npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hexkit

v1.0.5

Published

Hex Kit is a desktop application built on modern webapp technologies: React, Redux, and Electron. Hex Kit has it's own internal API (Redux actions) that can be used by 3rd-party plugins. With a little Javascript, new functionality (custom painting tools,

Downloads

12

Readme

Introduction

Hex Kit is a desktop application built on modern webapp technologies: React, Redux, and Electron. Hex Kit has it's own internal API (Redux actions) that can be used by 3rd-party plugins. With a little Javascript, new functionality (custom painting tools, generators, etc) can be added to Hex Kit.

Tiles

Hex Kit uses a URI scheme to define tiles and tilesets. The schema of the URI is the name of tileset, and the subsequent path can point to a specific file or folder in the directory structure of the tileset, i.e.:

HK-Fantasyland://HK - Wasteland/

or:

HK-Fantasyland://HK - Grass/HK_grass_003.png

The former will randomly paint from all tiles in the HK - Wasteland folder, while the latter will specifically paint the HK_grass_003.png tile.

Coordinates

Hex Kit uses the offset coordinate system to designate the location of tiles. Starting in the top-left corner, the tile is designated by it's row and column. The coordinate values increase as the location moves right and downward. Red Blob Games has an execellent tutorial on the ins-and-outs of hexagon math.

0,0   0,1   0,2
   1,0   1,1   1,2
2,0   2,1   2,2   

Installing the API

The Hex Kit API library is available to be installed via NPM.

npm add hex-kit

Calling the API

Hex Kit uses the Redux action pattern for making changes to the map. First, you'll want to create a "store" to send actions to:

import { createStore } from 'hexkit'

let store = createStore()

Then to paint a new tile, you want to dispatch an action via the paintTiles method:

import { paintTiles } from 'hex-kit'

store.dispatch(paintTiles([{
    coord: { x: 0, y: 0 },
    layer: 0,
    uri: 'HK-Fantasyland://HK - Wasteland/'
}])

Observing the App

The app state is inspectable as well. Use the 'getState' member of the store to get a snapshot of the current map and state of the app.

let state = store.getState()

console.log(state.map.layers[0].tiles[0])

The Redux store is often automatically relayed to a React app, like so:

import { createStore } from 'hex-kit'
import * as React from 'react'
import * as ReactDOM from 'react-dom'
import { connect } from 'react-redux' 

let store = createStore()

class MyPluginComponent extends React.Component {
    render() {
        return <div>
            The first tile's URI is {state.map.layers[0].tiles[0].source}
        </div>
    }
}

let MyPlugin = connect(state => state)(MyPluginComponent)

ReactDOM.render(
    <Provider store={store}><MyPlugin /><Provider>,
    document.getElementById('myplugin'))