@html-graph/html-graph 3.20.0 → 4.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/dist/html-graph.d.ts +26 -164
- package/dist/html-graph.js +1062 -1158
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.d.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -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;
|
|
@@ -212,12 +205,7 @@ export declare class CanvasBuilder {
|
|
|
212
205
|
private hasUserDraggableEdges;
|
|
213
206
|
private boxRenderingTrigger;
|
|
214
207
|
private readonly window;
|
|
215
|
-
constructor(element
|
|
216
|
-
/**
|
|
217
|
-
* @deprecated
|
|
218
|
-
* use `new CanvasBuilder(element);` instead
|
|
219
|
-
*/
|
|
220
|
-
setElement(element: HTMLElement): CanvasBuilder;
|
|
208
|
+
constructor(element: HTMLElement);
|
|
221
209
|
/**
|
|
222
210
|
* specifies default values for graph entities
|
|
223
211
|
*/
|
|
@@ -230,21 +218,10 @@ export declare class CanvasBuilder {
|
|
|
230
218
|
* enables viewport transformable by user
|
|
231
219
|
*/
|
|
232
220
|
enableUserTransformableViewport(config?: ViewportTransformConfig): CanvasBuilder;
|
|
233
|
-
/**
|
|
234
|
-
* @deprecated
|
|
235
|
-
* use enableNodeResizeReactiveEdges instead
|
|
236
|
-
*/
|
|
237
|
-
enableResizeReactiveNodes(): CanvasBuilder;
|
|
238
221
|
/**
|
|
239
222
|
* enables automatic edges update on node resize
|
|
240
223
|
*/
|
|
241
224
|
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
225
|
/**
|
|
249
226
|
* enables built-in virtual scroll behavior, when only nodes and edges close
|
|
250
227
|
* to viewport are rendered
|
|
@@ -263,11 +240,10 @@ export declare class CanvasBuilder {
|
|
|
263
240
|
* builds final canvas
|
|
264
241
|
*/
|
|
265
242
|
build(): Canvas;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
private reset;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export declare class CanvasBuilderError extends Error {
|
|
246
|
+
readonly name = "CanvasBuilderError";
|
|
271
247
|
}
|
|
272
248
|
|
|
273
249
|
export declare interface CanvasDefaults {
|
|
@@ -309,6 +285,10 @@ export declare interface CanvasDefaults {
|
|
|
309
285
|
};
|
|
310
286
|
}
|
|
311
287
|
|
|
288
|
+
export declare class CanvasError extends Error {
|
|
289
|
+
readonly name = "CanvasError";
|
|
290
|
+
}
|
|
291
|
+
|
|
312
292
|
declare interface CanvasParams {
|
|
313
293
|
readonly nodes: {
|
|
314
294
|
readonly centerFn: CenterFn;
|
|
@@ -325,7 +305,7 @@ declare interface CanvasParams {
|
|
|
325
305
|
|
|
326
306
|
export declare type CenterFn = (width: number, height: number) => Point;
|
|
327
307
|
|
|
328
|
-
declare interface ConnectablePortsConfig {
|
|
308
|
+
export declare interface ConnectablePortsConfig {
|
|
329
309
|
readonly edgeShape?: EdgeShapeConfig;
|
|
330
310
|
readonly connectionTypeResolver?: ConnectionTypeResolver;
|
|
331
311
|
readonly connectionPreprocessor?: ConnectionPreprocessor;
|
|
@@ -334,12 +314,13 @@ declare interface ConnectablePortsConfig {
|
|
|
334
314
|
readonly dragPortDirection?: number | undefined;
|
|
335
315
|
readonly events?: {
|
|
336
316
|
readonly onAfterEdgeCreated?: (edgeId: unknown) => void;
|
|
337
|
-
readonly onEdgeCreationInterrupted?: (
|
|
317
|
+
readonly onEdgeCreationInterrupted?: (params: {
|
|
318
|
+
readonly staticPortId: unknown;
|
|
319
|
+
readonly isDirect: boolean;
|
|
320
|
+
}) => void;
|
|
338
321
|
readonly onEdgeCreationPrevented?: (request: AddEdgeRequest) => void;
|
|
339
322
|
};
|
|
340
323
|
}
|
|
341
|
-
export { ConnectablePortsConfig }
|
|
342
|
-
export { ConnectablePortsConfig as ConnectablePortsOptions }
|
|
343
324
|
|
|
344
325
|
export declare enum ConnectionCategory {
|
|
345
326
|
Line = "line",
|
|
@@ -406,23 +387,21 @@ declare interface DraggableEdgesConfig {
|
|
|
406
387
|
};
|
|
407
388
|
}
|
|
408
389
|
|
|
409
|
-
declare interface DraggableNodesConfig {
|
|
390
|
+
export declare interface DraggableNodesConfig {
|
|
410
391
|
readonly moveOnTop?: boolean;
|
|
411
392
|
readonly moveEdgesOnTop?: boolean;
|
|
393
|
+
readonly gridSize?: number | null;
|
|
394
|
+
readonly nodeDragVerifier?: (nodeId: unknown) => boolean;
|
|
412
395
|
readonly mouse?: {
|
|
413
396
|
readonly dragCursor?: string | null;
|
|
414
397
|
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
415
398
|
readonly mouseUpEventVerifier?: MouseEventVerifier;
|
|
416
399
|
};
|
|
417
|
-
readonly gridSize?: number | null;
|
|
418
400
|
readonly events?: {
|
|
419
|
-
readonly onNodeDrag?: (
|
|
420
|
-
readonly
|
|
421
|
-
readonly onNodeDragFinished?: (payload: NodeDragPayload) => void;
|
|
401
|
+
readonly onNodeDrag?: (nodeId: unknown) => void;
|
|
402
|
+
readonly onNodeDragFinished?: (nodeId: unknown) => void;
|
|
422
403
|
};
|
|
423
404
|
}
|
|
424
|
-
export { DraggableNodesConfig as DragOptions }
|
|
425
|
-
export { DraggableNodesConfig }
|
|
426
405
|
|
|
427
406
|
export declare type DraggingEdgeResolver = (portId: unknown) => unknown | null;
|
|
428
407
|
|
|
@@ -431,8 +410,6 @@ declare interface EdgePath {
|
|
|
431
410
|
readonly midpoint: Point;
|
|
432
411
|
}
|
|
433
412
|
|
|
434
|
-
declare type EdgePathFactory = (sourceDirection: Point, targetDirection: Point, to: Point, flipX: number, flipY: number) => EdgePath;
|
|
435
|
-
|
|
436
413
|
declare interface EdgePayload {
|
|
437
414
|
readonly from: unknown;
|
|
438
415
|
readonly to: unknown;
|
|
@@ -452,16 +429,6 @@ export declare interface EdgeRenderPort {
|
|
|
452
429
|
readonly width: number;
|
|
453
430
|
readonly height: number;
|
|
454
431
|
readonly direction: number;
|
|
455
|
-
/**
|
|
456
|
-
* @deprecated
|
|
457
|
-
* use category instead
|
|
458
|
-
*/
|
|
459
|
-
readonly portId: unknown;
|
|
460
|
-
/**
|
|
461
|
-
* @deprecated
|
|
462
|
-
* use category instead
|
|
463
|
-
*/
|
|
464
|
-
readonly nodeId: unknown;
|
|
465
432
|
}
|
|
466
433
|
|
|
467
434
|
export declare interface EdgeShape {
|
|
@@ -473,20 +440,9 @@ declare type EdgeShapeConfig = BezierEdgeShapeConfig | StraightEdgeShapeConfig |
|
|
|
473
440
|
|
|
474
441
|
declare type EdgeShapeFactory = (edgeId: unknown) => EdgeShape;
|
|
475
442
|
|
|
476
|
-
|
|
477
|
-
emit(payload: T): void;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
export declare interface EventHandler<T> {
|
|
481
|
-
subscribe(callback: (payload: T) => void): void;
|
|
482
|
-
unsubscribe(callback: (payload: T) => void): void;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
export declare class EventSubject<T> implements EventEmitter<T>, EventHandler<T> {
|
|
486
|
-
private readonly callbacks;
|
|
443
|
+
declare interface EventHandler<T> {
|
|
487
444
|
subscribe(callback: (payload: T) => void): void;
|
|
488
445
|
unsubscribe(callback: (payload: T) => void): void;
|
|
489
|
-
emit(payload: T): void;
|
|
490
446
|
}
|
|
491
447
|
|
|
492
448
|
export declare class Graph {
|
|
@@ -512,29 +468,14 @@ export declare class Graph {
|
|
|
512
468
|
getAllPortIds(): readonly unknown[];
|
|
513
469
|
getNodePortIds(nodeId: unknown): readonly unknown[] | null;
|
|
514
470
|
getElementPortIds(element: HTMLElement): readonly unknown[];
|
|
515
|
-
/**
|
|
516
|
-
* @deprecated
|
|
517
|
-
* use getElementPortIds instead
|
|
518
|
-
*/
|
|
519
|
-
getElementPortsIds(element: HTMLElement): readonly unknown[];
|
|
520
471
|
getAllEdgeIds(): readonly unknown[];
|
|
521
472
|
getEdge(edgeId: unknown): GraphEdge | null;
|
|
522
473
|
getPortIncomingEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
523
474
|
getPortOutgoingEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
524
|
-
/**
|
|
525
|
-
* @deprecated
|
|
526
|
-
* use getPortOutgoingEdgeIds instead
|
|
527
|
-
*/
|
|
528
|
-
getPortOutcomingEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
529
475
|
getPortCycleEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
530
476
|
getPortAdjacentEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
531
477
|
getNodeIncomingEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
532
478
|
getNodeOutgoingEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
533
|
-
/**
|
|
534
|
-
* @deprecated
|
|
535
|
-
* use getNodeOutgoingEdgeIds instead
|
|
536
|
-
*/
|
|
537
|
-
getNodeOutcomingEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
538
479
|
getNodeCycleEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
539
480
|
getNodeAdjacentEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
540
481
|
}
|
|
@@ -638,11 +579,6 @@ export declare interface HorizontalEdgeParams {
|
|
|
638
579
|
readonly cycleSquareSide?: number | undefined;
|
|
639
580
|
readonly roundness?: number | undefined;
|
|
640
581
|
readonly detourDistance?: number | undefined;
|
|
641
|
-
/**
|
|
642
|
-
* @deprecated
|
|
643
|
-
* do not use
|
|
644
|
-
*/
|
|
645
|
-
readonly detourDirection?: number | undefined;
|
|
646
582
|
}
|
|
647
583
|
|
|
648
584
|
export declare class HorizontalEdgeShape implements StructuredEdgeShape {
|
|
@@ -672,10 +608,6 @@ declare type HorizontalEdgeShapeConfig = {
|
|
|
672
608
|
readonly type: "horizontal";
|
|
673
609
|
} & HorizontalEdgeParams;
|
|
674
610
|
|
|
675
|
-
export declare class HtmlGraphError extends Error {
|
|
676
|
-
readonly name = "HtmlGraphError";
|
|
677
|
-
}
|
|
678
|
-
|
|
679
611
|
declare interface HtmlView {
|
|
680
612
|
attachNode(nodeId: unknown): void;
|
|
681
613
|
detachNode(nodeId: unknown): void;
|
|
@@ -697,10 +629,7 @@ export declare class InteractiveEdgeError extends Error {
|
|
|
697
629
|
}
|
|
698
630
|
|
|
699
631
|
export declare interface InteractiveEdgeParams {
|
|
700
|
-
|
|
701
|
-
* TODO: rename to 'radius'
|
|
702
|
-
*/
|
|
703
|
-
readonly width?: number;
|
|
632
|
+
readonly distance?: number;
|
|
704
633
|
}
|
|
705
634
|
|
|
706
635
|
export declare class InteractiveEdgeShape implements StructuredEdgeShape {
|
|
@@ -719,31 +648,6 @@ export declare class InteractiveEdgeShape implements StructuredEdgeShape {
|
|
|
719
648
|
render(params: EdgeRenderParams): void;
|
|
720
649
|
}
|
|
721
650
|
|
|
722
|
-
export declare interface LineEdgeParams {
|
|
723
|
-
readonly width: number;
|
|
724
|
-
readonly color: string;
|
|
725
|
-
readonly arrowLength: number;
|
|
726
|
-
readonly arrowWidth: number;
|
|
727
|
-
readonly hasSourceArrow: boolean;
|
|
728
|
-
readonly hasTargetArrow: boolean;
|
|
729
|
-
readonly createCyclePath: EdgePathFactory;
|
|
730
|
-
readonly createDetourPath: EdgePathFactory;
|
|
731
|
-
readonly createLinePath: EdgePathFactory;
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
export declare class LineEdgeShape implements StructuredEdgeShape {
|
|
735
|
-
private readonly params;
|
|
736
|
-
readonly svg: SVGSVGElement;
|
|
737
|
-
readonly group: SVGGElement;
|
|
738
|
-
readonly line: SVGPathElement;
|
|
739
|
-
readonly sourceArrow: SVGPathElement | null;
|
|
740
|
-
readonly targetArrow: SVGPathElement | null;
|
|
741
|
-
readonly onAfterRender: EventHandler<StructuredEdgeRenderModel>;
|
|
742
|
-
private readonly afterRenderEmitter;
|
|
743
|
-
constructor(params: LineEdgeParams);
|
|
744
|
-
render(params: EdgeRenderParams): void;
|
|
745
|
-
}
|
|
746
|
-
|
|
747
651
|
export declare type MarkNodePortRequest = {
|
|
748
652
|
readonly id?: unknown | undefined;
|
|
749
653
|
readonly element: HTMLElement;
|
|
@@ -757,7 +661,7 @@ export declare interface MarkPortRequest {
|
|
|
757
661
|
readonly direction?: number;
|
|
758
662
|
}
|
|
759
663
|
|
|
760
|
-
declare class MidpointEdgeShape implements StructuredEdgeShape {
|
|
664
|
+
export declare class MidpointEdgeShape implements StructuredEdgeShape {
|
|
761
665
|
private readonly baseShape;
|
|
762
666
|
readonly midpointElement: SVGElement;
|
|
763
667
|
readonly group: SVGGElement;
|
|
@@ -766,29 +670,12 @@ declare class MidpointEdgeShape implements StructuredEdgeShape {
|
|
|
766
670
|
readonly targetArrow: SVGPathElement | null;
|
|
767
671
|
readonly onAfterRender: EventHandler<StructuredEdgeRenderModel>;
|
|
768
672
|
readonly svg: SVGSVGElement;
|
|
769
|
-
/**
|
|
770
|
-
* @deprecated
|
|
771
|
-
* use midpointElement instead
|
|
772
|
-
*/
|
|
773
|
-
readonly medianElement: SVGElement;
|
|
774
673
|
constructor(baseShape: StructuredEdgeShape, midpointElement: SVGElement);
|
|
775
674
|
render(params: EdgeRenderParams): void;
|
|
776
675
|
}
|
|
777
|
-
export { MidpointEdgeShape as MedianEdgeShape }
|
|
778
|
-
export { MidpointEdgeShape }
|
|
779
676
|
|
|
780
677
|
export declare type MouseEventVerifier = (event: MouseEvent) => boolean;
|
|
781
678
|
|
|
782
|
-
/**
|
|
783
|
-
* TODO: replace with node ID
|
|
784
|
-
*/
|
|
785
|
-
export declare interface NodeDragPayload {
|
|
786
|
-
readonly nodeId: unknown;
|
|
787
|
-
readonly element: HTMLElement;
|
|
788
|
-
readonly x: number;
|
|
789
|
-
readonly y: number;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
679
|
declare interface NodePayload {
|
|
793
680
|
readonly element: HTMLElement;
|
|
794
681
|
x: number;
|
|
@@ -825,13 +712,6 @@ declare type Priority = ConstantPriority | IncrementalPriority | CustomPriority;
|
|
|
825
712
|
|
|
826
713
|
export declare type PriorityFn = () => number;
|
|
827
714
|
|
|
828
|
-
export declare interface RenderingBox {
|
|
829
|
-
readonly x: number;
|
|
830
|
-
readonly y: number;
|
|
831
|
-
readonly width: number;
|
|
832
|
-
readonly height: number;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
715
|
export declare interface ScaleLimitPreprocessorParams {
|
|
836
716
|
readonly minContentScale: number | null;
|
|
837
717
|
readonly maxContentScale: number | null;
|
|
@@ -980,11 +860,6 @@ export declare interface VerticalEdgeParams {
|
|
|
980
860
|
readonly cycleSquareSide?: number | undefined;
|
|
981
861
|
readonly roundness?: number | undefined;
|
|
982
862
|
readonly detourDistance?: number | undefined;
|
|
983
|
-
/**
|
|
984
|
-
* @deprecated
|
|
985
|
-
* do not use
|
|
986
|
-
*/
|
|
987
|
-
readonly detourDirection?: number | undefined;
|
|
988
863
|
}
|
|
989
864
|
|
|
990
865
|
export declare class VerticalEdgeShape implements StructuredEdgeShape {
|
|
@@ -1016,11 +891,6 @@ declare type VerticalEdgeShapeConfig = {
|
|
|
1016
891
|
|
|
1017
892
|
export declare class Viewport {
|
|
1018
893
|
private readonly viewportStore;
|
|
1019
|
-
/**
|
|
1020
|
-
* @deprecated
|
|
1021
|
-
* do not use
|
|
1022
|
-
*/
|
|
1023
|
-
readonly onBeforeUpdated: EventHandler<void>;
|
|
1024
894
|
readonly onAfterUpdated: EventHandler<void>;
|
|
1025
895
|
constructor(viewportStore: ViewportStore);
|
|
1026
896
|
getViewportMatrix(): TransformState;
|
|
@@ -1032,12 +902,6 @@ declare class ViewportStore {
|
|
|
1032
902
|
private contentMatrix;
|
|
1033
903
|
private readonly afterUpdateEmitter;
|
|
1034
904
|
readonly onAfterUpdated: EventHandler<void>;
|
|
1035
|
-
private readonly beforeUpdateEmitter;
|
|
1036
|
-
/**
|
|
1037
|
-
* @deprecated
|
|
1038
|
-
* do not use
|
|
1039
|
-
*/
|
|
1040
|
-
readonly onBeforeUpdated: EventHandler<void>;
|
|
1041
905
|
constructor();
|
|
1042
906
|
getViewportMatrix(): TransformState;
|
|
1043
907
|
getContentMatrix(): TransformState;
|
|
@@ -1045,7 +909,7 @@ declare class ViewportStore {
|
|
|
1045
909
|
patchContentMatrix(matrix: PatchTransformRequest): void;
|
|
1046
910
|
}
|
|
1047
911
|
|
|
1048
|
-
declare interface ViewportTransformConfig {
|
|
912
|
+
export declare interface ViewportTransformConfig {
|
|
1049
913
|
readonly scale?: {
|
|
1050
914
|
readonly mouseWheelSensitivity?: number;
|
|
1051
915
|
readonly mouseWheelEventVerifier?: (event: WheelEvent) => boolean;
|
|
@@ -1066,8 +930,6 @@ declare interface ViewportTransformConfig {
|
|
|
1066
930
|
readonly onResizeTransformFinished?: () => void;
|
|
1067
931
|
};
|
|
1068
932
|
}
|
|
1069
|
-
export { ViewportTransformConfig as TransformOptions }
|
|
1070
|
-
export { ViewportTransformConfig }
|
|
1071
933
|
|
|
1072
934
|
export declare interface VirtualScrollConfig {
|
|
1073
935
|
readonly nodeContainingRadius: {
|