@html-graph/html-graph 8.17.0 → 8.18.1
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/README.md +3 -3
- package/dist/html-graph.d.ts +26 -13
- package/dist/html-graph.js +306 -226
- package/dist/html-graph.min.js +893 -841
- package/dist/html-graph.min.umd.cjs +1 -1
- package/dist/html-graph.umd.cjs +306 -226
- package/package.json +1 -1
package/dist/html-graph.min.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r, e, t) =>
|
|
1
|
+
var st = Object.defineProperty;
|
|
2
|
+
var it = (r, e, t) => e in r ? st(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => it(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
var I = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(I || {});
|
|
5
|
-
const
|
|
5
|
+
const nt = () => {
|
|
6
6
|
const r = document.createElement("div");
|
|
7
7
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
8
|
-
},
|
|
8
|
+
}, at = () => {
|
|
9
9
|
const r = document.createElement("div");
|
|
10
10
|
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
11
|
-
},
|
|
11
|
+
}, ht = (r) => {
|
|
12
12
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
13
|
-
},
|
|
13
|
+
}, dt = (r) => {
|
|
14
14
|
r.style.removeProperty("position"), r.style.removeProperty("top"), r.style.removeProperty("left"), r.style.removeProperty("visibility"), r.style.removeProperty("transform");
|
|
15
15
|
};
|
|
16
|
-
class
|
|
16
|
+
class Re {
|
|
17
17
|
constructor(e, t, o) {
|
|
18
|
-
i(this, "host",
|
|
19
|
-
i(this, "container",
|
|
18
|
+
i(this, "host", nt());
|
|
19
|
+
i(this, "container", at());
|
|
20
20
|
i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
21
21
|
i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
|
|
22
22
|
i(this, "applyTransform", () => {
|
|
@@ -27,11 +27,11 @@ class Te {
|
|
|
27
27
|
}
|
|
28
28
|
attachNode(e) {
|
|
29
29
|
const t = this.graphStore.getNode(e);
|
|
30
|
-
|
|
30
|
+
ht(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
|
|
31
31
|
}
|
|
32
32
|
detachNode(e) {
|
|
33
33
|
const t = this.graphStore.getNode(e);
|
|
34
|
-
|
|
34
|
+
dt(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
|
|
35
35
|
}
|
|
36
36
|
attachEdge(e) {
|
|
37
37
|
const t = this.graphStore.getEdge(e).payload.shape.svg;
|
|
@@ -71,9 +71,9 @@ class Te {
|
|
|
71
71
|
n,
|
|
72
72
|
h,
|
|
73
73
|
d
|
|
74
|
-
),
|
|
75
|
-
let
|
|
76
|
-
o.element === s.element ?
|
|
74
|
+
), l = this.createEdgeRenderPort(s, a, h, d);
|
|
75
|
+
let u = I.Line;
|
|
76
|
+
o.element === s.element ? u = I.PortCycle : o.nodeId === s.nodeId && (u = I.NodeCycle), t.payload.shape.render({ from: c, to: l, category: u });
|
|
77
77
|
}
|
|
78
78
|
updateEdgePriority(e) {
|
|
79
79
|
const t = this.graphStore.getEdge(e);
|
|
@@ -93,7 +93,7 @@ class Te {
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
class
|
|
96
|
+
class ct {
|
|
97
97
|
constructor(e) {
|
|
98
98
|
i(this, "xFrom", 1 / 0);
|
|
99
99
|
i(this, "yFrom", 1 / 0);
|
|
@@ -109,11 +109,11 @@ class it {
|
|
|
109
109
|
return o >= this.xFrom && o <= this.xTo && s >= this.yFrom && s <= this.yTo;
|
|
110
110
|
}
|
|
111
111
|
hasEdge(e) {
|
|
112
|
-
const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(o).payload, a = this.graphStore.getNode(s).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y),
|
|
113
|
-
return h <= this.xTo && d >= this.xFrom && c <= this.yTo &&
|
|
112
|
+
const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from).nodeId, s = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(o).payload, a = this.graphStore.getNode(s).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), l = Math.max(n.y, a.y);
|
|
113
|
+
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && l >= this.yFrom;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
class
|
|
116
|
+
class lt {
|
|
117
117
|
constructor(e, t, o, s) {
|
|
118
118
|
i(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
119
119
|
i(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -125,8 +125,8 @@ class nt {
|
|
|
125
125
|
const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
|
|
126
126
|
h && !d ? t.add(a) : !h && d && o.add(a);
|
|
127
127
|
}), this.graphStore.getAllEdgeIds().forEach((a) => {
|
|
128
|
-
const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a),
|
|
129
|
-
h && (this.renderingBox.hasNode(
|
|
128
|
+
const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), l = this.graphStore.getPort(c.from).nodeId, u = this.graphStore.getPort(c.to).nodeId;
|
|
129
|
+
h && (this.renderingBox.hasNode(l) || (t.add(l), o.delete(l)), this.renderingBox.hasNode(u) || (t.add(u), o.delete(u))), h && !d ? s.add(a) : !h && d && n.add(a);
|
|
130
130
|
}), n.forEach((a) => {
|
|
131
131
|
this.handleDetachEdge(a);
|
|
132
132
|
}), o.forEach((a) => {
|
|
@@ -137,7 +137,7 @@ class nt {
|
|
|
137
137
|
this.handleAttachEdge(a);
|
|
138
138
|
});
|
|
139
139
|
});
|
|
140
|
-
this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new
|
|
140
|
+
this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new ct(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
141
141
|
}
|
|
142
142
|
attachNode(e) {
|
|
143
143
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -191,7 +191,7 @@ class nt {
|
|
|
191
191
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
class
|
|
194
|
+
class ut {
|
|
195
195
|
constructor(e, t) {
|
|
196
196
|
i(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
197
197
|
i(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
@@ -261,16 +261,16 @@ class q {
|
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
const
|
|
264
|
+
const C = () => {
|
|
265
265
|
const r = new q();
|
|
266
266
|
return [r, r];
|
|
267
267
|
};
|
|
268
|
-
class
|
|
268
|
+
class Le {
|
|
269
269
|
constructor(e, t, o, s) {
|
|
270
270
|
i(this, "beforeDestroyEmitter");
|
|
271
271
|
i(this, "destroyed", !1);
|
|
272
272
|
i(this, "onBeforeDestroy");
|
|
273
|
-
this.graph = e, this.viewport = t, this.graphController = o, this.viewportController = s, [this.beforeDestroyEmitter, this.onBeforeDestroy] =
|
|
273
|
+
this.graph = e, this.viewport = t, this.graphController = o, this.viewportController = s, [this.beforeDestroyEmitter, this.onBeforeDestroy] = C();
|
|
274
274
|
}
|
|
275
275
|
addNode(e) {
|
|
276
276
|
return this.graphController.addNode(e), this;
|
|
@@ -318,7 +318,7 @@ class Ce {
|
|
|
318
318
|
this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
class
|
|
321
|
+
class gt {
|
|
322
322
|
constructor() {
|
|
323
323
|
i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
324
324
|
i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -378,7 +378,7 @@ const S = Object.freeze({
|
|
|
378
378
|
removeNonexistentPort: (r) => `Failed to remove port with ID ${JSON.stringify(r)} because it does not exist`,
|
|
379
379
|
accessNonexistentEdge: (r) => `Failed to access edge with ID ${JSON.stringify(r)} because it does not exist`,
|
|
380
380
|
addEdgeWithExistingId: (r) => `Failed to add edge with ID ${JSON.stringify(r)} because an edge with this ID already exists`,
|
|
381
|
-
addEdgeWithElementInUse: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} because its
|
|
381
|
+
addEdgeWithElementInUse: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} because its element is already attached to edge with ID ${JSON.stringify(e)}`,
|
|
382
382
|
addEdgeFromNonexistentPort: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} from port with ID ${JSON.stringify(e)} because the port does not exist`,
|
|
383
383
|
addEdgeToNonexistentPort: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} to port with ID ${JSON.stringify(e)} because the port does not exist`,
|
|
384
384
|
updateNonexistentEdge: (r) => `Failed to update edge with ID ${JSON.stringify(r)} because it does not exist`,
|
|
@@ -387,7 +387,7 @@ const S = Object.freeze({
|
|
|
387
387
|
removeNonexistentEdge: (r) => `Failed to remove edge with ID ${JSON.stringify(r)} because it does not exist`,
|
|
388
388
|
accessEdgesForNonexistentPort: (r) => `Failed to access edges for port with ID ${JSON.stringify(r)} because the port does not exist`
|
|
389
389
|
});
|
|
390
|
-
class
|
|
390
|
+
class Ve {
|
|
391
391
|
constructor() {
|
|
392
392
|
i(this, "nodes", /* @__PURE__ */ new Map());
|
|
393
393
|
i(this, "ports", /* @__PURE__ */ new Map());
|
|
@@ -396,7 +396,7 @@ class Me {
|
|
|
396
396
|
i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
397
397
|
i(this, "portOutgoingEdges", /* @__PURE__ */ new Map());
|
|
398
398
|
i(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
399
|
-
i(this, "elementPorts", new
|
|
399
|
+
i(this, "elementPorts", new gt());
|
|
400
400
|
i(this, "edgesElementsMap", /* @__PURE__ */ new Map());
|
|
401
401
|
i(this, "afterNodeAddedEmitter");
|
|
402
402
|
i(this, "onAfterNodeAdded");
|
|
@@ -424,7 +424,7 @@ class Me {
|
|
|
424
424
|
i(this, "onBeforeEdgeRemoved");
|
|
425
425
|
i(this, "beforeClearEmitter");
|
|
426
426
|
i(this, "onBeforeClear");
|
|
427
|
-
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] =
|
|
427
|
+
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] = C(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = C(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = C(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = C(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = C(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = C(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = C(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = C(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = C(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = C(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = C(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = C(), [this.beforeClearEmitter, this.onBeforeClear] = C();
|
|
428
428
|
}
|
|
429
429
|
hasNode(e) {
|
|
430
430
|
return this.nodes.has(e);
|
|
@@ -682,11 +682,11 @@ class Me {
|
|
|
682
682
|
this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(o).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(o).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(o).delete(e), this.edges.delete(e), this.edgesElementsMap.delete(s.shape.svg);
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
|
-
const
|
|
685
|
+
const me = (r) => ({
|
|
686
686
|
scale: 1 / r.scale,
|
|
687
687
|
x: -r.x / r.scale,
|
|
688
688
|
y: -r.y / r.scale
|
|
689
|
-
}),
|
|
689
|
+
}), Ee = {
|
|
690
690
|
scale: 1,
|
|
691
691
|
x: 0,
|
|
692
692
|
y: 0
|
|
@@ -694,10 +694,10 @@ const ve = (r) => ({
|
|
|
694
694
|
x: r.scale * e.x + r.x,
|
|
695
695
|
y: r.scale * e.y + r.y
|
|
696
696
|
});
|
|
697
|
-
class
|
|
697
|
+
class pt {
|
|
698
698
|
constructor(e) {
|
|
699
|
-
i(this, "viewportMatrix",
|
|
700
|
-
i(this, "contentMatrix",
|
|
699
|
+
i(this, "viewportMatrix", Ee);
|
|
700
|
+
i(this, "contentMatrix", Ee);
|
|
701
701
|
i(this, "beforeUpdateEmitter");
|
|
702
702
|
i(this, "onBeforeUpdated");
|
|
703
703
|
i(this, "afterUpdateEmitter");
|
|
@@ -707,7 +707,7 @@ class dt {
|
|
|
707
707
|
i(this, "observer", new ResizeObserver(() => {
|
|
708
708
|
this.afterResizeEmitter.emit();
|
|
709
709
|
}));
|
|
710
|
-
this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] =
|
|
710
|
+
this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] = C(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = C(), [this.afterResizeEmitter, this.onAfterResize] = C(), this.observer.observe(this.host);
|
|
711
711
|
}
|
|
712
712
|
getViewportMatrix() {
|
|
713
713
|
return this.viewportMatrix;
|
|
@@ -720,14 +720,14 @@ class dt {
|
|
|
720
720
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
721
721
|
x: e.x ?? this.viewportMatrix.x,
|
|
722
722
|
y: e.y ?? this.viewportMatrix.y
|
|
723
|
-
}, this.beforeUpdateEmitter.emit(), this.contentMatrix =
|
|
723
|
+
}, this.beforeUpdateEmitter.emit(), this.contentMatrix = me(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
724
724
|
}
|
|
725
725
|
patchContentMatrix(e) {
|
|
726
726
|
this.contentMatrix = {
|
|
727
727
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
728
728
|
x: e.x ?? this.contentMatrix.x,
|
|
729
729
|
y: e.y ?? this.contentMatrix.y
|
|
730
|
-
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix =
|
|
730
|
+
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix = me(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
731
731
|
}
|
|
732
732
|
getDimensions() {
|
|
733
733
|
const { width: e, height: t } = this.host.getBoundingClientRect();
|
|
@@ -776,16 +776,16 @@ class ee {
|
|
|
776
776
|
this.canvas.updateNode(t);
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
|
-
const
|
|
779
|
+
const wt = (r, e, t) => {
|
|
780
780
|
const { x: o, y: s, width: n, height: a } = r.getBoundingClientRect();
|
|
781
781
|
return e >= o && e <= o + n && t >= s && t <= s + a;
|
|
782
|
-
},
|
|
783
|
-
class
|
|
782
|
+
}, ft = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight;
|
|
783
|
+
class yt {
|
|
784
784
|
constructor(e, t) {
|
|
785
785
|
this.element = e, this.win = t;
|
|
786
786
|
}
|
|
787
787
|
verify(e, t) {
|
|
788
|
-
return
|
|
788
|
+
return wt(this.element, e, t) && ft(this.win, e, t);
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
791
|
const H = (r, e) => {
|
|
@@ -805,7 +805,7 @@ const H = (r, e) => {
|
|
|
805
805
|
}
|
|
806
806
|
]
|
|
807
807
|
};
|
|
808
|
-
},
|
|
808
|
+
}, vt = (r, e) => {
|
|
809
809
|
let t = e;
|
|
810
810
|
for (; t !== null; ) {
|
|
811
811
|
const o = r.findPortIdsByElement(t)[0] ?? null;
|
|
@@ -824,21 +824,21 @@ const H = (r, e) => {
|
|
|
824
824
|
status: "notFound"
|
|
825
825
|
};
|
|
826
826
|
};
|
|
827
|
-
function*
|
|
827
|
+
function* Ie(r, e) {
|
|
828
828
|
const t = r.elementsFromPoint(e.x, e.y);
|
|
829
829
|
for (const o of t) {
|
|
830
830
|
if (o.shadowRoot !== null) {
|
|
831
|
-
const s =
|
|
831
|
+
const s = Ie(o.shadowRoot, e);
|
|
832
832
|
for (const n of s)
|
|
833
833
|
yield n;
|
|
834
834
|
}
|
|
835
835
|
yield o;
|
|
836
836
|
}
|
|
837
837
|
}
|
|
838
|
-
const
|
|
839
|
-
const t =
|
|
838
|
+
const Fe = (r, e) => {
|
|
839
|
+
const t = Ie(document, e);
|
|
840
840
|
for (const o of t) {
|
|
841
|
-
const s =
|
|
841
|
+
const s = vt(r, o);
|
|
842
842
|
if (s.status === "portFound")
|
|
843
843
|
return s.portId;
|
|
844
844
|
if (s.status === "nodeEncountered")
|
|
@@ -846,14 +846,14 @@ const Re = (r, e) => {
|
|
|
846
846
|
}
|
|
847
847
|
return null;
|
|
848
848
|
};
|
|
849
|
-
var
|
|
850
|
-
const
|
|
849
|
+
var M = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(M || {});
|
|
850
|
+
const Ue = (r, e) => ({
|
|
851
851
|
x: r / 2,
|
|
852
852
|
y: e / 2
|
|
853
853
|
}), m = (r, e, t) => ({
|
|
854
854
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
855
855
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
856
|
-
}),
|
|
856
|
+
}), $e = (r, e, t) => {
|
|
857
857
|
const o = {
|
|
858
858
|
x: r.x + r.width / 2,
|
|
859
859
|
y: r.y + r.height / 2
|
|
@@ -870,7 +870,7 @@ const Le = (r, e) => ({
|
|
|
870
870
|
to: { x: s.x - n, y: s.y - a }
|
|
871
871
|
};
|
|
872
872
|
};
|
|
873
|
-
class
|
|
873
|
+
class mt {
|
|
874
874
|
constructor(e) {
|
|
875
875
|
i(this, "path");
|
|
876
876
|
i(this, "midpoint");
|
|
@@ -883,9 +883,9 @@ class pt {
|
|
|
883
883
|
curvature: h,
|
|
884
884
|
hasSourceArrow: d,
|
|
885
885
|
hasTargetArrow: c
|
|
886
|
-
} = e,
|
|
887
|
-
this.midpoint = { x:
|
|
888
|
-
const
|
|
886
|
+
} = e, l = (t.x + o.x) / 2, u = (t.y + o.y) / 2;
|
|
887
|
+
this.midpoint = { x: l, y: u };
|
|
888
|
+
const g = m(
|
|
889
889
|
{ x: t.x + s, y: t.y },
|
|
890
890
|
n,
|
|
891
891
|
t
|
|
@@ -894,16 +894,16 @@ class pt {
|
|
|
894
894
|
a,
|
|
895
895
|
o
|
|
896
896
|
), w = {
|
|
897
|
-
x:
|
|
898
|
-
y:
|
|
899
|
-
},
|
|
897
|
+
x: g.x + n.x * h,
|
|
898
|
+
y: g.y + n.y * h
|
|
899
|
+
}, f = {
|
|
900
900
|
x: p.x - a.x * h,
|
|
901
901
|
y: p.y - a.y * h
|
|
902
|
-
},
|
|
903
|
-
this.path = `${
|
|
902
|
+
}, y = `M ${g.x} ${g.y} C ${w.x} ${w.y}, ${f.x} ${f.y}, ${p.x} ${p.y}`, E = d ? "" : `M ${t.x} ${t.y} L ${g.x} ${g.y} `, x = c ? "" : ` M ${p.x} ${p.y} L ${o.x} ${o.y}`;
|
|
903
|
+
this.path = `${E}${y}${x}`;
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
|
-
class
|
|
906
|
+
class Et {
|
|
907
907
|
constructor(e) {
|
|
908
908
|
i(this, "path");
|
|
909
909
|
i(this, "midpoint");
|
|
@@ -916,70 +916,70 @@ class wt {
|
|
|
916
916
|
detourDir: h,
|
|
917
917
|
from: d,
|
|
918
918
|
to: c,
|
|
919
|
-
arrowLength:
|
|
920
|
-
detourDistance:
|
|
921
|
-
} = e,
|
|
922
|
-
{ x: d.x +
|
|
919
|
+
arrowLength: l,
|
|
920
|
+
detourDistance: u
|
|
921
|
+
} = e, g = t ? m(
|
|
922
|
+
{ x: d.x + l, y: d.y },
|
|
923
923
|
n,
|
|
924
924
|
d
|
|
925
925
|
) : d, p = o ? m(
|
|
926
926
|
{
|
|
927
|
-
x: c.x -
|
|
927
|
+
x: c.x - l,
|
|
928
928
|
y: c.y
|
|
929
929
|
},
|
|
930
930
|
a,
|
|
931
931
|
c
|
|
932
|
-
) : c, w = Math.cos(h) *
|
|
933
|
-
{ x: d.x +
|
|
932
|
+
) : c, w = Math.cos(h) * u, f = Math.sin(h) * u, y = m(
|
|
933
|
+
{ x: d.x + l, y: d.y },
|
|
934
934
|
n,
|
|
935
935
|
d
|
|
936
|
-
),
|
|
937
|
-
x:
|
|
938
|
-
y:
|
|
939
|
-
},
|
|
940
|
-
{ x: c.x -
|
|
936
|
+
), E = {
|
|
937
|
+
x: y.x + w,
|
|
938
|
+
y: y.y + f
|
|
939
|
+
}, x = m(
|
|
940
|
+
{ x: c.x - l, y: c.y },
|
|
941
941
|
a,
|
|
942
942
|
c
|
|
943
|
-
),
|
|
944
|
-
x:
|
|
945
|
-
y:
|
|
946
|
-
},
|
|
947
|
-
x: (
|
|
948
|
-
y: (
|
|
949
|
-
},
|
|
950
|
-
x:
|
|
951
|
-
y:
|
|
943
|
+
), N = {
|
|
944
|
+
x: x.x + w,
|
|
945
|
+
y: x.y + f
|
|
946
|
+
}, T = {
|
|
947
|
+
x: (E.x + N.x) / 2,
|
|
948
|
+
y: (E.y + N.y) / 2
|
|
949
|
+
}, D = {
|
|
950
|
+
x: y.x + s * n.x,
|
|
951
|
+
y: y.y + s * n.y
|
|
952
952
|
}, F = {
|
|
953
|
-
x:
|
|
954
|
-
y:
|
|
953
|
+
x: x.x - s * a.x,
|
|
954
|
+
y: x.y - s * a.y
|
|
955
955
|
}, U = {
|
|
956
|
-
x:
|
|
957
|
-
y:
|
|
956
|
+
x: y.x + w,
|
|
957
|
+
y: y.y + f
|
|
958
958
|
}, R = {
|
|
959
|
-
x:
|
|
960
|
-
y:
|
|
959
|
+
x: x.x + w,
|
|
960
|
+
y: x.y + f
|
|
961
961
|
};
|
|
962
962
|
this.path = [
|
|
963
|
-
`M ${
|
|
964
|
-
`L ${
|
|
965
|
-
`C ${
|
|
966
|
-
`C ${R.x} ${R.y} ${F.x} ${F.y} ${
|
|
963
|
+
`M ${g.x} ${g.y}`,
|
|
964
|
+
`L ${y.x} ${y.y}`,
|
|
965
|
+
`C ${D.x} ${D.y} ${U.x} ${U.y} ${T.x} ${T.y}`,
|
|
966
|
+
`C ${R.x} ${R.y} ${F.x} ${F.y} ${x.x} ${x.y}`,
|
|
967
967
|
`L ${p.x} ${p.y}`
|
|
968
|
-
].join(" "), this.midpoint =
|
|
968
|
+
].join(" "), this.midpoint = T;
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
971
|
const te = Object.freeze({
|
|
972
972
|
edgeColor: "--edge-color"
|
|
973
|
-
}),
|
|
973
|
+
}), Be = (r) => {
|
|
974
974
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
975
975
|
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(te.edgeColor, r), e;
|
|
976
|
-
},
|
|
976
|
+
}, Oe = (r) => {
|
|
977
977
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
978
978
|
return e.setAttribute("stroke", `var(${te.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
979
979
|
}, X = () => {
|
|
980
980
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
981
981
|
return r.setAttribute("fill", `var(${te.edgeColor})`), r;
|
|
982
|
-
},
|
|
982
|
+
}, We = (r, e) => {
|
|
983
983
|
r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${e.width}px`, r.style.height = `${e.height}px`;
|
|
984
984
|
}, V = (r, e) => {
|
|
985
985
|
const t = [];
|
|
@@ -987,56 +987,58 @@ const te = Object.freeze({
|
|
|
987
987
|
const o = r.length - 1;
|
|
988
988
|
let s = 0, n = 0, a = 0;
|
|
989
989
|
r.forEach((h, d) => {
|
|
990
|
-
let c = 0,
|
|
991
|
-
const
|
|
992
|
-
if (
|
|
993
|
-
const
|
|
994
|
-
s =
|
|
990
|
+
let c = 0, l = 0, u = 0;
|
|
991
|
+
const g = d > 0, p = d < o, w = g && p;
|
|
992
|
+
if (g && (c = -s, l = -n, u = a), p) {
|
|
993
|
+
const D = r[d + 1];
|
|
994
|
+
s = D.x - h.x, n = D.y - h.y, a = Math.sqrt(s * s + n * n);
|
|
995
995
|
}
|
|
996
|
-
const
|
|
997
|
-
d > 0 && t.push(`L ${
|
|
998
|
-
`C ${h.x} ${h.y} ${h.x} ${h.y} ${
|
|
996
|
+
const y = a !== 0 ? Math.min((w ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, E = w ? { x: h.x + s * y, y: h.y + n * y } : h, N = u !== 0 ? Math.min((w ? e : 0) / u, d > 1 ? 0.5 : 1) : 0, T = w ? { x: h.x + c * N, y: h.y + l * N } : h;
|
|
997
|
+
d > 0 && t.push(`L ${T.x} ${T.y}`), w && t.push(
|
|
998
|
+
`C ${h.x} ${h.y} ${h.x} ${h.y} ${E.x} ${E.y}`
|
|
999
999
|
);
|
|
1000
1000
|
});
|
|
1001
1001
|
}
|
|
1002
1002
|
return t.join(" ");
|
|
1003
|
-
},
|
|
1004
|
-
const t = e.x -
|
|
1005
|
-
if (
|
|
1006
|
-
const
|
|
1007
|
-
return
|
|
1003
|
+
}, xt = (r, e) => {
|
|
1004
|
+
const t = r.linePoint, o = e.linePoint, s = o.x - t.x >= 0, n = r.dirX >= 0, a = e.dirX >= 0;
|
|
1005
|
+
if (n === a) {
|
|
1006
|
+
const u = n === s, g = (t.x + o.x) / 2, p = (t.y + o.y) / 2, w = { x: g, y: p };
|
|
1007
|
+
return u ? {
|
|
1008
1008
|
points: [
|
|
1009
|
-
|
|
1010
|
-
{ x:
|
|
1011
|
-
{ x:
|
|
1012
|
-
|
|
1009
|
+
r.arrowPoint,
|
|
1010
|
+
{ x: w.x, y: t.y },
|
|
1011
|
+
{ x: w.x, y: o.y },
|
|
1012
|
+
e.arrowPoint
|
|
1013
1013
|
],
|
|
1014
|
-
midpoint:
|
|
1014
|
+
midpoint: w
|
|
1015
1015
|
} : {
|
|
1016
1016
|
points: [
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
{ x:
|
|
1020
|
-
{ x:
|
|
1017
|
+
r.arrowPoint,
|
|
1018
|
+
t,
|
|
1019
|
+
{ x: t.x, y: w.y },
|
|
1020
|
+
{ x: o.x, y: w.y },
|
|
1021
|
+
o,
|
|
1022
|
+
e.arrowPoint
|
|
1021
1023
|
],
|
|
1022
|
-
midpoint:
|
|
1024
|
+
midpoint: w
|
|
1023
1025
|
};
|
|
1024
1026
|
}
|
|
1025
|
-
const
|
|
1026
|
-
if (
|
|
1027
|
-
const
|
|
1027
|
+
const d = n === s, c = (t.y + o.y) / 2;
|
|
1028
|
+
if (d) {
|
|
1029
|
+
const u = { x: o.x, y: t.y };
|
|
1028
1030
|
return {
|
|
1029
|
-
points: [
|
|
1030
|
-
midpoint: { x:
|
|
1031
|
+
points: [r.arrowPoint, u, o, e.arrowPoint],
|
|
1032
|
+
midpoint: { x: u.x, y: c }
|
|
1031
1033
|
};
|
|
1032
1034
|
}
|
|
1033
|
-
const
|
|
1035
|
+
const l = { x: t.x, y: o.y };
|
|
1034
1036
|
return {
|
|
1035
|
-
points: [
|
|
1036
|
-
midpoint: { x:
|
|
1037
|
+
points: [r.arrowPoint, t, l, e.arrowPoint],
|
|
1038
|
+
midpoint: { x: l.x, y: c }
|
|
1037
1039
|
};
|
|
1038
1040
|
};
|
|
1039
|
-
class
|
|
1041
|
+
class At {
|
|
1040
1042
|
constructor(e) {
|
|
1041
1043
|
i(this, "path");
|
|
1042
1044
|
i(this, "midpoint");
|
|
@@ -1049,41 +1051,23 @@ class ft {
|
|
|
1049
1051
|
arrowOffset: h,
|
|
1050
1052
|
roundness: d,
|
|
1051
1053
|
hasSourceArrow: c,
|
|
1052
|
-
hasTargetArrow:
|
|
1053
|
-
} = e,
|
|
1054
|
+
hasTargetArrow: l
|
|
1055
|
+
} = e, u = c ? m(
|
|
1054
1056
|
{ x: t.x + a, y: t.y },
|
|
1055
1057
|
s,
|
|
1056
1058
|
t
|
|
1057
|
-
) : t,
|
|
1058
|
-
{
|
|
1059
|
-
x: o.x - a,
|
|
1060
|
-
y: o.y
|
|
1061
|
-
},
|
|
1062
|
-
n,
|
|
1063
|
-
o
|
|
1064
|
-
) : o, p = a + h, w = m(
|
|
1059
|
+
) : t, g = l ? m({ x: o.x - a, y: o.y }, n, o) : o, p = a + h, w = m(
|
|
1065
1060
|
{ x: t.x + p, y: t.y },
|
|
1066
1061
|
s,
|
|
1067
1062
|
t
|
|
1068
|
-
),
|
|
1069
|
-
{
|
|
1070
|
-
|
|
1071
|
-
y: w.y,
|
|
1072
|
-
dirX: s.x
|
|
1073
|
-
},
|
|
1074
|
-
{
|
|
1075
|
-
x: y.x,
|
|
1076
|
-
y: y.y,
|
|
1077
|
-
dirX: n.x
|
|
1078
|
-
}
|
|
1063
|
+
), f = m({ x: o.x - p, y: o.y }, n, o), y = xt(
|
|
1064
|
+
{ arrowPoint: u, linePoint: w, dirX: s.x },
|
|
1065
|
+
{ arrowPoint: g, linePoint: f, dirX: n.x }
|
|
1079
1066
|
);
|
|
1080
|
-
this.path = V(
|
|
1081
|
-
[g, ...f.points, l],
|
|
1082
|
-
d
|
|
1083
|
-
), this.midpoint = f.midpoint;
|
|
1067
|
+
this.path = V(y.points, d), this.midpoint = y.midpoint;
|
|
1084
1068
|
}
|
|
1085
1069
|
}
|
|
1086
|
-
class
|
|
1070
|
+
class St {
|
|
1087
1071
|
constructor(e) {
|
|
1088
1072
|
i(this, "path");
|
|
1089
1073
|
i(this, "midpoint");
|
|
@@ -1096,9 +1080,9 @@ class vt {
|
|
|
1096
1080
|
fromDir: h,
|
|
1097
1081
|
toDir: d,
|
|
1098
1082
|
arrowOffset: c,
|
|
1099
|
-
detourDir:
|
|
1100
|
-
detourDistance:
|
|
1101
|
-
roundness:
|
|
1083
|
+
detourDir: l,
|
|
1084
|
+
detourDistance: u,
|
|
1085
|
+
roundness: g
|
|
1102
1086
|
} = e, p = t ? m(
|
|
1103
1087
|
{ x: s.x + a, y: s.y },
|
|
1104
1088
|
h,
|
|
@@ -1110,31 +1094,31 @@ class vt {
|
|
|
1110
1094
|
},
|
|
1111
1095
|
d,
|
|
1112
1096
|
n
|
|
1113
|
-
) : n,
|
|
1114
|
-
{ x: s.x +
|
|
1097
|
+
) : n, f = a + c, y = Math.cos(l) * u, E = Math.sin(l) * u, x = m(
|
|
1098
|
+
{ x: s.x + f, y: s.y },
|
|
1115
1099
|
h,
|
|
1116
1100
|
s
|
|
1117
|
-
),
|
|
1118
|
-
x:
|
|
1119
|
-
y:
|
|
1120
|
-
},
|
|
1121
|
-
{ x: n.x -
|
|
1101
|
+
), N = {
|
|
1102
|
+
x: x.x + y,
|
|
1103
|
+
y: x.y + E
|
|
1104
|
+
}, T = m(
|
|
1105
|
+
{ x: n.x - f, y: n.y },
|
|
1122
1106
|
d,
|
|
1123
1107
|
n
|
|
1124
|
-
),
|
|
1125
|
-
x:
|
|
1126
|
-
y:
|
|
1108
|
+
), D = {
|
|
1109
|
+
x: T.x + y,
|
|
1110
|
+
y: T.y + E
|
|
1127
1111
|
};
|
|
1128
1112
|
this.midpoint = {
|
|
1129
|
-
x: (
|
|
1130
|
-
y: (
|
|
1113
|
+
x: (N.x + D.x) / 2,
|
|
1114
|
+
y: (N.y + D.y) / 2
|
|
1131
1115
|
}, this.path = V(
|
|
1132
|
-
[p,
|
|
1133
|
-
|
|
1116
|
+
[p, x, N, D, T, w],
|
|
1117
|
+
g
|
|
1134
1118
|
);
|
|
1135
1119
|
}
|
|
1136
1120
|
}
|
|
1137
|
-
class
|
|
1121
|
+
class bt {
|
|
1138
1122
|
constructor(e) {
|
|
1139
1123
|
i(this, "path");
|
|
1140
1124
|
i(this, "midpoint");
|
|
@@ -1147,24 +1131,24 @@ class mt {
|
|
|
1147
1131
|
fromDir: h,
|
|
1148
1132
|
toDir: d,
|
|
1149
1133
|
arrowOffset: c,
|
|
1150
|
-
roundness:
|
|
1151
|
-
} = e,
|
|
1134
|
+
roundness: l
|
|
1135
|
+
} = e, u = this.createArrowPoint(
|
|
1152
1136
|
s,
|
|
1153
1137
|
h,
|
|
1154
1138
|
t,
|
|
1155
1139
|
a
|
|
1156
|
-
),
|
|
1140
|
+
), g = this.createArrowPoint(
|
|
1157
1141
|
n,
|
|
1158
1142
|
d,
|
|
1159
1143
|
o,
|
|
1160
1144
|
-a
|
|
1161
|
-
), p = a + c, w = { x: t.x + p, y: t.y },
|
|
1145
|
+
), p = a + c, w = { x: t.x + p, y: t.y }, f = m(w, h, t), y = { x: o.x - p, y: o.y }, E = m(y, d, o);
|
|
1162
1146
|
this.path = V(
|
|
1163
|
-
[
|
|
1164
|
-
|
|
1147
|
+
[u, f, E, g],
|
|
1148
|
+
l
|
|
1165
1149
|
);
|
|
1166
|
-
const
|
|
1167
|
-
this.midpoint = { x
|
|
1150
|
+
const x = (f.x + E.x) / 2, N = (f.y + E.y) / 2;
|
|
1151
|
+
this.midpoint = { x, y: N };
|
|
1168
1152
|
}
|
|
1169
1153
|
createArrowPoint(e, t, o, s) {
|
|
1170
1154
|
if (!e)
|
|
@@ -1176,43 +1160,45 @@ class mt {
|
|
|
1176
1160
|
return m(n, t, o);
|
|
1177
1161
|
}
|
|
1178
1162
|
}
|
|
1179
|
-
const
|
|
1180
|
-
const t = e.y -
|
|
1181
|
-
if (
|
|
1182
|
-
const
|
|
1183
|
-
return
|
|
1163
|
+
const Pt = (r, e) => {
|
|
1164
|
+
const t = r.linePoint, o = e.linePoint, s = o.y - t.y >= 0, n = r.dirY >= 0, a = e.dirY >= 0;
|
|
1165
|
+
if (n === a) {
|
|
1166
|
+
const u = n === s, g = (t.x + o.x) / 2, p = (t.y + o.y) / 2, w = { x: g, y: p };
|
|
1167
|
+
return u ? {
|
|
1184
1168
|
points: [
|
|
1185
|
-
|
|
1186
|
-
{ x:
|
|
1187
|
-
{ x:
|
|
1188
|
-
|
|
1169
|
+
r.arrowPoint,
|
|
1170
|
+
{ x: t.x, y: w.y },
|
|
1171
|
+
{ x: o.x, y: w.y },
|
|
1172
|
+
e.arrowPoint
|
|
1189
1173
|
],
|
|
1190
|
-
midpoint:
|
|
1174
|
+
midpoint: w
|
|
1191
1175
|
} : {
|
|
1192
1176
|
points: [
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
{ x:
|
|
1196
|
-
{ x:
|
|
1177
|
+
r.arrowPoint,
|
|
1178
|
+
t,
|
|
1179
|
+
{ x: w.x, y: t.y },
|
|
1180
|
+
{ x: w.x, y: o.y },
|
|
1181
|
+
o,
|
|
1182
|
+
e.arrowPoint
|
|
1197
1183
|
],
|
|
1198
|
-
midpoint:
|
|
1184
|
+
midpoint: w
|
|
1199
1185
|
};
|
|
1200
1186
|
}
|
|
1201
|
-
const
|
|
1202
|
-
if (
|
|
1203
|
-
const
|
|
1187
|
+
const d = n === s, c = (t.x + o.x) / 2;
|
|
1188
|
+
if (d) {
|
|
1189
|
+
const u = { x: t.x, y: o.y };
|
|
1204
1190
|
return {
|
|
1205
|
-
points: [
|
|
1206
|
-
midpoint: { x:
|
|
1191
|
+
points: [r.arrowPoint, u, o, e.arrowPoint],
|
|
1192
|
+
midpoint: { x: c, y: u.y }
|
|
1207
1193
|
};
|
|
1208
1194
|
}
|
|
1209
|
-
const
|
|
1195
|
+
const l = { x: o.x, y: t.y };
|
|
1210
1196
|
return {
|
|
1211
|
-
points: [
|
|
1212
|
-
midpoint: { x:
|
|
1197
|
+
points: [r.arrowPoint, t, l, e.arrowPoint],
|
|
1198
|
+
midpoint: { x: c, y: l.y }
|
|
1213
1199
|
};
|
|
1214
1200
|
};
|
|
1215
|
-
class
|
|
1201
|
+
class Nt {
|
|
1216
1202
|
constructor(e) {
|
|
1217
1203
|
i(this, "path");
|
|
1218
1204
|
i(this, "midpoint");
|
|
@@ -1225,45 +1211,27 @@ class Et {
|
|
|
1225
1211
|
arrowOffset: h,
|
|
1226
1212
|
fromDir: d,
|
|
1227
1213
|
toDir: c,
|
|
1228
|
-
roundness:
|
|
1229
|
-
} = e,
|
|
1214
|
+
roundness: l
|
|
1215
|
+
} = e, u = s ? m(
|
|
1230
1216
|
{ x: t.x + a, y: t.y },
|
|
1231
1217
|
d,
|
|
1232
1218
|
t
|
|
1233
|
-
) : t,
|
|
1234
|
-
{
|
|
1235
|
-
x: o.x - a,
|
|
1236
|
-
y: o.y
|
|
1237
|
-
},
|
|
1238
|
-
c,
|
|
1239
|
-
o
|
|
1240
|
-
) : o, p = a + h, w = m(
|
|
1219
|
+
) : t, g = n ? m({ x: o.x - a, y: o.y }, c, o) : o, p = a + h, w = m(
|
|
1241
1220
|
{ x: t.x + p, y: t.y },
|
|
1242
1221
|
d,
|
|
1243
1222
|
t
|
|
1244
|
-
),
|
|
1245
|
-
{
|
|
1246
|
-
|
|
1247
|
-
y: w.y,
|
|
1248
|
-
dirY: d.y
|
|
1249
|
-
},
|
|
1250
|
-
{
|
|
1251
|
-
x: y.x,
|
|
1252
|
-
y: y.y,
|
|
1253
|
-
dirY: c.y
|
|
1254
|
-
}
|
|
1223
|
+
), f = m({ x: o.x - p, y: o.y }, c, o), y = Pt(
|
|
1224
|
+
{ arrowPoint: u, linePoint: w, dirY: d.y },
|
|
1225
|
+
{ arrowPoint: g, linePoint: f, dirY: c.y }
|
|
1255
1226
|
);
|
|
1256
|
-
this.path = V(
|
|
1257
|
-
[g, ...f.points, l],
|
|
1258
|
-
u
|
|
1259
|
-
), this.midpoint = f.midpoint;
|
|
1227
|
+
this.path = V(y.points, l), this.midpoint = y.midpoint;
|
|
1260
1228
|
}
|
|
1261
1229
|
}
|
|
1262
1230
|
class re {
|
|
1263
1231
|
constructor(e) {
|
|
1264
1232
|
i(this, "path");
|
|
1265
1233
|
i(this, "midpoint");
|
|
1266
|
-
const { side: t, arrowLength: o, arrowOffset: s, dir: n, origin: a, hasArrow: h } = e, d = o + s, c = d + 2 * t,
|
|
1234
|
+
const { side: t, arrowLength: o, arrowOffset: s, dir: n, origin: a, hasArrow: h } = e, d = o + s, c = d + 2 * t, u = [
|
|
1267
1235
|
{ x: o, y: 0 },
|
|
1268
1236
|
{ x: d, y: 0 },
|
|
1269
1237
|
{ x: d, y: t },
|
|
@@ -1272,29 +1240,29 @@ class re {
|
|
|
1272
1240
|
{ x: d, y: -t },
|
|
1273
1241
|
{ x: d, y: 0 },
|
|
1274
1242
|
{ x: o, y: 0 }
|
|
1275
|
-
].map((p) => m(p, n, { x: 0, y: 0 })).map((p) => ({ x: p.x + a.x, y: p.y + a.y })),
|
|
1276
|
-
this.path = `${h ? "" :
|
|
1243
|
+
].map((p) => m(p, n, { x: 0, y: 0 })).map((p) => ({ x: p.x + a.x, y: p.y + a.y })), g = `M ${a.x} ${a.y} L ${u[0].x} ${u[0].y} `;
|
|
1244
|
+
this.path = `${h ? "" : g}${V(u, e.roundness)}`, this.midpoint = { x: (u[3].x + u[4].x) / 2, y: (u[3].y + u[4].y) / 2 };
|
|
1277
1245
|
}
|
|
1278
1246
|
}
|
|
1279
|
-
class
|
|
1247
|
+
class Ct {
|
|
1280
1248
|
constructor(e) {
|
|
1281
1249
|
i(this, "path");
|
|
1282
1250
|
i(this, "midpoint");
|
|
1283
|
-
const { arrowLength: t, radius: o, smallRadius: s, dir: n, origin: a, hasArrow: h } = e, d = s + o, c = s * o / d,
|
|
1251
|
+
const { arrowLength: t, radius: o, smallRadius: s, dir: n, origin: a, hasArrow: h } = e, d = s + o, c = s * o / d, l = Math.sqrt(d * d - s * s), u = l * s / d, g = l + o + t, p = t + u, f = [
|
|
1284
1252
|
{ x: t, y: 0 },
|
|
1285
1253
|
{ x: p, y: c },
|
|
1286
1254
|
{ x: p, y: -c },
|
|
1287
|
-
{ x:
|
|
1288
|
-
].map((
|
|
1289
|
-
`M ${
|
|
1290
|
-
`A ${s} ${s} 0 0 1 ${
|
|
1291
|
-
`A ${o} ${o} 0 1 0 ${
|
|
1292
|
-
`A ${s} ${s} 0 0 1 ${
|
|
1293
|
-
].join(" "),
|
|
1294
|
-
this.path = `${h ? "" :
|
|
1255
|
+
{ x: g, y: 0 }
|
|
1256
|
+
].map((x) => m(x, n, { x: 0, y: 0 })).map((x) => ({ x: x.x + a.x, y: x.y + a.y })), y = [
|
|
1257
|
+
`M ${f[0].x} ${f[0].y}`,
|
|
1258
|
+
`A ${s} ${s} 0 0 1 ${f[1].x} ${f[1].y}`,
|
|
1259
|
+
`A ${o} ${o} 0 1 0 ${f[2].x} ${f[2].y}`,
|
|
1260
|
+
`A ${s} ${s} 0 0 1 ${f[0].x} ${f[0].y}`
|
|
1261
|
+
].join(" "), E = `M ${a.x} ${a.y} L ${f[0].x} ${f[0].y} `;
|
|
1262
|
+
this.path = `${h ? "" : E}${y}`, this.midpoint = f[3];
|
|
1295
1263
|
}
|
|
1296
1264
|
}
|
|
1297
|
-
class
|
|
1265
|
+
class Tt {
|
|
1298
1266
|
constructor(e) {
|
|
1299
1267
|
i(this, "path");
|
|
1300
1268
|
i(this, "midpoint");
|
|
@@ -1309,27 +1277,27 @@ class St {
|
|
|
1309
1277
|
arrowLength: d
|
|
1310
1278
|
} = e;
|
|
1311
1279
|
this.midpoint = { x: (t.x + o.x) / 2, y: (t.y + o.y) / 2 };
|
|
1312
|
-
const c = o.x - t.x,
|
|
1313
|
-
if (this.diagonalDistance = Math.sqrt(c * c +
|
|
1280
|
+
const c = o.x - t.x, l = o.y - t.y;
|
|
1281
|
+
if (this.diagonalDistance = Math.sqrt(c * c + l * l), this.diagonalDistance === 0) {
|
|
1314
1282
|
this.path = "";
|
|
1315
1283
|
return;
|
|
1316
1284
|
}
|
|
1317
|
-
const
|
|
1285
|
+
const u = { x: c, y: l }, g = this.createDirectLinePoint({
|
|
1318
1286
|
offset: s,
|
|
1319
1287
|
hasArrow: a,
|
|
1320
1288
|
flip: 1,
|
|
1321
1289
|
shift: t,
|
|
1322
1290
|
arrowLength: d,
|
|
1323
|
-
dir:
|
|
1291
|
+
dir: u
|
|
1324
1292
|
}), p = this.createDirectLinePoint({
|
|
1325
1293
|
offset: n,
|
|
1326
1294
|
hasArrow: h,
|
|
1327
1295
|
flip: -1,
|
|
1328
1296
|
shift: o,
|
|
1329
1297
|
arrowLength: d,
|
|
1330
|
-
dir:
|
|
1298
|
+
dir: u
|
|
1331
1299
|
});
|
|
1332
|
-
this.path = `M ${
|
|
1300
|
+
this.path = `M ${g.x} ${g.y} L ${p.x} ${p.y}`;
|
|
1333
1301
|
}
|
|
1334
1302
|
createDirectLinePoint(e) {
|
|
1335
1303
|
const t = e.hasArrow ? e.arrowLength : 0, o = e.offset + t, s = e.flip * o / this.diagonalDistance, { dir: n, shift: a } = e;
|
|
@@ -1339,11 +1307,11 @@ class St {
|
|
|
1339
1307
|
};
|
|
1340
1308
|
}
|
|
1341
1309
|
}
|
|
1342
|
-
const
|
|
1310
|
+
const Mt = (r, e, t) => {
|
|
1343
1311
|
const o = Math.max(r.y, e.y), s = Math.min(r.y, e.y);
|
|
1344
1312
|
return (t >= 0 ? o : s) + t;
|
|
1345
1313
|
};
|
|
1346
|
-
class
|
|
1314
|
+
class Dt {
|
|
1347
1315
|
constructor(e) {
|
|
1348
1316
|
i(this, "path");
|
|
1349
1317
|
i(this, "midpoint");
|
|
@@ -1356,9 +1324,9 @@ class Nt {
|
|
|
1356
1324
|
fromDir: h,
|
|
1357
1325
|
toDir: d,
|
|
1358
1326
|
arrowOffset: c,
|
|
1359
|
-
roundness:
|
|
1360
|
-
detourDistance:
|
|
1361
|
-
} = e,
|
|
1327
|
+
roundness: l,
|
|
1328
|
+
detourDistance: u
|
|
1329
|
+
} = e, g = t ? m(
|
|
1362
1330
|
{ x: n.x + s, y: n.y },
|
|
1363
1331
|
h,
|
|
1364
1332
|
n
|
|
@@ -1369,36 +1337,36 @@ class Nt {
|
|
|
1369
1337
|
},
|
|
1370
1338
|
d,
|
|
1371
1339
|
a
|
|
1372
|
-
) : a, w = s + c,
|
|
1340
|
+
) : a, w = s + c, f = m(
|
|
1373
1341
|
{ x: n.x + w, y: n.y },
|
|
1374
1342
|
h,
|
|
1375
1343
|
n
|
|
1376
|
-
),
|
|
1344
|
+
), y = m(
|
|
1377
1345
|
{ x: a.x - w, y: a.y },
|
|
1378
1346
|
d,
|
|
1379
1347
|
a
|
|
1380
|
-
),
|
|
1348
|
+
), E = Mt(f, y, u);
|
|
1381
1349
|
this.midpoint = {
|
|
1382
|
-
x: (
|
|
1383
|
-
y:
|
|
1350
|
+
x: (f.x + y.x) / 2,
|
|
1351
|
+
y: E
|
|
1384
1352
|
}, this.path = V(
|
|
1385
1353
|
[
|
|
1386
|
-
|
|
1387
|
-
y,
|
|
1388
|
-
{ x: y.x, y: x },
|
|
1389
|
-
{ x: f.x, y: x },
|
|
1354
|
+
g,
|
|
1390
1355
|
f,
|
|
1356
|
+
{ x: f.x, y: E },
|
|
1357
|
+
{ x: y.x, y: E },
|
|
1358
|
+
y,
|
|
1391
1359
|
p
|
|
1392
1360
|
],
|
|
1393
|
-
|
|
1361
|
+
l
|
|
1394
1362
|
);
|
|
1395
1363
|
}
|
|
1396
1364
|
}
|
|
1397
|
-
const
|
|
1365
|
+
const Rt = (r, e, t) => {
|
|
1398
1366
|
const o = Math.max(r.x, e.x), s = Math.min(r.x, e.x);
|
|
1399
1367
|
return (t >= 0 ? o : s) + t;
|
|
1400
1368
|
};
|
|
1401
|
-
class
|
|
1369
|
+
class Lt {
|
|
1402
1370
|
constructor(e) {
|
|
1403
1371
|
i(this, "path");
|
|
1404
1372
|
i(this, "midpoint");
|
|
@@ -1411,9 +1379,9 @@ class Tt {
|
|
|
1411
1379
|
from: h,
|
|
1412
1380
|
to: d,
|
|
1413
1381
|
arrowOffset: c,
|
|
1414
|
-
detourDistance:
|
|
1415
|
-
roundness:
|
|
1416
|
-
} = e,
|
|
1382
|
+
detourDistance: l,
|
|
1383
|
+
roundness: u
|
|
1384
|
+
} = e, g = t ? m(
|
|
1417
1385
|
{ x: h.x + s, y: h.y },
|
|
1418
1386
|
n,
|
|
1419
1387
|
h
|
|
@@ -1424,28 +1392,28 @@ class Tt {
|
|
|
1424
1392
|
},
|
|
1425
1393
|
a,
|
|
1426
1394
|
d
|
|
1427
|
-
) : d, w = s + c,
|
|
1395
|
+
) : d, w = s + c, f = m(
|
|
1428
1396
|
{ x: h.x + w, y: h.y },
|
|
1429
1397
|
n,
|
|
1430
1398
|
h
|
|
1431
|
-
),
|
|
1399
|
+
), y = m(
|
|
1432
1400
|
{ x: d.x - w, y: d.y },
|
|
1433
1401
|
a,
|
|
1434
1402
|
d
|
|
1435
|
-
),
|
|
1403
|
+
), E = Rt(f, y, l);
|
|
1436
1404
|
this.midpoint = {
|
|
1437
|
-
x,
|
|
1438
|
-
y: (
|
|
1405
|
+
x: E,
|
|
1406
|
+
y: (f.y + y.y) / 2
|
|
1439
1407
|
}, this.path = V(
|
|
1440
1408
|
[
|
|
1441
|
-
|
|
1442
|
-
y,
|
|
1443
|
-
{ x, y: y.y },
|
|
1444
|
-
{ x, y: f.y },
|
|
1409
|
+
g,
|
|
1445
1410
|
f,
|
|
1411
|
+
{ x: E, y: f.y },
|
|
1412
|
+
{ x: E, y: y.y },
|
|
1413
|
+
y,
|
|
1446
1414
|
p
|
|
1447
1415
|
],
|
|
1448
|
-
|
|
1416
|
+
u
|
|
1449
1417
|
);
|
|
1450
1418
|
}
|
|
1451
1419
|
}
|
|
@@ -1471,7 +1439,7 @@ const v = Object.freeze({
|
|
|
1471
1439
|
curvature: 90,
|
|
1472
1440
|
interactiveWidth: 10,
|
|
1473
1441
|
preOffset: 0
|
|
1474
|
-
}),
|
|
1442
|
+
}), Ae = (r) => ({ x: Math.cos(r), y: Math.sin(r) });
|
|
1475
1443
|
class G {
|
|
1476
1444
|
constructor(e) {
|
|
1477
1445
|
i(this, "svg");
|
|
@@ -1485,20 +1453,20 @@ class G {
|
|
|
1485
1453
|
i(this, "onAfterRender");
|
|
1486
1454
|
i(this, "afterRenderEmitter");
|
|
1487
1455
|
i(this, "arrowRenderer");
|
|
1488
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] =
|
|
1456
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = C(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Be(e.color), this.svg.appendChild(this.group), this.line = Oe(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = X(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = X(), this.group.appendChild(this.targetArrow));
|
|
1489
1457
|
}
|
|
1490
1458
|
render(e) {
|
|
1491
|
-
const { x: t, y: o, width: s, height: n, from: a, to: h } =
|
|
1459
|
+
const { x: t, y: o, width: s, height: n, from: a, to: h } = $e(
|
|
1492
1460
|
e.from,
|
|
1493
1461
|
e.to,
|
|
1494
1462
|
this.params.padding
|
|
1495
1463
|
);
|
|
1496
|
-
|
|
1497
|
-
const d =
|
|
1498
|
-
let
|
|
1499
|
-
e.category === I.PortCycle ? (
|
|
1500
|
-
const
|
|
1501
|
-
this.line.setAttribute("d",
|
|
1464
|
+
We(this.svg, { x: t, y: o, width: s, height: n });
|
|
1465
|
+
const d = Ae(e.from.direction), c = Ae(e.to.direction);
|
|
1466
|
+
let l = { x: -c.x, y: -c.y }, u;
|
|
1467
|
+
e.category === I.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === I.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
|
|
1468
|
+
const g = u(a, h, d, c);
|
|
1469
|
+
this.line.setAttribute("d", g.path);
|
|
1502
1470
|
let p = null;
|
|
1503
1471
|
this.sourceArrow && (p = this.arrowRenderer({
|
|
1504
1472
|
direction: d,
|
|
@@ -1507,17 +1475,17 @@ class G {
|
|
|
1507
1475
|
}), this.sourceArrow.setAttribute("d", p));
|
|
1508
1476
|
let w = null;
|
|
1509
1477
|
this.targetArrow && (w = this.arrowRenderer({
|
|
1510
|
-
direction:
|
|
1478
|
+
direction: l,
|
|
1511
1479
|
shift: h,
|
|
1512
1480
|
arrowLength: this.params.arrowLength
|
|
1513
1481
|
}), this.targetArrow.setAttribute("d", w)), this.afterRenderEmitter.emit({
|
|
1514
|
-
edgePath:
|
|
1482
|
+
edgePath: g,
|
|
1515
1483
|
sourceArrowPath: p,
|
|
1516
1484
|
targetArrowPath: w
|
|
1517
1485
|
});
|
|
1518
1486
|
}
|
|
1519
1487
|
}
|
|
1520
|
-
const
|
|
1488
|
+
const Vt = (r) => (e) => {
|
|
1521
1489
|
const o = [
|
|
1522
1490
|
{ x: 0, y: 0 },
|
|
1523
1491
|
{ x: e.arrowLength, y: r.radius },
|
|
@@ -1529,7 +1497,7 @@ const Ct = (r) => (e) => {
|
|
|
1529
1497
|
y: h.y + e.shift.y
|
|
1530
1498
|
})), s = `M ${o[0].x} ${o[0].y}`, n = `L ${o[1].x} ${o[1].y}`, a = `L ${o[2].x} ${o[2].y}`;
|
|
1531
1499
|
return `${s} ${n} ${a} Z`;
|
|
1532
|
-
},
|
|
1500
|
+
}, It = (r) => (e) => {
|
|
1533
1501
|
const t = r.radius, o = e.arrowLength, s = (o * o + 2 * o * t) / (2 * t), n = s + t, a = o + t - t * (o + t) / n, h = t * s / n, c = [
|
|
1534
1502
|
{ x: 0, y: 0 },
|
|
1535
1503
|
{ x: a, y: -h },
|
|
@@ -1539,9 +1507,9 @@ const Ct = (r) => (e) => {
|
|
|
1539
1507
|
).map((w) => ({
|
|
1540
1508
|
x: w.x + e.shift.x,
|
|
1541
1509
|
y: w.y + e.shift.y
|
|
1542
|
-
})),
|
|
1543
|
-
return `${
|
|
1544
|
-
},
|
|
1510
|
+
})), l = `M ${c[0].x} ${c[0].y}`, u = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, g = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1511
|
+
return `${l} ${u} ${g} ${p}`;
|
|
1512
|
+
}, Ft = (r) => (e) => {
|
|
1545
1513
|
const t = r.smallRadius, o = r.radius, s = m(
|
|
1546
1514
|
{
|
|
1547
1515
|
x: e.arrowLength,
|
|
@@ -1556,33 +1524,33 @@ const Ct = (r) => (e) => {
|
|
|
1556
1524
|
y: 0
|
|
1557
1525
|
}
|
|
1558
1526
|
), a = [{ x: 0, y: 0 }, { x: s.x, y: -s.y }, s].map(
|
|
1559
|
-
(
|
|
1560
|
-
).map((
|
|
1561
|
-
x:
|
|
1562
|
-
y:
|
|
1563
|
-
})), h = `M ${a[0].x} ${a[0].y}`, d = `A ${o} ${o} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`,
|
|
1564
|
-
return `${h} ${d} ${c} ${
|
|
1527
|
+
(u) => m(u, e.direction, { x: 0, y: 0 })
|
|
1528
|
+
).map((u) => ({
|
|
1529
|
+
x: u.x + e.shift.x,
|
|
1530
|
+
y: u.y + e.shift.y
|
|
1531
|
+
})), h = `M ${a[0].x} ${a[0].y}`, d = `A ${o} ${o} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, l = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
|
|
1532
|
+
return `${h} ${d} ${c} ${l}`;
|
|
1565
1533
|
}, B = (r) => {
|
|
1566
1534
|
if (typeof r == "function")
|
|
1567
1535
|
return r;
|
|
1568
1536
|
switch (r.type) {
|
|
1569
1537
|
case "triangle":
|
|
1570
|
-
return
|
|
1538
|
+
return Vt({
|
|
1571
1539
|
radius: r.radius ?? v.polygonArrowRadius
|
|
1572
1540
|
});
|
|
1573
1541
|
case "arc":
|
|
1574
|
-
return
|
|
1542
|
+
return It({
|
|
1575
1543
|
radius: r.radius ?? v.circleArrowRadius
|
|
1576
1544
|
});
|
|
1577
1545
|
default:
|
|
1578
|
-
return
|
|
1546
|
+
return Ft({
|
|
1579
1547
|
smallRadius: r.smallRadius ?? v.wedgeArrowSmallRadius,
|
|
1580
1548
|
angle: r.angle ?? v.wedgeArrowAngle,
|
|
1581
1549
|
radius: r.radius ?? v.wedgeArrowRadius
|
|
1582
1550
|
});
|
|
1583
1551
|
}
|
|
1584
1552
|
}, O = 50;
|
|
1585
|
-
class
|
|
1553
|
+
class Ut {
|
|
1586
1554
|
constructor(e) {
|
|
1587
1555
|
i(this, "svg");
|
|
1588
1556
|
i(this, "group");
|
|
@@ -1599,7 +1567,7 @@ class Rt {
|
|
|
1599
1567
|
i(this, "hasSourceArrow");
|
|
1600
1568
|
i(this, "hasTargetArrow");
|
|
1601
1569
|
i(this, "pathShape");
|
|
1602
|
-
i(this, "createCyclePath", (e, t, o) => new
|
|
1570
|
+
i(this, "createCyclePath", (e, t, o) => new Ct({
|
|
1603
1571
|
origin: e,
|
|
1604
1572
|
dir: o,
|
|
1605
1573
|
radius: this.portCycleRadius,
|
|
@@ -1607,7 +1575,7 @@ class Rt {
|
|
|
1607
1575
|
arrowLength: this.arrowLength,
|
|
1608
1576
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1609
1577
|
}));
|
|
1610
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1578
|
+
i(this, "createDetourPath", (e, t, o, s) => new Et({
|
|
1611
1579
|
from: e,
|
|
1612
1580
|
to: t,
|
|
1613
1581
|
fromDir: o,
|
|
@@ -1619,7 +1587,7 @@ class Rt {
|
|
|
1619
1587
|
hasSourceArrow: this.hasSourceArrow,
|
|
1620
1588
|
hasTargetArrow: this.hasTargetArrow
|
|
1621
1589
|
}));
|
|
1622
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1590
|
+
i(this, "createLinePath", (e, t, o, s) => new mt({
|
|
1623
1591
|
from: e,
|
|
1624
1592
|
to: t,
|
|
1625
1593
|
fromDir: o,
|
|
@@ -1646,7 +1614,8 @@ class Rt {
|
|
|
1646
1614
|
this.pathShape.render(e);
|
|
1647
1615
|
}
|
|
1648
1616
|
}
|
|
1649
|
-
|
|
1617
|
+
const Se = (r) => Math.cos(r) > 0 ? 0 : Math.PI;
|
|
1618
|
+
class $t {
|
|
1650
1619
|
constructor(e) {
|
|
1651
1620
|
i(this, "svg");
|
|
1652
1621
|
i(this, "group");
|
|
@@ -1671,7 +1640,7 @@ class Lt {
|
|
|
1671
1640
|
roundness: this.roundness,
|
|
1672
1641
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1673
1642
|
}));
|
|
1674
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1643
|
+
i(this, "createDetourPath", (e, t, o, s) => new Dt({
|
|
1675
1644
|
from: e,
|
|
1676
1645
|
to: t,
|
|
1677
1646
|
fromDir: o,
|
|
@@ -1683,7 +1652,7 @@ class Lt {
|
|
|
1683
1652
|
hasSourceArrow: this.hasSourceArrow,
|
|
1684
1653
|
hasTargetArrow: this.hasTargetArrow
|
|
1685
1654
|
}));
|
|
1686
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1655
|
+
i(this, "createLinePath", (e, t, o, s) => new At({
|
|
1687
1656
|
from: e,
|
|
1688
1657
|
to: t,
|
|
1689
1658
|
fromDir: o,
|
|
@@ -1714,10 +1683,21 @@ class Lt {
|
|
|
1714
1683
|
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1715
1684
|
}
|
|
1716
1685
|
render(e) {
|
|
1717
|
-
|
|
1686
|
+
const { from: t, to: o, category: s } = e;
|
|
1687
|
+
this.pathShape.render({
|
|
1688
|
+
category: s,
|
|
1689
|
+
from: {
|
|
1690
|
+
...t,
|
|
1691
|
+
direction: Se(t.direction)
|
|
1692
|
+
},
|
|
1693
|
+
to: {
|
|
1694
|
+
...o,
|
|
1695
|
+
direction: Se(o.direction)
|
|
1696
|
+
}
|
|
1697
|
+
});
|
|
1718
1698
|
}
|
|
1719
1699
|
}
|
|
1720
|
-
class
|
|
1700
|
+
class Bt {
|
|
1721
1701
|
constructor(e) {
|
|
1722
1702
|
i(this, "svg");
|
|
1723
1703
|
i(this, "group");
|
|
@@ -1743,7 +1723,7 @@ class Vt {
|
|
|
1743
1723
|
roundness: this.roundness,
|
|
1744
1724
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1745
1725
|
}));
|
|
1746
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1726
|
+
i(this, "createDetourPath", (e, t, o, s) => new St({
|
|
1747
1727
|
from: e,
|
|
1748
1728
|
to: t,
|
|
1749
1729
|
fromDir: o,
|
|
@@ -1756,7 +1736,7 @@ class Vt {
|
|
|
1756
1736
|
hasSourceArrow: this.hasSourceArrow,
|
|
1757
1737
|
hasTargetArrow: this.hasTargetArrow
|
|
1758
1738
|
}));
|
|
1759
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1739
|
+
i(this, "createLinePath", (e, t, o, s) => new bt({
|
|
1760
1740
|
from: e,
|
|
1761
1741
|
to: t,
|
|
1762
1742
|
fromDir: o,
|
|
@@ -1790,7 +1770,8 @@ class Vt {
|
|
|
1790
1770
|
this.pathShape.render(e);
|
|
1791
1771
|
}
|
|
1792
1772
|
}
|
|
1793
|
-
|
|
1773
|
+
const be = Math.PI / 2, Pe = (r) => Math.sin(r) > 0 ? be : -be;
|
|
1774
|
+
class Ot {
|
|
1794
1775
|
constructor(e) {
|
|
1795
1776
|
i(this, "svg");
|
|
1796
1777
|
i(this, "group");
|
|
@@ -1815,7 +1796,7 @@ class It {
|
|
|
1815
1796
|
roundness: this.roundness,
|
|
1816
1797
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1817
1798
|
}));
|
|
1818
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1799
|
+
i(this, "createDetourPath", (e, t, o, s) => new Lt({
|
|
1819
1800
|
from: e,
|
|
1820
1801
|
to: t,
|
|
1821
1802
|
fromDir: o,
|
|
@@ -1827,7 +1808,7 @@ class It {
|
|
|
1827
1808
|
hasSourceArrow: this.hasSourceArrow,
|
|
1828
1809
|
hasTargetArrow: this.hasTargetArrow
|
|
1829
1810
|
}));
|
|
1830
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1811
|
+
i(this, "createLinePath", (e, t, o, s) => new Nt({
|
|
1831
1812
|
from: e,
|
|
1832
1813
|
to: t,
|
|
1833
1814
|
fromDir: o,
|
|
@@ -1858,10 +1839,21 @@ class It {
|
|
|
1858
1839
|
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1859
1840
|
}
|
|
1860
1841
|
render(e) {
|
|
1861
|
-
|
|
1842
|
+
const { from: t, to: o, category: s } = e;
|
|
1843
|
+
this.pathShape.render({
|
|
1844
|
+
category: s,
|
|
1845
|
+
from: {
|
|
1846
|
+
...t,
|
|
1847
|
+
direction: Pe(t.direction)
|
|
1848
|
+
},
|
|
1849
|
+
to: {
|
|
1850
|
+
...o,
|
|
1851
|
+
direction: Pe(o.direction)
|
|
1852
|
+
}
|
|
1853
|
+
});
|
|
1862
1854
|
}
|
|
1863
1855
|
}
|
|
1864
|
-
class
|
|
1856
|
+
class ze {
|
|
1865
1857
|
constructor(e) {
|
|
1866
1858
|
i(this, "svg");
|
|
1867
1859
|
i(this, "group", document.createElementNS(
|
|
@@ -1879,16 +1871,16 @@ class $e {
|
|
|
1879
1871
|
i(this, "onAfterRender");
|
|
1880
1872
|
i(this, "afterRenderEmitter");
|
|
1881
1873
|
i(this, "arrowRenderer");
|
|
1882
|
-
[this.afterRenderEmitter, this.onAfterRender] =
|
|
1874
|
+
[this.afterRenderEmitter, this.onAfterRender] = C(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = B((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? v.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? v.preOffset, this.svg = Be(this.color), this.svg.appendChild(this.group), this.line = Oe(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = X(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = X(), this.group.appendChild(this.targetArrow));
|
|
1883
1875
|
}
|
|
1884
1876
|
render(e) {
|
|
1885
|
-
const { x: t, y: o, width: s, height: n, from: a, to: h } =
|
|
1877
|
+
const { x: t, y: o, width: s, height: n, from: a, to: h } = $e(
|
|
1886
1878
|
e.from,
|
|
1887
1879
|
e.to,
|
|
1888
1880
|
O
|
|
1889
1881
|
);
|
|
1890
|
-
|
|
1891
|
-
const d = new
|
|
1882
|
+
We(this.svg, { x: t, y: o, width: s, height: n });
|
|
1883
|
+
const d = new Tt({
|
|
1892
1884
|
from: a,
|
|
1893
1885
|
to: h,
|
|
1894
1886
|
sourceOffset: this.sourceOffset,
|
|
@@ -1898,64 +1890,64 @@ class $e {
|
|
|
1898
1890
|
arrowLength: this.arrowLength
|
|
1899
1891
|
});
|
|
1900
1892
|
this.line.setAttribute("d", d.path);
|
|
1901
|
-
let c = null,
|
|
1902
|
-
const
|
|
1903
|
-
if (
|
|
1904
|
-
this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (
|
|
1893
|
+
let c = null, l = null;
|
|
1894
|
+
const u = d.diagonalDistance;
|
|
1895
|
+
if (u === 0)
|
|
1896
|
+
this.sourceArrow !== null && (c = "", this.sourceArrow.setAttribute("d", c)), this.targetArrow !== null && (l = "", this.targetArrow.setAttribute("d", l));
|
|
1905
1897
|
else {
|
|
1906
|
-
const
|
|
1907
|
-
x: (h.x - a.x) /
|
|
1908
|
-
y: (h.y - a.y) /
|
|
1898
|
+
const g = {
|
|
1899
|
+
x: (h.x - a.x) / u,
|
|
1900
|
+
y: (h.y - a.y) / u
|
|
1909
1901
|
};
|
|
1910
1902
|
if (this.sourceArrow) {
|
|
1911
1903
|
const p = {
|
|
1912
|
-
x:
|
|
1913
|
-
y:
|
|
1904
|
+
x: g.x * this.sourceOffset,
|
|
1905
|
+
y: g.y * this.sourceOffset
|
|
1914
1906
|
};
|
|
1915
1907
|
c = this.arrowRenderer({
|
|
1916
|
-
direction:
|
|
1908
|
+
direction: g,
|
|
1917
1909
|
shift: p,
|
|
1918
1910
|
arrowLength: this.arrowLength
|
|
1919
1911
|
}), this.sourceArrow.setAttribute("d", c);
|
|
1920
1912
|
}
|
|
1921
1913
|
if (this.targetArrow) {
|
|
1922
1914
|
const p = {
|
|
1923
|
-
x:
|
|
1924
|
-
y:
|
|
1915
|
+
x: g.x * this.targetOffset,
|
|
1916
|
+
y: g.y * this.targetOffset
|
|
1925
1917
|
};
|
|
1926
|
-
|
|
1927
|
-
direction: { x: -
|
|
1918
|
+
l = this.arrowRenderer({
|
|
1919
|
+
direction: { x: -g.x, y: -g.y },
|
|
1928
1920
|
shift: {
|
|
1929
1921
|
x: h.x - p.x,
|
|
1930
1922
|
y: h.y - p.y
|
|
1931
1923
|
},
|
|
1932
1924
|
arrowLength: this.arrowLength
|
|
1933
|
-
}), this.targetArrow.setAttribute("d",
|
|
1925
|
+
}), this.targetArrow.setAttribute("d", l);
|
|
1934
1926
|
}
|
|
1935
1927
|
}
|
|
1936
1928
|
this.afterRenderEmitter.emit({
|
|
1937
1929
|
edgePath: d,
|
|
1938
1930
|
sourceArrowPath: c,
|
|
1939
|
-
targetArrowPath:
|
|
1931
|
+
targetArrowPath: l
|
|
1940
1932
|
});
|
|
1941
1933
|
}
|
|
1942
1934
|
}
|
|
1943
|
-
const
|
|
1935
|
+
const Wt = () => {
|
|
1944
1936
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1945
1937
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1946
|
-
},
|
|
1938
|
+
}, zt = (r) => {
|
|
1947
1939
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1948
1940
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1949
|
-
},
|
|
1941
|
+
}, Ne = (r) => {
|
|
1950
1942
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1951
1943
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1952
1944
|
};
|
|
1953
|
-
class
|
|
1945
|
+
class kt extends Error {
|
|
1954
1946
|
constructor(e) {
|
|
1955
1947
|
super(e), this.name = "InteractiveEdgeError";
|
|
1956
1948
|
}
|
|
1957
1949
|
}
|
|
1958
|
-
class
|
|
1950
|
+
class ke {
|
|
1959
1951
|
constructor(e, t) {
|
|
1960
1952
|
i(this, "svg");
|
|
1961
1953
|
i(this, "group");
|
|
@@ -1967,18 +1959,18 @@ class Be {
|
|
|
1967
1959
|
* @deprecated
|
|
1968
1960
|
* do use shape.svg instead
|
|
1969
1961
|
*/
|
|
1970
|
-
i(this, "handle",
|
|
1962
|
+
i(this, "handle", Wt());
|
|
1971
1963
|
i(this, "onAfterRender");
|
|
1972
1964
|
i(this, "interactiveLine");
|
|
1973
1965
|
i(this, "interactiveSourceArrow", null);
|
|
1974
1966
|
i(this, "interactiveTargetArrow", null);
|
|
1975
|
-
if (this.baseEdge = e, e instanceof
|
|
1976
|
-
throw new
|
|
1967
|
+
if (this.baseEdge = e, e instanceof ke)
|
|
1968
|
+
throw new kt(
|
|
1977
1969
|
"interactive edge can be configured only once"
|
|
1978
1970
|
);
|
|
1979
1971
|
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;
|
|
1980
1972
|
const o = (t == null ? void 0 : t.distance) ?? v.interactiveWidth;
|
|
1981
|
-
this.interactiveLine =
|
|
1973
|
+
this.interactiveLine = zt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Ne(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Ne(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
|
|
1982
1974
|
this.interactiveLine.setAttribute("d", s.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", s.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", s.targetArrowPath);
|
|
1983
1975
|
});
|
|
1984
1976
|
}
|
|
@@ -1986,7 +1978,7 @@ class Be {
|
|
|
1986
1978
|
this.baseEdge.render(e);
|
|
1987
1979
|
}
|
|
1988
1980
|
}
|
|
1989
|
-
class
|
|
1981
|
+
class Zr {
|
|
1990
1982
|
constructor(e, t) {
|
|
1991
1983
|
i(this, "group");
|
|
1992
1984
|
i(this, "line");
|
|
@@ -2003,7 +1995,7 @@ class Yr {
|
|
|
2003
1995
|
this.baseShape.render(e);
|
|
2004
1996
|
}
|
|
2005
1997
|
}
|
|
2006
|
-
class
|
|
1998
|
+
class He {
|
|
2007
1999
|
constructor(e) {
|
|
2008
2000
|
i(this, "onAfterNodeAdded");
|
|
2009
2001
|
i(this, "onAfterNodeUpdated");
|
|
@@ -2118,7 +2110,7 @@ class K {
|
|
|
2118
2110
|
this.counter = 0;
|
|
2119
2111
|
}
|
|
2120
2112
|
}
|
|
2121
|
-
class
|
|
2113
|
+
class Ye {
|
|
2122
2114
|
constructor(e, t, o) {
|
|
2123
2115
|
i(this, "nodeIdGenerator", new K(
|
|
2124
2116
|
(e) => this.graphStore.hasNode(e)
|
|
@@ -2249,18 +2241,18 @@ class We {
|
|
|
2249
2241
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
2250
2242
|
}
|
|
2251
2243
|
}
|
|
2252
|
-
const
|
|
2244
|
+
const Ht = (r) => {
|
|
2253
2245
|
setTimeout(() => {
|
|
2254
2246
|
r();
|
|
2255
2247
|
});
|
|
2256
|
-
},
|
|
2248
|
+
}, Yt = (r) => {
|
|
2257
2249
|
queueMicrotask(() => {
|
|
2258
2250
|
r();
|
|
2259
2251
|
});
|
|
2260
2252
|
}, oe = (r) => {
|
|
2261
2253
|
r();
|
|
2262
2254
|
};
|
|
2263
|
-
class
|
|
2255
|
+
class Xe {
|
|
2264
2256
|
constructor(e) {
|
|
2265
2257
|
i(this, "onBeforeUpdated");
|
|
2266
2258
|
i(this, "onAfterUpdated");
|
|
@@ -2283,7 +2275,7 @@ class ze {
|
|
|
2283
2275
|
return this.viewportStore.createViewportCoords(e);
|
|
2284
2276
|
}
|
|
2285
2277
|
}
|
|
2286
|
-
const
|
|
2278
|
+
const Xt = (r, e) => Symbol.iterator in r ? {
|
|
2287
2279
|
minContentScale: e.focus.minContentScale,
|
|
2288
2280
|
nodes: r,
|
|
2289
2281
|
contentPadding: e.focus.contentPadding,
|
|
@@ -2293,16 +2285,16 @@ const Wt = (r, e) => Symbol.iterator in r ? {
|
|
|
2293
2285
|
nodes: r.nodes ?? [],
|
|
2294
2286
|
contentPadding: r.contentPadding ?? r.contentOffset ?? e.focus.contentPadding,
|
|
2295
2287
|
animationDuration: r.animationDuration ?? e.focus.animationDuration
|
|
2296
|
-
},
|
|
2288
|
+
}, Ge = (r, e, t) => ({
|
|
2297
2289
|
scale: r.scale,
|
|
2298
2290
|
x: r.x + r.scale * e,
|
|
2299
2291
|
y: r.y + r.scale * t
|
|
2300
|
-
}),
|
|
2292
|
+
}), je = (r, e, t, o) => ({
|
|
2301
2293
|
scale: r.scale * e,
|
|
2302
2294
|
x: r.scale * (1 - e) * t + r.x,
|
|
2303
2295
|
y: r.scale * (1 - e) * o + r.y
|
|
2304
2296
|
});
|
|
2305
|
-
class
|
|
2297
|
+
class Je {
|
|
2306
2298
|
constructor(e, t, o, s) {
|
|
2307
2299
|
this.graphStore = e, this.viewportStore = t, this.params = o, this.win = s;
|
|
2308
2300
|
}
|
|
@@ -2314,22 +2306,22 @@ class Ye {
|
|
|
2314
2306
|
}
|
|
2315
2307
|
center(e, t) {
|
|
2316
2308
|
const { width: o, height: s } = this.viewportStore.getDimensions(), n = { x: o / 2, y: s / 2 }, a = this.viewportStore.getViewportMatrix(), h = this.viewportStore.createViewportCoords(e), d = h.x - n.x, c = h.y - n.y;
|
|
2317
|
-
let
|
|
2318
|
-
const
|
|
2319
|
-
if (
|
|
2320
|
-
const p = 1 /
|
|
2321
|
-
|
|
2322
|
-
|
|
2309
|
+
let l = Ge(a, d, c);
|
|
2310
|
+
const u = t == null ? void 0 : t.contentScale;
|
|
2311
|
+
if (u !== void 0) {
|
|
2312
|
+
const p = 1 / u;
|
|
2313
|
+
l = je(
|
|
2314
|
+
l,
|
|
2323
2315
|
p / a.scale,
|
|
2324
2316
|
n.x,
|
|
2325
2317
|
n.y
|
|
2326
2318
|
);
|
|
2327
2319
|
}
|
|
2328
|
-
const
|
|
2329
|
-
|
|
2320
|
+
const g = (t == null ? void 0 : t.animationDuration) ?? 0;
|
|
2321
|
+
g > 0 ? this.animateNavigation(a, l, g) : this.viewportStore.patchViewportMatrix(l);
|
|
2330
2322
|
}
|
|
2331
2323
|
focus(e) {
|
|
2332
|
-
const t =
|
|
2324
|
+
const t = Xt(e ?? {}, this.params);
|
|
2333
2325
|
this.params.focus.schedule(() => {
|
|
2334
2326
|
this.navigate(t);
|
|
2335
2327
|
});
|
|
@@ -2350,12 +2342,12 @@ class Ye {
|
|
|
2350
2342
|
const d = {
|
|
2351
2343
|
x: (t + o) / 2,
|
|
2352
2344
|
y: (s + n) / 2
|
|
2353
|
-
}, { scale: c } = this.viewportStore.getContentMatrix(),
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
),
|
|
2345
|
+
}, { scale: c } = this.viewportStore.getContentMatrix(), l = (n - s) * c, u = (o - t) * c, { width: g, height: p } = this.viewportStore.getDimensions(), w = Math.max(
|
|
2346
|
+
u / g,
|
|
2347
|
+
l / p
|
|
2348
|
+
), f = w > 1 ? c / w : c, y = Math.max(f, e.minContentScale);
|
|
2357
2349
|
this.center(d, {
|
|
2358
|
-
contentScale:
|
|
2350
|
+
contentScale: y,
|
|
2359
2351
|
animationDuration: e.animationDuration
|
|
2360
2352
|
});
|
|
2361
2353
|
}
|
|
@@ -2369,7 +2361,7 @@ class Ye {
|
|
|
2369
2361
|
}, a = (h) => {
|
|
2370
2362
|
s === void 0 && (s = h);
|
|
2371
2363
|
const d = Math.min((h - s) / o, 1);
|
|
2372
|
-
|
|
2364
|
+
this.viewportStore.patchViewportMatrix({
|
|
2373
2365
|
scale: e.scale + d * n.scale,
|
|
2374
2366
|
x: e.x + d * n.x,
|
|
2375
2367
|
y: e.y + d * n.y
|
|
@@ -2378,20 +2370,20 @@ class Ye {
|
|
|
2378
2370
|
this.win.requestAnimationFrame(a);
|
|
2379
2371
|
}
|
|
2380
2372
|
}
|
|
2381
|
-
const
|
|
2382
|
-
const o = new
|
|
2373
|
+
const Ke = (r, e, t) => {
|
|
2374
|
+
const o = new Ve(), s = new He(o), n = new Xe(e), a = new Re(o, e, r), h = {
|
|
2383
2375
|
nodes: {
|
|
2384
|
-
centerFn:
|
|
2376
|
+
centerFn: Ue,
|
|
2385
2377
|
priorityFn: () => 0
|
|
2386
2378
|
},
|
|
2387
2379
|
edges: {
|
|
2388
|
-
shapeFactory: () => new
|
|
2380
|
+
shapeFactory: () => new ze(),
|
|
2389
2381
|
priorityFn: () => 0
|
|
2390
2382
|
},
|
|
2391
2383
|
ports: {
|
|
2392
2384
|
direction: 0
|
|
2393
2385
|
}
|
|
2394
|
-
}, d = new
|
|
2386
|
+
}, d = new Ye(
|
|
2395
2387
|
o,
|
|
2396
2388
|
a,
|
|
2397
2389
|
h
|
|
@@ -2402,13 +2394,13 @@ const Xe = (r, e, t) => {
|
|
|
2402
2394
|
schedule: oe,
|
|
2403
2395
|
animationDuration: 0
|
|
2404
2396
|
}
|
|
2405
|
-
},
|
|
2397
|
+
}, l = new Je(
|
|
2406
2398
|
o,
|
|
2407
2399
|
e,
|
|
2408
2400
|
c,
|
|
2409
2401
|
t
|
|
2410
2402
|
);
|
|
2411
|
-
return new
|
|
2403
|
+
return new Le(s, n, d, l);
|
|
2412
2404
|
};
|
|
2413
2405
|
class j {
|
|
2414
2406
|
constructor(e, t, o, s) {
|
|
@@ -2425,7 +2417,7 @@ class j {
|
|
|
2425
2417
|
if (!this.params.mouseDownEventVerifier(t))
|
|
2426
2418
|
return;
|
|
2427
2419
|
const o = e.currentTarget, s = this.canvas.graph.findPortIdsByElement(o)[0];
|
|
2428
|
-
this.params.
|
|
2420
|
+
this.params.onPointerDownVerifier(s, {
|
|
2429
2421
|
x: t.clientX,
|
|
2430
2422
|
y: t.clientY
|
|
2431
2423
|
}) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
@@ -2452,7 +2444,7 @@ class j {
|
|
|
2452
2444
|
if (t.touches.length !== 1)
|
|
2453
2445
|
return;
|
|
2454
2446
|
const o = t.touches[0], s = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(s)[0];
|
|
2455
|
-
this.params.
|
|
2447
|
+
this.params.onPointerDownVerifier(n, {
|
|
2456
2448
|
x: o.clientX,
|
|
2457
2449
|
y: o.clientY
|
|
2458
2450
|
}) && (e.stopPropagation(), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
@@ -2510,7 +2502,7 @@ class j {
|
|
|
2510
2502
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2511
2503
|
}
|
|
2512
2504
|
}
|
|
2513
|
-
class
|
|
2505
|
+
class Gt {
|
|
2514
2506
|
constructor() {
|
|
2515
2507
|
i(this, "field", "_htmlGraphTags");
|
|
2516
2508
|
}
|
|
@@ -2614,7 +2606,38 @@ class ie {
|
|
|
2614
2606
|
this.movedDistance += s, this.movedDistance > this.movementThreshold && o();
|
|
2615
2607
|
}
|
|
2616
2608
|
}
|
|
2617
|
-
|
|
2609
|
+
const ne = (r, e) => ({
|
|
2610
|
+
from: r.isDirect ? r.staticPortId : e,
|
|
2611
|
+
to: r.isDirect ? e : r.staticPortId
|
|
2612
|
+
});
|
|
2613
|
+
class jt {
|
|
2614
|
+
constructor(e, t) {
|
|
2615
|
+
this.graph = e, this.connectionAllowedVerifier = t;
|
|
2616
|
+
}
|
|
2617
|
+
resolve(e) {
|
|
2618
|
+
let t, o = 1 / 0;
|
|
2619
|
+
const { cursor: s } = e;
|
|
2620
|
+
return this.graph.getAllPortIds().forEach((n) => {
|
|
2621
|
+
const { element: a, direction: h, nodeId: d } = this.graph.getPort(n), { x: c, y: l } = this.graph.getNode(d);
|
|
2622
|
+
if (c === null || l === null)
|
|
2623
|
+
return;
|
|
2624
|
+
const u = ne(e, n);
|
|
2625
|
+
if (!this.connectionAllowedVerifier(u))
|
|
2626
|
+
return;
|
|
2627
|
+
const { top: g, left: p, width: w, height: f } = a.getBoundingClientRect(), y = { x: p + w / 2, y: g + f / 2 }, E = s.x - y.x, x = s.y - y.y, N = Math.sqrt(E * E + x * x);
|
|
2628
|
+
N < o && (o = N, t = h);
|
|
2629
|
+
}), t;
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
class Jt {
|
|
2633
|
+
constructor(e) {
|
|
2634
|
+
this.direction = e;
|
|
2635
|
+
}
|
|
2636
|
+
resolve() {
|
|
2637
|
+
return this.direction;
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
class ae {
|
|
2618
2641
|
constructor(e, t, o, s, n) {
|
|
2619
2642
|
i(this, "grabbedNode", null);
|
|
2620
2643
|
i(this, "maxNodePriority", 0);
|
|
@@ -2733,7 +2756,7 @@ class ne {
|
|
|
2733
2756
|
this.canvas = e, this.element = t, this.window = o, this.pointInsideVerifier = s, this.params = n, 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.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
2734
2757
|
}
|
|
2735
2758
|
static configure(e, t, o, s, n) {
|
|
2736
|
-
new
|
|
2759
|
+
new ae(
|
|
2737
2760
|
e,
|
|
2738
2761
|
t,
|
|
2739
2762
|
o,
|
|
@@ -2924,7 +2947,7 @@ class J {
|
|
|
2924
2947
|
);
|
|
2925
2948
|
}
|
|
2926
2949
|
moveViewport(e, t) {
|
|
2927
|
-
const o = this.viewport.getViewportMatrix(), s =
|
|
2950
|
+
const o = this.viewport.getViewportMatrix(), s = Ge(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
|
|
2928
2951
|
prevTransform: o,
|
|
2929
2952
|
nextTransform: s,
|
|
2930
2953
|
canvasWidth: n,
|
|
@@ -2933,7 +2956,7 @@ class J {
|
|
|
2933
2956
|
this.performTransform(h);
|
|
2934
2957
|
}
|
|
2935
2958
|
scaleViewport(e, t, o) {
|
|
2936
|
-
const s = this.canvas.viewport.getViewportMatrix(), n =
|
|
2959
|
+
const s = this.canvas.viewport.getViewportMatrix(), n = je(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
|
|
2937
2960
|
prevTransform: s,
|
|
2938
2961
|
nextTransform: n,
|
|
2939
2962
|
canvasWidth: a,
|
|
@@ -2972,7 +2995,7 @@ class J {
|
|
|
2972
2995
|
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(s), this.params.onResizeTransformFinished();
|
|
2973
2996
|
}
|
|
2974
2997
|
}
|
|
2975
|
-
class
|
|
2998
|
+
class he {
|
|
2976
2999
|
constructor(e, t, o, s, n, a, h) {
|
|
2977
3000
|
i(this, "nodeHorizontal");
|
|
2978
3001
|
i(this, "nodeVertical");
|
|
@@ -3028,7 +3051,7 @@ class ae {
|
|
|
3028
3051
|
), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
3029
3052
|
}
|
|
3030
3053
|
static configure(e, t, o, s, n, a, h) {
|
|
3031
|
-
new
|
|
3054
|
+
new he(
|
|
3032
3055
|
e,
|
|
3033
3056
|
t,
|
|
3034
3057
|
o,
|
|
@@ -3045,38 +3068,38 @@ class ae {
|
|
|
3045
3068
|
}
|
|
3046
3069
|
scheduleEnsureViewportAreaLoaded() {
|
|
3047
3070
|
setTimeout(() => {
|
|
3048
|
-
const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - this.nodeHorizontal, c = n - this.nodeVertical,
|
|
3049
|
-
this.loadedArea.xFrom < d && this.loadedArea.xTo >
|
|
3071
|
+
const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - this.nodeHorizontal, c = n - this.nodeVertical, l = s + a + this.nodeHorizontal, u = n + h + this.nodeVertical;
|
|
3072
|
+
this.loadedArea.xFrom < d && this.loadedArea.xTo > l && this.loadedArea.yFrom < c && this.loadedArea.yTo > u || this.loadAreaAroundViewport();
|
|
3050
3073
|
});
|
|
3051
3074
|
}
|
|
3052
3075
|
loadAreaAroundViewport() {
|
|
3053
|
-
const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - a - this.nodeHorizontal, c = n - h - this.nodeVertical,
|
|
3076
|
+
const { width: e, height: t } = this.viewport.getDimensions(), { scale: o, x: s, y: n } = this.viewport.getViewportMatrix(), a = e * o, h = t * o, d = s - a - this.nodeHorizontal, c = n - h - this.nodeVertical, l = 3 * a + 2 * this.nodeHorizontal, u = 3 * h + 2 * this.nodeVertical;
|
|
3054
3077
|
this.trigger.emit({
|
|
3055
3078
|
x: d,
|
|
3056
3079
|
y: c,
|
|
3057
|
-
width:
|
|
3058
|
-
height:
|
|
3080
|
+
width: l,
|
|
3081
|
+
height: u
|
|
3059
3082
|
});
|
|
3060
3083
|
}
|
|
3061
3084
|
}
|
|
3062
|
-
const
|
|
3085
|
+
const Kt = () => {
|
|
3063
3086
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3064
3087
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3065
|
-
},
|
|
3088
|
+
}, Qt = () => {
|
|
3066
3089
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
3067
3090
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
3068
|
-
},
|
|
3091
|
+
}, Zt = () => {
|
|
3069
3092
|
const r = document.createElementNS(
|
|
3070
3093
|
"http://www.w3.org/2000/svg",
|
|
3071
3094
|
"pattern"
|
|
3072
3095
|
);
|
|
3073
3096
|
return r.setAttribute("id", "pattern"), r;
|
|
3074
3097
|
};
|
|
3075
|
-
class
|
|
3098
|
+
class de {
|
|
3076
3099
|
constructor(e, t, o) {
|
|
3077
|
-
i(this, "svg",
|
|
3078
|
-
i(this, "patternRenderingRectangle",
|
|
3079
|
-
i(this, "pattern",
|
|
3100
|
+
i(this, "svg", Kt());
|
|
3101
|
+
i(this, "patternRenderingRectangle", Qt());
|
|
3102
|
+
i(this, "pattern", Zt());
|
|
3080
3103
|
i(this, "patternContent");
|
|
3081
3104
|
i(this, "tileWidth");
|
|
3082
3105
|
i(this, "tileHeight");
|
|
@@ -3097,7 +3120,7 @@ class he {
|
|
|
3097
3120
|
}), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
3098
3121
|
}
|
|
3099
3122
|
static configure(e, t, o) {
|
|
3100
|
-
new
|
|
3123
|
+
new de(e, t, o);
|
|
3101
3124
|
}
|
|
3102
3125
|
updateVisibility() {
|
|
3103
3126
|
const { scale: e } = this.canvas.viewport.getViewportMatrix(), t = e > this.maxViewportScale;
|
|
@@ -3111,15 +3134,14 @@ class he {
|
|
|
3111
3134
|
}
|
|
3112
3135
|
}
|
|
3113
3136
|
}
|
|
3114
|
-
class
|
|
3137
|
+
class ce {
|
|
3115
3138
|
constructor(e, t, o, s, n, a) {
|
|
3116
3139
|
i(this, "overlayCanvas");
|
|
3117
|
-
i(this, "
|
|
3118
|
-
i(this, "isTargetDragging", !0);
|
|
3140
|
+
i(this, "edgeInProgress", null);
|
|
3119
3141
|
i(this, "onEdgeCreated", (e) => {
|
|
3120
3142
|
this.params.onAfterEdgeCreated(e);
|
|
3121
3143
|
});
|
|
3122
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas =
|
|
3144
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Ke(
|
|
3123
3145
|
this.overlayLayer,
|
|
3124
3146
|
this.viewportStore,
|
|
3125
3147
|
this.window
|
|
@@ -3127,9 +3149,9 @@ class de {
|
|
|
3127
3149
|
const h = {
|
|
3128
3150
|
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
3129
3151
|
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
3130
|
-
|
|
3131
|
-
const
|
|
3132
|
-
return
|
|
3152
|
+
onPointerDownVerifier: (d, c) => {
|
|
3153
|
+
const l = this.params.connectionTypeResolver(d);
|
|
3154
|
+
return l === null ? !1 : (this.grabPort(d, c, l), !0);
|
|
3133
3155
|
},
|
|
3134
3156
|
onPointerMove: (d) => {
|
|
3135
3157
|
this.moveDraggingPort(d);
|
|
@@ -3138,11 +3160,8 @@ class de {
|
|
|
3138
3160
|
this.tryCreateConnection(d), this.resetDragState();
|
|
3139
3161
|
},
|
|
3140
3162
|
onPointerOutside: () => {
|
|
3141
|
-
const d = this.
|
|
3142
|
-
this.resetDragState(), this.params.onEdgeCreationInterrupted(
|
|
3143
|
-
staticPortId: d,
|
|
3144
|
-
isDirect: c
|
|
3145
|
-
});
|
|
3163
|
+
const d = this.edgeInProgress;
|
|
3164
|
+
this.resetDragState(), this.params.onEdgeCreationInterrupted(d);
|
|
3146
3165
|
}
|
|
3147
3166
|
};
|
|
3148
3167
|
j.configure(
|
|
@@ -3153,7 +3172,7 @@ class de {
|
|
|
3153
3172
|
);
|
|
3154
3173
|
}
|
|
3155
3174
|
static configure(e, t, o, s, n, a) {
|
|
3156
|
-
new
|
|
3175
|
+
new ce(
|
|
3157
3176
|
e,
|
|
3158
3177
|
t,
|
|
3159
3178
|
o,
|
|
@@ -3163,67 +3182,78 @@ class de {
|
|
|
3163
3182
|
);
|
|
3164
3183
|
}
|
|
3165
3184
|
grabPort(e, t, o) {
|
|
3166
|
-
const s = this.canvas.graph.getPort(e)
|
|
3167
|
-
this.staticPortId = e;
|
|
3168
|
-
const n = s.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
|
|
3185
|
+
const s = this.canvas.graph.getPort(e), n = s.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
|
|
3169
3186
|
x: a - d.x,
|
|
3170
3187
|
y: h - d.y
|
|
3171
|
-
}),
|
|
3188
|
+
}), l = this.canvas.viewport.createContentCoords({
|
|
3172
3189
|
x: t.x - d.x,
|
|
3173
3190
|
y: t.y - d.y
|
|
3174
|
-
}),
|
|
3175
|
-
overlayNodeId:
|
|
3191
|
+
}), u = {
|
|
3192
|
+
overlayNodeId: M.StaticNodeId,
|
|
3176
3193
|
portCoords: c,
|
|
3177
3194
|
portDirection: s.direction
|
|
3178
|
-
},
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3195
|
+
}, g = o === "direct";
|
|
3196
|
+
this.edgeInProgress = {
|
|
3197
|
+
staticPortId: e,
|
|
3198
|
+
isDirect: g
|
|
3182
3199
|
};
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3200
|
+
const p = this.params.draggingPortDirectionResolver.resolve(
|
|
3201
|
+
{
|
|
3202
|
+
cursor: t,
|
|
3203
|
+
...this.edgeInProgress
|
|
3204
|
+
}
|
|
3205
|
+
), w = {
|
|
3206
|
+
overlayNodeId: M.DraggingNodeId,
|
|
3207
|
+
portCoords: l,
|
|
3208
|
+
portDirection: p ?? s.direction
|
|
3209
|
+
}, [f, y] = g ? [u, w] : [w, u];
|
|
3210
|
+
this.overlayCanvas.addNode(Y(f)), this.overlayCanvas.addNode(Y(y)), this.overlayCanvas.addEdge({
|
|
3211
|
+
from: f.overlayNodeId,
|
|
3212
|
+
to: y.overlayNodeId,
|
|
3213
|
+
shape: this.params.edgeShapeFactory(M.EdgeId)
|
|
3189
3214
|
});
|
|
3190
3215
|
}
|
|
3191
3216
|
resetDragState() {
|
|
3192
|
-
this.
|
|
3217
|
+
this.edgeInProgress = null, this.overlayCanvas.clear();
|
|
3193
3218
|
}
|
|
3194
3219
|
tryCreateConnection(e) {
|
|
3195
|
-
const t =
|
|
3220
|
+
const t = Fe(this.canvas.graph, e);
|
|
3196
3221
|
if (t === null) {
|
|
3197
|
-
this.params.onEdgeCreationInterrupted(
|
|
3198
|
-
staticPortId: this.staticPortId,
|
|
3199
|
-
isDirect: this.isTargetDragging
|
|
3200
|
-
});
|
|
3222
|
+
this.params.onEdgeCreationInterrupted(this.edgeInProgress);
|
|
3201
3223
|
return;
|
|
3202
3224
|
}
|
|
3203
|
-
const o =
|
|
3204
|
-
|
|
3225
|
+
const o = ne(
|
|
3226
|
+
this.edgeInProgress,
|
|
3227
|
+
t
|
|
3228
|
+
), s = this.params.connectionAllowedVerifier(o), n = this.params.connectionPreprocessor({
|
|
3229
|
+
from: o.from,
|
|
3230
|
+
to: o.to
|
|
3231
|
+
});
|
|
3232
|
+
s && n !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(n), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(o);
|
|
3205
3233
|
}
|
|
3206
3234
|
moveDraggingPort(e) {
|
|
3207
3235
|
const t = this.overlayLayer.getBoundingClientRect(), o = this.canvas.viewport.createContentCoords({
|
|
3208
3236
|
x: e.x - t.x,
|
|
3209
3237
|
y: e.y - t.y
|
|
3238
|
+
}), s = this.params.draggingPortDirectionResolver.resolve({
|
|
3239
|
+
cursor: e,
|
|
3240
|
+
...this.edgeInProgress
|
|
3210
3241
|
});
|
|
3211
|
-
this.overlayCanvas.updateNode(
|
|
3242
|
+
this.overlayCanvas.updateNode(M.DraggingNodeId, {
|
|
3212
3243
|
x: o.x,
|
|
3213
3244
|
y: o.y
|
|
3214
|
-
});
|
|
3245
|
+
}).updatePort(M.DraggingNodeId, { direction: s });
|
|
3215
3246
|
}
|
|
3216
3247
|
}
|
|
3217
|
-
class
|
|
3248
|
+
class le {
|
|
3218
3249
|
constructor(e, t, o, s, n, a) {
|
|
3219
3250
|
i(this, "overlayCanvas");
|
|
3220
|
-
i(this, "
|
|
3221
|
-
i(this, "isTargetDragging", !0);
|
|
3251
|
+
i(this, "edgeInProgress", null);
|
|
3222
3252
|
i(this, "draggingEdgePayload", null);
|
|
3223
3253
|
i(this, "onEdgeReattached", (e) => {
|
|
3224
3254
|
this.params.onAfterEdgeReattached(e);
|
|
3225
3255
|
});
|
|
3226
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas =
|
|
3256
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Ke(
|
|
3227
3257
|
this.overlayLayer,
|
|
3228
3258
|
this.viewportStore,
|
|
3229
3259
|
this.window
|
|
@@ -3231,7 +3261,7 @@ class ce {
|
|
|
3231
3261
|
const h = {
|
|
3232
3262
|
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
3233
3263
|
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
3234
|
-
|
|
3264
|
+
onPointerDownVerifier: (d, c) => this.tryStartEdgeDragging(d, c),
|
|
3235
3265
|
onPointerMove: (d) => {
|
|
3236
3266
|
this.moveDraggingPort(d);
|
|
3237
3267
|
},
|
|
@@ -3257,7 +3287,7 @@ class ce {
|
|
|
3257
3287
|
);
|
|
3258
3288
|
}
|
|
3259
3289
|
static configure(e, t, o, s, n, a) {
|
|
3260
|
-
new
|
|
3290
|
+
new le(
|
|
3261
3291
|
e,
|
|
3262
3292
|
t,
|
|
3263
3293
|
o,
|
|
@@ -3271,16 +3301,16 @@ class ce {
|
|
|
3271
3301
|
if (o === null)
|
|
3272
3302
|
return !1;
|
|
3273
3303
|
const s = this.canvas.graph.getEdge(o), n = e === s.from, a = e === s.to, h = n ? s.to : s.from;
|
|
3274
|
-
this.
|
|
3275
|
-
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h),
|
|
3276
|
-
x:
|
|
3277
|
-
y:
|
|
3278
|
-
},
|
|
3279
|
-
x:
|
|
3280
|
-
y:
|
|
3304
|
+
this.edgeInProgress = { staticPortId: h, isDirect: a };
|
|
3305
|
+
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), l = c.element.getBoundingClientRect(), u = {
|
|
3306
|
+
x: l.x + l.width / 2,
|
|
3307
|
+
y: l.y + l.height / 2
|
|
3308
|
+
}, g = this.overlayLayer.getBoundingClientRect(), p = this.canvas.viewport.createContentCoords({
|
|
3309
|
+
x: u.x - g.x,
|
|
3310
|
+
y: u.y - g.y
|
|
3281
3311
|
}), w = this.canvas.viewport.createContentCoords({
|
|
3282
|
-
x: t.x -
|
|
3283
|
-
y: t.y -
|
|
3312
|
+
x: t.x - g.x,
|
|
3313
|
+
y: t.y - g.y
|
|
3284
3314
|
});
|
|
3285
3315
|
this.draggingEdgePayload = {
|
|
3286
3316
|
id: o,
|
|
@@ -3289,44 +3319,62 @@ class ce {
|
|
|
3289
3319
|
shape: s.shape,
|
|
3290
3320
|
priority: s.priority
|
|
3291
3321
|
}, this.canvas.removeEdge(o);
|
|
3292
|
-
const
|
|
3293
|
-
overlayNodeId:
|
|
3322
|
+
const f = {
|
|
3323
|
+
overlayNodeId: M.StaticNodeId,
|
|
3294
3324
|
portCoords: p,
|
|
3295
3325
|
portDirection: c.direction
|
|
3296
|
-
},
|
|
3297
|
-
|
|
3326
|
+
}, y = this.params.draggingPortDirectionResolver.resolve(
|
|
3327
|
+
{
|
|
3328
|
+
cursor: t,
|
|
3329
|
+
...this.edgeInProgress
|
|
3330
|
+
}
|
|
3331
|
+
), E = {
|
|
3332
|
+
overlayNodeId: M.DraggingNodeId,
|
|
3298
3333
|
portCoords: w,
|
|
3299
|
-
portDirection: d.direction
|
|
3300
|
-
}, [x,
|
|
3301
|
-
this.overlayCanvas.addNode(Y(x)), this.overlayCanvas.addNode(Y(
|
|
3302
|
-
const T = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(
|
|
3334
|
+
portDirection: y ?? d.direction
|
|
3335
|
+
}, [x, N] = a ? [f, E] : [E, f];
|
|
3336
|
+
this.overlayCanvas.addNode(Y(x)), this.overlayCanvas.addNode(Y(N));
|
|
3337
|
+
const T = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(M.EdgeId) : s.shape;
|
|
3303
3338
|
return this.overlayCanvas.addEdge({
|
|
3304
|
-
id:
|
|
3339
|
+
id: M.EdgeId,
|
|
3305
3340
|
from: x.overlayNodeId,
|
|
3306
|
-
to:
|
|
3341
|
+
to: N.overlayNodeId,
|
|
3307
3342
|
shape: T
|
|
3308
3343
|
}), !0;
|
|
3309
3344
|
}
|
|
3310
3345
|
resetDragState() {
|
|
3311
|
-
this.draggingEdgePayload = null, this.
|
|
3346
|
+
this.draggingEdgePayload = null, this.edgeInProgress = null, this.overlayCanvas.clear();
|
|
3312
3347
|
}
|
|
3313
3348
|
moveDraggingPort(e) {
|
|
3314
3349
|
const t = this.overlayLayer.getBoundingClientRect(), o = {
|
|
3315
3350
|
x: e.x - t.x,
|
|
3316
3351
|
y: e.y - t.y
|
|
3317
|
-
}, s = this.canvas.viewport.createContentCoords(o)
|
|
3318
|
-
|
|
3352
|
+
}, s = this.canvas.viewport.createContentCoords(o), n = this.params.draggingPortDirectionResolver.resolve({
|
|
3353
|
+
cursor: e,
|
|
3354
|
+
...this.edgeInProgress
|
|
3355
|
+
});
|
|
3356
|
+
this.overlayCanvas.updateNode(M.DraggingNodeId, {
|
|
3319
3357
|
x: s.x,
|
|
3320
3358
|
y: s.y
|
|
3321
|
-
});
|
|
3359
|
+
}).updatePort(M.DraggingNodeId, { direction: n });
|
|
3322
3360
|
}
|
|
3323
3361
|
tryCreateConnection(e) {
|
|
3324
|
-
const t =
|
|
3325
|
-
if (this.overlayCanvas.removeEdge(
|
|
3326
|
-
this.
|
|
3362
|
+
const t = Fe(this.canvas.graph, e);
|
|
3363
|
+
if (this.overlayCanvas.removeEdge(M.EdgeId), t === null) {
|
|
3364
|
+
const c = this.draggingEdgePayload;
|
|
3365
|
+
this.params.onEdgeReattachInterrupted({
|
|
3366
|
+
id: c.id,
|
|
3367
|
+
from: c.from,
|
|
3368
|
+
to: c.to,
|
|
3369
|
+
shape: c.shape,
|
|
3370
|
+
priority: c.priority
|
|
3371
|
+
});
|
|
3327
3372
|
return;
|
|
3328
3373
|
}
|
|
3329
|
-
const
|
|
3374
|
+
const { from: o, to: s } = ne(
|
|
3375
|
+
this.edgeInProgress,
|
|
3376
|
+
t
|
|
3377
|
+
), n = this.draggingEdgePayload, a = {
|
|
3330
3378
|
id: n.id,
|
|
3331
3379
|
from: o,
|
|
3332
3380
|
to: s,
|
|
@@ -3349,28 +3397,18 @@ class ce {
|
|
|
3349
3397
|
});
|
|
3350
3398
|
}
|
|
3351
3399
|
}
|
|
3352
|
-
handleEdgeReattachInterrupted() {
|
|
3353
|
-
const e = this.draggingEdgePayload;
|
|
3354
|
-
this.params.onEdgeReattachInterrupted({
|
|
3355
|
-
id: e.id,
|
|
3356
|
-
from: e.from,
|
|
3357
|
-
to: e.to,
|
|
3358
|
-
shape: e.shape,
|
|
3359
|
-
priority: e.priority
|
|
3360
|
-
});
|
|
3361
|
-
}
|
|
3362
3400
|
}
|
|
3363
|
-
class
|
|
3401
|
+
class ue {
|
|
3364
3402
|
constructor(e, t) {
|
|
3365
3403
|
this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
|
|
3366
3404
|
this.applier.apply();
|
|
3367
3405
|
});
|
|
3368
3406
|
}
|
|
3369
3407
|
static configure(e, t) {
|
|
3370
|
-
new
|
|
3408
|
+
new ue(e, t);
|
|
3371
3409
|
}
|
|
3372
3410
|
}
|
|
3373
|
-
class
|
|
3411
|
+
class ge {
|
|
3374
3412
|
constructor(e, t, o) {
|
|
3375
3413
|
i(this, "applyScheduled", !1);
|
|
3376
3414
|
i(this, "apply", () => {
|
|
@@ -3387,7 +3425,7 @@ class ue {
|
|
|
3387
3425
|
});
|
|
3388
3426
|
}
|
|
3389
3427
|
static configure(e, t, o) {
|
|
3390
|
-
new
|
|
3428
|
+
new ge(
|
|
3391
3429
|
e,
|
|
3392
3430
|
t,
|
|
3393
3431
|
o
|
|
@@ -3397,7 +3435,7 @@ class ue {
|
|
|
3397
3435
|
this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
|
|
3398
3436
|
}
|
|
3399
3437
|
}
|
|
3400
|
-
class
|
|
3438
|
+
class _t {
|
|
3401
3439
|
constructor(e, t, o) {
|
|
3402
3440
|
this.canvas = e, this.layoutAlgorithm = t, this.params = o;
|
|
3403
3441
|
}
|
|
@@ -3411,23 +3449,23 @@ class Xt {
|
|
|
3411
3449
|
}), this.params.onAfterApplied();
|
|
3412
3450
|
}
|
|
3413
3451
|
}
|
|
3414
|
-
class
|
|
3452
|
+
class qt {
|
|
3415
3453
|
static configure(e, t) {
|
|
3416
|
-
const o = t.applyOn, s = new
|
|
3454
|
+
const o = t.applyOn, s = new _t(e, t.algorithm, {
|
|
3417
3455
|
staticNodeResolver: t.staticNodeResolver,
|
|
3418
3456
|
onBeforeApplied: t.onBeforeApplied,
|
|
3419
3457
|
onAfterApplied: t.onAfterApplied
|
|
3420
3458
|
});
|
|
3421
3459
|
switch (o.type) {
|
|
3422
3460
|
case "trigger": {
|
|
3423
|
-
|
|
3461
|
+
ue.configure(
|
|
3424
3462
|
s,
|
|
3425
3463
|
o.trigger
|
|
3426
3464
|
);
|
|
3427
3465
|
break;
|
|
3428
3466
|
}
|
|
3429
3467
|
case "topologyChangeSchedule": {
|
|
3430
|
-
|
|
3468
|
+
ge.configure(
|
|
3431
3469
|
e.graph,
|
|
3432
3470
|
s,
|
|
3433
3471
|
o.schedule
|
|
@@ -3437,7 +3475,7 @@ class Gt {
|
|
|
3437
3475
|
}
|
|
3438
3476
|
}
|
|
3439
3477
|
}
|
|
3440
|
-
class
|
|
3478
|
+
class er {
|
|
3441
3479
|
constructor(e, t) {
|
|
3442
3480
|
i(this, "previousTimeStamp");
|
|
3443
3481
|
i(this, "step", (e) => {
|
|
@@ -3452,7 +3490,7 @@ class jt {
|
|
|
3452
3490
|
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
3453
3491
|
}
|
|
3454
3492
|
}
|
|
3455
|
-
class
|
|
3493
|
+
class tr {
|
|
3456
3494
|
constructor(e, t, o) {
|
|
3457
3495
|
this.canvas = e, this.layoutAlgorithm = t, this.params = o;
|
|
3458
3496
|
}
|
|
@@ -3467,23 +3505,23 @@ class Jt {
|
|
|
3467
3505
|
}), this.params.onAfterApplied();
|
|
3468
3506
|
}
|
|
3469
3507
|
}
|
|
3470
|
-
class
|
|
3508
|
+
class pe {
|
|
3471
3509
|
constructor(e, t, o) {
|
|
3472
3510
|
i(this, "applier");
|
|
3473
3511
|
i(this, "step", (e) => {
|
|
3474
3512
|
this.applier.apply(e);
|
|
3475
3513
|
});
|
|
3476
|
-
this.win = o, this.applier = new
|
|
3514
|
+
this.win = o, this.applier = new tr(e, t.algorithm, {
|
|
3477
3515
|
staticNodeResolver: t.staticNodeResolver,
|
|
3478
3516
|
onBeforeApplied: t.onBeforeApplied,
|
|
3479
3517
|
onAfterApplied: t.onAfterApplied
|
|
3480
|
-
}), new
|
|
3518
|
+
}), new er(this.win, this.step);
|
|
3481
3519
|
}
|
|
3482
3520
|
static configure(e, t, o) {
|
|
3483
|
-
new
|
|
3521
|
+
new pe(e, t, o);
|
|
3484
3522
|
}
|
|
3485
3523
|
}
|
|
3486
|
-
class
|
|
3524
|
+
class we {
|
|
3487
3525
|
constructor(e, t, o, s, n) {
|
|
3488
3526
|
i(this, "configurator");
|
|
3489
3527
|
i(this, "onNodeSelected");
|
|
@@ -3517,7 +3555,7 @@ class pe {
|
|
|
3517
3555
|
), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.reset);
|
|
3518
3556
|
}
|
|
3519
3557
|
static configure(e, t, o, s, n) {
|
|
3520
|
-
new
|
|
3558
|
+
new we(
|
|
3521
3559
|
e,
|
|
3522
3560
|
t,
|
|
3523
3561
|
o,
|
|
@@ -3526,7 +3564,7 @@ class pe {
|
|
|
3526
3564
|
);
|
|
3527
3565
|
}
|
|
3528
3566
|
}
|
|
3529
|
-
class
|
|
3567
|
+
class fe {
|
|
3530
3568
|
constructor(e, t, o, s, n) {
|
|
3531
3569
|
i(this, "configurator");
|
|
3532
3570
|
i(this, "selectionHandledTag", se);
|
|
@@ -3560,7 +3598,7 @@ class we {
|
|
|
3560
3598
|
), this.canvas.graph.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.canvas.graph.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.reset);
|
|
3561
3599
|
}
|
|
3562
3600
|
static configure(e, t, o, s, n) {
|
|
3563
|
-
new
|
|
3601
|
+
new fe(
|
|
3564
3602
|
e,
|
|
3565
3603
|
t,
|
|
3566
3604
|
o,
|
|
@@ -3600,23 +3638,23 @@ class ye {
|
|
|
3600
3638
|
);
|
|
3601
3639
|
}
|
|
3602
3640
|
}
|
|
3603
|
-
const
|
|
3641
|
+
const rr = () => {
|
|
3604
3642
|
const r = document.createElement("div");
|
|
3605
3643
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3606
3644
|
}, Q = () => {
|
|
3607
3645
|
const r = document.createElement("div");
|
|
3608
3646
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3609
|
-
},
|
|
3647
|
+
}, Ce = () => {
|
|
3610
3648
|
const r = Q();
|
|
3611
3649
|
return r.style.pointerEvents = "none", r;
|
|
3612
3650
|
};
|
|
3613
|
-
class
|
|
3651
|
+
class or {
|
|
3614
3652
|
constructor(e) {
|
|
3615
3653
|
i(this, "background", Q());
|
|
3616
3654
|
i(this, "main", Q());
|
|
3617
|
-
i(this, "overlayConnectablePorts",
|
|
3618
|
-
i(this, "overlayDraggableEdges",
|
|
3619
|
-
i(this, "host",
|
|
3655
|
+
i(this, "overlayConnectablePorts", Ce());
|
|
3656
|
+
i(this, "overlayDraggableEdges", Ce());
|
|
3657
|
+
i(this, "host", rr());
|
|
3620
3658
|
this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
|
|
3621
3659
|
}
|
|
3622
3660
|
destroy() {
|
|
@@ -3641,10 +3679,83 @@ const b = Object.freeze({
|
|
|
3641
3679
|
mouseDownEventVerifier: (r) => r.button === 0,
|
|
3642
3680
|
mouseUpEventVerifier: (r) => r.button === 0,
|
|
3643
3681
|
movementThreshold: 10
|
|
3644
|
-
}),
|
|
3645
|
-
},
|
|
3646
|
-
|
|
3647
|
-
|
|
3682
|
+
}), P = () => {
|
|
3683
|
+
}, Qe = (r, e, t) => r === "closest-connectable-port" ? new jt(
|
|
3684
|
+
e,
|
|
3685
|
+
t
|
|
3686
|
+
) : new Jt(r), ve = (r) => {
|
|
3687
|
+
if (typeof r == "function")
|
|
3688
|
+
return r;
|
|
3689
|
+
switch (r.type) {
|
|
3690
|
+
case "straight":
|
|
3691
|
+
return () => new Bt({
|
|
3692
|
+
color: r.color,
|
|
3693
|
+
width: r.width,
|
|
3694
|
+
arrowLength: r.arrowLength,
|
|
3695
|
+
arrowOffset: r.arrowOffset,
|
|
3696
|
+
arrowRenderer: r.arrowRenderer,
|
|
3697
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
3698
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
3699
|
+
cycleSquareSide: r.cycleSquareSide,
|
|
3700
|
+
roundness: r.roundness,
|
|
3701
|
+
detourDistance: r.detourDistance,
|
|
3702
|
+
detourDirection: r.detourDirection
|
|
3703
|
+
});
|
|
3704
|
+
case "horizontal":
|
|
3705
|
+
return () => new $t({
|
|
3706
|
+
color: r.color,
|
|
3707
|
+
width: r.width,
|
|
3708
|
+
arrowLength: r.arrowLength,
|
|
3709
|
+
arrowOffset: r.arrowOffset,
|
|
3710
|
+
arrowRenderer: r.arrowRenderer,
|
|
3711
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
3712
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
3713
|
+
cycleSquareSide: r.cycleSquareSide,
|
|
3714
|
+
roundness: r.roundness,
|
|
3715
|
+
detourDistance: r.detourDistance
|
|
3716
|
+
});
|
|
3717
|
+
case "vertical":
|
|
3718
|
+
return () => new Ot({
|
|
3719
|
+
color: r.color,
|
|
3720
|
+
width: r.width,
|
|
3721
|
+
arrowLength: r.arrowLength,
|
|
3722
|
+
arrowOffset: r.arrowOffset,
|
|
3723
|
+
arrowRenderer: r.arrowRenderer,
|
|
3724
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
3725
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
3726
|
+
cycleSquareSide: r.cycleSquareSide,
|
|
3727
|
+
roundness: r.roundness,
|
|
3728
|
+
detourDistance: r.detourDistance
|
|
3729
|
+
});
|
|
3730
|
+
case "direct":
|
|
3731
|
+
return () => new ze({
|
|
3732
|
+
color: r.color,
|
|
3733
|
+
width: r.width,
|
|
3734
|
+
arrowLength: r.arrowLength,
|
|
3735
|
+
arrowRenderer: r.arrowRenderer,
|
|
3736
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
3737
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
3738
|
+
sourceOffset: r.sourceOffset,
|
|
3739
|
+
targetOffset: r.targetOffset
|
|
3740
|
+
});
|
|
3741
|
+
default:
|
|
3742
|
+
return () => new Ut({
|
|
3743
|
+
color: r.color,
|
|
3744
|
+
width: r.width,
|
|
3745
|
+
arrowLength: r.arrowLength,
|
|
3746
|
+
arrowRenderer: r.arrowRenderer,
|
|
3747
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
3748
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
3749
|
+
cycleRadius: r.cycleRadius,
|
|
3750
|
+
smallCycleRadius: r.smallCycleRadius,
|
|
3751
|
+
curvature: r.curvature,
|
|
3752
|
+
detourDistance: r.detourDistance,
|
|
3753
|
+
detourDirection: r.detourDirection
|
|
3754
|
+
});
|
|
3755
|
+
}
|
|
3756
|
+
}, sr = (r) => {
|
|
3757
|
+
var l, u, g, p, w, f;
|
|
3758
|
+
const e = r.nodeDragVerifier ?? (() => !0), t = r.moveOnTop !== !1, o = r.moveEdgesOnTop !== !1 && t, s = (l = r.mouse) == null ? void 0 : l.dragCursor, n = s !== void 0 ? s : "grab", a = (u = r.mouse) == null ? void 0 : u.mouseDownEventVerifier, h = a !== void 0 ? a : (y) => y.button === 0, d = (g = r.mouse) == null ? void 0 : g.mouseUpEventVerifier, c = d !== void 0 ? d : (y) => y.button === 0;
|
|
3648
3759
|
return {
|
|
3649
3760
|
moveOnTop: t,
|
|
3650
3761
|
moveEdgesOnTop: o,
|
|
@@ -3652,43 +3763,43 @@ const b = Object.freeze({
|
|
|
3652
3763
|
gridSize: r.gridSize ?? null,
|
|
3653
3764
|
mouseDownEventVerifier: h,
|
|
3654
3765
|
mouseUpEventVerifier: c,
|
|
3655
|
-
onNodeDragStarted: ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ??
|
|
3656
|
-
onNodeDrag: ((w = r.events) == null ? void 0 : w.onNodeDrag) ??
|
|
3766
|
+
onNodeDragStarted: ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? P,
|
|
3767
|
+
onNodeDrag: ((w = r.events) == null ? void 0 : w.onNodeDrag) ?? P,
|
|
3657
3768
|
nodeDragVerifier: e,
|
|
3658
|
-
onNodeDragFinished: ((
|
|
3769
|
+
onNodeDragFinished: ((f = r.events) == null ? void 0 : f.onNodeDragFinished) ?? P
|
|
3659
3770
|
};
|
|
3660
|
-
},
|
|
3771
|
+
}, ir = (r) => {
|
|
3661
3772
|
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, o = r.minY !== null ? r.minY : -1 / 0, s = r.maxY !== null ? r.maxY : 1 / 0;
|
|
3662
3773
|
return (n) => {
|
|
3663
3774
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
3664
3775
|
a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
|
|
3665
3776
|
const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
|
|
3666
3777
|
a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < o && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, o));
|
|
3667
|
-
const
|
|
3668
|
-
return h >
|
|
3778
|
+
const l = n.canvasHeight * n.prevTransform.scale, u = s - l;
|
|
3779
|
+
return h > u && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, u)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3669
3780
|
};
|
|
3670
|
-
},
|
|
3781
|
+
}, nr = (r) => {
|
|
3671
3782
|
const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
|
|
3672
3783
|
return (n) => {
|
|
3673
3784
|
const a = n.prevTransform, h = n.nextTransform;
|
|
3674
|
-
let d = h.scale, c = h.x,
|
|
3785
|
+
let d = h.scale, c = h.x, l = h.y;
|
|
3675
3786
|
if (h.scale > s && h.scale > a.scale) {
|
|
3676
|
-
d = Math.max(a.scale, s), c = a.x,
|
|
3677
|
-
const
|
|
3678
|
-
c = a.x + (h.x - a.x) *
|
|
3787
|
+
d = Math.max(a.scale, s), c = a.x, l = a.y;
|
|
3788
|
+
const u = (d - a.scale) / (h.scale - a.scale);
|
|
3789
|
+
c = a.x + (h.x - a.x) * u, l = a.y + (h.y - a.y) * u;
|
|
3679
3790
|
}
|
|
3680
3791
|
if (h.scale < o && h.scale < a.scale) {
|
|
3681
|
-
d = Math.min(a.scale, o), c = a.x,
|
|
3682
|
-
const
|
|
3683
|
-
c = a.x + (h.x - a.x) *
|
|
3792
|
+
d = Math.min(a.scale, o), c = a.x, l = a.y;
|
|
3793
|
+
const u = (d - a.scale) / (h.scale - a.scale);
|
|
3794
|
+
c = a.x + (h.x - a.x) * u, l = a.y + (h.y - a.y) * u;
|
|
3684
3795
|
}
|
|
3685
3796
|
return {
|
|
3686
3797
|
scale: d,
|
|
3687
3798
|
x: c,
|
|
3688
|
-
y:
|
|
3799
|
+
y: l
|
|
3689
3800
|
};
|
|
3690
3801
|
};
|
|
3691
|
-
},
|
|
3802
|
+
}, ar = (r) => (e) => r.reduce(
|
|
3692
3803
|
(t, o) => o({
|
|
3693
3804
|
prevTransform: e.prevTransform,
|
|
3694
3805
|
nextTransform: t,
|
|
@@ -3696,193 +3807,134 @@ const b = Object.freeze({
|
|
|
3696
3807
|
canvasHeight: e.canvasHeight
|
|
3697
3808
|
}),
|
|
3698
3809
|
e.nextTransform
|
|
3699
|
-
),
|
|
3810
|
+
), Te = (r) => {
|
|
3700
3811
|
if (typeof r == "function")
|
|
3701
3812
|
return r;
|
|
3702
3813
|
switch (r.type) {
|
|
3703
3814
|
case "scale-limit":
|
|
3704
|
-
return
|
|
3815
|
+
return nr({
|
|
3705
3816
|
minContentScale: r.minContentScale ?? 0,
|
|
3706
3817
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3707
3818
|
});
|
|
3708
3819
|
case "shift-limit":
|
|
3709
|
-
return
|
|
3820
|
+
return ir({
|
|
3710
3821
|
minX: r.minX ?? -1 / 0,
|
|
3711
3822
|
maxX: r.maxX ?? 1 / 0,
|
|
3712
3823
|
minY: r.minY ?? -1 / 0,
|
|
3713
3824
|
maxY: r.maxY ?? 1 / 0
|
|
3714
3825
|
});
|
|
3715
3826
|
}
|
|
3716
|
-
},
|
|
3717
|
-
var
|
|
3718
|
-
const e = (
|
|
3827
|
+
}, Me = (r) => {
|
|
3828
|
+
var g, p, w, f, y, E, x, N, T, D, F, U;
|
|
3829
|
+
const e = (g = r == null ? void 0 : r.scale) == null ? void 0 : g.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
|
|
3719
3830
|
let s;
|
|
3720
|
-
o !== void 0 ? Array.isArray(o) ? s =
|
|
3831
|
+
o !== void 0 ? Array.isArray(o) ? s = ar(
|
|
3721
3832
|
o.map(
|
|
3722
|
-
(R) =>
|
|
3833
|
+
(R) => Te(R)
|
|
3723
3834
|
)
|
|
3724
|
-
) : s =
|
|
3725
|
-
const n = ((p = r == null ? void 0 : r.shift) == null ? void 0 : p.cursor) !== void 0 ? r.shift.cursor : "grab", a = (w = r == null ? void 0 : r.shift) == null ? void 0 : w.mouseDownEventVerifier, h = a !== void 0 ? a : (R) => R.button === 0, d = (
|
|
3835
|
+
) : s = Te(o) : s = (R) => R.nextTransform;
|
|
3836
|
+
const n = ((p = r == null ? void 0 : r.shift) == null ? void 0 : p.cursor) !== void 0 ? r.shift.cursor : "grab", a = (w = r == null ? void 0 : r.shift) == null ? void 0 : w.mouseDownEventVerifier, h = a !== void 0 ? a : (R) => R.button === 0, d = (f = r == null ? void 0 : r.shift) == null ? void 0 : f.mouseUpEventVerifier, c = d !== void 0 ? d : (R) => R.button === 0, l = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelEventVerifier, u = l !== void 0 ? l : () => !0;
|
|
3726
3837
|
return {
|
|
3727
3838
|
wheelSensitivity: t,
|
|
3728
|
-
onTransformStarted: ((
|
|
3729
|
-
onTransformFinished: ((
|
|
3730
|
-
onBeforeTransformChange: ((
|
|
3731
|
-
onTransformChange: ((
|
|
3839
|
+
onTransformStarted: ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onTransformStarted) ?? P,
|
|
3840
|
+
onTransformFinished: ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformFinished) ?? P,
|
|
3841
|
+
onBeforeTransformChange: ((N = r == null ? void 0 : r.events) == null ? void 0 : N.onBeforeTransformChange) ?? P,
|
|
3842
|
+
onTransformChange: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onTransformChange) ?? P,
|
|
3732
3843
|
transformPreprocessor: s,
|
|
3733
3844
|
shiftCursor: n,
|
|
3734
3845
|
mouseDownEventVerifier: h,
|
|
3735
3846
|
mouseUpEventVerifier: c,
|
|
3736
|
-
mouseWheelEventVerifier:
|
|
3737
|
-
scaleWheelFinishTimeout: ((
|
|
3738
|
-
onResizeTransformStarted: ((F = r == null ? void 0 : r.events) == null ? void 0 : F.onResizeTransformStarted) ??
|
|
3739
|
-
onResizeTransformFinished: ((U = r == null ? void 0 : r.events) == null ? void 0 : U.onResizeTransformFinished) ??
|
|
3847
|
+
mouseWheelEventVerifier: u,
|
|
3848
|
+
scaleWheelFinishTimeout: ((D = r == null ? void 0 : r.scale) == null ? void 0 : D.wheelFinishTimeout) ?? 500,
|
|
3849
|
+
onResizeTransformStarted: ((F = r == null ? void 0 : r.events) == null ? void 0 : F.onResizeTransformStarted) ?? P,
|
|
3850
|
+
onResizeTransformFinished: ((U = r == null ? void 0 : r.events) == null ? void 0 : U.onResizeTransformFinished) ?? P
|
|
3740
3851
|
};
|
|
3741
|
-
},
|
|
3852
|
+
}, hr = (r, e) => {
|
|
3742
3853
|
const t = document.createElementNS(
|
|
3743
3854
|
"http://www.w3.org/2000/svg",
|
|
3744
3855
|
"circle"
|
|
3745
3856
|
);
|
|
3746
3857
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3747
|
-
},
|
|
3858
|
+
}, dr = (r) => r instanceof SVGElement ? r : hr(
|
|
3748
3859
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3749
3860
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3750
|
-
),
|
|
3751
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s =
|
|
3861
|
+
), cr = (r) => {
|
|
3862
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = dr(r.renderer ?? {});
|
|
3752
3863
|
return {
|
|
3753
3864
|
tileWidth: t,
|
|
3754
3865
|
tileHeight: o,
|
|
3755
3866
|
renderer: s,
|
|
3756
3867
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3757
3868
|
};
|
|
3758
|
-
}, fe = (r) => {
|
|
3759
|
-
if (typeof r == "function")
|
|
3760
|
-
return r;
|
|
3761
|
-
switch (r.type) {
|
|
3762
|
-
case "straight":
|
|
3763
|
-
return () => new Vt({
|
|
3764
|
-
color: r.color,
|
|
3765
|
-
width: r.width,
|
|
3766
|
-
arrowLength: r.arrowLength,
|
|
3767
|
-
arrowOffset: r.arrowOffset,
|
|
3768
|
-
arrowRenderer: r.arrowRenderer,
|
|
3769
|
-
hasSourceArrow: r.hasSourceArrow,
|
|
3770
|
-
hasTargetArrow: r.hasTargetArrow,
|
|
3771
|
-
cycleSquareSide: r.cycleSquareSide,
|
|
3772
|
-
roundness: r.roundness,
|
|
3773
|
-
detourDistance: r.detourDistance,
|
|
3774
|
-
detourDirection: r.detourDirection
|
|
3775
|
-
});
|
|
3776
|
-
case "horizontal":
|
|
3777
|
-
return () => new Lt({
|
|
3778
|
-
color: r.color,
|
|
3779
|
-
width: r.width,
|
|
3780
|
-
arrowLength: r.arrowLength,
|
|
3781
|
-
arrowOffset: r.arrowOffset,
|
|
3782
|
-
arrowRenderer: r.arrowRenderer,
|
|
3783
|
-
hasSourceArrow: r.hasSourceArrow,
|
|
3784
|
-
hasTargetArrow: r.hasTargetArrow,
|
|
3785
|
-
cycleSquareSide: r.cycleSquareSide,
|
|
3786
|
-
roundness: r.roundness,
|
|
3787
|
-
detourDistance: r.detourDistance
|
|
3788
|
-
});
|
|
3789
|
-
case "vertical":
|
|
3790
|
-
return () => new It({
|
|
3791
|
-
color: r.color,
|
|
3792
|
-
width: r.width,
|
|
3793
|
-
arrowLength: r.arrowLength,
|
|
3794
|
-
arrowOffset: r.arrowOffset,
|
|
3795
|
-
arrowRenderer: r.arrowRenderer,
|
|
3796
|
-
hasSourceArrow: r.hasSourceArrow,
|
|
3797
|
-
hasTargetArrow: r.hasTargetArrow,
|
|
3798
|
-
cycleSquareSide: r.cycleSquareSide,
|
|
3799
|
-
roundness: r.roundness,
|
|
3800
|
-
detourDistance: r.detourDistance
|
|
3801
|
-
});
|
|
3802
|
-
case "direct":
|
|
3803
|
-
return () => new $e({
|
|
3804
|
-
color: r.color,
|
|
3805
|
-
width: r.width,
|
|
3806
|
-
arrowLength: r.arrowLength,
|
|
3807
|
-
arrowRenderer: r.arrowRenderer,
|
|
3808
|
-
hasSourceArrow: r.hasSourceArrow,
|
|
3809
|
-
hasTargetArrow: r.hasTargetArrow,
|
|
3810
|
-
sourceOffset: r.sourceOffset,
|
|
3811
|
-
targetOffset: r.targetOffset
|
|
3812
|
-
});
|
|
3813
|
-
default:
|
|
3814
|
-
return () => new Rt({
|
|
3815
|
-
color: r.color,
|
|
3816
|
-
width: r.width,
|
|
3817
|
-
arrowLength: r.arrowLength,
|
|
3818
|
-
arrowRenderer: r.arrowRenderer,
|
|
3819
|
-
hasSourceArrow: r.hasSourceArrow,
|
|
3820
|
-
hasTargetArrow: r.hasTargetArrow,
|
|
3821
|
-
cycleRadius: r.cycleRadius,
|
|
3822
|
-
smallCycleRadius: r.smallCycleRadius,
|
|
3823
|
-
curvature: r.curvature,
|
|
3824
|
-
detourDistance: r.detourDistance,
|
|
3825
|
-
detourDirection: r.detourDirection
|
|
3826
|
-
});
|
|
3827
|
-
}
|
|
3828
3869
|
}, $ = Object.freeze({
|
|
3829
3870
|
connectionTypeResolver: () => "direct",
|
|
3830
3871
|
connectionPreprocessor: (r) => r,
|
|
3831
3872
|
connectionAllowedVerifier: () => !0,
|
|
3832
3873
|
mouseEventVerifier: (r) => r.button === 0
|
|
3833
|
-
}),
|
|
3834
|
-
var
|
|
3874
|
+
}), lr = (r, e, t) => {
|
|
3875
|
+
var s, n, a;
|
|
3876
|
+
const o = r.connectionAllowedVerifier ?? $.connectionAllowedVerifier;
|
|
3835
3877
|
return {
|
|
3836
3878
|
connectionTypeResolver: r.connectionTypeResolver ?? $.connectionTypeResolver,
|
|
3879
|
+
connectionAllowedVerifier: o,
|
|
3880
|
+
draggingPortDirectionResolver: Qe(
|
|
3881
|
+
r.dragPortDirection,
|
|
3882
|
+
t,
|
|
3883
|
+
o
|
|
3884
|
+
),
|
|
3885
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? ve(r.edgeShape) : e,
|
|
3837
3886
|
connectionPreprocessor: r.connectionPreprocessor ?? $.connectionPreprocessor,
|
|
3838
|
-
connectionAllowedVerifier: r.connectionAllowedVerifier ?? $.connectionAllowedVerifier,
|
|
3839
3887
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? $.mouseEventVerifier,
|
|
3840
3888
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? $.mouseEventVerifier,
|
|
3841
|
-
onAfterEdgeCreated: ((
|
|
3842
|
-
onEdgeCreationInterrupted: ((
|
|
3843
|
-
onEdgeCreationPrevented: ((
|
|
3844
|
-
dragPortDirection: r.dragPortDirection ?? t,
|
|
3845
|
-
edgeShapeFactory: r.edgeShape !== void 0 ? fe(r.edgeShape) : e
|
|
3889
|
+
onAfterEdgeCreated: ((s = r.events) == null ? void 0 : s.onAfterEdgeCreated) ?? P,
|
|
3890
|
+
onEdgeCreationInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeCreationInterrupted) ?? P,
|
|
3891
|
+
onEdgeCreationPrevented: ((a = r.events) == null ? void 0 : a.onEdgeCreationPrevented) ?? P
|
|
3846
3892
|
};
|
|
3847
3893
|
}, z = Object.freeze({
|
|
3848
3894
|
connectionAllowedVerifier: () => !0,
|
|
3849
3895
|
connectionPreprocessor: (r) => r,
|
|
3896
|
+
// TODO: remove ctrl key
|
|
3850
3897
|
mouseDownEventVerifier: (r) => r.button === 0 && r.ctrlKey,
|
|
3851
3898
|
mouseUpEventVerifier: (r) => r.button === 0
|
|
3852
|
-
}),
|
|
3853
|
-
var
|
|
3854
|
-
const t = (
|
|
3855
|
-
const
|
|
3856
|
-
return
|
|
3857
|
-
};
|
|
3899
|
+
}), ur = (r, e) => {
|
|
3900
|
+
var s, n, a;
|
|
3901
|
+
const t = (h) => {
|
|
3902
|
+
const d = e.getPortAdjacentEdgeIds(h);
|
|
3903
|
+
return d.length > 0 ? d[d.length - 1] : null;
|
|
3904
|
+
}, o = r.connectionAllowedVerifier ?? z.connectionAllowedVerifier;
|
|
3858
3905
|
return {
|
|
3859
3906
|
connectionPreprocessor: r.connectionPreprocessor ?? z.connectionPreprocessor,
|
|
3860
|
-
connectionAllowedVerifier:
|
|
3907
|
+
connectionAllowedVerifier: o,
|
|
3861
3908
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? z.mouseDownEventVerifier,
|
|
3862
3909
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? z.mouseUpEventVerifier,
|
|
3863
3910
|
draggingEdgeResolver: r.draggingEdgeResolver ?? t,
|
|
3864
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
3865
|
-
onAfterEdgeReattached: ((
|
|
3866
|
-
onEdgeReattachInterrupted: ((
|
|
3867
|
-
onEdgeReattachPrevented: ((
|
|
3911
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ve(r.draggingEdgeShape) : null,
|
|
3912
|
+
onAfterEdgeReattached: ((s = r.events) == null ? void 0 : s.onAfterEdgeReattached) ?? P,
|
|
3913
|
+
onEdgeReattachInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeReattachInterrupted) ?? P,
|
|
3914
|
+
onEdgeReattachPrevented: ((a = r.events) == null ? void 0 : a.onEdgeReattachPrevented) ?? P,
|
|
3915
|
+
draggingPortDirectionResolver: Qe(
|
|
3916
|
+
r.dragPortDirection,
|
|
3917
|
+
e,
|
|
3918
|
+
o
|
|
3919
|
+
)
|
|
3868
3920
|
};
|
|
3869
|
-
},
|
|
3921
|
+
}, gr = (r) => ({
|
|
3870
3922
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3871
3923
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3872
|
-
}),
|
|
3924
|
+
}), pr = (r) => {
|
|
3873
3925
|
var e, t;
|
|
3874
3926
|
return {
|
|
3875
|
-
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ??
|
|
3876
|
-
onBeforeNodeAttached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeNodeAttached) ??
|
|
3927
|
+
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? P,
|
|
3928
|
+
onBeforeNodeAttached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeNodeAttached) ?? P
|
|
3877
3929
|
};
|
|
3878
3930
|
};
|
|
3879
|
-
class
|
|
3931
|
+
class wr extends Error {
|
|
3880
3932
|
constructor() {
|
|
3881
3933
|
super(...arguments);
|
|
3882
3934
|
i(this, "name", "CanvasBuilderError");
|
|
3883
3935
|
}
|
|
3884
3936
|
}
|
|
3885
|
-
class
|
|
3937
|
+
class Ze {
|
|
3886
3938
|
constructor(e, t, o) {
|
|
3887
3939
|
i(this, "dt");
|
|
3888
3940
|
i(this, "nodeMass");
|
|
@@ -3915,12 +3967,12 @@ class Ge {
|
|
|
3915
3967
|
const o = this.graph.getEdge(t), s = this.graph.getPort(o.from), n = this.graph.getPort(o.to), a = this.currentCoords.get(s.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
|
|
3916
3968
|
a,
|
|
3917
3969
|
h
|
|
3918
|
-
),
|
|
3919
|
-
p.x +=
|
|
3970
|
+
), l = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, u = d.ex * l, g = d.ey * l, p = e.get(s.nodeId), w = e.get(n.nodeId);
|
|
3971
|
+
p.x += u, p.y += g, w.x -= u, w.y -= g;
|
|
3920
3972
|
});
|
|
3921
3973
|
}
|
|
3922
3974
|
}
|
|
3923
|
-
class
|
|
3975
|
+
class _e {
|
|
3924
3976
|
constructor(e) {
|
|
3925
3977
|
i(this, "PI2", 2 * Math.PI);
|
|
3926
3978
|
this.rand = e;
|
|
@@ -3939,13 +3991,13 @@ class je {
|
|
|
3939
3991
|
return { ex: h, ey: d, d: a };
|
|
3940
3992
|
}
|
|
3941
3993
|
}
|
|
3942
|
-
const
|
|
3994
|
+
const qe = (r) => {
|
|
3943
3995
|
if (r.distance === 0)
|
|
3944
3996
|
return r.maxForce;
|
|
3945
3997
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
3946
3998
|
return Math.min(e, r.maxForce);
|
|
3947
3999
|
};
|
|
3948
|
-
class
|
|
4000
|
+
class fr {
|
|
3949
4001
|
constructor(e) {
|
|
3950
4002
|
i(this, "nodeCharge");
|
|
3951
4003
|
i(this, "distanceVectorGenerator");
|
|
@@ -3957,22 +4009,22 @@ class dr {
|
|
|
3957
4009
|
for (let n = 0; n < s; n++) {
|
|
3958
4010
|
const a = o[n];
|
|
3959
4011
|
for (let h = n + 1; h < s; h++) {
|
|
3960
|
-
const d = o[h], c = e.get(a),
|
|
4012
|
+
const d = o[h], c = e.get(a), l = e.get(d), u = this.distanceVectorGenerator.create(
|
|
3961
4013
|
c,
|
|
3962
|
-
|
|
3963
|
-
),
|
|
4014
|
+
l
|
|
4015
|
+
), g = qe({
|
|
3964
4016
|
coefficient: 1,
|
|
3965
4017
|
sourceCharge: this.nodeCharge,
|
|
3966
4018
|
targetCharge: this.nodeCharge,
|
|
3967
|
-
distance:
|
|
4019
|
+
distance: u.d,
|
|
3968
4020
|
maxForce: this.maxForce
|
|
3969
|
-
}), p =
|
|
3970
|
-
|
|
4021
|
+
}), p = g * u.ex, w = g * u.ey, f = t.get(a), y = t.get(d);
|
|
4022
|
+
f.x -= p, f.y -= w, y.x += p, y.y += w;
|
|
3971
4023
|
}
|
|
3972
4024
|
}
|
|
3973
4025
|
}
|
|
3974
4026
|
}
|
|
3975
|
-
const
|
|
4027
|
+
const yr = (r) => {
|
|
3976
4028
|
if (r.size === 0)
|
|
3977
4029
|
return {
|
|
3978
4030
|
centerX: 0,
|
|
@@ -3990,7 +4042,7 @@ const cr = (r) => {
|
|
|
3990
4042
|
radius: h / 2
|
|
3991
4043
|
};
|
|
3992
4044
|
};
|
|
3993
|
-
class
|
|
4045
|
+
class vr {
|
|
3994
4046
|
constructor(e) {
|
|
3995
4047
|
i(this, "root");
|
|
3996
4048
|
i(this, "leaves", /* @__PURE__ */ new Map());
|
|
@@ -4044,19 +4096,19 @@ class lr {
|
|
|
4044
4096
|
return this.setLeaf(e), [];
|
|
4045
4097
|
this.sortedParentNodes.push(e);
|
|
4046
4098
|
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = s / 2;
|
|
4047
|
-
e.nodeIds.forEach((
|
|
4048
|
-
const { x: p, y: w } = this.coords.get(
|
|
4049
|
-
p < t ? w < o ? d.add(
|
|
4099
|
+
e.nodeIds.forEach((g) => {
|
|
4100
|
+
const { x: p, y: w } = this.coords.get(g);
|
|
4101
|
+
p < t ? w < o ? d.add(g) : h.add(g) : w < o ? a.add(g) : n.add(g), e.nodeIds.delete(g);
|
|
4050
4102
|
});
|
|
4051
|
-
const
|
|
4103
|
+
const l = {
|
|
4052
4104
|
parent: e,
|
|
4053
4105
|
lb: null,
|
|
4054
4106
|
lt: null,
|
|
4055
4107
|
rb: null,
|
|
4056
4108
|
rt: null
|
|
4057
|
-
},
|
|
4109
|
+
}, u = [];
|
|
4058
4110
|
if (n.size > 0) {
|
|
4059
|
-
const
|
|
4111
|
+
const g = {
|
|
4060
4112
|
nodeIds: n,
|
|
4061
4113
|
totalMass: 0,
|
|
4062
4114
|
totalCharge: 0,
|
|
@@ -4069,12 +4121,12 @@ class lr {
|
|
|
4069
4121
|
centerY: o + c,
|
|
4070
4122
|
radius: c
|
|
4071
4123
|
},
|
|
4072
|
-
...
|
|
4124
|
+
...l
|
|
4073
4125
|
};
|
|
4074
|
-
e.rt =
|
|
4126
|
+
e.rt = g, u.push(g);
|
|
4075
4127
|
}
|
|
4076
4128
|
if (a.size > 0) {
|
|
4077
|
-
const
|
|
4129
|
+
const g = {
|
|
4078
4130
|
nodeIds: a,
|
|
4079
4131
|
totalMass: 0,
|
|
4080
4132
|
totalCharge: 0,
|
|
@@ -4087,12 +4139,12 @@ class lr {
|
|
|
4087
4139
|
centerY: o - c,
|
|
4088
4140
|
radius: c
|
|
4089
4141
|
},
|
|
4090
|
-
...
|
|
4142
|
+
...l
|
|
4091
4143
|
};
|
|
4092
|
-
e.rb =
|
|
4144
|
+
e.rb = g, u.push(g);
|
|
4093
4145
|
}
|
|
4094
4146
|
if (h.size > 0) {
|
|
4095
|
-
const
|
|
4147
|
+
const g = {
|
|
4096
4148
|
nodeIds: h,
|
|
4097
4149
|
totalMass: 0,
|
|
4098
4150
|
totalCharge: 0,
|
|
@@ -4105,12 +4157,12 @@ class lr {
|
|
|
4105
4157
|
centerY: o + c,
|
|
4106
4158
|
radius: c
|
|
4107
4159
|
},
|
|
4108
|
-
...
|
|
4160
|
+
...l
|
|
4109
4161
|
};
|
|
4110
|
-
e.lt =
|
|
4162
|
+
e.lt = g, u.push(g);
|
|
4111
4163
|
}
|
|
4112
4164
|
if (d.size > 0) {
|
|
4113
|
-
const
|
|
4165
|
+
const g = {
|
|
4114
4166
|
nodeIds: d,
|
|
4115
4167
|
totalMass: 0,
|
|
4116
4168
|
totalCharge: 0,
|
|
@@ -4123,11 +4175,11 @@ class lr {
|
|
|
4123
4175
|
centerY: o - c,
|
|
4124
4176
|
radius: c
|
|
4125
4177
|
},
|
|
4126
|
-
...
|
|
4178
|
+
...l
|
|
4127
4179
|
};
|
|
4128
|
-
e.lb =
|
|
4180
|
+
e.lb = g, u.push(g);
|
|
4129
4181
|
}
|
|
4130
|
-
return
|
|
4182
|
+
return u;
|
|
4131
4183
|
}
|
|
4132
4184
|
setLeaf(e) {
|
|
4133
4185
|
e.totalMass = this.nodeMass * e.nodeIds.size, e.totalCharge = this.nodeCharge * e.nodeIds.size, e.chargeCenter = this.calculateLeafChargeCenter(e.nodeIds), e.nodeIds.forEach((t) => {
|
|
@@ -4147,7 +4199,7 @@ class lr {
|
|
|
4147
4199
|
}), { x: t / e.size, y: o / e.size };
|
|
4148
4200
|
}
|
|
4149
4201
|
}
|
|
4150
|
-
class
|
|
4202
|
+
class mr {
|
|
4151
4203
|
constructor(e) {
|
|
4152
4204
|
i(this, "areaRadiusThreshold");
|
|
4153
4205
|
i(this, "nodeMass");
|
|
@@ -4159,7 +4211,7 @@ class ur {
|
|
|
4159
4211
|
this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
|
|
4160
4212
|
}
|
|
4161
4213
|
apply(e, t) {
|
|
4162
|
-
const o =
|
|
4214
|
+
const o = yr(e), s = new vr({
|
|
4163
4215
|
box: o,
|
|
4164
4216
|
coords: e,
|
|
4165
4217
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
@@ -4274,7 +4326,7 @@ class ur {
|
|
|
4274
4326
|
const t = this.distanceVectorGenerator.create(
|
|
4275
4327
|
e.sourceCoords,
|
|
4276
4328
|
e.targetCoords
|
|
4277
|
-
), o =
|
|
4329
|
+
), o = qe({
|
|
4278
4330
|
coefficient: this.nodeForceCoefficient,
|
|
4279
4331
|
sourceCharge: e.sourceCharge,
|
|
4280
4332
|
targetCharge: e.targetCharge,
|
|
@@ -4309,7 +4361,7 @@ class ur {
|
|
|
4309
4361
|
}
|
|
4310
4362
|
}
|
|
4311
4363
|
}
|
|
4312
|
-
const
|
|
4364
|
+
const et = (r) => r.theta !== 0 ? new mr({
|
|
4313
4365
|
nodeCharge: r.nodeCharge,
|
|
4314
4366
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
4315
4367
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -4317,13 +4369,13 @@ const Ke = (r) => r.theta !== 0 ? new ur({
|
|
|
4317
4369
|
theta: r.theta,
|
|
4318
4370
|
nodeMass: r.nodeMass,
|
|
4319
4371
|
areaRadiusThreshold: r.areaRadiusThreshold
|
|
4320
|
-
}) : new
|
|
4372
|
+
}) : new fr({
|
|
4321
4373
|
nodeCharge: r.nodeCharge,
|
|
4322
4374
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
4323
4375
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
4324
4376
|
maxForce: r.maxForce
|
|
4325
4377
|
});
|
|
4326
|
-
class
|
|
4378
|
+
class tt {
|
|
4327
4379
|
constructor(e) {
|
|
4328
4380
|
i(this, "rand");
|
|
4329
4381
|
i(this, "sparsity");
|
|
@@ -4331,22 +4383,22 @@ class Qe {
|
|
|
4331
4383
|
}
|
|
4332
4384
|
calculateCoordinates(e) {
|
|
4333
4385
|
const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((w) => {
|
|
4334
|
-
const
|
|
4335
|
-
return
|
|
4336
|
-
}), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 },
|
|
4337
|
-
x:
|
|
4338
|
-
y:
|
|
4386
|
+
const f = t.getNode(w);
|
|
4387
|
+
return f.x === null || f.y === null;
|
|
4388
|
+
}), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 }, l = o.createContentCoords(c), u = a / 2, g = {
|
|
4389
|
+
x: l.x - u,
|
|
4390
|
+
y: l.y - u
|
|
4339
4391
|
};
|
|
4340
4392
|
return t.getAllNodeIds().forEach((w) => {
|
|
4341
|
-
const
|
|
4393
|
+
const f = t.getNode(w);
|
|
4342
4394
|
s.set(w, {
|
|
4343
|
-
x:
|
|
4344
|
-
y:
|
|
4395
|
+
x: f.x ?? g.x + a * this.rand(),
|
|
4396
|
+
y: f.y ?? g.y + a * this.rand()
|
|
4345
4397
|
});
|
|
4346
4398
|
}), s;
|
|
4347
4399
|
}
|
|
4348
4400
|
}
|
|
4349
|
-
class
|
|
4401
|
+
class Er {
|
|
4350
4402
|
constructor(e) {
|
|
4351
4403
|
i(this, "distanceVectorGenerator");
|
|
4352
4404
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4357,7 +4409,7 @@ class gr {
|
|
|
4357
4409
|
i(this, "edgeEquilibriumLength");
|
|
4358
4410
|
i(this, "edgeStiffness");
|
|
4359
4411
|
i(this, "convergenceVelocity");
|
|
4360
|
-
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new
|
|
4412
|
+
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new _e(e.rand), this.nodeForcesApplicationStrategy = et({
|
|
4361
4413
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4362
4414
|
nodeCharge: e.nodeCharge,
|
|
4363
4415
|
maxForce: e.maxForce,
|
|
@@ -4365,7 +4417,7 @@ class gr {
|
|
|
4365
4417
|
theta: e.barnesHutTheta,
|
|
4366
4418
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4367
4419
|
nodeMass: e.nodeMass
|
|
4368
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4420
|
+
}), this.fillerLayoutAlgorithm = new tt({
|
|
4369
4421
|
rand: e.rand,
|
|
4370
4422
|
sparsity: e.edgeEquilibriumLength
|
|
4371
4423
|
});
|
|
@@ -4375,7 +4427,7 @@ class gr {
|
|
|
4375
4427
|
graph: t,
|
|
4376
4428
|
viewport: o
|
|
4377
4429
|
});
|
|
4378
|
-
for (let n = 0; n < this.maxIterations && !(new
|
|
4430
|
+
for (let n = 0; n < this.maxIterations && !(new Ze(
|
|
4379
4431
|
t,
|
|
4380
4432
|
s,
|
|
4381
4433
|
{
|
|
@@ -4391,7 +4443,7 @@ class gr {
|
|
|
4391
4443
|
return s;
|
|
4392
4444
|
}
|
|
4393
4445
|
}
|
|
4394
|
-
class
|
|
4446
|
+
class xr {
|
|
4395
4447
|
constructor(e, t) {
|
|
4396
4448
|
i(this, "forest", /* @__PURE__ */ new Set());
|
|
4397
4449
|
i(this, "remainingNodeIds");
|
|
@@ -4432,7 +4484,7 @@ class pr {
|
|
|
4432
4484
|
}
|
|
4433
4485
|
}
|
|
4434
4486
|
}
|
|
4435
|
-
class
|
|
4487
|
+
class Ar {
|
|
4436
4488
|
constructor(e) {
|
|
4437
4489
|
this.params = e;
|
|
4438
4490
|
}
|
|
@@ -4440,17 +4492,17 @@ class wr {
|
|
|
4440
4492
|
let t = 0;
|
|
4441
4493
|
const o = [], s = e.length - 1, n = [];
|
|
4442
4494
|
e.forEach((h, d) => {
|
|
4443
|
-
if (t += this.params.spaceAroundRadius, h.forEach((c,
|
|
4444
|
-
n[
|
|
4495
|
+
if (t += this.params.spaceAroundRadius, h.forEach((c, l) => {
|
|
4496
|
+
n[l] === void 0 ? n[l] = {
|
|
4445
4497
|
start: t + c.start,
|
|
4446
4498
|
end: t + c.end
|
|
4447
|
-
} : n[
|
|
4499
|
+
} : n[l].end = t + c.end;
|
|
4448
4500
|
}), o.push(t), d !== s) {
|
|
4449
|
-
const c = e[d + 1],
|
|
4450
|
-
start:
|
|
4451
|
-
end:
|
|
4501
|
+
const c = e[d + 1], l = n.map((u) => ({
|
|
4502
|
+
start: u.start - t,
|
|
4503
|
+
end: u.end - t
|
|
4452
4504
|
}));
|
|
4453
|
-
t += this.calculateMaxDiff(
|
|
4505
|
+
t += this.calculateMaxDiff(l, c);
|
|
4454
4506
|
}
|
|
4455
4507
|
t += this.params.spaceAroundRadius;
|
|
4456
4508
|
});
|
|
@@ -4473,12 +4525,12 @@ class wr {
|
|
|
4473
4525
|
return o - 2 * this.params.spaceAroundRadius;
|
|
4474
4526
|
}
|
|
4475
4527
|
}
|
|
4476
|
-
class
|
|
4528
|
+
class Sr {
|
|
4477
4529
|
constructor(e, t) {
|
|
4478
4530
|
i(this, "offsets", /* @__PURE__ */ new Map());
|
|
4479
4531
|
i(this, "treeSpans", /* @__PURE__ */ new Map());
|
|
4480
4532
|
this.tree = e;
|
|
4481
|
-
const o = t.spaceAroundRadius, s = new
|
|
4533
|
+
const o = t.spaceAroundRadius, s = new Ar({
|
|
4482
4534
|
spaceAroundRadius: o
|
|
4483
4535
|
});
|
|
4484
4536
|
[...this.tree.sequence].reverse().forEach((n) => {
|
|
@@ -4500,40 +4552,40 @@ class yr {
|
|
|
4500
4552
|
return this.offsets;
|
|
4501
4553
|
}
|
|
4502
4554
|
}
|
|
4503
|
-
class
|
|
4555
|
+
class br {
|
|
4504
4556
|
constructor(e) {
|
|
4505
4557
|
this.params = e;
|
|
4506
4558
|
}
|
|
4507
4559
|
calculateCoordinates(e) {
|
|
4508
|
-
const t = /* @__PURE__ */ new Map(), s = new
|
|
4560
|
+
const t = /* @__PURE__ */ new Map(), s = new xr(
|
|
4509
4561
|
e.graph,
|
|
4510
4562
|
this.params.nextLayerNodesResolver
|
|
4511
4563
|
).generate();
|
|
4512
4564
|
let n = 0;
|
|
4513
4565
|
return s.forEach((a) => {
|
|
4514
4566
|
t.set(a.root.nodeId, { x: n, y: 0 });
|
|
4515
|
-
const d = new
|
|
4567
|
+
const d = new Sr(a, {
|
|
4516
4568
|
spaceAroundRadius: this.params.layerSpace / 2
|
|
4517
4569
|
}).generate();
|
|
4518
4570
|
let c = [a.root];
|
|
4519
4571
|
for (; c.length > 0; ) {
|
|
4520
|
-
const
|
|
4521
|
-
n += this.params.layerWidth, c.forEach((
|
|
4522
|
-
|
|
4523
|
-
const p = t.get(
|
|
4524
|
-
t.set(
|
|
4525
|
-
y: p + d.get(
|
|
4572
|
+
const l = [];
|
|
4573
|
+
n += this.params.layerWidth, c.forEach((u) => {
|
|
4574
|
+
u.children.forEach((g) => {
|
|
4575
|
+
const p = t.get(u.nodeId).y;
|
|
4576
|
+
t.set(g.nodeId, {
|
|
4577
|
+
y: p + d.get(g.nodeId),
|
|
4526
4578
|
x: n
|
|
4527
|
-
}),
|
|
4579
|
+
}), l.push(g);
|
|
4528
4580
|
});
|
|
4529
|
-
}), c =
|
|
4581
|
+
}), c = l;
|
|
4530
4582
|
}
|
|
4531
4583
|
}), t.forEach((a, h) => {
|
|
4532
4584
|
t.set(h, this.params.transform(a));
|
|
4533
4585
|
}), t;
|
|
4534
4586
|
}
|
|
4535
4587
|
}
|
|
4536
|
-
const
|
|
4588
|
+
const Pr = (r) => {
|
|
4537
4589
|
const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((n) => {
|
|
4538
4590
|
const a = e.getEdge(n);
|
|
4539
4591
|
return e.getPort(a.to).nodeId;
|
|
@@ -4542,20 +4594,20 @@ const vr = (r) => {
|
|
|
4542
4594
|
return e.getPort(a.from).nodeId;
|
|
4543
4595
|
});
|
|
4544
4596
|
return /* @__PURE__ */ new Set([...o, ...s]);
|
|
4545
|
-
},
|
|
4597
|
+
}, Nr = (r) => {
|
|
4546
4598
|
const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((s) => {
|
|
4547
4599
|
const n = e.getEdge(s);
|
|
4548
4600
|
return e.getPort(n.to).nodeId;
|
|
4549
4601
|
});
|
|
4550
4602
|
return new Set(o);
|
|
4551
|
-
},
|
|
4603
|
+
}, Cr = (r) => {
|
|
4552
4604
|
const { graph: e, currentNodeId: t } = r, o = e.getNodeIncomingEdgeIds(t).map((s) => {
|
|
4553
4605
|
const n = e.getEdge(s);
|
|
4554
4606
|
return e.getPort(n.from).nodeId;
|
|
4555
4607
|
});
|
|
4556
4608
|
return new Set(o);
|
|
4557
4609
|
};
|
|
4558
|
-
class
|
|
4610
|
+
class Tr {
|
|
4559
4611
|
constructor(e) {
|
|
4560
4612
|
i(this, "distanceVectorGenerator");
|
|
4561
4613
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4565,7 +4617,7 @@ class Er {
|
|
|
4565
4617
|
i(this, "edgeEquilibriumLength");
|
|
4566
4618
|
i(this, "edgeStiffness");
|
|
4567
4619
|
i(this, "fillerLayoutAlgorithm");
|
|
4568
|
-
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new
|
|
4620
|
+
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new _e(e.rand), this.nodeForcesApplicationStrategy = et({
|
|
4569
4621
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4570
4622
|
nodeCharge: e.nodeCharge,
|
|
4571
4623
|
maxForce: e.maxForce,
|
|
@@ -4573,7 +4625,7 @@ class Er {
|
|
|
4573
4625
|
theta: e.barnesHutTheta,
|
|
4574
4626
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4575
4627
|
nodeMass: e.nodeMass
|
|
4576
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4628
|
+
}), this.fillerLayoutAlgorithm = new tt({
|
|
4577
4629
|
rand: e.rand,
|
|
4578
4630
|
sparsity: e.edgeEquilibriumLength
|
|
4579
4631
|
});
|
|
@@ -4583,7 +4635,7 @@ class Er {
|
|
|
4583
4635
|
graph: t,
|
|
4584
4636
|
viewport: o
|
|
4585
4637
|
});
|
|
4586
|
-
return new
|
|
4638
|
+
return new Ze(
|
|
4587
4639
|
t,
|
|
4588
4640
|
n,
|
|
4589
4641
|
{
|
|
@@ -4595,28 +4647,28 @@ class Er {
|
|
|
4595
4647
|
edgeStiffness: this.edgeStiffness
|
|
4596
4648
|
}
|
|
4597
4649
|
).apply() < this.convergenceVelocity && !t.getAllNodeIds().some((c) => {
|
|
4598
|
-
const
|
|
4599
|
-
return
|
|
4650
|
+
const l = t.getNode(c);
|
|
4651
|
+
return l.x === null || l.y === null;
|
|
4600
4652
|
}) ? /* @__PURE__ */ new Map() : n;
|
|
4601
4653
|
}
|
|
4602
4654
|
}
|
|
4603
|
-
const
|
|
4655
|
+
const rt = (r) => {
|
|
4604
4656
|
let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
|
|
4605
4657
|
for (let n = 0, a; n < r.length; n++)
|
|
4606
4658
|
a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = o ^ Math.imul(t ^ a, 2869860233), o = s ^ Math.imul(o ^ a, 951274213), s = e ^ Math.imul(s ^ a, 2716044179);
|
|
4607
4659
|
return e = Math.imul(o ^ e >>> 18, 597399067), t = Math.imul(s ^ t >>> 22, 2869860233), o = Math.imul(e ^ o >>> 17, 951274213), s = Math.imul(t ^ s >>> 19, 2716044179), e ^= t ^ o ^ s, t ^= e, o ^= e, s ^= e, [e >>> 0, t >>> 0, o >>> 0, s >>> 0];
|
|
4608
|
-
},
|
|
4660
|
+
}, ot = (r, e, t, o) => function() {
|
|
4609
4661
|
r |= 0, e |= 0, t |= 0, o |= 0;
|
|
4610
4662
|
const s = (r + e | 0) + o | 0;
|
|
4611
4663
|
return o = o + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + s | 0, (s >>> 0) / 4294967296;
|
|
4612
|
-
},
|
|
4664
|
+
}, Mr = (r) => {
|
|
4613
4665
|
var e, t;
|
|
4614
4666
|
switch (r == null ? void 0 : r.type) {
|
|
4615
4667
|
case "custom":
|
|
4616
4668
|
return r.instance;
|
|
4617
4669
|
default: {
|
|
4618
|
-
const o =
|
|
4619
|
-
return new
|
|
4670
|
+
const o = rt((r == null ? void 0 : r.seed) ?? b.seed), s = ot(o[0], o[1], o[2], o[3]);
|
|
4671
|
+
return new Tr({
|
|
4620
4672
|
rand: s,
|
|
4621
4673
|
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? b.maxTimeDeltaSec,
|
|
4622
4674
|
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? b.nodeCharge,
|
|
@@ -4631,25 +4683,25 @@ const Ze = (r) => {
|
|
|
4631
4683
|
});
|
|
4632
4684
|
}
|
|
4633
4685
|
}
|
|
4634
|
-
},
|
|
4686
|
+
}, Dr = {
|
|
4635
4687
|
staticNodeResolver: () => !1
|
|
4636
|
-
},
|
|
4688
|
+
}, Rr = (r) => {
|
|
4637
4689
|
var t, o;
|
|
4638
4690
|
return {
|
|
4639
|
-
algorithm:
|
|
4640
|
-
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ??
|
|
4641
|
-
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ??
|
|
4642
|
-
onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ??
|
|
4691
|
+
algorithm: Mr((r == null ? void 0 : r.algorithm) ?? {}),
|
|
4692
|
+
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Dr.staticNodeResolver,
|
|
4693
|
+
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? P,
|
|
4694
|
+
onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? P
|
|
4643
4695
|
};
|
|
4644
|
-
},
|
|
4696
|
+
}, Lr = (r) => r instanceof q ? {
|
|
4645
4697
|
type: "trigger",
|
|
4646
4698
|
trigger: r
|
|
4647
4699
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
4648
4700
|
type: "topologyChangeSchedule",
|
|
4649
|
-
schedule:
|
|
4701
|
+
schedule: Ht
|
|
4650
4702
|
} : {
|
|
4651
4703
|
type: "topologyChangeSchedule",
|
|
4652
|
-
schedule:
|
|
4704
|
+
schedule: Yt
|
|
4653
4705
|
}, Z = Object.freeze({
|
|
4654
4706
|
staticNodeResolver: () => !1,
|
|
4655
4707
|
hierarchicalLayout: {
|
|
@@ -4663,7 +4715,7 @@ const Ze = (r) => {
|
|
|
4663
4715
|
d: r.d * e.a + r.e * e.d,
|
|
4664
4716
|
e: r.d * e.b + r.e * e.e,
|
|
4665
4717
|
f: r.d * e.c + r.e * e.f + r.f
|
|
4666
|
-
}),
|
|
4718
|
+
}), Vr = (r) => {
|
|
4667
4719
|
const { a: e, b: t, c: o, d: s, e: n, f: a } = r, h = e * n - t * s;
|
|
4668
4720
|
return {
|
|
4669
4721
|
a: n / h,
|
|
@@ -4674,7 +4726,7 @@ const Ze = (r) => {
|
|
|
4674
4726
|
f: (o * s - e * a) / h
|
|
4675
4727
|
};
|
|
4676
4728
|
};
|
|
4677
|
-
class
|
|
4729
|
+
class Ir {
|
|
4678
4730
|
resolve(e) {
|
|
4679
4731
|
if ("shift" in e)
|
|
4680
4732
|
return this.createShiftBaseMatrix(e.shift);
|
|
@@ -4718,7 +4770,7 @@ class Tr {
|
|
|
4718
4770
|
const o = k(
|
|
4719
4771
|
t,
|
|
4720
4772
|
e
|
|
4721
|
-
), s =
|
|
4773
|
+
), s = Vr(t);
|
|
4722
4774
|
return k(o, s);
|
|
4723
4775
|
}
|
|
4724
4776
|
createShiftBaseMatrix(e) {
|
|
@@ -4763,7 +4815,7 @@ class Tr {
|
|
|
4763
4815
|
};
|
|
4764
4816
|
}
|
|
4765
4817
|
}
|
|
4766
|
-
const
|
|
4818
|
+
const Fr = (r) => {
|
|
4767
4819
|
if (r === void 0)
|
|
4768
4820
|
return (s) => s;
|
|
4769
4821
|
if (typeof r == "function")
|
|
@@ -4777,7 +4829,7 @@ const Cr = (r) => {
|
|
|
4777
4829
|
e: 1,
|
|
4778
4830
|
f: 0
|
|
4779
4831
|
};
|
|
4780
|
-
const o = new
|
|
4832
|
+
const o = new Ir();
|
|
4781
4833
|
return e.forEach((s) => {
|
|
4782
4834
|
const n = o.resolve(s);
|
|
4783
4835
|
t = k(t, n);
|
|
@@ -4788,34 +4840,34 @@ const Cr = (r) => {
|
|
|
4788
4840
|
y: t.d * n + t.e * a + t.f
|
|
4789
4841
|
};
|
|
4790
4842
|
};
|
|
4791
|
-
},
|
|
4843
|
+
}, Ur = (r) => {
|
|
4792
4844
|
if (typeof r == "function")
|
|
4793
4845
|
return r;
|
|
4794
4846
|
switch (r) {
|
|
4795
4847
|
case "outgoing":
|
|
4796
|
-
return
|
|
4848
|
+
return Nr;
|
|
4797
4849
|
case "incoming":
|
|
4798
|
-
return
|
|
4850
|
+
return Cr;
|
|
4799
4851
|
default:
|
|
4800
|
-
return
|
|
4852
|
+
return Pr;
|
|
4801
4853
|
}
|
|
4802
|
-
},
|
|
4854
|
+
}, $r = (r) => {
|
|
4803
4855
|
var e, t;
|
|
4804
4856
|
switch (r == null ? void 0 : r.type) {
|
|
4805
4857
|
case "custom":
|
|
4806
4858
|
return r.instance;
|
|
4807
4859
|
case "hierarchical":
|
|
4808
|
-
return new
|
|
4860
|
+
return new br({
|
|
4809
4861
|
layerWidth: r.layerWidth ?? Z.hierarchicalLayout.layerWidth,
|
|
4810
4862
|
layerSpace: r.layerSpace ?? Z.hierarchicalLayout.layerSpace,
|
|
4811
|
-
transform:
|
|
4812
|
-
nextLayerNodesResolver:
|
|
4863
|
+
transform: Fr(r.transform),
|
|
4864
|
+
nextLayerNodesResolver: Ur(
|
|
4813
4865
|
r.nextLayerNodesResolver
|
|
4814
4866
|
)
|
|
4815
4867
|
});
|
|
4816
4868
|
default: {
|
|
4817
|
-
const o =
|
|
4818
|
-
return new
|
|
4869
|
+
const o = rt((r == null ? void 0 : r.seed) ?? b.seed), s = ot(o[0], o[1], o[2], o[3]);
|
|
4870
|
+
return new Er({
|
|
4819
4871
|
dtSec: (r == null ? void 0 : r.dtSec) ?? b.dtSec,
|
|
4820
4872
|
maxIterations: (r == null ? void 0 : r.maxIterations) ?? b.maxIterations,
|
|
4821
4873
|
rand: s,
|
|
@@ -4831,16 +4883,16 @@ const Cr = (r) => {
|
|
|
4831
4883
|
});
|
|
4832
4884
|
}
|
|
4833
4885
|
}
|
|
4834
|
-
},
|
|
4886
|
+
}, Br = (r) => {
|
|
4835
4887
|
var e, t;
|
|
4836
4888
|
return {
|
|
4837
|
-
algorithm:
|
|
4838
|
-
applyOn:
|
|
4889
|
+
algorithm: $r(r.algorithm),
|
|
4890
|
+
applyOn: Lr(r.applyOn),
|
|
4839
4891
|
staticNodeResolver: r.staticNodeResolver ?? Z.staticNodeResolver,
|
|
4840
|
-
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ??
|
|
4841
|
-
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ??
|
|
4892
|
+
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? P,
|
|
4893
|
+
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? P
|
|
4842
4894
|
};
|
|
4843
|
-
},
|
|
4895
|
+
}, Or = (r, e) => ({
|
|
4844
4896
|
...r,
|
|
4845
4897
|
onNodeDragStarted: (t) => {
|
|
4846
4898
|
e.add(t), r.onNodeDragStarted(t);
|
|
@@ -4848,7 +4900,7 @@ const Cr = (r) => {
|
|
|
4848
4900
|
onNodeDragFinished: (t) => {
|
|
4849
4901
|
e.delete(t), r.onNodeDragFinished(t);
|
|
4850
4902
|
}
|
|
4851
|
-
}),
|
|
4903
|
+
}), Wr = (r, e) => {
|
|
4852
4904
|
r.graph.onBeforeNodeRemoved.subscribe((t) => {
|
|
4853
4905
|
e.delete(t);
|
|
4854
4906
|
}), r.graph.onBeforeClear.subscribe(() => {
|
|
@@ -4856,41 +4908,41 @@ const Cr = (r) => {
|
|
|
4856
4908
|
}), r.onBeforeDestroy.subscribe(() => {
|
|
4857
4909
|
e.clear();
|
|
4858
4910
|
});
|
|
4859
|
-
},
|
|
4911
|
+
}, zr = (r, e) => ({
|
|
4860
4912
|
...r,
|
|
4861
4913
|
staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
|
|
4862
|
-
}), _ = (r) => () => r,
|
|
4914
|
+
}), _ = (r) => () => r, De = _(0), kr = () => {
|
|
4863
4915
|
let r = 0;
|
|
4864
4916
|
return () => r++;
|
|
4865
|
-
},
|
|
4866
|
-
let t =
|
|
4867
|
-
const s =
|
|
4917
|
+
}, Hr = (r, e) => {
|
|
4918
|
+
let t = De, o = De;
|
|
4919
|
+
const s = kr();
|
|
4868
4920
|
return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t = _(r)), typeof e == "number" && (o = _(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
|
|
4869
4921
|
nodesPriorityFn: t,
|
|
4870
4922
|
edgesPriorityFn: o
|
|
4871
4923
|
};
|
|
4872
|
-
},
|
|
4924
|
+
}, Yr = (r) => {
|
|
4873
4925
|
var t, o, s, n, a;
|
|
4874
|
-
const e =
|
|
4926
|
+
const e = Hr(
|
|
4875
4927
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
4876
4928
|
(o = r.edges) == null ? void 0 : o.priority
|
|
4877
4929
|
);
|
|
4878
4930
|
return {
|
|
4879
4931
|
nodes: {
|
|
4880
|
-
centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ??
|
|
4932
|
+
centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? Ue,
|
|
4881
4933
|
priorityFn: e.nodesPriorityFn
|
|
4882
4934
|
},
|
|
4883
4935
|
ports: {
|
|
4884
4936
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
4885
4937
|
},
|
|
4886
4938
|
edges: {
|
|
4887
|
-
shapeFactory:
|
|
4939
|
+
shapeFactory: ve(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
4888
4940
|
priorityFn: e.edgesPriorityFn
|
|
4889
4941
|
}
|
|
4890
4942
|
};
|
|
4891
|
-
},
|
|
4943
|
+
}, Xr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : oe, Gr = (r) => {
|
|
4892
4944
|
var o, s, n, a;
|
|
4893
|
-
const { canvasDefaults: e } = r, t = r.hasLayout ?
|
|
4945
|
+
const { canvasDefaults: e } = r, t = r.hasLayout ? Xr(r.layoutParams) : oe;
|
|
4894
4946
|
return {
|
|
4895
4947
|
focus: {
|
|
4896
4948
|
contentPadding: ((o = e.focus) == null ? void 0 : o.contentPadding) ?? ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
|
|
@@ -4899,23 +4951,23 @@ const Cr = (r) => {
|
|
|
4899
4951
|
animationDuration: ((a = e.focus) == null ? void 0 : a.animationDuration) ?? 0
|
|
4900
4952
|
}
|
|
4901
4953
|
};
|
|
4902
|
-
},
|
|
4954
|
+
}, jr = (r) => ({
|
|
4903
4955
|
onNodeSelected: r.onNodeSelected,
|
|
4904
4956
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
|
|
4905
4957
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
|
|
4906
4958
|
movementThreshold: r.movementThreshold ?? L.movementThreshold
|
|
4907
|
-
}),
|
|
4959
|
+
}), Jr = (r) => ({
|
|
4908
4960
|
onCanvasSelected: r.onCanvasSelected,
|
|
4909
4961
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
|
|
4910
4962
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
|
|
4911
4963
|
movementThreshold: r.movementThreshold ?? L.movementThreshold
|
|
4912
|
-
}),
|
|
4964
|
+
}), Kr = (r) => ({
|
|
4913
4965
|
onEdgeSelected: r.onEdgeSelected,
|
|
4914
4966
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
|
|
4915
4967
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
|
|
4916
4968
|
movementThreshold: r.movementThreshold ?? L.movementThreshold
|
|
4917
4969
|
});
|
|
4918
|
-
class
|
|
4970
|
+
class _r {
|
|
4919
4971
|
constructor(e) {
|
|
4920
4972
|
i(this, "used", !1);
|
|
4921
4973
|
i(this, "canvasDefaults", {});
|
|
@@ -4942,8 +4994,8 @@ class Xr {
|
|
|
4942
4994
|
i(this, "window", window);
|
|
4943
4995
|
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
4944
4996
|
i(this, "pointInsideVerifier");
|
|
4945
|
-
i(this, "eventTagger", new
|
|
4946
|
-
this.element = e, this.pointInsideVerifier = new
|
|
4997
|
+
i(this, "eventTagger", new Gt());
|
|
4998
|
+
this.element = e, this.pointInsideVerifier = new yt(e, this.window);
|
|
4947
4999
|
}
|
|
4948
5000
|
setDefaults(e) {
|
|
4949
5001
|
return this.canvasDefaults = e, this;
|
|
@@ -4986,45 +5038,45 @@ class Xr {
|
|
|
4986
5038
|
}
|
|
4987
5039
|
build() {
|
|
4988
5040
|
if (this.used)
|
|
4989
|
-
throw new
|
|
5041
|
+
throw new wr(
|
|
4990
5042
|
"Failed to build Canvas because CanvasBuilder is a single-use object"
|
|
4991
5043
|
);
|
|
4992
5044
|
this.used = !0;
|
|
4993
|
-
const e = new
|
|
5045
|
+
const e = new pt(this.element), t = new Ve(), o = new or(this.element), s = this.createHtmlView(
|
|
4994
5046
|
o.main,
|
|
4995
5047
|
t,
|
|
4996
5048
|
e
|
|
4997
|
-
), n =
|
|
5049
|
+
), n = Yr(
|
|
4998
5050
|
this.canvasDefaults
|
|
4999
|
-
), a = new
|
|
5051
|
+
), a = new Ye(
|
|
5000
5052
|
t,
|
|
5001
5053
|
s,
|
|
5002
5054
|
n
|
|
5003
|
-
), h =
|
|
5055
|
+
), h = Br(this.layoutConfig), d = Gr({
|
|
5004
5056
|
canvasDefaults: this.canvasDefaults,
|
|
5005
5057
|
hasLayout: this.hasLayout,
|
|
5006
5058
|
layoutParams: h
|
|
5007
|
-
}), c = new
|
|
5059
|
+
}), c = new Je(
|
|
5008
5060
|
t,
|
|
5009
5061
|
e,
|
|
5010
5062
|
d,
|
|
5011
5063
|
this.window
|
|
5012
|
-
),
|
|
5013
|
-
g,
|
|
5064
|
+
), l = new Xe(e), u = new He(t), g = new Le(
|
|
5014
5065
|
u,
|
|
5066
|
+
l,
|
|
5015
5067
|
a,
|
|
5016
5068
|
c
|
|
5017
5069
|
);
|
|
5018
|
-
if (this.hasBackground &&
|
|
5019
|
-
|
|
5020
|
-
|
|
5070
|
+
if (this.hasBackground && de.configure(
|
|
5071
|
+
g,
|
|
5072
|
+
cr(this.backgroundConfig),
|
|
5021
5073
|
o.background
|
|
5022
|
-
), this.hasNodeResizeReactiveEdges && ee.configure(
|
|
5023
|
-
const p =
|
|
5074
|
+
), this.hasNodeResizeReactiveEdges && ee.configure(g), this.userSelectableEdgesConfig !== void 0) {
|
|
5075
|
+
const p = Kr(
|
|
5024
5076
|
this.userSelectableEdgesConfig
|
|
5025
5077
|
);
|
|
5026
|
-
|
|
5027
|
-
|
|
5078
|
+
fe.configure(
|
|
5079
|
+
g,
|
|
5028
5080
|
this.window,
|
|
5029
5081
|
this.pointInsideVerifier,
|
|
5030
5082
|
this.eventTagger,
|
|
@@ -5032,11 +5084,11 @@ class Xr {
|
|
|
5032
5084
|
);
|
|
5033
5085
|
}
|
|
5034
5086
|
if (this.userSelectableNodesConfig !== void 0) {
|
|
5035
|
-
const p =
|
|
5087
|
+
const p = jr(
|
|
5036
5088
|
this.userSelectableNodesConfig
|
|
5037
5089
|
);
|
|
5038
|
-
|
|
5039
|
-
|
|
5090
|
+
we.configure(
|
|
5091
|
+
g,
|
|
5040
5092
|
this.window,
|
|
5041
5093
|
this.pointInsideVerifier,
|
|
5042
5094
|
this.eventTagger,
|
|
@@ -5044,11 +5096,11 @@ class Xr {
|
|
|
5044
5096
|
);
|
|
5045
5097
|
}
|
|
5046
5098
|
if (this.userSelectableCanvasConfig !== void 0) {
|
|
5047
|
-
const p =
|
|
5099
|
+
const p = Jr(
|
|
5048
5100
|
this.userSelectableCanvasConfig
|
|
5049
5101
|
);
|
|
5050
5102
|
ye.configure(
|
|
5051
|
-
|
|
5103
|
+
g,
|
|
5052
5104
|
o.main,
|
|
5053
5105
|
this.window,
|
|
5054
5106
|
this.pointInsideVerifier,
|
|
@@ -5057,12 +5109,12 @@ class Xr {
|
|
|
5057
5109
|
);
|
|
5058
5110
|
}
|
|
5059
5111
|
if (this.hasDraggableNodes) {
|
|
5060
|
-
let p =
|
|
5061
|
-
this.hasAnimatedLayout && (p =
|
|
5112
|
+
let p = sr(this.dragConfig);
|
|
5113
|
+
this.hasAnimatedLayout && (p = Or(
|
|
5062
5114
|
p,
|
|
5063
5115
|
this.animationStaticNodes
|
|
5064
|
-
)),
|
|
5065
|
-
|
|
5116
|
+
)), ae.configure(
|
|
5117
|
+
g,
|
|
5066
5118
|
o.main,
|
|
5067
5119
|
this.window,
|
|
5068
5120
|
this.pointInsideVerifier,
|
|
@@ -5070,13 +5122,13 @@ class Xr {
|
|
|
5070
5122
|
);
|
|
5071
5123
|
}
|
|
5072
5124
|
if (this.hasUserConnectablePorts) {
|
|
5073
|
-
const p =
|
|
5125
|
+
const p = lr(
|
|
5074
5126
|
this.connectablePortsConfig,
|
|
5075
5127
|
n.edges.shapeFactory,
|
|
5076
|
-
|
|
5128
|
+
g.graph
|
|
5077
5129
|
);
|
|
5078
|
-
|
|
5079
|
-
|
|
5130
|
+
ce.configure(
|
|
5131
|
+
g,
|
|
5080
5132
|
o.overlayConnectablePorts,
|
|
5081
5133
|
e,
|
|
5082
5134
|
this.window,
|
|
@@ -5085,12 +5137,12 @@ class Xr {
|
|
|
5085
5137
|
);
|
|
5086
5138
|
}
|
|
5087
5139
|
if (this.hasUserDraggableEdges) {
|
|
5088
|
-
const p =
|
|
5140
|
+
const p = ur(
|
|
5089
5141
|
this.draggableEdgesConfig,
|
|
5090
|
-
|
|
5142
|
+
g.graph
|
|
5091
5143
|
);
|
|
5092
|
-
|
|
5093
|
-
|
|
5144
|
+
le.configure(
|
|
5145
|
+
g,
|
|
5094
5146
|
o.overlayDraggableEdges,
|
|
5095
5147
|
e,
|
|
5096
5148
|
this.window,
|
|
@@ -5098,56 +5150,56 @@ class Xr {
|
|
|
5098
5150
|
p
|
|
5099
5151
|
);
|
|
5100
5152
|
}
|
|
5101
|
-
if (this.virtualScrollConfig !== void 0 ?
|
|
5102
|
-
|
|
5153
|
+
if (this.virtualScrollConfig !== void 0 ? he.configure(
|
|
5154
|
+
g,
|
|
5103
5155
|
o.main,
|
|
5104
5156
|
this.window,
|
|
5105
|
-
|
|
5157
|
+
Me(this.transformConfig),
|
|
5106
5158
|
this.boxRenderingTrigger,
|
|
5107
5159
|
this.pointInsideVerifier,
|
|
5108
|
-
|
|
5160
|
+
gr(this.virtualScrollConfig)
|
|
5109
5161
|
) : this.hasTransformableViewport && J.configure(
|
|
5110
|
-
|
|
5162
|
+
g,
|
|
5111
5163
|
o.main,
|
|
5112
5164
|
this.window,
|
|
5113
5165
|
this.pointInsideVerifier,
|
|
5114
|
-
|
|
5115
|
-
), this.hasLayout &&
|
|
5116
|
-
let p =
|
|
5117
|
-
this.hasDraggableNodes && (
|
|
5118
|
-
|
|
5166
|
+
Me(this.transformConfig)
|
|
5167
|
+
), this.hasLayout && qt.configure(g, h), this.hasAnimatedLayout) {
|
|
5168
|
+
let p = Rr(this.animatedLayoutConfig);
|
|
5169
|
+
this.hasDraggableNodes && (Wr(
|
|
5170
|
+
g,
|
|
5119
5171
|
this.animationStaticNodes
|
|
5120
|
-
), p =
|
|
5172
|
+
), p = zr(
|
|
5121
5173
|
p,
|
|
5122
5174
|
this.animationStaticNodes
|
|
5123
|
-
)),
|
|
5175
|
+
)), pe.configure(g, p, this.window);
|
|
5124
5176
|
}
|
|
5125
|
-
return
|
|
5177
|
+
return g.onBeforeDestroy.subscribe(() => {
|
|
5126
5178
|
o.destroy();
|
|
5127
|
-
}),
|
|
5179
|
+
}), g;
|
|
5128
5180
|
}
|
|
5129
5181
|
createHtmlView(e, t, o) {
|
|
5130
|
-
let s = new
|
|
5131
|
-
return this.virtualScrollConfig !== void 0 && (s = new
|
|
5182
|
+
let s = new Re(t, o, e);
|
|
5183
|
+
return this.virtualScrollConfig !== void 0 && (s = new lt(
|
|
5132
5184
|
s,
|
|
5133
5185
|
t,
|
|
5134
5186
|
this.boxRenderingTrigger,
|
|
5135
|
-
|
|
5136
|
-
)), s = new
|
|
5187
|
+
pr(this.virtualScrollConfig)
|
|
5188
|
+
)), s = new ut(s, t), s;
|
|
5137
5189
|
}
|
|
5138
5190
|
}
|
|
5139
5191
|
export {
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5192
|
+
Ut as BezierEdgeShape,
|
|
5193
|
+
_r as CanvasBuilder,
|
|
5194
|
+
wr as CanvasBuilderError,
|
|
5143
5195
|
A as CanvasError,
|
|
5144
5196
|
I as ConnectionCategory,
|
|
5145
|
-
|
|
5197
|
+
ze as DirectEdgeShape,
|
|
5146
5198
|
q as EventSubject,
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5199
|
+
$t as HorizontalEdgeShape,
|
|
5200
|
+
kt as InteractiveEdgeError,
|
|
5201
|
+
ke as InteractiveEdgeShape,
|
|
5202
|
+
Zr as MidpointEdgeShape,
|
|
5203
|
+
Bt as StraightEdgeShape,
|
|
5204
|
+
Ot as VerticalEdgeShape
|
|
5153
5205
|
};
|