@html-graph/html-graph 3.9.0 → 3.10.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.js +275 -273
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var r = (t, e, o) =>
|
|
4
|
-
const
|
|
1
|
+
var ye = Object.defineProperty;
|
|
2
|
+
var Ae = (t, e, o) => e in t ? ye(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
|
+
var r = (t, e, o) => Ae(t, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
+
const pe = () => {
|
|
5
5
|
const t = document.createElement("div");
|
|
6
6
|
return t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.width = "0", t.style.height = "0", t;
|
|
7
7
|
}, Ee = () => {
|
|
8
8
|
const t = document.createElement("div");
|
|
9
9
|
return t.style.width = "100%", t.style.height = "100%", t.style.position = "relative", t.style.overflow = "hidden", t;
|
|
10
|
-
},
|
|
10
|
+
}, xe = (t) => {
|
|
11
11
|
t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.visibility = "hidden";
|
|
12
12
|
}, N = (t, e) => ({
|
|
13
13
|
x: t.scale * e.x + t.x,
|
|
14
14
|
y: t.scale * e.y + t.y
|
|
15
15
|
});
|
|
16
|
-
class
|
|
16
|
+
class he {
|
|
17
17
|
constructor(e, o, i) {
|
|
18
18
|
r(this, "host", Ee());
|
|
19
|
-
r(this, "container",
|
|
19
|
+
r(this, "container", pe());
|
|
20
20
|
r(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
21
21
|
r(this, "applyTransform", () => {
|
|
22
22
|
const e = this.viewportStore.getContentMatrix();
|
|
@@ -26,7 +26,7 @@ class ne {
|
|
|
26
26
|
}
|
|
27
27
|
attachNode(e) {
|
|
28
28
|
const o = this.graphStore.getNode(e);
|
|
29
|
-
|
|
29
|
+
xe(o.element), this.container.appendChild(o.element), this.updateNodePosition(e), this.updateNodePriority(e), o.element.style.visibility = "visible";
|
|
30
30
|
}
|
|
31
31
|
detachNode(e) {
|
|
32
32
|
const o = this.graphStore.getNode(e);
|
|
@@ -100,7 +100,7 @@ class ne {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
class
|
|
103
|
+
class Se {
|
|
104
104
|
constructor(e) {
|
|
105
105
|
r(this, "xFrom", 1 / 0);
|
|
106
106
|
r(this, "yFrom", 1 / 0);
|
|
@@ -120,7 +120,7 @@ class xe {
|
|
|
120
120
|
return d <= this.xTo && c >= this.xFrom && a <= this.yTo && l >= this.yFrom;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
class
|
|
123
|
+
class be {
|
|
124
124
|
constructor(e, o, i) {
|
|
125
125
|
r(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
126
126
|
r(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -144,7 +144,7 @@ class Se {
|
|
|
144
144
|
this.handleAttachEdge(n);
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
|
-
this.htmlView = e, this.graphStore = o, this.trigger = i, this.renderingBox = new
|
|
147
|
+
this.htmlView = e, this.graphStore = o, this.trigger = i, this.renderingBox = new Se(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
148
148
|
}
|
|
149
149
|
attachNode(e) {
|
|
150
150
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -198,7 +198,7 @@ class Se {
|
|
|
198
198
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
class
|
|
201
|
+
class de {
|
|
202
202
|
constructor() {
|
|
203
203
|
r(this, "callbacks", /* @__PURE__ */ new Set());
|
|
204
204
|
}
|
|
@@ -215,10 +215,10 @@ class he {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
const x = () => {
|
|
218
|
-
const t = new
|
|
218
|
+
const t = new de();
|
|
219
219
|
return [t, t];
|
|
220
220
|
};
|
|
221
|
-
class
|
|
221
|
+
class Te {
|
|
222
222
|
constructor(e) {
|
|
223
223
|
r(this, "onBeforeUpdated");
|
|
224
224
|
r(this, "onAfterUpdated");
|
|
@@ -231,7 +231,7 @@ class be {
|
|
|
231
231
|
return { ...this.viewportStore.getContentMatrix() };
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
class
|
|
234
|
+
class Pe {
|
|
235
235
|
constructor(e) {
|
|
236
236
|
r(this, "onAfterNodeAdded");
|
|
237
237
|
r(this, "onAfterNodeUpdated");
|
|
@@ -348,7 +348,7 @@ class S extends Error {
|
|
|
348
348
|
r(this, "name", "HtmlGraphError");
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
class
|
|
351
|
+
class ce {
|
|
352
352
|
constructor(e, o, i, s, h) {
|
|
353
353
|
/**
|
|
354
354
|
* provides api for accessing model of rendered graph
|
|
@@ -416,7 +416,7 @@ class de {
|
|
|
416
416
|
* emits event just before destruction of canvas
|
|
417
417
|
*/
|
|
418
418
|
r(this, "onBeforeDestroy");
|
|
419
|
-
this.element = e, this.graphStore = o, this.viewportStore = i, this.htmlView = s, this.defaults = h, this.graph = new
|
|
419
|
+
this.element = e, this.graphStore = o, this.viewportStore = i, this.htmlView = s, this.defaults = h, this.graph = new Pe(this.graphStore), this.viewport = new Te(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
|
|
420
420
|
this.onAfterNodePriorityUpdated
|
|
421
421
|
), this.graphStore.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.subscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.subscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.subscribe(
|
|
422
422
|
this.onAfterEdgeShapeUpdated
|
|
@@ -571,7 +571,7 @@ class de {
|
|
|
571
571
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
class
|
|
574
|
+
class De {
|
|
575
575
|
constructor() {
|
|
576
576
|
r(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
577
577
|
r(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -611,7 +611,7 @@ class Pe {
|
|
|
611
611
|
return this.multiToSingleMap.get(e) !== void 0;
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
|
-
class
|
|
614
|
+
class ae {
|
|
615
615
|
constructor() {
|
|
616
616
|
r(this, "nodes", /* @__PURE__ */ new Map());
|
|
617
617
|
r(this, "ports", /* @__PURE__ */ new Map());
|
|
@@ -620,7 +620,7 @@ class ce {
|
|
|
620
620
|
r(this, "incomingEdges", /* @__PURE__ */ new Map());
|
|
621
621
|
r(this, "outcomingEdges", /* @__PURE__ */ new Map());
|
|
622
622
|
r(this, "cycleEdges", /* @__PURE__ */ new Map());
|
|
623
|
-
r(this, "elementPorts", new
|
|
623
|
+
r(this, "elementPorts", new De());
|
|
624
624
|
r(this, "afterNodeAddedEmitter");
|
|
625
625
|
r(this, "onAfterNodeAdded");
|
|
626
626
|
r(this, "afterNodeUpdatedEmitter");
|
|
@@ -793,19 +793,19 @@ class ce {
|
|
|
793
793
|
this.cycleEdges.get(i).delete(e), this.cycleEdges.get(s).delete(e), this.incomingEdges.get(i).delete(e), this.incomingEdges.get(s).delete(e), this.outcomingEdges.get(i).delete(e), this.outcomingEdges.get(s).delete(e), this.edges.delete(e);
|
|
794
794
|
}
|
|
795
795
|
}
|
|
796
|
-
const
|
|
796
|
+
const q = (t) => ({
|
|
797
797
|
scale: 1 / t.scale,
|
|
798
798
|
x: -t.x / t.scale,
|
|
799
799
|
y: -t.y / t.scale
|
|
800
|
-
}),
|
|
800
|
+
}), ee = {
|
|
801
801
|
scale: 1,
|
|
802
802
|
x: 0,
|
|
803
803
|
y: 0
|
|
804
804
|
};
|
|
805
|
-
class
|
|
805
|
+
class Ne {
|
|
806
806
|
constructor() {
|
|
807
|
-
r(this, "viewportMatrix",
|
|
808
|
-
r(this, "contentMatrix",
|
|
807
|
+
r(this, "viewportMatrix", ee);
|
|
808
|
+
r(this, "contentMatrix", ee);
|
|
809
809
|
r(this, "afterUpdateEmitter");
|
|
810
810
|
r(this, "onAfterUpdated");
|
|
811
811
|
r(this, "beforeUpdateEmitter");
|
|
@@ -823,14 +823,14 @@ class me {
|
|
|
823
823
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
824
824
|
x: e.x ?? this.viewportMatrix.x,
|
|
825
825
|
y: e.y ?? this.viewportMatrix.y
|
|
826
|
-
}, this.contentMatrix =
|
|
826
|
+
}, this.contentMatrix = q(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
827
827
|
}
|
|
828
828
|
patchContentMatrix(e) {
|
|
829
829
|
this.beforeUpdateEmitter.emit(), this.contentMatrix = {
|
|
830
830
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
831
831
|
x: e.x ?? this.contentMatrix.x,
|
|
832
832
|
y: e.y ?? this.contentMatrix.y
|
|
833
|
-
}, this.viewportMatrix =
|
|
833
|
+
}, this.viewportMatrix = q(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
836
|
class k {
|
|
@@ -866,11 +866,11 @@ class k {
|
|
|
866
866
|
this.canvas.updateNode(o);
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
|
-
const
|
|
870
|
-
var v, A, y,
|
|
869
|
+
const me = (t) => {
|
|
870
|
+
var v, A, y, p, E, b;
|
|
871
871
|
const e = ((v = t == null ? void 0 : t.events) == null ? void 0 : v.onNodeDrag) ?? (() => {
|
|
872
872
|
}), o = ((A = t == null ? void 0 : t.events) == null ? void 0 : A.onBeforeNodeDrag) ?? (() => !0), i = ((y = t == null ? void 0 : t.events) == null ? void 0 : y.onNodeDragFinished) ?? (() => {
|
|
873
|
-
}), s = (t == null ? void 0 : t.moveOnTop) !== !1, h = (t == null ? void 0 : t.moveEdgesOnTop) !== !1 && s, n = (
|
|
873
|
+
}), s = (t == null ? void 0 : t.moveOnTop) !== !1, h = (t == null ? void 0 : t.moveEdgesOnTop) !== !1 && s, n = (p = t == null ? void 0 : t.mouse) == null ? void 0 : p.dragCursor, d = n !== void 0 ? n : "grab", c = (E = t == null ? void 0 : t.mouse) == null ? void 0 : E.mouseDownEventVerifier, a = c !== void 0 ? c : (T) => T.button === 0, l = (b = t == null ? void 0 : t.mouse) == null ? void 0 : b.mouseUpEventVerifier;
|
|
874
874
|
return {
|
|
875
875
|
moveOnTop: s,
|
|
876
876
|
moveEdgesOnTop: h,
|
|
@@ -881,10 +881,10 @@ const Ne = (t) => {
|
|
|
881
881
|
onBeforeNodeDrag: o,
|
|
882
882
|
onNodeDragFinished: i
|
|
883
883
|
};
|
|
884
|
-
},
|
|
884
|
+
}, Me = (t, e, o) => {
|
|
885
885
|
const { x: i, y: s, width: h, height: n } = t.getBoundingClientRect();
|
|
886
886
|
return e >= i && e <= i + h && o >= s && o <= s + n;
|
|
887
|
-
},
|
|
887
|
+
}, Le = (t, e, o) => e >= 0 && e <= t.innerWidth && o >= 0 && o <= t.innerHeight, m = (t, e, o, i) => Me(e, o, i) && Le(t, o, i), B = (t, e) => {
|
|
888
888
|
e !== null ? t.style.cursor = e : t.style.removeProperty("cursor");
|
|
889
889
|
};
|
|
890
890
|
class z {
|
|
@@ -927,7 +927,7 @@ class z {
|
|
|
927
927
|
element: s.element,
|
|
928
928
|
x: s.x,
|
|
929
929
|
y: s.y
|
|
930
|
-
}) && (e.stopImmediatePropagation(), this.grabbedNodeId = i,
|
|
930
|
+
}) && (e.stopImmediatePropagation(), this.grabbedNodeId = i, B(this.element, this.config.dragCursor), this.moveNodeOnTop(i), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
931
931
|
passive: !0
|
|
932
932
|
}), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
933
933
|
passive: !0
|
|
@@ -955,7 +955,7 @@ class z {
|
|
|
955
955
|
}));
|
|
956
956
|
});
|
|
957
957
|
r(this, "onWindowMouseMove", (e) => {
|
|
958
|
-
if (!
|
|
958
|
+
if (!m(
|
|
959
959
|
this.window,
|
|
960
960
|
this.element,
|
|
961
961
|
e.clientX,
|
|
@@ -973,7 +973,7 @@ class z {
|
|
|
973
973
|
if (e.touches.length !== 1)
|
|
974
974
|
return;
|
|
975
975
|
const o = e.touches[0];
|
|
976
|
-
if (!
|
|
976
|
+
if (!m(
|
|
977
977
|
this.window,
|
|
978
978
|
this.element,
|
|
979
979
|
o.clientX,
|
|
@@ -994,7 +994,7 @@ class z {
|
|
|
994
994
|
this.previousTouchCoordinates = null, this.cancelTouchDrag();
|
|
995
995
|
});
|
|
996
996
|
r(this, "config");
|
|
997
|
-
this.canvas = e, this.element = o, this.window = i, this.config =
|
|
997
|
+
this.canvas = e, this.element = o, this.window = i, this.config = me(s), this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
998
998
|
}
|
|
999
999
|
static configure(e, o, i, s) {
|
|
1000
1000
|
new z(e, o, i, s);
|
|
@@ -1035,7 +1035,7 @@ class z {
|
|
|
1035
1035
|
element: e.element,
|
|
1036
1036
|
x: e.x,
|
|
1037
1037
|
y: e.y
|
|
1038
|
-
}), this.grabbedNodeId = null,
|
|
1038
|
+
}), this.grabbedNodeId = null, B(this.element, null), this.removeMouseDragListeners();
|
|
1039
1039
|
}
|
|
1040
1040
|
removeMouseDragListeners() {
|
|
1041
1041
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -1058,7 +1058,7 @@ class z {
|
|
|
1058
1058
|
this.maxNodePriority = Math.max(this.maxNodePriority, o);
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
|
-
const
|
|
1061
|
+
const Re = (t) => {
|
|
1062
1062
|
const e = t.minX !== null ? t.minX : -1 / 0, o = t.maxX !== null ? t.maxX : 1 / 0, i = t.minY !== null ? t.minY : -1 / 0, s = t.maxY !== null ? t.maxY : 1 / 0;
|
|
1063
1063
|
return (h) => {
|
|
1064
1064
|
let n = h.nextTransform.x, d = h.nextTransform.y;
|
|
@@ -1068,7 +1068,7 @@ const Le = (t) => {
|
|
|
1068
1068
|
const l = h.canvasHeight * h.prevTransform.scale, w = s - l;
|
|
1069
1069
|
return d > w && d > h.prevTransform.y && (d = Math.max(h.prevTransform.y, w)), { scale: h.nextTransform.scale, x: n, y: d };
|
|
1070
1070
|
};
|
|
1071
|
-
},
|
|
1071
|
+
}, Ie = (t) => {
|
|
1072
1072
|
const e = t.maxContentScale, o = t.minContentScale, i = e !== null ? 1 / e : 0, s = o !== null ? 1 / o : 1 / 0;
|
|
1073
1073
|
return (h) => {
|
|
1074
1074
|
const n = h.prevTransform, d = h.nextTransform;
|
|
@@ -1089,7 +1089,7 @@ const Le = (t) => {
|
|
|
1089
1089
|
y: l
|
|
1090
1090
|
};
|
|
1091
1091
|
};
|
|
1092
|
-
},
|
|
1092
|
+
}, Be = (t) => (e) => t.reduce(
|
|
1093
1093
|
(o, i) => i({
|
|
1094
1094
|
prevTransform: e.prevTransform,
|
|
1095
1095
|
nextTransform: o,
|
|
@@ -1097,40 +1097,40 @@ const Le = (t) => {
|
|
|
1097
1097
|
canvasHeight: e.canvasHeight
|
|
1098
1098
|
}),
|
|
1099
1099
|
e.nextTransform
|
|
1100
|
-
),
|
|
1100
|
+
), te = (t) => {
|
|
1101
1101
|
if (typeof t == "function")
|
|
1102
1102
|
return t;
|
|
1103
1103
|
switch (t.type) {
|
|
1104
1104
|
case "scale-limit":
|
|
1105
|
-
return
|
|
1105
|
+
return Ie({
|
|
1106
1106
|
minContentScale: t.minContentScale ?? 0,
|
|
1107
1107
|
maxContentScale: t.maxContentScale ?? 1 / 0
|
|
1108
1108
|
});
|
|
1109
1109
|
case "shift-limit":
|
|
1110
|
-
return
|
|
1110
|
+
return Re({
|
|
1111
1111
|
minX: t.minX ?? -1 / 0,
|
|
1112
1112
|
maxX: t.maxX ?? 1 / 0,
|
|
1113
1113
|
minY: t.minY ?? -1 / 0,
|
|
1114
1114
|
maxY: t.maxY ?? 1 / 0
|
|
1115
1115
|
});
|
|
1116
1116
|
}
|
|
1117
|
-
},
|
|
1118
|
-
var y,
|
|
1117
|
+
}, Ve = (t) => {
|
|
1118
|
+
var y, p, E, b, T, P, M, L, J, K, Q, _;
|
|
1119
1119
|
const e = (y = t == null ? void 0 : t.scale) == null ? void 0 : y.mouseWheelSensitivity, o = e !== void 0 ? e : 1.2, i = t == null ? void 0 : t.transformPreprocessor;
|
|
1120
1120
|
let s;
|
|
1121
|
-
i !== void 0 ? Array.isArray(i) ? s =
|
|
1121
|
+
i !== void 0 ? Array.isArray(i) ? s = Be(
|
|
1122
1122
|
i.map(
|
|
1123
|
-
(
|
|
1123
|
+
(D) => te(D)
|
|
1124
1124
|
)
|
|
1125
|
-
) : s =
|
|
1126
|
-
const h = ((
|
|
1125
|
+
) : s = te(i) : s = (D) => D.nextTransform;
|
|
1126
|
+
const h = ((p = t == null ? void 0 : t.shift) == null ? void 0 : p.cursor) !== void 0 ? t.shift.cursor : "grab", n = ((E = t == null ? void 0 : t.events) == null ? void 0 : E.onBeforeTransformChange) ?? (() => {
|
|
1127
1127
|
}), d = ((b = t == null ? void 0 : t.events) == null ? void 0 : b.onTransformChange) ?? (() => {
|
|
1128
|
-
}), c = (T = t == null ? void 0 : t.shift) == null ? void 0 : T.mouseDownEventVerifier, a = c !== void 0 ? c : (
|
|
1128
|
+
}), c = (T = t == null ? void 0 : t.shift) == null ? void 0 : T.mouseDownEventVerifier, a = c !== void 0 ? c : (D) => D.button === 0, l = (P = t == null ? void 0 : t.shift) == null ? void 0 : P.mouseUpEventVerifier, w = l !== void 0 ? l : (D) => D.button === 0, v = (M = t == null ? void 0 : t.scale) == null ? void 0 : M.mouseWheelEventVerifier, A = v !== void 0 ? v : () => !0;
|
|
1129
1129
|
return {
|
|
1130
1130
|
wheelSensitivity: o,
|
|
1131
1131
|
onTransformStarted: ((L = t == null ? void 0 : t.events) == null ? void 0 : L.onTransformStarted) ?? (() => {
|
|
1132
1132
|
}),
|
|
1133
|
-
onTransformFinished: ((
|
|
1133
|
+
onTransformFinished: ((J = t == null ? void 0 : t.events) == null ? void 0 : J.onTransformFinished) ?? (() => {
|
|
1134
1134
|
}),
|
|
1135
1135
|
onBeforeTransformChange: n,
|
|
1136
1136
|
onTransformChange: d,
|
|
@@ -1139,21 +1139,21 @@ const Le = (t) => {
|
|
|
1139
1139
|
mouseDownEventVerifier: a,
|
|
1140
1140
|
mouseUpEventVerifier: w,
|
|
1141
1141
|
mouseWheelEventVerifier: A,
|
|
1142
|
-
scaleWheelFinishTimeout: ((
|
|
1143
|
-
onResizeTransformStarted: ((
|
|
1142
|
+
scaleWheelFinishTimeout: ((K = t == null ? void 0 : t.scale) == null ? void 0 : K.wheelFinishTimeout) ?? 500,
|
|
1143
|
+
onResizeTransformStarted: ((Q = t == null ? void 0 : t.events) == null ? void 0 : Q.onResizeTransformStarted) ?? (() => {
|
|
1144
1144
|
}),
|
|
1145
|
-
onResizeTransformFinished: ((
|
|
1145
|
+
onResizeTransformFinished: ((_ = t == null ? void 0 : t.events) == null ? void 0 : _.onResizeTransformFinished) ?? (() => {
|
|
1146
1146
|
})
|
|
1147
1147
|
};
|
|
1148
|
-
},
|
|
1148
|
+
}, Ue = (t, e, o) => ({
|
|
1149
1149
|
scale: t.scale,
|
|
1150
1150
|
x: t.x + t.scale * e,
|
|
1151
1151
|
y: t.y + t.scale * o
|
|
1152
|
-
}),
|
|
1152
|
+
}), Ce = (t, e, o, i) => ({
|
|
1153
1153
|
scale: t.scale * e,
|
|
1154
1154
|
x: t.scale * (1 - e) * o + t.x,
|
|
1155
1155
|
y: t.scale * (1 - e) * i + t.y
|
|
1156
|
-
}),
|
|
1156
|
+
}), I = (t) => {
|
|
1157
1157
|
const e = [], o = t.touches.length;
|
|
1158
1158
|
for (let d = 0; d < o; d++)
|
|
1159
1159
|
e.push([t.touches[d].clientX, t.touches[d].clientY]);
|
|
@@ -1182,14 +1182,14 @@ class U {
|
|
|
1182
1182
|
this.removeMouseDragListeners(), this.removeTouchDragListeners(), this.observer.unobserve(this.element), this.element.removeEventListener("mousedown", this.onMouseDown), this.element.removeEventListener("wheel", this.onWheelScroll), this.element.removeEventListener("touchstart", this.onTouchStart), this.element.removeEventListener("wheel", this.preventWheelScaleListener), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
1183
1183
|
});
|
|
1184
1184
|
r(this, "onMouseDown", (e) => {
|
|
1185
|
-
this.element === null || !this.config.mouseDownEventVerifier(e) || (
|
|
1185
|
+
this.element === null || !this.config.mouseDownEventVerifier(e) || (B(this.element, this.config.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
1186
1186
|
passive: !0
|
|
1187
1187
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
1188
1188
|
passive: !0
|
|
1189
1189
|
}), this.startRegisteredTransform());
|
|
1190
1190
|
});
|
|
1191
1191
|
r(this, "onWindowMouseMove", (e) => {
|
|
1192
|
-
const o =
|
|
1192
|
+
const o = m(
|
|
1193
1193
|
this.window,
|
|
1194
1194
|
this.element,
|
|
1195
1195
|
e.clientX,
|
|
@@ -1215,10 +1215,10 @@ class U {
|
|
|
1215
1215
|
});
|
|
1216
1216
|
r(this, "onTouchStart", (e) => {
|
|
1217
1217
|
if (this.prevTouches !== null) {
|
|
1218
|
-
this.prevTouches =
|
|
1218
|
+
this.prevTouches = I(e);
|
|
1219
1219
|
return;
|
|
1220
1220
|
}
|
|
1221
|
-
this.prevTouches =
|
|
1221
|
+
this.prevTouches = I(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
1222
1222
|
passive: !0
|
|
1223
1223
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
1224
1224
|
passive: !0
|
|
@@ -1227,9 +1227,9 @@ class U {
|
|
|
1227
1227
|
}), this.startRegisteredTransform();
|
|
1228
1228
|
});
|
|
1229
1229
|
r(this, "onWindowTouchMove", (e) => {
|
|
1230
|
-
const o =
|
|
1230
|
+
const o = I(e);
|
|
1231
1231
|
if (!o.touches.every(
|
|
1232
|
-
(s) =>
|
|
1232
|
+
(s) => m(this.window, this.element, s[0], s[1])
|
|
1233
1233
|
)) {
|
|
1234
1234
|
this.stopTouchDrag();
|
|
1235
1235
|
return;
|
|
@@ -1244,7 +1244,7 @@ class U {
|
|
|
1244
1244
|
this.prevTouches = o;
|
|
1245
1245
|
});
|
|
1246
1246
|
r(this, "onWindowTouchFinish", (e) => {
|
|
1247
|
-
e.touches.length > 0 ? this.prevTouches =
|
|
1247
|
+
e.touches.length > 0 ? this.prevTouches = I(e) : this.stopTouchDrag();
|
|
1248
1248
|
});
|
|
1249
1249
|
r(this, "observer", new ResizeObserver(() => {
|
|
1250
1250
|
const e = this.viewport.getViewportMatrix(), { width: o, height: i } = this.element.getBoundingClientRect(), s = this.config.transformPreprocessor({
|
|
@@ -1261,7 +1261,7 @@ class U {
|
|
|
1261
1261
|
});
|
|
1262
1262
|
this.canvas = e, this.element = o, this.window = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
|
|
1263
1263
|
passive: !1
|
|
1264
|
-
}), this.config =
|
|
1264
|
+
}), this.config = Ve(s), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
|
|
1265
1265
|
passive: !0
|
|
1266
1266
|
}), this.element.addEventListener("wheel", this.onWheelScroll, {
|
|
1267
1267
|
passive: !0
|
|
@@ -1278,7 +1278,7 @@ class U {
|
|
|
1278
1278
|
);
|
|
1279
1279
|
}
|
|
1280
1280
|
moveViewport(e, o) {
|
|
1281
|
-
const i = this.viewport.getViewportMatrix(), s =
|
|
1281
|
+
const i = this.viewport.getViewportMatrix(), s = Ue(i, e, o), { width: h, height: n } = this.element.getBoundingClientRect(), d = this.config.transformPreprocessor({
|
|
1282
1282
|
prevTransform: i,
|
|
1283
1283
|
nextTransform: s,
|
|
1284
1284
|
canvasWidth: h,
|
|
@@ -1287,7 +1287,7 @@ class U {
|
|
|
1287
1287
|
this.performTransform(d);
|
|
1288
1288
|
}
|
|
1289
1289
|
scaleViewport(e, o, i) {
|
|
1290
|
-
const s = this.canvas.viewport.getViewportMatrix(), h =
|
|
1290
|
+
const s = this.canvas.viewport.getViewportMatrix(), h = Ce(s, e, o, i), { width: n, height: d } = this.element.getBoundingClientRect(), c = this.config.transformPreprocessor({
|
|
1291
1291
|
prevTransform: s,
|
|
1292
1292
|
nextTransform: h,
|
|
1293
1293
|
canvasWidth: n,
|
|
@@ -1296,7 +1296,7 @@ class U {
|
|
|
1296
1296
|
this.performTransform(c);
|
|
1297
1297
|
}
|
|
1298
1298
|
stopMouseDrag() {
|
|
1299
|
-
|
|
1299
|
+
B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
1300
1300
|
}
|
|
1301
1301
|
removeMouseDragListeners() {
|
|
1302
1302
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -1349,15 +1349,15 @@ class X {
|
|
|
1349
1349
|
this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
|
|
1350
1350
|
});
|
|
1351
1351
|
r(this, "userTransformInProgress", !1);
|
|
1352
|
-
var A, y,
|
|
1352
|
+
var A, y, p, E, b;
|
|
1353
1353
|
this.canvas = e, this.element = o, this.window = i, this.trigger = h, this.virtualScrollOptions = n, this.nodeHorizontal = this.virtualScrollOptions.nodeContainingRadius.horizontal, this.nodeVertical = this.virtualScrollOptions.nodeContainingRadius.vertical, this.canvasResizeObserver = new ResizeObserver((T) => {
|
|
1354
1354
|
const P = T[0];
|
|
1355
1355
|
this.viewportWidth = P.contentRect.width, this.viewportHeight = P.contentRect.height, this.scheduleLoadAreaAroundViewport();
|
|
1356
1356
|
}), this.viewport = e.viewport;
|
|
1357
1357
|
const d = ((A = s == null ? void 0 : s.events) == null ? void 0 : A.onResizeTransformStarted) ?? (() => {
|
|
1358
1358
|
}), c = ((y = s == null ? void 0 : s.events) == null ? void 0 : y.onResizeTransformFinished) ?? (() => {
|
|
1359
|
-
}), a = ((
|
|
1360
|
-
}), l = ((
|
|
1359
|
+
}), a = ((p = s == null ? void 0 : s.events) == null ? void 0 : p.onTransformChange) ?? (() => {
|
|
1360
|
+
}), l = ((E = s == null ? void 0 : s.events) == null ? void 0 : E.onBeforeTransformChange) ?? (() => {
|
|
1361
1361
|
}), w = ((b = s == null ? void 0 : s.events) == null ? void 0 : b.onTransformFinished) ?? (() => {
|
|
1362
1362
|
}), v = {
|
|
1363
1363
|
...s,
|
|
@@ -1413,29 +1413,29 @@ class X {
|
|
|
1413
1413
|
this.trigger.emit({ x: i, y: s, width: h, height: n });
|
|
1414
1414
|
}
|
|
1415
1415
|
}
|
|
1416
|
-
const
|
|
1416
|
+
const We = () => {
|
|
1417
1417
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1418
1418
|
return t.style.position = "absolute", t.style.inset = "0", t;
|
|
1419
|
-
},
|
|
1419
|
+
}, $e = () => {
|
|
1420
1420
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
1421
1421
|
return t.setAttribute("fill", "url(#pattern)"), t;
|
|
1422
|
-
},
|
|
1422
|
+
}, Fe = () => {
|
|
1423
1423
|
const t = document.createElementNS(
|
|
1424
1424
|
"http://www.w3.org/2000/svg",
|
|
1425
1425
|
"pattern"
|
|
1426
1426
|
);
|
|
1427
1427
|
return t.setAttribute("id", "pattern"), t;
|
|
1428
|
-
},
|
|
1428
|
+
}, Oe = (t, e) => {
|
|
1429
1429
|
const o = document.createElementNS(
|
|
1430
1430
|
"http://www.w3.org/2000/svg",
|
|
1431
1431
|
"circle"
|
|
1432
1432
|
);
|
|
1433
1433
|
return o.setAttribute("cx", "0"), o.setAttribute("cy", "0"), o.setAttribute("r", `${t}`), o.setAttribute("fill", `${e}`), o;
|
|
1434
|
-
},
|
|
1434
|
+
}, ke = (t) => t instanceof SVGElement ? t : Oe(
|
|
1435
1435
|
(t == null ? void 0 : t.radius) ?? 1.5,
|
|
1436
1436
|
(t == null ? void 0 : t.color) ?? "#d8d8d8"
|
|
1437
|
-
),
|
|
1438
|
-
const e = t.tileDimensions, o = (e == null ? void 0 : e.width) ?? 25, i = (e == null ? void 0 : e.height) ?? 25, s =
|
|
1437
|
+
), ze = (t) => {
|
|
1438
|
+
const e = t.tileDimensions, o = (e == null ? void 0 : e.width) ?? 25, i = (e == null ? void 0 : e.height) ?? 25, s = ke(t.renderer ?? {});
|
|
1439
1439
|
return {
|
|
1440
1440
|
tileWidth: o,
|
|
1441
1441
|
tileHeight: i,
|
|
@@ -1445,9 +1445,9 @@ const Ce = () => {
|
|
|
1445
1445
|
};
|
|
1446
1446
|
class Y {
|
|
1447
1447
|
constructor(e, o, i) {
|
|
1448
|
-
r(this, "svg",
|
|
1449
|
-
r(this, "patternRenderingRectangle",
|
|
1450
|
-
r(this, "pattern",
|
|
1448
|
+
r(this, "svg", We());
|
|
1449
|
+
r(this, "patternRenderingRectangle", $e());
|
|
1450
|
+
r(this, "pattern", Fe());
|
|
1451
1451
|
r(this, "patternContent");
|
|
1452
1452
|
r(this, "tileWidth");
|
|
1453
1453
|
r(this, "tileHeight");
|
|
@@ -1471,7 +1471,7 @@ class Y {
|
|
|
1471
1471
|
), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
1472
1472
|
});
|
|
1473
1473
|
this.canvas = e, this.host = i;
|
|
1474
|
-
const s =
|
|
1474
|
+
const s = ze(o);
|
|
1475
1475
|
this.tileWidth = s.tileWidth, this.tileHeight = s.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = s.renderer, this.maxViewportScale = s.maxViewportScale;
|
|
1476
1476
|
const h = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
1477
1477
|
this.patternContent.setAttribute("transform", h), this.pattern.appendChild(this.patternContent);
|
|
@@ -1486,7 +1486,7 @@ class Y {
|
|
|
1486
1486
|
o && this.visible ? (this.visible = !1, this.host.removeChild(this.svg)) : !o && !this.visible && (this.visible = !0, this.host.appendChild(this.svg));
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
|
-
const
|
|
1489
|
+
const Xe = (t) => {
|
|
1490
1490
|
var d, c, a;
|
|
1491
1491
|
const e = () => "direct", o = (l) => l, i = (l) => l.button === 0, s = () => {
|
|
1492
1492
|
}, h = () => {
|
|
@@ -1528,7 +1528,7 @@ class H {
|
|
|
1528
1528
|
}));
|
|
1529
1529
|
});
|
|
1530
1530
|
r(this, "onWindowMouseMove", (e) => {
|
|
1531
|
-
if (!
|
|
1531
|
+
if (!m(
|
|
1532
1532
|
this.window,
|
|
1533
1533
|
this.overlayLayer,
|
|
1534
1534
|
e.clientX,
|
|
@@ -1558,7 +1558,7 @@ class H {
|
|
|
1558
1558
|
});
|
|
1559
1559
|
r(this, "onWindowTouchMove", (e) => {
|
|
1560
1560
|
const o = e.touches[0];
|
|
1561
|
-
if (!
|
|
1561
|
+
if (!m(
|
|
1562
1562
|
this.window,
|
|
1563
1563
|
this.overlayLayer,
|
|
1564
1564
|
o.clientX,
|
|
@@ -1587,13 +1587,13 @@ class H {
|
|
|
1587
1587
|
r(this, "onEdgeCreated", (e) => {
|
|
1588
1588
|
this.config.onAfterEdgeCreated(e);
|
|
1589
1589
|
});
|
|
1590
|
-
this.canvas = e, this.overlayLayer = o, this.viewportStore = i, this.window = s, this.config =
|
|
1591
|
-
const d = new
|
|
1590
|
+
this.canvas = e, this.overlayLayer = o, this.viewportStore = i, this.window = s, this.config = Xe(n);
|
|
1591
|
+
const d = new ae(), c = new he(
|
|
1592
1592
|
d,
|
|
1593
1593
|
this.viewportStore,
|
|
1594
1594
|
this.overlayLayer
|
|
1595
1595
|
);
|
|
1596
|
-
this.overlayCanvas = new
|
|
1596
|
+
this.overlayCanvas = new ce(
|
|
1597
1597
|
this.overlayLayer,
|
|
1598
1598
|
d,
|
|
1599
1599
|
this.viewportStore,
|
|
@@ -1630,8 +1630,8 @@ class H {
|
|
|
1630
1630
|
portDirection: this.config.dragPortDirection
|
|
1631
1631
|
};
|
|
1632
1632
|
this.isDirect = h === "direct";
|
|
1633
|
-
const
|
|
1634
|
-
this.createOverlayGraph(
|
|
1633
|
+
const p = this.isDirect ? A : y, E = this.isDirect ? y : A;
|
|
1634
|
+
this.createOverlayGraph(p, E);
|
|
1635
1635
|
}
|
|
1636
1636
|
hookPortEvents(e) {
|
|
1637
1637
|
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
@@ -1716,34 +1716,34 @@ class H {
|
|
|
1716
1716
|
return this.config.connectionTypeResolver(o) !== null;
|
|
1717
1717
|
}
|
|
1718
1718
|
}
|
|
1719
|
-
const
|
|
1719
|
+
const Ye = () => {
|
|
1720
1720
|
const t = document.createElement("div");
|
|
1721
1721
|
return t.style.width = "100%", t.style.height = "100%", t.style.position = "relative", t;
|
|
1722
1722
|
}, $ = () => {
|
|
1723
1723
|
const t = document.createElement("div");
|
|
1724
1724
|
return t.style.position = "absolute", t.style.inset = "0", t;
|
|
1725
1725
|
};
|
|
1726
|
-
class
|
|
1726
|
+
class He {
|
|
1727
1727
|
constructor(e) {
|
|
1728
1728
|
r(this, "background", $());
|
|
1729
1729
|
r(this, "main", $());
|
|
1730
1730
|
r(this, "overlay", $());
|
|
1731
|
-
r(this, "host",
|
|
1731
|
+
r(this, "host", Ye());
|
|
1732
1732
|
this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.overlay.style.pointerEvents = "none", this.host.appendChild(this.overlay);
|
|
1733
1733
|
}
|
|
1734
1734
|
destroy() {
|
|
1735
1735
|
this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlay), this.element.removeChild(this.host);
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
1738
|
-
const
|
|
1738
|
+
const je = (t, e) => ({
|
|
1739
1739
|
x: t / 2,
|
|
1740
1740
|
y: e / 2
|
|
1741
|
-
}), F = (t) => () => t,
|
|
1741
|
+
}), F = (t) => () => t, oe = F(0), Ge = () => {
|
|
1742
1742
|
let t = 0;
|
|
1743
1743
|
return () => t++;
|
|
1744
|
-
},
|
|
1745
|
-
let o =
|
|
1746
|
-
const s =
|
|
1744
|
+
}, Ze = (t, e) => {
|
|
1745
|
+
let o = oe, i = oe;
|
|
1746
|
+
const s = Ge();
|
|
1747
1747
|
return t === "incremental" && (o = s), e === "incremental" && (i = s), typeof t == "number" && (o = F(t)), typeof e == "number" && (i = F(e)), typeof t == "function" && (o = t), typeof e == "function" && (i = e), {
|
|
1748
1748
|
nodesPriorityFn: o,
|
|
1749
1749
|
edgesPriorityFn: i
|
|
@@ -1754,67 +1754,67 @@ const He = (t, e) => ({
|
|
|
1754
1754
|
}), g = {
|
|
1755
1755
|
x: 0,
|
|
1756
1756
|
y: 0
|
|
1757
|
-
},
|
|
1757
|
+
}, Je = (t) => {
|
|
1758
1758
|
const e = f(
|
|
1759
1759
|
{ x: t.arrowLength, y: g.y },
|
|
1760
|
-
t.
|
|
1760
|
+
t.sourceDirection,
|
|
1761
1761
|
g
|
|
1762
1762
|
), o = f(
|
|
1763
1763
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
1764
|
-
t.
|
|
1764
|
+
t.targetDirection,
|
|
1765
1765
|
t.to
|
|
1766
1766
|
), i = {
|
|
1767
|
-
x: e.x + t.
|
|
1768
|
-
y: e.y + t.
|
|
1767
|
+
x: e.x + t.sourceDirection.x * t.curvature,
|
|
1768
|
+
y: e.y + t.sourceDirection.y * t.curvature
|
|
1769
1769
|
}, s = {
|
|
1770
|
-
x: o.x - t.
|
|
1771
|
-
y: o.y - t.
|
|
1770
|
+
x: o.x - t.targetDirection.x * t.curvature,
|
|
1771
|
+
y: o.y - t.targetDirection.y * t.curvature
|
|
1772
1772
|
}, h = `M ${e.x} ${e.y} C ${i.x} ${i.y}, ${s.x} ${s.y}, ${o.x} ${o.y}`, n = t.hasSourceArrow ? "" : `M ${g.x} ${g.y} L ${e.x} ${e.y} `, d = t.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${t.to.x} ${t.to.y}`;
|
|
1773
1773
|
return `${n}${h}${d}`;
|
|
1774
|
-
},
|
|
1774
|
+
}, Ke = (t) => {
|
|
1775
1775
|
const e = t.hasSourceArrow ? f(
|
|
1776
1776
|
{ x: t.arrowLength, y: g.y },
|
|
1777
|
-
t.
|
|
1777
|
+
t.sourceDirection,
|
|
1778
1778
|
g
|
|
1779
1779
|
) : g, o = t.hasTargetArrow ? f(
|
|
1780
1780
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
1781
|
-
t.
|
|
1781
|
+
t.targetDirection,
|
|
1782
1782
|
t.to
|
|
1783
1783
|
) : t.to, i = t.arrowLength, s = Math.cos(t.detourDirection) * t.detourDistance, h = Math.sin(t.detourDirection) * t.detourDistance, n = s * t.flipX, d = h * t.flipY, c = f(
|
|
1784
1784
|
{ x: i, y: g.y },
|
|
1785
|
-
t.
|
|
1785
|
+
t.sourceDirection,
|
|
1786
1786
|
g
|
|
1787
1787
|
), a = {
|
|
1788
1788
|
x: c.x + n,
|
|
1789
1789
|
y: c.y + d
|
|
1790
1790
|
}, l = f(
|
|
1791
1791
|
{ x: t.to.x - i, y: t.to.y },
|
|
1792
|
-
t.
|
|
1792
|
+
t.targetDirection,
|
|
1793
1793
|
t.to
|
|
1794
1794
|
), w = {
|
|
1795
1795
|
x: l.x + n,
|
|
1796
1796
|
y: l.y + d
|
|
1797
1797
|
}, v = { x: (a.x + w.x) / 2, y: (a.y + w.y) / 2 }, A = {
|
|
1798
|
-
x: c.x + t.curvature * t.
|
|
1799
|
-
y: c.y + t.curvature * t.
|
|
1798
|
+
x: c.x + t.curvature * t.sourceDirection.x,
|
|
1799
|
+
y: c.y + t.curvature * t.sourceDirection.y
|
|
1800
1800
|
}, y = {
|
|
1801
|
-
x: l.x - t.curvature * t.
|
|
1802
|
-
y: l.y - t.curvature * t.
|
|
1803
|
-
},
|
|
1801
|
+
x: l.x - t.curvature * t.targetDirection.x,
|
|
1802
|
+
y: l.y - t.curvature * t.targetDirection.y
|
|
1803
|
+
}, p = {
|
|
1804
1804
|
x: c.x + n,
|
|
1805
1805
|
y: c.y + d
|
|
1806
|
-
},
|
|
1806
|
+
}, E = {
|
|
1807
1807
|
x: l.x + n,
|
|
1808
1808
|
y: l.y + d
|
|
1809
1809
|
};
|
|
1810
1810
|
return [
|
|
1811
1811
|
`M ${e.x} ${e.y}`,
|
|
1812
1812
|
`L ${c.x} ${c.y}`,
|
|
1813
|
-
`C ${A.x} ${A.y} ${
|
|
1814
|
-
`C ${
|
|
1813
|
+
`C ${A.x} ${A.y} ${p.x} ${p.y} ${v.x} ${v.y}`,
|
|
1814
|
+
`C ${E.x} ${E.y} ${y.x} ${y.y} ${l.x} ${l.y}`,
|
|
1815
1815
|
`L ${o.x} ${o.y}`
|
|
1816
1816
|
].join(" ");
|
|
1817
|
-
},
|
|
1817
|
+
}, R = (t, e) => {
|
|
1818
1818
|
const o = [];
|
|
1819
1819
|
if (t.length > 0 && o.push(`M ${t[0].x} ${t[0].y}`), t.length === 2 && o.push(`L ${t[1].x} ${t[1].y}`), t.length > 2) {
|
|
1820
1820
|
const i = t.length - 1;
|
|
@@ -1826,29 +1826,29 @@ const He = (t, e) => ({
|
|
|
1826
1826
|
const L = t[c + 1];
|
|
1827
1827
|
s = L.x - d.x, h = L.y - d.y, n = Math.sqrt(s * s + h * h);
|
|
1828
1828
|
}
|
|
1829
|
-
const
|
|
1829
|
+
const E = n !== 0 ? Math.min((y ? e : 0) / n, c < i - 1 ? 0.5 : 1) : 0, b = y ? { x: d.x + s * E, y: d.y + h * E } : d, P = w !== 0 ? Math.min((y ? e : 0) / w, c > 1 ? 0.5 : 1) : 0, M = y ? { x: d.x + a * P, y: d.y + l * P } : d;
|
|
1830
1830
|
c > 0 && o.push(`L ${M.x} ${M.y}`), y && o.push(
|
|
1831
1831
|
`C ${d.x} ${d.y} ${d.x} ${d.y} ${b.x} ${b.y}`
|
|
1832
1832
|
);
|
|
1833
1833
|
});
|
|
1834
1834
|
}
|
|
1835
1835
|
return o.join(" ");
|
|
1836
|
-
},
|
|
1836
|
+
}, Qe = (t) => {
|
|
1837
1837
|
const e = t.hasSourceArrow ? f(
|
|
1838
1838
|
{ x: t.arrowLength, y: g.y },
|
|
1839
|
-
t.
|
|
1839
|
+
t.sourceDirection,
|
|
1840
1840
|
g
|
|
1841
1841
|
) : g, o = t.hasTargetArrow ? f(
|
|
1842
1842
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
1843
|
-
t.
|
|
1843
|
+
t.targetDirection,
|
|
1844
1844
|
t.to
|
|
1845
1845
|
) : t.to, i = t.arrowLength + t.arrowOffset, s = i - t.roundness, h = f(
|
|
1846
1846
|
{ x: s, y: g.y },
|
|
1847
|
-
t.
|
|
1847
|
+
t.sourceDirection,
|
|
1848
1848
|
g
|
|
1849
1849
|
), n = f(
|
|
1850
1850
|
{ x: t.to.x - s, y: t.to.y },
|
|
1851
|
-
t.
|
|
1851
|
+
t.targetDirection,
|
|
1852
1852
|
t.to
|
|
1853
1853
|
), d = Math.max((h.x + n.x) / 2, i), c = t.to.y / 2, a = {
|
|
1854
1854
|
x: t.flipX > 0 ? d : -i,
|
|
@@ -1857,67 +1857,67 @@ const He = (t, e) => ({
|
|
|
1857
1857
|
x: t.flipX > 0 ? t.to.x - d : t.to.x + i,
|
|
1858
1858
|
y: n.y
|
|
1859
1859
|
}, v = { x: w.x, y: c };
|
|
1860
|
-
return
|
|
1860
|
+
return R(
|
|
1861
1861
|
[e, h, a, l, v, w, n, o],
|
|
1862
1862
|
t.roundness
|
|
1863
1863
|
);
|
|
1864
1864
|
}, j = (t) => {
|
|
1865
1865
|
const e = t.hasSourceArrow ? f(
|
|
1866
1866
|
{ x: t.arrowLength, y: g.y },
|
|
1867
|
-
t.
|
|
1867
|
+
t.sourceDirection,
|
|
1868
1868
|
g
|
|
1869
1869
|
) : g, o = t.hasTargetArrow ? f(
|
|
1870
1870
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
1871
|
-
t.
|
|
1871
|
+
t.targetDirection,
|
|
1872
1872
|
t.to
|
|
1873
1873
|
) : t.to, i = t.arrowLength + t.arrowOffset, s = f(
|
|
1874
1874
|
{ x: i, y: g.y },
|
|
1875
|
-
t.
|
|
1875
|
+
t.sourceDirection,
|
|
1876
1876
|
g
|
|
1877
1877
|
), h = Math.cos(t.detourDirection) * t.detourDistance, n = Math.sin(t.detourDirection) * t.detourDistance, d = h * t.flipX, c = n * t.flipY, a = { x: s.x + d, y: s.y + c }, l = f(
|
|
1878
1878
|
{ x: t.to.x - i, y: t.to.y },
|
|
1879
|
-
t.
|
|
1879
|
+
t.targetDirection,
|
|
1880
1880
|
t.to
|
|
1881
1881
|
), w = { x: l.x + d, y: l.y + c };
|
|
1882
|
-
return
|
|
1882
|
+
return R(
|
|
1883
1883
|
[e, s, a, w, l, o],
|
|
1884
1884
|
t.roundness
|
|
1885
1885
|
);
|
|
1886
|
-
},
|
|
1886
|
+
}, _e = (t) => {
|
|
1887
1887
|
const e = t.hasSourceArrow ? f(
|
|
1888
1888
|
{ x: t.arrowLength, y: g.y },
|
|
1889
|
-
t.
|
|
1889
|
+
t.sourceDirection,
|
|
1890
1890
|
g
|
|
1891
1891
|
) : g, o = t.hasTargetArrow ? f(
|
|
1892
1892
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
1893
|
-
t.
|
|
1893
|
+
t.targetDirection,
|
|
1894
1894
|
t.to
|
|
1895
1895
|
) : t.to, i = t.arrowLength + t.arrowOffset, s = f(
|
|
1896
1896
|
{ x: i, y: g.y },
|
|
1897
|
-
t.
|
|
1897
|
+
t.sourceDirection,
|
|
1898
1898
|
g
|
|
1899
1899
|
), h = f(
|
|
1900
1900
|
{ x: t.to.x - i, y: t.to.y },
|
|
1901
|
-
t.
|
|
1901
|
+
t.targetDirection,
|
|
1902
1902
|
t.to
|
|
1903
1903
|
);
|
|
1904
|
-
return
|
|
1905
|
-
},
|
|
1904
|
+
return R([e, s, h, o], t.roundness);
|
|
1905
|
+
}, qe = (t) => {
|
|
1906
1906
|
const e = t.hasSourceArrow ? f(
|
|
1907
1907
|
{ x: t.arrowLength, y: g.y },
|
|
1908
|
-
t.
|
|
1908
|
+
t.sourceDirection,
|
|
1909
1909
|
g
|
|
1910
1910
|
) : g, o = t.hasTargetArrow ? f(
|
|
1911
1911
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
1912
|
-
t.
|
|
1912
|
+
t.targetDirection,
|
|
1913
1913
|
t.to
|
|
1914
1914
|
) : t.to, i = t.arrowLength + t.arrowOffset, s = i - t.roundness, h = f(
|
|
1915
1915
|
{ x: s, y: g.y },
|
|
1916
|
-
t.
|
|
1916
|
+
t.sourceDirection,
|
|
1917
1917
|
g
|
|
1918
1918
|
), n = f(
|
|
1919
1919
|
{ x: t.to.x - s, y: t.to.y },
|
|
1920
|
-
t.
|
|
1920
|
+
t.targetDirection,
|
|
1921
1921
|
t.to
|
|
1922
1922
|
), d = Math.max((h.y + n.y) / 2, i), c = t.to.x / 2, a = {
|
|
1923
1923
|
x: h.x,
|
|
@@ -1926,7 +1926,7 @@ const He = (t, e) => ({
|
|
|
1926
1926
|
x: n.x,
|
|
1927
1927
|
y: t.flipY > 0 ? t.to.y - d : t.to.y + i
|
|
1928
1928
|
}, v = { x: c, y: w.y };
|
|
1929
|
-
return
|
|
1929
|
+
return R(
|
|
1930
1930
|
[e, h, a, l, v, w, n, o],
|
|
1931
1931
|
t.roundness
|
|
1932
1932
|
);
|
|
@@ -1941,16 +1941,16 @@ const He = (t, e) => ({
|
|
|
1941
1941
|
{ x: i, y: g.y },
|
|
1942
1942
|
{ x: t.arrowLength, y: g.y }
|
|
1943
1943
|
].map(
|
|
1944
|
-
(c) => f(c, t.
|
|
1944
|
+
(c) => f(c, t.sourceDirection, g)
|
|
1945
1945
|
), d = `M ${g.x} ${g.y} L ${n[0].x} ${n[0].y} `;
|
|
1946
|
-
return `${t.hasSourceArrow || t.hasTargetArrow ? "" : d}${
|
|
1947
|
-
},
|
|
1946
|
+
return `${t.hasSourceArrow || t.hasTargetArrow ? "" : d}${R(n, t.roundness)}`;
|
|
1947
|
+
}, et = (t) => {
|
|
1948
1948
|
const e = t.smallRadius, o = t.radius, i = Math.sqrt(e * e + o * o), s = e + o, h = t.arrowLength + i * (1 - o / s), n = e * o / s, c = [
|
|
1949
1949
|
{ x: t.arrowLength, y: g.y },
|
|
1950
1950
|
{ x: h, y: n },
|
|
1951
1951
|
{ x: h, y: -n }
|
|
1952
1952
|
].map(
|
|
1953
|
-
(w) => f(w, t.
|
|
1953
|
+
(w) => f(w, t.sourceDirection, g)
|
|
1954
1954
|
), a = [
|
|
1955
1955
|
`M ${c[0].x} ${c[0].y}`,
|
|
1956
1956
|
`A ${e} ${e} 0 0 1 ${c[1].x} ${c[1].y}`,
|
|
@@ -1958,8 +1958,45 @@ const He = (t, e) => ({
|
|
|
1958
1958
|
`A ${e} ${e} 0 0 1 ${c[0].x} ${c[0].y}`
|
|
1959
1959
|
].join(" "), l = `M 0 0 L ${c[0].x} ${c[0].y} `;
|
|
1960
1960
|
return `${t.hasSourceArrow || t.hasTargetArrow ? "" : l}${a}`;
|
|
1961
|
-
},
|
|
1961
|
+
}, le = (t, e) => {
|
|
1962
1962
|
t.style.transform = `translate(${e.x}px, ${e.y}px)`, t.style.width = `${Math.max(e.width, 1)}px`, t.style.height = `${Math.max(e.height, 1)}px`;
|
|
1963
|
+
}, Z = Object.freeze({
|
|
1964
|
+
edgeColor: "--edge-color"
|
|
1965
|
+
}), ue = (t) => {
|
|
1966
|
+
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1967
|
+
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, t), e;
|
|
1968
|
+
}, V = () => {
|
|
1969
|
+
const t = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1970
|
+
return t.setAttribute("fill", `var(${Z.edgeColor})`), t;
|
|
1971
|
+
}, ge = () => {
|
|
1972
|
+
const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1973
|
+
return t.style.transformOrigin = "50% 50%", t;
|
|
1974
|
+
}, we = (t) => {
|
|
1975
|
+
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1976
|
+
return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${t}`), e.setAttribute("fill", "none"), e;
|
|
1977
|
+
}, fe = (t, e) => {
|
|
1978
|
+
const o = {
|
|
1979
|
+
x: t.x + t.width / 2,
|
|
1980
|
+
y: t.y + t.height / 2
|
|
1981
|
+
}, i = {
|
|
1982
|
+
x: e.x + e.width / 2,
|
|
1983
|
+
y: e.y + e.height / 2
|
|
1984
|
+
}, s = Math.min(o.x, i.x), h = Math.min(o.y, i.y), n = Math.abs(i.x - o.x), d = Math.abs(i.y - o.y), c = o.x <= i.x ? 1 : -1, a = o.y <= i.y ? 1 : -1;
|
|
1985
|
+
return {
|
|
1986
|
+
x: s,
|
|
1987
|
+
y: h,
|
|
1988
|
+
width: n,
|
|
1989
|
+
height: d,
|
|
1990
|
+
flipX: c,
|
|
1991
|
+
flipY: a
|
|
1992
|
+
};
|
|
1993
|
+
}, O = (t, e, o, i) => {
|
|
1994
|
+
const h = [
|
|
1995
|
+
g,
|
|
1996
|
+
{ x: o, y: i },
|
|
1997
|
+
{ x: o, y: -i }
|
|
1998
|
+
].map((a) => f(a, t, g)).map((a) => ({ x: a.x + e.x, y: a.y + e.y })), n = `M ${h[0].x} ${h[0].y}`, d = `L ${h[1].x} ${h[1].y}`, c = `L ${h[2].x} ${h[2].y}`;
|
|
1999
|
+
return `${n} ${d} ${c} Z`;
|
|
1963
2000
|
}, u = Object.freeze({
|
|
1964
2001
|
color: "#777777",
|
|
1965
2002
|
width: 1,
|
|
@@ -1978,62 +2015,27 @@ const He = (t, e) => ({
|
|
|
1978
2015
|
curvature: 90,
|
|
1979
2016
|
interactiveWidth: 10,
|
|
1980
2017
|
preOffset: 0
|
|
1981
|
-
}),
|
|
1982
|
-
const h = [
|
|
1983
|
-
g,
|
|
1984
|
-
{ x: o, y: i },
|
|
1985
|
-
{ x: o, y: -i }
|
|
1986
|
-
].map((a) => f(a, t, g)).map((a) => ({ x: a.x + e.x, y: a.y + e.y })), n = `M ${h[0].x} ${h[0].y}`, d = `L ${h[1].x} ${h[1].y}`, c = `L ${h[2].x} ${h[2].y}`;
|
|
1987
|
-
return `${n} ${d} ${c} Z`;
|
|
1988
|
-
}, B = (t) => {
|
|
1989
|
-
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1990
|
-
return e.setAttribute("fill", t), e;
|
|
1991
|
-
}, le = () => {
|
|
1992
|
-
const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1993
|
-
return t.style.transformOrigin = "50% 50%", t;
|
|
1994
|
-
}, ue = (t, e) => {
|
|
1995
|
-
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1996
|
-
return o.setAttribute("stroke", t), o.setAttribute("stroke-width", `${e}`), o.setAttribute("fill", "none"), o;
|
|
1997
|
-
}, ge = (t, e) => {
|
|
1998
|
-
const o = {
|
|
1999
|
-
x: t.x + t.width / 2,
|
|
2000
|
-
y: t.y + t.height / 2
|
|
2001
|
-
}, i = {
|
|
2002
|
-
x: e.x + e.width / 2,
|
|
2003
|
-
y: e.y + e.height / 2
|
|
2004
|
-
}, s = Math.min(o.x, i.x), h = Math.min(o.y, i.y), n = Math.abs(i.x - o.x), d = Math.abs(i.y - o.y), c = o.x <= i.x ? 1 : -1, a = o.y <= i.y ? 1 : -1;
|
|
2005
|
-
return {
|
|
2006
|
-
x: s,
|
|
2007
|
-
y: h,
|
|
2008
|
-
width: n,
|
|
2009
|
-
height: d,
|
|
2010
|
-
flipX: c,
|
|
2011
|
-
flipY: a
|
|
2012
|
-
};
|
|
2013
|
-
}, we = () => {
|
|
2014
|
-
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2015
|
-
return t.style.pointerEvents = "none", t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.overflow = "visible", t;
|
|
2016
|
-
}, oe = (t, e, o) => ({ x: e * Math.cos(t), y: o * Math.sin(t) });
|
|
2018
|
+
}), re = (t, e, o) => ({ x: e * Math.cos(t), y: o * Math.sin(t) });
|
|
2017
2019
|
class C {
|
|
2018
2020
|
constructor(e) {
|
|
2019
|
-
r(this, "svg"
|
|
2020
|
-
r(this, "group",
|
|
2021
|
+
r(this, "svg");
|
|
2022
|
+
r(this, "group", ge());
|
|
2021
2023
|
r(this, "line");
|
|
2022
2024
|
r(this, "sourceArrow", null);
|
|
2023
2025
|
r(this, "targetArrow", null);
|
|
2024
|
-
this.params = e, this.svg.appendChild(this.group), this.line =
|
|
2026
|
+
this.params = e, this.svg = ue(e.color), this.svg.appendChild(this.group), this.line = we(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
|
|
2025
2027
|
}
|
|
2026
2028
|
render(e) {
|
|
2027
|
-
const { x: o, y: i, width: s, height: h, flipX: n, flipY: d } =
|
|
2029
|
+
const { x: o, y: i, width: s, height: h, flipX: n, flipY: d } = fe(
|
|
2028
2030
|
e.from,
|
|
2029
2031
|
e.to
|
|
2030
2032
|
);
|
|
2031
|
-
|
|
2032
|
-
const c =
|
|
2033
|
+
le(this.svg, { x: o, y: i, width: s, height: h }), this.group.style.transform = `scale(${n}, ${d})`;
|
|
2034
|
+
const c = re(
|
|
2033
2035
|
e.from.direction,
|
|
2034
2036
|
n,
|
|
2035
2037
|
d
|
|
2036
|
-
), a =
|
|
2038
|
+
), a = re(
|
|
2037
2039
|
e.to.direction,
|
|
2038
2040
|
n,
|
|
2039
2041
|
d
|
|
@@ -2051,26 +2053,26 @@ class C {
|
|
|
2051
2053
|
d
|
|
2052
2054
|
);
|
|
2053
2055
|
if (this.line.setAttribute("d", y), this.sourceArrow) {
|
|
2054
|
-
const
|
|
2056
|
+
const p = O(
|
|
2055
2057
|
c,
|
|
2056
2058
|
g,
|
|
2057
2059
|
this.params.arrowLength,
|
|
2058
2060
|
this.params.arrowWidth
|
|
2059
2061
|
);
|
|
2060
|
-
this.sourceArrow.setAttribute("d",
|
|
2062
|
+
this.sourceArrow.setAttribute("d", p);
|
|
2061
2063
|
}
|
|
2062
2064
|
if (this.targetArrow) {
|
|
2063
|
-
const
|
|
2065
|
+
const p = O(
|
|
2064
2066
|
w,
|
|
2065
2067
|
l,
|
|
2066
2068
|
v,
|
|
2067
2069
|
this.params.arrowWidth
|
|
2068
2070
|
);
|
|
2069
|
-
this.targetArrow.setAttribute("d",
|
|
2071
|
+
this.targetArrow.setAttribute("d", p);
|
|
2070
2072
|
}
|
|
2071
2073
|
}
|
|
2072
2074
|
}
|
|
2073
|
-
class
|
|
2075
|
+
class tt {
|
|
2074
2076
|
constructor(e) {
|
|
2075
2077
|
r(this, "svg");
|
|
2076
2078
|
r(this, "group");
|
|
@@ -2087,18 +2089,18 @@ class et {
|
|
|
2087
2089
|
r(this, "hasSourceArrow");
|
|
2088
2090
|
r(this, "hasTargetArrow");
|
|
2089
2091
|
r(this, "lineShape");
|
|
2090
|
-
r(this, "createCyclePath", (e) =>
|
|
2091
|
-
|
|
2092
|
+
r(this, "createCyclePath", (e) => et({
|
|
2093
|
+
sourceDirection: e,
|
|
2092
2094
|
radius: this.portCycleRadius,
|
|
2093
2095
|
smallRadius: this.portCycleSmallRadius,
|
|
2094
2096
|
arrowLength: this.arrowLength,
|
|
2095
2097
|
hasSourceArrow: this.hasSourceArrow,
|
|
2096
2098
|
hasTargetArrow: this.hasTargetArrow
|
|
2097
2099
|
}));
|
|
2098
|
-
r(this, "createDetourPath", (e, o, i, s, h) =>
|
|
2100
|
+
r(this, "createDetourPath", (e, o, i, s, h) => Ke({
|
|
2099
2101
|
to: i,
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
+
sourceDirection: e,
|
|
2103
|
+
targetDirection: o,
|
|
2102
2104
|
flipX: s,
|
|
2103
2105
|
flipY: h,
|
|
2104
2106
|
arrowLength: this.arrowLength,
|
|
@@ -2108,10 +2110,10 @@ class et {
|
|
|
2108
2110
|
hasSourceArrow: this.hasSourceArrow,
|
|
2109
2111
|
hasTargetArrow: this.hasTargetArrow
|
|
2110
2112
|
}));
|
|
2111
|
-
r(this, "createLinePath", (e, o, i) =>
|
|
2113
|
+
r(this, "createLinePath", (e, o, i) => Je({
|
|
2112
2114
|
to: i,
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
+
sourceDirection: e,
|
|
2116
|
+
targetDirection: o,
|
|
2115
2117
|
arrowLength: this.arrowLength,
|
|
2116
2118
|
curvature: this.curvature,
|
|
2117
2119
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -2133,7 +2135,7 @@ class et {
|
|
|
2133
2135
|
this.lineShape.render(e);
|
|
2134
2136
|
}
|
|
2135
2137
|
}
|
|
2136
|
-
class
|
|
2138
|
+
class ot {
|
|
2137
2139
|
constructor(e) {
|
|
2138
2140
|
r(this, "svg");
|
|
2139
2141
|
r(this, "group");
|
|
@@ -2151,7 +2153,7 @@ class tt {
|
|
|
2151
2153
|
r(this, "hasTargetArrow");
|
|
2152
2154
|
r(this, "lineShape");
|
|
2153
2155
|
r(this, "createCyclePath", (e) => G({
|
|
2154
|
-
|
|
2156
|
+
sourceDirection: e,
|
|
2155
2157
|
arrowLength: this.arrowLength,
|
|
2156
2158
|
side: this.cycleSquareSide,
|
|
2157
2159
|
arrowOffset: this.arrowOffset,
|
|
@@ -2161,8 +2163,8 @@ class tt {
|
|
|
2161
2163
|
}));
|
|
2162
2164
|
r(this, "createDetourPath", (e, o, i, s, h) => j({
|
|
2163
2165
|
to: i,
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
+
sourceDirection: e,
|
|
2167
|
+
targetDirection: o,
|
|
2166
2168
|
flipX: s,
|
|
2167
2169
|
flipY: h,
|
|
2168
2170
|
arrowLength: this.arrowLength,
|
|
@@ -2173,10 +2175,10 @@ class tt {
|
|
|
2173
2175
|
hasSourceArrow: this.hasSourceArrow,
|
|
2174
2176
|
hasTargetArrow: this.hasTargetArrow
|
|
2175
2177
|
}));
|
|
2176
|
-
r(this, "createLinePath", (e, o, i, s) =>
|
|
2178
|
+
r(this, "createLinePath", (e, o, i, s) => Qe({
|
|
2177
2179
|
to: i,
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
+
sourceDirection: e,
|
|
2181
|
+
targetDirection: o,
|
|
2180
2182
|
flipX: s,
|
|
2181
2183
|
arrowLength: this.arrowLength,
|
|
2182
2184
|
arrowOffset: this.arrowOffset,
|
|
@@ -2206,7 +2208,7 @@ class tt {
|
|
|
2206
2208
|
this.lineShape.render(e);
|
|
2207
2209
|
}
|
|
2208
2210
|
}
|
|
2209
|
-
class
|
|
2211
|
+
class rt {
|
|
2210
2212
|
constructor(e) {
|
|
2211
2213
|
r(this, "svg");
|
|
2212
2214
|
r(this, "group");
|
|
@@ -2224,7 +2226,7 @@ class ot {
|
|
|
2224
2226
|
r(this, "hasTargetArrow");
|
|
2225
2227
|
r(this, "lineShape");
|
|
2226
2228
|
r(this, "createCyclePath", (e) => G({
|
|
2227
|
-
|
|
2229
|
+
sourceDirection: e,
|
|
2228
2230
|
arrowLength: this.arrowLength,
|
|
2229
2231
|
side: this.cycleSquareSide,
|
|
2230
2232
|
arrowOffset: this.arrowOffset,
|
|
@@ -2234,8 +2236,8 @@ class ot {
|
|
|
2234
2236
|
}));
|
|
2235
2237
|
r(this, "createDetourPath", (e, o, i, s, h) => j({
|
|
2236
2238
|
to: i,
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
+
sourceDirection: e,
|
|
2240
|
+
targetDirection: o,
|
|
2239
2241
|
flipX: s,
|
|
2240
2242
|
flipY: h,
|
|
2241
2243
|
arrowLength: this.arrowLength,
|
|
@@ -2246,10 +2248,10 @@ class ot {
|
|
|
2246
2248
|
hasSourceArrow: this.hasSourceArrow,
|
|
2247
2249
|
hasTargetArrow: this.hasTargetArrow
|
|
2248
2250
|
}));
|
|
2249
|
-
r(this, "createLinePath", (e, o, i) =>
|
|
2251
|
+
r(this, "createLinePath", (e, o, i) => _e({
|
|
2250
2252
|
to: i,
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
+
sourceDirection: e,
|
|
2254
|
+
targetDirection: o,
|
|
2253
2255
|
arrowLength: this.arrowLength,
|
|
2254
2256
|
arrowOffset: this.arrowOffset,
|
|
2255
2257
|
roundness: this.roundness,
|
|
@@ -2278,7 +2280,7 @@ class ot {
|
|
|
2278
2280
|
this.lineShape.render(e);
|
|
2279
2281
|
}
|
|
2280
2282
|
}
|
|
2281
|
-
class
|
|
2283
|
+
class it {
|
|
2282
2284
|
constructor(e) {
|
|
2283
2285
|
r(this, "svg");
|
|
2284
2286
|
r(this, "group");
|
|
@@ -2296,7 +2298,7 @@ class rt {
|
|
|
2296
2298
|
r(this, "hasTargetArrow");
|
|
2297
2299
|
r(this, "lineShape");
|
|
2298
2300
|
r(this, "createCyclePath", (e) => G({
|
|
2299
|
-
|
|
2301
|
+
sourceDirection: e,
|
|
2300
2302
|
arrowLength: this.arrowLength,
|
|
2301
2303
|
side: this.cycleSquareSide,
|
|
2302
2304
|
arrowOffset: this.arrowOffset,
|
|
@@ -2306,8 +2308,8 @@ class rt {
|
|
|
2306
2308
|
}));
|
|
2307
2309
|
r(this, "createDetourPath", (e, o, i, s, h) => j({
|
|
2308
2310
|
to: i,
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
+
sourceDirection: e,
|
|
2312
|
+
targetDirection: o,
|
|
2311
2313
|
flipX: s,
|
|
2312
2314
|
flipY: h,
|
|
2313
2315
|
arrowLength: this.arrowLength,
|
|
@@ -2318,10 +2320,10 @@ class rt {
|
|
|
2318
2320
|
hasSourceArrow: this.hasSourceArrow,
|
|
2319
2321
|
hasTargetArrow: this.hasTargetArrow
|
|
2320
2322
|
}));
|
|
2321
|
-
r(this, "createLinePath", (e, o, i, s, h) =>
|
|
2323
|
+
r(this, "createLinePath", (e, o, i, s, h) => qe({
|
|
2322
2324
|
to: i,
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
+
sourceDirection: e,
|
|
2326
|
+
targetDirection: o,
|
|
2325
2327
|
flipY: h,
|
|
2326
2328
|
arrowLength: this.arrowLength,
|
|
2327
2329
|
arrowOffset: this.arrowOffset,
|
|
@@ -2351,7 +2353,7 @@ class rt {
|
|
|
2351
2353
|
this.lineShape.render(e);
|
|
2352
2354
|
}
|
|
2353
2355
|
}
|
|
2354
|
-
const
|
|
2356
|
+
const ie = (t) => {
|
|
2355
2357
|
if (t.diagonalDistance === 0)
|
|
2356
2358
|
return "";
|
|
2357
2359
|
const e = t.offset / t.diagonalDistance, o = t.flip * t.to.x, i = t.flip * t.to.y, s = {
|
|
@@ -2367,14 +2369,14 @@ const re = (t) => {
|
|
|
2367
2369
|
t.arrowLength,
|
|
2368
2370
|
t.arrowWidth
|
|
2369
2371
|
);
|
|
2370
|
-
},
|
|
2372
|
+
}, se = (t) => {
|
|
2371
2373
|
const e = t.hasArrow ? t.arrowLength : 0, o = t.offset + e, i = t.flip * o / t.diagonalDistance;
|
|
2372
2374
|
return {
|
|
2373
2375
|
x: t.to.x * i + t.shift.x,
|
|
2374
2376
|
y: t.to.y * i + t.shift.y
|
|
2375
2377
|
};
|
|
2376
|
-
},
|
|
2377
|
-
const e =
|
|
2378
|
+
}, st = (t) => {
|
|
2379
|
+
const e = se({
|
|
2378
2380
|
diagonalDistance: t.diagonalDistance,
|
|
2379
2381
|
to: t.to,
|
|
2380
2382
|
offset: t.sourceOffset,
|
|
@@ -2382,7 +2384,7 @@ const re = (t) => {
|
|
|
2382
2384
|
flip: 1,
|
|
2383
2385
|
shift: g,
|
|
2384
2386
|
arrowLength: t.arrowLength
|
|
2385
|
-
}), o =
|
|
2387
|
+
}), o = se({
|
|
2386
2388
|
diagonalDistance: t.diagonalDistance,
|
|
2387
2389
|
to: t.to,
|
|
2388
2390
|
offset: t.targetOffset,
|
|
@@ -2393,10 +2395,10 @@ const re = (t) => {
|
|
|
2393
2395
|
});
|
|
2394
2396
|
return `M ${e.x} ${e.y} L ${o.x} ${o.y}`;
|
|
2395
2397
|
};
|
|
2396
|
-
class
|
|
2398
|
+
class nt {
|
|
2397
2399
|
constructor(e) {
|
|
2398
|
-
r(this, "svg"
|
|
2399
|
-
r(this, "group",
|
|
2400
|
+
r(this, "svg");
|
|
2401
|
+
r(this, "group", ge());
|
|
2400
2402
|
r(this, "line");
|
|
2401
2403
|
r(this, "sourceArrow", null);
|
|
2402
2404
|
r(this, "targetArrow", null);
|
|
@@ -2406,17 +2408,17 @@ class st {
|
|
|
2406
2408
|
r(this, "arrowWidth");
|
|
2407
2409
|
r(this, "sourceOffset");
|
|
2408
2410
|
r(this, "targetOffset");
|
|
2409
|
-
this.color = (e == null ? void 0 : e.color) ?? u.color, this.width = (e == null ? void 0 : e.width) ?? u.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? u.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? u.preOffset, this.svg.appendChild(this.group), this.line =
|
|
2411
|
+
this.color = (e == null ? void 0 : e.color) ?? u.color, this.width = (e == null ? void 0 : e.width) ?? u.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? u.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? u.preOffset, this.svg = ue(this.color), this.svg.appendChild(this.group), this.line = we(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = V(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = V(), this.group.appendChild(this.targetArrow));
|
|
2410
2412
|
}
|
|
2411
2413
|
render(e) {
|
|
2412
|
-
const { x: o, y: i, width: s, height: h, flipX: n, flipY: d } =
|
|
2414
|
+
const { x: o, y: i, width: s, height: h, flipX: n, flipY: d } = fe(
|
|
2413
2415
|
e.from,
|
|
2414
2416
|
e.to
|
|
2415
2417
|
);
|
|
2416
|
-
|
|
2418
|
+
le(this.svg, { x: o, y: i, width: s, height: h }), this.group.style.transform = `scale(${n}, ${d})`;
|
|
2417
2419
|
const c = Math.sqrt(s * s + h * h), a = { x: s, y: h };
|
|
2418
2420
|
if (c > 0) {
|
|
2419
|
-
const l =
|
|
2421
|
+
const l = st({
|
|
2420
2422
|
diagonalDistance: c,
|
|
2421
2423
|
to: a,
|
|
2422
2424
|
sourceOffset: this.sourceOffset,
|
|
@@ -2429,7 +2431,7 @@ class st {
|
|
|
2429
2431
|
} else
|
|
2430
2432
|
this.line.setAttribute("d", "");
|
|
2431
2433
|
if (this.sourceArrow) {
|
|
2432
|
-
const l =
|
|
2434
|
+
const l = ie({
|
|
2433
2435
|
diagonalDistance: c,
|
|
2434
2436
|
to: a,
|
|
2435
2437
|
offset: this.sourceOffset,
|
|
@@ -2441,7 +2443,7 @@ class st {
|
|
|
2441
2443
|
this.sourceArrow.setAttribute("d", l);
|
|
2442
2444
|
}
|
|
2443
2445
|
if (this.targetArrow) {
|
|
2444
|
-
const l =
|
|
2446
|
+
const l = ie({
|
|
2445
2447
|
diagonalDistance: c,
|
|
2446
2448
|
to: a,
|
|
2447
2449
|
offset: this.targetOffset,
|
|
@@ -2454,39 +2456,39 @@ class st {
|
|
|
2454
2456
|
}
|
|
2455
2457
|
}
|
|
2456
2458
|
}
|
|
2457
|
-
const
|
|
2459
|
+
const ht = () => {
|
|
2458
2460
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2459
2461
|
return t.style.pointerEvents = "auto", t.style.cursor = "pointer", t;
|
|
2460
|
-
},
|
|
2462
|
+
}, dt = (t) => {
|
|
2461
2463
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2462
2464
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${t}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
2463
|
-
},
|
|
2465
|
+
}, ne = (t) => {
|
|
2464
2466
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2465
2467
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${t}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
2466
2468
|
};
|
|
2467
|
-
class
|
|
2469
|
+
class ct extends Error {
|
|
2468
2470
|
constructor(e) {
|
|
2469
2471
|
super(e), this.name = "InteractiveEdgeError";
|
|
2470
2472
|
}
|
|
2471
2473
|
}
|
|
2472
|
-
class
|
|
2474
|
+
class ve {
|
|
2473
2475
|
constructor(e, o) {
|
|
2474
2476
|
r(this, "svg");
|
|
2475
2477
|
r(this, "group");
|
|
2476
2478
|
r(this, "line");
|
|
2477
2479
|
r(this, "sourceArrow");
|
|
2478
2480
|
r(this, "targetArrow");
|
|
2479
|
-
r(this, "handle",
|
|
2481
|
+
r(this, "handle", ht());
|
|
2480
2482
|
r(this, "interactiveLine");
|
|
2481
2483
|
r(this, "interactiveSourceArrow", null);
|
|
2482
2484
|
r(this, "interactiveTargetArrow", null);
|
|
2483
|
-
if (this.structuredEdge = e, e instanceof
|
|
2484
|
-
throw new
|
|
2485
|
+
if (this.structuredEdge = e, e instanceof ve)
|
|
2486
|
+
throw new ct(
|
|
2485
2487
|
"interactive edge can be configured only once"
|
|
2486
2488
|
);
|
|
2487
2489
|
this.svg = this.structuredEdge.svg, this.group = this.structuredEdge.group, this.line = this.structuredEdge.line, this.sourceArrow = this.structuredEdge.sourceArrow, this.targetArrow = this.structuredEdge.targetArrow;
|
|
2488
2490
|
const i = (o == null ? void 0 : o.width) ?? u.interactiveWidth;
|
|
2489
|
-
this.interactiveLine =
|
|
2491
|
+
this.interactiveLine = dt(i), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ne(i), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ne(i), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle);
|
|
2490
2492
|
}
|
|
2491
2493
|
render(e) {
|
|
2492
2494
|
this.structuredEdge.render(e);
|
|
@@ -2501,12 +2503,12 @@ class fe {
|
|
|
2501
2503
|
}
|
|
2502
2504
|
}
|
|
2503
2505
|
}
|
|
2504
|
-
const
|
|
2506
|
+
const at = (t) => {
|
|
2505
2507
|
if (typeof t == "function")
|
|
2506
2508
|
return t;
|
|
2507
2509
|
switch (t == null ? void 0 : t.type) {
|
|
2508
2510
|
case "straight":
|
|
2509
|
-
return () => new
|
|
2511
|
+
return () => new rt({
|
|
2510
2512
|
color: t.color,
|
|
2511
2513
|
width: t.width,
|
|
2512
2514
|
arrowLength: t.arrowLength,
|
|
@@ -2520,7 +2522,7 @@ const ct = (t) => {
|
|
|
2520
2522
|
detourDirection: t.detourDirection
|
|
2521
2523
|
});
|
|
2522
2524
|
case "horizontal":
|
|
2523
|
-
return () => new
|
|
2525
|
+
return () => new ot({
|
|
2524
2526
|
color: t.color,
|
|
2525
2527
|
width: t.width,
|
|
2526
2528
|
arrowLength: t.arrowLength,
|
|
@@ -2534,7 +2536,7 @@ const ct = (t) => {
|
|
|
2534
2536
|
detourDirection: t.detourDirection
|
|
2535
2537
|
});
|
|
2536
2538
|
case "vertical":
|
|
2537
|
-
return () => new
|
|
2539
|
+
return () => new it({
|
|
2538
2540
|
color: t.color,
|
|
2539
2541
|
width: t.width,
|
|
2540
2542
|
arrowLength: t.arrowLength,
|
|
@@ -2548,7 +2550,7 @@ const ct = (t) => {
|
|
|
2548
2550
|
detourDirection: t.detourDirection
|
|
2549
2551
|
});
|
|
2550
2552
|
case "direct":
|
|
2551
|
-
return () => new
|
|
2553
|
+
return () => new nt({
|
|
2552
2554
|
color: t.color,
|
|
2553
2555
|
width: t.width,
|
|
2554
2556
|
arrowLength: t.arrowLength,
|
|
@@ -2559,7 +2561,7 @@ const ct = (t) => {
|
|
|
2559
2561
|
targetOffset: t.targetOffset
|
|
2560
2562
|
});
|
|
2561
2563
|
default:
|
|
2562
|
-
return () => new
|
|
2564
|
+
return () => new tt({
|
|
2563
2565
|
color: t.color,
|
|
2564
2566
|
width: t.width,
|
|
2565
2567
|
arrowLength: t.arrowLength,
|
|
@@ -2573,27 +2575,27 @@ const ct = (t) => {
|
|
|
2573
2575
|
detourDirection: t.detourDirection
|
|
2574
2576
|
});
|
|
2575
2577
|
}
|
|
2576
|
-
},
|
|
2578
|
+
}, lt = (t) => {
|
|
2577
2579
|
var o, i, s, h, n;
|
|
2578
|
-
const e =
|
|
2580
|
+
const e = Ze(
|
|
2579
2581
|
(o = t.nodes) == null ? void 0 : o.priority,
|
|
2580
2582
|
(i = t.edges) == null ? void 0 : i.priority
|
|
2581
2583
|
);
|
|
2582
2584
|
return {
|
|
2583
2585
|
nodes: {
|
|
2584
|
-
centerFn: ((s = t.nodes) == null ? void 0 : s.centerFn) ??
|
|
2586
|
+
centerFn: ((s = t.nodes) == null ? void 0 : s.centerFn) ?? je,
|
|
2585
2587
|
priorityFn: e.nodesPriorityFn
|
|
2586
2588
|
},
|
|
2587
2589
|
ports: {
|
|
2588
2590
|
direction: ((h = t.ports) == null ? void 0 : h.direction) ?? 0
|
|
2589
2591
|
},
|
|
2590
2592
|
edges: {
|
|
2591
|
-
shapeFactory:
|
|
2593
|
+
shapeFactory: at(((n = t.edges) == null ? void 0 : n.shape) ?? {}),
|
|
2592
2594
|
priorityFn: e.edgesPriorityFn
|
|
2593
2595
|
}
|
|
2594
2596
|
};
|
|
2595
2597
|
};
|
|
2596
|
-
class
|
|
2598
|
+
class gt {
|
|
2597
2599
|
constructor(e) {
|
|
2598
2600
|
r(this, "element", null);
|
|
2599
2601
|
r(this, "canvasDefaults", {});
|
|
@@ -2676,15 +2678,15 @@ class ut {
|
|
|
2676
2678
|
"unable to build canvas when no attach element specified"
|
|
2677
2679
|
);
|
|
2678
2680
|
let e = this.boxRenderingTrigger;
|
|
2679
|
-
this.virtualScrollConfig !== void 0 && e === void 0 && (e = new
|
|
2680
|
-
const o = new
|
|
2681
|
-
let h = new
|
|
2681
|
+
this.virtualScrollConfig !== void 0 && e === void 0 && (e = new de());
|
|
2682
|
+
const o = new ae(), i = new Ne(), s = new He(this.element);
|
|
2683
|
+
let h = new he(
|
|
2682
2684
|
o,
|
|
2683
2685
|
i,
|
|
2684
2686
|
s.main
|
|
2685
2687
|
);
|
|
2686
|
-
e !== void 0 && (h = new
|
|
2687
|
-
const n =
|
|
2688
|
+
e !== void 0 && (h = new be(h, o, e));
|
|
2689
|
+
const n = lt(this.canvasDefaults), d = new ce(
|
|
2688
2690
|
this.element,
|
|
2689
2691
|
o,
|
|
2690
2692
|
i,
|
|
@@ -2732,15 +2734,15 @@ class ut {
|
|
|
2732
2734
|
}
|
|
2733
2735
|
}
|
|
2734
2736
|
export {
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2737
|
+
tt as BezierEdgeShape,
|
|
2738
|
+
gt as CanvasBuilder,
|
|
2739
|
+
nt as DirectEdgeShape,
|
|
2740
|
+
de as EventSubject,
|
|
2741
|
+
ot as HorizontalEdgeShape,
|
|
2740
2742
|
S as HtmlGraphError,
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
+
ct as InteractiveEdgeError,
|
|
2744
|
+
ve as InteractiveEdgeShape,
|
|
2743
2745
|
C as LineEdgeShape,
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
+
rt as StraightEdgeShape,
|
|
2747
|
+
it as VerticalEdgeShape
|
|
2746
2748
|
};
|