@html-graph/html-graph 8.18.0 → 8.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html-graph.d.ts +10 -5
- package/dist/html-graph.js +115 -98
- package/dist/html-graph.min.js +696 -693
- package/dist/html-graph.min.umd.cjs +1 -1
- package/dist/html-graph.umd.cjs +115 -98
- 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 nt = Object.defineProperty;
|
|
2
|
+
var at = (r, e, t) => e in r ? nt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => at(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 ht = () => {
|
|
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
|
+
}, dt = () => {
|
|
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
|
+
}, ct = (r) => {
|
|
12
12
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
13
|
-
},
|
|
13
|
+
}, lt = (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 Ve {
|
|
17
17
|
constructor(e, t, o) {
|
|
18
|
-
i(this, "host",
|
|
19
|
-
i(this, "container",
|
|
18
|
+
i(this, "host", ht());
|
|
19
|
+
i(this, "container", dt());
|
|
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
|
+
ct(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
|
+
lt(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 ut {
|
|
97
97
|
constructor(e) {
|
|
98
98
|
i(this, "xFrom", 1 / 0);
|
|
99
99
|
i(this, "yFrom", 1 / 0);
|
|
@@ -109,11 +109,11 @@ class at {
|
|
|
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 gt {
|
|
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 ht {
|
|
|
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 ht {
|
|
|
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 ut(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 ht {
|
|
|
191
191
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
class
|
|
194
|
+
class pt {
|
|
195
195
|
constructor(e, t) {
|
|
196
196
|
i(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
197
197
|
i(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
@@ -265,7 +265,7 @@ const C = () => {
|
|
|
265
265
|
const r = new q();
|
|
266
266
|
return [r, r];
|
|
267
267
|
};
|
|
268
|
-
class
|
|
268
|
+
class Ie {
|
|
269
269
|
constructor(e, t, o, s) {
|
|
270
270
|
i(this, "beforeDestroyEmitter");
|
|
271
271
|
i(this, "destroyed", !1);
|
|
@@ -318,7 +318,7 @@ class Me {
|
|
|
318
318
|
this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
class
|
|
321
|
+
class wt {
|
|
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 Fe {
|
|
391
391
|
constructor() {
|
|
392
392
|
i(this, "nodes", /* @__PURE__ */ new Map());
|
|
393
393
|
i(this, "ports", /* @__PURE__ */ new Map());
|
|
@@ -396,7 +396,7 @@ class De {
|
|
|
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 wt());
|
|
400
400
|
i(this, "edgesElementsMap", /* @__PURE__ */ new Map());
|
|
401
401
|
i(this, "afterNodeAddedEmitter");
|
|
402
402
|
i(this, "onAfterNodeAdded");
|
|
@@ -686,18 +686,18 @@ 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
|
|
693
|
-
},
|
|
693
|
+
}, xe = (r, e) => ({
|
|
694
694
|
x: r.scale * e.x + r.x,
|
|
695
695
|
y: r.scale * e.y + r.y
|
|
696
696
|
});
|
|
697
|
-
class
|
|
697
|
+
class ft {
|
|
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");
|
|
@@ -734,10 +734,10 @@ class lt {
|
|
|
734
734
|
return { width: e, height: t };
|
|
735
735
|
}
|
|
736
736
|
createContentCoords(e) {
|
|
737
|
-
return
|
|
737
|
+
return xe(this.viewportMatrix, e);
|
|
738
738
|
}
|
|
739
739
|
createViewportCoords(e) {
|
|
740
|
-
return
|
|
740
|
+
return xe(this.contentMatrix, e);
|
|
741
741
|
}
|
|
742
742
|
destroy() {
|
|
743
743
|
this.observer.disconnect();
|
|
@@ -776,16 +776,16 @@ class ee {
|
|
|
776
776
|
this.canvas.updateNode(t);
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
|
-
const
|
|
779
|
+
const yt = (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
|
+
}, vt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight;
|
|
783
|
+
class mt {
|
|
784
784
|
constructor(e, t) {
|
|
785
785
|
this.element = e, this.win = t;
|
|
786
786
|
}
|
|
787
787
|
verify(e, t) {
|
|
788
|
-
return
|
|
788
|
+
return yt(this.element, e, t) && vt(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
|
+
}, Et = (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* Ue(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 = Ue(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 $e = (r, e) => {
|
|
839
|
+
const t = Ue(document, e);
|
|
840
840
|
for (const o of t) {
|
|
841
|
-
const s =
|
|
841
|
+
const s = Et(r, o);
|
|
842
842
|
if (s.status === "portFound")
|
|
843
843
|
return s.portId;
|
|
844
844
|
if (s.status === "nodeEncountered")
|
|
@@ -847,13 +847,13 @@ const Le = (r, e) => {
|
|
|
847
847
|
return null;
|
|
848
848
|
};
|
|
849
849
|
var M = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(M || {});
|
|
850
|
-
const
|
|
850
|
+
const Be = (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
|
+
}), Oe = (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 Ve = (r, e) => ({
|
|
|
870
870
|
to: { x: s.x - n, y: s.y - a }
|
|
871
871
|
};
|
|
872
872
|
};
|
|
873
|
-
class
|
|
873
|
+
class xt {
|
|
874
874
|
constructor(e) {
|
|
875
875
|
i(this, "path");
|
|
876
876
|
i(this, "midpoint");
|
|
@@ -883,9 +883,9 @@ class yt {
|
|
|
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 yt {
|
|
|
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 At {
|
|
907
907
|
constructor(e) {
|
|
908
908
|
i(this, "path");
|
|
909
909
|
i(this, "midpoint");
|
|
@@ -916,70 +916,70 @@ class ft {
|
|
|
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:
|
|
943
|
+
), N = {
|
|
944
|
+
x: x.x + w,
|
|
945
|
+
y: x.y + f
|
|
946
946
|
}, T = {
|
|
947
|
-
x: (
|
|
948
|
-
y: (
|
|
947
|
+
x: (E.x + N.x) / 2,
|
|
948
|
+
y: (E.y + N.y) / 2
|
|
949
949
|
}, D = {
|
|
950
|
-
x:
|
|
951
|
-
y:
|
|
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 ${
|
|
963
|
+
`M ${g.x} ${g.y}`,
|
|
964
|
+
`L ${y.x} ${y.y}`,
|
|
965
965
|
`C ${D.x} ${D.y} ${U.x} ${U.y} ${T.x} ${T.y}`,
|
|
966
|
-
`C ${R.x} ${R.y} ${F.x} ${F.y} ${
|
|
966
|
+
`C ${R.x} ${R.y} ${F.x} ${F.y} ${x.x} ${x.y}`,
|
|
967
967
|
`L ${p.x} ${p.y}`
|
|
968
968
|
].join(" "), this.midpoint = T;
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
971
|
const te = Object.freeze({
|
|
972
972
|
edgeColor: "--edge-color"
|
|
973
|
-
}),
|
|
973
|
+
}), We = (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
|
+
}, ze = (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
|
+
}, ke = (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 (
|
|
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
993
|
const D = r[d + 1];
|
|
994
994
|
s = D.x - h.x, n = D.y - h.y, a = Math.sqrt(s * s + n * n);
|
|
995
995
|
}
|
|
996
|
-
const
|
|
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
997
|
d > 0 && t.push(`L ${T.x} ${T.y}`), w && t.push(
|
|
998
|
-
`C ${h.x} ${h.y} ${h.x} ${h.y} ${
|
|
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
|
+
}, St = (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 bt {
|
|
1040
1042
|
constructor(e) {
|
|
1041
1043
|
i(this, "path");
|
|
1042
1044
|
i(this, "midpoint");
|
|
@@ -1049,41 +1051,23 @@ class mt {
|
|
|
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 = St(
|
|
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 Pt {
|
|
1087
1071
|
constructor(e) {
|
|
1088
1072
|
i(this, "path");
|
|
1089
1073
|
i(this, "midpoint");
|
|
@@ -1096,9 +1080,9 @@ class xt {
|
|
|
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 xt {
|
|
|
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:
|
|
1101
|
+
), N = {
|
|
1102
|
+
x: x.x + y,
|
|
1103
|
+
y: x.y + E
|
|
1120
1104
|
}, T = m(
|
|
1121
|
-
{ x: n.x -
|
|
1105
|
+
{ x: n.x - f, y: n.y },
|
|
1122
1106
|
d,
|
|
1123
1107
|
n
|
|
1124
1108
|
), D = {
|
|
1125
|
-
x: T.x +
|
|
1126
|
-
y: T.y +
|
|
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 Nt {
|
|
1138
1122
|
constructor(e) {
|
|
1139
1123
|
i(this, "path");
|
|
1140
1124
|
i(this, "midpoint");
|
|
@@ -1147,24 +1131,24 @@ class Et {
|
|
|
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 Et {
|
|
|
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 Ct = (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 Tt {
|
|
1216
1202
|
constructor(e) {
|
|
1217
1203
|
i(this, "path");
|
|
1218
1204
|
i(this, "midpoint");
|
|
@@ -1225,45 +1211,27 @@ class St {
|
|
|
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 = Ct(
|
|
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 Mt {
|
|
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 Dt {
|
|
1298
1266
|
constructor(e) {
|
|
1299
1267
|
i(this, "path");
|
|
1300
1268
|
i(this, "midpoint");
|
|
@@ -1309,27 +1277,27 @@ class Nt {
|
|
|
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 Nt {
|
|
|
1339
1307
|
};
|
|
1340
1308
|
}
|
|
1341
1309
|
}
|
|
1342
|
-
const
|
|
1310
|
+
const Rt = (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 Lt {
|
|
1347
1315
|
constructor(e) {
|
|
1348
1316
|
i(this, "path");
|
|
1349
1317
|
i(this, "midpoint");
|
|
@@ -1356,9 +1324,9 @@ class Ct {
|
|
|
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 Ct {
|
|
|
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 = Rt(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 Vt = (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 It {
|
|
1402
1370
|
constructor(e) {
|
|
1403
1371
|
i(this, "path");
|
|
1404
1372
|
i(this, "midpoint");
|
|
@@ -1411,9 +1379,9 @@ class Mt {
|
|
|
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 Mt {
|
|
|
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 = Vt(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
|
}
|
|
@@ -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] = C(), this.arrowRenderer = this.params.arrowRenderer, this.svg =
|
|
1456
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = C(), this.arrowRenderer = this.params.arrowRenderer, this.svg = We(e.color), this.svg.appendChild(this.group), this.line = ze(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 } = Oe(
|
|
1492
1460
|
e.from,
|
|
1493
1461
|
e.to,
|
|
1494
1462
|
this.params.padding
|
|
1495
1463
|
);
|
|
1496
|
-
|
|
1464
|
+
ke(this.svg, { x: t, y: o, width: s, height: n });
|
|
1497
1465
|
const d = Ae(e.from.direction), c = Ae(e.to.direction);
|
|
1498
|
-
let
|
|
1499
|
-
e.category === I.PortCycle ? (
|
|
1500
|
-
const
|
|
1501
|
-
this.line.setAttribute("d",
|
|
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 Ft = (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 Dt = (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
|
+
}, Ut = (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 Dt = (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
|
+
}, $t = (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 Dt = (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 Ft({
|
|
1571
1539
|
radius: r.radius ?? v.polygonArrowRadius
|
|
1572
1540
|
});
|
|
1573
1541
|
case "arc":
|
|
1574
|
-
return
|
|
1542
|
+
return Ut({
|
|
1575
1543
|
radius: r.radius ?? v.circleArrowRadius
|
|
1576
1544
|
});
|
|
1577
1545
|
default:
|
|
1578
|
-
return
|
|
1546
|
+
return $t({
|
|
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 Bt {
|
|
1586
1554
|
constructor(e) {
|
|
1587
1555
|
i(this, "svg");
|
|
1588
1556
|
i(this, "group");
|
|
@@ -1599,7 +1567,7 @@ class Vt {
|
|
|
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 Mt({
|
|
1603
1571
|
origin: e,
|
|
1604
1572
|
dir: o,
|
|
1605
1573
|
radius: this.portCycleRadius,
|
|
@@ -1607,7 +1575,7 @@ class Vt {
|
|
|
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 At({
|
|
1611
1579
|
from: e,
|
|
1612
1580
|
to: t,
|
|
1613
1581
|
fromDir: o,
|
|
@@ -1619,7 +1587,7 @@ class Vt {
|
|
|
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 xt({
|
|
1623
1591
|
from: e,
|
|
1624
1592
|
to: t,
|
|
1625
1593
|
fromDir: o,
|
|
@@ -1646,7 +1614,8 @@ class Vt {
|
|
|
1646
1614
|
this.pathShape.render(e);
|
|
1647
1615
|
}
|
|
1648
1616
|
}
|
|
1649
|
-
|
|
1617
|
+
const Se = (r) => Math.cos(r) > 0 ? 0 : Math.PI;
|
|
1618
|
+
class Ot {
|
|
1650
1619
|
constructor(e) {
|
|
1651
1620
|
i(this, "svg");
|
|
1652
1621
|
i(this, "group");
|
|
@@ -1671,7 +1640,7 @@ class It {
|
|
|
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 Lt({
|
|
1675
1644
|
from: e,
|
|
1676
1645
|
to: t,
|
|
1677
1646
|
fromDir: o,
|
|
@@ -1683,7 +1652,7 @@ class It {
|
|
|
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 bt({
|
|
1687
1656
|
from: e,
|
|
1688
1657
|
to: t,
|
|
1689
1658
|
fromDir: o,
|
|
@@ -1714,10 +1683,21 @@ class It {
|
|
|
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 Wt {
|
|
1721
1701
|
constructor(e) {
|
|
1722
1702
|
i(this, "svg");
|
|
1723
1703
|
i(this, "group");
|
|
@@ -1743,7 +1723,7 @@ class Ft {
|
|
|
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 Pt({
|
|
1747
1727
|
from: e,
|
|
1748
1728
|
to: t,
|
|
1749
1729
|
fromDir: o,
|
|
@@ -1756,7 +1736,7 @@ class Ft {
|
|
|
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 Nt({
|
|
1760
1740
|
from: e,
|
|
1761
1741
|
to: t,
|
|
1762
1742
|
fromDir: o,
|
|
@@ -1790,7 +1770,8 @@ class Ft {
|
|
|
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 zt {
|
|
1794
1775
|
constructor(e) {
|
|
1795
1776
|
i(this, "svg");
|
|
1796
1777
|
i(this, "group");
|
|
@@ -1815,7 +1796,7 @@ class Ut {
|
|
|
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 It({
|
|
1819
1800
|
from: e,
|
|
1820
1801
|
to: t,
|
|
1821
1802
|
fromDir: o,
|
|
@@ -1827,7 +1808,7 @@ class Ut {
|
|
|
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 Tt({
|
|
1831
1812
|
from: e,
|
|
1832
1813
|
to: t,
|
|
1833
1814
|
fromDir: o,
|
|
@@ -1858,10 +1839,21 @@ class Ut {
|
|
|
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 He {
|
|
1865
1857
|
constructor(e) {
|
|
1866
1858
|
i(this, "svg");
|
|
1867
1859
|
i(this, "group", document.createElementNS(
|
|
@@ -1879,16 +1871,16 @@ class Be {
|
|
|
1879
1871
|
i(this, "onAfterRender");
|
|
1880
1872
|
i(this, "afterRenderEmitter");
|
|
1881
1873
|
i(this, "arrowRenderer");
|
|
1882
|
-
[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 =
|
|
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 = We(this.color), this.svg.appendChild(this.group), this.line = ze(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 } = Oe(
|
|
1886
1878
|
e.from,
|
|
1887
1879
|
e.to,
|
|
1888
1880
|
O
|
|
1889
1881
|
);
|
|
1890
|
-
|
|
1891
|
-
const d = new
|
|
1882
|
+
ke(this.svg, { x: t, y: o, width: s, height: n });
|
|
1883
|
+
const d = new Dt({
|
|
1892
1884
|
from: a,
|
|
1893
1885
|
to: h,
|
|
1894
1886
|
sourceOffset: this.sourceOffset,
|
|
@@ -1898,64 +1890,64 @@ class Be {
|
|
|
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 kt = () => {
|
|
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
|
+
}, Ht = (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 Yt extends Error {
|
|
1954
1946
|
constructor(e) {
|
|
1955
1947
|
super(e), this.name = "InteractiveEdgeError";
|
|
1956
1948
|
}
|
|
1957
1949
|
}
|
|
1958
|
-
class
|
|
1950
|
+
class Ye {
|
|
1959
1951
|
constructor(e, t) {
|
|
1960
1952
|
i(this, "svg");
|
|
1961
1953
|
i(this, "group");
|
|
@@ -1965,20 +1957,20 @@ class Oe {
|
|
|
1965
1957
|
// TODO: make private
|
|
1966
1958
|
/**
|
|
1967
1959
|
* @deprecated
|
|
1968
|
-
*
|
|
1960
|
+
* use shape.svg instead
|
|
1969
1961
|
*/
|
|
1970
|
-
i(this, "handle",
|
|
1962
|
+
i(this, "handle", kt());
|
|
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 Ye)
|
|
1968
|
+
throw new Yt(
|
|
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 = Ht(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 Oe {
|
|
|
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 Jr {
|
|
|
2003
1995
|
this.baseShape.render(e);
|
|
2004
1996
|
}
|
|
2005
1997
|
}
|
|
2006
|
-
class
|
|
1998
|
+
class Xe {
|
|
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 Ge {
|
|
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 ze {
|
|
|
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 Xt = (r) => {
|
|
2253
2245
|
setTimeout(() => {
|
|
2254
2246
|
r();
|
|
2255
2247
|
});
|
|
2256
|
-
},
|
|
2248
|
+
}, Ce = (r) => {
|
|
2257
2249
|
queueMicrotask(() => {
|
|
2258
2250
|
r();
|
|
2259
2251
|
});
|
|
2260
2252
|
}, oe = (r) => {
|
|
2261
2253
|
r();
|
|
2262
2254
|
};
|
|
2263
|
-
class
|
|
2255
|
+
class je {
|
|
2264
2256
|
constructor(e) {
|
|
2265
2257
|
i(this, "onBeforeUpdated");
|
|
2266
2258
|
i(this, "onAfterUpdated");
|
|
@@ -2283,7 +2275,7 @@ class ke {
|
|
|
2283
2275
|
return this.viewportStore.createViewportCoords(e);
|
|
2284
2276
|
}
|
|
2285
2277
|
}
|
|
2286
|
-
const
|
|
2278
|
+
const Gt = (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 kt = (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
|
+
}, Je = (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
|
+
}), Ke = (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 Qe {
|
|
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 Xe {
|
|
|
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 = Je(a, d, c);
|
|
2310
|
+
const u = t == null ? void 0 : t.contentScale;
|
|
2311
|
+
if (u !== void 0) {
|
|
2312
|
+
const p = 1 / u;
|
|
2313
|
+
l = Ke(
|
|
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 = Gt(e ?? {}, this.params);
|
|
2333
2325
|
this.params.focus.schedule(() => {
|
|
2334
2326
|
this.navigate(t);
|
|
2335
2327
|
});
|
|
@@ -2350,12 +2342,12 @@ class Xe {
|
|
|
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 Xe {
|
|
|
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 Xe {
|
|
|
2378
2370
|
this.win.requestAnimationFrame(a);
|
|
2379
2371
|
}
|
|
2380
2372
|
}
|
|
2381
|
-
const
|
|
2382
|
-
const o = new
|
|
2373
|
+
const Ze = (r, e, t) => {
|
|
2374
|
+
const o = new Fe(), s = new Xe(o), n = new je(e), a = new Ve(o, e, r), h = {
|
|
2383
2375
|
nodes: {
|
|
2384
|
-
centerFn:
|
|
2376
|
+
centerFn: Be,
|
|
2385
2377
|
priorityFn: () => 0
|
|
2386
2378
|
},
|
|
2387
2379
|
edges: {
|
|
2388
|
-
shapeFactory: () => new
|
|
2380
|
+
shapeFactory: () => new He(),
|
|
2389
2381
|
priorityFn: () => 0
|
|
2390
2382
|
},
|
|
2391
2383
|
ports: {
|
|
2392
2384
|
direction: 0
|
|
2393
2385
|
}
|
|
2394
|
-
}, d = new
|
|
2386
|
+
}, d = new Ge(
|
|
2395
2387
|
o,
|
|
2396
2388
|
a,
|
|
2397
2389
|
h
|
|
@@ -2402,13 +2394,13 @@ const Ge = (r, e, t) => {
|
|
|
2402
2394
|
schedule: oe,
|
|
2403
2395
|
animationDuration: 0
|
|
2404
2396
|
}
|
|
2405
|
-
},
|
|
2397
|
+
}, l = new Qe(
|
|
2406
2398
|
o,
|
|
2407
2399
|
e,
|
|
2408
2400
|
c,
|
|
2409
2401
|
t
|
|
2410
2402
|
);
|
|
2411
|
-
return new
|
|
2403
|
+
return new Ie(s, n, d, l);
|
|
2412
2404
|
};
|
|
2413
2405
|
class j {
|
|
2414
2406
|
constructor(e, t, o, s) {
|
|
@@ -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 jt {
|
|
2514
2506
|
constructor() {
|
|
2515
2507
|
i(this, "field", "_htmlGraphTags");
|
|
2516
2508
|
}
|
|
@@ -2618,7 +2610,7 @@ const ne = (r, e) => ({
|
|
|
2618
2610
|
from: r.isDirect ? r.staticPortId : e,
|
|
2619
2611
|
to: r.isDirect ? e : r.staticPortId
|
|
2620
2612
|
});
|
|
2621
|
-
class
|
|
2613
|
+
class Te {
|
|
2622
2614
|
constructor(e, t) {
|
|
2623
2615
|
this.graph = e, this.connectionAllowedVerifier = t;
|
|
2624
2616
|
}
|
|
@@ -2626,18 +2618,18 @@ class Yt {
|
|
|
2626
2618
|
let t, o = 1 / 0;
|
|
2627
2619
|
const { cursor: s } = e;
|
|
2628
2620
|
return this.graph.getAllPortIds().forEach((n) => {
|
|
2629
|
-
const { element: a, direction: h, nodeId: d } = this.graph.getPort(n), { x: c, y:
|
|
2630
|
-
if (c === null ||
|
|
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)
|
|
2631
2623
|
return;
|
|
2632
|
-
const
|
|
2633
|
-
if (!this.connectionAllowedVerifier(
|
|
2624
|
+
const u = ne(e, n);
|
|
2625
|
+
if (!this.connectionAllowedVerifier(u))
|
|
2634
2626
|
return;
|
|
2635
|
-
const { top:
|
|
2636
|
-
|
|
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);
|
|
2637
2629
|
}), t;
|
|
2638
2630
|
}
|
|
2639
2631
|
}
|
|
2640
|
-
class
|
|
2632
|
+
class Jt {
|
|
2641
2633
|
constructor(e) {
|
|
2642
2634
|
this.direction = e;
|
|
2643
2635
|
}
|
|
@@ -2955,7 +2947,7 @@ class J {
|
|
|
2955
2947
|
);
|
|
2956
2948
|
}
|
|
2957
2949
|
moveViewport(e, t) {
|
|
2958
|
-
const o = this.viewport.getViewportMatrix(), s =
|
|
2950
|
+
const o = this.viewport.getViewportMatrix(), s = Je(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
|
|
2959
2951
|
prevTransform: o,
|
|
2960
2952
|
nextTransform: s,
|
|
2961
2953
|
canvasWidth: n,
|
|
@@ -2964,7 +2956,7 @@ class J {
|
|
|
2964
2956
|
this.performTransform(h);
|
|
2965
2957
|
}
|
|
2966
2958
|
scaleViewport(e, t, o) {
|
|
2967
|
-
const s = this.canvas.viewport.getViewportMatrix(), n =
|
|
2959
|
+
const s = this.canvas.viewport.getViewportMatrix(), n = Ke(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
|
|
2968
2960
|
prevTransform: s,
|
|
2969
2961
|
nextTransform: n,
|
|
2970
2962
|
canvasWidth: a,
|
|
@@ -3076,27 +3068,27 @@ class he {
|
|
|
3076
3068
|
}
|
|
3077
3069
|
scheduleEnsureViewportAreaLoaded() {
|
|
3078
3070
|
setTimeout(() => {
|
|
3079
|
-
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,
|
|
3080
|
-
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();
|
|
3081
3073
|
});
|
|
3082
3074
|
}
|
|
3083
3075
|
loadAreaAroundViewport() {
|
|
3084
|
-
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;
|
|
3085
3077
|
this.trigger.emit({
|
|
3086
3078
|
x: d,
|
|
3087
3079
|
y: c,
|
|
3088
|
-
width:
|
|
3089
|
-
height:
|
|
3080
|
+
width: l,
|
|
3081
|
+
height: u
|
|
3090
3082
|
});
|
|
3091
3083
|
}
|
|
3092
3084
|
}
|
|
3093
|
-
const
|
|
3085
|
+
const Kt = () => {
|
|
3094
3086
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
3095
3087
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3096
|
-
},
|
|
3088
|
+
}, Qt = () => {
|
|
3097
3089
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
3098
3090
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
3099
|
-
},
|
|
3091
|
+
}, Zt = () => {
|
|
3100
3092
|
const r = document.createElementNS(
|
|
3101
3093
|
"http://www.w3.org/2000/svg",
|
|
3102
3094
|
"pattern"
|
|
@@ -3105,9 +3097,9 @@ const Gt = () => {
|
|
|
3105
3097
|
};
|
|
3106
3098
|
class de {
|
|
3107
3099
|
constructor(e, t, o) {
|
|
3108
|
-
i(this, "svg",
|
|
3109
|
-
i(this, "patternRenderingRectangle",
|
|
3110
|
-
i(this, "pattern",
|
|
3100
|
+
i(this, "svg", Kt());
|
|
3101
|
+
i(this, "patternRenderingRectangle", Qt());
|
|
3102
|
+
i(this, "pattern", Zt());
|
|
3111
3103
|
i(this, "patternContent");
|
|
3112
3104
|
i(this, "tileWidth");
|
|
3113
3105
|
i(this, "tileHeight");
|
|
@@ -3149,7 +3141,7 @@ class ce {
|
|
|
3149
3141
|
i(this, "onEdgeCreated", (e) => {
|
|
3150
3142
|
this.params.onAfterEdgeCreated(e);
|
|
3151
3143
|
});
|
|
3152
|
-
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 = Ze(
|
|
3153
3145
|
this.overlayLayer,
|
|
3154
3146
|
this.viewportStore,
|
|
3155
3147
|
this.window
|
|
@@ -3158,8 +3150,8 @@ class ce {
|
|
|
3158
3150
|
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
3159
3151
|
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
3160
3152
|
onPointerDownVerifier: (d, c) => {
|
|
3161
|
-
const
|
|
3162
|
-
return
|
|
3153
|
+
const l = this.params.connectionTypeResolver(d);
|
|
3154
|
+
return l === null ? !1 : (this.grabPort(d, c, l), !0);
|
|
3163
3155
|
},
|
|
3164
3156
|
onPointerMove: (d) => {
|
|
3165
3157
|
this.moveDraggingPort(d);
|
|
@@ -3193,28 +3185,30 @@ class ce {
|
|
|
3193
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({
|
|
3194
3186
|
x: a - d.x,
|
|
3195
3187
|
y: h - d.y
|
|
3196
|
-
}),
|
|
3188
|
+
}), l = this.canvas.viewport.createContentCoords({
|
|
3197
3189
|
x: t.x - d.x,
|
|
3198
3190
|
y: t.y - d.y
|
|
3199
|
-
}),
|
|
3191
|
+
}), u = {
|
|
3200
3192
|
overlayNodeId: M.StaticNodeId,
|
|
3201
3193
|
portCoords: c,
|
|
3202
3194
|
portDirection: s.direction
|
|
3203
|
-
},
|
|
3195
|
+
}, g = o === "direct";
|
|
3204
3196
|
this.edgeInProgress = {
|
|
3205
3197
|
staticPortId: e,
|
|
3206
|
-
isDirect:
|
|
3198
|
+
isDirect: g
|
|
3207
3199
|
};
|
|
3208
|
-
const p =
|
|
3209
|
-
|
|
3210
|
-
portCoords: u,
|
|
3211
|
-
portDirection: this.params.draggingPortDirectionResolver.resolve({
|
|
3200
|
+
const p = this.params.draggingPortDirectionResolver.resolve(
|
|
3201
|
+
{
|
|
3212
3202
|
cursor: t,
|
|
3213
3203
|
...this.edgeInProgress
|
|
3214
|
-
}
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
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,
|
|
3218
3212
|
to: y.overlayNodeId,
|
|
3219
3213
|
shape: this.params.edgeShapeFactory(M.EdgeId)
|
|
3220
3214
|
});
|
|
@@ -3223,7 +3217,7 @@ class ce {
|
|
|
3223
3217
|
this.edgeInProgress = null, this.overlayCanvas.clear();
|
|
3224
3218
|
}
|
|
3225
3219
|
tryCreateConnection(e) {
|
|
3226
|
-
const t =
|
|
3220
|
+
const t = $e(this.canvas.graph, e);
|
|
3227
3221
|
if (t === null) {
|
|
3228
3222
|
this.params.onEdgeCreationInterrupted(this.edgeInProgress);
|
|
3229
3223
|
return;
|
|
@@ -3259,7 +3253,7 @@ class le {
|
|
|
3259
3253
|
i(this, "onEdgeReattached", (e) => {
|
|
3260
3254
|
this.params.onAfterEdgeReattached(e);
|
|
3261
3255
|
});
|
|
3262
|
-
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 = Ze(
|
|
3263
3257
|
this.overlayLayer,
|
|
3264
3258
|
this.viewportStore,
|
|
3265
3259
|
this.window
|
|
@@ -3308,15 +3302,15 @@ class le {
|
|
|
3308
3302
|
return !1;
|
|
3309
3303
|
const s = this.canvas.graph.getEdge(o), n = e === s.from, a = e === s.to, h = n ? s.to : s.from;
|
|
3310
3304
|
this.edgeInProgress = { staticPortId: h, isDirect: a };
|
|
3311
|
-
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h),
|
|
3312
|
-
x:
|
|
3313
|
-
y:
|
|
3314
|
-
},
|
|
3315
|
-
x:
|
|
3316
|
-
y:
|
|
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
|
|
3317
3311
|
}), w = this.canvas.viewport.createContentCoords({
|
|
3318
|
-
x: t.x -
|
|
3319
|
-
y: t.y -
|
|
3312
|
+
x: t.x - g.x,
|
|
3313
|
+
y: t.y - g.y
|
|
3320
3314
|
});
|
|
3321
3315
|
this.draggingEdgePayload = {
|
|
3322
3316
|
id: o,
|
|
@@ -3325,24 +3319,26 @@ class le {
|
|
|
3325
3319
|
shape: s.shape,
|
|
3326
3320
|
priority: s.priority
|
|
3327
3321
|
}, this.canvas.removeEdge(o);
|
|
3328
|
-
const
|
|
3322
|
+
const f = {
|
|
3329
3323
|
overlayNodeId: M.StaticNodeId,
|
|
3330
3324
|
portCoords: p,
|
|
3331
3325
|
portDirection: c.direction
|
|
3332
|
-
},
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3326
|
+
}, y = this.params.draggingPortDirectionResolver.resolve(
|
|
3327
|
+
{
|
|
3328
|
+
cursor: t,
|
|
3329
|
+
...this.edgeInProgress
|
|
3330
|
+
}
|
|
3331
|
+
), E = {
|
|
3336
3332
|
overlayNodeId: M.DraggingNodeId,
|
|
3337
3333
|
portCoords: w,
|
|
3338
|
-
portDirection:
|
|
3339
|
-
}, [
|
|
3340
|
-
this.overlayCanvas.addNode(Y(
|
|
3334
|
+
portDirection: y ?? d.direction
|
|
3335
|
+
}, [x, N] = a ? [f, E] : [E, f];
|
|
3336
|
+
this.overlayCanvas.addNode(Y(x)), this.overlayCanvas.addNode(Y(N));
|
|
3341
3337
|
const T = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(M.EdgeId) : s.shape;
|
|
3342
3338
|
return this.overlayCanvas.addEdge({
|
|
3343
3339
|
id: M.EdgeId,
|
|
3344
|
-
from:
|
|
3345
|
-
to:
|
|
3340
|
+
from: x.overlayNodeId,
|
|
3341
|
+
to: N.overlayNodeId,
|
|
3346
3342
|
shape: T
|
|
3347
3343
|
}), !0;
|
|
3348
3344
|
}
|
|
@@ -3363,7 +3359,7 @@ class le {
|
|
|
3363
3359
|
}).updatePort(M.DraggingNodeId, { direction: n });
|
|
3364
3360
|
}
|
|
3365
3361
|
tryCreateConnection(e) {
|
|
3366
|
-
const t =
|
|
3362
|
+
const t = $e(this.canvas.graph, e);
|
|
3367
3363
|
if (this.overlayCanvas.removeEdge(M.EdgeId), t === null) {
|
|
3368
3364
|
const c = this.draggingEdgePayload;
|
|
3369
3365
|
this.params.onEdgeReattachInterrupted({
|
|
@@ -3439,7 +3435,7 @@ class ge {
|
|
|
3439
3435
|
this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
|
|
3440
3436
|
}
|
|
3441
3437
|
}
|
|
3442
|
-
class
|
|
3438
|
+
class _t {
|
|
3443
3439
|
constructor(e, t, o) {
|
|
3444
3440
|
this.canvas = e, this.layoutAlgorithm = t, this.params = o;
|
|
3445
3441
|
}
|
|
@@ -3453,9 +3449,9 @@ class Kt {
|
|
|
3453
3449
|
}), this.params.onAfterApplied();
|
|
3454
3450
|
}
|
|
3455
3451
|
}
|
|
3456
|
-
class
|
|
3452
|
+
class qt {
|
|
3457
3453
|
static configure(e, t) {
|
|
3458
|
-
const o = t.applyOn, s = new
|
|
3454
|
+
const o = t.applyOn, s = new _t(e, t.algorithm, {
|
|
3459
3455
|
staticNodeResolver: t.staticNodeResolver,
|
|
3460
3456
|
onBeforeApplied: t.onBeforeApplied,
|
|
3461
3457
|
onAfterApplied: t.onAfterApplied
|
|
@@ -3479,7 +3475,7 @@ class Qt {
|
|
|
3479
3475
|
}
|
|
3480
3476
|
}
|
|
3481
3477
|
}
|
|
3482
|
-
class
|
|
3478
|
+
class er {
|
|
3483
3479
|
constructor(e, t) {
|
|
3484
3480
|
i(this, "previousTimeStamp");
|
|
3485
3481
|
i(this, "step", (e) => {
|
|
@@ -3494,7 +3490,7 @@ class Zt {
|
|
|
3494
3490
|
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
3495
3491
|
}
|
|
3496
3492
|
}
|
|
3497
|
-
class
|
|
3493
|
+
class tr {
|
|
3498
3494
|
constructor(e, t, o) {
|
|
3499
3495
|
this.canvas = e, this.layoutAlgorithm = t, this.params = o;
|
|
3500
3496
|
}
|
|
@@ -3515,11 +3511,11 @@ class pe {
|
|
|
3515
3511
|
i(this, "step", (e) => {
|
|
3516
3512
|
this.applier.apply(e);
|
|
3517
3513
|
});
|
|
3518
|
-
this.win = o, this.applier = new
|
|
3514
|
+
this.win = o, this.applier = new tr(e, t.algorithm, {
|
|
3519
3515
|
staticNodeResolver: t.staticNodeResolver,
|
|
3520
3516
|
onBeforeApplied: t.onBeforeApplied,
|
|
3521
3517
|
onAfterApplied: t.onAfterApplied
|
|
3522
|
-
}), new
|
|
3518
|
+
}), new er(this.win, this.step);
|
|
3523
3519
|
}
|
|
3524
3520
|
static configure(e, t, o) {
|
|
3525
3521
|
new pe(e, t, o);
|
|
@@ -3568,7 +3564,7 @@ class we {
|
|
|
3568
3564
|
);
|
|
3569
3565
|
}
|
|
3570
3566
|
}
|
|
3571
|
-
class
|
|
3567
|
+
class fe {
|
|
3572
3568
|
constructor(e, t, o, s, n) {
|
|
3573
3569
|
i(this, "configurator");
|
|
3574
3570
|
i(this, "selectionHandledTag", se);
|
|
@@ -3602,7 +3598,7 @@ class ye {
|
|
|
3602
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);
|
|
3603
3599
|
}
|
|
3604
3600
|
static configure(e, t, o, s, n) {
|
|
3605
|
-
new
|
|
3601
|
+
new fe(
|
|
3606
3602
|
e,
|
|
3607
3603
|
t,
|
|
3608
3604
|
o,
|
|
@@ -3611,7 +3607,7 @@ class ye {
|
|
|
3611
3607
|
);
|
|
3612
3608
|
}
|
|
3613
3609
|
}
|
|
3614
|
-
class
|
|
3610
|
+
class ye {
|
|
3615
3611
|
constructor(e, t, o, s, n, a) {
|
|
3616
3612
|
i(this, "configurator");
|
|
3617
3613
|
i(this, "onCanvasSelected");
|
|
@@ -3632,7 +3628,7 @@ class fe {
|
|
|
3632
3628
|
});
|
|
3633
3629
|
}
|
|
3634
3630
|
static configure(e, t, o, s, n, a) {
|
|
3635
|
-
new
|
|
3631
|
+
new ye(
|
|
3636
3632
|
e,
|
|
3637
3633
|
t,
|
|
3638
3634
|
o,
|
|
@@ -3642,23 +3638,23 @@ class fe {
|
|
|
3642
3638
|
);
|
|
3643
3639
|
}
|
|
3644
3640
|
}
|
|
3645
|
-
const
|
|
3641
|
+
const rr = () => {
|
|
3646
3642
|
const r = document.createElement("div");
|
|
3647
3643
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3648
3644
|
}, Q = () => {
|
|
3649
3645
|
const r = document.createElement("div");
|
|
3650
3646
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3651
|
-
},
|
|
3647
|
+
}, Me = () => {
|
|
3652
3648
|
const r = Q();
|
|
3653
3649
|
return r.style.pointerEvents = "none", r;
|
|
3654
3650
|
};
|
|
3655
|
-
class
|
|
3651
|
+
class or {
|
|
3656
3652
|
constructor(e) {
|
|
3657
3653
|
i(this, "background", Q());
|
|
3658
3654
|
i(this, "main", Q());
|
|
3659
|
-
i(this, "overlayConnectablePorts",
|
|
3660
|
-
i(this, "overlayDraggableEdges",
|
|
3661
|
-
i(this, "host",
|
|
3655
|
+
i(this, "overlayConnectablePorts", Me());
|
|
3656
|
+
i(this, "overlayDraggableEdges", Me());
|
|
3657
|
+
i(this, "host", rr());
|
|
3662
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);
|
|
3663
3659
|
}
|
|
3664
3660
|
destroy() {
|
|
@@ -3683,16 +3679,19 @@ const b = Object.freeze({
|
|
|
3683
3679
|
mouseDownEventVerifier: (r) => r.button === 0,
|
|
3684
3680
|
mouseUpEventVerifier: (r) => r.button === 0,
|
|
3685
3681
|
movementThreshold: 10
|
|
3686
|
-
}),
|
|
3687
|
-
},
|
|
3682
|
+
}), P = () => {
|
|
3683
|
+
}, _e = (r, e, t) => r === "closest-connectable-port" ? new Te(
|
|
3684
|
+
e,
|
|
3685
|
+
t
|
|
3686
|
+
) : r === "nearest-connectable-port" ? new Te(
|
|
3688
3687
|
e,
|
|
3689
3688
|
t
|
|
3690
|
-
) : new
|
|
3689
|
+
) : new Jt(r), ve = (r) => {
|
|
3691
3690
|
if (typeof r == "function")
|
|
3692
3691
|
return r;
|
|
3693
3692
|
switch (r.type) {
|
|
3694
3693
|
case "straight":
|
|
3695
|
-
return () => new
|
|
3694
|
+
return () => new Wt({
|
|
3696
3695
|
color: r.color,
|
|
3697
3696
|
width: r.width,
|
|
3698
3697
|
arrowLength: r.arrowLength,
|
|
@@ -3706,7 +3705,7 @@ const b = Object.freeze({
|
|
|
3706
3705
|
detourDirection: r.detourDirection
|
|
3707
3706
|
});
|
|
3708
3707
|
case "horizontal":
|
|
3709
|
-
return () => new
|
|
3708
|
+
return () => new Ot({
|
|
3710
3709
|
color: r.color,
|
|
3711
3710
|
width: r.width,
|
|
3712
3711
|
arrowLength: r.arrowLength,
|
|
@@ -3719,7 +3718,7 @@ const b = Object.freeze({
|
|
|
3719
3718
|
detourDistance: r.detourDistance
|
|
3720
3719
|
});
|
|
3721
3720
|
case "vertical":
|
|
3722
|
-
return () => new
|
|
3721
|
+
return () => new zt({
|
|
3723
3722
|
color: r.color,
|
|
3724
3723
|
width: r.width,
|
|
3725
3724
|
arrowLength: r.arrowLength,
|
|
@@ -3732,7 +3731,7 @@ const b = Object.freeze({
|
|
|
3732
3731
|
detourDistance: r.detourDistance
|
|
3733
3732
|
});
|
|
3734
3733
|
case "direct":
|
|
3735
|
-
return () => new
|
|
3734
|
+
return () => new He({
|
|
3736
3735
|
color: r.color,
|
|
3737
3736
|
width: r.width,
|
|
3738
3737
|
arrowLength: r.arrowLength,
|
|
@@ -3743,7 +3742,7 @@ const b = Object.freeze({
|
|
|
3743
3742
|
targetOffset: r.targetOffset
|
|
3744
3743
|
});
|
|
3745
3744
|
default:
|
|
3746
|
-
return () => new
|
|
3745
|
+
return () => new Bt({
|
|
3747
3746
|
color: r.color,
|
|
3748
3747
|
width: r.width,
|
|
3749
3748
|
arrowLength: r.arrowLength,
|
|
@@ -3757,9 +3756,9 @@ const b = Object.freeze({
|
|
|
3757
3756
|
detourDirection: r.detourDirection
|
|
3758
3757
|
});
|
|
3759
3758
|
}
|
|
3760
|
-
},
|
|
3761
|
-
var u, g,
|
|
3762
|
-
const e = r.nodeDragVerifier ?? (() => !0), t = r.moveOnTop !== !1, o = r.moveEdgesOnTop !== !1 && t, s = (
|
|
3759
|
+
}, sr = (r) => {
|
|
3760
|
+
var l, u, g, p, w, f;
|
|
3761
|
+
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;
|
|
3763
3762
|
return {
|
|
3764
3763
|
moveOnTop: t,
|
|
3765
3764
|
moveEdgesOnTop: o,
|
|
@@ -3767,43 +3766,43 @@ const b = Object.freeze({
|
|
|
3767
3766
|
gridSize: r.gridSize ?? null,
|
|
3768
3767
|
mouseDownEventVerifier: h,
|
|
3769
3768
|
mouseUpEventVerifier: c,
|
|
3770
|
-
onNodeDragStarted: ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ??
|
|
3771
|
-
onNodeDrag: ((w = r.events) == null ? void 0 : w.onNodeDrag) ??
|
|
3769
|
+
onNodeDragStarted: ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? P,
|
|
3770
|
+
onNodeDrag: ((w = r.events) == null ? void 0 : w.onNodeDrag) ?? P,
|
|
3772
3771
|
nodeDragVerifier: e,
|
|
3773
|
-
onNodeDragFinished: ((
|
|
3772
|
+
onNodeDragFinished: ((f = r.events) == null ? void 0 : f.onNodeDragFinished) ?? P
|
|
3774
3773
|
};
|
|
3775
|
-
},
|
|
3774
|
+
}, ir = (r) => {
|
|
3776
3775
|
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;
|
|
3777
3776
|
return (n) => {
|
|
3778
3777
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
3779
3778
|
a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
|
|
3780
3779
|
const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
|
|
3781
3780
|
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));
|
|
3782
|
-
const
|
|
3783
|
-
return h >
|
|
3781
|
+
const l = n.canvasHeight * n.prevTransform.scale, u = s - l;
|
|
3782
|
+
return h > u && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, u)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3784
3783
|
};
|
|
3785
|
-
},
|
|
3784
|
+
}, nr = (r) => {
|
|
3786
3785
|
const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
|
|
3787
3786
|
return (n) => {
|
|
3788
3787
|
const a = n.prevTransform, h = n.nextTransform;
|
|
3789
|
-
let d = h.scale, c = h.x,
|
|
3788
|
+
let d = h.scale, c = h.x, l = h.y;
|
|
3790
3789
|
if (h.scale > s && h.scale > a.scale) {
|
|
3791
|
-
d = Math.max(a.scale, s), c = a.x,
|
|
3792
|
-
const
|
|
3793
|
-
c = a.x + (h.x - a.x) *
|
|
3790
|
+
d = Math.max(a.scale, s), c = a.x, l = a.y;
|
|
3791
|
+
const u = (d - a.scale) / (h.scale - a.scale);
|
|
3792
|
+
c = a.x + (h.x - a.x) * u, l = a.y + (h.y - a.y) * u;
|
|
3794
3793
|
}
|
|
3795
3794
|
if (h.scale < o && h.scale < a.scale) {
|
|
3796
|
-
d = Math.min(a.scale, o), c = a.x,
|
|
3797
|
-
const
|
|
3798
|
-
c = a.x + (h.x - a.x) *
|
|
3795
|
+
d = Math.min(a.scale, o), c = a.x, l = a.y;
|
|
3796
|
+
const u = (d - a.scale) / (h.scale - a.scale);
|
|
3797
|
+
c = a.x + (h.x - a.x) * u, l = a.y + (h.y - a.y) * u;
|
|
3799
3798
|
}
|
|
3800
3799
|
return {
|
|
3801
3800
|
scale: d,
|
|
3802
3801
|
x: c,
|
|
3803
|
-
y:
|
|
3802
|
+
y: l
|
|
3804
3803
|
};
|
|
3805
3804
|
};
|
|
3806
|
-
},
|
|
3805
|
+
}, ar = (r) => (e) => r.reduce(
|
|
3807
3806
|
(t, o) => o({
|
|
3808
3807
|
prevTransform: e.prevTransform,
|
|
3809
3808
|
nextTransform: t,
|
|
@@ -3811,59 +3810,59 @@ const b = Object.freeze({
|
|
|
3811
3810
|
canvasHeight: e.canvasHeight
|
|
3812
3811
|
}),
|
|
3813
3812
|
e.nextTransform
|
|
3814
|
-
),
|
|
3813
|
+
), De = (r) => {
|
|
3815
3814
|
if (typeof r == "function")
|
|
3816
3815
|
return r;
|
|
3817
3816
|
switch (r.type) {
|
|
3818
3817
|
case "scale-limit":
|
|
3819
|
-
return
|
|
3818
|
+
return nr({
|
|
3820
3819
|
minContentScale: r.minContentScale ?? 0,
|
|
3821
3820
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3822
3821
|
});
|
|
3823
3822
|
case "shift-limit":
|
|
3824
|
-
return
|
|
3823
|
+
return ir({
|
|
3825
3824
|
minX: r.minX ?? -1 / 0,
|
|
3826
3825
|
maxX: r.maxX ?? 1 / 0,
|
|
3827
3826
|
minY: r.minY ?? -1 / 0,
|
|
3828
3827
|
maxY: r.maxY ?? 1 / 0
|
|
3829
3828
|
});
|
|
3830
3829
|
}
|
|
3831
|
-
},
|
|
3832
|
-
var
|
|
3833
|
-
const e = (
|
|
3830
|
+
}, Re = (r) => {
|
|
3831
|
+
var g, p, w, f, y, E, x, N, T, D, F, U;
|
|
3832
|
+
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;
|
|
3834
3833
|
let s;
|
|
3835
|
-
o !== void 0 ? Array.isArray(o) ? s =
|
|
3834
|
+
o !== void 0 ? Array.isArray(o) ? s = ar(
|
|
3836
3835
|
o.map(
|
|
3837
|
-
(R) =>
|
|
3836
|
+
(R) => De(R)
|
|
3838
3837
|
)
|
|
3839
|
-
) : s =
|
|
3840
|
-
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 = (
|
|
3838
|
+
) : s = De(o) : s = (R) => R.nextTransform;
|
|
3839
|
+
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;
|
|
3841
3840
|
return {
|
|
3842
3841
|
wheelSensitivity: t,
|
|
3843
|
-
onTransformStarted: ((
|
|
3844
|
-
onTransformFinished: ((
|
|
3845
|
-
onBeforeTransformChange: ((
|
|
3846
|
-
onTransformChange: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onTransformChange) ??
|
|
3842
|
+
onTransformStarted: ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onTransformStarted) ?? P,
|
|
3843
|
+
onTransformFinished: ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformFinished) ?? P,
|
|
3844
|
+
onBeforeTransformChange: ((N = r == null ? void 0 : r.events) == null ? void 0 : N.onBeforeTransformChange) ?? P,
|
|
3845
|
+
onTransformChange: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onTransformChange) ?? P,
|
|
3847
3846
|
transformPreprocessor: s,
|
|
3848
3847
|
shiftCursor: n,
|
|
3849
3848
|
mouseDownEventVerifier: h,
|
|
3850
3849
|
mouseUpEventVerifier: c,
|
|
3851
|
-
mouseWheelEventVerifier:
|
|
3850
|
+
mouseWheelEventVerifier: u,
|
|
3852
3851
|
scaleWheelFinishTimeout: ((D = r == null ? void 0 : r.scale) == null ? void 0 : D.wheelFinishTimeout) ?? 500,
|
|
3853
|
-
onResizeTransformStarted: ((F = r == null ? void 0 : r.events) == null ? void 0 : F.onResizeTransformStarted) ??
|
|
3854
|
-
onResizeTransformFinished: ((U = r == null ? void 0 : r.events) == null ? void 0 : U.onResizeTransformFinished) ??
|
|
3852
|
+
onResizeTransformStarted: ((F = r == null ? void 0 : r.events) == null ? void 0 : F.onResizeTransformStarted) ?? P,
|
|
3853
|
+
onResizeTransformFinished: ((U = r == null ? void 0 : r.events) == null ? void 0 : U.onResizeTransformFinished) ?? P
|
|
3855
3854
|
};
|
|
3856
|
-
},
|
|
3855
|
+
}, hr = (r, e) => {
|
|
3857
3856
|
const t = document.createElementNS(
|
|
3858
3857
|
"http://www.w3.org/2000/svg",
|
|
3859
3858
|
"circle"
|
|
3860
3859
|
);
|
|
3861
3860
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3862
|
-
},
|
|
3861
|
+
}, dr = (r) => r instanceof SVGElement ? r : hr(
|
|
3863
3862
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3864
3863
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3865
|
-
),
|
|
3866
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s =
|
|
3864
|
+
), cr = (r) => {
|
|
3865
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = dr(r.renderer ?? {});
|
|
3867
3866
|
return {
|
|
3868
3867
|
tileWidth: t,
|
|
3869
3868
|
tileHeight: o,
|
|
@@ -3875,13 +3874,13 @@ const b = Object.freeze({
|
|
|
3875
3874
|
connectionPreprocessor: (r) => r,
|
|
3876
3875
|
connectionAllowedVerifier: () => !0,
|
|
3877
3876
|
mouseEventVerifier: (r) => r.button === 0
|
|
3878
|
-
}),
|
|
3877
|
+
}), lr = (r, e, t) => {
|
|
3879
3878
|
var s, n, a;
|
|
3880
3879
|
const o = r.connectionAllowedVerifier ?? $.connectionAllowedVerifier;
|
|
3881
3880
|
return {
|
|
3882
3881
|
connectionTypeResolver: r.connectionTypeResolver ?? $.connectionTypeResolver,
|
|
3883
3882
|
connectionAllowedVerifier: o,
|
|
3884
|
-
draggingPortDirectionResolver:
|
|
3883
|
+
draggingPortDirectionResolver: _e(
|
|
3885
3884
|
r.dragPortDirection,
|
|
3886
3885
|
t,
|
|
3887
3886
|
o
|
|
@@ -3890,9 +3889,9 @@ const b = Object.freeze({
|
|
|
3890
3889
|
connectionPreprocessor: r.connectionPreprocessor ?? $.connectionPreprocessor,
|
|
3891
3890
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? $.mouseEventVerifier,
|
|
3892
3891
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? $.mouseEventVerifier,
|
|
3893
|
-
onAfterEdgeCreated: ((s = r.events) == null ? void 0 : s.onAfterEdgeCreated) ??
|
|
3894
|
-
onEdgeCreationInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeCreationInterrupted) ??
|
|
3895
|
-
onEdgeCreationPrevented: ((a = r.events) == null ? void 0 : a.onEdgeCreationPrevented) ??
|
|
3892
|
+
onAfterEdgeCreated: ((s = r.events) == null ? void 0 : s.onAfterEdgeCreated) ?? P,
|
|
3893
|
+
onEdgeCreationInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeCreationInterrupted) ?? P,
|
|
3894
|
+
onEdgeCreationPrevented: ((a = r.events) == null ? void 0 : a.onEdgeCreationPrevented) ?? P
|
|
3896
3895
|
};
|
|
3897
3896
|
}, z = Object.freeze({
|
|
3898
3897
|
connectionAllowedVerifier: () => !0,
|
|
@@ -3900,7 +3899,7 @@ const b = Object.freeze({
|
|
|
3900
3899
|
// TODO: remove ctrl key
|
|
3901
3900
|
mouseDownEventVerifier: (r) => r.button === 0 && r.ctrlKey,
|
|
3902
3901
|
mouseUpEventVerifier: (r) => r.button === 0
|
|
3903
|
-
}),
|
|
3902
|
+
}), ur = (r, e) => {
|
|
3904
3903
|
var s, n, a;
|
|
3905
3904
|
const t = (h) => {
|
|
3906
3905
|
const d = e.getPortAdjacentEdgeIds(h);
|
|
@@ -3913,32 +3912,32 @@ const b = Object.freeze({
|
|
|
3913
3912
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? z.mouseUpEventVerifier,
|
|
3914
3913
|
draggingEdgeResolver: r.draggingEdgeResolver ?? t,
|
|
3915
3914
|
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ve(r.draggingEdgeShape) : null,
|
|
3916
|
-
onAfterEdgeReattached: ((s = r.events) == null ? void 0 : s.onAfterEdgeReattached) ??
|
|
3917
|
-
onEdgeReattachInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeReattachInterrupted) ??
|
|
3918
|
-
onEdgeReattachPrevented: ((a = r.events) == null ? void 0 : a.onEdgeReattachPrevented) ??
|
|
3919
|
-
draggingPortDirectionResolver:
|
|
3915
|
+
onAfterEdgeReattached: ((s = r.events) == null ? void 0 : s.onAfterEdgeReattached) ?? P,
|
|
3916
|
+
onEdgeReattachInterrupted: ((n = r.events) == null ? void 0 : n.onEdgeReattachInterrupted) ?? P,
|
|
3917
|
+
onEdgeReattachPrevented: ((a = r.events) == null ? void 0 : a.onEdgeReattachPrevented) ?? P,
|
|
3918
|
+
draggingPortDirectionResolver: _e(
|
|
3920
3919
|
r.dragPortDirection,
|
|
3921
3920
|
e,
|
|
3922
3921
|
o
|
|
3923
3922
|
)
|
|
3924
3923
|
};
|
|
3925
|
-
},
|
|
3924
|
+
}, gr = (r) => ({
|
|
3926
3925
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3927
3926
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3928
|
-
}),
|
|
3927
|
+
}), pr = (r) => {
|
|
3929
3928
|
var e, t;
|
|
3930
3929
|
return {
|
|
3931
|
-
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ??
|
|
3932
|
-
onBeforeNodeAttached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeNodeAttached) ??
|
|
3930
|
+
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? P,
|
|
3931
|
+
onBeforeNodeAttached: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeNodeAttached) ?? P
|
|
3933
3932
|
};
|
|
3934
3933
|
};
|
|
3935
|
-
class
|
|
3934
|
+
class wr extends Error {
|
|
3936
3935
|
constructor() {
|
|
3937
3936
|
super(...arguments);
|
|
3938
3937
|
i(this, "name", "CanvasBuilderError");
|
|
3939
3938
|
}
|
|
3940
3939
|
}
|
|
3941
|
-
class
|
|
3940
|
+
class qe {
|
|
3942
3941
|
constructor(e, t, o) {
|
|
3943
3942
|
i(this, "dt");
|
|
3944
3943
|
i(this, "nodeMass");
|
|
@@ -3971,12 +3970,12 @@ class Je {
|
|
|
3971
3970
|
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(
|
|
3972
3971
|
a,
|
|
3973
3972
|
h
|
|
3974
|
-
),
|
|
3975
|
-
p.x +=
|
|
3973
|
+
), 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);
|
|
3974
|
+
p.x += u, p.y += g, w.x -= u, w.y -= g;
|
|
3976
3975
|
});
|
|
3977
3976
|
}
|
|
3978
3977
|
}
|
|
3979
|
-
class
|
|
3978
|
+
class et {
|
|
3980
3979
|
constructor(e) {
|
|
3981
3980
|
i(this, "PI2", 2 * Math.PI);
|
|
3982
3981
|
this.rand = e;
|
|
@@ -3995,13 +3994,13 @@ class Ke {
|
|
|
3995
3994
|
return { ex: h, ey: d, d: a };
|
|
3996
3995
|
}
|
|
3997
3996
|
}
|
|
3998
|
-
const
|
|
3997
|
+
const tt = (r) => {
|
|
3999
3998
|
if (r.distance === 0)
|
|
4000
3999
|
return r.maxForce;
|
|
4001
4000
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
4002
4001
|
return Math.min(e, r.maxForce);
|
|
4003
4002
|
};
|
|
4004
|
-
class
|
|
4003
|
+
class fr {
|
|
4005
4004
|
constructor(e) {
|
|
4006
4005
|
i(this, "nodeCharge");
|
|
4007
4006
|
i(this, "distanceVectorGenerator");
|
|
@@ -4013,22 +4012,22 @@ class gr {
|
|
|
4013
4012
|
for (let n = 0; n < s; n++) {
|
|
4014
4013
|
const a = o[n];
|
|
4015
4014
|
for (let h = n + 1; h < s; h++) {
|
|
4016
|
-
const d = o[h], c = e.get(a),
|
|
4015
|
+
const d = o[h], c = e.get(a), l = e.get(d), u = this.distanceVectorGenerator.create(
|
|
4017
4016
|
c,
|
|
4018
|
-
|
|
4019
|
-
),
|
|
4017
|
+
l
|
|
4018
|
+
), g = tt({
|
|
4020
4019
|
coefficient: 1,
|
|
4021
4020
|
sourceCharge: this.nodeCharge,
|
|
4022
4021
|
targetCharge: this.nodeCharge,
|
|
4023
|
-
distance:
|
|
4022
|
+
distance: u.d,
|
|
4024
4023
|
maxForce: this.maxForce
|
|
4025
|
-
}), p =
|
|
4026
|
-
|
|
4024
|
+
}), p = g * u.ex, w = g * u.ey, f = t.get(a), y = t.get(d);
|
|
4025
|
+
f.x -= p, f.y -= w, y.x += p, y.y += w;
|
|
4027
4026
|
}
|
|
4028
4027
|
}
|
|
4029
4028
|
}
|
|
4030
4029
|
}
|
|
4031
|
-
const
|
|
4030
|
+
const yr = (r) => {
|
|
4032
4031
|
if (r.size === 0)
|
|
4033
4032
|
return {
|
|
4034
4033
|
centerX: 0,
|
|
@@ -4046,7 +4045,7 @@ const pr = (r) => {
|
|
|
4046
4045
|
radius: h / 2
|
|
4047
4046
|
};
|
|
4048
4047
|
};
|
|
4049
|
-
class
|
|
4048
|
+
class vr {
|
|
4050
4049
|
constructor(e) {
|
|
4051
4050
|
i(this, "root");
|
|
4052
4051
|
i(this, "leaves", /* @__PURE__ */ new Map());
|
|
@@ -4100,19 +4099,19 @@ class wr {
|
|
|
4100
4099
|
return this.setLeaf(e), [];
|
|
4101
4100
|
this.sortedParentNodes.push(e);
|
|
4102
4101
|
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = s / 2;
|
|
4103
|
-
e.nodeIds.forEach((
|
|
4104
|
-
const { x: p, y: w } = this.coords.get(
|
|
4105
|
-
p < t ? w < o ? d.add(
|
|
4102
|
+
e.nodeIds.forEach((g) => {
|
|
4103
|
+
const { x: p, y: w } = this.coords.get(g);
|
|
4104
|
+
p < t ? w < o ? d.add(g) : h.add(g) : w < o ? a.add(g) : n.add(g), e.nodeIds.delete(g);
|
|
4106
4105
|
});
|
|
4107
|
-
const
|
|
4106
|
+
const l = {
|
|
4108
4107
|
parent: e,
|
|
4109
4108
|
lb: null,
|
|
4110
4109
|
lt: null,
|
|
4111
4110
|
rb: null,
|
|
4112
4111
|
rt: null
|
|
4113
|
-
},
|
|
4112
|
+
}, u = [];
|
|
4114
4113
|
if (n.size > 0) {
|
|
4115
|
-
const
|
|
4114
|
+
const g = {
|
|
4116
4115
|
nodeIds: n,
|
|
4117
4116
|
totalMass: 0,
|
|
4118
4117
|
totalCharge: 0,
|
|
@@ -4125,12 +4124,12 @@ class wr {
|
|
|
4125
4124
|
centerY: o + c,
|
|
4126
4125
|
radius: c
|
|
4127
4126
|
},
|
|
4128
|
-
...
|
|
4127
|
+
...l
|
|
4129
4128
|
};
|
|
4130
|
-
e.rt =
|
|
4129
|
+
e.rt = g, u.push(g);
|
|
4131
4130
|
}
|
|
4132
4131
|
if (a.size > 0) {
|
|
4133
|
-
const
|
|
4132
|
+
const g = {
|
|
4134
4133
|
nodeIds: a,
|
|
4135
4134
|
totalMass: 0,
|
|
4136
4135
|
totalCharge: 0,
|
|
@@ -4143,12 +4142,12 @@ class wr {
|
|
|
4143
4142
|
centerY: o - c,
|
|
4144
4143
|
radius: c
|
|
4145
4144
|
},
|
|
4146
|
-
...
|
|
4145
|
+
...l
|
|
4147
4146
|
};
|
|
4148
|
-
e.rb =
|
|
4147
|
+
e.rb = g, u.push(g);
|
|
4149
4148
|
}
|
|
4150
4149
|
if (h.size > 0) {
|
|
4151
|
-
const
|
|
4150
|
+
const g = {
|
|
4152
4151
|
nodeIds: h,
|
|
4153
4152
|
totalMass: 0,
|
|
4154
4153
|
totalCharge: 0,
|
|
@@ -4161,12 +4160,12 @@ class wr {
|
|
|
4161
4160
|
centerY: o + c,
|
|
4162
4161
|
radius: c
|
|
4163
4162
|
},
|
|
4164
|
-
...
|
|
4163
|
+
...l
|
|
4165
4164
|
};
|
|
4166
|
-
e.lt =
|
|
4165
|
+
e.lt = g, u.push(g);
|
|
4167
4166
|
}
|
|
4168
4167
|
if (d.size > 0) {
|
|
4169
|
-
const
|
|
4168
|
+
const g = {
|
|
4170
4169
|
nodeIds: d,
|
|
4171
4170
|
totalMass: 0,
|
|
4172
4171
|
totalCharge: 0,
|
|
@@ -4179,11 +4178,11 @@ class wr {
|
|
|
4179
4178
|
centerY: o - c,
|
|
4180
4179
|
radius: c
|
|
4181
4180
|
},
|
|
4182
|
-
...
|
|
4181
|
+
...l
|
|
4183
4182
|
};
|
|
4184
|
-
e.lb =
|
|
4183
|
+
e.lb = g, u.push(g);
|
|
4185
4184
|
}
|
|
4186
|
-
return
|
|
4185
|
+
return u;
|
|
4187
4186
|
}
|
|
4188
4187
|
setLeaf(e) {
|
|
4189
4188
|
e.totalMass = this.nodeMass * e.nodeIds.size, e.totalCharge = this.nodeCharge * e.nodeIds.size, e.chargeCenter = this.calculateLeafChargeCenter(e.nodeIds), e.nodeIds.forEach((t) => {
|
|
@@ -4203,7 +4202,7 @@ class wr {
|
|
|
4203
4202
|
}), { x: t / e.size, y: o / e.size };
|
|
4204
4203
|
}
|
|
4205
4204
|
}
|
|
4206
|
-
class
|
|
4205
|
+
class mr {
|
|
4207
4206
|
constructor(e) {
|
|
4208
4207
|
i(this, "areaRadiusThreshold");
|
|
4209
4208
|
i(this, "nodeMass");
|
|
@@ -4215,7 +4214,7 @@ class yr {
|
|
|
4215
4214
|
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;
|
|
4216
4215
|
}
|
|
4217
4216
|
apply(e, t) {
|
|
4218
|
-
const o =
|
|
4217
|
+
const o = yr(e), s = new vr({
|
|
4219
4218
|
box: o,
|
|
4220
4219
|
coords: e,
|
|
4221
4220
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
@@ -4330,7 +4329,7 @@ class yr {
|
|
|
4330
4329
|
const t = this.distanceVectorGenerator.create(
|
|
4331
4330
|
e.sourceCoords,
|
|
4332
4331
|
e.targetCoords
|
|
4333
|
-
), o =
|
|
4332
|
+
), o = tt({
|
|
4334
4333
|
coefficient: this.nodeForceCoefficient,
|
|
4335
4334
|
sourceCharge: e.sourceCharge,
|
|
4336
4335
|
targetCharge: e.targetCharge,
|
|
@@ -4365,7 +4364,7 @@ class yr {
|
|
|
4365
4364
|
}
|
|
4366
4365
|
}
|
|
4367
4366
|
}
|
|
4368
|
-
const
|
|
4367
|
+
const rt = (r) => r.theta !== 0 ? new mr({
|
|
4369
4368
|
nodeCharge: r.nodeCharge,
|
|
4370
4369
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
4371
4370
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -4373,13 +4372,13 @@ const Ze = (r) => r.theta !== 0 ? new yr({
|
|
|
4373
4372
|
theta: r.theta,
|
|
4374
4373
|
nodeMass: r.nodeMass,
|
|
4375
4374
|
areaRadiusThreshold: r.areaRadiusThreshold
|
|
4376
|
-
}) : new
|
|
4375
|
+
}) : new fr({
|
|
4377
4376
|
nodeCharge: r.nodeCharge,
|
|
4378
4377
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
4379
4378
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
4380
4379
|
maxForce: r.maxForce
|
|
4381
4380
|
});
|
|
4382
|
-
class
|
|
4381
|
+
class ot {
|
|
4383
4382
|
constructor(e) {
|
|
4384
4383
|
i(this, "rand");
|
|
4385
4384
|
i(this, "sparsity");
|
|
@@ -4387,22 +4386,22 @@ class _e {
|
|
|
4387
4386
|
}
|
|
4388
4387
|
calculateCoordinates(e) {
|
|
4389
4388
|
const { graph: t, viewport: o } = e, s = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((w) => {
|
|
4390
|
-
const
|
|
4391
|
-
return
|
|
4392
|
-
}), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = o.getDimensions(), c = { x: h / 2, y: d / 2 },
|
|
4393
|
-
x:
|
|
4394
|
-
y:
|
|
4389
|
+
const f = t.getNode(w);
|
|
4390
|
+
return f.x === null || f.y === null;
|
|
4391
|
+
}), 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 = {
|
|
4392
|
+
x: l.x - u,
|
|
4393
|
+
y: l.y - u
|
|
4395
4394
|
};
|
|
4396
4395
|
return t.getAllNodeIds().forEach((w) => {
|
|
4397
|
-
const
|
|
4396
|
+
const f = t.getNode(w);
|
|
4398
4397
|
s.set(w, {
|
|
4399
|
-
x:
|
|
4400
|
-
y:
|
|
4398
|
+
x: f.x ?? g.x + a * this.rand(),
|
|
4399
|
+
y: f.y ?? g.y + a * this.rand()
|
|
4401
4400
|
});
|
|
4402
4401
|
}), s;
|
|
4403
4402
|
}
|
|
4404
4403
|
}
|
|
4405
|
-
class
|
|
4404
|
+
class Er {
|
|
4406
4405
|
constructor(e) {
|
|
4407
4406
|
i(this, "distanceVectorGenerator");
|
|
4408
4407
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4413,7 +4412,7 @@ class fr {
|
|
|
4413
4412
|
i(this, "edgeEquilibriumLength");
|
|
4414
4413
|
i(this, "edgeStiffness");
|
|
4415
4414
|
i(this, "convergenceVelocity");
|
|
4416
|
-
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
|
|
4415
|
+
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 et(e.rand), this.nodeForcesApplicationStrategy = rt({
|
|
4417
4416
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4418
4417
|
nodeCharge: e.nodeCharge,
|
|
4419
4418
|
maxForce: e.maxForce,
|
|
@@ -4421,7 +4420,7 @@ class fr {
|
|
|
4421
4420
|
theta: e.barnesHutTheta,
|
|
4422
4421
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4423
4422
|
nodeMass: e.nodeMass
|
|
4424
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4423
|
+
}), this.fillerLayoutAlgorithm = new ot({
|
|
4425
4424
|
rand: e.rand,
|
|
4426
4425
|
sparsity: e.edgeEquilibriumLength
|
|
4427
4426
|
});
|
|
@@ -4431,7 +4430,7 @@ class fr {
|
|
|
4431
4430
|
graph: t,
|
|
4432
4431
|
viewport: o
|
|
4433
4432
|
});
|
|
4434
|
-
for (let n = 0; n < this.maxIterations && !(new
|
|
4433
|
+
for (let n = 0; n < this.maxIterations && !(new qe(
|
|
4435
4434
|
t,
|
|
4436
4435
|
s,
|
|
4437
4436
|
{
|
|
@@ -4447,7 +4446,7 @@ class fr {
|
|
|
4447
4446
|
return s;
|
|
4448
4447
|
}
|
|
4449
4448
|
}
|
|
4450
|
-
class
|
|
4449
|
+
class xr {
|
|
4451
4450
|
constructor(e, t) {
|
|
4452
4451
|
i(this, "forest", /* @__PURE__ */ new Set());
|
|
4453
4452
|
i(this, "remainingNodeIds");
|
|
@@ -4488,7 +4487,7 @@ class vr {
|
|
|
4488
4487
|
}
|
|
4489
4488
|
}
|
|
4490
4489
|
}
|
|
4491
|
-
class
|
|
4490
|
+
class Ar {
|
|
4492
4491
|
constructor(e) {
|
|
4493
4492
|
this.params = e;
|
|
4494
4493
|
}
|
|
@@ -4496,17 +4495,17 @@ class mr {
|
|
|
4496
4495
|
let t = 0;
|
|
4497
4496
|
const o = [], s = e.length - 1, n = [];
|
|
4498
4497
|
e.forEach((h, d) => {
|
|
4499
|
-
if (t += this.params.spaceAroundRadius, h.forEach((c,
|
|
4500
|
-
n[
|
|
4498
|
+
if (t += this.params.spaceAroundRadius, h.forEach((c, l) => {
|
|
4499
|
+
n[l] === void 0 ? n[l] = {
|
|
4501
4500
|
start: t + c.start,
|
|
4502
4501
|
end: t + c.end
|
|
4503
|
-
} : n[
|
|
4502
|
+
} : n[l].end = t + c.end;
|
|
4504
4503
|
}), o.push(t), d !== s) {
|
|
4505
|
-
const c = e[d + 1],
|
|
4506
|
-
start:
|
|
4507
|
-
end:
|
|
4504
|
+
const c = e[d + 1], l = n.map((u) => ({
|
|
4505
|
+
start: u.start - t,
|
|
4506
|
+
end: u.end - t
|
|
4508
4507
|
}));
|
|
4509
|
-
t += this.calculateMaxDiff(
|
|
4508
|
+
t += this.calculateMaxDiff(l, c);
|
|
4510
4509
|
}
|
|
4511
4510
|
t += this.params.spaceAroundRadius;
|
|
4512
4511
|
});
|
|
@@ -4529,12 +4528,12 @@ class mr {
|
|
|
4529
4528
|
return o - 2 * this.params.spaceAroundRadius;
|
|
4530
4529
|
}
|
|
4531
4530
|
}
|
|
4532
|
-
class
|
|
4531
|
+
class Sr {
|
|
4533
4532
|
constructor(e, t) {
|
|
4534
4533
|
i(this, "offsets", /* @__PURE__ */ new Map());
|
|
4535
4534
|
i(this, "treeSpans", /* @__PURE__ */ new Map());
|
|
4536
4535
|
this.tree = e;
|
|
4537
|
-
const o = t.spaceAroundRadius, s = new
|
|
4536
|
+
const o = t.spaceAroundRadius, s = new Ar({
|
|
4538
4537
|
spaceAroundRadius: o
|
|
4539
4538
|
});
|
|
4540
4539
|
[...this.tree.sequence].reverse().forEach((n) => {
|
|
@@ -4556,40 +4555,40 @@ class xr {
|
|
|
4556
4555
|
return this.offsets;
|
|
4557
4556
|
}
|
|
4558
4557
|
}
|
|
4559
|
-
class
|
|
4558
|
+
class br {
|
|
4560
4559
|
constructor(e) {
|
|
4561
4560
|
this.params = e;
|
|
4562
4561
|
}
|
|
4563
4562
|
calculateCoordinates(e) {
|
|
4564
|
-
const t = /* @__PURE__ */ new Map(), s = new
|
|
4563
|
+
const t = /* @__PURE__ */ new Map(), s = new xr(
|
|
4565
4564
|
e.graph,
|
|
4566
4565
|
this.params.nextLayerNodesResolver
|
|
4567
4566
|
).generate();
|
|
4568
4567
|
let n = 0;
|
|
4569
4568
|
return s.forEach((a) => {
|
|
4570
4569
|
t.set(a.root.nodeId, { x: n, y: 0 });
|
|
4571
|
-
const d = new
|
|
4570
|
+
const d = new Sr(a, {
|
|
4572
4571
|
spaceAroundRadius: this.params.layerSpace / 2
|
|
4573
4572
|
}).generate();
|
|
4574
4573
|
let c = [a.root];
|
|
4575
4574
|
for (; c.length > 0; ) {
|
|
4576
|
-
const
|
|
4577
|
-
n += this.params.layerWidth, c.forEach((
|
|
4578
|
-
|
|
4579
|
-
const p = t.get(
|
|
4580
|
-
t.set(
|
|
4581
|
-
y: p + d.get(
|
|
4575
|
+
const l = [];
|
|
4576
|
+
n += this.params.layerWidth, c.forEach((u) => {
|
|
4577
|
+
u.children.forEach((g) => {
|
|
4578
|
+
const p = t.get(u.nodeId).y;
|
|
4579
|
+
t.set(g.nodeId, {
|
|
4580
|
+
y: p + d.get(g.nodeId),
|
|
4582
4581
|
x: n
|
|
4583
|
-
}),
|
|
4582
|
+
}), l.push(g);
|
|
4584
4583
|
});
|
|
4585
|
-
}), c =
|
|
4584
|
+
}), c = l;
|
|
4586
4585
|
}
|
|
4587
4586
|
}), t.forEach((a, h) => {
|
|
4588
4587
|
t.set(h, this.params.transform(a));
|
|
4589
4588
|
}), t;
|
|
4590
4589
|
}
|
|
4591
4590
|
}
|
|
4592
|
-
const
|
|
4591
|
+
const Pr = (r) => {
|
|
4593
4592
|
const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((n) => {
|
|
4594
4593
|
const a = e.getEdge(n);
|
|
4595
4594
|
return e.getPort(a.to).nodeId;
|
|
@@ -4598,20 +4597,20 @@ const Ar = (r) => {
|
|
|
4598
4597
|
return e.getPort(a.from).nodeId;
|
|
4599
4598
|
});
|
|
4600
4599
|
return /* @__PURE__ */ new Set([...o, ...s]);
|
|
4601
|
-
},
|
|
4600
|
+
}, Nr = (r) => {
|
|
4602
4601
|
const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((s) => {
|
|
4603
4602
|
const n = e.getEdge(s);
|
|
4604
4603
|
return e.getPort(n.to).nodeId;
|
|
4605
4604
|
});
|
|
4606
4605
|
return new Set(o);
|
|
4607
|
-
},
|
|
4606
|
+
}, Cr = (r) => {
|
|
4608
4607
|
const { graph: e, currentNodeId: t } = r, o = e.getNodeIncomingEdgeIds(t).map((s) => {
|
|
4609
4608
|
const n = e.getEdge(s);
|
|
4610
4609
|
return e.getPort(n.from).nodeId;
|
|
4611
4610
|
});
|
|
4612
4611
|
return new Set(o);
|
|
4613
4612
|
};
|
|
4614
|
-
class
|
|
4613
|
+
class Tr {
|
|
4615
4614
|
constructor(e) {
|
|
4616
4615
|
i(this, "distanceVectorGenerator");
|
|
4617
4616
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4621,7 +4620,7 @@ class Nr {
|
|
|
4621
4620
|
i(this, "edgeEquilibriumLength");
|
|
4622
4621
|
i(this, "edgeStiffness");
|
|
4623
4622
|
i(this, "fillerLayoutAlgorithm");
|
|
4624
|
-
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new
|
|
4623
|
+
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new et(e.rand), this.nodeForcesApplicationStrategy = rt({
|
|
4625
4624
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4626
4625
|
nodeCharge: e.nodeCharge,
|
|
4627
4626
|
maxForce: e.maxForce,
|
|
@@ -4629,7 +4628,7 @@ class Nr {
|
|
|
4629
4628
|
theta: e.barnesHutTheta,
|
|
4630
4629
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4631
4630
|
nodeMass: e.nodeMass
|
|
4632
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4631
|
+
}), this.fillerLayoutAlgorithm = new ot({
|
|
4633
4632
|
rand: e.rand,
|
|
4634
4633
|
sparsity: e.edgeEquilibriumLength
|
|
4635
4634
|
});
|
|
@@ -4639,7 +4638,7 @@ class Nr {
|
|
|
4639
4638
|
graph: t,
|
|
4640
4639
|
viewport: o
|
|
4641
4640
|
});
|
|
4642
|
-
return new
|
|
4641
|
+
return new qe(
|
|
4643
4642
|
t,
|
|
4644
4643
|
n,
|
|
4645
4644
|
{
|
|
@@ -4651,34 +4650,35 @@ class Nr {
|
|
|
4651
4650
|
edgeStiffness: this.edgeStiffness
|
|
4652
4651
|
}
|
|
4653
4652
|
).apply() < this.convergenceVelocity && !t.getAllNodeIds().some((c) => {
|
|
4654
|
-
const
|
|
4655
|
-
return
|
|
4653
|
+
const l = t.getNode(c);
|
|
4654
|
+
return l.x === null || l.y === null;
|
|
4656
4655
|
}) ? /* @__PURE__ */ new Map() : n;
|
|
4657
4656
|
}
|
|
4658
4657
|
}
|
|
4659
|
-
const
|
|
4658
|
+
const st = (r) => {
|
|
4660
4659
|
let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
|
|
4661
4660
|
for (let n = 0, a; n < r.length; n++)
|
|
4662
4661
|
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);
|
|
4663
4662
|
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];
|
|
4664
|
-
},
|
|
4663
|
+
}, it = (r, e, t, o) => function() {
|
|
4665
4664
|
r |= 0, e |= 0, t |= 0, o |= 0;
|
|
4666
4665
|
const s = (r + e | 0) + o | 0;
|
|
4667
4666
|
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;
|
|
4668
|
-
},
|
|
4667
|
+
}, Mr = (r) => {
|
|
4669
4668
|
var e, t;
|
|
4670
4669
|
switch (r == null ? void 0 : r.type) {
|
|
4671
4670
|
case "custom":
|
|
4672
4671
|
return r.instance;
|
|
4673
4672
|
default: {
|
|
4674
|
-
const o =
|
|
4675
|
-
return new
|
|
4673
|
+
const o = st((r == null ? void 0 : r.seed) ?? b.seed), s = it(o[0], o[1], o[2], o[3]);
|
|
4674
|
+
return new Tr({
|
|
4676
4675
|
rand: s,
|
|
4677
4676
|
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? b.maxTimeDeltaSec,
|
|
4678
4677
|
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? b.nodeCharge,
|
|
4679
4678
|
nodeMass: (r == null ? void 0 : r.nodeMass) ?? b.nodeMass,
|
|
4680
4679
|
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? b.edgeEquilibriumLength,
|
|
4681
4680
|
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? b.edgeStiffness,
|
|
4681
|
+
// TODO: rename no `minVelocity`
|
|
4682
4682
|
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? b.convergenceVelocity,
|
|
4683
4683
|
maxForce: (r == null ? void 0 : r.maxForce) ?? b.maxForce,
|
|
4684
4684
|
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? b.nodeForceCoefficient,
|
|
@@ -4687,25 +4687,28 @@ const qe = (r) => {
|
|
|
4687
4687
|
});
|
|
4688
4688
|
}
|
|
4689
4689
|
}
|
|
4690
|
-
},
|
|
4690
|
+
}, Dr = {
|
|
4691
4691
|
staticNodeResolver: () => !1
|
|
4692
|
-
},
|
|
4692
|
+
}, Rr = (r) => {
|
|
4693
4693
|
var t, o;
|
|
4694
4694
|
return {
|
|
4695
|
-
algorithm:
|
|
4696
|
-
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ??
|
|
4697
|
-
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ??
|
|
4698
|
-
onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ??
|
|
4695
|
+
algorithm: Mr((r == null ? void 0 : r.algorithm) ?? {}),
|
|
4696
|
+
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Dr.staticNodeResolver,
|
|
4697
|
+
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? P,
|
|
4698
|
+
onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? P
|
|
4699
4699
|
};
|
|
4700
|
-
},
|
|
4700
|
+
}, Lr = (r) => r instanceof q ? {
|
|
4701
4701
|
type: "trigger",
|
|
4702
4702
|
trigger: r
|
|
4703
|
+
} : r === "topologyChangeMicrotask" ? {
|
|
4704
|
+
type: "topologyChangeSchedule",
|
|
4705
|
+
schedule: Ce
|
|
4703
4706
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
4704
4707
|
type: "topologyChangeSchedule",
|
|
4705
|
-
schedule:
|
|
4708
|
+
schedule: Xt
|
|
4706
4709
|
} : {
|
|
4707
4710
|
type: "topologyChangeSchedule",
|
|
4708
|
-
schedule:
|
|
4711
|
+
schedule: Ce
|
|
4709
4712
|
}, Z = Object.freeze({
|
|
4710
4713
|
staticNodeResolver: () => !1,
|
|
4711
4714
|
hierarchicalLayout: {
|
|
@@ -4719,7 +4722,7 @@ const qe = (r) => {
|
|
|
4719
4722
|
d: r.d * e.a + r.e * e.d,
|
|
4720
4723
|
e: r.d * e.b + r.e * e.e,
|
|
4721
4724
|
f: r.d * e.c + r.e * e.f + r.f
|
|
4722
|
-
}),
|
|
4725
|
+
}), Vr = (r) => {
|
|
4723
4726
|
const { a: e, b: t, c: o, d: s, e: n, f: a } = r, h = e * n - t * s;
|
|
4724
4727
|
return {
|
|
4725
4728
|
a: n / h,
|
|
@@ -4730,7 +4733,7 @@ const qe = (r) => {
|
|
|
4730
4733
|
f: (o * s - e * a) / h
|
|
4731
4734
|
};
|
|
4732
4735
|
};
|
|
4733
|
-
class
|
|
4736
|
+
class Ir {
|
|
4734
4737
|
resolve(e) {
|
|
4735
4738
|
if ("shift" in e)
|
|
4736
4739
|
return this.createShiftBaseMatrix(e.shift);
|
|
@@ -4774,7 +4777,7 @@ class Rr {
|
|
|
4774
4777
|
const o = k(
|
|
4775
4778
|
t,
|
|
4776
4779
|
e
|
|
4777
|
-
), s =
|
|
4780
|
+
), s = Vr(t);
|
|
4778
4781
|
return k(o, s);
|
|
4779
4782
|
}
|
|
4780
4783
|
createShiftBaseMatrix(e) {
|
|
@@ -4819,7 +4822,7 @@ class Rr {
|
|
|
4819
4822
|
};
|
|
4820
4823
|
}
|
|
4821
4824
|
}
|
|
4822
|
-
const
|
|
4825
|
+
const Fr = (r) => {
|
|
4823
4826
|
if (r === void 0)
|
|
4824
4827
|
return (s) => s;
|
|
4825
4828
|
if (typeof r == "function")
|
|
@@ -4833,7 +4836,7 @@ const Lr = (r) => {
|
|
|
4833
4836
|
e: 1,
|
|
4834
4837
|
f: 0
|
|
4835
4838
|
};
|
|
4836
|
-
const o = new
|
|
4839
|
+
const o = new Ir();
|
|
4837
4840
|
return e.forEach((s) => {
|
|
4838
4841
|
const n = o.resolve(s);
|
|
4839
4842
|
t = k(t, n);
|
|
@@ -4844,34 +4847,34 @@ const Lr = (r) => {
|
|
|
4844
4847
|
y: t.d * n + t.e * a + t.f
|
|
4845
4848
|
};
|
|
4846
4849
|
};
|
|
4847
|
-
},
|
|
4850
|
+
}, Ur = (r) => {
|
|
4848
4851
|
if (typeof r == "function")
|
|
4849
4852
|
return r;
|
|
4850
4853
|
switch (r) {
|
|
4851
4854
|
case "outgoing":
|
|
4852
|
-
return
|
|
4855
|
+
return Nr;
|
|
4853
4856
|
case "incoming":
|
|
4854
|
-
return
|
|
4857
|
+
return Cr;
|
|
4855
4858
|
default:
|
|
4856
|
-
return
|
|
4859
|
+
return Pr;
|
|
4857
4860
|
}
|
|
4858
|
-
},
|
|
4861
|
+
}, $r = (r) => {
|
|
4859
4862
|
var e, t;
|
|
4860
4863
|
switch (r == null ? void 0 : r.type) {
|
|
4861
4864
|
case "custom":
|
|
4862
4865
|
return r.instance;
|
|
4863
4866
|
case "hierarchical":
|
|
4864
|
-
return new
|
|
4867
|
+
return new br({
|
|
4865
4868
|
layerWidth: r.layerWidth ?? Z.hierarchicalLayout.layerWidth,
|
|
4866
4869
|
layerSpace: r.layerSpace ?? Z.hierarchicalLayout.layerSpace,
|
|
4867
|
-
transform:
|
|
4868
|
-
nextLayerNodesResolver:
|
|
4870
|
+
transform: Fr(r.transform),
|
|
4871
|
+
nextLayerNodesResolver: Ur(
|
|
4869
4872
|
r.nextLayerNodesResolver
|
|
4870
4873
|
)
|
|
4871
4874
|
});
|
|
4872
4875
|
default: {
|
|
4873
|
-
const o =
|
|
4874
|
-
return new
|
|
4876
|
+
const o = st((r == null ? void 0 : r.seed) ?? b.seed), s = it(o[0], o[1], o[2], o[3]);
|
|
4877
|
+
return new Er({
|
|
4875
4878
|
dtSec: (r == null ? void 0 : r.dtSec) ?? b.dtSec,
|
|
4876
4879
|
maxIterations: (r == null ? void 0 : r.maxIterations) ?? b.maxIterations,
|
|
4877
4880
|
rand: s,
|
|
@@ -4887,16 +4890,16 @@ const Lr = (r) => {
|
|
|
4887
4890
|
});
|
|
4888
4891
|
}
|
|
4889
4892
|
}
|
|
4890
|
-
},
|
|
4893
|
+
}, Br = (r) => {
|
|
4891
4894
|
var e, t;
|
|
4892
4895
|
return {
|
|
4893
|
-
algorithm:
|
|
4894
|
-
applyOn:
|
|
4896
|
+
algorithm: $r(r.algorithm),
|
|
4897
|
+
applyOn: Lr(r.applyOn),
|
|
4895
4898
|
staticNodeResolver: r.staticNodeResolver ?? Z.staticNodeResolver,
|
|
4896
|
-
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ??
|
|
4897
|
-
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ??
|
|
4899
|
+
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? P,
|
|
4900
|
+
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? P
|
|
4898
4901
|
};
|
|
4899
|
-
},
|
|
4902
|
+
}, Or = (r, e) => ({
|
|
4900
4903
|
...r,
|
|
4901
4904
|
onNodeDragStarted: (t) => {
|
|
4902
4905
|
e.add(t), r.onNodeDragStarted(t);
|
|
@@ -4904,7 +4907,7 @@ const Lr = (r) => {
|
|
|
4904
4907
|
onNodeDragFinished: (t) => {
|
|
4905
4908
|
e.delete(t), r.onNodeDragFinished(t);
|
|
4906
4909
|
}
|
|
4907
|
-
}),
|
|
4910
|
+
}), Wr = (r, e) => {
|
|
4908
4911
|
r.graph.onBeforeNodeRemoved.subscribe((t) => {
|
|
4909
4912
|
e.delete(t);
|
|
4910
4913
|
}), r.graph.onBeforeClear.subscribe(() => {
|
|
@@ -4912,28 +4915,28 @@ const Lr = (r) => {
|
|
|
4912
4915
|
}), r.onBeforeDestroy.subscribe(() => {
|
|
4913
4916
|
e.clear();
|
|
4914
4917
|
});
|
|
4915
|
-
},
|
|
4918
|
+
}, zr = (r, e) => ({
|
|
4916
4919
|
...r,
|
|
4917
4920
|
staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
|
|
4918
|
-
}), _ = (r) => () => r,
|
|
4921
|
+
}), _ = (r) => () => r, Le = _(0), kr = () => {
|
|
4919
4922
|
let r = 0;
|
|
4920
4923
|
return () => r++;
|
|
4921
|
-
},
|
|
4922
|
-
let t =
|
|
4923
|
-
const s =
|
|
4924
|
+
}, Hr = (r, e) => {
|
|
4925
|
+
let t = Le, o = Le;
|
|
4926
|
+
const s = kr();
|
|
4924
4927
|
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), {
|
|
4925
4928
|
nodesPriorityFn: t,
|
|
4926
4929
|
edgesPriorityFn: o
|
|
4927
4930
|
};
|
|
4928
|
-
},
|
|
4931
|
+
}, Yr = (r) => {
|
|
4929
4932
|
var t, o, s, n, a;
|
|
4930
|
-
const e =
|
|
4933
|
+
const e = Hr(
|
|
4931
4934
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
4932
4935
|
(o = r.edges) == null ? void 0 : o.priority
|
|
4933
4936
|
);
|
|
4934
4937
|
return {
|
|
4935
4938
|
nodes: {
|
|
4936
|
-
centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ??
|
|
4939
|
+
centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? Be,
|
|
4937
4940
|
priorityFn: e.nodesPriorityFn
|
|
4938
4941
|
},
|
|
4939
4942
|
ports: {
|
|
@@ -4944,9 +4947,9 @@ const Lr = (r) => {
|
|
|
4944
4947
|
priorityFn: e.edgesPriorityFn
|
|
4945
4948
|
}
|
|
4946
4949
|
};
|
|
4947
|
-
},
|
|
4950
|
+
}, Xr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : oe, Gr = (r) => {
|
|
4948
4951
|
var o, s, n, a;
|
|
4949
|
-
const { canvasDefaults: e } = r, t = r.hasLayout ?
|
|
4952
|
+
const { canvasDefaults: e } = r, t = r.hasLayout ? Xr(r.layoutParams) : oe;
|
|
4950
4953
|
return {
|
|
4951
4954
|
focus: {
|
|
4952
4955
|
contentPadding: ((o = e.focus) == null ? void 0 : o.contentPadding) ?? ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
|
|
@@ -4955,23 +4958,23 @@ const Lr = (r) => {
|
|
|
4955
4958
|
animationDuration: ((a = e.focus) == null ? void 0 : a.animationDuration) ?? 0
|
|
4956
4959
|
}
|
|
4957
4960
|
};
|
|
4958
|
-
},
|
|
4961
|
+
}, jr = (r) => ({
|
|
4959
4962
|
onNodeSelected: r.onNodeSelected,
|
|
4960
4963
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
|
|
4961
4964
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
|
|
4962
4965
|
movementThreshold: r.movementThreshold ?? L.movementThreshold
|
|
4963
|
-
}),
|
|
4966
|
+
}), Jr = (r) => ({
|
|
4964
4967
|
onCanvasSelected: r.onCanvasSelected,
|
|
4965
4968
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
|
|
4966
4969
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
|
|
4967
4970
|
movementThreshold: r.movementThreshold ?? L.movementThreshold
|
|
4968
|
-
}),
|
|
4971
|
+
}), Kr = (r) => ({
|
|
4969
4972
|
onEdgeSelected: r.onEdgeSelected,
|
|
4970
4973
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? L.mouseDownEventVerifier,
|
|
4971
4974
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? L.mouseUpEventVerifier,
|
|
4972
4975
|
movementThreshold: r.movementThreshold ?? L.movementThreshold
|
|
4973
4976
|
});
|
|
4974
|
-
class
|
|
4977
|
+
class _r {
|
|
4975
4978
|
constructor(e) {
|
|
4976
4979
|
i(this, "used", !1);
|
|
4977
4980
|
i(this, "canvasDefaults", {});
|
|
@@ -4998,8 +5001,8 @@ class Kr {
|
|
|
4998
5001
|
i(this, "window", window);
|
|
4999
5002
|
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
5000
5003
|
i(this, "pointInsideVerifier");
|
|
5001
|
-
i(this, "eventTagger", new
|
|
5002
|
-
this.element = e, this.pointInsideVerifier = new
|
|
5004
|
+
i(this, "eventTagger", new jt());
|
|
5005
|
+
this.element = e, this.pointInsideVerifier = new mt(e, this.window);
|
|
5003
5006
|
}
|
|
5004
5007
|
setDefaults(e) {
|
|
5005
5008
|
return this.canvasDefaults = e, this;
|
|
@@ -5042,45 +5045,45 @@ class Kr {
|
|
|
5042
5045
|
}
|
|
5043
5046
|
build() {
|
|
5044
5047
|
if (this.used)
|
|
5045
|
-
throw new
|
|
5048
|
+
throw new wr(
|
|
5046
5049
|
"Failed to build Canvas because CanvasBuilder is a single-use object"
|
|
5047
5050
|
);
|
|
5048
5051
|
this.used = !0;
|
|
5049
|
-
const e = new
|
|
5052
|
+
const e = new ft(this.element), t = new Fe(), o = new or(this.element), s = this.createHtmlView(
|
|
5050
5053
|
o.main,
|
|
5051
5054
|
t,
|
|
5052
5055
|
e
|
|
5053
|
-
), n =
|
|
5056
|
+
), n = Yr(
|
|
5054
5057
|
this.canvasDefaults
|
|
5055
|
-
), a = new
|
|
5058
|
+
), a = new Ge(
|
|
5056
5059
|
t,
|
|
5057
5060
|
s,
|
|
5058
5061
|
n
|
|
5059
|
-
), h =
|
|
5062
|
+
), h = Br(this.layoutConfig), d = Gr({
|
|
5060
5063
|
canvasDefaults: this.canvasDefaults,
|
|
5061
5064
|
hasLayout: this.hasLayout,
|
|
5062
5065
|
layoutParams: h
|
|
5063
|
-
}), c = new
|
|
5066
|
+
}), c = new Qe(
|
|
5064
5067
|
t,
|
|
5065
5068
|
e,
|
|
5066
5069
|
d,
|
|
5067
5070
|
this.window
|
|
5068
|
-
),
|
|
5069
|
-
g,
|
|
5071
|
+
), l = new je(e), u = new Xe(t), g = new Ie(
|
|
5070
5072
|
u,
|
|
5073
|
+
l,
|
|
5071
5074
|
a,
|
|
5072
5075
|
c
|
|
5073
5076
|
);
|
|
5074
5077
|
if (this.hasBackground && de.configure(
|
|
5075
|
-
|
|
5076
|
-
|
|
5078
|
+
g,
|
|
5079
|
+
cr(this.backgroundConfig),
|
|
5077
5080
|
o.background
|
|
5078
|
-
), this.hasNodeResizeReactiveEdges && ee.configure(
|
|
5079
|
-
const p =
|
|
5081
|
+
), this.hasNodeResizeReactiveEdges && ee.configure(g), this.userSelectableEdgesConfig !== void 0) {
|
|
5082
|
+
const p = Kr(
|
|
5080
5083
|
this.userSelectableEdgesConfig
|
|
5081
5084
|
);
|
|
5082
|
-
|
|
5083
|
-
|
|
5085
|
+
fe.configure(
|
|
5086
|
+
g,
|
|
5084
5087
|
this.window,
|
|
5085
5088
|
this.pointInsideVerifier,
|
|
5086
5089
|
this.eventTagger,
|
|
@@ -5088,11 +5091,11 @@ class Kr {
|
|
|
5088
5091
|
);
|
|
5089
5092
|
}
|
|
5090
5093
|
if (this.userSelectableNodesConfig !== void 0) {
|
|
5091
|
-
const p =
|
|
5094
|
+
const p = jr(
|
|
5092
5095
|
this.userSelectableNodesConfig
|
|
5093
5096
|
);
|
|
5094
5097
|
we.configure(
|
|
5095
|
-
|
|
5098
|
+
g,
|
|
5096
5099
|
this.window,
|
|
5097
5100
|
this.pointInsideVerifier,
|
|
5098
5101
|
this.eventTagger,
|
|
@@ -5100,11 +5103,11 @@ class Kr {
|
|
|
5100
5103
|
);
|
|
5101
5104
|
}
|
|
5102
5105
|
if (this.userSelectableCanvasConfig !== void 0) {
|
|
5103
|
-
const p =
|
|
5106
|
+
const p = Jr(
|
|
5104
5107
|
this.userSelectableCanvasConfig
|
|
5105
5108
|
);
|
|
5106
|
-
|
|
5107
|
-
|
|
5109
|
+
ye.configure(
|
|
5110
|
+
g,
|
|
5108
5111
|
o.main,
|
|
5109
5112
|
this.window,
|
|
5110
5113
|
this.pointInsideVerifier,
|
|
@@ -5113,12 +5116,12 @@ class Kr {
|
|
|
5113
5116
|
);
|
|
5114
5117
|
}
|
|
5115
5118
|
if (this.hasDraggableNodes) {
|
|
5116
|
-
let p =
|
|
5117
|
-
this.hasAnimatedLayout && (p =
|
|
5119
|
+
let p = sr(this.dragConfig);
|
|
5120
|
+
this.hasAnimatedLayout && (p = Or(
|
|
5118
5121
|
p,
|
|
5119
5122
|
this.animationStaticNodes
|
|
5120
5123
|
)), ae.configure(
|
|
5121
|
-
|
|
5124
|
+
g,
|
|
5122
5125
|
o.main,
|
|
5123
5126
|
this.window,
|
|
5124
5127
|
this.pointInsideVerifier,
|
|
@@ -5126,13 +5129,13 @@ class Kr {
|
|
|
5126
5129
|
);
|
|
5127
5130
|
}
|
|
5128
5131
|
if (this.hasUserConnectablePorts) {
|
|
5129
|
-
const p =
|
|
5132
|
+
const p = lr(
|
|
5130
5133
|
this.connectablePortsConfig,
|
|
5131
5134
|
n.edges.shapeFactory,
|
|
5132
|
-
|
|
5135
|
+
g.graph
|
|
5133
5136
|
);
|
|
5134
5137
|
ce.configure(
|
|
5135
|
-
|
|
5138
|
+
g,
|
|
5136
5139
|
o.overlayConnectablePorts,
|
|
5137
5140
|
e,
|
|
5138
5141
|
this.window,
|
|
@@ -5141,12 +5144,12 @@ class Kr {
|
|
|
5141
5144
|
);
|
|
5142
5145
|
}
|
|
5143
5146
|
if (this.hasUserDraggableEdges) {
|
|
5144
|
-
const p =
|
|
5147
|
+
const p = ur(
|
|
5145
5148
|
this.draggableEdgesConfig,
|
|
5146
|
-
|
|
5149
|
+
g.graph
|
|
5147
5150
|
);
|
|
5148
5151
|
le.configure(
|
|
5149
|
-
|
|
5152
|
+
g,
|
|
5150
5153
|
o.overlayDraggableEdges,
|
|
5151
5154
|
e,
|
|
5152
5155
|
this.window,
|
|
@@ -5155,55 +5158,55 @@ class Kr {
|
|
|
5155
5158
|
);
|
|
5156
5159
|
}
|
|
5157
5160
|
if (this.virtualScrollConfig !== void 0 ? he.configure(
|
|
5158
|
-
|
|
5161
|
+
g,
|
|
5159
5162
|
o.main,
|
|
5160
5163
|
this.window,
|
|
5161
|
-
|
|
5164
|
+
Re(this.transformConfig),
|
|
5162
5165
|
this.boxRenderingTrigger,
|
|
5163
5166
|
this.pointInsideVerifier,
|
|
5164
|
-
|
|
5167
|
+
gr(this.virtualScrollConfig)
|
|
5165
5168
|
) : this.hasTransformableViewport && J.configure(
|
|
5166
|
-
|
|
5169
|
+
g,
|
|
5167
5170
|
o.main,
|
|
5168
5171
|
this.window,
|
|
5169
5172
|
this.pointInsideVerifier,
|
|
5170
|
-
|
|
5171
|
-
), this.hasLayout &&
|
|
5172
|
-
let p =
|
|
5173
|
-
this.hasDraggableNodes && (
|
|
5174
|
-
|
|
5173
|
+
Re(this.transformConfig)
|
|
5174
|
+
), this.hasLayout && qt.configure(g, h), this.hasAnimatedLayout) {
|
|
5175
|
+
let p = Rr(this.animatedLayoutConfig);
|
|
5176
|
+
this.hasDraggableNodes && (Wr(
|
|
5177
|
+
g,
|
|
5175
5178
|
this.animationStaticNodes
|
|
5176
|
-
), p =
|
|
5179
|
+
), p = zr(
|
|
5177
5180
|
p,
|
|
5178
5181
|
this.animationStaticNodes
|
|
5179
|
-
)), pe.configure(
|
|
5182
|
+
)), pe.configure(g, p, this.window);
|
|
5180
5183
|
}
|
|
5181
|
-
return
|
|
5184
|
+
return g.onBeforeDestroy.subscribe(() => {
|
|
5182
5185
|
o.destroy();
|
|
5183
|
-
}),
|
|
5186
|
+
}), g;
|
|
5184
5187
|
}
|
|
5185
5188
|
createHtmlView(e, t, o) {
|
|
5186
|
-
let s = new
|
|
5187
|
-
return this.virtualScrollConfig !== void 0 && (s = new
|
|
5189
|
+
let s = new Ve(t, o, e);
|
|
5190
|
+
return this.virtualScrollConfig !== void 0 && (s = new gt(
|
|
5188
5191
|
s,
|
|
5189
5192
|
t,
|
|
5190
5193
|
this.boxRenderingTrigger,
|
|
5191
|
-
|
|
5192
|
-
)), s = new
|
|
5194
|
+
pr(this.virtualScrollConfig)
|
|
5195
|
+
)), s = new pt(s, t), s;
|
|
5193
5196
|
}
|
|
5194
5197
|
}
|
|
5195
5198
|
export {
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
+
Bt as BezierEdgeShape,
|
|
5200
|
+
_r as CanvasBuilder,
|
|
5201
|
+
wr as CanvasBuilderError,
|
|
5199
5202
|
A as CanvasError,
|
|
5200
5203
|
I as ConnectionCategory,
|
|
5201
|
-
|
|
5204
|
+
He as DirectEdgeShape,
|
|
5202
5205
|
q as EventSubject,
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5206
|
+
Ot as HorizontalEdgeShape,
|
|
5207
|
+
Yt as InteractiveEdgeError,
|
|
5208
|
+
Ye as InteractiveEdgeShape,
|
|
5209
|
+
Zr as MidpointEdgeShape,
|
|
5210
|
+
Wt as StraightEdgeShape,
|
|
5211
|
+
zt as VerticalEdgeShape
|
|
5209
5212
|
};
|