@html-graph/html-graph 0.0.53 → 0.0.55
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 +97 -79
- package/dist/main.js +989 -901
- package/dist/main.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare interface AddEdgeRequest {
|
|
|
2
2
|
id?: unknown;
|
|
3
3
|
from: string;
|
|
4
4
|
to: string;
|
|
5
|
-
options?:
|
|
5
|
+
options?: EdgeShape_2;
|
|
6
6
|
priority?: number;
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -33,7 +33,7 @@ declare type BackgroundOptions = {
|
|
|
33
33
|
readonly drawingFn: BackgroundDrawingFn;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
export declare class BezierEdgeShape implements
|
|
36
|
+
export declare class BezierEdgeShape implements EdgeShape {
|
|
37
37
|
private readonly color;
|
|
38
38
|
private readonly width;
|
|
39
39
|
private readonly curvature;
|
|
@@ -114,11 +114,11 @@ export declare interface Canvas {
|
|
|
114
114
|
/**
|
|
115
115
|
* applies transformation for viewport
|
|
116
116
|
*/
|
|
117
|
-
|
|
117
|
+
patchViewportMatrix(request: PatchMatrixRequest): Canvas;
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
119
|
+
* applies transformation for content
|
|
120
120
|
*/
|
|
121
|
-
|
|
121
|
+
patchContentMatrix(request: PatchMatrixRequest): Canvas;
|
|
122
122
|
/**
|
|
123
123
|
* attaches canvas to given element
|
|
124
124
|
*/
|
|
@@ -160,15 +160,15 @@ export declare class CanvasCore implements Canvas {
|
|
|
160
160
|
addEdge(edge: AddEdgeRequest): CanvasCore;
|
|
161
161
|
updateEdge(edgeId: unknown, request: UpdateEdgeRequest): CanvasCore;
|
|
162
162
|
removeEdge(edgeId: unknown): CanvasCore;
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
patchViewportMatrix(request: PatchMatrixRequest): CanvasCore;
|
|
164
|
+
patchContentMatrix(request: PatchMatrixRequest): CanvasCore;
|
|
165
165
|
clear(): CanvasCore;
|
|
166
166
|
attach(element: HTMLElement): CanvasCore;
|
|
167
167
|
detach(): CanvasCore;
|
|
168
168
|
destroy(): void;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
export declare type CenterFn = (width: number, height: number) =>
|
|
171
|
+
export declare type CenterFn = (width: number, height: number) => Point;
|
|
172
172
|
|
|
173
173
|
declare type ConstantPriority = number;
|
|
174
174
|
|
|
@@ -212,7 +212,7 @@ export declare interface CoreOptions {
|
|
|
212
212
|
/**
|
|
213
213
|
* specifies default controller
|
|
214
214
|
*/
|
|
215
|
-
readonly shape?:
|
|
215
|
+
readonly shape?: EdgeShape_2;
|
|
216
216
|
/**
|
|
217
217
|
* specifies default z-index value
|
|
218
218
|
*/
|
|
@@ -283,7 +283,7 @@ declare interface CustomEdgeShape {
|
|
|
283
283
|
|
|
284
284
|
declare type CustomPriority = PriorityFn;
|
|
285
285
|
|
|
286
|
-
export declare class CycleCircleEdgeShape implements
|
|
286
|
+
export declare class CycleCircleEdgeShape implements EdgeShape {
|
|
287
287
|
private readonly color;
|
|
288
288
|
private readonly width;
|
|
289
289
|
private readonly arrowLength;
|
|
@@ -298,7 +298,7 @@ export declare class CycleCircleEdgeShape implements EdgeController {
|
|
|
298
298
|
update(x: number, y: number, _width: number, _height: number, from: PortPayload): void;
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
export declare class CycleSquareEdgeShape implements
|
|
301
|
+
export declare class CycleSquareEdgeShape implements EdgeShape {
|
|
302
302
|
private readonly color;
|
|
303
303
|
private readonly width;
|
|
304
304
|
private readonly arrowLength;
|
|
@@ -315,7 +315,7 @@ export declare class CycleSquareEdgeShape implements EdgeController {
|
|
|
315
315
|
update(x: number, y: number, _width: number, _height: number, from: PortPayload): void;
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
export declare class DetourStraightEdgeShape implements
|
|
318
|
+
export declare class DetourStraightEdgeShape implements EdgeShape {
|
|
319
319
|
private readonly color;
|
|
320
320
|
private readonly width;
|
|
321
321
|
private readonly arrowLength;
|
|
@@ -341,21 +341,21 @@ export declare interface DragOptions {
|
|
|
341
341
|
};
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
export declare interface EdgeController {
|
|
345
|
-
readonly svg: SVGSVGElement;
|
|
346
|
-
update(x: number, y: number, width: number, height: number, from: PortPayload, to: PortPayload): void;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
344
|
declare interface EdgePayload {
|
|
350
345
|
from: string;
|
|
351
346
|
to: string;
|
|
352
|
-
shape:
|
|
347
|
+
shape: EdgeShape;
|
|
353
348
|
priority: number;
|
|
354
349
|
}
|
|
355
350
|
|
|
356
|
-
declare
|
|
351
|
+
export declare interface EdgeShape {
|
|
352
|
+
readonly svg: SVGSVGElement;
|
|
353
|
+
update(x: number, y: number, width: number, height: number, from: PortPayload, to: PortPayload): void;
|
|
354
|
+
}
|
|
357
355
|
|
|
358
|
-
declare type
|
|
356
|
+
declare type EdgeShape_2 = BezierEdgeShape_2 | StraightEdgeShape_2 | CustomEdgeShape | HorizontalEdgeShape_2 | VerticalEdgeShape_2;
|
|
357
|
+
|
|
358
|
+
declare type EdgeShapeFactory = (type: EdgeType) => EdgeShape;
|
|
359
359
|
|
|
360
360
|
export declare enum EdgeType {
|
|
361
361
|
Regular = "regular",
|
|
@@ -393,13 +393,17 @@ declare class GraphStore {
|
|
|
393
393
|
private readonly outcommingEdges;
|
|
394
394
|
private readonly cycleEdges;
|
|
395
395
|
addNode(nodeId: unknown, element: HTMLElement, x: number, y: number, centerFn: CenterFn, priority: number): void;
|
|
396
|
+
getAllNodes(): readonly unknown[];
|
|
396
397
|
getNode(nodeId: unknown): NodePayload | undefined;
|
|
398
|
+
getNodePorts(nodeId: unknown): readonly unknown[] | undefined;
|
|
397
399
|
removeNode(nodeId: unknown): void;
|
|
398
400
|
addPort(portId: unknown, element: HTMLElement, nodeId: unknown, centerFn: CenterFn, dir: number): void;
|
|
401
|
+
getAllPorts(): readonly unknown[];
|
|
399
402
|
getPort(portId: unknown): PortPayload | undefined;
|
|
400
403
|
getPortNode(portId: string): unknown | undefined;
|
|
401
404
|
removePort(portId: string): void;
|
|
402
|
-
addEdge(edgeId: unknown, fromPortId: string, toPortId: string, shape:
|
|
405
|
+
addEdge(edgeId: unknown, fromPortId: string, toPortId: string, shape: EdgeShape, priority: number): void;
|
|
406
|
+
getAllEdges(): readonly unknown[];
|
|
403
407
|
getEdge(edgeId: unknown): EdgePayload | undefined;
|
|
404
408
|
removeEdge(edgeId: unknown): void;
|
|
405
409
|
getPortAdjacentEdges(portId: string): readonly unknown[];
|
|
@@ -413,7 +417,7 @@ declare class GraphStore {
|
|
|
413
417
|
getNodeCycleEdges(nodeId: unknown): readonly unknown[];
|
|
414
418
|
}
|
|
415
419
|
|
|
416
|
-
export declare class HorizontalEdgeShape implements
|
|
420
|
+
export declare class HorizontalEdgeShape implements EdgeShape {
|
|
417
421
|
private readonly color;
|
|
418
422
|
private readonly width;
|
|
419
423
|
private readonly arrowLength;
|
|
@@ -487,10 +491,15 @@ declare interface NodePayload {
|
|
|
487
491
|
priority: number;
|
|
488
492
|
}
|
|
489
493
|
|
|
490
|
-
export declare interface
|
|
491
|
-
scale?: number;
|
|
492
|
-
|
|
493
|
-
|
|
494
|
+
export declare interface PatchMatrixRequest {
|
|
495
|
+
readonly scale?: number;
|
|
496
|
+
readonly dx?: number;
|
|
497
|
+
readonly dy?: number;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export declare interface Point {
|
|
501
|
+
readonly x: number;
|
|
502
|
+
readonly y: number;
|
|
494
503
|
}
|
|
495
504
|
|
|
496
505
|
export declare interface PortPayload {
|
|
@@ -506,10 +515,14 @@ export declare type PriorityFn = () => number;
|
|
|
506
515
|
declare class PublicGraphStore {
|
|
507
516
|
private readonly graphStore;
|
|
508
517
|
constructor(graphStore: GraphStore);
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
518
|
+
getAllNodes(): readonly unknown[];
|
|
519
|
+
getAllPorts(): readonly unknown[];
|
|
520
|
+
getNode(nodeId: unknown): GraphNode | null;
|
|
521
|
+
getNodePorts(nodeId: unknown): readonly unknown[] | undefined;
|
|
522
|
+
getPort(portId: unknown): GraphPort | null;
|
|
523
|
+
getPortNode(portId: string): unknown | null;
|
|
524
|
+
getAllEdges(): readonly unknown[];
|
|
525
|
+
getEdge(edgeId: unknown): GraphEdge | null;
|
|
513
526
|
getPortAdjacentEdges(portId: string): readonly unknown[];
|
|
514
527
|
getNodeAdjacentEdges(nodeId: unknown): readonly unknown[];
|
|
515
528
|
getPortIncomingEdges(portId: unknown): readonly unknown[];
|
|
@@ -523,31 +536,13 @@ declare class PublicGraphStore {
|
|
|
523
536
|
export declare class PublicViewportTransformer {
|
|
524
537
|
private readonly transformer;
|
|
525
538
|
constructor(transformer: ViewportTransformer);
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
* viewport coordinated represent actual coordinates on screen for given absolute coordinates
|
|
529
|
-
*/
|
|
530
|
-
getViewCoords(xa: number, ya: number): [number, number];
|
|
531
|
-
/**
|
|
532
|
-
* returns viewport scale
|
|
533
|
-
* it represents scale at which entities on canvas should be scaled to fit current scale
|
|
534
|
-
*/
|
|
535
|
-
getViewScale(): number;
|
|
536
|
-
/**
|
|
537
|
-
* for given viewport coordinates returns absolute coordinates
|
|
538
|
-
* absolute coordinates represent actual coordinates, which stay constant even for transformed canvas
|
|
539
|
-
*/
|
|
540
|
-
getAbsCoords(xv: number, yv: number): [number, number];
|
|
541
|
-
/**
|
|
542
|
-
* returns absolute scale
|
|
543
|
-
* it represents scale at which current viewport was scaled compared to initial state
|
|
544
|
-
*/
|
|
545
|
-
getAbsScale(): number;
|
|
539
|
+
getViewportMatrix(): TransformState;
|
|
540
|
+
getContentMatrix(): TransformState;
|
|
546
541
|
}
|
|
547
542
|
|
|
548
543
|
declare type SharedIncrementalPriority = "shared-incremental";
|
|
549
544
|
|
|
550
|
-
export declare class StraightEdgeShape implements
|
|
545
|
+
export declare class StraightEdgeShape implements EdgeShape {
|
|
551
546
|
private readonly color;
|
|
552
547
|
private readonly width;
|
|
553
548
|
private readonly arrowLength;
|
|
@@ -578,30 +573,53 @@ declare interface StraightEdgeShape_2 {
|
|
|
578
573
|
readonly detourDirection?: number;
|
|
579
574
|
}
|
|
580
575
|
|
|
576
|
+
export declare type TransformFinishedFn = (transform: TransformPayload) => void;
|
|
577
|
+
|
|
581
578
|
export declare interface TransformOptions {
|
|
582
|
-
scale?: {
|
|
583
|
-
enabled?: boolean;
|
|
584
|
-
|
|
585
|
-
max?: number;
|
|
586
|
-
wheelSensitivity?: number;
|
|
579
|
+
readonly scale?: {
|
|
580
|
+
readonly enabled?: boolean;
|
|
581
|
+
readonly wheelSensitivity?: number;
|
|
587
582
|
};
|
|
588
|
-
shift?: {
|
|
589
|
-
enabled?: boolean;
|
|
583
|
+
readonly shift?: {
|
|
584
|
+
readonly enabled?: boolean;
|
|
590
585
|
};
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
586
|
+
readonly transformPreprocessor?: TransformPreprocessorOption | TransformPreprocessorOption[];
|
|
587
|
+
readonly events?: {
|
|
588
|
+
readonly onTransformFinished?: TransformFinishedFn;
|
|
594
589
|
};
|
|
595
590
|
}
|
|
596
591
|
|
|
597
592
|
export declare interface TransformPayload {
|
|
598
593
|
readonly scale: number;
|
|
599
|
-
readonly
|
|
600
|
-
readonly
|
|
594
|
+
readonly dx: number;
|
|
595
|
+
readonly dy: number;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export declare type TransformPreprocessorFn = (prevTransform: TransformPayload, nextTransform: TransformPayload, canvasWidth: number, canvasHeight: number) => TransformPayload;
|
|
599
|
+
|
|
600
|
+
declare type TransformPreprocessorOption = {
|
|
601
|
+
readonly type: "scale-limit";
|
|
602
|
+
readonly minContentScale?: number;
|
|
603
|
+
readonly maxContentScale?: number;
|
|
604
|
+
} | {
|
|
605
|
+
readonly type: "shift-limit";
|
|
606
|
+
readonly minX?: number;
|
|
607
|
+
readonly maxX?: number;
|
|
608
|
+
readonly minY?: number;
|
|
609
|
+
readonly maxY?: number;
|
|
610
|
+
} | {
|
|
611
|
+
readonly type: "custom";
|
|
612
|
+
readonly preprocessorFn: TransformPreprocessorFn;
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
declare interface TransformState {
|
|
616
|
+
readonly scale: number;
|
|
617
|
+
readonly dx: number;
|
|
618
|
+
readonly dy: number;
|
|
601
619
|
}
|
|
602
620
|
|
|
603
621
|
export declare interface UpdateEdgeRequest {
|
|
604
|
-
readonly controller?:
|
|
622
|
+
readonly controller?: EdgeShape;
|
|
605
623
|
readonly priority?: number;
|
|
606
624
|
}
|
|
607
625
|
|
|
@@ -645,8 +663,8 @@ export declare class UserDraggableNodesCanvas implements Canvas {
|
|
|
645
663
|
addEdge(edge: AddEdgeRequest): UserDraggableNodesCanvas;
|
|
646
664
|
updateEdge(edgeId: unknown, request: UpdateEdgeRequest): UserDraggableNodesCanvas;
|
|
647
665
|
removeEdge(edgeId: unknown): UserDraggableNodesCanvas;
|
|
648
|
-
|
|
649
|
-
|
|
666
|
+
patchViewportMatrix(request: PatchMatrixRequest): UserDraggableNodesCanvas;
|
|
667
|
+
patchContentMatrix(request: PatchMatrixRequest): UserDraggableNodesCanvas;
|
|
650
668
|
clear(): UserDraggableNodesCanvas;
|
|
651
669
|
attach(element: HTMLElement): UserDraggableNodesCanvas;
|
|
652
670
|
detach(): UserDraggableNodesCanvas;
|
|
@@ -665,12 +683,10 @@ export declare class UserTransformableCanvas implements Canvas {
|
|
|
665
683
|
private element;
|
|
666
684
|
private isMoving;
|
|
667
685
|
private prevTouches;
|
|
668
|
-
private
|
|
669
|
-
private
|
|
686
|
+
private readonly onTransformFinished;
|
|
687
|
+
private readonly transformPreprocessor;
|
|
670
688
|
private readonly isScalable;
|
|
671
689
|
private readonly isShiftable;
|
|
672
|
-
private readonly minViewScale;
|
|
673
|
-
private readonly maxViewScale;
|
|
674
690
|
private readonly wheelSensitivity;
|
|
675
691
|
private readonly onMouseDown;
|
|
676
692
|
private readonly onMouseMove;
|
|
@@ -679,6 +695,7 @@ export declare class UserTransformableCanvas implements Canvas {
|
|
|
679
695
|
private readonly onTouchStart;
|
|
680
696
|
private readonly onTouchMove;
|
|
681
697
|
private readonly onTouchEnd;
|
|
698
|
+
private readonly observer;
|
|
682
699
|
constructor(canvas: Canvas, options?: TransformOptions | undefined);
|
|
683
700
|
addNode(node: AddNodeRequest): UserTransformableCanvas;
|
|
684
701
|
updateNode(nodeId: unknown, request: UpdateNodeRequest): UserTransformableCanvas;
|
|
@@ -689,8 +706,8 @@ export declare class UserTransformableCanvas implements Canvas {
|
|
|
689
706
|
addEdge(edge: AddEdgeRequest): UserTransformableCanvas;
|
|
690
707
|
updateEdge(edgeId: unknown, request: UpdateEdgeRequest): UserTransformableCanvas;
|
|
691
708
|
removeEdge(edgeId: unknown): UserTransformableCanvas;
|
|
692
|
-
|
|
693
|
-
|
|
709
|
+
patchViewportMatrix(request: PatchMatrixRequest): UserTransformableCanvas;
|
|
710
|
+
patchContentMatrix(request: PatchMatrixRequest): UserTransformableCanvas;
|
|
694
711
|
clear(): UserTransformableCanvas;
|
|
695
712
|
attach(element: HTMLElement): UserTransformableCanvas;
|
|
696
713
|
detach(): UserTransformableCanvas;
|
|
@@ -701,7 +718,7 @@ export declare class UserTransformableCanvas implements Canvas {
|
|
|
701
718
|
private scaleViewport;
|
|
702
719
|
}
|
|
703
720
|
|
|
704
|
-
export declare class VerticalEdgeShape implements
|
|
721
|
+
export declare class VerticalEdgeShape implements EdgeShape {
|
|
705
722
|
private readonly color;
|
|
706
723
|
private readonly width;
|
|
707
724
|
private readonly arrowLength;
|
|
@@ -733,12 +750,13 @@ declare interface VerticalEdgeShape_2 {
|
|
|
733
750
|
}
|
|
734
751
|
|
|
735
752
|
declare class ViewportTransformer {
|
|
736
|
-
private
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
753
|
+
private viewportMatrix;
|
|
754
|
+
private contentMatrix;
|
|
755
|
+
getViewportMatrix(): TransformState;
|
|
756
|
+
getContentMatrix(): TransformState;
|
|
757
|
+
patchViewportMatrix(scale: number | null, x: number | null, y: number | null): void;
|
|
758
|
+
patchContentMatrix(scale: number | null, dx: number | null, dy: number | null): void;
|
|
759
|
+
private calculateReverseMatrix;
|
|
742
760
|
}
|
|
743
761
|
|
|
744
762
|
export { }
|