Giter VIP home page Giter VIP logo

react-diagrams's Introduction

STORM React Diagrams

DEMO: http://www.projectstorm.io/react-diagrams

Latest Release Notes: http://dylanv.blog/2017/09/15/storm-react-diagrams-3-1-0/

A super simple, no-nonsense diagramming library written in React that just works.

Join the chat at https://gitter.im/projectstorm/react-diagrams NPM NPM

Demo2

Demo2

Demo2

Introduction

A no-nonsense diagramming library written entirely in React with the help of Lodash, and a single polyfill. It aims to be:

  • Simple, and void of any fuss/complications when implementing it into your own application
  • Customizable without having to hack the core (adapters/factories etc..)
  • Simple to operate and understand without sugar and magic
  • Fast and optimized to handle large diagrams with hundreds of nodes/links
  • Super easy to use, and should work as you expect it to

Roadmap

  • Move path logic associated with links into a base link class so we can easily extend links
  • Add more fault tolerance

How to install

npm install storm-react-diagrams

or

yarn add storm-react-diagrams

How to build

Simply run webpack in the root directory (or export NODE_ENV=production && webpack if you want a production build) and it will spit out the transpiled code and typescript definitions into the dist directory as a single file. It will also compile the code for the demos .We use webpack for this because TSC cannot compile a single UMD file (TSC can currently only output multiple UMD files).

NOTE: We turn off name mangeling in production builds because we require class names to be left intact when serializing.

Make your own nodes

To see how to create your own nodes like the one below, take a look at demo3:

Demo2

How does it work

The library uses a Model Graph to represent the virtual diagram and then renders the diagram using 2 layers:

  • Node Layer -> which is responsible for rendering nodes as HTML components
  • Link Layer -> which renders the links as SVG paths

Each node and link is fed into a factory that then generates the corresponding node or link react widget. Therefore, to create custom nodes and links, register your own factories that return your own widgets.

As long as a node contains at least one port and the corresponding NodeWidget contains at least one PortWidget, a link can be connected to it.

Events

Event System

Questions

Questions

Usage

Delete removes any selected items Delete

Shift + Mouse Drag triggers a multi-selection box Shift + Mouse Drag

Shift + Mouse Click selects the item (items can be multi-selected) Shift + Mouse Click

Mouse Drag drags the entire diagram Mouse Drag

Mouse Wheel zooms the diagram in / out Mouse Wheel

Click Link + Drag creates a new link point Click Link + Drag

Click Node Port + Drag creates a new link Click Node Port + Drag

react-diagrams's People

Contributors

dylanvorster avatar gen4sp avatar drummerhead avatar mylesbell avatar gothy avatar chlumper avatar schlesiger avatar mwozniczak avatar gitter-badger avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.