@html-graph/html-graph 4.0.0 → 5.0.0

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
@@ -1,92 +1,11 @@
1
- <h1>
2
- <img src="/media/favicon.png" alt="HTMLGraph" width="25" height="25"/> HTMLGraph
3
- </h1>
4
-
5
- ### Graph visualization library that enables rich nodes customization using HTML
1
+ <p align="center">
2
+ <img src="/media/logo-label.svg" alt="HTMLGraph" width="520" height="100"/>
3
+ </p>
6
4
 
7
5
  <a target="_blank" href="https://html-graph.github.io/use-cases/advanced-demo/">
8
6
  <img width="100%" src="https://raw.githubusercontent.com/html-graph/html-graph/master/media/full-demo.gif"/>
9
7
  </a>
10
8
 
11
- Visit the <a target="_blank" href="https://html-graph.github.io">DOCUMENTATION</a> for more details.
12
-
13
- ## Getting started:
14
-
15
- ```
16
- npm i @html-graph/html-graph
17
- ```
18
-
19
- ```javascript
20
- import { CanvasBuilder } from "@html-graph/html-graph";
21
-
22
- class Application {
23
- constructor(element) {
24
- this.canvas = new CanvasBuilder(element)
25
- .setDefaults({
26
- edges: {
27
- shape: {
28
- hasTargetArrow: true,
29
- },
30
- },
31
- })
32
- .enableUserDraggableNodes()
33
- .enableUserTransformableViewport()
34
- .enableBackground()
35
- .build();
36
- }
37
-
38
- initGraph() {
39
- this.canvas
40
- .addNode(
41
- this.createNode({
42
- name: "Node 1",
43
- x: 200,
44
- y: 400,
45
- frontPortId: "node-1-in",
46
- backPortId: "node-1-out",
47
- }),
48
- )
49
- .addNode(
50
- this.createNode({
51
- name: "Node 2",
52
- x: 600,
53
- y: 500,
54
- frontPortId: "node-2-in",
55
- backPortId: "node-2-out",
56
- }),
57
- )
58
- .addEdge({ from: "node-1-out", to: "node-2-in" });
59
- }
60
-
61
- createNode({ name, x, y, frontPortId, backPortId }) {
62
- const nodeElement = document.createElement("div");
63
- const text = document.createElement("div");
64
- const frontPortElement = document.createElement("div");
65
- const backPortElement = document.createElement("div");
66
-
67
- nodeElement.classList.add("node");
68
- frontPortElement.classList.add("port");
69
- backPortElement.classList.add("port");
70
- text.innerText = name;
71
-
72
- nodeElement.appendChild(frontPortElement);
73
- nodeElement.appendChild(text);
74
- nodeElement.appendChild(backPortElement);
75
-
76
- return {
77
- element: nodeElement,
78
- x: x,
79
- y: y,
80
- ports: [
81
- { id: frontPortId, element: frontPortElement },
82
- { id: backPortId, element: backPortElement },
83
- ],
84
- };
85
- }
86
- }
87
-
88
- const element = document.getElementById("canvas");
89
- const app = new Application(element);
9
+ ### Graph visualization library that enables rich nodes customization using HTML
90
10
 
91
- app.initGraph();
92
- ```
11
+ Visit the <a target="_blank" href="https://html-graph.github.io">DOCUMENTATION</a> for examples and API reference.