@html-graph/html-graph 0.1.3 → 0.1.5
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 -22
- package/dist/main.d.ts +12 -10
- package/dist/main.js +297 -287
- package/dist/main.umd.cjs +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</a>
|
|
10
10
|
|
|
11
11
|
Instead of connecting nodes directly this library uses concept of ports, which provide greater fexibility at managing edges.
|
|
12
|
-
Port is an entity of a node to which
|
|
12
|
+
Port is an entity of a node to which edges can be attached to.
|
|
13
13
|
|
|
14
14
|
Visit <a target="_blank" href="https://html-graph.github.io/use-cases/">use cases</a> and [use cases implementation](use-cases).
|
|
15
15
|
|
|
@@ -61,27 +61,25 @@ const canvas = new HtmlGraphBuilder()
|
|
|
61
61
|
.setResizeReactiveNodes()
|
|
62
62
|
.build();
|
|
63
63
|
|
|
64
|
-
const node1 = createNode({
|
|
65
|
-
name: "Node 1",
|
|
66
|
-
x: 200,
|
|
67
|
-
y: 400,
|
|
68
|
-
frontPortId: "node-1-in",
|
|
69
|
-
backPortId: "node-1-out",
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const node2 = createNode({
|
|
73
|
-
name: "Node 2",
|
|
74
|
-
x: 600,
|
|
75
|
-
y: 500,
|
|
76
|
-
frontPortId: "node-2-in",
|
|
77
|
-
backPortId: "node-2-out",
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const canvasElement = document.getElementById("canvas");
|
|
81
|
-
|
|
82
64
|
canvas
|
|
83
|
-
.attach(
|
|
84
|
-
.addNode(
|
|
85
|
-
|
|
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
|
+
)
|
|
86
84
|
.addEdge({ from: "node-1-out", to: "node-2-in" });
|
|
87
85
|
```
|
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;
|
|
@@ -244,7 +244,11 @@ declare type CustomPriority = PriorityFn;
|
|
|
244
244
|
|
|
245
245
|
export declare interface DragOptions {
|
|
246
246
|
readonly moveOnTop?: boolean;
|
|
247
|
-
readonly
|
|
247
|
+
readonly mouse?: {
|
|
248
|
+
readonly dragCursor?: string | null;
|
|
249
|
+
readonly mouseDownEventValidator?: (event: MouseEvent) => boolean;
|
|
250
|
+
readonly mouseUpEventValidator?: (event: MouseEvent) => boolean;
|
|
251
|
+
};
|
|
248
252
|
readonly events?: {
|
|
249
253
|
readonly onNodeDrag?: (payload: NodeDragPayload) => void;
|
|
250
254
|
readonly onBeforeNodeDrag?: (payload: NodeDragPayload) => boolean;
|
|
@@ -576,7 +580,7 @@ declare interface StraightEdgeShape_2 {
|
|
|
576
580
|
readonly detourDirection?: number;
|
|
577
581
|
}
|
|
578
582
|
|
|
579
|
-
export declare type
|
|
583
|
+
export declare type TransformChangeFn = () => void;
|
|
580
584
|
|
|
581
585
|
export declare interface TransformOptions {
|
|
582
586
|
readonly scale?: {
|
|
@@ -587,8 +591,10 @@ export declare interface TransformOptions {
|
|
|
587
591
|
};
|
|
588
592
|
readonly transformPreprocessor?: TransformPreprocessorOption | TransformPreprocessorOption[];
|
|
589
593
|
readonly events?: {
|
|
590
|
-
readonly
|
|
591
|
-
readonly onTransformFinished?:
|
|
594
|
+
readonly onTransformStarted?: () => void;
|
|
595
|
+
readonly onTransformFinished?: () => void;
|
|
596
|
+
readonly onBeforeTransformChange?: BeforeTransformChangeFn;
|
|
597
|
+
readonly onTransformChange?: TransformChangeFn;
|
|
592
598
|
};
|
|
593
599
|
}
|
|
594
600
|
|
|
@@ -650,9 +656,6 @@ export declare class UserDraggableNodesCanvas implements Canvas {
|
|
|
650
656
|
private maxNodePriority;
|
|
651
657
|
private readonly nodes;
|
|
652
658
|
private grabbedNodeId;
|
|
653
|
-
private onNodeDrag;
|
|
654
|
-
private onBeforeNodeDrag;
|
|
655
|
-
private onNodeDragFinished;
|
|
656
659
|
private readonly nodeIdGenerator;
|
|
657
660
|
private element;
|
|
658
661
|
private readonly onWindowMouseMove;
|
|
@@ -660,9 +663,8 @@ export declare class UserDraggableNodesCanvas implements Canvas {
|
|
|
660
663
|
private readonly onWindowTouchMove;
|
|
661
664
|
private readonly onWindowTouchFinish;
|
|
662
665
|
private previousTouchCoords;
|
|
663
|
-
private readonly freezePriority;
|
|
664
666
|
private readonly window;
|
|
665
|
-
private readonly
|
|
667
|
+
private readonly options;
|
|
666
668
|
constructor(canvas: Canvas, dragOptions?: DragOptions);
|
|
667
669
|
attach(element: HTMLElement): UserDraggableNodesCanvas;
|
|
668
670
|
detach(): UserDraggableNodesCanvas;
|