MCPcopy Index your code
hub / github.com/projectstorm/react-diagrams

github.com/projectstorm/react-diagrams @7.1.3 sqlite

repository ↗ · DeepWiki ↗ · release 7.1.3 ↗
927 symbols 2,224 edges 154 files 20 documented · 2%
README

Introduction

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

DEMO: http://projectstorm.cloud/react-diagrams

DOCS (wip) https://projectstorm.gitbook.io/react-diagrams

Docs are currently being worked on, along with a migration path.

What

A flow & process orientated diagramming library inspired by Blender, Labview and Unreal engine.

  • Modern Codebase written entirely in Typescript and React, the library makes use of powerful generics, advanced software engineering principles and is broken up into multiple modules.
  • Hackable and extensible the entire library including its core can be extended, rewired and re-assembled into fundamentally different software to suit your own software needs.
  • HTML nodes as a first class citizen the library was originally written to represent advanced dynamic nodes, that are difficult to represent as SVG's due to complex input requirements ux requirements.
  • Designed for process the library is aimed for software engineers that want to rewire their programs at runtime, and that want to make their software more dynamic.
  • Fast diagram editing the defaults provided give the highest priority to editing diagrams as fast as possible.

Gallery

Example implementation using custom models: (Dylan's personal code)

Personal Project

Get started with the default models right out of the box:

Installing

For all the bells and whistles:

yarn add @projectstorm/react-diagrams

This includes all the packages listed below (and works (mostly and conceptually) like it used to in version 5.0)

A more modular approach

This library now has a more modular design and you can import just the core (contains no default factories or routing)

yarn add @projectstorm/react-diagrams-core

this is built ontop of the evolving react-canvas-core library

yarn add @projectstorm/react-canvas-core

which makes use of

yarn add @projectstorm/geometry

and of course, you can add some extras:

yarn add @projectstorm/react-diagrams-defaults
yarn add @projectstorm/react-diagrams-routing

How to use

Before running any of the examples, please run pnpm build in the root. This project is a monorepo, and the packages (including the demos) require the packages to first be built.

Take a look at the diagram demos

or

Take a look at the demo project which contains an example for ES6 as well as Typescript

or

Checkout the docs

Run the demos

After running pnpm install and pnpm build, you must then run: cd diagrams-demo-gallery && pnpm run start

Building from source

Simply run pnpm then pnpm build or pnpm build:prod in the root directory and it will spit out the transpiled code and typescript definitions into the dist directory as a single file.

Built with react-diagrams

Do you have an interesting project built with react-diagrams? PR it into this section for others to see.

Extension points exported contracts — how you extend this code

ModelGeometryInterface (Interface)
(no doc) [7 implementers]
packages/react-canvas-core/src/core/ModelGeometryInterface.ts
DefaultLinkModelListener (Interface)
(no doc)
packages/react-diagrams-defaults/src/link/DefaultLinkModel.ts
DragNewLinkStateOptions (Interface)
(no doc)
packages/react-diagrams-core/src/states/DragNewLinkState.ts
PathFindingLinkWidgetProps (Interface)
(no doc)
packages/react-diagrams-routing/src/link/PathFindingLinkWidget.tsx
BodyWidgetProps (Interface)
(no doc)
diagrams-demo-project/src/BodyWidget.tsx
DiamondNodeModelGenerics (Interface)
(no doc)
diagrams-demo-gallery/demos/demo-custom-node1/DiamondNodeModel.ts
CanvasEngineListener (Interface)
(no doc)
packages/react-canvas-core/src/CanvasEngine.ts
DefaultLinkModelOptions (Interface)
(no doc)
packages/react-diagrams-defaults/src/link/DefaultLinkModel.ts

Core symbols most depended-on inside this repo

setPosition
called by 102
packages/react-diagrams-core/src/entities/port/PortModel.ts
getID
called by 57
packages/react-canvas-core/src/core-models/BaseEntity.ts
getModel
called by 46
packages/react-canvas-core/src/core-models/BaseEntity.ts
getX
called by 41
packages/react-canvas-core/src/core-models/BasePositionModel.ts
getY
called by 40
packages/react-canvas-core/src/core-models/BasePositionModel.ts
link
called by 36
packages/react-diagrams-defaults/src/port/DefaultPortModel.ts
addPort
called by 32
packages/react-diagrams-core/src/entities/node/NodeModel.ts
getOptions
called by 32
packages/react-canvas-core/src/core-models/BaseEntity.ts

Shape

Method 542
Class 228
Interface 98
Function 55
Enum 4

Languages

TypeScript100%

Modules by API surface

packages/react-diagrams-core/src/entities/link/LinkModel.ts38 symbols
packages/react-canvas-core/src/entities/canvas/CanvasModel.ts29 symbols
packages/react-diagrams-core/src/DiagramEngine.ts26 symbols
packages/react-diagrams-core/src/entities/port/PortModel.ts25 symbols
packages/react-canvas-core/src/CanvasEngine.ts23 symbols
packages/react-diagrams-core/src/models/DiagramModel.ts22 symbols
packages/react-canvas-core/src/core-models/BaseModel.ts20 symbols
packages/react-canvas-core/src/core-models/BaseEntity.ts20 symbols
packages/react-diagrams-core/src/entities/node/NodeModel.ts19 symbols
packages/geometry/src/Rectangle.ts18 symbols
diagrams-demo-gallery/demos/demo-custom-link1/index.tsx17 symbols
diagrams-demo-gallery/demos/demo-custom-link2/index.tsx16 symbols

Dependencies from manifests, versioned

@babel/core7.22.20 · 1×
@babel/preset-env7.22.20 · 1×
@babel/preset-react7.22.15 · 1×
@babel/preset-typescript7.22.15 · 1×
@changesets/cli2.26.2 · 1×
@emotion/react11.11.1 · 1×
@emotion/styled11.* · 1×
@projectstorm/geometryworkspace:* · 1×
@projectstorm/react-canvas-coreworkspace:* · 1×
@projectstorm/react-diagrams-coreworkspace:* · 1×
@projectstorm/react-diagrams-defaultsworkspace:* · 1×

For agents

$ claude mcp add react-diagrams \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact