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

@hanica-dwa/diagram-library

v1.3.0

Published

Library for creating collaborative diagram drawing tools.

Readme

npm version

Diagram Engine library

Description

This library allows application developers to create collaborative drawing tools. This library is a ReactJS component library with pre-defined building blocks like a Canvas and Palette.

This library supports shapes that have been created by using Konva.js, and functionality to work collaborative through running operations on a ShareDB server. For this library to work collaborative, a ShareDB server has been made. It uses websockets to connect to clients and uses a mongo database to persist its data.

Supported models

Installation

The diagram-library is available on NPM and can be installed with either npm or yarn. This will allow you to use it in your own collaborative diagram drawing application.

Install with NPM:

$ npm install @hanica-dwa/diagram-library

Install with Yarn:

$ yarn add @hanica-dwa/diagram-library

Reference

Use Diagram engine

Diagram engine

To use the diagram engine, import the Diagram Engine and call the React component <DiagramEngine />. This will render a Canvas and a Palette. The diagram needs three arguments: width, height and an id. From here it is possible to create a local diagram.

import DiagramEngine from '@hanica-dwa/diagram-library';

const app = () => {
  return (
    <DiagramEngine width={1000} height={750} id={`UUID`}/>  
  )
}

Import and export data structure

It is possible to import and export the state of the shapes in a diagram from the library.

  • importDataStructure | Import the shapes from the library and render them in the canvas.
  • exportDataStructure | Export the shapes from the application to the library. Useful when create and subscribe to a diagram
import { importDataStructure, exportDataStructure } from '@hanica-dwa/diagram-library';

Sample of data structure which is validated in the library

{
shapes: {
  kjasdkl: {
    id: 'kjasdkl',
    type: 'rectangle',
    top: 0,
    left: 0,
    height: 400,
    width: 600,
    relation: undefined,
    customData: {},
    {shapeOwner: null, transformLock: false, contentOwner: null, contentLock: false}  },
},
};

Subscriptions

Subscribing to a document will allow the diagram library to process changes made by the user and allow the library to process updates from other collaborators.

import {
  subscribeAndCreateOnDocument,
  subscribeOnDocument,
  unsubscribeOnDocument,
  copyDocument,
} from '@hanica-dwa/diagram-library';
  • subscribeAndCreateOnDocument('UUID') | Create a diagram and subscribe on a document to make it possible for collaboration. From this moment multiple users can editing on that diagram. The UUID parameter, provided by the application is the ID of a canvas.

  • subscribeOnDocument('UUID') | Subscribe on document with a given UUID. When a user is subscribed, he can start editing the diagram collaborative with other users.

  • copyDocument('UUID') | The copyDocument function allows you to create a local copy of a shared diagram.

  • unsubscribeOnDocument | Unsubscribe on a document. This will close the connection to shareDB and changes will not be saved by the library.

This library is still in development.