@html-graph/html-graph 1.1.0 → 1.2.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/main.d.ts +199 -16
- package/dist/main.js +1758 -1333
- package/dist/main.umd.cjs +1 -1
- package/package.json +1 -3
package/dist/main.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare interface AddEdgeRequest {
|
|
2
2
|
readonly id?: unknown | undefined;
|
|
3
|
-
readonly from:
|
|
4
|
-
readonly to:
|
|
3
|
+
readonly from: unknown;
|
|
4
|
+
readonly to: unknown;
|
|
5
5
|
readonly shape?: EdgeShape | undefined;
|
|
6
6
|
readonly priority?: number | undefined;
|
|
7
7
|
}
|
|
@@ -90,6 +90,21 @@ declare interface BezierEdgeShape_2 {
|
|
|
90
90
|
readonly detourDirection?: number | undefined;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
declare interface BezierEdgeShape_3 {
|
|
94
|
+
readonly type?: "bezier" | undefined;
|
|
95
|
+
readonly color?: string | undefined;
|
|
96
|
+
readonly width?: number | undefined;
|
|
97
|
+
readonly curvature?: number | undefined;
|
|
98
|
+
readonly arrowLength?: number | undefined;
|
|
99
|
+
readonly arrowWidth?: number | undefined;
|
|
100
|
+
readonly hasSourceArrow?: boolean | undefined;
|
|
101
|
+
readonly hasTargetArrow?: boolean | undefined;
|
|
102
|
+
readonly cycleRadius?: number | undefined;
|
|
103
|
+
readonly smallCycleRadius?: number | undefined;
|
|
104
|
+
readonly detourDistance?: number | undefined;
|
|
105
|
+
readonly detourDirection?: number | undefined;
|
|
106
|
+
}
|
|
107
|
+
|
|
93
108
|
export declare interface Canvas {
|
|
94
109
|
/**
|
|
95
110
|
* provides api for accessing graph model
|
|
@@ -172,42 +187,73 @@ declare class CanvasBuilder {
|
|
|
172
187
|
private coreOptions;
|
|
173
188
|
private dragOptions;
|
|
174
189
|
private transformOptions;
|
|
175
|
-
private
|
|
176
|
-
private
|
|
190
|
+
private hasDraggableNode;
|
|
191
|
+
private hasTransformableViewport;
|
|
177
192
|
private hasResizeReactiveNodes;
|
|
193
|
+
private boxRenderingTrigger;
|
|
194
|
+
/**
|
|
195
|
+
* specifies options for fundamental aspects of visualization
|
|
196
|
+
*/
|
|
178
197
|
setOptions(options: CoreOptions): CanvasBuilder;
|
|
198
|
+
/**
|
|
199
|
+
* enables nodes draggable bu user
|
|
200
|
+
*/
|
|
179
201
|
setUserDraggableNodes(options?: DragOptions): CanvasBuilder;
|
|
180
202
|
/**
|
|
181
203
|
* @deprecated
|
|
182
204
|
* use setUserTransformableViewport instead
|
|
183
205
|
*/
|
|
184
206
|
setUserTransformableCanvas(options?: TransformOptions): CanvasBuilder;
|
|
207
|
+
/**
|
|
208
|
+
* enables viewport transformable by user
|
|
209
|
+
*/
|
|
185
210
|
setUserTransformableViewport(options?: TransformOptions): CanvasBuilder;
|
|
211
|
+
/**
|
|
212
|
+
* enables automatic edges update on node resize
|
|
213
|
+
*/
|
|
186
214
|
setResizeReactiveNodes(): CanvasBuilder;
|
|
215
|
+
/**
|
|
216
|
+
* sets emitter for rendering graph inside bounded area
|
|
217
|
+
*/
|
|
218
|
+
setBoxRenderingTrigger(trigger: EventSubject<RenderingBox>): CanvasBuilder;
|
|
219
|
+
/**
|
|
220
|
+
* builds final canvas
|
|
221
|
+
*/
|
|
187
222
|
build(): Canvas;
|
|
188
223
|
}
|
|
189
224
|
export { CanvasBuilder }
|
|
190
225
|
export { CanvasBuilder as HtmlGraphBuilder }
|
|
191
226
|
|
|
192
227
|
/**
|
|
193
|
-
*
|
|
228
|
+
* @deprecated
|
|
194
229
|
*/
|
|
195
230
|
export declare class CanvasCore implements Canvas {
|
|
196
|
-
private readonly apiOptions?;
|
|
197
231
|
readonly transformation: PublicViewportTransformer;
|
|
198
232
|
readonly model: PublicGraphStore;
|
|
199
|
-
private readonly
|
|
200
|
-
private readonly
|
|
201
|
-
|
|
233
|
+
private readonly internalTransformation;
|
|
234
|
+
private readonly internalModel;
|
|
235
|
+
private readonly graphStoreController;
|
|
236
|
+
private readonly htmlView;
|
|
237
|
+
private readonly onAfterNodeAdded;
|
|
238
|
+
private readonly onAfterEdgeAdded;
|
|
239
|
+
private readonly onAfterEdgeShapeUpdated;
|
|
240
|
+
private readonly onAfterEdgePriorityUpdated;
|
|
241
|
+
private readonly onAfterEdgeUpdated;
|
|
242
|
+
private readonly onAfterPortUpdated;
|
|
243
|
+
private readonly onAfterNodePriorityUpdated;
|
|
244
|
+
private readonly onAfterNodeUpdated;
|
|
245
|
+
private readonly onBeforeEdgeRemoved;
|
|
246
|
+
private readonly onBeforeNodeRemoved;
|
|
247
|
+
constructor(apiOptions?: CoreOptions_2);
|
|
202
248
|
attach(element: HTMLElement): CanvasCore;
|
|
203
249
|
detach(): CanvasCore;
|
|
204
250
|
addNode(request: AddNodeRequest): CanvasCore;
|
|
205
251
|
updateNode(nodeId: unknown, request?: UpdateNodeRequest): CanvasCore;
|
|
206
252
|
removeNode(nodeId: unknown): CanvasCore;
|
|
207
|
-
addEdge(
|
|
253
|
+
addEdge(request: AddEdgeRequest): CanvasCore;
|
|
208
254
|
updateEdge(edgeId: unknown, request?: UpdateEdgeRequest): CanvasCore;
|
|
209
255
|
removeEdge(edgeId: unknown): CanvasCore;
|
|
210
|
-
markPort(
|
|
256
|
+
markPort(request: MarkPortRequest): CanvasCore;
|
|
211
257
|
updatePort(portId: string, request?: UpdatePortRequest): CanvasCore;
|
|
212
258
|
unmarkPort(portId: string): CanvasCore;
|
|
213
259
|
patchViewportMatrix(request: PatchMatrixRequest): CanvasCore;
|
|
@@ -220,6 +266,8 @@ export declare type CenterFn = (width: number, height: number) => Point;
|
|
|
220
266
|
|
|
221
267
|
declare type ConstantPriority = number;
|
|
222
268
|
|
|
269
|
+
declare type ConstantPriority_2 = number;
|
|
270
|
+
|
|
223
271
|
export declare interface CoreOptions {
|
|
224
272
|
/**
|
|
225
273
|
* nodes related behavior
|
|
@@ -259,8 +307,49 @@ export declare interface CoreOptions {
|
|
|
259
307
|
};
|
|
260
308
|
}
|
|
261
309
|
|
|
310
|
+
declare interface CoreOptions_2 {
|
|
311
|
+
/**
|
|
312
|
+
* nodes related behavior
|
|
313
|
+
*/
|
|
314
|
+
readonly nodes?: {
|
|
315
|
+
/**
|
|
316
|
+
* specifies how to determine center of node
|
|
317
|
+
* center of nodes specified in addNode method by x and y
|
|
318
|
+
*/
|
|
319
|
+
readonly centerFn?: CenterFn;
|
|
320
|
+
/**
|
|
321
|
+
* specifies default z-index value
|
|
322
|
+
*/
|
|
323
|
+
readonly priority?: Priority_2;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* ports related behavior
|
|
327
|
+
*/
|
|
328
|
+
readonly ports?: {
|
|
329
|
+
/**
|
|
330
|
+
* specifies default direction of port
|
|
331
|
+
*/
|
|
332
|
+
readonly direction?: number;
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
*edges related behavior
|
|
336
|
+
*/
|
|
337
|
+
readonly edges?: {
|
|
338
|
+
/**
|
|
339
|
+
* specifies default controller
|
|
340
|
+
*/
|
|
341
|
+
readonly shape?: EdgeShape_3;
|
|
342
|
+
/**
|
|
343
|
+
* specifies default z-index value
|
|
344
|
+
*/
|
|
345
|
+
readonly priority?: Priority_2;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
262
349
|
declare type CustomPriority = PriorityFn;
|
|
263
350
|
|
|
351
|
+
declare type CustomPriority_2 = PriorityFn;
|
|
352
|
+
|
|
264
353
|
export declare interface DragOptions {
|
|
265
354
|
readonly moveOnTop?: boolean;
|
|
266
355
|
readonly mouse?: {
|
|
@@ -271,7 +360,7 @@ export declare interface DragOptions {
|
|
|
271
360
|
readonly events?: {
|
|
272
361
|
readonly onNodeDrag?: (payload: NodeDragPayload) => void;
|
|
273
362
|
readonly onBeforeNodeDrag?: (payload: NodeDragPayload) => boolean;
|
|
274
|
-
readonly onNodeDragFinished?: (
|
|
363
|
+
readonly onNodeDragFinished?: (payload: NodeDragPayload) => void;
|
|
275
364
|
};
|
|
276
365
|
}
|
|
277
366
|
|
|
@@ -304,8 +393,28 @@ export declare interface EdgeShape {
|
|
|
304
393
|
|
|
305
394
|
declare type EdgeShape_2 = BezierEdgeShape_2 | StraightEdgeShape_2 | HorizontalEdgeShape_2 | VerticalEdgeShape_2 | EdgeShapeFactory;
|
|
306
395
|
|
|
396
|
+
declare type EdgeShape_3 = BezierEdgeShape_3 | StraightEdgeShape_3 | HorizontalEdgeShape_3 | VerticalEdgeShape_3 | EdgeShapeFactory_2;
|
|
397
|
+
|
|
307
398
|
declare type EdgeShapeFactory = () => EdgeShape;
|
|
308
399
|
|
|
400
|
+
declare type EdgeShapeFactory_2 = () => EdgeShape;
|
|
401
|
+
|
|
402
|
+
declare interface EventEmitter<T> {
|
|
403
|
+
emit(payload: T): void;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
declare interface EventHandler<T> {
|
|
407
|
+
subscribe(callback: (payload: T) => void): void;
|
|
408
|
+
unsubscribe(callback: (payload: T) => void): void;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export declare class EventSubject<T> implements EventEmitter<T>, EventHandler<T> {
|
|
412
|
+
private readonly callbacks;
|
|
413
|
+
subscribe(callback: (payload: T) => void): void;
|
|
414
|
+
unsubscribe(callback: (payload: T) => void): void;
|
|
415
|
+
emit(payload: T): void;
|
|
416
|
+
}
|
|
417
|
+
|
|
309
418
|
export declare interface GraphEdge {
|
|
310
419
|
readonly from: unknown;
|
|
311
420
|
readonly to: unknown;
|
|
@@ -325,6 +434,9 @@ export declare interface GraphPort {
|
|
|
325
434
|
readonly direction: number;
|
|
326
435
|
}
|
|
327
436
|
|
|
437
|
+
/**
|
|
438
|
+
* This entity is responsible for storing state of graph
|
|
439
|
+
*/
|
|
328
440
|
declare class GraphStore {
|
|
329
441
|
private readonly nodes;
|
|
330
442
|
private readonly ports;
|
|
@@ -409,12 +521,29 @@ declare interface HorizontalEdgeShape_2 {
|
|
|
409
521
|
readonly detourDirection?: number | undefined;
|
|
410
522
|
}
|
|
411
523
|
|
|
524
|
+
declare interface HorizontalEdgeShape_3 {
|
|
525
|
+
readonly type: "horizontal";
|
|
526
|
+
readonly color?: string | undefined;
|
|
527
|
+
readonly width?: number | undefined;
|
|
528
|
+
readonly arrowLength?: number | undefined;
|
|
529
|
+
readonly arrowWidth?: number | undefined;
|
|
530
|
+
readonly arrowOffset?: number | undefined;
|
|
531
|
+
readonly hasSourceArrow?: boolean | undefined;
|
|
532
|
+
readonly hasTargetArrow?: boolean | undefined;
|
|
533
|
+
readonly cycleSquareSide?: number | undefined;
|
|
534
|
+
readonly roundness?: number | undefined;
|
|
535
|
+
readonly detourDistance?: number | undefined;
|
|
536
|
+
readonly detourDirection?: number | undefined;
|
|
537
|
+
}
|
|
538
|
+
|
|
412
539
|
export declare class HtmlGraphError extends Error {
|
|
413
540
|
readonly name = "HtmlGraphError";
|
|
414
541
|
}
|
|
415
542
|
|
|
416
543
|
declare type IncrementalPriority = "incremental";
|
|
417
544
|
|
|
545
|
+
declare type IncrementalPriority_2 = "incremental";
|
|
546
|
+
|
|
418
547
|
export declare type MarkNodePortRequest = {
|
|
419
548
|
readonly id?: unknown | undefined;
|
|
420
549
|
readonly element: HTMLElement;
|
|
@@ -422,10 +551,10 @@ export declare type MarkNodePortRequest = {
|
|
|
422
551
|
};
|
|
423
552
|
|
|
424
553
|
export declare interface MarkPortRequest {
|
|
425
|
-
readonly id?: unknown
|
|
554
|
+
readonly id?: unknown;
|
|
426
555
|
readonly element: HTMLElement;
|
|
427
556
|
readonly nodeId: unknown;
|
|
428
|
-
readonly direction?: number
|
|
557
|
+
readonly direction?: number;
|
|
429
558
|
}
|
|
430
559
|
|
|
431
560
|
export declare interface NodeDragPayload {
|
|
@@ -467,8 +596,13 @@ declare interface PortPayload {
|
|
|
467
596
|
|
|
468
597
|
declare type Priority = ConstantPriority | IncrementalPriority | SharedIncrementalPriority | CustomPriority;
|
|
469
598
|
|
|
599
|
+
declare type Priority_2 = ConstantPriority_2 | IncrementalPriority_2 | SharedIncrementalPriority_2 | CustomPriority_2;
|
|
600
|
+
|
|
470
601
|
export declare type PriorityFn = () => number;
|
|
471
602
|
|
|
603
|
+
/**
|
|
604
|
+
* This entity is responsible for providing access to end user in a safe way
|
|
605
|
+
*/
|
|
472
606
|
export declare class PublicGraphStore {
|
|
473
607
|
private readonly graphStore;
|
|
474
608
|
constructor(graphStore: GraphStore);
|
|
@@ -490,6 +624,10 @@ export declare class PublicGraphStore {
|
|
|
490
624
|
getNodeAdjacentEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
491
625
|
}
|
|
492
626
|
|
|
627
|
+
/**
|
|
628
|
+
* This entity is responsible for providing viewport transformation state to the
|
|
629
|
+
* end user in a safe way
|
|
630
|
+
*/
|
|
493
631
|
export declare class PublicViewportTransformer {
|
|
494
632
|
private readonly transformer;
|
|
495
633
|
constructor(transformer: ViewportTransformer);
|
|
@@ -497,6 +635,13 @@ export declare class PublicViewportTransformer {
|
|
|
497
635
|
getContentMatrix(): TransformState;
|
|
498
636
|
}
|
|
499
637
|
|
|
638
|
+
export declare interface RenderingBox {
|
|
639
|
+
readonly x: number;
|
|
640
|
+
readonly y: number;
|
|
641
|
+
readonly width: number;
|
|
642
|
+
readonly height: number;
|
|
643
|
+
}
|
|
644
|
+
|
|
500
645
|
export declare class ResizeReactiveNodesCanvas implements Canvas {
|
|
501
646
|
private readonly canvas;
|
|
502
647
|
readonly transformation: PublicViewportTransformer;
|
|
@@ -520,7 +665,7 @@ export declare class ResizeReactiveNodesCanvas implements Canvas {
|
|
|
520
665
|
patchContentMatrix(request: PatchMatrixRequest): ResizeReactiveNodesCanvas;
|
|
521
666
|
clear(): ResizeReactiveNodesCanvas;
|
|
522
667
|
destroy(): void;
|
|
523
|
-
private
|
|
668
|
+
private handleNodeResize;
|
|
524
669
|
}
|
|
525
670
|
|
|
526
671
|
export declare interface ScaleLimitPreprocessorParams {
|
|
@@ -530,6 +675,8 @@ export declare interface ScaleLimitPreprocessorParams {
|
|
|
530
675
|
|
|
531
676
|
declare type SharedIncrementalPriority = "shared-incremental";
|
|
532
677
|
|
|
678
|
+
declare type SharedIncrementalPriority_2 = "shared-incremental";
|
|
679
|
+
|
|
533
680
|
export declare interface ShiftLimitPreprocessorParams {
|
|
534
681
|
readonly minX: number | null;
|
|
535
682
|
readonly maxX: number | null;
|
|
@@ -585,6 +732,21 @@ declare interface StraightEdgeShape_2 {
|
|
|
585
732
|
readonly detourDirection?: number | undefined;
|
|
586
733
|
}
|
|
587
734
|
|
|
735
|
+
declare interface StraightEdgeShape_3 {
|
|
736
|
+
readonly type: "straight";
|
|
737
|
+
readonly color?: string | undefined;
|
|
738
|
+
readonly width?: number | undefined;
|
|
739
|
+
readonly arrowLength?: number | undefined;
|
|
740
|
+
readonly arrowWidth?: number | undefined;
|
|
741
|
+
readonly arrowOffset?: number | undefined;
|
|
742
|
+
readonly hasSourceArrow?: boolean | undefined;
|
|
743
|
+
readonly hasTargetArrow?: boolean | undefined;
|
|
744
|
+
readonly cycleSquareSide?: number | undefined;
|
|
745
|
+
readonly roundness?: number | undefined;
|
|
746
|
+
readonly detourDistance?: number | undefined;
|
|
747
|
+
readonly detourDirection?: number | undefined;
|
|
748
|
+
}
|
|
749
|
+
|
|
588
750
|
export declare interface TransformOptions {
|
|
589
751
|
readonly scale?: {
|
|
590
752
|
readonly mouseWheelSensitivity?: number;
|
|
@@ -652,7 +814,7 @@ export declare interface UpdateNodeRequest {
|
|
|
652
814
|
}
|
|
653
815
|
|
|
654
816
|
export declare interface UpdatePortRequest {
|
|
655
|
-
readonly direction?: number
|
|
817
|
+
readonly direction?: number;
|
|
656
818
|
}
|
|
657
819
|
|
|
658
820
|
export declare class UserDraggableNodesCanvas implements Canvas {
|
|
@@ -786,9 +948,30 @@ declare interface VerticalEdgeShape_2 {
|
|
|
786
948
|
readonly detourDirection?: number | undefined;
|
|
787
949
|
}
|
|
788
950
|
|
|
951
|
+
declare interface VerticalEdgeShape_3 {
|
|
952
|
+
readonly type: "vertical";
|
|
953
|
+
readonly color?: string | undefined;
|
|
954
|
+
readonly width?: number | undefined;
|
|
955
|
+
readonly arrowLength?: number | undefined;
|
|
956
|
+
readonly arrowWidth?: number | undefined;
|
|
957
|
+
readonly arrowOffset?: number | undefined;
|
|
958
|
+
readonly hasSourceArrow?: boolean | undefined;
|
|
959
|
+
readonly hasTargetArrow?: boolean | undefined;
|
|
960
|
+
readonly cycleSquareSide?: number | undefined;
|
|
961
|
+
readonly roundness?: number | undefined;
|
|
962
|
+
readonly detourDistance?: number | undefined;
|
|
963
|
+
readonly detourDirection?: number | undefined;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* This entity is responsible for storing viewport transformation
|
|
968
|
+
*/
|
|
789
969
|
declare class ViewportTransformer {
|
|
790
970
|
private viewportMatrix;
|
|
791
971
|
private contentMatrix;
|
|
972
|
+
private readonly emitter;
|
|
973
|
+
readonly onAfterUpdate: EventHandler<void>;
|
|
974
|
+
constructor();
|
|
792
975
|
getViewportMatrix(): TransformState;
|
|
793
976
|
getContentMatrix(): TransformState;
|
|
794
977
|
patchViewportMatrix(matrix: PatchTransformRequest): void;
|