@html-graph/html-graph 3.12.0 → 3.14.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 -1
- package/dist/html-graph.d.ts +64 -23
- package/dist/html-graph.js +1947 -1771
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
### Graph visualization library that enables nodes customization using HTML
|
|
6
6
|
|
|
7
7
|
<a target="_blank" href="https://html-graph.github.io/use-cases/advanced-demo/">
|
|
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
11
|
Instead of connecting nodes directly, this library utilizes the concept of ports,
|
package/dist/html-graph.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ export declare class Canvas {
|
|
|
101
101
|
private readonly graphStore;
|
|
102
102
|
private readonly viewportStore;
|
|
103
103
|
private readonly htmlView;
|
|
104
|
-
private readonly
|
|
104
|
+
private readonly params;
|
|
105
105
|
/**
|
|
106
106
|
* provides api for accessing model of rendered graph
|
|
107
107
|
*/
|
|
@@ -134,7 +134,7 @@ export declare class Canvas {
|
|
|
134
134
|
/**
|
|
135
135
|
* @deprecated access element directly instead
|
|
136
136
|
*/
|
|
137
|
-
element: HTMLElement, graphStore: GraphStore, viewportStore: ViewportStore, htmlView: HtmlView,
|
|
137
|
+
element: HTMLElement, graphStore: GraphStore, viewportStore: ViewportStore, htmlView: HtmlView, params: CanvasParams);
|
|
138
138
|
/**
|
|
139
139
|
* adds new node
|
|
140
140
|
*/
|
|
@@ -201,12 +201,14 @@ export declare class CanvasBuilder {
|
|
|
201
201
|
private transformConfig;
|
|
202
202
|
private backgroundConfig;
|
|
203
203
|
private connectablePortsConfig;
|
|
204
|
+
private draggableEdgesConfig;
|
|
204
205
|
private virtualScrollConfig;
|
|
205
206
|
private hasDraggableNode;
|
|
206
207
|
private hasTransformableViewport;
|
|
207
208
|
private hasResizeReactiveNodes;
|
|
208
209
|
private hasBackground;
|
|
209
210
|
private hasUserConnectablePorts;
|
|
211
|
+
private hasUserDraggableEdges;
|
|
210
212
|
private boxRenderingTrigger;
|
|
211
213
|
private readonly window;
|
|
212
214
|
constructor(element?: HTMLElement);
|
|
@@ -248,6 +250,7 @@ export declare class CanvasBuilder {
|
|
|
248
250
|
* enables edge creation by dragging one port to another
|
|
249
251
|
*/
|
|
250
252
|
enableUserConnectablePorts(config?: ConnectablePortsConfig): CanvasBuilder;
|
|
253
|
+
enableUserDraggableEdges(config?: DraggableEdgesConfig): CanvasBuilder;
|
|
251
254
|
/**
|
|
252
255
|
* builds final canvas
|
|
253
256
|
*/
|
|
@@ -298,6 +301,20 @@ export declare interface CanvasDefaults {
|
|
|
298
301
|
};
|
|
299
302
|
}
|
|
300
303
|
|
|
304
|
+
declare interface CanvasParams {
|
|
305
|
+
readonly nodes: {
|
|
306
|
+
readonly centerFn: CenterFn;
|
|
307
|
+
readonly priorityFn: PriorityFn;
|
|
308
|
+
};
|
|
309
|
+
readonly ports: {
|
|
310
|
+
readonly direction: number;
|
|
311
|
+
};
|
|
312
|
+
readonly edges: {
|
|
313
|
+
readonly shapeFactory: EdgeShapeFactory;
|
|
314
|
+
readonly priorityFn: PriorityFn;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
|
|
301
318
|
export declare type CenterFn = (width: number, height: number) => Point;
|
|
302
319
|
|
|
303
320
|
declare interface ConnectablePortsConfig {
|
|
@@ -324,20 +341,6 @@ declare type ConstantPriority = number;
|
|
|
324
341
|
|
|
325
342
|
declare type CustomPriority = PriorityFn;
|
|
326
343
|
|
|
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
344
|
export declare interface DirectEdgeParams {
|
|
342
345
|
readonly color?: string | undefined;
|
|
343
346
|
readonly width?: number | undefined;
|
|
@@ -376,6 +379,19 @@ declare interface DotsRenderer {
|
|
|
376
379
|
readonly color?: string;
|
|
377
380
|
}
|
|
378
381
|
|
|
382
|
+
declare interface DraggableEdgesConfig {
|
|
383
|
+
readonly connectionPreprocessor?: ConnectionPreprocessor;
|
|
384
|
+
readonly mouseDownEventVerifier?: MouseEventVerifier;
|
|
385
|
+
readonly mouseUpEventVerifier?: MouseEventVerifier;
|
|
386
|
+
readonly draggingEdgeResolver?: DraggingEdgeResolver;
|
|
387
|
+
readonly draggingEdgeShape?: EdgeShapeConfig;
|
|
388
|
+
readonly events?: {
|
|
389
|
+
readonly onAfterEdgeReattached?: (edgeId: unknown) => void;
|
|
390
|
+
readonly onEdgeReattachInterrupted?: (edge: GraphEdge) => void;
|
|
391
|
+
readonly onEdgeReattachPrevented?: (request: AddEdgeRequest) => void;
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
|
|
379
395
|
declare interface DraggableNodesConfig {
|
|
380
396
|
readonly moveOnTop?: boolean;
|
|
381
397
|
readonly moveEdgesOnTop?: boolean;
|
|
@@ -393,9 +409,11 @@ declare interface DraggableNodesConfig {
|
|
|
393
409
|
export { DraggableNodesConfig as DragOptions }
|
|
394
410
|
export { DraggableNodesConfig }
|
|
395
411
|
|
|
412
|
+
export declare type DraggingEdgeResolver = (portId: unknown) => unknown | null;
|
|
413
|
+
|
|
396
414
|
declare interface EdgePath {
|
|
397
415
|
readonly path: string;
|
|
398
|
-
readonly
|
|
416
|
+
readonly midpoint: Point;
|
|
399
417
|
}
|
|
400
418
|
|
|
401
419
|
declare type EdgePathFactory = (sourceDirection: Point, targetDirection: Point, to: Point, flipX: number, flipY: number) => EdgePath;
|
|
@@ -469,14 +487,29 @@ export declare class Graph {
|
|
|
469
487
|
getPort(portId: unknown): GraphPort | null;
|
|
470
488
|
getAllPortIds(): readonly unknown[];
|
|
471
489
|
getNodePortIds(nodeId: unknown): readonly unknown[] | null;
|
|
490
|
+
getElementPortIds(element: HTMLElement): readonly unknown[];
|
|
491
|
+
/**
|
|
492
|
+
* @deprecated
|
|
493
|
+
* use getElementPortIds instead
|
|
494
|
+
*/
|
|
472
495
|
getElementPortsIds(element: HTMLElement): readonly unknown[];
|
|
473
496
|
getAllEdgeIds(): readonly unknown[];
|
|
474
497
|
getEdge(edgeId: unknown): GraphEdge | null;
|
|
475
498
|
getPortIncomingEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
499
|
+
getPortOutgoingEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
500
|
+
/**
|
|
501
|
+
* @deprecated
|
|
502
|
+
* use getPortOutgoingEdgeIds instead
|
|
503
|
+
*/
|
|
476
504
|
getPortOutcomingEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
477
505
|
getPortCycleEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
478
506
|
getPortAdjacentEdgeIds(portId: unknown): readonly unknown[] | null;
|
|
479
507
|
getNodeIncomingEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
508
|
+
getNodeOutgoingEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
509
|
+
/**
|
|
510
|
+
* @deprecated
|
|
511
|
+
* use getNodeOutgoingEdgeIds instead
|
|
512
|
+
*/
|
|
480
513
|
getNodeOutcomingEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
481
514
|
getNodeCycleEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
482
515
|
getNodeAdjacentEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
@@ -486,6 +519,7 @@ export declare interface GraphEdge {
|
|
|
486
519
|
readonly from: unknown;
|
|
487
520
|
readonly to: unknown;
|
|
488
521
|
readonly priority: number;
|
|
522
|
+
readonly shape: EdgeShape;
|
|
489
523
|
}
|
|
490
524
|
|
|
491
525
|
export declare interface GraphNode {
|
|
@@ -548,7 +582,7 @@ declare class GraphStore {
|
|
|
548
582
|
getPort(portId: unknown): PortPayload | undefined;
|
|
549
583
|
updatePort(portId: unknown, request: UpdatePortRequest_2): void;
|
|
550
584
|
getAllPortIds(): readonly unknown[];
|
|
551
|
-
|
|
585
|
+
getElementPortIds(element: HTMLElement): readonly unknown[];
|
|
552
586
|
getNodePortIds(nodeId: unknown): readonly unknown[] | undefined;
|
|
553
587
|
removePort(portId: unknown): void;
|
|
554
588
|
addEdge(request: AddEdgeRequest_2): void;
|
|
@@ -558,11 +592,11 @@ declare class GraphStore {
|
|
|
558
592
|
removeEdge(edgeId: unknown): void;
|
|
559
593
|
clear(): void;
|
|
560
594
|
getPortIncomingEdgeIds(portId: unknown): readonly unknown[];
|
|
561
|
-
|
|
595
|
+
getPortOutgoingEdgeIds(portId: unknown): readonly unknown[];
|
|
562
596
|
getPortCycleEdgeIds(portId: unknown): readonly unknown[];
|
|
563
597
|
getPortAdjacentEdgeIds(portId: unknown): readonly unknown[];
|
|
564
598
|
getNodeIncomingEdgeIds(nodeId: unknown): readonly unknown[];
|
|
565
|
-
|
|
599
|
+
getNodeOutgoingEdgeIds(nodeId: unknown): readonly unknown[];
|
|
566
600
|
getNodeCycleEdgeIds(nodeId: unknown): readonly unknown[];
|
|
567
601
|
getNodeAdjacentEdgeIds(nodeId: unknown): readonly unknown[];
|
|
568
602
|
private addEdgeInternal;
|
|
@@ -696,18 +730,25 @@ export declare interface MarkPortRequest {
|
|
|
696
730
|
readonly direction?: number;
|
|
697
731
|
}
|
|
698
732
|
|
|
699
|
-
|
|
733
|
+
declare class MidpointEdgeShape implements StructuredEdgeShape {
|
|
700
734
|
private readonly baseShape;
|
|
701
|
-
readonly
|
|
735
|
+
readonly midpointElement: SVGElement;
|
|
702
736
|
readonly group: SVGGElement;
|
|
703
737
|
readonly line: SVGPathElement;
|
|
704
738
|
readonly sourceArrow: SVGPathElement | null;
|
|
705
739
|
readonly targetArrow: SVGPathElement | null;
|
|
706
740
|
readonly onAfterRender: EventHandler<StructuredEdgeRenderModel>;
|
|
707
741
|
readonly svg: SVGSVGElement;
|
|
708
|
-
|
|
742
|
+
/**
|
|
743
|
+
* @deprecated
|
|
744
|
+
* use midpointElement instead
|
|
745
|
+
*/
|
|
746
|
+
readonly medianElement: SVGElement;
|
|
747
|
+
constructor(baseShape: StructuredEdgeShape, midpointElement: SVGElement);
|
|
709
748
|
render(params: EdgeRenderParams): void;
|
|
710
749
|
}
|
|
750
|
+
export { MidpointEdgeShape as MedianEdgeShape }
|
|
751
|
+
export { MidpointEdgeShape }
|
|
711
752
|
|
|
712
753
|
export declare type MouseEventVerifier = (event: MouseEvent) => boolean;
|
|
713
754
|
|