@html-graph/html-graph 3.11.1 → 3.12.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 +1 -0
- package/dist/html-graph.js +196 -178
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var o = (r, e, t) =>
|
|
4
|
-
const
|
|
1
|
+
var me = Object.defineProperty;
|
|
2
|
+
var Ae = (r, e, t) => e in r ? me(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var o = (r, e, t) => Ae(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
const Ee = () => {
|
|
5
5
|
const r = document.createElement("div");
|
|
6
6
|
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
7
|
-
},
|
|
7
|
+
}, xe = () => {
|
|
8
8
|
const r = document.createElement("div");
|
|
9
9
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
10
|
-
},
|
|
10
|
+
}, Se = (r) => {
|
|
11
11
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
12
12
|
}, D = (r, e) => ({
|
|
13
13
|
x: r.scale * e.x + r.x,
|
|
@@ -15,8 +15,8 @@ const me = () => {
|
|
|
15
15
|
});
|
|
16
16
|
class ne {
|
|
17
17
|
constructor(e, t, s) {
|
|
18
|
-
o(this, "host",
|
|
19
|
-
o(this, "container",
|
|
18
|
+
o(this, "host", xe());
|
|
19
|
+
o(this, "container", Ee());
|
|
20
20
|
o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
21
21
|
o(this, "applyTransform", () => {
|
|
22
22
|
const e = this.viewportStore.getContentMatrix();
|
|
@@ -26,7 +26,7 @@ class ne {
|
|
|
26
26
|
}
|
|
27
27
|
attachNode(e) {
|
|
28
28
|
const t = this.graphStore.getNode(e);
|
|
29
|
-
|
|
29
|
+
Se(t.element), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
|
|
30
30
|
}
|
|
31
31
|
detachNode(e) {
|
|
32
32
|
const t = this.graphStore.getNode(e);
|
|
@@ -100,7 +100,7 @@ class ne {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
class
|
|
103
|
+
class be {
|
|
104
104
|
constructor(e) {
|
|
105
105
|
o(this, "xFrom", 1 / 0);
|
|
106
106
|
o(this, "yFrom", 1 / 0);
|
|
@@ -120,7 +120,7 @@ class xe {
|
|
|
120
120
|
return a <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
class
|
|
123
|
+
class Te {
|
|
124
124
|
constructor(e, t, s) {
|
|
125
125
|
o(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
126
126
|
o(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -144,7 +144,7 @@ class Se {
|
|
|
144
144
|
this.handleAttachEdge(h);
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
|
-
this.htmlView = e, this.graphStore = t, this.trigger = s, this.renderingBox = new
|
|
147
|
+
this.htmlView = e, this.graphStore = t, this.trigger = s, this.renderingBox = new be(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
148
148
|
}
|
|
149
149
|
attachNode(e) {
|
|
150
150
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -218,7 +218,7 @@ const E = () => {
|
|
|
218
218
|
const r = new he();
|
|
219
219
|
return [r, r];
|
|
220
220
|
};
|
|
221
|
-
class
|
|
221
|
+
class Pe {
|
|
222
222
|
constructor(e) {
|
|
223
223
|
o(this, "onBeforeUpdated");
|
|
224
224
|
o(this, "onAfterUpdated");
|
|
@@ -231,7 +231,7 @@ class be {
|
|
|
231
231
|
return { ...this.viewportStore.getContentMatrix() };
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
class
|
|
234
|
+
class De {
|
|
235
235
|
constructor(e) {
|
|
236
236
|
o(this, "onAfterNodeAdded");
|
|
237
237
|
o(this, "onAfterNodeUpdated");
|
|
@@ -326,7 +326,7 @@ class Te {
|
|
|
326
326
|
return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
class
|
|
329
|
+
class W {
|
|
330
330
|
constructor(e) {
|
|
331
331
|
o(this, "counter", 0);
|
|
332
332
|
this.checkExists = e;
|
|
@@ -358,13 +358,13 @@ class ae {
|
|
|
358
358
|
* provides api for accessing viewport state
|
|
359
359
|
*/
|
|
360
360
|
o(this, "viewport");
|
|
361
|
-
o(this, "nodeIdGenerator", new
|
|
361
|
+
o(this, "nodeIdGenerator", new W(
|
|
362
362
|
(e) => this.graph.getNode(e) !== null
|
|
363
363
|
));
|
|
364
|
-
o(this, "portIdGenerator", new
|
|
364
|
+
o(this, "portIdGenerator", new W(
|
|
365
365
|
(e) => this.graph.getPort(e) !== null
|
|
366
366
|
));
|
|
367
|
-
o(this, "edgeIdGenerator", new
|
|
367
|
+
o(this, "edgeIdGenerator", new W(
|
|
368
368
|
(e) => this.graph.getEdge(e) !== null
|
|
369
369
|
));
|
|
370
370
|
o(this, "onAfterNodeAdded", (e) => {
|
|
@@ -416,7 +416,7 @@ class ae {
|
|
|
416
416
|
* emits event just before destruction of canvas
|
|
417
417
|
*/
|
|
418
418
|
o(this, "onBeforeDestroy");
|
|
419
|
-
this.element = e, this.graphStore = t, this.viewportStore = s, this.htmlView = i, this.defaults = n, this.graph = new
|
|
419
|
+
this.element = e, this.graphStore = t, this.viewportStore = s, this.htmlView = i, this.defaults = n, this.graph = new De(this.graphStore), this.viewport = new Pe(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 ae {
|
|
|
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 Ne {
|
|
575
575
|
constructor() {
|
|
576
576
|
o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
577
577
|
o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -620,7 +620,7 @@ class de {
|
|
|
620
620
|
o(this, "incomingEdges", /* @__PURE__ */ new Map());
|
|
621
621
|
o(this, "outcomingEdges", /* @__PURE__ */ new Map());
|
|
622
622
|
o(this, "cycleEdges", /* @__PURE__ */ new Map());
|
|
623
|
-
o(this, "elementPorts", new
|
|
623
|
+
o(this, "elementPorts", new Ne());
|
|
624
624
|
o(this, "afterNodeAddedEmitter");
|
|
625
625
|
o(this, "onAfterNodeAdded");
|
|
626
626
|
o(this, "afterNodeUpdatedEmitter");
|
|
@@ -802,7 +802,7 @@ const q = (r) => ({
|
|
|
802
802
|
x: 0,
|
|
803
803
|
y: 0
|
|
804
804
|
};
|
|
805
|
-
class
|
|
805
|
+
class Me {
|
|
806
806
|
constructor() {
|
|
807
807
|
o(this, "viewportMatrix", ee);
|
|
808
808
|
o(this, "contentMatrix", ee);
|
|
@@ -866,10 +866,10 @@ class k {
|
|
|
866
866
|
this.canvas.updateNode(t);
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
|
-
const
|
|
870
|
-
var
|
|
871
|
-
const e = ((
|
|
872
|
-
}), t = ((
|
|
869
|
+
const Le = (r) => {
|
|
870
|
+
var p, f, v, A, m, x;
|
|
871
|
+
const e = ((p = r == null ? void 0 : r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
|
|
872
|
+
}), t = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeNodeDrag) ?? (() => !0), s = ((v = r == null ? void 0 : r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
|
|
873
873
|
}), i = (r == null ? void 0 : r.moveOnTop) !== !1, n = (r == null ? void 0 : r.moveEdgesOnTop) !== !1 && i, h = (A = r == null ? void 0 : r.mouse) == null ? void 0 : A.dragCursor, a = h !== void 0 ? h : "grab", d = (m = r == null ? void 0 : r.mouse) == null ? void 0 : m.mouseDownEventVerifier, c = d !== void 0 ? d : (b) => b.button === 0, g = (x = r == null ? void 0 : r.mouse) == null ? void 0 : x.mouseUpEventVerifier;
|
|
874
874
|
return {
|
|
875
875
|
moveOnTop: i,
|
|
@@ -881,10 +881,10 @@ const Ne = (r) => {
|
|
|
881
881
|
onBeforeNodeDrag: t,
|
|
882
882
|
onNodeDragFinished: s
|
|
883
883
|
};
|
|
884
|
-
},
|
|
884
|
+
}, Re = (r, e, t) => {
|
|
885
885
|
const { x: s, y: i, width: n, height: h } = r.getBoundingClientRect();
|
|
886
886
|
return e >= s && e <= s + n && t >= i && t <= i + h;
|
|
887
|
-
},
|
|
887
|
+
}, Ie = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, N = (r, e, t, s) => Re(e, t, s) && Ie(r, t, s), B = (r, e) => {
|
|
888
888
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
889
889
|
};
|
|
890
890
|
class z {
|
|
@@ -994,7 +994,7 @@ class z {
|
|
|
994
994
|
this.previousTouchCoordinates = null, this.cancelTouchDrag();
|
|
995
995
|
});
|
|
996
996
|
o(this, "config");
|
|
997
|
-
this.canvas = e, this.element = t, this.window = s, this.config =
|
|
997
|
+
this.canvas = e, this.element = t, this.window = s, this.config = Le(i), 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, t, s, i) {
|
|
1000
1000
|
new z(e, t, s, i);
|
|
@@ -1058,7 +1058,7 @@ class z {
|
|
|
1058
1058
|
this.maxNodePriority = Math.max(this.maxNodePriority, t);
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
|
-
const
|
|
1061
|
+
const Be = (r) => {
|
|
1062
1062
|
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
|
|
1063
1063
|
return (n) => {
|
|
1064
1064
|
let h = n.nextTransform.x, a = n.nextTransform.y;
|
|
@@ -1068,7 +1068,7 @@ const Re = (r) => {
|
|
|
1068
1068
|
const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
|
|
1069
1069
|
return a > l && a > n.prevTransform.y && (a = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: h, y: a };
|
|
1070
1070
|
};
|
|
1071
|
-
},
|
|
1071
|
+
}, Ve = (r) => {
|
|
1072
1072
|
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
|
|
1073
1073
|
return (n) => {
|
|
1074
1074
|
const h = n.prevTransform, a = n.nextTransform;
|
|
@@ -1089,7 +1089,7 @@ const Re = (r) => {
|
|
|
1089
1089
|
y: g
|
|
1090
1090
|
};
|
|
1091
1091
|
};
|
|
1092
|
-
},
|
|
1092
|
+
}, Ue = (r) => (e) => r.reduce(
|
|
1093
1093
|
(t, s) => s({
|
|
1094
1094
|
prevTransform: e.prevTransform,
|
|
1095
1095
|
nextTransform: t,
|
|
@@ -1102,30 +1102,30 @@ const Re = (r) => {
|
|
|
1102
1102
|
return r;
|
|
1103
1103
|
switch (r.type) {
|
|
1104
1104
|
case "scale-limit":
|
|
1105
|
-
return
|
|
1105
|
+
return Ve({
|
|
1106
1106
|
minContentScale: r.minContentScale ?? 0,
|
|
1107
1107
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
1108
1108
|
});
|
|
1109
1109
|
case "shift-limit":
|
|
1110
|
-
return
|
|
1110
|
+
return Be({
|
|
1111
1111
|
minX: r.minX ?? -1 / 0,
|
|
1112
1112
|
maxX: r.maxX ?? 1 / 0,
|
|
1113
1113
|
minY: r.minY ?? -1 / 0,
|
|
1114
1114
|
maxY: r.maxY ?? 1 / 0
|
|
1115
1115
|
});
|
|
1116
1116
|
}
|
|
1117
|
-
},
|
|
1118
|
-
var
|
|
1119
|
-
const e = (
|
|
1117
|
+
}, Ce = (r) => {
|
|
1118
|
+
var v, A, m, x, b, T, M, L, J, K, Q, _;
|
|
1119
|
+
const e = (v = r == null ? void 0 : r.scale) == null ? void 0 : v.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
1120
1120
|
let i;
|
|
1121
|
-
s !== void 0 ? Array.isArray(s) ? i =
|
|
1121
|
+
s !== void 0 ? Array.isArray(s) ? i = Ue(
|
|
1122
1122
|
s.map(
|
|
1123
1123
|
(P) => te(P)
|
|
1124
1124
|
)
|
|
1125
1125
|
) : i = te(s) : i = (P) => P.nextTransform;
|
|
1126
1126
|
const n = ((A = r == null ? void 0 : r.shift) == null ? void 0 : A.cursor) !== void 0 ? r.shift.cursor : "grab", h = ((m = r == null ? void 0 : r.events) == null ? void 0 : m.onBeforeTransformChange) ?? (() => {
|
|
1127
1127
|
}), a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformChange) ?? (() => {
|
|
1128
|
-
}), d = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseDownEventVerifier, c = d !== void 0 ? d : (P) => P.button === 0, g = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseUpEventVerifier, l = g !== void 0 ? g : (P) => P.button === 0,
|
|
1128
|
+
}), d = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseDownEventVerifier, c = d !== void 0 ? d : (P) => P.button === 0, g = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseUpEventVerifier, l = g !== void 0 ? g : (P) => P.button === 0, p = (M = r == null ? void 0 : r.scale) == null ? void 0 : M.mouseWheelEventVerifier, f = p !== void 0 ? p : () => !0;
|
|
1129
1129
|
return {
|
|
1130
1130
|
wheelSensitivity: t,
|
|
1131
1131
|
onTransformStarted: ((L = r == null ? void 0 : r.events) == null ? void 0 : L.onTransformStarted) ?? (() => {
|
|
@@ -1138,18 +1138,18 @@ const Re = (r) => {
|
|
|
1138
1138
|
shiftCursor: n,
|
|
1139
1139
|
mouseDownEventVerifier: c,
|
|
1140
1140
|
mouseUpEventVerifier: l,
|
|
1141
|
-
mouseWheelEventVerifier:
|
|
1141
|
+
mouseWheelEventVerifier: f,
|
|
1142
1142
|
scaleWheelFinishTimeout: ((K = r == null ? void 0 : r.scale) == null ? void 0 : K.wheelFinishTimeout) ?? 500,
|
|
1143
1143
|
onResizeTransformStarted: ((Q = r == null ? void 0 : r.events) == null ? void 0 : Q.onResizeTransformStarted) ?? (() => {
|
|
1144
1144
|
}),
|
|
1145
1145
|
onResizeTransformFinished: ((_ = r == null ? void 0 : r.events) == null ? void 0 : _.onResizeTransformFinished) ?? (() => {
|
|
1146
1146
|
})
|
|
1147
1147
|
};
|
|
1148
|
-
},
|
|
1148
|
+
}, We = (r, e, t) => ({
|
|
1149
1149
|
scale: r.scale,
|
|
1150
1150
|
x: r.x + r.scale * e,
|
|
1151
1151
|
y: r.y + r.scale * t
|
|
1152
|
-
}),
|
|
1152
|
+
}), $e = (r, e, t, s) => ({
|
|
1153
1153
|
scale: r.scale * e,
|
|
1154
1154
|
x: r.scale * (1 - e) * t + r.x,
|
|
1155
1155
|
y: r.scale * (1 - e) * s + r.y
|
|
@@ -1172,7 +1172,7 @@ const Re = (r) => {
|
|
|
1172
1172
|
touches: e
|
|
1173
1173
|
};
|
|
1174
1174
|
};
|
|
1175
|
-
class
|
|
1175
|
+
class U {
|
|
1176
1176
|
constructor(e, t, s, i) {
|
|
1177
1177
|
o(this, "viewport");
|
|
1178
1178
|
o(this, "prevTouches", null);
|
|
@@ -1261,7 +1261,7 @@ class C {
|
|
|
1261
1261
|
});
|
|
1262
1262
|
this.canvas = e, this.element = t, this.window = s, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
|
|
1263
1263
|
passive: !1
|
|
1264
|
-
}), this.config =
|
|
1264
|
+
}), this.config = Ce(i), 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
|
|
@@ -1270,7 +1270,7 @@ class C {
|
|
|
1270
1270
|
}), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1271
1271
|
}
|
|
1272
1272
|
static configure(e, t, s, i) {
|
|
1273
|
-
new
|
|
1273
|
+
new U(
|
|
1274
1274
|
e,
|
|
1275
1275
|
t,
|
|
1276
1276
|
s,
|
|
@@ -1278,7 +1278,7 @@ class C {
|
|
|
1278
1278
|
);
|
|
1279
1279
|
}
|
|
1280
1280
|
moveViewport(e, t) {
|
|
1281
|
-
const s = this.viewport.getViewportMatrix(), i =
|
|
1281
|
+
const s = this.viewport.getViewportMatrix(), i = We(s, e, t), { width: n, height: h } = this.element.getBoundingClientRect(), a = this.config.transformPreprocessor({
|
|
1282
1282
|
prevTransform: s,
|
|
1283
1283
|
nextTransform: i,
|
|
1284
1284
|
canvasWidth: n,
|
|
@@ -1287,7 +1287,7 @@ class C {
|
|
|
1287
1287
|
this.performTransform(a);
|
|
1288
1288
|
}
|
|
1289
1289
|
scaleViewport(e, t, s) {
|
|
1290
|
-
const i = this.canvas.viewport.getViewportMatrix(), n =
|
|
1290
|
+
const i = this.canvas.viewport.getViewportMatrix(), n = $e(i, e, t, s), { width: h, height: a } = this.element.getBoundingClientRect(), d = this.config.transformPreprocessor({
|
|
1291
1291
|
prevTransform: i,
|
|
1292
1292
|
nextTransform: n,
|
|
1293
1293
|
canvasWidth: h,
|
|
@@ -1349,17 +1349,17 @@ class X {
|
|
|
1349
1349
|
this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
|
|
1350
1350
|
});
|
|
1351
1351
|
o(this, "userTransformInProgress", !1);
|
|
1352
|
-
var
|
|
1352
|
+
var f, v, A, m, x;
|
|
1353
1353
|
this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.virtualScrollOptions = h, this.nodeHorizontal = this.virtualScrollOptions.nodeContainingRadius.horizontal, this.nodeVertical = this.virtualScrollOptions.nodeContainingRadius.vertical, this.canvasResizeObserver = new ResizeObserver((b) => {
|
|
1354
1354
|
const T = b[0];
|
|
1355
1355
|
this.viewportWidth = T.contentRect.width, this.viewportHeight = T.contentRect.height, this.scheduleLoadAreaAroundViewport();
|
|
1356
1356
|
}), this.viewport = e.viewport;
|
|
1357
|
-
const a = ((
|
|
1358
|
-
}), d = ((
|
|
1357
|
+
const a = ((f = i == null ? void 0 : i.events) == null ? void 0 : f.onResizeTransformStarted) ?? (() => {
|
|
1358
|
+
}), d = ((v = i == null ? void 0 : i.events) == null ? void 0 : v.onResizeTransformFinished) ?? (() => {
|
|
1359
1359
|
}), c = ((A = i == null ? void 0 : i.events) == null ? void 0 : A.onTransformChange) ?? (() => {
|
|
1360
1360
|
}), g = ((m = i == null ? void 0 : i.events) == null ? void 0 : m.onBeforeTransformChange) ?? (() => {
|
|
1361
1361
|
}), l = ((x = i == null ? void 0 : i.events) == null ? void 0 : x.onTransformFinished) ?? (() => {
|
|
1362
|
-
}),
|
|
1362
|
+
}), p = {
|
|
1363
1363
|
...i,
|
|
1364
1364
|
events: {
|
|
1365
1365
|
...i == null ? void 0 : i.events,
|
|
@@ -1382,11 +1382,11 @@ class X {
|
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
1384
|
};
|
|
1385
|
-
|
|
1385
|
+
U.configure(
|
|
1386
1386
|
e,
|
|
1387
1387
|
this.element,
|
|
1388
1388
|
this.window,
|
|
1389
|
-
|
|
1389
|
+
p
|
|
1390
1390
|
), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1391
1391
|
}
|
|
1392
1392
|
static configure(e, t, s, i, n, h) {
|
|
@@ -1413,29 +1413,29 @@ class X {
|
|
|
1413
1413
|
this.trigger.emit({ x: s, y: i, width: n, height: h });
|
|
1414
1414
|
}
|
|
1415
1415
|
}
|
|
1416
|
-
const
|
|
1416
|
+
const Fe = () => {
|
|
1417
1417
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1418
1418
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
1419
|
-
},
|
|
1419
|
+
}, Oe = () => {
|
|
1420
1420
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
1421
1421
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
1422
|
-
},
|
|
1422
|
+
}, ke = () => {
|
|
1423
1423
|
const r = document.createElementNS(
|
|
1424
1424
|
"http://www.w3.org/2000/svg",
|
|
1425
1425
|
"pattern"
|
|
1426
1426
|
);
|
|
1427
1427
|
return r.setAttribute("id", "pattern"), r;
|
|
1428
|
-
},
|
|
1428
|
+
}, ze = (r, e) => {
|
|
1429
1429
|
const t = document.createElementNS(
|
|
1430
1430
|
"http://www.w3.org/2000/svg",
|
|
1431
1431
|
"circle"
|
|
1432
1432
|
);
|
|
1433
1433
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
1434
|
-
},
|
|
1434
|
+
}, Xe = (r) => r instanceof SVGElement ? r : ze(
|
|
1435
1435
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
1436
1436
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
1437
|
-
),
|
|
1438
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i =
|
|
1437
|
+
), Ye = (r) => {
|
|
1438
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = Xe(r.renderer ?? {});
|
|
1439
1439
|
return {
|
|
1440
1440
|
tileWidth: t,
|
|
1441
1441
|
tileHeight: s,
|
|
@@ -1445,9 +1445,9 @@ const $e = () => {
|
|
|
1445
1445
|
};
|
|
1446
1446
|
class Y {
|
|
1447
1447
|
constructor(e, t, s) {
|
|
1448
|
-
o(this, "svg",
|
|
1449
|
-
o(this, "patternRenderingRectangle",
|
|
1450
|
-
o(this, "pattern",
|
|
1448
|
+
o(this, "svg", Fe());
|
|
1449
|
+
o(this, "patternRenderingRectangle", Oe());
|
|
1450
|
+
o(this, "pattern", ke());
|
|
1451
1451
|
o(this, "patternContent");
|
|
1452
1452
|
o(this, "tileWidth");
|
|
1453
1453
|
o(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 = s;
|
|
1474
|
-
const i =
|
|
1474
|
+
const i = Ye(t);
|
|
1475
1475
|
this.tileWidth = i.tileWidth, this.tileHeight = i.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = i.renderer, this.maxViewportScale = i.maxViewportScale;
|
|
1476
1476
|
const n = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
1477
1477
|
this.patternContent.setAttribute("transform", n), this.pattern.appendChild(this.patternContent);
|
|
@@ -1486,26 +1486,12 @@ class Y {
|
|
|
1486
1486
|
t && this.visible ? (this.visible = !1, this.host.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.host.appendChild(this.svg));
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
}, h = () => {
|
|
1494
|
-
};
|
|
1495
|
-
return {
|
|
1496
|
-
connectionTypeResolver: r.connectionTypeResolver ?? e,
|
|
1497
|
-
connectionPreprocessor: r.connectionPreprocessor ?? t,
|
|
1498
|
-
mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
|
|
1499
|
-
mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
|
|
1500
|
-
onAfterEdgeCreated: ((a = r.events) == null ? void 0 : a.onAfterEdgeCreated) ?? i,
|
|
1501
|
-
onEdgeCreationInterrupted: ((d = r.events) == null ? void 0 : d.onEdgeCreationInterrupted) ?? h,
|
|
1502
|
-
onEdgeCreationPrevented: ((c = r.events) == null ? void 0 : c.onEdgeCreationPrevented) ?? n,
|
|
1503
|
-
dragPortDirection: r.dragPortDirection ?? void 0
|
|
1504
|
-
};
|
|
1505
|
-
};
|
|
1489
|
+
const ce = (r, e) => ({
|
|
1490
|
+
x: r / 2,
|
|
1491
|
+
y: e / 2
|
|
1492
|
+
});
|
|
1506
1493
|
class H {
|
|
1507
|
-
constructor(e, t, s, i, n
|
|
1508
|
-
o(this, "config");
|
|
1494
|
+
constructor(e, t, s, i, n) {
|
|
1509
1495
|
o(this, "overlayCanvas");
|
|
1510
1496
|
o(this, "staticOverlayPortId", "static");
|
|
1511
1497
|
o(this, "draggingOverlayPortId", "dragging");
|
|
@@ -1587,28 +1573,39 @@ class H {
|
|
|
1587
1573
|
o(this, "onEdgeCreated", (e) => {
|
|
1588
1574
|
this.config.onAfterEdgeCreated(e);
|
|
1589
1575
|
});
|
|
1590
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.config =
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1576
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.config = n;
|
|
1577
|
+
const h = new de(), a = new ne(
|
|
1578
|
+
h,
|
|
1593
1579
|
this.viewportStore,
|
|
1594
1580
|
this.overlayLayer
|
|
1595
|
-
)
|
|
1581
|
+
), d = {
|
|
1582
|
+
nodes: {
|
|
1583
|
+
centerFn: ce,
|
|
1584
|
+
priorityFn: () => 0
|
|
1585
|
+
},
|
|
1586
|
+
edges: {
|
|
1587
|
+
shapeFactory: this.config.edgeShapeFactory,
|
|
1588
|
+
priorityFn: () => 0
|
|
1589
|
+
},
|
|
1590
|
+
ports: {
|
|
1591
|
+
direction: 0
|
|
1592
|
+
}
|
|
1593
|
+
};
|
|
1596
1594
|
this.overlayCanvas = new ae(
|
|
1597
1595
|
this.overlayLayer,
|
|
1598
|
-
|
|
1596
|
+
h,
|
|
1599
1597
|
this.viewportStore,
|
|
1600
|
-
|
|
1601
|
-
|
|
1598
|
+
a,
|
|
1599
|
+
d
|
|
1602
1600
|
), 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);
|
|
1603
1601
|
}
|
|
1604
|
-
static configure(e, t, s, i, n
|
|
1602
|
+
static configure(e, t, s, i, n) {
|
|
1605
1603
|
new H(
|
|
1606
1604
|
e,
|
|
1607
1605
|
t,
|
|
1608
1606
|
s,
|
|
1609
1607
|
i,
|
|
1610
|
-
n
|
|
1611
|
-
h
|
|
1608
|
+
n
|
|
1612
1609
|
);
|
|
1613
1610
|
}
|
|
1614
1611
|
grabPort(e, t) {
|
|
@@ -1617,20 +1614,20 @@ class H {
|
|
|
1617
1614
|
const n = this.config.connectionTypeResolver(this.staticPortId), h = e.getBoundingClientRect(), a = h.x + h.width / 2, d = h.y + h.height / 2, c = this.overlayLayer.getBoundingClientRect(), g = this.canvas.viewport.getViewportMatrix(), l = D(g, {
|
|
1618
1615
|
x: a - c.x,
|
|
1619
1616
|
y: d - c.y
|
|
1620
|
-
}),
|
|
1617
|
+
}), p = D(g, {
|
|
1621
1618
|
x: t.x - c.x,
|
|
1622
1619
|
y: t.y - c.y
|
|
1623
|
-
}),
|
|
1620
|
+
}), f = {
|
|
1624
1621
|
overlayId: this.staticOverlayPortId,
|
|
1625
1622
|
portCoords: l,
|
|
1626
1623
|
portDirection: i.direction
|
|
1627
|
-
},
|
|
1624
|
+
}, v = {
|
|
1628
1625
|
overlayId: this.draggingOverlayPortId,
|
|
1629
|
-
portCoords:
|
|
1626
|
+
portCoords: p,
|
|
1630
1627
|
portDirection: this.config.dragPortDirection
|
|
1631
1628
|
};
|
|
1632
1629
|
this.isDirect = n === "direct";
|
|
1633
|
-
const A = this.isDirect ?
|
|
1630
|
+
const A = this.isDirect ? f : v, m = this.isDirect ? v : f;
|
|
1634
1631
|
this.createOverlayGraph(A, m);
|
|
1635
1632
|
}
|
|
1636
1633
|
hookPortEvents(e) {
|
|
@@ -1716,29 +1713,26 @@ class H {
|
|
|
1716
1713
|
return this.config.connectionTypeResolver(t) !== null;
|
|
1717
1714
|
}
|
|
1718
1715
|
}
|
|
1719
|
-
const
|
|
1716
|
+
const He = () => {
|
|
1720
1717
|
const r = document.createElement("div");
|
|
1721
1718
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
1722
|
-
},
|
|
1719
|
+
}, $ = () => {
|
|
1723
1720
|
const r = document.createElement("div");
|
|
1724
1721
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
1725
1722
|
};
|
|
1726
|
-
class
|
|
1723
|
+
class je {
|
|
1727
1724
|
constructor(e) {
|
|
1728
|
-
o(this, "background",
|
|
1729
|
-
o(this, "main",
|
|
1730
|
-
o(this, "overlay",
|
|
1731
|
-
o(this, "host",
|
|
1725
|
+
o(this, "background", $());
|
|
1726
|
+
o(this, "main", $());
|
|
1727
|
+
o(this, "overlay", $());
|
|
1728
|
+
o(this, "host", He());
|
|
1732
1729
|
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
1730
|
}
|
|
1734
1731
|
destroy() {
|
|
1735
1732
|
this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlay), this.element.removeChild(this.host);
|
|
1736
1733
|
}
|
|
1737
1734
|
}
|
|
1738
|
-
const
|
|
1739
|
-
x: r / 2,
|
|
1740
|
-
y: e / 2
|
|
1741
|
-
}), F = (r) => () => r, re = F(0), Ge = () => {
|
|
1735
|
+
const F = (r) => () => r, re = F(0), Ge = () => {
|
|
1742
1736
|
let r = 0;
|
|
1743
1737
|
return () => r++;
|
|
1744
1738
|
}, Ze = (r, e) => {
|
|
@@ -1780,7 +1774,7 @@ class Je {
|
|
|
1780
1774
|
this.path = `${d}${a}${c}`;
|
|
1781
1775
|
}
|
|
1782
1776
|
}
|
|
1783
|
-
const
|
|
1777
|
+
const le = (r, e, t, s) => ({
|
|
1784
1778
|
x: e * r.x + (1 - e) / 2 * s.x,
|
|
1785
1779
|
y: t * r.y + (1 - t) / 2 * s.y
|
|
1786
1780
|
});
|
|
@@ -1811,13 +1805,13 @@ class Ke {
|
|
|
1811
1805
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1812
1806
|
this.params.targetDirection,
|
|
1813
1807
|
this.params.to
|
|
1814
|
-
),
|
|
1808
|
+
), p = {
|
|
1815
1809
|
x: l.x + a,
|
|
1816
1810
|
y: l.y + d
|
|
1817
|
-
}, p = {
|
|
1818
|
-
x: (g.x + v.x) / 2,
|
|
1819
|
-
y: (g.y + v.y) / 2
|
|
1820
1811
|
}, f = {
|
|
1812
|
+
x: (g.x + p.x) / 2,
|
|
1813
|
+
y: (g.y + p.y) / 2
|
|
1814
|
+
}, v = {
|
|
1821
1815
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
1822
1816
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
1823
1817
|
}, A = {
|
|
@@ -1833,10 +1827,10 @@ class Ke {
|
|
|
1833
1827
|
this.path = [
|
|
1834
1828
|
`M ${t.x} ${t.y}`,
|
|
1835
1829
|
`L ${c.x} ${c.y}`,
|
|
1836
|
-
`C ${
|
|
1830
|
+
`C ${v.x} ${v.y} ${m.x} ${m.y} ${f.x} ${f.y}`,
|
|
1837
1831
|
`C ${x.x} ${x.y} ${A.x} ${A.y} ${l.x} ${l.y}`,
|
|
1838
1832
|
`L ${s.x} ${s.y}`
|
|
1839
|
-
].join(" "), this.median =
|
|
1833
|
+
].join(" "), this.median = le(f, e.flipX, e.flipY, e.to);
|
|
1840
1834
|
}
|
|
1841
1835
|
}
|
|
1842
1836
|
const R = (r, e) => {
|
|
@@ -1846,13 +1840,13 @@ const R = (r, e) => {
|
|
|
1846
1840
|
let i = 0, n = 0, h = 0;
|
|
1847
1841
|
r.forEach((a, d) => {
|
|
1848
1842
|
let c = 0, g = 0, l = 0;
|
|
1849
|
-
const
|
|
1850
|
-
if (
|
|
1843
|
+
const p = d > 0, f = d < s, v = p && f;
|
|
1844
|
+
if (p && (c = -i, g = -n, l = h), f) {
|
|
1851
1845
|
const L = r[d + 1];
|
|
1852
1846
|
i = L.x - a.x, n = L.y - a.y, h = Math.sqrt(i * i + n * n);
|
|
1853
1847
|
}
|
|
1854
|
-
const m = h !== 0 ? Math.min((
|
|
1855
|
-
d > 0 && t.push(`L ${M.x} ${M.y}`),
|
|
1848
|
+
const m = h !== 0 ? Math.min((v ? e : 0) / h, d < s - 1 ? 0.5 : 1) : 0, x = v ? { x: a.x + i * m, y: a.y + n * m } : a, T = l !== 0 ? Math.min((v ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, M = v ? { x: a.x + c * T, y: a.y + g * T } : a;
|
|
1849
|
+
d > 0 && t.push(`L ${M.x} ${M.y}`), v && t.push(
|
|
1856
1850
|
`C ${a.x} ${a.y} ${a.x} ${a.y} ${x.x} ${x.y}`
|
|
1857
1851
|
);
|
|
1858
1852
|
});
|
|
@@ -1888,12 +1882,12 @@ class Qe {
|
|
|
1888
1882
|
), c = Math.max((a.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
|
|
1889
1883
|
x: this.params.flipX > 0 ? c : -n,
|
|
1890
1884
|
y: a.y
|
|
1891
|
-
},
|
|
1885
|
+
}, p = { x: l.x, y: g }, f = {
|
|
1892
1886
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1893
1887
|
y: d.y
|
|
1894
|
-
},
|
|
1888
|
+
}, v = { x: f.x, y: g };
|
|
1895
1889
|
this.path = R(
|
|
1896
|
-
[s, a, l, v, f,
|
|
1890
|
+
[s, a, l, p, v, f, d, i],
|
|
1897
1891
|
this.params.roundness
|
|
1898
1892
|
);
|
|
1899
1893
|
}
|
|
@@ -1922,9 +1916,9 @@ class j {
|
|
|
1922
1916
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1923
1917
|
this.params.targetDirection,
|
|
1924
1918
|
this.params.to
|
|
1925
|
-
),
|
|
1926
|
-
this.median =
|
|
1927
|
-
[t, n, g,
|
|
1919
|
+
), p = { x: l.x + d, y: l.y + c }, f = { x: (g.x + p.x) / 2, y: (g.y + p.y) / 2 };
|
|
1920
|
+
this.median = le(f, e.flipX, e.flipY, e.to), this.path = R(
|
|
1921
|
+
[t, n, g, p, l, s],
|
|
1928
1922
|
this.params.roundness
|
|
1929
1923
|
);
|
|
1930
1924
|
}
|
|
@@ -1988,12 +1982,12 @@ class qe {
|
|
|
1988
1982
|
), c = Math.max((a.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
|
|
1989
1983
|
x: a.x,
|
|
1990
1984
|
y: this.params.flipY > 0 ? c : -n
|
|
1991
|
-
},
|
|
1985
|
+
}, p = { x: g, y: l.y }, f = {
|
|
1992
1986
|
x: d.x,
|
|
1993
1987
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1994
|
-
},
|
|
1988
|
+
}, v = { x: g, y: f.y };
|
|
1995
1989
|
this.path = R(
|
|
1996
|
-
[s, a, l, v, f,
|
|
1990
|
+
[s, a, l, p, v, f, d, i],
|
|
1997
1991
|
this.params.roundness
|
|
1998
1992
|
);
|
|
1999
1993
|
}
|
|
@@ -2029,14 +2023,14 @@ class et {
|
|
|
2029
2023
|
{ x: c, y: -n },
|
|
2030
2024
|
{ x: d, y: 0 }
|
|
2031
2025
|
].map(
|
|
2032
|
-
(
|
|
2033
|
-
),
|
|
2026
|
+
(v) => y(v, this.params.sourceDirection, w)
|
|
2027
|
+
), p = [
|
|
2034
2028
|
`M ${l[0].x} ${l[0].y}`,
|
|
2035
2029
|
`A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
|
|
2036
2030
|
`A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
|
|
2037
2031
|
`A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
|
|
2038
|
-
].join(" "),
|
|
2039
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" :
|
|
2032
|
+
].join(" "), f = `M 0 0 L ${l[0].x} ${l[0].y} `;
|
|
2033
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : f}${p}`, this.median = l[3];
|
|
2040
2034
|
}
|
|
2041
2035
|
}
|
|
2042
2036
|
class tt {
|
|
@@ -2075,23 +2069,23 @@ class tt {
|
|
|
2075
2069
|
};
|
|
2076
2070
|
}
|
|
2077
2071
|
}
|
|
2078
|
-
const
|
|
2072
|
+
const ge = (r, e) => {
|
|
2079
2073
|
r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${Math.max(e.width, 1)}px`, r.style.height = `${Math.max(e.height, 1)}px`;
|
|
2080
2074
|
}, Z = Object.freeze({
|
|
2081
2075
|
edgeColor: "--edge-color"
|
|
2082
|
-
}),
|
|
2076
|
+
}), ue = (r) => {
|
|
2083
2077
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2084
2078
|
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;
|
|
2085
2079
|
}, V = () => {
|
|
2086
2080
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2087
2081
|
return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
|
|
2088
|
-
},
|
|
2082
|
+
}, we = () => {
|
|
2089
2083
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2090
2084
|
return r.style.transformOrigin = "50% 50%", r;
|
|
2091
|
-
},
|
|
2085
|
+
}, pe = (r) => {
|
|
2092
2086
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2093
2087
|
return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
2094
|
-
},
|
|
2088
|
+
}, fe = (r, e) => {
|
|
2095
2089
|
const t = {
|
|
2096
2090
|
x: r.x + r.width / 2,
|
|
2097
2091
|
y: r.y + r.height / 2
|
|
@@ -2133,23 +2127,23 @@ const le = (r, e) => {
|
|
|
2133
2127
|
interactiveWidth: 10,
|
|
2134
2128
|
preOffset: 0
|
|
2135
2129
|
}), oe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
2136
|
-
class
|
|
2130
|
+
class C {
|
|
2137
2131
|
constructor(e) {
|
|
2138
2132
|
o(this, "svg");
|
|
2139
|
-
o(this, "group",
|
|
2133
|
+
o(this, "group", we());
|
|
2140
2134
|
o(this, "line");
|
|
2141
2135
|
o(this, "sourceArrow", null);
|
|
2142
2136
|
o(this, "targetArrow", null);
|
|
2143
2137
|
o(this, "onAfterRender");
|
|
2144
2138
|
o(this, "afterRenderEmitter");
|
|
2145
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.svg =
|
|
2139
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.svg = ue(e.color), this.svg.appendChild(this.group), this.line = pe(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));
|
|
2146
2140
|
}
|
|
2147
2141
|
render(e) {
|
|
2148
|
-
const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } =
|
|
2142
|
+
const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = fe(
|
|
2149
2143
|
e.from,
|
|
2150
2144
|
e.to
|
|
2151
2145
|
);
|
|
2152
|
-
|
|
2146
|
+
ge(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
|
|
2153
2147
|
const d = oe(
|
|
2154
2148
|
e.from.direction,
|
|
2155
2149
|
h,
|
|
@@ -2162,16 +2156,16 @@ class U {
|
|
|
2162
2156
|
x: i,
|
|
2163
2157
|
y: n
|
|
2164
2158
|
};
|
|
2165
|
-
let l = c,
|
|
2166
|
-
e.from.portId === e.to.portId ? (
|
|
2167
|
-
const
|
|
2159
|
+
let l = c, p = -this.params.arrowLength, f;
|
|
2160
|
+
e.from.portId === e.to.portId ? (f = this.params.createCyclePath, l = d, p = this.params.arrowLength) : e.from.nodeId === e.to.nodeId ? f = this.params.createDetourPath : f = this.params.createLinePath;
|
|
2161
|
+
const v = f(
|
|
2168
2162
|
d,
|
|
2169
2163
|
c,
|
|
2170
2164
|
g,
|
|
2171
2165
|
h,
|
|
2172
2166
|
a
|
|
2173
2167
|
);
|
|
2174
|
-
this.line.setAttribute("d",
|
|
2168
|
+
this.line.setAttribute("d", v.path);
|
|
2175
2169
|
let A = null;
|
|
2176
2170
|
this.sourceArrow && (A = O(
|
|
2177
2171
|
d,
|
|
@@ -2183,10 +2177,10 @@ class U {
|
|
|
2183
2177
|
this.targetArrow && (m = O(
|
|
2184
2178
|
l,
|
|
2185
2179
|
g,
|
|
2186
|
-
|
|
2180
|
+
p,
|
|
2187
2181
|
this.params.arrowWidth
|
|
2188
2182
|
), this.targetArrow.setAttribute("d", m)), this.afterRenderEmitter.emit({
|
|
2189
|
-
edgePath:
|
|
2183
|
+
edgePath: v,
|
|
2190
2184
|
sourceArrowPath: A,
|
|
2191
2185
|
targetArrowPath: m
|
|
2192
2186
|
});
|
|
@@ -2240,7 +2234,7 @@ class rt {
|
|
|
2240
2234
|
hasSourceArrow: this.hasSourceArrow,
|
|
2241
2235
|
hasTargetArrow: this.hasTargetArrow
|
|
2242
2236
|
}));
|
|
2243
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new
|
|
2237
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? u.arrowLength, this.arrowWidth = (e == null ? void 0 : e.arrowWidth) ?? u.arrowWidth, this.curvature = (e == null ? void 0 : e.curvature) ?? u.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
|
|
2244
2238
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
2245
2239
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
2246
2240
|
arrowLength: this.arrowLength,
|
|
@@ -2314,7 +2308,7 @@ class ot {
|
|
|
2314
2308
|
t,
|
|
2315
2309
|
this.arrowOffset,
|
|
2316
2310
|
this.cycleSquareSide / 2
|
|
2317
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new
|
|
2311
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
|
|
2318
2312
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
2319
2313
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
2320
2314
|
arrowLength: this.arrowLength,
|
|
@@ -2387,7 +2381,7 @@ class st {
|
|
|
2387
2381
|
t,
|
|
2388
2382
|
this.arrowOffset,
|
|
2389
2383
|
this.cycleSquareSide / 2
|
|
2390
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new
|
|
2384
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
|
|
2391
2385
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
2392
2386
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
2393
2387
|
arrowLength: this.arrowLength,
|
|
@@ -2461,7 +2455,7 @@ class it {
|
|
|
2461
2455
|
t,
|
|
2462
2456
|
this.arrowOffset,
|
|
2463
2457
|
this.cycleSquareSide / 2
|
|
2464
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new
|
|
2458
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? u.hasTargetArrow, this.pathShape = new C({
|
|
2465
2459
|
color: (e == null ? void 0 : e.color) ?? u.color,
|
|
2466
2460
|
width: (e == null ? void 0 : e.width) ?? u.width,
|
|
2467
2461
|
arrowLength: this.arrowLength,
|
|
@@ -2497,7 +2491,7 @@ const se = (r) => {
|
|
|
2497
2491
|
class nt {
|
|
2498
2492
|
constructor(e) {
|
|
2499
2493
|
o(this, "svg");
|
|
2500
|
-
o(this, "group",
|
|
2494
|
+
o(this, "group", we());
|
|
2501
2495
|
o(this, "line");
|
|
2502
2496
|
o(this, "sourceArrow", null);
|
|
2503
2497
|
o(this, "targetArrow", null);
|
|
@@ -2509,14 +2503,14 @@ class nt {
|
|
|
2509
2503
|
o(this, "targetOffset");
|
|
2510
2504
|
o(this, "onAfterRender");
|
|
2511
2505
|
o(this, "afterRenderEmitter");
|
|
2512
|
-
[this.afterRenderEmitter, this.onAfterRender] = E(), 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 =
|
|
2506
|
+
[this.afterRenderEmitter, this.onAfterRender] = E(), 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 = pe(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));
|
|
2513
2507
|
}
|
|
2514
2508
|
render(e) {
|
|
2515
|
-
const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } =
|
|
2509
|
+
const { x: t, y: s, width: i, height: n, flipX: h, flipY: a } = fe(
|
|
2516
2510
|
e.from,
|
|
2517
2511
|
e.to
|
|
2518
2512
|
);
|
|
2519
|
-
|
|
2513
|
+
ge(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
|
|
2520
2514
|
const d = { x: i, y: n }, c = new tt({
|
|
2521
2515
|
to: d,
|
|
2522
2516
|
sourceOffset: this.sourceOffset,
|
|
@@ -2567,7 +2561,7 @@ class dt extends Error {
|
|
|
2567
2561
|
super(e), this.name = "InteractiveEdgeError";
|
|
2568
2562
|
}
|
|
2569
2563
|
}
|
|
2570
|
-
class
|
|
2564
|
+
class ve {
|
|
2571
2565
|
constructor(e, t) {
|
|
2572
2566
|
o(this, "svg");
|
|
2573
2567
|
o(this, "group");
|
|
@@ -2579,7 +2573,7 @@ class fe {
|
|
|
2579
2573
|
o(this, "interactiveLine");
|
|
2580
2574
|
o(this, "interactiveSourceArrow", null);
|
|
2581
2575
|
o(this, "interactiveTargetArrow", null);
|
|
2582
|
-
if (this.baseEdge = e, e instanceof
|
|
2576
|
+
if (this.baseEdge = e, e instanceof ve)
|
|
2583
2577
|
throw new dt(
|
|
2584
2578
|
"interactive edge can be configured only once"
|
|
2585
2579
|
);
|
|
@@ -2610,7 +2604,7 @@ class ut {
|
|
|
2610
2604
|
this.baseShape.render(e);
|
|
2611
2605
|
}
|
|
2612
2606
|
}
|
|
2613
|
-
const
|
|
2607
|
+
const ye = (r) => {
|
|
2614
2608
|
if (typeof r == "function")
|
|
2615
2609
|
return r;
|
|
2616
2610
|
switch (r == null ? void 0 : r.type) {
|
|
@@ -2682,7 +2676,7 @@ const ct = (r) => {
|
|
|
2682
2676
|
detourDirection: r.detourDirection
|
|
2683
2677
|
});
|
|
2684
2678
|
}
|
|
2685
|
-
},
|
|
2679
|
+
}, ct = (r) => {
|
|
2686
2680
|
var t, s, i, n, h;
|
|
2687
2681
|
const e = Ze(
|
|
2688
2682
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
@@ -2690,17 +2684,34 @@ const ct = (r) => {
|
|
|
2690
2684
|
);
|
|
2691
2685
|
return {
|
|
2692
2686
|
nodes: {
|
|
2693
|
-
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ??
|
|
2687
|
+
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? ce,
|
|
2694
2688
|
priorityFn: e.nodesPriorityFn
|
|
2695
2689
|
},
|
|
2696
2690
|
ports: {
|
|
2697
2691
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
2698
2692
|
},
|
|
2699
2693
|
edges: {
|
|
2700
|
-
shapeFactory:
|
|
2694
|
+
shapeFactory: ye(((h = r.edges) == null ? void 0 : h.shape) ?? {}),
|
|
2701
2695
|
priorityFn: e.edgesPriorityFn
|
|
2702
2696
|
}
|
|
2703
2697
|
};
|
|
2698
|
+
}, lt = (r, e, t) => {
|
|
2699
|
+
var c, g, l;
|
|
2700
|
+
const s = () => "direct", i = (p) => p, n = (p) => p.button === 0, h = () => {
|
|
2701
|
+
}, a = () => {
|
|
2702
|
+
}, d = () => {
|
|
2703
|
+
};
|
|
2704
|
+
return {
|
|
2705
|
+
connectionTypeResolver: r.connectionTypeResolver ?? s,
|
|
2706
|
+
connectionPreprocessor: r.connectionPreprocessor ?? i,
|
|
2707
|
+
mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
|
|
2708
|
+
mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
|
|
2709
|
+
onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? h,
|
|
2710
|
+
onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
|
|
2711
|
+
onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? a,
|
|
2712
|
+
dragPortDirection: r.dragPortDirection ?? t,
|
|
2713
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? ye(r.edgeShape) : e
|
|
2714
|
+
};
|
|
2704
2715
|
};
|
|
2705
2716
|
class wt {
|
|
2706
2717
|
constructor(e) {
|
|
@@ -2786,14 +2797,14 @@ class wt {
|
|
|
2786
2797
|
);
|
|
2787
2798
|
let e = this.boxRenderingTrigger;
|
|
2788
2799
|
this.virtualScrollConfig !== void 0 && e === void 0 && (e = new he());
|
|
2789
|
-
const t = new de(), s = new
|
|
2800
|
+
const t = new de(), s = new Me(), i = new je(this.element);
|
|
2790
2801
|
let n = new ne(
|
|
2791
2802
|
t,
|
|
2792
2803
|
s,
|
|
2793
2804
|
i.main
|
|
2794
2805
|
);
|
|
2795
|
-
e !== void 0 && (n = new
|
|
2796
|
-
const h =
|
|
2806
|
+
e !== void 0 && (n = new Te(n, t, e));
|
|
2807
|
+
const h = ct(this.canvasDefaults), a = new ae(
|
|
2797
2808
|
this.element,
|
|
2798
2809
|
t,
|
|
2799
2810
|
s,
|
|
@@ -2802,7 +2813,7 @@ class wt {
|
|
|
2802
2813
|
), d = () => {
|
|
2803
2814
|
i.destroy(), a.onBeforeDestroy.unsubscribe(d);
|
|
2804
2815
|
};
|
|
2805
|
-
|
|
2816
|
+
if (a.onBeforeDestroy.subscribe(d), this.hasBackground && Y.configure(
|
|
2806
2817
|
a,
|
|
2807
2818
|
this.backgroundConfig,
|
|
2808
2819
|
i.background
|
|
@@ -2811,21 +2822,28 @@ class wt {
|
|
|
2811
2822
|
i.main,
|
|
2812
2823
|
this.window,
|
|
2813
2824
|
this.dragConfig
|
|
2814
|
-
), this.hasUserConnectablePorts
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2825
|
+
), this.hasUserConnectablePorts) {
|
|
2826
|
+
const c = lt(
|
|
2827
|
+
this.connectablePortsConfig,
|
|
2828
|
+
h.edges.shapeFactory,
|
|
2829
|
+
h.ports.direction
|
|
2830
|
+
);
|
|
2831
|
+
H.configure(
|
|
2832
|
+
a,
|
|
2833
|
+
i.overlay,
|
|
2834
|
+
s,
|
|
2835
|
+
this.window,
|
|
2836
|
+
c
|
|
2837
|
+
);
|
|
2838
|
+
}
|
|
2839
|
+
return this.virtualScrollConfig !== void 0 ? X.configure(
|
|
2822
2840
|
a,
|
|
2823
2841
|
i.main,
|
|
2824
2842
|
this.window,
|
|
2825
2843
|
this.transformConfig,
|
|
2826
2844
|
e,
|
|
2827
2845
|
this.virtualScrollConfig
|
|
2828
|
-
) : this.hasTransformableViewport &&
|
|
2846
|
+
) : this.hasTransformableViewport && U.configure(
|
|
2829
2847
|
a,
|
|
2830
2848
|
i.main,
|
|
2831
2849
|
this.window,
|
|
@@ -2848,8 +2866,8 @@ export {
|
|
|
2848
2866
|
ot as HorizontalEdgeShape,
|
|
2849
2867
|
S as HtmlGraphError,
|
|
2850
2868
|
dt as InteractiveEdgeError,
|
|
2851
|
-
|
|
2852
|
-
|
|
2869
|
+
ve as InteractiveEdgeShape,
|
|
2870
|
+
C as LineEdgeShape,
|
|
2853
2871
|
ut as MedianEdgeShape,
|
|
2854
2872
|
st as StraightEdgeShape,
|
|
2855
2873
|
it as VerticalEdgeShape
|