@html-graph/html-graph 9.1.0 → 9.2.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 +29 -4
- package/dist/html-graph.js +225 -79
- package/dist/html-graph.min.js +616 -528
- package/dist/html-graph.min.umd.cjs +1 -1
- package/dist/html-graph.umd.cjs +225 -79
- package/package.json +1 -1
package/dist/html-graph.min.js
CHANGED
|
@@ -522,7 +522,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
522
522
|
if (t.from !== void 0 || t.to !== void 0) {
|
|
523
523
|
if (t.from !== void 0 && !this.hasPort(t.from)) throw new p(m.updateNonexistentEdgeSource(e, t.from));
|
|
524
524
|
if (t.to !== void 0 && !this.hasPort(t.to)) throw new p(m.updateNonexistentEdgeTarget(e, t.to));
|
|
525
|
-
let n = this.getEdge(e), r = n
|
|
525
|
+
let n = this.getEdge(e), { payload: r } = n;
|
|
526
526
|
this.removeEdgeInternal(e), this.addEdgeInternal({
|
|
527
527
|
id: e,
|
|
528
528
|
from: t.from ?? n.from,
|
|
@@ -531,7 +531,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
531
531
|
priority: r.priority
|
|
532
532
|
});
|
|
533
533
|
}
|
|
534
|
-
let n = this.
|
|
534
|
+
let n = this.getEdge(e);
|
|
535
535
|
t.shape !== void 0 && (n.payload.shape = t.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), t.priority !== void 0 && (n.payload.priority = t.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
|
|
536
536
|
}
|
|
537
537
|
getAllEdgeIds() {
|
|
@@ -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, C = 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
|
+
}, w = (e, t) => {
|
|
739
739
|
t === null ? e.style.removeProperty("cursor") : e.style.cursor = t;
|
|
740
|
-
},
|
|
740
|
+
}, T = (e) => {
|
|
741
741
|
let t = document.createElement("div");
|
|
742
742
|
return {
|
|
743
743
|
id: e.overlayNodeId,
|
|
@@ -750,7 +750,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
750
750
|
direction: e.portDirection
|
|
751
751
|
}]
|
|
752
752
|
};
|
|
753
|
-
},
|
|
753
|
+
}, ee = (e, t, n) => {
|
|
754
754
|
let r = t;
|
|
755
755
|
for (; r !== null;) {
|
|
756
756
|
let t = n(e.findPortIdsByElement(r));
|
|
@@ -765,11 +765,11 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
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* te(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 = te(e.shadowRoot, t);
|
|
773
773
|
for (let e of n) yield e;
|
|
774
774
|
}
|
|
775
775
|
yield e;
|
|
@@ -777,23 +777,23 @@ function* ne(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 r =
|
|
780
|
+
var ne = (e, t, n) => {
|
|
781
|
+
let r = te(document, t);
|
|
782
782
|
for (let t of r) {
|
|
783
|
-
let r =
|
|
783
|
+
let r = ee(e, t, n);
|
|
784
784
|
if (r.status === "portFound") return r.portId;
|
|
785
785
|
if (r.status === "nodeEncountered") return null;
|
|
786
786
|
}
|
|
787
787
|
return null;
|
|
788
|
-
},
|
|
788
|
+
}, E = /* @__PURE__ */ function(e) {
|
|
789
789
|
return e.StaticNodeId = "static", e.DraggingNodeId = "dragging", e.EdgeId = "edge", e;
|
|
790
|
-
}({}),
|
|
790
|
+
}({}), re = (e, t) => ({
|
|
791
791
|
x: e / 2,
|
|
792
792
|
y: t / 2
|
|
793
|
-
}),
|
|
793
|
+
}), D = (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
|
+
}), ie = (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 re = (e, t, n) => {
|
|
|
815
815
|
y: i.y - o
|
|
816
816
|
}
|
|
817
817
|
};
|
|
818
|
-
},
|
|
818
|
+
}, O = .5 * .5 * .5, k = 3 * O, ae = 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 = D({
|
|
823
823
|
x: t.x + r,
|
|
824
824
|
y: t.y
|
|
825
|
-
}, i, t), u =
|
|
825
|
+
}, i, t), u = D({
|
|
826
826
|
x: n.x - r,
|
|
827
827
|
y: n.y
|
|
828
828
|
}, a, n), d = {
|
|
@@ -831,7 +831,7 @@ var re = (e, t, n) => {
|
|
|
831
831
|
}, f = {
|
|
832
832
|
x: u.x - a.x * o,
|
|
833
833
|
y: u.y - a.y * o
|
|
834
|
-
}, p =
|
|
834
|
+
}, p = O * l.x + k * d.x + k * f.x + O * u.x, m = O * l.y + k * d.y + k * f.y + O * u.y;
|
|
835
835
|
this.midpoint = {
|
|
836
836
|
x: p,
|
|
837
837
|
y: m
|
|
@@ -839,23 +839,23 @@ var re = (e, t, n) => {
|
|
|
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
|
+
}, oe = 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 ? D({
|
|
847
847
|
x: s.x + l,
|
|
848
848
|
y: s.y
|
|
849
|
-
}, i, s) : s, f = n ?
|
|
849
|
+
}, i, s) : s, f = n ? D({
|
|
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 = D({
|
|
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
|
+
}, _ = D({
|
|
859
859
|
x: c.x - l,
|
|
860
860
|
y: c.y
|
|
861
861
|
}, a, c), v = {
|
|
@@ -873,7 +873,7 @@ var re = (e, t, n) => {
|
|
|
873
873
|
}, S = {
|
|
874
874
|
x: h.x + p,
|
|
875
875
|
y: h.y + m
|
|
876
|
-
},
|
|
876
|
+
}, C = {
|
|
877
877
|
x: _.x + p,
|
|
878
878
|
y: _.y + m
|
|
879
879
|
};
|
|
@@ -881,22 +881,22 @@ var re = (e, t, n) => {
|
|
|
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 ${C.x} ${C.y} ${x.x} ${x.y} ${_.x} ${_.y}`,
|
|
885
885
|
`L ${f.x} ${f.y}`
|
|
886
886
|
].join(" "), this.midpoint = y;
|
|
887
887
|
}
|
|
888
|
-
},
|
|
888
|
+
}, A = Object.freeze({ edgeColor: "--edge-color" }), se = (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(A.edgeColor, e), t;
|
|
891
|
+
}, ce = (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(${A.edgeColor})`), t.setAttribute("stroke-width", `${e}`), t.setAttribute("fill", "none"), t;
|
|
894
|
+
}, j = () => {
|
|
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(${A.edgeColor})`), e;
|
|
897
|
+
}, le = (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
|
+
}, M = (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 re = (e, t, n) => {
|
|
|
917
917
|
});
|
|
918
918
|
}
|
|
919
919
|
return n.join(" ");
|
|
920
|
-
},
|
|
920
|
+
}, ue = (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 re = (e, t, n) => {
|
|
|
991
991
|
y: s
|
|
992
992
|
}
|
|
993
993
|
};
|
|
994
|
-
},
|
|
994
|
+
}, N = (e) => ({
|
|
995
995
|
x: e.y,
|
|
996
996
|
y: e.x
|
|
997
|
-
}),
|
|
998
|
-
let n =
|
|
999
|
-
arrowPoint:
|
|
1000
|
-
linePoint:
|
|
1001
|
-
dir:
|
|
997
|
+
}), de = (e, t) => {
|
|
998
|
+
let n = ue({
|
|
999
|
+
arrowPoint: N(e.arrowPoint),
|
|
1000
|
+
linePoint: N(e.linePoint),
|
|
1001
|
+
dir: N(e.dir)
|
|
1002
1002
|
}, {
|
|
1003
|
-
arrowPoint:
|
|
1004
|
-
linePoint:
|
|
1005
|
-
dir:
|
|
1003
|
+
arrowPoint: N(t.arrowPoint),
|
|
1004
|
+
linePoint: N(t.linePoint),
|
|
1005
|
+
dir: N(t.dir)
|
|
1006
1006
|
});
|
|
1007
1007
|
return {
|
|
1008
|
-
points: n.points.map((e) =>
|
|
1009
|
-
midpoint:
|
|
1008
|
+
points: n.points.map((e) => N(e)),
|
|
1009
|
+
midpoint: N(n.midpoint)
|
|
1010
1010
|
};
|
|
1011
|
-
},
|
|
1011
|
+
}, P = (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 re = (e, t, n) => {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
if (r === 0 && e.length > 0) return e[0];
|
|
1036
1036
|
throw Error("Failed to calculate midpoint");
|
|
1037
|
-
},
|
|
1037
|
+
}, fe = (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 re = (e, t, n) => {
|
|
|
1048
1048
|
e,
|
|
1049
1049
|
a
|
|
1050
1050
|
],
|
|
1051
|
-
midpoint:
|
|
1051
|
+
midpoint: P([
|
|
1052
1052
|
n,
|
|
1053
1053
|
e,
|
|
1054
1054
|
i
|
|
@@ -1070,7 +1070,7 @@ var re = (e, t, n) => {
|
|
|
1070
1070
|
i,
|
|
1071
1071
|
a
|
|
1072
1072
|
],
|
|
1073
|
-
midpoint:
|
|
1073
|
+
midpoint: P([
|
|
1074
1074
|
n,
|
|
1075
1075
|
t,
|
|
1076
1076
|
o,
|
|
@@ -1094,7 +1094,7 @@ var re = (e, t, n) => {
|
|
|
1094
1094
|
o,
|
|
1095
1095
|
a
|
|
1096
1096
|
],
|
|
1097
|
-
midpoint:
|
|
1097
|
+
midpoint: P([
|
|
1098
1098
|
n,
|
|
1099
1099
|
t,
|
|
1100
1100
|
o,
|
|
@@ -1114,46 +1114,46 @@ var re = (e, t, n) => {
|
|
|
1114
1114
|
i,
|
|
1115
1115
|
a
|
|
1116
1116
|
],
|
|
1117
|
-
midpoint:
|
|
1117
|
+
midpoint: P([
|
|
1118
1118
|
n,
|
|
1119
1119
|
d,
|
|
1120
1120
|
i
|
|
1121
1121
|
])
|
|
1122
1122
|
};
|
|
1123
|
-
},
|
|
1124
|
-
let n =
|
|
1125
|
-
arrowPoint:
|
|
1126
|
-
linePoint:
|
|
1127
|
-
dir:
|
|
1123
|
+
}, pe = (e, t) => {
|
|
1124
|
+
let n = fe({
|
|
1125
|
+
arrowPoint: N(e.arrowPoint),
|
|
1126
|
+
linePoint: N(e.linePoint),
|
|
1127
|
+
dir: N(e.dir)
|
|
1128
1128
|
}, {
|
|
1129
|
-
arrowPoint:
|
|
1130
|
-
linePoint:
|
|
1131
|
-
dir:
|
|
1129
|
+
arrowPoint: N(t.arrowPoint),
|
|
1130
|
+
linePoint: N(t.linePoint),
|
|
1131
|
+
dir: N(t.dir)
|
|
1132
1132
|
});
|
|
1133
1133
|
return {
|
|
1134
|
-
points: n.points.map((e) =>
|
|
1135
|
-
midpoint:
|
|
1134
|
+
points: n.points.map((e) => N(e)),
|
|
1135
|
+
midpoint: N(n.midpoint)
|
|
1136
1136
|
};
|
|
1137
|
-
},
|
|
1137
|
+
}, me = (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 ? ue(e, t) : fe(e, t) : r ? pe(e, t) : de(e, t);
|
|
1140
|
+
}, he = 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 ? D({
|
|
1145
1145
|
x: r.x + a,
|
|
1146
1146
|
y: r.y
|
|
1147
|
-
}, o, r) : r, p = n ?
|
|
1147
|
+
}, o, r) : r, p = n ? D({
|
|
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, _ = D({
|
|
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 = D({
|
|
1157
1157
|
x: i.x - m,
|
|
1158
1158
|
y: i.y
|
|
1159
1159
|
}, s, i), b = {
|
|
@@ -1163,7 +1163,7 @@ var re = (e, t, n) => {
|
|
|
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 = M([
|
|
1167
1167
|
f,
|
|
1168
1168
|
_,
|
|
1169
1169
|
v,
|
|
@@ -1172,18 +1172,18 @@ var re = (e, t, n) => {
|
|
|
1172
1172
|
p
|
|
1173
1173
|
], d);
|
|
1174
1174
|
}
|
|
1175
|
-
},
|
|
1175
|
+
}, ge = 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 = D({
|
|
1180
1180
|
x: t.x + f,
|
|
1181
1181
|
y: t.y
|
|
1182
|
-
}, o, t), m =
|
|
1182
|
+
}, o, t), m = D({
|
|
1183
1183
|
x: n.x - f,
|
|
1184
1184
|
y: n.y
|
|
1185
1185
|
}, s, n);
|
|
1186
|
-
this.path =
|
|
1186
|
+
this.path = M([
|
|
1187
1187
|
u,
|
|
1188
1188
|
p,
|
|
1189
1189
|
m,
|
|
@@ -1196,28 +1196,28 @@ var re = (e, t, n) => {
|
|
|
1196
1196
|
};
|
|
1197
1197
|
}
|
|
1198
1198
|
createArrowPoint(e, t, n, r) {
|
|
1199
|
-
return e ?
|
|
1199
|
+
return e ? D({
|
|
1200
1200
|
x: n.x + r,
|
|
1201
1201
|
y: n.y
|
|
1202
1202
|
}, t, n) : n;
|
|
1203
1203
|
}
|
|
1204
|
-
},
|
|
1204
|
+
}, _e = 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 ? D({
|
|
1209
1209
|
x: t.x + a,
|
|
1210
1210
|
y: t.y
|
|
1211
|
-
}, r, t) : t, d = l ?
|
|
1211
|
+
}, r, t) : t, d = l ? D({
|
|
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 = D({
|
|
1215
1215
|
x: t.x + f,
|
|
1216
1216
|
y: t.y
|
|
1217
|
-
}, r, t), m =
|
|
1217
|
+
}, r, t), m = D({
|
|
1218
1218
|
x: n.x - f,
|
|
1219
1219
|
y: n.y
|
|
1220
|
-
}, i, n), h =
|
|
1220
|
+
}, i, n), h = me({
|
|
1221
1221
|
arrowPoint: u,
|
|
1222
1222
|
linePoint: p,
|
|
1223
1223
|
dir: r
|
|
@@ -1226,9 +1226,9 @@ var re = (e, t, n) => {
|
|
|
1226
1226
|
linePoint: m,
|
|
1227
1227
|
dir: i
|
|
1228
1228
|
});
|
|
1229
|
-
this.path =
|
|
1229
|
+
this.path = M(h.points, s), this.midpoint = h.midpoint;
|
|
1230
1230
|
}
|
|
1231
|
-
},
|
|
1231
|
+
}, ve = class {
|
|
1232
1232
|
path;
|
|
1233
1233
|
midpoint;
|
|
1234
1234
|
constructor(e) {
|
|
@@ -1265,19 +1265,19 @@ var re = (e, t, n) => {
|
|
|
1265
1265
|
x: n,
|
|
1266
1266
|
y: 0
|
|
1267
1267
|
}
|
|
1268
|
-
].map((e) =>
|
|
1268
|
+
].map((e) => D(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}${M(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
|
+
}, ye = class {
|
|
1281
1281
|
path;
|
|
1282
1282
|
midpoint;
|
|
1283
1283
|
constructor(e) {
|
|
@@ -1298,7 +1298,7 @@ var re = (e, t, n) => {
|
|
|
1298
1298
|
x: d,
|
|
1299
1299
|
y: 0
|
|
1300
1300
|
}
|
|
1301
|
-
].map((e) =>
|
|
1301
|
+
].map((e) => D(e, i, {
|
|
1302
1302
|
x: 0,
|
|
1303
1303
|
y: 0
|
|
1304
1304
|
})).map((e) => ({
|
|
@@ -1312,30 +1312,30 @@ var re = (e, t, n) => {
|
|
|
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
|
+
}, be = (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
|
+
}, xe = 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 ? D({
|
|
1323
1323
|
x: i.x + r,
|
|
1324
1324
|
y: i.y
|
|
1325
|
-
}, o, i) : i, f = n ?
|
|
1325
|
+
}, o, i) : i, f = n ? D({
|
|
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 = D({
|
|
1329
1329
|
x: i.x + p,
|
|
1330
1330
|
y: i.y
|
|
1331
|
-
}, o, i), h =
|
|
1331
|
+
}, o, i), h = D({
|
|
1332
1332
|
x: a.x - p,
|
|
1333
1333
|
y: a.y
|
|
1334
|
-
}, s, a), g =
|
|
1334
|
+
}, s, a), g = be(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 = M([
|
|
1339
1339
|
d,
|
|
1340
1340
|
m,
|
|
1341
1341
|
{
|
|
@@ -1350,30 +1350,30 @@ var re = (e, t, n) => {
|
|
|
1350
1350
|
f
|
|
1351
1351
|
], l);
|
|
1352
1352
|
}
|
|
1353
|
-
},
|
|
1353
|
+
}, Se = (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
|
+
}, Ce = 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 ? D({
|
|
1361
1361
|
x: o.x + r,
|
|
1362
1362
|
y: o.y
|
|
1363
|
-
}, i, o) : o, f = n ?
|
|
1363
|
+
}, i, o) : o, f = n ? D({
|
|
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 = D({
|
|
1367
1367
|
x: o.x + p,
|
|
1368
1368
|
y: o.y
|
|
1369
|
-
}, i, o), h =
|
|
1369
|
+
}, i, o), h = D({
|
|
1370
1370
|
x: s.x - p,
|
|
1371
1371
|
y: s.y
|
|
1372
|
-
}, a, s), g =
|
|
1372
|
+
}, a, s), g = Se(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 = M([
|
|
1377
1377
|
d,
|
|
1378
1378
|
m,
|
|
1379
1379
|
{
|
|
@@ -1388,25 +1388,25 @@ var re = (e, t, n) => {
|
|
|
1388
1388
|
f
|
|
1389
1389
|
], u);
|
|
1390
1390
|
}
|
|
1391
|
-
},
|
|
1391
|
+
}, we = 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 xe(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 Ce(e);
|
|
1403
1403
|
this.path = t.path, this.midpoint = t.midpoint;
|
|
1404
1404
|
return;
|
|
1405
1405
|
}
|
|
1406
|
-
let r = new
|
|
1406
|
+
let r = new _e(e);
|
|
1407
1407
|
this.path = r.path, this.midpoint = r.midpoint;
|
|
1408
1408
|
}
|
|
1409
|
-
},
|
|
1409
|
+
}, F = Object.freeze({
|
|
1410
1410
|
color: "#777777",
|
|
1411
1411
|
width: 1,
|
|
1412
1412
|
arrowLength: 20,
|
|
@@ -1428,10 +1428,10 @@ var re = (e, t, n) => {
|
|
|
1428
1428
|
curvature: 90,
|
|
1429
1429
|
interactiveWidth: 10,
|
|
1430
1430
|
portOffset: 0
|
|
1431
|
-
}),
|
|
1431
|
+
}), Te = (e) => ({
|
|
1432
1432
|
x: Math.cos(e),
|
|
1433
1433
|
y: Math.sin(e)
|
|
1434
|
-
}),
|
|
1434
|
+
}), I = class {
|
|
1435
1435
|
params;
|
|
1436
1436
|
element;
|
|
1437
1437
|
group = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
@@ -1442,17 +1442,17 @@ var re = (e, t, n) => {
|
|
|
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 = se(e.color), this.element.appendChild(this.group), this.line = ce(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = j(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = j(), 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 } = ie(t.from, t.to, this.params.padding);
|
|
1449
|
+
le(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 = Te(t.from.direction), l = Te(t.to.direction), u = {
|
|
1456
1456
|
x: -l.x,
|
|
1457
1457
|
y: -l.y
|
|
1458
1458
|
}, d;
|
|
@@ -1476,7 +1476,7 @@ var re = (e, t, n) => {
|
|
|
1476
1476
|
targetArrowPath: m
|
|
1477
1477
|
});
|
|
1478
1478
|
}
|
|
1479
|
-
},
|
|
1479
|
+
}, Ee = (e) => (t) => {
|
|
1480
1480
|
let n = [
|
|
1481
1481
|
{
|
|
1482
1482
|
x: 0,
|
|
@@ -1490,7 +1490,7 @@ var re = (e, t, n) => {
|
|
|
1490
1490
|
x: t.arrowLength,
|
|
1491
1491
|
y: -e.radius
|
|
1492
1492
|
}
|
|
1493
|
-
].map((e) =>
|
|
1493
|
+
].map((e) => D(e, t.direction, {
|
|
1494
1494
|
x: 0,
|
|
1495
1495
|
y: 0
|
|
1496
1496
|
})).map((e) => ({
|
|
@@ -1498,7 +1498,7 @@ var re = (e, t, n) => {
|
|
|
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
|
+
}, De = (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 re = (e, t, n) => {
|
|
|
1512
1512
|
x: o,
|
|
1513
1513
|
y: s
|
|
1514
1514
|
}
|
|
1515
|
-
].map((e) =>
|
|
1515
|
+
].map((e) => D(e, t.direction, {
|
|
1516
1516
|
x: 0,
|
|
1517
1517
|
y: 0
|
|
1518
1518
|
})).map((e) => ({
|
|
@@ -1520,8 +1520,8 @@ var re = (e, t, n) => {
|
|
|
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
|
+
}, Oe = (e) => (t) => {
|
|
1524
|
+
let n = e.smallRadius, r = e.radius, i = D({
|
|
1525
1525
|
x: t.arrowLength,
|
|
1526
1526
|
y: 0
|
|
1527
1527
|
}, {
|
|
@@ -1540,7 +1540,7 @@ var re = (e, t, n) => {
|
|
|
1540
1540
|
y: -i.y
|
|
1541
1541
|
},
|
|
1542
1542
|
i
|
|
1543
|
-
].map((e) =>
|
|
1543
|
+
].map((e) => D(e, t.direction, {
|
|
1544
1544
|
x: 0,
|
|
1545
1545
|
y: 0
|
|
1546
1546
|
})).map((e) => ({
|
|
@@ -1548,18 +1548,18 @@ var re = (e, t, n) => {
|
|
|
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
|
+
}, L = (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 Ee({ radius: e.radius ?? F.polygonArrowRadius });
|
|
1555
|
+
case "arc": return De({ radius: e.radius ?? F.circleArrowRadius });
|
|
1556
|
+
default: return Oe({
|
|
1557
|
+
smallRadius: e.smallRadius ?? F.wedgeArrowSmallRadius,
|
|
1558
|
+
angle: e.angle ?? F.wedgeArrowAngle,
|
|
1559
|
+
radius: e.radius ?? F.wedgeArrowRadius
|
|
1560
1560
|
});
|
|
1561
1561
|
}
|
|
1562
|
-
},
|
|
1562
|
+
}, ke = class {
|
|
1563
1563
|
element;
|
|
1564
1564
|
group;
|
|
1565
1565
|
line;
|
|
@@ -1575,7 +1575,7 @@ var re = (e, t, n) => {
|
|
|
1575
1575
|
hasSourceArrow;
|
|
1576
1576
|
hasTargetArrow;
|
|
1577
1577
|
pathShape;
|
|
1578
|
-
createCyclePath = (e, t, n) => new
|
|
1578
|
+
createCyclePath = (e, t, n) => new ye({
|
|
1579
1579
|
origin: e,
|
|
1580
1580
|
dir: n,
|
|
1581
1581
|
radius: this.portCycleRadius,
|
|
@@ -1583,7 +1583,7 @@ var re = (e, t, n) => {
|
|
|
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 oe({
|
|
1587
1587
|
from: e,
|
|
1588
1588
|
to: t,
|
|
1589
1589
|
fromDir: n,
|
|
@@ -1595,7 +1595,7 @@ var re = (e, t, n) => {
|
|
|
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 ae({
|
|
1599
1599
|
from: e,
|
|
1600
1600
|
to: t,
|
|
1601
1601
|
fromDir: n,
|
|
@@ -1606,10 +1606,10 @@ var re = (e, t, n) => {
|
|
|
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 ?? F.arrowLength, this.curvature = e?.curvature ?? F.curvature, this.portCycleRadius = e?.cycleRadius ?? F.cycleRadius, this.portCycleSmallRadius = e?.smallCycleRadius ?? F.smallCycleRadius, this.detourDirection = e?.detourDirection ?? F.detourDirection, this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
|
|
1610
|
+
color: e?.color ?? F.color,
|
|
1611
|
+
width: e?.width ?? F.width,
|
|
1612
|
+
arrowRenderer: L(e?.arrowRenderer ?? {}),
|
|
1613
1613
|
arrowLength: this.arrowLength,
|
|
1614
1614
|
hasSourceArrow: this.hasSourceArrow,
|
|
1615
1615
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1622,7 +1622,7 @@ var re = (e, t, n) => {
|
|
|
1622
1622
|
render(e) {
|
|
1623
1623
|
this.pathShape.render(e);
|
|
1624
1624
|
}
|
|
1625
|
-
},
|
|
1625
|
+
}, Ae = class {
|
|
1626
1626
|
element;
|
|
1627
1627
|
group;
|
|
1628
1628
|
line;
|
|
@@ -1638,7 +1638,7 @@ var re = (e, t, n) => {
|
|
|
1638
1638
|
hasSourceArrow;
|
|
1639
1639
|
hasTargetArrow;
|
|
1640
1640
|
pathShape;
|
|
1641
|
-
createCyclePath = (e, t, n) => new
|
|
1641
|
+
createCyclePath = (e, t, n) => new ve({
|
|
1642
1642
|
origin: e,
|
|
1643
1643
|
dir: n,
|
|
1644
1644
|
arrowLength: this.arrowLength,
|
|
@@ -1647,7 +1647,7 @@ var re = (e, t, n) => {
|
|
|
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 he({
|
|
1651
1651
|
from: e,
|
|
1652
1652
|
to: t,
|
|
1653
1653
|
fromDir: n,
|
|
@@ -1660,7 +1660,7 @@ var re = (e, t, n) => {
|
|
|
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 ge({
|
|
1664
1664
|
from: e,
|
|
1665
1665
|
to: t,
|
|
1666
1666
|
fromDir: n,
|
|
@@ -1672,12 +1672,12 @@ var re = (e, t, n) => {
|
|
|
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 ?? F.arrowLength, this.arrowOffset = e?.arrowOffset ?? F.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? F.cycleSquareSide;
|
|
1676
|
+
let t = e?.roundness ?? F.roundness;
|
|
1677
|
+
this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDirection = e?.detourDirection ?? F.detourDirection, this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
|
|
1678
|
+
color: e?.color ?? F.color,
|
|
1679
|
+
width: e?.width ?? F.width,
|
|
1680
|
+
arrowRenderer: L(e?.arrowRenderer ?? {}),
|
|
1681
1681
|
arrowLength: this.arrowLength,
|
|
1682
1682
|
hasSourceArrow: this.hasSourceArrow,
|
|
1683
1683
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1690,10 +1690,10 @@ var re = (e, t, n) => {
|
|
|
1690
1690
|
render(e) {
|
|
1691
1691
|
this.pathShape.render(e);
|
|
1692
1692
|
}
|
|
1693
|
-
},
|
|
1693
|
+
}, je = (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
|
+
}, Me = class {
|
|
1697
1697
|
element;
|
|
1698
1698
|
group;
|
|
1699
1699
|
line;
|
|
@@ -1708,7 +1708,7 @@ var re = (e, t, n) => {
|
|
|
1708
1708
|
hasSourceArrow;
|
|
1709
1709
|
hasTargetArrow;
|
|
1710
1710
|
pathShape;
|
|
1711
|
-
createCyclePath = (e, t, n) => new
|
|
1711
|
+
createCyclePath = (e, t, n) => new ve({
|
|
1712
1712
|
origin: e,
|
|
1713
1713
|
dir: n,
|
|
1714
1714
|
arrowLength: this.arrowLength,
|
|
@@ -1717,7 +1717,7 @@ var re = (e, t, n) => {
|
|
|
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 we({
|
|
1721
1721
|
from: e,
|
|
1722
1722
|
to: t,
|
|
1723
1723
|
fromDir: n,
|
|
@@ -1729,7 +1729,7 @@ var re = (e, t, n) => {
|
|
|
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 _e({
|
|
1733
1733
|
from: e,
|
|
1734
1734
|
to: t,
|
|
1735
1735
|
fromDir: n,
|
|
@@ -1741,12 +1741,12 @@ var re = (e, t, n) => {
|
|
|
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 ?? F.arrowLength, this.arrowOffset = e?.arrowOffset ?? F.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? F.cycleSquareSide;
|
|
1745
|
+
let t = e?.roundness ?? F.roundness;
|
|
1746
|
+
this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
|
|
1747
|
+
color: e?.color ?? F.color,
|
|
1748
|
+
width: e?.width ?? F.width,
|
|
1749
|
+
arrowRenderer: L(e?.arrowRenderer ?? {}),
|
|
1750
1750
|
arrowLength: this.arrowLength,
|
|
1751
1751
|
hasSourceArrow: this.hasSourceArrow,
|
|
1752
1752
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1762,18 +1762,18 @@ var re = (e, t, n) => {
|
|
|
1762
1762
|
category: r,
|
|
1763
1763
|
from: {
|
|
1764
1764
|
...t,
|
|
1765
|
-
direction:
|
|
1765
|
+
direction: je(t.direction)
|
|
1766
1766
|
},
|
|
1767
1767
|
to: {
|
|
1768
1768
|
...n,
|
|
1769
|
-
direction:
|
|
1769
|
+
direction: je(n.direction)
|
|
1770
1770
|
}
|
|
1771
1771
|
});
|
|
1772
1772
|
}
|
|
1773
|
-
},
|
|
1773
|
+
}, Ne = (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
|
+
}, Pe = (e) => typeof e == "number" ? () => e : e === "box" ? Ne : e, Fe = F.portOffset, R = class {
|
|
1777
1777
|
element;
|
|
1778
1778
|
group = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1779
1779
|
line;
|
|
@@ -1788,11 +1788,11 @@ var re = (e, t, n) => {
|
|
|
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 ?? F.color, this.width = e?.width ?? F.width, this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowRenderer = L(e?.arrowRenderer ?? {}), this.sourceOffsetFn = Pe(e?.sourceOffset ?? Fe), this.targetOffsetFn = Pe(e?.targetOffset ?? Fe), this.element = se(this.color), this.element.appendChild(this.group), this.line = ce(this.width), this.group.appendChild(this.line), e?.hasSourceArrow && (this.sourceArrow = j(), this.group.appendChild(this.sourceArrow)), e?.hasTargetArrow && (this.targetArrow = j(), 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 } = ie(e.from, e.to, 50);
|
|
1795
|
+
le(this.element, {
|
|
1796
1796
|
x: t,
|
|
1797
1797
|
y: n,
|
|
1798
1798
|
width: r,
|
|
@@ -1890,43 +1890,43 @@ var re = (e, t, n) => {
|
|
|
1890
1890
|
targetArrowPath: n
|
|
1891
1891
|
});
|
|
1892
1892
|
}
|
|
1893
|
-
},
|
|
1893
|
+
}, Ie = () => {
|
|
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
|
+
}, Le = (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
|
+
}, Re = (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
|
+
}, ze = class extends Error {
|
|
1903
1903
|
constructor(e) {
|
|
1904
1904
|
super(e), this.name = "InteractiveEdgeError";
|
|
1905
1905
|
}
|
|
1906
|
-
},
|
|
1906
|
+
}, Be = class e {
|
|
1907
1907
|
baseEdge;
|
|
1908
1908
|
element;
|
|
1909
1909
|
group;
|
|
1910
1910
|
line;
|
|
1911
1911
|
sourceArrow;
|
|
1912
1912
|
targetArrow;
|
|
1913
|
-
handle =
|
|
1913
|
+
handle = Ie();
|
|
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 ze("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 ?? F.interactiveWidth;
|
|
1922
|
+
this.interactiveLine = Le(r), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Re(r), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Re(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
|
+
}, Ve = class {
|
|
1930
1930
|
baseShape;
|
|
1931
1931
|
midpointElement;
|
|
1932
1932
|
group;
|
|
@@ -1944,7 +1944,7 @@ var re = (e, t, n) => {
|
|
|
1944
1944
|
render(e) {
|
|
1945
1945
|
this.baseShape.render(e);
|
|
1946
1946
|
}
|
|
1947
|
-
},
|
|
1947
|
+
}, He = class {
|
|
1948
1948
|
graphStore;
|
|
1949
1949
|
onAfterNodeAdded;
|
|
1950
1950
|
onAfterNodeUpdated;
|
|
@@ -2043,7 +2043,7 @@ var re = (e, t, n) => {
|
|
|
2043
2043
|
getNodeAdjacentEdgeIds(e) {
|
|
2044
2044
|
return this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
2045
2045
|
}
|
|
2046
|
-
},
|
|
2046
|
+
}, z = class {
|
|
2047
2047
|
checkExists;
|
|
2048
2048
|
counter = 0;
|
|
2049
2049
|
constructor(e) {
|
|
@@ -2057,13 +2057,13 @@ var re = (e, t, n) => {
|
|
|
2057
2057
|
reset() {
|
|
2058
2058
|
this.counter = 0;
|
|
2059
2059
|
}
|
|
2060
|
-
},
|
|
2060
|
+
}, Ue = class {
|
|
2061
2061
|
graphStore;
|
|
2062
2062
|
htmlView;
|
|
2063
2063
|
params;
|
|
2064
|
-
nodeIdGenerator = new
|
|
2065
|
-
portIdGenerator = new
|
|
2066
|
-
edgeIdGenerator = new
|
|
2064
|
+
nodeIdGenerator = new z((e) => this.graphStore.hasNode(e));
|
|
2065
|
+
portIdGenerator = new z((e) => this.graphStore.hasPort(e));
|
|
2066
|
+
edgeIdGenerator = new z((e) => this.graphStore.hasEdge(e));
|
|
2067
2067
|
onAfterNodeAdded = (e) => {
|
|
2068
2068
|
this.htmlView.attachNode(e);
|
|
2069
2069
|
};
|
|
@@ -2170,13 +2170,13 @@ var re = (e, t, n) => {
|
|
|
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
|
+
}, We = (e) => {
|
|
2174
2174
|
queueMicrotask(() => {
|
|
2175
2175
|
e();
|
|
2176
2176
|
});
|
|
2177
|
-
},
|
|
2177
|
+
}, B = (e) => {
|
|
2178
2178
|
e();
|
|
2179
|
-
},
|
|
2179
|
+
}, Ge = class {
|
|
2180
2180
|
viewportStore;
|
|
2181
2181
|
onBeforeUpdated;
|
|
2182
2182
|
onAfterUpdated;
|
|
@@ -2199,7 +2199,7 @@ var re = (e, t, n) => {
|
|
|
2199
2199
|
createViewportCoords(e) {
|
|
2200
2200
|
return this.viewportStore.createViewportCoords(e);
|
|
2201
2201
|
}
|
|
2202
|
-
},
|
|
2202
|
+
}, Ke = (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 re = (e, t, n) => {
|
|
|
2209
2209
|
nodes: e.nodes ?? [],
|
|
2210
2210
|
contentPadding: e.contentPadding ?? t.focus.contentPadding,
|
|
2211
2211
|
animationDuration: e.animationDuration ?? t.focus.animationDuration
|
|
2212
|
-
},
|
|
2212
|
+
}, qe = (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
|
+
}), Je = (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
|
+
}), Ye = class {
|
|
2221
2221
|
graphStore;
|
|
2222
2222
|
viewportStore;
|
|
2223
2223
|
params;
|
|
@@ -2235,16 +2235,16 @@ var re = (e, t, n) => {
|
|
|
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 = qe(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 = Je(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 = Ke(e ?? {}, this.params);
|
|
2248
2248
|
this.params.focus.schedule(() => {
|
|
2249
2249
|
this.navigate(t);
|
|
2250
2250
|
});
|
|
@@ -2286,25 +2286,25 @@ var re = (e, t, n) => {
|
|
|
2286
2286
|
};
|
|
2287
2287
|
this.win.requestAnimationFrame(a);
|
|
2288
2288
|
}
|
|
2289
|
-
},
|
|
2289
|
+
}, Xe = (e, t, n) => {
|
|
2290
2290
|
let r = new h();
|
|
2291
|
-
return new d(new
|
|
2291
|
+
return new d(new He(r), new Ge(t), new Ue(r, new a(r, t, e), {
|
|
2292
2292
|
nodes: {
|
|
2293
|
-
centerFn:
|
|
2293
|
+
centerFn: re,
|
|
2294
2294
|
priorityFn: () => 0
|
|
2295
2295
|
},
|
|
2296
2296
|
edges: {
|
|
2297
|
-
shapeFactory: () => new
|
|
2297
|
+
shapeFactory: () => new R(),
|
|
2298
2298
|
priorityFn: () => 0
|
|
2299
2299
|
},
|
|
2300
2300
|
ports: { direction: 0 }
|
|
2301
|
-
}), new
|
|
2301
|
+
}), new Ye(r, t, { focus: {
|
|
2302
2302
|
contentPadding: 0,
|
|
2303
2303
|
minContentScale: 0,
|
|
2304
|
-
schedule:
|
|
2304
|
+
schedule: B,
|
|
2305
2305
|
animationDuration: 0
|
|
2306
2306
|
} }, n));
|
|
2307
|
-
},
|
|
2307
|
+
}, V = Symbol(), Ze = class e {
|
|
2308
2308
|
canvas;
|
|
2309
2309
|
window;
|
|
2310
2310
|
pointInsideVerifier;
|
|
@@ -2325,7 +2325,7 @@ var re = (e, t, n) => {
|
|
|
2325
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, V), 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 re = (e, t, n) => {
|
|
|
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, V), 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 re = (e, t, n) => {
|
|
|
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
|
+
}, H = Symbol(), Qe = class {
|
|
2402
2402
|
has(e, t) {
|
|
2403
|
-
let n = e[
|
|
2403
|
+
let n = e[H];
|
|
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[H];
|
|
2408
|
+
r === void 0 ? n[H] = /* @__PURE__ */ new Set([t]) : r.add(t);
|
|
2409
2409
|
}
|
|
2410
|
-
},
|
|
2410
|
+
}, U = Symbol(), W = class {
|
|
2411
2411
|
window;
|
|
2412
2412
|
pointInsideVerifier;
|
|
2413
2413
|
onSelected;
|
|
@@ -2488,10 +2488,10 @@ var re = (e, t, n) => {
|
|
|
2488
2488
|
let r = Math.sqrt(e * e + t * t);
|
|
2489
2489
|
this.movedDistance += r, this.movedDistance > this.movementThreshold && n();
|
|
2490
2490
|
}
|
|
2491
|
-
},
|
|
2491
|
+
}, G = (e, t) => ({
|
|
2492
2492
|
from: e.isDirect ? e.staticPortId : t,
|
|
2493
2493
|
to: e.isDirect ? t : e.staticPortId
|
|
2494
|
-
}),
|
|
2494
|
+
}), $e = class {
|
|
2495
2495
|
graph;
|
|
2496
2496
|
connectionAllowedVerifier;
|
|
2497
2497
|
constructor(e, t) {
|
|
@@ -2502,7 +2502,7 @@ var re = (e, t, n) => {
|
|
|
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 = G(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 re = (e, t, n) => {
|
|
|
2511
2511
|
v < n && (n = v, t = o);
|
|
2512
2512
|
}), t;
|
|
2513
2513
|
}
|
|
2514
|
-
},
|
|
2514
|
+
}, et = class {
|
|
2515
2515
|
direction;
|
|
2516
2516
|
constructor(e) {
|
|
2517
2517
|
this.direction = e;
|
|
@@ -2519,7 +2519,7 @@ var re = (e, t, n) => {
|
|
|
2519
2519
|
resolve() {
|
|
2520
2520
|
return this.direction;
|
|
2521
2521
|
}
|
|
2522
|
-
},
|
|
2522
|
+
}, K = (e) => e.length > 0 ? e[0] : null, tt = class e {
|
|
2523
2523
|
canvas;
|
|
2524
2524
|
element;
|
|
2525
2525
|
window;
|
|
@@ -2542,12 +2542,12 @@ var re = (e, t, n) => {
|
|
|
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, V)) 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, V), 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 re = (e, t, n) => {
|
|
|
2556
2556
|
nodeId: r,
|
|
2557
2557
|
dx: a.x - i.x,
|
|
2558
2558
|
dy: a.y - i.y
|
|
2559
|
-
},
|
|
2559
|
+
}, w(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, V)) 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, V);
|
|
2568
2568
|
let o = this.calculateContentPoint({
|
|
2569
2569
|
x: n.clientX,
|
|
2570
2570
|
y: n.clientY
|
|
@@ -2641,7 +2641,7 @@ var re = (e, t, n) => {
|
|
|
2641
2641
|
}
|
|
2642
2642
|
}
|
|
2643
2643
|
stopMouseDrag() {
|
|
2644
|
-
this.finishDrag(),
|
|
2644
|
+
this.finishDrag(), w(this.element, null), this.removeMouseDragListeners();
|
|
2645
2645
|
}
|
|
2646
2646
|
removeMouseDragListeners() {
|
|
2647
2647
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -2678,7 +2678,7 @@ var re = (e, t, n) => {
|
|
|
2678
2678
|
let e = this.grabbedNodeState.nodeId;
|
|
2679
2679
|
this.graph.hasNode(e) && this.params.onNodeDragFinished(e), this.grabbedNodeState = null;
|
|
2680
2680
|
}
|
|
2681
|
-
},
|
|
2681
|
+
}, q = (e) => {
|
|
2682
2682
|
let t = [], n = e.touches.length;
|
|
2683
2683
|
for (let r = 0; r < n; r++) t.push([e.touches[r].clientX, e.touches[r].clientY]);
|
|
2684
2684
|
let r = t.reduce((e, t) => [e[0] + t[0], e[1] + t[1]], [0, 0]), i = [r[0] / n, r[1] / n], a = t.map((e) => [e[0] - i[0], e[1] - i[1]]).reduce((e, t) => e + Math.sqrt(t[0] * t[0] + t[1] * t[1]), 0);
|
|
@@ -2689,7 +2689,7 @@ var re = (e, t, n) => {
|
|
|
2689
2689
|
touchesCnt: n,
|
|
2690
2690
|
touches: t
|
|
2691
2691
|
};
|
|
2692
|
-
},
|
|
2692
|
+
}, nt = class e {
|
|
2693
2693
|
canvas;
|
|
2694
2694
|
element;
|
|
2695
2695
|
window;
|
|
@@ -2704,7 +2704,7 @@ var re = (e, t, n) => {
|
|
|
2704
2704
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2705
2705
|
};
|
|
2706
2706
|
onMouseDown = (e) => {
|
|
2707
|
-
this.eventTagger.has(e,
|
|
2707
|
+
this.eventTagger.has(e, V) || this.params.mouseDownEventVerifier(e) && (w(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,16 +2726,16 @@ var re = (e, t, n) => {
|
|
|
2726
2726
|
}, this.params.scaleWheelFinishTimeout);
|
|
2727
2727
|
};
|
|
2728
2728
|
onTouchStart = (e) => {
|
|
2729
|
-
if (!this.eventTagger.has(e,
|
|
2729
|
+
if (!this.eventTagger.has(e, V)) {
|
|
2730
2730
|
if (this.prevTouches !== null) {
|
|
2731
|
-
this.prevTouches =
|
|
2731
|
+
this.prevTouches = q(e);
|
|
2732
2732
|
return;
|
|
2733
2733
|
}
|
|
2734
|
-
this.prevTouches =
|
|
2734
|
+
this.prevTouches = q(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, { passive: !0 }), this.window.addEventListener("touchend", this.onWindowTouchFinish, { passive: !0 }), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, { passive: !0 }), this.startRegisteredTransform();
|
|
2735
2735
|
}
|
|
2736
2736
|
};
|
|
2737
2737
|
onWindowTouchMove = (e) => {
|
|
2738
|
-
let t =
|
|
2738
|
+
let t = q(e);
|
|
2739
2739
|
if (!t.touches.every((e) => this.pointInsideVerifier.verify(e[0], e[1]))) {
|
|
2740
2740
|
this.stopTouchDrag();
|
|
2741
2741
|
return;
|
|
@@ -2751,7 +2751,7 @@ var re = (e, t, n) => {
|
|
|
2751
2751
|
this.prevTouches = t;
|
|
2752
2752
|
};
|
|
2753
2753
|
onWindowTouchFinish = (e) => {
|
|
2754
|
-
e.touches.length > 0 ? this.prevTouches =
|
|
2754
|
+
e.touches.length > 0 ? this.prevTouches = q(e) : this.stopTouchDrag();
|
|
2755
2755
|
};
|
|
2756
2756
|
preventWheelScaleListener = (e) => {
|
|
2757
2757
|
e.preventDefault();
|
|
@@ -2765,7 +2765,7 @@ var re = (e, t, n) => {
|
|
|
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 = qe(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 re = (e, t, n) => {
|
|
|
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 = Je(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 re = (e, t, n) => {
|
|
|
2787
2787
|
this.performTransform(s);
|
|
2788
2788
|
}
|
|
2789
2789
|
stopMouseDrag() {
|
|
2790
|
-
|
|
2790
|
+
w(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 re = (e, t, n) => {
|
|
|
2818
2818
|
});
|
|
2819
2819
|
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(r), this.params.onResizeTransformFinished();
|
|
2820
2820
|
}
|
|
2821
|
-
},
|
|
2821
|
+
}, rt = class e {
|
|
2822
2822
|
canvas;
|
|
2823
2823
|
element;
|
|
2824
2824
|
window;
|
|
@@ -2871,7 +2871,7 @@ var re = (e, t, n) => {
|
|
|
2871
2871
|
this.scheduleLoadAreaAroundViewport(), r.onTransformFinished();
|
|
2872
2872
|
}
|
|
2873
2873
|
};
|
|
2874
|
-
|
|
2874
|
+
nt.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 re = (e, t, n) => {
|
|
|
2896
2896
|
height: u
|
|
2897
2897
|
});
|
|
2898
2898
|
}
|
|
2899
|
-
},
|
|
2899
|
+
}, it = () => {
|
|
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
|
+
}, at = () => {
|
|
2903
2903
|
let e = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2904
2904
|
return e.setAttribute("fill", "url(#pattern)"), e;
|
|
2905
|
-
},
|
|
2905
|
+
}, ot = () => {
|
|
2906
2906
|
let e = document.createElementNS("http://www.w3.org/2000/svg", "pattern");
|
|
2907
2907
|
return e.setAttribute("id", "pattern"), e;
|
|
2908
|
-
},
|
|
2908
|
+
}, st = class e {
|
|
2909
2909
|
canvas;
|
|
2910
2910
|
backgroundHost;
|
|
2911
|
-
svg =
|
|
2912
|
-
patternRenderingRectangle =
|
|
2913
|
-
pattern =
|
|
2911
|
+
svg = it();
|
|
2912
|
+
patternRenderingRectangle = at();
|
|
2913
|
+
pattern = ot();
|
|
2914
2914
|
patternContent;
|
|
2915
2915
|
tileWidth;
|
|
2916
2916
|
tileHeight;
|
|
@@ -2945,7 +2945,7 @@ var re = (e, t, n) => {
|
|
|
2945
2945
|
this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${r}`);
|
|
2946
2946
|
}
|
|
2947
2947
|
}
|
|
2948
|
-
},
|
|
2948
|
+
}, ct = class e {
|
|
2949
2949
|
canvas;
|
|
2950
2950
|
overlayLayer;
|
|
2951
2951
|
viewportStore;
|
|
@@ -2959,7 +2959,7 @@ var re = (e, t, n) => {
|
|
|
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 = Xe(this.overlayLayer, this.viewportStore, this.window);
|
|
2963
2963
|
let s = {
|
|
2964
2964
|
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
2965
2965
|
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
@@ -2979,7 +2979,7 @@ var re = (e, t, n) => {
|
|
|
2979
2979
|
},
|
|
2980
2980
|
grabbedPortIdResolver: this.params.grabbedPortIdResolver
|
|
2981
2981
|
};
|
|
2982
|
-
|
|
2982
|
+
Ze.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
|
|
2983
2983
|
}
|
|
2984
2984
|
static configure(t, n, r, i, a, o, s) {
|
|
2985
2985
|
new e(t, n, r, i, a, o, s);
|
|
@@ -2992,7 +2992,7 @@ var re = (e, t, n) => {
|
|
|
2992
2992
|
x: t.x - s.x,
|
|
2993
2993
|
y: t.y - s.y
|
|
2994
2994
|
}), u = {
|
|
2995
|
-
overlayNodeId:
|
|
2995
|
+
overlayNodeId: E.StaticNodeId,
|
|
2996
2996
|
portCoords: c,
|
|
2997
2997
|
portDirection: r.direction
|
|
2998
2998
|
}, d = n === "direct";
|
|
@@ -3004,30 +3004,33 @@ var re = (e, t, n) => {
|
|
|
3004
3004
|
cursor: t,
|
|
3005
3005
|
...this.edgeInProgress
|
|
3006
3006
|
}), p = {
|
|
3007
|
-
overlayNodeId:
|
|
3007
|
+
overlayNodeId: E.DraggingNodeId,
|
|
3008
3008
|
portCoords: l,
|
|
3009
3009
|
portDirection: f ?? r.direction
|
|
3010
3010
|
}, [m, h] = d ? [u, p] : [p, u];
|
|
3011
|
-
this.overlayCanvas.addNode(
|
|
3011
|
+
this.overlayCanvas.addNode(T(m)), this.overlayCanvas.addNode(T(h)), this.overlayCanvas.addEdge({
|
|
3012
3012
|
from: m.overlayNodeId,
|
|
3013
3013
|
to: h.overlayNodeId,
|
|
3014
|
-
shape: this.params.edgeShapeFactory(
|
|
3014
|
+
shape: this.params.edgeShapeFactory(E.EdgeId)
|
|
3015
3015
|
});
|
|
3016
3016
|
}
|
|
3017
3017
|
resetDragState() {
|
|
3018
3018
|
this.edgeInProgress = null, this.overlayCanvas.clear();
|
|
3019
3019
|
}
|
|
3020
3020
|
tryCreateConnection(e) {
|
|
3021
|
-
let t =
|
|
3021
|
+
let t = ne(this.canvas.graph, e, this.params.releasedPortIdResolver);
|
|
3022
3022
|
if (t === null) {
|
|
3023
3023
|
this.params.onEdgeCreationInterrupted(this.edgeInProgress);
|
|
3024
3024
|
return;
|
|
3025
3025
|
}
|
|
3026
|
-
let n =
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3026
|
+
let n = G(this.edgeInProgress, t);
|
|
3027
|
+
if (this.params.connectionAllowedVerifier(n)) {
|
|
3028
|
+
let e = this.params.connectionPreprocessor({
|
|
3029
|
+
from: n.from,
|
|
3030
|
+
to: n.to
|
|
3031
|
+
});
|
|
3032
|
+
this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(e), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated);
|
|
3033
|
+
} else this.params.onEdgeCreationPrevented(n);
|
|
3031
3034
|
}
|
|
3032
3035
|
moveDraggingPort(e) {
|
|
3033
3036
|
let t = this.overlayLayer.getBoundingClientRect(), n = this.canvas.viewport.createContentCoords({
|
|
@@ -3037,12 +3040,12 @@ var re = (e, t, n) => {
|
|
|
3037
3040
|
cursor: e,
|
|
3038
3041
|
...this.edgeInProgress
|
|
3039
3042
|
});
|
|
3040
|
-
this.overlayCanvas.updateNode(
|
|
3043
|
+
this.overlayCanvas.updateNode(E.DraggingNodeId, {
|
|
3041
3044
|
x: n.x,
|
|
3042
3045
|
y: n.y
|
|
3043
|
-
}).updatePort(
|
|
3046
|
+
}).updatePort(E.DraggingNodeId, { direction: r });
|
|
3044
3047
|
}
|
|
3045
|
-
},
|
|
3048
|
+
}, lt = class e {
|
|
3046
3049
|
canvas;
|
|
3047
3050
|
overlayLayer;
|
|
3048
3051
|
viewportStore;
|
|
@@ -3057,7 +3060,7 @@ var re = (e, t, n) => {
|
|
|
3057
3060
|
this.params.onAfterEdgeReattached(e);
|
|
3058
3061
|
};
|
|
3059
3062
|
constructor(e, t, n, r, i, a, o) {
|
|
3060
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas =
|
|
3063
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas = Xe(this.overlayLayer, this.viewportStore, this.window);
|
|
3061
3064
|
let s = {
|
|
3062
3065
|
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
3063
3066
|
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
@@ -3080,7 +3083,7 @@ var re = (e, t, n) => {
|
|
|
3080
3083
|
},
|
|
3081
3084
|
grabbedPortIdResolver: this.params.grabbedPortIdResolver
|
|
3082
3085
|
};
|
|
3083
|
-
|
|
3086
|
+
Ze.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
|
|
3084
3087
|
}
|
|
3085
3088
|
static configure(t, n, r, i, a, o, s) {
|
|
3086
3089
|
new e(t, n, r, i, a, o, s);
|
|
@@ -3111,21 +3114,21 @@ var re = (e, t, n) => {
|
|
|
3111
3114
|
priority: r.priority
|
|
3112
3115
|
}, this.canvas.removeEdge(n);
|
|
3113
3116
|
let m = {
|
|
3114
|
-
overlayNodeId:
|
|
3117
|
+
overlayNodeId: E.StaticNodeId,
|
|
3115
3118
|
portCoords: f,
|
|
3116
3119
|
portDirection: c.direction
|
|
3117
3120
|
}, h = this.params.draggingPortDirectionResolver.resolve({
|
|
3118
3121
|
cursor: t,
|
|
3119
3122
|
...this.edgeInProgress
|
|
3120
3123
|
}), g = {
|
|
3121
|
-
overlayNodeId:
|
|
3124
|
+
overlayNodeId: E.DraggingNodeId,
|
|
3122
3125
|
portCoords: p,
|
|
3123
3126
|
portDirection: h ?? s.direction
|
|
3124
3127
|
}, [_, v] = a ? [m, g] : [g, m];
|
|
3125
|
-
this.overlayCanvas.addNode(
|
|
3126
|
-
let y = this.params.draggingEdgeShapeFactory === null ? r.shape : this.params.draggingEdgeShapeFactory(
|
|
3128
|
+
this.overlayCanvas.addNode(T(_)), this.overlayCanvas.addNode(T(v));
|
|
3129
|
+
let y = this.params.draggingEdgeShapeFactory === null ? r.shape : this.params.draggingEdgeShapeFactory(E.EdgeId);
|
|
3127
3130
|
return this.overlayCanvas.addEdge({
|
|
3128
|
-
id:
|
|
3131
|
+
id: E.EdgeId,
|
|
3129
3132
|
from: _.overlayNodeId,
|
|
3130
3133
|
to: v.overlayNodeId,
|
|
3131
3134
|
shape: y
|
|
@@ -3142,14 +3145,14 @@ var re = (e, t, n) => {
|
|
|
3142
3145
|
cursor: e,
|
|
3143
3146
|
...this.edgeInProgress
|
|
3144
3147
|
});
|
|
3145
|
-
this.overlayCanvas.updateNode(
|
|
3148
|
+
this.overlayCanvas.updateNode(E.DraggingNodeId, {
|
|
3146
3149
|
x: r.x,
|
|
3147
3150
|
y: r.y
|
|
3148
|
-
}).updatePort(
|
|
3151
|
+
}).updatePort(E.DraggingNodeId, { direction: i });
|
|
3149
3152
|
}
|
|
3150
3153
|
tryCreateConnection(e) {
|
|
3151
|
-
let t =
|
|
3152
|
-
if (this.overlayCanvas.removeEdge(
|
|
3154
|
+
let t = ne(this.canvas.graph, e, this.params.releasedPortIdResolver);
|
|
3155
|
+
if (this.overlayCanvas.removeEdge(E.EdgeId), t === null) {
|
|
3153
3156
|
let e = this.draggingEdgePayload;
|
|
3154
3157
|
this.params.onEdgeReattachInterrupted({
|
|
3155
3158
|
id: e.id,
|
|
@@ -3160,7 +3163,7 @@ var re = (e, t, n) => {
|
|
|
3160
3163
|
});
|
|
3161
3164
|
return;
|
|
3162
3165
|
}
|
|
3163
|
-
let { from: n, to: r } =
|
|
3166
|
+
let { from: n, to: r } = G(this.edgeInProgress, t), i = this.draggingEdgePayload, a = {
|
|
3164
3167
|
id: i.id,
|
|
3165
3168
|
from: n,
|
|
3166
3169
|
to: r,
|
|
@@ -3182,7 +3185,7 @@ var re = (e, t, n) => {
|
|
|
3182
3185
|
});
|
|
3183
3186
|
}
|
|
3184
3187
|
}
|
|
3185
|
-
},
|
|
3188
|
+
}, ut = class e {
|
|
3186
3189
|
applier;
|
|
3187
3190
|
trigger;
|
|
3188
3191
|
constructor(e, t) {
|
|
@@ -3193,7 +3196,7 @@ var re = (e, t, n) => {
|
|
|
3193
3196
|
static configure(t, n) {
|
|
3194
3197
|
new e(t, n);
|
|
3195
3198
|
}
|
|
3196
|
-
},
|
|
3199
|
+
}, dt = class e {
|
|
3197
3200
|
graph;
|
|
3198
3201
|
applier;
|
|
3199
3202
|
defererFn;
|
|
@@ -3218,7 +3221,7 @@ var re = (e, t, n) => {
|
|
|
3218
3221
|
scheduleApply() {
|
|
3219
3222
|
this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
|
|
3220
3223
|
}
|
|
3221
|
-
},
|
|
3224
|
+
}, ft = class {
|
|
3222
3225
|
canvas;
|
|
3223
3226
|
layoutAlgorithm;
|
|
3224
3227
|
params;
|
|
@@ -3234,23 +3237,23 @@ var re = (e, t, n) => {
|
|
|
3234
3237
|
this.params.staticNodeResolver(t) || this.canvas.updateNode(t, e);
|
|
3235
3238
|
}), this.params.onAfterApplied();
|
|
3236
3239
|
}
|
|
3237
|
-
},
|
|
3240
|
+
}, pt = class {
|
|
3238
3241
|
static configure(e, t) {
|
|
3239
|
-
let n = t.applyOn, r = new
|
|
3242
|
+
let n = t.applyOn, r = new ft(e, t.algorithm, {
|
|
3240
3243
|
staticNodeResolver: t.staticNodeResolver,
|
|
3241
3244
|
onBeforeApplied: t.onBeforeApplied,
|
|
3242
3245
|
onAfterApplied: t.onAfterApplied
|
|
3243
3246
|
});
|
|
3244
3247
|
switch (n.type) {
|
|
3245
3248
|
case "trigger":
|
|
3246
|
-
|
|
3249
|
+
ut.configure(r, n.trigger);
|
|
3247
3250
|
break;
|
|
3248
3251
|
case "topologyChangeSchedule":
|
|
3249
|
-
|
|
3252
|
+
dt.configure(e.graph, r, n.schedule);
|
|
3250
3253
|
break;
|
|
3251
3254
|
}
|
|
3252
3255
|
}
|
|
3253
|
-
},
|
|
3256
|
+
}, mt = class {
|
|
3254
3257
|
win;
|
|
3255
3258
|
callback;
|
|
3256
3259
|
previousTimeStamp = void 0;
|
|
@@ -3265,7 +3268,7 @@ var re = (e, t, n) => {
|
|
|
3265
3268
|
constructor(e, t) {
|
|
3266
3269
|
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
3267
3270
|
}
|
|
3268
|
-
},
|
|
3271
|
+
}, ht = class {
|
|
3269
3272
|
canvas;
|
|
3270
3273
|
layoutAlgorithm;
|
|
3271
3274
|
params;
|
|
@@ -3282,29 +3285,29 @@ var re = (e, t, n) => {
|
|
|
3282
3285
|
this.params.staticNodeResolver(t) || this.canvas.updateNode(t, e);
|
|
3283
3286
|
}), this.params.onAfterApplied();
|
|
3284
3287
|
}
|
|
3285
|
-
},
|
|
3288
|
+
}, gt = class e {
|
|
3286
3289
|
applier;
|
|
3287
3290
|
step = (e) => {
|
|
3288
3291
|
this.applier.apply(e);
|
|
3289
3292
|
};
|
|
3290
3293
|
constructor(e, t, n) {
|
|
3291
|
-
this.applier = new
|
|
3294
|
+
this.applier = new ht(e, t.algorithm, {
|
|
3292
3295
|
staticNodeResolver: t.staticNodeResolver,
|
|
3293
3296
|
onBeforeApplied: t.onBeforeApplied,
|
|
3294
3297
|
onAfterApplied: t.onAfterApplied
|
|
3295
|
-
}), new
|
|
3298
|
+
}), new mt(n, this.step);
|
|
3296
3299
|
}
|
|
3297
3300
|
static configure(t, n, r) {
|
|
3298
3301
|
new e(t, n, r);
|
|
3299
3302
|
}
|
|
3300
|
-
},
|
|
3303
|
+
}, _t = class e {
|
|
3301
3304
|
canvas;
|
|
3302
3305
|
window;
|
|
3303
3306
|
pointInsideVerifier;
|
|
3304
3307
|
eventTagger;
|
|
3305
3308
|
configurator;
|
|
3306
3309
|
onNodeSelected;
|
|
3307
|
-
eventHandledTag =
|
|
3310
|
+
eventHandledTag = U;
|
|
3308
3311
|
onAfterNodeAdded = (e) => {
|
|
3309
3312
|
let { element: t } = this.canvas.graph.getNode(e);
|
|
3310
3313
|
this.configurator.enable(t);
|
|
@@ -3320,7 +3323,7 @@ var re = (e, t, n) => {
|
|
|
3320
3323
|
});
|
|
3321
3324
|
};
|
|
3322
3325
|
constructor(e, t, n, r, i) {
|
|
3323
|
-
this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onNodeSelected = i.onNodeSelected, this.configurator = new
|
|
3326
|
+
this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onNodeSelected = i.onNodeSelected, this.configurator = new W(this.window, this.pointInsideVerifier, {
|
|
3324
3327
|
onSelected: (e, t) => {
|
|
3325
3328
|
let n = this.canvas.graph.findNodeIdByElement(e);
|
|
3326
3329
|
this.eventTagger.tag(t, this.eventHandledTag), this.onNodeSelected(n);
|
|
@@ -3333,13 +3336,13 @@ var re = (e, t, n) => {
|
|
|
3333
3336
|
static configure(t, n, r, i, a) {
|
|
3334
3337
|
new e(t, n, r, i, a);
|
|
3335
3338
|
}
|
|
3336
|
-
},
|
|
3339
|
+
}, vt = class e {
|
|
3337
3340
|
canvas;
|
|
3338
3341
|
window;
|
|
3339
3342
|
pointInsideVerifier;
|
|
3340
3343
|
eventTagger;
|
|
3341
3344
|
configurator;
|
|
3342
|
-
eventHandledTag =
|
|
3345
|
+
eventHandledTag = U;
|
|
3343
3346
|
onEdgeSelected;
|
|
3344
3347
|
onAfterEdgeAdded = (e) => {
|
|
3345
3348
|
let { shape: t } = this.canvas.graph.getEdge(e);
|
|
@@ -3356,7 +3359,7 @@ var re = (e, t, n) => {
|
|
|
3356
3359
|
});
|
|
3357
3360
|
};
|
|
3358
3361
|
constructor(e, t, n, r, i) {
|
|
3359
|
-
this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onEdgeSelected = i.onEdgeSelected, this.configurator = new
|
|
3362
|
+
this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onEdgeSelected = i.onEdgeSelected, this.configurator = new W(this.window, this.pointInsideVerifier, {
|
|
3360
3363
|
onSelected: (e, t) => {
|
|
3361
3364
|
let n = this.canvas.graph.findEdgeIdByElement(e);
|
|
3362
3365
|
this.eventTagger.tag(t, this.eventHandledTag), this.onEdgeSelected(n);
|
|
@@ -3369,7 +3372,7 @@ var re = (e, t, n) => {
|
|
|
3369
3372
|
static configure(t, n, r, i, a) {
|
|
3370
3373
|
new e(t, n, r, i, a);
|
|
3371
3374
|
}
|
|
3372
|
-
},
|
|
3375
|
+
}, yt = class e {
|
|
3373
3376
|
canvas;
|
|
3374
3377
|
element;
|
|
3375
3378
|
window;
|
|
@@ -3377,9 +3380,9 @@ var re = (e, t, n) => {
|
|
|
3377
3380
|
eventTagger;
|
|
3378
3381
|
configurator;
|
|
3379
3382
|
onCanvasSelected;
|
|
3380
|
-
eventHandledTag =
|
|
3383
|
+
eventHandledTag = U;
|
|
3381
3384
|
constructor(e, t, n, r, i, a) {
|
|
3382
|
-
this.canvas = e, this.element = t, this.window = n, this.pointInsideVerifier = r, this.eventTagger = i, this.onCanvasSelected = a.onCanvasSelected, this.configurator = new
|
|
3385
|
+
this.canvas = e, this.element = t, this.window = n, this.pointInsideVerifier = r, this.eventTagger = i, this.onCanvasSelected = a.onCanvasSelected, this.configurator = new W(this.window, this.pointInsideVerifier, {
|
|
3383
3386
|
onSelected: (e, t) => {
|
|
3384
3387
|
this.eventTagger.has(t, this.eventHandledTag) || this.onCanvasSelected();
|
|
3385
3388
|
},
|
|
@@ -3393,29 +3396,107 @@ var re = (e, t, n) => {
|
|
|
3393
3396
|
static configure(t, n, r, i, a, o) {
|
|
3394
3397
|
new e(t, n, r, i, a, o);
|
|
3395
3398
|
}
|
|
3396
|
-
},
|
|
3399
|
+
}, bt = () => {
|
|
3397
3400
|
let e = document.createElement("div");
|
|
3398
3401
|
return e.style.width = "100%", e.style.height = "100%", e.style.position = "relative", e;
|
|
3399
|
-
},
|
|
3402
|
+
}, xt = () => {
|
|
3400
3403
|
let e = document.createElement("div");
|
|
3401
|
-
return e.style.position = "absolute", e
|
|
3404
|
+
return e.style.position = "absolute", e;
|
|
3405
|
+
}, St = class e {
|
|
3406
|
+
canvas;
|
|
3407
|
+
mainElement;
|
|
3408
|
+
overlayLayer;
|
|
3409
|
+
pointInsideVerifier;
|
|
3410
|
+
eventTagger;
|
|
3411
|
+
win;
|
|
3412
|
+
params;
|
|
3413
|
+
host = bt();
|
|
3414
|
+
selectionRectangleWrapper = xt();
|
|
3415
|
+
initialContentPoint = null;
|
|
3416
|
+
draggingViewportPoint = null;
|
|
3417
|
+
eventHandledTag = V;
|
|
3418
|
+
onAfterViewportUpdated = () => {
|
|
3419
|
+
this.updateSelectionRectangle();
|
|
3420
|
+
};
|
|
3421
|
+
onCanvasMouseDown = (e) => {
|
|
3422
|
+
let t = e;
|
|
3423
|
+
if (!this.params.mouseDownEventVerifier(t) || this.eventTagger.has(e, this.eventHandledTag)) return;
|
|
3424
|
+
this.params.onSelectionStarted();
|
|
3425
|
+
let n = this.mainElement.getBoundingClientRect(), r = {
|
|
3426
|
+
x: t.clientX - n.x,
|
|
3427
|
+
y: t.clientY - n.y
|
|
3428
|
+
};
|
|
3429
|
+
this.initialContentPoint = this.canvas.viewport.createContentCoords(r), this.draggingViewportPoint = r, this.updateSelectionRectangle(), this.host.appendChild(this.selectionRectangleWrapper), this.win.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.win.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 });
|
|
3430
|
+
};
|
|
3431
|
+
onWindowMouseMove = (e) => {
|
|
3432
|
+
let t = e;
|
|
3433
|
+
if (!this.pointInsideVerifier.verify(t.clientX, t.clientY)) {
|
|
3434
|
+
this.removeMouseListeners(), this.interruptSelection();
|
|
3435
|
+
return;
|
|
3436
|
+
}
|
|
3437
|
+
let n = this.mainElement.getBoundingClientRect(), r = {
|
|
3438
|
+
x: t.clientX - n.x,
|
|
3439
|
+
y: t.clientY - n.y
|
|
3440
|
+
};
|
|
3441
|
+
this.draggingViewportPoint = r, this.updateSelectionRectangle();
|
|
3442
|
+
let i = this.selectionRectangleWrapper.getBoundingClientRect();
|
|
3443
|
+
this.params.onSelectionChange(i);
|
|
3444
|
+
};
|
|
3445
|
+
onWindowMouseUp = (e) => {
|
|
3446
|
+
let t = e;
|
|
3447
|
+
this.params.mouseUpEventVerifier(t) && (this.removeMouseListeners(), this.finishSelection());
|
|
3448
|
+
};
|
|
3449
|
+
constructor(e, t, n, r, i, a, o) {
|
|
3450
|
+
this.canvas = e, this.mainElement = t, this.overlayLayer = n, this.pointInsideVerifier = r, this.eventTagger = i, this.win = a, this.params = o, this.overlayLayer.appendChild(this.host), this.selectionRectangleWrapper.appendChild(this.params.rectangleElement), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated), this.mainElement.addEventListener("mousedown", this.onCanvasMouseDown, { passive: !0 }), this.canvas.onBeforeDestroy.subscribe(() => {
|
|
3451
|
+
this.mainElement.removeEventListener("mousedown", this.onCanvasMouseDown), this.removeMouseListeners();
|
|
3452
|
+
});
|
|
3453
|
+
}
|
|
3454
|
+
static configure(t, n, r, i, a, o, s) {
|
|
3455
|
+
new e(t, n, r, i, a, o, s);
|
|
3456
|
+
}
|
|
3457
|
+
updateSelectionRectangle() {
|
|
3458
|
+
if (this.initialContentPoint === null || this.draggingViewportPoint === null) return;
|
|
3459
|
+
let e = this.canvas.viewport.createViewportCoords(this.initialContentPoint), t = this.draggingViewportPoint, n = Math.min(e.x, t.x), r = Math.min(e.y, t.y), i = Math.abs(t.x - e.x), a = Math.abs(t.y - e.y), { style: o } = this.selectionRectangleWrapper;
|
|
3460
|
+
o.left = `${n}px`, o.top = `${r}px`, o.width = `${i}px`, o.height = `${a}px`;
|
|
3461
|
+
}
|
|
3462
|
+
removeMouseListeners() {
|
|
3463
|
+
this.win.removeEventListener("mousemove", this.onWindowMouseMove), this.win.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
3464
|
+
}
|
|
3465
|
+
finishSelection() {
|
|
3466
|
+
let e = this.selectionRectangleWrapper.getBoundingClientRect();
|
|
3467
|
+
this.terminateSelection(), this.params.onSelectionFinished(e);
|
|
3468
|
+
}
|
|
3469
|
+
interruptSelection() {
|
|
3470
|
+
let e = this.selectionRectangleWrapper.getBoundingClientRect();
|
|
3471
|
+
this.terminateSelection(), this.params.onSelectionInterrupted(e);
|
|
3472
|
+
}
|
|
3473
|
+
terminateSelection() {
|
|
3474
|
+
this.host.removeChild(this.selectionRectangleWrapper), this.initialContentPoint = null, this.draggingViewportPoint = null;
|
|
3475
|
+
}
|
|
3402
3476
|
}, Ct = () => {
|
|
3403
|
-
let e =
|
|
3404
|
-
return e.style.
|
|
3405
|
-
},
|
|
3477
|
+
let e = document.createElement("div");
|
|
3478
|
+
return e.style.width = "100%", e.style.height = "100%", e.style.position = "relative", e;
|
|
3479
|
+
}, J = (e) => {
|
|
3480
|
+
let t = document.createElement("div");
|
|
3481
|
+
return t.style.position = "absolute", t.style.inset = "0", t.style.zIndex = `${e}`, t;
|
|
3482
|
+
}, wt = (e) => {
|
|
3483
|
+
let t = J(e);
|
|
3484
|
+
return t.style.pointerEvents = "none", t;
|
|
3485
|
+
}, Tt = class {
|
|
3406
3486
|
element;
|
|
3407
|
-
background =
|
|
3408
|
-
main =
|
|
3409
|
-
overlayConnectablePorts =
|
|
3410
|
-
overlayDraggableEdges =
|
|
3411
|
-
|
|
3487
|
+
background = J(0);
|
|
3488
|
+
main = J(1);
|
|
3489
|
+
overlayConnectablePorts = wt(1);
|
|
3490
|
+
overlayDraggableEdges = wt(1);
|
|
3491
|
+
overlayRectangularSelection = wt(2);
|
|
3492
|
+
host = Ct();
|
|
3412
3493
|
constructor(e) {
|
|
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);
|
|
3494
|
+
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), this.host.appendChild(this.overlayRectangularSelection);
|
|
3414
3495
|
}
|
|
3415
3496
|
destroy() {
|
|
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);
|
|
3497
|
+
this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.host.removeChild(this.overlayRectangularSelection), this.element.removeChild(this.host);
|
|
3417
3498
|
}
|
|
3418
|
-
},
|
|
3499
|
+
}, Y = Object.freeze({
|
|
3419
3500
|
seed: "HTMLGraph is awesome",
|
|
3420
3501
|
maxTimeDeltaSec: .01,
|
|
3421
3502
|
nodeCharge: 1e5,
|
|
@@ -3424,19 +3505,15 @@ var re = (e, t, n) => {
|
|
|
3424
3505
|
edgeStiffness: 1e3,
|
|
3425
3506
|
dtSec: .01,
|
|
3426
3507
|
maxIterations: 1e3,
|
|
3427
|
-
|
|
3508
|
+
stopVelocity: 10,
|
|
3428
3509
|
maxForce: 1e7,
|
|
3429
3510
|
nodeForceCoefficient: 1,
|
|
3430
3511
|
barnesHutAreaRadiusThreshold: .01,
|
|
3431
3512
|
barnesHutTheta: 1
|
|
3432
|
-
}),
|
|
3433
|
-
mouseDownEventVerifier: (e) => e.button === 0,
|
|
3434
|
-
mouseUpEventVerifier: (e) => e.button === 0,
|
|
3435
|
-
movementThreshold: 10
|
|
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) => {
|
|
3513
|
+
}), X = () => {}, Et = (e, t, n) => e === "nearest-connectable-port" ? new $e(t, n) : typeof e == "number" ? new et(e) : new et(void 0), Dt = (e) => {
|
|
3437
3514
|
if (typeof e == "function") return e;
|
|
3438
3515
|
switch (e.type) {
|
|
3439
|
-
case "straight": return () => new
|
|
3516
|
+
case "straight": return () => new Ae({
|
|
3440
3517
|
color: e.color,
|
|
3441
3518
|
width: e.width,
|
|
3442
3519
|
arrowLength: e.arrowLength,
|
|
@@ -3449,7 +3526,7 @@ var re = (e, t, n) => {
|
|
|
3449
3526
|
detourDistance: e.detourDistance,
|
|
3450
3527
|
detourDirection: e.detourDirection
|
|
3451
3528
|
});
|
|
3452
|
-
case "orthogonal": return () => new
|
|
3529
|
+
case "orthogonal": return () => new Me({
|
|
3453
3530
|
color: e.color,
|
|
3454
3531
|
width: e.width,
|
|
3455
3532
|
arrowLength: e.arrowLength,
|
|
@@ -3461,7 +3538,7 @@ var re = (e, t, n) => {
|
|
|
3461
3538
|
roundness: e.roundness,
|
|
3462
3539
|
detourDistance: e.detourDistance
|
|
3463
3540
|
});
|
|
3464
|
-
case "direct": return () => new
|
|
3541
|
+
case "direct": return () => new R({
|
|
3465
3542
|
color: e.color,
|
|
3466
3543
|
width: e.width,
|
|
3467
3544
|
arrowLength: e.arrowLength,
|
|
@@ -3471,7 +3548,7 @@ var re = (e, t, n) => {
|
|
|
3471
3548
|
sourceOffset: e.sourceOffset,
|
|
3472
3549
|
targetOffset: e.targetOffset
|
|
3473
3550
|
});
|
|
3474
|
-
default: return () => new
|
|
3551
|
+
default: return () => new ke({
|
|
3475
3552
|
color: e.color,
|
|
3476
3553
|
width: e.width,
|
|
3477
3554
|
arrowLength: e.arrowLength,
|
|
@@ -3485,21 +3562,21 @@ var re = (e, t, n) => {
|
|
|
3485
3562
|
detourDirection: e.detourDirection
|
|
3486
3563
|
});
|
|
3487
3564
|
}
|
|
3488
|
-
},
|
|
3489
|
-
let t = e.
|
|
3565
|
+
}, Ot = (e) => e.button === 0 && e.ctrlKey, Z = (e) => e.button === 0, Q = (e) => e.button === 0 && !e.ctrlKey, kt = (e) => {
|
|
3566
|
+
let t = e.moveOnTop !== !1;
|
|
3490
3567
|
return {
|
|
3491
|
-
moveOnTop:
|
|
3492
|
-
moveEdgesOnTop:
|
|
3493
|
-
dragCursor:
|
|
3568
|
+
moveOnTop: t,
|
|
3569
|
+
moveEdgesOnTop: e.moveEdgesOnTop !== !1 && t,
|
|
3570
|
+
dragCursor: e.mouse?.dragCursor ?? "grab",
|
|
3494
3571
|
gridSize: e.gridSize ?? null,
|
|
3495
|
-
mouseDownEventVerifier:
|
|
3496
|
-
mouseUpEventVerifier:
|
|
3497
|
-
onNodeDragStarted: e.events?.onNodeDragStarted ??
|
|
3498
|
-
onNodeDrag: e.events?.onNodeDrag ??
|
|
3499
|
-
nodeDragVerifier:
|
|
3500
|
-
onNodeDragFinished: e.events?.onNodeDragFinished ??
|
|
3572
|
+
mouseDownEventVerifier: e.mouse?.mouseDownEventVerifier ?? Q,
|
|
3573
|
+
mouseUpEventVerifier: e.mouse?.mouseUpEventVerifier ?? Z,
|
|
3574
|
+
onNodeDragStarted: e.events?.onNodeDragStarted ?? X,
|
|
3575
|
+
onNodeDrag: e.events?.onNodeDrag ?? X,
|
|
3576
|
+
nodeDragVerifier: e.nodeDragVerifier ?? (() => !0),
|
|
3577
|
+
onNodeDragFinished: e.events?.onNodeDragFinished ?? X
|
|
3501
3578
|
};
|
|
3502
|
-
},
|
|
3579
|
+
}, At = (e) => {
|
|
3503
3580
|
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;
|
|
3504
3581
|
return (e) => {
|
|
3505
3582
|
let a = e.nextTransform.x, o = e.nextTransform.y;
|
|
@@ -3513,7 +3590,7 @@ var re = (e, t, n) => {
|
|
|
3513
3590
|
y: o
|
|
3514
3591
|
};
|
|
3515
3592
|
};
|
|
3516
|
-
},
|
|
3593
|
+
}, jt = (e) => {
|
|
3517
3594
|
let t = e.maxContentScale, n = e.minContentScale, r = t === null ? 0 : 1 / t, i = n === null ? Infinity : 1 / n;
|
|
3518
3595
|
return (e) => {
|
|
3519
3596
|
let t = e.prevTransform, n = e.nextTransform, a = n.scale, o = n.x, s = n.y;
|
|
@@ -3533,108 +3610,103 @@ var re = (e, t, n) => {
|
|
|
3533
3610
|
y: s
|
|
3534
3611
|
};
|
|
3535
3612
|
};
|
|
3536
|
-
},
|
|
3613
|
+
}, Mt = (e) => (t) => e.reduce((e, n) => n({
|
|
3537
3614
|
prevTransform: t.prevTransform,
|
|
3538
3615
|
nextTransform: e,
|
|
3539
3616
|
viewport: t.viewport
|
|
3540
|
-
}), t.nextTransform),
|
|
3617
|
+
}), t.nextTransform), Nt = (e) => {
|
|
3541
3618
|
if (typeof e == "function") return e;
|
|
3542
3619
|
switch (e.type) {
|
|
3543
|
-
case "scale-limit": return
|
|
3620
|
+
case "scale-limit": return jt({
|
|
3544
3621
|
minContentScale: e.minContentScale ?? 0,
|
|
3545
3622
|
maxContentScale: e.maxContentScale ?? Infinity
|
|
3546
3623
|
});
|
|
3547
|
-
case "shift-limit": return
|
|
3624
|
+
case "shift-limit": return At({
|
|
3548
3625
|
minX: e.minX ?? -Infinity,
|
|
3549
3626
|
maxX: e.maxX ?? Infinity,
|
|
3550
3627
|
minY: e.minY ?? -Infinity,
|
|
3551
3628
|
maxY: e.maxY ?? Infinity
|
|
3552
3629
|
});
|
|
3553
3630
|
}
|
|
3554
|
-
},
|
|
3555
|
-
let t = e?.
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
mouseUpEventVerifier: l,
|
|
3568
|
-
mouseWheelEventVerifier: d,
|
|
3631
|
+
}, Pt = (e) => {
|
|
3632
|
+
let t = e?.transformPreprocessor, n;
|
|
3633
|
+
return n = t === void 0 ? (e) => e.nextTransform : Array.isArray(t) ? Mt(t.map((e) => Nt(e))) : Nt(t), {
|
|
3634
|
+
wheelSensitivity: e?.scale?.mouseWheelSensitivity ?? 1.2,
|
|
3635
|
+
onTransformStarted: e?.events?.onTransformStarted ?? X,
|
|
3636
|
+
onTransformFinished: e?.events?.onTransformFinished ?? X,
|
|
3637
|
+
onBeforeTransformChange: e?.events?.onBeforeTransformChange ?? X,
|
|
3638
|
+
onTransformChange: e?.events?.onTransformChange ?? X,
|
|
3639
|
+
transformPreprocessor: n,
|
|
3640
|
+
shiftCursor: e?.pan?.cursor ?? "grab",
|
|
3641
|
+
mouseDownEventVerifier: e?.pan?.mouseDownEventVerifier ?? Q,
|
|
3642
|
+
mouseUpEventVerifier: e?.pan?.mouseUpEventVerifier ?? Z,
|
|
3643
|
+
mouseWheelEventVerifier: e?.scale?.mouseWheelEventVerifier ?? (() => !0),
|
|
3569
3644
|
scaleWheelFinishTimeout: e?.scale?.wheelFinishTimeout ?? 500,
|
|
3570
|
-
onResizeTransformStarted: e?.events?.onResizeTransformStarted ??
|
|
3571
|
-
onResizeTransformFinished: e?.events?.onResizeTransformFinished ??
|
|
3645
|
+
onResizeTransformStarted: e?.events?.onResizeTransformStarted ?? X,
|
|
3646
|
+
onResizeTransformFinished: e?.events?.onResizeTransformFinished ?? X
|
|
3572
3647
|
};
|
|
3573
|
-
},
|
|
3648
|
+
}, Ft = (e, t) => {
|
|
3574
3649
|
let n = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
3575
3650
|
return n.setAttribute("cx", "0"), n.setAttribute("cy", "0"), n.setAttribute("r", `${e}`), n.setAttribute("fill", `${t}`), n;
|
|
3576
|
-
},
|
|
3651
|
+
}, It = (e) => e instanceof SVGElement ? e : Ft(e?.radius ?? 1.5, e?.color ?? "#d8d8d8"), Lt = (e) => {
|
|
3577
3652
|
let t = e.tileDimensions;
|
|
3578
3653
|
return {
|
|
3579
3654
|
tileWidth: t?.width ?? 25,
|
|
3580
3655
|
tileHeight: t?.height ?? 25,
|
|
3581
|
-
renderer:
|
|
3656
|
+
renderer: It(e.renderer ?? {}),
|
|
3582
3657
|
maxViewportScale: e.maxViewportScale ?? 10
|
|
3583
3658
|
};
|
|
3584
|
-
},
|
|
3659
|
+
}, Rt = Object.freeze({
|
|
3585
3660
|
connectionTypeResolver: () => "direct",
|
|
3586
3661
|
connectionPreprocessor: (e) => e,
|
|
3587
|
-
connectionAllowedVerifier: () => !0
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
let r = e.connectionAllowedVerifier ?? X.connectionAllowedVerifier;
|
|
3662
|
+
connectionAllowedVerifier: () => !0
|
|
3663
|
+
}), zt = (e, t, n) => {
|
|
3664
|
+
let r = e.connectionAllowedVerifier ?? Rt.connectionAllowedVerifier;
|
|
3591
3665
|
return {
|
|
3592
|
-
connectionTypeResolver: e.connectionTypeResolver ??
|
|
3666
|
+
connectionTypeResolver: e.connectionTypeResolver ?? Rt.connectionTypeResolver,
|
|
3593
3667
|
connectionAllowedVerifier: r,
|
|
3594
|
-
draggingPortDirectionResolver:
|
|
3595
|
-
edgeShapeFactory: e.edgeShape === void 0 ? t :
|
|
3596
|
-
connectionPreprocessor: e.connectionPreprocessor ??
|
|
3597
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
3598
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
3599
|
-
onAfterEdgeCreated: e.events?.onAfterEdgeCreated ??
|
|
3600
|
-
onEdgeCreationInterrupted: e.events?.onEdgeCreationInterrupted ??
|
|
3601
|
-
onEdgeCreationPrevented: e.events?.onEdgeCreationPrevented ??
|
|
3602
|
-
grabbedPortIdResolver: e.grabbedPortIdResolver ??
|
|
3603
|
-
releasedPortIdResolver: e.releasedPortIdResolver ??
|
|
3668
|
+
draggingPortDirectionResolver: Et(e.dragPortDirection, n, r),
|
|
3669
|
+
edgeShapeFactory: e.edgeShape === void 0 ? t : Dt(e.edgeShape),
|
|
3670
|
+
connectionPreprocessor: e.connectionPreprocessor ?? Rt.connectionPreprocessor,
|
|
3671
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Q,
|
|
3672
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z,
|
|
3673
|
+
onAfterEdgeCreated: e.events?.onAfterEdgeCreated ?? X,
|
|
3674
|
+
onEdgeCreationInterrupted: e.events?.onEdgeCreationInterrupted ?? X,
|
|
3675
|
+
onEdgeCreationPrevented: e.events?.onEdgeCreationPrevented ?? X,
|
|
3676
|
+
grabbedPortIdResolver: e.grabbedPortIdResolver ?? K,
|
|
3677
|
+
releasedPortIdResolver: e.releasedPortIdResolver ?? K
|
|
3604
3678
|
};
|
|
3605
|
-
},
|
|
3679
|
+
}, Bt = Object.freeze({
|
|
3606
3680
|
connectionAllowedVerifier: () => !0,
|
|
3607
|
-
connectionPreprocessor: (e) => e
|
|
3608
|
-
|
|
3609
|
-
mouseUpEventVerifier: (e) => e.button === 0
|
|
3610
|
-
}), Lt = (e, t) => {
|
|
3681
|
+
connectionPreprocessor: (e) => e
|
|
3682
|
+
}), Vt = (e, t) => {
|
|
3611
3683
|
let n = (e) => {
|
|
3612
3684
|
let n = t.getPortAdjacentEdgeIds(e);
|
|
3613
3685
|
return n.length > 0 ? n[n.length - 1] : null;
|
|
3614
|
-
}, r = e.connectionAllowedVerifier ??
|
|
3686
|
+
}, r = e.connectionAllowedVerifier ?? Bt.connectionAllowedVerifier;
|
|
3615
3687
|
return {
|
|
3616
|
-
connectionPreprocessor: e.connectionPreprocessor ??
|
|
3688
|
+
connectionPreprocessor: e.connectionPreprocessor ?? Bt.connectionPreprocessor,
|
|
3617
3689
|
connectionAllowedVerifier: r,
|
|
3618
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
3619
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z
|
|
3690
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Q,
|
|
3691
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z,
|
|
3620
3692
|
draggingEdgeResolver: e.draggingEdgeResolver ?? n,
|
|
3621
|
-
draggingEdgeShapeFactory: e.draggingEdgeShape === void 0 ? null :
|
|
3622
|
-
onAfterEdgeReattached: e.events?.onAfterEdgeReattached ??
|
|
3623
|
-
onEdgeReattachInterrupted: e.events?.onEdgeReattachInterrupted ??
|
|
3624
|
-
onEdgeReattachPrevented: e.events?.onEdgeReattachPrevented ??
|
|
3625
|
-
draggingPortDirectionResolver:
|
|
3626
|
-
grabbedPortIdResolver: e.grabbedPortIdResolver ??
|
|
3627
|
-
releasedPortIdResolver: e.releasedPortIdResolver ??
|
|
3693
|
+
draggingEdgeShapeFactory: e.draggingEdgeShape === void 0 ? null : Dt(e.draggingEdgeShape),
|
|
3694
|
+
onAfterEdgeReattached: e.events?.onAfterEdgeReattached ?? X,
|
|
3695
|
+
onEdgeReattachInterrupted: e.events?.onEdgeReattachInterrupted ?? X,
|
|
3696
|
+
onEdgeReattachPrevented: e.events?.onEdgeReattachPrevented ?? X,
|
|
3697
|
+
draggingPortDirectionResolver: Et(e.dragPortDirection, t, r),
|
|
3698
|
+
grabbedPortIdResolver: e.grabbedPortIdResolver ?? K,
|
|
3699
|
+
releasedPortIdResolver: e.releasedPortIdResolver ?? K
|
|
3628
3700
|
};
|
|
3629
|
-
},
|
|
3701
|
+
}, Ht = (e) => ({
|
|
3630
3702
|
nodeVerticalRadius: e.nodeContainingRadius.vertical,
|
|
3631
3703
|
nodeHorizontalRadius: e.nodeContainingRadius.horizontal
|
|
3632
|
-
}),
|
|
3633
|
-
onAfterNodeDetached: e?.events?.onAfterNodeDetached ??
|
|
3634
|
-
onBeforeNodeAttached: e?.events?.onBeforeNodeAttached ??
|
|
3635
|
-
}),
|
|
3704
|
+
}), Ut = (e) => ({
|
|
3705
|
+
onAfterNodeDetached: e?.events?.onAfterNodeDetached ?? X,
|
|
3706
|
+
onBeforeNodeAttached: e?.events?.onBeforeNodeAttached ?? X
|
|
3707
|
+
}), Wt = class extends Error {
|
|
3636
3708
|
name = "CanvasBuilderError";
|
|
3637
|
-
},
|
|
3709
|
+
}, Gt = class {
|
|
3638
3710
|
graph;
|
|
3639
3711
|
currentCoords;
|
|
3640
3712
|
dt;
|
|
@@ -3669,7 +3741,7 @@ var re = (e, t, n) => {
|
|
|
3669
3741
|
d.x += l, d.y += u, f.x -= l, f.y -= u;
|
|
3670
3742
|
});
|
|
3671
3743
|
}
|
|
3672
|
-
},
|
|
3744
|
+
}, Kt = class {
|
|
3673
3745
|
rand;
|
|
3674
3746
|
PI2 = 2 * Math.PI;
|
|
3675
3747
|
constructor(e) {
|
|
@@ -3692,11 +3764,11 @@ var re = (e, t, n) => {
|
|
|
3692
3764
|
d: a
|
|
3693
3765
|
};
|
|
3694
3766
|
}
|
|
3695
|
-
},
|
|
3767
|
+
}, qt = (e) => {
|
|
3696
3768
|
if (e.distance === 0) return e.maxForce;
|
|
3697
3769
|
let t = e.coefficient * (e.sourceCharge * e.targetCharge / (e.distance * e.distance));
|
|
3698
3770
|
return Math.min(t, e.maxForce);
|
|
3699
|
-
},
|
|
3771
|
+
}, Jt = class {
|
|
3700
3772
|
nodeCharge;
|
|
3701
3773
|
distanceVectorGenerator;
|
|
3702
3774
|
maxForce;
|
|
@@ -3708,7 +3780,7 @@ var re = (e, t, n) => {
|
|
|
3708
3780
|
for (let i = 0; i < r; i++) {
|
|
3709
3781
|
let a = n[i];
|
|
3710
3782
|
for (let o = i + 1; o < r; o++) {
|
|
3711
|
-
let r = n[o], i = e.get(a), s = e.get(r), c = this.distanceVectorGenerator.create(i, s), l =
|
|
3783
|
+
let r = n[o], i = e.get(a), s = e.get(r), c = this.distanceVectorGenerator.create(i, s), l = qt({
|
|
3712
3784
|
coefficient: 1,
|
|
3713
3785
|
sourceCharge: this.nodeCharge,
|
|
3714
3786
|
targetCharge: this.nodeCharge,
|
|
@@ -3719,7 +3791,7 @@ var re = (e, t, n) => {
|
|
|
3719
3791
|
}
|
|
3720
3792
|
}
|
|
3721
3793
|
}
|
|
3722
|
-
},
|
|
3794
|
+
}, Yt = (e) => {
|
|
3723
3795
|
if (e.size === 0) return {
|
|
3724
3796
|
centerX: 0,
|
|
3725
3797
|
centerY: 0,
|
|
@@ -3735,7 +3807,7 @@ var re = (e, t, n) => {
|
|
|
3735
3807
|
centerY: (r + i) / 2,
|
|
3736
3808
|
radius: s / 2
|
|
3737
3809
|
};
|
|
3738
|
-
},
|
|
3810
|
+
}, Xt = class {
|
|
3739
3811
|
root;
|
|
3740
3812
|
leaves = /* @__PURE__ */ new Map();
|
|
3741
3813
|
coords;
|
|
@@ -3891,7 +3963,7 @@ var re = (e, t, n) => {
|
|
|
3891
3963
|
y: n / e.size
|
|
3892
3964
|
};
|
|
3893
3965
|
}
|
|
3894
|
-
},
|
|
3966
|
+
}, Zt = class {
|
|
3895
3967
|
areaRadiusThreshold;
|
|
3896
3968
|
nodeMass;
|
|
3897
3969
|
nodeCharge;
|
|
@@ -3903,8 +3975,8 @@ var re = (e, t, n) => {
|
|
|
3903
3975
|
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;
|
|
3904
3976
|
}
|
|
3905
3977
|
apply(e, t) {
|
|
3906
|
-
let n = new
|
|
3907
|
-
box:
|
|
3978
|
+
let n = new Xt({
|
|
3979
|
+
box: Yt(e),
|
|
3908
3980
|
coords: e,
|
|
3909
3981
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
3910
3982
|
nodeMass: this.nodeMass,
|
|
@@ -4014,7 +4086,7 @@ var re = (e, t, n) => {
|
|
|
4014
4086
|
});
|
|
4015
4087
|
}
|
|
4016
4088
|
calculateNodeRepulsiveForce(e) {
|
|
4017
|
-
let t = this.distanceVectorGenerator.create(e.sourceCoords, e.targetCoords), n =
|
|
4089
|
+
let t = this.distanceVectorGenerator.create(e.sourceCoords, e.targetCoords), n = qt({
|
|
4018
4090
|
coefficient: this.nodeForceCoefficient,
|
|
4019
4091
|
sourceCharge: e.sourceCharge,
|
|
4020
4092
|
targetCharge: e.targetCharge,
|
|
@@ -4041,12 +4113,12 @@ var re = (e, t, n) => {
|
|
|
4041
4113
|
this.applyForce(e.totalForce, t);
|
|
4042
4114
|
}
|
|
4043
4115
|
}
|
|
4044
|
-
},
|
|
4116
|
+
}, Qt = (e) => e.theta === 0 ? new Jt({
|
|
4045
4117
|
nodeCharge: e.nodeCharge,
|
|
4046
4118
|
nodeForceCoefficient: e.nodeForceCoefficient,
|
|
4047
4119
|
distanceVectorGenerator: e.distanceVectorGenerator,
|
|
4048
4120
|
maxForce: e.maxForce
|
|
4049
|
-
}) : new
|
|
4121
|
+
}) : new Zt({
|
|
4050
4122
|
nodeCharge: e.nodeCharge,
|
|
4051
4123
|
nodeForceCoefficient: e.nodeForceCoefficient,
|
|
4052
4124
|
distanceVectorGenerator: e.distanceVectorGenerator,
|
|
@@ -4054,7 +4126,7 @@ var re = (e, t, n) => {
|
|
|
4054
4126
|
theta: e.theta,
|
|
4055
4127
|
nodeMass: e.nodeMass,
|
|
4056
4128
|
areaRadiusThreshold: e.areaRadiusThreshold
|
|
4057
|
-
}),
|
|
4129
|
+
}), $t = class {
|
|
4058
4130
|
rand;
|
|
4059
4131
|
sparsity;
|
|
4060
4132
|
constructor(e) {
|
|
@@ -4079,7 +4151,7 @@ var re = (e, t, n) => {
|
|
|
4079
4151
|
});
|
|
4080
4152
|
}), r;
|
|
4081
4153
|
}
|
|
4082
|
-
},
|
|
4154
|
+
}, en = class {
|
|
4083
4155
|
distanceVectorGenerator;
|
|
4084
4156
|
nodeForcesApplicationStrategy;
|
|
4085
4157
|
fillerLayoutAlgorithm;
|
|
@@ -4088,9 +4160,9 @@ var re = (e, t, n) => {
|
|
|
4088
4160
|
nodeMass;
|
|
4089
4161
|
edgeEquilibriumLength;
|
|
4090
4162
|
edgeStiffness;
|
|
4091
|
-
|
|
4163
|
+
stopVelocity;
|
|
4092
4164
|
constructor(e) {
|
|
4093
|
-
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.
|
|
4165
|
+
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.stopVelocity = e.stopVelocity, this.distanceVectorGenerator = new Kt(e.rand), this.nodeForcesApplicationStrategy = Qt({
|
|
4094
4166
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4095
4167
|
nodeCharge: e.nodeCharge,
|
|
4096
4168
|
maxForce: e.maxForce,
|
|
@@ -4098,7 +4170,7 @@ var re = (e, t, n) => {
|
|
|
4098
4170
|
theta: e.barnesHutTheta,
|
|
4099
4171
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4100
4172
|
nodeMass: e.nodeMass
|
|
4101
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4173
|
+
}), this.fillerLayoutAlgorithm = new $t({
|
|
4102
4174
|
rand: e.rand,
|
|
4103
4175
|
sparsity: e.edgeEquilibriumLength
|
|
4104
4176
|
});
|
|
@@ -4108,17 +4180,17 @@ var re = (e, t, n) => {
|
|
|
4108
4180
|
graph: t,
|
|
4109
4181
|
viewport: n
|
|
4110
4182
|
});
|
|
4111
|
-
for (let e = 0; e < this.maxIterations && !(new
|
|
4183
|
+
for (let e = 0; e < this.maxIterations && !(new Gt(t, r, {
|
|
4112
4184
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4113
4185
|
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
4114
4186
|
dtSec: this.dtSec,
|
|
4115
4187
|
nodeMass: this.nodeMass,
|
|
4116
4188
|
edgeEquilibriumLength: this.edgeEquilibriumLength,
|
|
4117
4189
|
edgeStiffness: this.edgeStiffness
|
|
4118
|
-
}).apply() < this.
|
|
4190
|
+
}).apply() < this.stopVelocity); e++);
|
|
4119
4191
|
return r;
|
|
4120
4192
|
}
|
|
4121
|
-
},
|
|
4193
|
+
}, tn = class {
|
|
4122
4194
|
graph;
|
|
4123
4195
|
nextLayerNodesResolver;
|
|
4124
4196
|
forest = /* @__PURE__ */ new Set();
|
|
@@ -4162,7 +4234,7 @@ var re = (e, t, n) => {
|
|
|
4162
4234
|
}), r = e;
|
|
4163
4235
|
}
|
|
4164
4236
|
}
|
|
4165
|
-
},
|
|
4237
|
+
}, nn = class {
|
|
4166
4238
|
params;
|
|
4167
4239
|
constructor(e) {
|
|
4168
4240
|
this.params = e;
|
|
@@ -4201,13 +4273,13 @@ var re = (e, t, n) => {
|
|
|
4201
4273
|
}
|
|
4202
4274
|
return n - 2 * this.params.spaceAroundRadius;
|
|
4203
4275
|
}
|
|
4204
|
-
},
|
|
4276
|
+
}, rn = class {
|
|
4205
4277
|
tree;
|
|
4206
4278
|
offsets = /* @__PURE__ */ new Map();
|
|
4207
4279
|
treeSpans = /* @__PURE__ */ new Map();
|
|
4208
4280
|
constructor(e, t) {
|
|
4209
4281
|
this.tree = e;
|
|
4210
|
-
let n = t.spaceAroundRadius, r = new
|
|
4282
|
+
let n = t.spaceAroundRadius, r = new nn({ spaceAroundRadius: n });
|
|
4211
4283
|
[...this.tree.sequence].reverse().forEach((e) => {
|
|
4212
4284
|
let t = Array.from(e.children).map((e) => this.treeSpans.get(e.nodeId)), i = r.generate(t), a = 0;
|
|
4213
4285
|
e.children.forEach((e) => {
|
|
@@ -4223,19 +4295,19 @@ var re = (e, t, n) => {
|
|
|
4223
4295
|
generate() {
|
|
4224
4296
|
return this.offsets;
|
|
4225
4297
|
}
|
|
4226
|
-
},
|
|
4298
|
+
}, an = class {
|
|
4227
4299
|
params;
|
|
4228
4300
|
constructor(e) {
|
|
4229
4301
|
this.params = e;
|
|
4230
4302
|
}
|
|
4231
4303
|
calculateCoordinates(e) {
|
|
4232
|
-
let t = /* @__PURE__ */ new Map(), n = new
|
|
4304
|
+
let t = /* @__PURE__ */ new Map(), n = new tn(e.graph, this.params.nextLayerNodesResolver).generate(), r = 0;
|
|
4233
4305
|
return n.forEach((e) => {
|
|
4234
4306
|
t.set(e.root.nodeId, {
|
|
4235
4307
|
x: r,
|
|
4236
4308
|
y: 0
|
|
4237
4309
|
});
|
|
4238
|
-
let n = new
|
|
4310
|
+
let n = new rn(e, { spaceAroundRadius: this.params.layerSpace / 2 }).generate(), i = [e.root];
|
|
4239
4311
|
for (; i.length > 0;) {
|
|
4240
4312
|
let e = [];
|
|
4241
4313
|
r += this.params.layerWidth, i.forEach((i) => {
|
|
@@ -4252,7 +4324,7 @@ var re = (e, t, n) => {
|
|
|
4252
4324
|
t.set(n, this.params.transform(e));
|
|
4253
4325
|
}), t;
|
|
4254
4326
|
}
|
|
4255
|
-
},
|
|
4327
|
+
}, on = (e) => {
|
|
4256
4328
|
let { graph: t, currentNodeId: n } = e, r = t.getNodeOutgoingEdgeIds(n).map((e) => {
|
|
4257
4329
|
let n = t.getEdge(e);
|
|
4258
4330
|
return t.getPort(n.to).nodeId;
|
|
@@ -4261,29 +4333,29 @@ var re = (e, t, n) => {
|
|
|
4261
4333
|
return t.getPort(n.from).nodeId;
|
|
4262
4334
|
});
|
|
4263
4335
|
return /* @__PURE__ */ new Set([...r, ...i]);
|
|
4264
|
-
},
|
|
4336
|
+
}, sn = (e) => {
|
|
4265
4337
|
let { graph: t, currentNodeId: n } = e, r = t.getNodeOutgoingEdgeIds(n).map((e) => {
|
|
4266
4338
|
let n = t.getEdge(e);
|
|
4267
4339
|
return t.getPort(n.to).nodeId;
|
|
4268
4340
|
});
|
|
4269
4341
|
return new Set(r);
|
|
4270
|
-
},
|
|
4342
|
+
}, cn = (e) => {
|
|
4271
4343
|
let { graph: t, currentNodeId: n } = e, r = t.getNodeIncomingEdgeIds(n).map((e) => {
|
|
4272
4344
|
let n = t.getEdge(e);
|
|
4273
4345
|
return t.getPort(n.from).nodeId;
|
|
4274
4346
|
});
|
|
4275
4347
|
return new Set(r);
|
|
4276
|
-
},
|
|
4348
|
+
}, ln = class {
|
|
4277
4349
|
distanceVectorGenerator;
|
|
4278
4350
|
nodeForcesApplicationStrategy;
|
|
4279
|
-
|
|
4351
|
+
stopVelocity;
|
|
4280
4352
|
maxTimeDeltaSec;
|
|
4281
4353
|
nodeMass;
|
|
4282
4354
|
edgeEquilibriumLength;
|
|
4283
4355
|
edgeStiffness;
|
|
4284
4356
|
fillerLayoutAlgorithm;
|
|
4285
4357
|
constructor(e) {
|
|
4286
|
-
this.
|
|
4358
|
+
this.stopVelocity = e.stopVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Kt(e.rand), this.nodeForcesApplicationStrategy = Qt({
|
|
4287
4359
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4288
4360
|
nodeCharge: e.nodeCharge,
|
|
4289
4361
|
maxForce: e.maxForce,
|
|
@@ -4291,7 +4363,7 @@ var re = (e, t, n) => {
|
|
|
4291
4363
|
theta: e.barnesHutTheta,
|
|
4292
4364
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4293
4365
|
nodeMass: e.nodeMass
|
|
4294
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4366
|
+
}), this.fillerLayoutAlgorithm = new $t({
|
|
4295
4367
|
rand: e.rand,
|
|
4296
4368
|
sparsity: e.edgeEquilibriumLength
|
|
4297
4369
|
});
|
|
@@ -4301,19 +4373,19 @@ var re = (e, t, n) => {
|
|
|
4301
4373
|
graph: t,
|
|
4302
4374
|
viewport: n
|
|
4303
4375
|
});
|
|
4304
|
-
return new
|
|
4376
|
+
return new Gt(t, i, {
|
|
4305
4377
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4306
4378
|
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
4307
4379
|
dtSec: Math.min(r, this.maxTimeDeltaSec),
|
|
4308
4380
|
nodeMass: this.nodeMass,
|
|
4309
4381
|
edgeEquilibriumLength: this.edgeEquilibriumLength,
|
|
4310
4382
|
edgeStiffness: this.edgeStiffness
|
|
4311
|
-
}).apply() < this.
|
|
4383
|
+
}).apply() < this.stopVelocity && !t.getAllNodeIds().some((e) => {
|
|
4312
4384
|
let n = t.getNode(e);
|
|
4313
4385
|
return n.x === null || n.y === null;
|
|
4314
4386
|
}) ? /* @__PURE__ */ new Map() : i;
|
|
4315
4387
|
}
|
|
4316
|
-
},
|
|
4388
|
+
}, un = (e) => {
|
|
4317
4389
|
let t = 1779033703, n = 3144134277, r = 1013904242, i = 2773480762;
|
|
4318
4390
|
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);
|
|
4319
4391
|
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, [
|
|
@@ -4322,55 +4394,55 @@ var re = (e, t, n) => {
|
|
|
4322
4394
|
r >>> 0,
|
|
4323
4395
|
i >>> 0
|
|
4324
4396
|
];
|
|
4325
|
-
},
|
|
4397
|
+
}, dn = (e, t, n, r) => function() {
|
|
4326
4398
|
e |= 0, t |= 0, n |= 0, r |= 0;
|
|
4327
4399
|
let i = (e + t | 0) + r | 0;
|
|
4328
4400
|
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;
|
|
4329
|
-
},
|
|
4401
|
+
}, fn = (e) => {
|
|
4330
4402
|
switch (e?.type) {
|
|
4331
4403
|
case "custom": return e.instance;
|
|
4332
4404
|
default: {
|
|
4333
|
-
let t =
|
|
4334
|
-
return new
|
|
4335
|
-
rand:
|
|
4336
|
-
maxTimeDeltaSec: e?.maxTimeDeltaSec ??
|
|
4337
|
-
nodeCharge: e?.nodeCharge ??
|
|
4338
|
-
nodeMass: e?.nodeMass ??
|
|
4339
|
-
edgeEquilibriumLength: e?.edgeEquilibriumLength ??
|
|
4340
|
-
edgeStiffness: e?.edgeStiffness ??
|
|
4341
|
-
stopVelocity: e?.stopVelocity ??
|
|
4342
|
-
maxForce: e?.maxForce ??
|
|
4343
|
-
nodeForceCoefficient: e?.nodeForceCoefficient ??
|
|
4344
|
-
barnesHutTheta: e?.barnesHut?.theta ??
|
|
4345
|
-
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ??
|
|
4405
|
+
let t = un(e?.seed ?? Y.seed);
|
|
4406
|
+
return new ln({
|
|
4407
|
+
rand: dn(t[0], t[1], t[2], t[3]),
|
|
4408
|
+
maxTimeDeltaSec: e?.maxTimeDeltaSec ?? Y.maxTimeDeltaSec,
|
|
4409
|
+
nodeCharge: e?.nodeCharge ?? Y.nodeCharge,
|
|
4410
|
+
nodeMass: e?.nodeMass ?? Y.nodeMass,
|
|
4411
|
+
edgeEquilibriumLength: e?.edgeEquilibriumLength ?? Y.edgeEquilibriumLength,
|
|
4412
|
+
edgeStiffness: e?.edgeStiffness ?? Y.edgeStiffness,
|
|
4413
|
+
stopVelocity: e?.stopVelocity ?? Y.stopVelocity,
|
|
4414
|
+
maxForce: e?.maxForce ?? Y.maxForce,
|
|
4415
|
+
nodeForceCoefficient: e?.nodeForceCoefficient ?? Y.nodeForceCoefficient,
|
|
4416
|
+
barnesHutTheta: e?.barnesHut?.theta ?? Y.barnesHutTheta,
|
|
4417
|
+
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ?? Y.barnesHutAreaRadiusThreshold
|
|
4346
4418
|
});
|
|
4347
4419
|
}
|
|
4348
4420
|
}
|
|
4349
|
-
},
|
|
4350
|
-
algorithm:
|
|
4351
|
-
staticNodeResolver: e?.staticNodeResolver ??
|
|
4352
|
-
onBeforeApplied: e?.events?.onBeforeApplied ??
|
|
4353
|
-
onAfterApplied: e?.events?.onAfterApplied ??
|
|
4354
|
-
}),
|
|
4421
|
+
}, pn = { staticNodeResolver: () => !1 }, mn = (e) => ({
|
|
4422
|
+
algorithm: fn(e?.algorithm ?? {}),
|
|
4423
|
+
staticNodeResolver: e?.staticNodeResolver ?? pn.staticNodeResolver,
|
|
4424
|
+
onBeforeApplied: e?.events?.onBeforeApplied ?? X,
|
|
4425
|
+
onAfterApplied: e?.events?.onAfterApplied ?? X
|
|
4426
|
+
}), hn = (e) => e instanceof l ? {
|
|
4355
4427
|
type: "trigger",
|
|
4356
4428
|
trigger: e
|
|
4357
4429
|
} : {
|
|
4358
4430
|
type: "topologyChangeSchedule",
|
|
4359
|
-
schedule:
|
|
4360
|
-
},
|
|
4431
|
+
schedule: We
|
|
4432
|
+
}, gn = Object.freeze({
|
|
4361
4433
|
staticNodeResolver: () => !1,
|
|
4362
4434
|
hierarchicalLayout: {
|
|
4363
4435
|
layerWidth: 300,
|
|
4364
4436
|
layerSpace: 300
|
|
4365
4437
|
}
|
|
4366
|
-
}),
|
|
4438
|
+
}), $ = (e, t) => ({
|
|
4367
4439
|
a: e.a * t.a + e.b * t.d,
|
|
4368
4440
|
b: e.a * t.b + e.b * t.e,
|
|
4369
4441
|
c: e.a * t.c + e.b * t.f + e.c,
|
|
4370
4442
|
d: e.d * t.a + e.e * t.d,
|
|
4371
4443
|
e: e.d * t.b + e.e * t.e,
|
|
4372
4444
|
f: e.d * t.c + e.e * t.f + e.f
|
|
4373
|
-
}),
|
|
4445
|
+
}), _n = (e) => {
|
|
4374
4446
|
let { a: t, b: n, c: r, d: i, e: a, f: o } = e, s = t * a - n * i;
|
|
4375
4447
|
return {
|
|
4376
4448
|
a: a / s,
|
|
@@ -4380,7 +4452,7 @@ var re = (e, t, n) => {
|
|
|
4380
4452
|
e: t / s,
|
|
4381
4453
|
f: (r * i - t * o) / s
|
|
4382
4454
|
};
|
|
4383
|
-
},
|
|
4455
|
+
}, vn = class {
|
|
4384
4456
|
resolve(e) {
|
|
4385
4457
|
if ("shift" in e) return this.createShiftBaseMatrix(e.shift);
|
|
4386
4458
|
if ("scale" in e) {
|
|
@@ -4422,11 +4494,11 @@ var re = (e, t, n) => {
|
|
|
4422
4494
|
return this.createRelativeTransform(n, r);
|
|
4423
4495
|
}
|
|
4424
4496
|
createMirrorRelativeMatrix(e, t) {
|
|
4425
|
-
let n = this.createMirrorYBaseMatrix(), r =
|
|
4497
|
+
let n = this.createMirrorYBaseMatrix(), r = $(this.createShiftBaseMatrix(t), this.createRotateBaseMatrix(e));
|
|
4426
4498
|
return this.createRelativeTransform(n, r);
|
|
4427
4499
|
}
|
|
4428
4500
|
createRelativeTransform(e, t) {
|
|
4429
|
-
return
|
|
4501
|
+
return $($(t, e), _n(t));
|
|
4430
4502
|
}
|
|
4431
4503
|
createShiftBaseMatrix(e) {
|
|
4432
4504
|
return {
|
|
@@ -4469,7 +4541,7 @@ var re = (e, t, n) => {
|
|
|
4469
4541
|
f: 0
|
|
4470
4542
|
};
|
|
4471
4543
|
}
|
|
4472
|
-
},
|
|
4544
|
+
}, yn = (e) => {
|
|
4473
4545
|
if (e === void 0) return (e) => e;
|
|
4474
4546
|
if (typeof e == "function") return e;
|
|
4475
4547
|
let t = Array.isArray(e) ? e : [e], n = {
|
|
@@ -4479,10 +4551,10 @@ var re = (e, t, n) => {
|
|
|
4479
4551
|
d: 0,
|
|
4480
4552
|
e: 1,
|
|
4481
4553
|
f: 0
|
|
4482
|
-
}, r = new
|
|
4554
|
+
}, r = new vn();
|
|
4483
4555
|
return t.forEach((e) => {
|
|
4484
4556
|
let t = r.resolve(e);
|
|
4485
|
-
n =
|
|
4557
|
+
n = $(n, t);
|
|
4486
4558
|
}), (e) => {
|
|
4487
4559
|
let { x: t, y: r } = e;
|
|
4488
4560
|
return {
|
|
@@ -4490,47 +4562,47 @@ var re = (e, t, n) => {
|
|
|
4490
4562
|
y: n.d * t + n.e * r + n.f
|
|
4491
4563
|
};
|
|
4492
4564
|
};
|
|
4493
|
-
},
|
|
4565
|
+
}, bn = (e) => {
|
|
4494
4566
|
if (typeof e == "function") return e;
|
|
4495
4567
|
switch (e) {
|
|
4496
|
-
case "outgoing": return
|
|
4497
|
-
case "incoming": return
|
|
4498
|
-
default: return
|
|
4568
|
+
case "outgoing": return sn;
|
|
4569
|
+
case "incoming": return cn;
|
|
4570
|
+
default: return on;
|
|
4499
4571
|
}
|
|
4500
|
-
},
|
|
4572
|
+
}, xn = (e) => {
|
|
4501
4573
|
switch (e?.type) {
|
|
4502
4574
|
case "custom": return e.instance;
|
|
4503
|
-
case "hierarchical": return new
|
|
4504
|
-
layerWidth: e.layerWidth ??
|
|
4505
|
-
layerSpace: e.layerSpace ??
|
|
4506
|
-
transform:
|
|
4507
|
-
nextLayerNodesResolver:
|
|
4575
|
+
case "hierarchical": return new an({
|
|
4576
|
+
layerWidth: e.layerWidth ?? gn.hierarchicalLayout.layerWidth,
|
|
4577
|
+
layerSpace: e.layerSpace ?? gn.hierarchicalLayout.layerSpace,
|
|
4578
|
+
transform: yn(e.transform),
|
|
4579
|
+
nextLayerNodesResolver: bn(e.nextLayerNodesResolver)
|
|
4508
4580
|
});
|
|
4509
4581
|
default: {
|
|
4510
|
-
let t =
|
|
4511
|
-
return new
|
|
4512
|
-
dtSec: e?.dtSec ??
|
|
4513
|
-
maxIterations: e?.maxIterations ??
|
|
4582
|
+
let t = un(e?.seed ?? Y.seed), n = dn(t[0], t[1], t[2], t[3]);
|
|
4583
|
+
return new en({
|
|
4584
|
+
dtSec: e?.dtSec ?? Y.dtSec,
|
|
4585
|
+
maxIterations: e?.maxIterations ?? Y.maxIterations,
|
|
4514
4586
|
rand: n,
|
|
4515
|
-
nodeCharge: e?.nodeCharge ??
|
|
4516
|
-
nodeMass: e?.nodeMass ??
|
|
4517
|
-
edgeEquilibriumLength: e?.edgeEquilibriumLength ??
|
|
4518
|
-
edgeStiffness: e?.edgeStiffness ??
|
|
4519
|
-
stopVelocity: e?.stopVelocity ??
|
|
4520
|
-
maxForce: e?.maxForce ??
|
|
4521
|
-
nodeForceCoefficient: e?.nodeForceCoefficient ??
|
|
4522
|
-
barnesHutTheta: e?.barnesHut?.theta ??
|
|
4523
|
-
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ??
|
|
4587
|
+
nodeCharge: e?.nodeCharge ?? Y.nodeCharge,
|
|
4588
|
+
nodeMass: e?.nodeMass ?? Y.nodeMass,
|
|
4589
|
+
edgeEquilibriumLength: e?.edgeEquilibriumLength ?? Y.edgeEquilibriumLength,
|
|
4590
|
+
edgeStiffness: e?.edgeStiffness ?? Y.edgeStiffness,
|
|
4591
|
+
stopVelocity: e?.stopVelocity ?? Y.stopVelocity,
|
|
4592
|
+
maxForce: e?.maxForce ?? Y.maxForce,
|
|
4593
|
+
nodeForceCoefficient: e?.nodeForceCoefficient ?? Y.nodeForceCoefficient,
|
|
4594
|
+
barnesHutTheta: e?.barnesHut?.theta ?? Y.barnesHutTheta,
|
|
4595
|
+
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ?? Y.barnesHutAreaRadiusThreshold
|
|
4524
4596
|
});
|
|
4525
4597
|
}
|
|
4526
4598
|
}
|
|
4527
|
-
},
|
|
4528
|
-
algorithm:
|
|
4529
|
-
applyOn:
|
|
4530
|
-
staticNodeResolver: e.staticNodeResolver ??
|
|
4531
|
-
onBeforeApplied: e.events?.onBeforeApplied ??
|
|
4532
|
-
onAfterApplied: e.events?.onAfterApplied ??
|
|
4533
|
-
}),
|
|
4599
|
+
}, Sn = (e) => ({
|
|
4600
|
+
algorithm: xn(e.algorithm),
|
|
4601
|
+
applyOn: hn(e.applyOn),
|
|
4602
|
+
staticNodeResolver: e.staticNodeResolver ?? gn.staticNodeResolver,
|
|
4603
|
+
onBeforeApplied: e.events?.onBeforeApplied ?? X,
|
|
4604
|
+
onAfterApplied: e.events?.onAfterApplied ?? X
|
|
4605
|
+
}), Cn = (e, t) => ({
|
|
4534
4606
|
...e,
|
|
4535
4607
|
onNodeDragStarted: (n) => {
|
|
4536
4608
|
t.add(n), e.onNodeDragStarted(n);
|
|
@@ -4538,7 +4610,7 @@ var re = (e, t, n) => {
|
|
|
4538
4610
|
onNodeDragFinished: (n) => {
|
|
4539
4611
|
t.delete(n), e.onNodeDragFinished(n);
|
|
4540
4612
|
}
|
|
4541
|
-
}),
|
|
4613
|
+
}), wn = (e, t) => {
|
|
4542
4614
|
e.graph.onBeforeNodeRemoved.subscribe((e) => {
|
|
4543
4615
|
t.delete(e);
|
|
4544
4616
|
}), e.graph.onBeforeClear.subscribe(() => {
|
|
@@ -4546,55 +4618,66 @@ var re = (e, t, n) => {
|
|
|
4546
4618
|
}), e.onBeforeDestroy.subscribe(() => {
|
|
4547
4619
|
t.clear();
|
|
4548
4620
|
});
|
|
4549
|
-
},
|
|
4621
|
+
}, Tn = (e, t) => ({
|
|
4550
4622
|
...e,
|
|
4551
4623
|
staticNodeResolver: (n) => e.staticNodeResolver(n) || t.has(n)
|
|
4552
|
-
}),
|
|
4624
|
+
}), En = (e) => () => e, Dn = En(0), On = () => {
|
|
4553
4625
|
let e = 0;
|
|
4554
4626
|
return () => e++;
|
|
4555
|
-
},
|
|
4556
|
-
let n =
|
|
4557
|
-
return e === "incremental" && (n = i), t === "incremental" && (r = i), typeof e == "number" && (n =
|
|
4627
|
+
}, kn = (e, t) => {
|
|
4628
|
+
let n = Dn, r = Dn, i = On();
|
|
4629
|
+
return e === "incremental" && (n = i), t === "incremental" && (r = i), typeof e == "number" && (n = En(e)), typeof t == "number" && (r = En(t)), typeof e == "function" && (n = e), typeof t == "function" && (r = t), {
|
|
4558
4630
|
nodesPriorityFn: n,
|
|
4559
4631
|
edgesPriorityFn: r
|
|
4560
4632
|
};
|
|
4561
|
-
},
|
|
4562
|
-
let t =
|
|
4633
|
+
}, An = (e) => {
|
|
4634
|
+
let t = kn(e.nodes?.priority, e.edges?.priority);
|
|
4563
4635
|
return {
|
|
4564
4636
|
nodes: {
|
|
4565
|
-
centerFn: e.nodes?.centerFn ??
|
|
4637
|
+
centerFn: e.nodes?.centerFn ?? re,
|
|
4566
4638
|
priorityFn: t.nodesPriorityFn
|
|
4567
4639
|
},
|
|
4568
4640
|
ports: { direction: e.ports?.direction ?? 0 },
|
|
4569
4641
|
edges: {
|
|
4570
|
-
shapeFactory:
|
|
4642
|
+
shapeFactory: Dt(e.edges?.shape ?? {}),
|
|
4571
4643
|
priorityFn: t.edgesPriorityFn
|
|
4572
4644
|
}
|
|
4573
4645
|
};
|
|
4574
|
-
},
|
|
4575
|
-
let { canvasDefaults: t } = e, n = e.hasLayout ?
|
|
4646
|
+
}, jn = (e) => e.applyOn.type === "topologyChangeSchedule" ? e.applyOn.schedule : B, Mn = (e) => {
|
|
4647
|
+
let { canvasDefaults: t } = e, n = e.hasLayout ? jn(e.layoutParams) : B;
|
|
4576
4648
|
return { focus: {
|
|
4577
4649
|
contentPadding: t.focus?.contentPadding ?? 100,
|
|
4578
4650
|
minContentScale: t.focus?.minContentScale ?? 0,
|
|
4579
4651
|
schedule: n,
|
|
4580
4652
|
animationDuration: t.focus?.animationDuration ?? 0
|
|
4581
4653
|
} };
|
|
4582
|
-
},
|
|
4654
|
+
}, Nn = (e) => ({
|
|
4583
4655
|
onNodeSelected: e.onNodeSelected,
|
|
4584
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
4585
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
4586
|
-
movementThreshold: e.movementThreshold ??
|
|
4587
|
-
}),
|
|
4656
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Q,
|
|
4657
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z,
|
|
4658
|
+
movementThreshold: e.movementThreshold ?? 10
|
|
4659
|
+
}), Pn = (e) => ({
|
|
4588
4660
|
onCanvasSelected: e.onCanvasSelected,
|
|
4589
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
4590
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
4591
|
-
movementThreshold: e.movementThreshold ??
|
|
4592
|
-
}),
|
|
4661
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Q,
|
|
4662
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z,
|
|
4663
|
+
movementThreshold: e.movementThreshold ?? 10
|
|
4664
|
+
}), Fn = (e) => ({
|
|
4593
4665
|
onEdgeSelected: e.onEdgeSelected,
|
|
4594
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
4595
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
4596
|
-
movementThreshold: e.movementThreshold ??
|
|
4597
|
-
}),
|
|
4666
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Q,
|
|
4667
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z,
|
|
4668
|
+
movementThreshold: e.movementThreshold ?? 10
|
|
4669
|
+
}), In = () => {
|
|
4670
|
+
let e = document.createElement("div");
|
|
4671
|
+
return e.style.width = "100%", e.style.height = "100%", e.style.background = "rgba(174, 238, 255, 0.34)", e.style.border = "1px dashed rgba(96, 96, 96, 0.47)", e;
|
|
4672
|
+
}, Ln = (e) => ({
|
|
4673
|
+
rectangleElement: e?.rectangleElement ?? In(),
|
|
4674
|
+
mouseDownEventVerifier: e?.mouseDownEventVerifier ?? Ot,
|
|
4675
|
+
mouseUpEventVerifier: e?.mouseUpEventVerifier ?? Z,
|
|
4676
|
+
onSelectionStarted: e?.onSelectionStarted ?? X,
|
|
4677
|
+
onSelectionChange: e?.onSelectionChange ?? X,
|
|
4678
|
+
onSelectionInterrupted: e?.onSelectionInterrupted ?? X,
|
|
4679
|
+
onSelectionFinished: e?.onSelectionFinished ?? X
|
|
4680
|
+
}), Rn = class {
|
|
4598
4681
|
element;
|
|
4599
4682
|
used = !1;
|
|
4600
4683
|
canvasDefaults = {};
|
|
@@ -4603,6 +4686,7 @@ var re = (e, t, n) => {
|
|
|
4603
4686
|
backgroundConfig = {};
|
|
4604
4687
|
connectablePortsConfig = {};
|
|
4605
4688
|
draggableEdgesConfig = {};
|
|
4689
|
+
rectangularSelectionConfig = void 0;
|
|
4606
4690
|
virtualScrollConfig = void 0;
|
|
4607
4691
|
layoutConfig = {};
|
|
4608
4692
|
animatedLayoutConfig = {};
|
|
@@ -4615,15 +4699,16 @@ var re = (e, t, n) => {
|
|
|
4615
4699
|
hasBackground = !1;
|
|
4616
4700
|
hasUserConnectablePorts = !1;
|
|
4617
4701
|
hasUserDraggableEdges = !1;
|
|
4702
|
+
hasRectangularSelection = !1;
|
|
4618
4703
|
hasAnimatedLayout = !1;
|
|
4619
4704
|
hasLayout = !1;
|
|
4620
4705
|
boxRenderingTrigger = new l();
|
|
4621
4706
|
window = window;
|
|
4622
4707
|
animationStaticNodes = /* @__PURE__ */ new Set();
|
|
4623
4708
|
pointInsideVerifier;
|
|
4624
|
-
eventTagger = new
|
|
4709
|
+
eventTagger = new Qe();
|
|
4625
4710
|
constructor(e) {
|
|
4626
|
-
this.element = e, this.pointInsideVerifier = new
|
|
4711
|
+
this.element = e, this.pointInsideVerifier = new C(e, this.window);
|
|
4627
4712
|
}
|
|
4628
4713
|
setDefaults(e) {
|
|
4629
4714
|
return this.canvasDefaults = e, this;
|
|
@@ -4649,6 +4734,9 @@ var re = (e, t, n) => {
|
|
|
4649
4734
|
enableUserDraggableEdges(e) {
|
|
4650
4735
|
return this.hasUserDraggableEdges = !0, this.draggableEdgesConfig = e ?? {}, this;
|
|
4651
4736
|
}
|
|
4737
|
+
enableRectangularSelection(e) {
|
|
4738
|
+
return this.hasRectangularSelection = !0, this.rectangularSelectionConfig = e, this;
|
|
4739
|
+
}
|
|
4652
4740
|
enableLayout(e) {
|
|
4653
4741
|
return this.layoutConfig = e ?? {}, this.hasLayout = !0, this.hasAnimatedLayout = !1, this;
|
|
4654
4742
|
}
|
|
@@ -4665,40 +4753,40 @@ var re = (e, t, n) => {
|
|
|
4665
4753
|
return this.userSelectableCanvasConfig = e, this;
|
|
4666
4754
|
}
|
|
4667
4755
|
build() {
|
|
4668
|
-
if (this.used) throw new
|
|
4756
|
+
if (this.used) throw new Wt("Failed to build Canvas because CanvasBuilder is a single-use object");
|
|
4669
4757
|
this.used = !0;
|
|
4670
|
-
let e = new y(this.element), t = new h(), n = new
|
|
4758
|
+
let e = new y(this.element), t = new h(), n = new Tt(this.element), r = this.createHtmlView(n.main, t, e), i = An(this.canvasDefaults), a = new Ue(t, r, i), o = Sn(this.layoutConfig), s = new Ye(t, e, Mn({
|
|
4671
4759
|
canvasDefaults: this.canvasDefaults,
|
|
4672
4760
|
hasLayout: this.hasLayout,
|
|
4673
4761
|
layoutParams: o
|
|
4674
|
-
}), this.window), c = new
|
|
4675
|
-
if (this.hasBackground &&
|
|
4676
|
-
let e =
|
|
4677
|
-
|
|
4762
|
+
}), this.window), c = new Ge(e), l = new d(new He(t), c, a, s);
|
|
4763
|
+
if (this.hasBackground && st.configure(l, Lt(this.backgroundConfig), n.background), this.hasNodeResizeReactiveEdges && b.configure(l), this.userSelectableEdgesConfig !== void 0) {
|
|
4764
|
+
let e = Fn(this.userSelectableEdgesConfig);
|
|
4765
|
+
vt.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4678
4766
|
}
|
|
4679
4767
|
if (this.userSelectableNodesConfig !== void 0) {
|
|
4680
|
-
let e =
|
|
4681
|
-
|
|
4768
|
+
let e = Nn(this.userSelectableNodesConfig);
|
|
4769
|
+
_t.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4682
4770
|
}
|
|
4683
4771
|
if (this.userSelectableCanvasConfig !== void 0) {
|
|
4684
|
-
let e =
|
|
4685
|
-
|
|
4772
|
+
let e = Pn(this.userSelectableCanvasConfig);
|
|
4773
|
+
yt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4686
4774
|
}
|
|
4687
4775
|
if (this.hasDraggableNodes) {
|
|
4688
|
-
let e =
|
|
4689
|
-
this.hasAnimatedLayout && (e =
|
|
4776
|
+
let e = kt(this.dragConfig);
|
|
4777
|
+
this.hasAnimatedLayout && (e = Cn(e, this.animationStaticNodes)), tt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4690
4778
|
}
|
|
4691
4779
|
if (this.hasUserConnectablePorts) {
|
|
4692
|
-
let t =
|
|
4693
|
-
|
|
4780
|
+
let t = zt(this.connectablePortsConfig, i.edges.shapeFactory, l.graph);
|
|
4781
|
+
ct.configure(l, n.overlayConnectablePorts, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
|
|
4694
4782
|
}
|
|
4695
4783
|
if (this.hasUserDraggableEdges) {
|
|
4696
|
-
let t =
|
|
4697
|
-
|
|
4784
|
+
let t = Vt(this.draggableEdgesConfig, l.graph);
|
|
4785
|
+
lt.configure(l, n.overlayDraggableEdges, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
|
|
4698
4786
|
}
|
|
4699
|
-
if (this.virtualScrollConfig === void 0 ? this.hasTransformableViewport &&
|
|
4700
|
-
let e =
|
|
4701
|
-
this.hasDraggableNodes && (
|
|
4787
|
+
if (this.virtualScrollConfig === void 0 ? this.hasTransformableViewport && nt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, Pt(this.transformConfig)) : rt.configure(l, n.main, this.window, Pt(this.transformConfig), this.boxRenderingTrigger, this.pointInsideVerifier, this.eventTagger, Ht(this.virtualScrollConfig)), this.hasRectangularSelection && St.configure(l, n.main, n.overlayRectangularSelection, this.pointInsideVerifier, this.eventTagger, this.window, Ln(this.rectangularSelectionConfig)), this.hasLayout && pt.configure(l, o), this.hasAnimatedLayout) {
|
|
4788
|
+
let e = mn(this.animatedLayoutConfig);
|
|
4789
|
+
this.hasDraggableNodes && (wn(l, this.animationStaticNodes), e = Tn(e, this.animationStaticNodes)), gt.configure(l, e, this.window);
|
|
4702
4790
|
}
|
|
4703
4791
|
return l.onBeforeDestroy.subscribe(() => {
|
|
4704
4792
|
n.destroy();
|
|
@@ -4706,8 +4794,8 @@ var re = (e, t, n) => {
|
|
|
4706
4794
|
}
|
|
4707
4795
|
createHtmlView(e, t, n) {
|
|
4708
4796
|
let r = new a(t, n, e);
|
|
4709
|
-
return this.virtualScrollConfig !== void 0 && (r = new s(r, t, this.boxRenderingTrigger,
|
|
4797
|
+
return this.virtualScrollConfig !== void 0 && (r = new s(r, t, this.boxRenderingTrigger, Ut(this.virtualScrollConfig))), r = new c(r, t), r;
|
|
4710
4798
|
}
|
|
4711
4799
|
};
|
|
4712
4800
|
//#endregion
|
|
4713
|
-
export {
|
|
4801
|
+
export { ke as BezierEdgeShape, Rn as CanvasBuilder, Wt as CanvasBuilderError, p as CanvasError, e as ConnectionCategory, R as DirectEdgeShape, l as EventSubject, ze as InteractiveEdgeError, Be as InteractiveEdgeShape, Ve as MidpointEdgeShape, Me as OrthogonalEdgeShape, Ae as StraightEdgeShape };
|