@html-graph/html-graph 3.7.0 → 3.9.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 +55 -70
- package/dist/html-graph.js +1468 -1332
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.d.ts
CHANGED
|
@@ -65,9 +65,6 @@ export declare interface BezierEdgeParams {
|
|
|
65
65
|
readonly detourDirection?: number | undefined;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
/**
|
|
69
|
-
* Responsibility: Providing edge shape connecting ports with bezier line
|
|
70
|
-
*/
|
|
71
68
|
export declare class BezierEdgeShape implements StructuredEdgeShape {
|
|
72
69
|
readonly svg: SVGSVGElement;
|
|
73
70
|
readonly group: SVGGElement;
|
|
@@ -95,9 +92,6 @@ declare type BezierEdgeShapeConfig = {
|
|
|
95
92
|
readonly type?: "bezier" | undefined;
|
|
96
93
|
} & BezierEdgeParams;
|
|
97
94
|
|
|
98
|
-
/**
|
|
99
|
-
* Responsibility: provides graph rendering API for end user
|
|
100
|
-
*/
|
|
101
95
|
export declare class Canvas {
|
|
102
96
|
/**
|
|
103
97
|
* @deprecated access element directly instead
|
|
@@ -106,6 +100,7 @@ export declare class Canvas {
|
|
|
106
100
|
private readonly graphStore;
|
|
107
101
|
private readonly viewportStore;
|
|
108
102
|
private readonly htmlView;
|
|
103
|
+
private readonly defaults;
|
|
109
104
|
/**
|
|
110
105
|
* provides api for accessing model of rendered graph
|
|
111
106
|
*/
|
|
@@ -114,7 +109,6 @@ export declare class Canvas {
|
|
|
114
109
|
* provides api for accessing viewport state
|
|
115
110
|
*/
|
|
116
111
|
readonly viewport: Viewport;
|
|
117
|
-
private readonly defaults;
|
|
118
112
|
private readonly nodeIdGenerator;
|
|
119
113
|
private readonly portIdGenerator;
|
|
120
114
|
private readonly edgeIdGenerator;
|
|
@@ -139,7 +133,7 @@ export declare class Canvas {
|
|
|
139
133
|
/**
|
|
140
134
|
* @deprecated access element directly instead
|
|
141
135
|
*/
|
|
142
|
-
element: HTMLElement, graphStore: GraphStore, viewportStore: ViewportStore, htmlView: HtmlView, defaults:
|
|
136
|
+
element: HTMLElement, graphStore: GraphStore, viewportStore: ViewportStore, htmlView: HtmlView, defaults: Defaults);
|
|
143
137
|
/**
|
|
144
138
|
* adds new node
|
|
145
139
|
*/
|
|
@@ -199,9 +193,6 @@ export declare class Canvas {
|
|
|
199
193
|
destroy(): void;
|
|
200
194
|
}
|
|
201
195
|
|
|
202
|
-
/**
|
|
203
|
-
* Responsibility: Constructs canvas based on specified configuration
|
|
204
|
-
*/
|
|
205
196
|
export declare class CanvasBuilder {
|
|
206
197
|
private element;
|
|
207
198
|
private canvasDefaults;
|
|
@@ -333,6 +324,51 @@ export declare type CreatePathFn = (sourceDirection: Point, targetDirection: Poi
|
|
|
333
324
|
|
|
334
325
|
declare type CustomPriority = PriorityFn;
|
|
335
326
|
|
|
327
|
+
declare interface Defaults {
|
|
328
|
+
readonly nodes: {
|
|
329
|
+
readonly centerFn: CenterFn;
|
|
330
|
+
readonly priorityFn: PriorityFn;
|
|
331
|
+
};
|
|
332
|
+
readonly ports: {
|
|
333
|
+
readonly direction: number;
|
|
334
|
+
};
|
|
335
|
+
readonly edges: {
|
|
336
|
+
readonly shapeFactory: EdgeShapeFactory;
|
|
337
|
+
readonly priorityFn: PriorityFn;
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export declare interface DirectEdgeParams {
|
|
342
|
+
readonly color?: string | undefined;
|
|
343
|
+
readonly width?: number | undefined;
|
|
344
|
+
readonly arrowLength?: number | undefined;
|
|
345
|
+
readonly arrowWidth?: number | undefined;
|
|
346
|
+
readonly hasSourceArrow?: boolean | undefined;
|
|
347
|
+
readonly hasTargetArrow?: boolean | undefined;
|
|
348
|
+
readonly sourceOffset?: number | undefined;
|
|
349
|
+
readonly targetOffset?: number | undefined;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export declare class DirectEdgeShape implements StructuredEdgeShape {
|
|
353
|
+
readonly svg: SVGSVGElement;
|
|
354
|
+
readonly group: SVGGElement;
|
|
355
|
+
readonly line: SVGPathElement;
|
|
356
|
+
readonly sourceArrow: SVGPathElement | null;
|
|
357
|
+
readonly targetArrow: SVGPathElement | null;
|
|
358
|
+
private readonly color;
|
|
359
|
+
private readonly width;
|
|
360
|
+
private readonly arrowLength;
|
|
361
|
+
private readonly arrowWidth;
|
|
362
|
+
private readonly sourceOffset;
|
|
363
|
+
private readonly targetOffset;
|
|
364
|
+
constructor(params?: DirectEdgeParams);
|
|
365
|
+
render(params: EdgeRenderParams): void;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
declare type DirectEdgeShapeConfig = {
|
|
369
|
+
readonly type: "direct";
|
|
370
|
+
} & DirectEdgeParams;
|
|
371
|
+
|
|
336
372
|
declare interface DotsRenderer {
|
|
337
373
|
readonly radius?: number;
|
|
338
374
|
readonly color?: string;
|
|
@@ -340,6 +376,7 @@ declare interface DotsRenderer {
|
|
|
340
376
|
|
|
341
377
|
declare interface DraggableNodesConfig {
|
|
342
378
|
readonly moveOnTop?: boolean;
|
|
379
|
+
readonly moveEdgesOnTop?: boolean;
|
|
343
380
|
readonly mouse?: {
|
|
344
381
|
readonly dragCursor?: string | null;
|
|
345
382
|
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
@@ -376,36 +413,24 @@ export declare interface EdgeRenderPort {
|
|
|
376
413
|
readonly nodeId: unknown;
|
|
377
414
|
}
|
|
378
415
|
|
|
379
|
-
/**
|
|
380
|
-
* Responsibility: Rendering edge via SVG
|
|
381
|
-
*/
|
|
382
416
|
export declare interface EdgeShape {
|
|
383
417
|
readonly svg: SVGSVGElement;
|
|
384
418
|
render(params: EdgeRenderParams): void;
|
|
385
419
|
}
|
|
386
420
|
|
|
387
|
-
declare type EdgeShapeConfig = BezierEdgeShapeConfig | StraightEdgeShapeConfig | HorizontalEdgeShapeConfig | VerticalEdgeShapeConfig | EdgeShapeFactory;
|
|
421
|
+
declare type EdgeShapeConfig = BezierEdgeShapeConfig | StraightEdgeShapeConfig | HorizontalEdgeShapeConfig | VerticalEdgeShapeConfig | DirectEdgeShapeConfig | EdgeShapeFactory;
|
|
388
422
|
|
|
389
423
|
declare type EdgeShapeFactory = (edgeId: unknown) => EdgeShape;
|
|
390
424
|
|
|
391
|
-
/**
|
|
392
|
-
* Responsibility: Provides a way to trigger events
|
|
393
|
-
*/
|
|
394
425
|
export declare interface EventEmitter<T> {
|
|
395
426
|
emit(payload: T): void;
|
|
396
427
|
}
|
|
397
428
|
|
|
398
|
-
/**
|
|
399
|
-
* Responsibility: Provides a way to handle events
|
|
400
|
-
*/
|
|
401
429
|
export declare interface EventHandler<T> {
|
|
402
430
|
subscribe(callback: (payload: T) => void): void;
|
|
403
431
|
unsubscribe(callback: (payload: T) => void): void;
|
|
404
432
|
}
|
|
405
433
|
|
|
406
|
-
/**
|
|
407
|
-
* Responsibility: Connects events and event handlers
|
|
408
|
-
*/
|
|
409
434
|
export declare class EventSubject<T> implements EventEmitter<T>, EventHandler<T> {
|
|
410
435
|
private readonly callbacks;
|
|
411
436
|
subscribe(callback: (payload: T) => void): void;
|
|
@@ -413,9 +438,6 @@ export declare class EventSubject<T> implements EventEmitter<T>, EventHandler<T>
|
|
|
413
438
|
emit(payload: T): void;
|
|
414
439
|
}
|
|
415
440
|
|
|
416
|
-
/**
|
|
417
|
-
* Responsibility: Provides access to graph model for end user
|
|
418
|
-
*/
|
|
419
441
|
export declare class Graph {
|
|
420
442
|
private readonly graphStore;
|
|
421
443
|
readonly onAfterNodeAdded: EventHandler<unknown>;
|
|
@@ -433,6 +455,7 @@ export declare class Graph {
|
|
|
433
455
|
readonly onBeforeClear: EventHandler<void>;
|
|
434
456
|
constructor(graphStore: GraphStore);
|
|
435
457
|
getNode(nodeId: unknown): GraphNode | null;
|
|
458
|
+
getElementNodeId(element: HTMLElement): unknown | null;
|
|
436
459
|
getAllNodeIds(): readonly unknown[];
|
|
437
460
|
getPort(portId: unknown): GraphPort | null;
|
|
438
461
|
getAllPortIds(): readonly unknown[];
|
|
@@ -470,13 +493,11 @@ export declare interface GraphPort {
|
|
|
470
493
|
readonly nodeId: unknown;
|
|
471
494
|
}
|
|
472
495
|
|
|
473
|
-
/**
|
|
474
|
-
* Responsibility: Store state of graph
|
|
475
|
-
*/
|
|
476
496
|
declare class GraphStore {
|
|
477
497
|
private readonly nodes;
|
|
478
498
|
private readonly ports;
|
|
479
499
|
private readonly edges;
|
|
500
|
+
private readonly nodesElementsMap;
|
|
480
501
|
private readonly incomingEdges;
|
|
481
502
|
private readonly outcomingEdges;
|
|
482
503
|
private readonly cycleEdges;
|
|
@@ -511,6 +532,7 @@ declare class GraphStore {
|
|
|
511
532
|
addNode(request: AddNodeRequest_2): void;
|
|
512
533
|
getAllNodeIds(): readonly unknown[];
|
|
513
534
|
getNode(nodeId: unknown): NodePayload | undefined;
|
|
535
|
+
getElementNodeId(element: HTMLElement): unknown | undefined;
|
|
514
536
|
updateNode(nodeId: unknown, request: UpdateNodeRequest_2): void;
|
|
515
537
|
removeNode(nodeId: unknown): void;
|
|
516
538
|
addPort(request: AddPortRequest): void;
|
|
@@ -552,10 +574,6 @@ export declare interface HorizontalEdgeParams {
|
|
|
552
574
|
readonly detourDirection?: number | undefined;
|
|
553
575
|
}
|
|
554
576
|
|
|
555
|
-
/**
|
|
556
|
-
* Responsibility: Providing edge shape connecting ports with horizontal angled
|
|
557
|
-
* line
|
|
558
|
-
*/
|
|
559
577
|
export declare class HorizontalEdgeShape implements StructuredEdgeShape {
|
|
560
578
|
readonly svg: SVGSVGElement;
|
|
561
579
|
readonly group: SVGGElement;
|
|
@@ -583,17 +601,10 @@ declare type HorizontalEdgeShapeConfig = {
|
|
|
583
601
|
readonly type: "horizontal";
|
|
584
602
|
} & HorizontalEdgeParams;
|
|
585
603
|
|
|
586
|
-
/**
|
|
587
|
-
* Responsibility: Library specific error to throw when unexpected action
|
|
588
|
-
* occured
|
|
589
|
-
*/
|
|
590
604
|
export declare class HtmlGraphError extends Error {
|
|
591
605
|
readonly name = "HtmlGraphError";
|
|
592
606
|
}
|
|
593
607
|
|
|
594
|
-
/**
|
|
595
|
-
* Responsibility: Provides access to DOM modifications
|
|
596
|
-
*/
|
|
597
608
|
declare interface HtmlView {
|
|
598
609
|
attachNode(nodeId: unknown): void;
|
|
599
610
|
detachNode(nodeId: unknown): void;
|
|
@@ -615,13 +626,12 @@ export declare class InteractiveEdgeError extends Error {
|
|
|
615
626
|
}
|
|
616
627
|
|
|
617
628
|
export declare interface InteractiveEdgeParams {
|
|
629
|
+
/**
|
|
630
|
+
* TODO: rename to 'radius'
|
|
631
|
+
*/
|
|
618
632
|
readonly width?: number;
|
|
619
633
|
}
|
|
620
634
|
|
|
621
|
-
/**
|
|
622
|
-
* Responsibility: Providing handle for attaching interactive behavior to an
|
|
623
|
-
* edge
|
|
624
|
-
*/
|
|
625
635
|
export declare class InteractiveEdgeShape implements StructuredEdgeShape {
|
|
626
636
|
private readonly structuredEdge;
|
|
627
637
|
readonly svg: SVGSVGElement;
|
|
@@ -649,9 +659,6 @@ export declare interface LineEdgeParams {
|
|
|
649
659
|
readonly createLinePath: CreatePathFn;
|
|
650
660
|
}
|
|
651
661
|
|
|
652
|
-
/**
|
|
653
|
-
* Responsibility: Providing low level core for single line structured edges
|
|
654
|
-
*/
|
|
655
662
|
export declare class LineEdgeShape implements StructuredEdgeShape {
|
|
656
663
|
private readonly params;
|
|
657
664
|
readonly svg: SVGSVGElement;
|
|
@@ -706,9 +713,6 @@ declare interface PatchTransformRequest {
|
|
|
706
713
|
readonly y?: number;
|
|
707
714
|
}
|
|
708
715
|
|
|
709
|
-
/**
|
|
710
|
-
* Responsibility: Specifies point coordinates
|
|
711
|
-
*/
|
|
712
716
|
export declare interface Point {
|
|
713
717
|
readonly x: number;
|
|
714
718
|
readonly y: number;
|
|
@@ -722,9 +726,6 @@ declare interface PortPayload {
|
|
|
722
726
|
|
|
723
727
|
declare type Priority = ConstantPriority | IncrementalPriority | CustomPriority;
|
|
724
728
|
|
|
725
|
-
/**
|
|
726
|
-
* Responsibility: Specifies how to determine Z-index of an entity in DOM
|
|
727
|
-
*/
|
|
728
729
|
export declare type PriorityFn = () => number;
|
|
729
730
|
|
|
730
731
|
export declare interface RenderingBox {
|
|
@@ -760,9 +761,6 @@ export declare interface StraightEdgeParams {
|
|
|
760
761
|
readonly detourDirection?: number | undefined;
|
|
761
762
|
}
|
|
762
763
|
|
|
763
|
-
/**
|
|
764
|
-
* Responsibility: Providing edge shape connecting ports with straight line
|
|
765
|
-
*/
|
|
766
764
|
export declare class StraightEdgeShape implements StructuredEdgeShape {
|
|
767
765
|
readonly svg: SVGSVGElement;
|
|
768
766
|
readonly group: SVGGElement;
|
|
@@ -790,9 +788,6 @@ declare type StraightEdgeShapeConfig = {
|
|
|
790
788
|
readonly type: "straight";
|
|
791
789
|
} & StraightEdgeParams;
|
|
792
790
|
|
|
793
|
-
/**
|
|
794
|
-
* Responsibility: Specifying EdgeShape with a standard visual structure
|
|
795
|
-
*/
|
|
796
791
|
export declare interface StructuredEdgeShape extends EdgeShape {
|
|
797
792
|
readonly group: SVGGElement;
|
|
798
793
|
readonly line: SVGPathElement;
|
|
@@ -883,10 +878,6 @@ export declare interface VerticalEdgeParams {
|
|
|
883
878
|
readonly detourDirection?: number | undefined;
|
|
884
879
|
}
|
|
885
880
|
|
|
886
|
-
/**
|
|
887
|
-
* Responsibility: Providing edge shape connecting ports with vertical angled
|
|
888
|
-
* line
|
|
889
|
-
*/
|
|
890
881
|
export declare class VerticalEdgeShape implements StructuredEdgeShape {
|
|
891
882
|
readonly svg: SVGSVGElement;
|
|
892
883
|
readonly group: SVGGElement;
|
|
@@ -914,9 +905,6 @@ declare type VerticalEdgeShapeConfig = {
|
|
|
914
905
|
readonly type: "vertical";
|
|
915
906
|
} & VerticalEdgeParams;
|
|
916
907
|
|
|
917
|
-
/**
|
|
918
|
-
* Responsibility: Provides access to viewport state for end user
|
|
919
|
-
*/
|
|
920
908
|
export declare class Viewport {
|
|
921
909
|
private readonly viewportStore;
|
|
922
910
|
readonly onBeforeUpdated: EventHandler<void>;
|
|
@@ -926,9 +914,6 @@ export declare class Viewport {
|
|
|
926
914
|
getContentMatrix(): TransformState;
|
|
927
915
|
}
|
|
928
916
|
|
|
929
|
-
/**
|
|
930
|
-
* Responsibility: Stores viewport transformation state
|
|
931
|
-
*/
|
|
932
917
|
declare class ViewportStore {
|
|
933
918
|
private viewportMatrix;
|
|
934
919
|
private contentMatrix;
|