@html-graph/html-graph 0.0.61 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,23 +6,14 @@
6
6
 
7
7
  ![CI](https://github.com/html-graph/html-graph/actions/workflows/ci.yml/badge.svg?branch=master)
8
8
 
9
- <a target="_blank" href="https://html-graph.github.io/use-cases/020-advanced-demo/index.html">
9
+ <a target="_blank" href="https://html-graph.github.io/use-cases/020-advanced-demo/">
10
10
  <img width="100%" src="https://raw.githubusercontent.com/html-graph/html-graph/master/media/full-demo.gif"/>
11
11
  </a>
12
12
 
13
13
  Instead of connecting nodes directly this library uses concept of ports, which provide greater fexibility at managing edges.
14
14
  Port is an entity of a node to which edge can be attached to.
15
15
 
16
- Visit <a target="_blank" href="https://html-graph.github.io/use-cases">use cases</a> and [use cases implementation](use-cases).
17
-
18
- ## Features:
19
-
20
- - easy nodes customization using HTML
21
- - wide configuration options out of the box
22
- - draggable and scalable canvas with draggable nodes
23
- - exhaustive set of use cases
24
- - typescript support
25
- - mobile devices support
16
+ Visit <a target="_blank" href="https://html-graph.github.io/use-cases/">use cases</a> and [use cases implementation](use-cases).
26
17
 
27
18
  ## Getting started:
28
19
 
@@ -33,18 +24,6 @@ npm i @html-graph/html-graph
33
24
  ```javascript
34
25
  import { HtmlGraphBuilder } from "@html-graph/html-graph";
35
26
 
36
- const canvas = new HtmlGraphBuilder()
37
- .setOptions({
38
- edges: {
39
- shape: {
40
- hasTargetArrow: true,
41
- },
42
- },
43
- })
44
- .setUserDraggableNodes()
45
- .setUserTransformableCanvas()
46
- .build();
47
-
48
27
  function createNode({ name, x, y, frontPortId, backPortId }) {
49
28
  const node = document.createElement("div");
50
29
  const text = document.createElement("div");
@@ -71,20 +50,33 @@ function createNode({ name, x, y, frontPortId, backPortId }) {
71
50
  };
72
51
  }
73
52
 
53
+ const canvas = new HtmlGraphBuilder()
54
+ .setOptions({
55
+ edges: {
56
+ shape: {
57
+ hasTargetArrow: true,
58
+ },
59
+ },
60
+ })
61
+ .setUserDraggableNodes()
62
+ .setUserTransformableCanvas()
63
+ .setResizeReactiveNodes()
64
+ .build();
65
+
74
66
  const node1 = createNode({
75
67
  name: "Node 1",
76
68
  x: 200,
77
69
  y: 400,
78
- frontPortId: "port-1-1",
79
- backPortId: "port-1-2",
70
+ frontPortId: "node-1-in",
71
+ backPortId: "node-1-out",
80
72
  });
81
73
 
82
74
  const node2 = createNode({
83
75
  name: "Node 2",
84
76
  x: 600,
85
77
  y: 500,
86
- frontPortId: "port-2-1",
87
- backPortId: "port-2-2",
78
+ frontPortId: "node-2-in",
79
+ backPortId: "node-2-out",
88
80
  });
89
81
 
90
82
  const canvasElement = document.getElementById("canvas");
@@ -93,20 +85,15 @@ canvas
93
85
  .attach(canvasElement)
94
86
  .addNode(node1)
95
87
  .addNode(node2)
96
- .addEdge({ from: "port-1-2", to: "port-2-1" });
97
- ```
98
-
99
- ## Run use cases
100
-
101
- ```
102
- npm install
103
- npm run start
88
+ .addEdge({ from: "node-1-out", to: "node-2-in" });
104
89
  ```
105
90
 
106
- or
107
-
108
- ```
109
- docker compose up
110
- ```
91
+ ## Features:
111
92
 
112
- Open `http://localhost:3100`
93
+ - easy nodes customization using HTML
94
+ - wide configuration options out of the box
95
+ - draggable and scalable canvas
96
+ - draggable and resize responsive nodes
97
+ - exhaustive set of use cases
98
+ - typescript support
99
+ - mobile devices support