@html-graph/html-graph 8.6.0 → 8.6.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/html-graph.js +275 -268
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Ke = Object.defineProperty;
|
|
2
2
|
var Qe = (r, e, t) => e in r ? Ke(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var i = (r, e, t) => Qe(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
var
|
|
4
|
+
var R = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(R || {});
|
|
5
5
|
const Ze = () => {
|
|
6
6
|
const r = document.createElement("div");
|
|
7
7
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
@@ -10,6 +10,8 @@ const Ze = () => {
|
|
|
10
10
|
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
11
11
|
}, _e = (r) => {
|
|
12
12
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
13
|
+
}, et = (r) => {
|
|
14
|
+
r.style.removeProperty("position"), r.style.removeProperty("top"), r.style.removeProperty("left"), r.style.removeProperty("visibility"), r.style.removeProperty("transform");
|
|
13
15
|
};
|
|
14
16
|
class Ee {
|
|
15
17
|
constructor(e, t, s) {
|
|
@@ -29,7 +31,7 @@ class Ee {
|
|
|
29
31
|
}
|
|
30
32
|
detachNode(e) {
|
|
31
33
|
const t = this.graphStore.getNode(e);
|
|
32
|
-
this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
|
|
34
|
+
et(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
|
|
33
35
|
}
|
|
34
36
|
attachEdge(e) {
|
|
35
37
|
const t = this.graphStore.getEdge(e).payload.shape.svg;
|
|
@@ -47,7 +49,7 @@ class Ee {
|
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
51
|
destroy() {
|
|
50
|
-
this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
|
|
52
|
+
this.clear(), this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
|
|
51
53
|
}
|
|
52
54
|
updateNodePosition(e) {
|
|
53
55
|
const t = this.graphStore.getNode(e), { width: s, height: o } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(s, o), d = a.x - n * h.x, c = a.y - n * h.y;
|
|
@@ -70,8 +72,8 @@ class Ee {
|
|
|
70
72
|
h,
|
|
71
73
|
d
|
|
72
74
|
), g = this.createEdgeRenderPort(o, a, h, d);
|
|
73
|
-
let l =
|
|
74
|
-
s.element === o.element ? l =
|
|
75
|
+
let l = R.Line;
|
|
76
|
+
s.element === o.element ? l = R.PortCycle : s.nodeId === o.nodeId && (l = R.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
|
|
75
77
|
}
|
|
76
78
|
updateEdgePriority(e) {
|
|
77
79
|
const t = this.graphStore.getEdge(e);
|
|
@@ -91,7 +93,7 @@ class Ee {
|
|
|
91
93
|
};
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
|
-
class
|
|
96
|
+
class tt {
|
|
95
97
|
constructor(e) {
|
|
96
98
|
i(this, "xFrom", 1 / 0);
|
|
97
99
|
i(this, "yFrom", 1 / 0);
|
|
@@ -111,7 +113,7 @@ class et {
|
|
|
111
113
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
|
-
class
|
|
116
|
+
class rt {
|
|
115
117
|
constructor(e, t, s, o) {
|
|
116
118
|
i(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
117
119
|
i(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -135,7 +137,7 @@ class tt {
|
|
|
135
137
|
this.handleAttachEdge(a);
|
|
136
138
|
});
|
|
137
139
|
});
|
|
138
|
-
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new
|
|
140
|
+
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new tt(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
139
141
|
}
|
|
140
142
|
attachNode(e) {
|
|
141
143
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -189,7 +191,7 @@ class tt {
|
|
|
189
191
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
190
192
|
}
|
|
191
193
|
}
|
|
192
|
-
class
|
|
194
|
+
class st {
|
|
193
195
|
constructor(e, t) {
|
|
194
196
|
i(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
195
197
|
i(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
@@ -316,7 +318,7 @@ class Se {
|
|
|
316
318
|
this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
|
|
317
319
|
}
|
|
318
320
|
}
|
|
319
|
-
class
|
|
321
|
+
class ot {
|
|
320
322
|
constructor() {
|
|
321
323
|
i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
322
324
|
i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -371,7 +373,7 @@ class be {
|
|
|
371
373
|
i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
372
374
|
i(this, "portOutgoingEdges", /* @__PURE__ */ new Map());
|
|
373
375
|
i(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
374
|
-
i(this, "elementPorts", new
|
|
376
|
+
i(this, "elementPorts", new ot());
|
|
375
377
|
i(this, "afterNodeAddedEmitter");
|
|
376
378
|
i(this, "onAfterNodeAdded");
|
|
377
379
|
i(this, "afterNodeUpdatedEmitter");
|
|
@@ -637,7 +639,7 @@ const ue = (r) => ({
|
|
|
637
639
|
x: r.scale * e.x + r.x,
|
|
638
640
|
y: r.scale * e.y + r.y
|
|
639
641
|
});
|
|
640
|
-
class
|
|
642
|
+
class it {
|
|
641
643
|
constructor(e) {
|
|
642
644
|
i(this, "viewportMatrix", pe);
|
|
643
645
|
i(this, "contentMatrix", pe);
|
|
@@ -698,15 +700,18 @@ class Q {
|
|
|
698
700
|
const t = this.canvas.graph.getNode(e);
|
|
699
701
|
this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
|
|
700
702
|
});
|
|
701
|
-
i(this, "
|
|
703
|
+
i(this, "reset", () => {
|
|
702
704
|
this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
|
|
703
705
|
});
|
|
706
|
+
i(this, "revert", () => {
|
|
707
|
+
this.reset();
|
|
708
|
+
});
|
|
704
709
|
this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
|
|
705
710
|
t.forEach((s) => {
|
|
706
711
|
const o = s.target;
|
|
707
712
|
this.handleNodeResize(o);
|
|
708
713
|
});
|
|
709
|
-
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.
|
|
714
|
+
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
710
715
|
}
|
|
711
716
|
static configure(e) {
|
|
712
717
|
new Q(e);
|
|
@@ -716,10 +721,10 @@ class Q {
|
|
|
716
721
|
this.canvas.updateNode(t);
|
|
717
722
|
}
|
|
718
723
|
}
|
|
719
|
-
const
|
|
724
|
+
const nt = (r, e, t) => {
|
|
720
725
|
const { x: s, y: o, width: n, height: a } = r.getBoundingClientRect();
|
|
721
726
|
return e >= s && e <= s + n && t >= o && t <= o + a;
|
|
722
|
-
},
|
|
727
|
+
}, at = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, D = (r, e, t, s) => nt(e, t, s) && at(r, t, s), U = (r, e) => {
|
|
723
728
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
724
729
|
}, O = (r) => {
|
|
725
730
|
const e = document.createElement("div");
|
|
@@ -736,7 +741,7 @@ const it = (r, e, t) => {
|
|
|
736
741
|
}
|
|
737
742
|
]
|
|
738
743
|
};
|
|
739
|
-
},
|
|
744
|
+
}, ht = (r, e) => {
|
|
740
745
|
let t = e;
|
|
741
746
|
for (; t !== null; ) {
|
|
742
747
|
const s = r.findPortIdsByElement(t)[0] ?? null;
|
|
@@ -769,7 +774,7 @@ function* Pe(r, e) {
|
|
|
769
774
|
const Ce = (r, e) => {
|
|
770
775
|
const t = Pe(document, e);
|
|
771
776
|
for (const s of t) {
|
|
772
|
-
const o =
|
|
777
|
+
const o = ht(r, s);
|
|
773
778
|
if (o.status === "portFound")
|
|
774
779
|
return o.portId;
|
|
775
780
|
if (o.status === "nodeEncountered")
|
|
@@ -807,7 +812,7 @@ const Ne = (r, e) => ({
|
|
|
807
812
|
x: e * r.x + (1 - e) / 2 * s.x,
|
|
808
813
|
y: t * r.y + (1 - t) / 2 * s.y
|
|
809
814
|
});
|
|
810
|
-
class
|
|
815
|
+
class dt {
|
|
811
816
|
constructor(e) {
|
|
812
817
|
i(this, "path");
|
|
813
818
|
i(this, "midpoint");
|
|
@@ -832,7 +837,7 @@ class ht {
|
|
|
832
837
|
this.path = `${d}${h}${c}`;
|
|
833
838
|
}
|
|
834
839
|
}
|
|
835
|
-
class
|
|
840
|
+
class ct {
|
|
836
841
|
constructor(e) {
|
|
837
842
|
i(this, "path");
|
|
838
843
|
i(this, "midpoint");
|
|
@@ -865,7 +870,7 @@ class dt {
|
|
|
865
870
|
}, p = {
|
|
866
871
|
x: (g.x + u.x) / 2,
|
|
867
872
|
y: (g.y + u.y) / 2
|
|
868
|
-
},
|
|
873
|
+
}, y = {
|
|
869
874
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
870
875
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
871
876
|
}, v = {
|
|
@@ -881,7 +886,7 @@ class dt {
|
|
|
881
886
|
this.path = [
|
|
882
887
|
`M ${t.x} ${t.y}`,
|
|
883
888
|
`L ${c.x} ${c.y}`,
|
|
884
|
-
`C ${
|
|
889
|
+
`C ${y.x} ${y.y} ${x.x} ${x.y} ${p.x} ${p.y}`,
|
|
885
890
|
`C ${b.x} ${b.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
|
|
886
891
|
`L ${s.x} ${s.y}`
|
|
887
892
|
].join(" "), this.midpoint = z(p, e.flipX, e.flipY, e.to);
|
|
@@ -892,13 +897,13 @@ const Z = Object.freeze({
|
|
|
892
897
|
}), Me = (r) => {
|
|
893
898
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
894
899
|
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(Z.edgeColor, r), e;
|
|
895
|
-
},
|
|
900
|
+
}, Re = (r) => {
|
|
896
901
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
897
902
|
return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
898
903
|
}, W = () => {
|
|
899
904
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
900
905
|
return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
|
|
901
|
-
},
|
|
906
|
+
}, De = () => {
|
|
902
907
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
903
908
|
return r.style.transformOrigin = "50% 50%", r;
|
|
904
909
|
}, Le = (r, e) => {
|
|
@@ -910,20 +915,20 @@ const Z = Object.freeze({
|
|
|
910
915
|
let o = 0, n = 0, a = 0;
|
|
911
916
|
r.forEach((h, d) => {
|
|
912
917
|
let c = 0, g = 0, l = 0;
|
|
913
|
-
const u = d > 0, p = d < s,
|
|
918
|
+
const u = d > 0, p = d < s, y = u && p;
|
|
914
919
|
if (u && (c = -o, g = -n, l = a), p) {
|
|
915
920
|
const V = r[d + 1];
|
|
916
921
|
o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
|
|
917
922
|
}
|
|
918
|
-
const x = a !== 0 ? Math.min((
|
|
919
|
-
d > 0 && t.push(`L ${L.x} ${L.y}`),
|
|
923
|
+
const x = a !== 0 ? Math.min((y ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, b = y ? { x: h.x + o * x, y: h.y + n * x } : h, C = l !== 0 ? Math.min((y ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, L = y ? { x: h.x + c * C, y: h.y + g * C } : h;
|
|
924
|
+
d > 0 && t.push(`L ${L.x} ${L.y}`), y && t.push(
|
|
920
925
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${b.x} ${b.y}`
|
|
921
926
|
);
|
|
922
927
|
});
|
|
923
928
|
}
|
|
924
929
|
return t.join(" ");
|
|
925
930
|
};
|
|
926
|
-
class
|
|
931
|
+
class lt {
|
|
927
932
|
constructor(e) {
|
|
928
933
|
i(this, "path");
|
|
929
934
|
i(this, "midpoint");
|
|
@@ -955,14 +960,14 @@ class ct {
|
|
|
955
960
|
}, u = { x: l.x, y: g }, p = {
|
|
956
961
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
957
962
|
y: d.y
|
|
958
|
-
},
|
|
963
|
+
}, y = { x: p.x, y: g };
|
|
959
964
|
this.path = M(
|
|
960
|
-
[s, h, l, u,
|
|
965
|
+
[s, h, l, u, y, p, d, o],
|
|
961
966
|
this.params.roundness
|
|
962
967
|
);
|
|
963
968
|
}
|
|
964
969
|
}
|
|
965
|
-
class
|
|
970
|
+
class gt {
|
|
966
971
|
constructor(e) {
|
|
967
972
|
i(this, "path");
|
|
968
973
|
i(this, "midpoint");
|
|
@@ -993,7 +998,7 @@ class lt {
|
|
|
993
998
|
);
|
|
994
999
|
}
|
|
995
1000
|
}
|
|
996
|
-
class
|
|
1001
|
+
class ut {
|
|
997
1002
|
constructor(e) {
|
|
998
1003
|
i(this, "path");
|
|
999
1004
|
i(this, "midpoint");
|
|
@@ -1023,7 +1028,7 @@ class gt {
|
|
|
1023
1028
|
this.path = M([s, a, h, o], this.params.roundness);
|
|
1024
1029
|
}
|
|
1025
1030
|
}
|
|
1026
|
-
class
|
|
1031
|
+
class pt {
|
|
1027
1032
|
constructor(e) {
|
|
1028
1033
|
i(this, "path");
|
|
1029
1034
|
i(this, "midpoint");
|
|
@@ -1055,9 +1060,9 @@ class ut {
|
|
|
1055
1060
|
}, u = { x: g, y: l.y }, p = {
|
|
1056
1061
|
x: d.x,
|
|
1057
1062
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1058
|
-
},
|
|
1063
|
+
}, y = { x: g, y: p.y };
|
|
1059
1064
|
this.path = M(
|
|
1060
|
-
[s, h, l, u,
|
|
1065
|
+
[s, h, l, u, y, p, d, o],
|
|
1061
1066
|
this.params.roundness
|
|
1062
1067
|
);
|
|
1063
1068
|
}
|
|
@@ -1082,7 +1087,7 @@ class J {
|
|
|
1082
1087
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${M(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1083
1088
|
}
|
|
1084
1089
|
}
|
|
1085
|
-
class
|
|
1090
|
+
class wt {
|
|
1086
1091
|
constructor(e) {
|
|
1087
1092
|
i(this, "path");
|
|
1088
1093
|
i(this, "midpoint");
|
|
@@ -1093,7 +1098,7 @@ class pt {
|
|
|
1093
1098
|
{ x: c, y: -n },
|
|
1094
1099
|
{ x: d, y: 0 }
|
|
1095
1100
|
].map(
|
|
1096
|
-
(
|
|
1101
|
+
(y) => m(y, this.params.sourceDirection, w)
|
|
1097
1102
|
), u = [
|
|
1098
1103
|
`M ${l[0].x} ${l[0].y}`,
|
|
1099
1104
|
`A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
|
|
@@ -1103,7 +1108,7 @@ class pt {
|
|
|
1103
1108
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : p}${u}`, this.midpoint = l[3];
|
|
1104
1109
|
}
|
|
1105
1110
|
}
|
|
1106
|
-
class
|
|
1111
|
+
class yt {
|
|
1107
1112
|
constructor(e) {
|
|
1108
1113
|
i(this, "path");
|
|
1109
1114
|
i(this, "midpoint");
|
|
@@ -1180,7 +1185,7 @@ class ft {
|
|
|
1180
1185
|
);
|
|
1181
1186
|
}
|
|
1182
1187
|
}
|
|
1183
|
-
class
|
|
1188
|
+
class mt {
|
|
1184
1189
|
constructor(e) {
|
|
1185
1190
|
i(this, "path");
|
|
1186
1191
|
i(this, "midpoint");
|
|
@@ -1221,7 +1226,7 @@ class yt {
|
|
|
1221
1226
|
);
|
|
1222
1227
|
}
|
|
1223
1228
|
}
|
|
1224
|
-
const
|
|
1229
|
+
const f = Object.freeze({
|
|
1225
1230
|
color: "#777777",
|
|
1226
1231
|
width: 1,
|
|
1227
1232
|
arrowLength: 20,
|
|
@@ -1243,18 +1248,18 @@ const y = Object.freeze({
|
|
|
1243
1248
|
curvature: 90,
|
|
1244
1249
|
interactiveWidth: 10,
|
|
1245
1250
|
preOffset: 0
|
|
1246
|
-
}),
|
|
1251
|
+
}), ye = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1247
1252
|
class k {
|
|
1248
1253
|
constructor(e) {
|
|
1249
1254
|
i(this, "svg");
|
|
1250
|
-
i(this, "group",
|
|
1255
|
+
i(this, "group", De());
|
|
1251
1256
|
i(this, "line");
|
|
1252
1257
|
i(this, "sourceArrow", null);
|
|
1253
1258
|
i(this, "targetArrow", null);
|
|
1254
1259
|
i(this, "onAfterRender");
|
|
1255
1260
|
i(this, "afterRenderEmitter");
|
|
1256
1261
|
i(this, "arrowRenderer");
|
|
1257
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = S(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Me(e.color), this.svg.appendChild(this.group), this.line =
|
|
1262
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = S(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Me(e.color), this.svg.appendChild(this.group), this.line = Re(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = W(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = W(), this.group.appendChild(this.targetArrow));
|
|
1258
1263
|
}
|
|
1259
1264
|
render(e) {
|
|
1260
1265
|
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Te(
|
|
@@ -1262,11 +1267,11 @@ class k {
|
|
|
1262
1267
|
e.to
|
|
1263
1268
|
);
|
|
1264
1269
|
Le(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1265
|
-
const d =
|
|
1270
|
+
const d = ye(
|
|
1266
1271
|
e.from.direction,
|
|
1267
1272
|
a,
|
|
1268
1273
|
h
|
|
1269
|
-
), c =
|
|
1274
|
+
), c = ye(
|
|
1270
1275
|
e.to.direction,
|
|
1271
1276
|
a,
|
|
1272
1277
|
h
|
|
@@ -1275,7 +1280,7 @@ class k {
|
|
|
1275
1280
|
y: n
|
|
1276
1281
|
};
|
|
1277
1282
|
let l = { x: -c.x, y: -c.y }, u;
|
|
1278
|
-
e.category ===
|
|
1283
|
+
e.category === R.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === R.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
|
|
1279
1284
|
const p = u(
|
|
1280
1285
|
d,
|
|
1281
1286
|
c,
|
|
@@ -1284,12 +1289,12 @@ class k {
|
|
|
1284
1289
|
h
|
|
1285
1290
|
);
|
|
1286
1291
|
this.line.setAttribute("d", p.path);
|
|
1287
|
-
let
|
|
1288
|
-
this.sourceArrow && (
|
|
1292
|
+
let y = null;
|
|
1293
|
+
this.sourceArrow && (y = this.arrowRenderer({
|
|
1289
1294
|
direction: d,
|
|
1290
1295
|
shift: w,
|
|
1291
1296
|
arrowLength: this.params.arrowLength
|
|
1292
|
-
}), this.sourceArrow.setAttribute("d",
|
|
1297
|
+
}), this.sourceArrow.setAttribute("d", y));
|
|
1293
1298
|
let v = null;
|
|
1294
1299
|
this.targetArrow && (v = this.arrowRenderer({
|
|
1295
1300
|
direction: l,
|
|
@@ -1297,12 +1302,12 @@ class k {
|
|
|
1297
1302
|
arrowLength: this.params.arrowLength
|
|
1298
1303
|
}), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
|
|
1299
1304
|
edgePath: p,
|
|
1300
|
-
sourceArrowPath:
|
|
1305
|
+
sourceArrowPath: y,
|
|
1301
1306
|
targetArrowPath: v
|
|
1302
1307
|
});
|
|
1303
1308
|
}
|
|
1304
1309
|
}
|
|
1305
|
-
const
|
|
1310
|
+
const vt = (r) => (e) => {
|
|
1306
1311
|
const s = [
|
|
1307
1312
|
w,
|
|
1308
1313
|
{ x: e.arrowLength, y: r.radius },
|
|
@@ -1314,15 +1319,15 @@ const mt = (r) => (e) => {
|
|
|
1314
1319
|
y: h.y + e.shift.y
|
|
1315
1320
|
})), o = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
|
|
1316
1321
|
return `${o} ${n} ${a} Z`;
|
|
1317
|
-
},
|
|
1322
|
+
}, At = (r) => (e) => {
|
|
1318
1323
|
const t = r.radius, s = e.arrowLength, o = (s * s + 2 * s * t) / (2 * t), n = o + t, a = s + t - t * (s + t) / n, h = t * o / n, c = [w, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1319
|
-
(
|
|
1320
|
-
).map((
|
|
1321
|
-
x:
|
|
1322
|
-
y:
|
|
1324
|
+
(y) => m(y, e.direction, w)
|
|
1325
|
+
).map((y) => ({
|
|
1326
|
+
x: y.x + e.shift.x,
|
|
1327
|
+
y: y.y + e.shift.y
|
|
1323
1328
|
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${o} ${o} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${o} ${o} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1324
1329
|
return `${g} ${l} ${u} ${p}`;
|
|
1325
|
-
},
|
|
1330
|
+
}, xt = (r) => (e) => {
|
|
1326
1331
|
const t = r.smallRadius, s = r.radius, o = m(
|
|
1327
1332
|
{
|
|
1328
1333
|
x: e.arrowLength,
|
|
@@ -1348,22 +1353,22 @@ const mt = (r) => (e) => {
|
|
|
1348
1353
|
return r;
|
|
1349
1354
|
switch (r.type) {
|
|
1350
1355
|
case "triangle":
|
|
1351
|
-
return
|
|
1352
|
-
radius: r.radius ??
|
|
1356
|
+
return vt({
|
|
1357
|
+
radius: r.radius ?? f.polygonArrowRadius
|
|
1353
1358
|
});
|
|
1354
1359
|
case "arc":
|
|
1355
|
-
return
|
|
1356
|
-
radius: r.radius ??
|
|
1360
|
+
return At({
|
|
1361
|
+
radius: r.radius ?? f.circleArrowRadius
|
|
1357
1362
|
});
|
|
1358
1363
|
default:
|
|
1359
|
-
return
|
|
1360
|
-
smallRadius: r.smallRadius ??
|
|
1361
|
-
angle: r.angle ??
|
|
1362
|
-
radius: r.radius ??
|
|
1364
|
+
return xt({
|
|
1365
|
+
smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
|
|
1366
|
+
angle: r.angle ?? f.wedgeArrowAngle,
|
|
1367
|
+
radius: r.radius ?? f.wedgeArrowRadius
|
|
1363
1368
|
});
|
|
1364
1369
|
}
|
|
1365
1370
|
};
|
|
1366
|
-
class
|
|
1371
|
+
class Et {
|
|
1367
1372
|
constructor(e) {
|
|
1368
1373
|
i(this, "svg");
|
|
1369
1374
|
i(this, "group");
|
|
@@ -1380,7 +1385,7 @@ class xt {
|
|
|
1380
1385
|
i(this, "hasSourceArrow");
|
|
1381
1386
|
i(this, "hasTargetArrow");
|
|
1382
1387
|
i(this, "pathShape");
|
|
1383
|
-
i(this, "createCyclePath", (e) => new
|
|
1388
|
+
i(this, "createCyclePath", (e) => new wt({
|
|
1384
1389
|
sourceDirection: e,
|
|
1385
1390
|
radius: this.portCycleRadius,
|
|
1386
1391
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1388,7 +1393,7 @@ class xt {
|
|
|
1388
1393
|
hasSourceArrow: this.hasSourceArrow,
|
|
1389
1394
|
hasTargetArrow: this.hasTargetArrow
|
|
1390
1395
|
}));
|
|
1391
|
-
i(this, "createDetourPath", (e, t, s, o, n) => new
|
|
1396
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new ct({
|
|
1392
1397
|
to: s,
|
|
1393
1398
|
sourceDirection: e,
|
|
1394
1399
|
targetDirection: t,
|
|
@@ -1401,7 +1406,7 @@ class xt {
|
|
|
1401
1406
|
hasSourceArrow: this.hasSourceArrow,
|
|
1402
1407
|
hasTargetArrow: this.hasTargetArrow
|
|
1403
1408
|
}));
|
|
1404
|
-
i(this, "createLinePath", (e, t, s) => new
|
|
1409
|
+
i(this, "createLinePath", (e, t, s) => new dt({
|
|
1405
1410
|
to: s,
|
|
1406
1411
|
sourceDirection: e,
|
|
1407
1412
|
targetDirection: t,
|
|
@@ -1410,9 +1415,9 @@ class xt {
|
|
|
1410
1415
|
hasSourceArrow: this.hasSourceArrow,
|
|
1411
1416
|
hasTargetArrow: this.hasTargetArrow
|
|
1412
1417
|
}));
|
|
1413
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1414
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1415
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1418
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? f.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? f.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? f.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1419
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1420
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1416
1421
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1417
1422
|
arrowLength: this.arrowLength,
|
|
1418
1423
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1426,7 +1431,7 @@ class xt {
|
|
|
1426
1431
|
this.pathShape.render(e);
|
|
1427
1432
|
}
|
|
1428
1433
|
}
|
|
1429
|
-
class
|
|
1434
|
+
class St {
|
|
1430
1435
|
constructor(e) {
|
|
1431
1436
|
i(this, "svg");
|
|
1432
1437
|
i(this, "group");
|
|
@@ -1464,7 +1469,7 @@ class Et {
|
|
|
1464
1469
|
hasSourceArrow: this.hasSourceArrow,
|
|
1465
1470
|
hasTargetArrow: this.hasTargetArrow
|
|
1466
1471
|
}));
|
|
1467
|
-
i(this, "createLinePath", (e, t, s, o) => new
|
|
1472
|
+
i(this, "createLinePath", (e, t, s, o) => new lt({
|
|
1468
1473
|
to: s,
|
|
1469
1474
|
sourceDirection: e,
|
|
1470
1475
|
targetDirection: t,
|
|
@@ -1475,15 +1480,15 @@ class Et {
|
|
|
1475
1480
|
hasSourceArrow: this.hasSourceArrow,
|
|
1476
1481
|
hasTargetArrow: this.hasTargetArrow
|
|
1477
1482
|
}));
|
|
1478
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1479
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1483
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
|
|
1484
|
+
const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
|
|
1480
1485
|
this.roundness = Math.min(
|
|
1481
1486
|
t,
|
|
1482
1487
|
this.arrowOffset,
|
|
1483
1488
|
this.cycleSquareSide / 2
|
|
1484
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ??
|
|
1485
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1486
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1489
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1490
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1491
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1487
1492
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1488
1493
|
arrowLength: this.arrowLength,
|
|
1489
1494
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1497,7 +1502,7 @@ class Et {
|
|
|
1497
1502
|
this.pathShape.render(e);
|
|
1498
1503
|
}
|
|
1499
1504
|
}
|
|
1500
|
-
class
|
|
1505
|
+
class bt {
|
|
1501
1506
|
constructor(e) {
|
|
1502
1507
|
i(this, "svg");
|
|
1503
1508
|
i(this, "group");
|
|
@@ -1523,7 +1528,7 @@ class St {
|
|
|
1523
1528
|
hasSourceArrow: this.hasSourceArrow,
|
|
1524
1529
|
hasTargetArrow: this.hasTargetArrow
|
|
1525
1530
|
}));
|
|
1526
|
-
i(this, "createDetourPath", (e, t, s, o, n) => new
|
|
1531
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new gt({
|
|
1527
1532
|
to: s,
|
|
1528
1533
|
sourceDirection: e,
|
|
1529
1534
|
targetDirection: t,
|
|
@@ -1537,7 +1542,7 @@ class St {
|
|
|
1537
1542
|
hasSourceArrow: this.hasSourceArrow,
|
|
1538
1543
|
hasTargetArrow: this.hasTargetArrow
|
|
1539
1544
|
}));
|
|
1540
|
-
i(this, "createLinePath", (e, t, s) => new
|
|
1545
|
+
i(this, "createLinePath", (e, t, s) => new ut({
|
|
1541
1546
|
to: s,
|
|
1542
1547
|
sourceDirection: e,
|
|
1543
1548
|
targetDirection: t,
|
|
@@ -1547,15 +1552,15 @@ class St {
|
|
|
1547
1552
|
hasSourceArrow: this.hasSourceArrow,
|
|
1548
1553
|
hasTargetArrow: this.hasTargetArrow
|
|
1549
1554
|
}));
|
|
1550
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1551
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1555
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
|
|
1556
|
+
const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
|
|
1552
1557
|
this.roundness = Math.min(
|
|
1553
1558
|
t,
|
|
1554
1559
|
this.arrowOffset,
|
|
1555
1560
|
this.cycleSquareSide / 2
|
|
1556
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ??
|
|
1557
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1558
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1561
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1562
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1563
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1559
1564
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1560
1565
|
arrowLength: this.arrowLength,
|
|
1561
1566
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1569,7 +1574,7 @@ class St {
|
|
|
1569
1574
|
this.pathShape.render(e);
|
|
1570
1575
|
}
|
|
1571
1576
|
}
|
|
1572
|
-
class
|
|
1577
|
+
class Pt {
|
|
1573
1578
|
constructor(e) {
|
|
1574
1579
|
i(this, "svg");
|
|
1575
1580
|
i(this, "group");
|
|
@@ -1594,7 +1599,7 @@ class bt {
|
|
|
1594
1599
|
hasSourceArrow: this.hasSourceArrow,
|
|
1595
1600
|
hasTargetArrow: this.hasTargetArrow
|
|
1596
1601
|
}));
|
|
1597
|
-
i(this, "createDetourPath", (e, t, s, o, n) => new
|
|
1602
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new mt({
|
|
1598
1603
|
to: s,
|
|
1599
1604
|
sourceDirection: e,
|
|
1600
1605
|
targetDirection: t,
|
|
@@ -1607,7 +1612,7 @@ class bt {
|
|
|
1607
1612
|
hasSourceArrow: this.hasSourceArrow,
|
|
1608
1613
|
hasTargetArrow: this.hasTargetArrow
|
|
1609
1614
|
}));
|
|
1610
|
-
i(this, "createLinePath", (e, t, s, o, n) => new
|
|
1615
|
+
i(this, "createLinePath", (e, t, s, o, n) => new pt({
|
|
1611
1616
|
to: s,
|
|
1612
1617
|
sourceDirection: e,
|
|
1613
1618
|
targetDirection: t,
|
|
@@ -1618,15 +1623,15 @@ class bt {
|
|
|
1618
1623
|
hasSourceArrow: this.hasSourceArrow,
|
|
1619
1624
|
hasTargetArrow: this.hasTargetArrow
|
|
1620
1625
|
}));
|
|
1621
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1622
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1626
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
|
|
1627
|
+
const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
|
|
1623
1628
|
this.roundness = Math.min(
|
|
1624
1629
|
t,
|
|
1625
1630
|
this.arrowOffset,
|
|
1626
1631
|
this.cycleSquareSide / 2
|
|
1627
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ??
|
|
1628
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1629
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1632
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1633
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1634
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1630
1635
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1631
1636
|
arrowLength: this.arrowLength,
|
|
1632
1637
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1643,7 +1648,7 @@ class bt {
|
|
|
1643
1648
|
class Ve {
|
|
1644
1649
|
constructor(e) {
|
|
1645
1650
|
i(this, "svg");
|
|
1646
|
-
i(this, "group",
|
|
1651
|
+
i(this, "group", De());
|
|
1647
1652
|
i(this, "line");
|
|
1648
1653
|
i(this, "sourceArrow", null);
|
|
1649
1654
|
i(this, "targetArrow", null);
|
|
@@ -1655,7 +1660,7 @@ class Ve {
|
|
|
1655
1660
|
i(this, "onAfterRender");
|
|
1656
1661
|
i(this, "afterRenderEmitter");
|
|
1657
1662
|
i(this, "arrowRenderer");
|
|
1658
|
-
[this.afterRenderEmitter, this.onAfterRender] = S(), this.color = (e == null ? void 0 : e.color) ??
|
|
1663
|
+
[this.afterRenderEmitter, this.onAfterRender] = S(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = I((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg = Me(this.color), this.svg.appendChild(this.group), this.line = Re(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = W(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = W(), this.group.appendChild(this.targetArrow));
|
|
1659
1664
|
}
|
|
1660
1665
|
render(e) {
|
|
1661
1666
|
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Te(
|
|
@@ -1663,7 +1668,7 @@ class Ve {
|
|
|
1663
1668
|
e.to
|
|
1664
1669
|
);
|
|
1665
1670
|
Le(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1666
|
-
const d = { x: o, y: n }, c = new
|
|
1671
|
+
const d = { x: o, y: n }, c = new yt({
|
|
1667
1672
|
to: d,
|
|
1668
1673
|
sourceOffset: this.sourceOffset,
|
|
1669
1674
|
targetOffset: this.targetOffset,
|
|
@@ -1682,26 +1687,26 @@ class Ve {
|
|
|
1682
1687
|
y: d.y / u
|
|
1683
1688
|
};
|
|
1684
1689
|
if (this.sourceArrow) {
|
|
1685
|
-
const
|
|
1690
|
+
const y = {
|
|
1686
1691
|
x: p.x * this.sourceOffset,
|
|
1687
1692
|
y: p.y * this.sourceOffset
|
|
1688
1693
|
};
|
|
1689
1694
|
g = this.arrowRenderer({
|
|
1690
1695
|
direction: p,
|
|
1691
|
-
shift:
|
|
1696
|
+
shift: y,
|
|
1692
1697
|
arrowLength: this.arrowLength
|
|
1693
1698
|
}), this.sourceArrow.setAttribute("d", g);
|
|
1694
1699
|
}
|
|
1695
1700
|
if (this.targetArrow) {
|
|
1696
|
-
const
|
|
1701
|
+
const y = {
|
|
1697
1702
|
x: p.x * this.targetOffset,
|
|
1698
1703
|
y: p.y * this.targetOffset
|
|
1699
1704
|
};
|
|
1700
1705
|
l = this.arrowRenderer({
|
|
1701
1706
|
direction: { x: -p.x, y: -p.y },
|
|
1702
1707
|
shift: {
|
|
1703
|
-
x: d.x -
|
|
1704
|
-
y: d.y -
|
|
1708
|
+
x: d.x - y.x,
|
|
1709
|
+
y: d.y - y.y
|
|
1705
1710
|
},
|
|
1706
1711
|
arrowLength: this.arrowLength
|
|
1707
1712
|
}), this.targetArrow.setAttribute("d", l);
|
|
@@ -1714,17 +1719,17 @@ class Ve {
|
|
|
1714
1719
|
});
|
|
1715
1720
|
}
|
|
1716
1721
|
}
|
|
1717
|
-
const
|
|
1722
|
+
const Ct = () => {
|
|
1718
1723
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1719
1724
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1720
|
-
},
|
|
1725
|
+
}, Nt = (r) => {
|
|
1721
1726
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1722
1727
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1723
|
-
},
|
|
1728
|
+
}, fe = (r) => {
|
|
1724
1729
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1725
1730
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1726
1731
|
};
|
|
1727
|
-
class
|
|
1732
|
+
class Tt extends Error {
|
|
1728
1733
|
constructor(e) {
|
|
1729
1734
|
super(e), this.name = "InteractiveEdgeError";
|
|
1730
1735
|
}
|
|
@@ -1736,18 +1741,18 @@ class Fe {
|
|
|
1736
1741
|
i(this, "line");
|
|
1737
1742
|
i(this, "sourceArrow");
|
|
1738
1743
|
i(this, "targetArrow");
|
|
1739
|
-
i(this, "handle",
|
|
1744
|
+
i(this, "handle", Ct());
|
|
1740
1745
|
i(this, "onAfterRender");
|
|
1741
1746
|
i(this, "interactiveLine");
|
|
1742
1747
|
i(this, "interactiveSourceArrow", null);
|
|
1743
1748
|
i(this, "interactiveTargetArrow", null);
|
|
1744
1749
|
if (this.baseEdge = e, e instanceof Fe)
|
|
1745
|
-
throw new
|
|
1750
|
+
throw new Tt(
|
|
1746
1751
|
"interactive edge can be configured only once"
|
|
1747
1752
|
);
|
|
1748
1753
|
this.svg = this.baseEdge.svg, 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;
|
|
1749
|
-
const s = (t == null ? void 0 : t.distance) ??
|
|
1750
|
-
this.interactiveLine =
|
|
1754
|
+
const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
|
|
1755
|
+
this.interactiveLine = Nt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = fe(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = fe(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((o) => {
|
|
1751
1756
|
this.interactiveLine.setAttribute("d", o.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", o.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", o.targetArrowPath);
|
|
1752
1757
|
});
|
|
1753
1758
|
}
|
|
@@ -1755,7 +1760,7 @@ class Fe {
|
|
|
1755
1760
|
this.baseEdge.render(e);
|
|
1756
1761
|
}
|
|
1757
1762
|
}
|
|
1758
|
-
class
|
|
1763
|
+
class Cr {
|
|
1759
1764
|
constructor(e, t) {
|
|
1760
1765
|
i(this, "group");
|
|
1761
1766
|
i(this, "line");
|
|
@@ -2006,7 +2011,7 @@ class Be {
|
|
|
2006
2011
|
this.graphStore.clear();
|
|
2007
2012
|
}
|
|
2008
2013
|
destroy() {
|
|
2009
|
-
this.
|
|
2014
|
+
this.graphStore.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.unsubscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.unsubscribe(
|
|
2010
2015
|
this.onAfterNodePriorityUpdated
|
|
2011
2016
|
), this.graphStore.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.unsubscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.unsubscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.unsubscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.unsubscribe(
|
|
2012
2017
|
this.onAfterEdgeShapeUpdated
|
|
@@ -2015,11 +2020,11 @@ class Be {
|
|
|
2015
2020
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
2016
2021
|
}
|
|
2017
2022
|
}
|
|
2018
|
-
const
|
|
2023
|
+
const Mt = (r) => {
|
|
2019
2024
|
setTimeout(() => {
|
|
2020
2025
|
r();
|
|
2021
2026
|
});
|
|
2022
|
-
},
|
|
2027
|
+
}, Rt = (r) => {
|
|
2023
2028
|
queueMicrotask(() => {
|
|
2024
2029
|
r();
|
|
2025
2030
|
});
|
|
@@ -2113,9 +2118,9 @@ class We {
|
|
|
2113
2118
|
const d = {
|
|
2114
2119
|
x: (t + s) / 2,
|
|
2115
2120
|
y: (o + n) / 2
|
|
2116
|
-
}, c = (s - t) / 2, g = (n - o) / 2, { width: l, height: u } = this.viewportStore.getDimensions(), p = l / 2,
|
|
2121
|
+
}, c = (s - t) / 2, g = (n - o) / 2, { width: l, height: u } = this.viewportStore.getDimensions(), p = l / 2, y = u / 2, v = Math.max(
|
|
2117
2122
|
c / p,
|
|
2118
|
-
g /
|
|
2123
|
+
g / y
|
|
2119
2124
|
), { scale: x } = this.viewportStore.getContentMatrix(), b = v > 1 ? x / v : x, P = Math.max(b, e.minContentScale);
|
|
2120
2125
|
this.center(d, { contentScale: P });
|
|
2121
2126
|
}
|
|
@@ -2176,7 +2181,7 @@ class H {
|
|
|
2176
2181
|
}));
|
|
2177
2182
|
});
|
|
2178
2183
|
i(this, "onWindowMouseMove", (e) => {
|
|
2179
|
-
if (!
|
|
2184
|
+
if (!D(
|
|
2180
2185
|
this.window,
|
|
2181
2186
|
this.element,
|
|
2182
2187
|
e.clientX,
|
|
@@ -2208,7 +2213,7 @@ class H {
|
|
|
2208
2213
|
});
|
|
2209
2214
|
i(this, "onWindowTouchMove", (e) => {
|
|
2210
2215
|
const t = e.touches[0];
|
|
2211
|
-
if (!
|
|
2216
|
+
if (!D(
|
|
2212
2217
|
this.window,
|
|
2213
2218
|
this.element,
|
|
2214
2219
|
t.clientX,
|
|
@@ -2223,16 +2228,16 @@ class H {
|
|
|
2223
2228
|
const t = e.changedTouches[0];
|
|
2224
2229
|
this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
|
|
2225
2230
|
});
|
|
2226
|
-
i(this, "
|
|
2231
|
+
i(this, "reset", () => {
|
|
2227
2232
|
this.canvas.graph.getAllPortIds().forEach((e) => {
|
|
2228
2233
|
const t = this.canvas.graph.getPort(e);
|
|
2229
2234
|
this.unhookPortEvents(t.element);
|
|
2230
2235
|
});
|
|
2231
2236
|
});
|
|
2232
|
-
i(this, "
|
|
2233
|
-
this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
2237
|
+
i(this, "revert", () => {
|
|
2238
|
+
this.params.onStopDrag(), this.reset(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
2234
2239
|
});
|
|
2235
|
-
this.canvas = e, this.element = t, this.window = s, this.params = o, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.
|
|
2240
|
+
this.canvas = e, this.element = t, this.window = s, this.params = o, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
2236
2241
|
}
|
|
2237
2242
|
static configure(e, t, s, o) {
|
|
2238
2243
|
new H(e, t, s, o);
|
|
@@ -2260,7 +2265,7 @@ class H {
|
|
|
2260
2265
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2261
2266
|
}
|
|
2262
2267
|
}
|
|
2263
|
-
class
|
|
2268
|
+
class Lt {
|
|
2264
2269
|
constructor(e, t, s) {
|
|
2265
2270
|
this.canvas = e, this.layoutAlgorithm = t, this.params = s;
|
|
2266
2271
|
}
|
|
@@ -2274,7 +2279,7 @@ class Rt {
|
|
|
2274
2279
|
}), this.params.onAfterApplied();
|
|
2275
2280
|
}
|
|
2276
2281
|
}
|
|
2277
|
-
class
|
|
2282
|
+
class Vt {
|
|
2278
2283
|
constructor(e, t, s) {
|
|
2279
2284
|
this.canvas = e, this.layoutAlgorithm = t, this.params = s;
|
|
2280
2285
|
}
|
|
@@ -2310,15 +2315,6 @@ class ee {
|
|
|
2310
2315
|
const { element: t } = this.graph.getNode(e);
|
|
2311
2316
|
t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
|
|
2312
2317
|
});
|
|
2313
|
-
i(this, "onBeforeDestroy", () => {
|
|
2314
|
-
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2315
|
-
});
|
|
2316
|
-
i(this, "onBeforeClear", () => {
|
|
2317
|
-
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
2318
|
-
const { element: t } = this.canvas.graph.getNode(e);
|
|
2319
|
-
t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
|
|
2320
|
-
}), this.maxNodePriority = 0;
|
|
2321
|
-
});
|
|
2322
2318
|
i(this, "onMouseDown", (e) => {
|
|
2323
2319
|
const t = e;
|
|
2324
2320
|
if (!this.params.mouseDownEventVerifier(t))
|
|
@@ -2371,7 +2367,7 @@ class ee {
|
|
|
2371
2367
|
});
|
|
2372
2368
|
});
|
|
2373
2369
|
i(this, "onWindowMouseMove", (e) => {
|
|
2374
|
-
if (!
|
|
2370
|
+
if (!D(
|
|
2375
2371
|
this.window,
|
|
2376
2372
|
this.element,
|
|
2377
2373
|
e.clientX,
|
|
@@ -2392,7 +2388,7 @@ class ee {
|
|
|
2392
2388
|
if (e.touches.length !== 1)
|
|
2393
2389
|
return;
|
|
2394
2390
|
const t = e.touches[0];
|
|
2395
|
-
if (!
|
|
2391
|
+
if (!D(
|
|
2396
2392
|
this.window,
|
|
2397
2393
|
this.element,
|
|
2398
2394
|
t.clientX,
|
|
@@ -2409,7 +2405,16 @@ class ee {
|
|
|
2409
2405
|
i(this, "onWindowTouchFinish", () => {
|
|
2410
2406
|
this.cancelTouchDrag();
|
|
2411
2407
|
});
|
|
2412
|
-
|
|
2408
|
+
i(this, "reset", () => {
|
|
2409
|
+
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
2410
|
+
const { element: t } = this.canvas.graph.getNode(e);
|
|
2411
|
+
t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
|
|
2412
|
+
}), this.maxNodePriority = 0;
|
|
2413
|
+
});
|
|
2414
|
+
i(this, "revert", () => {
|
|
2415
|
+
this.reset(), this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2416
|
+
});
|
|
2417
|
+
this.canvas = e, this.element = t, this.window = s, this.params = o, this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
2413
2418
|
}
|
|
2414
2419
|
static configure(e, t, s, o) {
|
|
2415
2420
|
new ee(e, t, s, o);
|
|
@@ -2506,7 +2511,7 @@ class Y {
|
|
|
2506
2511
|
i(this, "prevTouches", null);
|
|
2507
2512
|
i(this, "wheelFinishTimer", null);
|
|
2508
2513
|
i(this, "transformInProgress", !1);
|
|
2509
|
-
i(this, "
|
|
2514
|
+
i(this, "revert", () => {
|
|
2510
2515
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2511
2516
|
});
|
|
2512
2517
|
i(this, "onMouseDown", (e) => {
|
|
@@ -2517,7 +2522,7 @@ class Y {
|
|
|
2517
2522
|
}), this.startRegisteredTransform());
|
|
2518
2523
|
});
|
|
2519
2524
|
i(this, "onWindowMouseMove", (e) => {
|
|
2520
|
-
const t =
|
|
2525
|
+
const t = D(
|
|
2521
2526
|
this.window,
|
|
2522
2527
|
this.element,
|
|
2523
2528
|
e.clientX,
|
|
@@ -2557,7 +2562,7 @@ class Y {
|
|
|
2557
2562
|
i(this, "onWindowTouchMove", (e) => {
|
|
2558
2563
|
const t = B(e);
|
|
2559
2564
|
if (!t.touches.every(
|
|
2560
|
-
(o) =>
|
|
2565
|
+
(o) => D(this.window, this.element, o[0], o[1])
|
|
2561
2566
|
)) {
|
|
2562
2567
|
this.stopTouchDrag();
|
|
2563
2568
|
return;
|
|
@@ -2587,7 +2592,7 @@ class Y {
|
|
|
2587
2592
|
passive: !0
|
|
2588
2593
|
}), this.element.addEventListener("touchstart", this.onTouchStart, {
|
|
2589
2594
|
passive: !0
|
|
2590
|
-
}), e.onBeforeDestroy.subscribe(this.
|
|
2595
|
+
}), e.onBeforeDestroy.subscribe(this.revert);
|
|
2591
2596
|
}
|
|
2592
2597
|
static configure(e, t, s, o) {
|
|
2593
2598
|
new Y(e, t, s, o);
|
|
@@ -2726,13 +2731,13 @@ class te {
|
|
|
2726
2731
|
});
|
|
2727
2732
|
}
|
|
2728
2733
|
}
|
|
2729
|
-
const
|
|
2734
|
+
const Ft = () => {
|
|
2730
2735
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2731
2736
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2732
|
-
},
|
|
2737
|
+
}, It = () => {
|
|
2733
2738
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2734
2739
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2735
|
-
},
|
|
2740
|
+
}, Bt = () => {
|
|
2736
2741
|
const r = document.createElementNS(
|
|
2737
2742
|
"http://www.w3.org/2000/svg",
|
|
2738
2743
|
"pattern"
|
|
@@ -2741,9 +2746,9 @@ const Vt = () => {
|
|
|
2741
2746
|
};
|
|
2742
2747
|
class re {
|
|
2743
2748
|
constructor(e, t, s) {
|
|
2744
|
-
i(this, "svg",
|
|
2745
|
-
i(this, "patternRenderingRectangle",
|
|
2746
|
-
i(this, "pattern",
|
|
2749
|
+
i(this, "svg", Ft());
|
|
2750
|
+
i(this, "patternRenderingRectangle", It());
|
|
2751
|
+
i(this, "pattern", Bt());
|
|
2747
2752
|
i(this, "patternContent");
|
|
2748
2753
|
i(this, "tileWidth");
|
|
2749
2754
|
i(this, "tileHeight");
|
|
@@ -2839,10 +2844,10 @@ class se {
|
|
|
2839
2844
|
portDirection: this.params.dragPortDirection
|
|
2840
2845
|
};
|
|
2841
2846
|
this.isTargetDragging = s === "direct";
|
|
2842
|
-
const [p,
|
|
2843
|
-
this.overlayCanvas.addNode(O(p)), this.overlayCanvas.addNode(O(
|
|
2847
|
+
const [p, y] = this.isTargetDragging ? [l, u] : [u, l];
|
|
2848
|
+
this.overlayCanvas.addNode(O(p)), this.overlayCanvas.addNode(O(y)), this.overlayCanvas.addEdge({
|
|
2844
2849
|
from: p.overlayNodeId,
|
|
2845
|
-
to:
|
|
2850
|
+
to: y.overlayNodeId,
|
|
2846
2851
|
shape: this.params.edgeShapeFactory(N.EdgeId)
|
|
2847
2852
|
});
|
|
2848
2853
|
}
|
|
@@ -2925,7 +2930,7 @@ class oe {
|
|
|
2925
2930
|
}, u = this.overlayLayer.getBoundingClientRect(), p = this.canvas.viewport.createContentCoords({
|
|
2926
2931
|
x: l.x - u.x,
|
|
2927
2932
|
y: l.y - u.y
|
|
2928
|
-
}),
|
|
2933
|
+
}), y = this.canvas.viewport.createContentCoords({
|
|
2929
2934
|
x: t.x - u.x,
|
|
2930
2935
|
y: t.y - u.y
|
|
2931
2936
|
});
|
|
@@ -2942,7 +2947,7 @@ class oe {
|
|
|
2942
2947
|
portDirection: c.direction
|
|
2943
2948
|
}, x = {
|
|
2944
2949
|
overlayNodeId: N.DraggingNodeId,
|
|
2945
|
-
portCoords:
|
|
2950
|
+
portCoords: y,
|
|
2946
2951
|
portDirection: d.direction
|
|
2947
2952
|
}, [b, P] = this.isTargetDragging ? [v, x] : [x, v];
|
|
2948
2953
|
this.overlayCanvas.addNode(O(b)), this.overlayCanvas.addNode(O(P));
|
|
@@ -3038,9 +3043,9 @@ class ne {
|
|
|
3038
3043
|
this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
|
|
3039
3044
|
}
|
|
3040
3045
|
}
|
|
3041
|
-
class
|
|
3046
|
+
class $t {
|
|
3042
3047
|
static configure(e, t) {
|
|
3043
|
-
const s = t.applyOn, o = new
|
|
3048
|
+
const s = t.applyOn, o = new Lt(e, t.algorithm, {
|
|
3044
3049
|
staticNodeResolver: t.staticNodeResolver,
|
|
3045
3050
|
onBeforeApplied: t.onBeforeApplied,
|
|
3046
3051
|
onAfterApplied: t.onAfterApplied
|
|
@@ -3064,7 +3069,7 @@ class Bt {
|
|
|
3064
3069
|
}
|
|
3065
3070
|
}
|
|
3066
3071
|
}
|
|
3067
|
-
class
|
|
3072
|
+
class Ut {
|
|
3068
3073
|
constructor(e, t) {
|
|
3069
3074
|
i(this, "previousTimeStamp");
|
|
3070
3075
|
i(this, "step", (e) => {
|
|
@@ -3085,17 +3090,17 @@ class ae {
|
|
|
3085
3090
|
i(this, "step", (e) => {
|
|
3086
3091
|
this.applier.apply(e);
|
|
3087
3092
|
});
|
|
3088
|
-
this.win = s, this.applier = new
|
|
3093
|
+
this.win = s, this.applier = new Vt(e, t.algorithm, {
|
|
3089
3094
|
staticNodeResolver: t.staticNodeResolver,
|
|
3090
3095
|
onBeforeApplied: t.onBeforeApplied,
|
|
3091
3096
|
onAfterApplied: t.onAfterApplied
|
|
3092
|
-
}), new
|
|
3097
|
+
}), new Ut(this.win, this.step);
|
|
3093
3098
|
}
|
|
3094
3099
|
static configure(e, t, s) {
|
|
3095
3100
|
new ae(e, t, s);
|
|
3096
3101
|
}
|
|
3097
3102
|
}
|
|
3098
|
-
const
|
|
3103
|
+
const Ot = () => {
|
|
3099
3104
|
const r = document.createElement("div");
|
|
3100
3105
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3101
3106
|
}, j = () => {
|
|
@@ -3105,23 +3110,23 @@ const Ut = () => {
|
|
|
3105
3110
|
const r = j();
|
|
3106
3111
|
return r.style.pointerEvents = "none", r;
|
|
3107
3112
|
};
|
|
3108
|
-
class
|
|
3113
|
+
class Wt {
|
|
3109
3114
|
constructor(e) {
|
|
3110
3115
|
i(this, "background", j());
|
|
3111
3116
|
i(this, "main", j());
|
|
3112
3117
|
i(this, "overlayConnectablePorts", me());
|
|
3113
3118
|
i(this, "overlayDraggableEdges", me());
|
|
3114
|
-
i(this, "host",
|
|
3119
|
+
i(this, "host", Ot());
|
|
3115
3120
|
this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
|
|
3116
3121
|
}
|
|
3117
3122
|
destroy() {
|
|
3118
3123
|
this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
|
|
3119
3124
|
}
|
|
3120
3125
|
}
|
|
3121
|
-
const
|
|
3122
|
-
var p,
|
|
3126
|
+
const zt = (r) => {
|
|
3127
|
+
var p, y, v, x, b, P;
|
|
3123
3128
|
const e = ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? (() => {
|
|
3124
|
-
}), t = ((
|
|
3129
|
+
}), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
|
|
3125
3130
|
}), s = r.nodeDragVerifier ?? (() => !0), o = ((v = r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
|
|
3126
3131
|
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (x = r.mouse) == null ? void 0 : x.dragCursor, d = h !== void 0 ? h : "grab", c = (b = r.mouse) == null ? void 0 : b.mouseDownEventVerifier, g = c !== void 0 ? c : (C) => C.button === 0, l = (P = r.mouse) == null ? void 0 : P.mouseUpEventVerifier, u = l !== void 0 ? l : (C) => C.button === 0;
|
|
3127
3132
|
return {
|
|
@@ -3136,7 +3141,7 @@ const Wt = (r) => {
|
|
|
3136
3141
|
nodeDragVerifier: s,
|
|
3137
3142
|
onNodeDragFinished: o
|
|
3138
3143
|
};
|
|
3139
|
-
},
|
|
3144
|
+
}, kt = (r) => {
|
|
3140
3145
|
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, o = r.maxY !== null ? r.maxY : 1 / 0;
|
|
3141
3146
|
return (n) => {
|
|
3142
3147
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
@@ -3146,7 +3151,7 @@ const Wt = (r) => {
|
|
|
3146
3151
|
const g = n.canvasHeight * n.prevTransform.scale, l = o - g;
|
|
3147
3152
|
return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3148
3153
|
};
|
|
3149
|
-
},
|
|
3154
|
+
}, Ht = (r) => {
|
|
3150
3155
|
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, o = t !== null ? 1 / t : 1 / 0;
|
|
3151
3156
|
return (n) => {
|
|
3152
3157
|
const a = n.prevTransform, h = n.nextTransform;
|
|
@@ -3167,7 +3172,7 @@ const Wt = (r) => {
|
|
|
3167
3172
|
y: g
|
|
3168
3173
|
};
|
|
3169
3174
|
};
|
|
3170
|
-
},
|
|
3175
|
+
}, Yt = (r) => (e) => r.reduce(
|
|
3171
3176
|
(t, s) => s({
|
|
3172
3177
|
prevTransform: e.prevTransform,
|
|
3173
3178
|
nextTransform: t,
|
|
@@ -3180,12 +3185,12 @@ const Wt = (r) => {
|
|
|
3180
3185
|
return r;
|
|
3181
3186
|
switch (r.type) {
|
|
3182
3187
|
case "scale-limit":
|
|
3183
|
-
return
|
|
3188
|
+
return Ht({
|
|
3184
3189
|
minContentScale: r.minContentScale ?? 0,
|
|
3185
3190
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3186
3191
|
});
|
|
3187
3192
|
case "shift-limit":
|
|
3188
|
-
return
|
|
3193
|
+
return kt({
|
|
3189
3194
|
minX: r.minX ?? -1 / 0,
|
|
3190
3195
|
maxX: r.maxX ?? 1 / 0,
|
|
3191
3196
|
minY: r.minY ?? -1 / 0,
|
|
@@ -3193,10 +3198,10 @@ const Wt = (r) => {
|
|
|
3193
3198
|
});
|
|
3194
3199
|
}
|
|
3195
3200
|
}, Ae = (r) => {
|
|
3196
|
-
var
|
|
3197
|
-
const e = (
|
|
3201
|
+
var y, v, x, b, P, C, L, V, de, ce, le, ge;
|
|
3202
|
+
const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
3198
3203
|
let o;
|
|
3199
|
-
s !== void 0 ? Array.isArray(s) ? o =
|
|
3204
|
+
s !== void 0 ? Array.isArray(s) ? o = Yt(
|
|
3200
3205
|
s.map(
|
|
3201
3206
|
(T) => ve(T)
|
|
3202
3207
|
)
|
|
@@ -3223,17 +3228,17 @@ const Wt = (r) => {
|
|
|
3223
3228
|
onResizeTransformFinished: ((ge = r == null ? void 0 : r.events) == null ? void 0 : ge.onResizeTransformFinished) ?? (() => {
|
|
3224
3229
|
})
|
|
3225
3230
|
};
|
|
3226
|
-
},
|
|
3231
|
+
}, Xt = (r, e) => {
|
|
3227
3232
|
const t = document.createElementNS(
|
|
3228
3233
|
"http://www.w3.org/2000/svg",
|
|
3229
3234
|
"circle"
|
|
3230
3235
|
);
|
|
3231
3236
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3232
|
-
},
|
|
3237
|
+
}, Gt = (r) => r instanceof SVGElement ? r : Xt(
|
|
3233
3238
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3234
3239
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3235
|
-
),
|
|
3236
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o =
|
|
3240
|
+
), jt = (r) => {
|
|
3241
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o = Gt(r.renderer ?? {});
|
|
3237
3242
|
return {
|
|
3238
3243
|
tileWidth: t,
|
|
3239
3244
|
tileHeight: s,
|
|
@@ -3245,7 +3250,7 @@ const Wt = (r) => {
|
|
|
3245
3250
|
return r;
|
|
3246
3251
|
switch (r.type) {
|
|
3247
3252
|
case "straight":
|
|
3248
|
-
return () => new
|
|
3253
|
+
return () => new bt({
|
|
3249
3254
|
color: r.color,
|
|
3250
3255
|
width: r.width,
|
|
3251
3256
|
arrowLength: r.arrowLength,
|
|
@@ -3259,7 +3264,7 @@ const Wt = (r) => {
|
|
|
3259
3264
|
detourDirection: r.detourDirection
|
|
3260
3265
|
});
|
|
3261
3266
|
case "horizontal":
|
|
3262
|
-
return () => new
|
|
3267
|
+
return () => new St({
|
|
3263
3268
|
color: r.color,
|
|
3264
3269
|
width: r.width,
|
|
3265
3270
|
arrowLength: r.arrowLength,
|
|
@@ -3272,7 +3277,7 @@ const Wt = (r) => {
|
|
|
3272
3277
|
detourDistance: r.detourDistance
|
|
3273
3278
|
});
|
|
3274
3279
|
case "vertical":
|
|
3275
|
-
return () => new
|
|
3280
|
+
return () => new Pt({
|
|
3276
3281
|
color: r.color,
|
|
3277
3282
|
width: r.width,
|
|
3278
3283
|
arrowLength: r.arrowLength,
|
|
@@ -3296,7 +3301,7 @@ const Wt = (r) => {
|
|
|
3296
3301
|
targetOffset: r.targetOffset
|
|
3297
3302
|
});
|
|
3298
3303
|
default:
|
|
3299
|
-
return () => new
|
|
3304
|
+
return () => new Et({
|
|
3300
3305
|
color: r.color,
|
|
3301
3306
|
width: r.width,
|
|
3302
3307
|
arrowLength: r.arrowLength,
|
|
@@ -3310,7 +3315,7 @@ const Wt = (r) => {
|
|
|
3310
3315
|
detourDirection: r.detourDirection
|
|
3311
3316
|
});
|
|
3312
3317
|
}
|
|
3313
|
-
},
|
|
3318
|
+
}, qt = (r, e, t) => {
|
|
3314
3319
|
var c, g, l;
|
|
3315
3320
|
const s = () => "direct", o = (u) => u, n = (u) => u.button === 0, a = () => {
|
|
3316
3321
|
}, h = () => {
|
|
@@ -3327,7 +3332,7 @@ const Wt = (r) => {
|
|
|
3327
3332
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3328
3333
|
edgeShapeFactory: r.edgeShape !== void 0 ? he(r.edgeShape) : e
|
|
3329
3334
|
};
|
|
3330
|
-
},
|
|
3335
|
+
}, Kt = (r, e) => {
|
|
3331
3336
|
var c, g, l;
|
|
3332
3337
|
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
|
|
3333
3338
|
const p = e.getPortAdjacentEdgeIds(u);
|
|
@@ -3346,10 +3351,10 @@ const Wt = (r) => {
|
|
|
3346
3351
|
onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
|
|
3347
3352
|
onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
|
|
3348
3353
|
};
|
|
3349
|
-
},
|
|
3354
|
+
}, Qt = (r) => ({
|
|
3350
3355
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3351
3356
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3352
|
-
}),
|
|
3357
|
+
}), Zt = (r) => {
|
|
3353
3358
|
var e, t;
|
|
3354
3359
|
return {
|
|
3355
3360
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3358,7 +3363,7 @@ const Wt = (r) => {
|
|
|
3358
3363
|
})
|
|
3359
3364
|
};
|
|
3360
3365
|
};
|
|
3361
|
-
class
|
|
3366
|
+
class Jt extends Error {
|
|
3362
3367
|
constructor() {
|
|
3363
3368
|
super(...arguments);
|
|
3364
3369
|
i(this, "name", "CanvasBuilderError");
|
|
@@ -3397,8 +3402,8 @@ class ke {
|
|
|
3397
3402
|
const s = this.graph.getEdge(t), o = this.graph.getPort(s.from), n = this.graph.getPort(s.to), a = this.currentCoords.get(o.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
|
|
3398
3403
|
a,
|
|
3399
3404
|
h
|
|
3400
|
-
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, p = e.get(o.nodeId),
|
|
3401
|
-
p.x += l, p.y += u,
|
|
3405
|
+
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, p = e.get(o.nodeId), y = e.get(n.nodeId);
|
|
3406
|
+
p.x += l, p.y += u, y.x -= l, y.y -= u;
|
|
3402
3407
|
});
|
|
3403
3408
|
}
|
|
3404
3409
|
}
|
|
@@ -3427,7 +3432,7 @@ const Ye = (r) => {
|
|
|
3427
3432
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
3428
3433
|
return Math.min(e, r.maxForce);
|
|
3429
3434
|
};
|
|
3430
|
-
class
|
|
3435
|
+
class _t {
|
|
3431
3436
|
constructor(e) {
|
|
3432
3437
|
i(this, "nodeCharge");
|
|
3433
3438
|
i(this, "distanceVectorGenerator");
|
|
@@ -3448,13 +3453,13 @@ class Jt {
|
|
|
3448
3453
|
targetCharge: this.nodeCharge,
|
|
3449
3454
|
distance: l.d,
|
|
3450
3455
|
maxForce: this.maxForce
|
|
3451
|
-
}), p = u * l.ex,
|
|
3452
|
-
v.x -= p, v.y -=
|
|
3456
|
+
}), p = u * l.ex, y = u * l.ey, v = t.get(a), x = t.get(d);
|
|
3457
|
+
v.x -= p, v.y -= y, x.x += p, x.y += y;
|
|
3453
3458
|
}
|
|
3454
3459
|
}
|
|
3455
3460
|
}
|
|
3456
3461
|
}
|
|
3457
|
-
const
|
|
3462
|
+
const er = (r) => {
|
|
3458
3463
|
if (r.size === 0)
|
|
3459
3464
|
return {
|
|
3460
3465
|
centerX: 0,
|
|
@@ -3472,7 +3477,7 @@ const _t = (r) => {
|
|
|
3472
3477
|
radius: h / 2
|
|
3473
3478
|
};
|
|
3474
3479
|
};
|
|
3475
|
-
class
|
|
3480
|
+
class tr {
|
|
3476
3481
|
constructor(e) {
|
|
3477
3482
|
i(this, "root");
|
|
3478
3483
|
i(this, "leaves", /* @__PURE__ */ new Map());
|
|
@@ -3527,8 +3532,8 @@ class er {
|
|
|
3527
3532
|
this.sortedParentNodes.push(e);
|
|
3528
3533
|
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = o / 2;
|
|
3529
3534
|
e.nodeIds.forEach((u) => {
|
|
3530
|
-
const { x: p, y
|
|
3531
|
-
p < t ?
|
|
3535
|
+
const { x: p, y } = this.coords.get(u);
|
|
3536
|
+
p < t ? y < s ? d.add(u) : h.add(u) : y < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
|
|
3532
3537
|
});
|
|
3533
3538
|
const g = {
|
|
3534
3539
|
parent: e,
|
|
@@ -3629,7 +3634,7 @@ class er {
|
|
|
3629
3634
|
}), { x: t / e.size, y: s / e.size };
|
|
3630
3635
|
}
|
|
3631
3636
|
}
|
|
3632
|
-
class
|
|
3637
|
+
class rr {
|
|
3633
3638
|
constructor(e) {
|
|
3634
3639
|
i(this, "areaRadiusThreshold");
|
|
3635
3640
|
i(this, "nodeMass");
|
|
@@ -3641,7 +3646,7 @@ class tr {
|
|
|
3641
3646
|
this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
|
|
3642
3647
|
}
|
|
3643
3648
|
apply(e, t) {
|
|
3644
|
-
const s =
|
|
3649
|
+
const s = er(e), o = new tr({
|
|
3645
3650
|
box: s,
|
|
3646
3651
|
coords: e,
|
|
3647
3652
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
@@ -3791,7 +3796,7 @@ class tr {
|
|
|
3791
3796
|
}
|
|
3792
3797
|
}
|
|
3793
3798
|
}
|
|
3794
|
-
const Xe = (r) => r.theta !== 0 ? new
|
|
3799
|
+
const Xe = (r) => r.theta !== 0 ? new rr({
|
|
3795
3800
|
nodeCharge: r.nodeCharge,
|
|
3796
3801
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3797
3802
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -3799,7 +3804,7 @@ const Xe = (r) => r.theta !== 0 ? new tr({
|
|
|
3799
3804
|
theta: r.theta,
|
|
3800
3805
|
nodeMass: r.nodeMass,
|
|
3801
3806
|
areaRadiusThreshold: r.areaRadiusThreshold
|
|
3802
|
-
}) : new
|
|
3807
|
+
}) : new _t({
|
|
3803
3808
|
nodeCharge: r.nodeCharge,
|
|
3804
3809
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3805
3810
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -3812,23 +3817,23 @@ class Ge {
|
|
|
3812
3817
|
this.rand = e.rand, this.sparsity = e.sparsity;
|
|
3813
3818
|
}
|
|
3814
3819
|
calculateCoordinates(e) {
|
|
3815
|
-
const { graph: t, viewport: s } = e, o = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((
|
|
3816
|
-
const v = t.getNode(
|
|
3820
|
+
const { graph: t, viewport: s } = e, o = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((y) => {
|
|
3821
|
+
const v = t.getNode(y);
|
|
3817
3822
|
return v.x === null || v.y === null;
|
|
3818
3823
|
}), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = s.getDimensions(), c = { x: h / 2, y: d / 2 }, g = s.createContentCoords(c), l = a / 2, u = {
|
|
3819
3824
|
x: g.x - l,
|
|
3820
3825
|
y: g.y - l
|
|
3821
3826
|
};
|
|
3822
|
-
return t.getAllNodeIds().forEach((
|
|
3823
|
-
const v = t.getNode(
|
|
3824
|
-
o.set(
|
|
3827
|
+
return t.getAllNodeIds().forEach((y) => {
|
|
3828
|
+
const v = t.getNode(y);
|
|
3829
|
+
o.set(y, {
|
|
3825
3830
|
x: v.x ?? u.x + a * this.rand(),
|
|
3826
3831
|
y: v.y ?? u.y + a * this.rand()
|
|
3827
3832
|
});
|
|
3828
3833
|
}), o;
|
|
3829
3834
|
}
|
|
3830
3835
|
}
|
|
3831
|
-
class
|
|
3836
|
+
class sr {
|
|
3832
3837
|
constructor(e) {
|
|
3833
3838
|
i(this, "distanceVectorGenerator");
|
|
3834
3839
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -3873,7 +3878,7 @@ class rr {
|
|
|
3873
3878
|
return o;
|
|
3874
3879
|
}
|
|
3875
3880
|
}
|
|
3876
|
-
class
|
|
3881
|
+
class or {
|
|
3877
3882
|
constructor(e) {
|
|
3878
3883
|
i(this, "forest", /* @__PURE__ */ new Set());
|
|
3879
3884
|
i(this, "remainingNodeIds");
|
|
@@ -3916,7 +3921,7 @@ class sr {
|
|
|
3916
3921
|
}
|
|
3917
3922
|
}
|
|
3918
3923
|
}
|
|
3919
|
-
class
|
|
3924
|
+
class ir {
|
|
3920
3925
|
constructor(e) {
|
|
3921
3926
|
i(this, "baseRadius");
|
|
3922
3927
|
this.baseRadius = e.radius;
|
|
@@ -3944,12 +3949,12 @@ class or {
|
|
|
3944
3949
|
};
|
|
3945
3950
|
}
|
|
3946
3951
|
}
|
|
3947
|
-
class
|
|
3952
|
+
class nr {
|
|
3948
3953
|
constructor(e, t) {
|
|
3949
3954
|
i(this, "offsets", /* @__PURE__ */ new Map());
|
|
3950
3955
|
i(this, "childrenRadii", /* @__PURE__ */ new Map());
|
|
3951
3956
|
i(this, "layerNodePlacementResolver");
|
|
3952
|
-
this.tree = e, this.layerNodePlacementResolver = new
|
|
3957
|
+
this.tree = e, this.layerNodePlacementResolver = new ir({
|
|
3953
3958
|
radius: t.spaceAroundRadius
|
|
3954
3959
|
}), [...this.tree.sequence].reverse().forEach((s) => {
|
|
3955
3960
|
if (s.children.size === 0)
|
|
@@ -3970,16 +3975,16 @@ class ir {
|
|
|
3970
3975
|
return this.offsets;
|
|
3971
3976
|
}
|
|
3972
3977
|
}
|
|
3973
|
-
class
|
|
3978
|
+
class ar {
|
|
3974
3979
|
constructor(e) {
|
|
3975
3980
|
this.params = e;
|
|
3976
3981
|
}
|
|
3977
3982
|
calculateCoordinates(e) {
|
|
3978
|
-
const t = /* @__PURE__ */ new Map(), o = new
|
|
3983
|
+
const t = /* @__PURE__ */ new Map(), o = new or(e.graph).generate();
|
|
3979
3984
|
let n = 0;
|
|
3980
3985
|
return o.forEach((a) => {
|
|
3981
3986
|
t.set(a.root.nodeId, { x: n, y: 0 });
|
|
3982
|
-
const d = new
|
|
3987
|
+
const d = new nr(a, {
|
|
3983
3988
|
spaceAroundRadius: this.params.layerSpace / 2
|
|
3984
3989
|
}).generate();
|
|
3985
3990
|
let c = [a.root];
|
|
@@ -4001,7 +4006,7 @@ class nr {
|
|
|
4001
4006
|
}), t;
|
|
4002
4007
|
}
|
|
4003
4008
|
}
|
|
4004
|
-
class
|
|
4009
|
+
class hr {
|
|
4005
4010
|
constructor(e) {
|
|
4006
4011
|
i(this, "distanceVectorGenerator");
|
|
4007
4012
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4069,14 +4074,14 @@ const je = (r) => {
|
|
|
4069
4074
|
nodeForceCoefficient: 1,
|
|
4070
4075
|
barnesHutAreaRadiusThreshold: 0.01,
|
|
4071
4076
|
barnesHutTheta: 1
|
|
4072
|
-
}),
|
|
4077
|
+
}), dr = (r) => {
|
|
4073
4078
|
var e, t;
|
|
4074
4079
|
switch (r == null ? void 0 : r.type) {
|
|
4075
4080
|
case "custom":
|
|
4076
4081
|
return r.instance;
|
|
4077
4082
|
default: {
|
|
4078
4083
|
const s = je((r == null ? void 0 : r.seed) ?? A.seed), o = qe(s[0], s[1], s[2], s[3]);
|
|
4079
|
-
return new
|
|
4084
|
+
return new hr({
|
|
4080
4085
|
rand: o,
|
|
4081
4086
|
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? A.maxTimeDeltaSec,
|
|
4082
4087
|
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
|
|
@@ -4097,23 +4102,23 @@ const je = (r) => {
|
|
|
4097
4102
|
},
|
|
4098
4103
|
onAfterApplied: () => {
|
|
4099
4104
|
}
|
|
4100
|
-
},
|
|
4105
|
+
}, cr = (r) => {
|
|
4101
4106
|
var t, s;
|
|
4102
4107
|
return {
|
|
4103
|
-
algorithm:
|
|
4108
|
+
algorithm: dr((r == null ? void 0 : r.algorithm) ?? {}),
|
|
4104
4109
|
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? G.staticNodeResolver,
|
|
4105
4110
|
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? G.onBeforeApplied,
|
|
4106
4111
|
onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ?? G.onAfterApplied
|
|
4107
4112
|
};
|
|
4108
|
-
},
|
|
4113
|
+
}, lr = (r) => r instanceof K ? {
|
|
4109
4114
|
type: "trigger",
|
|
4110
4115
|
trigger: r
|
|
4111
4116
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
4112
4117
|
type: "topologyChangeSchedule",
|
|
4113
|
-
schedule:
|
|
4118
|
+
schedule: Mt
|
|
4114
4119
|
} : {
|
|
4115
4120
|
type: "topologyChangeSchedule",
|
|
4116
|
-
schedule:
|
|
4121
|
+
schedule: Rt
|
|
4117
4122
|
}, F = Object.freeze({
|
|
4118
4123
|
staticNodeResolver: () => !1,
|
|
4119
4124
|
onBeforeApplied: () => {
|
|
@@ -4131,7 +4136,7 @@ const je = (r) => {
|
|
|
4131
4136
|
d: r.d * e.a + r.e * e.d,
|
|
4132
4137
|
e: r.d * e.b + r.e * e.e,
|
|
4133
4138
|
f: r.d * e.c + r.e * e.f + r.f
|
|
4134
|
-
}),
|
|
4139
|
+
}), gr = (r) => {
|
|
4135
4140
|
const { a: e, b: t, c: s, d: o, e: n, f: a } = r, h = e * n - t * o;
|
|
4136
4141
|
return {
|
|
4137
4142
|
a: n / h,
|
|
@@ -4142,7 +4147,7 @@ const je = (r) => {
|
|
|
4142
4147
|
f: (s * o - e * a) / h
|
|
4143
4148
|
};
|
|
4144
4149
|
};
|
|
4145
|
-
class
|
|
4150
|
+
class ur {
|
|
4146
4151
|
resolve(e) {
|
|
4147
4152
|
if ("shift" in e)
|
|
4148
4153
|
return this.createShiftBaseMatrix(e.shift);
|
|
@@ -4186,7 +4191,7 @@ class gr {
|
|
|
4186
4191
|
const s = $(
|
|
4187
4192
|
t,
|
|
4188
4193
|
e
|
|
4189
|
-
), o =
|
|
4194
|
+
), o = gr(t);
|
|
4190
4195
|
return $(s, o);
|
|
4191
4196
|
}
|
|
4192
4197
|
createShiftBaseMatrix(e) {
|
|
@@ -4231,7 +4236,7 @@ class gr {
|
|
|
4231
4236
|
};
|
|
4232
4237
|
}
|
|
4233
4238
|
}
|
|
4234
|
-
const
|
|
4239
|
+
const pr = (r) => {
|
|
4235
4240
|
if (r === void 0)
|
|
4236
4241
|
return (o) => o;
|
|
4237
4242
|
if (typeof r == "function")
|
|
@@ -4245,7 +4250,7 @@ const ur = (r) => {
|
|
|
4245
4250
|
e: 1,
|
|
4246
4251
|
f: 0
|
|
4247
4252
|
};
|
|
4248
|
-
const s = new
|
|
4253
|
+
const s = new ur();
|
|
4249
4254
|
return e.forEach((o) => {
|
|
4250
4255
|
const n = s.resolve(o);
|
|
4251
4256
|
t = $(t, n);
|
|
@@ -4256,20 +4261,20 @@ const ur = (r) => {
|
|
|
4256
4261
|
y: t.d * n + t.e * a + t.f
|
|
4257
4262
|
};
|
|
4258
4263
|
};
|
|
4259
|
-
},
|
|
4264
|
+
}, wr = (r) => {
|
|
4260
4265
|
var e, t;
|
|
4261
4266
|
switch (r == null ? void 0 : r.type) {
|
|
4262
4267
|
case "custom":
|
|
4263
4268
|
return r.instance;
|
|
4264
4269
|
case "hierarchical":
|
|
4265
|
-
return new
|
|
4270
|
+
return new ar({
|
|
4266
4271
|
layerWidth: r.layerWidth ?? F.hierarchicalLayout.layerWidth,
|
|
4267
4272
|
layerSpace: r.layerSpace ?? F.hierarchicalLayout.layerSpace,
|
|
4268
|
-
transform:
|
|
4273
|
+
transform: pr(r.transform)
|
|
4269
4274
|
});
|
|
4270
4275
|
default: {
|
|
4271
4276
|
const s = je((r == null ? void 0 : r.seed) ?? A.seed), o = qe(s[0], s[1], s[2], s[3]);
|
|
4272
|
-
return new
|
|
4277
|
+
return new sr({
|
|
4273
4278
|
dtSec: (r == null ? void 0 : r.dtSec) ?? A.dtSec,
|
|
4274
4279
|
maxIterations: (r == null ? void 0 : r.maxIterations) ?? A.maxIterations,
|
|
4275
4280
|
rand: o,
|
|
@@ -4285,11 +4290,11 @@ const ur = (r) => {
|
|
|
4285
4290
|
});
|
|
4286
4291
|
}
|
|
4287
4292
|
}
|
|
4288
|
-
},
|
|
4293
|
+
}, yr = (r) => {
|
|
4289
4294
|
var e, t;
|
|
4290
4295
|
return {
|
|
4291
|
-
algorithm:
|
|
4292
|
-
applyOn:
|
|
4296
|
+
algorithm: wr(r.algorithm),
|
|
4297
|
+
applyOn: lr(r.applyOn),
|
|
4293
4298
|
staticNodeResolver: r.staticNodeResolver ?? F.staticNodeResolver,
|
|
4294
4299
|
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? F.onBeforeApplied,
|
|
4295
4300
|
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? F.onAfterApplied
|
|
@@ -4302,28 +4307,30 @@ const ur = (r) => {
|
|
|
4302
4307
|
onNodeDragFinished: (t) => {
|
|
4303
4308
|
e.delete(t), r.onNodeDragFinished(t);
|
|
4304
4309
|
}
|
|
4305
|
-
}),
|
|
4306
|
-
r.onBeforeNodeRemoved.subscribe((t) => {
|
|
4310
|
+
}), mr = (r, e) => {
|
|
4311
|
+
r.graph.onBeforeNodeRemoved.subscribe((t) => {
|
|
4307
4312
|
e.delete(t);
|
|
4308
|
-
}), r.onBeforeClear.subscribe(() => {
|
|
4313
|
+
}), r.graph.onBeforeClear.subscribe(() => {
|
|
4314
|
+
e.clear();
|
|
4315
|
+
}), r.onBeforeDestroy.subscribe(() => {
|
|
4309
4316
|
e.clear();
|
|
4310
4317
|
});
|
|
4311
|
-
},
|
|
4318
|
+
}, vr = (r, e) => ({
|
|
4312
4319
|
...r,
|
|
4313
4320
|
staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
|
|
4314
|
-
}), q = (r) => () => r, xe = q(0),
|
|
4321
|
+
}), q = (r) => () => r, xe = q(0), Ar = () => {
|
|
4315
4322
|
let r = 0;
|
|
4316
4323
|
return () => r++;
|
|
4317
|
-
},
|
|
4324
|
+
}, xr = (r, e) => {
|
|
4318
4325
|
let t = xe, s = xe;
|
|
4319
|
-
const o =
|
|
4326
|
+
const o = Ar();
|
|
4320
4327
|
return r === "incremental" && (t = o), e === "incremental" && (s = o), typeof r == "number" && (t = q(r)), typeof e == "number" && (s = q(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
4321
4328
|
nodesPriorityFn: t,
|
|
4322
4329
|
edgesPriorityFn: s
|
|
4323
4330
|
};
|
|
4324
|
-
},
|
|
4331
|
+
}, Er = (r) => {
|
|
4325
4332
|
var t, s, o, n, a;
|
|
4326
|
-
const e =
|
|
4333
|
+
const e = xr(
|
|
4327
4334
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
4328
4335
|
(s = r.edges) == null ? void 0 : s.priority
|
|
4329
4336
|
);
|
|
@@ -4340,9 +4347,9 @@ const ur = (r) => {
|
|
|
4340
4347
|
priorityFn: e.edgesPriorityFn
|
|
4341
4348
|
}
|
|
4342
4349
|
};
|
|
4343
|
-
},
|
|
4350
|
+
}, Sr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : _, br = (r) => {
|
|
4344
4351
|
var s, o;
|
|
4345
|
-
const { canvasDefaults: e } = r, t = r.hasLayout ?
|
|
4352
|
+
const { canvasDefaults: e } = r, t = r.hasLayout ? Sr(r.layoutParams) : _;
|
|
4346
4353
|
return {
|
|
4347
4354
|
focus: {
|
|
4348
4355
|
contentOffset: ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
|
|
@@ -4351,7 +4358,7 @@ const ur = (r) => {
|
|
|
4351
4358
|
}
|
|
4352
4359
|
};
|
|
4353
4360
|
};
|
|
4354
|
-
class
|
|
4361
|
+
class Nr {
|
|
4355
4362
|
constructor(e) {
|
|
4356
4363
|
i(this, "used", !1);
|
|
4357
4364
|
i(this, "canvasDefaults", {});
|
|
@@ -4378,7 +4385,7 @@ class Cr {
|
|
|
4378
4385
|
i(this, "viewport");
|
|
4379
4386
|
i(this, "window", window);
|
|
4380
4387
|
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
4381
|
-
this.element = e, this.viewportStore = new
|
|
4388
|
+
this.element = e, this.viewportStore = new it(this.element), this.viewport = new $e(this.viewportStore), this.graphStore = new be(), this.graph = new Ie(this.graphStore);
|
|
4382
4389
|
}
|
|
4383
4390
|
setDefaults(e) {
|
|
4384
4391
|
return this.canvasDefaults = e, this;
|
|
@@ -4412,15 +4419,15 @@ class Cr {
|
|
|
4412
4419
|
}
|
|
4413
4420
|
build() {
|
|
4414
4421
|
if (this.used)
|
|
4415
|
-
throw new
|
|
4422
|
+
throw new Jt("CanvasBuilder is a single use object");
|
|
4416
4423
|
this.used = !0;
|
|
4417
|
-
const e = new
|
|
4424
|
+
const e = new Wt(this.element), t = this.createHtmlView(e.main), s = Er(
|
|
4418
4425
|
this.canvasDefaults
|
|
4419
4426
|
), o = new Be(
|
|
4420
4427
|
this.graphStore,
|
|
4421
4428
|
t,
|
|
4422
4429
|
s
|
|
4423
|
-
), n =
|
|
4430
|
+
), n = yr(this.layoutConfig), a = br({
|
|
4424
4431
|
canvasDefaults: this.canvasDefaults,
|
|
4425
4432
|
hasLayout: this.hasLayout,
|
|
4426
4433
|
layoutParams: n
|
|
@@ -4436,10 +4443,10 @@ class Cr {
|
|
|
4436
4443
|
);
|
|
4437
4444
|
if (this.hasBackground && re.configure(
|
|
4438
4445
|
d,
|
|
4439
|
-
|
|
4446
|
+
jt(this.backgroundConfig),
|
|
4440
4447
|
e.background
|
|
4441
4448
|
), this.hasNodeResizeReactiveEdges && Q.configure(d), this.hasDraggableNodes) {
|
|
4442
|
-
let g =
|
|
4449
|
+
let g = zt(this.dragConfig);
|
|
4443
4450
|
this.hasAnimatedLayout && (g = fr(
|
|
4444
4451
|
g,
|
|
4445
4452
|
this.animationStaticNodes
|
|
@@ -4451,7 +4458,7 @@ class Cr {
|
|
|
4451
4458
|
);
|
|
4452
4459
|
}
|
|
4453
4460
|
if (this.hasUserConnectablePorts) {
|
|
4454
|
-
const g =
|
|
4461
|
+
const g = qt(
|
|
4455
4462
|
this.connectablePortsConfig,
|
|
4456
4463
|
s.edges.shapeFactory,
|
|
4457
4464
|
s.ports.direction
|
|
@@ -4465,7 +4472,7 @@ class Cr {
|
|
|
4465
4472
|
);
|
|
4466
4473
|
}
|
|
4467
4474
|
if (this.hasUserDraggableEdges) {
|
|
4468
|
-
const g =
|
|
4475
|
+
const g = Kt(
|
|
4469
4476
|
this.draggableEdgesConfig,
|
|
4470
4477
|
d.graph
|
|
4471
4478
|
);
|
|
@@ -4483,20 +4490,20 @@ class Cr {
|
|
|
4483
4490
|
this.window,
|
|
4484
4491
|
Ae(this.transformConfig),
|
|
4485
4492
|
this.boxRenderingTrigger,
|
|
4486
|
-
|
|
4493
|
+
Qt(this.virtualScrollConfig)
|
|
4487
4494
|
) : this.hasTransformableViewport && Y.configure(
|
|
4488
4495
|
d,
|
|
4489
4496
|
e.main,
|
|
4490
4497
|
this.window,
|
|
4491
4498
|
Ae(this.transformConfig)
|
|
4492
|
-
), this.hasLayout &&
|
|
4493
|
-
let g =
|
|
4499
|
+
), this.hasLayout && $t.configure(d, n), this.hasAnimatedLayout) {
|
|
4500
|
+
let g = cr(
|
|
4494
4501
|
this.animatedLayoutConfig
|
|
4495
4502
|
);
|
|
4496
|
-
this.hasDraggableNodes && (
|
|
4497
|
-
d
|
|
4503
|
+
this.hasDraggableNodes && (mr(
|
|
4504
|
+
d,
|
|
4498
4505
|
this.animationStaticNodes
|
|
4499
|
-
), g =
|
|
4506
|
+
), g = vr(
|
|
4500
4507
|
g,
|
|
4501
4508
|
this.animationStaticNodes
|
|
4502
4509
|
)), ae.configure(d, g, this.window);
|
|
@@ -4512,26 +4519,26 @@ class Cr {
|
|
|
4512
4519
|
this.viewportStore,
|
|
4513
4520
|
e
|
|
4514
4521
|
);
|
|
4515
|
-
return this.virtualScrollConfig !== void 0 && (t = new
|
|
4522
|
+
return this.virtualScrollConfig !== void 0 && (t = new rt(
|
|
4516
4523
|
t,
|
|
4517
4524
|
this.graphStore,
|
|
4518
4525
|
this.boxRenderingTrigger,
|
|
4519
|
-
|
|
4520
|
-
)), t = new
|
|
4526
|
+
Zt(this.virtualScrollConfig)
|
|
4527
|
+
)), t = new st(t, this.graphStore), t;
|
|
4521
4528
|
}
|
|
4522
4529
|
}
|
|
4523
4530
|
export {
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4531
|
+
Et as BezierEdgeShape,
|
|
4532
|
+
Nr as CanvasBuilder,
|
|
4533
|
+
Jt as CanvasBuilderError,
|
|
4527
4534
|
E as CanvasError,
|
|
4528
|
-
|
|
4535
|
+
R as ConnectionCategory,
|
|
4529
4536
|
Ve as DirectEdgeShape,
|
|
4530
4537
|
K as EventSubject,
|
|
4531
|
-
|
|
4532
|
-
|
|
4538
|
+
St as HorizontalEdgeShape,
|
|
4539
|
+
Tt as InteractiveEdgeError,
|
|
4533
4540
|
Fe as InteractiveEdgeShape,
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4541
|
+
Cr as MidpointEdgeShape,
|
|
4542
|
+
bt as StraightEdgeShape,
|
|
4543
|
+
Pt as VerticalEdgeShape
|
|
4537
4544
|
};
|