@html-graph/html-graph 3.11.0 → 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 +255 -232
- 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 ye = () => {
|
|
|
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 Ee {
|
|
|
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 xe {
|
|
|
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 Se {
|
|
|
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 be {
|
|
|
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;
|
|
@@ -342,7 +342,7 @@ class $ {
|
|
|
342
342
|
this.counter = 0;
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
class
|
|
345
|
+
class S extends Error {
|
|
346
346
|
constructor() {
|
|
347
347
|
super(...arguments);
|
|
348
348
|
o(this, "name", "HtmlGraphError");
|
|
@@ -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
|
|
@@ -430,9 +430,9 @@ class ae {
|
|
|
430
430
|
addNode(e) {
|
|
431
431
|
const t = this.nodeIdGenerator.create(e.id);
|
|
432
432
|
if (this.graph.getNode(t) !== null)
|
|
433
|
-
throw new
|
|
433
|
+
throw new S("failed to add node with existing id");
|
|
434
434
|
if (this.graphStore.getElementNodeId(e.element) !== void 0)
|
|
435
|
-
throw new
|
|
435
|
+
throw new S(
|
|
436
436
|
"failed to add node with html element already in use by another node"
|
|
437
437
|
);
|
|
438
438
|
if (this.graphStore.addNode({
|
|
@@ -457,7 +457,7 @@ class ae {
|
|
|
457
457
|
*/
|
|
458
458
|
updateNode(e, t) {
|
|
459
459
|
if (this.graph.getNode(e) === null)
|
|
460
|
-
throw new
|
|
460
|
+
throw new S("failed to update non existing node");
|
|
461
461
|
return this.graphStore.updateNode(e, t ?? {}), this;
|
|
462
462
|
}
|
|
463
463
|
/**
|
|
@@ -467,7 +467,7 @@ class ae {
|
|
|
467
467
|
*/
|
|
468
468
|
removeNode(e) {
|
|
469
469
|
if (this.graph.getNode(e) === null)
|
|
470
|
-
throw new
|
|
470
|
+
throw new S("failed to remove non existing node");
|
|
471
471
|
return this.graphStore.removeNode(e), this;
|
|
472
472
|
}
|
|
473
473
|
/**
|
|
@@ -476,9 +476,9 @@ class ae {
|
|
|
476
476
|
markPort(e) {
|
|
477
477
|
const t = this.portIdGenerator.create(e.id);
|
|
478
478
|
if (this.graph.getPort(t) !== null)
|
|
479
|
-
throw new
|
|
479
|
+
throw new S("failed to add port with existing id");
|
|
480
480
|
if (this.graph.getNode(e.nodeId) === null)
|
|
481
|
-
throw new
|
|
481
|
+
throw new S("failed to mark port for nonexistent node");
|
|
482
482
|
return this.graphStore.addPort({
|
|
483
483
|
id: t,
|
|
484
484
|
element: e.element,
|
|
@@ -491,7 +491,7 @@ class ae {
|
|
|
491
491
|
*/
|
|
492
492
|
updatePort(e, t) {
|
|
493
493
|
if (this.graph.getPort(e) === null)
|
|
494
|
-
throw new
|
|
494
|
+
throw new S("failed to update nonexistent port");
|
|
495
495
|
return this.graphStore.updatePort(e, t ?? {}), this;
|
|
496
496
|
}
|
|
497
497
|
/**
|
|
@@ -500,7 +500,7 @@ class ae {
|
|
|
500
500
|
*/
|
|
501
501
|
unmarkPort(e) {
|
|
502
502
|
if (this.graph.getPort(e) === null)
|
|
503
|
-
throw new
|
|
503
|
+
throw new S("failed to unmark non existing port");
|
|
504
504
|
return this.graphStore.removePort(e), this;
|
|
505
505
|
}
|
|
506
506
|
/**
|
|
@@ -509,11 +509,11 @@ class ae {
|
|
|
509
509
|
addEdge(e) {
|
|
510
510
|
const t = this.edgeIdGenerator.create(e.id);
|
|
511
511
|
if (this.graph.getEdge(t) !== null)
|
|
512
|
-
throw new
|
|
512
|
+
throw new S("failed to add edge with existing id");
|
|
513
513
|
if (this.graph.getPort(e.from) === null)
|
|
514
|
-
throw new
|
|
514
|
+
throw new S("failed to add edge from nonexistent port");
|
|
515
515
|
if (this.graph.getPort(e.to) === null)
|
|
516
|
-
throw new
|
|
516
|
+
throw new S("failed to add edge to nonexistent port");
|
|
517
517
|
return this.graphStore.addEdge({
|
|
518
518
|
id: t,
|
|
519
519
|
from: e.from,
|
|
@@ -527,7 +527,7 @@ class ae {
|
|
|
527
527
|
*/
|
|
528
528
|
updateEdge(e, t) {
|
|
529
529
|
if (this.graph.getEdge(e) === null)
|
|
530
|
-
throw new
|
|
530
|
+
throw new S("failed to update nonexistent edge");
|
|
531
531
|
return this.graphStore.updateEdge(e, t ?? {}), this;
|
|
532
532
|
}
|
|
533
533
|
/**
|
|
@@ -535,7 +535,7 @@ class ae {
|
|
|
535
535
|
*/
|
|
536
536
|
removeEdge(e) {
|
|
537
537
|
if (this.graph.getEdge(e) === null)
|
|
538
|
-
throw new
|
|
538
|
+
throw new S("failed to remove nonexistent edge");
|
|
539
539
|
return this.graphStore.removeEdge(e), this;
|
|
540
540
|
}
|
|
541
541
|
/**
|
|
@@ -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,11 +866,11 @@ class k {
|
|
|
866
866
|
this.canvas.updateNode(t);
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
|
-
const
|
|
870
|
-
var
|
|
871
|
-
const e = ((
|
|
872
|
-
}), t = ((
|
|
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 = (
|
|
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
|
+
}), 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,
|
|
876
876
|
moveEdgesOnTop: n,
|
|
@@ -881,10 +881,10 @@ const De = (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 Le = (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 Le = (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 Le = (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
|
-
}), a = ((
|
|
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,
|
|
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, 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 Le = (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
|
|
@@ -1261,7 +1261,7 @@ class U {
|
|
|
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
|
|
@@ -1278,7 +1278,7 @@ class U {
|
|
|
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 U {
|
|
|
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
|
-
}), l = ((
|
|
1362
|
-
}),
|
|
1361
|
+
}), l = ((x = i == null ? void 0 : i.events) == null ? void 0 : x.onTransformFinished) ?? (() => {
|
|
1362
|
+
}), p = {
|
|
1363
1363
|
...i,
|
|
1364
1364
|
events: {
|
|
1365
1365
|
...i == null ? void 0 : i.events,
|
|
@@ -1386,7 +1386,7 @@ class X {
|
|
|
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 Ce = () => {
|
|
|
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,34 +1713,31 @@ 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), je = () => {
|
|
1735
|
+
const F = (r) => () => r, re = F(0), Ge = () => {
|
|
1742
1736
|
let r = 0;
|
|
1743
1737
|
return () => r++;
|
|
1744
|
-
},
|
|
1738
|
+
}, Ze = (r, e) => {
|
|
1745
1739
|
let t = re, s = re;
|
|
1746
|
-
const i =
|
|
1740
|
+
const i = Ge();
|
|
1747
1741
|
return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = F(r)), typeof e == "number" && (s = F(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
1748
1742
|
nodesPriorityFn: t,
|
|
1749
1743
|
edgesPriorityFn: s
|
|
@@ -1755,7 +1749,7 @@ const He = (r, e) => ({
|
|
|
1755
1749
|
x: 0,
|
|
1756
1750
|
y: 0
|
|
1757
1751
|
};
|
|
1758
|
-
class
|
|
1752
|
+
class Je {
|
|
1759
1753
|
constructor(e) {
|
|
1760
1754
|
o(this, "path");
|
|
1761
1755
|
o(this, "median");
|
|
@@ -1780,7 +1774,11 @@ class Ze {
|
|
|
1780
1774
|
this.path = `${d}${a}${c}`;
|
|
1781
1775
|
}
|
|
1782
1776
|
}
|
|
1783
|
-
|
|
1777
|
+
const le = (r, e, t, s) => ({
|
|
1778
|
+
x: e * r.x + (1 - e) / 2 * s.x,
|
|
1779
|
+
y: t * r.y + (1 - t) / 2 * s.y
|
|
1780
|
+
});
|
|
1781
|
+
class Ke {
|
|
1784
1782
|
constructor(e) {
|
|
1785
1783
|
o(this, "path");
|
|
1786
1784
|
o(this, "median");
|
|
@@ -1807,31 +1805,32 @@ class Je {
|
|
|
1807
1805
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1808
1806
|
this.params.targetDirection,
|
|
1809
1807
|
this.params.to
|
|
1810
|
-
),
|
|
1808
|
+
), p = {
|
|
1811
1809
|
x: l.x + a,
|
|
1812
1810
|
y: l.y + d
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
|
|
1811
|
+
}, f = {
|
|
1812
|
+
x: (g.x + p.x) / 2,
|
|
1813
|
+
y: (g.y + p.y) / 2
|
|
1814
|
+
}, v = {
|
|
1816
1815
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
1817
1816
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
1818
|
-
},
|
|
1817
|
+
}, A = {
|
|
1819
1818
|
x: l.x - this.params.curvature * this.params.targetDirection.x,
|
|
1820
1819
|
y: l.y - this.params.curvature * this.params.targetDirection.y
|
|
1821
|
-
},
|
|
1820
|
+
}, m = {
|
|
1822
1821
|
x: c.x + a,
|
|
1823
1822
|
y: c.y + d
|
|
1824
|
-
},
|
|
1823
|
+
}, x = {
|
|
1825
1824
|
x: l.x + a,
|
|
1826
1825
|
y: l.y + d
|
|
1827
1826
|
};
|
|
1828
1827
|
this.path = [
|
|
1829
1828
|
`M ${t.x} ${t.y}`,
|
|
1830
1829
|
`L ${c.x} ${c.y}`,
|
|
1831
|
-
`C ${
|
|
1832
|
-
`C ${
|
|
1830
|
+
`C ${v.x} ${v.y} ${m.x} ${m.y} ${f.x} ${f.y}`,
|
|
1831
|
+
`C ${x.x} ${x.y} ${A.x} ${A.y} ${l.x} ${l.y}`,
|
|
1833
1832
|
`L ${s.x} ${s.y}`
|
|
1834
|
-
].join(" ");
|
|
1833
|
+
].join(" "), this.median = le(f, e.flipX, e.flipY, e.to);
|
|
1835
1834
|
}
|
|
1836
1835
|
}
|
|
1837
1836
|
const R = (r, e) => {
|
|
@@ -1841,20 +1840,20 @@ const R = (r, e) => {
|
|
|
1841
1840
|
let i = 0, n = 0, h = 0;
|
|
1842
1841
|
r.forEach((a, d) => {
|
|
1843
1842
|
let c = 0, g = 0, l = 0;
|
|
1844
|
-
const
|
|
1845
|
-
if (
|
|
1843
|
+
const p = d > 0, f = d < s, v = p && f;
|
|
1844
|
+
if (p && (c = -i, g = -n, l = h), f) {
|
|
1846
1845
|
const L = r[d + 1];
|
|
1847
1846
|
i = L.x - a.x, n = L.y - a.y, h = Math.sqrt(i * i + n * n);
|
|
1848
1847
|
}
|
|
1849
|
-
const m = h !== 0 ? Math.min((
|
|
1850
|
-
d > 0 && t.push(`L ${M.x} ${M.y}`),
|
|
1851
|
-
`C ${a.x} ${a.y} ${a.x} ${a.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(
|
|
1850
|
+
`C ${a.x} ${a.y} ${a.x} ${a.y} ${x.x} ${x.y}`
|
|
1852
1851
|
);
|
|
1853
1852
|
});
|
|
1854
1853
|
}
|
|
1855
1854
|
return t.join(" ");
|
|
1856
1855
|
};
|
|
1857
|
-
class
|
|
1856
|
+
class Qe {
|
|
1858
1857
|
constructor(e) {
|
|
1859
1858
|
o(this, "path");
|
|
1860
1859
|
o(this, "median");
|
|
@@ -1883,12 +1882,12 @@ class Ke {
|
|
|
1883
1882
|
), c = Math.max((a.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
|
|
1884
1883
|
x: this.params.flipX > 0 ? c : -n,
|
|
1885
1884
|
y: a.y
|
|
1886
|
-
},
|
|
1885
|
+
}, p = { x: l.x, y: g }, f = {
|
|
1887
1886
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1888
1887
|
y: d.y
|
|
1889
|
-
},
|
|
1888
|
+
}, v = { x: f.x, y: g };
|
|
1890
1889
|
this.path = R(
|
|
1891
|
-
[s, a, l, v, f,
|
|
1890
|
+
[s, a, l, p, v, f, d, i],
|
|
1892
1891
|
this.params.roundness
|
|
1893
1892
|
);
|
|
1894
1893
|
}
|
|
@@ -1917,14 +1916,14 @@ class j {
|
|
|
1917
1916
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1918
1917
|
this.params.targetDirection,
|
|
1919
1918
|
this.params.to
|
|
1920
|
-
),
|
|
1921
|
-
this.median =
|
|
1922
|
-
[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],
|
|
1923
1922
|
this.params.roundness
|
|
1924
1923
|
);
|
|
1925
1924
|
}
|
|
1926
1925
|
}
|
|
1927
|
-
class
|
|
1926
|
+
class _e {
|
|
1928
1927
|
constructor(e) {
|
|
1929
1928
|
o(this, "path");
|
|
1930
1929
|
o(this, "median");
|
|
@@ -1954,7 +1953,7 @@ class Qe {
|
|
|
1954
1953
|
this.path = R([s, h, a, i], this.params.roundness);
|
|
1955
1954
|
}
|
|
1956
1955
|
}
|
|
1957
|
-
class
|
|
1956
|
+
class qe {
|
|
1958
1957
|
constructor(e) {
|
|
1959
1958
|
o(this, "path");
|
|
1960
1959
|
o(this, "median");
|
|
@@ -1983,12 +1982,12 @@ class _e {
|
|
|
1983
1982
|
), c = Math.max((a.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
|
|
1984
1983
|
x: a.x,
|
|
1985
1984
|
y: this.params.flipY > 0 ? c : -n
|
|
1986
|
-
},
|
|
1985
|
+
}, p = { x: g, y: l.y }, f = {
|
|
1987
1986
|
x: d.x,
|
|
1988
1987
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1989
|
-
},
|
|
1988
|
+
}, v = { x: g, y: f.y };
|
|
1990
1989
|
this.path = R(
|
|
1991
|
-
[s, a, l, v, f,
|
|
1990
|
+
[s, a, l, p, v, f, d, i],
|
|
1992
1991
|
this.params.roundness
|
|
1993
1992
|
);
|
|
1994
1993
|
}
|
|
@@ -2013,7 +2012,7 @@ class G {
|
|
|
2013
2012
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${R(a, this.params.roundness)}`, this.median = { x: (a[3].x + a[4].x) / 2, y: (a[3].y + a[4].y) / 2 };
|
|
2014
2013
|
}
|
|
2015
2014
|
}
|
|
2016
|
-
class
|
|
2015
|
+
class et {
|
|
2017
2016
|
constructor(e) {
|
|
2018
2017
|
o(this, "path");
|
|
2019
2018
|
o(this, "median");
|
|
@@ -2024,17 +2023,17 @@ class qe {
|
|
|
2024
2023
|
{ x: c, y: -n },
|
|
2025
2024
|
{ x: d, y: 0 }
|
|
2026
2025
|
].map(
|
|
2027
|
-
(
|
|
2028
|
-
),
|
|
2026
|
+
(v) => y(v, this.params.sourceDirection, w)
|
|
2027
|
+
), p = [
|
|
2029
2028
|
`M ${l[0].x} ${l[0].y}`,
|
|
2030
2029
|
`A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
|
|
2031
2030
|
`A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
|
|
2032
2031
|
`A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
|
|
2033
|
-
].join(" "),
|
|
2034
|
-
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];
|
|
2035
2034
|
}
|
|
2036
2035
|
}
|
|
2037
|
-
class
|
|
2036
|
+
class tt {
|
|
2038
2037
|
constructor(e) {
|
|
2039
2038
|
o(this, "path");
|
|
2040
2039
|
o(this, "median");
|
|
@@ -2070,23 +2069,23 @@ class et {
|
|
|
2070
2069
|
};
|
|
2071
2070
|
}
|
|
2072
2071
|
}
|
|
2073
|
-
const
|
|
2072
|
+
const ge = (r, e) => {
|
|
2074
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`;
|
|
2075
2074
|
}, Z = Object.freeze({
|
|
2076
2075
|
edgeColor: "--edge-color"
|
|
2077
|
-
}),
|
|
2076
|
+
}), ue = (r) => {
|
|
2078
2077
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2079
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;
|
|
2080
2079
|
}, V = () => {
|
|
2081
2080
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2082
2081
|
return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
|
|
2083
|
-
},
|
|
2082
|
+
}, we = () => {
|
|
2084
2083
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2085
2084
|
return r.style.transformOrigin = "50% 50%", r;
|
|
2086
|
-
},
|
|
2085
|
+
}, pe = (r) => {
|
|
2087
2086
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2088
2087
|
return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
2089
|
-
},
|
|
2088
|
+
}, fe = (r, e) => {
|
|
2090
2089
|
const t = {
|
|
2091
2090
|
x: r.x + r.width / 2,
|
|
2092
2091
|
y: r.y + r.height / 2
|
|
@@ -2131,20 +2130,20 @@ const ce = (r, e) => {
|
|
|
2131
2130
|
class C {
|
|
2132
2131
|
constructor(e) {
|
|
2133
2132
|
o(this, "svg");
|
|
2134
|
-
o(this, "group",
|
|
2133
|
+
o(this, "group", we());
|
|
2135
2134
|
o(this, "line");
|
|
2136
2135
|
o(this, "sourceArrow", null);
|
|
2137
2136
|
o(this, "targetArrow", null);
|
|
2138
2137
|
o(this, "onAfterRender");
|
|
2139
2138
|
o(this, "afterRenderEmitter");
|
|
2140
|
-
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));
|
|
2141
2140
|
}
|
|
2142
2141
|
render(e) {
|
|
2143
|
-
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(
|
|
2144
2143
|
e.from,
|
|
2145
2144
|
e.to
|
|
2146
2145
|
);
|
|
2147
|
-
|
|
2146
|
+
ge(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
|
|
2148
2147
|
const d = oe(
|
|
2149
2148
|
e.from.direction,
|
|
2150
2149
|
h,
|
|
@@ -2157,16 +2156,16 @@ class C {
|
|
|
2157
2156
|
x: i,
|
|
2158
2157
|
y: n
|
|
2159
2158
|
};
|
|
2160
|
-
let l = c,
|
|
2161
|
-
e.from.portId === e.to.portId ? (
|
|
2162
|
-
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(
|
|
2163
2162
|
d,
|
|
2164
2163
|
c,
|
|
2165
2164
|
g,
|
|
2166
2165
|
h,
|
|
2167
2166
|
a
|
|
2168
2167
|
);
|
|
2169
|
-
this.line.setAttribute("d",
|
|
2168
|
+
this.line.setAttribute("d", v.path);
|
|
2170
2169
|
let A = null;
|
|
2171
2170
|
this.sourceArrow && (A = O(
|
|
2172
2171
|
d,
|
|
@@ -2178,16 +2177,16 @@ class C {
|
|
|
2178
2177
|
this.targetArrow && (m = O(
|
|
2179
2178
|
l,
|
|
2180
2179
|
g,
|
|
2181
|
-
|
|
2180
|
+
p,
|
|
2182
2181
|
this.params.arrowWidth
|
|
2183
2182
|
), this.targetArrow.setAttribute("d", m)), this.afterRenderEmitter.emit({
|
|
2184
|
-
edgePath:
|
|
2183
|
+
edgePath: v,
|
|
2185
2184
|
sourceArrowPath: A,
|
|
2186
2185
|
targetArrowPath: m
|
|
2187
2186
|
});
|
|
2188
2187
|
}
|
|
2189
2188
|
}
|
|
2190
|
-
class
|
|
2189
|
+
class rt {
|
|
2191
2190
|
constructor(e) {
|
|
2192
2191
|
o(this, "svg");
|
|
2193
2192
|
o(this, "group");
|
|
@@ -2205,7 +2204,7 @@ class tt {
|
|
|
2205
2204
|
o(this, "hasSourceArrow");
|
|
2206
2205
|
o(this, "hasTargetArrow");
|
|
2207
2206
|
o(this, "pathShape");
|
|
2208
|
-
o(this, "createCyclePath", (e) => new
|
|
2207
|
+
o(this, "createCyclePath", (e) => new et({
|
|
2209
2208
|
sourceDirection: e,
|
|
2210
2209
|
radius: this.portCycleRadius,
|
|
2211
2210
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -2213,7 +2212,7 @@ class tt {
|
|
|
2213
2212
|
hasSourceArrow: this.hasSourceArrow,
|
|
2214
2213
|
hasTargetArrow: this.hasTargetArrow
|
|
2215
2214
|
}));
|
|
2216
|
-
o(this, "createDetourPath", (e, t, s, i, n) => new
|
|
2215
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new Ke({
|
|
2217
2216
|
to: s,
|
|
2218
2217
|
sourceDirection: e,
|
|
2219
2218
|
targetDirection: t,
|
|
@@ -2226,7 +2225,7 @@ class tt {
|
|
|
2226
2225
|
hasSourceArrow: this.hasSourceArrow,
|
|
2227
2226
|
hasTargetArrow: this.hasTargetArrow
|
|
2228
2227
|
}));
|
|
2229
|
-
o(this, "createLinePath", (e, t, s) => new
|
|
2228
|
+
o(this, "createLinePath", (e, t, s) => new Je({
|
|
2230
2229
|
to: s,
|
|
2231
2230
|
sourceDirection: e,
|
|
2232
2231
|
targetDirection: t,
|
|
@@ -2251,7 +2250,7 @@ class tt {
|
|
|
2251
2250
|
this.pathShape.render(e);
|
|
2252
2251
|
}
|
|
2253
2252
|
}
|
|
2254
|
-
class
|
|
2253
|
+
class ot {
|
|
2255
2254
|
constructor(e) {
|
|
2256
2255
|
o(this, "svg");
|
|
2257
2256
|
o(this, "group");
|
|
@@ -2292,7 +2291,7 @@ class rt {
|
|
|
2292
2291
|
hasSourceArrow: this.hasSourceArrow,
|
|
2293
2292
|
hasTargetArrow: this.hasTargetArrow
|
|
2294
2293
|
}));
|
|
2295
|
-
o(this, "createLinePath", (e, t, s, i) => new
|
|
2294
|
+
o(this, "createLinePath", (e, t, s, i) => new Qe({
|
|
2296
2295
|
to: s,
|
|
2297
2296
|
sourceDirection: e,
|
|
2298
2297
|
targetDirection: t,
|
|
@@ -2325,7 +2324,7 @@ class rt {
|
|
|
2325
2324
|
this.pathShape.render(e);
|
|
2326
2325
|
}
|
|
2327
2326
|
}
|
|
2328
|
-
class
|
|
2327
|
+
class st {
|
|
2329
2328
|
constructor(e) {
|
|
2330
2329
|
o(this, "svg");
|
|
2331
2330
|
o(this, "group");
|
|
@@ -2366,7 +2365,7 @@ class ot {
|
|
|
2366
2365
|
hasSourceArrow: this.hasSourceArrow,
|
|
2367
2366
|
hasTargetArrow: this.hasTargetArrow
|
|
2368
2367
|
}));
|
|
2369
|
-
o(this, "createLinePath", (e, t, s) => new
|
|
2368
|
+
o(this, "createLinePath", (e, t, s) => new _e({
|
|
2370
2369
|
to: s,
|
|
2371
2370
|
sourceDirection: e,
|
|
2372
2371
|
targetDirection: t,
|
|
@@ -2398,7 +2397,7 @@ class ot {
|
|
|
2398
2397
|
this.pathShape.render(e);
|
|
2399
2398
|
}
|
|
2400
2399
|
}
|
|
2401
|
-
class
|
|
2400
|
+
class it {
|
|
2402
2401
|
constructor(e) {
|
|
2403
2402
|
o(this, "svg");
|
|
2404
2403
|
o(this, "group");
|
|
@@ -2439,7 +2438,7 @@ class st {
|
|
|
2439
2438
|
hasSourceArrow: this.hasSourceArrow,
|
|
2440
2439
|
hasTargetArrow: this.hasTargetArrow
|
|
2441
2440
|
}));
|
|
2442
|
-
o(this, "createLinePath", (e, t, s, i, n) => new
|
|
2441
|
+
o(this, "createLinePath", (e, t, s, i, n) => new qe({
|
|
2443
2442
|
to: s,
|
|
2444
2443
|
sourceDirection: e,
|
|
2445
2444
|
targetDirection: t,
|
|
@@ -2489,10 +2488,10 @@ const se = (r) => {
|
|
|
2489
2488
|
r.arrowWidth
|
|
2490
2489
|
);
|
|
2491
2490
|
};
|
|
2492
|
-
class
|
|
2491
|
+
class nt {
|
|
2493
2492
|
constructor(e) {
|
|
2494
2493
|
o(this, "svg");
|
|
2495
|
-
o(this, "group",
|
|
2494
|
+
o(this, "group", we());
|
|
2496
2495
|
o(this, "line");
|
|
2497
2496
|
o(this, "sourceArrow", null);
|
|
2498
2497
|
o(this, "targetArrow", null);
|
|
@@ -2504,15 +2503,15 @@ class it {
|
|
|
2504
2503
|
o(this, "targetOffset");
|
|
2505
2504
|
o(this, "onAfterRender");
|
|
2506
2505
|
o(this, "afterRenderEmitter");
|
|
2507
|
-
[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));
|
|
2508
2507
|
}
|
|
2509
2508
|
render(e) {
|
|
2510
|
-
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(
|
|
2511
2510
|
e.from,
|
|
2512
2511
|
e.to
|
|
2513
2512
|
);
|
|
2514
|
-
|
|
2515
|
-
const d = { x: i, y: n }, c = new
|
|
2513
|
+
ge(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${h}, ${a})`;
|
|
2514
|
+
const d = { x: i, y: n }, c = new tt({
|
|
2516
2515
|
to: d,
|
|
2517
2516
|
sourceOffset: this.sourceOffset,
|
|
2518
2517
|
targetOffset: this.targetOffset,
|
|
@@ -2547,40 +2546,40 @@ class it {
|
|
|
2547
2546
|
});
|
|
2548
2547
|
}
|
|
2549
2548
|
}
|
|
2550
|
-
const
|
|
2549
|
+
const ht = () => {
|
|
2551
2550
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2552
2551
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
2553
|
-
},
|
|
2552
|
+
}, at = (r) => {
|
|
2554
2553
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2555
2554
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
2556
2555
|
}, ie = (r) => {
|
|
2557
2556
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2558
2557
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
2559
2558
|
};
|
|
2560
|
-
class
|
|
2559
|
+
class dt extends Error {
|
|
2561
2560
|
constructor(e) {
|
|
2562
2561
|
super(e), this.name = "InteractiveEdgeError";
|
|
2563
2562
|
}
|
|
2564
2563
|
}
|
|
2565
|
-
class
|
|
2564
|
+
class ve {
|
|
2566
2565
|
constructor(e, t) {
|
|
2567
2566
|
o(this, "svg");
|
|
2568
2567
|
o(this, "group");
|
|
2569
2568
|
o(this, "line");
|
|
2570
2569
|
o(this, "sourceArrow");
|
|
2571
2570
|
o(this, "targetArrow");
|
|
2572
|
-
o(this, "handle",
|
|
2571
|
+
o(this, "handle", ht());
|
|
2573
2572
|
o(this, "onAfterRender");
|
|
2574
2573
|
o(this, "interactiveLine");
|
|
2575
2574
|
o(this, "interactiveSourceArrow", null);
|
|
2576
2575
|
o(this, "interactiveTargetArrow", null);
|
|
2577
|
-
if (this.baseEdge = e, e instanceof
|
|
2578
|
-
throw new
|
|
2576
|
+
if (this.baseEdge = e, e instanceof ve)
|
|
2577
|
+
throw new dt(
|
|
2579
2578
|
"interactive edge can be configured only once"
|
|
2580
2579
|
);
|
|
2581
2580
|
this.svg = this.baseEdge.svg, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
|
|
2582
2581
|
const s = (t == null ? void 0 : t.width) ?? u.interactiveWidth;
|
|
2583
|
-
this.interactiveLine =
|
|
2582
|
+
this.interactiveLine = at(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ie(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ie(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
|
|
2584
2583
|
this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
|
|
2585
2584
|
});
|
|
2586
2585
|
}
|
|
@@ -2588,7 +2587,7 @@ class pe {
|
|
|
2588
2587
|
this.baseEdge.render(e);
|
|
2589
2588
|
}
|
|
2590
2589
|
}
|
|
2591
|
-
class
|
|
2590
|
+
class ut {
|
|
2592
2591
|
constructor(e, t) {
|
|
2593
2592
|
o(this, "group");
|
|
2594
2593
|
o(this, "line");
|
|
@@ -2605,12 +2604,12 @@ class gt {
|
|
|
2605
2604
|
this.baseShape.render(e);
|
|
2606
2605
|
}
|
|
2607
2606
|
}
|
|
2608
|
-
const
|
|
2607
|
+
const ye = (r) => {
|
|
2609
2608
|
if (typeof r == "function")
|
|
2610
2609
|
return r;
|
|
2611
2610
|
switch (r == null ? void 0 : r.type) {
|
|
2612
2611
|
case "straight":
|
|
2613
|
-
return () => new
|
|
2612
|
+
return () => new st({
|
|
2614
2613
|
color: r.color,
|
|
2615
2614
|
width: r.width,
|
|
2616
2615
|
arrowLength: r.arrowLength,
|
|
@@ -2624,7 +2623,7 @@ const dt = (r) => {
|
|
|
2624
2623
|
detourDirection: r.detourDirection
|
|
2625
2624
|
});
|
|
2626
2625
|
case "horizontal":
|
|
2627
|
-
return () => new
|
|
2626
|
+
return () => new ot({
|
|
2628
2627
|
color: r.color,
|
|
2629
2628
|
width: r.width,
|
|
2630
2629
|
arrowLength: r.arrowLength,
|
|
@@ -2638,7 +2637,7 @@ const dt = (r) => {
|
|
|
2638
2637
|
detourDirection: r.detourDirection
|
|
2639
2638
|
});
|
|
2640
2639
|
case "vertical":
|
|
2641
|
-
return () => new
|
|
2640
|
+
return () => new it({
|
|
2642
2641
|
color: r.color,
|
|
2643
2642
|
width: r.width,
|
|
2644
2643
|
arrowLength: r.arrowLength,
|
|
@@ -2652,7 +2651,7 @@ const dt = (r) => {
|
|
|
2652
2651
|
detourDirection: r.detourDirection
|
|
2653
2652
|
});
|
|
2654
2653
|
case "direct":
|
|
2655
|
-
return () => new
|
|
2654
|
+
return () => new nt({
|
|
2656
2655
|
color: r.color,
|
|
2657
2656
|
width: r.width,
|
|
2658
2657
|
arrowLength: r.arrowLength,
|
|
@@ -2663,7 +2662,7 @@ const dt = (r) => {
|
|
|
2663
2662
|
targetOffset: r.targetOffset
|
|
2664
2663
|
});
|
|
2665
2664
|
default:
|
|
2666
|
-
return () => new
|
|
2665
|
+
return () => new rt({
|
|
2667
2666
|
color: r.color,
|
|
2668
2667
|
width: r.width,
|
|
2669
2668
|
arrowLength: r.arrowLength,
|
|
@@ -2679,25 +2678,42 @@ const dt = (r) => {
|
|
|
2679
2678
|
}
|
|
2680
2679
|
}, ct = (r) => {
|
|
2681
2680
|
var t, s, i, n, h;
|
|
2682
|
-
const e =
|
|
2681
|
+
const e = Ze(
|
|
2683
2682
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
2684
2683
|
(s = r.edges) == null ? void 0 : s.priority
|
|
2685
2684
|
);
|
|
2686
2685
|
return {
|
|
2687
2686
|
nodes: {
|
|
2688
|
-
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ??
|
|
2687
|
+
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? ce,
|
|
2689
2688
|
priorityFn: e.nodesPriorityFn
|
|
2690
2689
|
},
|
|
2691
2690
|
ports: {
|
|
2692
2691
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
2693
2692
|
},
|
|
2694
2693
|
edges: {
|
|
2695
|
-
shapeFactory:
|
|
2694
|
+
shapeFactory: ye(((h = r.edges) == null ? void 0 : h.shape) ?? {}),
|
|
2696
2695
|
priorityFn: e.edgesPriorityFn
|
|
2697
2696
|
}
|
|
2698
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
|
+
};
|
|
2699
2715
|
};
|
|
2700
|
-
class
|
|
2716
|
+
class wt {
|
|
2701
2717
|
constructor(e) {
|
|
2702
2718
|
o(this, "element", null);
|
|
2703
2719
|
o(this, "canvasDefaults", {});
|
|
@@ -2776,18 +2792,18 @@ class ut {
|
|
|
2776
2792
|
*/
|
|
2777
2793
|
build() {
|
|
2778
2794
|
if (this.element === null)
|
|
2779
|
-
throw new
|
|
2795
|
+
throw new S(
|
|
2780
2796
|
"unable to build canvas when no attach element specified"
|
|
2781
2797
|
);
|
|
2782
2798
|
let e = this.boxRenderingTrigger;
|
|
2783
2799
|
this.virtualScrollConfig !== void 0 && e === void 0 && (e = new he());
|
|
2784
|
-
const t = new de(), s = new
|
|
2800
|
+
const t = new de(), s = new Me(), i = new je(this.element);
|
|
2785
2801
|
let n = new ne(
|
|
2786
2802
|
t,
|
|
2787
2803
|
s,
|
|
2788
2804
|
i.main
|
|
2789
2805
|
);
|
|
2790
|
-
e !== void 0 && (n = new
|
|
2806
|
+
e !== void 0 && (n = new Te(n, t, e));
|
|
2791
2807
|
const h = ct(this.canvasDefaults), a = new ae(
|
|
2792
2808
|
this.element,
|
|
2793
2809
|
t,
|
|
@@ -2797,7 +2813,7 @@ class ut {
|
|
|
2797
2813
|
), d = () => {
|
|
2798
2814
|
i.destroy(), a.onBeforeDestroy.unsubscribe(d);
|
|
2799
2815
|
};
|
|
2800
|
-
|
|
2816
|
+
if (a.onBeforeDestroy.subscribe(d), this.hasBackground && Y.configure(
|
|
2801
2817
|
a,
|
|
2802
2818
|
this.backgroundConfig,
|
|
2803
2819
|
i.background
|
|
@@ -2806,14 +2822,21 @@ class ut {
|
|
|
2806
2822
|
i.main,
|
|
2807
2823
|
this.window,
|
|
2808
2824
|
this.dragConfig
|
|
2809
|
-
), this.hasUserConnectablePorts
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
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(
|
|
2817
2840
|
a,
|
|
2818
2841
|
i.main,
|
|
2819
2842
|
this.window,
|
|
@@ -2836,16 +2859,16 @@ class ut {
|
|
|
2836
2859
|
}
|
|
2837
2860
|
}
|
|
2838
2861
|
export {
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2862
|
+
rt as BezierEdgeShape,
|
|
2863
|
+
wt as CanvasBuilder,
|
|
2864
|
+
nt as DirectEdgeShape,
|
|
2842
2865
|
he as EventSubject,
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2866
|
+
ot as HorizontalEdgeShape,
|
|
2867
|
+
S as HtmlGraphError,
|
|
2868
|
+
dt as InteractiveEdgeError,
|
|
2869
|
+
ve as InteractiveEdgeShape,
|
|
2847
2870
|
C as LineEdgeShape,
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2871
|
+
ut as MedianEdgeShape,
|
|
2872
|
+
st as StraightEdgeShape,
|
|
2873
|
+
it as VerticalEdgeShape
|
|
2851
2874
|
};
|