@html-graph/html-graph 9.0.0 → 9.1.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 +20 -14
- package/dist/html-graph.js +26 -14
- package/dist/html-graph.min.js +499 -494
- package/dist/html-graph.min.umd.cjs +1 -1
- package/dist/html-graph.umd.cjs +26 -14
- package/package.json +1 -1
package/dist/html-graph.min.js
CHANGED
|
@@ -726,7 +726,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
726
726
|
}, x = (e, t, n) => {
|
|
727
727
|
let { x: r, y: i, width: a, height: o } = e.getBoundingClientRect();
|
|
728
728
|
return t >= r && t <= r + a && n >= i && n <= i + o;
|
|
729
|
-
}, S = (e, t, n) => t >= 0 && t <= e.innerWidth && n >= 0 && n <= e.innerHeight,
|
|
729
|
+
}, S = (e, t, n) => t >= 0 && t <= e.innerWidth && n >= 0 && n <= e.innerHeight, ee = class {
|
|
730
730
|
element;
|
|
731
731
|
win;
|
|
732
732
|
constructor(e, t) {
|
|
@@ -735,9 +735,9 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
735
735
|
verify(e, t) {
|
|
736
736
|
return x(this.element, e, t) && S(this.win, e, t);
|
|
737
737
|
}
|
|
738
|
-
},
|
|
738
|
+
}, C = (e, t) => {
|
|
739
739
|
t === null ? e.style.removeProperty("cursor") : e.style.cursor = t;
|
|
740
|
-
},
|
|
740
|
+
}, w = (e) => {
|
|
741
741
|
let t = document.createElement("div");
|
|
742
742
|
return {
|
|
743
743
|
id: e.overlayNodeId,
|
|
@@ -750,26 +750,26 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
750
750
|
direction: e.portDirection
|
|
751
751
|
}]
|
|
752
752
|
};
|
|
753
|
-
},
|
|
754
|
-
let
|
|
755
|
-
for (;
|
|
756
|
-
let t = e.findPortIdsByElement(
|
|
753
|
+
}, te = (e, t, n) => {
|
|
754
|
+
let r = t;
|
|
755
|
+
for (; r !== null;) {
|
|
756
|
+
let t = n(e.findPortIdsByElement(r));
|
|
757
757
|
if (t !== null) return {
|
|
758
758
|
status: "portFound",
|
|
759
759
|
portId: t
|
|
760
760
|
};
|
|
761
|
-
if (e.findNodeIdByElement(
|
|
762
|
-
|
|
761
|
+
if (e.findNodeIdByElement(r) !== void 0) return { status: "nodeEncountered" };
|
|
762
|
+
r = r.parentElement;
|
|
763
763
|
}
|
|
764
764
|
return { status: "notFound" };
|
|
765
765
|
};
|
|
766
766
|
//#endregion
|
|
767
767
|
//#region src/configurators/shared/find-port-at-point/get-elements-at-point/get-elements-at-point.ts
|
|
768
|
-
function*
|
|
768
|
+
function* ne(e, t) {
|
|
769
769
|
let n = e.elementsFromPoint(t.x, t.y);
|
|
770
770
|
for (let e of n) {
|
|
771
771
|
if (e.shadowRoot !== null) {
|
|
772
|
-
let n =
|
|
772
|
+
let n = ne(e.shadowRoot, t);
|
|
773
773
|
for (let e of n) yield e;
|
|
774
774
|
}
|
|
775
775
|
yield e;
|
|
@@ -777,23 +777,23 @@ function* te(e, t) {
|
|
|
777
777
|
}
|
|
778
778
|
//#endregion
|
|
779
779
|
//#region src/configurators/shared/find-port-at-point/find-port-at-point.ts
|
|
780
|
-
var
|
|
781
|
-
let
|
|
782
|
-
for (let t of
|
|
783
|
-
let
|
|
784
|
-
if (
|
|
785
|
-
if (
|
|
780
|
+
var re = (e, t, n) => {
|
|
781
|
+
let r = ne(document, t);
|
|
782
|
+
for (let t of r) {
|
|
783
|
+
let r = te(e, t, n);
|
|
784
|
+
if (r.status === "portFound") return r.portId;
|
|
785
|
+
if (r.status === "nodeEncountered") return null;
|
|
786
786
|
}
|
|
787
787
|
return null;
|
|
788
|
-
},
|
|
788
|
+
}, T = /* @__PURE__ */ function(e) {
|
|
789
789
|
return e.StaticNodeId = "static", e.DraggingNodeId = "dragging", e.EdgeId = "edge", e;
|
|
790
|
-
}({}),
|
|
790
|
+
}({}), ie = (e, t) => ({
|
|
791
791
|
x: e / 2,
|
|
792
792
|
y: t / 2
|
|
793
|
-
}),
|
|
793
|
+
}), E = (e, t, n) => ({
|
|
794
794
|
x: t.x * e.x - t.y * e.y + ((1 - t.x) * n.x + t.y * n.y),
|
|
795
795
|
y: t.y * e.x + t.x * e.y + ((1 - t.x) * n.y - t.y * n.x)
|
|
796
|
-
}),
|
|
796
|
+
}), ae = (e, t, n) => {
|
|
797
797
|
let r = {
|
|
798
798
|
x: e.x + e.width / 2,
|
|
799
799
|
y: e.y + e.height / 2
|
|
@@ -815,14 +815,14 @@ var ne = (e, t) => {
|
|
|
815
815
|
y: i.y - o
|
|
816
816
|
}
|
|
817
817
|
};
|
|
818
|
-
},
|
|
818
|
+
}, D = .5 * .5 * .5, O = 3 * D, oe = class {
|
|
819
819
|
path;
|
|
820
820
|
midpoint;
|
|
821
821
|
constructor(e) {
|
|
822
|
-
let { from: t, to: n, arrowLength: r, fromDir: i, toDir: a, curvature: o, hasSourceArrow: s, hasTargetArrow: c } = e, l =
|
|
822
|
+
let { from: t, to: n, arrowLength: r, fromDir: i, toDir: a, curvature: o, hasSourceArrow: s, hasTargetArrow: c } = e, l = E({
|
|
823
823
|
x: t.x + r,
|
|
824
824
|
y: t.y
|
|
825
|
-
}, i, t), u =
|
|
825
|
+
}, i, t), u = E({
|
|
826
826
|
x: n.x - r,
|
|
827
827
|
y: n.y
|
|
828
828
|
}, a, n), d = {
|
|
@@ -831,7 +831,7 @@ var ne = (e, t) => {
|
|
|
831
831
|
}, f = {
|
|
832
832
|
x: u.x - a.x * o,
|
|
833
833
|
y: u.y - a.y * o
|
|
834
|
-
}, p =
|
|
834
|
+
}, p = D * l.x + O * d.x + O * f.x + D * u.x, m = D * l.y + O * d.y + O * f.y + D * u.y;
|
|
835
835
|
this.midpoint = {
|
|
836
836
|
x: p,
|
|
837
837
|
y: m
|
|
@@ -839,23 +839,23 @@ var ne = (e, t) => {
|
|
|
839
839
|
let h = `M ${l.x} ${l.y} C ${d.x} ${d.y}, ${f.x} ${f.y}, ${u.x} ${u.y}`, g = s ? "" : `M ${t.x} ${t.y} L ${l.x} ${l.y} `, _ = c ? "" : ` M ${u.x} ${u.y} L ${n.x} ${n.y}`;
|
|
840
840
|
this.path = `${g}${h}${_}`;
|
|
841
841
|
}
|
|
842
|
-
},
|
|
842
|
+
}, se = class {
|
|
843
843
|
path;
|
|
844
844
|
midpoint;
|
|
845
845
|
constructor(e) {
|
|
846
|
-
let { hasSourceArrow: t, hasTargetArrow: n, curvature: r, fromDir: i, toDir: a, detourDir: o, from: s, to: c, arrowLength: l, detourDistance: u } = e, d = t ?
|
|
846
|
+
let { hasSourceArrow: t, hasTargetArrow: n, curvature: r, fromDir: i, toDir: a, detourDir: o, from: s, to: c, arrowLength: l, detourDistance: u } = e, d = t ? E({
|
|
847
847
|
x: s.x + l,
|
|
848
848
|
y: s.y
|
|
849
|
-
}, i, s) : s, f = n ?
|
|
849
|
+
}, i, s) : s, f = n ? E({
|
|
850
850
|
x: c.x - l,
|
|
851
851
|
y: c.y
|
|
852
|
-
}, a, c) : c, p = Math.cos(o) * u, m = Math.sin(o) * u, h =
|
|
852
|
+
}, a, c) : c, p = Math.cos(o) * u, m = Math.sin(o) * u, h = E({
|
|
853
853
|
x: s.x + l,
|
|
854
854
|
y: s.y
|
|
855
855
|
}, i, s), g = {
|
|
856
856
|
x: h.x + p,
|
|
857
857
|
y: h.y + m
|
|
858
|
-
}, _ =
|
|
858
|
+
}, _ = E({
|
|
859
859
|
x: c.x - l,
|
|
860
860
|
y: c.y
|
|
861
861
|
}, a, c), v = {
|
|
@@ -873,7 +873,7 @@ var ne = (e, t) => {
|
|
|
873
873
|
}, S = {
|
|
874
874
|
x: h.x + p,
|
|
875
875
|
y: h.y + m
|
|
876
|
-
},
|
|
876
|
+
}, ee = {
|
|
877
877
|
x: _.x + p,
|
|
878
878
|
y: _.y + m
|
|
879
879
|
};
|
|
@@ -881,22 +881,22 @@ var ne = (e, t) => {
|
|
|
881
881
|
`M ${d.x} ${d.y}`,
|
|
882
882
|
`L ${h.x} ${h.y}`,
|
|
883
883
|
`C ${b.x} ${b.y} ${S.x} ${S.y} ${y.x} ${y.y}`,
|
|
884
|
-
`C ${
|
|
884
|
+
`C ${ee.x} ${ee.y} ${x.x} ${x.y} ${_.x} ${_.y}`,
|
|
885
885
|
`L ${f.x} ${f.y}`
|
|
886
886
|
].join(" "), this.midpoint = y;
|
|
887
887
|
}
|
|
888
|
-
},
|
|
888
|
+
}, k = Object.freeze({ edgeColor: "--edge-color" }), ce = (e) => {
|
|
889
889
|
let t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
890
|
-
return t.style.pointerEvents = "none", t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.overflow = "visible", t.style.setProperty(
|
|
891
|
-
},
|
|
890
|
+
return t.style.pointerEvents = "none", t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.overflow = "visible", t.style.setProperty(k.edgeColor, e), t;
|
|
891
|
+
}, le = (e) => {
|
|
892
892
|
let t = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
893
|
-
return t.setAttribute("stroke", `var(${
|
|
894
|
-
},
|
|
893
|
+
return t.setAttribute("stroke", `var(${k.edgeColor})`), t.setAttribute("stroke-width", `${e}`), t.setAttribute("fill", "none"), t;
|
|
894
|
+
}, A = () => {
|
|
895
895
|
let e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
896
|
-
return e.setAttribute("fill", `var(${
|
|
897
|
-
},
|
|
896
|
+
return e.setAttribute("fill", `var(${k.edgeColor})`), e;
|
|
897
|
+
}, ue = (e, t) => {
|
|
898
898
|
e.style.transform = `translate(${t.x}px, ${t.y}px)`, e.style.width = `${t.width}px`, e.style.height = `${t.height}px`;
|
|
899
|
-
},
|
|
899
|
+
}, j = (e, t) => {
|
|
900
900
|
let n = [];
|
|
901
901
|
if (e.length > 0 && n.push(`M ${e[0].x} ${e[0].y}`), e.length === 2 && n.push(`L ${e[1].x} ${e[1].y}`), e.length > 2) {
|
|
902
902
|
let r = e.length - 1, i = 0, a = 0, o = 0;
|
|
@@ -917,7 +917,7 @@ var ne = (e, t) => {
|
|
|
917
917
|
});
|
|
918
918
|
}
|
|
919
919
|
return n.join(" ");
|
|
920
|
-
},
|
|
920
|
+
}, de = (e, t) => {
|
|
921
921
|
let n = e.linePoint, r = t.linePoint, i = r.x - n.x >= 0, a = e.dir.x >= 0;
|
|
922
922
|
if (a === t.dir.x >= 0) {
|
|
923
923
|
let o = a === i, s = {
|
|
@@ -991,24 +991,24 @@ var ne = (e, t) => {
|
|
|
991
991
|
y: s
|
|
992
992
|
}
|
|
993
993
|
};
|
|
994
|
-
},
|
|
994
|
+
}, M = (e) => ({
|
|
995
995
|
x: e.y,
|
|
996
996
|
y: e.x
|
|
997
|
-
}),
|
|
998
|
-
let n =
|
|
999
|
-
arrowPoint:
|
|
1000
|
-
linePoint:
|
|
1001
|
-
dir:
|
|
997
|
+
}), fe = (e, t) => {
|
|
998
|
+
let n = de({
|
|
999
|
+
arrowPoint: M(e.arrowPoint),
|
|
1000
|
+
linePoint: M(e.linePoint),
|
|
1001
|
+
dir: M(e.dir)
|
|
1002
1002
|
}, {
|
|
1003
|
-
arrowPoint:
|
|
1004
|
-
linePoint:
|
|
1005
|
-
dir:
|
|
1003
|
+
arrowPoint: M(t.arrowPoint),
|
|
1004
|
+
linePoint: M(t.linePoint),
|
|
1005
|
+
dir: M(t.dir)
|
|
1006
1006
|
});
|
|
1007
1007
|
return {
|
|
1008
|
-
points: n.points.map((e) =>
|
|
1009
|
-
midpoint:
|
|
1008
|
+
points: n.points.map((e) => M(e)),
|
|
1009
|
+
midpoint: M(n.midpoint)
|
|
1010
1010
|
};
|
|
1011
|
-
},
|
|
1011
|
+
}, N = (e) => {
|
|
1012
1012
|
let t = [];
|
|
1013
1013
|
for (let n = 1; n < e.length; n++) {
|
|
1014
1014
|
let r = e[n - 1], i = e[n], a = i.x - r.x, o = i.y - r.y, s = Math.sqrt(a * a + o * o);
|
|
@@ -1034,7 +1034,7 @@ var ne = (e, t) => {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
if (r === 0 && e.length > 0) return e[0];
|
|
1036
1036
|
throw Error("Failed to calculate midpoint");
|
|
1037
|
-
},
|
|
1037
|
+
}, pe = (e, t) => {
|
|
1038
1038
|
let n = e.linePoint, r = e.arrowPoint, i = t.linePoint, a = t.arrowPoint, o = t.dir.y >= 0, s = e.dir.x >= 0, c = i.y - n.y >= 0, l = s === i.x - n.x >= 0, u = o === c;
|
|
1039
1039
|
if (l) {
|
|
1040
1040
|
if (u) {
|
|
@@ -1048,7 +1048,7 @@ var ne = (e, t) => {
|
|
|
1048
1048
|
e,
|
|
1049
1049
|
a
|
|
1050
1050
|
],
|
|
1051
|
-
midpoint:
|
|
1051
|
+
midpoint: N([
|
|
1052
1052
|
n,
|
|
1053
1053
|
e,
|
|
1054
1054
|
i
|
|
@@ -1070,7 +1070,7 @@ var ne = (e, t) => {
|
|
|
1070
1070
|
i,
|
|
1071
1071
|
a
|
|
1072
1072
|
],
|
|
1073
|
-
midpoint:
|
|
1073
|
+
midpoint: N([
|
|
1074
1074
|
n,
|
|
1075
1075
|
t,
|
|
1076
1076
|
o,
|
|
@@ -1094,7 +1094,7 @@ var ne = (e, t) => {
|
|
|
1094
1094
|
o,
|
|
1095
1095
|
a
|
|
1096
1096
|
],
|
|
1097
|
-
midpoint:
|
|
1097
|
+
midpoint: N([
|
|
1098
1098
|
n,
|
|
1099
1099
|
t,
|
|
1100
1100
|
o,
|
|
@@ -1114,46 +1114,46 @@ var ne = (e, t) => {
|
|
|
1114
1114
|
i,
|
|
1115
1115
|
a
|
|
1116
1116
|
],
|
|
1117
|
-
midpoint:
|
|
1117
|
+
midpoint: N([
|
|
1118
1118
|
n,
|
|
1119
1119
|
d,
|
|
1120
1120
|
i
|
|
1121
1121
|
])
|
|
1122
1122
|
};
|
|
1123
|
-
},
|
|
1124
|
-
let n =
|
|
1125
|
-
arrowPoint:
|
|
1126
|
-
linePoint:
|
|
1127
|
-
dir:
|
|
1123
|
+
}, me = (e, t) => {
|
|
1124
|
+
let n = pe({
|
|
1125
|
+
arrowPoint: M(e.arrowPoint),
|
|
1126
|
+
linePoint: M(e.linePoint),
|
|
1127
|
+
dir: M(e.dir)
|
|
1128
1128
|
}, {
|
|
1129
|
-
arrowPoint:
|
|
1130
|
-
linePoint:
|
|
1131
|
-
dir:
|
|
1129
|
+
arrowPoint: M(t.arrowPoint),
|
|
1130
|
+
linePoint: M(t.linePoint),
|
|
1131
|
+
dir: M(t.dir)
|
|
1132
1132
|
});
|
|
1133
1133
|
return {
|
|
1134
|
-
points: n.points.map((e) =>
|
|
1135
|
-
midpoint:
|
|
1134
|
+
points: n.points.map((e) => M(e)),
|
|
1135
|
+
midpoint: M(n.midpoint)
|
|
1136
1136
|
};
|
|
1137
|
-
},
|
|
1137
|
+
}, he = (e, t) => {
|
|
1138
1138
|
let n = Math.abs(e.dir.y) < 1e-10, r = Math.abs(t.dir.y) < 1e-10;
|
|
1139
|
-
return n ? r ?
|
|
1140
|
-
},
|
|
1139
|
+
return n ? r ? de(e, t) : pe(e, t) : r ? me(e, t) : fe(e, t);
|
|
1140
|
+
}, ge = class {
|
|
1141
1141
|
path;
|
|
1142
1142
|
midpoint;
|
|
1143
1143
|
constructor(e) {
|
|
1144
|
-
let { hasSourceArrow: t, hasTargetArrow: n, from: r, to: i, arrowLength: a, fromDir: o, toDir: s, arrowOffset: c, detourDir: l, detourDistance: u, roundness: d } = e, f = t ?
|
|
1144
|
+
let { hasSourceArrow: t, hasTargetArrow: n, from: r, to: i, arrowLength: a, fromDir: o, toDir: s, arrowOffset: c, detourDir: l, detourDistance: u, roundness: d } = e, f = t ? E({
|
|
1145
1145
|
x: r.x + a,
|
|
1146
1146
|
y: r.y
|
|
1147
|
-
}, o, r) : r, p = n ?
|
|
1147
|
+
}, o, r) : r, p = n ? E({
|
|
1148
1148
|
x: i.x - a,
|
|
1149
1149
|
y: i.y
|
|
1150
|
-
}, s, i) : i, m = a + c, h = Math.cos(l) * u, g = Math.sin(l) * u, _ =
|
|
1150
|
+
}, s, i) : i, m = a + c, h = Math.cos(l) * u, g = Math.sin(l) * u, _ = E({
|
|
1151
1151
|
x: r.x + m,
|
|
1152
1152
|
y: r.y
|
|
1153
1153
|
}, o, r), v = {
|
|
1154
1154
|
x: _.x + h,
|
|
1155
1155
|
y: _.y + g
|
|
1156
|
-
}, y =
|
|
1156
|
+
}, y = E({
|
|
1157
1157
|
x: i.x - m,
|
|
1158
1158
|
y: i.y
|
|
1159
1159
|
}, s, i), b = {
|
|
@@ -1163,7 +1163,7 @@ var ne = (e, t) => {
|
|
|
1163
1163
|
this.midpoint = {
|
|
1164
1164
|
x: (v.x + b.x) / 2,
|
|
1165
1165
|
y: (v.y + b.y) / 2
|
|
1166
|
-
}, this.path =
|
|
1166
|
+
}, this.path = j([
|
|
1167
1167
|
f,
|
|
1168
1168
|
_,
|
|
1169
1169
|
v,
|
|
@@ -1172,18 +1172,18 @@ var ne = (e, t) => {
|
|
|
1172
1172
|
p
|
|
1173
1173
|
], d);
|
|
1174
1174
|
}
|
|
1175
|
-
},
|
|
1175
|
+
}, _e = class {
|
|
1176
1176
|
path;
|
|
1177
1177
|
midpoint;
|
|
1178
1178
|
constructor(e) {
|
|
1179
|
-
let { from: t, to: n, hasSourceArrow: r, hasTargetArrow: i, arrowLength: a, fromDir: o, toDir: s, arrowOffset: c, roundness: l } = e, u = this.createArrowPoint(r, o, t, a), d = this.createArrowPoint(i, s, n, -a), f = a + c, p =
|
|
1179
|
+
let { from: t, to: n, hasSourceArrow: r, hasTargetArrow: i, arrowLength: a, fromDir: o, toDir: s, arrowOffset: c, roundness: l } = e, u = this.createArrowPoint(r, o, t, a), d = this.createArrowPoint(i, s, n, -a), f = a + c, p = E({
|
|
1180
1180
|
x: t.x + f,
|
|
1181
1181
|
y: t.y
|
|
1182
|
-
}, o, t), m =
|
|
1182
|
+
}, o, t), m = E({
|
|
1183
1183
|
x: n.x - f,
|
|
1184
1184
|
y: n.y
|
|
1185
1185
|
}, s, n);
|
|
1186
|
-
this.path =
|
|
1186
|
+
this.path = j([
|
|
1187
1187
|
u,
|
|
1188
1188
|
p,
|
|
1189
1189
|
m,
|
|
@@ -1196,28 +1196,28 @@ var ne = (e, t) => {
|
|
|
1196
1196
|
};
|
|
1197
1197
|
}
|
|
1198
1198
|
createArrowPoint(e, t, n, r) {
|
|
1199
|
-
return e ?
|
|
1199
|
+
return e ? E({
|
|
1200
1200
|
x: n.x + r,
|
|
1201
1201
|
y: n.y
|
|
1202
1202
|
}, t, n) : n;
|
|
1203
1203
|
}
|
|
1204
|
-
},
|
|
1204
|
+
}, ve = class {
|
|
1205
1205
|
path;
|
|
1206
1206
|
midpoint;
|
|
1207
1207
|
constructor(e) {
|
|
1208
|
-
let { from: t, to: n, fromDir: r, toDir: i, arrowLength: a, arrowOffset: o, roundness: s, hasSourceArrow: c, hasTargetArrow: l } = e, u = c ?
|
|
1208
|
+
let { from: t, to: n, fromDir: r, toDir: i, arrowLength: a, arrowOffset: o, roundness: s, hasSourceArrow: c, hasTargetArrow: l } = e, u = c ? E({
|
|
1209
1209
|
x: t.x + a,
|
|
1210
1210
|
y: t.y
|
|
1211
|
-
}, r, t) : t, d = l ?
|
|
1211
|
+
}, r, t) : t, d = l ? E({
|
|
1212
1212
|
x: n.x - a,
|
|
1213
1213
|
y: n.y
|
|
1214
|
-
}, i, n) : n, f = a + o, p =
|
|
1214
|
+
}, i, n) : n, f = a + o, p = E({
|
|
1215
1215
|
x: t.x + f,
|
|
1216
1216
|
y: t.y
|
|
1217
|
-
}, r, t), m =
|
|
1217
|
+
}, r, t), m = E({
|
|
1218
1218
|
x: n.x - f,
|
|
1219
1219
|
y: n.y
|
|
1220
|
-
}, i, n), h =
|
|
1220
|
+
}, i, n), h = he({
|
|
1221
1221
|
arrowPoint: u,
|
|
1222
1222
|
linePoint: p,
|
|
1223
1223
|
dir: r
|
|
@@ -1226,9 +1226,9 @@ var ne = (e, t) => {
|
|
|
1226
1226
|
linePoint: m,
|
|
1227
1227
|
dir: i
|
|
1228
1228
|
});
|
|
1229
|
-
this.path =
|
|
1229
|
+
this.path = j(h.points, s), this.midpoint = h.midpoint;
|
|
1230
1230
|
}
|
|
1231
|
-
},
|
|
1231
|
+
}, ye = class {
|
|
1232
1232
|
path;
|
|
1233
1233
|
midpoint;
|
|
1234
1234
|
constructor(e) {
|
|
@@ -1265,19 +1265,19 @@ var ne = (e, t) => {
|
|
|
1265
1265
|
x: n,
|
|
1266
1266
|
y: 0
|
|
1267
1267
|
}
|
|
1268
|
-
].map((e) =>
|
|
1268
|
+
].map((e) => E(e, i, {
|
|
1269
1269
|
x: 0,
|
|
1270
1270
|
y: 0
|
|
1271
1271
|
})).map((e) => ({
|
|
1272
1272
|
x: e.x + a.x,
|
|
1273
1273
|
y: e.y + a.y
|
|
1274
1274
|
})), u = `M ${a.x} ${a.y} L ${l[0].x} ${l[0].y} `;
|
|
1275
|
-
this.path = `${o ? "" : u}${
|
|
1275
|
+
this.path = `${o ? "" : u}${j(l, e.roundness)}`, this.midpoint = {
|
|
1276
1276
|
x: (l[3].x + l[4].x) / 2,
|
|
1277
1277
|
y: (l[3].y + l[4].y) / 2
|
|
1278
1278
|
};
|
|
1279
1279
|
}
|
|
1280
|
-
},
|
|
1280
|
+
}, be = class {
|
|
1281
1281
|
path;
|
|
1282
1282
|
midpoint;
|
|
1283
1283
|
constructor(e) {
|
|
@@ -1298,7 +1298,7 @@ var ne = (e, t) => {
|
|
|
1298
1298
|
x: d,
|
|
1299
1299
|
y: 0
|
|
1300
1300
|
}
|
|
1301
|
-
].map((e) =>
|
|
1301
|
+
].map((e) => E(e, i, {
|
|
1302
1302
|
x: 0,
|
|
1303
1303
|
y: 0
|
|
1304
1304
|
})).map((e) => ({
|
|
@@ -1312,30 +1312,30 @@ var ne = (e, t) => {
|
|
|
1312
1312
|
].join(" "), h = `M ${a.x} ${a.y} L ${p[0].x} ${p[0].y} `;
|
|
1313
1313
|
this.path = `${o ? "" : h}${m}`, this.midpoint = p[3];
|
|
1314
1314
|
}
|
|
1315
|
-
},
|
|
1315
|
+
}, xe = (e, t, n) => {
|
|
1316
1316
|
let r = Math.max(e.y, t.y), i = Math.min(e.y, t.y);
|
|
1317
1317
|
return (n >= 0 ? r : i) + n;
|
|
1318
|
-
},
|
|
1318
|
+
}, Se = class {
|
|
1319
1319
|
path;
|
|
1320
1320
|
midpoint;
|
|
1321
1321
|
constructor(e) {
|
|
1322
|
-
let { hasSourceArrow: t, hasTargetArrow: n, arrowLength: r, from: i, to: a, fromDir: o, toDir: s, arrowOffset: c, roundness: l, detourDistance: u } = e, d = t ?
|
|
1322
|
+
let { hasSourceArrow: t, hasTargetArrow: n, arrowLength: r, from: i, to: a, fromDir: o, toDir: s, arrowOffset: c, roundness: l, detourDistance: u } = e, d = t ? E({
|
|
1323
1323
|
x: i.x + r,
|
|
1324
1324
|
y: i.y
|
|
1325
|
-
}, o, i) : i, f = n ?
|
|
1325
|
+
}, o, i) : i, f = n ? E({
|
|
1326
1326
|
x: a.x - r,
|
|
1327
1327
|
y: a.y
|
|
1328
|
-
}, s, a) : a, p = r + c, m =
|
|
1328
|
+
}, s, a) : a, p = r + c, m = E({
|
|
1329
1329
|
x: i.x + p,
|
|
1330
1330
|
y: i.y
|
|
1331
|
-
}, o, i), h =
|
|
1331
|
+
}, o, i), h = E({
|
|
1332
1332
|
x: a.x - p,
|
|
1333
1333
|
y: a.y
|
|
1334
|
-
}, s, a), g =
|
|
1334
|
+
}, s, a), g = xe(m, h, u);
|
|
1335
1335
|
this.midpoint = {
|
|
1336
1336
|
x: (m.x + h.x) / 2,
|
|
1337
1337
|
y: g
|
|
1338
|
-
}, this.path =
|
|
1338
|
+
}, this.path = j([
|
|
1339
1339
|
d,
|
|
1340
1340
|
m,
|
|
1341
1341
|
{
|
|
@@ -1350,30 +1350,30 @@ var ne = (e, t) => {
|
|
|
1350
1350
|
f
|
|
1351
1351
|
], l);
|
|
1352
1352
|
}
|
|
1353
|
-
},
|
|
1353
|
+
}, Ce = (e, t, n) => {
|
|
1354
1354
|
let r = Math.max(e.x, t.x), i = Math.min(e.x, t.x);
|
|
1355
1355
|
return (n >= 0 ? r : i) + n;
|
|
1356
|
-
},
|
|
1356
|
+
}, we = class {
|
|
1357
1357
|
path;
|
|
1358
1358
|
midpoint;
|
|
1359
1359
|
constructor(e) {
|
|
1360
|
-
let { hasSourceArrow: t, hasTargetArrow: n, arrowLength: r, fromDir: i, toDir: a, from: o, to: s, arrowOffset: c, detourDistance: l, roundness: u } = e, d = t ?
|
|
1360
|
+
let { hasSourceArrow: t, hasTargetArrow: n, arrowLength: r, fromDir: i, toDir: a, from: o, to: s, arrowOffset: c, detourDistance: l, roundness: u } = e, d = t ? E({
|
|
1361
1361
|
x: o.x + r,
|
|
1362
1362
|
y: o.y
|
|
1363
|
-
}, i, o) : o, f = n ?
|
|
1363
|
+
}, i, o) : o, f = n ? E({
|
|
1364
1364
|
x: s.x - r,
|
|
1365
1365
|
y: s.y
|
|
1366
|
-
}, a, s) : s, p = r + c, m =
|
|
1366
|
+
}, a, s) : s, p = r + c, m = E({
|
|
1367
1367
|
x: o.x + p,
|
|
1368
1368
|
y: o.y
|
|
1369
|
-
}, i, o), h =
|
|
1369
|
+
}, i, o), h = E({
|
|
1370
1370
|
x: s.x - p,
|
|
1371
1371
|
y: s.y
|
|
1372
|
-
}, a, s), g =
|
|
1372
|
+
}, a, s), g = Ce(m, h, l);
|
|
1373
1373
|
this.midpoint = {
|
|
1374
1374
|
x: g,
|
|
1375
1375
|
y: (m.y + h.y) / 2
|
|
1376
|
-
}, this.path =
|
|
1376
|
+
}, this.path = j([
|
|
1377
1377
|
d,
|
|
1378
1378
|
m,
|
|
1379
1379
|
{
|
|
@@ -1388,25 +1388,25 @@ var ne = (e, t) => {
|
|
|
1388
1388
|
f
|
|
1389
1389
|
], u);
|
|
1390
1390
|
}
|
|
1391
|
-
},
|
|
1391
|
+
}, Te = class {
|
|
1392
1392
|
path;
|
|
1393
1393
|
midpoint;
|
|
1394
1394
|
constructor(e) {
|
|
1395
1395
|
let t = Math.abs(e.fromDir.y) < 1e-10, n = Math.abs(e.toDir.y) < 1e-10;
|
|
1396
1396
|
if (t && n) {
|
|
1397
|
-
let t = new
|
|
1397
|
+
let t = new Se(e);
|
|
1398
1398
|
this.path = t.path, this.midpoint = t.midpoint;
|
|
1399
1399
|
return;
|
|
1400
1400
|
}
|
|
1401
1401
|
if (!t && !n) {
|
|
1402
|
-
let t = new
|
|
1402
|
+
let t = new we(e);
|
|
1403
1403
|
this.path = t.path, this.midpoint = t.midpoint;
|
|
1404
1404
|
return;
|
|
1405
1405
|
}
|
|
1406
|
-
let r = new
|
|
1406
|
+
let r = new ve(e);
|
|
1407
1407
|
this.path = r.path, this.midpoint = r.midpoint;
|
|
1408
1408
|
}
|
|
1409
|
-
},
|
|
1409
|
+
}, P = Object.freeze({
|
|
1410
1410
|
color: "#777777",
|
|
1411
1411
|
width: 1,
|
|
1412
1412
|
arrowLength: 20,
|
|
@@ -1428,10 +1428,10 @@ var ne = (e, t) => {
|
|
|
1428
1428
|
curvature: 90,
|
|
1429
1429
|
interactiveWidth: 10,
|
|
1430
1430
|
portOffset: 0
|
|
1431
|
-
}),
|
|
1431
|
+
}), Ee = (e) => ({
|
|
1432
1432
|
x: Math.cos(e),
|
|
1433
1433
|
y: Math.sin(e)
|
|
1434
|
-
}),
|
|
1434
|
+
}), F = class {
|
|
1435
1435
|
params;
|
|
1436
1436
|
element;
|
|
1437
1437
|
group = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
@@ -1442,17 +1442,17 @@ var ne = (e, t) => {
|
|
|
1442
1442
|
afterRenderEmitter;
|
|
1443
1443
|
arrowRenderer;
|
|
1444
1444
|
constructor(e) {
|
|
1445
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = u(), this.arrowRenderer = this.params.arrowRenderer, this.element =
|
|
1445
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = u(), this.arrowRenderer = this.params.arrowRenderer, this.element = ce(e.color), 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));
|
|
1446
1446
|
}
|
|
1447
1447
|
render(t) {
|
|
1448
|
-
let { x: n, y: r, width: i, height: a, from: o, to: s } =
|
|
1449
|
-
|
|
1448
|
+
let { x: n, y: r, width: i, height: a, from: o, to: s } = ae(t.from, t.to, this.params.padding);
|
|
1449
|
+
ue(this.element, {
|
|
1450
1450
|
x: n,
|
|
1451
1451
|
y: r,
|
|
1452
1452
|
width: i,
|
|
1453
1453
|
height: a
|
|
1454
1454
|
});
|
|
1455
|
-
let c =
|
|
1455
|
+
let c = Ee(t.from.direction), l = Ee(t.to.direction), u = {
|
|
1456
1456
|
x: -l.x,
|
|
1457
1457
|
y: -l.y
|
|
1458
1458
|
}, d;
|
|
@@ -1476,7 +1476,7 @@ var ne = (e, t) => {
|
|
|
1476
1476
|
targetArrowPath: m
|
|
1477
1477
|
});
|
|
1478
1478
|
}
|
|
1479
|
-
},
|
|
1479
|
+
}, De = (e) => (t) => {
|
|
1480
1480
|
let n = [
|
|
1481
1481
|
{
|
|
1482
1482
|
x: 0,
|
|
@@ -1490,7 +1490,7 @@ var ne = (e, t) => {
|
|
|
1490
1490
|
x: t.arrowLength,
|
|
1491
1491
|
y: -e.radius
|
|
1492
1492
|
}
|
|
1493
|
-
].map((e) =>
|
|
1493
|
+
].map((e) => E(e, t.direction, {
|
|
1494
1494
|
x: 0,
|
|
1495
1495
|
y: 0
|
|
1496
1496
|
})).map((e) => ({
|
|
@@ -1498,7 +1498,7 @@ var ne = (e, t) => {
|
|
|
1498
1498
|
y: e.y + t.shift.y
|
|
1499
1499
|
}));
|
|
1500
1500
|
return `${`M ${n[0].x} ${n[0].y}`} ${`L ${n[1].x} ${n[1].y}`} ${`L ${n[2].x} ${n[2].y}`} Z`;
|
|
1501
|
-
},
|
|
1501
|
+
}, Oe = (e) => (t) => {
|
|
1502
1502
|
let n = e.radius, r = t.arrowLength, i = (r * r + 2 * r * n) / (2 * n), a = i + n, o = r + n - n * (r + n) / a, s = n * i / a, c = [
|
|
1503
1503
|
{
|
|
1504
1504
|
x: 0,
|
|
@@ -1512,7 +1512,7 @@ var ne = (e, t) => {
|
|
|
1512
1512
|
x: o,
|
|
1513
1513
|
y: s
|
|
1514
1514
|
}
|
|
1515
|
-
].map((e) =>
|
|
1515
|
+
].map((e) => E(e, t.direction, {
|
|
1516
1516
|
x: 0,
|
|
1517
1517
|
y: 0
|
|
1518
1518
|
})).map((e) => ({
|
|
@@ -1520,8 +1520,8 @@ var ne = (e, t) => {
|
|
|
1520
1520
|
y: e.y + t.shift.y
|
|
1521
1521
|
}));
|
|
1522
1522
|
return `${`M ${c[0].x} ${c[0].y}`} ${`A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`} ${`A ${n} ${n} 0 0 0 ${c[2].x} ${c[2].y}`} ${`A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`}`;
|
|
1523
|
-
},
|
|
1524
|
-
let n = e.smallRadius, r = e.radius, i =
|
|
1523
|
+
}, ke = (e) => (t) => {
|
|
1524
|
+
let n = e.smallRadius, r = e.radius, i = E({
|
|
1525
1525
|
x: t.arrowLength,
|
|
1526
1526
|
y: 0
|
|
1527
1527
|
}, {
|
|
@@ -1540,7 +1540,7 @@ var ne = (e, t) => {
|
|
|
1540
1540
|
y: -i.y
|
|
1541
1541
|
},
|
|
1542
1542
|
i
|
|
1543
|
-
].map((e) =>
|
|
1543
|
+
].map((e) => E(e, t.direction, {
|
|
1544
1544
|
x: 0,
|
|
1545
1545
|
y: 0
|
|
1546
1546
|
})).map((e) => ({
|
|
@@ -1548,18 +1548,18 @@ var ne = (e, t) => {
|
|
|
1548
1548
|
y: e.y + t.shift.y
|
|
1549
1549
|
}));
|
|
1550
1550
|
return `${`M ${a[0].x} ${a[0].y}`} ${`A ${r} ${r} 0 0 1 ${a[1].x} ${a[1].y}`} ${`A ${n} ${n} 0 0 1 ${a[2].x} ${a[2].y}`} ${`A ${r} ${r} 0 0 1 ${a[0].x} ${a[0].y}`}`;
|
|
1551
|
-
},
|
|
1551
|
+
}, I = (e) => {
|
|
1552
1552
|
if (typeof e == "function") return e;
|
|
1553
1553
|
switch (e.type) {
|
|
1554
|
-
case "triangle": return
|
|
1555
|
-
case "arc": return
|
|
1556
|
-
default: return
|
|
1557
|
-
smallRadius: e.smallRadius ??
|
|
1558
|
-
angle: e.angle ??
|
|
1559
|
-
radius: e.radius ??
|
|
1554
|
+
case "triangle": return De({ radius: e.radius ?? P.polygonArrowRadius });
|
|
1555
|
+
case "arc": return Oe({ radius: e.radius ?? P.circleArrowRadius });
|
|
1556
|
+
default: return ke({
|
|
1557
|
+
smallRadius: e.smallRadius ?? P.wedgeArrowSmallRadius,
|
|
1558
|
+
angle: e.angle ?? P.wedgeArrowAngle,
|
|
1559
|
+
radius: e.radius ?? P.wedgeArrowRadius
|
|
1560
1560
|
});
|
|
1561
1561
|
}
|
|
1562
|
-
},
|
|
1562
|
+
}, Ae = class {
|
|
1563
1563
|
element;
|
|
1564
1564
|
group;
|
|
1565
1565
|
line;
|
|
@@ -1575,7 +1575,7 @@ var ne = (e, t) => {
|
|
|
1575
1575
|
hasSourceArrow;
|
|
1576
1576
|
hasTargetArrow;
|
|
1577
1577
|
pathShape;
|
|
1578
|
-
createCyclePath = (e, t, n) => new
|
|
1578
|
+
createCyclePath = (e, t, n) => new be({
|
|
1579
1579
|
origin: e,
|
|
1580
1580
|
dir: n,
|
|
1581
1581
|
radius: this.portCycleRadius,
|
|
@@ -1583,7 +1583,7 @@ var ne = (e, t) => {
|
|
|
1583
1583
|
arrowLength: this.arrowLength,
|
|
1584
1584
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1585
1585
|
});
|
|
1586
|
-
createDetourPath = (e, t, n, r) => new
|
|
1586
|
+
createDetourPath = (e, t, n, r) => new se({
|
|
1587
1587
|
from: e,
|
|
1588
1588
|
to: t,
|
|
1589
1589
|
fromDir: n,
|
|
@@ -1595,7 +1595,7 @@ var ne = (e, t) => {
|
|
|
1595
1595
|
hasSourceArrow: this.hasSourceArrow,
|
|
1596
1596
|
hasTargetArrow: this.hasTargetArrow
|
|
1597
1597
|
});
|
|
1598
|
-
createLinePath = (e, t, n, r) => new
|
|
1598
|
+
createLinePath = (e, t, n, r) => new oe({
|
|
1599
1599
|
from: e,
|
|
1600
1600
|
to: t,
|
|
1601
1601
|
fromDir: n,
|
|
@@ -1606,10 +1606,10 @@ var ne = (e, t) => {
|
|
|
1606
1606
|
hasTargetArrow: this.hasTargetArrow
|
|
1607
1607
|
});
|
|
1608
1608
|
constructor(e) {
|
|
1609
|
-
this.arrowLength = e?.arrowLength ??
|
|
1610
|
-
color: e?.color ??
|
|
1611
|
-
width: e?.width ??
|
|
1612
|
-
arrowRenderer:
|
|
1609
|
+
this.arrowLength = e?.arrowLength ?? P.arrowLength, this.curvature = e?.curvature ?? P.curvature, this.portCycleRadius = e?.cycleRadius ?? P.cycleRadius, this.portCycleSmallRadius = e?.smallCycleRadius ?? P.smallCycleRadius, this.detourDirection = e?.detourDirection ?? P.detourDirection, this.detourDistance = e?.detourDistance ?? P.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? P.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? P.hasTargetArrow, this.pathShape = new F({
|
|
1610
|
+
color: e?.color ?? P.color,
|
|
1611
|
+
width: e?.width ?? P.width,
|
|
1612
|
+
arrowRenderer: I(e?.arrowRenderer ?? {}),
|
|
1613
1613
|
arrowLength: this.arrowLength,
|
|
1614
1614
|
hasSourceArrow: this.hasSourceArrow,
|
|
1615
1615
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1622,7 +1622,7 @@ var ne = (e, t) => {
|
|
|
1622
1622
|
render(e) {
|
|
1623
1623
|
this.pathShape.render(e);
|
|
1624
1624
|
}
|
|
1625
|
-
},
|
|
1625
|
+
}, je = class {
|
|
1626
1626
|
element;
|
|
1627
1627
|
group;
|
|
1628
1628
|
line;
|
|
@@ -1638,7 +1638,7 @@ var ne = (e, t) => {
|
|
|
1638
1638
|
hasSourceArrow;
|
|
1639
1639
|
hasTargetArrow;
|
|
1640
1640
|
pathShape;
|
|
1641
|
-
createCyclePath = (e, t, n) => new
|
|
1641
|
+
createCyclePath = (e, t, n) => new ye({
|
|
1642
1642
|
origin: e,
|
|
1643
1643
|
dir: n,
|
|
1644
1644
|
arrowLength: this.arrowLength,
|
|
@@ -1647,7 +1647,7 @@ var ne = (e, t) => {
|
|
|
1647
1647
|
roundness: this.roundness,
|
|
1648
1648
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1649
1649
|
});
|
|
1650
|
-
createDetourPath = (e, t, n, r) => new
|
|
1650
|
+
createDetourPath = (e, t, n, r) => new ge({
|
|
1651
1651
|
from: e,
|
|
1652
1652
|
to: t,
|
|
1653
1653
|
fromDir: n,
|
|
@@ -1660,7 +1660,7 @@ var ne = (e, t) => {
|
|
|
1660
1660
|
hasSourceArrow: this.hasSourceArrow,
|
|
1661
1661
|
hasTargetArrow: this.hasTargetArrow
|
|
1662
1662
|
});
|
|
1663
|
-
createLinePath = (e, t, n, r) => new
|
|
1663
|
+
createLinePath = (e, t, n, r) => new _e({
|
|
1664
1664
|
from: e,
|
|
1665
1665
|
to: t,
|
|
1666
1666
|
fromDir: n,
|
|
@@ -1672,12 +1672,12 @@ var ne = (e, t) => {
|
|
|
1672
1672
|
hasTargetArrow: this.hasTargetArrow
|
|
1673
1673
|
});
|
|
1674
1674
|
constructor(e) {
|
|
1675
|
-
this.arrowLength = e?.arrowLength ??
|
|
1676
|
-
let t = e?.roundness ??
|
|
1677
|
-
this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDirection = e?.detourDirection ??
|
|
1678
|
-
color: e?.color ??
|
|
1679
|
-
width: e?.width ??
|
|
1680
|
-
arrowRenderer:
|
|
1675
|
+
this.arrowLength = e?.arrowLength ?? P.arrowLength, this.arrowOffset = e?.arrowOffset ?? P.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? P.cycleSquareSide;
|
|
1676
|
+
let t = e?.roundness ?? P.roundness;
|
|
1677
|
+
this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDirection = e?.detourDirection ?? P.detourDirection, this.detourDistance = e?.detourDistance ?? P.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? P.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? P.hasTargetArrow, this.pathShape = new F({
|
|
1678
|
+
color: e?.color ?? P.color,
|
|
1679
|
+
width: e?.width ?? P.width,
|
|
1680
|
+
arrowRenderer: I(e?.arrowRenderer ?? {}),
|
|
1681
1681
|
arrowLength: this.arrowLength,
|
|
1682
1682
|
hasSourceArrow: this.hasSourceArrow,
|
|
1683
1683
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1690,10 +1690,10 @@ var ne = (e, t) => {
|
|
|
1690
1690
|
render(e) {
|
|
1691
1691
|
this.pathShape.render(e);
|
|
1692
1692
|
}
|
|
1693
|
-
},
|
|
1693
|
+
}, Me = (e) => {
|
|
1694
1694
|
let t = e + Math.PI / 4, n = Math.cos(t), r = Math.sin(t);
|
|
1695
1695
|
return n > 0 ? r > 0 ? 0 : -Math.PI / 2 : r > 0 ? Math.PI / 2 : Math.PI;
|
|
1696
|
-
},
|
|
1696
|
+
}, Ne = class {
|
|
1697
1697
|
element;
|
|
1698
1698
|
group;
|
|
1699
1699
|
line;
|
|
@@ -1708,7 +1708,7 @@ var ne = (e, t) => {
|
|
|
1708
1708
|
hasSourceArrow;
|
|
1709
1709
|
hasTargetArrow;
|
|
1710
1710
|
pathShape;
|
|
1711
|
-
createCyclePath = (e, t, n) => new
|
|
1711
|
+
createCyclePath = (e, t, n) => new ye({
|
|
1712
1712
|
origin: e,
|
|
1713
1713
|
dir: n,
|
|
1714
1714
|
arrowLength: this.arrowLength,
|
|
@@ -1717,7 +1717,7 @@ var ne = (e, t) => {
|
|
|
1717
1717
|
roundness: this.roundness,
|
|
1718
1718
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1719
1719
|
});
|
|
1720
|
-
createDetourPath = (e, t, n, r) => new
|
|
1720
|
+
createDetourPath = (e, t, n, r) => new Te({
|
|
1721
1721
|
from: e,
|
|
1722
1722
|
to: t,
|
|
1723
1723
|
fromDir: n,
|
|
@@ -1729,7 +1729,7 @@ var ne = (e, t) => {
|
|
|
1729
1729
|
hasSourceArrow: this.hasSourceArrow,
|
|
1730
1730
|
hasTargetArrow: this.hasTargetArrow
|
|
1731
1731
|
});
|
|
1732
|
-
createLinePath = (e, t, n, r) => new
|
|
1732
|
+
createLinePath = (e, t, n, r) => new ve({
|
|
1733
1733
|
from: e,
|
|
1734
1734
|
to: t,
|
|
1735
1735
|
fromDir: n,
|
|
@@ -1741,12 +1741,12 @@ var ne = (e, t) => {
|
|
|
1741
1741
|
hasTargetArrow: this.hasTargetArrow
|
|
1742
1742
|
});
|
|
1743
1743
|
constructor(e) {
|
|
1744
|
-
this.arrowLength = e?.arrowLength ??
|
|
1745
|
-
let t = e?.roundness ??
|
|
1746
|
-
this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ??
|
|
1747
|
-
color: e?.color ??
|
|
1748
|
-
width: e?.width ??
|
|
1749
|
-
arrowRenderer:
|
|
1744
|
+
this.arrowLength = e?.arrowLength ?? P.arrowLength, this.arrowOffset = e?.arrowOffset ?? P.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? P.cycleSquareSide;
|
|
1745
|
+
let t = e?.roundness ?? P.roundness;
|
|
1746
|
+
this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ?? P.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? P.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? P.hasTargetArrow, this.pathShape = new F({
|
|
1747
|
+
color: e?.color ?? P.color,
|
|
1748
|
+
width: e?.width ?? P.width,
|
|
1749
|
+
arrowRenderer: I(e?.arrowRenderer ?? {}),
|
|
1750
1750
|
arrowLength: this.arrowLength,
|
|
1751
1751
|
hasSourceArrow: this.hasSourceArrow,
|
|
1752
1752
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1762,18 +1762,18 @@ var ne = (e, t) => {
|
|
|
1762
1762
|
category: r,
|
|
1763
1763
|
from: {
|
|
1764
1764
|
...t,
|
|
1765
|
-
direction:
|
|
1765
|
+
direction: Me(t.direction)
|
|
1766
1766
|
},
|
|
1767
1767
|
to: {
|
|
1768
1768
|
...n,
|
|
1769
|
-
direction:
|
|
1769
|
+
direction: Me(n.direction)
|
|
1770
1770
|
}
|
|
1771
1771
|
});
|
|
1772
1772
|
}
|
|
1773
|
-
},
|
|
1773
|
+
}, Pe = (e) => {
|
|
1774
1774
|
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);
|
|
1775
1775
|
return Math.sqrt(u * u + d * d);
|
|
1776
|
-
},
|
|
1776
|
+
}, Fe = (e) => typeof e == "number" ? () => e : e === "box" ? Pe : e, Ie = P.portOffset, L = class {
|
|
1777
1777
|
element;
|
|
1778
1778
|
group = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1779
1779
|
line;
|
|
@@ -1788,11 +1788,11 @@ var ne = (e, t) => {
|
|
|
1788
1788
|
afterRenderEmitter;
|
|
1789
1789
|
arrowRenderer;
|
|
1790
1790
|
constructor(e) {
|
|
1791
|
-
[this.afterRenderEmitter, this.onAfterRender] = u(), this.color = e?.color ??
|
|
1791
|
+
[this.afterRenderEmitter, this.onAfterRender] = u(), this.color = e?.color ?? P.color, this.width = e?.width ?? P.width, this.arrowLength = e?.arrowLength ?? P.arrowLength, this.arrowRenderer = I(e?.arrowRenderer ?? {}), this.sourceOffsetFn = Fe(e?.sourceOffset ?? Ie), this.targetOffsetFn = Fe(e?.targetOffset ?? Ie), this.element = ce(this.color), 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));
|
|
1792
1792
|
}
|
|
1793
1793
|
render(e) {
|
|
1794
|
-
let { x: t, y: n, width: r, height: i, from: a, to: o } =
|
|
1795
|
-
|
|
1794
|
+
let { x: t, y: n, width: r, height: i, from: a, to: o } = ae(e.from, e.to, 50);
|
|
1795
|
+
ue(this.element, {
|
|
1796
1796
|
x: t,
|
|
1797
1797
|
y: n,
|
|
1798
1798
|
width: r,
|
|
@@ -1890,43 +1890,43 @@ var ne = (e, t) => {
|
|
|
1890
1890
|
targetArrowPath: n
|
|
1891
1891
|
});
|
|
1892
1892
|
}
|
|
1893
|
-
},
|
|
1893
|
+
}, Le = () => {
|
|
1894
1894
|
let e = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1895
1895
|
return e.style.pointerEvents = "auto", e.style.cursor = "pointer", e;
|
|
1896
|
-
},
|
|
1896
|
+
}, Re = (e) => {
|
|
1897
1897
|
let t = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1898
1898
|
return t.setAttribute("stroke", "transparent"), t.setAttribute("stroke-width", `${e}`), t.setAttribute("fill", "none"), t.setAttribute("stroke-linecap", "round"), t;
|
|
1899
|
-
},
|
|
1899
|
+
}, ze = (e) => {
|
|
1900
1900
|
let t = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1901
1901
|
return t.setAttribute("stroke-linejoin", "round"), t.setAttribute("stroke-width", `${e}`), t.setAttribute("fill", "transparent"), t.setAttribute("stroke", "transparent"), t;
|
|
1902
|
-
},
|
|
1902
|
+
}, Be = class extends Error {
|
|
1903
1903
|
constructor(e) {
|
|
1904
1904
|
super(e), this.name = "InteractiveEdgeError";
|
|
1905
1905
|
}
|
|
1906
|
-
},
|
|
1906
|
+
}, Ve = class e {
|
|
1907
1907
|
baseEdge;
|
|
1908
1908
|
element;
|
|
1909
1909
|
group;
|
|
1910
1910
|
line;
|
|
1911
1911
|
sourceArrow;
|
|
1912
1912
|
targetArrow;
|
|
1913
|
-
handle =
|
|
1913
|
+
handle = Le();
|
|
1914
1914
|
onAfterRender;
|
|
1915
1915
|
interactiveLine;
|
|
1916
1916
|
interactiveSourceArrow = null;
|
|
1917
1917
|
interactiveTargetArrow = null;
|
|
1918
1918
|
constructor(t, n) {
|
|
1919
|
-
if (this.baseEdge = t, t instanceof e) throw new
|
|
1919
|
+
if (this.baseEdge = t, t instanceof e) throw new Be("interactive edge can be configured only once");
|
|
1920
1920
|
this.element = this.baseEdge.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;
|
|
1921
|
-
let r = n?.distance ??
|
|
1922
|
-
this.interactiveLine =
|
|
1921
|
+
let r = n?.distance ?? P.interactiveWidth;
|
|
1922
|
+
this.interactiveLine = Re(r), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ze(r), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ze(r), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((e) => {
|
|
1923
1923
|
this.interactiveLine.setAttribute("d", e.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", e.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", e.targetArrowPath);
|
|
1924
1924
|
});
|
|
1925
1925
|
}
|
|
1926
1926
|
render(e) {
|
|
1927
1927
|
this.baseEdge.render(e);
|
|
1928
1928
|
}
|
|
1929
|
-
},
|
|
1929
|
+
}, He = class {
|
|
1930
1930
|
baseShape;
|
|
1931
1931
|
midpointElement;
|
|
1932
1932
|
group;
|
|
@@ -1944,7 +1944,7 @@ var ne = (e, t) => {
|
|
|
1944
1944
|
render(e) {
|
|
1945
1945
|
this.baseShape.render(e);
|
|
1946
1946
|
}
|
|
1947
|
-
},
|
|
1947
|
+
}, Ue = class {
|
|
1948
1948
|
graphStore;
|
|
1949
1949
|
onAfterNodeAdded;
|
|
1950
1950
|
onAfterNodeUpdated;
|
|
@@ -2043,7 +2043,7 @@ var ne = (e, t) => {
|
|
|
2043
2043
|
getNodeAdjacentEdgeIds(e) {
|
|
2044
2044
|
return this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
2045
2045
|
}
|
|
2046
|
-
},
|
|
2046
|
+
}, R = class {
|
|
2047
2047
|
checkExists;
|
|
2048
2048
|
counter = 0;
|
|
2049
2049
|
constructor(e) {
|
|
@@ -2057,13 +2057,13 @@ var ne = (e, t) => {
|
|
|
2057
2057
|
reset() {
|
|
2058
2058
|
this.counter = 0;
|
|
2059
2059
|
}
|
|
2060
|
-
},
|
|
2060
|
+
}, We = class {
|
|
2061
2061
|
graphStore;
|
|
2062
2062
|
htmlView;
|
|
2063
2063
|
params;
|
|
2064
|
-
nodeIdGenerator = new
|
|
2065
|
-
portIdGenerator = new
|
|
2066
|
-
edgeIdGenerator = new
|
|
2064
|
+
nodeIdGenerator = new R((e) => this.graphStore.hasNode(e));
|
|
2065
|
+
portIdGenerator = new R((e) => this.graphStore.hasPort(e));
|
|
2066
|
+
edgeIdGenerator = new R((e) => this.graphStore.hasEdge(e));
|
|
2067
2067
|
onAfterNodeAdded = (e) => {
|
|
2068
2068
|
this.htmlView.attachNode(e);
|
|
2069
2069
|
};
|
|
@@ -2170,13 +2170,13 @@ var ne = (e, t) => {
|
|
|
2170
2170
|
destroy() {
|
|
2171
2171
|
this.graphStore.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.unsubscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.unsubscribe(this.onAfterNodePriorityUpdated), 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(this.onAfterEdgeShapeUpdated), this.graphStore.onAfterEdgeUpdated.unsubscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.unsubscribe(this.onAfterEdgePriorityUpdated), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
2172
2172
|
}
|
|
2173
|
-
},
|
|
2173
|
+
}, Ge = (e) => {
|
|
2174
2174
|
queueMicrotask(() => {
|
|
2175
2175
|
e();
|
|
2176
2176
|
});
|
|
2177
|
-
},
|
|
2177
|
+
}, z = (e) => {
|
|
2178
2178
|
e();
|
|
2179
|
-
},
|
|
2179
|
+
}, Ke = class {
|
|
2180
2180
|
viewportStore;
|
|
2181
2181
|
onBeforeUpdated;
|
|
2182
2182
|
onAfterUpdated;
|
|
@@ -2199,7 +2199,7 @@ var ne = (e, t) => {
|
|
|
2199
2199
|
createViewportCoords(e) {
|
|
2200
2200
|
return this.viewportStore.createViewportCoords(e);
|
|
2201
2201
|
}
|
|
2202
|
-
},
|
|
2202
|
+
}, qe = (e, t) => Symbol.iterator in e ? {
|
|
2203
2203
|
minContentScale: t.focus.minContentScale,
|
|
2204
2204
|
nodes: e,
|
|
2205
2205
|
contentPadding: t.focus.contentPadding,
|
|
@@ -2209,15 +2209,15 @@ var ne = (e, t) => {
|
|
|
2209
2209
|
nodes: e.nodes ?? [],
|
|
2210
2210
|
contentPadding: e.contentPadding ?? t.focus.contentPadding,
|
|
2211
2211
|
animationDuration: e.animationDuration ?? t.focus.animationDuration
|
|
2212
|
-
},
|
|
2212
|
+
}, Je = (e, t, n) => ({
|
|
2213
2213
|
scale: e.scale,
|
|
2214
2214
|
x: e.x + e.scale * t,
|
|
2215
2215
|
y: e.y + e.scale * n
|
|
2216
|
-
}),
|
|
2216
|
+
}), Ye = (e, t, n, r) => ({
|
|
2217
2217
|
scale: e.scale * t,
|
|
2218
2218
|
x: e.scale * (1 - t) * n + e.x,
|
|
2219
2219
|
y: e.scale * (1 - t) * r + e.y
|
|
2220
|
-
}),
|
|
2220
|
+
}), Xe = class {
|
|
2221
2221
|
graphStore;
|
|
2222
2222
|
viewportStore;
|
|
2223
2223
|
params;
|
|
@@ -2235,16 +2235,16 @@ var ne = (e, t) => {
|
|
|
2235
2235
|
let { width: n, height: r } = this.viewportStore.getDimensions(), i = {
|
|
2236
2236
|
x: n / 2,
|
|
2237
2237
|
y: r / 2
|
|
2238
|
-
}, a = this.viewportStore.getViewportMatrix(), o = this.viewportStore.createViewportCoords(e), s =
|
|
2238
|
+
}, a = this.viewportStore.getViewportMatrix(), o = this.viewportStore.createViewportCoords(e), s = Je(a, o.x - i.x, o.y - i.y), c = t?.contentScale;
|
|
2239
2239
|
if (c !== void 0) {
|
|
2240
2240
|
let e = 1 / c;
|
|
2241
|
-
s =
|
|
2241
|
+
s = Ye(s, e / a.scale, i.x, i.y);
|
|
2242
2242
|
}
|
|
2243
2243
|
let l = t?.animationDuration ?? 0;
|
|
2244
2244
|
l > 0 ? this.animateNavigation(a, s, l) : this.viewportStore.patchViewportMatrix(s);
|
|
2245
2245
|
}
|
|
2246
2246
|
focus(e) {
|
|
2247
|
-
let t =
|
|
2247
|
+
let t = qe(e ?? {}, this.params);
|
|
2248
2248
|
this.params.focus.schedule(() => {
|
|
2249
2249
|
this.navigate(t);
|
|
2250
2250
|
});
|
|
@@ -2286,25 +2286,25 @@ var ne = (e, t) => {
|
|
|
2286
2286
|
};
|
|
2287
2287
|
this.win.requestAnimationFrame(a);
|
|
2288
2288
|
}
|
|
2289
|
-
},
|
|
2289
|
+
}, Ze = (e, t, n) => {
|
|
2290
2290
|
let r = new h();
|
|
2291
|
-
return new d(new
|
|
2291
|
+
return new d(new Ue(r), new Ke(t), new We(r, new a(r, t, e), {
|
|
2292
2292
|
nodes: {
|
|
2293
|
-
centerFn:
|
|
2293
|
+
centerFn: ie,
|
|
2294
2294
|
priorityFn: () => 0
|
|
2295
2295
|
},
|
|
2296
2296
|
edges: {
|
|
2297
|
-
shapeFactory: () => new
|
|
2297
|
+
shapeFactory: () => new L(),
|
|
2298
2298
|
priorityFn: () => 0
|
|
2299
2299
|
},
|
|
2300
2300
|
ports: { direction: 0 }
|
|
2301
|
-
}), new
|
|
2301
|
+
}), new Xe(r, t, { focus: {
|
|
2302
2302
|
contentPadding: 0,
|
|
2303
2303
|
minContentScale: 0,
|
|
2304
|
-
schedule:
|
|
2304
|
+
schedule: z,
|
|
2305
2305
|
animationDuration: 0
|
|
2306
2306
|
} }, n));
|
|
2307
|
-
},
|
|
2307
|
+
}, B = Symbol(), Qe = class e {
|
|
2308
2308
|
canvas;
|
|
2309
2309
|
window;
|
|
2310
2310
|
pointInsideVerifier;
|
|
@@ -2321,11 +2321,11 @@ var ne = (e, t) => {
|
|
|
2321
2321
|
onPortMouseDown = (e) => {
|
|
2322
2322
|
let t = e;
|
|
2323
2323
|
if (!this.params.mouseDownEventVerifier(t)) return;
|
|
2324
|
-
let n = e.currentTarget, r = this.canvas.graph.findPortIdsByElement(n)
|
|
2325
|
-
this.params.onPointerDownVerifier(
|
|
2324
|
+
let n = e.currentTarget, r = this.canvas.graph.findPortIdsByElement(n), i = this.params.grabbedPortIdResolver(r);
|
|
2325
|
+
i !== null && this.params.onPointerDownVerifier(i, {
|
|
2326
2326
|
x: t.clientX,
|
|
2327
2327
|
y: t.clientY
|
|
2328
|
-
}) && (this.eventTagger.tag(e,
|
|
2328
|
+
}) && (this.eventTagger.tag(e, B), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 }));
|
|
2329
2329
|
};
|
|
2330
2330
|
onWindowMouseMove = (e) => {
|
|
2331
2331
|
if (!this.pointInsideVerifier.verify(e.clientX, e.clientY)) {
|
|
@@ -2350,7 +2350,7 @@ var ne = (e, t) => {
|
|
|
2350
2350
|
this.params.onPointerDownVerifier(i, {
|
|
2351
2351
|
x: n.clientX,
|
|
2352
2352
|
y: n.clientY
|
|
2353
|
-
}) && (this.eventTagger.tag(e,
|
|
2353
|
+
}) && (this.eventTagger.tag(e, B), this.window.addEventListener("touchmove", this.onWindowTouchMove, { passive: !0 }), this.window.addEventListener("touchend", this.onWindowTouchFinish, { passive: !0 }), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, { passive: !0 }));
|
|
2354
2354
|
};
|
|
2355
2355
|
onWindowTouchMove = (e) => {
|
|
2356
2356
|
let t = e.touches[0];
|
|
@@ -2398,16 +2398,16 @@ var ne = (e, t) => {
|
|
|
2398
2398
|
removeWindowTouchListeners() {
|
|
2399
2399
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2400
2400
|
}
|
|
2401
|
-
},
|
|
2401
|
+
}, V = Symbol(), $e = class {
|
|
2402
2402
|
has(e, t) {
|
|
2403
|
-
let n = e[
|
|
2403
|
+
let n = e[V];
|
|
2404
2404
|
return n !== void 0 && n.has(t);
|
|
2405
2405
|
}
|
|
2406
2406
|
tag(e, t) {
|
|
2407
|
-
let n = e, r = n[
|
|
2408
|
-
r === void 0 ? n[
|
|
2407
|
+
let n = e, r = n[V];
|
|
2408
|
+
r === void 0 ? n[V] = /* @__PURE__ */ new Set([t]) : r.add(t);
|
|
2409
2409
|
}
|
|
2410
|
-
},
|
|
2410
|
+
}, H = Symbol(), U = class {
|
|
2411
2411
|
window;
|
|
2412
2412
|
pointInsideVerifier;
|
|
2413
2413
|
onSelected;
|
|
@@ -2488,10 +2488,10 @@ var ne = (e, t) => {
|
|
|
2488
2488
|
let r = Math.sqrt(e * e + t * t);
|
|
2489
2489
|
this.movedDistance += r, this.movedDistance > this.movementThreshold && n();
|
|
2490
2490
|
}
|
|
2491
|
-
},
|
|
2491
|
+
}, W = (e, t) => ({
|
|
2492
2492
|
from: e.isDirect ? e.staticPortId : t,
|
|
2493
2493
|
to: e.isDirect ? t : e.staticPortId
|
|
2494
|
-
}),
|
|
2494
|
+
}), et = class {
|
|
2495
2495
|
graph;
|
|
2496
2496
|
connectionAllowedVerifier;
|
|
2497
2497
|
constructor(e, t) {
|
|
@@ -2502,7 +2502,7 @@ var ne = (e, t) => {
|
|
|
2502
2502
|
return this.graph.getAllPortIds().forEach((i) => {
|
|
2503
2503
|
let { element: a, direction: o, nodeId: s } = this.graph.getPort(i), { x: c, y: l } = this.graph.getNode(s);
|
|
2504
2504
|
if (c === null || l === null) return;
|
|
2505
|
-
let u =
|
|
2505
|
+
let u = W(e, i);
|
|
2506
2506
|
if (!this.connectionAllowedVerifier(u)) return;
|
|
2507
2507
|
let { top: d, left: f, width: p, height: m } = a.getBoundingClientRect(), h = {
|
|
2508
2508
|
x: f + p / 2,
|
|
@@ -2511,7 +2511,7 @@ var ne = (e, t) => {
|
|
|
2511
2511
|
v < n && (n = v, t = o);
|
|
2512
2512
|
}), t;
|
|
2513
2513
|
}
|
|
2514
|
-
},
|
|
2514
|
+
}, tt = class {
|
|
2515
2515
|
direction;
|
|
2516
2516
|
constructor(e) {
|
|
2517
2517
|
this.direction = e;
|
|
@@ -2519,7 +2519,7 @@ var ne = (e, t) => {
|
|
|
2519
2519
|
resolve() {
|
|
2520
2520
|
return this.direction;
|
|
2521
2521
|
}
|
|
2522
|
-
},
|
|
2522
|
+
}, G = (e) => e.length > 0 ? e[0] : null, nt = class e {
|
|
2523
2523
|
canvas;
|
|
2524
2524
|
element;
|
|
2525
2525
|
window;
|
|
@@ -2542,12 +2542,12 @@ var ne = (e, t) => {
|
|
|
2542
2542
|
t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
|
|
2543
2543
|
};
|
|
2544
2544
|
onMouseDown = (e) => {
|
|
2545
|
-
if (this.eventTagger.has(e,
|
|
2545
|
+
if (this.eventTagger.has(e, B)) return;
|
|
2546
2546
|
let t = e;
|
|
2547
2547
|
if (!this.params.mouseDownEventVerifier(t)) return;
|
|
2548
2548
|
let n = e.currentTarget, r = this.graph.findNodeIdByElement(n), i = this.graph.getNode(r);
|
|
2549
2549
|
if (!this.params.nodeDragVerifier(r)) return;
|
|
2550
|
-
this.eventTagger.tag(e,
|
|
2550
|
+
this.eventTagger.tag(e, B), this.params.onNodeDragStarted(r);
|
|
2551
2551
|
let a = this.calculateContentPoint({
|
|
2552
2552
|
x: t.clientX,
|
|
2553
2553
|
y: t.clientY
|
|
@@ -2556,15 +2556,15 @@ var ne = (e, t) => {
|
|
|
2556
2556
|
nodeId: r,
|
|
2557
2557
|
dx: a.x - i.x,
|
|
2558
2558
|
dy: a.y - i.y
|
|
2559
|
-
},
|
|
2559
|
+
}, C(this.element, this.params.dragCursor), this.moveNodeOnTop(r), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 });
|
|
2560
2560
|
};
|
|
2561
2561
|
onTouchStart = (e) => {
|
|
2562
|
-
if (this.eventTagger.has(e,
|
|
2562
|
+
if (this.eventTagger.has(e, B)) return;
|
|
2563
2563
|
let t = e;
|
|
2564
2564
|
if (t.touches.length !== 1) return;
|
|
2565
2565
|
let n = t.touches[0], r = e.currentTarget, i = this.canvas.graph.findNodeIdByElement(r), a = this.graph.getNode(i);
|
|
2566
2566
|
if (!this.params.nodeDragVerifier(i)) return;
|
|
2567
|
-
this.eventTagger.tag(e,
|
|
2567
|
+
this.eventTagger.tag(e, B);
|
|
2568
2568
|
let o = this.calculateContentPoint({
|
|
2569
2569
|
x: n.clientX,
|
|
2570
2570
|
y: n.clientY
|
|
@@ -2641,7 +2641,7 @@ var ne = (e, t) => {
|
|
|
2641
2641
|
}
|
|
2642
2642
|
}
|
|
2643
2643
|
stopMouseDrag() {
|
|
2644
|
-
this.finishDrag(),
|
|
2644
|
+
this.finishDrag(), C(this.element, null), this.removeMouseDragListeners();
|
|
2645
2645
|
}
|
|
2646
2646
|
removeMouseDragListeners() {
|
|
2647
2647
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -2689,7 +2689,7 @@ var ne = (e, t) => {
|
|
|
2689
2689
|
touchesCnt: n,
|
|
2690
2690
|
touches: t
|
|
2691
2691
|
};
|
|
2692
|
-
},
|
|
2692
|
+
}, rt = class e {
|
|
2693
2693
|
canvas;
|
|
2694
2694
|
element;
|
|
2695
2695
|
window;
|
|
@@ -2704,7 +2704,7 @@ var ne = (e, t) => {
|
|
|
2704
2704
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2705
2705
|
};
|
|
2706
2706
|
onMouseDown = (e) => {
|
|
2707
|
-
this.eventTagger.has(e,
|
|
2707
|
+
this.eventTagger.has(e, B) || this.params.mouseDownEventVerifier(e) && (C(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 }), this.startRegisteredTransform());
|
|
2708
2708
|
};
|
|
2709
2709
|
onWindowMouseMove = (e) => {
|
|
2710
2710
|
let t = this.pointInsideVerifier.verify(e.clientX, e.clientY);
|
|
@@ -2726,7 +2726,7 @@ var ne = (e, t) => {
|
|
|
2726
2726
|
}, this.params.scaleWheelFinishTimeout);
|
|
2727
2727
|
};
|
|
2728
2728
|
onTouchStart = (e) => {
|
|
2729
|
-
if (!this.eventTagger.has(e,
|
|
2729
|
+
if (!this.eventTagger.has(e, B)) {
|
|
2730
2730
|
if (this.prevTouches !== null) {
|
|
2731
2731
|
this.prevTouches = K(e);
|
|
2732
2732
|
return;
|
|
@@ -2765,7 +2765,7 @@ var ne = (e, t) => {
|
|
|
2765
2765
|
new e(t, n, r, i, a, o);
|
|
2766
2766
|
}
|
|
2767
2767
|
moveViewport(e, t) {
|
|
2768
|
-
let n = this.viewport.getViewportMatrix(), r =
|
|
2768
|
+
let n = this.viewport.getViewportMatrix(), r = Je(n, e, t), { width: i, height: a } = this.viewport.getDimensions(), o = this.params.transformPreprocessor({
|
|
2769
2769
|
prevTransform: n,
|
|
2770
2770
|
nextTransform: r,
|
|
2771
2771
|
viewport: {
|
|
@@ -2776,7 +2776,7 @@ var ne = (e, t) => {
|
|
|
2776
2776
|
this.performTransform(o);
|
|
2777
2777
|
}
|
|
2778
2778
|
scaleViewport(e, t, n) {
|
|
2779
|
-
let r = this.canvas.viewport.getViewportMatrix(), i =
|
|
2779
|
+
let r = this.canvas.viewport.getViewportMatrix(), i = Ye(r, e, t, n), { width: a, height: o } = this.viewport.getDimensions(), s = this.params.transformPreprocessor({
|
|
2780
2780
|
prevTransform: r,
|
|
2781
2781
|
nextTransform: i,
|
|
2782
2782
|
viewport: {
|
|
@@ -2787,7 +2787,7 @@ var ne = (e, t) => {
|
|
|
2787
2787
|
this.performTransform(s);
|
|
2788
2788
|
}
|
|
2789
2789
|
stopMouseDrag() {
|
|
2790
|
-
|
|
2790
|
+
C(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
2791
2791
|
}
|
|
2792
2792
|
removeMouseDragListeners() {
|
|
2793
2793
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -2818,7 +2818,7 @@ var ne = (e, t) => {
|
|
|
2818
2818
|
});
|
|
2819
2819
|
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(r), this.params.onResizeTransformFinished();
|
|
2820
2820
|
}
|
|
2821
|
-
},
|
|
2821
|
+
}, it = class e {
|
|
2822
2822
|
canvas;
|
|
2823
2823
|
element;
|
|
2824
2824
|
window;
|
|
@@ -2871,7 +2871,7 @@ var ne = (e, t) => {
|
|
|
2871
2871
|
this.scheduleLoadAreaAroundViewport(), r.onTransformFinished();
|
|
2872
2872
|
}
|
|
2873
2873
|
};
|
|
2874
|
-
|
|
2874
|
+
rt.configure(e, this.element, this.window, this.pointInsideVerifier, o, c), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2875
2875
|
}
|
|
2876
2876
|
static configure(t, n, r, i, a, o, s, c) {
|
|
2877
2877
|
new e(t, n, r, i, a, o, s, c);
|
|
@@ -2896,21 +2896,21 @@ var ne = (e, t) => {
|
|
|
2896
2896
|
height: u
|
|
2897
2897
|
});
|
|
2898
2898
|
}
|
|
2899
|
-
},
|
|
2899
|
+
}, at = () => {
|
|
2900
2900
|
let e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2901
2901
|
return e.style.position = "absolute", e.style.inset = "0", e;
|
|
2902
|
-
},
|
|
2902
|
+
}, ot = () => {
|
|
2903
2903
|
let e = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2904
2904
|
return e.setAttribute("fill", "url(#pattern)"), e;
|
|
2905
|
-
},
|
|
2905
|
+
}, st = () => {
|
|
2906
2906
|
let e = document.createElementNS("http://www.w3.org/2000/svg", "pattern");
|
|
2907
2907
|
return e.setAttribute("id", "pattern"), e;
|
|
2908
|
-
},
|
|
2908
|
+
}, ct = class e {
|
|
2909
2909
|
canvas;
|
|
2910
2910
|
backgroundHost;
|
|
2911
|
-
svg =
|
|
2912
|
-
patternRenderingRectangle =
|
|
2913
|
-
pattern =
|
|
2911
|
+
svg = at();
|
|
2912
|
+
patternRenderingRectangle = ot();
|
|
2913
|
+
pattern = st();
|
|
2914
2914
|
patternContent;
|
|
2915
2915
|
tileWidth;
|
|
2916
2916
|
tileHeight;
|
|
@@ -2945,7 +2945,7 @@ var ne = (e, t) => {
|
|
|
2945
2945
|
this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${r}`);
|
|
2946
2946
|
}
|
|
2947
2947
|
}
|
|
2948
|
-
},
|
|
2948
|
+
}, lt = class e {
|
|
2949
2949
|
canvas;
|
|
2950
2950
|
overlayLayer;
|
|
2951
2951
|
viewportStore;
|
|
@@ -2959,7 +2959,7 @@ var ne = (e, t) => {
|
|
|
2959
2959
|
this.params.onAfterEdgeCreated(e);
|
|
2960
2960
|
};
|
|
2961
2961
|
constructor(e, t, n, r, i, a, o) {
|
|
2962
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas =
|
|
2962
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas = Ze(this.overlayLayer, this.viewportStore, this.window);
|
|
2963
2963
|
let s = {
|
|
2964
2964
|
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
2965
2965
|
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
@@ -2976,9 +2976,10 @@ var ne = (e, t) => {
|
|
|
2976
2976
|
onPointerOutside: () => {
|
|
2977
2977
|
let e = this.edgeInProgress;
|
|
2978
2978
|
this.resetDragState(), this.params.onEdgeCreationInterrupted(e);
|
|
2979
|
-
}
|
|
2979
|
+
},
|
|
2980
|
+
grabbedPortIdResolver: this.params.grabbedPortIdResolver
|
|
2980
2981
|
};
|
|
2981
|
-
|
|
2982
|
+
Qe.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
|
|
2982
2983
|
}
|
|
2983
2984
|
static configure(t, n, r, i, a, o, s) {
|
|
2984
2985
|
new e(t, n, r, i, a, o, s);
|
|
@@ -2991,7 +2992,7 @@ var ne = (e, t) => {
|
|
|
2991
2992
|
x: t.x - s.x,
|
|
2992
2993
|
y: t.y - s.y
|
|
2993
2994
|
}), u = {
|
|
2994
|
-
overlayNodeId:
|
|
2995
|
+
overlayNodeId: T.StaticNodeId,
|
|
2995
2996
|
portCoords: c,
|
|
2996
2997
|
portDirection: r.direction
|
|
2997
2998
|
}, d = n === "direct";
|
|
@@ -3003,26 +3004,26 @@ var ne = (e, t) => {
|
|
|
3003
3004
|
cursor: t,
|
|
3004
3005
|
...this.edgeInProgress
|
|
3005
3006
|
}), p = {
|
|
3006
|
-
overlayNodeId:
|
|
3007
|
+
overlayNodeId: T.DraggingNodeId,
|
|
3007
3008
|
portCoords: l,
|
|
3008
3009
|
portDirection: f ?? r.direction
|
|
3009
3010
|
}, [m, h] = d ? [u, p] : [p, u];
|
|
3010
|
-
this.overlayCanvas.addNode(
|
|
3011
|
+
this.overlayCanvas.addNode(w(m)), this.overlayCanvas.addNode(w(h)), this.overlayCanvas.addEdge({
|
|
3011
3012
|
from: m.overlayNodeId,
|
|
3012
3013
|
to: h.overlayNodeId,
|
|
3013
|
-
shape: this.params.edgeShapeFactory(
|
|
3014
|
+
shape: this.params.edgeShapeFactory(T.EdgeId)
|
|
3014
3015
|
});
|
|
3015
3016
|
}
|
|
3016
3017
|
resetDragState() {
|
|
3017
3018
|
this.edgeInProgress = null, this.overlayCanvas.clear();
|
|
3018
3019
|
}
|
|
3019
3020
|
tryCreateConnection(e) {
|
|
3020
|
-
let t =
|
|
3021
|
+
let t = re(this.canvas.graph, e, this.params.releasedPortIdResolver);
|
|
3021
3022
|
if (t === null) {
|
|
3022
3023
|
this.params.onEdgeCreationInterrupted(this.edgeInProgress);
|
|
3023
3024
|
return;
|
|
3024
3025
|
}
|
|
3025
|
-
let n =
|
|
3026
|
+
let n = W(this.edgeInProgress, t), r = this.params.connectionAllowedVerifier(n), i = this.params.connectionPreprocessor({
|
|
3026
3027
|
from: n.from,
|
|
3027
3028
|
to: n.to
|
|
3028
3029
|
});
|
|
@@ -3036,12 +3037,12 @@ var ne = (e, t) => {
|
|
|
3036
3037
|
cursor: e,
|
|
3037
3038
|
...this.edgeInProgress
|
|
3038
3039
|
});
|
|
3039
|
-
this.overlayCanvas.updateNode(
|
|
3040
|
+
this.overlayCanvas.updateNode(T.DraggingNodeId, {
|
|
3040
3041
|
x: n.x,
|
|
3041
3042
|
y: n.y
|
|
3042
|
-
}).updatePort(
|
|
3043
|
+
}).updatePort(T.DraggingNodeId, { direction: r });
|
|
3043
3044
|
}
|
|
3044
|
-
},
|
|
3045
|
+
}, ut = class e {
|
|
3045
3046
|
canvas;
|
|
3046
3047
|
overlayLayer;
|
|
3047
3048
|
viewportStore;
|
|
@@ -3056,7 +3057,7 @@ var ne = (e, t) => {
|
|
|
3056
3057
|
this.params.onAfterEdgeReattached(e);
|
|
3057
3058
|
};
|
|
3058
3059
|
constructor(e, t, n, r, i, a, o) {
|
|
3059
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas =
|
|
3060
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas = Ze(this.overlayLayer, this.viewportStore, this.window);
|
|
3060
3061
|
let s = {
|
|
3061
3062
|
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
3062
3063
|
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
@@ -3076,9 +3077,10 @@ var ne = (e, t) => {
|
|
|
3076
3077
|
shape: e.shape,
|
|
3077
3078
|
priority: e.priority
|
|
3078
3079
|
});
|
|
3079
|
-
}
|
|
3080
|
+
},
|
|
3081
|
+
grabbedPortIdResolver: this.params.grabbedPortIdResolver
|
|
3080
3082
|
};
|
|
3081
|
-
|
|
3083
|
+
Qe.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
|
|
3082
3084
|
}
|
|
3083
3085
|
static configure(t, n, r, i, a, o, s) {
|
|
3084
3086
|
new e(t, n, r, i, a, o, s);
|
|
@@ -3109,21 +3111,21 @@ var ne = (e, t) => {
|
|
|
3109
3111
|
priority: r.priority
|
|
3110
3112
|
}, this.canvas.removeEdge(n);
|
|
3111
3113
|
let m = {
|
|
3112
|
-
overlayNodeId:
|
|
3114
|
+
overlayNodeId: T.StaticNodeId,
|
|
3113
3115
|
portCoords: f,
|
|
3114
3116
|
portDirection: c.direction
|
|
3115
3117
|
}, h = this.params.draggingPortDirectionResolver.resolve({
|
|
3116
3118
|
cursor: t,
|
|
3117
3119
|
...this.edgeInProgress
|
|
3118
3120
|
}), g = {
|
|
3119
|
-
overlayNodeId:
|
|
3121
|
+
overlayNodeId: T.DraggingNodeId,
|
|
3120
3122
|
portCoords: p,
|
|
3121
3123
|
portDirection: h ?? s.direction
|
|
3122
3124
|
}, [_, v] = a ? [m, g] : [g, m];
|
|
3123
|
-
this.overlayCanvas.addNode(
|
|
3124
|
-
let y = this.params.draggingEdgeShapeFactory === null ? r.shape : this.params.draggingEdgeShapeFactory(
|
|
3125
|
+
this.overlayCanvas.addNode(w(_)), this.overlayCanvas.addNode(w(v));
|
|
3126
|
+
let y = this.params.draggingEdgeShapeFactory === null ? r.shape : this.params.draggingEdgeShapeFactory(T.EdgeId);
|
|
3125
3127
|
return this.overlayCanvas.addEdge({
|
|
3126
|
-
id:
|
|
3128
|
+
id: T.EdgeId,
|
|
3127
3129
|
from: _.overlayNodeId,
|
|
3128
3130
|
to: v.overlayNodeId,
|
|
3129
3131
|
shape: y
|
|
@@ -3140,14 +3142,14 @@ var ne = (e, t) => {
|
|
|
3140
3142
|
cursor: e,
|
|
3141
3143
|
...this.edgeInProgress
|
|
3142
3144
|
});
|
|
3143
|
-
this.overlayCanvas.updateNode(
|
|
3145
|
+
this.overlayCanvas.updateNode(T.DraggingNodeId, {
|
|
3144
3146
|
x: r.x,
|
|
3145
3147
|
y: r.y
|
|
3146
|
-
}).updatePort(
|
|
3148
|
+
}).updatePort(T.DraggingNodeId, { direction: i });
|
|
3147
3149
|
}
|
|
3148
3150
|
tryCreateConnection(e) {
|
|
3149
|
-
let t =
|
|
3150
|
-
if (this.overlayCanvas.removeEdge(
|
|
3151
|
+
let t = re(this.canvas.graph, e, this.params.releasedPortIdResolver);
|
|
3152
|
+
if (this.overlayCanvas.removeEdge(T.EdgeId), t === null) {
|
|
3151
3153
|
let e = this.draggingEdgePayload;
|
|
3152
3154
|
this.params.onEdgeReattachInterrupted({
|
|
3153
3155
|
id: e.id,
|
|
@@ -3158,7 +3160,7 @@ var ne = (e, t) => {
|
|
|
3158
3160
|
});
|
|
3159
3161
|
return;
|
|
3160
3162
|
}
|
|
3161
|
-
let { from: n, to: r } =
|
|
3163
|
+
let { from: n, to: r } = W(this.edgeInProgress, t), i = this.draggingEdgePayload, a = {
|
|
3162
3164
|
id: i.id,
|
|
3163
3165
|
from: n,
|
|
3164
3166
|
to: r,
|
|
@@ -3180,7 +3182,7 @@ var ne = (e, t) => {
|
|
|
3180
3182
|
});
|
|
3181
3183
|
}
|
|
3182
3184
|
}
|
|
3183
|
-
},
|
|
3185
|
+
}, dt = class e {
|
|
3184
3186
|
applier;
|
|
3185
3187
|
trigger;
|
|
3186
3188
|
constructor(e, t) {
|
|
@@ -3191,7 +3193,7 @@ var ne = (e, t) => {
|
|
|
3191
3193
|
static configure(t, n) {
|
|
3192
3194
|
new e(t, n);
|
|
3193
3195
|
}
|
|
3194
|
-
},
|
|
3196
|
+
}, ft = class e {
|
|
3195
3197
|
graph;
|
|
3196
3198
|
applier;
|
|
3197
3199
|
defererFn;
|
|
@@ -3216,7 +3218,7 @@ var ne = (e, t) => {
|
|
|
3216
3218
|
scheduleApply() {
|
|
3217
3219
|
this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
|
|
3218
3220
|
}
|
|
3219
|
-
},
|
|
3221
|
+
}, pt = class {
|
|
3220
3222
|
canvas;
|
|
3221
3223
|
layoutAlgorithm;
|
|
3222
3224
|
params;
|
|
@@ -3232,23 +3234,23 @@ var ne = (e, t) => {
|
|
|
3232
3234
|
this.params.staticNodeResolver(t) || this.canvas.updateNode(t, e);
|
|
3233
3235
|
}), this.params.onAfterApplied();
|
|
3234
3236
|
}
|
|
3235
|
-
},
|
|
3237
|
+
}, mt = class {
|
|
3236
3238
|
static configure(e, t) {
|
|
3237
|
-
let n = t.applyOn, r = new
|
|
3239
|
+
let n = t.applyOn, r = new pt(e, t.algorithm, {
|
|
3238
3240
|
staticNodeResolver: t.staticNodeResolver,
|
|
3239
3241
|
onBeforeApplied: t.onBeforeApplied,
|
|
3240
3242
|
onAfterApplied: t.onAfterApplied
|
|
3241
3243
|
});
|
|
3242
3244
|
switch (n.type) {
|
|
3243
3245
|
case "trigger":
|
|
3244
|
-
|
|
3246
|
+
dt.configure(r, n.trigger);
|
|
3245
3247
|
break;
|
|
3246
3248
|
case "topologyChangeSchedule":
|
|
3247
|
-
|
|
3249
|
+
ft.configure(e.graph, r, n.schedule);
|
|
3248
3250
|
break;
|
|
3249
3251
|
}
|
|
3250
3252
|
}
|
|
3251
|
-
},
|
|
3253
|
+
}, ht = class {
|
|
3252
3254
|
win;
|
|
3253
3255
|
callback;
|
|
3254
3256
|
previousTimeStamp = void 0;
|
|
@@ -3263,7 +3265,7 @@ var ne = (e, t) => {
|
|
|
3263
3265
|
constructor(e, t) {
|
|
3264
3266
|
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
3265
3267
|
}
|
|
3266
|
-
},
|
|
3268
|
+
}, gt = class {
|
|
3267
3269
|
canvas;
|
|
3268
3270
|
layoutAlgorithm;
|
|
3269
3271
|
params;
|
|
@@ -3280,30 +3282,29 @@ var ne = (e, t) => {
|
|
|
3280
3282
|
this.params.staticNodeResolver(t) || this.canvas.updateNode(t, e);
|
|
3281
3283
|
}), this.params.onAfterApplied();
|
|
3282
3284
|
}
|
|
3283
|
-
},
|
|
3284
|
-
win;
|
|
3285
|
+
}, _t = class e {
|
|
3285
3286
|
applier;
|
|
3286
3287
|
step = (e) => {
|
|
3287
3288
|
this.applier.apply(e);
|
|
3288
3289
|
};
|
|
3289
3290
|
constructor(e, t, n) {
|
|
3290
|
-
this.
|
|
3291
|
+
this.applier = new gt(e, t.algorithm, {
|
|
3291
3292
|
staticNodeResolver: t.staticNodeResolver,
|
|
3292
3293
|
onBeforeApplied: t.onBeforeApplied,
|
|
3293
3294
|
onAfterApplied: t.onAfterApplied
|
|
3294
|
-
}), new
|
|
3295
|
+
}), new ht(n, this.step);
|
|
3295
3296
|
}
|
|
3296
3297
|
static configure(t, n, r) {
|
|
3297
3298
|
new e(t, n, r);
|
|
3298
3299
|
}
|
|
3299
|
-
},
|
|
3300
|
+
}, vt = class e {
|
|
3300
3301
|
canvas;
|
|
3301
3302
|
window;
|
|
3302
3303
|
pointInsideVerifier;
|
|
3303
3304
|
eventTagger;
|
|
3304
3305
|
configurator;
|
|
3305
3306
|
onNodeSelected;
|
|
3306
|
-
eventHandledTag =
|
|
3307
|
+
eventHandledTag = H;
|
|
3307
3308
|
onAfterNodeAdded = (e) => {
|
|
3308
3309
|
let { element: t } = this.canvas.graph.getNode(e);
|
|
3309
3310
|
this.configurator.enable(t);
|
|
@@ -3319,7 +3320,7 @@ var ne = (e, t) => {
|
|
|
3319
3320
|
});
|
|
3320
3321
|
};
|
|
3321
3322
|
constructor(e, t, n, r, i) {
|
|
3322
|
-
this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onNodeSelected = i.onNodeSelected, this.configurator = new
|
|
3323
|
+
this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onNodeSelected = i.onNodeSelected, this.configurator = new U(this.window, this.pointInsideVerifier, {
|
|
3323
3324
|
onSelected: (e, t) => {
|
|
3324
3325
|
let n = this.canvas.graph.findNodeIdByElement(e);
|
|
3325
3326
|
this.eventTagger.tag(t, this.eventHandledTag), this.onNodeSelected(n);
|
|
@@ -3332,13 +3333,13 @@ var ne = (e, t) => {
|
|
|
3332
3333
|
static configure(t, n, r, i, a) {
|
|
3333
3334
|
new e(t, n, r, i, a);
|
|
3334
3335
|
}
|
|
3335
|
-
},
|
|
3336
|
+
}, yt = class e {
|
|
3336
3337
|
canvas;
|
|
3337
3338
|
window;
|
|
3338
3339
|
pointInsideVerifier;
|
|
3339
3340
|
eventTagger;
|
|
3340
3341
|
configurator;
|
|
3341
|
-
eventHandledTag =
|
|
3342
|
+
eventHandledTag = H;
|
|
3342
3343
|
onEdgeSelected;
|
|
3343
3344
|
onAfterEdgeAdded = (e) => {
|
|
3344
3345
|
let { shape: t } = this.canvas.graph.getEdge(e);
|
|
@@ -3355,7 +3356,7 @@ var ne = (e, t) => {
|
|
|
3355
3356
|
});
|
|
3356
3357
|
};
|
|
3357
3358
|
constructor(e, t, n, r, i) {
|
|
3358
|
-
this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onEdgeSelected = i.onEdgeSelected, this.configurator = new
|
|
3359
|
+
this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onEdgeSelected = i.onEdgeSelected, this.configurator = new U(this.window, this.pointInsideVerifier, {
|
|
3359
3360
|
onSelected: (e, t) => {
|
|
3360
3361
|
let n = this.canvas.graph.findEdgeIdByElement(e);
|
|
3361
3362
|
this.eventTagger.tag(t, this.eventHandledTag), this.onEdgeSelected(n);
|
|
@@ -3368,7 +3369,7 @@ var ne = (e, t) => {
|
|
|
3368
3369
|
static configure(t, n, r, i, a) {
|
|
3369
3370
|
new e(t, n, r, i, a);
|
|
3370
3371
|
}
|
|
3371
|
-
},
|
|
3372
|
+
}, bt = class e {
|
|
3372
3373
|
canvas;
|
|
3373
3374
|
element;
|
|
3374
3375
|
window;
|
|
@@ -3376,9 +3377,9 @@ var ne = (e, t) => {
|
|
|
3376
3377
|
eventTagger;
|
|
3377
3378
|
configurator;
|
|
3378
3379
|
onCanvasSelected;
|
|
3379
|
-
eventHandledTag =
|
|
3380
|
+
eventHandledTag = H;
|
|
3380
3381
|
constructor(e, t, n, r, i, a) {
|
|
3381
|
-
this.canvas = e, this.element = t, this.window = n, this.pointInsideVerifier = r, this.eventTagger = i, this.onCanvasSelected = a.onCanvasSelected, this.configurator = new
|
|
3382
|
+
this.canvas = e, this.element = t, this.window = n, this.pointInsideVerifier = r, this.eventTagger = i, this.onCanvasSelected = a.onCanvasSelected, this.configurator = new U(this.window, this.pointInsideVerifier, {
|
|
3382
3383
|
onSelected: (e, t) => {
|
|
3383
3384
|
this.eventTagger.has(t, this.eventHandledTag) || this.onCanvasSelected();
|
|
3384
3385
|
},
|
|
@@ -3392,29 +3393,29 @@ var ne = (e, t) => {
|
|
|
3392
3393
|
static configure(t, n, r, i, a, o) {
|
|
3393
3394
|
new e(t, n, r, i, a, o);
|
|
3394
3395
|
}
|
|
3395
|
-
},
|
|
3396
|
+
}, xt = () => {
|
|
3396
3397
|
let e = document.createElement("div");
|
|
3397
3398
|
return e.style.width = "100%", e.style.height = "100%", e.style.position = "relative", e;
|
|
3398
|
-
},
|
|
3399
|
+
}, St = () => {
|
|
3399
3400
|
let e = document.createElement("div");
|
|
3400
3401
|
return e.style.position = "absolute", e.style.inset = "0", e;
|
|
3401
|
-
},
|
|
3402
|
-
let e =
|
|
3402
|
+
}, Ct = () => {
|
|
3403
|
+
let e = St();
|
|
3403
3404
|
return e.style.pointerEvents = "none", e;
|
|
3404
|
-
},
|
|
3405
|
+
}, wt = class {
|
|
3405
3406
|
element;
|
|
3406
|
-
background =
|
|
3407
|
-
main =
|
|
3408
|
-
overlayConnectablePorts =
|
|
3409
|
-
overlayDraggableEdges =
|
|
3410
|
-
host =
|
|
3407
|
+
background = St();
|
|
3408
|
+
main = St();
|
|
3409
|
+
overlayConnectablePorts = Ct();
|
|
3410
|
+
overlayDraggableEdges = Ct();
|
|
3411
|
+
host = xt();
|
|
3411
3412
|
constructor(e) {
|
|
3412
3413
|
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);
|
|
3413
3414
|
}
|
|
3414
3415
|
destroy() {
|
|
3415
3416
|
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);
|
|
3416
3417
|
}
|
|
3417
|
-
},
|
|
3418
|
+
}, q = Object.freeze({
|
|
3418
3419
|
seed: "HTMLGraph is awesome",
|
|
3419
3420
|
maxTimeDeltaSec: .01,
|
|
3420
3421
|
nodeCharge: 1e5,
|
|
@@ -3428,14 +3429,14 @@ var ne = (e, t) => {
|
|
|
3428
3429
|
nodeForceCoefficient: 1,
|
|
3429
3430
|
barnesHutAreaRadiusThreshold: .01,
|
|
3430
3431
|
barnesHutTheta: 1
|
|
3431
|
-
}),
|
|
3432
|
+
}), J = Object.freeze({
|
|
3432
3433
|
mouseDownEventVerifier: (e) => e.button === 0,
|
|
3433
3434
|
mouseUpEventVerifier: (e) => e.button === 0,
|
|
3434
3435
|
movementThreshold: 10
|
|
3435
|
-
}),
|
|
3436
|
+
}), Y = () => {}, Tt = (e, t, n) => e === "nearest-connectable-port" ? new et(t, n) : typeof e == "number" ? new tt(e) : new tt(void 0), Et = (e) => {
|
|
3436
3437
|
if (typeof e == "function") return e;
|
|
3437
3438
|
switch (e.type) {
|
|
3438
|
-
case "straight": return () => new
|
|
3439
|
+
case "straight": return () => new je({
|
|
3439
3440
|
color: e.color,
|
|
3440
3441
|
width: e.width,
|
|
3441
3442
|
arrowLength: e.arrowLength,
|
|
@@ -3448,7 +3449,7 @@ var ne = (e, t) => {
|
|
|
3448
3449
|
detourDistance: e.detourDistance,
|
|
3449
3450
|
detourDirection: e.detourDirection
|
|
3450
3451
|
});
|
|
3451
|
-
case "orthogonal": return () => new
|
|
3452
|
+
case "orthogonal": return () => new Ne({
|
|
3452
3453
|
color: e.color,
|
|
3453
3454
|
width: e.width,
|
|
3454
3455
|
arrowLength: e.arrowLength,
|
|
@@ -3460,7 +3461,7 @@ var ne = (e, t) => {
|
|
|
3460
3461
|
roundness: e.roundness,
|
|
3461
3462
|
detourDistance: e.detourDistance
|
|
3462
3463
|
});
|
|
3463
|
-
case "direct": return () => new
|
|
3464
|
+
case "direct": return () => new L({
|
|
3464
3465
|
color: e.color,
|
|
3465
3466
|
width: e.width,
|
|
3466
3467
|
arrowLength: e.arrowLength,
|
|
@@ -3470,7 +3471,7 @@ var ne = (e, t) => {
|
|
|
3470
3471
|
sourceOffset: e.sourceOffset,
|
|
3471
3472
|
targetOffset: e.targetOffset
|
|
3472
3473
|
});
|
|
3473
|
-
default: return () => new
|
|
3474
|
+
default: return () => new Ae({
|
|
3474
3475
|
color: e.color,
|
|
3475
3476
|
width: e.width,
|
|
3476
3477
|
arrowLength: e.arrowLength,
|
|
@@ -3484,7 +3485,7 @@ var ne = (e, t) => {
|
|
|
3484
3485
|
detourDirection: e.detourDirection
|
|
3485
3486
|
});
|
|
3486
3487
|
}
|
|
3487
|
-
},
|
|
3488
|
+
}, Dt = (e) => {
|
|
3488
3489
|
let t = e.nodeDragVerifier ?? (() => !0), n = e.moveOnTop !== !1, r = e.moveEdgesOnTop !== !1 && n, i = e.mouse?.dragCursor, a = i === void 0 ? "grab" : i, o = e.mouse?.mouseDownEventVerifier, s = o === void 0 ? (e) => e.button === 0 : o, c = e.mouse?.mouseUpEventVerifier, l = c === void 0 ? (e) => e.button === 0 : c;
|
|
3489
3490
|
return {
|
|
3490
3491
|
moveOnTop: n,
|
|
@@ -3493,12 +3494,12 @@ var ne = (e, t) => {
|
|
|
3493
3494
|
gridSize: e.gridSize ?? null,
|
|
3494
3495
|
mouseDownEventVerifier: s,
|
|
3495
3496
|
mouseUpEventVerifier: l,
|
|
3496
|
-
onNodeDragStarted: e.events?.onNodeDragStarted ??
|
|
3497
|
-
onNodeDrag: e.events?.onNodeDrag ??
|
|
3497
|
+
onNodeDragStarted: e.events?.onNodeDragStarted ?? Y,
|
|
3498
|
+
onNodeDrag: e.events?.onNodeDrag ?? Y,
|
|
3498
3499
|
nodeDragVerifier: t,
|
|
3499
|
-
onNodeDragFinished: e.events?.onNodeDragFinished ??
|
|
3500
|
+
onNodeDragFinished: e.events?.onNodeDragFinished ?? Y
|
|
3500
3501
|
};
|
|
3501
|
-
},
|
|
3502
|
+
}, Ot = (e) => {
|
|
3502
3503
|
let t = e.minX === null ? -Infinity : e.minX, n = e.maxX === null ? Infinity : e.maxX, r = e.minY === null ? -Infinity : e.minY, i = e.maxY === null ? Infinity : e.maxY;
|
|
3503
3504
|
return (e) => {
|
|
3504
3505
|
let a = e.nextTransform.x, o = e.nextTransform.y;
|
|
@@ -3512,7 +3513,7 @@ var ne = (e, t) => {
|
|
|
3512
3513
|
y: o
|
|
3513
3514
|
};
|
|
3514
3515
|
};
|
|
3515
|
-
},
|
|
3516
|
+
}, kt = (e) => {
|
|
3516
3517
|
let t = e.maxContentScale, n = e.minContentScale, r = t === null ? 0 : 1 / t, i = n === null ? Infinity : 1 / n;
|
|
3517
3518
|
return (e) => {
|
|
3518
3519
|
let t = e.prevTransform, n = e.nextTransform, a = n.scale, o = n.x, s = n.y;
|
|
@@ -3532,104 +3533,108 @@ var ne = (e, t) => {
|
|
|
3532
3533
|
y: s
|
|
3533
3534
|
};
|
|
3534
3535
|
};
|
|
3535
|
-
},
|
|
3536
|
+
}, At = (e) => (t) => e.reduce((e, n) => n({
|
|
3536
3537
|
prevTransform: t.prevTransform,
|
|
3537
3538
|
nextTransform: e,
|
|
3538
3539
|
viewport: t.viewport
|
|
3539
|
-
}), t.nextTransform),
|
|
3540
|
+
}), t.nextTransform), jt = (e) => {
|
|
3540
3541
|
if (typeof e == "function") return e;
|
|
3541
3542
|
switch (e.type) {
|
|
3542
|
-
case "scale-limit": return
|
|
3543
|
+
case "scale-limit": return kt({
|
|
3543
3544
|
minContentScale: e.minContentScale ?? 0,
|
|
3544
3545
|
maxContentScale: e.maxContentScale ?? Infinity
|
|
3545
3546
|
});
|
|
3546
|
-
case "shift-limit": return
|
|
3547
|
+
case "shift-limit": return Ot({
|
|
3547
3548
|
minX: e.minX ?? -Infinity,
|
|
3548
3549
|
maxX: e.maxX ?? Infinity,
|
|
3549
3550
|
minY: e.minY ?? -Infinity,
|
|
3550
3551
|
maxY: e.maxY ?? Infinity
|
|
3551
3552
|
});
|
|
3552
3553
|
}
|
|
3553
|
-
},
|
|
3554
|
+
}, Mt = (e) => {
|
|
3554
3555
|
let t = e?.scale?.mouseWheelSensitivity, n = t === void 0 ? 1.2 : t, r = e?.transformPreprocessor, i;
|
|
3555
|
-
i = r === void 0 ? (e) => e.nextTransform : Array.isArray(r) ?
|
|
3556
|
+
i = r === void 0 ? (e) => e.nextTransform : Array.isArray(r) ? At(r.map((e) => jt(e))) : jt(r);
|
|
3556
3557
|
let a = e?.pan?.cursor === void 0 ? "grab" : e.pan.cursor, o = e?.pan?.mouseDownEventVerifier, s = o === void 0 ? (e) => e.button === 0 : o, c = e?.pan?.mouseUpEventVerifier, l = c === void 0 ? (e) => e.button === 0 : c, u = e?.scale?.mouseWheelEventVerifier, d = u === void 0 ? () => !0 : u;
|
|
3557
3558
|
return {
|
|
3558
3559
|
wheelSensitivity: n,
|
|
3559
|
-
onTransformStarted: e?.events?.onTransformStarted ??
|
|
3560
|
-
onTransformFinished: e?.events?.onTransformFinished ??
|
|
3561
|
-
onBeforeTransformChange: e?.events?.onBeforeTransformChange ??
|
|
3562
|
-
onTransformChange: e?.events?.onTransformChange ??
|
|
3560
|
+
onTransformStarted: e?.events?.onTransformStarted ?? Y,
|
|
3561
|
+
onTransformFinished: e?.events?.onTransformFinished ?? Y,
|
|
3562
|
+
onBeforeTransformChange: e?.events?.onBeforeTransformChange ?? Y,
|
|
3563
|
+
onTransformChange: e?.events?.onTransformChange ?? Y,
|
|
3563
3564
|
transformPreprocessor: i,
|
|
3564
3565
|
shiftCursor: a,
|
|
3565
3566
|
mouseDownEventVerifier: s,
|
|
3566
3567
|
mouseUpEventVerifier: l,
|
|
3567
3568
|
mouseWheelEventVerifier: d,
|
|
3568
3569
|
scaleWheelFinishTimeout: e?.scale?.wheelFinishTimeout ?? 500,
|
|
3569
|
-
onResizeTransformStarted: e?.events?.onResizeTransformStarted ??
|
|
3570
|
-
onResizeTransformFinished: e?.events?.onResizeTransformFinished ??
|
|
3570
|
+
onResizeTransformStarted: e?.events?.onResizeTransformStarted ?? Y,
|
|
3571
|
+
onResizeTransformFinished: e?.events?.onResizeTransformFinished ?? Y
|
|
3571
3572
|
};
|
|
3572
|
-
},
|
|
3573
|
+
}, Nt = (e, t) => {
|
|
3573
3574
|
let n = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
3574
3575
|
return n.setAttribute("cx", "0"), n.setAttribute("cy", "0"), n.setAttribute("r", `${e}`), n.setAttribute("fill", `${t}`), n;
|
|
3575
|
-
},
|
|
3576
|
+
}, Pt = (e) => e instanceof SVGElement ? e : Nt(e?.radius ?? 1.5, e?.color ?? "#d8d8d8"), Ft = (e) => {
|
|
3576
3577
|
let t = e.tileDimensions;
|
|
3577
3578
|
return {
|
|
3578
3579
|
tileWidth: t?.width ?? 25,
|
|
3579
3580
|
tileHeight: t?.height ?? 25,
|
|
3580
|
-
renderer:
|
|
3581
|
+
renderer: Pt(e.renderer ?? {}),
|
|
3581
3582
|
maxViewportScale: e.maxViewportScale ?? 10
|
|
3582
3583
|
};
|
|
3583
|
-
},
|
|
3584
|
+
}, X = Object.freeze({
|
|
3584
3585
|
connectionTypeResolver: () => "direct",
|
|
3585
3586
|
connectionPreprocessor: (e) => e,
|
|
3586
3587
|
connectionAllowedVerifier: () => !0,
|
|
3587
3588
|
mouseEventVerifier: (e) => e.button === 0
|
|
3588
|
-
}),
|
|
3589
|
-
let r = e.connectionAllowedVerifier ??
|
|
3589
|
+
}), It = (e, t, n) => {
|
|
3590
|
+
let r = e.connectionAllowedVerifier ?? X.connectionAllowedVerifier;
|
|
3590
3591
|
return {
|
|
3591
|
-
connectionTypeResolver: e.connectionTypeResolver ??
|
|
3592
|
+
connectionTypeResolver: e.connectionTypeResolver ?? X.connectionTypeResolver,
|
|
3592
3593
|
connectionAllowedVerifier: r,
|
|
3593
|
-
draggingPortDirectionResolver:
|
|
3594
|
-
edgeShapeFactory: e.edgeShape === void 0 ? t :
|
|
3595
|
-
connectionPreprocessor: e.connectionPreprocessor ??
|
|
3596
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
3597
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
3598
|
-
onAfterEdgeCreated: e.events?.onAfterEdgeCreated ??
|
|
3599
|
-
onEdgeCreationInterrupted: e.events?.onEdgeCreationInterrupted ??
|
|
3600
|
-
onEdgeCreationPrevented: e.events?.onEdgeCreationPrevented ??
|
|
3594
|
+
draggingPortDirectionResolver: Tt(e.dragPortDirection, n, r),
|
|
3595
|
+
edgeShapeFactory: e.edgeShape === void 0 ? t : Et(e.edgeShape),
|
|
3596
|
+
connectionPreprocessor: e.connectionPreprocessor ?? X.connectionPreprocessor,
|
|
3597
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? X.mouseEventVerifier,
|
|
3598
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? X.mouseEventVerifier,
|
|
3599
|
+
onAfterEdgeCreated: e.events?.onAfterEdgeCreated ?? Y,
|
|
3600
|
+
onEdgeCreationInterrupted: e.events?.onEdgeCreationInterrupted ?? Y,
|
|
3601
|
+
onEdgeCreationPrevented: e.events?.onEdgeCreationPrevented ?? Y,
|
|
3602
|
+
grabbedPortIdResolver: e.grabbedPortIdResolver ?? G,
|
|
3603
|
+
releasedPortIdResolver: e.releasedPortIdResolver ?? G
|
|
3601
3604
|
};
|
|
3602
|
-
},
|
|
3605
|
+
}, Z = Object.freeze({
|
|
3603
3606
|
connectionAllowedVerifier: () => !0,
|
|
3604
3607
|
connectionPreprocessor: (e) => e,
|
|
3605
3608
|
mouseDownEventVerifier: (e) => e.button === 0,
|
|
3606
3609
|
mouseUpEventVerifier: (e) => e.button === 0
|
|
3607
|
-
}),
|
|
3610
|
+
}), Lt = (e, t) => {
|
|
3608
3611
|
let n = (e) => {
|
|
3609
3612
|
let n = t.getPortAdjacentEdgeIds(e);
|
|
3610
3613
|
return n.length > 0 ? n[n.length - 1] : null;
|
|
3611
|
-
}, r = e.connectionAllowedVerifier ??
|
|
3614
|
+
}, r = e.connectionAllowedVerifier ?? Z.connectionAllowedVerifier;
|
|
3612
3615
|
return {
|
|
3613
|
-
connectionPreprocessor: e.connectionPreprocessor ??
|
|
3616
|
+
connectionPreprocessor: e.connectionPreprocessor ?? Z.connectionPreprocessor,
|
|
3614
3617
|
connectionAllowedVerifier: r,
|
|
3615
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
3616
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
3618
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Z.mouseDownEventVerifier,
|
|
3619
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z.mouseUpEventVerifier,
|
|
3617
3620
|
draggingEdgeResolver: e.draggingEdgeResolver ?? n,
|
|
3618
|
-
draggingEdgeShapeFactory: e.draggingEdgeShape === void 0 ? null :
|
|
3619
|
-
onAfterEdgeReattached: e.events?.onAfterEdgeReattached ??
|
|
3620
|
-
onEdgeReattachInterrupted: e.events?.onEdgeReattachInterrupted ??
|
|
3621
|
-
onEdgeReattachPrevented: e.events?.onEdgeReattachPrevented ??
|
|
3622
|
-
draggingPortDirectionResolver:
|
|
3621
|
+
draggingEdgeShapeFactory: e.draggingEdgeShape === void 0 ? null : Et(e.draggingEdgeShape),
|
|
3622
|
+
onAfterEdgeReattached: e.events?.onAfterEdgeReattached ?? Y,
|
|
3623
|
+
onEdgeReattachInterrupted: e.events?.onEdgeReattachInterrupted ?? Y,
|
|
3624
|
+
onEdgeReattachPrevented: e.events?.onEdgeReattachPrevented ?? Y,
|
|
3625
|
+
draggingPortDirectionResolver: Tt(e.dragPortDirection, t, r),
|
|
3626
|
+
grabbedPortIdResolver: e.grabbedPortIdResolver ?? G,
|
|
3627
|
+
releasedPortIdResolver: e.releasedPortIdResolver ?? G
|
|
3623
3628
|
};
|
|
3624
|
-
},
|
|
3629
|
+
}, Rt = (e) => ({
|
|
3625
3630
|
nodeVerticalRadius: e.nodeContainingRadius.vertical,
|
|
3626
3631
|
nodeHorizontalRadius: e.nodeContainingRadius.horizontal
|
|
3627
|
-
}),
|
|
3628
|
-
onAfterNodeDetached: e?.events?.onAfterNodeDetached ??
|
|
3629
|
-
onBeforeNodeAttached: e?.events?.onBeforeNodeAttached ??
|
|
3630
|
-
}),
|
|
3632
|
+
}), zt = (e) => ({
|
|
3633
|
+
onAfterNodeDetached: e?.events?.onAfterNodeDetached ?? Y,
|
|
3634
|
+
onBeforeNodeAttached: e?.events?.onBeforeNodeAttached ?? Y
|
|
3635
|
+
}), Bt = class extends Error {
|
|
3631
3636
|
name = "CanvasBuilderError";
|
|
3632
|
-
},
|
|
3637
|
+
}, Vt = class {
|
|
3633
3638
|
graph;
|
|
3634
3639
|
currentCoords;
|
|
3635
3640
|
dt;
|
|
@@ -3664,7 +3669,7 @@ var ne = (e, t) => {
|
|
|
3664
3669
|
d.x += l, d.y += u, f.x -= l, f.y -= u;
|
|
3665
3670
|
});
|
|
3666
3671
|
}
|
|
3667
|
-
},
|
|
3672
|
+
}, Ht = class {
|
|
3668
3673
|
rand;
|
|
3669
3674
|
PI2 = 2 * Math.PI;
|
|
3670
3675
|
constructor(e) {
|
|
@@ -3687,11 +3692,11 @@ var ne = (e, t) => {
|
|
|
3687
3692
|
d: a
|
|
3688
3693
|
};
|
|
3689
3694
|
}
|
|
3690
|
-
},
|
|
3695
|
+
}, Ut = (e) => {
|
|
3691
3696
|
if (e.distance === 0) return e.maxForce;
|
|
3692
3697
|
let t = e.coefficient * (e.sourceCharge * e.targetCharge / (e.distance * e.distance));
|
|
3693
3698
|
return Math.min(t, e.maxForce);
|
|
3694
|
-
},
|
|
3699
|
+
}, Wt = class {
|
|
3695
3700
|
nodeCharge;
|
|
3696
3701
|
distanceVectorGenerator;
|
|
3697
3702
|
maxForce;
|
|
@@ -3703,7 +3708,7 @@ var ne = (e, t) => {
|
|
|
3703
3708
|
for (let i = 0; i < r; i++) {
|
|
3704
3709
|
let a = n[i];
|
|
3705
3710
|
for (let o = i + 1; o < r; o++) {
|
|
3706
|
-
let r = n[o], i = e.get(a), s = e.get(r), c = this.distanceVectorGenerator.create(i, s), l =
|
|
3711
|
+
let r = n[o], i = e.get(a), s = e.get(r), c = this.distanceVectorGenerator.create(i, s), l = Ut({
|
|
3707
3712
|
coefficient: 1,
|
|
3708
3713
|
sourceCharge: this.nodeCharge,
|
|
3709
3714
|
targetCharge: this.nodeCharge,
|
|
@@ -3714,7 +3719,7 @@ var ne = (e, t) => {
|
|
|
3714
3719
|
}
|
|
3715
3720
|
}
|
|
3716
3721
|
}
|
|
3717
|
-
},
|
|
3722
|
+
}, Gt = (e) => {
|
|
3718
3723
|
if (e.size === 0) return {
|
|
3719
3724
|
centerX: 0,
|
|
3720
3725
|
centerY: 0,
|
|
@@ -3730,7 +3735,7 @@ var ne = (e, t) => {
|
|
|
3730
3735
|
centerY: (r + i) / 2,
|
|
3731
3736
|
radius: s / 2
|
|
3732
3737
|
};
|
|
3733
|
-
},
|
|
3738
|
+
}, Kt = class {
|
|
3734
3739
|
root;
|
|
3735
3740
|
leaves = /* @__PURE__ */ new Map();
|
|
3736
3741
|
coords;
|
|
@@ -3886,7 +3891,7 @@ var ne = (e, t) => {
|
|
|
3886
3891
|
y: n / e.size
|
|
3887
3892
|
};
|
|
3888
3893
|
}
|
|
3889
|
-
},
|
|
3894
|
+
}, qt = class {
|
|
3890
3895
|
areaRadiusThreshold;
|
|
3891
3896
|
nodeMass;
|
|
3892
3897
|
nodeCharge;
|
|
@@ -3898,8 +3903,8 @@ var ne = (e, t) => {
|
|
|
3898
3903
|
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;
|
|
3899
3904
|
}
|
|
3900
3905
|
apply(e, t) {
|
|
3901
|
-
let n = new
|
|
3902
|
-
box:
|
|
3906
|
+
let n = new Kt({
|
|
3907
|
+
box: Gt(e),
|
|
3903
3908
|
coords: e,
|
|
3904
3909
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
3905
3910
|
nodeMass: this.nodeMass,
|
|
@@ -4009,7 +4014,7 @@ var ne = (e, t) => {
|
|
|
4009
4014
|
});
|
|
4010
4015
|
}
|
|
4011
4016
|
calculateNodeRepulsiveForce(e) {
|
|
4012
|
-
let t = this.distanceVectorGenerator.create(e.sourceCoords, e.targetCoords), n =
|
|
4017
|
+
let t = this.distanceVectorGenerator.create(e.sourceCoords, e.targetCoords), n = Ut({
|
|
4013
4018
|
coefficient: this.nodeForceCoefficient,
|
|
4014
4019
|
sourceCharge: e.sourceCharge,
|
|
4015
4020
|
targetCharge: e.targetCharge,
|
|
@@ -4036,12 +4041,12 @@ var ne = (e, t) => {
|
|
|
4036
4041
|
this.applyForce(e.totalForce, t);
|
|
4037
4042
|
}
|
|
4038
4043
|
}
|
|
4039
|
-
},
|
|
4044
|
+
}, Jt = (e) => e.theta === 0 ? new Wt({
|
|
4040
4045
|
nodeCharge: e.nodeCharge,
|
|
4041
4046
|
nodeForceCoefficient: e.nodeForceCoefficient,
|
|
4042
4047
|
distanceVectorGenerator: e.distanceVectorGenerator,
|
|
4043
4048
|
maxForce: e.maxForce
|
|
4044
|
-
}) : new
|
|
4049
|
+
}) : new qt({
|
|
4045
4050
|
nodeCharge: e.nodeCharge,
|
|
4046
4051
|
nodeForceCoefficient: e.nodeForceCoefficient,
|
|
4047
4052
|
distanceVectorGenerator: e.distanceVectorGenerator,
|
|
@@ -4049,7 +4054,7 @@ var ne = (e, t) => {
|
|
|
4049
4054
|
theta: e.theta,
|
|
4050
4055
|
nodeMass: e.nodeMass,
|
|
4051
4056
|
areaRadiusThreshold: e.areaRadiusThreshold
|
|
4052
|
-
}),
|
|
4057
|
+
}), Yt = class {
|
|
4053
4058
|
rand;
|
|
4054
4059
|
sparsity;
|
|
4055
4060
|
constructor(e) {
|
|
@@ -4074,7 +4079,7 @@ var ne = (e, t) => {
|
|
|
4074
4079
|
});
|
|
4075
4080
|
}), r;
|
|
4076
4081
|
}
|
|
4077
|
-
},
|
|
4082
|
+
}, Xt = class {
|
|
4078
4083
|
distanceVectorGenerator;
|
|
4079
4084
|
nodeForcesApplicationStrategy;
|
|
4080
4085
|
fillerLayoutAlgorithm;
|
|
@@ -4085,7 +4090,7 @@ var ne = (e, t) => {
|
|
|
4085
4090
|
edgeStiffness;
|
|
4086
4091
|
convergenceVelocity;
|
|
4087
4092
|
constructor(e) {
|
|
4088
|
-
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.stopVelocity, this.distanceVectorGenerator = new
|
|
4093
|
+
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.stopVelocity, this.distanceVectorGenerator = new Ht(e.rand), this.nodeForcesApplicationStrategy = Jt({
|
|
4089
4094
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4090
4095
|
nodeCharge: e.nodeCharge,
|
|
4091
4096
|
maxForce: e.maxForce,
|
|
@@ -4093,7 +4098,7 @@ var ne = (e, t) => {
|
|
|
4093
4098
|
theta: e.barnesHutTheta,
|
|
4094
4099
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4095
4100
|
nodeMass: e.nodeMass
|
|
4096
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4101
|
+
}), this.fillerLayoutAlgorithm = new Yt({
|
|
4097
4102
|
rand: e.rand,
|
|
4098
4103
|
sparsity: e.edgeEquilibriumLength
|
|
4099
4104
|
});
|
|
@@ -4103,7 +4108,7 @@ var ne = (e, t) => {
|
|
|
4103
4108
|
graph: t,
|
|
4104
4109
|
viewport: n
|
|
4105
4110
|
});
|
|
4106
|
-
for (let e = 0; e < this.maxIterations && !(new
|
|
4111
|
+
for (let e = 0; e < this.maxIterations && !(new Vt(t, r, {
|
|
4107
4112
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4108
4113
|
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
4109
4114
|
dtSec: this.dtSec,
|
|
@@ -4113,7 +4118,7 @@ var ne = (e, t) => {
|
|
|
4113
4118
|
}).apply() < this.convergenceVelocity); e++);
|
|
4114
4119
|
return r;
|
|
4115
4120
|
}
|
|
4116
|
-
},
|
|
4121
|
+
}, Zt = class {
|
|
4117
4122
|
graph;
|
|
4118
4123
|
nextLayerNodesResolver;
|
|
4119
4124
|
forest = /* @__PURE__ */ new Set();
|
|
@@ -4157,7 +4162,7 @@ var ne = (e, t) => {
|
|
|
4157
4162
|
}), r = e;
|
|
4158
4163
|
}
|
|
4159
4164
|
}
|
|
4160
|
-
},
|
|
4165
|
+
}, Qt = class {
|
|
4161
4166
|
params;
|
|
4162
4167
|
constructor(e) {
|
|
4163
4168
|
this.params = e;
|
|
@@ -4196,13 +4201,13 @@ var ne = (e, t) => {
|
|
|
4196
4201
|
}
|
|
4197
4202
|
return n - 2 * this.params.spaceAroundRadius;
|
|
4198
4203
|
}
|
|
4199
|
-
},
|
|
4204
|
+
}, $t = class {
|
|
4200
4205
|
tree;
|
|
4201
4206
|
offsets = /* @__PURE__ */ new Map();
|
|
4202
4207
|
treeSpans = /* @__PURE__ */ new Map();
|
|
4203
4208
|
constructor(e, t) {
|
|
4204
4209
|
this.tree = e;
|
|
4205
|
-
let n = t.spaceAroundRadius, r = new
|
|
4210
|
+
let n = t.spaceAroundRadius, r = new Qt({ spaceAroundRadius: n });
|
|
4206
4211
|
[...this.tree.sequence].reverse().forEach((e) => {
|
|
4207
4212
|
let t = Array.from(e.children).map((e) => this.treeSpans.get(e.nodeId)), i = r.generate(t), a = 0;
|
|
4208
4213
|
e.children.forEach((e) => {
|
|
@@ -4218,19 +4223,19 @@ var ne = (e, t) => {
|
|
|
4218
4223
|
generate() {
|
|
4219
4224
|
return this.offsets;
|
|
4220
4225
|
}
|
|
4221
|
-
},
|
|
4226
|
+
}, en = class {
|
|
4222
4227
|
params;
|
|
4223
4228
|
constructor(e) {
|
|
4224
4229
|
this.params = e;
|
|
4225
4230
|
}
|
|
4226
4231
|
calculateCoordinates(e) {
|
|
4227
|
-
let t = /* @__PURE__ */ new Map(), n = new
|
|
4232
|
+
let t = /* @__PURE__ */ new Map(), n = new Zt(e.graph, this.params.nextLayerNodesResolver).generate(), r = 0;
|
|
4228
4233
|
return n.forEach((e) => {
|
|
4229
4234
|
t.set(e.root.nodeId, {
|
|
4230
4235
|
x: r,
|
|
4231
4236
|
y: 0
|
|
4232
4237
|
});
|
|
4233
|
-
let n = new
|
|
4238
|
+
let n = new $t(e, { spaceAroundRadius: this.params.layerSpace / 2 }).generate(), i = [e.root];
|
|
4234
4239
|
for (; i.length > 0;) {
|
|
4235
4240
|
let e = [];
|
|
4236
4241
|
r += this.params.layerWidth, i.forEach((i) => {
|
|
@@ -4247,7 +4252,7 @@ var ne = (e, t) => {
|
|
|
4247
4252
|
t.set(n, this.params.transform(e));
|
|
4248
4253
|
}), t;
|
|
4249
4254
|
}
|
|
4250
|
-
},
|
|
4255
|
+
}, tn = (e) => {
|
|
4251
4256
|
let { graph: t, currentNodeId: n } = e, r = t.getNodeOutgoingEdgeIds(n).map((e) => {
|
|
4252
4257
|
let n = t.getEdge(e);
|
|
4253
4258
|
return t.getPort(n.to).nodeId;
|
|
@@ -4256,19 +4261,19 @@ var ne = (e, t) => {
|
|
|
4256
4261
|
return t.getPort(n.from).nodeId;
|
|
4257
4262
|
});
|
|
4258
4263
|
return /* @__PURE__ */ new Set([...r, ...i]);
|
|
4259
|
-
},
|
|
4264
|
+
}, nn = (e) => {
|
|
4260
4265
|
let { graph: t, currentNodeId: n } = e, r = t.getNodeOutgoingEdgeIds(n).map((e) => {
|
|
4261
4266
|
let n = t.getEdge(e);
|
|
4262
4267
|
return t.getPort(n.to).nodeId;
|
|
4263
4268
|
});
|
|
4264
4269
|
return new Set(r);
|
|
4265
|
-
},
|
|
4270
|
+
}, rn = (e) => {
|
|
4266
4271
|
let { graph: t, currentNodeId: n } = e, r = t.getNodeIncomingEdgeIds(n).map((e) => {
|
|
4267
4272
|
let n = t.getEdge(e);
|
|
4268
4273
|
return t.getPort(n.from).nodeId;
|
|
4269
4274
|
});
|
|
4270
4275
|
return new Set(r);
|
|
4271
|
-
},
|
|
4276
|
+
}, an = class {
|
|
4272
4277
|
distanceVectorGenerator;
|
|
4273
4278
|
nodeForcesApplicationStrategy;
|
|
4274
4279
|
convergenceVelocity;
|
|
@@ -4278,7 +4283,7 @@ var ne = (e, t) => {
|
|
|
4278
4283
|
edgeStiffness;
|
|
4279
4284
|
fillerLayoutAlgorithm;
|
|
4280
4285
|
constructor(e) {
|
|
4281
|
-
this.convergenceVelocity = e.stopVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new
|
|
4286
|
+
this.convergenceVelocity = e.stopVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Ht(e.rand), this.nodeForcesApplicationStrategy = Jt({
|
|
4282
4287
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4283
4288
|
nodeCharge: e.nodeCharge,
|
|
4284
4289
|
maxForce: e.maxForce,
|
|
@@ -4286,7 +4291,7 @@ var ne = (e, t) => {
|
|
|
4286
4291
|
theta: e.barnesHutTheta,
|
|
4287
4292
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4288
4293
|
nodeMass: e.nodeMass
|
|
4289
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4294
|
+
}), this.fillerLayoutAlgorithm = new Yt({
|
|
4290
4295
|
rand: e.rand,
|
|
4291
4296
|
sparsity: e.edgeEquilibriumLength
|
|
4292
4297
|
});
|
|
@@ -4296,7 +4301,7 @@ var ne = (e, t) => {
|
|
|
4296
4301
|
graph: t,
|
|
4297
4302
|
viewport: n
|
|
4298
4303
|
});
|
|
4299
|
-
return new
|
|
4304
|
+
return new Vt(t, i, {
|
|
4300
4305
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4301
4306
|
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
4302
4307
|
dtSec: Math.min(r, this.maxTimeDeltaSec),
|
|
@@ -4308,7 +4313,7 @@ var ne = (e, t) => {
|
|
|
4308
4313
|
return n.x === null || n.y === null;
|
|
4309
4314
|
}) ? /* @__PURE__ */ new Map() : i;
|
|
4310
4315
|
}
|
|
4311
|
-
},
|
|
4316
|
+
}, on = (e) => {
|
|
4312
4317
|
let t = 1779033703, n = 3144134277, r = 1013904242, i = 2773480762;
|
|
4313
4318
|
for (let a = 0, o; a < e.length; a++) o = e.charCodeAt(a), t = n ^ Math.imul(t ^ o, 597399067), n = r ^ Math.imul(n ^ o, 2869860233), r = i ^ Math.imul(r ^ o, 951274213), i = t ^ Math.imul(i ^ o, 2716044179);
|
|
4314
4319
|
return t = Math.imul(r ^ t >>> 18, 597399067), n = Math.imul(i ^ n >>> 22, 2869860233), r = Math.imul(t ^ r >>> 17, 951274213), i = Math.imul(n ^ i >>> 19, 2716044179), t ^= n ^ r ^ i, n ^= t, r ^= t, i ^= t, [
|
|
@@ -4317,55 +4322,55 @@ var ne = (e, t) => {
|
|
|
4317
4322
|
r >>> 0,
|
|
4318
4323
|
i >>> 0
|
|
4319
4324
|
];
|
|
4320
|
-
},
|
|
4325
|
+
}, sn = (e, t, n, r) => function() {
|
|
4321
4326
|
e |= 0, t |= 0, n |= 0, r |= 0;
|
|
4322
4327
|
let i = (e + t | 0) + r | 0;
|
|
4323
4328
|
return r = r + 1 | 0, e = t ^ t >>> 9, t = n + (n << 3) | 0, n = n << 21 | n >>> 11, n = n + i | 0, (i >>> 0) / 4294967296;
|
|
4324
|
-
},
|
|
4329
|
+
}, cn = (e) => {
|
|
4325
4330
|
switch (e?.type) {
|
|
4326
4331
|
case "custom": return e.instance;
|
|
4327
4332
|
default: {
|
|
4328
|
-
let t =
|
|
4329
|
-
return new
|
|
4330
|
-
rand:
|
|
4331
|
-
maxTimeDeltaSec: e?.maxTimeDeltaSec ??
|
|
4332
|
-
nodeCharge: e?.nodeCharge ??
|
|
4333
|
-
nodeMass: e?.nodeMass ??
|
|
4334
|
-
edgeEquilibriumLength: e?.edgeEquilibriumLength ??
|
|
4335
|
-
edgeStiffness: e?.edgeStiffness ??
|
|
4336
|
-
stopVelocity: e?.stopVelocity ??
|
|
4337
|
-
maxForce: e?.maxForce ??
|
|
4338
|
-
nodeForceCoefficient: e?.nodeForceCoefficient ??
|
|
4339
|
-
barnesHutTheta: e?.barnesHut?.theta ??
|
|
4340
|
-
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ??
|
|
4333
|
+
let t = on(e?.seed ?? q.seed);
|
|
4334
|
+
return new an({
|
|
4335
|
+
rand: sn(t[0], t[1], t[2], t[3]),
|
|
4336
|
+
maxTimeDeltaSec: e?.maxTimeDeltaSec ?? q.maxTimeDeltaSec,
|
|
4337
|
+
nodeCharge: e?.nodeCharge ?? q.nodeCharge,
|
|
4338
|
+
nodeMass: e?.nodeMass ?? q.nodeMass,
|
|
4339
|
+
edgeEquilibriumLength: e?.edgeEquilibriumLength ?? q.edgeEquilibriumLength,
|
|
4340
|
+
edgeStiffness: e?.edgeStiffness ?? q.edgeStiffness,
|
|
4341
|
+
stopVelocity: e?.stopVelocity ?? q.convergenceVelocity,
|
|
4342
|
+
maxForce: e?.maxForce ?? q.maxForce,
|
|
4343
|
+
nodeForceCoefficient: e?.nodeForceCoefficient ?? q.nodeForceCoefficient,
|
|
4344
|
+
barnesHutTheta: e?.barnesHut?.theta ?? q.barnesHutTheta,
|
|
4345
|
+
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ?? q.barnesHutAreaRadiusThreshold
|
|
4341
4346
|
});
|
|
4342
4347
|
}
|
|
4343
4348
|
}
|
|
4344
|
-
},
|
|
4345
|
-
algorithm:
|
|
4346
|
-
staticNodeResolver: e?.staticNodeResolver ??
|
|
4347
|
-
onBeforeApplied: e?.events?.onBeforeApplied ??
|
|
4348
|
-
onAfterApplied: e?.events?.onAfterApplied ??
|
|
4349
|
-
}),
|
|
4349
|
+
}, ln = { staticNodeResolver: () => !1 }, un = (e) => ({
|
|
4350
|
+
algorithm: cn(e?.algorithm ?? {}),
|
|
4351
|
+
staticNodeResolver: e?.staticNodeResolver ?? ln.staticNodeResolver,
|
|
4352
|
+
onBeforeApplied: e?.events?.onBeforeApplied ?? Y,
|
|
4353
|
+
onAfterApplied: e?.events?.onAfterApplied ?? Y
|
|
4354
|
+
}), dn = (e) => e instanceof l ? {
|
|
4350
4355
|
type: "trigger",
|
|
4351
4356
|
trigger: e
|
|
4352
4357
|
} : {
|
|
4353
4358
|
type: "topologyChangeSchedule",
|
|
4354
|
-
schedule:
|
|
4355
|
-
},
|
|
4359
|
+
schedule: Ge
|
|
4360
|
+
}, fn = Object.freeze({
|
|
4356
4361
|
staticNodeResolver: () => !1,
|
|
4357
4362
|
hierarchicalLayout: {
|
|
4358
4363
|
layerWidth: 300,
|
|
4359
4364
|
layerSpace: 300
|
|
4360
4365
|
}
|
|
4361
|
-
}),
|
|
4366
|
+
}), Q = (e, t) => ({
|
|
4362
4367
|
a: e.a * t.a + e.b * t.d,
|
|
4363
4368
|
b: e.a * t.b + e.b * t.e,
|
|
4364
4369
|
c: e.a * t.c + e.b * t.f + e.c,
|
|
4365
4370
|
d: e.d * t.a + e.e * t.d,
|
|
4366
4371
|
e: e.d * t.b + e.e * t.e,
|
|
4367
4372
|
f: e.d * t.c + e.e * t.f + e.f
|
|
4368
|
-
}),
|
|
4373
|
+
}), pn = (e) => {
|
|
4369
4374
|
let { a: t, b: n, c: r, d: i, e: a, f: o } = e, s = t * a - n * i;
|
|
4370
4375
|
return {
|
|
4371
4376
|
a: a / s,
|
|
@@ -4375,7 +4380,7 @@ var ne = (e, t) => {
|
|
|
4375
4380
|
e: t / s,
|
|
4376
4381
|
f: (r * i - t * o) / s
|
|
4377
4382
|
};
|
|
4378
|
-
},
|
|
4383
|
+
}, mn = class {
|
|
4379
4384
|
resolve(e) {
|
|
4380
4385
|
if ("shift" in e) return this.createShiftBaseMatrix(e.shift);
|
|
4381
4386
|
if ("scale" in e) {
|
|
@@ -4417,11 +4422,11 @@ var ne = (e, t) => {
|
|
|
4417
4422
|
return this.createRelativeTransform(n, r);
|
|
4418
4423
|
}
|
|
4419
4424
|
createMirrorRelativeMatrix(e, t) {
|
|
4420
|
-
let n = this.createMirrorYBaseMatrix(), r =
|
|
4425
|
+
let n = this.createMirrorYBaseMatrix(), r = Q(this.createShiftBaseMatrix(t), this.createRotateBaseMatrix(e));
|
|
4421
4426
|
return this.createRelativeTransform(n, r);
|
|
4422
4427
|
}
|
|
4423
4428
|
createRelativeTransform(e, t) {
|
|
4424
|
-
return
|
|
4429
|
+
return Q(Q(t, e), pn(t));
|
|
4425
4430
|
}
|
|
4426
4431
|
createShiftBaseMatrix(e) {
|
|
4427
4432
|
return {
|
|
@@ -4464,7 +4469,7 @@ var ne = (e, t) => {
|
|
|
4464
4469
|
f: 0
|
|
4465
4470
|
};
|
|
4466
4471
|
}
|
|
4467
|
-
},
|
|
4472
|
+
}, hn = (e) => {
|
|
4468
4473
|
if (e === void 0) return (e) => e;
|
|
4469
4474
|
if (typeof e == "function") return e;
|
|
4470
4475
|
let t = Array.isArray(e) ? e : [e], n = {
|
|
@@ -4474,10 +4479,10 @@ var ne = (e, t) => {
|
|
|
4474
4479
|
d: 0,
|
|
4475
4480
|
e: 1,
|
|
4476
4481
|
f: 0
|
|
4477
|
-
}, r = new
|
|
4482
|
+
}, r = new mn();
|
|
4478
4483
|
return t.forEach((e) => {
|
|
4479
4484
|
let t = r.resolve(e);
|
|
4480
|
-
n =
|
|
4485
|
+
n = Q(n, t);
|
|
4481
4486
|
}), (e) => {
|
|
4482
4487
|
let { x: t, y: r } = e;
|
|
4483
4488
|
return {
|
|
@@ -4485,47 +4490,47 @@ var ne = (e, t) => {
|
|
|
4485
4490
|
y: n.d * t + n.e * r + n.f
|
|
4486
4491
|
};
|
|
4487
4492
|
};
|
|
4488
|
-
},
|
|
4493
|
+
}, gn = (e) => {
|
|
4489
4494
|
if (typeof e == "function") return e;
|
|
4490
4495
|
switch (e) {
|
|
4491
|
-
case "outgoing": return
|
|
4492
|
-
case "incoming": return
|
|
4493
|
-
default: return
|
|
4496
|
+
case "outgoing": return nn;
|
|
4497
|
+
case "incoming": return rn;
|
|
4498
|
+
default: return tn;
|
|
4494
4499
|
}
|
|
4495
|
-
},
|
|
4500
|
+
}, _n = (e) => {
|
|
4496
4501
|
switch (e?.type) {
|
|
4497
4502
|
case "custom": return e.instance;
|
|
4498
|
-
case "hierarchical": return new
|
|
4499
|
-
layerWidth: e.layerWidth ??
|
|
4500
|
-
layerSpace: e.layerSpace ??
|
|
4501
|
-
transform:
|
|
4502
|
-
nextLayerNodesResolver:
|
|
4503
|
+
case "hierarchical": return new en({
|
|
4504
|
+
layerWidth: e.layerWidth ?? fn.hierarchicalLayout.layerWidth,
|
|
4505
|
+
layerSpace: e.layerSpace ?? fn.hierarchicalLayout.layerSpace,
|
|
4506
|
+
transform: hn(e.transform),
|
|
4507
|
+
nextLayerNodesResolver: gn(e.nextLayerNodesResolver)
|
|
4503
4508
|
});
|
|
4504
4509
|
default: {
|
|
4505
|
-
let t =
|
|
4506
|
-
return new
|
|
4507
|
-
dtSec: e?.dtSec ??
|
|
4508
|
-
maxIterations: e?.maxIterations ??
|
|
4510
|
+
let t = on(e?.seed ?? q.seed), n = sn(t[0], t[1], t[2], t[3]);
|
|
4511
|
+
return new Xt({
|
|
4512
|
+
dtSec: e?.dtSec ?? q.dtSec,
|
|
4513
|
+
maxIterations: e?.maxIterations ?? q.maxIterations,
|
|
4509
4514
|
rand: n,
|
|
4510
|
-
nodeCharge: e?.nodeCharge ??
|
|
4511
|
-
nodeMass: e?.nodeMass ??
|
|
4512
|
-
edgeEquilibriumLength: e?.edgeEquilibriumLength ??
|
|
4513
|
-
edgeStiffness: e?.edgeStiffness ??
|
|
4514
|
-
stopVelocity: e?.stopVelocity ??
|
|
4515
|
-
maxForce: e?.maxForce ??
|
|
4516
|
-
nodeForceCoefficient: e?.nodeForceCoefficient ??
|
|
4517
|
-
barnesHutTheta: e?.barnesHut?.theta ??
|
|
4518
|
-
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ??
|
|
4515
|
+
nodeCharge: e?.nodeCharge ?? q.nodeCharge,
|
|
4516
|
+
nodeMass: e?.nodeMass ?? q.nodeMass,
|
|
4517
|
+
edgeEquilibriumLength: e?.edgeEquilibriumLength ?? q.edgeEquilibriumLength,
|
|
4518
|
+
edgeStiffness: e?.edgeStiffness ?? q.edgeStiffness,
|
|
4519
|
+
stopVelocity: e?.stopVelocity ?? q.convergenceVelocity,
|
|
4520
|
+
maxForce: e?.maxForce ?? q.maxForce,
|
|
4521
|
+
nodeForceCoefficient: e?.nodeForceCoefficient ?? q.nodeForceCoefficient,
|
|
4522
|
+
barnesHutTheta: e?.barnesHut?.theta ?? q.barnesHutTheta,
|
|
4523
|
+
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ?? q.barnesHutAreaRadiusThreshold
|
|
4519
4524
|
});
|
|
4520
4525
|
}
|
|
4521
4526
|
}
|
|
4522
|
-
},
|
|
4523
|
-
algorithm:
|
|
4524
|
-
applyOn:
|
|
4525
|
-
staticNodeResolver: e.staticNodeResolver ??
|
|
4526
|
-
onBeforeApplied: e.events?.onBeforeApplied ??
|
|
4527
|
-
onAfterApplied: e.events?.onAfterApplied ??
|
|
4528
|
-
}),
|
|
4527
|
+
}, vn = (e) => ({
|
|
4528
|
+
algorithm: _n(e.algorithm),
|
|
4529
|
+
applyOn: dn(e.applyOn),
|
|
4530
|
+
staticNodeResolver: e.staticNodeResolver ?? fn.staticNodeResolver,
|
|
4531
|
+
onBeforeApplied: e.events?.onBeforeApplied ?? Y,
|
|
4532
|
+
onAfterApplied: e.events?.onAfterApplied ?? Y
|
|
4533
|
+
}), yn = (e, t) => ({
|
|
4529
4534
|
...e,
|
|
4530
4535
|
onNodeDragStarted: (n) => {
|
|
4531
4536
|
t.add(n), e.onNodeDragStarted(n);
|
|
@@ -4533,7 +4538,7 @@ var ne = (e, t) => {
|
|
|
4533
4538
|
onNodeDragFinished: (n) => {
|
|
4534
4539
|
t.delete(n), e.onNodeDragFinished(n);
|
|
4535
4540
|
}
|
|
4536
|
-
}),
|
|
4541
|
+
}), bn = (e, t) => {
|
|
4537
4542
|
e.graph.onBeforeNodeRemoved.subscribe((e) => {
|
|
4538
4543
|
t.delete(e);
|
|
4539
4544
|
}), e.graph.onBeforeClear.subscribe(() => {
|
|
@@ -4541,55 +4546,55 @@ var ne = (e, t) => {
|
|
|
4541
4546
|
}), e.onBeforeDestroy.subscribe(() => {
|
|
4542
4547
|
t.clear();
|
|
4543
4548
|
});
|
|
4544
|
-
},
|
|
4549
|
+
}, xn = (e, t) => ({
|
|
4545
4550
|
...e,
|
|
4546
4551
|
staticNodeResolver: (n) => e.staticNodeResolver(n) || t.has(n)
|
|
4547
|
-
}),
|
|
4552
|
+
}), $ = (e) => () => e, Sn = $(0), Cn = () => {
|
|
4548
4553
|
let e = 0;
|
|
4549
4554
|
return () => e++;
|
|
4550
|
-
},
|
|
4551
|
-
let n =
|
|
4552
|
-
return e === "incremental" && (n = i), t === "incremental" && (r = i), typeof e == "number" && (n =
|
|
4555
|
+
}, wn = (e, t) => {
|
|
4556
|
+
let n = Sn, r = Sn, i = Cn();
|
|
4557
|
+
return e === "incremental" && (n = i), t === "incremental" && (r = i), typeof e == "number" && (n = $(e)), typeof t == "number" && (r = $(t)), typeof e == "function" && (n = e), typeof t == "function" && (r = t), {
|
|
4553
4558
|
nodesPriorityFn: n,
|
|
4554
4559
|
edgesPriorityFn: r
|
|
4555
4560
|
};
|
|
4556
|
-
},
|
|
4557
|
-
let t =
|
|
4561
|
+
}, Tn = (e) => {
|
|
4562
|
+
let t = wn(e.nodes?.priority, e.edges?.priority);
|
|
4558
4563
|
return {
|
|
4559
4564
|
nodes: {
|
|
4560
|
-
centerFn: e.nodes?.centerFn ??
|
|
4565
|
+
centerFn: e.nodes?.centerFn ?? ie,
|
|
4561
4566
|
priorityFn: t.nodesPriorityFn
|
|
4562
4567
|
},
|
|
4563
4568
|
ports: { direction: e.ports?.direction ?? 0 },
|
|
4564
4569
|
edges: {
|
|
4565
|
-
shapeFactory:
|
|
4570
|
+
shapeFactory: Et(e.edges?.shape ?? {}),
|
|
4566
4571
|
priorityFn: t.edgesPriorityFn
|
|
4567
4572
|
}
|
|
4568
4573
|
};
|
|
4569
|
-
},
|
|
4570
|
-
let { canvasDefaults: t } = e, n = e.hasLayout ?
|
|
4574
|
+
}, En = (e) => e.applyOn.type === "topologyChangeSchedule" ? e.applyOn.schedule : z, Dn = (e) => {
|
|
4575
|
+
let { canvasDefaults: t } = e, n = e.hasLayout ? En(e.layoutParams) : z;
|
|
4571
4576
|
return { focus: {
|
|
4572
4577
|
contentPadding: t.focus?.contentPadding ?? 100,
|
|
4573
4578
|
minContentScale: t.focus?.minContentScale ?? 0,
|
|
4574
4579
|
schedule: n,
|
|
4575
4580
|
animationDuration: t.focus?.animationDuration ?? 0
|
|
4576
4581
|
} };
|
|
4577
|
-
},
|
|
4582
|
+
}, On = (e) => ({
|
|
4578
4583
|
onNodeSelected: e.onNodeSelected,
|
|
4579
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
4580
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
4581
|
-
movementThreshold: e.movementThreshold ??
|
|
4582
|
-
}), On = (e) => ({
|
|
4583
|
-
onCanvasSelected: e.onCanvasSelected,
|
|
4584
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Y.mouseDownEventVerifier,
|
|
4585
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Y.mouseUpEventVerifier,
|
|
4586
|
-
movementThreshold: e.movementThreshold ?? Y.movementThreshold
|
|
4584
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? J.mouseDownEventVerifier,
|
|
4585
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? J.mouseUpEventVerifier,
|
|
4586
|
+
movementThreshold: e.movementThreshold ?? J.movementThreshold
|
|
4587
4587
|
}), kn = (e) => ({
|
|
4588
|
+
onCanvasSelected: e.onCanvasSelected,
|
|
4589
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? J.mouseDownEventVerifier,
|
|
4590
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? J.mouseUpEventVerifier,
|
|
4591
|
+
movementThreshold: e.movementThreshold ?? J.movementThreshold
|
|
4592
|
+
}), An = (e) => ({
|
|
4588
4593
|
onEdgeSelected: e.onEdgeSelected,
|
|
4589
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
4590
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
4591
|
-
movementThreshold: e.movementThreshold ??
|
|
4592
|
-
}),
|
|
4594
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? J.mouseDownEventVerifier,
|
|
4595
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? J.mouseUpEventVerifier,
|
|
4596
|
+
movementThreshold: e.movementThreshold ?? J.movementThreshold
|
|
4597
|
+
}), jn = class {
|
|
4593
4598
|
element;
|
|
4594
4599
|
used = !1;
|
|
4595
4600
|
canvasDefaults = {};
|
|
@@ -4616,9 +4621,9 @@ var ne = (e, t) => {
|
|
|
4616
4621
|
window = window;
|
|
4617
4622
|
animationStaticNodes = /* @__PURE__ */ new Set();
|
|
4618
4623
|
pointInsideVerifier;
|
|
4619
|
-
eventTagger = new
|
|
4624
|
+
eventTagger = new $e();
|
|
4620
4625
|
constructor(e) {
|
|
4621
|
-
this.element = e, this.pointInsideVerifier = new
|
|
4626
|
+
this.element = e, this.pointInsideVerifier = new ee(e, this.window);
|
|
4622
4627
|
}
|
|
4623
4628
|
setDefaults(e) {
|
|
4624
4629
|
return this.canvasDefaults = e, this;
|
|
@@ -4660,40 +4665,40 @@ var ne = (e, t) => {
|
|
|
4660
4665
|
return this.userSelectableCanvasConfig = e, this;
|
|
4661
4666
|
}
|
|
4662
4667
|
build() {
|
|
4663
|
-
if (this.used) throw new
|
|
4668
|
+
if (this.used) throw new Bt("Failed to build Canvas because CanvasBuilder is a single-use object");
|
|
4664
4669
|
this.used = !0;
|
|
4665
|
-
let e = new y(this.element), t = new h(), n = new
|
|
4670
|
+
let e = new y(this.element), t = new h(), n = new wt(this.element), r = this.createHtmlView(n.main, t, e), i = Tn(this.canvasDefaults), a = new We(t, r, i), o = vn(this.layoutConfig), s = new Xe(t, e, Dn({
|
|
4666
4671
|
canvasDefaults: this.canvasDefaults,
|
|
4667
4672
|
hasLayout: this.hasLayout,
|
|
4668
4673
|
layoutParams: o
|
|
4669
|
-
}), this.window), c = new
|
|
4670
|
-
if (this.hasBackground &&
|
|
4671
|
-
let e =
|
|
4672
|
-
|
|
4674
|
+
}), this.window), c = new Ke(e), l = new d(new Ue(t), c, a, s);
|
|
4675
|
+
if (this.hasBackground && ct.configure(l, Ft(this.backgroundConfig), n.background), this.hasNodeResizeReactiveEdges && b.configure(l), this.userSelectableEdgesConfig !== void 0) {
|
|
4676
|
+
let e = An(this.userSelectableEdgesConfig);
|
|
4677
|
+
yt.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4673
4678
|
}
|
|
4674
4679
|
if (this.userSelectableNodesConfig !== void 0) {
|
|
4675
|
-
let e =
|
|
4676
|
-
|
|
4680
|
+
let e = On(this.userSelectableNodesConfig);
|
|
4681
|
+
vt.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4677
4682
|
}
|
|
4678
4683
|
if (this.userSelectableCanvasConfig !== void 0) {
|
|
4679
|
-
let e =
|
|
4680
|
-
|
|
4684
|
+
let e = kn(this.userSelectableCanvasConfig);
|
|
4685
|
+
bt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4681
4686
|
}
|
|
4682
4687
|
if (this.hasDraggableNodes) {
|
|
4683
|
-
let e =
|
|
4684
|
-
this.hasAnimatedLayout && (e =
|
|
4688
|
+
let e = Dt(this.dragConfig);
|
|
4689
|
+
this.hasAnimatedLayout && (e = yn(e, this.animationStaticNodes)), nt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4685
4690
|
}
|
|
4686
4691
|
if (this.hasUserConnectablePorts) {
|
|
4687
|
-
let t =
|
|
4688
|
-
|
|
4692
|
+
let t = It(this.connectablePortsConfig, i.edges.shapeFactory, l.graph);
|
|
4693
|
+
lt.configure(l, n.overlayConnectablePorts, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
|
|
4689
4694
|
}
|
|
4690
4695
|
if (this.hasUserDraggableEdges) {
|
|
4691
|
-
let t =
|
|
4692
|
-
|
|
4696
|
+
let t = Lt(this.draggableEdgesConfig, l.graph);
|
|
4697
|
+
ut.configure(l, n.overlayDraggableEdges, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
|
|
4693
4698
|
}
|
|
4694
|
-
if (this.virtualScrollConfig === void 0 ? this.hasTransformableViewport &&
|
|
4695
|
-
let e =
|
|
4696
|
-
this.hasDraggableNodes && (
|
|
4699
|
+
if (this.virtualScrollConfig === void 0 ? this.hasTransformableViewport && rt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, Mt(this.transformConfig)) : it.configure(l, n.main, this.window, Mt(this.transformConfig), this.boxRenderingTrigger, this.pointInsideVerifier, this.eventTagger, Rt(this.virtualScrollConfig)), this.hasLayout && mt.configure(l, o), this.hasAnimatedLayout) {
|
|
4700
|
+
let e = un(this.animatedLayoutConfig);
|
|
4701
|
+
this.hasDraggableNodes && (bn(l, this.animationStaticNodes), e = xn(e, this.animationStaticNodes)), _t.configure(l, e, this.window);
|
|
4697
4702
|
}
|
|
4698
4703
|
return l.onBeforeDestroy.subscribe(() => {
|
|
4699
4704
|
n.destroy();
|
|
@@ -4701,8 +4706,8 @@ var ne = (e, t) => {
|
|
|
4701
4706
|
}
|
|
4702
4707
|
createHtmlView(e, t, n) {
|
|
4703
4708
|
let r = new a(t, n, e);
|
|
4704
|
-
return this.virtualScrollConfig !== void 0 && (r = new s(r, t, this.boxRenderingTrigger,
|
|
4709
|
+
return this.virtualScrollConfig !== void 0 && (r = new s(r, t, this.boxRenderingTrigger, zt(this.virtualScrollConfig))), r = new c(r, t), r;
|
|
4705
4710
|
}
|
|
4706
4711
|
};
|
|
4707
4712
|
//#endregion
|
|
4708
|
-
export {
|
|
4713
|
+
export { Ae as BezierEdgeShape, jn as CanvasBuilder, Bt as CanvasBuilderError, p as CanvasError, e as ConnectionCategory, L as DirectEdgeShape, l as EventSubject, Be as InteractiveEdgeError, Ve as InteractiveEdgeShape, He as MidpointEdgeShape, Ne as OrthogonalEdgeShape, je as StraightEdgeShape };
|