@html-graph/html-graph 1.1.0 → 1.1.1
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 +160 -14
- package/dist/main.js +1652 -1341
- package/dist/main.umd.cjs +1 -1
- package/package.json +1 -3
package/dist/main.d.ts
CHANGED
|
@@ -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,8 +187,8 @@ 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;
|
|
178
193
|
setOptions(options: CoreOptions): CanvasBuilder;
|
|
179
194
|
setUserDraggableNodes(options?: DragOptions): CanvasBuilder;
|
|
@@ -190,24 +205,36 @@ export { CanvasBuilder }
|
|
|
190
205
|
export { CanvasBuilder as HtmlGraphBuilder }
|
|
191
206
|
|
|
192
207
|
/**
|
|
193
|
-
*
|
|
208
|
+
* @deprecated
|
|
194
209
|
*/
|
|
195
210
|
export declare class CanvasCore implements Canvas {
|
|
196
|
-
private readonly apiOptions?;
|
|
197
211
|
readonly transformation: PublicViewportTransformer;
|
|
198
212
|
readonly model: PublicGraphStore;
|
|
199
|
-
private readonly
|
|
200
|
-
private readonly
|
|
201
|
-
|
|
213
|
+
private readonly internalTransformation;
|
|
214
|
+
private readonly internalModel;
|
|
215
|
+
private readonly graphStoreController;
|
|
216
|
+
private readonly htmlController;
|
|
217
|
+
private readonly onAfterNodeAdded;
|
|
218
|
+
private readonly onAfterEdgeAdded;
|
|
219
|
+
private readonly onAfterEdgeShapeUpdated;
|
|
220
|
+
private readonly onAfterEdgePriorityUpdated;
|
|
221
|
+
private readonly onAfterEdgeUpdated;
|
|
222
|
+
private readonly onAfterPortUpdated;
|
|
223
|
+
private readonly onAfterNodePriorityUpdated;
|
|
224
|
+
private readonly onAfterNodeUpdated;
|
|
225
|
+
private readonly onBeforeEdgeRemoved;
|
|
226
|
+
private readonly onBeforeNodeRemoved;
|
|
227
|
+
private readonly onAfterTransformUpdate;
|
|
228
|
+
constructor(apiOptions?: CoreOptions_2);
|
|
202
229
|
attach(element: HTMLElement): CanvasCore;
|
|
203
230
|
detach(): CanvasCore;
|
|
204
231
|
addNode(request: AddNodeRequest): CanvasCore;
|
|
205
232
|
updateNode(nodeId: unknown, request?: UpdateNodeRequest): CanvasCore;
|
|
206
233
|
removeNode(nodeId: unknown): CanvasCore;
|
|
207
|
-
addEdge(
|
|
234
|
+
addEdge(request: AddEdgeRequest): CanvasCore;
|
|
208
235
|
updateEdge(edgeId: unknown, request?: UpdateEdgeRequest): CanvasCore;
|
|
209
236
|
removeEdge(edgeId: unknown): CanvasCore;
|
|
210
|
-
markPort(
|
|
237
|
+
markPort(request: MarkPortRequest): CanvasCore;
|
|
211
238
|
updatePort(portId: string, request?: UpdatePortRequest): CanvasCore;
|
|
212
239
|
unmarkPort(portId: string): CanvasCore;
|
|
213
240
|
patchViewportMatrix(request: PatchMatrixRequest): CanvasCore;
|
|
@@ -220,6 +247,8 @@ export declare type CenterFn = (width: number, height: number) => Point;
|
|
|
220
247
|
|
|
221
248
|
declare type ConstantPriority = number;
|
|
222
249
|
|
|
250
|
+
declare type ConstantPriority_2 = number;
|
|
251
|
+
|
|
223
252
|
export declare interface CoreOptions {
|
|
224
253
|
/**
|
|
225
254
|
* nodes related behavior
|
|
@@ -259,8 +288,49 @@ export declare interface CoreOptions {
|
|
|
259
288
|
};
|
|
260
289
|
}
|
|
261
290
|
|
|
291
|
+
declare interface CoreOptions_2 {
|
|
292
|
+
/**
|
|
293
|
+
* nodes related behavior
|
|
294
|
+
*/
|
|
295
|
+
readonly nodes?: {
|
|
296
|
+
/**
|
|
297
|
+
* specifies how to determine center of node
|
|
298
|
+
* center of nodes specified in addNode method by x and y
|
|
299
|
+
*/
|
|
300
|
+
readonly centerFn?: CenterFn;
|
|
301
|
+
/**
|
|
302
|
+
* specifies default z-index value
|
|
303
|
+
*/
|
|
304
|
+
readonly priority?: Priority_2;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* ports related behavior
|
|
308
|
+
*/
|
|
309
|
+
readonly ports?: {
|
|
310
|
+
/**
|
|
311
|
+
* specifies default direction of port
|
|
312
|
+
*/
|
|
313
|
+
readonly direction?: number;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
*edges related behavior
|
|
317
|
+
*/
|
|
318
|
+
readonly edges?: {
|
|
319
|
+
/**
|
|
320
|
+
* specifies default controller
|
|
321
|
+
*/
|
|
322
|
+
readonly shape?: EdgeShape_3;
|
|
323
|
+
/**
|
|
324
|
+
* specifies default z-index value
|
|
325
|
+
*/
|
|
326
|
+
readonly priority?: Priority_2;
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
262
330
|
declare type CustomPriority = PriorityFn;
|
|
263
331
|
|
|
332
|
+
declare type CustomPriority_2 = PriorityFn;
|
|
333
|
+
|
|
264
334
|
export declare interface DragOptions {
|
|
265
335
|
readonly moveOnTop?: boolean;
|
|
266
336
|
readonly mouse?: {
|
|
@@ -271,7 +341,7 @@ export declare interface DragOptions {
|
|
|
271
341
|
readonly events?: {
|
|
272
342
|
readonly onNodeDrag?: (payload: NodeDragPayload) => void;
|
|
273
343
|
readonly onBeforeNodeDrag?: (payload: NodeDragPayload) => boolean;
|
|
274
|
-
readonly onNodeDragFinished?: (
|
|
344
|
+
readonly onNodeDragFinished?: (payload: NodeDragPayload) => void;
|
|
275
345
|
};
|
|
276
346
|
}
|
|
277
347
|
|
|
@@ -304,8 +374,17 @@ export declare interface EdgeShape {
|
|
|
304
374
|
|
|
305
375
|
declare type EdgeShape_2 = BezierEdgeShape_2 | StraightEdgeShape_2 | HorizontalEdgeShape_2 | VerticalEdgeShape_2 | EdgeShapeFactory;
|
|
306
376
|
|
|
377
|
+
declare type EdgeShape_3 = BezierEdgeShape_3 | StraightEdgeShape_3 | HorizontalEdgeShape_3 | VerticalEdgeShape_3 | EdgeShapeFactory_2;
|
|
378
|
+
|
|
307
379
|
declare type EdgeShapeFactory = () => EdgeShape;
|
|
308
380
|
|
|
381
|
+
declare type EdgeShapeFactory_2 = () => EdgeShape;
|
|
382
|
+
|
|
383
|
+
declare interface EventHandler<T> {
|
|
384
|
+
subscribe(callback: (payload: T) => void): void;
|
|
385
|
+
unsubscribe(callback: (payload: T) => void): void;
|
|
386
|
+
}
|
|
387
|
+
|
|
309
388
|
export declare interface GraphEdge {
|
|
310
389
|
readonly from: unknown;
|
|
311
390
|
readonly to: unknown;
|
|
@@ -325,6 +404,9 @@ export declare interface GraphPort {
|
|
|
325
404
|
readonly direction: number;
|
|
326
405
|
}
|
|
327
406
|
|
|
407
|
+
/**
|
|
408
|
+
* This entity is responsible for storing state of graph
|
|
409
|
+
*/
|
|
328
410
|
declare class GraphStore {
|
|
329
411
|
private readonly nodes;
|
|
330
412
|
private readonly ports;
|
|
@@ -409,12 +491,29 @@ declare interface HorizontalEdgeShape_2 {
|
|
|
409
491
|
readonly detourDirection?: number | undefined;
|
|
410
492
|
}
|
|
411
493
|
|
|
494
|
+
declare interface HorizontalEdgeShape_3 {
|
|
495
|
+
readonly type: "horizontal";
|
|
496
|
+
readonly color?: string | undefined;
|
|
497
|
+
readonly width?: number | undefined;
|
|
498
|
+
readonly arrowLength?: number | undefined;
|
|
499
|
+
readonly arrowWidth?: number | undefined;
|
|
500
|
+
readonly arrowOffset?: number | undefined;
|
|
501
|
+
readonly hasSourceArrow?: boolean | undefined;
|
|
502
|
+
readonly hasTargetArrow?: boolean | undefined;
|
|
503
|
+
readonly cycleSquareSide?: number | undefined;
|
|
504
|
+
readonly roundness?: number | undefined;
|
|
505
|
+
readonly detourDistance?: number | undefined;
|
|
506
|
+
readonly detourDirection?: number | undefined;
|
|
507
|
+
}
|
|
508
|
+
|
|
412
509
|
export declare class HtmlGraphError extends Error {
|
|
413
510
|
readonly name = "HtmlGraphError";
|
|
414
511
|
}
|
|
415
512
|
|
|
416
513
|
declare type IncrementalPriority = "incremental";
|
|
417
514
|
|
|
515
|
+
declare type IncrementalPriority_2 = "incremental";
|
|
516
|
+
|
|
418
517
|
export declare type MarkNodePortRequest = {
|
|
419
518
|
readonly id?: unknown | undefined;
|
|
420
519
|
readonly element: HTMLElement;
|
|
@@ -422,10 +521,10 @@ export declare type MarkNodePortRequest = {
|
|
|
422
521
|
};
|
|
423
522
|
|
|
424
523
|
export declare interface MarkPortRequest {
|
|
425
|
-
readonly id?: unknown
|
|
524
|
+
readonly id?: unknown;
|
|
426
525
|
readonly element: HTMLElement;
|
|
427
526
|
readonly nodeId: unknown;
|
|
428
|
-
readonly direction?: number
|
|
527
|
+
readonly direction?: number;
|
|
429
528
|
}
|
|
430
529
|
|
|
431
530
|
export declare interface NodeDragPayload {
|
|
@@ -467,8 +566,13 @@ declare interface PortPayload {
|
|
|
467
566
|
|
|
468
567
|
declare type Priority = ConstantPriority | IncrementalPriority | SharedIncrementalPriority | CustomPriority;
|
|
469
568
|
|
|
569
|
+
declare type Priority_2 = ConstantPriority_2 | IncrementalPriority_2 | SharedIncrementalPriority_2 | CustomPriority_2;
|
|
570
|
+
|
|
470
571
|
export declare type PriorityFn = () => number;
|
|
471
572
|
|
|
573
|
+
/**
|
|
574
|
+
* This entity is responsible for providing access to end user in a safe way
|
|
575
|
+
*/
|
|
472
576
|
export declare class PublicGraphStore {
|
|
473
577
|
private readonly graphStore;
|
|
474
578
|
constructor(graphStore: GraphStore);
|
|
@@ -490,6 +594,10 @@ export declare class PublicGraphStore {
|
|
|
490
594
|
getNodeAdjacentEdgeIds(nodeId: unknown): readonly unknown[] | null;
|
|
491
595
|
}
|
|
492
596
|
|
|
597
|
+
/**
|
|
598
|
+
* This entity is responsible for providing viewport transformation state to the
|
|
599
|
+
* end user in a safe way
|
|
600
|
+
*/
|
|
493
601
|
export declare class PublicViewportTransformer {
|
|
494
602
|
private readonly transformer;
|
|
495
603
|
constructor(transformer: ViewportTransformer);
|
|
@@ -520,7 +628,7 @@ export declare class ResizeReactiveNodesCanvas implements Canvas {
|
|
|
520
628
|
patchContentMatrix(request: PatchMatrixRequest): ResizeReactiveNodesCanvas;
|
|
521
629
|
clear(): ResizeReactiveNodesCanvas;
|
|
522
630
|
destroy(): void;
|
|
523
|
-
private
|
|
631
|
+
private handleNodeResize;
|
|
524
632
|
}
|
|
525
633
|
|
|
526
634
|
export declare interface ScaleLimitPreprocessorParams {
|
|
@@ -530,6 +638,8 @@ export declare interface ScaleLimitPreprocessorParams {
|
|
|
530
638
|
|
|
531
639
|
declare type SharedIncrementalPriority = "shared-incremental";
|
|
532
640
|
|
|
641
|
+
declare type SharedIncrementalPriority_2 = "shared-incremental";
|
|
642
|
+
|
|
533
643
|
export declare interface ShiftLimitPreprocessorParams {
|
|
534
644
|
readonly minX: number | null;
|
|
535
645
|
readonly maxX: number | null;
|
|
@@ -585,6 +695,21 @@ declare interface StraightEdgeShape_2 {
|
|
|
585
695
|
readonly detourDirection?: number | undefined;
|
|
586
696
|
}
|
|
587
697
|
|
|
698
|
+
declare interface StraightEdgeShape_3 {
|
|
699
|
+
readonly type: "straight";
|
|
700
|
+
readonly color?: string | undefined;
|
|
701
|
+
readonly width?: number | undefined;
|
|
702
|
+
readonly arrowLength?: number | undefined;
|
|
703
|
+
readonly arrowWidth?: number | undefined;
|
|
704
|
+
readonly arrowOffset?: number | undefined;
|
|
705
|
+
readonly hasSourceArrow?: boolean | undefined;
|
|
706
|
+
readonly hasTargetArrow?: boolean | undefined;
|
|
707
|
+
readonly cycleSquareSide?: number | undefined;
|
|
708
|
+
readonly roundness?: number | undefined;
|
|
709
|
+
readonly detourDistance?: number | undefined;
|
|
710
|
+
readonly detourDirection?: number | undefined;
|
|
711
|
+
}
|
|
712
|
+
|
|
588
713
|
export declare interface TransformOptions {
|
|
589
714
|
readonly scale?: {
|
|
590
715
|
readonly mouseWheelSensitivity?: number;
|
|
@@ -652,7 +777,7 @@ export declare interface UpdateNodeRequest {
|
|
|
652
777
|
}
|
|
653
778
|
|
|
654
779
|
export declare interface UpdatePortRequest {
|
|
655
|
-
readonly direction?: number
|
|
780
|
+
readonly direction?: number;
|
|
656
781
|
}
|
|
657
782
|
|
|
658
783
|
export declare class UserDraggableNodesCanvas implements Canvas {
|
|
@@ -786,9 +911,30 @@ declare interface VerticalEdgeShape_2 {
|
|
|
786
911
|
readonly detourDirection?: number | undefined;
|
|
787
912
|
}
|
|
788
913
|
|
|
914
|
+
declare interface VerticalEdgeShape_3 {
|
|
915
|
+
readonly type: "vertical";
|
|
916
|
+
readonly color?: string | undefined;
|
|
917
|
+
readonly width?: number | undefined;
|
|
918
|
+
readonly arrowLength?: number | undefined;
|
|
919
|
+
readonly arrowWidth?: number | undefined;
|
|
920
|
+
readonly arrowOffset?: number | undefined;
|
|
921
|
+
readonly hasSourceArrow?: boolean | undefined;
|
|
922
|
+
readonly hasTargetArrow?: boolean | undefined;
|
|
923
|
+
readonly cycleSquareSide?: number | undefined;
|
|
924
|
+
readonly roundness?: number | undefined;
|
|
925
|
+
readonly detourDistance?: number | undefined;
|
|
926
|
+
readonly detourDirection?: number | undefined;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* This entity is responsible for storing viewport transformation
|
|
931
|
+
*/
|
|
789
932
|
declare class ViewportTransformer {
|
|
790
933
|
private viewportMatrix;
|
|
791
934
|
private contentMatrix;
|
|
935
|
+
private readonly emitter;
|
|
936
|
+
readonly onAfterUpdate: EventHandler<void>;
|
|
937
|
+
constructor();
|
|
792
938
|
getViewportMatrix(): TransformState;
|
|
793
939
|
getContentMatrix(): TransformState;
|
|
794
940
|
patchViewportMatrix(matrix: PatchTransformRequest): void;
|