@html-graph/html-graph 8.12.0 → 8.13.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 +11 -0
- package/dist/html-graph.js +467 -416
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r, e, t) =>
|
|
4
|
-
var
|
|
5
|
-
const
|
|
1
|
+
var Qe = Object.defineProperty;
|
|
2
|
+
var Ze = (r, e, t) => e in r ? Qe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => Ze(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
var R = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(R || {});
|
|
5
|
+
const _e = () => {
|
|
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
|
+
}, qe = () => {
|
|
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
|
+
}, et = (r) => {
|
|
12
12
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
13
|
-
},
|
|
13
|
+
}, tt = (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 Ne {
|
|
17
17
|
constructor(e, t, o) {
|
|
18
|
-
i(this, "host",
|
|
19
|
-
i(this, "container",
|
|
18
|
+
i(this, "host", _e());
|
|
19
|
+
i(this, "container", qe());
|
|
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 be {
|
|
|
27
27
|
}
|
|
28
28
|
attachNode(e) {
|
|
29
29
|
const t = this.graphStore.getNode(e);
|
|
30
|
-
|
|
30
|
+
et(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
|
+
tt(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;
|
|
@@ -72,8 +72,8 @@ class be {
|
|
|
72
72
|
h,
|
|
73
73
|
d
|
|
74
74
|
), u = this.createEdgeRenderPort(s, a, h, d);
|
|
75
|
-
let g =
|
|
76
|
-
o.element === s.element ? g =
|
|
75
|
+
let g = R.Line;
|
|
76
|
+
o.element === s.element ? g = R.PortCycle : o.nodeId === s.nodeId && (g = R.NodeCycle), t.payload.shape.render({ from: c, to: u, category: g });
|
|
77
77
|
}
|
|
78
78
|
updateEdgePriority(e) {
|
|
79
79
|
const t = this.graphStore.getEdge(e);
|
|
@@ -93,7 +93,7 @@ class be {
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
class
|
|
96
|
+
class rt {
|
|
97
97
|
constructor(e) {
|
|
98
98
|
i(this, "xFrom", 1 / 0);
|
|
99
99
|
i(this, "yFrom", 1 / 0);
|
|
@@ -113,7 +113,7 @@ class ot {
|
|
|
113
113
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && u >= this.yFrom;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
class
|
|
116
|
+
class ot {
|
|
117
117
|
constructor(e, t, o, s) {
|
|
118
118
|
i(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
119
119
|
i(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -137,7 +137,7 @@ class st {
|
|
|
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 rt(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 st {
|
|
|
191
191
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
class
|
|
194
|
+
class st {
|
|
195
195
|
constructor(e, t) {
|
|
196
196
|
i(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
197
197
|
i(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
@@ -245,7 +245,7 @@ class it {
|
|
|
245
245
|
this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
class
|
|
248
|
+
class _ {
|
|
249
249
|
constructor() {
|
|
250
250
|
i(this, "callbacks", /* @__PURE__ */ new Set());
|
|
251
251
|
}
|
|
@@ -262,10 +262,10 @@ class q {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
const P = () => {
|
|
265
|
-
const r = new
|
|
265
|
+
const r = new _();
|
|
266
266
|
return [r, r];
|
|
267
267
|
};
|
|
268
|
-
class
|
|
268
|
+
class be {
|
|
269
269
|
constructor(e, t, o, s) {
|
|
270
270
|
i(this, "beforeDestroyEmitter");
|
|
271
271
|
i(this, "destroyed", !1);
|
|
@@ -318,7 +318,7 @@ class Pe {
|
|
|
318
318
|
this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
class
|
|
321
|
+
class it {
|
|
322
322
|
constructor() {
|
|
323
323
|
i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
324
324
|
i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -386,7 +386,7 @@ const N = Object.freeze({
|
|
|
386
386
|
removeNonexistentEdge: (r) => `Failed to remove edge with ID ${JSON.stringify(r)} because it does not exist`,
|
|
387
387
|
accessEdgesForNonexistentPort: (r) => `Failed to access edges for port with ID ${JSON.stringify(r)} because the port does not exist`
|
|
388
388
|
});
|
|
389
|
-
class
|
|
389
|
+
class Pe {
|
|
390
390
|
constructor() {
|
|
391
391
|
i(this, "nodes", /* @__PURE__ */ new Map());
|
|
392
392
|
i(this, "ports", /* @__PURE__ */ new Map());
|
|
@@ -395,7 +395,7 @@ class Te {
|
|
|
395
395
|
i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
396
396
|
i(this, "portOutgoingEdges", /* @__PURE__ */ new Map());
|
|
397
397
|
i(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
398
|
-
i(this, "elementPorts", new
|
|
398
|
+
i(this, "elementPorts", new it());
|
|
399
399
|
i(this, "afterNodeAddedEmitter");
|
|
400
400
|
i(this, "onAfterNodeAdded");
|
|
401
401
|
i(this, "afterNodeUpdatedEmitter");
|
|
@@ -672,22 +672,22 @@ class Te {
|
|
|
672
672
|
this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(o).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(o).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(o).delete(e), this.edges.delete(e);
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
const
|
|
675
|
+
const we = (r) => ({
|
|
676
676
|
scale: 1 / r.scale,
|
|
677
677
|
x: -r.x / r.scale,
|
|
678
678
|
y: -r.y / r.scale
|
|
679
|
-
}),
|
|
679
|
+
}), ye = {
|
|
680
680
|
scale: 1,
|
|
681
681
|
x: 0,
|
|
682
682
|
y: 0
|
|
683
|
-
},
|
|
683
|
+
}, fe = (r, e) => ({
|
|
684
684
|
x: r.scale * e.x + r.x,
|
|
685
685
|
y: r.scale * e.y + r.y
|
|
686
686
|
});
|
|
687
|
-
class
|
|
687
|
+
class nt {
|
|
688
688
|
constructor(e) {
|
|
689
|
-
i(this, "viewportMatrix",
|
|
690
|
-
i(this, "contentMatrix",
|
|
689
|
+
i(this, "viewportMatrix", ye);
|
|
690
|
+
i(this, "contentMatrix", ye);
|
|
691
691
|
i(this, "beforeUpdateEmitter");
|
|
692
692
|
i(this, "onBeforeUpdated");
|
|
693
693
|
i(this, "afterUpdateEmitter");
|
|
@@ -710,30 +710,30 @@ class at {
|
|
|
710
710
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
711
711
|
x: e.x ?? this.viewportMatrix.x,
|
|
712
712
|
y: e.y ?? this.viewportMatrix.y
|
|
713
|
-
}, this.beforeUpdateEmitter.emit(), this.contentMatrix =
|
|
713
|
+
}, this.beforeUpdateEmitter.emit(), this.contentMatrix = we(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
714
714
|
}
|
|
715
715
|
patchContentMatrix(e) {
|
|
716
716
|
this.contentMatrix = {
|
|
717
717
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
718
718
|
x: e.x ?? this.contentMatrix.x,
|
|
719
719
|
y: e.y ?? this.contentMatrix.y
|
|
720
|
-
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix =
|
|
720
|
+
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix = we(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
721
721
|
}
|
|
722
722
|
getDimensions() {
|
|
723
723
|
const { width: e, height: t } = this.host.getBoundingClientRect();
|
|
724
724
|
return { width: e, height: t };
|
|
725
725
|
}
|
|
726
726
|
createContentCoords(e) {
|
|
727
|
-
return
|
|
727
|
+
return fe(this.viewportMatrix, e);
|
|
728
728
|
}
|
|
729
729
|
createViewportCoords(e) {
|
|
730
|
-
return
|
|
730
|
+
return fe(this.contentMatrix, e);
|
|
731
731
|
}
|
|
732
732
|
destroy() {
|
|
733
733
|
this.observer.disconnect();
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
|
-
class
|
|
736
|
+
class q {
|
|
737
737
|
constructor(e) {
|
|
738
738
|
i(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
739
739
|
i(this, "nodesResizeObserver");
|
|
@@ -759,19 +759,28 @@ class ee {
|
|
|
759
759
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
760
760
|
}
|
|
761
761
|
static configure(e) {
|
|
762
|
-
new
|
|
762
|
+
new q(e);
|
|
763
763
|
}
|
|
764
764
|
handleNodeResize(e) {
|
|
765
765
|
const t = this.elementToNodeId.get(e);
|
|
766
766
|
this.canvas.updateNode(t);
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
|
-
const
|
|
769
|
+
const at = (r, e, t) => {
|
|
770
770
|
const { x: o, y: s, width: n, height: a } = r.getBoundingClientRect();
|
|
771
771
|
return e >= o && e <= o + n && t >= s && t <= s + a;
|
|
772
|
-
},
|
|
772
|
+
}, ht = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight;
|
|
773
|
+
class dt {
|
|
774
|
+
constructor(e, t) {
|
|
775
|
+
this.element = e, this.win = t;
|
|
776
|
+
}
|
|
777
|
+
verify(e, t) {
|
|
778
|
+
return at(this.element, e, t) && ht(this.win, e, t);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
const k = (r, e) => {
|
|
773
782
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
774
|
-
},
|
|
783
|
+
}, Y = (r) => {
|
|
775
784
|
const e = document.createElement("div");
|
|
776
785
|
return {
|
|
777
786
|
id: r.overlayNodeId,
|
|
@@ -805,19 +814,19 @@ const ht = (r, e, t) => {
|
|
|
805
814
|
status: "notFound"
|
|
806
815
|
};
|
|
807
816
|
};
|
|
808
|
-
function*
|
|
817
|
+
function* Te(r, e) {
|
|
809
818
|
const t = r.elementsFromPoint(e.x, e.y);
|
|
810
819
|
for (const o of t) {
|
|
811
820
|
if (o.shadowRoot !== null) {
|
|
812
|
-
const s =
|
|
821
|
+
const s = Te(o.shadowRoot, e);
|
|
813
822
|
for (const n of s)
|
|
814
823
|
yield n;
|
|
815
824
|
}
|
|
816
825
|
yield o;
|
|
817
826
|
}
|
|
818
827
|
}
|
|
819
|
-
const
|
|
820
|
-
const t =
|
|
828
|
+
const Ce = (r, e) => {
|
|
829
|
+
const t = Te(document, e);
|
|
821
830
|
for (const o of t) {
|
|
822
831
|
const s = ct(r, o);
|
|
823
832
|
if (s.status === "portFound")
|
|
@@ -828,13 +837,13 @@ const Me = (r, e) => {
|
|
|
828
837
|
return null;
|
|
829
838
|
};
|
|
830
839
|
var M = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(M || {});
|
|
831
|
-
const
|
|
840
|
+
const Me = (r, e) => ({
|
|
832
841
|
x: r / 2,
|
|
833
842
|
y: e / 2
|
|
834
843
|
}), m = (r, e, t) => ({
|
|
835
844
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
836
845
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
837
|
-
}),
|
|
846
|
+
}), De = (r, e, t) => {
|
|
838
847
|
const o = {
|
|
839
848
|
x: r.x + r.width / 2,
|
|
840
849
|
y: r.y + r.height / 2
|
|
@@ -933,36 +942,36 @@ class ut {
|
|
|
933
942
|
}, I = {
|
|
934
943
|
x: E.x - s * a.x,
|
|
935
944
|
y: E.y - s * a.y
|
|
936
|
-
},
|
|
945
|
+
}, F = {
|
|
937
946
|
x: f.x + p,
|
|
938
947
|
y: f.y + y
|
|
939
|
-
},
|
|
948
|
+
}, U = {
|
|
940
949
|
x: E.x + p,
|
|
941
950
|
y: E.y + y
|
|
942
951
|
};
|
|
943
952
|
this.path = [
|
|
944
953
|
`M ${l.x} ${l.y}`,
|
|
945
954
|
`L ${f.x} ${f.y}`,
|
|
946
|
-
`C ${C.x} ${C.y} ${
|
|
947
|
-
`C ${
|
|
955
|
+
`C ${C.x} ${C.y} ${F.x} ${F.y} ${T.x} ${T.y}`,
|
|
956
|
+
`C ${U.x} ${U.y} ${I.x} ${I.y} ${E.x} ${E.y}`,
|
|
948
957
|
`L ${w.x} ${w.y}`
|
|
949
958
|
].join(" "), this.midpoint = T;
|
|
950
959
|
}
|
|
951
960
|
}
|
|
952
|
-
const
|
|
961
|
+
const ee = Object.freeze({
|
|
953
962
|
edgeColor: "--edge-color"
|
|
954
|
-
}),
|
|
963
|
+
}), Le = (r) => {
|
|
955
964
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
956
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(
|
|
957
|
-
},
|
|
965
|
+
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(ee.edgeColor, r), e;
|
|
966
|
+
}, Re = (r) => {
|
|
958
967
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
959
|
-
return e.setAttribute("stroke", `var(${
|
|
960
|
-
},
|
|
968
|
+
return e.setAttribute("stroke", `var(${ee.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
969
|
+
}, X = () => {
|
|
961
970
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
962
|
-
return r.setAttribute("fill", `var(${
|
|
963
|
-
},
|
|
971
|
+
return r.setAttribute("fill", `var(${ee.edgeColor})`), r;
|
|
972
|
+
}, Ve = (r, e) => {
|
|
964
973
|
r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${e.width}px`, r.style.height = `${e.height}px`;
|
|
965
|
-
},
|
|
974
|
+
}, L = (r, e) => {
|
|
966
975
|
const t = [];
|
|
967
976
|
if (r.length > 0 && t.push(`M ${r[0].x} ${r[0].y}`), r.length === 2 && t.push(`L ${r[1].x} ${r[1].y}`), r.length > 2) {
|
|
968
977
|
const o = r.length - 1;
|
|
@@ -1058,7 +1067,7 @@ class pt {
|
|
|
1058
1067
|
dirX: n.x
|
|
1059
1068
|
}
|
|
1060
1069
|
);
|
|
1061
|
-
this.path =
|
|
1070
|
+
this.path = L(
|
|
1062
1071
|
[g, ...f.points, l],
|
|
1063
1072
|
d
|
|
1064
1073
|
), this.midpoint = f.midpoint;
|
|
@@ -1109,7 +1118,7 @@ class wt {
|
|
|
1109
1118
|
this.midpoint = {
|
|
1110
1119
|
x: (b.x + C.x) / 2,
|
|
1111
1120
|
y: (b.y + C.y) / 2
|
|
1112
|
-
}, this.path =
|
|
1121
|
+
}, this.path = L(
|
|
1113
1122
|
[w, E, b, C, T, p],
|
|
1114
1123
|
l
|
|
1115
1124
|
);
|
|
@@ -1140,7 +1149,7 @@ class yt {
|
|
|
1140
1149
|
o,
|
|
1141
1150
|
-a
|
|
1142
1151
|
), w = a + c, p = { x: t.x + w, y: t.y }, y = m(p, h, t), f = { x: o.x - w, y: o.y }, x = m(f, d, o);
|
|
1143
|
-
this.path =
|
|
1152
|
+
this.path = L(
|
|
1144
1153
|
[g, y, x, l],
|
|
1145
1154
|
u
|
|
1146
1155
|
);
|
|
@@ -1234,13 +1243,13 @@ class vt {
|
|
|
1234
1243
|
dirY: c.y
|
|
1235
1244
|
}
|
|
1236
1245
|
);
|
|
1237
|
-
this.path =
|
|
1246
|
+
this.path = L(
|
|
1238
1247
|
[g, ...f.points, l],
|
|
1239
1248
|
u
|
|
1240
1249
|
), this.midpoint = f.midpoint;
|
|
1241
1250
|
}
|
|
1242
1251
|
}
|
|
1243
|
-
class
|
|
1252
|
+
class te {
|
|
1244
1253
|
constructor(e) {
|
|
1245
1254
|
i(this, "path");
|
|
1246
1255
|
i(this, "midpoint");
|
|
@@ -1254,7 +1263,7 @@ class re {
|
|
|
1254
1263
|
{ x: d, y: 0 },
|
|
1255
1264
|
{ x: o, y: 0 }
|
|
1256
1265
|
].map((w) => m(w, n, { x: 0, y: 0 })).map((w) => ({ x: w.x + a.x, y: w.y + a.y })), l = `M ${a.x} ${a.y} L ${g[0].x} ${g[0].y} `;
|
|
1257
|
-
this.path = `${h ? "" : l}${
|
|
1266
|
+
this.path = `${h ? "" : l}${L(g, e.roundness)}`, this.midpoint = { x: (g[3].x + g[4].x) / 2, y: (g[3].y + g[4].y) / 2 };
|
|
1258
1267
|
}
|
|
1259
1268
|
}
|
|
1260
1269
|
class mt {
|
|
@@ -1362,7 +1371,7 @@ class At {
|
|
|
1362
1371
|
this.midpoint = {
|
|
1363
1372
|
x: (y.x + f.x) / 2,
|
|
1364
1373
|
y: x
|
|
1365
|
-
}, this.path =
|
|
1374
|
+
}, this.path = L(
|
|
1366
1375
|
[
|
|
1367
1376
|
l,
|
|
1368
1377
|
y,
|
|
@@ -1417,7 +1426,7 @@ class Nt {
|
|
|
1417
1426
|
this.midpoint = {
|
|
1418
1427
|
x,
|
|
1419
1428
|
y: (y.y + f.y) / 2
|
|
1420
|
-
}, this.path =
|
|
1429
|
+
}, this.path = L(
|
|
1421
1430
|
[
|
|
1422
1431
|
l,
|
|
1423
1432
|
y,
|
|
@@ -1452,8 +1461,8 @@ const v = Object.freeze({
|
|
|
1452
1461
|
curvature: 90,
|
|
1453
1462
|
interactiveWidth: 10,
|
|
1454
1463
|
preOffset: 0
|
|
1455
|
-
}),
|
|
1456
|
-
class
|
|
1464
|
+
}), ve = (r) => ({ x: Math.cos(r), y: Math.sin(r) });
|
|
1465
|
+
class H {
|
|
1457
1466
|
constructor(e) {
|
|
1458
1467
|
i(this, "svg");
|
|
1459
1468
|
i(this, "group", document.createElementNS(
|
|
@@ -1466,18 +1475,18 @@ class G {
|
|
|
1466
1475
|
i(this, "onAfterRender");
|
|
1467
1476
|
i(this, "afterRenderEmitter");
|
|
1468
1477
|
i(this, "arrowRenderer");
|
|
1469
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = P(), this.arrowRenderer = this.params.arrowRenderer, this.svg =
|
|
1478
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = P(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Le(e.color), this.svg.appendChild(this.group), this.line = Re(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));
|
|
1470
1479
|
}
|
|
1471
1480
|
render(e) {
|
|
1472
|
-
const { x: t, y: o, width: s, height: n, from: a, to: h } =
|
|
1481
|
+
const { x: t, y: o, width: s, height: n, from: a, to: h } = De(
|
|
1473
1482
|
e.from,
|
|
1474
1483
|
e.to,
|
|
1475
1484
|
this.params.padding
|
|
1476
1485
|
);
|
|
1477
|
-
|
|
1478
|
-
const d =
|
|
1486
|
+
Ve(this.svg, { x: t, y: o, width: s, height: n });
|
|
1487
|
+
const d = ve(e.from.direction), c = ve(e.to.direction);
|
|
1479
1488
|
let u = { x: -c.x, y: -c.y }, g;
|
|
1480
|
-
e.category ===
|
|
1489
|
+
e.category === R.PortCycle ? (g = this.params.createCyclePath, u = d) : e.category === R.NodeCycle ? g = this.params.createDetourPath : g = this.params.createLinePath;
|
|
1481
1490
|
const l = g(a, h, d, c);
|
|
1482
1491
|
this.line.setAttribute("d", l.path);
|
|
1483
1492
|
let w = null;
|
|
@@ -1543,7 +1552,7 @@ const bt = (r) => (e) => {
|
|
|
1543
1552
|
y: g.y + e.shift.y
|
|
1544
1553
|
})), 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}`, u = `A ${o} ${o} 0 0 1 ${a[0].x} ${a[0].y}`;
|
|
1545
1554
|
return `${h} ${d} ${c} ${u}`;
|
|
1546
|
-
},
|
|
1555
|
+
}, B = (r) => {
|
|
1547
1556
|
if (typeof r == "function")
|
|
1548
1557
|
return r;
|
|
1549
1558
|
switch (r.type) {
|
|
@@ -1562,7 +1571,7 @@ const bt = (r) => (e) => {
|
|
|
1562
1571
|
radius: r.radius ?? v.wedgeArrowRadius
|
|
1563
1572
|
});
|
|
1564
1573
|
}
|
|
1565
|
-
},
|
|
1574
|
+
}, W = 50;
|
|
1566
1575
|
class Ct {
|
|
1567
1576
|
constructor(e) {
|
|
1568
1577
|
i(this, "svg");
|
|
@@ -1610,17 +1619,17 @@ class Ct {
|
|
|
1610
1619
|
hasSourceArrow: this.hasSourceArrow,
|
|
1611
1620
|
hasTargetArrow: this.hasTargetArrow
|
|
1612
1621
|
}));
|
|
1613
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? v.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? v.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? v.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1622
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? v.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? v.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? v.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new H({
|
|
1614
1623
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1615
1624
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1616
|
-
arrowRenderer:
|
|
1625
|
+
arrowRenderer: B((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1617
1626
|
arrowLength: this.arrowLength,
|
|
1618
1627
|
hasSourceArrow: this.hasSourceArrow,
|
|
1619
1628
|
hasTargetArrow: this.hasTargetArrow,
|
|
1620
1629
|
createCyclePath: this.createCyclePath,
|
|
1621
1630
|
createDetourPath: this.createDetourPath,
|
|
1622
1631
|
createLinePath: this.createLinePath,
|
|
1623
|
-
padding:
|
|
1632
|
+
padding: W
|
|
1624
1633
|
}), 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;
|
|
1625
1634
|
}
|
|
1626
1635
|
render(e) {
|
|
@@ -1643,7 +1652,7 @@ class Mt {
|
|
|
1643
1652
|
i(this, "hasSourceArrow");
|
|
1644
1653
|
i(this, "hasTargetArrow");
|
|
1645
1654
|
i(this, "pathShape");
|
|
1646
|
-
i(this, "createCyclePath", (e, t, o) => new
|
|
1655
|
+
i(this, "createCyclePath", (e, t, o) => new te({
|
|
1647
1656
|
origin: e,
|
|
1648
1657
|
dir: o,
|
|
1649
1658
|
arrowLength: this.arrowLength,
|
|
@@ -1681,17 +1690,17 @@ class Mt {
|
|
|
1681
1690
|
t,
|
|
1682
1691
|
this.arrowOffset,
|
|
1683
1692
|
this.cycleSquareSide / 2
|
|
1684
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1693
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new H({
|
|
1685
1694
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1686
1695
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1687
|
-
arrowRenderer:
|
|
1696
|
+
arrowRenderer: B((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1688
1697
|
arrowLength: this.arrowLength,
|
|
1689
1698
|
hasSourceArrow: this.hasSourceArrow,
|
|
1690
1699
|
hasTargetArrow: this.hasTargetArrow,
|
|
1691
1700
|
createCyclePath: this.createCyclePath,
|
|
1692
1701
|
createDetourPath: this.createDetourPath,
|
|
1693
1702
|
createLinePath: this.createLinePath,
|
|
1694
|
-
padding:
|
|
1703
|
+
padding: W
|
|
1695
1704
|
}), 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;
|
|
1696
1705
|
}
|
|
1697
1706
|
render(e) {
|
|
@@ -1715,7 +1724,7 @@ class Dt {
|
|
|
1715
1724
|
i(this, "hasSourceArrow");
|
|
1716
1725
|
i(this, "hasTargetArrow");
|
|
1717
1726
|
i(this, "pathShape");
|
|
1718
|
-
i(this, "createCyclePath", (e, t, o) => new
|
|
1727
|
+
i(this, "createCyclePath", (e, t, o) => new te({
|
|
1719
1728
|
origin: e,
|
|
1720
1729
|
dir: o,
|
|
1721
1730
|
arrowLength: this.arrowLength,
|
|
@@ -1754,17 +1763,17 @@ class Dt {
|
|
|
1754
1763
|
t,
|
|
1755
1764
|
this.arrowOffset,
|
|
1756
1765
|
this.cycleSquareSide / 2
|
|
1757
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1766
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new H({
|
|
1758
1767
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1759
1768
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1760
|
-
arrowRenderer:
|
|
1769
|
+
arrowRenderer: B((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1761
1770
|
arrowLength: this.arrowLength,
|
|
1762
1771
|
hasSourceArrow: this.hasSourceArrow,
|
|
1763
1772
|
hasTargetArrow: this.hasTargetArrow,
|
|
1764
1773
|
createCyclePath: this.createCyclePath,
|
|
1765
1774
|
createDetourPath: this.createDetourPath,
|
|
1766
1775
|
createLinePath: this.createLinePath,
|
|
1767
|
-
padding:
|
|
1776
|
+
padding: W
|
|
1768
1777
|
}), 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;
|
|
1769
1778
|
}
|
|
1770
1779
|
render(e) {
|
|
@@ -1787,7 +1796,7 @@ class Lt {
|
|
|
1787
1796
|
i(this, "hasSourceArrow");
|
|
1788
1797
|
i(this, "hasTargetArrow");
|
|
1789
1798
|
i(this, "pathShape");
|
|
1790
|
-
i(this, "createCyclePath", (e, t, o) => new
|
|
1799
|
+
i(this, "createCyclePath", (e, t, o) => new te({
|
|
1791
1800
|
origin: e,
|
|
1792
1801
|
dir: o,
|
|
1793
1802
|
arrowLength: this.arrowLength,
|
|
@@ -1825,17 +1834,17 @@ class Lt {
|
|
|
1825
1834
|
t,
|
|
1826
1835
|
this.arrowOffset,
|
|
1827
1836
|
this.cycleSquareSide / 2
|
|
1828
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1837
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new H({
|
|
1829
1838
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1830
1839
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1831
|
-
arrowRenderer:
|
|
1840
|
+
arrowRenderer: B((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1832
1841
|
arrowLength: this.arrowLength,
|
|
1833
1842
|
hasSourceArrow: this.hasSourceArrow,
|
|
1834
1843
|
hasTargetArrow: this.hasTargetArrow,
|
|
1835
1844
|
createCyclePath: this.createCyclePath,
|
|
1836
1845
|
createDetourPath: this.createDetourPath,
|
|
1837
1846
|
createLinePath: this.createLinePath,
|
|
1838
|
-
padding:
|
|
1847
|
+
padding: W
|
|
1839
1848
|
}), 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;
|
|
1840
1849
|
}
|
|
1841
1850
|
render(e) {
|
|
@@ -1860,15 +1869,15 @@ class Ie {
|
|
|
1860
1869
|
i(this, "onAfterRender");
|
|
1861
1870
|
i(this, "afterRenderEmitter");
|
|
1862
1871
|
i(this, "arrowRenderer");
|
|
1863
|
-
[this.afterRenderEmitter, this.onAfterRender] = P(), 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 =
|
|
1872
|
+
[this.afterRenderEmitter, this.onAfterRender] = P(), 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 = Le(this.color), this.svg.appendChild(this.group), this.line = Re(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));
|
|
1864
1873
|
}
|
|
1865
1874
|
render(e) {
|
|
1866
|
-
const { x: t, y: o, width: s, height: n, from: a, to: h } =
|
|
1875
|
+
const { x: t, y: o, width: s, height: n, from: a, to: h } = De(
|
|
1867
1876
|
e.from,
|
|
1868
1877
|
e.to,
|
|
1869
|
-
|
|
1878
|
+
W
|
|
1870
1879
|
);
|
|
1871
|
-
|
|
1880
|
+
Ve(this.svg, { x: t, y: o, width: s, height: n });
|
|
1872
1881
|
const d = new xt({
|
|
1873
1882
|
from: a,
|
|
1874
1883
|
to: h,
|
|
@@ -1927,16 +1936,16 @@ const Rt = () => {
|
|
|
1927
1936
|
}, Vt = (r) => {
|
|
1928
1937
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1929
1938
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1930
|
-
},
|
|
1939
|
+
}, me = (r) => {
|
|
1931
1940
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1932
1941
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1933
1942
|
};
|
|
1934
|
-
class
|
|
1943
|
+
class It extends Error {
|
|
1935
1944
|
constructor(e) {
|
|
1936
1945
|
super(e), this.name = "InteractiveEdgeError";
|
|
1937
1946
|
}
|
|
1938
1947
|
}
|
|
1939
|
-
class
|
|
1948
|
+
class Fe {
|
|
1940
1949
|
constructor(e, t) {
|
|
1941
1950
|
i(this, "svg");
|
|
1942
1951
|
i(this, "group");
|
|
@@ -1948,13 +1957,13 @@ class Ue {
|
|
|
1948
1957
|
i(this, "interactiveLine");
|
|
1949
1958
|
i(this, "interactiveSourceArrow", null);
|
|
1950
1959
|
i(this, "interactiveTargetArrow", null);
|
|
1951
|
-
if (this.baseEdge = e, e instanceof
|
|
1952
|
-
throw new
|
|
1960
|
+
if (this.baseEdge = e, e instanceof Fe)
|
|
1961
|
+
throw new It(
|
|
1953
1962
|
"interactive edge can be configured only once"
|
|
1954
1963
|
);
|
|
1955
1964
|
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;
|
|
1956
1965
|
const o = (t == null ? void 0 : t.distance) ?? v.interactiveWidth;
|
|
1957
|
-
this.interactiveLine = Vt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow =
|
|
1966
|
+
this.interactiveLine = Vt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = me(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = me(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
|
|
1958
1967
|
this.interactiveLine.setAttribute("d", s.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", s.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", s.targetArrowPath);
|
|
1959
1968
|
});
|
|
1960
1969
|
}
|
|
@@ -1962,7 +1971,7 @@ class Ue {
|
|
|
1962
1971
|
this.baseEdge.render(e);
|
|
1963
1972
|
}
|
|
1964
1973
|
}
|
|
1965
|
-
class
|
|
1974
|
+
class Br {
|
|
1966
1975
|
constructor(e, t) {
|
|
1967
1976
|
i(this, "group");
|
|
1968
1977
|
i(this, "line");
|
|
@@ -1979,7 +1988,7 @@ class Fr {
|
|
|
1979
1988
|
this.baseShape.render(e);
|
|
1980
1989
|
}
|
|
1981
1990
|
}
|
|
1982
|
-
class
|
|
1991
|
+
class Ue {
|
|
1983
1992
|
constructor(e) {
|
|
1984
1993
|
i(this, "onAfterNodeAdded");
|
|
1985
1994
|
i(this, "onAfterNodeUpdated");
|
|
@@ -2075,7 +2084,7 @@ class $e {
|
|
|
2075
2084
|
return this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
2076
2085
|
}
|
|
2077
2086
|
}
|
|
2078
|
-
class
|
|
2087
|
+
class J {
|
|
2079
2088
|
constructor(e) {
|
|
2080
2089
|
i(this, "counter", 0);
|
|
2081
2090
|
this.checkExists = e;
|
|
@@ -2091,15 +2100,15 @@ class K {
|
|
|
2091
2100
|
this.counter = 0;
|
|
2092
2101
|
}
|
|
2093
2102
|
}
|
|
2094
|
-
class
|
|
2103
|
+
class $e {
|
|
2095
2104
|
constructor(e, t, o) {
|
|
2096
|
-
i(this, "nodeIdGenerator", new
|
|
2105
|
+
i(this, "nodeIdGenerator", new J(
|
|
2097
2106
|
(e) => this.graphStore.hasNode(e)
|
|
2098
2107
|
));
|
|
2099
|
-
i(this, "portIdGenerator", new
|
|
2108
|
+
i(this, "portIdGenerator", new J(
|
|
2100
2109
|
(e) => this.graphStore.hasPort(e)
|
|
2101
2110
|
));
|
|
2102
|
-
i(this, "edgeIdGenerator", new
|
|
2111
|
+
i(this, "edgeIdGenerator", new J(
|
|
2103
2112
|
(e) => this.graphStore.hasEdge(e)
|
|
2104
2113
|
));
|
|
2105
2114
|
i(this, "onAfterNodeAdded", (e) => {
|
|
@@ -2222,7 +2231,7 @@ class Be {
|
|
|
2222
2231
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
2223
2232
|
}
|
|
2224
2233
|
}
|
|
2225
|
-
const
|
|
2234
|
+
const Ft = (r) => {
|
|
2226
2235
|
setTimeout(() => {
|
|
2227
2236
|
r();
|
|
2228
2237
|
});
|
|
@@ -2230,10 +2239,10 @@ const It = (r) => {
|
|
|
2230
2239
|
queueMicrotask(() => {
|
|
2231
2240
|
r();
|
|
2232
2241
|
});
|
|
2233
|
-
},
|
|
2242
|
+
}, re = (r) => {
|
|
2234
2243
|
r();
|
|
2235
2244
|
};
|
|
2236
|
-
class
|
|
2245
|
+
class Be {
|
|
2237
2246
|
constructor(e) {
|
|
2238
2247
|
i(this, "onBeforeUpdated");
|
|
2239
2248
|
i(this, "onAfterUpdated");
|
|
@@ -2266,16 +2275,16 @@ const $t = (r, e) => Symbol.iterator in r ? {
|
|
|
2266
2275
|
nodes: r.nodes ?? [],
|
|
2267
2276
|
contentPadding: r.contentPadding ?? r.contentOffset ?? e.focus.contentPadding,
|
|
2268
2277
|
animationDuration: r.animationDuration ?? e.focus.animationDuration
|
|
2269
|
-
},
|
|
2278
|
+
}, We = (r, e, t) => ({
|
|
2270
2279
|
scale: r.scale,
|
|
2271
2280
|
x: r.x + r.scale * e,
|
|
2272
2281
|
y: r.y + r.scale * t
|
|
2273
|
-
}),
|
|
2282
|
+
}), Oe = (r, e, t, o) => ({
|
|
2274
2283
|
scale: r.scale * e,
|
|
2275
2284
|
x: r.scale * (1 - e) * t + r.x,
|
|
2276
2285
|
y: r.scale * (1 - e) * o + r.y
|
|
2277
2286
|
});
|
|
2278
|
-
class
|
|
2287
|
+
class ze {
|
|
2279
2288
|
constructor(e, t, o, s) {
|
|
2280
2289
|
this.graphStore = e, this.viewportStore = t, this.params = o, this.win = s;
|
|
2281
2290
|
}
|
|
@@ -2287,11 +2296,11 @@ class ke {
|
|
|
2287
2296
|
}
|
|
2288
2297
|
center(e, t) {
|
|
2289
2298
|
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;
|
|
2290
|
-
let u =
|
|
2299
|
+
let u = We(a, d, c);
|
|
2291
2300
|
const g = t == null ? void 0 : t.contentScale;
|
|
2292
2301
|
if (g !== void 0) {
|
|
2293
2302
|
const w = 1 / g;
|
|
2294
|
-
u =
|
|
2303
|
+
u = Oe(
|
|
2295
2304
|
u,
|
|
2296
2305
|
w / a.scale,
|
|
2297
2306
|
n.x,
|
|
@@ -2351,10 +2360,10 @@ class ke {
|
|
|
2351
2360
|
this.win.requestAnimationFrame(a);
|
|
2352
2361
|
}
|
|
2353
2362
|
}
|
|
2354
|
-
const
|
|
2355
|
-
const o = new
|
|
2363
|
+
const ke = (r, e, t) => {
|
|
2364
|
+
const o = new Pe(), s = new Ue(o), n = new Be(e), a = new Ne(o, e, r), h = {
|
|
2356
2365
|
nodes: {
|
|
2357
|
-
centerFn:
|
|
2366
|
+
centerFn: Me,
|
|
2358
2367
|
priorityFn: () => 0
|
|
2359
2368
|
},
|
|
2360
2369
|
edges: {
|
|
@@ -2364,7 +2373,7 @@ const Ye = (r, e, t) => {
|
|
|
2364
2373
|
ports: {
|
|
2365
2374
|
direction: 0
|
|
2366
2375
|
}
|
|
2367
|
-
}, d = new
|
|
2376
|
+
}, d = new $e(
|
|
2368
2377
|
o,
|
|
2369
2378
|
a,
|
|
2370
2379
|
h
|
|
@@ -2372,18 +2381,18 @@ const Ye = (r, e, t) => {
|
|
|
2372
2381
|
focus: {
|
|
2373
2382
|
contentPadding: 0,
|
|
2374
2383
|
minContentScale: 0,
|
|
2375
|
-
schedule:
|
|
2384
|
+
schedule: re,
|
|
2376
2385
|
animationDuration: 0
|
|
2377
2386
|
}
|
|
2378
|
-
}, u = new
|
|
2387
|
+
}, u = new ze(
|
|
2379
2388
|
o,
|
|
2380
2389
|
e,
|
|
2381
2390
|
c,
|
|
2382
2391
|
t
|
|
2383
2392
|
);
|
|
2384
|
-
return new
|
|
2393
|
+
return new be(s, n, d, u);
|
|
2385
2394
|
};
|
|
2386
|
-
class
|
|
2395
|
+
class G {
|
|
2387
2396
|
constructor(e, t, o, s) {
|
|
2388
2397
|
i(this, "onAfterPortMarked", (e) => {
|
|
2389
2398
|
const t = this.canvas.graph.getPort(e);
|
|
@@ -2408,9 +2417,7 @@ class j {
|
|
|
2408
2417
|
}));
|
|
2409
2418
|
});
|
|
2410
2419
|
i(this, "onWindowMouseMove", (e) => {
|
|
2411
|
-
if (!
|
|
2412
|
-
this.window,
|
|
2413
|
-
this.element,
|
|
2420
|
+
if (!this.pointInsideVerifier.verify(
|
|
2414
2421
|
e.clientX,
|
|
2415
2422
|
e.clientY
|
|
2416
2423
|
)) {
|
|
@@ -2440,9 +2447,7 @@ class j {
|
|
|
2440
2447
|
});
|
|
2441
2448
|
i(this, "onWindowTouchMove", (e) => {
|
|
2442
2449
|
const t = e.touches[0];
|
|
2443
|
-
if (!
|
|
2444
|
-
this.window,
|
|
2445
|
-
this.element,
|
|
2450
|
+
if (!this.pointInsideVerifier.verify(
|
|
2446
2451
|
t.clientX,
|
|
2447
2452
|
t.clientY
|
|
2448
2453
|
)) {
|
|
@@ -2464,10 +2469,10 @@ class j {
|
|
|
2464
2469
|
i(this, "revert", () => {
|
|
2465
2470
|
this.params.onStopDrag(), this.reset(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
2466
2471
|
});
|
|
2467
|
-
this.canvas = e, this.
|
|
2472
|
+
this.canvas = e, this.window = t, this.pointInsideVerifier = o, this.params = s, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
2468
2473
|
}
|
|
2469
2474
|
static configure(e, t, o, s) {
|
|
2470
|
-
new
|
|
2475
|
+
new G(e, t, o, s);
|
|
2471
2476
|
}
|
|
2472
2477
|
hookPortEvents(e) {
|
|
2473
2478
|
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
@@ -2521,8 +2526,8 @@ class Wt {
|
|
|
2521
2526
|
}), this.params.onAfterApplied();
|
|
2522
2527
|
}
|
|
2523
2528
|
}
|
|
2524
|
-
class
|
|
2525
|
-
constructor(e, t, o, s) {
|
|
2529
|
+
class oe {
|
|
2530
|
+
constructor(e, t, o, s, n) {
|
|
2526
2531
|
i(this, "grabbedNode", null);
|
|
2527
2532
|
i(this, "maxNodePriority", 0);
|
|
2528
2533
|
i(this, "graph");
|
|
@@ -2558,7 +2563,7 @@ class se {
|
|
|
2558
2563
|
nodeId: s,
|
|
2559
2564
|
dx: h.x - n.x,
|
|
2560
2565
|
dy: h.y - n.y
|
|
2561
|
-
},
|
|
2566
|
+
}, k(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2562
2567
|
passive: !0
|
|
2563
2568
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2564
2569
|
passive: !0
|
|
@@ -2594,9 +2599,7 @@ class se {
|
|
|
2594
2599
|
});
|
|
2595
2600
|
});
|
|
2596
2601
|
i(this, "onWindowMouseMove", (e) => {
|
|
2597
|
-
if (!
|
|
2598
|
-
this.window,
|
|
2599
|
-
this.element,
|
|
2602
|
+
if (!this.pointInsideVerifier.verify(
|
|
2600
2603
|
e.clientX,
|
|
2601
2604
|
e.clientY
|
|
2602
2605
|
)) {
|
|
@@ -2615,9 +2618,7 @@ class se {
|
|
|
2615
2618
|
if (e.touches.length !== 1)
|
|
2616
2619
|
return;
|
|
2617
2620
|
const t = e.touches[0];
|
|
2618
|
-
if (!
|
|
2619
|
-
this.window,
|
|
2620
|
-
this.element,
|
|
2621
|
+
if (!this.pointInsideVerifier.verify(
|
|
2621
2622
|
t.clientX,
|
|
2622
2623
|
t.clientY
|
|
2623
2624
|
)) {
|
|
@@ -2641,10 +2642,16 @@ class se {
|
|
|
2641
2642
|
i(this, "revert", () => {
|
|
2642
2643
|
this.reset(), this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2643
2644
|
});
|
|
2644
|
-
this.canvas = e, this.element = t, this.window = o, this.
|
|
2645
|
+
this.canvas = e, this.element = t, this.window = o, this.pointInsideVerifier = s, this.params = n, this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
2645
2646
|
}
|
|
2646
|
-
static configure(e, t, o, s) {
|
|
2647
|
-
new
|
|
2647
|
+
static configure(e, t, o, s, n) {
|
|
2648
|
+
new oe(
|
|
2649
|
+
e,
|
|
2650
|
+
t,
|
|
2651
|
+
o,
|
|
2652
|
+
s,
|
|
2653
|
+
n
|
|
2654
|
+
);
|
|
2648
2655
|
}
|
|
2649
2656
|
moveNode(e, t) {
|
|
2650
2657
|
if (!this.graph.hasNode(e.nodeId))
|
|
@@ -2670,7 +2677,7 @@ class se {
|
|
|
2670
2677
|
}
|
|
2671
2678
|
}
|
|
2672
2679
|
stopMouseDrag() {
|
|
2673
|
-
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null,
|
|
2680
|
+
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, k(this.element, null), this.removeMouseDragListeners();
|
|
2674
2681
|
}
|
|
2675
2682
|
removeMouseDragListeners() {
|
|
2676
2683
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -2713,7 +2720,7 @@ class se {
|
|
|
2713
2720
|
return e;
|
|
2714
2721
|
}
|
|
2715
2722
|
}
|
|
2716
|
-
const
|
|
2723
|
+
const O = (r) => {
|
|
2717
2724
|
const e = [], t = r.touches.length;
|
|
2718
2725
|
for (let h = 0; h < t; h++)
|
|
2719
2726
|
e.push([r.touches[h].clientX, r.touches[h].clientY]);
|
|
@@ -2732,8 +2739,8 @@ const z = (r) => {
|
|
|
2732
2739
|
touches: e
|
|
2733
2740
|
};
|
|
2734
2741
|
};
|
|
2735
|
-
class
|
|
2736
|
-
constructor(e, t, o, s) {
|
|
2742
|
+
class j {
|
|
2743
|
+
constructor(e, t, o, s, n) {
|
|
2737
2744
|
i(this, "viewport");
|
|
2738
2745
|
i(this, "prevTouches", null);
|
|
2739
2746
|
i(this, "wheelFinishTimer", null);
|
|
@@ -2742,16 +2749,14 @@ class J {
|
|
|
2742
2749
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2743
2750
|
});
|
|
2744
2751
|
i(this, "onMouseDown", (e) => {
|
|
2745
|
-
this.params.mouseDownEventVerifier(e) && (
|
|
2752
|
+
this.params.mouseDownEventVerifier(e) && (k(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2746
2753
|
passive: !0
|
|
2747
2754
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2748
2755
|
passive: !0
|
|
2749
2756
|
}), this.startRegisteredTransform());
|
|
2750
2757
|
});
|
|
2751
2758
|
i(this, "onWindowMouseMove", (e) => {
|
|
2752
|
-
const t =
|
|
2753
|
-
this.window,
|
|
2754
|
-
this.element,
|
|
2759
|
+
const t = this.pointInsideVerifier.verify(
|
|
2755
2760
|
e.clientX,
|
|
2756
2761
|
e.clientY
|
|
2757
2762
|
);
|
|
@@ -2775,10 +2780,10 @@ class J {
|
|
|
2775
2780
|
});
|
|
2776
2781
|
i(this, "onTouchStart", (e) => {
|
|
2777
2782
|
if (this.prevTouches !== null) {
|
|
2778
|
-
this.prevTouches =
|
|
2783
|
+
this.prevTouches = O(e);
|
|
2779
2784
|
return;
|
|
2780
2785
|
}
|
|
2781
|
-
this.prevTouches =
|
|
2786
|
+
this.prevTouches = O(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
2782
2787
|
passive: !0
|
|
2783
2788
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
2784
2789
|
passive: !0
|
|
@@ -2787,9 +2792,9 @@ class J {
|
|
|
2787
2792
|
}), this.startRegisteredTransform();
|
|
2788
2793
|
});
|
|
2789
2794
|
i(this, "onWindowTouchMove", (e) => {
|
|
2790
|
-
const t =
|
|
2795
|
+
const t = O(e);
|
|
2791
2796
|
if (!t.touches.every(
|
|
2792
|
-
(s) =>
|
|
2797
|
+
(s) => this.pointInsideVerifier.verify(s[0], s[1])
|
|
2793
2798
|
)) {
|
|
2794
2799
|
this.stopTouchDrag();
|
|
2795
2800
|
return;
|
|
@@ -2804,12 +2809,12 @@ class J {
|
|
|
2804
2809
|
this.prevTouches = t;
|
|
2805
2810
|
});
|
|
2806
2811
|
i(this, "onWindowTouchFinish", (e) => {
|
|
2807
|
-
e.touches.length > 0 ? this.prevTouches =
|
|
2812
|
+
e.touches.length > 0 ? this.prevTouches = O(e) : this.stopTouchDrag();
|
|
2808
2813
|
});
|
|
2809
2814
|
i(this, "preventWheelScaleListener", (e) => {
|
|
2810
2815
|
e.preventDefault();
|
|
2811
2816
|
});
|
|
2812
|
-
this.canvas = e, this.element = t, this.window = o, this.
|
|
2817
|
+
this.canvas = e, this.element = t, this.window = o, this.pointInsideVerifier = s, this.params = n, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
|
|
2813
2818
|
passive: !1
|
|
2814
2819
|
}), this.viewport = e.viewport, this.handleResize(), this.viewport.onAfterResize.subscribe(() => {
|
|
2815
2820
|
this.handleResize();
|
|
@@ -2821,11 +2826,17 @@ class J {
|
|
|
2821
2826
|
passive: !0
|
|
2822
2827
|
}), e.onBeforeDestroy.subscribe(this.revert);
|
|
2823
2828
|
}
|
|
2824
|
-
static configure(e, t, o, s) {
|
|
2825
|
-
new
|
|
2829
|
+
static configure(e, t, o, s, n) {
|
|
2830
|
+
new j(
|
|
2831
|
+
e,
|
|
2832
|
+
t,
|
|
2833
|
+
o,
|
|
2834
|
+
s,
|
|
2835
|
+
n
|
|
2836
|
+
);
|
|
2826
2837
|
}
|
|
2827
2838
|
moveViewport(e, t) {
|
|
2828
|
-
const o = this.viewport.getViewportMatrix(), s =
|
|
2839
|
+
const o = this.viewport.getViewportMatrix(), s = We(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
|
|
2829
2840
|
prevTransform: o,
|
|
2830
2841
|
nextTransform: s,
|
|
2831
2842
|
canvasWidth: n,
|
|
@@ -2834,7 +2845,7 @@ class J {
|
|
|
2834
2845
|
this.performTransform(h);
|
|
2835
2846
|
}
|
|
2836
2847
|
scaleViewport(e, t, o) {
|
|
2837
|
-
const s = this.canvas.viewport.getViewportMatrix(), n =
|
|
2848
|
+
const s = this.canvas.viewport.getViewportMatrix(), n = Oe(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
|
|
2838
2849
|
prevTransform: s,
|
|
2839
2850
|
nextTransform: n,
|
|
2840
2851
|
canvasWidth: a,
|
|
@@ -2843,7 +2854,7 @@ class J {
|
|
|
2843
2854
|
this.performTransform(d);
|
|
2844
2855
|
}
|
|
2845
2856
|
stopMouseDrag() {
|
|
2846
|
-
|
|
2857
|
+
k(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
2847
2858
|
}
|
|
2848
2859
|
removeMouseDragListeners() {
|
|
2849
2860
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -2873,8 +2884,8 @@ class J {
|
|
|
2873
2884
|
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(s), this.params.onResizeTransformFinished();
|
|
2874
2885
|
}
|
|
2875
2886
|
}
|
|
2876
|
-
class
|
|
2877
|
-
constructor(e, t, o, s, n, a) {
|
|
2887
|
+
class se {
|
|
2888
|
+
constructor(e, t, o, s, n, a, h) {
|
|
2878
2889
|
i(this, "nodeHorizontal");
|
|
2879
2890
|
i(this, "nodeVertical");
|
|
2880
2891
|
i(this, "viewport");
|
|
@@ -2897,10 +2908,10 @@ class ie {
|
|
|
2897
2908
|
this.userTransformInProgress || this.loadAreaAroundViewport();
|
|
2898
2909
|
});
|
|
2899
2910
|
i(this, "userTransformInProgress", !1);
|
|
2900
|
-
this.canvas = e, this.element = t, this.window = o, this.trigger = n, this.
|
|
2911
|
+
this.canvas = e, this.element = t, this.window = o, this.trigger = n, this.pointInsideVerifier = a, this.params = h, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.viewport = e.viewport, this.currentScale = this.viewport.getViewportMatrix().scale, this.scheduleLoadAreaAroundViewport(), this.viewport.onAfterResize.subscribe(() => {
|
|
2901
2912
|
this.scheduleLoadAreaAroundViewport();
|
|
2902
2913
|
});
|
|
2903
|
-
const
|
|
2914
|
+
const d = {
|
|
2904
2915
|
...s,
|
|
2905
2916
|
onResizeTransformStarted: () => {
|
|
2906
2917
|
this.userTransformInProgress = !0, s.onResizeTransformStarted();
|
|
@@ -2913,28 +2924,30 @@ class ie {
|
|
|
2913
2924
|
},
|
|
2914
2925
|
onTransformChange: () => {
|
|
2915
2926
|
this.userTransformInProgress = !1;
|
|
2916
|
-
const
|
|
2917
|
-
this.currentScale = this.viewport.getViewportMatrix().scale,
|
|
2927
|
+
const c = this.currentScale;
|
|
2928
|
+
this.currentScale = this.viewport.getViewportMatrix().scale, c !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(), s.onTransformChange();
|
|
2918
2929
|
},
|
|
2919
2930
|
onTransformFinished: () => {
|
|
2920
2931
|
this.scheduleLoadAreaAroundViewport(), s.onTransformFinished();
|
|
2921
2932
|
}
|
|
2922
2933
|
};
|
|
2923
|
-
|
|
2934
|
+
j.configure(
|
|
2924
2935
|
e,
|
|
2925
2936
|
this.element,
|
|
2926
2937
|
this.window,
|
|
2927
|
-
|
|
2938
|
+
this.pointInsideVerifier,
|
|
2939
|
+
d
|
|
2928
2940
|
), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2929
2941
|
}
|
|
2930
|
-
static configure(e, t, o, s, n, a) {
|
|
2931
|
-
new
|
|
2942
|
+
static configure(e, t, o, s, n, a, h) {
|
|
2943
|
+
new se(
|
|
2932
2944
|
e,
|
|
2933
2945
|
t,
|
|
2934
2946
|
o,
|
|
2935
2947
|
s,
|
|
2936
2948
|
n,
|
|
2937
|
-
a
|
|
2949
|
+
a,
|
|
2950
|
+
h
|
|
2938
2951
|
);
|
|
2939
2952
|
}
|
|
2940
2953
|
scheduleLoadAreaAroundViewport() {
|
|
@@ -2971,7 +2984,7 @@ const Ot = () => {
|
|
|
2971
2984
|
);
|
|
2972
2985
|
return r.setAttribute("id", "pattern"), r;
|
|
2973
2986
|
};
|
|
2974
|
-
class
|
|
2987
|
+
class ie {
|
|
2975
2988
|
constructor(e, t, o) {
|
|
2976
2989
|
i(this, "svg", Ot());
|
|
2977
2990
|
i(this, "patternRenderingRectangle", zt());
|
|
@@ -2996,7 +3009,7 @@ class ne {
|
|
|
2996
3009
|
}), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
2997
3010
|
}
|
|
2998
3011
|
static configure(e, t, o) {
|
|
2999
|
-
new
|
|
3012
|
+
new ie(e, t, o);
|
|
3000
3013
|
}
|
|
3001
3014
|
updateVisibility() {
|
|
3002
3015
|
const { scale: e } = this.canvas.viewport.getViewportMatrix(), t = e > this.maxViewportScale;
|
|
@@ -3004,53 +3017,55 @@ class ne {
|
|
|
3004
3017
|
}
|
|
3005
3018
|
updateDimensions() {
|
|
3006
3019
|
const { width: e, height: t } = this.canvas.viewport.getDimensions();
|
|
3007
|
-
this.svg.setAttribute("width", `${e}`), this.svg.setAttribute("height", `${t}`), this.patternRenderingRectangle.setAttribute("width", `${e}`), this.patternRenderingRectangle.setAttribute("height", `${t}`)
|
|
3008
|
-
|
|
3009
|
-
|
|
3020
|
+
if (this.svg.setAttribute("width", `${e}`), this.svg.setAttribute("height", `${t}`), this.patternRenderingRectangle.setAttribute("width", `${e}`), this.patternRenderingRectangle.setAttribute("height", `${t}`), e > 0 && t > 0) {
|
|
3021
|
+
const o = this.tileWidth / e, s = this.tileHeight / t;
|
|
3022
|
+
this.pattern.setAttribute("width", `${o}`), this.pattern.setAttribute("height", `${s}`);
|
|
3023
|
+
}
|
|
3010
3024
|
}
|
|
3011
3025
|
}
|
|
3012
|
-
class
|
|
3013
|
-
constructor(e, t, o, s, n) {
|
|
3026
|
+
class ne {
|
|
3027
|
+
constructor(e, t, o, s, n, a) {
|
|
3014
3028
|
i(this, "overlayCanvas");
|
|
3015
3029
|
i(this, "staticPortId", null);
|
|
3016
3030
|
i(this, "isTargetDragging", !0);
|
|
3017
3031
|
i(this, "onEdgeCreated", (e) => {
|
|
3018
3032
|
this.params.onAfterEdgeCreated(e);
|
|
3019
3033
|
});
|
|
3020
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.
|
|
3034
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = ke(
|
|
3021
3035
|
this.overlayLayer,
|
|
3022
3036
|
this.viewportStore,
|
|
3023
3037
|
this.window
|
|
3024
|
-
),
|
|
3038
|
+
), G.configure(
|
|
3025
3039
|
this.canvas,
|
|
3026
|
-
this.overlayLayer,
|
|
3027
3040
|
this.window,
|
|
3041
|
+
this.pointInsideVerifier,
|
|
3028
3042
|
{
|
|
3029
3043
|
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
3030
3044
|
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
3031
3045
|
onStopDrag: () => {
|
|
3032
3046
|
this.resetDragState();
|
|
3033
3047
|
},
|
|
3034
|
-
onPortPointerDown: (
|
|
3035
|
-
const
|
|
3036
|
-
return
|
|
3048
|
+
onPortPointerDown: (h, d) => {
|
|
3049
|
+
const c = this.params.connectionTypeResolver(h);
|
|
3050
|
+
return c === null ? !1 : (this.grabPort(h, d, c), !0);
|
|
3037
3051
|
},
|
|
3038
|
-
onPointerMove: (
|
|
3039
|
-
this.moveDraggingPort(
|
|
3052
|
+
onPointerMove: (h) => {
|
|
3053
|
+
this.moveDraggingPort(h);
|
|
3040
3054
|
},
|
|
3041
|
-
onPointerUp: (
|
|
3042
|
-
this.tryCreateConnection(
|
|
3055
|
+
onPointerUp: (h) => {
|
|
3056
|
+
this.tryCreateConnection(h);
|
|
3043
3057
|
}
|
|
3044
3058
|
}
|
|
3045
3059
|
);
|
|
3046
3060
|
}
|
|
3047
|
-
static configure(e, t, o, s, n) {
|
|
3048
|
-
new
|
|
3061
|
+
static configure(e, t, o, s, n, a) {
|
|
3062
|
+
new ne(
|
|
3049
3063
|
e,
|
|
3050
3064
|
t,
|
|
3051
3065
|
o,
|
|
3052
3066
|
s,
|
|
3053
|
-
n
|
|
3067
|
+
n,
|
|
3068
|
+
a
|
|
3054
3069
|
);
|
|
3055
3070
|
}
|
|
3056
3071
|
grabPort(e, t, o) {
|
|
@@ -3073,7 +3088,7 @@ class ae {
|
|
|
3073
3088
|
};
|
|
3074
3089
|
this.isTargetDragging = o === "direct";
|
|
3075
3090
|
const [w, p] = this.isTargetDragging ? [g, l] : [l, g];
|
|
3076
|
-
this.overlayCanvas.addNode(
|
|
3091
|
+
this.overlayCanvas.addNode(Y(w)), this.overlayCanvas.addNode(Y(p)), this.overlayCanvas.addEdge({
|
|
3077
3092
|
from: w.overlayNodeId,
|
|
3078
3093
|
to: p.overlayNodeId,
|
|
3079
3094
|
shape: this.params.edgeShapeFactory(M.EdgeId)
|
|
@@ -3083,7 +3098,7 @@ class ae {
|
|
|
3083
3098
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
3084
3099
|
}
|
|
3085
3100
|
tryCreateConnection(e) {
|
|
3086
|
-
const t =
|
|
3101
|
+
const t = Ce(this.canvas.graph, e), o = this.staticPortId;
|
|
3087
3102
|
if (t === null) {
|
|
3088
3103
|
this.params.onEdgeCreationInterrupted({
|
|
3089
3104
|
staticPortId: o,
|
|
@@ -3105,8 +3120,8 @@ class ae {
|
|
|
3105
3120
|
});
|
|
3106
3121
|
}
|
|
3107
3122
|
}
|
|
3108
|
-
class
|
|
3109
|
-
constructor(e, t, o, s, n) {
|
|
3123
|
+
class ae {
|
|
3124
|
+
constructor(e, t, o, s, n, a) {
|
|
3110
3125
|
i(this, "overlayCanvas");
|
|
3111
3126
|
i(this, "staticPortId", null);
|
|
3112
3127
|
i(this, "isTargetDragging", !0);
|
|
@@ -3114,37 +3129,38 @@ class he {
|
|
|
3114
3129
|
i(this, "onEdgeReattached", (e) => {
|
|
3115
3130
|
this.params.onAfterEdgeReattached(e);
|
|
3116
3131
|
});
|
|
3117
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.
|
|
3132
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = ke(
|
|
3118
3133
|
this.overlayLayer,
|
|
3119
3134
|
this.viewportStore,
|
|
3120
3135
|
this.window
|
|
3121
|
-
),
|
|
3136
|
+
), G.configure(
|
|
3122
3137
|
this.canvas,
|
|
3123
|
-
this.overlayLayer,
|
|
3124
3138
|
this.window,
|
|
3139
|
+
this.pointInsideVerifier,
|
|
3125
3140
|
{
|
|
3126
3141
|
mouseDownEventVerifier: this.params.mouseDownEventVerifier,
|
|
3127
3142
|
mouseUpEventVerifier: this.params.mouseUpEventVerifier,
|
|
3128
3143
|
onStopDrag: () => {
|
|
3129
3144
|
this.resetDragState();
|
|
3130
3145
|
},
|
|
3131
|
-
onPortPointerDown: (
|
|
3132
|
-
onPointerMove: (
|
|
3133
|
-
this.moveDraggingPort(
|
|
3146
|
+
onPortPointerDown: (h, d) => this.tryStartEdgeDragging(h, d),
|
|
3147
|
+
onPointerMove: (h) => {
|
|
3148
|
+
this.moveDraggingPort(h);
|
|
3134
3149
|
},
|
|
3135
|
-
onPointerUp: (
|
|
3136
|
-
this.tryCreateConnection(
|
|
3150
|
+
onPointerUp: (h) => {
|
|
3151
|
+
this.tryCreateConnection(h);
|
|
3137
3152
|
}
|
|
3138
3153
|
}
|
|
3139
3154
|
);
|
|
3140
3155
|
}
|
|
3141
|
-
static configure(e, t, o, s, n) {
|
|
3142
|
-
new
|
|
3156
|
+
static configure(e, t, o, s, n, a) {
|
|
3157
|
+
new ae(
|
|
3143
3158
|
e,
|
|
3144
3159
|
t,
|
|
3145
3160
|
o,
|
|
3146
3161
|
s,
|
|
3147
|
-
n
|
|
3162
|
+
n,
|
|
3163
|
+
a
|
|
3148
3164
|
);
|
|
3149
3165
|
}
|
|
3150
3166
|
tryStartEdgeDragging(e, t) {
|
|
@@ -3179,7 +3195,7 @@ class he {
|
|
|
3179
3195
|
portCoords: p,
|
|
3180
3196
|
portDirection: d.direction
|
|
3181
3197
|
}, [x, E] = this.isTargetDragging ? [y, f] : [f, y];
|
|
3182
|
-
this.overlayCanvas.addNode(
|
|
3198
|
+
this.overlayCanvas.addNode(Y(x)), this.overlayCanvas.addNode(Y(E));
|
|
3183
3199
|
const b = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(M.EdgeId) : s.shape;
|
|
3184
3200
|
return this.overlayCanvas.addEdge({
|
|
3185
3201
|
id: M.EdgeId,
|
|
@@ -3202,7 +3218,7 @@ class he {
|
|
|
3202
3218
|
});
|
|
3203
3219
|
}
|
|
3204
3220
|
tryCreateConnection(e) {
|
|
3205
|
-
const t =
|
|
3221
|
+
const t = Ce(this.canvas.graph, e);
|
|
3206
3222
|
if (this.overlayCanvas.removeEdge(M.EdgeId), t === null) {
|
|
3207
3223
|
const d = this.draggingEdgePayload;
|
|
3208
3224
|
this.params.onEdgeReattachInterrupted({
|
|
@@ -3235,17 +3251,17 @@ class he {
|
|
|
3235
3251
|
}
|
|
3236
3252
|
}
|
|
3237
3253
|
}
|
|
3238
|
-
class
|
|
3254
|
+
class he {
|
|
3239
3255
|
constructor(e, t) {
|
|
3240
3256
|
this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
|
|
3241
3257
|
this.applier.apply();
|
|
3242
3258
|
});
|
|
3243
3259
|
}
|
|
3244
3260
|
static configure(e, t) {
|
|
3245
|
-
new
|
|
3261
|
+
new he(e, t);
|
|
3246
3262
|
}
|
|
3247
3263
|
}
|
|
3248
|
-
class
|
|
3264
|
+
class de {
|
|
3249
3265
|
constructor(e, t, o) {
|
|
3250
3266
|
i(this, "applyScheduled", !1);
|
|
3251
3267
|
i(this, "apply", () => {
|
|
@@ -3262,7 +3278,7 @@ class ce {
|
|
|
3262
3278
|
});
|
|
3263
3279
|
}
|
|
3264
3280
|
static configure(e, t, o) {
|
|
3265
|
-
new
|
|
3281
|
+
new de(
|
|
3266
3282
|
e,
|
|
3267
3283
|
t,
|
|
3268
3284
|
o
|
|
@@ -3281,14 +3297,14 @@ class Yt {
|
|
|
3281
3297
|
});
|
|
3282
3298
|
switch (o.type) {
|
|
3283
3299
|
case "trigger": {
|
|
3284
|
-
|
|
3300
|
+
he.configure(
|
|
3285
3301
|
s,
|
|
3286
3302
|
o.trigger
|
|
3287
3303
|
);
|
|
3288
3304
|
break;
|
|
3289
3305
|
}
|
|
3290
3306
|
case "topologyChangeSchedule": {
|
|
3291
|
-
|
|
3307
|
+
de.configure(
|
|
3292
3308
|
e.graph,
|
|
3293
3309
|
s,
|
|
3294
3310
|
o.schedule
|
|
@@ -3313,7 +3329,7 @@ class Xt {
|
|
|
3313
3329
|
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
3314
3330
|
}
|
|
3315
3331
|
}
|
|
3316
|
-
class
|
|
3332
|
+
class ce {
|
|
3317
3333
|
constructor(e, t, o) {
|
|
3318
3334
|
i(this, "applier");
|
|
3319
3335
|
i(this, "step", (e) => {
|
|
@@ -3326,14 +3342,11 @@ class le {
|
|
|
3326
3342
|
}), new Xt(this.win, this.step);
|
|
3327
3343
|
}
|
|
3328
3344
|
static configure(e, t, o) {
|
|
3329
|
-
new
|
|
3345
|
+
new ce(e, t, o);
|
|
3330
3346
|
}
|
|
3331
3347
|
}
|
|
3332
|
-
class
|
|
3333
|
-
constructor(e) {
|
|
3334
|
-
i(this, "element");
|
|
3335
|
-
i(this, "canvas");
|
|
3336
|
-
i(this, "window");
|
|
3348
|
+
class le {
|
|
3349
|
+
constructor(e, t, o, s) {
|
|
3337
3350
|
i(this, "onNodeSelected");
|
|
3338
3351
|
i(this, "mouseDownEventVerifier");
|
|
3339
3352
|
i(this, "mouseUpEventVerifier");
|
|
@@ -3393,12 +3406,7 @@ class ue {
|
|
|
3393
3406
|
});
|
|
3394
3407
|
i(this, "onWindowMouseMove", (e) => {
|
|
3395
3408
|
const t = e, o = this.previousMouse, s = t.clientX - o.x, n = t.clientY - o.y;
|
|
3396
|
-
if (!
|
|
3397
|
-
this.window,
|
|
3398
|
-
this.element,
|
|
3399
|
-
t.clientX,
|
|
3400
|
-
t.clientY
|
|
3401
|
-
)) {
|
|
3409
|
+
if (!this.pointInsideVerifier.verify(t.clientX, t.clientY)) {
|
|
3402
3410
|
this.removeWindowMouseListeners();
|
|
3403
3411
|
return;
|
|
3404
3412
|
}
|
|
@@ -3413,7 +3421,7 @@ class ue {
|
|
|
3413
3421
|
return;
|
|
3414
3422
|
}
|
|
3415
3423
|
const o = t.touches[0];
|
|
3416
|
-
if (!
|
|
3424
|
+
if (!this.pointInsideVerifier.verify(o.clientX, o.clientY)) {
|
|
3417
3425
|
this.removeWindowTouchListeners();
|
|
3418
3426
|
return;
|
|
3419
3427
|
}
|
|
@@ -3424,18 +3432,23 @@ class ue {
|
|
|
3424
3432
|
});
|
|
3425
3433
|
i(this, "onWindowMouseUp", (e) => {
|
|
3426
3434
|
const t = e;
|
|
3427
|
-
this.mouseUpEventVerifier(t) && (this.removeWindowMouseListeners(), this.trySelectNode());
|
|
3435
|
+
this.mouseUpEventVerifier(t) && (this.removeWindowMouseListeners(), this.trySelectNode(e));
|
|
3428
3436
|
});
|
|
3429
|
-
i(this, "onWindowTouchEnd", () => {
|
|
3430
|
-
this.removeWindowTouchListeners(), this.trySelectNode();
|
|
3437
|
+
i(this, "onWindowTouchEnd", (e) => {
|
|
3438
|
+
this.removeWindowTouchListeners(), this.trySelectNode(e);
|
|
3431
3439
|
});
|
|
3432
3440
|
i(this, "onWindowTouchCancel", () => {
|
|
3433
3441
|
this.removeWindowTouchListeners();
|
|
3434
3442
|
});
|
|
3435
|
-
this.
|
|
3443
|
+
this.canvas = e, this.window = t, this.pointInsideVerifier = o, this.mouseDownEventVerifier = s.mouseDownEventVerifier, this.mouseUpEventVerifier = s.mouseUpEventVerifier, this.onNodeSelected = s.onNodeSelected, this.movementThreshold = s.movementThreshold, this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
3436
3444
|
}
|
|
3437
|
-
static configure(e) {
|
|
3438
|
-
new
|
|
3445
|
+
static configure(e, t, o, s) {
|
|
3446
|
+
new le(
|
|
3447
|
+
e,
|
|
3448
|
+
t,
|
|
3449
|
+
o,
|
|
3450
|
+
s
|
|
3451
|
+
);
|
|
3439
3452
|
}
|
|
3440
3453
|
removeWindowMouseListeners() {
|
|
3441
3454
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -3443,20 +3456,17 @@ class ue {
|
|
|
3443
3456
|
removeWindowTouchListeners() {
|
|
3444
3457
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchEnd), this.window.removeEventListener("touchcancel", this.onWindowTouchCancel);
|
|
3445
3458
|
}
|
|
3446
|
-
trySelectNode() {
|
|
3447
|
-
const
|
|
3448
|
-
this.canvas.graph.hasNode(
|
|
3459
|
+
trySelectNode(e) {
|
|
3460
|
+
const t = this.selectionCandidateNodeId;
|
|
3461
|
+
this.canvas.graph.hasNode(t) && (this.onNodeSelected(t), e.ignoreCanvasSelection = !0);
|
|
3449
3462
|
}
|
|
3450
3463
|
processMoveThresholdVerification(e, t, o) {
|
|
3451
3464
|
const s = Math.sqrt(e * e + t * t);
|
|
3452
3465
|
this.movedDistance += s, this.movedDistance > this.movementThreshold && o();
|
|
3453
3466
|
}
|
|
3454
3467
|
}
|
|
3455
|
-
class
|
|
3456
|
-
constructor(e) {
|
|
3457
|
-
i(this, "element");
|
|
3458
|
-
i(this, "canvas");
|
|
3459
|
-
i(this, "window");
|
|
3468
|
+
class ue {
|
|
3469
|
+
constructor(e, t, o, s, n) {
|
|
3460
3470
|
i(this, "onCanvasSelected");
|
|
3461
3471
|
i(this, "movementThreshold");
|
|
3462
3472
|
i(this, "mouseDownEventVerifier");
|
|
@@ -3487,12 +3497,7 @@ class ge {
|
|
|
3487
3497
|
});
|
|
3488
3498
|
i(this, "onWindowMouseMove", (e) => {
|
|
3489
3499
|
const t = e;
|
|
3490
|
-
if (!
|
|
3491
|
-
this.window,
|
|
3492
|
-
this.element,
|
|
3493
|
-
t.clientX,
|
|
3494
|
-
t.clientY
|
|
3495
|
-
)) {
|
|
3500
|
+
if (!this.pointInsideVerifier.verify(t.clientX, t.clientY)) {
|
|
3496
3501
|
this.removeWindowMouseListeners();
|
|
3497
3502
|
return;
|
|
3498
3503
|
}
|
|
@@ -3508,7 +3513,7 @@ class ge {
|
|
|
3508
3513
|
return;
|
|
3509
3514
|
}
|
|
3510
3515
|
const o = t.touches[0];
|
|
3511
|
-
if (!
|
|
3516
|
+
if (!this.pointInsideVerifier.verify(o.clientX, o.clientY)) {
|
|
3512
3517
|
this.removeWindowTouchListeners();
|
|
3513
3518
|
return;
|
|
3514
3519
|
}
|
|
@@ -3519,7 +3524,9 @@ class ge {
|
|
|
3519
3524
|
});
|
|
3520
3525
|
i(this, "onWindowMouseUp", (e) => {
|
|
3521
3526
|
const t = e;
|
|
3522
|
-
this.mouseUpEventVerifier(t)
|
|
3527
|
+
if (!this.mouseUpEventVerifier(t))
|
|
3528
|
+
return;
|
|
3529
|
+
e.ignoreCanvasSelection !== !0 && this.onCanvasSelected(), this.removeWindowMouseListeners();
|
|
3523
3530
|
});
|
|
3524
3531
|
i(this, "onWindowTouchEnd", () => {
|
|
3525
3532
|
this.onCanvasSelected(), this.removeWindowTouchListeners();
|
|
@@ -3530,14 +3537,20 @@ class ge {
|
|
|
3530
3537
|
i(this, "restore", () => {
|
|
3531
3538
|
this.element.removeEventListener("mousedown", this.onMouseDown), this.element.removeEventListener("touchstart", this.onTouchStart), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
3532
3539
|
});
|
|
3533
|
-
this.
|
|
3540
|
+
this.canvas = e, this.element = t, this.window = o, this.pointInsideVerifier = s, this.onCanvasSelected = n.onCanvasSelected, this.movementThreshold = n.movementThreshold, this.mouseDownEventVerifier = n.mouseDownEventVerifier, this.mouseUpEventVerifier = n.mouseUpEventVerifier, this.canvas.onBeforeDestroy.subscribe(this.restore), this.element.addEventListener("mousedown", this.onMouseDown, {
|
|
3534
3541
|
passive: !0
|
|
3535
3542
|
}), this.element.addEventListener("touchstart", this.onTouchStart, {
|
|
3536
3543
|
passive: !0
|
|
3537
3544
|
});
|
|
3538
3545
|
}
|
|
3539
|
-
static configure(e) {
|
|
3540
|
-
new
|
|
3546
|
+
static configure(e, t, o, s, n) {
|
|
3547
|
+
new ue(
|
|
3548
|
+
e,
|
|
3549
|
+
t,
|
|
3550
|
+
o,
|
|
3551
|
+
s,
|
|
3552
|
+
n
|
|
3553
|
+
);
|
|
3541
3554
|
}
|
|
3542
3555
|
removeWindowMouseListeners() {
|
|
3543
3556
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -3553,19 +3566,19 @@ class ge {
|
|
|
3553
3566
|
const Ht = () => {
|
|
3554
3567
|
const r = document.createElement("div");
|
|
3555
3568
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3556
|
-
},
|
|
3569
|
+
}, Q = () => {
|
|
3557
3570
|
const r = document.createElement("div");
|
|
3558
3571
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3559
|
-
},
|
|
3560
|
-
const r =
|
|
3572
|
+
}, xe = () => {
|
|
3573
|
+
const r = Q();
|
|
3561
3574
|
return r.style.pointerEvents = "none", r;
|
|
3562
3575
|
};
|
|
3563
3576
|
class Gt {
|
|
3564
3577
|
constructor(e) {
|
|
3565
|
-
i(this, "background",
|
|
3566
|
-
i(this, "main",
|
|
3567
|
-
i(this, "overlayConnectablePorts",
|
|
3568
|
-
i(this, "overlayDraggableEdges",
|
|
3578
|
+
i(this, "background", Q());
|
|
3579
|
+
i(this, "main", Q());
|
|
3580
|
+
i(this, "overlayConnectablePorts", xe());
|
|
3581
|
+
i(this, "overlayDraggableEdges", xe());
|
|
3569
3582
|
i(this, "host", Ht());
|
|
3570
3583
|
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);
|
|
3571
3584
|
}
|
|
@@ -3630,7 +3643,7 @@ const jt = (r) => {
|
|
|
3630
3643
|
canvasHeight: e.canvasHeight
|
|
3631
3644
|
}),
|
|
3632
3645
|
e.nextTransform
|
|
3633
|
-
),
|
|
3646
|
+
), Ee = (r) => {
|
|
3634
3647
|
if (typeof r == "function")
|
|
3635
3648
|
return r;
|
|
3636
3649
|
switch (r.type) {
|
|
@@ -3647,18 +3660,18 @@ const jt = (r) => {
|
|
|
3647
3660
|
maxY: r.maxY ?? 1 / 0
|
|
3648
3661
|
});
|
|
3649
3662
|
}
|
|
3650
|
-
},
|
|
3651
|
-
var p, y, f, x, E, b, T, C, I, U,
|
|
3663
|
+
}, Ae = (r) => {
|
|
3664
|
+
var p, y, f, x, E, b, T, C, I, F, U, pe;
|
|
3652
3665
|
const e = (p = r == null ? void 0 : r.scale) == null ? void 0 : p.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
|
|
3653
3666
|
let s;
|
|
3654
3667
|
o !== void 0 ? Array.isArray(o) ? s = Qt(
|
|
3655
3668
|
o.map(
|
|
3656
|
-
(
|
|
3669
|
+
(D) => Ee(D)
|
|
3657
3670
|
)
|
|
3658
|
-
) : s =
|
|
3671
|
+
) : s = Ee(o) : s = (D) => D.nextTransform;
|
|
3659
3672
|
const n = ((y = r == null ? void 0 : r.shift) == null ? void 0 : y.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeTransformChange) ?? (() => {
|
|
3660
3673
|
}), h = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformChange) ?? (() => {
|
|
3661
|
-
}), d = (E = r == null ? void 0 : r.shift) == null ? void 0 : E.mouseDownEventVerifier, c = d !== void 0 ? d : (
|
|
3674
|
+
}), d = (E = r == null ? void 0 : r.shift) == null ? void 0 : E.mouseDownEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, u = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseUpEventVerifier, g = u !== void 0 ? u : (D) => D.button === 0, l = (T = r == null ? void 0 : r.scale) == null ? void 0 : T.mouseWheelEventVerifier, w = l !== void 0 ? l : () => !0;
|
|
3662
3675
|
return {
|
|
3663
3676
|
wheelSensitivity: t,
|
|
3664
3677
|
onTransformStarted: ((C = r == null ? void 0 : r.events) == null ? void 0 : C.onTransformStarted) ?? (() => {
|
|
@@ -3672,10 +3685,10 @@ const jt = (r) => {
|
|
|
3672
3685
|
mouseDownEventVerifier: c,
|
|
3673
3686
|
mouseUpEventVerifier: g,
|
|
3674
3687
|
mouseWheelEventVerifier: w,
|
|
3675
|
-
scaleWheelFinishTimeout: ((
|
|
3676
|
-
onResizeTransformStarted: ((
|
|
3688
|
+
scaleWheelFinishTimeout: ((F = r == null ? void 0 : r.scale) == null ? void 0 : F.wheelFinishTimeout) ?? 500,
|
|
3689
|
+
onResizeTransformStarted: ((U = r == null ? void 0 : r.events) == null ? void 0 : U.onResizeTransformStarted) ?? (() => {
|
|
3677
3690
|
}),
|
|
3678
|
-
onResizeTransformFinished: ((
|
|
3691
|
+
onResizeTransformFinished: ((pe = r == null ? void 0 : r.events) == null ? void 0 : pe.onResizeTransformFinished) ?? (() => {
|
|
3679
3692
|
})
|
|
3680
3693
|
};
|
|
3681
3694
|
}, Zt = (r, e) => {
|
|
@@ -3695,7 +3708,7 @@ const jt = (r) => {
|
|
|
3695
3708
|
renderer: s,
|
|
3696
3709
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3697
3710
|
};
|
|
3698
|
-
},
|
|
3711
|
+
}, ge = (r) => {
|
|
3699
3712
|
if (typeof r == "function")
|
|
3700
3713
|
return r;
|
|
3701
3714
|
switch (r.type) {
|
|
@@ -3780,7 +3793,7 @@ const jt = (r) => {
|
|
|
3780
3793
|
onEdgeCreationInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeCreationInterrupted) ?? d,
|
|
3781
3794
|
onEdgeCreationPrevented: ((g = r.events) == null ? void 0 : g.onEdgeCreationPrevented) ?? h,
|
|
3782
3795
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3783
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
3796
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? ge(r.edgeShape) : e
|
|
3784
3797
|
};
|
|
3785
3798
|
}, tr = (r, e) => {
|
|
3786
3799
|
var c, u, g;
|
|
@@ -3796,7 +3809,7 @@ const jt = (r) => {
|
|
|
3796
3809
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? o,
|
|
3797
3810
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
|
|
3798
3811
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3799
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
3812
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ge(r.draggingEdgeShape) : null,
|
|
3800
3813
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3801
3814
|
onEdgeReattachInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeReattachInterrupted) ?? d,
|
|
3802
3815
|
onEdgeReattachPrevented: ((g = r.events) == null ? void 0 : g.onEdgeReattachPrevented) ?? h
|
|
@@ -3819,7 +3832,7 @@ class sr extends Error {
|
|
|
3819
3832
|
i(this, "name", "CanvasBuilderError");
|
|
3820
3833
|
}
|
|
3821
3834
|
}
|
|
3822
|
-
class
|
|
3835
|
+
class Ye {
|
|
3823
3836
|
constructor(e, t, o) {
|
|
3824
3837
|
i(this, "dt");
|
|
3825
3838
|
i(this, "nodeMass");
|
|
@@ -3857,7 +3870,7 @@ class Xe {
|
|
|
3857
3870
|
});
|
|
3858
3871
|
}
|
|
3859
3872
|
}
|
|
3860
|
-
class
|
|
3873
|
+
class Xe {
|
|
3861
3874
|
constructor(e) {
|
|
3862
3875
|
i(this, "PI2", 2 * Math.PI);
|
|
3863
3876
|
this.rand = e;
|
|
@@ -3876,7 +3889,7 @@ class He {
|
|
|
3876
3889
|
return { ex: h, ey: d, d: a };
|
|
3877
3890
|
}
|
|
3878
3891
|
}
|
|
3879
|
-
const
|
|
3892
|
+
const He = (r) => {
|
|
3880
3893
|
if (r.distance === 0)
|
|
3881
3894
|
return r.maxForce;
|
|
3882
3895
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
@@ -3897,7 +3910,7 @@ class ir {
|
|
|
3897
3910
|
const d = o[h], c = e.get(a), u = e.get(d), g = this.distanceVectorGenerator.create(
|
|
3898
3911
|
c,
|
|
3899
3912
|
u
|
|
3900
|
-
), l =
|
|
3913
|
+
), l = He({
|
|
3901
3914
|
coefficient: 1,
|
|
3902
3915
|
sourceCharge: this.nodeCharge,
|
|
3903
3916
|
targetCharge: this.nodeCharge,
|
|
@@ -4211,7 +4224,7 @@ class hr {
|
|
|
4211
4224
|
const t = this.distanceVectorGenerator.create(
|
|
4212
4225
|
e.sourceCoords,
|
|
4213
4226
|
e.targetCoords
|
|
4214
|
-
), o =
|
|
4227
|
+
), o = He({
|
|
4215
4228
|
coefficient: this.nodeForceCoefficient,
|
|
4216
4229
|
sourceCharge: e.sourceCharge,
|
|
4217
4230
|
targetCharge: e.targetCharge,
|
|
@@ -4246,7 +4259,7 @@ class hr {
|
|
|
4246
4259
|
}
|
|
4247
4260
|
}
|
|
4248
4261
|
}
|
|
4249
|
-
const
|
|
4262
|
+
const Ge = (r) => r.theta !== 0 ? new hr({
|
|
4250
4263
|
nodeCharge: r.nodeCharge,
|
|
4251
4264
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
4252
4265
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -4260,7 +4273,7 @@ const je = (r) => r.theta !== 0 ? new hr({
|
|
|
4260
4273
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
4261
4274
|
maxForce: r.maxForce
|
|
4262
4275
|
});
|
|
4263
|
-
class
|
|
4276
|
+
class je {
|
|
4264
4277
|
constructor(e) {
|
|
4265
4278
|
i(this, "rand");
|
|
4266
4279
|
i(this, "sparsity");
|
|
@@ -4294,7 +4307,7 @@ class dr {
|
|
|
4294
4307
|
i(this, "edgeEquilibriumLength");
|
|
4295
4308
|
i(this, "edgeStiffness");
|
|
4296
4309
|
i(this, "convergenceVelocity");
|
|
4297
|
-
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
|
|
4310
|
+
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 Xe(e.rand), this.nodeForcesApplicationStrategy = Ge({
|
|
4298
4311
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4299
4312
|
nodeCharge: e.nodeCharge,
|
|
4300
4313
|
maxForce: e.maxForce,
|
|
@@ -4302,7 +4315,7 @@ class dr {
|
|
|
4302
4315
|
theta: e.barnesHutTheta,
|
|
4303
4316
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4304
4317
|
nodeMass: e.nodeMass
|
|
4305
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4318
|
+
}), this.fillerLayoutAlgorithm = new je({
|
|
4306
4319
|
rand: e.rand,
|
|
4307
4320
|
sparsity: e.edgeEquilibriumLength
|
|
4308
4321
|
});
|
|
@@ -4312,7 +4325,7 @@ class dr {
|
|
|
4312
4325
|
graph: t,
|
|
4313
4326
|
viewport: o
|
|
4314
4327
|
});
|
|
4315
|
-
for (let n = 0; n < this.maxIterations && !(new
|
|
4328
|
+
for (let n = 0; n < this.maxIterations && !(new Ye(
|
|
4316
4329
|
t,
|
|
4317
4330
|
s,
|
|
4318
4331
|
{
|
|
@@ -4329,12 +4342,12 @@ class dr {
|
|
|
4329
4342
|
}
|
|
4330
4343
|
}
|
|
4331
4344
|
class cr {
|
|
4332
|
-
constructor(e) {
|
|
4345
|
+
constructor(e, t) {
|
|
4333
4346
|
i(this, "forest", /* @__PURE__ */ new Set());
|
|
4334
4347
|
i(this, "remainingNodeIds");
|
|
4335
|
-
for (this.graph = e, this.remainingNodeIds = new Set(this.graph.getAllNodeIds()); this.remainingNodeIds.size > 0; ) {
|
|
4336
|
-
const [
|
|
4337
|
-
this.traverse(
|
|
4348
|
+
for (this.graph = e, this.nextLayerNodesResolver = t, this.remainingNodeIds = new Set(this.graph.getAllNodeIds()); this.remainingNodeIds.size > 0; ) {
|
|
4349
|
+
const [o] = this.remainingNodeIds;
|
|
4350
|
+
this.traverse(o);
|
|
4338
4351
|
}
|
|
4339
4352
|
}
|
|
4340
4353
|
generate() {
|
|
@@ -4351,26 +4364,20 @@ class cr {
|
|
|
4351
4364
|
const n = [];
|
|
4352
4365
|
s.forEach((a) => {
|
|
4353
4366
|
o.push(a);
|
|
4354
|
-
const h = this.
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
}), d = this.graph.getNodeIncomingEdgeIds(a.nodeId).map((u) => {
|
|
4358
|
-
const g = this.graph.getEdge(u);
|
|
4359
|
-
return this.graph.getPort(g.from).nodeId;
|
|
4367
|
+
const h = this.nextLayerNodesResolver({
|
|
4368
|
+
graph: this.graph,
|
|
4369
|
+
currentNodeId: a.nodeId
|
|
4360
4370
|
});
|
|
4361
|
-
(
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
this.remainingNodeIds.delete(u);
|
|
4368
|
-
const g = {
|
|
4369
|
-
nodeId: u,
|
|
4371
|
+
for (const d of h) {
|
|
4372
|
+
if (!this.remainingNodeIds.has(d))
|
|
4373
|
+
continue;
|
|
4374
|
+
this.remainingNodeIds.delete(d);
|
|
4375
|
+
const c = {
|
|
4376
|
+
nodeId: d,
|
|
4370
4377
|
children: /* @__PURE__ */ new Set()
|
|
4371
4378
|
};
|
|
4372
|
-
a.children.add(
|
|
4373
|
-
}
|
|
4379
|
+
a.children.add(c), n.push(c);
|
|
4380
|
+
}
|
|
4374
4381
|
}), s = n;
|
|
4375
4382
|
}
|
|
4376
4383
|
}
|
|
@@ -4448,7 +4455,10 @@ class gr {
|
|
|
4448
4455
|
this.params = e;
|
|
4449
4456
|
}
|
|
4450
4457
|
calculateCoordinates(e) {
|
|
4451
|
-
const t = /* @__PURE__ */ new Map(), s = new cr(
|
|
4458
|
+
const t = /* @__PURE__ */ new Map(), s = new cr(
|
|
4459
|
+
e.graph,
|
|
4460
|
+
this.params.nextLayerNodesResolver
|
|
4461
|
+
).generate();
|
|
4452
4462
|
let n = 0;
|
|
4453
4463
|
return s.forEach((a) => {
|
|
4454
4464
|
t.set(a.root.nodeId, { x: n, y: 0 });
|
|
@@ -4473,7 +4483,29 @@ class gr {
|
|
|
4473
4483
|
}), t;
|
|
4474
4484
|
}
|
|
4475
4485
|
}
|
|
4476
|
-
|
|
4486
|
+
const pr = (r) => {
|
|
4487
|
+
const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((n) => {
|
|
4488
|
+
const a = e.getEdge(n);
|
|
4489
|
+
return e.getPort(a.to).nodeId;
|
|
4490
|
+
}), s = e.getNodeIncomingEdgeIds(t).map((n) => {
|
|
4491
|
+
const a = e.getEdge(n);
|
|
4492
|
+
return e.getPort(a.from).nodeId;
|
|
4493
|
+
});
|
|
4494
|
+
return /* @__PURE__ */ new Set([...o, ...s]);
|
|
4495
|
+
}, wr = (r) => {
|
|
4496
|
+
const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((s) => {
|
|
4497
|
+
const n = e.getEdge(s);
|
|
4498
|
+
return e.getPort(n.to).nodeId;
|
|
4499
|
+
});
|
|
4500
|
+
return new Set(o);
|
|
4501
|
+
}, yr = (r) => {
|
|
4502
|
+
const { graph: e, currentNodeId: t } = r, o = e.getNodeIncomingEdgeIds(t).map((s) => {
|
|
4503
|
+
const n = e.getEdge(s);
|
|
4504
|
+
return e.getPort(n.from).nodeId;
|
|
4505
|
+
});
|
|
4506
|
+
return new Set(o);
|
|
4507
|
+
};
|
|
4508
|
+
class fr {
|
|
4477
4509
|
constructor(e) {
|
|
4478
4510
|
i(this, "distanceVectorGenerator");
|
|
4479
4511
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4483,7 +4515,7 @@ class pr {
|
|
|
4483
4515
|
i(this, "edgeEquilibriumLength");
|
|
4484
4516
|
i(this, "edgeStiffness");
|
|
4485
4517
|
i(this, "fillerLayoutAlgorithm");
|
|
4486
|
-
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new
|
|
4518
|
+
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Xe(e.rand), this.nodeForcesApplicationStrategy = Ge({
|
|
4487
4519
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4488
4520
|
nodeCharge: e.nodeCharge,
|
|
4489
4521
|
maxForce: e.maxForce,
|
|
@@ -4491,7 +4523,7 @@ class pr {
|
|
|
4491
4523
|
theta: e.barnesHutTheta,
|
|
4492
4524
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4493
4525
|
nodeMass: e.nodeMass
|
|
4494
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4526
|
+
}), this.fillerLayoutAlgorithm = new je({
|
|
4495
4527
|
rand: e.rand,
|
|
4496
4528
|
sparsity: e.edgeEquilibriumLength
|
|
4497
4529
|
});
|
|
@@ -4501,7 +4533,7 @@ class pr {
|
|
|
4501
4533
|
graph: t,
|
|
4502
4534
|
viewport: o
|
|
4503
4535
|
});
|
|
4504
|
-
return new
|
|
4536
|
+
return new Ye(
|
|
4505
4537
|
t,
|
|
4506
4538
|
n,
|
|
4507
4539
|
{
|
|
@@ -4518,12 +4550,12 @@ class pr {
|
|
|
4518
4550
|
}) ? /* @__PURE__ */ new Map() : n;
|
|
4519
4551
|
}
|
|
4520
4552
|
}
|
|
4521
|
-
const
|
|
4553
|
+
const Je = (r) => {
|
|
4522
4554
|
let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
|
|
4523
4555
|
for (let n = 0, a; n < r.length; n++)
|
|
4524
4556
|
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);
|
|
4525
4557
|
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];
|
|
4526
|
-
},
|
|
4558
|
+
}, Ke = (r, e, t, o) => function() {
|
|
4527
4559
|
r |= 0, e |= 0, t |= 0, o |= 0;
|
|
4528
4560
|
const s = (r + e | 0) + o | 0;
|
|
4529
4561
|
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;
|
|
@@ -4541,18 +4573,18 @@ const Ke = (r) => {
|
|
|
4541
4573
|
nodeForceCoefficient: 1,
|
|
4542
4574
|
barnesHutAreaRadiusThreshold: 0.01,
|
|
4543
4575
|
barnesHutTheta: 1
|
|
4544
|
-
}),
|
|
4576
|
+
}), V = Object.freeze({
|
|
4545
4577
|
mouseDownEventVerifier: (r) => r.button === 0,
|
|
4546
4578
|
mouseUpEventVerifier: (r) => r.button === 0,
|
|
4547
4579
|
movementThreshold: 10
|
|
4548
|
-
}),
|
|
4580
|
+
}), vr = (r) => {
|
|
4549
4581
|
var e, t;
|
|
4550
4582
|
switch (r == null ? void 0 : r.type) {
|
|
4551
4583
|
case "custom":
|
|
4552
4584
|
return r.instance;
|
|
4553
4585
|
default: {
|
|
4554
|
-
const o =
|
|
4555
|
-
return new
|
|
4586
|
+
const o = Je((r == null ? void 0 : r.seed) ?? A.seed), s = Ke(o[0], o[1], o[2], o[3]);
|
|
4587
|
+
return new fr({
|
|
4556
4588
|
rand: s,
|
|
4557
4589
|
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? A.maxTimeDeltaSec,
|
|
4558
4590
|
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
|
|
@@ -4567,30 +4599,30 @@ const Ke = (r) => {
|
|
|
4567
4599
|
});
|
|
4568
4600
|
}
|
|
4569
4601
|
}
|
|
4570
|
-
},
|
|
4602
|
+
}, K = {
|
|
4571
4603
|
staticNodeResolver: () => !1,
|
|
4572
4604
|
onBeforeApplied: () => {
|
|
4573
4605
|
},
|
|
4574
4606
|
onAfterApplied: () => {
|
|
4575
4607
|
}
|
|
4576
|
-
},
|
|
4608
|
+
}, mr = (r) => {
|
|
4577
4609
|
var t, o;
|
|
4578
4610
|
return {
|
|
4579
|
-
algorithm:
|
|
4580
|
-
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ??
|
|
4581
|
-
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ??
|
|
4582
|
-
onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ??
|
|
4611
|
+
algorithm: vr((r == null ? void 0 : r.algorithm) ?? {}),
|
|
4612
|
+
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? K.staticNodeResolver,
|
|
4613
|
+
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? K.onBeforeApplied,
|
|
4614
|
+
onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? K.onAfterApplied
|
|
4583
4615
|
};
|
|
4584
|
-
},
|
|
4616
|
+
}, xr = (r) => r instanceof _ ? {
|
|
4585
4617
|
type: "trigger",
|
|
4586
4618
|
trigger: r
|
|
4587
4619
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
4588
4620
|
type: "topologyChangeSchedule",
|
|
4589
|
-
schedule:
|
|
4621
|
+
schedule: Ft
|
|
4590
4622
|
} : {
|
|
4591
4623
|
type: "topologyChangeSchedule",
|
|
4592
4624
|
schedule: Ut
|
|
4593
|
-
},
|
|
4625
|
+
}, $ = Object.freeze({
|
|
4594
4626
|
staticNodeResolver: () => !1,
|
|
4595
4627
|
onBeforeApplied: () => {
|
|
4596
4628
|
},
|
|
@@ -4600,14 +4632,14 @@ const Ke = (r) => {
|
|
|
4600
4632
|
layerWidth: 300,
|
|
4601
4633
|
layerSpace: 300
|
|
4602
4634
|
}
|
|
4603
|
-
}),
|
|
4635
|
+
}), z = (r, e) => ({
|
|
4604
4636
|
a: r.a * e.a + r.b * e.d,
|
|
4605
4637
|
b: r.a * e.b + r.b * e.e,
|
|
4606
4638
|
c: r.a * e.c + r.b * e.f + r.c,
|
|
4607
4639
|
d: r.d * e.a + r.e * e.d,
|
|
4608
4640
|
e: r.d * e.b + r.e * e.e,
|
|
4609
4641
|
f: r.d * e.c + r.e * e.f + r.f
|
|
4610
|
-
}),
|
|
4642
|
+
}), Er = (r) => {
|
|
4611
4643
|
const { a: e, b: t, c: o, d: s, e: n, f: a } = r, h = e * n - t * s;
|
|
4612
4644
|
return {
|
|
4613
4645
|
a: n / h,
|
|
@@ -4618,7 +4650,7 @@ const Ke = (r) => {
|
|
|
4618
4650
|
f: (o * s - e * a) / h
|
|
4619
4651
|
};
|
|
4620
4652
|
};
|
|
4621
|
-
class
|
|
4653
|
+
class Ar {
|
|
4622
4654
|
resolve(e) {
|
|
4623
4655
|
if ("shift" in e)
|
|
4624
4656
|
return this.createShiftBaseMatrix(e.shift);
|
|
@@ -4652,18 +4684,18 @@ class mr {
|
|
|
4652
4684
|
return this.createRelativeTransform(o, s);
|
|
4653
4685
|
}
|
|
4654
4686
|
createMirrorRelativeMatrix(e, t) {
|
|
4655
|
-
const o = this.createMirrorYBaseMatrix(), s =
|
|
4687
|
+
const o = this.createMirrorYBaseMatrix(), s = z(
|
|
4656
4688
|
this.createShiftBaseMatrix(t),
|
|
4657
4689
|
this.createRotateBaseMatrix(e)
|
|
4658
4690
|
);
|
|
4659
4691
|
return this.createRelativeTransform(o, s);
|
|
4660
4692
|
}
|
|
4661
4693
|
createRelativeTransform(e, t) {
|
|
4662
|
-
const o =
|
|
4694
|
+
const o = z(
|
|
4663
4695
|
t,
|
|
4664
4696
|
e
|
|
4665
|
-
), s =
|
|
4666
|
-
return
|
|
4697
|
+
), s = Er(t);
|
|
4698
|
+
return z(o, s);
|
|
4667
4699
|
}
|
|
4668
4700
|
createShiftBaseMatrix(e) {
|
|
4669
4701
|
return {
|
|
@@ -4707,7 +4739,7 @@ class mr {
|
|
|
4707
4739
|
};
|
|
4708
4740
|
}
|
|
4709
4741
|
}
|
|
4710
|
-
const
|
|
4742
|
+
const Sr = (r) => {
|
|
4711
4743
|
if (r === void 0)
|
|
4712
4744
|
return (s) => s;
|
|
4713
4745
|
if (typeof r == "function")
|
|
@@ -4721,10 +4753,10 @@ const xr = (r) => {
|
|
|
4721
4753
|
e: 1,
|
|
4722
4754
|
f: 0
|
|
4723
4755
|
};
|
|
4724
|
-
const o = new
|
|
4756
|
+
const o = new Ar();
|
|
4725
4757
|
return e.forEach((s) => {
|
|
4726
4758
|
const n = o.resolve(s);
|
|
4727
|
-
t =
|
|
4759
|
+
t = z(t, n);
|
|
4728
4760
|
}), (s) => {
|
|
4729
4761
|
const { x: n, y: a } = s;
|
|
4730
4762
|
return {
|
|
@@ -4732,19 +4764,33 @@ const xr = (r) => {
|
|
|
4732
4764
|
y: t.d * n + t.e * a + t.f
|
|
4733
4765
|
};
|
|
4734
4766
|
};
|
|
4735
|
-
},
|
|
4767
|
+
}, Nr = (r) => {
|
|
4768
|
+
if (typeof r == "function")
|
|
4769
|
+
return r;
|
|
4770
|
+
switch (r) {
|
|
4771
|
+
case "outgoing":
|
|
4772
|
+
return wr;
|
|
4773
|
+
case "incoming":
|
|
4774
|
+
return yr;
|
|
4775
|
+
default:
|
|
4776
|
+
return pr;
|
|
4777
|
+
}
|
|
4778
|
+
}, br = (r) => {
|
|
4736
4779
|
var e, t;
|
|
4737
4780
|
switch (r == null ? void 0 : r.type) {
|
|
4738
4781
|
case "custom":
|
|
4739
4782
|
return r.instance;
|
|
4740
4783
|
case "hierarchical":
|
|
4741
4784
|
return new gr({
|
|
4742
|
-
layerWidth: r.layerWidth ??
|
|
4743
|
-
layerSpace: r.layerSpace ??
|
|
4744
|
-
transform:
|
|
4785
|
+
layerWidth: r.layerWidth ?? $.hierarchicalLayout.layerWidth,
|
|
4786
|
+
layerSpace: r.layerSpace ?? $.hierarchicalLayout.layerSpace,
|
|
4787
|
+
transform: Sr(r.transform),
|
|
4788
|
+
nextLayerNodesResolver: Nr(
|
|
4789
|
+
r.nextLayerNodesResolver
|
|
4790
|
+
)
|
|
4745
4791
|
});
|
|
4746
4792
|
default: {
|
|
4747
|
-
const o =
|
|
4793
|
+
const o = Je((r == null ? void 0 : r.seed) ?? A.seed), s = Ke(o[0], o[1], o[2], o[3]);
|
|
4748
4794
|
return new dr({
|
|
4749
4795
|
dtSec: (r == null ? void 0 : r.dtSec) ?? A.dtSec,
|
|
4750
4796
|
maxIterations: (r == null ? void 0 : r.maxIterations) ?? A.maxIterations,
|
|
@@ -4761,16 +4807,16 @@ const xr = (r) => {
|
|
|
4761
4807
|
});
|
|
4762
4808
|
}
|
|
4763
4809
|
}
|
|
4764
|
-
},
|
|
4810
|
+
}, Pr = (r) => {
|
|
4765
4811
|
var e, t;
|
|
4766
4812
|
return {
|
|
4767
|
-
algorithm:
|
|
4768
|
-
applyOn:
|
|
4769
|
-
staticNodeResolver: r.staticNodeResolver ??
|
|
4770
|
-
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ??
|
|
4771
|
-
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ??
|
|
4813
|
+
algorithm: br(r.algorithm),
|
|
4814
|
+
applyOn: xr(r.applyOn),
|
|
4815
|
+
staticNodeResolver: r.staticNodeResolver ?? $.staticNodeResolver,
|
|
4816
|
+
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? $.onBeforeApplied,
|
|
4817
|
+
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? $.onAfterApplied
|
|
4772
4818
|
};
|
|
4773
|
-
},
|
|
4819
|
+
}, Tr = (r, e) => ({
|
|
4774
4820
|
...r,
|
|
4775
4821
|
onNodeDragStarted: (t) => {
|
|
4776
4822
|
e.add(t), r.onNodeDragStarted(t);
|
|
@@ -4778,7 +4824,7 @@ const xr = (r) => {
|
|
|
4778
4824
|
onNodeDragFinished: (t) => {
|
|
4779
4825
|
e.delete(t), r.onNodeDragFinished(t);
|
|
4780
4826
|
}
|
|
4781
|
-
}),
|
|
4827
|
+
}), Cr = (r, e) => {
|
|
4782
4828
|
r.graph.onBeforeNodeRemoved.subscribe((t) => {
|
|
4783
4829
|
e.delete(t);
|
|
4784
4830
|
}), r.graph.onBeforeClear.subscribe(() => {
|
|
@@ -4786,41 +4832,41 @@ const xr = (r) => {
|
|
|
4786
4832
|
}), r.onBeforeDestroy.subscribe(() => {
|
|
4787
4833
|
e.clear();
|
|
4788
4834
|
});
|
|
4789
|
-
},
|
|
4835
|
+
}, Mr = (r, e) => ({
|
|
4790
4836
|
...r,
|
|
4791
4837
|
staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
|
|
4792
|
-
}),
|
|
4838
|
+
}), Z = (r) => () => r, Se = Z(0), Dr = () => {
|
|
4793
4839
|
let r = 0;
|
|
4794
4840
|
return () => r++;
|
|
4795
|
-
},
|
|
4796
|
-
let t =
|
|
4797
|
-
const s =
|
|
4798
|
-
return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t =
|
|
4841
|
+
}, Lr = (r, e) => {
|
|
4842
|
+
let t = Se, o = Se;
|
|
4843
|
+
const s = Dr();
|
|
4844
|
+
return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t = Z(r)), typeof e == "number" && (o = Z(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
|
|
4799
4845
|
nodesPriorityFn: t,
|
|
4800
4846
|
edgesPriorityFn: o
|
|
4801
4847
|
};
|
|
4802
|
-
},
|
|
4848
|
+
}, Rr = (r) => {
|
|
4803
4849
|
var t, o, s, n, a;
|
|
4804
|
-
const e =
|
|
4850
|
+
const e = Lr(
|
|
4805
4851
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
4806
4852
|
(o = r.edges) == null ? void 0 : o.priority
|
|
4807
4853
|
);
|
|
4808
4854
|
return {
|
|
4809
4855
|
nodes: {
|
|
4810
|
-
centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ??
|
|
4856
|
+
centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? Me,
|
|
4811
4857
|
priorityFn: e.nodesPriorityFn
|
|
4812
4858
|
},
|
|
4813
4859
|
ports: {
|
|
4814
4860
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
4815
4861
|
},
|
|
4816
4862
|
edges: {
|
|
4817
|
-
shapeFactory:
|
|
4863
|
+
shapeFactory: ge(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
4818
4864
|
priorityFn: e.edgesPriorityFn
|
|
4819
4865
|
}
|
|
4820
4866
|
};
|
|
4821
|
-
},
|
|
4867
|
+
}, Vr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : re, Ir = (r) => {
|
|
4822
4868
|
var o, s, n, a;
|
|
4823
|
-
const { canvasDefaults: e } = r, t = r.hasLayout ?
|
|
4869
|
+
const { canvasDefaults: e } = r, t = r.hasLayout ? Vr(r.layoutParams) : re;
|
|
4824
4870
|
return {
|
|
4825
4871
|
focus: {
|
|
4826
4872
|
contentPadding: ((o = e.focus) == null ? void 0 : o.contentPadding) ?? ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
|
|
@@ -4829,24 +4875,18 @@ const xr = (r) => {
|
|
|
4829
4875
|
animationDuration: ((a = e.focus) == null ? void 0 : a.animationDuration) ?? 0
|
|
4830
4876
|
}
|
|
4831
4877
|
};
|
|
4832
|
-
},
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
element: e,
|
|
4843
|
-
window: t,
|
|
4844
|
-
onCanvasSelected: o.onCanvasSelected,
|
|
4845
|
-
mouseDownEventVerifier: o.mouseDownEventVerifier ?? F.mouseDownEventVerifier,
|
|
4846
|
-
mouseUpEventVerifier: o.mouseUpEventVerifier ?? F.mouseUpEventVerifier,
|
|
4847
|
-
movementThreshold: o.movementThreshold ?? F.movementThreshold
|
|
4878
|
+
}, Fr = (r) => ({
|
|
4879
|
+
onNodeSelected: r.onNodeSelected,
|
|
4880
|
+
mouseDownEventVerifier: r.mouseDownEventVerifier ?? V.mouseDownEventVerifier,
|
|
4881
|
+
mouseUpEventVerifier: r.mouseUpEventVerifier ?? V.mouseUpEventVerifier,
|
|
4882
|
+
movementThreshold: r.movementThreshold ?? V.movementThreshold
|
|
4883
|
+
}), Ur = (r) => ({
|
|
4884
|
+
onCanvasSelected: r.onCanvasSelected,
|
|
4885
|
+
mouseDownEventVerifier: r.mouseDownEventVerifier ?? V.mouseDownEventVerifier,
|
|
4886
|
+
mouseUpEventVerifier: r.mouseUpEventVerifier ?? V.mouseUpEventVerifier,
|
|
4887
|
+
movementThreshold: r.movementThreshold ?? V.movementThreshold
|
|
4848
4888
|
});
|
|
4849
|
-
class
|
|
4889
|
+
class Wr {
|
|
4850
4890
|
constructor(e) {
|
|
4851
4891
|
i(this, "used", !1);
|
|
4852
4892
|
i(this, "canvasDefaults", {});
|
|
@@ -4868,10 +4908,11 @@ class Ir {
|
|
|
4868
4908
|
i(this, "hasUserDraggableEdges", !1);
|
|
4869
4909
|
i(this, "hasAnimatedLayout", !1);
|
|
4870
4910
|
i(this, "hasLayout", !1);
|
|
4871
|
-
i(this, "boxRenderingTrigger", new
|
|
4911
|
+
i(this, "boxRenderingTrigger", new _());
|
|
4872
4912
|
i(this, "window", window);
|
|
4873
4913
|
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
4874
|
-
this
|
|
4914
|
+
i(this, "pointInsideVerifier");
|
|
4915
|
+
this.element = e, this.pointInsideVerifier = new dt(e, this.window);
|
|
4875
4916
|
}
|
|
4876
4917
|
setDefaults(e) {
|
|
4877
4918
|
return this.canvasDefaults = e, this;
|
|
@@ -4915,62 +4956,68 @@ class Ir {
|
|
|
4915
4956
|
"Failed to build Canvas because CanvasBuilder is a single-use object"
|
|
4916
4957
|
);
|
|
4917
4958
|
this.used = !0;
|
|
4918
|
-
const e = new
|
|
4959
|
+
const e = new nt(this.element), t = new Pe(), o = new Gt(this.element), s = this.createHtmlView(
|
|
4919
4960
|
o.main,
|
|
4920
4961
|
t,
|
|
4921
4962
|
e
|
|
4922
|
-
), n =
|
|
4963
|
+
), n = Rr(
|
|
4923
4964
|
this.canvasDefaults
|
|
4924
|
-
), a = new
|
|
4965
|
+
), a = new $e(
|
|
4925
4966
|
t,
|
|
4926
4967
|
s,
|
|
4927
4968
|
n
|
|
4928
|
-
), h =
|
|
4969
|
+
), h = Pr(this.layoutConfig), d = Ir({
|
|
4929
4970
|
canvasDefaults: this.canvasDefaults,
|
|
4930
4971
|
hasLayout: this.hasLayout,
|
|
4931
4972
|
layoutParams: h
|
|
4932
|
-
}), c = new
|
|
4973
|
+
}), c = new ze(
|
|
4933
4974
|
t,
|
|
4934
4975
|
e,
|
|
4935
4976
|
d,
|
|
4936
4977
|
this.window
|
|
4937
|
-
), u = new
|
|
4978
|
+
), u = new Be(e), g = new Ue(t), l = new be(
|
|
4938
4979
|
g,
|
|
4939
4980
|
u,
|
|
4940
4981
|
a,
|
|
4941
4982
|
c
|
|
4942
4983
|
);
|
|
4943
|
-
if (this.hasBackground &&
|
|
4984
|
+
if (this.hasBackground && ie.configure(
|
|
4944
4985
|
l,
|
|
4945
4986
|
qt(this.backgroundConfig),
|
|
4946
4987
|
o.background
|
|
4947
|
-
), this.hasNodeResizeReactiveEdges &&
|
|
4948
|
-
const p =
|
|
4988
|
+
), this.hasNodeResizeReactiveEdges && q.configure(l), this.userSelectableNodesConfig !== void 0) {
|
|
4989
|
+
const p = Fr(
|
|
4990
|
+
this.userSelectableNodesConfig
|
|
4991
|
+
);
|
|
4992
|
+
le.configure(
|
|
4949
4993
|
l,
|
|
4950
|
-
o.main,
|
|
4951
4994
|
this.window,
|
|
4952
|
-
this.
|
|
4995
|
+
this.pointInsideVerifier,
|
|
4996
|
+
p
|
|
4953
4997
|
);
|
|
4954
|
-
ue.configure(p);
|
|
4955
4998
|
}
|
|
4956
4999
|
if (this.userSelectableCanvasConfig !== void 0) {
|
|
4957
|
-
const p =
|
|
5000
|
+
const p = Ur(
|
|
5001
|
+
this.userSelectableCanvasConfig
|
|
5002
|
+
);
|
|
5003
|
+
ue.configure(
|
|
4958
5004
|
l,
|
|
4959
5005
|
o.main,
|
|
4960
5006
|
this.window,
|
|
4961
|
-
this.
|
|
5007
|
+
this.pointInsideVerifier,
|
|
5008
|
+
p
|
|
4962
5009
|
);
|
|
4963
|
-
ge.configure(p);
|
|
4964
5010
|
}
|
|
4965
5011
|
if (this.hasDraggableNodes) {
|
|
4966
5012
|
let p = jt(this.dragConfig);
|
|
4967
|
-
this.hasAnimatedLayout && (p =
|
|
5013
|
+
this.hasAnimatedLayout && (p = Tr(
|
|
4968
5014
|
p,
|
|
4969
5015
|
this.animationStaticNodes
|
|
4970
|
-
)),
|
|
5016
|
+
)), oe.configure(
|
|
4971
5017
|
l,
|
|
4972
5018
|
o.main,
|
|
4973
5019
|
this.window,
|
|
5020
|
+
this.pointInsideVerifier,
|
|
4974
5021
|
p
|
|
4975
5022
|
);
|
|
4976
5023
|
}
|
|
@@ -4980,11 +5027,12 @@ class Ir {
|
|
|
4980
5027
|
n.edges.shapeFactory,
|
|
4981
5028
|
n.ports.direction
|
|
4982
5029
|
);
|
|
4983
|
-
|
|
5030
|
+
ne.configure(
|
|
4984
5031
|
l,
|
|
4985
5032
|
o.overlayConnectablePorts,
|
|
4986
5033
|
e,
|
|
4987
5034
|
this.window,
|
|
5035
|
+
this.pointInsideVerifier,
|
|
4988
5036
|
p
|
|
4989
5037
|
);
|
|
4990
5038
|
}
|
|
@@ -4993,37 +5041,40 @@ class Ir {
|
|
|
4993
5041
|
this.draggableEdgesConfig,
|
|
4994
5042
|
l.graph
|
|
4995
5043
|
);
|
|
4996
|
-
|
|
5044
|
+
ae.configure(
|
|
4997
5045
|
l,
|
|
4998
5046
|
o.overlayDraggableEdges,
|
|
4999
5047
|
e,
|
|
5000
5048
|
this.window,
|
|
5049
|
+
this.pointInsideVerifier,
|
|
5001
5050
|
p
|
|
5002
5051
|
);
|
|
5003
5052
|
}
|
|
5004
|
-
if (this.virtualScrollConfig !== void 0 ?
|
|
5053
|
+
if (this.virtualScrollConfig !== void 0 ? se.configure(
|
|
5005
5054
|
l,
|
|
5006
5055
|
o.main,
|
|
5007
5056
|
this.window,
|
|
5008
|
-
|
|
5057
|
+
Ae(this.transformConfig),
|
|
5009
5058
|
this.boxRenderingTrigger,
|
|
5059
|
+
this.pointInsideVerifier,
|
|
5010
5060
|
rr(this.virtualScrollConfig)
|
|
5011
|
-
) : this.hasTransformableViewport &&
|
|
5061
|
+
) : this.hasTransformableViewport && j.configure(
|
|
5012
5062
|
l,
|
|
5013
5063
|
o.main,
|
|
5014
5064
|
this.window,
|
|
5015
|
-
|
|
5065
|
+
this.pointInsideVerifier,
|
|
5066
|
+
Ae(this.transformConfig)
|
|
5016
5067
|
), this.hasLayout && Yt.configure(l, h), this.hasAnimatedLayout) {
|
|
5017
|
-
let p =
|
|
5068
|
+
let p = mr(
|
|
5018
5069
|
this.animatedLayoutConfig
|
|
5019
5070
|
);
|
|
5020
|
-
this.hasDraggableNodes && (
|
|
5071
|
+
this.hasDraggableNodes && (Cr(
|
|
5021
5072
|
l,
|
|
5022
5073
|
this.animationStaticNodes
|
|
5023
|
-
), p =
|
|
5074
|
+
), p = Mr(
|
|
5024
5075
|
p,
|
|
5025
5076
|
this.animationStaticNodes
|
|
5026
|
-
)),
|
|
5077
|
+
)), ce.configure(l, p, this.window);
|
|
5027
5078
|
}
|
|
5028
5079
|
const w = () => {
|
|
5029
5080
|
o.destroy(), l.onBeforeDestroy.unsubscribe(w);
|
|
@@ -5031,27 +5082,27 @@ class Ir {
|
|
|
5031
5082
|
return l.onBeforeDestroy.subscribe(w), l;
|
|
5032
5083
|
}
|
|
5033
5084
|
createHtmlView(e, t, o) {
|
|
5034
|
-
let s = new
|
|
5035
|
-
return this.virtualScrollConfig !== void 0 && (s = new
|
|
5085
|
+
let s = new Ne(t, o, e);
|
|
5086
|
+
return this.virtualScrollConfig !== void 0 && (s = new ot(
|
|
5036
5087
|
s,
|
|
5037
5088
|
t,
|
|
5038
5089
|
this.boxRenderingTrigger,
|
|
5039
5090
|
or(this.virtualScrollConfig)
|
|
5040
|
-
)), s = new
|
|
5091
|
+
)), s = new st(s, t), s;
|
|
5041
5092
|
}
|
|
5042
5093
|
}
|
|
5043
5094
|
export {
|
|
5044
5095
|
Ct as BezierEdgeShape,
|
|
5045
|
-
|
|
5096
|
+
Wr as CanvasBuilder,
|
|
5046
5097
|
sr as CanvasBuilderError,
|
|
5047
5098
|
S as CanvasError,
|
|
5048
|
-
|
|
5099
|
+
R as ConnectionCategory,
|
|
5049
5100
|
Ie as DirectEdgeShape,
|
|
5050
|
-
|
|
5101
|
+
_ as EventSubject,
|
|
5051
5102
|
Mt as HorizontalEdgeShape,
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5103
|
+
It as InteractiveEdgeError,
|
|
5104
|
+
Fe as InteractiveEdgeShape,
|
|
5105
|
+
Br as MidpointEdgeShape,
|
|
5055
5106
|
Dt as StraightEdgeShape,
|
|
5056
5107
|
Lt as VerticalEdgeShape
|
|
5057
5108
|
};
|