@html-graph/html-graph 8.6.1 → 8.7.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 +0 -4
- package/dist/html-graph.js +261 -256
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Ke = Object.defineProperty;
|
|
2
2
|
var Qe = (r, e, t) => e in r ? Ke(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var i = (r, e, t) => Qe(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
var
|
|
4
|
+
var D = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(D || {});
|
|
5
5
|
const Ze = () => {
|
|
6
6
|
const r = document.createElement("div");
|
|
7
7
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
@@ -72,8 +72,8 @@ class Ee {
|
|
|
72
72
|
h,
|
|
73
73
|
d
|
|
74
74
|
), g = this.createEdgeRenderPort(o, a, h, d);
|
|
75
|
-
let l =
|
|
76
|
-
s.element === o.element ? l =
|
|
75
|
+
let l = D.Line;
|
|
76
|
+
s.element === o.element ? l = D.PortCycle : s.nodeId === o.nodeId && (l = D.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
|
|
77
77
|
}
|
|
78
78
|
updateEdgePriority(e) {
|
|
79
79
|
const t = this.graphStore.getEdge(e);
|
|
@@ -724,7 +724,7 @@ class Q {
|
|
|
724
724
|
const nt = (r, e, t) => {
|
|
725
725
|
const { x: s, y: o, width: n, height: a } = r.getBoundingClientRect();
|
|
726
726
|
return e >= s && e <= s + n && t >= o && t <= o + a;
|
|
727
|
-
}, at = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight,
|
|
727
|
+
}, at = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, R = (r, e, t, s) => nt(e, t, s) && at(r, t, s), U = (r, e) => {
|
|
728
728
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
729
729
|
}, O = (r) => {
|
|
730
730
|
const e = document.createElement("div");
|
|
@@ -786,7 +786,7 @@ var N = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "
|
|
|
786
786
|
const Ne = (r, e) => ({
|
|
787
787
|
x: r / 2,
|
|
788
788
|
y: e / 2
|
|
789
|
-
}),
|
|
789
|
+
}), y = {
|
|
790
790
|
x: 0,
|
|
791
791
|
y: 0
|
|
792
792
|
}, m = (r, e, t) => ({
|
|
@@ -820,9 +820,9 @@ class dt {
|
|
|
820
820
|
const t = this.params.to;
|
|
821
821
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
822
822
|
const s = m(
|
|
823
|
-
{ x: this.params.arrowLength, y:
|
|
823
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
824
824
|
this.params.sourceDirection,
|
|
825
|
-
|
|
825
|
+
y
|
|
826
826
|
), o = m(
|
|
827
827
|
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
828
828
|
this.params.targetDirection,
|
|
@@ -833,7 +833,7 @@ class dt {
|
|
|
833
833
|
}, a = {
|
|
834
834
|
x: o.x - this.params.targetDirection.x * this.params.curvature,
|
|
835
835
|
y: o.y - this.params.targetDirection.y * this.params.curvature
|
|
836
|
-
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${o.x} ${o.y}`, d = this.params.hasSourceArrow ? "" : `M ${
|
|
836
|
+
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${o.x} ${o.y}`, d = this.params.hasSourceArrow ? "" : `M ${y.x} ${y.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${this.params.to.x} ${this.params.to.y}`;
|
|
837
837
|
this.path = `${d}${h}${c}`;
|
|
838
838
|
}
|
|
839
839
|
}
|
|
@@ -843,10 +843,10 @@ class ct {
|
|
|
843
843
|
i(this, "midpoint");
|
|
844
844
|
this.params = e;
|
|
845
845
|
const t = this.params.hasSourceArrow ? m(
|
|
846
|
-
{ x: this.params.arrowLength, y:
|
|
846
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
847
847
|
this.params.sourceDirection,
|
|
848
|
-
|
|
849
|
-
) :
|
|
848
|
+
y
|
|
849
|
+
) : y, s = this.params.hasTargetArrow ? m(
|
|
850
850
|
{
|
|
851
851
|
x: this.params.to.x - this.params.arrowLength,
|
|
852
852
|
y: this.params.to.y
|
|
@@ -854,9 +854,9 @@ class ct {
|
|
|
854
854
|
this.params.targetDirection,
|
|
855
855
|
this.params.to
|
|
856
856
|
) : this.params.to, o = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = m(
|
|
857
|
-
{ x: o, y:
|
|
857
|
+
{ x: o, y: y.y },
|
|
858
858
|
this.params.sourceDirection,
|
|
859
|
-
|
|
859
|
+
y
|
|
860
860
|
), g = {
|
|
861
861
|
x: c.x + h,
|
|
862
862
|
y: c.y + d
|
|
@@ -867,10 +867,10 @@ class ct {
|
|
|
867
867
|
), u = {
|
|
868
868
|
x: l.x + h,
|
|
869
869
|
y: l.y + d
|
|
870
|
-
},
|
|
870
|
+
}, w = {
|
|
871
871
|
x: (g.x + u.x) / 2,
|
|
872
872
|
y: (g.y + u.y) / 2
|
|
873
|
-
},
|
|
873
|
+
}, p = {
|
|
874
874
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
875
875
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
876
876
|
}, v = {
|
|
@@ -886,10 +886,10 @@ class ct {
|
|
|
886
886
|
this.path = [
|
|
887
887
|
`M ${t.x} ${t.y}`,
|
|
888
888
|
`L ${c.x} ${c.y}`,
|
|
889
|
-
`C ${
|
|
889
|
+
`C ${p.x} ${p.y} ${x.x} ${x.y} ${w.x} ${w.y}`,
|
|
890
890
|
`C ${b.x} ${b.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
|
|
891
891
|
`L ${s.x} ${s.y}`
|
|
892
|
-
].join(" "), this.midpoint = z(
|
|
892
|
+
].join(" "), this.midpoint = z(w, e.flipX, e.flipY, e.to);
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
895
|
const Z = Object.freeze({
|
|
@@ -897,13 +897,13 @@ const Z = Object.freeze({
|
|
|
897
897
|
}), Me = (r) => {
|
|
898
898
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
899
899
|
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(Z.edgeColor, r), e;
|
|
900
|
-
},
|
|
900
|
+
}, De = (r) => {
|
|
901
901
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
902
902
|
return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
903
903
|
}, W = () => {
|
|
904
904
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
905
905
|
return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
|
|
906
|
-
},
|
|
906
|
+
}, Re = () => {
|
|
907
907
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
908
908
|
return r.style.transformOrigin = "50% 50%", r;
|
|
909
909
|
}, Le = (r, e) => {
|
|
@@ -915,13 +915,13 @@ const Z = Object.freeze({
|
|
|
915
915
|
let o = 0, n = 0, a = 0;
|
|
916
916
|
r.forEach((h, d) => {
|
|
917
917
|
let c = 0, g = 0, l = 0;
|
|
918
|
-
const u = d > 0,
|
|
919
|
-
if (u && (c = -o, g = -n, l = a),
|
|
918
|
+
const u = d > 0, w = d < s, p = u && w;
|
|
919
|
+
if (u && (c = -o, g = -n, l = a), w) {
|
|
920
920
|
const V = r[d + 1];
|
|
921
921
|
o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
|
|
922
922
|
}
|
|
923
|
-
const x = a !== 0 ? Math.min((
|
|
924
|
-
d > 0 && t.push(`L ${L.x} ${L.y}`),
|
|
923
|
+
const x = a !== 0 ? Math.min((p ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, b = p ? { x: h.x + o * x, y: h.y + n * x } : h, C = l !== 0 ? Math.min((p ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, L = p ? { x: h.x + c * C, y: h.y + g * C } : h;
|
|
924
|
+
d > 0 && t.push(`L ${L.x} ${L.y}`), p && t.push(
|
|
925
925
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${b.x} ${b.y}`
|
|
926
926
|
);
|
|
927
927
|
});
|
|
@@ -936,10 +936,10 @@ class lt {
|
|
|
936
936
|
const t = this.params.to;
|
|
937
937
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
938
938
|
const s = this.params.hasSourceArrow ? m(
|
|
939
|
-
{ x: this.params.arrowLength, y:
|
|
939
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
940
940
|
this.params.sourceDirection,
|
|
941
|
-
|
|
942
|
-
) :
|
|
941
|
+
y
|
|
942
|
+
) : y, o = this.params.hasTargetArrow ? m(
|
|
943
943
|
{
|
|
944
944
|
x: this.params.to.x - this.params.arrowLength,
|
|
945
945
|
y: this.params.to.y
|
|
@@ -947,9 +947,9 @@ class lt {
|
|
|
947
947
|
this.params.targetDirection,
|
|
948
948
|
this.params.to
|
|
949
949
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
950
|
-
{ x: a, y:
|
|
950
|
+
{ x: a, y: y.y },
|
|
951
951
|
this.params.sourceDirection,
|
|
952
|
-
|
|
952
|
+
y
|
|
953
953
|
), d = m(
|
|
954
954
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
955
955
|
this.params.targetDirection,
|
|
@@ -957,12 +957,12 @@ class lt {
|
|
|
957
957
|
), c = Math.max((h.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
|
|
958
958
|
x: this.params.flipX > 0 ? c : -n,
|
|
959
959
|
y: h.y
|
|
960
|
-
}, u = { x: l.x, y: g },
|
|
960
|
+
}, u = { x: l.x, y: g }, w = {
|
|
961
961
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
962
962
|
y: d.y
|
|
963
|
-
},
|
|
963
|
+
}, p = { x: w.x, y: g };
|
|
964
964
|
this.path = M(
|
|
965
|
-
[s, h, l, u,
|
|
965
|
+
[s, h, l, u, p, w, d, o],
|
|
966
966
|
this.params.roundness
|
|
967
967
|
);
|
|
968
968
|
}
|
|
@@ -973,10 +973,10 @@ class gt {
|
|
|
973
973
|
i(this, "midpoint");
|
|
974
974
|
this.params = e;
|
|
975
975
|
const t = this.params.hasSourceArrow ? m(
|
|
976
|
-
{ x: this.params.arrowLength, y:
|
|
976
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
977
977
|
this.params.sourceDirection,
|
|
978
|
-
|
|
979
|
-
) :
|
|
978
|
+
y
|
|
979
|
+
) : y, s = this.params.hasTargetArrow ? m(
|
|
980
980
|
{
|
|
981
981
|
x: this.params.to.x - this.params.arrowLength,
|
|
982
982
|
y: this.params.to.y
|
|
@@ -984,15 +984,15 @@ class gt {
|
|
|
984
984
|
this.params.targetDirection,
|
|
985
985
|
this.params.to
|
|
986
986
|
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
987
|
-
{ x: o, y:
|
|
987
|
+
{ x: o, y: y.y },
|
|
988
988
|
this.params.sourceDirection,
|
|
989
|
-
|
|
989
|
+
y
|
|
990
990
|
), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = m(
|
|
991
991
|
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
992
992
|
this.params.targetDirection,
|
|
993
993
|
this.params.to
|
|
994
|
-
), u = { x: l.x + d, y: l.y + c },
|
|
995
|
-
this.midpoint = z(
|
|
994
|
+
), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
|
|
995
|
+
this.midpoint = z(w, e.flipX, e.flipY, e.to), this.path = M(
|
|
996
996
|
[t, n, g, u, l, s],
|
|
997
997
|
this.params.roundness
|
|
998
998
|
);
|
|
@@ -1006,10 +1006,10 @@ class ut {
|
|
|
1006
1006
|
const t = this.params.to;
|
|
1007
1007
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1008
1008
|
const s = this.params.hasSourceArrow ? m(
|
|
1009
|
-
{ x: this.params.arrowLength, y:
|
|
1009
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1010
1010
|
this.params.sourceDirection,
|
|
1011
|
-
|
|
1012
|
-
) :
|
|
1011
|
+
y
|
|
1012
|
+
) : y, o = this.params.hasTargetArrow ? m(
|
|
1013
1013
|
{
|
|
1014
1014
|
x: this.params.to.x - this.params.arrowLength,
|
|
1015
1015
|
y: this.params.to.y
|
|
@@ -1017,9 +1017,9 @@ class ut {
|
|
|
1017
1017
|
this.params.targetDirection,
|
|
1018
1018
|
this.params.to
|
|
1019
1019
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = m(
|
|
1020
|
-
{ x: n, y:
|
|
1020
|
+
{ x: n, y: y.y },
|
|
1021
1021
|
this.params.sourceDirection,
|
|
1022
|
-
|
|
1022
|
+
y
|
|
1023
1023
|
), h = m(
|
|
1024
1024
|
{ x: this.params.to.x - n, y: this.params.to.y },
|
|
1025
1025
|
this.params.targetDirection,
|
|
@@ -1036,10 +1036,10 @@ class pt {
|
|
|
1036
1036
|
const t = this.params.to;
|
|
1037
1037
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1038
1038
|
const s = this.params.hasSourceArrow ? m(
|
|
1039
|
-
{ x: this.params.arrowLength, y:
|
|
1039
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1040
1040
|
this.params.sourceDirection,
|
|
1041
|
-
|
|
1042
|
-
) :
|
|
1041
|
+
y
|
|
1042
|
+
) : y, o = this.params.hasTargetArrow ? m(
|
|
1043
1043
|
{
|
|
1044
1044
|
x: this.params.to.x - this.params.arrowLength,
|
|
1045
1045
|
y: this.params.to.y
|
|
@@ -1047,9 +1047,9 @@ class pt {
|
|
|
1047
1047
|
this.params.targetDirection,
|
|
1048
1048
|
this.params.to
|
|
1049
1049
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
1050
|
-
{ x: a, y:
|
|
1050
|
+
{ x: a, y: y.y },
|
|
1051
1051
|
this.params.sourceDirection,
|
|
1052
|
-
|
|
1052
|
+
y
|
|
1053
1053
|
), d = m(
|
|
1054
1054
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1055
1055
|
this.params.targetDirection,
|
|
@@ -1057,12 +1057,12 @@ class pt {
|
|
|
1057
1057
|
), c = Math.max((h.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
|
|
1058
1058
|
x: h.x,
|
|
1059
1059
|
y: this.params.flipY > 0 ? c : -n
|
|
1060
|
-
}, u = { x: g, y: l.y },
|
|
1060
|
+
}, u = { x: g, y: l.y }, w = {
|
|
1061
1061
|
x: d.x,
|
|
1062
1062
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1063
|
-
},
|
|
1063
|
+
}, p = { x: g, y: w.y };
|
|
1064
1064
|
this.path = M(
|
|
1065
|
-
[s, h, l, u,
|
|
1065
|
+
[s, h, l, u, p, w, d, o],
|
|
1066
1066
|
this.params.roundness
|
|
1067
1067
|
);
|
|
1068
1068
|
}
|
|
@@ -1073,17 +1073,17 @@ class J {
|
|
|
1073
1073
|
i(this, "midpoint");
|
|
1074
1074
|
this.params = e;
|
|
1075
1075
|
const t = this.params.arrowOffset, s = this.params.side, o = this.params.arrowLength + t, n = o + 2 * s, h = [
|
|
1076
|
-
{ x: this.params.arrowLength, y:
|
|
1077
|
-
{ x: o, y:
|
|
1076
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1077
|
+
{ x: o, y: y.y },
|
|
1078
1078
|
{ x: o, y: this.params.side },
|
|
1079
1079
|
{ x: n, y: this.params.side },
|
|
1080
1080
|
{ x: n, y: -this.params.side },
|
|
1081
1081
|
{ x: o, y: -this.params.side },
|
|
1082
|
-
{ x: o, y:
|
|
1083
|
-
{ x: this.params.arrowLength, y:
|
|
1082
|
+
{ x: o, y: y.y },
|
|
1083
|
+
{ x: this.params.arrowLength, y: y.y }
|
|
1084
1084
|
].map(
|
|
1085
|
-
(c) => m(c, this.params.sourceDirection,
|
|
1086
|
-
), d = `M ${
|
|
1085
|
+
(c) => m(c, this.params.sourceDirection, y)
|
|
1086
|
+
), d = `M ${y.x} ${y.y} L ${h[0].x} ${h[0].y} `;
|
|
1087
1087
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${M(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
@@ -1093,19 +1093,19 @@ class wt {
|
|
|
1093
1093
|
i(this, "midpoint");
|
|
1094
1094
|
this.params = e;
|
|
1095
1095
|
const t = this.params.smallRadius, s = this.params.radius, o = t + s, n = t * s / o, a = Math.sqrt(o * o - t * t), h = a * t / o, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, l = [
|
|
1096
|
-
{ x: this.params.arrowLength, y:
|
|
1096
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1097
1097
|
{ x: c, y: n },
|
|
1098
1098
|
{ x: c, y: -n },
|
|
1099
1099
|
{ x: d, y: 0 }
|
|
1100
1100
|
].map(
|
|
1101
|
-
(
|
|
1101
|
+
(p) => m(p, this.params.sourceDirection, y)
|
|
1102
1102
|
), u = [
|
|
1103
1103
|
`M ${l[0].x} ${l[0].y}`,
|
|
1104
1104
|
`A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
|
|
1105
1105
|
`A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
|
|
1106
1106
|
`A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
|
|
1107
|
-
].join(" "),
|
|
1108
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" :
|
|
1107
|
+
].join(" "), w = `M 0 0 L ${l[0].x} ${l[0].y} `;
|
|
1108
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
1111
|
class yt {
|
|
@@ -1127,7 +1127,7 @@ class yt {
|
|
|
1127
1127
|
offset: this.params.sourceOffset,
|
|
1128
1128
|
hasArrow: this.params.hasSourceArrow,
|
|
1129
1129
|
flip: 1,
|
|
1130
|
-
shift:
|
|
1130
|
+
shift: y
|
|
1131
1131
|
}), n = this.createDirectLinePoint({
|
|
1132
1132
|
offset: this.params.targetOffset,
|
|
1133
1133
|
hasArrow: this.params.hasTargetArrow,
|
|
@@ -1150,10 +1150,10 @@ class ft {
|
|
|
1150
1150
|
i(this, "midpoint");
|
|
1151
1151
|
this.params = e;
|
|
1152
1152
|
const t = this.params.hasSourceArrow ? m(
|
|
1153
|
-
{ x: this.params.arrowLength, y:
|
|
1153
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1154
1154
|
this.params.sourceDirection,
|
|
1155
|
-
|
|
1156
|
-
) :
|
|
1155
|
+
y
|
|
1156
|
+
) : y, s = this.params.hasTargetArrow ? m(
|
|
1157
1157
|
{
|
|
1158
1158
|
x: this.params.to.x - this.params.arrowLength,
|
|
1159
1159
|
y: this.params.to.y
|
|
@@ -1161,9 +1161,9 @@ class ft {
|
|
|
1161
1161
|
this.params.targetDirection,
|
|
1162
1162
|
this.params.to
|
|
1163
1163
|
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1164
|
-
{ x: o, y:
|
|
1164
|
+
{ x: o, y: y.y },
|
|
1165
1165
|
this.params.sourceDirection,
|
|
1166
|
-
|
|
1166
|
+
y
|
|
1167
1167
|
), a = m(
|
|
1168
1168
|
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1169
1169
|
this.params.targetDirection,
|
|
@@ -1191,10 +1191,10 @@ class mt {
|
|
|
1191
1191
|
i(this, "midpoint");
|
|
1192
1192
|
this.params = e;
|
|
1193
1193
|
const t = this.params.hasSourceArrow ? m(
|
|
1194
|
-
{ x: this.params.arrowLength, y:
|
|
1194
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1195
1195
|
this.params.sourceDirection,
|
|
1196
|
-
|
|
1197
|
-
) :
|
|
1196
|
+
y
|
|
1197
|
+
) : y, s = this.params.hasTargetArrow ? m(
|
|
1198
1198
|
{
|
|
1199
1199
|
x: this.params.to.x - this.params.arrowLength,
|
|
1200
1200
|
y: this.params.to.y
|
|
@@ -1202,9 +1202,9 @@ class mt {
|
|
|
1202
1202
|
this.params.targetDirection,
|
|
1203
1203
|
this.params.to
|
|
1204
1204
|
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1205
|
-
{ x: o, y:
|
|
1205
|
+
{ x: o, y: y.y },
|
|
1206
1206
|
this.params.sourceDirection,
|
|
1207
|
-
|
|
1207
|
+
y
|
|
1208
1208
|
), a = m(
|
|
1209
1209
|
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1210
1210
|
this.params.targetDirection,
|
|
@@ -1252,14 +1252,14 @@ const f = Object.freeze({
|
|
|
1252
1252
|
class k {
|
|
1253
1253
|
constructor(e) {
|
|
1254
1254
|
i(this, "svg");
|
|
1255
|
-
i(this, "group",
|
|
1255
|
+
i(this, "group", Re());
|
|
1256
1256
|
i(this, "line");
|
|
1257
1257
|
i(this, "sourceArrow", null);
|
|
1258
1258
|
i(this, "targetArrow", null);
|
|
1259
1259
|
i(this, "onAfterRender");
|
|
1260
1260
|
i(this, "afterRenderEmitter");
|
|
1261
1261
|
i(this, "arrowRenderer");
|
|
1262
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = S(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Me(e.color), this.svg.appendChild(this.group), this.line =
|
|
1262
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = S(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Me(e.color), this.svg.appendChild(this.group), this.line = De(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = W(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = W(), this.group.appendChild(this.targetArrow));
|
|
1263
1263
|
}
|
|
1264
1264
|
render(e) {
|
|
1265
1265
|
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Te(
|
|
@@ -1280,53 +1280,53 @@ class k {
|
|
|
1280
1280
|
y: n
|
|
1281
1281
|
};
|
|
1282
1282
|
let l = { x: -c.x, y: -c.y }, u;
|
|
1283
|
-
e.category ===
|
|
1284
|
-
const
|
|
1283
|
+
e.category === D.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === D.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
|
|
1284
|
+
const w = u(
|
|
1285
1285
|
d,
|
|
1286
1286
|
c,
|
|
1287
1287
|
g,
|
|
1288
1288
|
a,
|
|
1289
1289
|
h
|
|
1290
1290
|
);
|
|
1291
|
-
this.line.setAttribute("d",
|
|
1292
|
-
let
|
|
1293
|
-
this.sourceArrow && (
|
|
1291
|
+
this.line.setAttribute("d", w.path);
|
|
1292
|
+
let p = null;
|
|
1293
|
+
this.sourceArrow && (p = this.arrowRenderer({
|
|
1294
1294
|
direction: d,
|
|
1295
|
-
shift:
|
|
1295
|
+
shift: y,
|
|
1296
1296
|
arrowLength: this.params.arrowLength
|
|
1297
|
-
}), this.sourceArrow.setAttribute("d",
|
|
1297
|
+
}), this.sourceArrow.setAttribute("d", p));
|
|
1298
1298
|
let v = null;
|
|
1299
1299
|
this.targetArrow && (v = this.arrowRenderer({
|
|
1300
1300
|
direction: l,
|
|
1301
1301
|
shift: g,
|
|
1302
1302
|
arrowLength: this.params.arrowLength
|
|
1303
1303
|
}), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
|
|
1304
|
-
edgePath:
|
|
1305
|
-
sourceArrowPath:
|
|
1304
|
+
edgePath: w,
|
|
1305
|
+
sourceArrowPath: p,
|
|
1306
1306
|
targetArrowPath: v
|
|
1307
1307
|
});
|
|
1308
1308
|
}
|
|
1309
1309
|
}
|
|
1310
1310
|
const vt = (r) => (e) => {
|
|
1311
1311
|
const s = [
|
|
1312
|
-
|
|
1312
|
+
y,
|
|
1313
1313
|
{ x: e.arrowLength, y: r.radius },
|
|
1314
1314
|
{ x: e.arrowLength, y: -r.radius }
|
|
1315
1315
|
].map(
|
|
1316
|
-
(h) => m(h, e.direction,
|
|
1316
|
+
(h) => m(h, e.direction, y)
|
|
1317
1317
|
).map((h) => ({
|
|
1318
1318
|
x: h.x + e.shift.x,
|
|
1319
1319
|
y: h.y + e.shift.y
|
|
1320
1320
|
})), o = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
|
|
1321
1321
|
return `${o} ${n} ${a} Z`;
|
|
1322
1322
|
}, At = (r) => (e) => {
|
|
1323
|
-
const t = r.radius, s = e.arrowLength, o = (s * s + 2 * s * t) / (2 * t), n = o + t, a = s + t - t * (s + t) / n, h = t * o / n, c = [
|
|
1324
|
-
(
|
|
1325
|
-
).map((
|
|
1326
|
-
x:
|
|
1327
|
-
y:
|
|
1328
|
-
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${o} ${o} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`,
|
|
1329
|
-
return `${g} ${l} ${u} ${
|
|
1323
|
+
const t = r.radius, s = e.arrowLength, o = (s * s + 2 * s * t) / (2 * t), n = o + t, a = s + t - t * (s + t) / n, h = t * o / n, c = [y, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1324
|
+
(p) => m(p, e.direction, y)
|
|
1325
|
+
).map((p) => ({
|
|
1326
|
+
x: p.x + e.shift.x,
|
|
1327
|
+
y: p.y + e.shift.y
|
|
1328
|
+
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${o} ${o} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${o} ${o} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1329
|
+
return `${g} ${l} ${u} ${w}`;
|
|
1330
1330
|
}, xt = (r) => (e) => {
|
|
1331
1331
|
const t = r.smallRadius, s = r.radius, o = m(
|
|
1332
1332
|
{
|
|
@@ -1341,8 +1341,8 @@ const vt = (r) => (e) => {
|
|
|
1341
1341
|
x: e.arrowLength + r.smallRadius,
|
|
1342
1342
|
y: 0
|
|
1343
1343
|
}
|
|
1344
|
-
), a = [
|
|
1345
|
-
(l) => m(l, e.direction,
|
|
1344
|
+
), a = [y, { x: o.x, y: -o.y }, o].map(
|
|
1345
|
+
(l) => m(l, e.direction, y)
|
|
1346
1346
|
).map((l) => ({
|
|
1347
1347
|
x: l.x + e.shift.x,
|
|
1348
1348
|
y: l.y + e.shift.y
|
|
@@ -1648,7 +1648,7 @@ class Pt {
|
|
|
1648
1648
|
class Ve {
|
|
1649
1649
|
constructor(e) {
|
|
1650
1650
|
i(this, "svg");
|
|
1651
|
-
i(this, "group",
|
|
1651
|
+
i(this, "group", Re());
|
|
1652
1652
|
i(this, "line");
|
|
1653
1653
|
i(this, "sourceArrow", null);
|
|
1654
1654
|
i(this, "targetArrow", null);
|
|
@@ -1660,7 +1660,7 @@ class Ve {
|
|
|
1660
1660
|
i(this, "onAfterRender");
|
|
1661
1661
|
i(this, "afterRenderEmitter");
|
|
1662
1662
|
i(this, "arrowRenderer");
|
|
1663
|
-
[this.afterRenderEmitter, this.onAfterRender] = S(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = I((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg = Me(this.color), this.svg.appendChild(this.group), this.line =
|
|
1663
|
+
[this.afterRenderEmitter, this.onAfterRender] = S(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = I((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg = Me(this.color), this.svg.appendChild(this.group), this.line = De(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = W(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = W(), this.group.appendChild(this.targetArrow));
|
|
1664
1664
|
}
|
|
1665
1665
|
render(e) {
|
|
1666
1666
|
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Te(
|
|
@@ -1682,31 +1682,31 @@ class Ve {
|
|
|
1682
1682
|
if (u === 0)
|
|
1683
1683
|
this.sourceArrow !== null && (g = "", this.sourceArrow.setAttribute("d", g)), this.targetArrow !== null && (l = "", this.targetArrow.setAttribute("d", l));
|
|
1684
1684
|
else {
|
|
1685
|
-
const
|
|
1685
|
+
const w = {
|
|
1686
1686
|
x: d.x / u,
|
|
1687
1687
|
y: d.y / u
|
|
1688
1688
|
};
|
|
1689
1689
|
if (this.sourceArrow) {
|
|
1690
|
-
const
|
|
1691
|
-
x:
|
|
1692
|
-
y:
|
|
1690
|
+
const p = {
|
|
1691
|
+
x: w.x * this.sourceOffset,
|
|
1692
|
+
y: w.y * this.sourceOffset
|
|
1693
1693
|
};
|
|
1694
1694
|
g = this.arrowRenderer({
|
|
1695
|
-
direction:
|
|
1696
|
-
shift:
|
|
1695
|
+
direction: w,
|
|
1696
|
+
shift: p,
|
|
1697
1697
|
arrowLength: this.arrowLength
|
|
1698
1698
|
}), this.sourceArrow.setAttribute("d", g);
|
|
1699
1699
|
}
|
|
1700
1700
|
if (this.targetArrow) {
|
|
1701
|
-
const
|
|
1702
|
-
x:
|
|
1703
|
-
y:
|
|
1701
|
+
const p = {
|
|
1702
|
+
x: w.x * this.targetOffset,
|
|
1703
|
+
y: w.y * this.targetOffset
|
|
1704
1704
|
};
|
|
1705
1705
|
l = this.arrowRenderer({
|
|
1706
|
-
direction: { x: -
|
|
1706
|
+
direction: { x: -w.x, y: -w.y },
|
|
1707
1707
|
shift: {
|
|
1708
|
-
x: d.x -
|
|
1709
|
-
y: d.y -
|
|
1708
|
+
x: d.x - p.x,
|
|
1709
|
+
y: d.y - p.y
|
|
1710
1710
|
},
|
|
1711
1711
|
arrowLength: this.arrowLength
|
|
1712
1712
|
}), this.targetArrow.setAttribute("d", l);
|
|
@@ -2024,7 +2024,7 @@ const Mt = (r) => {
|
|
|
2024
2024
|
setTimeout(() => {
|
|
2025
2025
|
r();
|
|
2026
2026
|
});
|
|
2027
|
-
},
|
|
2027
|
+
}, Dt = (r) => {
|
|
2028
2028
|
queueMicrotask(() => {
|
|
2029
2029
|
r();
|
|
2030
2030
|
});
|
|
@@ -2054,7 +2054,7 @@ class $e {
|
|
|
2054
2054
|
return this.viewportStore.createViewportCoords(e);
|
|
2055
2055
|
}
|
|
2056
2056
|
}
|
|
2057
|
-
const
|
|
2057
|
+
const Rt = (r, e) => Symbol.iterator in r ? {
|
|
2058
2058
|
minContentScale: e.focus.minContentScale,
|
|
2059
2059
|
nodes: r,
|
|
2060
2060
|
contentOffset: e.focus.contentOffset
|
|
@@ -2097,7 +2097,7 @@ class We {
|
|
|
2097
2097
|
this.viewportStore.patchViewportMatrix(g);
|
|
2098
2098
|
}
|
|
2099
2099
|
focus(e) {
|
|
2100
|
-
const t =
|
|
2100
|
+
const t = Rt(e ?? {}, this.params);
|
|
2101
2101
|
this.params.focus.schedule(() => {
|
|
2102
2102
|
this.navigate(t);
|
|
2103
2103
|
});
|
|
@@ -2118,9 +2118,9 @@ class We {
|
|
|
2118
2118
|
const d = {
|
|
2119
2119
|
x: (t + s) / 2,
|
|
2120
2120
|
y: (o + n) / 2
|
|
2121
|
-
}, c = (s - t) / 2, g = (n - o) / 2, { width: l, height: u } = this.viewportStore.getDimensions(),
|
|
2122
|
-
c /
|
|
2123
|
-
g /
|
|
2121
|
+
}, c = (s - t) / 2, g = (n - o) / 2, { width: l, height: u } = this.viewportStore.getDimensions(), w = l / 2, p = u / 2, v = Math.max(
|
|
2122
|
+
c / w,
|
|
2123
|
+
g / p
|
|
2124
2124
|
), { scale: x } = this.viewportStore.getContentMatrix(), b = v > 1 ? x / v : x, P = Math.max(b, e.minContentScale);
|
|
2125
2125
|
this.center(d, { contentScale: P });
|
|
2126
2126
|
}
|
|
@@ -2181,7 +2181,7 @@ class H {
|
|
|
2181
2181
|
}));
|
|
2182
2182
|
});
|
|
2183
2183
|
i(this, "onWindowMouseMove", (e) => {
|
|
2184
|
-
if (!
|
|
2184
|
+
if (!R(
|
|
2185
2185
|
this.window,
|
|
2186
2186
|
this.element,
|
|
2187
2187
|
e.clientX,
|
|
@@ -2213,7 +2213,7 @@ class H {
|
|
|
2213
2213
|
});
|
|
2214
2214
|
i(this, "onWindowTouchMove", (e) => {
|
|
2215
2215
|
const t = e.touches[0];
|
|
2216
|
-
if (!
|
|
2216
|
+
if (!R(
|
|
2217
2217
|
this.window,
|
|
2218
2218
|
this.element,
|
|
2219
2219
|
t.clientX,
|
|
@@ -2367,7 +2367,7 @@ class ee {
|
|
|
2367
2367
|
});
|
|
2368
2368
|
});
|
|
2369
2369
|
i(this, "onWindowMouseMove", (e) => {
|
|
2370
|
-
if (!
|
|
2370
|
+
if (!R(
|
|
2371
2371
|
this.window,
|
|
2372
2372
|
this.element,
|
|
2373
2373
|
e.clientX,
|
|
@@ -2388,7 +2388,7 @@ class ee {
|
|
|
2388
2388
|
if (e.touches.length !== 1)
|
|
2389
2389
|
return;
|
|
2390
2390
|
const t = e.touches[0];
|
|
2391
|
-
if (!
|
|
2391
|
+
if (!R(
|
|
2392
2392
|
this.window,
|
|
2393
2393
|
this.element,
|
|
2394
2394
|
t.clientX,
|
|
@@ -2522,7 +2522,7 @@ class Y {
|
|
|
2522
2522
|
}), this.startRegisteredTransform());
|
|
2523
2523
|
});
|
|
2524
2524
|
i(this, "onWindowMouseMove", (e) => {
|
|
2525
|
-
const t =
|
|
2525
|
+
const t = R(
|
|
2526
2526
|
this.window,
|
|
2527
2527
|
this.element,
|
|
2528
2528
|
e.clientX,
|
|
@@ -2562,7 +2562,7 @@ class Y {
|
|
|
2562
2562
|
i(this, "onWindowTouchMove", (e) => {
|
|
2563
2563
|
const t = B(e);
|
|
2564
2564
|
if (!t.touches.every(
|
|
2565
|
-
(o) =>
|
|
2565
|
+
(o) => R(this.window, this.element, o[0], o[1])
|
|
2566
2566
|
)) {
|
|
2567
2567
|
this.stopTouchDrag();
|
|
2568
2568
|
return;
|
|
@@ -2844,10 +2844,10 @@ class se {
|
|
|
2844
2844
|
portDirection: this.params.dragPortDirection
|
|
2845
2845
|
};
|
|
2846
2846
|
this.isTargetDragging = s === "direct";
|
|
2847
|
-
const [
|
|
2848
|
-
this.overlayCanvas.addNode(O(
|
|
2849
|
-
from:
|
|
2850
|
-
to:
|
|
2847
|
+
const [w, p] = this.isTargetDragging ? [l, u] : [u, l];
|
|
2848
|
+
this.overlayCanvas.addNode(O(w)), this.overlayCanvas.addNode(O(p)), this.overlayCanvas.addEdge({
|
|
2849
|
+
from: w.overlayNodeId,
|
|
2850
|
+
to: p.overlayNodeId,
|
|
2851
2851
|
shape: this.params.edgeShapeFactory(N.EdgeId)
|
|
2852
2852
|
});
|
|
2853
2853
|
}
|
|
@@ -2927,10 +2927,10 @@ class oe {
|
|
|
2927
2927
|
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
|
|
2928
2928
|
x: g.x + g.width / 2,
|
|
2929
2929
|
y: g.y + g.height / 2
|
|
2930
|
-
}, u = this.overlayLayer.getBoundingClientRect(),
|
|
2930
|
+
}, u = this.overlayLayer.getBoundingClientRect(), w = this.canvas.viewport.createContentCoords({
|
|
2931
2931
|
x: l.x - u.x,
|
|
2932
2932
|
y: l.y - u.y
|
|
2933
|
-
}),
|
|
2933
|
+
}), p = this.canvas.viewport.createContentCoords({
|
|
2934
2934
|
x: t.x - u.x,
|
|
2935
2935
|
y: t.y - u.y
|
|
2936
2936
|
});
|
|
@@ -2943,11 +2943,11 @@ class oe {
|
|
|
2943
2943
|
}, this.canvas.removeEdge(s);
|
|
2944
2944
|
const v = {
|
|
2945
2945
|
overlayNodeId: N.StaticNodeId,
|
|
2946
|
-
portCoords:
|
|
2946
|
+
portCoords: w,
|
|
2947
2947
|
portDirection: c.direction
|
|
2948
2948
|
}, x = {
|
|
2949
2949
|
overlayNodeId: N.DraggingNodeId,
|
|
2950
|
-
portCoords:
|
|
2950
|
+
portCoords: p,
|
|
2951
2951
|
portDirection: d.direction
|
|
2952
2952
|
}, [b, P] = this.isTargetDragging ? [v, x] : [x, v];
|
|
2953
2953
|
this.overlayCanvas.addNode(O(b)), this.overlayCanvas.addNode(O(P));
|
|
@@ -3124,9 +3124,9 @@ class Wt {
|
|
|
3124
3124
|
}
|
|
3125
3125
|
}
|
|
3126
3126
|
const zt = (r) => {
|
|
3127
|
-
var
|
|
3128
|
-
const e = ((
|
|
3129
|
-
}), t = ((
|
|
3127
|
+
var w, p, v, x, b, P;
|
|
3128
|
+
const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
|
|
3129
|
+
}), t = ((p = r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
|
|
3130
3130
|
}), s = r.nodeDragVerifier ?? (() => !0), o = ((v = r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
|
|
3131
3131
|
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (x = r.mouse) == null ? void 0 : x.dragCursor, d = h !== void 0 ? h : "grab", c = (b = r.mouse) == null ? void 0 : b.mouseDownEventVerifier, g = c !== void 0 ? c : (C) => C.button === 0, l = (P = r.mouse) == null ? void 0 : P.mouseUpEventVerifier, u = l !== void 0 ? l : (C) => C.button === 0;
|
|
3132
3132
|
return {
|
|
@@ -3198,8 +3198,8 @@ const zt = (r) => {
|
|
|
3198
3198
|
});
|
|
3199
3199
|
}
|
|
3200
3200
|
}, Ae = (r) => {
|
|
3201
|
-
var
|
|
3202
|
-
const e = (
|
|
3201
|
+
var p, v, x, b, P, C, L, V, de, ce, le, ge;
|
|
3202
|
+
const e = (p = r == null ? void 0 : r.scale) == null ? void 0 : p.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
3203
3203
|
let o;
|
|
3204
3204
|
s !== void 0 ? Array.isArray(s) ? o = Yt(
|
|
3205
3205
|
s.map(
|
|
@@ -3208,7 +3208,7 @@ const zt = (r) => {
|
|
|
3208
3208
|
) : o = ve(s) : o = (T) => T.nextTransform;
|
|
3209
3209
|
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onBeforeTransformChange) ?? (() => {
|
|
3210
3210
|
}), h = ((b = r == null ? void 0 : r.events) == null ? void 0 : b.onTransformChange) ?? (() => {
|
|
3211
|
-
}), d = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseDownEventVerifier, c = d !== void 0 ? d : (T) => T.button === 0, g = (C = r == null ? void 0 : r.shift) == null ? void 0 : C.mouseUpEventVerifier, l = g !== void 0 ? g : (T) => T.button === 0, u = (L = r == null ? void 0 : r.scale) == null ? void 0 : L.mouseWheelEventVerifier,
|
|
3211
|
+
}), d = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseDownEventVerifier, c = d !== void 0 ? d : (T) => T.button === 0, g = (C = r == null ? void 0 : r.shift) == null ? void 0 : C.mouseUpEventVerifier, l = g !== void 0 ? g : (T) => T.button === 0, u = (L = r == null ? void 0 : r.scale) == null ? void 0 : L.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
|
|
3212
3212
|
return {
|
|
3213
3213
|
wheelSensitivity: t,
|
|
3214
3214
|
onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
|
|
@@ -3221,7 +3221,7 @@ const zt = (r) => {
|
|
|
3221
3221
|
shiftCursor: n,
|
|
3222
3222
|
mouseDownEventVerifier: c,
|
|
3223
3223
|
mouseUpEventVerifier: l,
|
|
3224
|
-
mouseWheelEventVerifier:
|
|
3224
|
+
mouseWheelEventVerifier: w,
|
|
3225
3225
|
scaleWheelFinishTimeout: ((ce = r == null ? void 0 : r.scale) == null ? void 0 : ce.wheelFinishTimeout) ?? 500,
|
|
3226
3226
|
onResizeTransformStarted: ((le = r == null ? void 0 : r.events) == null ? void 0 : le.onResizeTransformStarted) ?? (() => {
|
|
3227
3227
|
}),
|
|
@@ -3335,8 +3335,8 @@ const zt = (r) => {
|
|
|
3335
3335
|
}, Kt = (r, e) => {
|
|
3336
3336
|
var c, g, l;
|
|
3337
3337
|
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
|
|
3338
|
-
const
|
|
3339
|
-
return
|
|
3338
|
+
const w = e.getPortAdjacentEdgeIds(u);
|
|
3339
|
+
return w.length > 0 ? w[w.length - 1] : null;
|
|
3340
3340
|
}, a = () => {
|
|
3341
3341
|
}, h = () => {
|
|
3342
3342
|
}, d = () => {
|
|
@@ -3402,8 +3402,8 @@ class ke {
|
|
|
3402
3402
|
const s = this.graph.getEdge(t), o = this.graph.getPort(s.from), n = this.graph.getPort(s.to), a = this.currentCoords.get(o.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
|
|
3403
3403
|
a,
|
|
3404
3404
|
h
|
|
3405
|
-
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g,
|
|
3406
|
-
|
|
3405
|
+
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, w = e.get(o.nodeId), p = e.get(n.nodeId);
|
|
3406
|
+
w.x += l, w.y += u, p.x -= l, p.y -= u;
|
|
3407
3407
|
});
|
|
3408
3408
|
}
|
|
3409
3409
|
}
|
|
@@ -3453,8 +3453,8 @@ class _t {
|
|
|
3453
3453
|
targetCharge: this.nodeCharge,
|
|
3454
3454
|
distance: l.d,
|
|
3455
3455
|
maxForce: this.maxForce
|
|
3456
|
-
}),
|
|
3457
|
-
v.x -=
|
|
3456
|
+
}), w = u * l.ex, p = u * l.ey, v = t.get(a), x = t.get(d);
|
|
3457
|
+
v.x -= w, v.y -= p, x.x += w, x.y += p;
|
|
3458
3458
|
}
|
|
3459
3459
|
}
|
|
3460
3460
|
}
|
|
@@ -3532,8 +3532,8 @@ class tr {
|
|
|
3532
3532
|
this.sortedParentNodes.push(e);
|
|
3533
3533
|
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = o / 2;
|
|
3534
3534
|
e.nodeIds.forEach((u) => {
|
|
3535
|
-
const { x:
|
|
3536
|
-
|
|
3535
|
+
const { x: w, y: p } = this.coords.get(u);
|
|
3536
|
+
w < t ? p < s ? d.add(u) : h.add(u) : p < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
|
|
3537
3537
|
});
|
|
3538
3538
|
const g = {
|
|
3539
3539
|
parent: e,
|
|
@@ -3817,16 +3817,16 @@ class Ge {
|
|
|
3817
3817
|
this.rand = e.rand, this.sparsity = e.sparsity;
|
|
3818
3818
|
}
|
|
3819
3819
|
calculateCoordinates(e) {
|
|
3820
|
-
const { graph: t, viewport: s } = e, o = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((
|
|
3821
|
-
const v = t.getNode(
|
|
3820
|
+
const { graph: t, viewport: s } = e, o = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((p) => {
|
|
3821
|
+
const v = t.getNode(p);
|
|
3822
3822
|
return v.x === null || v.y === null;
|
|
3823
3823
|
}), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = s.getDimensions(), c = { x: h / 2, y: d / 2 }, g = s.createContentCoords(c), l = a / 2, u = {
|
|
3824
3824
|
x: g.x - l,
|
|
3825
3825
|
y: g.y - l
|
|
3826
3826
|
};
|
|
3827
|
-
return t.getAllNodeIds().forEach((
|
|
3828
|
-
const v = t.getNode(
|
|
3829
|
-
o.set(
|
|
3827
|
+
return t.getAllNodeIds().forEach((p) => {
|
|
3828
|
+
const v = t.getNode(p);
|
|
3829
|
+
o.set(p, {
|
|
3830
3830
|
x: v.x ?? u.x + a * this.rand(),
|
|
3831
3831
|
y: v.y ?? u.y + a * this.rand()
|
|
3832
3832
|
});
|
|
@@ -3923,52 +3923,62 @@ class or {
|
|
|
3923
3923
|
}
|
|
3924
3924
|
class ir {
|
|
3925
3925
|
constructor(e) {
|
|
3926
|
-
|
|
3927
|
-
this.baseRadius = e.radius;
|
|
3926
|
+
this.params = e;
|
|
3928
3927
|
}
|
|
3929
|
-
|
|
3930
|
-
let t = 0
|
|
3931
|
-
const o = [];
|
|
3932
|
-
e.forEach((h) => {
|
|
3933
|
-
|
|
3928
|
+
generate(e) {
|
|
3929
|
+
let t = 0;
|
|
3930
|
+
const s = [], o = e.length - 1, n = [];
|
|
3931
|
+
e.forEach((h, d) => {
|
|
3932
|
+
if (t += this.params.spaceAroundRadius, h.forEach((c, g) => {
|
|
3933
|
+
n[g] === void 0 ? n[g] = {
|
|
3934
|
+
start: t + c.start,
|
|
3935
|
+
end: t + c.end
|
|
3936
|
+
} : n[g].end = t + c.end;
|
|
3937
|
+
}), s.push(t), t += this.params.spaceAroundRadius, d !== o) {
|
|
3938
|
+
const c = e[d + 1];
|
|
3939
|
+
t += this.calculateMaxDiff(h, c);
|
|
3940
|
+
}
|
|
3934
3941
|
});
|
|
3935
|
-
const
|
|
3936
|
-
let a = 0;
|
|
3937
|
-
if (e.length > 0) {
|
|
3938
|
-
const h = e[e.length - 1] ?? 0, d = o[o.length - 1];
|
|
3939
|
-
a = Math.max(
|
|
3940
|
-
a,
|
|
3941
|
-
d + h - t
|
|
3942
|
-
);
|
|
3943
|
-
const c = e[0] ?? 0, g = o[0];
|
|
3944
|
-
a = Math.max(a, c - g);
|
|
3945
|
-
}
|
|
3942
|
+
const a = t / 2;
|
|
3946
3943
|
return {
|
|
3947
|
-
|
|
3948
|
-
|
|
3944
|
+
childOffsets: s.map((h) => h - a),
|
|
3945
|
+
subtreeSpans: n.map((h) => ({
|
|
3946
|
+
start: h.start - a,
|
|
3947
|
+
end: h.end - a
|
|
3948
|
+
}))
|
|
3949
3949
|
};
|
|
3950
3950
|
}
|
|
3951
|
+
calculateMaxDiff(e, t) {
|
|
3952
|
+
let s = 0;
|
|
3953
|
+
const o = Math.min(e.length, t.length);
|
|
3954
|
+
for (let n = 0; n < o; n++) {
|
|
3955
|
+
const a = e[n].end - t[n].start;
|
|
3956
|
+
s = Math.max(s, a);
|
|
3957
|
+
}
|
|
3958
|
+
return s - 2 * this.params.spaceAroundRadius;
|
|
3959
|
+
}
|
|
3951
3960
|
}
|
|
3952
3961
|
class nr {
|
|
3953
3962
|
constructor(e, t) {
|
|
3954
3963
|
i(this, "offsets", /* @__PURE__ */ new Map());
|
|
3955
|
-
i(this, "
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
})
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
this.
|
|
3967
|
-
|
|
3968
|
-
s
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3964
|
+
i(this, "treeSpans", /* @__PURE__ */ new Map());
|
|
3965
|
+
this.tree = e;
|
|
3966
|
+
const s = t.spaceAroundRadius, o = new ir({
|
|
3967
|
+
spaceAroundRadius: s
|
|
3968
|
+
});
|
|
3969
|
+
[...this.tree.sequence].reverse().forEach((n) => {
|
|
3970
|
+
const a = Array.from(n.children).map(
|
|
3971
|
+
(c) => this.treeSpans.get(c.nodeId)
|
|
3972
|
+
), h = o.generate(a);
|
|
3973
|
+
let d = 0;
|
|
3974
|
+
n.children.forEach((c) => {
|
|
3975
|
+
this.offsets.set(c.nodeId, h.childOffsets[d]), d++;
|
|
3976
|
+
}), this.treeSpans.set(n.nodeId, [
|
|
3977
|
+
{ start: -s, end: s },
|
|
3978
|
+
...h.subtreeSpans
|
|
3979
|
+
]), n.children.forEach((c) => {
|
|
3980
|
+
this.treeSpans.delete(c.nodeId);
|
|
3981
|
+
});
|
|
3972
3982
|
}), this.offsets.set(this.tree.root.nodeId, 0);
|
|
3973
3983
|
}
|
|
3974
3984
|
generate() {
|
|
@@ -3992,17 +4002,16 @@ class ar {
|
|
|
3992
4002
|
const g = [];
|
|
3993
4003
|
n += this.params.layerWidth, c.forEach((l) => {
|
|
3994
4004
|
l.children.forEach((u) => {
|
|
3995
|
-
const
|
|
4005
|
+
const w = t.get(l.nodeId).y;
|
|
3996
4006
|
t.set(u.nodeId, {
|
|
3997
|
-
y:
|
|
4007
|
+
y: w + d.get(u.nodeId),
|
|
3998
4008
|
x: n
|
|
3999
4009
|
}), g.push(u);
|
|
4000
4010
|
});
|
|
4001
4011
|
}), c = g;
|
|
4002
4012
|
}
|
|
4003
|
-
}), t.forEach((a) => {
|
|
4004
|
-
|
|
4005
|
-
a.x = h.x, a.y = h.y;
|
|
4013
|
+
}), t.forEach((a, h) => {
|
|
4014
|
+
t.set(h, this.params.transform(a));
|
|
4006
4015
|
}), t;
|
|
4007
4016
|
}
|
|
4008
4017
|
}
|
|
@@ -4118,7 +4127,7 @@ const je = (r) => {
|
|
|
4118
4127
|
schedule: Mt
|
|
4119
4128
|
} : {
|
|
4120
4129
|
type: "topologyChangeSchedule",
|
|
4121
|
-
schedule:
|
|
4130
|
+
schedule: Dt
|
|
4122
4131
|
}, F = Object.freeze({
|
|
4123
4132
|
staticNodeResolver: () => !1,
|
|
4124
4133
|
onBeforeApplied: () => {
|
|
@@ -4379,13 +4388,9 @@ class Nr {
|
|
|
4379
4388
|
i(this, "hasAnimatedLayout", !1);
|
|
4380
4389
|
i(this, "hasLayout", !1);
|
|
4381
4390
|
i(this, "boxRenderingTrigger", new K());
|
|
4382
|
-
i(this, "graphStore");
|
|
4383
|
-
i(this, "viewportStore");
|
|
4384
|
-
i(this, "graph");
|
|
4385
|
-
i(this, "viewport");
|
|
4386
4391
|
i(this, "window", window);
|
|
4387
4392
|
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
4388
|
-
this.element = e
|
|
4393
|
+
this.element = e;
|
|
4389
4394
|
}
|
|
4390
4395
|
setDefaults(e) {
|
|
4391
4396
|
return this.canvasDefaults = e, this;
|
|
@@ -4421,110 +4426,110 @@ class Nr {
|
|
|
4421
4426
|
if (this.used)
|
|
4422
4427
|
throw new Jt("CanvasBuilder is a single use object");
|
|
4423
4428
|
this.used = !0;
|
|
4424
|
-
const e = new
|
|
4429
|
+
const e = new it(this.element), t = new be(), s = new Wt(this.element), o = this.createHtmlView(
|
|
4430
|
+
s.main,
|
|
4431
|
+
t,
|
|
4432
|
+
e
|
|
4433
|
+
), n = Er(
|
|
4425
4434
|
this.canvasDefaults
|
|
4426
|
-
),
|
|
4427
|
-
this.graphStore,
|
|
4435
|
+
), a = new Be(
|
|
4428
4436
|
t,
|
|
4429
|
-
|
|
4430
|
-
|
|
4437
|
+
o,
|
|
4438
|
+
n
|
|
4439
|
+
), h = yr(this.layoutConfig), d = br({
|
|
4431
4440
|
canvasDefaults: this.canvasDefaults,
|
|
4432
4441
|
hasLayout: this.hasLayout,
|
|
4433
|
-
layoutParams:
|
|
4434
|
-
}),
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
),
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4442
|
+
layoutParams: h
|
|
4443
|
+
}), c = new We(
|
|
4444
|
+
t,
|
|
4445
|
+
e,
|
|
4446
|
+
d
|
|
4447
|
+
), g = new $e(e), l = new Ie(t), u = new Se(
|
|
4448
|
+
l,
|
|
4449
|
+
g,
|
|
4450
|
+
a,
|
|
4451
|
+
c
|
|
4443
4452
|
);
|
|
4444
4453
|
if (this.hasBackground && re.configure(
|
|
4445
|
-
|
|
4454
|
+
u,
|
|
4446
4455
|
jt(this.backgroundConfig),
|
|
4447
|
-
|
|
4448
|
-
), this.hasNodeResizeReactiveEdges && Q.configure(
|
|
4449
|
-
let
|
|
4450
|
-
this.hasAnimatedLayout && (
|
|
4451
|
-
|
|
4456
|
+
s.background
|
|
4457
|
+
), this.hasNodeResizeReactiveEdges && Q.configure(u), this.hasDraggableNodes) {
|
|
4458
|
+
let p = zt(this.dragConfig);
|
|
4459
|
+
this.hasAnimatedLayout && (p = fr(
|
|
4460
|
+
p,
|
|
4452
4461
|
this.animationStaticNodes
|
|
4453
4462
|
)), ee.configure(
|
|
4454
|
-
|
|
4455
|
-
|
|
4463
|
+
u,
|
|
4464
|
+
s.main,
|
|
4456
4465
|
this.window,
|
|
4457
|
-
|
|
4466
|
+
p
|
|
4458
4467
|
);
|
|
4459
4468
|
}
|
|
4460
4469
|
if (this.hasUserConnectablePorts) {
|
|
4461
|
-
const
|
|
4470
|
+
const p = qt(
|
|
4462
4471
|
this.connectablePortsConfig,
|
|
4463
|
-
|
|
4464
|
-
|
|
4472
|
+
n.edges.shapeFactory,
|
|
4473
|
+
n.ports.direction
|
|
4465
4474
|
);
|
|
4466
4475
|
se.configure(
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4476
|
+
u,
|
|
4477
|
+
s.overlayConnectablePorts,
|
|
4478
|
+
e,
|
|
4470
4479
|
this.window,
|
|
4471
|
-
|
|
4480
|
+
p
|
|
4472
4481
|
);
|
|
4473
4482
|
}
|
|
4474
4483
|
if (this.hasUserDraggableEdges) {
|
|
4475
|
-
const
|
|
4484
|
+
const p = Kt(
|
|
4476
4485
|
this.draggableEdgesConfig,
|
|
4477
|
-
|
|
4486
|
+
u.graph
|
|
4478
4487
|
);
|
|
4479
4488
|
oe.configure(
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4489
|
+
u,
|
|
4490
|
+
s.overlayDraggableEdges,
|
|
4491
|
+
e,
|
|
4483
4492
|
this.window,
|
|
4484
|
-
|
|
4493
|
+
p
|
|
4485
4494
|
);
|
|
4486
4495
|
}
|
|
4487
4496
|
if (this.virtualScrollConfig !== void 0 ? te.configure(
|
|
4488
|
-
|
|
4489
|
-
|
|
4497
|
+
u,
|
|
4498
|
+
s.main,
|
|
4490
4499
|
this.window,
|
|
4491
4500
|
Ae(this.transformConfig),
|
|
4492
4501
|
this.boxRenderingTrigger,
|
|
4493
4502
|
Qt(this.virtualScrollConfig)
|
|
4494
4503
|
) : this.hasTransformableViewport && Y.configure(
|
|
4495
|
-
|
|
4496
|
-
|
|
4504
|
+
u,
|
|
4505
|
+
s.main,
|
|
4497
4506
|
this.window,
|
|
4498
4507
|
Ae(this.transformConfig)
|
|
4499
|
-
), this.hasLayout && $t.configure(
|
|
4500
|
-
let
|
|
4508
|
+
), this.hasLayout && $t.configure(u, h), this.hasAnimatedLayout) {
|
|
4509
|
+
let p = cr(
|
|
4501
4510
|
this.animatedLayoutConfig
|
|
4502
4511
|
);
|
|
4503
4512
|
this.hasDraggableNodes && (mr(
|
|
4504
|
-
|
|
4513
|
+
u,
|
|
4505
4514
|
this.animationStaticNodes
|
|
4506
|
-
),
|
|
4507
|
-
|
|
4515
|
+
), p = vr(
|
|
4516
|
+
p,
|
|
4508
4517
|
this.animationStaticNodes
|
|
4509
|
-
)), ae.configure(
|
|
4518
|
+
)), ae.configure(u, p, this.window);
|
|
4510
4519
|
}
|
|
4511
|
-
const
|
|
4512
|
-
|
|
4520
|
+
const w = () => {
|
|
4521
|
+
s.destroy(), u.onBeforeDestroy.unsubscribe(w);
|
|
4513
4522
|
};
|
|
4514
|
-
return
|
|
4523
|
+
return u.onBeforeDestroy.subscribe(w), u;
|
|
4515
4524
|
}
|
|
4516
|
-
createHtmlView(e) {
|
|
4517
|
-
let
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
e
|
|
4521
|
-
);
|
|
4522
|
-
return this.virtualScrollConfig !== void 0 && (t = new rt(
|
|
4525
|
+
createHtmlView(e, t, s) {
|
|
4526
|
+
let o = new Ee(t, s, e);
|
|
4527
|
+
return this.virtualScrollConfig !== void 0 && (o = new rt(
|
|
4528
|
+
o,
|
|
4523
4529
|
t,
|
|
4524
|
-
this.graphStore,
|
|
4525
4530
|
this.boxRenderingTrigger,
|
|
4526
4531
|
Zt(this.virtualScrollConfig)
|
|
4527
|
-
)),
|
|
4532
|
+
)), o = new st(o, t), o;
|
|
4528
4533
|
}
|
|
4529
4534
|
}
|
|
4530
4535
|
export {
|
|
@@ -4532,7 +4537,7 @@ export {
|
|
|
4532
4537
|
Nr as CanvasBuilder,
|
|
4533
4538
|
Jt as CanvasBuilderError,
|
|
4534
4539
|
E as CanvasError,
|
|
4535
|
-
|
|
4540
|
+
D as ConnectionCategory,
|
|
4536
4541
|
Ve as DirectEdgeShape,
|
|
4537
4542
|
K as EventSubject,
|
|
4538
4543
|
St as HorizontalEdgeShape,
|