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 🙏

© 2025 – Pkg Stats / Ryan Hefner

mind-graph-js

v0.1.2

Published

A pure Vanilla JS graph component based on canvas, written in Typescript.

Downloads

19

Readme

MindGraph.js

A pure Vanilla JS graph component based on canvas, written in Typescript.

Demo here

Currently under construction, not recommended for production environment.

Features

  1. no 3rd-party dependencies.
  2. single canvas rendering.
  3. support common mouse & keyboard interactions out of the box.
  4. full js API support for graph manipulation.

Installation

npm install mind-graph-js --save

or

yarn add mind-graph-js

Usage

  1. import mindGraph.
import mindGraph from 'mind-graph-js';
  1. create a new MindMap instance, which takes a dom element as the canvas container, then render it.
const dom = document.getElementById('app');
const mindMap = new mindGraph.MindMap(dom);
mindMap.render();
  1. node operations are based on node ids, to add our first node, we need to aquire the root node id.
const rootId = mindMap.rootId;
  1. call addNode, which will return the id of the added node for future operations.
const nodeId = mindMap.addNode(rootId, 'first node');
  1. all MindMap's instance methods are as follows:

method | description ------ | ----------- addNode(parentId: number, text?: string, position?: number): number | add a node to it's parent, return new node's id. deleteNode(nodeId: number): number | delete a node by id, return it's parent's id. updateNode(nodeId: number, text: string) | update a node's text. copyNode(nodeId: number) | copy a node by id. cutNode(nodeId: number) | cut a node by id. pasteNode(parentId: number) | paste the copied node to a specified parent. toJson(): MapJson | export current graph to json. loadJson(json: MapJson) | reconstruct current graph by json. 6. default mouse & keyboard interactions:

  • Drag empty space to pan.
  • Use mouse wheel to scroll vertically.
  • Hold "Ctrl" and use mouse wheel to zoom.
  • Click a node to select it.
  • Double click a node to edit it's text.
  • Drag & drop a node to change it's position
  • "Ctrl + C" to copy the selected node.
  • "Ctrl + X" to cut the selected node.
  • "Ctrl + V" to paste copied node to the selected node.

*for Mac, "Cmd" key and "Ctrl" key work the same