@html-graph/html-graph 8.23.0 → 8.24.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 +13 -0
- package/dist/html-graph.js +41 -23
- package/dist/html-graph.min.js +29 -20
- package/dist/html-graph.min.umd.cjs +1 -1
- package/dist/html-graph.umd.cjs +41 -23
- package/package.json +1 -1
package/dist/html-graph.d.ts
CHANGED
|
@@ -126,6 +126,7 @@ export declare interface BezierEdgeParams {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
export declare class BezierEdgeShape implements StructuredEdgeShape {
|
|
129
|
+
readonly element: SVGSVGElement;
|
|
129
130
|
readonly svg: SVGSVGElement;
|
|
130
131
|
readonly group: SVGGElement;
|
|
131
132
|
readonly line: SVGPathElement;
|
|
@@ -353,6 +354,7 @@ export declare interface DirectEdgeParams {
|
|
|
353
354
|
}
|
|
354
355
|
|
|
355
356
|
export declare class DirectEdgeShape implements StructuredEdgeShape {
|
|
357
|
+
readonly element: SVGSVGElement;
|
|
356
358
|
readonly svg: SVGSVGElement;
|
|
357
359
|
readonly group: SVGGElement;
|
|
358
360
|
readonly line: SVGPathElement;
|
|
@@ -448,7 +450,12 @@ export declare interface EdgeRenderPort {
|
|
|
448
450
|
}
|
|
449
451
|
|
|
450
452
|
export declare interface EdgeShape {
|
|
453
|
+
/**
|
|
454
|
+
* @deprecated
|
|
455
|
+
* use element instead
|
|
456
|
+
*/
|
|
451
457
|
readonly svg: SVGSVGElement;
|
|
458
|
+
readonly element: SVGSVGElement;
|
|
452
459
|
render(params: EdgeRenderParams): void;
|
|
453
460
|
}
|
|
454
461
|
|
|
@@ -685,6 +692,7 @@ export declare interface HorizontalEdgeParams {
|
|
|
685
692
|
* use OrthogonalEdgeShape instead
|
|
686
693
|
*/
|
|
687
694
|
export declare class HorizontalEdgeShape implements StructuredEdgeShape {
|
|
695
|
+
readonly element: SVGSVGElement;
|
|
688
696
|
readonly svg: SVGSVGElement;
|
|
689
697
|
readonly group: SVGGElement;
|
|
690
698
|
readonly line: SVGPathElement;
|
|
@@ -742,6 +750,7 @@ export declare interface InteractiveEdgeParams {
|
|
|
742
750
|
|
|
743
751
|
export declare class InteractiveEdgeShape implements StructuredEdgeShape {
|
|
744
752
|
private readonly baseEdge;
|
|
753
|
+
readonly element: SVGSVGElement;
|
|
745
754
|
readonly svg: SVGSVGElement;
|
|
746
755
|
readonly group: SVGGElement;
|
|
747
756
|
readonly line: SVGPathElement;
|
|
@@ -829,6 +838,7 @@ export declare class MidpointEdgeShape implements StructuredEdgeShape {
|
|
|
829
838
|
readonly sourceArrow: SVGPathElement | null;
|
|
830
839
|
readonly targetArrow: SVGPathElement | null;
|
|
831
840
|
readonly onAfterRender: EventHandler<StructuredEdgeRenderModel>;
|
|
841
|
+
readonly element: SVGSVGElement;
|
|
832
842
|
readonly svg: SVGSVGElement;
|
|
833
843
|
constructor(baseShape: StructuredEdgeShape, midpointElement: SVGElement);
|
|
834
844
|
render(params: EdgeRenderParams): void;
|
|
@@ -861,6 +871,7 @@ export declare interface OrthogonalEdgeParams {
|
|
|
861
871
|
}
|
|
862
872
|
|
|
863
873
|
export declare class OrthogonalEdgeShape implements StructuredEdgeShape {
|
|
874
|
+
readonly element: SVGSVGElement;
|
|
864
875
|
readonly svg: SVGSVGElement;
|
|
865
876
|
readonly group: SVGGElement;
|
|
866
877
|
readonly line: SVGPathElement;
|
|
@@ -980,6 +991,7 @@ export declare interface StraightEdgeParams {
|
|
|
980
991
|
}
|
|
981
992
|
|
|
982
993
|
export declare class StraightEdgeShape implements StructuredEdgeShape {
|
|
994
|
+
readonly element: SVGSVGElement;
|
|
983
995
|
readonly svg: SVGSVGElement;
|
|
984
996
|
readonly group: SVGGElement;
|
|
985
997
|
readonly line: SVGPathElement;
|
|
@@ -1160,6 +1172,7 @@ export declare interface VerticalEdgeParams {
|
|
|
1160
1172
|
* use OrthogonalEdgeShape instead
|
|
1161
1173
|
*/
|
|
1162
1174
|
export declare class VerticalEdgeShape implements StructuredEdgeShape {
|
|
1175
|
+
readonly element: SVGSVGElement;
|
|
1163
1176
|
readonly svg: SVGSVGElement;
|
|
1164
1177
|
readonly group: SVGGElement;
|
|
1165
1178
|
readonly line: SVGPathElement;
|
package/dist/html-graph.js
CHANGED
|
@@ -81,7 +81,7 @@ var CoreHtmlView = class {
|
|
|
81
81
|
this.attachedNodeIds.delete(nodeId);
|
|
82
82
|
}
|
|
83
83
|
attachEdge(edgeId) {
|
|
84
|
-
const svg = this.graphStore.getEdge(edgeId).payload.shape.
|
|
84
|
+
const svg = this.graphStore.getEdge(edgeId).payload.shape.element;
|
|
85
85
|
this.edgeIdToElementMap.set(edgeId, svg);
|
|
86
86
|
this.container.appendChild(svg);
|
|
87
87
|
this.renderEdge(edgeId);
|
|
@@ -123,7 +123,7 @@ var CoreHtmlView = class {
|
|
|
123
123
|
updateEdgeShape(edgeId) {
|
|
124
124
|
const element = this.edgeIdToElementMap.get(edgeId);
|
|
125
125
|
this.container.removeChild(element);
|
|
126
|
-
const svg = this.graphStore.getEdge(edgeId).payload.shape.
|
|
126
|
+
const svg = this.graphStore.getEdge(edgeId).payload.shape.element;
|
|
127
127
|
this.edgeIdToElementMap.set(edgeId, svg);
|
|
128
128
|
this.container.appendChild(svg);
|
|
129
129
|
}
|
|
@@ -148,7 +148,7 @@ var CoreHtmlView = class {
|
|
|
148
148
|
}
|
|
149
149
|
updateEdgePriority(edgeId) {
|
|
150
150
|
const edge = this.graphStore.getEdge(edgeId);
|
|
151
|
-
edge.payload.shape.
|
|
151
|
+
edge.payload.shape.element.style.zIndex = `${edge.payload.priority}`;
|
|
152
152
|
}
|
|
153
153
|
createEdgeRenderPort(port, rectPort, rectCanvas, scale) {
|
|
154
154
|
const contentPoint = this.viewportStore.createContentCoords({
|
|
@@ -757,7 +757,7 @@ var GraphStore = class {
|
|
|
757
757
|
if (this.hasEdge(request.id)) throw new CanvasError(canvasErrorText.addEdgeWithExistingId(request.id));
|
|
758
758
|
if (!this.hasPort(request.from)) throw new CanvasError(canvasErrorText.addEdgeFromNonexistentPort(request.id, request.from));
|
|
759
759
|
if (!this.hasPort(request.to)) throw new CanvasError(canvasErrorText.addEdgeToNonexistentPort(request.id, request.to));
|
|
760
|
-
const useEdgeId = this.findEdgeIdByElement(request.shape.
|
|
760
|
+
const useEdgeId = this.findEdgeIdByElement(request.shape.element);
|
|
761
761
|
if (useEdgeId !== void 0) throw new CanvasError(canvasErrorText.addEdgeWithElementInUse(request.id, useEdgeId));
|
|
762
762
|
this.addEdgeInternal(request);
|
|
763
763
|
this.afterEdgeAddedEmitter.emit(request.id);
|
|
@@ -898,7 +898,7 @@ var GraphStore = class {
|
|
|
898
898
|
priority: request.priority
|
|
899
899
|
}
|
|
900
900
|
});
|
|
901
|
-
this.edgesElementsMap.set(request.shape.
|
|
901
|
+
this.edgesElementsMap.set(request.shape.element, request.id);
|
|
902
902
|
if (request.from !== request.to) {
|
|
903
903
|
this.portOutgoingEdges.get(request.from).add(request.id);
|
|
904
904
|
this.portIncomingEdges.get(request.to).add(request.id);
|
|
@@ -913,7 +913,7 @@ var GraphStore = class {
|
|
|
913
913
|
this.portOutgoingEdges.get(from).delete(edgeId);
|
|
914
914
|
this.portOutgoingEdges.get(to).delete(edgeId);
|
|
915
915
|
this.edges.delete(edgeId);
|
|
916
|
-
this.edgesElementsMap.delete(payload.shape.
|
|
916
|
+
this.edgesElementsMap.delete(payload.shape.element);
|
|
917
917
|
}
|
|
918
918
|
};
|
|
919
919
|
//#endregion
|
|
@@ -2131,6 +2131,7 @@ var createDirectionVector = (dir) => {
|
|
|
2131
2131
|
//#region src/edges/shapes/path-edge-shape/path-edge-shape.ts
|
|
2132
2132
|
var PathEdgeShape = class {
|
|
2133
2133
|
params;
|
|
2134
|
+
element;
|
|
2134
2135
|
svg;
|
|
2135
2136
|
group = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2136
2137
|
line;
|
|
@@ -2143,8 +2144,9 @@ var PathEdgeShape = class {
|
|
|
2143
2144
|
this.params = params;
|
|
2144
2145
|
[this.afterRenderEmitter, this.onAfterRender] = createPair();
|
|
2145
2146
|
this.arrowRenderer = this.params.arrowRenderer;
|
|
2146
|
-
this.
|
|
2147
|
-
this.svg
|
|
2147
|
+
this.element = createEdgeSvg(params.color);
|
|
2148
|
+
this.svg = this.element;
|
|
2149
|
+
this.element.appendChild(this.group);
|
|
2148
2150
|
this.line = createEdgePath(params.width);
|
|
2149
2151
|
this.group.appendChild(this.line);
|
|
2150
2152
|
if (params.hasSourceArrow) {
|
|
@@ -2158,7 +2160,7 @@ var PathEdgeShape = class {
|
|
|
2158
2160
|
}
|
|
2159
2161
|
render(params) {
|
|
2160
2162
|
const { x, y, width, height, from, to } = createEdgeRectangle(params.from, params.to, this.params.padding);
|
|
2161
|
-
setSvgRectangle(this.
|
|
2163
|
+
setSvgRectangle(this.element, {
|
|
2162
2164
|
x,
|
|
2163
2165
|
y,
|
|
2164
2166
|
width,
|
|
@@ -2316,6 +2318,7 @@ var resolveArrowRenderer = (config) => {
|
|
|
2316
2318
|
//#endregion
|
|
2317
2319
|
//#region src/edges/shapes/bezier-edge-shape/bezier-edge-shape.ts
|
|
2318
2320
|
var BezierEdgeShape = class {
|
|
2321
|
+
element;
|
|
2319
2322
|
svg;
|
|
2320
2323
|
group;
|
|
2321
2324
|
line;
|
|
@@ -2382,7 +2385,8 @@ var BezierEdgeShape = class {
|
|
|
2382
2385
|
createLinePath: this.createLinePath,
|
|
2383
2386
|
padding: 50
|
|
2384
2387
|
});
|
|
2385
|
-
this.
|
|
2388
|
+
this.element = this.pathShape.element;
|
|
2389
|
+
this.svg = this.element;
|
|
2386
2390
|
this.group = this.pathShape.group;
|
|
2387
2391
|
this.line = this.pathShape.line;
|
|
2388
2392
|
this.sourceArrow = this.pathShape.sourceArrow;
|
|
@@ -2405,6 +2409,7 @@ var horizontalizeDirection = (direction) => {
|
|
|
2405
2409
|
* use OrthogonalEdgeShape instead
|
|
2406
2410
|
*/
|
|
2407
2411
|
var HorizontalEdgeShape = class {
|
|
2412
|
+
element;
|
|
2408
2413
|
svg;
|
|
2409
2414
|
group;
|
|
2410
2415
|
line;
|
|
@@ -2472,7 +2477,8 @@ var HorizontalEdgeShape = class {
|
|
|
2472
2477
|
createLinePath: this.createLinePath,
|
|
2473
2478
|
padding: 50
|
|
2474
2479
|
});
|
|
2475
|
-
this.
|
|
2480
|
+
this.element = this.pathShape.element;
|
|
2481
|
+
this.svg = this.element;
|
|
2476
2482
|
this.group = this.pathShape.group;
|
|
2477
2483
|
this.line = this.pathShape.line;
|
|
2478
2484
|
this.sourceArrow = this.pathShape.sourceArrow;
|
|
@@ -2497,6 +2503,7 @@ var HorizontalEdgeShape = class {
|
|
|
2497
2503
|
//#endregion
|
|
2498
2504
|
//#region src/edges/shapes/straight-edge-shape/straight-edge-shape.ts
|
|
2499
2505
|
var StraightEdgeShape = class {
|
|
2506
|
+
element;
|
|
2500
2507
|
svg;
|
|
2501
2508
|
group;
|
|
2502
2509
|
line;
|
|
@@ -2567,7 +2574,8 @@ var StraightEdgeShape = class {
|
|
|
2567
2574
|
createLinePath: this.createLinePath,
|
|
2568
2575
|
padding: 50
|
|
2569
2576
|
});
|
|
2570
|
-
this.
|
|
2577
|
+
this.element = this.pathShape.element;
|
|
2578
|
+
this.svg = this.element;
|
|
2571
2579
|
this.group = this.pathShape.group;
|
|
2572
2580
|
this.line = this.pathShape.line;
|
|
2573
2581
|
this.sourceArrow = this.pathShape.sourceArrow;
|
|
@@ -2591,6 +2599,7 @@ var verticalizeDirection = (direction) => {
|
|
|
2591
2599
|
* use OrthogonalEdgeShape instead
|
|
2592
2600
|
*/
|
|
2593
2601
|
var VerticalEdgeShape = class {
|
|
2602
|
+
element;
|
|
2594
2603
|
svg;
|
|
2595
2604
|
group;
|
|
2596
2605
|
line;
|
|
@@ -2658,7 +2667,8 @@ var VerticalEdgeShape = class {
|
|
|
2658
2667
|
createLinePath: this.createLinePath,
|
|
2659
2668
|
padding: 50
|
|
2660
2669
|
});
|
|
2661
|
-
this.
|
|
2670
|
+
this.element = this.pathShape.element;
|
|
2671
|
+
this.svg = this.element;
|
|
2662
2672
|
this.group = this.pathShape.group;
|
|
2663
2673
|
this.line = this.pathShape.line;
|
|
2664
2674
|
this.sourceArrow = this.pathShape.sourceArrow;
|
|
@@ -2696,6 +2706,7 @@ var orthogonalizeDirection = (direction) => {
|
|
|
2696
2706
|
//#endregion
|
|
2697
2707
|
//#region src/edges/shapes/orthogonal-edge-shape/orthogonal-edge-shape.ts
|
|
2698
2708
|
var OrthogonalEdgeShape = class {
|
|
2709
|
+
element;
|
|
2699
2710
|
svg;
|
|
2700
2711
|
group;
|
|
2701
2712
|
line;
|
|
@@ -2763,7 +2774,8 @@ var OrthogonalEdgeShape = class {
|
|
|
2763
2774
|
createLinePath: this.createLinePath,
|
|
2764
2775
|
padding: 50
|
|
2765
2776
|
});
|
|
2766
|
-
this.
|
|
2777
|
+
this.element = this.pathShape.element;
|
|
2778
|
+
this.svg = this.element;
|
|
2767
2779
|
this.group = this.pathShape.group;
|
|
2768
2780
|
this.line = this.pathShape.line;
|
|
2769
2781
|
this.sourceArrow = this.pathShape.sourceArrow;
|
|
@@ -2809,6 +2821,7 @@ var resolvePortOffsetFn = (offset) => {
|
|
|
2809
2821
|
//#region src/edges/shapes/direct-edge-shape/direct-edge-shape.ts
|
|
2810
2822
|
var defaultPortOffset = edgeConstants.portOffset;
|
|
2811
2823
|
var DirectEdgeShape = class {
|
|
2824
|
+
element;
|
|
2812
2825
|
svg;
|
|
2813
2826
|
group = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2814
2827
|
line;
|
|
@@ -2830,8 +2843,9 @@ var DirectEdgeShape = class {
|
|
|
2830
2843
|
this.arrowRenderer = resolveArrowRenderer(params?.arrowRenderer ?? {});
|
|
2831
2844
|
this.sourceOffsetFn = resolvePortOffsetFn(params?.sourceOffset ?? defaultPortOffset);
|
|
2832
2845
|
this.targetOffsetFn = resolvePortOffsetFn(params?.targetOffset ?? defaultPortOffset);
|
|
2833
|
-
this.
|
|
2834
|
-
this.svg
|
|
2846
|
+
this.element = createEdgeSvg(this.color);
|
|
2847
|
+
this.svg = this.element;
|
|
2848
|
+
this.element.appendChild(this.group);
|
|
2835
2849
|
this.line = createEdgePath(this.width);
|
|
2836
2850
|
this.group.appendChild(this.line);
|
|
2837
2851
|
if (params?.hasSourceArrow) {
|
|
@@ -2845,7 +2859,7 @@ var DirectEdgeShape = class {
|
|
|
2845
2859
|
}
|
|
2846
2860
|
render(params) {
|
|
2847
2861
|
const { x, y, width, height, from, to } = createEdgeRectangle(params.from, params.to, 50);
|
|
2848
|
-
setSvgRectangle(this.
|
|
2862
|
+
setSvgRectangle(this.element, {
|
|
2849
2863
|
x,
|
|
2850
2864
|
y,
|
|
2851
2865
|
width,
|
|
@@ -3010,6 +3024,7 @@ var InteractiveEdgeError = class extends Error {
|
|
|
3010
3024
|
//#region src/edges/shapes/interactive-edge-shape/interactive-edge-shape.ts
|
|
3011
3025
|
var InteractiveEdgeShape = class InteractiveEdgeShape {
|
|
3012
3026
|
baseEdge;
|
|
3027
|
+
element;
|
|
3013
3028
|
svg;
|
|
3014
3029
|
group;
|
|
3015
3030
|
line;
|
|
@@ -3027,7 +3042,8 @@ var InteractiveEdgeShape = class InteractiveEdgeShape {
|
|
|
3027
3042
|
constructor(baseEdge, params) {
|
|
3028
3043
|
this.baseEdge = baseEdge;
|
|
3029
3044
|
if (baseEdge instanceof InteractiveEdgeShape) throw new InteractiveEdgeError("interactive edge can be configured only once");
|
|
3030
|
-
this.
|
|
3045
|
+
this.element = this.baseEdge.element;
|
|
3046
|
+
this.svg = this.element;
|
|
3031
3047
|
this.group = this.baseEdge.group;
|
|
3032
3048
|
this.line = this.baseEdge.line;
|
|
3033
3049
|
this.sourceArrow = this.baseEdge.sourceArrow;
|
|
@@ -3065,17 +3081,19 @@ var MidpointEdgeShape = class {
|
|
|
3065
3081
|
sourceArrow;
|
|
3066
3082
|
targetArrow;
|
|
3067
3083
|
onAfterRender;
|
|
3084
|
+
element;
|
|
3068
3085
|
svg;
|
|
3069
3086
|
constructor(baseShape, midpointElement) {
|
|
3070
3087
|
this.baseShape = baseShape;
|
|
3071
3088
|
this.midpointElement = midpointElement;
|
|
3072
|
-
this.
|
|
3089
|
+
this.element = this.baseShape.element;
|
|
3090
|
+
this.svg = this.element;
|
|
3073
3091
|
this.group = this.baseShape.group;
|
|
3074
3092
|
this.line = this.baseShape.line;
|
|
3075
3093
|
this.sourceArrow = this.baseShape.sourceArrow;
|
|
3076
3094
|
this.targetArrow = this.baseShape.targetArrow;
|
|
3077
3095
|
this.onAfterRender = this.baseShape.onAfterRender;
|
|
3078
|
-
this.
|
|
3096
|
+
this.element.append(this.midpointElement);
|
|
3079
3097
|
this.baseShape.onAfterRender.subscribe((model) => {
|
|
3080
3098
|
const midpoint = model.edgePath.midpoint;
|
|
3081
3099
|
const transform = `translate(${midpoint.x}px, ${midpoint.y}px)`;
|
|
@@ -5081,16 +5099,16 @@ var UserSelectableEdgesConfigurator = class UserSelectableEdgesConfigurator {
|
|
|
5081
5099
|
onEdgeSelected;
|
|
5082
5100
|
onAfterEdgeAdded = (edgeId) => {
|
|
5083
5101
|
const { shape } = this.canvas.graph.getEdge(edgeId);
|
|
5084
|
-
this.configurator.enable(shape.
|
|
5102
|
+
this.configurator.enable(shape.element);
|
|
5085
5103
|
};
|
|
5086
5104
|
onBeforeEdgeRemoved = (edgeId) => {
|
|
5087
5105
|
const { shape } = this.canvas.graph.getEdge(edgeId);
|
|
5088
|
-
this.configurator.disable(shape.
|
|
5106
|
+
this.configurator.disable(shape.element);
|
|
5089
5107
|
};
|
|
5090
5108
|
reset = () => {
|
|
5091
5109
|
this.canvas.graph.getAllEdgeIds().forEach((edgeId) => {
|
|
5092
5110
|
const { shape } = this.canvas.graph.getEdge(edgeId);
|
|
5093
|
-
this.configurator.disable(shape.
|
|
5111
|
+
this.configurator.disable(shape.element);
|
|
5094
5112
|
});
|
|
5095
5113
|
};
|
|
5096
5114
|
constructor(canvas, window, pointInsideVerifier, eventTagger, params) {
|
package/dist/html-graph.min.js
CHANGED
|
@@ -35,7 +35,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
35
35
|
i(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
|
|
36
36
|
}
|
|
37
37
|
attachEdge(e) {
|
|
38
|
-
let t = this.graphStore.getEdge(e).payload.shape.
|
|
38
|
+
let t = this.graphStore.getEdge(e).payload.shape.element;
|
|
39
39
|
this.edgeIdToElementMap.set(e, t), this.container.appendChild(t), this.renderEdge(e), this.updateEdgePriority(e);
|
|
40
40
|
}
|
|
41
41
|
detachEdge(e) {
|
|
@@ -63,7 +63,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
63
63
|
updateEdgeShape(e) {
|
|
64
64
|
let t = this.edgeIdToElementMap.get(e);
|
|
65
65
|
this.container.removeChild(t);
|
|
66
|
-
let n = this.graphStore.getEdge(e).payload.shape.
|
|
66
|
+
let n = this.graphStore.getEdge(e).payload.shape.element;
|
|
67
67
|
this.edgeIdToElementMap.set(e, n), this.container.appendChild(n);
|
|
68
68
|
}
|
|
69
69
|
renderEdge(t) {
|
|
@@ -76,7 +76,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
76
76
|
}
|
|
77
77
|
updateEdgePriority(e) {
|
|
78
78
|
let t = this.graphStore.getEdge(e);
|
|
79
|
-
t.payload.shape.
|
|
79
|
+
t.payload.shape.element.style.zIndex = `${t.payload.priority}`;
|
|
80
80
|
}
|
|
81
81
|
createEdgeRenderPort(e, t, n, r) {
|
|
82
82
|
let i = this.viewportStore.createContentCoords({
|
|
@@ -513,7 +513,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
513
513
|
if (this.hasEdge(e.id)) throw new p(m.addEdgeWithExistingId(e.id));
|
|
514
514
|
if (!this.hasPort(e.from)) throw new p(m.addEdgeFromNonexistentPort(e.id, e.from));
|
|
515
515
|
if (!this.hasPort(e.to)) throw new p(m.addEdgeToNonexistentPort(e.id, e.to));
|
|
516
|
-
let t = this.findEdgeIdByElement(e.shape.
|
|
516
|
+
let t = this.findEdgeIdByElement(e.shape.element);
|
|
517
517
|
if (t !== void 0) throw new p(m.addEdgeWithElementInUse(e.id, t));
|
|
518
518
|
this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
|
|
519
519
|
}
|
|
@@ -621,11 +621,11 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
621
621
|
shape: e.shape,
|
|
622
622
|
priority: e.priority
|
|
623
623
|
}
|
|
624
|
-
}), this.edgesElementsMap.set(e.shape.
|
|
624
|
+
}), this.edgesElementsMap.set(e.shape.element, e.id), e.from === e.to ? this.portCycleEdges.get(e.from).add(e.id) : (this.portOutgoingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id));
|
|
625
625
|
}
|
|
626
626
|
removeEdgeInternal(e) {
|
|
627
627
|
let { from: t, to: n, payload: r } = this.getEdge(e);
|
|
628
|
-
this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(n).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(n).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(n).delete(e), this.edges.delete(e), this.edgesElementsMap.delete(r.shape.
|
|
628
|
+
this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(n).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(n).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(n).delete(e), this.edges.delete(e), this.edgesElementsMap.delete(r.shape.element);
|
|
629
629
|
}
|
|
630
630
|
}, g = (e) => ({
|
|
631
631
|
scale: 1 / e.scale,
|
|
@@ -1487,6 +1487,7 @@ var re = (e, t) => {
|
|
|
1487
1487
|
y: Math.sin(e)
|
|
1488
1488
|
}), I = class {
|
|
1489
1489
|
params;
|
|
1490
|
+
element;
|
|
1490
1491
|
svg;
|
|
1491
1492
|
group = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1492
1493
|
line;
|
|
@@ -1496,11 +1497,11 @@ var re = (e, t) => {
|
|
|
1496
1497
|
afterRenderEmitter;
|
|
1497
1498
|
arrowRenderer;
|
|
1498
1499
|
constructor(e) {
|
|
1499
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = u(), this.arrowRenderer = this.params.arrowRenderer, this.
|
|
1500
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = u(), this.arrowRenderer = this.params.arrowRenderer, this.element = ce(e.color), this.svg = this.element, this.element.appendChild(this.group), this.line = le(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = A(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = A(), this.group.appendChild(this.targetArrow));
|
|
1500
1501
|
}
|
|
1501
1502
|
render(t) {
|
|
1502
1503
|
let { x: n, y: r, width: i, height: a, from: o, to: s } = ae(t.from, t.to, this.params.padding);
|
|
1503
|
-
ue(this.
|
|
1504
|
+
ue(this.element, {
|
|
1504
1505
|
x: n,
|
|
1505
1506
|
y: r,
|
|
1506
1507
|
width: i,
|
|
@@ -1614,6 +1615,7 @@ var re = (e, t) => {
|
|
|
1614
1615
|
});
|
|
1615
1616
|
}
|
|
1616
1617
|
}, je = class {
|
|
1618
|
+
element;
|
|
1617
1619
|
svg;
|
|
1618
1620
|
group;
|
|
1619
1621
|
line;
|
|
@@ -1671,12 +1673,13 @@ var re = (e, t) => {
|
|
|
1671
1673
|
createDetourPath: this.createDetourPath,
|
|
1672
1674
|
createLinePath: this.createLinePath,
|
|
1673
1675
|
padding: 50
|
|
1674
|
-
}), this.
|
|
1676
|
+
}), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1675
1677
|
}
|
|
1676
1678
|
render(e) {
|
|
1677
1679
|
this.pathShape.render(e);
|
|
1678
1680
|
}
|
|
1679
1681
|
}, Me = (e) => Math.cos(e) > 0 ? 0 : Math.PI, Ne = class {
|
|
1682
|
+
element;
|
|
1680
1683
|
svg;
|
|
1681
1684
|
group;
|
|
1682
1685
|
line;
|
|
@@ -1737,7 +1740,7 @@ var re = (e, t) => {
|
|
|
1737
1740
|
createDetourPath: this.createDetourPath,
|
|
1738
1741
|
createLinePath: this.createLinePath,
|
|
1739
1742
|
padding: 50
|
|
1740
|
-
}), this.
|
|
1743
|
+
}), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1741
1744
|
}
|
|
1742
1745
|
render(e) {
|
|
1743
1746
|
let { from: t, to: n, category: r } = e;
|
|
@@ -1754,6 +1757,7 @@ var re = (e, t) => {
|
|
|
1754
1757
|
});
|
|
1755
1758
|
}
|
|
1756
1759
|
}, Pe = class {
|
|
1760
|
+
element;
|
|
1757
1761
|
svg;
|
|
1758
1762
|
group;
|
|
1759
1763
|
line;
|
|
@@ -1816,12 +1820,13 @@ var re = (e, t) => {
|
|
|
1816
1820
|
createDetourPath: this.createDetourPath,
|
|
1817
1821
|
createLinePath: this.createLinePath,
|
|
1818
1822
|
padding: 50
|
|
1819
|
-
}), this.
|
|
1823
|
+
}), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1820
1824
|
}
|
|
1821
1825
|
render(e) {
|
|
1822
1826
|
this.pathShape.render(e);
|
|
1823
1827
|
}
|
|
1824
1828
|
}, Fe = Math.PI / 2, Ie = (e) => Math.sin(e) > 0 ? Fe : -Fe, Le = class {
|
|
1829
|
+
element;
|
|
1825
1830
|
svg;
|
|
1826
1831
|
group;
|
|
1827
1832
|
line;
|
|
@@ -1882,7 +1887,7 @@ var re = (e, t) => {
|
|
|
1882
1887
|
createDetourPath: this.createDetourPath,
|
|
1883
1888
|
createLinePath: this.createLinePath,
|
|
1884
1889
|
padding: 50
|
|
1885
|
-
}), this.
|
|
1890
|
+
}), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1886
1891
|
}
|
|
1887
1892
|
render(e) {
|
|
1888
1893
|
let { from: t, to: n, category: r } = e;
|
|
@@ -1902,6 +1907,7 @@ var re = (e, t) => {
|
|
|
1902
1907
|
let t = e + Math.PI / 4, n = Math.cos(t), r = Math.sin(t);
|
|
1903
1908
|
return n > 0 ? r > 0 ? 0 : -Math.PI / 2 : r > 0 ? Math.PI / 2 : Math.PI;
|
|
1904
1909
|
}, ze = class {
|
|
1910
|
+
element;
|
|
1905
1911
|
svg;
|
|
1906
1912
|
group;
|
|
1907
1913
|
line;
|
|
@@ -1962,7 +1968,7 @@ var re = (e, t) => {
|
|
|
1962
1968
|
createDetourPath: this.createDetourPath,
|
|
1963
1969
|
createLinePath: this.createLinePath,
|
|
1964
1970
|
padding: 50
|
|
1965
|
-
}), this.
|
|
1971
|
+
}), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1966
1972
|
}
|
|
1967
1973
|
render(e) {
|
|
1968
1974
|
let { from: t, to: n, category: r } = e;
|
|
@@ -1982,6 +1988,7 @@ var re = (e, t) => {
|
|
|
1982
1988
|
let { direction: t, radius: n } = e, { x: r, y: i } = t, { horizontal: a, vertical: o } = n, s = i / r, c = Math.abs(o / s), l = Math.abs(a * s), u = Math.min(a, c), d = Math.min(o, l);
|
|
1983
1989
|
return Math.sqrt(u * u + d * d);
|
|
1984
1990
|
}, Ve = (e) => typeof e == "number" ? () => e : e === "box" ? Be : e, He = F.portOffset, R = class {
|
|
1991
|
+
element;
|
|
1985
1992
|
svg;
|
|
1986
1993
|
group = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1987
1994
|
line;
|
|
@@ -1996,11 +2003,11 @@ var re = (e, t) => {
|
|
|
1996
2003
|
afterRenderEmitter;
|
|
1997
2004
|
arrowRenderer;
|
|
1998
2005
|
constructor(e) {
|
|
1999
|
-
[this.afterRenderEmitter, this.onAfterRender] = u(), this.color = e?.color ?? F.color, this.width = e?.width ?? F.width, this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowRenderer = L(e?.arrowRenderer ?? {}), this.sourceOffsetFn = Ve(e?.sourceOffset ?? He), this.targetOffsetFn = Ve(e?.targetOffset ?? He), this.
|
|
2006
|
+
[this.afterRenderEmitter, this.onAfterRender] = u(), this.color = e?.color ?? F.color, this.width = e?.width ?? F.width, this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowRenderer = L(e?.arrowRenderer ?? {}), this.sourceOffsetFn = Ve(e?.sourceOffset ?? He), this.targetOffsetFn = Ve(e?.targetOffset ?? He), this.element = ce(this.color), this.svg = this.element, this.element.appendChild(this.group), this.line = le(this.width), this.group.appendChild(this.line), e?.hasSourceArrow && (this.sourceArrow = A(), this.group.appendChild(this.sourceArrow)), e?.hasTargetArrow && (this.targetArrow = A(), this.group.appendChild(this.targetArrow));
|
|
2000
2007
|
}
|
|
2001
2008
|
render(e) {
|
|
2002
2009
|
let { x: t, y: n, width: r, height: i, from: a, to: o } = ae(e.from, e.to, 50);
|
|
2003
|
-
ue(this.
|
|
2010
|
+
ue(this.element, {
|
|
2004
2011
|
x: t,
|
|
2005
2012
|
y: n,
|
|
2006
2013
|
width: r,
|
|
@@ -2113,6 +2120,7 @@ var re = (e, t) => {
|
|
|
2113
2120
|
}
|
|
2114
2121
|
}, qe = class e {
|
|
2115
2122
|
baseEdge;
|
|
2123
|
+
element;
|
|
2116
2124
|
svg;
|
|
2117
2125
|
group;
|
|
2118
2126
|
line;
|
|
@@ -2125,7 +2133,7 @@ var re = (e, t) => {
|
|
|
2125
2133
|
interactiveTargetArrow = null;
|
|
2126
2134
|
constructor(t, n) {
|
|
2127
2135
|
if (this.baseEdge = t, t instanceof e) throw new Ke("interactive edge can be configured only once");
|
|
2128
|
-
this.
|
|
2136
|
+
this.element = this.baseEdge.element, this.svg = this.element, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
|
|
2129
2137
|
let r = n?.distance ?? F.interactiveWidth;
|
|
2130
2138
|
this.interactiveLine = We(r), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Ge(r), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Ge(r), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((e) => {
|
|
2131
2139
|
this.interactiveLine.setAttribute("d", e.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", e.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", e.targetArrowPath);
|
|
@@ -2142,9 +2150,10 @@ var re = (e, t) => {
|
|
|
2142
2150
|
sourceArrow;
|
|
2143
2151
|
targetArrow;
|
|
2144
2152
|
onAfterRender;
|
|
2153
|
+
element;
|
|
2145
2154
|
svg;
|
|
2146
2155
|
constructor(e, t) {
|
|
2147
|
-
this.baseShape = e, this.midpointElement = t, this.
|
|
2156
|
+
this.baseShape = e, this.midpointElement = t, this.element = this.baseShape.element, this.svg = this.element, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.element.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((e) => {
|
|
2148
2157
|
let t = e.edgePath.midpoint, n = `translate(${t.x}px, ${t.y}px)`;
|
|
2149
2158
|
this.midpointElement.style.setProperty("transform", n);
|
|
2150
2159
|
});
|
|
@@ -3553,16 +3562,16 @@ var re = (e, t) => {
|
|
|
3553
3562
|
onEdgeSelected;
|
|
3554
3563
|
onAfterEdgeAdded = (e) => {
|
|
3555
3564
|
let { shape: t } = this.canvas.graph.getEdge(e);
|
|
3556
|
-
this.configurator.enable(t.
|
|
3565
|
+
this.configurator.enable(t.element);
|
|
3557
3566
|
};
|
|
3558
3567
|
onBeforeEdgeRemoved = (e) => {
|
|
3559
3568
|
let { shape: t } = this.canvas.graph.getEdge(e);
|
|
3560
|
-
this.configurator.disable(t.
|
|
3569
|
+
this.configurator.disable(t.element);
|
|
3561
3570
|
};
|
|
3562
3571
|
reset = () => {
|
|
3563
3572
|
this.canvas.graph.getAllEdgeIds().forEach((e) => {
|
|
3564
3573
|
let { shape: t } = this.canvas.graph.getEdge(e);
|
|
3565
|
-
this.configurator.disable(t.
|
|
3574
|
+
this.configurator.disable(t.element);
|
|
3566
3575
|
});
|
|
3567
3576
|
};
|
|
3568
3577
|
constructor(e, t, n, r, i) {
|