@html-graph/html-graph 0.1.2 → 0.1.4
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 +20 -34
- package/dist/main.d.ts +4 -4
- package/dist/main.js +451 -441
- package/dist/main.umd.cjs +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
### Graph visualization library that enables nodes customization using HTML
|
|
6
6
|
|
|
7
|
-

|
|
8
|
-
|
|
9
7
|
<a target="_blank" href="https://html-graph.github.io/use-cases/020-advanced-demo/">
|
|
10
8
|
<img width="100%" src="https://raw.githubusercontent.com/html-graph/html-graph/master/media/full-demo.gif"/>
|
|
11
9
|
</a>
|
|
12
10
|
|
|
13
11
|
Instead of connecting nodes directly this library uses concept of ports, which provide greater fexibility at managing edges.
|
|
14
|
-
Port is an entity of a node to which
|
|
12
|
+
Port is an entity of a node to which edges can be attached to.
|
|
15
13
|
|
|
16
14
|
Visit <a target="_blank" href="https://html-graph.github.io/use-cases/">use cases</a> and [use cases implementation](use-cases).
|
|
17
15
|
|
|
@@ -63,37 +61,25 @@ const canvas = new HtmlGraphBuilder()
|
|
|
63
61
|
.setResizeReactiveNodes()
|
|
64
62
|
.build();
|
|
65
63
|
|
|
66
|
-
const node1 = createNode({
|
|
67
|
-
name: "Node 1",
|
|
68
|
-
x: 200,
|
|
69
|
-
y: 400,
|
|
70
|
-
frontPortId: "node-1-in",
|
|
71
|
-
backPortId: "node-1-out",
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const node2 = createNode({
|
|
75
|
-
name: "Node 2",
|
|
76
|
-
x: 600,
|
|
77
|
-
y: 500,
|
|
78
|
-
frontPortId: "node-2-in",
|
|
79
|
-
backPortId: "node-2-out",
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
const canvasElement = document.getElementById("canvas");
|
|
83
|
-
|
|
84
64
|
canvas
|
|
85
|
-
.attach(
|
|
86
|
-
.addNode(
|
|
87
|
-
|
|
65
|
+
.attach(document.getElementById("canvas"))
|
|
66
|
+
.addNode(
|
|
67
|
+
createNode({
|
|
68
|
+
name: "Node 1",
|
|
69
|
+
x: 200,
|
|
70
|
+
y: 400,
|
|
71
|
+
frontPortId: "node-1-in",
|
|
72
|
+
backPortId: "node-1-out",
|
|
73
|
+
}),
|
|
74
|
+
)
|
|
75
|
+
.addNode(
|
|
76
|
+
createNode({
|
|
77
|
+
name: "Node 2",
|
|
78
|
+
x: 600,
|
|
79
|
+
y: 500,
|
|
80
|
+
frontPortId: "node-2-in",
|
|
81
|
+
backPortId: "node-2-out",
|
|
82
|
+
}),
|
|
83
|
+
)
|
|
88
84
|
.addEdge({ from: "node-1-out", to: "node-2-in" });
|
|
89
85
|
```
|
|
90
|
-
|
|
91
|
-
## Features:
|
|
92
|
-
|
|
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
|
package/dist/main.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ declare interface AddPortRequest {
|
|
|
42
42
|
readonly direction: number;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export declare type
|
|
45
|
+
export declare type BeforeTransformChangeFn = () => void;
|
|
46
46
|
|
|
47
47
|
export declare interface BezierEdgeParams {
|
|
48
48
|
readonly color?: string | undefined;
|
|
@@ -576,7 +576,7 @@ declare interface StraightEdgeShape_2 {
|
|
|
576
576
|
readonly detourDirection?: number;
|
|
577
577
|
}
|
|
578
578
|
|
|
579
|
-
export declare type
|
|
579
|
+
export declare type TransformChangeFn = () => void;
|
|
580
580
|
|
|
581
581
|
export declare interface TransformOptions {
|
|
582
582
|
readonly scale?: {
|
|
@@ -587,8 +587,8 @@ export declare interface TransformOptions {
|
|
|
587
587
|
};
|
|
588
588
|
readonly transformPreprocessor?: TransformPreprocessorOption | TransformPreprocessorOption[];
|
|
589
589
|
readonly events?: {
|
|
590
|
-
readonly
|
|
591
|
-
readonly
|
|
590
|
+
readonly onBeforeTransformChange?: BeforeTransformChangeFn;
|
|
591
|
+
readonly onTransformChange?: TransformChangeFn;
|
|
592
592
|
};
|
|
593
593
|
}
|
|
594
594
|
|