@html-graph/html-graph 8.3.0 → 8.4.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 +4 -0
- package/dist/html-graph.js +438 -305
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/html-graph.js
CHANGED
|
@@ -91,7 +91,7 @@ class Ae {
|
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
class
|
|
94
|
+
class qe {
|
|
95
95
|
constructor(e) {
|
|
96
96
|
o(this, "xFrom", 1 / 0);
|
|
97
97
|
o(this, "yFrom", 1 / 0);
|
|
@@ -111,7 +111,7 @@ class Ke {
|
|
|
111
111
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
class
|
|
114
|
+
class Ke {
|
|
115
115
|
constructor(e, t, s, i) {
|
|
116
116
|
o(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
117
117
|
o(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -135,7 +135,7 @@ class Qe {
|
|
|
135
135
|
this.handleAttachEdge(a);
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
|
-
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new
|
|
138
|
+
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new qe(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
139
139
|
}
|
|
140
140
|
attachNode(e) {
|
|
141
141
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -189,7 +189,7 @@ class Qe {
|
|
|
189
189
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
class
|
|
192
|
+
class Qe {
|
|
193
193
|
constructor(e, t) {
|
|
194
194
|
o(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
195
195
|
o(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
@@ -243,7 +243,7 @@ class Ze {
|
|
|
243
243
|
this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
class
|
|
246
|
+
class K {
|
|
247
247
|
constructor() {
|
|
248
248
|
o(this, "callbacks", /* @__PURE__ */ new Set());
|
|
249
249
|
}
|
|
@@ -260,10 +260,10 @@ class Q {
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
const x = () => {
|
|
263
|
-
const r = new
|
|
263
|
+
const r = new K();
|
|
264
264
|
return [r, r];
|
|
265
265
|
};
|
|
266
|
-
class
|
|
266
|
+
class Y {
|
|
267
267
|
constructor(e) {
|
|
268
268
|
o(this, "counter", 0);
|
|
269
269
|
this.checkExists = e;
|
|
@@ -281,13 +281,13 @@ class X {
|
|
|
281
281
|
}
|
|
282
282
|
class Ee {
|
|
283
283
|
constructor(e, t, s, i, n, a) {
|
|
284
|
-
o(this, "nodeIdGenerator", new
|
|
284
|
+
o(this, "nodeIdGenerator", new Y(
|
|
285
285
|
(e) => this.graphStore.hasNode(e)
|
|
286
286
|
));
|
|
287
|
-
o(this, "portIdGenerator", new
|
|
287
|
+
o(this, "portIdGenerator", new Y(
|
|
288
288
|
(e) => this.graphStore.hasPort(e)
|
|
289
289
|
));
|
|
290
|
-
o(this, "edgeIdGenerator", new
|
|
290
|
+
o(this, "edgeIdGenerator", new Y(
|
|
291
291
|
(e) => this.graphStore.hasEdge(e)
|
|
292
292
|
));
|
|
293
293
|
o(this, "onAfterNodeAdded", (e) => {
|
|
@@ -467,7 +467,7 @@ class Ee {
|
|
|
467
467
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.viewportStore.destroy(), this.destroyed = !0);
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
class
|
|
470
|
+
class Ze {
|
|
471
471
|
constructor() {
|
|
472
472
|
o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
473
473
|
o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -522,7 +522,7 @@ class xe {
|
|
|
522
522
|
o(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
523
523
|
o(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
|
|
524
524
|
o(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
525
|
-
o(this, "elementPorts", new
|
|
525
|
+
o(this, "elementPorts", new Ze());
|
|
526
526
|
o(this, "afterNodeAddedEmitter");
|
|
527
527
|
o(this, "onAfterNodeAdded");
|
|
528
528
|
o(this, "afterNodeUpdatedEmitter");
|
|
@@ -837,7 +837,7 @@ class Je {
|
|
|
837
837
|
this.observer.disconnect();
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
|
-
class
|
|
840
|
+
class Q {
|
|
841
841
|
constructor(e) {
|
|
842
842
|
o(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
843
843
|
o(this, "nodesResizeObserver");
|
|
@@ -860,7 +860,7 @@ class Z {
|
|
|
860
860
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
|
|
861
861
|
}
|
|
862
862
|
static configure(e) {
|
|
863
|
-
new
|
|
863
|
+
new Q(e);
|
|
864
864
|
}
|
|
865
865
|
handleNodeResize(e) {
|
|
866
866
|
const t = this.elementToNodeId.get(e);
|
|
@@ -870,9 +870,9 @@ class Z {
|
|
|
870
870
|
const _e = (r, e, t) => {
|
|
871
871
|
const { x: s, y: i, width: n, height: a } = r.getBoundingClientRect();
|
|
872
872
|
return e >= s && e <= s + n && t >= i && t <= i + a;
|
|
873
|
-
}, et = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight,
|
|
873
|
+
}, et = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, R = (r, e, t, s) => _e(e, t, s) && et(r, t, s), $ = (r, e) => {
|
|
874
874
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
875
|
-
},
|
|
875
|
+
}, U = (r) => {
|
|
876
876
|
const e = document.createElement("div");
|
|
877
877
|
return {
|
|
878
878
|
id: r.overlayNodeId,
|
|
@@ -932,7 +932,7 @@ var N = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "
|
|
|
932
932
|
const Pe = (r, e) => ({
|
|
933
933
|
x: r / 2,
|
|
934
934
|
y: e / 2
|
|
935
|
-
}),
|
|
935
|
+
}), w = {
|
|
936
936
|
x: 0,
|
|
937
937
|
y: 0
|
|
938
938
|
}, m = (r, e, t) => ({
|
|
@@ -954,7 +954,7 @@ const Pe = (r, e) => ({
|
|
|
954
954
|
flipX: d,
|
|
955
955
|
flipY: c
|
|
956
956
|
};
|
|
957
|
-
},
|
|
957
|
+
}, z = (r, e, t, s) => ({
|
|
958
958
|
x: e * r.x + (1 - e) / 2 * s.x,
|
|
959
959
|
y: t * r.y + (1 - t) / 2 * s.y
|
|
960
960
|
});
|
|
@@ -966,9 +966,9 @@ class rt {
|
|
|
966
966
|
const t = this.params.to;
|
|
967
967
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
968
968
|
const s = m(
|
|
969
|
-
{ x: this.params.arrowLength, y:
|
|
969
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
970
970
|
this.params.sourceDirection,
|
|
971
|
-
|
|
971
|
+
w
|
|
972
972
|
), i = m(
|
|
973
973
|
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
974
974
|
this.params.targetDirection,
|
|
@@ -979,7 +979,7 @@ class rt {
|
|
|
979
979
|
}, a = {
|
|
980
980
|
x: i.x - this.params.targetDirection.x * this.params.curvature,
|
|
981
981
|
y: i.y - this.params.targetDirection.y * this.params.curvature
|
|
982
|
-
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${
|
|
982
|
+
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${w.x} ${w.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${i.x} ${i.y} L ${this.params.to.x} ${this.params.to.y}`;
|
|
983
983
|
this.path = `${d}${h}${c}`;
|
|
984
984
|
}
|
|
985
985
|
}
|
|
@@ -989,10 +989,10 @@ class st {
|
|
|
989
989
|
o(this, "midpoint");
|
|
990
990
|
this.params = e;
|
|
991
991
|
const t = this.params.hasSourceArrow ? m(
|
|
992
|
-
{ x: this.params.arrowLength, y:
|
|
992
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
993
993
|
this.params.sourceDirection,
|
|
994
|
-
|
|
995
|
-
) :
|
|
994
|
+
w
|
|
995
|
+
) : w, s = this.params.hasTargetArrow ? m(
|
|
996
996
|
{
|
|
997
997
|
x: this.params.to.x - this.params.arrowLength,
|
|
998
998
|
y: this.params.to.y
|
|
@@ -1000,9 +1000,9 @@ class st {
|
|
|
1000
1000
|
this.params.targetDirection,
|
|
1001
1001
|
this.params.to
|
|
1002
1002
|
) : this.params.to, i = 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(
|
|
1003
|
-
{ x: i, y:
|
|
1003
|
+
{ x: i, y: w.y },
|
|
1004
1004
|
this.params.sourceDirection,
|
|
1005
|
-
|
|
1005
|
+
w
|
|
1006
1006
|
), g = {
|
|
1007
1007
|
x: c.x + h,
|
|
1008
1008
|
y: c.y + d
|
|
@@ -1013,10 +1013,10 @@ class st {
|
|
|
1013
1013
|
), u = {
|
|
1014
1014
|
x: l.x + h,
|
|
1015
1015
|
y: l.y + d
|
|
1016
|
-
},
|
|
1016
|
+
}, p = {
|
|
1017
1017
|
x: (g.x + u.x) / 2,
|
|
1018
1018
|
y: (g.y + u.y) / 2
|
|
1019
|
-
},
|
|
1019
|
+
}, f = {
|
|
1020
1020
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
1021
1021
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
1022
1022
|
}, E = {
|
|
@@ -1032,23 +1032,23 @@ class st {
|
|
|
1032
1032
|
this.path = [
|
|
1033
1033
|
`M ${t.x} ${t.y}`,
|
|
1034
1034
|
`L ${c.x} ${c.y}`,
|
|
1035
|
-
`C ${
|
|
1035
|
+
`C ${f.x} ${f.y} ${S.x} ${S.y} ${p.x} ${p.y}`,
|
|
1036
1036
|
`C ${b.x} ${b.y} ${E.x} ${E.y} ${l.x} ${l.y}`,
|
|
1037
1037
|
`L ${s.x} ${s.y}`
|
|
1038
|
-
].join(" "), this.midpoint =
|
|
1038
|
+
].join(" "), this.midpoint = z(p, e.flipX, e.flipY, e.to);
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
|
-
const
|
|
1041
|
+
const Z = Object.freeze({
|
|
1042
1042
|
edgeColor: "--edge-color"
|
|
1043
|
-
}),
|
|
1043
|
+
}), Ce = (r) => {
|
|
1044
1044
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1045
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(
|
|
1046
|
-
},
|
|
1045
|
+
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;
|
|
1046
|
+
}, Te = (r) => {
|
|
1047
1047
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1048
|
-
return e.setAttribute("stroke", `var(${
|
|
1049
|
-
},
|
|
1048
|
+
return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
1049
|
+
}, O = () => {
|
|
1050
1050
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1051
|
-
return r.setAttribute("fill", `var(${
|
|
1051
|
+
return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
|
|
1052
1052
|
}, De = () => {
|
|
1053
1053
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1054
1054
|
return r.style.transformOrigin = "50% 50%", r;
|
|
@@ -1061,13 +1061,13 @@ const q = Object.freeze({
|
|
|
1061
1061
|
let i = 0, n = 0, a = 0;
|
|
1062
1062
|
r.forEach((h, d) => {
|
|
1063
1063
|
let c = 0, g = 0, l = 0;
|
|
1064
|
-
const u = d > 0,
|
|
1065
|
-
if (u && (c = -i, g = -n, l = a),
|
|
1064
|
+
const u = d > 0, p = d < s, f = u && p;
|
|
1065
|
+
if (u && (c = -i, g = -n, l = a), p) {
|
|
1066
1066
|
const V = r[d + 1];
|
|
1067
1067
|
i = V.x - h.x, n = V.y - h.y, a = Math.sqrt(i * i + n * n);
|
|
1068
1068
|
}
|
|
1069
|
-
const S = a !== 0 ? Math.min((
|
|
1070
|
-
d > 0 && t.push(`L ${
|
|
1069
|
+
const S = a !== 0 ? Math.min((f ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, b = f ? { x: h.x + i * S, y: h.y + n * S } : h, P = l !== 0 ? Math.min((f ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, L = f ? { x: h.x + c * P, y: h.y + g * P } : h;
|
|
1070
|
+
d > 0 && t.push(`L ${L.x} ${L.y}`), f && t.push(
|
|
1071
1071
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${b.x} ${b.y}`
|
|
1072
1072
|
);
|
|
1073
1073
|
});
|
|
@@ -1082,10 +1082,10 @@ class ot {
|
|
|
1082
1082
|
const t = this.params.to;
|
|
1083
1083
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1084
1084
|
const s = this.params.hasSourceArrow ? m(
|
|
1085
|
-
{ x: this.params.arrowLength, y:
|
|
1085
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1086
1086
|
this.params.sourceDirection,
|
|
1087
|
-
|
|
1088
|
-
) :
|
|
1087
|
+
w
|
|
1088
|
+
) : w, i = this.params.hasTargetArrow ? m(
|
|
1089
1089
|
{
|
|
1090
1090
|
x: this.params.to.x - this.params.arrowLength,
|
|
1091
1091
|
y: this.params.to.y
|
|
@@ -1093,9 +1093,9 @@ class ot {
|
|
|
1093
1093
|
this.params.targetDirection,
|
|
1094
1094
|
this.params.to
|
|
1095
1095
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
1096
|
-
{ x: a, y:
|
|
1096
|
+
{ x: a, y: w.y },
|
|
1097
1097
|
this.params.sourceDirection,
|
|
1098
|
-
|
|
1098
|
+
w
|
|
1099
1099
|
), d = m(
|
|
1100
1100
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1101
1101
|
this.params.targetDirection,
|
|
@@ -1103,12 +1103,12 @@ class ot {
|
|
|
1103
1103
|
), c = Math.max((h.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
|
|
1104
1104
|
x: this.params.flipX > 0 ? c : -n,
|
|
1105
1105
|
y: h.y
|
|
1106
|
-
}, u = { x: l.x, y: g },
|
|
1106
|
+
}, u = { x: l.x, y: g }, p = {
|
|
1107
1107
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1108
1108
|
y: d.y
|
|
1109
|
-
},
|
|
1109
|
+
}, f = { x: p.x, y: g };
|
|
1110
1110
|
this.path = D(
|
|
1111
|
-
[s, h, l, u,
|
|
1111
|
+
[s, h, l, u, f, p, d, i],
|
|
1112
1112
|
this.params.roundness
|
|
1113
1113
|
);
|
|
1114
1114
|
}
|
|
@@ -1119,10 +1119,10 @@ class it {
|
|
|
1119
1119
|
o(this, "midpoint");
|
|
1120
1120
|
this.params = e;
|
|
1121
1121
|
const t = this.params.hasSourceArrow ? m(
|
|
1122
|
-
{ x: this.params.arrowLength, y:
|
|
1122
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1123
1123
|
this.params.sourceDirection,
|
|
1124
|
-
|
|
1125
|
-
) :
|
|
1124
|
+
w
|
|
1125
|
+
) : w, s = this.params.hasTargetArrow ? m(
|
|
1126
1126
|
{
|
|
1127
1127
|
x: this.params.to.x - this.params.arrowLength,
|
|
1128
1128
|
y: this.params.to.y
|
|
@@ -1130,15 +1130,15 @@ class it {
|
|
|
1130
1130
|
this.params.targetDirection,
|
|
1131
1131
|
this.params.to
|
|
1132
1132
|
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1133
|
-
{ x: i, y:
|
|
1133
|
+
{ x: i, y: w.y },
|
|
1134
1134
|
this.params.sourceDirection,
|
|
1135
|
-
|
|
1135
|
+
w
|
|
1136
1136
|
), 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(
|
|
1137
1137
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1138
1138
|
this.params.targetDirection,
|
|
1139
1139
|
this.params.to
|
|
1140
|
-
), u = { x: l.x + d, y: l.y + c },
|
|
1141
|
-
this.midpoint =
|
|
1140
|
+
), u = { x: l.x + d, y: l.y + c }, p = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
|
|
1141
|
+
this.midpoint = z(p, e.flipX, e.flipY, e.to), this.path = D(
|
|
1142
1142
|
[t, n, g, u, l, s],
|
|
1143
1143
|
this.params.roundness
|
|
1144
1144
|
);
|
|
@@ -1152,10 +1152,10 @@ class nt {
|
|
|
1152
1152
|
const t = this.params.to;
|
|
1153
1153
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1154
1154
|
const s = this.params.hasSourceArrow ? m(
|
|
1155
|
-
{ x: this.params.arrowLength, y:
|
|
1155
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1156
1156
|
this.params.sourceDirection,
|
|
1157
|
-
|
|
1158
|
-
) :
|
|
1157
|
+
w
|
|
1158
|
+
) : w, i = this.params.hasTargetArrow ? m(
|
|
1159
1159
|
{
|
|
1160
1160
|
x: this.params.to.x - this.params.arrowLength,
|
|
1161
1161
|
y: this.params.to.y
|
|
@@ -1163,9 +1163,9 @@ class nt {
|
|
|
1163
1163
|
this.params.targetDirection,
|
|
1164
1164
|
this.params.to
|
|
1165
1165
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = m(
|
|
1166
|
-
{ x: n, y:
|
|
1166
|
+
{ x: n, y: w.y },
|
|
1167
1167
|
this.params.sourceDirection,
|
|
1168
|
-
|
|
1168
|
+
w
|
|
1169
1169
|
), h = m(
|
|
1170
1170
|
{ x: this.params.to.x - n, y: this.params.to.y },
|
|
1171
1171
|
this.params.targetDirection,
|
|
@@ -1182,10 +1182,10 @@ class at {
|
|
|
1182
1182
|
const t = this.params.to;
|
|
1183
1183
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1184
1184
|
const s = this.params.hasSourceArrow ? m(
|
|
1185
|
-
{ x: this.params.arrowLength, y:
|
|
1185
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1186
1186
|
this.params.sourceDirection,
|
|
1187
|
-
|
|
1188
|
-
) :
|
|
1187
|
+
w
|
|
1188
|
+
) : w, i = this.params.hasTargetArrow ? m(
|
|
1189
1189
|
{
|
|
1190
1190
|
x: this.params.to.x - this.params.arrowLength,
|
|
1191
1191
|
y: this.params.to.y
|
|
@@ -1193,9 +1193,9 @@ class at {
|
|
|
1193
1193
|
this.params.targetDirection,
|
|
1194
1194
|
this.params.to
|
|
1195
1195
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
1196
|
-
{ x: a, y:
|
|
1196
|
+
{ x: a, y: w.y },
|
|
1197
1197
|
this.params.sourceDirection,
|
|
1198
|
-
|
|
1198
|
+
w
|
|
1199
1199
|
), d = m(
|
|
1200
1200
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1201
1201
|
this.params.targetDirection,
|
|
@@ -1203,12 +1203,12 @@ class at {
|
|
|
1203
1203
|
), c = Math.max((h.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
|
|
1204
1204
|
x: h.x,
|
|
1205
1205
|
y: this.params.flipY > 0 ? c : -n
|
|
1206
|
-
}, u = { x: g, y: l.y },
|
|
1206
|
+
}, u = { x: g, y: l.y }, p = {
|
|
1207
1207
|
x: d.x,
|
|
1208
1208
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1209
|
-
},
|
|
1209
|
+
}, f = { x: g, y: p.y };
|
|
1210
1210
|
this.path = D(
|
|
1211
|
-
[s, h, l, u,
|
|
1211
|
+
[s, h, l, u, f, p, d, i],
|
|
1212
1212
|
this.params.roundness
|
|
1213
1213
|
);
|
|
1214
1214
|
}
|
|
@@ -1219,17 +1219,17 @@ class J {
|
|
|
1219
1219
|
o(this, "midpoint");
|
|
1220
1220
|
this.params = e;
|
|
1221
1221
|
const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, h = [
|
|
1222
|
-
{ x: this.params.arrowLength, y:
|
|
1223
|
-
{ x: i, y:
|
|
1222
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1223
|
+
{ x: i, y: w.y },
|
|
1224
1224
|
{ x: i, y: this.params.side },
|
|
1225
1225
|
{ x: n, y: this.params.side },
|
|
1226
1226
|
{ x: n, y: -this.params.side },
|
|
1227
1227
|
{ x: i, y: -this.params.side },
|
|
1228
|
-
{ x: i, y:
|
|
1229
|
-
{ x: this.params.arrowLength, y:
|
|
1228
|
+
{ x: i, y: w.y },
|
|
1229
|
+
{ x: this.params.arrowLength, y: w.y }
|
|
1230
1230
|
].map(
|
|
1231
|
-
(c) => m(c, this.params.sourceDirection,
|
|
1232
|
-
), d = `M ${
|
|
1231
|
+
(c) => m(c, this.params.sourceDirection, w)
|
|
1232
|
+
), d = `M ${w.x} ${w.y} L ${h[0].x} ${h[0].y} `;
|
|
1233
1233
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${D(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
@@ -1239,19 +1239,19 @@ class ht {
|
|
|
1239
1239
|
o(this, "midpoint");
|
|
1240
1240
|
this.params = e;
|
|
1241
1241
|
const t = this.params.smallRadius, s = this.params.radius, i = t + s, n = t * s / i, a = Math.sqrt(i * i - t * t), h = a * t / i, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, l = [
|
|
1242
|
-
{ x: this.params.arrowLength, y:
|
|
1242
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1243
1243
|
{ x: c, y: n },
|
|
1244
1244
|
{ x: c, y: -n },
|
|
1245
1245
|
{ x: d, y: 0 }
|
|
1246
1246
|
].map(
|
|
1247
|
-
(
|
|
1247
|
+
(f) => m(f, this.params.sourceDirection, w)
|
|
1248
1248
|
), u = [
|
|
1249
1249
|
`M ${l[0].x} ${l[0].y}`,
|
|
1250
1250
|
`A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
|
|
1251
1251
|
`A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
|
|
1252
1252
|
`A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
|
|
1253
|
-
].join(" "),
|
|
1254
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" :
|
|
1253
|
+
].join(" "), p = `M 0 0 L ${l[0].x} ${l[0].y} `;
|
|
1254
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : p}${u}`, this.midpoint = l[3];
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
1257
|
class dt {
|
|
@@ -1273,7 +1273,7 @@ class dt {
|
|
|
1273
1273
|
offset: this.params.sourceOffset,
|
|
1274
1274
|
hasArrow: this.params.hasSourceArrow,
|
|
1275
1275
|
flip: 1,
|
|
1276
|
-
shift:
|
|
1276
|
+
shift: w
|
|
1277
1277
|
}), n = this.createDirectLinePoint({
|
|
1278
1278
|
offset: this.params.targetOffset,
|
|
1279
1279
|
hasArrow: this.params.hasTargetArrow,
|
|
@@ -1296,10 +1296,10 @@ class ct {
|
|
|
1296
1296
|
o(this, "midpoint");
|
|
1297
1297
|
this.params = e;
|
|
1298
1298
|
const t = this.params.hasSourceArrow ? m(
|
|
1299
|
-
{ x: this.params.arrowLength, y:
|
|
1299
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1300
1300
|
this.params.sourceDirection,
|
|
1301
|
-
|
|
1302
|
-
) :
|
|
1301
|
+
w
|
|
1302
|
+
) : w, s = this.params.hasTargetArrow ? m(
|
|
1303
1303
|
{
|
|
1304
1304
|
x: this.params.to.x - this.params.arrowLength,
|
|
1305
1305
|
y: this.params.to.y
|
|
@@ -1307,9 +1307,9 @@ class ct {
|
|
|
1307
1307
|
this.params.targetDirection,
|
|
1308
1308
|
this.params.to
|
|
1309
1309
|
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1310
|
-
{ x: i, y:
|
|
1310
|
+
{ x: i, y: w.y },
|
|
1311
1311
|
this.params.sourceDirection,
|
|
1312
|
-
|
|
1312
|
+
w
|
|
1313
1313
|
), a = m(
|
|
1314
1314
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1315
1315
|
this.params.targetDirection,
|
|
@@ -1318,7 +1318,7 @@ class ct {
|
|
|
1318
1318
|
x: (n.x + a.x) / 2,
|
|
1319
1319
|
y: g
|
|
1320
1320
|
};
|
|
1321
|
-
this.midpoint =
|
|
1321
|
+
this.midpoint = z(l, e.flipX, e.flipY, e.to), this.path = D(
|
|
1322
1322
|
[
|
|
1323
1323
|
t,
|
|
1324
1324
|
n,
|
|
@@ -1337,10 +1337,10 @@ class lt {
|
|
|
1337
1337
|
o(this, "midpoint");
|
|
1338
1338
|
this.params = e;
|
|
1339
1339
|
const t = this.params.hasSourceArrow ? m(
|
|
1340
|
-
{ x: this.params.arrowLength, y:
|
|
1340
|
+
{ x: this.params.arrowLength, y: w.y },
|
|
1341
1341
|
this.params.sourceDirection,
|
|
1342
|
-
|
|
1343
|
-
) :
|
|
1342
|
+
w
|
|
1343
|
+
) : w, s = this.params.hasTargetArrow ? m(
|
|
1344
1344
|
{
|
|
1345
1345
|
x: this.params.to.x - this.params.arrowLength,
|
|
1346
1346
|
y: this.params.to.y
|
|
@@ -1348,9 +1348,9 @@ class lt {
|
|
|
1348
1348
|
this.params.targetDirection,
|
|
1349
1349
|
this.params.to
|
|
1350
1350
|
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1351
|
-
{ x: i, y:
|
|
1351
|
+
{ x: i, y: w.y },
|
|
1352
1352
|
this.params.sourceDirection,
|
|
1353
|
-
|
|
1353
|
+
w
|
|
1354
1354
|
), a = m(
|
|
1355
1355
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1356
1356
|
this.params.targetDirection,
|
|
@@ -1359,7 +1359,7 @@ class lt {
|
|
|
1359
1359
|
x: g,
|
|
1360
1360
|
y: (n.y + a.y) / 2
|
|
1361
1361
|
};
|
|
1362
|
-
this.midpoint =
|
|
1362
|
+
this.midpoint = z(l, e.flipX, e.flipY, e.to), this.path = D(
|
|
1363
1363
|
[
|
|
1364
1364
|
t,
|
|
1365
1365
|
n,
|
|
@@ -1372,7 +1372,7 @@ class lt {
|
|
|
1372
1372
|
);
|
|
1373
1373
|
}
|
|
1374
1374
|
}
|
|
1375
|
-
const
|
|
1375
|
+
const y = Object.freeze({
|
|
1376
1376
|
color: "#777777",
|
|
1377
1377
|
width: 1,
|
|
1378
1378
|
arrowLength: 20,
|
|
@@ -1395,7 +1395,7 @@ const f = Object.freeze({
|
|
|
1395
1395
|
interactiveWidth: 10,
|
|
1396
1396
|
preOffset: 0
|
|
1397
1397
|
}), pe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1398
|
-
class
|
|
1398
|
+
class k {
|
|
1399
1399
|
constructor(e) {
|
|
1400
1400
|
o(this, "svg");
|
|
1401
1401
|
o(this, "group", De());
|
|
@@ -1405,7 +1405,7 @@ class z {
|
|
|
1405
1405
|
o(this, "onAfterRender");
|
|
1406
1406
|
o(this, "afterRenderEmitter");
|
|
1407
1407
|
o(this, "arrowRenderer");
|
|
1408
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg =
|
|
1408
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Ce(e.color), this.svg.appendChild(this.group), this.line = Te(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
|
|
1409
1409
|
}
|
|
1410
1410
|
render(e) {
|
|
1411
1411
|
const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Ne(
|
|
@@ -1427,52 +1427,52 @@ class z {
|
|
|
1427
1427
|
};
|
|
1428
1428
|
let l = { x: -c.x, y: -c.y }, u;
|
|
1429
1429
|
e.category === M.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === M.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
|
|
1430
|
-
const
|
|
1430
|
+
const p = u(
|
|
1431
1431
|
d,
|
|
1432
1432
|
c,
|
|
1433
1433
|
g,
|
|
1434
1434
|
a,
|
|
1435
1435
|
h
|
|
1436
1436
|
);
|
|
1437
|
-
this.line.setAttribute("d",
|
|
1438
|
-
let
|
|
1439
|
-
this.sourceArrow && (
|
|
1437
|
+
this.line.setAttribute("d", p.path);
|
|
1438
|
+
let f = null;
|
|
1439
|
+
this.sourceArrow && (f = this.arrowRenderer({
|
|
1440
1440
|
direction: d,
|
|
1441
|
-
shift:
|
|
1441
|
+
shift: w,
|
|
1442
1442
|
arrowLength: this.params.arrowLength
|
|
1443
|
-
}), this.sourceArrow.setAttribute("d",
|
|
1443
|
+
}), this.sourceArrow.setAttribute("d", f));
|
|
1444
1444
|
let E = null;
|
|
1445
1445
|
this.targetArrow && (E = this.arrowRenderer({
|
|
1446
1446
|
direction: l,
|
|
1447
1447
|
shift: g,
|
|
1448
1448
|
arrowLength: this.params.arrowLength
|
|
1449
1449
|
}), this.targetArrow.setAttribute("d", E)), this.afterRenderEmitter.emit({
|
|
1450
|
-
edgePath:
|
|
1451
|
-
sourceArrowPath:
|
|
1450
|
+
edgePath: p,
|
|
1451
|
+
sourceArrowPath: f,
|
|
1452
1452
|
targetArrowPath: E
|
|
1453
1453
|
});
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
1456
|
const gt = (r) => (e) => {
|
|
1457
1457
|
const s = [
|
|
1458
|
-
|
|
1458
|
+
w,
|
|
1459
1459
|
{ x: e.arrowLength, y: r.radius },
|
|
1460
1460
|
{ x: e.arrowLength, y: -r.radius }
|
|
1461
1461
|
].map(
|
|
1462
|
-
(h) => m(h, e.direction,
|
|
1462
|
+
(h) => m(h, e.direction, w)
|
|
1463
1463
|
).map((h) => ({
|
|
1464
1464
|
x: h.x + e.shift.x,
|
|
1465
1465
|
y: h.y + e.shift.y
|
|
1466
1466
|
})), i = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
|
|
1467
1467
|
return `${i} ${n} ${a} Z`;
|
|
1468
1468
|
}, ut = (r) => (e) => {
|
|
1469
|
-
const t = r.radius, s = e.arrowLength, i = (s * s + 2 * s * t) / (2 * t), n = i + t, a = s + t - t * (s + t) / n, h = t * i / n, c = [
|
|
1470
|
-
(
|
|
1471
|
-
).map((
|
|
1472
|
-
x:
|
|
1473
|
-
y:
|
|
1474
|
-
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`,
|
|
1475
|
-
return `${g} ${l} ${u} ${
|
|
1469
|
+
const t = r.radius, s = e.arrowLength, i = (s * s + 2 * s * t) / (2 * t), n = i + t, a = s + t - t * (s + t) / n, h = t * i / n, c = [w, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1470
|
+
(f) => m(f, e.direction, w)
|
|
1471
|
+
).map((f) => ({
|
|
1472
|
+
x: f.x + e.shift.x,
|
|
1473
|
+
y: f.y + e.shift.y
|
|
1474
|
+
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1475
|
+
return `${g} ${l} ${u} ${p}`;
|
|
1476
1476
|
}, pt = (r) => (e) => {
|
|
1477
1477
|
const t = r.smallRadius, s = r.radius, i = m(
|
|
1478
1478
|
{
|
|
@@ -1487,30 +1487,30 @@ const gt = (r) => (e) => {
|
|
|
1487
1487
|
x: e.arrowLength + r.smallRadius,
|
|
1488
1488
|
y: 0
|
|
1489
1489
|
}
|
|
1490
|
-
), a = [
|
|
1491
|
-
(l) => m(l, e.direction,
|
|
1490
|
+
), a = [w, { x: i.x, y: -i.y }, i].map(
|
|
1491
|
+
(l) => m(l, e.direction, w)
|
|
1492
1492
|
).map((l) => ({
|
|
1493
1493
|
x: l.x + e.shift.x,
|
|
1494
1494
|
y: l.y + e.shift.y
|
|
1495
1495
|
})), h = `M ${a[0].x} ${a[0].y}`, d = `A ${s} ${s} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, g = `A ${s} ${s} 0 0 1 ${a[0].x} ${a[0].y}`;
|
|
1496
1496
|
return `${h} ${d} ${c} ${g}`;
|
|
1497
|
-
},
|
|
1497
|
+
}, I = (r) => {
|
|
1498
1498
|
if (typeof r == "function")
|
|
1499
1499
|
return r;
|
|
1500
1500
|
switch (r.type) {
|
|
1501
1501
|
case "triangle":
|
|
1502
1502
|
return gt({
|
|
1503
|
-
radius: r.radius ??
|
|
1503
|
+
radius: r.radius ?? y.polygonArrowRadius
|
|
1504
1504
|
});
|
|
1505
1505
|
case "arc":
|
|
1506
1506
|
return ut({
|
|
1507
|
-
radius: r.radius ??
|
|
1507
|
+
radius: r.radius ?? y.circleArrowRadius
|
|
1508
1508
|
});
|
|
1509
1509
|
default:
|
|
1510
1510
|
return pt({
|
|
1511
|
-
smallRadius: r.smallRadius ??
|
|
1512
|
-
angle: r.angle ??
|
|
1513
|
-
radius: r.radius ??
|
|
1511
|
+
smallRadius: r.smallRadius ?? y.wedgeArrowSmallRadius,
|
|
1512
|
+
angle: r.angle ?? y.wedgeArrowAngle,
|
|
1513
|
+
radius: r.radius ?? y.wedgeArrowRadius
|
|
1514
1514
|
});
|
|
1515
1515
|
}
|
|
1516
1516
|
};
|
|
@@ -1561,10 +1561,10 @@ class wt {
|
|
|
1561
1561
|
hasSourceArrow: this.hasSourceArrow,
|
|
1562
1562
|
hasTargetArrow: this.hasTargetArrow
|
|
1563
1563
|
}));
|
|
1564
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1565
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1566
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1567
|
-
arrowRenderer:
|
|
1564
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? y.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? y.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? y.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? y.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new k({
|
|
1565
|
+
color: (e == null ? void 0 : e.color) ?? y.color,
|
|
1566
|
+
width: (e == null ? void 0 : e.width) ?? y.width,
|
|
1567
|
+
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1568
1568
|
arrowLength: this.arrowLength,
|
|
1569
1569
|
hasSourceArrow: this.hasSourceArrow,
|
|
1570
1570
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1577,7 +1577,7 @@ class wt {
|
|
|
1577
1577
|
this.pathShape.render(e);
|
|
1578
1578
|
}
|
|
1579
1579
|
}
|
|
1580
|
-
class
|
|
1580
|
+
class ft {
|
|
1581
1581
|
constructor(e) {
|
|
1582
1582
|
o(this, "svg");
|
|
1583
1583
|
o(this, "group");
|
|
@@ -1626,16 +1626,16 @@ class yt {
|
|
|
1626
1626
|
hasSourceArrow: this.hasSourceArrow,
|
|
1627
1627
|
hasTargetArrow: this.hasTargetArrow
|
|
1628
1628
|
}));
|
|
1629
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1630
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1629
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? y.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? y.cycleSquareSide;
|
|
1630
|
+
const t = (e == null ? void 0 : e.roundness) ?? y.roundness;
|
|
1631
1631
|
this.roundness = Math.min(
|
|
1632
1632
|
t,
|
|
1633
1633
|
this.arrowOffset,
|
|
1634
1634
|
this.cycleSquareSide / 2
|
|
1635
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ??
|
|
1636
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1637
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1638
|
-
arrowRenderer:
|
|
1635
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new k({
|
|
1636
|
+
color: (e == null ? void 0 : e.color) ?? y.color,
|
|
1637
|
+
width: (e == null ? void 0 : e.width) ?? y.width,
|
|
1638
|
+
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1639
1639
|
arrowLength: this.arrowLength,
|
|
1640
1640
|
hasSourceArrow: this.hasSourceArrow,
|
|
1641
1641
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1648,7 +1648,7 @@ class yt {
|
|
|
1648
1648
|
this.pathShape.render(e);
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
|
-
class
|
|
1651
|
+
class yt {
|
|
1652
1652
|
constructor(e) {
|
|
1653
1653
|
o(this, "svg");
|
|
1654
1654
|
o(this, "group");
|
|
@@ -1698,16 +1698,16 @@ class ft {
|
|
|
1698
1698
|
hasSourceArrow: this.hasSourceArrow,
|
|
1699
1699
|
hasTargetArrow: this.hasTargetArrow
|
|
1700
1700
|
}));
|
|
1701
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1702
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1701
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? y.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? y.cycleSquareSide;
|
|
1702
|
+
const t = (e == null ? void 0 : e.roundness) ?? y.roundness;
|
|
1703
1703
|
this.roundness = Math.min(
|
|
1704
1704
|
t,
|
|
1705
1705
|
this.arrowOffset,
|
|
1706
1706
|
this.cycleSquareSide / 2
|
|
1707
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ??
|
|
1708
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1709
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1710
|
-
arrowRenderer:
|
|
1707
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? y.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new k({
|
|
1708
|
+
color: (e == null ? void 0 : e.color) ?? y.color,
|
|
1709
|
+
width: (e == null ? void 0 : e.width) ?? y.width,
|
|
1710
|
+
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1711
1711
|
arrowLength: this.arrowLength,
|
|
1712
1712
|
hasSourceArrow: this.hasSourceArrow,
|
|
1713
1713
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1769,16 +1769,16 @@ class mt {
|
|
|
1769
1769
|
hasSourceArrow: this.hasSourceArrow,
|
|
1770
1770
|
hasTargetArrow: this.hasTargetArrow
|
|
1771
1771
|
}));
|
|
1772
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1773
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1772
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? y.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? y.cycleSquareSide;
|
|
1773
|
+
const t = (e == null ? void 0 : e.roundness) ?? y.roundness;
|
|
1774
1774
|
this.roundness = Math.min(
|
|
1775
1775
|
t,
|
|
1776
1776
|
this.arrowOffset,
|
|
1777
1777
|
this.cycleSquareSide / 2
|
|
1778
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ??
|
|
1779
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1780
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1781
|
-
arrowRenderer:
|
|
1778
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new k({
|
|
1779
|
+
color: (e == null ? void 0 : e.color) ?? y.color,
|
|
1780
|
+
width: (e == null ? void 0 : e.width) ?? y.width,
|
|
1781
|
+
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1782
1782
|
arrowLength: this.arrowLength,
|
|
1783
1783
|
hasSourceArrow: this.hasSourceArrow,
|
|
1784
1784
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1791,7 +1791,7 @@ class mt {
|
|
|
1791
1791
|
this.pathShape.render(e);
|
|
1792
1792
|
}
|
|
1793
1793
|
}
|
|
1794
|
-
class
|
|
1794
|
+
class Re {
|
|
1795
1795
|
constructor(e) {
|
|
1796
1796
|
o(this, "svg");
|
|
1797
1797
|
o(this, "group", De());
|
|
@@ -1806,7 +1806,7 @@ class Le {
|
|
|
1806
1806
|
o(this, "onAfterRender");
|
|
1807
1807
|
o(this, "afterRenderEmitter");
|
|
1808
1808
|
o(this, "arrowRenderer");
|
|
1809
|
-
[this.afterRenderEmitter, this.onAfterRender] = x(), this.color = (e == null ? void 0 : e.color) ??
|
|
1809
|
+
[this.afterRenderEmitter, this.onAfterRender] = x(), this.color = (e == null ? void 0 : e.color) ?? y.color, this.width = (e == null ? void 0 : e.width) ?? y.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowRenderer = I((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? y.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? y.preOffset, this.svg = Ce(this.color), this.svg.appendChild(this.group), this.line = Te(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
|
|
1810
1810
|
}
|
|
1811
1811
|
render(e) {
|
|
1812
1812
|
const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Ne(
|
|
@@ -1828,31 +1828,31 @@ class Le {
|
|
|
1828
1828
|
if (u === 0)
|
|
1829
1829
|
this.sourceArrow !== null && (g = "", this.sourceArrow.setAttribute("d", g)), this.targetArrow !== null && (l = "", this.targetArrow.setAttribute("d", l));
|
|
1830
1830
|
else {
|
|
1831
|
-
const
|
|
1831
|
+
const p = {
|
|
1832
1832
|
x: d.x / u,
|
|
1833
1833
|
y: d.y / u
|
|
1834
1834
|
};
|
|
1835
1835
|
if (this.sourceArrow) {
|
|
1836
|
-
const
|
|
1837
|
-
x:
|
|
1838
|
-
y:
|
|
1836
|
+
const f = {
|
|
1837
|
+
x: p.x * this.sourceOffset,
|
|
1838
|
+
y: p.y * this.sourceOffset
|
|
1839
1839
|
};
|
|
1840
1840
|
g = this.arrowRenderer({
|
|
1841
|
-
direction:
|
|
1842
|
-
shift:
|
|
1841
|
+
direction: p,
|
|
1842
|
+
shift: f,
|
|
1843
1843
|
arrowLength: this.arrowLength
|
|
1844
1844
|
}), this.sourceArrow.setAttribute("d", g);
|
|
1845
1845
|
}
|
|
1846
1846
|
if (this.targetArrow) {
|
|
1847
|
-
const
|
|
1848
|
-
x:
|
|
1849
|
-
y:
|
|
1847
|
+
const f = {
|
|
1848
|
+
x: p.x * this.targetOffset,
|
|
1849
|
+
y: p.y * this.targetOffset
|
|
1850
1850
|
};
|
|
1851
1851
|
l = this.arrowRenderer({
|
|
1852
|
-
direction: { x: -
|
|
1852
|
+
direction: { x: -p.x, y: -p.y },
|
|
1853
1853
|
shift: {
|
|
1854
|
-
x: d.x -
|
|
1855
|
-
y: d.y -
|
|
1854
|
+
x: d.x - f.x,
|
|
1855
|
+
y: d.y - f.y
|
|
1856
1856
|
},
|
|
1857
1857
|
arrowLength: this.arrowLength
|
|
1858
1858
|
}), this.targetArrow.setAttribute("d", l);
|
|
@@ -1880,7 +1880,7 @@ class Et extends Error {
|
|
|
1880
1880
|
super(e), this.name = "InteractiveEdgeError";
|
|
1881
1881
|
}
|
|
1882
1882
|
}
|
|
1883
|
-
class
|
|
1883
|
+
class Le {
|
|
1884
1884
|
constructor(e, t) {
|
|
1885
1885
|
o(this, "svg");
|
|
1886
1886
|
o(this, "group");
|
|
@@ -1892,12 +1892,12 @@ class Re {
|
|
|
1892
1892
|
o(this, "interactiveLine");
|
|
1893
1893
|
o(this, "interactiveSourceArrow", null);
|
|
1894
1894
|
o(this, "interactiveTargetArrow", null);
|
|
1895
|
-
if (this.baseEdge = e, e instanceof
|
|
1895
|
+
if (this.baseEdge = e, e instanceof Le)
|
|
1896
1896
|
throw new Et(
|
|
1897
1897
|
"interactive edge can be configured only once"
|
|
1898
1898
|
);
|
|
1899
1899
|
this.svg = this.baseEdge.svg, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
|
|
1900
|
-
const s = (t == null ? void 0 : t.distance) ??
|
|
1900
|
+
const s = (t == null ? void 0 : t.distance) ?? y.interactiveWidth;
|
|
1901
1901
|
this.interactiveLine = At(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = we(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = we(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
|
|
1902
1902
|
this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
|
|
1903
1903
|
});
|
|
@@ -1906,7 +1906,7 @@ class Re {
|
|
|
1906
1906
|
this.baseEdge.render(e);
|
|
1907
1907
|
}
|
|
1908
1908
|
}
|
|
1909
|
-
class
|
|
1909
|
+
class ur {
|
|
1910
1910
|
constructor(e, t) {
|
|
1911
1911
|
o(this, "group");
|
|
1912
1912
|
o(this, "line");
|
|
@@ -2049,7 +2049,7 @@ const Ie = (r, e) => {
|
|
|
2049
2049
|
priorityFn: () => 0
|
|
2050
2050
|
},
|
|
2051
2051
|
edges: {
|
|
2052
|
-
shapeFactory: () => new
|
|
2052
|
+
shapeFactory: () => new Re(),
|
|
2053
2053
|
priorityFn: () => 0
|
|
2054
2054
|
},
|
|
2055
2055
|
ports: {
|
|
@@ -2065,7 +2065,7 @@ const Ie = (r, e) => {
|
|
|
2065
2065
|
a
|
|
2066
2066
|
);
|
|
2067
2067
|
};
|
|
2068
|
-
class
|
|
2068
|
+
class H {
|
|
2069
2069
|
constructor(e, t, s, i) {
|
|
2070
2070
|
o(this, "onAfterPortMarked", (e) => {
|
|
2071
2071
|
const t = this.canvas.graph.getPort(e);
|
|
@@ -2090,7 +2090,7 @@ class k {
|
|
|
2090
2090
|
}));
|
|
2091
2091
|
});
|
|
2092
2092
|
o(this, "onWindowMouseMove", (e) => {
|
|
2093
|
-
if (!
|
|
2093
|
+
if (!R(
|
|
2094
2094
|
this.window,
|
|
2095
2095
|
this.element,
|
|
2096
2096
|
e.clientX,
|
|
@@ -2122,7 +2122,7 @@ class k {
|
|
|
2122
2122
|
});
|
|
2123
2123
|
o(this, "onWindowTouchMove", (e) => {
|
|
2124
2124
|
const t = e.touches[0];
|
|
2125
|
-
if (!
|
|
2125
|
+
if (!R(
|
|
2126
2126
|
this.window,
|
|
2127
2127
|
this.element,
|
|
2128
2128
|
t.clientX,
|
|
@@ -2149,7 +2149,7 @@ class k {
|
|
|
2149
2149
|
this.canvas = e, this.element = t, this.window = s, this.params = i, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2150
2150
|
}
|
|
2151
2151
|
static configure(e, t, s, i) {
|
|
2152
|
-
new
|
|
2152
|
+
new H(e, t, s, i);
|
|
2153
2153
|
}
|
|
2154
2154
|
hookPortEvents(e) {
|
|
2155
2155
|
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
@@ -2249,7 +2249,7 @@ class _ {
|
|
|
2249
2249
|
nodeId: i,
|
|
2250
2250
|
dx: h.x - n.x,
|
|
2251
2251
|
dy: h.y - n.y
|
|
2252
|
-
},
|
|
2252
|
+
}, $(this.element, this.params.dragCursor), this.moveNodeOnTop(i), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2253
2253
|
passive: !0
|
|
2254
2254
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2255
2255
|
passive: !0
|
|
@@ -2285,7 +2285,7 @@ class _ {
|
|
|
2285
2285
|
});
|
|
2286
2286
|
});
|
|
2287
2287
|
o(this, "onWindowMouseMove", (e) => {
|
|
2288
|
-
if (!
|
|
2288
|
+
if (!R(
|
|
2289
2289
|
this.window,
|
|
2290
2290
|
this.element,
|
|
2291
2291
|
e.clientX,
|
|
@@ -2306,7 +2306,7 @@ class _ {
|
|
|
2306
2306
|
if (e.touches.length !== 1)
|
|
2307
2307
|
return;
|
|
2308
2308
|
const t = e.touches[0];
|
|
2309
|
-
if (!
|
|
2309
|
+
if (!R(
|
|
2310
2310
|
this.window,
|
|
2311
2311
|
this.element,
|
|
2312
2312
|
t.clientX,
|
|
@@ -2352,7 +2352,7 @@ class _ {
|
|
|
2352
2352
|
}
|
|
2353
2353
|
}
|
|
2354
2354
|
cancelMouseDrag() {
|
|
2355
|
-
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null,
|
|
2355
|
+
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, $(this.element, null), this.removeMouseDragListeners();
|
|
2356
2356
|
}
|
|
2357
2357
|
removeMouseDragListeners() {
|
|
2358
2358
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -2403,7 +2403,7 @@ const bt = (r, e, t) => ({
|
|
|
2403
2403
|
scale: r.scale * e,
|
|
2404
2404
|
x: r.scale * (1 - e) * t + r.x,
|
|
2405
2405
|
y: r.scale * (1 - e) * s + r.y
|
|
2406
|
-
}),
|
|
2406
|
+
}), B = (r) => {
|
|
2407
2407
|
const e = [], t = r.touches.length;
|
|
2408
2408
|
for (let h = 0; h < t; h++)
|
|
2409
2409
|
e.push([r.touches[h].clientX, r.touches[h].clientY]);
|
|
@@ -2422,7 +2422,7 @@ const bt = (r, e, t) => ({
|
|
|
2422
2422
|
touches: e
|
|
2423
2423
|
};
|
|
2424
2424
|
};
|
|
2425
|
-
class
|
|
2425
|
+
class X {
|
|
2426
2426
|
constructor(e, t, s, i) {
|
|
2427
2427
|
o(this, "viewport");
|
|
2428
2428
|
o(this, "prevTouches", null);
|
|
@@ -2432,14 +2432,14 @@ class H {
|
|
|
2432
2432
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2433
2433
|
});
|
|
2434
2434
|
o(this, "onMouseDown", (e) => {
|
|
2435
|
-
this.
|
|
2435
|
+
this.params.mouseDownEventVerifier(e) && ($(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2436
2436
|
passive: !0
|
|
2437
2437
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2438
2438
|
passive: !0
|
|
2439
2439
|
}), this.startRegisteredTransform());
|
|
2440
2440
|
});
|
|
2441
2441
|
o(this, "onWindowMouseMove", (e) => {
|
|
2442
|
-
const t =
|
|
2442
|
+
const t = R(
|
|
2443
2443
|
this.window,
|
|
2444
2444
|
this.element,
|
|
2445
2445
|
e.clientX,
|
|
@@ -2465,10 +2465,10 @@ class H {
|
|
|
2465
2465
|
});
|
|
2466
2466
|
o(this, "onTouchStart", (e) => {
|
|
2467
2467
|
if (this.prevTouches !== null) {
|
|
2468
|
-
this.prevTouches =
|
|
2468
|
+
this.prevTouches = B(e);
|
|
2469
2469
|
return;
|
|
2470
2470
|
}
|
|
2471
|
-
this.prevTouches =
|
|
2471
|
+
this.prevTouches = B(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
2472
2472
|
passive: !0
|
|
2473
2473
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
2474
2474
|
passive: !0
|
|
@@ -2477,9 +2477,9 @@ class H {
|
|
|
2477
2477
|
}), this.startRegisteredTransform();
|
|
2478
2478
|
});
|
|
2479
2479
|
o(this, "onWindowTouchMove", (e) => {
|
|
2480
|
-
const t =
|
|
2480
|
+
const t = B(e);
|
|
2481
2481
|
if (!t.touches.every(
|
|
2482
|
-
(i) =>
|
|
2482
|
+
(i) => R(this.window, this.element, i[0], i[1])
|
|
2483
2483
|
)) {
|
|
2484
2484
|
this.stopTouchDrag();
|
|
2485
2485
|
return;
|
|
@@ -2494,7 +2494,7 @@ class H {
|
|
|
2494
2494
|
this.prevTouches = t;
|
|
2495
2495
|
});
|
|
2496
2496
|
o(this, "onWindowTouchFinish", (e) => {
|
|
2497
|
-
e.touches.length > 0 ? this.prevTouches =
|
|
2497
|
+
e.touches.length > 0 ? this.prevTouches = B(e) : this.stopTouchDrag();
|
|
2498
2498
|
});
|
|
2499
2499
|
o(this, "preventWheelScaleListener", (e) => {
|
|
2500
2500
|
e.preventDefault();
|
|
@@ -2512,7 +2512,7 @@ class H {
|
|
|
2512
2512
|
}), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2513
2513
|
}
|
|
2514
2514
|
static configure(e, t, s, i) {
|
|
2515
|
-
new
|
|
2515
|
+
new X(e, t, s, i);
|
|
2516
2516
|
}
|
|
2517
2517
|
moveViewport(e, t) {
|
|
2518
2518
|
const s = this.viewport.getViewportMatrix(), i = bt(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
|
|
@@ -2533,7 +2533,7 @@ class H {
|
|
|
2533
2533
|
this.performTransform(d);
|
|
2534
2534
|
}
|
|
2535
2535
|
stopMouseDrag() {
|
|
2536
|
-
|
|
2536
|
+
$(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
2537
2537
|
}
|
|
2538
2538
|
removeMouseDragListeners() {
|
|
2539
2539
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -2610,7 +2610,7 @@ class ee {
|
|
|
2610
2610
|
this.scheduleLoadAreaAroundViewport(), i.onTransformFinished();
|
|
2611
2611
|
}
|
|
2612
2612
|
};
|
|
2613
|
-
|
|
2613
|
+
X.configure(
|
|
2614
2614
|
e,
|
|
2615
2615
|
this.element,
|
|
2616
2616
|
this.window,
|
|
@@ -2651,10 +2651,10 @@ class ee {
|
|
|
2651
2651
|
const Nt = () => {
|
|
2652
2652
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2653
2653
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2654
|
-
},
|
|
2654
|
+
}, Ct = () => {
|
|
2655
2655
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2656
2656
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2657
|
-
},
|
|
2657
|
+
}, Tt = () => {
|
|
2658
2658
|
const r = document.createElementNS(
|
|
2659
2659
|
"http://www.w3.org/2000/svg",
|
|
2660
2660
|
"pattern"
|
|
@@ -2664,8 +2664,8 @@ const Nt = () => {
|
|
|
2664
2664
|
class te {
|
|
2665
2665
|
constructor(e, t, s) {
|
|
2666
2666
|
o(this, "svg", Nt());
|
|
2667
|
-
o(this, "patternRenderingRectangle",
|
|
2668
|
-
o(this, "pattern",
|
|
2667
|
+
o(this, "patternRenderingRectangle", Ct());
|
|
2668
|
+
o(this, "pattern", Tt());
|
|
2669
2669
|
o(this, "patternContent");
|
|
2670
2670
|
o(this, "tileWidth");
|
|
2671
2671
|
o(this, "tileHeight");
|
|
@@ -2710,7 +2710,7 @@ class re {
|
|
|
2710
2710
|
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ie(
|
|
2711
2711
|
this.overlayLayer,
|
|
2712
2712
|
this.viewportStore
|
|
2713
|
-
),
|
|
2713
|
+
), H.configure(
|
|
2714
2714
|
this.canvas,
|
|
2715
2715
|
this.overlayLayer,
|
|
2716
2716
|
this.window,
|
|
@@ -2761,10 +2761,10 @@ class re {
|
|
|
2761
2761
|
portDirection: this.params.dragPortDirection
|
|
2762
2762
|
};
|
|
2763
2763
|
this.isTargetDragging = s === "direct";
|
|
2764
|
-
const [
|
|
2765
|
-
this.overlayCanvas.addNode(
|
|
2766
|
-
from:
|
|
2767
|
-
to:
|
|
2764
|
+
const [p, f] = this.isTargetDragging ? [l, u] : [u, l];
|
|
2765
|
+
this.overlayCanvas.addNode(U(p)), this.overlayCanvas.addNode(U(f)), this.overlayCanvas.addEdge({
|
|
2766
|
+
from: p.overlayNodeId,
|
|
2767
|
+
to: f.overlayNodeId,
|
|
2768
2768
|
shape: this.params.edgeShapeFactory(N.EdgeId)
|
|
2769
2769
|
});
|
|
2770
2770
|
}
|
|
@@ -2806,7 +2806,7 @@ class se {
|
|
|
2806
2806
|
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ie(
|
|
2807
2807
|
this.overlayLayer,
|
|
2808
2808
|
this.viewportStore
|
|
2809
|
-
),
|
|
2809
|
+
), H.configure(
|
|
2810
2810
|
this.canvas,
|
|
2811
2811
|
this.overlayLayer,
|
|
2812
2812
|
this.window,
|
|
@@ -2844,10 +2844,10 @@ class se {
|
|
|
2844
2844
|
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
|
|
2845
2845
|
x: g.x + g.width / 2,
|
|
2846
2846
|
y: g.y + g.height / 2
|
|
2847
|
-
}, u = this.overlayLayer.getBoundingClientRect(),
|
|
2847
|
+
}, u = this.overlayLayer.getBoundingClientRect(), p = this.canvas.viewport.createContentCoords({
|
|
2848
2848
|
x: l.x - u.x,
|
|
2849
2849
|
y: l.y - u.y
|
|
2850
|
-
}),
|
|
2850
|
+
}), f = this.canvas.viewport.createContentCoords({
|
|
2851
2851
|
x: t.x - u.x,
|
|
2852
2852
|
y: t.y - u.y
|
|
2853
2853
|
});
|
|
@@ -2860,19 +2860,19 @@ class se {
|
|
|
2860
2860
|
}, this.canvas.removeEdge(s);
|
|
2861
2861
|
const E = {
|
|
2862
2862
|
overlayNodeId: N.StaticNodeId,
|
|
2863
|
-
portCoords:
|
|
2863
|
+
portCoords: p,
|
|
2864
2864
|
portDirection: c.direction
|
|
2865
2865
|
}, S = {
|
|
2866
2866
|
overlayNodeId: N.DraggingNodeId,
|
|
2867
|
-
portCoords:
|
|
2867
|
+
portCoords: f,
|
|
2868
2868
|
portDirection: d.direction
|
|
2869
|
-
}, [b,
|
|
2870
|
-
this.overlayCanvas.addNode(
|
|
2869
|
+
}, [b, C] = this.isTargetDragging ? [E, S] : [S, E];
|
|
2870
|
+
this.overlayCanvas.addNode(U(b)), this.overlayCanvas.addNode(U(C));
|
|
2871
2871
|
const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(N.EdgeId) : i.shape;
|
|
2872
2872
|
return this.overlayCanvas.addEdge({
|
|
2873
2873
|
id: N.EdgeId,
|
|
2874
2874
|
from: b.overlayNodeId,
|
|
2875
|
-
to:
|
|
2875
|
+
to: C.overlayNodeId,
|
|
2876
2876
|
shape: P
|
|
2877
2877
|
}), !0;
|
|
2878
2878
|
}
|
|
@@ -2933,7 +2933,7 @@ class oe {
|
|
|
2933
2933
|
new oe(e, t);
|
|
2934
2934
|
}
|
|
2935
2935
|
}
|
|
2936
|
-
class
|
|
2936
|
+
class W {
|
|
2937
2937
|
constructor(e, t, s) {
|
|
2938
2938
|
o(this, "applyScheduled", !1);
|
|
2939
2939
|
o(this, "apply", () => {
|
|
@@ -2950,7 +2950,7 @@ class O {
|
|
|
2950
2950
|
});
|
|
2951
2951
|
}
|
|
2952
2952
|
static configure(e, t, s) {
|
|
2953
|
-
new
|
|
2953
|
+
new W(
|
|
2954
2954
|
e,
|
|
2955
2955
|
t,
|
|
2956
2956
|
s
|
|
@@ -2976,7 +2976,7 @@ class Dt {
|
|
|
2976
2976
|
break;
|
|
2977
2977
|
}
|
|
2978
2978
|
case "topologyChangeMacrotask": {
|
|
2979
|
-
|
|
2979
|
+
W.configure(
|
|
2980
2980
|
e.graph,
|
|
2981
2981
|
i,
|
|
2982
2982
|
(n) => {
|
|
@@ -2988,7 +2988,7 @@ class Dt {
|
|
|
2988
2988
|
break;
|
|
2989
2989
|
}
|
|
2990
2990
|
case "topologyChangeMicrotask": {
|
|
2991
|
-
|
|
2991
|
+
W.configure(
|
|
2992
2992
|
e.graph,
|
|
2993
2993
|
i,
|
|
2994
2994
|
(n) => {
|
|
@@ -3033,36 +3033,36 @@ class ie {
|
|
|
3033
3033
|
new ie(e, t, s);
|
|
3034
3034
|
}
|
|
3035
3035
|
}
|
|
3036
|
-
const
|
|
3036
|
+
const Rt = () => {
|
|
3037
3037
|
const r = document.createElement("div");
|
|
3038
3038
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3039
3039
|
}, j = () => {
|
|
3040
3040
|
const r = document.createElement("div");
|
|
3041
3041
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3042
|
-
},
|
|
3042
|
+
}, fe = () => {
|
|
3043
3043
|
const r = j();
|
|
3044
3044
|
return r.style.pointerEvents = "none", r;
|
|
3045
3045
|
};
|
|
3046
|
-
class
|
|
3046
|
+
class Lt {
|
|
3047
3047
|
constructor(e) {
|
|
3048
3048
|
o(this, "background", j());
|
|
3049
3049
|
o(this, "main", j());
|
|
3050
|
-
o(this, "overlayConnectablePorts",
|
|
3051
|
-
o(this, "overlayDraggableEdges",
|
|
3052
|
-
o(this, "host",
|
|
3050
|
+
o(this, "overlayConnectablePorts", fe());
|
|
3051
|
+
o(this, "overlayDraggableEdges", fe());
|
|
3052
|
+
o(this, "host", Rt());
|
|
3053
3053
|
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);
|
|
3054
3054
|
}
|
|
3055
3055
|
destroy() {
|
|
3056
3056
|
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);
|
|
3057
3057
|
}
|
|
3058
3058
|
}
|
|
3059
|
-
const
|
|
3059
|
+
const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
3060
3060
|
let r = 0;
|
|
3061
3061
|
return () => r++;
|
|
3062
3062
|
}, Ft = (r, e) => {
|
|
3063
|
-
let t =
|
|
3063
|
+
let t = ye, s = ye;
|
|
3064
3064
|
const i = Vt();
|
|
3065
|
-
return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t =
|
|
3065
|
+
return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = q(r)), typeof e == "number" && (s = q(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
3066
3066
|
nodesPriorityFn: t,
|
|
3067
3067
|
edgesPriorityFn: s
|
|
3068
3068
|
};
|
|
@@ -3071,7 +3071,7 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
|
|
|
3071
3071
|
return r;
|
|
3072
3072
|
switch (r.type) {
|
|
3073
3073
|
case "straight":
|
|
3074
|
-
return () => new
|
|
3074
|
+
return () => new yt({
|
|
3075
3075
|
color: r.color,
|
|
3076
3076
|
width: r.width,
|
|
3077
3077
|
arrowLength: r.arrowLength,
|
|
@@ -3085,7 +3085,7 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
|
|
|
3085
3085
|
detourDirection: r.detourDirection
|
|
3086
3086
|
});
|
|
3087
3087
|
case "horizontal":
|
|
3088
|
-
return () => new
|
|
3088
|
+
return () => new ft({
|
|
3089
3089
|
color: r.color,
|
|
3090
3090
|
width: r.width,
|
|
3091
3091
|
arrowLength: r.arrowLength,
|
|
@@ -3111,7 +3111,7 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
|
|
|
3111
3111
|
detourDistance: r.detourDistance
|
|
3112
3112
|
});
|
|
3113
3113
|
case "direct":
|
|
3114
|
-
return () => new
|
|
3114
|
+
return () => new Re({
|
|
3115
3115
|
color: r.color,
|
|
3116
3116
|
width: r.width,
|
|
3117
3117
|
arrowLength: r.arrowLength,
|
|
@@ -3156,11 +3156,11 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
|
|
|
3156
3156
|
}
|
|
3157
3157
|
};
|
|
3158
3158
|
}, Bt = (r) => {
|
|
3159
|
-
var
|
|
3160
|
-
const e = ((
|
|
3161
|
-
}), t = ((
|
|
3159
|
+
var p, f, E, S, b, C;
|
|
3160
|
+
const e = ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? (() => {
|
|
3161
|
+
}), t = ((f = r.events) == null ? void 0 : f.onNodeDrag) ?? (() => {
|
|
3162
3162
|
}), s = r.nodeDragVerifier ?? (() => !0), i = ((E = r.events) == null ? void 0 : E.onNodeDragFinished) ?? (() => {
|
|
3163
|
-
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (S = r.mouse) == null ? void 0 : S.dragCursor, d = h !== void 0 ? h : "grab", c = (b = r.mouse) == null ? void 0 : b.mouseDownEventVerifier, g = c !== void 0 ? c : (P) => P.button === 0, l = (
|
|
3163
|
+
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (S = r.mouse) == null ? void 0 : S.dragCursor, d = h !== void 0 ? h : "grab", c = (b = r.mouse) == null ? void 0 : b.mouseDownEventVerifier, g = c !== void 0 ? c : (P) => P.button === 0, l = (C = r.mouse) == null ? void 0 : C.mouseUpEventVerifier, u = l !== void 0 ? l : (P) => P.button === 0;
|
|
3164
3164
|
return {
|
|
3165
3165
|
moveOnTop: n,
|
|
3166
3166
|
moveEdgesOnTop: a,
|
|
@@ -3230,17 +3230,17 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
|
|
|
3230
3230
|
});
|
|
3231
3231
|
}
|
|
3232
3232
|
}, ve = (r) => {
|
|
3233
|
-
var
|
|
3234
|
-
const e = (
|
|
3233
|
+
var f, E, S, b, C, P, L, V, ae, he, de, ce;
|
|
3234
|
+
const e = (f = r == null ? void 0 : r.scale) == null ? void 0 : f.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
3235
3235
|
let i;
|
|
3236
3236
|
s !== void 0 ? Array.isArray(s) ? i = Ot(
|
|
3237
3237
|
s.map(
|
|
3238
|
-
(
|
|
3238
|
+
(T) => me(T)
|
|
3239
3239
|
)
|
|
3240
|
-
) : i = me(s) : i = (
|
|
3240
|
+
) : i = me(s) : i = (T) => T.nextTransform;
|
|
3241
3241
|
const n = ((E = r == null ? void 0 : r.shift) == null ? void 0 : E.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onBeforeTransformChange) ?? (() => {
|
|
3242
3242
|
}), h = ((b = r == null ? void 0 : r.events) == null ? void 0 : b.onTransformChange) ?? (() => {
|
|
3243
|
-
}), d = (
|
|
3243
|
+
}), d = (C = r == null ? void 0 : r.shift) == null ? void 0 : C.mouseDownEventVerifier, c = d !== void 0 ? d : (T) => T.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (T) => T.button === 0, u = (L = r == null ? void 0 : r.scale) == null ? void 0 : L.mouseWheelEventVerifier, p = u !== void 0 ? u : () => !0;
|
|
3244
3244
|
return {
|
|
3245
3245
|
wheelSensitivity: t,
|
|
3246
3246
|
onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
|
|
@@ -3253,7 +3253,7 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
|
|
|
3253
3253
|
shiftCursor: n,
|
|
3254
3254
|
mouseDownEventVerifier: c,
|
|
3255
3255
|
mouseUpEventVerifier: l,
|
|
3256
|
-
mouseWheelEventVerifier:
|
|
3256
|
+
mouseWheelEventVerifier: p,
|
|
3257
3257
|
scaleWheelFinishTimeout: ((he = r == null ? void 0 : r.scale) == null ? void 0 : he.wheelFinishTimeout) ?? 500,
|
|
3258
3258
|
onResizeTransformStarted: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onResizeTransformStarted) ?? (() => {
|
|
3259
3259
|
}),
|
|
@@ -3297,8 +3297,8 @@ const K = (r) => () => r, fe = K(0), Vt = () => {
|
|
|
3297
3297
|
}, Xt = (r, e) => {
|
|
3298
3298
|
var c, g, l;
|
|
3299
3299
|
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, i = (u) => u.button === 0, n = (u) => {
|
|
3300
|
-
const
|
|
3301
|
-
return
|
|
3300
|
+
const p = e.getPortAdjacentEdgeIds(u);
|
|
3301
|
+
return p.length > 0 ? p[p.length - 1] : null;
|
|
3302
3302
|
}, a = () => {
|
|
3303
3303
|
}, h = () => {
|
|
3304
3304
|
}, d = () => {
|
|
@@ -3331,21 +3331,6 @@ class jt extends Error {
|
|
|
3331
3331
|
o(this, "name", "CanvasBuilderError");
|
|
3332
3332
|
}
|
|
3333
3333
|
}
|
|
3334
|
-
const v = Object.freeze({
|
|
3335
|
-
seed: "HTMLGraph is awesome",
|
|
3336
|
-
maxTimeDeltaSec: 0.01,
|
|
3337
|
-
nodeCharge: 1e5,
|
|
3338
|
-
nodeMass: 1,
|
|
3339
|
-
edgeEquilibriumLength: 300,
|
|
3340
|
-
edgeStiffness: 1e3,
|
|
3341
|
-
dtSec: 0.01,
|
|
3342
|
-
maxIterations: 1e3,
|
|
3343
|
-
convergenceVelocity: 10,
|
|
3344
|
-
maxForce: 1e7,
|
|
3345
|
-
nodeForceCoefficient: 1,
|
|
3346
|
-
barnesHutAreaRadiusThreshold: 0.01,
|
|
3347
|
-
barnesHutTheta: 1
|
|
3348
|
-
});
|
|
3349
3334
|
class Be {
|
|
3350
3335
|
constructor(e, t, s) {
|
|
3351
3336
|
o(this, "dt");
|
|
@@ -3379,8 +3364,8 @@ class Be {
|
|
|
3379
3364
|
const s = this.graph.getEdge(t), i = this.graph.getPort(s.from), n = this.graph.getPort(s.to), a = this.currentCoords.get(i.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
|
|
3380
3365
|
a,
|
|
3381
3366
|
h
|
|
3382
|
-
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g,
|
|
3383
|
-
|
|
3367
|
+
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, p = e.get(i.nodeId), f = e.get(n.nodeId);
|
|
3368
|
+
p.x += l, p.y += u, f.x -= l, f.y -= u;
|
|
3384
3369
|
});
|
|
3385
3370
|
}
|
|
3386
3371
|
}
|
|
@@ -3409,7 +3394,7 @@ const Ue = (r) => {
|
|
|
3409
3394
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
3410
3395
|
return Math.min(e, r.maxForce);
|
|
3411
3396
|
};
|
|
3412
|
-
class
|
|
3397
|
+
class qt {
|
|
3413
3398
|
constructor(e) {
|
|
3414
3399
|
o(this, "nodeCharge");
|
|
3415
3400
|
o(this, "distanceVectorGenerator");
|
|
@@ -3430,13 +3415,13 @@ class Kt {
|
|
|
3430
3415
|
targetCharge: this.nodeCharge,
|
|
3431
3416
|
distance: l.d,
|
|
3432
3417
|
maxForce: this.maxForce
|
|
3433
|
-
}),
|
|
3434
|
-
E.x -=
|
|
3418
|
+
}), p = u * l.ex, f = u * l.ey, E = t.get(a), S = t.get(d);
|
|
3419
|
+
E.x -= p, E.y -= f, S.x += p, S.y += f;
|
|
3435
3420
|
}
|
|
3436
3421
|
}
|
|
3437
3422
|
}
|
|
3438
3423
|
}
|
|
3439
|
-
const
|
|
3424
|
+
const Kt = (r) => {
|
|
3440
3425
|
if (r.size === 0)
|
|
3441
3426
|
return {
|
|
3442
3427
|
centerX: 0,
|
|
@@ -3454,7 +3439,7 @@ const Qt = (r) => {
|
|
|
3454
3439
|
radius: h / 2
|
|
3455
3440
|
};
|
|
3456
3441
|
};
|
|
3457
|
-
class
|
|
3442
|
+
class Qt {
|
|
3458
3443
|
constructor(e) {
|
|
3459
3444
|
o(this, "root");
|
|
3460
3445
|
o(this, "leaves", /* @__PURE__ */ new Map());
|
|
@@ -3509,8 +3494,8 @@ class Zt {
|
|
|
3509
3494
|
this.sortedParentNodes.push(e);
|
|
3510
3495
|
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = i / 2;
|
|
3511
3496
|
e.nodeIds.forEach((u) => {
|
|
3512
|
-
const { x:
|
|
3513
|
-
|
|
3497
|
+
const { x: p, y: f } = this.coords.get(u);
|
|
3498
|
+
p < t ? f < s ? d.add(u) : h.add(u) : f < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
|
|
3514
3499
|
});
|
|
3515
3500
|
const g = {
|
|
3516
3501
|
parent: e,
|
|
@@ -3611,7 +3596,7 @@ class Zt {
|
|
|
3611
3596
|
}), { x: t / e.size, y: s / e.size };
|
|
3612
3597
|
}
|
|
3613
3598
|
}
|
|
3614
|
-
class
|
|
3599
|
+
class Zt {
|
|
3615
3600
|
constructor(e) {
|
|
3616
3601
|
o(this, "areaRadiusThreshold");
|
|
3617
3602
|
o(this, "nodeMass");
|
|
@@ -3623,7 +3608,7 @@ class qt {
|
|
|
3623
3608
|
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;
|
|
3624
3609
|
}
|
|
3625
3610
|
apply(e, t) {
|
|
3626
|
-
const s =
|
|
3611
|
+
const s = Kt(e), i = new Qt({
|
|
3627
3612
|
box: s,
|
|
3628
3613
|
coords: e,
|
|
3629
3614
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
@@ -3773,7 +3758,7 @@ class qt {
|
|
|
3773
3758
|
}
|
|
3774
3759
|
}
|
|
3775
3760
|
}
|
|
3776
|
-
const Oe = (r) => r.theta !== 0 ? new
|
|
3761
|
+
const Oe = (r) => r.theta !== 0 ? new Zt({
|
|
3777
3762
|
nodeCharge: r.nodeCharge,
|
|
3778
3763
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3779
3764
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -3781,7 +3766,7 @@ const Oe = (r) => r.theta !== 0 ? new qt({
|
|
|
3781
3766
|
theta: r.theta,
|
|
3782
3767
|
nodeMass: r.nodeMass,
|
|
3783
3768
|
areaRadiusThreshold: r.areaRadiusThreshold
|
|
3784
|
-
}) : new
|
|
3769
|
+
}) : new qt({
|
|
3785
3770
|
nodeCharge: r.nodeCharge,
|
|
3786
3771
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3787
3772
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -3798,11 +3783,11 @@ class We {
|
|
|
3798
3783
|
x: g.x - l,
|
|
3799
3784
|
y: g.y - l
|
|
3800
3785
|
};
|
|
3801
|
-
return n.forEach((
|
|
3802
|
-
const
|
|
3803
|
-
i.set(
|
|
3804
|
-
x:
|
|
3805
|
-
y:
|
|
3786
|
+
return n.forEach((p) => {
|
|
3787
|
+
const f = t.getNode(p);
|
|
3788
|
+
i.set(p, {
|
|
3789
|
+
x: f.x ?? u.x + a * this.rand(),
|
|
3790
|
+
y: f.y ?? u.y + a * this.rand()
|
|
3806
3791
|
});
|
|
3807
3792
|
}), i;
|
|
3808
3793
|
}
|
|
@@ -3853,6 +3838,131 @@ class Jt {
|
|
|
3853
3838
|
}
|
|
3854
3839
|
}
|
|
3855
3840
|
class _t {
|
|
3841
|
+
constructor(e) {
|
|
3842
|
+
o(this, "forest", /* @__PURE__ */ new Set());
|
|
3843
|
+
o(this, "remainingNodeIds");
|
|
3844
|
+
for (this.graph = e, this.remainingNodeIds = new Set(this.graph.getAllNodeIds()); this.remainingNodeIds.size > 0; ) {
|
|
3845
|
+
const [t] = this.remainingNodeIds;
|
|
3846
|
+
this.traverse(t);
|
|
3847
|
+
}
|
|
3848
|
+
}
|
|
3849
|
+
generate() {
|
|
3850
|
+
return this.forest;
|
|
3851
|
+
}
|
|
3852
|
+
traverse(e) {
|
|
3853
|
+
const t = {
|
|
3854
|
+
nodeId: e,
|
|
3855
|
+
children: /* @__PURE__ */ new Set()
|
|
3856
|
+
}, s = [];
|
|
3857
|
+
this.forest.add({ root: t, sequence: s });
|
|
3858
|
+
let i = [t];
|
|
3859
|
+
for (; i.length > 0; ) {
|
|
3860
|
+
const n = [];
|
|
3861
|
+
i.forEach((a) => {
|
|
3862
|
+
s.push(a), this.remainingNodeIds.delete(a.nodeId);
|
|
3863
|
+
const h = this.graph.getNodeOutgoingEdgeIds(a.nodeId).map((g) => {
|
|
3864
|
+
const l = this.graph.getEdge(g);
|
|
3865
|
+
return this.graph.getPort(l.to).nodeId;
|
|
3866
|
+
}), d = this.graph.getNodeIncomingEdgeIds(a.nodeId).map((g) => {
|
|
3867
|
+
const l = this.graph.getEdge(g);
|
|
3868
|
+
return this.graph.getPort(l.from).nodeId;
|
|
3869
|
+
});
|
|
3870
|
+
[...h, ...d].forEach((g) => {
|
|
3871
|
+
if (!this.remainingNodeIds.has(g))
|
|
3872
|
+
return;
|
|
3873
|
+
const l = {
|
|
3874
|
+
nodeId: g,
|
|
3875
|
+
children: /* @__PURE__ */ new Set()
|
|
3876
|
+
};
|
|
3877
|
+
a.children.add(l), n.push(l);
|
|
3878
|
+
});
|
|
3879
|
+
}), i = n;
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
class er {
|
|
3884
|
+
constructor(e) {
|
|
3885
|
+
o(this, "baseRadius");
|
|
3886
|
+
this.baseRadius = e.radius;
|
|
3887
|
+
}
|
|
3888
|
+
resolve(e) {
|
|
3889
|
+
let t = 0, s = -1 / 0;
|
|
3890
|
+
const i = [];
|
|
3891
|
+
e.forEach((h) => {
|
|
3892
|
+
h === null ? (t += this.baseRadius, i.push(t), t += this.baseRadius) : t + this.baseRadius - h < s ? (s += h, i.push(s), t = s + this.baseRadius, s += h) : (t += this.baseRadius, i.push(t), s = t + h, t += this.baseRadius);
|
|
3893
|
+
});
|
|
3894
|
+
const n = t / 2;
|
|
3895
|
+
let a = 0;
|
|
3896
|
+
if (e.length > 0) {
|
|
3897
|
+
const h = e[e.length - 1] ?? 0, d = i[i.length - 1];
|
|
3898
|
+
a = Math.max(
|
|
3899
|
+
a,
|
|
3900
|
+
d + h - t
|
|
3901
|
+
);
|
|
3902
|
+
const c = e[0] ?? 0, g = i[0];
|
|
3903
|
+
a = Math.max(a, c - g);
|
|
3904
|
+
}
|
|
3905
|
+
return {
|
|
3906
|
+
offsets: i.map((h) => h - n),
|
|
3907
|
+
radius: n + a
|
|
3908
|
+
};
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3911
|
+
class tr {
|
|
3912
|
+
constructor(e, t) {
|
|
3913
|
+
o(this, "offsets", /* @__PURE__ */ new Map());
|
|
3914
|
+
o(this, "childrenRadii", /* @__PURE__ */ new Map());
|
|
3915
|
+
o(this, "layerNodePlacementResolver");
|
|
3916
|
+
this.tree = e, this.layerNodePlacementResolver = new er({
|
|
3917
|
+
radius: t.spaceAroundRadius
|
|
3918
|
+
}), [...this.tree.sequence].reverse().forEach((s) => {
|
|
3919
|
+
if (s.children.size === 0)
|
|
3920
|
+
this.childrenRadii.set(s.nodeId, null);
|
|
3921
|
+
else {
|
|
3922
|
+
const i = Array.from(s.children).map(
|
|
3923
|
+
(h) => this.childrenRadii.get(h.nodeId)
|
|
3924
|
+
), n = this.layerNodePlacementResolver.resolve(i);
|
|
3925
|
+
this.childrenRadii.set(s.nodeId, n.radius);
|
|
3926
|
+
let a = 0;
|
|
3927
|
+
s.children.forEach((h) => {
|
|
3928
|
+
this.offsets.set(h.nodeId, n.offsets[a]), a++;
|
|
3929
|
+
});
|
|
3930
|
+
}
|
|
3931
|
+
}), this.offsets.set(this.tree.root.nodeId, 0);
|
|
3932
|
+
}
|
|
3933
|
+
generate() {
|
|
3934
|
+
return this.offsets;
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
class rr {
|
|
3938
|
+
constructor(e) {
|
|
3939
|
+
this.params = e;
|
|
3940
|
+
}
|
|
3941
|
+
calculateCoordinates(e) {
|
|
3942
|
+
const t = /* @__PURE__ */ new Map(), i = new _t(e.graph).generate();
|
|
3943
|
+
let n = 0;
|
|
3944
|
+
return i.forEach((a) => {
|
|
3945
|
+
t.set(a.root.nodeId, { x: n, y: 0 });
|
|
3946
|
+
const d = new tr(a, {
|
|
3947
|
+
spaceAroundRadius: this.params.layerSpace / 2
|
|
3948
|
+
}).generate();
|
|
3949
|
+
let c = [a.root];
|
|
3950
|
+
for (; c.length > 0; ) {
|
|
3951
|
+
const g = [];
|
|
3952
|
+
n += this.params.layerWidth, c.forEach((l) => {
|
|
3953
|
+
l.children.forEach((u) => {
|
|
3954
|
+
const p = t.get(l.nodeId).y;
|
|
3955
|
+
t.set(u.nodeId, {
|
|
3956
|
+
y: p + d.get(u.nodeId),
|
|
3957
|
+
x: n
|
|
3958
|
+
}), g.push(u);
|
|
3959
|
+
});
|
|
3960
|
+
}), c = g;
|
|
3961
|
+
}
|
|
3962
|
+
}), t;
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
class sr {
|
|
3856
3966
|
constructor(e) {
|
|
3857
3967
|
o(this, "distanceVectorGenerator");
|
|
3858
3968
|
o(this, "nodeForcesApplicationStrategy");
|
|
@@ -3906,14 +4016,28 @@ const ze = (r) => {
|
|
|
3906
4016
|
r |= 0, e |= 0, t |= 0, s |= 0;
|
|
3907
4017
|
const i = (r + e | 0) + s | 0;
|
|
3908
4018
|
return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + i | 0, (i >>> 0) / 4294967296;
|
|
3909
|
-
},
|
|
4019
|
+
}, v = Object.freeze({
|
|
4020
|
+
seed: "HTMLGraph is awesome",
|
|
4021
|
+
maxTimeDeltaSec: 0.01,
|
|
4022
|
+
nodeCharge: 1e5,
|
|
4023
|
+
nodeMass: 1,
|
|
4024
|
+
edgeEquilibriumLength: 300,
|
|
4025
|
+
edgeStiffness: 1e3,
|
|
4026
|
+
dtSec: 0.01,
|
|
4027
|
+
maxIterations: 1e3,
|
|
4028
|
+
convergenceVelocity: 10,
|
|
4029
|
+
maxForce: 1e7,
|
|
4030
|
+
nodeForceCoefficient: 1,
|
|
4031
|
+
barnesHutAreaRadiusThreshold: 0.01,
|
|
4032
|
+
barnesHutTheta: 1
|
|
4033
|
+
}), or = (r) => {
|
|
3910
4034
|
var e, t;
|
|
3911
4035
|
switch (r == null ? void 0 : r.type) {
|
|
3912
4036
|
case "custom":
|
|
3913
4037
|
return r.instance;
|
|
3914
4038
|
default: {
|
|
3915
4039
|
const s = ze((r == null ? void 0 : r.seed) ?? v.seed), i = ke(s[0], s[1], s[2], s[3]);
|
|
3916
|
-
return new
|
|
4040
|
+
return new sr({
|
|
3917
4041
|
rand: i,
|
|
3918
4042
|
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? v.maxTimeDeltaSec,
|
|
3919
4043
|
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? v.nodeCharge,
|
|
@@ -3928,32 +4052,47 @@ const ze = (r) => {
|
|
|
3928
4052
|
});
|
|
3929
4053
|
}
|
|
3930
4054
|
}
|
|
3931
|
-
},
|
|
4055
|
+
}, G = {
|
|
3932
4056
|
staticNodeResolver: () => !1,
|
|
3933
4057
|
onBeforeApplied: () => {
|
|
3934
4058
|
},
|
|
3935
4059
|
onAfterApplied: () => {
|
|
3936
4060
|
}
|
|
3937
|
-
},
|
|
4061
|
+
}, ir = (r) => {
|
|
3938
4062
|
var t, s;
|
|
3939
4063
|
return {
|
|
3940
|
-
algorithm:
|
|
3941
|
-
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ??
|
|
3942
|
-
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ??
|
|
3943
|
-
onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ??
|
|
4064
|
+
algorithm: or((r == null ? void 0 : r.algorithm) ?? {}),
|
|
4065
|
+
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? G.staticNodeResolver,
|
|
4066
|
+
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? G.onBeforeApplied,
|
|
4067
|
+
onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ?? G.onAfterApplied
|
|
3944
4068
|
};
|
|
3945
|
-
},
|
|
4069
|
+
}, nr = (r) => r instanceof K ? {
|
|
3946
4070
|
type: "manual",
|
|
3947
4071
|
trigger: r
|
|
3948
4072
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
3949
4073
|
type: "topologyChangeMacrotask"
|
|
3950
4074
|
} : {
|
|
3951
4075
|
type: "topologyChangeMicrotask"
|
|
3952
|
-
},
|
|
4076
|
+
}, F = Object.freeze({
|
|
4077
|
+
staticNodeResolver: () => !1,
|
|
4078
|
+
onBeforeApplied: () => {
|
|
4079
|
+
},
|
|
4080
|
+
onAfterApplied: () => {
|
|
4081
|
+
},
|
|
4082
|
+
hierarchicalLayout: {
|
|
4083
|
+
layerWidth: 300,
|
|
4084
|
+
layerSpace: 300
|
|
4085
|
+
}
|
|
4086
|
+
}), ar = (r) => {
|
|
3953
4087
|
var e, t;
|
|
3954
4088
|
switch (r == null ? void 0 : r.type) {
|
|
3955
4089
|
case "custom":
|
|
3956
4090
|
return r.instance;
|
|
4091
|
+
case "hierarchical":
|
|
4092
|
+
return new rr({
|
|
4093
|
+
layerWidth: r.layerWidth ?? F.hierarchicalLayout.layerWidth,
|
|
4094
|
+
layerSpace: r.layerSpace ?? F.hierarchicalLayout.layerSpace
|
|
4095
|
+
});
|
|
3957
4096
|
default: {
|
|
3958
4097
|
const s = ze((r == null ? void 0 : r.seed) ?? v.seed), i = ke(s[0], s[1], s[2], s[3]);
|
|
3959
4098
|
return new Jt({
|
|
@@ -3972,22 +4111,16 @@ const ze = (r) => {
|
|
|
3972
4111
|
});
|
|
3973
4112
|
}
|
|
3974
4113
|
}
|
|
3975
|
-
},
|
|
3976
|
-
staticNodeResolver: () => !1,
|
|
3977
|
-
onBeforeApplied: () => {
|
|
3978
|
-
},
|
|
3979
|
-
onAfterApplied: () => {
|
|
3980
|
-
}
|
|
3981
|
-
}, or = (r) => {
|
|
4114
|
+
}, hr = (r) => {
|
|
3982
4115
|
var e, t;
|
|
3983
4116
|
return {
|
|
3984
|
-
algorithm:
|
|
3985
|
-
applyOn:
|
|
3986
|
-
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ??
|
|
3987
|
-
onBeforeApplied: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onBeforeApplied) ??
|
|
3988
|
-
onAfterApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onAfterApplied) ??
|
|
4117
|
+
algorithm: ar(r == null ? void 0 : r.algorithm),
|
|
4118
|
+
applyOn: nr(r == null ? void 0 : r.applyOn),
|
|
4119
|
+
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? F.staticNodeResolver,
|
|
4120
|
+
onBeforeApplied: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onBeforeApplied) ?? F.onBeforeApplied,
|
|
4121
|
+
onAfterApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onAfterApplied) ?? F.onAfterApplied
|
|
3989
4122
|
};
|
|
3990
|
-
},
|
|
4123
|
+
}, dr = (r, e) => ({
|
|
3991
4124
|
...r,
|
|
3992
4125
|
onNodeDragStarted: (t) => {
|
|
3993
4126
|
e.add(t), r.onNodeDragStarted(t);
|
|
@@ -3995,17 +4128,17 @@ const ze = (r) => {
|
|
|
3995
4128
|
onNodeDragFinished: (t) => {
|
|
3996
4129
|
e.delete(t), r.onNodeDragFinished(t);
|
|
3997
4130
|
}
|
|
3998
|
-
}),
|
|
4131
|
+
}), cr = (r, e) => {
|
|
3999
4132
|
r.onBeforeNodeRemoved.subscribe((t) => {
|
|
4000
4133
|
e.delete(t);
|
|
4001
4134
|
}), r.onBeforeClear.subscribe(() => {
|
|
4002
4135
|
e.clear();
|
|
4003
4136
|
});
|
|
4004
|
-
},
|
|
4137
|
+
}, lr = (r, e) => ({
|
|
4005
4138
|
...r,
|
|
4006
4139
|
staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
|
|
4007
4140
|
});
|
|
4008
|
-
class
|
|
4141
|
+
class pr {
|
|
4009
4142
|
constructor(e) {
|
|
4010
4143
|
o(this, "used", !1);
|
|
4011
4144
|
o(this, "canvasDefaults", {});
|
|
@@ -4025,7 +4158,7 @@ class cr {
|
|
|
4025
4158
|
o(this, "hasUserDraggableEdges", !1);
|
|
4026
4159
|
o(this, "hasAnimatedLayout", !1);
|
|
4027
4160
|
o(this, "hasLayout", !1);
|
|
4028
|
-
o(this, "boxRenderingTrigger", new
|
|
4161
|
+
o(this, "boxRenderingTrigger", new K());
|
|
4029
4162
|
o(this, "graphStore");
|
|
4030
4163
|
o(this, "viewportStore");
|
|
4031
4164
|
o(this, "graph");
|
|
@@ -4102,7 +4235,7 @@ class cr {
|
|
|
4102
4235
|
if (this.used)
|
|
4103
4236
|
throw new jt("CanvasBuilder is a single use object");
|
|
4104
4237
|
this.used = !0;
|
|
4105
|
-
const e = new
|
|
4238
|
+
const e = new Lt(this.element), t = this.createHtmlView(e.main), s = It(this.canvasDefaults), i = new Ee(
|
|
4106
4239
|
this.graph,
|
|
4107
4240
|
this.viewport,
|
|
4108
4241
|
this.graphStore,
|
|
@@ -4114,9 +4247,9 @@ class cr {
|
|
|
4114
4247
|
i,
|
|
4115
4248
|
kt(this.backgroundConfig),
|
|
4116
4249
|
e.background
|
|
4117
|
-
), this.hasNodeResizeReactiveEdges &&
|
|
4250
|
+
), this.hasNodeResizeReactiveEdges && Q.configure(i), this.hasDraggableNodes) {
|
|
4118
4251
|
let a = Bt(this.dragConfig);
|
|
4119
|
-
this.hasAnimatedLayout && (a =
|
|
4252
|
+
this.hasAnimatedLayout && (a = dr(
|
|
4120
4253
|
a,
|
|
4121
4254
|
this.animationStaticNodes
|
|
4122
4255
|
)), _.configure(
|
|
@@ -4160,22 +4293,22 @@ class cr {
|
|
|
4160
4293
|
ve(this.transformConfig),
|
|
4161
4294
|
this.boxRenderingTrigger,
|
|
4162
4295
|
Yt(this.virtualScrollConfig)
|
|
4163
|
-
) : this.hasTransformableViewport &&
|
|
4296
|
+
) : this.hasTransformableViewport && X.configure(
|
|
4164
4297
|
i,
|
|
4165
4298
|
e.main,
|
|
4166
4299
|
this.window,
|
|
4167
4300
|
ve(this.transformConfig)
|
|
4168
4301
|
), this.hasLayout && Dt.configure(
|
|
4169
4302
|
i,
|
|
4170
|
-
|
|
4303
|
+
hr(this.layoutConfig)
|
|
4171
4304
|
), this.hasAnimatedLayout) {
|
|
4172
|
-
let a =
|
|
4305
|
+
let a = ir(
|
|
4173
4306
|
this.animatedLayoutConfig
|
|
4174
4307
|
);
|
|
4175
|
-
this.hasDraggableNodes && (
|
|
4308
|
+
this.hasDraggableNodes && (cr(
|
|
4176
4309
|
i.graph,
|
|
4177
4310
|
this.animationStaticNodes
|
|
4178
|
-
), a =
|
|
4311
|
+
), a = lr(
|
|
4179
4312
|
a,
|
|
4180
4313
|
this.animationStaticNodes
|
|
4181
4314
|
)), ie.configure(i, a, this.window);
|
|
@@ -4191,26 +4324,26 @@ class cr {
|
|
|
4191
4324
|
this.viewportStore,
|
|
4192
4325
|
e
|
|
4193
4326
|
);
|
|
4194
|
-
return this.virtualScrollConfig !== void 0 && (t = new
|
|
4327
|
+
return this.virtualScrollConfig !== void 0 && (t = new Ke(
|
|
4195
4328
|
t,
|
|
4196
4329
|
this.graphStore,
|
|
4197
4330
|
this.boxRenderingTrigger,
|
|
4198
4331
|
Gt(this.virtualScrollConfig)
|
|
4199
|
-
)), new
|
|
4332
|
+
)), new Qe(t, this.graphStore);
|
|
4200
4333
|
}
|
|
4201
4334
|
}
|
|
4202
4335
|
export {
|
|
4203
4336
|
wt as BezierEdgeShape,
|
|
4204
|
-
|
|
4337
|
+
pr as CanvasBuilder,
|
|
4205
4338
|
jt as CanvasBuilderError,
|
|
4206
4339
|
A as CanvasError,
|
|
4207
4340
|
M as ConnectionCategory,
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4341
|
+
Re as DirectEdgeShape,
|
|
4342
|
+
K as EventSubject,
|
|
4343
|
+
ft as HorizontalEdgeShape,
|
|
4211
4344
|
Et as InteractiveEdgeError,
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4345
|
+
Le as InteractiveEdgeShape,
|
|
4346
|
+
ur as MidpointEdgeShape,
|
|
4347
|
+
yt as StraightEdgeShape,
|
|
4215
4348
|
mt as VerticalEdgeShape
|
|
4216
4349
|
};
|