@html-graph/html-graph 4.0.0 → 4.1.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 +1 -76
- package/dist/html-graph.d.ts +143 -133
- package/dist/html-graph.js +166 -154
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,85 +8,10 @@
|
|
|
8
8
|
<img width="100%" src="https://raw.githubusercontent.com/html-graph/html-graph/master/media/full-demo.gif"/>
|
|
9
9
|
</a>
|
|
10
10
|
|
|
11
|
-
Visit the <a target="_blank" href="https://html-graph.github.io">DOCUMENTATION</a> for more details.
|
|
12
|
-
|
|
13
11
|
## Getting started:
|
|
14
12
|
|
|
15
13
|
```
|
|
16
14
|
npm i @html-graph/html-graph
|
|
17
15
|
```
|
|
18
16
|
|
|
19
|
-
|
|
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);
|
|
90
|
-
|
|
91
|
-
app.initGraph();
|
|
92
|
-
```
|
|
17
|
+
Visit the <a target="_blank" href="https://html-graph.github.io">DOCUMENTATION</a> for examples and API reference.
|
package/dist/html-graph.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export declare interface AddEdgeRequest {
|
|
2
|
-
readonly id?:
|
|
3
|
-
readonly from:
|
|
4
|
-
readonly to:
|
|
2
|
+
readonly id?: Identifier | undefined;
|
|
3
|
+
readonly from: Identifier;
|
|
4
|
+
readonly to: Identifier;
|
|
5
5
|
readonly shape?: EdgeShape | undefined;
|
|
6
6
|
readonly priority?: number | undefined;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
declare interface AddEdgeRequest_2 {
|
|
10
|
-
readonly id:
|
|
11
|
-
readonly from:
|
|
12
|
-
readonly to:
|
|
10
|
+
readonly id: Identifier;
|
|
11
|
+
readonly from: Identifier;
|
|
12
|
+
readonly to: Identifier;
|
|
13
13
|
readonly shape: EdgeShape;
|
|
14
14
|
readonly priority: number;
|
|
15
15
|
}
|
|
@@ -17,7 +17,7 @@ declare interface AddEdgeRequest_2 {
|
|
|
17
17
|
export declare type AddNodePorts = Iterable<MarkNodePortRequest>;
|
|
18
18
|
|
|
19
19
|
export declare interface AddNodeRequest {
|
|
20
|
-
readonly id?:
|
|
20
|
+
readonly id?: Identifier;
|
|
21
21
|
readonly element: HTMLElement;
|
|
22
22
|
readonly x: number;
|
|
23
23
|
readonly y: number;
|
|
@@ -27,7 +27,7 @@ export declare interface AddNodeRequest {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
declare interface AddNodeRequest_2 {
|
|
30
|
-
readonly id:
|
|
30
|
+
readonly id: Identifier;
|
|
31
31
|
readonly element: HTMLElement;
|
|
32
32
|
readonly x: number;
|
|
33
33
|
readonly y: number;
|
|
@@ -36,8 +36,8 @@ declare interface AddNodeRequest_2 {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
declare interface AddPortRequest {
|
|
39
|
-
readonly id:
|
|
40
|
-
readonly nodeId:
|
|
39
|
+
readonly id: Identifier;
|
|
40
|
+
readonly nodeId: Identifier;
|
|
41
41
|
readonly element: HTMLElement;
|
|
42
42
|
readonly direction: number;
|
|
43
43
|
}
|
|
@@ -135,13 +135,13 @@ export declare class Canvas {
|
|
|
135
135
|
/**
|
|
136
136
|
* updates node parameters
|
|
137
137
|
*/
|
|
138
|
-
updateNode(nodeId:
|
|
138
|
+
updateNode(nodeId: Identifier, request?: UpdateNodeRequest): Canvas;
|
|
139
139
|
/**
|
|
140
140
|
* removes specified node
|
|
141
141
|
* all the ports of node get unmarked
|
|
142
142
|
* all the edges adjacent to node get removed
|
|
143
143
|
*/
|
|
144
|
-
removeNode(nodeId:
|
|
144
|
+
removeNode(nodeId: Identifier): Canvas;
|
|
145
145
|
/**
|
|
146
146
|
* marks specified element as a port for specified node
|
|
147
147
|
*/
|
|
@@ -149,12 +149,12 @@ export declare class Canvas {
|
|
|
149
149
|
/**
|
|
150
150
|
* updates port and edges attached to it
|
|
151
151
|
*/
|
|
152
|
-
updatePort(portId:
|
|
152
|
+
updatePort(portId: Identifier, request?: UpdatePortRequest): Canvas;
|
|
153
153
|
/**
|
|
154
154
|
* unmarks specified port
|
|
155
155
|
* all the edges adjacent to the port get removed
|
|
156
156
|
*/
|
|
157
|
-
unmarkPort(portId:
|
|
157
|
+
unmarkPort(portId: Identifier): Canvas;
|
|
158
158
|
/**
|
|
159
159
|
* adds new edge
|
|
160
160
|
*/
|
|
@@ -162,11 +162,11 @@ export declare class Canvas {
|
|
|
162
162
|
/**
|
|
163
163
|
* updates specified edge
|
|
164
164
|
*/
|
|
165
|
-
updateEdge(edgeId:
|
|
165
|
+
updateEdge(edgeId: Identifier, request?: UpdateEdgeRequest): Canvas;
|
|
166
166
|
/**
|
|
167
167
|
* removes specified edge
|
|
168
168
|
*/
|
|
169
|
-
removeEdge(edgeId:
|
|
169
|
+
removeEdge(edgeId: Identifier): Canvas;
|
|
170
170
|
/**
|
|
171
171
|
* applies transformation for viewport matrix
|
|
172
172
|
*/
|
|
@@ -203,7 +203,9 @@ export declare class CanvasBuilder {
|
|
|
203
203
|
private hasBackground;
|
|
204
204
|
private hasUserConnectablePorts;
|
|
205
205
|
private hasUserDraggableEdges;
|
|
206
|
-
private boxRenderingTrigger;
|
|
206
|
+
private readonly boxRenderingTrigger;
|
|
207
|
+
private readonly graphStore;
|
|
208
|
+
private readonly viewportStore;
|
|
207
209
|
private readonly window;
|
|
208
210
|
constructor(element: HTMLElement);
|
|
209
211
|
/**
|
|
@@ -313,9 +315,9 @@ export declare interface ConnectablePortsConfig {
|
|
|
313
315
|
readonly mouseUpEventVerifier?: MouseEventVerifier;
|
|
314
316
|
readonly dragPortDirection?: number | undefined;
|
|
315
317
|
readonly events?: {
|
|
316
|
-
readonly onAfterEdgeCreated?: (edgeId:
|
|
318
|
+
readonly onAfterEdgeCreated?: (edgeId: Identifier) => void;
|
|
317
319
|
readonly onEdgeCreationInterrupted?: (params: {
|
|
318
|
-
readonly staticPortId:
|
|
320
|
+
readonly staticPortId: Identifier;
|
|
319
321
|
readonly isDirect: boolean;
|
|
320
322
|
}) => void;
|
|
321
323
|
readonly onEdgeCreationPrevented?: (request: AddEdgeRequest) => void;
|
|
@@ -330,7 +332,7 @@ export declare enum ConnectionCategory {
|
|
|
330
332
|
|
|
331
333
|
export declare type ConnectionPreprocessor = (request: AddEdgeRequest) => AddEdgeRequest | null;
|
|
332
334
|
|
|
333
|
-
export declare type ConnectionTypeResolver = (portId:
|
|
335
|
+
export declare type ConnectionTypeResolver = (portId: Identifier) => "direct" | "reverse" | null;
|
|
334
336
|
|
|
335
337
|
declare type ConstantPriority = number;
|
|
336
338
|
|
|
@@ -381,7 +383,7 @@ declare interface DraggableEdgesConfig {
|
|
|
381
383
|
readonly draggingEdgeResolver?: DraggingEdgeResolver;
|
|
382
384
|
readonly draggingEdgeShape?: EdgeShapeConfig;
|
|
383
385
|
readonly events?: {
|
|
384
|
-
readonly onAfterEdgeReattached?: (edgeId:
|
|
386
|
+
readonly onAfterEdgeReattached?: (edgeId: Identifier) => void;
|
|
385
387
|
readonly onEdgeReattachInterrupted?: (edge: GraphEdge) => void;
|
|
386
388
|
readonly onEdgeReattachPrevented?: (request: AddEdgeRequest) => void;
|
|
387
389
|
};
|
|
@@ -391,32 +393,25 @@ export declare interface DraggableNodesConfig {
|
|
|
391
393
|
readonly moveOnTop?: boolean;
|
|
392
394
|
readonly moveEdgesOnTop?: boolean;
|
|
393
395
|
readonly gridSize?: number | null;
|
|
394
|
-
readonly nodeDragVerifier?: (nodeId:
|
|
396
|
+
readonly nodeDragVerifier?: (nodeId: Identifier) => boolean;
|
|
395
397
|
readonly mouse?: {
|
|
396
398
|
readonly dragCursor?: string | null;
|
|
397
399
|
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
398
400
|
readonly mouseUpEventVerifier?: MouseEventVerifier;
|
|
399
401
|
};
|
|
400
402
|
readonly events?: {
|
|
401
|
-
readonly onNodeDrag?: (nodeId:
|
|
402
|
-
readonly onNodeDragFinished?: (nodeId:
|
|
403
|
+
readonly onNodeDrag?: (nodeId: Identifier) => void;
|
|
404
|
+
readonly onNodeDragFinished?: (nodeId: Identifier) => void;
|
|
403
405
|
};
|
|
404
406
|
}
|
|
405
407
|
|
|
406
|
-
export declare type DraggingEdgeResolver = (portId:
|
|
408
|
+
export declare type DraggingEdgeResolver = (portId: Identifier) => Identifier | null;
|
|
407
409
|
|
|
408
410
|
declare interface EdgePath {
|
|
409
411
|
readonly path: string;
|
|
410
412
|
readonly midpoint: Point;
|
|
411
413
|
}
|
|
412
414
|
|
|
413
|
-
declare interface EdgePayload {
|
|
414
|
-
readonly from: unknown;
|
|
415
|
-
readonly to: unknown;
|
|
416
|
-
shape: EdgeShape;
|
|
417
|
-
priority: number;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
415
|
export declare interface EdgeRenderParams {
|
|
421
416
|
readonly from: EdgeRenderPort;
|
|
422
417
|
readonly to: EdgeRenderPort;
|
|
@@ -438,7 +433,7 @@ export declare interface EdgeShape {
|
|
|
438
433
|
|
|
439
434
|
declare type EdgeShapeConfig = BezierEdgeShapeConfig | StraightEdgeShapeConfig | HorizontalEdgeShapeConfig | VerticalEdgeShapeConfig | DirectEdgeShapeConfig | EdgeShapeFactory;
|
|
440
435
|
|
|
441
|
-
declare type EdgeShapeFactory = (edgeId:
|
|
436
|
+
declare type EdgeShapeFactory = (edgeId: Identifier) => EdgeShape;
|
|
442
437
|
|
|
443
438
|
declare interface EventHandler<T> {
|
|
444
439
|
subscribe(callback: (payload: T) => void): void;
|
|
@@ -447,42 +442,42 @@ declare interface EventHandler<T> {
|
|
|
447
442
|
|
|
448
443
|
export declare class Graph {
|
|
449
444
|
private readonly graphStore;
|
|
450
|
-
readonly onAfterNodeAdded: EventHandler<
|
|
451
|
-
readonly onAfterNodeUpdated: EventHandler<
|
|
452
|
-
readonly onAfterNodePriorityUpdated: EventHandler<
|
|
453
|
-
readonly onBeforeNodeRemoved: EventHandler<
|
|
454
|
-
readonly onAfterPortMarked: EventHandler<
|
|
455
|
-
readonly onAfterPortUpdated: EventHandler<
|
|
456
|
-
readonly onBeforePortUnmarked: EventHandler<
|
|
457
|
-
readonly onAfterEdgeAdded: EventHandler<
|
|
458
|
-
readonly onAfterEdgeShapeUpdated: EventHandler<
|
|
459
|
-
readonly onAfterEdgeUpdated: EventHandler<
|
|
460
|
-
readonly onAfterEdgePriorityUpdated: EventHandler<
|
|
461
|
-
readonly onBeforeEdgeRemoved: EventHandler<
|
|
445
|
+
readonly onAfterNodeAdded: EventHandler<Identifier>;
|
|
446
|
+
readonly onAfterNodeUpdated: EventHandler<Identifier>;
|
|
447
|
+
readonly onAfterNodePriorityUpdated: EventHandler<Identifier>;
|
|
448
|
+
readonly onBeforeNodeRemoved: EventHandler<Identifier>;
|
|
449
|
+
readonly onAfterPortMarked: EventHandler<Identifier>;
|
|
450
|
+
readonly onAfterPortUpdated: EventHandler<Identifier>;
|
|
451
|
+
readonly onBeforePortUnmarked: EventHandler<Identifier>;
|
|
452
|
+
readonly onAfterEdgeAdded: EventHandler<Identifier>;
|
|
453
|
+
readonly onAfterEdgeShapeUpdated: EventHandler<Identifier>;
|
|
454
|
+
readonly onAfterEdgeUpdated: EventHandler<Identifier>;
|
|
455
|
+
readonly onAfterEdgePriorityUpdated: EventHandler<Identifier>;
|
|
456
|
+
readonly onBeforeEdgeRemoved: EventHandler<Identifier>;
|
|
462
457
|
readonly onBeforeClear: EventHandler<void>;
|
|
463
458
|
constructor(graphStore: GraphStore);
|
|
464
|
-
getNode(nodeId:
|
|
465
|
-
getElementNodeId(element: HTMLElement):
|
|
466
|
-
getAllNodeIds(): readonly
|
|
467
|
-
getPort(portId:
|
|
468
|
-
getAllPortIds(): readonly
|
|
469
|
-
getNodePortIds(nodeId:
|
|
470
|
-
getElementPortIds(element: HTMLElement): readonly
|
|
471
|
-
getAllEdgeIds(): readonly
|
|
472
|
-
getEdge(edgeId:
|
|
473
|
-
getPortIncomingEdgeIds(portId:
|
|
474
|
-
getPortOutgoingEdgeIds(portId:
|
|
475
|
-
getPortCycleEdgeIds(portId:
|
|
476
|
-
getPortAdjacentEdgeIds(portId:
|
|
477
|
-
getNodeIncomingEdgeIds(nodeId:
|
|
478
|
-
getNodeOutgoingEdgeIds(nodeId:
|
|
479
|
-
getNodeCycleEdgeIds(nodeId:
|
|
480
|
-
getNodeAdjacentEdgeIds(nodeId:
|
|
459
|
+
getNode(nodeId: Identifier): GraphNode | null;
|
|
460
|
+
getElementNodeId(element: HTMLElement): Identifier | null;
|
|
461
|
+
getAllNodeIds(): readonly Identifier[];
|
|
462
|
+
getPort(portId: Identifier): GraphPort | null;
|
|
463
|
+
getAllPortIds(): readonly Identifier[];
|
|
464
|
+
getNodePortIds(nodeId: Identifier): readonly Identifier[] | null;
|
|
465
|
+
getElementPortIds(element: HTMLElement): readonly Identifier[];
|
|
466
|
+
getAllEdgeIds(): readonly Identifier[];
|
|
467
|
+
getEdge(edgeId: Identifier): GraphEdge | null;
|
|
468
|
+
getPortIncomingEdgeIds(portId: Identifier): readonly Identifier[] | null;
|
|
469
|
+
getPortOutgoingEdgeIds(portId: Identifier): readonly Identifier[] | null;
|
|
470
|
+
getPortCycleEdgeIds(portId: Identifier): readonly Identifier[] | null;
|
|
471
|
+
getPortAdjacentEdgeIds(portId: Identifier): readonly Identifier[] | null;
|
|
472
|
+
getNodeIncomingEdgeIds(nodeId: Identifier): readonly Identifier[] | null;
|
|
473
|
+
getNodeOutgoingEdgeIds(nodeId: Identifier): readonly Identifier[] | null;
|
|
474
|
+
getNodeCycleEdgeIds(nodeId: Identifier): readonly Identifier[] | null;
|
|
475
|
+
getNodeAdjacentEdgeIds(nodeId: Identifier): readonly Identifier[] | null;
|
|
481
476
|
}
|
|
482
477
|
|
|
483
478
|
export declare interface GraphEdge {
|
|
484
|
-
readonly from:
|
|
485
|
-
readonly to:
|
|
479
|
+
readonly from: Identifier;
|
|
480
|
+
readonly to: Identifier;
|
|
486
481
|
readonly priority: number;
|
|
487
482
|
readonly shape: EdgeShape;
|
|
488
483
|
}
|
|
@@ -498,7 +493,7 @@ export declare interface GraphNode {
|
|
|
498
493
|
export declare interface GraphPort {
|
|
499
494
|
readonly element: HTMLElement;
|
|
500
495
|
readonly direction: number;
|
|
501
|
-
readonly nodeId:
|
|
496
|
+
readonly nodeId: Identifier;
|
|
502
497
|
}
|
|
503
498
|
|
|
504
499
|
declare class GraphStore {
|
|
@@ -511,59 +506,59 @@ declare class GraphStore {
|
|
|
511
506
|
private readonly cycleEdges;
|
|
512
507
|
private readonly elementPorts;
|
|
513
508
|
private readonly afterNodeAddedEmitter;
|
|
514
|
-
readonly onAfterNodeAdded: EventHandler<
|
|
509
|
+
readonly onAfterNodeAdded: EventHandler<Identifier>;
|
|
515
510
|
private readonly afterNodeUpdatedEmitter;
|
|
516
|
-
readonly onAfterNodeUpdated: EventHandler<
|
|
511
|
+
readonly onAfterNodeUpdated: EventHandler<Identifier>;
|
|
517
512
|
private readonly afterNodePriorityUpdatedEmitter;
|
|
518
|
-
readonly onAfterNodePriorityUpdated: EventHandler<
|
|
513
|
+
readonly onAfterNodePriorityUpdated: EventHandler<Identifier>;
|
|
519
514
|
private readonly beforeNodeRemovedEmitter;
|
|
520
|
-
readonly onBeforeNodeRemoved: EventHandler<
|
|
515
|
+
readonly onBeforeNodeRemoved: EventHandler<Identifier>;
|
|
521
516
|
private readonly afterPortAddedEmitter;
|
|
522
|
-
readonly onAfterPortAdded: EventHandler<
|
|
517
|
+
readonly onAfterPortAdded: EventHandler<Identifier>;
|
|
523
518
|
private readonly afterPortUpdatedEmitter;
|
|
524
|
-
readonly onAfterPortUpdated: EventHandler<
|
|
519
|
+
readonly onAfterPortUpdated: EventHandler<Identifier>;
|
|
525
520
|
private readonly beforePortRemovedEmitter;
|
|
526
|
-
readonly onBeforePortRemoved: EventHandler<
|
|
521
|
+
readonly onBeforePortRemoved: EventHandler<Identifier>;
|
|
527
522
|
private readonly afterEdgeAddedEmitter;
|
|
528
|
-
readonly onAfterEdgeAdded: EventHandler<
|
|
523
|
+
readonly onAfterEdgeAdded: EventHandler<Identifier>;
|
|
529
524
|
private readonly afterEdgeShapeUpdatedEmitter;
|
|
530
|
-
readonly onAfterEdgeShapeUpdated: EventHandler<
|
|
525
|
+
readonly onAfterEdgeShapeUpdated: EventHandler<Identifier>;
|
|
531
526
|
private readonly afterEdgeUpdatedEmitter;
|
|
532
|
-
readonly onAfterEdgeUpdated: EventHandler<
|
|
527
|
+
readonly onAfterEdgeUpdated: EventHandler<Identifier>;
|
|
533
528
|
private readonly afterEdgePriorityUpdatedEmitter;
|
|
534
|
-
readonly onAfterEdgePriorityUpdated: EventHandler<
|
|
529
|
+
readonly onAfterEdgePriorityUpdated: EventHandler<Identifier>;
|
|
535
530
|
private readonly beforeEdgeRemovedEmitter;
|
|
536
|
-
readonly onBeforeEdgeRemoved: EventHandler<
|
|
531
|
+
readonly onBeforeEdgeRemoved: EventHandler<Identifier>;
|
|
537
532
|
private readonly beforeClearEmitter;
|
|
538
533
|
readonly onBeforeClear: EventHandler<void>;
|
|
539
534
|
constructor();
|
|
540
535
|
addNode(request: AddNodeRequest_2): void;
|
|
541
|
-
getAllNodeIds(): readonly
|
|
542
|
-
getNode(nodeId:
|
|
543
|
-
getElementNodeId(element: HTMLElement):
|
|
544
|
-
updateNode(nodeId:
|
|
545
|
-
removeNode(nodeId:
|
|
536
|
+
getAllNodeIds(): readonly Identifier[];
|
|
537
|
+
getNode(nodeId: Identifier): StoreNode | undefined;
|
|
538
|
+
getElementNodeId(element: HTMLElement): Identifier | undefined;
|
|
539
|
+
updateNode(nodeId: Identifier, request: UpdateNodeRequest_2): void;
|
|
540
|
+
removeNode(nodeId: Identifier): void;
|
|
546
541
|
addPort(request: AddPortRequest): void;
|
|
547
|
-
getPort(portId:
|
|
548
|
-
updatePort(portId:
|
|
549
|
-
getAllPortIds(): readonly
|
|
550
|
-
getElementPortIds(element: HTMLElement): readonly
|
|
551
|
-
getNodePortIds(nodeId:
|
|
552
|
-
removePort(portId:
|
|
542
|
+
getPort(portId: Identifier): StorePort | undefined;
|
|
543
|
+
updatePort(portId: Identifier, request: UpdatePortRequest_2): void;
|
|
544
|
+
getAllPortIds(): readonly Identifier[];
|
|
545
|
+
getElementPortIds(element: HTMLElement): readonly Identifier[];
|
|
546
|
+
getNodePortIds(nodeId: Identifier): readonly Identifier[] | undefined;
|
|
547
|
+
removePort(portId: Identifier): void;
|
|
553
548
|
addEdge(request: AddEdgeRequest_2): void;
|
|
554
|
-
updateEdge(edgeId:
|
|
555
|
-
getAllEdgeIds(): readonly
|
|
556
|
-
getEdge(edgeId:
|
|
557
|
-
removeEdge(edgeId:
|
|
549
|
+
updateEdge(edgeId: Identifier, request: UpdateEdgeRequest_2): void;
|
|
550
|
+
getAllEdgeIds(): readonly Identifier[];
|
|
551
|
+
getEdge(edgeId: Identifier): StoreEdge | undefined;
|
|
552
|
+
removeEdge(edgeId: Identifier): void;
|
|
558
553
|
clear(): void;
|
|
559
|
-
getPortIncomingEdgeIds(portId:
|
|
560
|
-
getPortOutgoingEdgeIds(portId:
|
|
561
|
-
getPortCycleEdgeIds(portId:
|
|
562
|
-
getPortAdjacentEdgeIds(portId:
|
|
563
|
-
getNodeIncomingEdgeIds(nodeId:
|
|
564
|
-
getNodeOutgoingEdgeIds(nodeId:
|
|
565
|
-
getNodeCycleEdgeIds(nodeId:
|
|
566
|
-
getNodeAdjacentEdgeIds(nodeId:
|
|
554
|
+
getPortIncomingEdgeIds(portId: Identifier): readonly Identifier[];
|
|
555
|
+
getPortOutgoingEdgeIds(portId: Identifier): readonly Identifier[];
|
|
556
|
+
getPortCycleEdgeIds(portId: Identifier): readonly Identifier[];
|
|
557
|
+
getPortAdjacentEdgeIds(portId: Identifier): readonly Identifier[];
|
|
558
|
+
getNodeIncomingEdgeIds(nodeId: Identifier): readonly Identifier[];
|
|
559
|
+
getNodeOutgoingEdgeIds(nodeId: Identifier): readonly Identifier[];
|
|
560
|
+
getNodeCycleEdgeIds(nodeId: Identifier): readonly Identifier[];
|
|
561
|
+
getNodeAdjacentEdgeIds(nodeId: Identifier): readonly Identifier[];
|
|
567
562
|
private addEdgeInternal;
|
|
568
563
|
private removeEdgeInternal;
|
|
569
564
|
}
|
|
@@ -609,19 +604,21 @@ declare type HorizontalEdgeShapeConfig = {
|
|
|
609
604
|
} & HorizontalEdgeParams;
|
|
610
605
|
|
|
611
606
|
declare interface HtmlView {
|
|
612
|
-
attachNode(nodeId:
|
|
613
|
-
detachNode(nodeId:
|
|
614
|
-
attachEdge(edgeId:
|
|
615
|
-
detachEdge(edgeId:
|
|
607
|
+
attachNode(nodeId: Identifier): void;
|
|
608
|
+
detachNode(nodeId: Identifier): void;
|
|
609
|
+
attachEdge(edgeId: Identifier): void;
|
|
610
|
+
detachEdge(edgeId: Identifier): void;
|
|
616
611
|
clear(): void;
|
|
617
612
|
destroy(): void;
|
|
618
|
-
updateNodePosition(nodeId:
|
|
619
|
-
updateNodePriority(nodeId:
|
|
620
|
-
updateEdgeShape(edgeId:
|
|
621
|
-
renderEdge(edgeId:
|
|
622
|
-
updateEdgePriority(edgeId:
|
|
613
|
+
updateNodePosition(nodeId: Identifier): void;
|
|
614
|
+
updateNodePriority(nodeId: Identifier): void;
|
|
615
|
+
updateEdgeShape(edgeId: Identifier): void;
|
|
616
|
+
renderEdge(edgeId: Identifier): void;
|
|
617
|
+
updateEdgePriority(edgeId: Identifier): void;
|
|
623
618
|
}
|
|
624
619
|
|
|
620
|
+
export declare type Identifier = NonNullable<unknown>;
|
|
621
|
+
|
|
625
622
|
declare type IncrementalPriority = "incremental";
|
|
626
623
|
|
|
627
624
|
export declare class InteractiveEdgeError extends Error {
|
|
@@ -649,15 +646,15 @@ export declare class InteractiveEdgeShape implements StructuredEdgeShape {
|
|
|
649
646
|
}
|
|
650
647
|
|
|
651
648
|
export declare type MarkNodePortRequest = {
|
|
652
|
-
readonly id?:
|
|
649
|
+
readonly id?: Identifier | undefined;
|
|
653
650
|
readonly element: HTMLElement;
|
|
654
651
|
readonly direction?: number | undefined;
|
|
655
652
|
};
|
|
656
653
|
|
|
657
654
|
export declare interface MarkPortRequest {
|
|
658
|
-
readonly id?:
|
|
655
|
+
readonly id?: Identifier;
|
|
659
656
|
readonly element: HTMLElement;
|
|
660
|
-
readonly nodeId:
|
|
657
|
+
readonly nodeId: Identifier;
|
|
661
658
|
readonly direction?: number;
|
|
662
659
|
}
|
|
663
660
|
|
|
@@ -676,15 +673,6 @@ export declare class MidpointEdgeShape implements StructuredEdgeShape {
|
|
|
676
673
|
|
|
677
674
|
export declare type MouseEventVerifier = (event: MouseEvent) => boolean;
|
|
678
675
|
|
|
679
|
-
declare interface NodePayload {
|
|
680
|
-
readonly element: HTMLElement;
|
|
681
|
-
x: number;
|
|
682
|
-
y: number;
|
|
683
|
-
centerFn: CenterFn;
|
|
684
|
-
priority: number;
|
|
685
|
-
readonly ports: Map<unknown, HTMLElement>;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
676
|
export declare interface PatchMatrixRequest {
|
|
689
677
|
readonly scale?: number | undefined;
|
|
690
678
|
readonly x?: number | undefined;
|
|
@@ -702,12 +690,6 @@ export declare interface Point {
|
|
|
702
690
|
readonly y: number;
|
|
703
691
|
}
|
|
704
692
|
|
|
705
|
-
declare interface PortPayload {
|
|
706
|
-
readonly element: HTMLElement;
|
|
707
|
-
direction: number;
|
|
708
|
-
readonly nodeId: unknown;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
693
|
declare type Priority = ConstantPriority | IncrementalPriority | CustomPriority;
|
|
712
694
|
|
|
713
695
|
export declare type PriorityFn = () => number;
|
|
@@ -724,6 +706,34 @@ export declare interface ShiftLimitPreprocessorParams {
|
|
|
724
706
|
readonly maxY: number | null;
|
|
725
707
|
}
|
|
726
708
|
|
|
709
|
+
declare interface StoreEdge {
|
|
710
|
+
readonly from: Identifier;
|
|
711
|
+
readonly to: Identifier;
|
|
712
|
+
readonly payload: {
|
|
713
|
+
shape: EdgeShape;
|
|
714
|
+
priority: number;
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
declare interface StoreNode {
|
|
719
|
+
readonly element: HTMLElement;
|
|
720
|
+
readonly payload: {
|
|
721
|
+
x: number;
|
|
722
|
+
y: number;
|
|
723
|
+
centerFn: CenterFn;
|
|
724
|
+
priority: number;
|
|
725
|
+
};
|
|
726
|
+
readonly ports: Map<Identifier, HTMLElement>;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
declare interface StorePort {
|
|
730
|
+
readonly element: HTMLElement;
|
|
731
|
+
readonly payload: {
|
|
732
|
+
direction: number;
|
|
733
|
+
};
|
|
734
|
+
readonly nodeId: Identifier;
|
|
735
|
+
}
|
|
736
|
+
|
|
727
737
|
export declare interface StraightEdgeParams {
|
|
728
738
|
readonly color?: string | undefined;
|
|
729
739
|
readonly width?: number | undefined;
|
|
@@ -814,15 +824,15 @@ declare interface TransformState {
|
|
|
814
824
|
}
|
|
815
825
|
|
|
816
826
|
export declare interface UpdateEdgeRequest {
|
|
817
|
-
readonly from?:
|
|
818
|
-
readonly to?:
|
|
827
|
+
readonly from?: Identifier | undefined;
|
|
828
|
+
readonly to?: Identifier | undefined;
|
|
819
829
|
readonly shape?: EdgeShape | undefined;
|
|
820
830
|
readonly priority?: number | undefined;
|
|
821
831
|
}
|
|
822
832
|
|
|
823
833
|
declare interface UpdateEdgeRequest_2 {
|
|
824
|
-
readonly from?:
|
|
825
|
-
readonly to?:
|
|
834
|
+
readonly from?: Identifier;
|
|
835
|
+
readonly to?: Identifier;
|
|
826
836
|
readonly shape?: EdgeShape;
|
|
827
837
|
readonly priority?: number;
|
|
828
838
|
}
|
|
@@ -937,8 +947,8 @@ export declare interface VirtualScrollConfig {
|
|
|
937
947
|
readonly horizontal: number;
|
|
938
948
|
};
|
|
939
949
|
readonly events?: {
|
|
940
|
-
readonly onBeforeNodeAttached?: (nodeId:
|
|
941
|
-
readonly onAfterNodeDetached?: (nodeId:
|
|
950
|
+
readonly onBeforeNodeAttached?: (nodeId: Identifier) => void;
|
|
951
|
+
readonly onAfterNodeDetached?: (nodeId: Identifier) => void;
|
|
942
952
|
};
|
|
943
953
|
}
|
|
944
954
|
|