0.0.9 โ€ข Published 8 months ago

nodeflow-lib v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

NodeFlow GitHub activity Static Badge

A library that aims to provide everything needed for making flowcharts, graphs, diagrams, and other similar things using a simple and intuitive API.\ Currently, NodeFlow is built using SolidJS, but there are plans to make it framework-agnostic in the future.

Features

  • ๐Ÿ” Zooming and panning
  • ๐Ÿคš Dragging, selecting, and connecting nodes
  • ๐ŸŽจ Fully customizable styling for every element (nodes, connectors, connector-sections, etc.)
  • ๐Ÿ“ฆ Customizable node content
  • ๐Ÿ“’ History (undo/redo)
  • โคต๏ธ Connection curves

Installation

npm install nodeflow

Usage

๐Ÿ“š The Wiki page covers most of the features of NodeFlow.

Below is a simple example that covers adding 2 nodes and connecting them:

import { NodeflowLib } from "nodeflow-lib";

// Create a canvas with id "main".
// nodeflowData contains the data of the canvas
// Nodeflow is the canvas element (currently a SolidJS component)
const [nodeflowData, Nodeflow] = NodeflowLib.get().createCanvas("main");

// create the nodes
const sourceNode = nodeflowData.addNode({
  position: { x: 100, y: 100 },
  content: (nodeData) => <div>{nodeData.position}</div>,
});
const destinationNode = nodeflowData.addNode({
  position: { x: 400, y: 400 },
  content: (nodeData) => <div>Node 2!</div>,
});

// add a connector section to the nodes
const outputSection = sourceNode.addConnectorSection({ id: "output" });
const inputSection = node2.addConnectorSection({ id: "input" });

// add a connector to each connector section
outputSection.addConnector({ id: "source-connector" });
connectorSection2.addConnector({ id: "target-connector" });

// connect the connectors
nodeflowData.addConnection({
  sourceNodeId: sourceNode.id,
  sourceConnectorId: "source-connector",
  destinationNodeId: destinationNode.id,
  destinationConnectorId: "target-connector",
});

For rendering the canvas, you just use the Nodeflow component:

<Nodeflow width="800px" height="800px" />

Examples

There are 2 example projects: ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ a FamilyTree App and ๐Ÿ“˜ a Blueprint App.\ You can check them out in action here.

0.0.9

8 months ago

0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.1-a12

1 year ago

0.0.1-a13

1 year ago

0.0.1-a10

1 year ago

0.0.1-a11

1 year ago

0.0.1-a16

1 year ago

0.0.1-a14

1 year ago

0.0.1-a15

1 year ago

0.0.1

1 year ago

0.0.2

1 year ago

0.0.1-a9

1 year ago

0.0.1-a2

1 year ago

0.0.1-a4

1 year ago

0.0.1-a3

1 year ago

0.0.1-a6

1 year ago

0.0.1-a5

1 year ago

0.0.1-a8

1 year ago

0.0.1-a7

1 year ago

0.0.1-a1

1 year ago