@html-graph/html-graph 3.21.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 +165 -298
- package/dist/html-graph.js +1149 -1233
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
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
|
}
|
|
@@ -94,10 +94,6 @@ declare type BezierEdgeShapeConfig = {
|
|
|
94
94
|
} & BezierEdgeParams;
|
|
95
95
|
|
|
96
96
|
export declare class Canvas {
|
|
97
|
-
/**
|
|
98
|
-
* @deprecated access element directly instead
|
|
99
|
-
*/
|
|
100
|
-
readonly element: HTMLElement;
|
|
101
97
|
private readonly graphStore;
|
|
102
98
|
private readonly viewportStore;
|
|
103
99
|
private readonly htmlView;
|
|
@@ -131,11 +127,7 @@ export declare class Canvas {
|
|
|
131
127
|
* emits event just before destruction of canvas
|
|
132
128
|
*/
|
|
133
129
|
readonly onBeforeDestroy: EventHandler<void>;
|
|
134
|
-
constructor(
|
|
135
|
-
/**
|
|
136
|
-
* @deprecated access element directly instead
|
|
137
|
-
*/
|
|
138
|
-
element: HTMLElement, graphStore: GraphStore, viewportStore: ViewportStore, htmlView: HtmlView, params: CanvasParams);
|
|
130
|
+
constructor(graphStore: GraphStore, viewportStore: ViewportStore, htmlView: HtmlView, params: CanvasParams);
|
|
139
131
|
/**
|
|
140
132
|
* adds new node
|
|
141
133
|
*/
|
|
@@ -143,13 +135,13 @@ export declare class Canvas {
|
|
|
143
135
|
/**
|
|
144
136
|
* updates node parameters
|
|
145
137
|
*/
|
|
146
|
-
updateNode(nodeId:
|
|
138
|
+
updateNode(nodeId: Identifier, request?: UpdateNodeRequest): Canvas;
|
|
147
139
|
/**
|
|
148
140
|
* removes specified node
|
|
149
141
|
* all the ports of node get unmarked
|
|
150
142
|
* all the edges adjacent to node get removed
|
|
151
143
|
*/
|
|
152
|
-
removeNode(nodeId:
|
|
144
|
+
removeNode(nodeId: Identifier): Canvas;
|
|
153
145
|
/**
|
|
154
146
|
* marks specified element as a port for specified node
|
|
155
147
|
*/
|
|
@@ -157,12 +149,12 @@ export declare class Canvas {
|
|
|
157
149
|
/**
|
|
158
150
|
* updates port and edges attached to it
|
|
159
151
|
*/
|
|
160
|
-
updatePort(portId:
|
|
152
|
+
updatePort(portId: Identifier, request?: UpdatePortRequest): Canvas;
|
|
161
153
|
/**
|
|
162
154
|
* unmarks specified port
|
|
163
155
|
* all the edges adjacent to the port get removed
|
|
164
156
|
*/
|
|
165
|
-
unmarkPort(portId:
|
|
157
|
+
unmarkPort(portId: Identifier): Canvas;
|
|
166
158
|
/**
|
|
167
159
|
* adds new edge
|
|
168
160
|
*/
|
|
@@ -170,11 +162,11 @@ export declare class Canvas {
|
|
|
170
162
|
/**
|
|
171
163
|
* updates specified edge
|
|
172
164
|
*/
|
|
173
|
-
updateEdge(edgeId:
|
|
165
|
+
updateEdge(edgeId: Identifier, request?: UpdateEdgeRequest): Canvas;
|
|
174
166
|
/**
|
|
175
167
|
* removes specified edge
|
|
176
168
|
*/
|
|
177
|
-
removeEdge(edgeId:
|
|
169
|
+
removeEdge(edgeId: Identifier): Canvas;
|
|
178
170
|
/**
|
|
179
171
|
* applies transformation for viewport matrix
|
|
180
172
|
*/
|
|
@@ -196,7 +188,8 @@ export declare class Canvas {
|
|
|
196
188
|
}
|
|
197
189
|
|
|
198
190
|
export declare class CanvasBuilder {
|
|
199
|
-
private element;
|
|
191
|
+
private readonly element;
|
|
192
|
+
private used;
|
|
200
193
|
private canvasDefaults;
|
|
201
194
|
private dragConfig;
|
|
202
195
|
private transformConfig;
|
|
@@ -210,14 +203,11 @@ export declare class CanvasBuilder {
|
|
|
210
203
|
private hasBackground;
|
|
211
204
|
private hasUserConnectablePorts;
|
|
212
205
|
private hasUserDraggableEdges;
|
|
213
|
-
private boxRenderingTrigger;
|
|
206
|
+
private readonly boxRenderingTrigger;
|
|
207
|
+
private readonly graphStore;
|
|
208
|
+
private readonly viewportStore;
|
|
214
209
|
private readonly window;
|
|
215
|
-
constructor(element
|
|
216
|
-
/**
|
|
217
|
-
* @deprecated
|
|
218
|
-
* use `new CanvasBuilder(element);` instead
|
|
219
|
-
*/
|
|
220
|
-
setElement(element: HTMLElement): CanvasBuilder;
|
|
210
|
+
constructor(element: HTMLElement);
|
|
221
211
|
/**
|
|
222
212
|
* specifies default values for graph entities
|
|
223
213
|
*/
|
|
@@ -230,21 +220,10 @@ export declare class CanvasBuilder {
|
|
|
230
220
|
* enables viewport transformable by user
|
|
231
221
|
*/
|
|
232
222
|
enableUserTransformableViewport(config?: ViewportTransformConfig): CanvasBuilder;
|
|
233
|
-
/**
|
|
234
|
-
* @deprecated
|
|
235
|
-
* use enableNodeResizeReactiveEdges instead
|
|
236
|
-
*/
|
|
237
|
-
enableResizeReactiveNodes(): CanvasBuilder;
|
|
238
223
|
/**
|
|
239
224
|
* enables automatic edges update on node resize
|
|
240
225
|
*/
|
|
241
226
|
enableNodeResizeReactiveEdges(): CanvasBuilder;
|
|
242
|
-
/**
|
|
243
|
-
* @deprecated
|
|
244
|
-
* do not use
|
|
245
|
-
* sets emitter for rendering graph inside bounded area
|
|
246
|
-
*/
|
|
247
|
-
enableBoxAreaRendering(trigger: EventSubject<RenderingBox>): CanvasBuilder;
|
|
248
227
|
/**
|
|
249
228
|
* enables built-in virtual scroll behavior, when only nodes and edges close
|
|
250
229
|
* to viewport are rendered
|
|
@@ -263,11 +242,10 @@ export declare class CanvasBuilder {
|
|
|
263
242
|
* builds final canvas
|
|
264
243
|
*/
|
|
265
244
|
build(): Canvas;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
private reset;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export declare class CanvasBuilderError extends Error {
|
|
248
|
+
readonly name = "CanvasBuilderError";
|
|
271
249
|
}
|
|
272
250
|
|
|
273
251
|
export declare interface CanvasDefaults {
|
|
@@ -309,6 +287,10 @@ export declare interface CanvasDefaults {
|
|
|
309
287
|
};
|
|
310
288
|
}
|
|
311
289
|
|
|
290
|
+
export declare class CanvasError extends Error {
|
|
291
|
+
readonly name = "CanvasError";
|
|
292
|
+
}
|
|
293
|
+
|
|
312
294
|
declare interface CanvasParams {
|
|
313
295
|
readonly nodes: {
|
|
314
296
|
readonly centerFn: CenterFn;
|
|
@@ -325,7 +307,7 @@ declare interface CanvasParams {
|
|
|
325
307
|
|
|
326
308
|
export declare type CenterFn = (width: number, height: number) => Point;
|
|
327
309
|
|
|
328
|
-
declare interface ConnectablePortsConfig {
|
|
310
|
+
export declare interface ConnectablePortsConfig {
|
|
329
311
|
readonly edgeShape?: EdgeShapeConfig;
|
|
330
312
|
readonly connectionTypeResolver?: ConnectionTypeResolver;
|
|
331
313
|
readonly connectionPreprocessor?: ConnectionPreprocessor;
|
|
@@ -333,13 +315,14 @@ declare interface ConnectablePortsConfig {
|
|
|
333
315
|
readonly mouseUpEventVerifier?: MouseEventVerifier;
|
|
334
316
|
readonly dragPortDirection?: number | undefined;
|
|
335
317
|
readonly events?: {
|
|
336
|
-
readonly onAfterEdgeCreated?: (edgeId:
|
|
337
|
-
readonly onEdgeCreationInterrupted?: (
|
|
318
|
+
readonly onAfterEdgeCreated?: (edgeId: Identifier) => void;
|
|
319
|
+
readonly onEdgeCreationInterrupted?: (params: {
|
|
320
|
+
readonly staticPortId: Identifier;
|
|
321
|
+
readonly isDirect: boolean;
|
|
322
|
+
}) => void;
|
|
338
323
|
readonly onEdgeCreationPrevented?: (request: AddEdgeRequest) => void;
|
|
339
324
|
};
|
|
340
325
|
}
|
|
341
|
-
export { ConnectablePortsConfig }
|
|
342
|
-
export { ConnectablePortsConfig as ConnectablePortsOptions }
|
|
343
326
|
|
|
344
327
|
export declare enum ConnectionCategory {
|
|
345
328
|
Line = "line",
|
|
@@ -349,7 +332,7 @@ export declare enum ConnectionCategory {
|
|
|
349
332
|
|
|
350
333
|
export declare type ConnectionPreprocessor = (request: AddEdgeRequest) => AddEdgeRequest | null;
|
|
351
334
|
|
|
352
|
-
export declare type ConnectionTypeResolver = (portId:
|
|
335
|
+
export declare type ConnectionTypeResolver = (portId: Identifier) => "direct" | "reverse" | null;
|
|
353
336
|
|
|
354
337
|
declare type ConstantPriority = number;
|
|
355
338
|
|
|
@@ -400,51 +383,35 @@ declare interface DraggableEdgesConfig {
|
|
|
400
383
|
readonly draggingEdgeResolver?: DraggingEdgeResolver;
|
|
401
384
|
readonly draggingEdgeShape?: EdgeShapeConfig;
|
|
402
385
|
readonly events?: {
|
|
403
|
-
readonly onAfterEdgeReattached?: (edgeId:
|
|
386
|
+
readonly onAfterEdgeReattached?: (edgeId: Identifier) => void;
|
|
404
387
|
readonly onEdgeReattachInterrupted?: (edge: GraphEdge) => void;
|
|
405
388
|
readonly onEdgeReattachPrevented?: (request: AddEdgeRequest) => void;
|
|
406
389
|
};
|
|
407
390
|
}
|
|
408
391
|
|
|
409
|
-
declare interface DraggableNodesConfig {
|
|
392
|
+
export declare interface DraggableNodesConfig {
|
|
410
393
|
readonly moveOnTop?: boolean;
|
|
411
394
|
readonly moveEdgesOnTop?: boolean;
|
|
395
|
+
readonly gridSize?: number | null;
|
|
396
|
+
readonly nodeDragVerifier?: (nodeId: Identifier) => boolean;
|
|
412
397
|
readonly mouse?: {
|
|
413
398
|
readonly dragCursor?: string | null;
|
|
414
399
|
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
415
400
|
readonly mouseUpEventVerifier?: MouseEventVerifier;
|
|
416
401
|
};
|
|
417
|
-
readonly gridSize?: number | null;
|
|
418
|
-
readonly nodeDragVerifier?: (payload: NodeDragPayload) => boolean;
|
|
419
402
|
readonly events?: {
|
|
420
|
-
readonly onNodeDrag?: (
|
|
421
|
-
|
|
422
|
-
* @deprecated
|
|
423
|
-
* use nodeDragVerifier instead
|
|
424
|
-
*/
|
|
425
|
-
readonly onBeforeNodeDrag?: (payload: NodeDragPayload) => boolean;
|
|
426
|
-
readonly onNodeDragFinished?: (payload: NodeDragPayload) => void;
|
|
403
|
+
readonly onNodeDrag?: (nodeId: Identifier) => void;
|
|
404
|
+
readonly onNodeDragFinished?: (nodeId: Identifier) => void;
|
|
427
405
|
};
|
|
428
406
|
}
|
|
429
|
-
export { DraggableNodesConfig as DragOptions }
|
|
430
|
-
export { DraggableNodesConfig }
|
|
431
407
|
|
|
432
|
-
export declare type DraggingEdgeResolver = (portId:
|
|
408
|
+
export declare type DraggingEdgeResolver = (portId: Identifier) => Identifier | null;
|
|
433
409
|
|
|
434
410
|
declare interface EdgePath {
|
|
435
411
|
readonly path: string;
|
|
436
412
|
readonly midpoint: Point;
|
|
437
413
|
}
|
|
438
414
|
|
|
439
|
-
declare type EdgePathFactory = (sourceDirection: Point, targetDirection: Point, to: Point, flipX: number, flipY: number) => EdgePath;
|
|
440
|
-
|
|
441
|
-
declare interface EdgePayload {
|
|
442
|
-
readonly from: unknown;
|
|
443
|
-
readonly to: unknown;
|
|
444
|
-
shape: EdgeShape;
|
|
445
|
-
priority: number;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
415
|
export declare interface EdgeRenderParams {
|
|
449
416
|
readonly from: EdgeRenderPort;
|
|
450
417
|
readonly to: EdgeRenderPort;
|
|
@@ -457,16 +424,6 @@ export declare interface EdgeRenderPort {
|
|
|
457
424
|
readonly width: number;
|
|
458
425
|
readonly height: number;
|
|
459
426
|
readonly direction: number;
|
|
460
|
-
/**
|
|
461
|
-
* @deprecated
|
|
462
|
-
* use category instead
|
|
463
|
-
*/
|
|
464
|
-
readonly portId: unknown;
|
|
465
|
-
/**
|
|
466
|
-
* @deprecated
|
|
467
|
-
* use category instead
|
|
468
|
-
*/
|
|
469
|
-
readonly nodeId: unknown;
|
|
470
427
|
}
|
|
471
428
|
|
|
472
429
|
export declare interface EdgeShape {
|
|
@@ -476,77 +433,51 @@ export declare interface EdgeShape {
|
|
|
476
433
|
|
|
477
434
|
declare type EdgeShapeConfig = BezierEdgeShapeConfig | StraightEdgeShapeConfig | HorizontalEdgeShapeConfig | VerticalEdgeShapeConfig | DirectEdgeShapeConfig | EdgeShapeFactory;
|
|
478
435
|
|
|
479
|
-
declare type EdgeShapeFactory = (edgeId:
|
|
436
|
+
declare type EdgeShapeFactory = (edgeId: Identifier) => EdgeShape;
|
|
480
437
|
|
|
481
|
-
|
|
482
|
-
emit(payload: T): void;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
export declare interface EventHandler<T> {
|
|
438
|
+
declare interface EventHandler<T> {
|
|
486
439
|
subscribe(callback: (payload: T) => void): void;
|
|
487
440
|
unsubscribe(callback: (payload: T) => void): void;
|
|
488
441
|
}
|
|
489
442
|
|
|
490
|
-
export declare class EventSubject<T> implements EventEmitter<T>, EventHandler<T> {
|
|
491
|
-
private readonly callbacks;
|
|
492
|
-
subscribe(callback: (payload: T) => void): void;
|
|
493
|
-
unsubscribe(callback: (payload: T) => void): void;
|
|
494
|
-
emit(payload: T): void;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
443
|
export declare class Graph {
|
|
498
444
|
private readonly graphStore;
|
|
499
|
-
readonly onAfterNodeAdded: EventHandler<
|
|
500
|
-
readonly onAfterNodeUpdated: EventHandler<
|
|
501
|
-
readonly onAfterNodePriorityUpdated: EventHandler<
|
|
502
|
-
readonly onBeforeNodeRemoved: EventHandler<
|
|
503
|
-
readonly onAfterPortMarked: EventHandler<
|
|
504
|
-
readonly onAfterPortUpdated: EventHandler<
|
|
505
|
-
readonly onBeforePortUnmarked: EventHandler<
|
|
506
|
-
readonly onAfterEdgeAdded: EventHandler<
|
|
507
|
-
readonly onAfterEdgeShapeUpdated: EventHandler<
|
|
508
|
-
readonly onAfterEdgeUpdated: EventHandler<
|
|
509
|
-
readonly onAfterEdgePriorityUpdated: EventHandler<
|
|
510
|
-
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>;
|
|
511
457
|
readonly onBeforeClear: EventHandler<void>;
|
|
512
458
|
constructor(graphStore: GraphStore);
|
|
513
|
-
getNode(nodeId:
|
|
514
|
-
getElementNodeId(element: HTMLElement):
|
|
515
|
-
getAllNodeIds(): readonly
|
|
516
|
-
getPort(portId:
|
|
517
|
-
getAllPortIds(): readonly
|
|
518
|
-
getNodePortIds(nodeId:
|
|
519
|
-
getElementPortIds(element: HTMLElement): readonly
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
* @deprecated
|
|
531
|
-
* use getPortOutgoingEdgeIds instead
|
|
532
|
-
*/
|
|
533
|
-
getPortOutcomingEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
534
|
-
getPortCycleEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
535
|
-
getPortAdjacentEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
536
|
-
getNodeIncomingEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
537
|
-
getNodeOutgoingEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
538
|
-
/**
|
|
539
|
-
* @deprecated
|
|
540
|
-
* use getNodeOutgoingEdgeIds instead
|
|
541
|
-
*/
|
|
542
|
-
getNodeOutcomingEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
543
|
-
getNodeCycleEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
544
|
-
getNodeAdjacentEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
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;
|
|
545
476
|
}
|
|
546
477
|
|
|
547
478
|
export declare interface GraphEdge {
|
|
548
|
-
readonly from:
|
|
549
|
-
readonly to:
|
|
479
|
+
readonly from: Identifier;
|
|
480
|
+
readonly to: Identifier;
|
|
550
481
|
readonly priority: number;
|
|
551
482
|
readonly shape: EdgeShape;
|
|
552
483
|
}
|
|
@@ -562,7 +493,7 @@ export declare interface GraphNode {
|
|
|
562
493
|
export declare interface GraphPort {
|
|
563
494
|
readonly element: HTMLElement;
|
|
564
495
|
readonly direction: number;
|
|
565
|
-
readonly nodeId:
|
|
496
|
+
readonly nodeId: Identifier;
|
|
566
497
|
}
|
|
567
498
|
|
|
568
499
|
declare class GraphStore {
|
|
@@ -575,59 +506,59 @@ declare class GraphStore {
|
|
|
575
506
|
private readonly cycleEdges;
|
|
576
507
|
private readonly elementPorts;
|
|
577
508
|
private readonly afterNodeAddedEmitter;
|
|
578
|
-
readonly onAfterNodeAdded: EventHandler<
|
|
509
|
+
readonly onAfterNodeAdded: EventHandler<Identifier>;
|
|
579
510
|
private readonly afterNodeUpdatedEmitter;
|
|
580
|
-
readonly onAfterNodeUpdated: EventHandler<
|
|
511
|
+
readonly onAfterNodeUpdated: EventHandler<Identifier>;
|
|
581
512
|
private readonly afterNodePriorityUpdatedEmitter;
|
|
582
|
-
readonly onAfterNodePriorityUpdated: EventHandler<
|
|
513
|
+
readonly onAfterNodePriorityUpdated: EventHandler<Identifier>;
|
|
583
514
|
private readonly beforeNodeRemovedEmitter;
|
|
584
|
-
readonly onBeforeNodeRemoved: EventHandler<
|
|
515
|
+
readonly onBeforeNodeRemoved: EventHandler<Identifier>;
|
|
585
516
|
private readonly afterPortAddedEmitter;
|
|
586
|
-
readonly onAfterPortAdded: EventHandler<
|
|
517
|
+
readonly onAfterPortAdded: EventHandler<Identifier>;
|
|
587
518
|
private readonly afterPortUpdatedEmitter;
|
|
588
|
-
readonly onAfterPortUpdated: EventHandler<
|
|
519
|
+
readonly onAfterPortUpdated: EventHandler<Identifier>;
|
|
589
520
|
private readonly beforePortRemovedEmitter;
|
|
590
|
-
readonly onBeforePortRemoved: EventHandler<
|
|
521
|
+
readonly onBeforePortRemoved: EventHandler<Identifier>;
|
|
591
522
|
private readonly afterEdgeAddedEmitter;
|
|
592
|
-
readonly onAfterEdgeAdded: EventHandler<
|
|
523
|
+
readonly onAfterEdgeAdded: EventHandler<Identifier>;
|
|
593
524
|
private readonly afterEdgeShapeUpdatedEmitter;
|
|
594
|
-
readonly onAfterEdgeShapeUpdated: EventHandler<
|
|
525
|
+
readonly onAfterEdgeShapeUpdated: EventHandler<Identifier>;
|
|
595
526
|
private readonly afterEdgeUpdatedEmitter;
|
|
596
|
-
readonly onAfterEdgeUpdated: EventHandler<
|
|
527
|
+
readonly onAfterEdgeUpdated: EventHandler<Identifier>;
|
|
597
528
|
private readonly afterEdgePriorityUpdatedEmitter;
|
|
598
|
-
readonly onAfterEdgePriorityUpdated: EventHandler<
|
|
529
|
+
readonly onAfterEdgePriorityUpdated: EventHandler<Identifier>;
|
|
599
530
|
private readonly beforeEdgeRemovedEmitter;
|
|
600
|
-
readonly onBeforeEdgeRemoved: EventHandler<
|
|
531
|
+
readonly onBeforeEdgeRemoved: EventHandler<Identifier>;
|
|
601
532
|
private readonly beforeClearEmitter;
|
|
602
533
|
readonly onBeforeClear: EventHandler<void>;
|
|
603
534
|
constructor();
|
|
604
535
|
addNode(request: AddNodeRequest_2): void;
|
|
605
|
-
getAllNodeIds(): readonly
|
|
606
|
-
getNode(nodeId:
|
|
607
|
-
getElementNodeId(element: HTMLElement):
|
|
608
|
-
updateNode(nodeId:
|
|
609
|
-
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;
|
|
610
541
|
addPort(request: AddPortRequest): void;
|
|
611
|
-
getPort(portId:
|
|
612
|
-
updatePort(portId:
|
|
613
|
-
getAllPortIds(): readonly
|
|
614
|
-
getElementPortIds(element: HTMLElement): readonly
|
|
615
|
-
getNodePortIds(nodeId:
|
|
616
|
-
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;
|
|
617
548
|
addEdge(request: AddEdgeRequest_2): void;
|
|
618
|
-
updateEdge(edgeId:
|
|
619
|
-
getAllEdgeIds(): readonly
|
|
620
|
-
getEdge(edgeId:
|
|
621
|
-
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;
|
|
622
553
|
clear(): void;
|
|
623
|
-
getPortIncomingEdgeIds(portId:
|
|
624
|
-
getPortOutgoingEdgeIds(portId:
|
|
625
|
-
getPortCycleEdgeIds(portId:
|
|
626
|
-
getPortAdjacentEdgeIds(portId:
|
|
627
|
-
getNodeIncomingEdgeIds(nodeId:
|
|
628
|
-
getNodeOutgoingEdgeIds(nodeId:
|
|
629
|
-
getNodeCycleEdgeIds(nodeId:
|
|
630
|
-
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[];
|
|
631
562
|
private addEdgeInternal;
|
|
632
563
|
private removeEdgeInternal;
|
|
633
564
|
}
|
|
@@ -643,11 +574,6 @@ export declare interface HorizontalEdgeParams {
|
|
|
643
574
|
readonly cycleSquareSide?: number | undefined;
|
|
644
575
|
readonly roundness?: number | undefined;
|
|
645
576
|
readonly detourDistance?: number | undefined;
|
|
646
|
-
/**
|
|
647
|
-
* @deprecated
|
|
648
|
-
* do not use
|
|
649
|
-
*/
|
|
650
|
-
readonly detourDirection?: number | undefined;
|
|
651
577
|
}
|
|
652
578
|
|
|
653
579
|
export declare class HorizontalEdgeShape implements StructuredEdgeShape {
|
|
@@ -677,24 +603,22 @@ declare type HorizontalEdgeShapeConfig = {
|
|
|
677
603
|
readonly type: "horizontal";
|
|
678
604
|
} & HorizontalEdgeParams;
|
|
679
605
|
|
|
680
|
-
export declare class HtmlGraphError extends Error {
|
|
681
|
-
readonly name = "HtmlGraphError";
|
|
682
|
-
}
|
|
683
|
-
|
|
684
606
|
declare interface HtmlView {
|
|
685
|
-
attachNode(nodeId:
|
|
686
|
-
detachNode(nodeId:
|
|
687
|
-
attachEdge(edgeId:
|
|
688
|
-
detachEdge(edgeId:
|
|
607
|
+
attachNode(nodeId: Identifier): void;
|
|
608
|
+
detachNode(nodeId: Identifier): void;
|
|
609
|
+
attachEdge(edgeId: Identifier): void;
|
|
610
|
+
detachEdge(edgeId: Identifier): void;
|
|
689
611
|
clear(): void;
|
|
690
612
|
destroy(): void;
|
|
691
|
-
updateNodePosition(nodeId:
|
|
692
|
-
updateNodePriority(nodeId:
|
|
693
|
-
updateEdgeShape(edgeId:
|
|
694
|
-
renderEdge(edgeId:
|
|
695
|
-
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;
|
|
696
618
|
}
|
|
697
619
|
|
|
620
|
+
export declare type Identifier = NonNullable<unknown>;
|
|
621
|
+
|
|
698
622
|
declare type IncrementalPriority = "incremental";
|
|
699
623
|
|
|
700
624
|
export declare class InteractiveEdgeError extends Error {
|
|
@@ -702,10 +626,7 @@ export declare class InteractiveEdgeError extends Error {
|
|
|
702
626
|
}
|
|
703
627
|
|
|
704
628
|
export declare interface InteractiveEdgeParams {
|
|
705
|
-
|
|
706
|
-
* TODO: rename to 'radius'
|
|
707
|
-
*/
|
|
708
|
-
readonly width?: number;
|
|
629
|
+
readonly distance?: number;
|
|
709
630
|
}
|
|
710
631
|
|
|
711
632
|
export declare class InteractiveEdgeShape implements StructuredEdgeShape {
|
|
@@ -724,45 +645,20 @@ export declare class InteractiveEdgeShape implements StructuredEdgeShape {
|
|
|
724
645
|
render(params: EdgeRenderParams): void;
|
|
725
646
|
}
|
|
726
647
|
|
|
727
|
-
export declare interface LineEdgeParams {
|
|
728
|
-
readonly width: number;
|
|
729
|
-
readonly color: string;
|
|
730
|
-
readonly arrowLength: number;
|
|
731
|
-
readonly arrowWidth: number;
|
|
732
|
-
readonly hasSourceArrow: boolean;
|
|
733
|
-
readonly hasTargetArrow: boolean;
|
|
734
|
-
readonly createCyclePath: EdgePathFactory;
|
|
735
|
-
readonly createDetourPath: EdgePathFactory;
|
|
736
|
-
readonly createLinePath: EdgePathFactory;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
export declare class LineEdgeShape implements StructuredEdgeShape {
|
|
740
|
-
private readonly params;
|
|
741
|
-
readonly svg: SVGSVGElement;
|
|
742
|
-
readonly group: SVGGElement;
|
|
743
|
-
readonly line: SVGPathElement;
|
|
744
|
-
readonly sourceArrow: SVGPathElement | null;
|
|
745
|
-
readonly targetArrow: SVGPathElement | null;
|
|
746
|
-
readonly onAfterRender: EventHandler<StructuredEdgeRenderModel>;
|
|
747
|
-
private readonly afterRenderEmitter;
|
|
748
|
-
constructor(params: LineEdgeParams);
|
|
749
|
-
render(params: EdgeRenderParams): void;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
648
|
export declare type MarkNodePortRequest = {
|
|
753
|
-
readonly id?:
|
|
649
|
+
readonly id?: Identifier | undefined;
|
|
754
650
|
readonly element: HTMLElement;
|
|
755
651
|
readonly direction?: number | undefined;
|
|
756
652
|
};
|
|
757
653
|
|
|
758
654
|
export declare interface MarkPortRequest {
|
|
759
|
-
readonly id?:
|
|
655
|
+
readonly id?: Identifier;
|
|
760
656
|
readonly element: HTMLElement;
|
|
761
|
-
readonly nodeId:
|
|
657
|
+
readonly nodeId: Identifier;
|
|
762
658
|
readonly direction?: number;
|
|
763
659
|
}
|
|
764
660
|
|
|
765
|
-
declare class MidpointEdgeShape implements StructuredEdgeShape {
|
|
661
|
+
export declare class MidpointEdgeShape implements StructuredEdgeShape {
|
|
766
662
|
private readonly baseShape;
|
|
767
663
|
readonly midpointElement: SVGElement;
|
|
768
664
|
readonly group: SVGGElement;
|
|
@@ -771,38 +667,12 @@ declare class MidpointEdgeShape implements StructuredEdgeShape {
|
|
|
771
667
|
readonly targetArrow: SVGPathElement | null;
|
|
772
668
|
readonly onAfterRender: EventHandler<StructuredEdgeRenderModel>;
|
|
773
669
|
readonly svg: SVGSVGElement;
|
|
774
|
-
/**
|
|
775
|
-
* @deprecated
|
|
776
|
-
* use midpointElement instead
|
|
777
|
-
*/
|
|
778
|
-
readonly medianElement: SVGElement;
|
|
779
670
|
constructor(baseShape: StructuredEdgeShape, midpointElement: SVGElement);
|
|
780
671
|
render(params: EdgeRenderParams): void;
|
|
781
672
|
}
|
|
782
|
-
export { MidpointEdgeShape as MedianEdgeShape }
|
|
783
|
-
export { MidpointEdgeShape }
|
|
784
673
|
|
|
785
674
|
export declare type MouseEventVerifier = (event: MouseEvent) => boolean;
|
|
786
675
|
|
|
787
|
-
/**
|
|
788
|
-
* TODO: replace with node ID
|
|
789
|
-
*/
|
|
790
|
-
export declare interface NodeDragPayload {
|
|
791
|
-
readonly nodeId: unknown;
|
|
792
|
-
readonly element: HTMLElement;
|
|
793
|
-
readonly x: number;
|
|
794
|
-
readonly y: number;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
declare interface NodePayload {
|
|
798
|
-
readonly element: HTMLElement;
|
|
799
|
-
x: number;
|
|
800
|
-
y: number;
|
|
801
|
-
centerFn: CenterFn;
|
|
802
|
-
priority: number;
|
|
803
|
-
readonly ports: Map<unknown, HTMLElement>;
|
|
804
|
-
}
|
|
805
|
-
|
|
806
676
|
export declare interface PatchMatrixRequest {
|
|
807
677
|
readonly scale?: number | undefined;
|
|
808
678
|
readonly x?: number | undefined;
|
|
@@ -820,23 +690,10 @@ export declare interface Point {
|
|
|
820
690
|
readonly y: number;
|
|
821
691
|
}
|
|
822
692
|
|
|
823
|
-
declare interface PortPayload {
|
|
824
|
-
readonly element: HTMLElement;
|
|
825
|
-
direction: number;
|
|
826
|
-
readonly nodeId: unknown;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
693
|
declare type Priority = ConstantPriority | IncrementalPriority | CustomPriority;
|
|
830
694
|
|
|
831
695
|
export declare type PriorityFn = () => number;
|
|
832
696
|
|
|
833
|
-
export declare interface RenderingBox {
|
|
834
|
-
readonly x: number;
|
|
835
|
-
readonly y: number;
|
|
836
|
-
readonly width: number;
|
|
837
|
-
readonly height: number;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
697
|
export declare interface ScaleLimitPreprocessorParams {
|
|
841
698
|
readonly minContentScale: number | null;
|
|
842
699
|
readonly maxContentScale: number | null;
|
|
@@ -849,6 +706,34 @@ export declare interface ShiftLimitPreprocessorParams {
|
|
|
849
706
|
readonly maxY: number | null;
|
|
850
707
|
}
|
|
851
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
|
+
|
|
852
737
|
export declare interface StraightEdgeParams {
|
|
853
738
|
readonly color?: string | undefined;
|
|
854
739
|
readonly width?: number | undefined;
|
|
@@ -939,15 +824,15 @@ declare interface TransformState {
|
|
|
939
824
|
}
|
|
940
825
|
|
|
941
826
|
export declare interface UpdateEdgeRequest {
|
|
942
|
-
readonly from?:
|
|
943
|
-
readonly to?:
|
|
827
|
+
readonly from?: Identifier | undefined;
|
|
828
|
+
readonly to?: Identifier | undefined;
|
|
944
829
|
readonly shape?: EdgeShape | undefined;
|
|
945
830
|
readonly priority?: number | undefined;
|
|
946
831
|
}
|
|
947
832
|
|
|
948
833
|
declare interface UpdateEdgeRequest_2 {
|
|
949
|
-
readonly from?:
|
|
950
|
-
readonly to?:
|
|
834
|
+
readonly from?: Identifier;
|
|
835
|
+
readonly to?: Identifier;
|
|
951
836
|
readonly shape?: EdgeShape;
|
|
952
837
|
readonly priority?: number;
|
|
953
838
|
}
|
|
@@ -985,11 +870,6 @@ export declare interface VerticalEdgeParams {
|
|
|
985
870
|
readonly cycleSquareSide?: number | undefined;
|
|
986
871
|
readonly roundness?: number | undefined;
|
|
987
872
|
readonly detourDistance?: number | undefined;
|
|
988
|
-
/**
|
|
989
|
-
* @deprecated
|
|
990
|
-
* do not use
|
|
991
|
-
*/
|
|
992
|
-
readonly detourDirection?: number | undefined;
|
|
993
873
|
}
|
|
994
874
|
|
|
995
875
|
export declare class VerticalEdgeShape implements StructuredEdgeShape {
|
|
@@ -1021,11 +901,6 @@ declare type VerticalEdgeShapeConfig = {
|
|
|
1021
901
|
|
|
1022
902
|
export declare class Viewport {
|
|
1023
903
|
private readonly viewportStore;
|
|
1024
|
-
/**
|
|
1025
|
-
* @deprecated
|
|
1026
|
-
* do not use
|
|
1027
|
-
*/
|
|
1028
|
-
readonly onBeforeUpdated: EventHandler<void>;
|
|
1029
904
|
readonly onAfterUpdated: EventHandler<void>;
|
|
1030
905
|
constructor(viewportStore: ViewportStore);
|
|
1031
906
|
getViewportMatrix(): TransformState;
|
|
@@ -1037,12 +912,6 @@ declare class ViewportStore {
|
|
|
1037
912
|
private contentMatrix;
|
|
1038
913
|
private readonly afterUpdateEmitter;
|
|
1039
914
|
readonly onAfterUpdated: EventHandler<void>;
|
|
1040
|
-
private readonly beforeUpdateEmitter;
|
|
1041
|
-
/**
|
|
1042
|
-
* @deprecated
|
|
1043
|
-
* do not use
|
|
1044
|
-
*/
|
|
1045
|
-
readonly onBeforeUpdated: EventHandler<void>;
|
|
1046
915
|
constructor();
|
|
1047
916
|
getViewportMatrix(): TransformState;
|
|
1048
917
|
getContentMatrix(): TransformState;
|
|
@@ -1050,7 +919,7 @@ declare class ViewportStore {
|
|
|
1050
919
|
patchContentMatrix(matrix: PatchTransformRequest): void;
|
|
1051
920
|
}
|
|
1052
921
|
|
|
1053
|
-
declare interface ViewportTransformConfig {
|
|
922
|
+
export declare interface ViewportTransformConfig {
|
|
1054
923
|
readonly scale?: {
|
|
1055
924
|
readonly mouseWheelSensitivity?: number;
|
|
1056
925
|
readonly mouseWheelEventVerifier?: (event: WheelEvent) => boolean;
|
|
@@ -1071,8 +940,6 @@ declare interface ViewportTransformConfig {
|
|
|
1071
940
|
readonly onResizeTransformFinished?: () => void;
|
|
1072
941
|
};
|
|
1073
942
|
}
|
|
1074
|
-
export { ViewportTransformConfig as TransformOptions }
|
|
1075
|
-
export { ViewportTransformConfig }
|
|
1076
943
|
|
|
1077
944
|
export declare interface VirtualScrollConfig {
|
|
1078
945
|
readonly nodeContainingRadius: {
|
|
@@ -1080,8 +947,8 @@ export declare interface VirtualScrollConfig {
|
|
|
1080
947
|
readonly horizontal: number;
|
|
1081
948
|
};
|
|
1082
949
|
readonly events?: {
|
|
1083
|
-
readonly onBeforeNodeAttached?: (nodeId:
|
|
1084
|
-
readonly onAfterNodeDetached?: (nodeId:
|
|
950
|
+
readonly onBeforeNodeAttached?: (nodeId: Identifier) => void;
|
|
951
|
+
readonly onAfterNodeDetached?: (nodeId: Identifier) => void;
|
|
1085
952
|
};
|
|
1086
953
|
}
|
|
1087
954
|
|