@html-graph/html-graph 8.2.0 → 8.3.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 +8 -0
- package/dist/html-graph.js +315 -291
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var o = (r, e, t) =>
|
|
1
|
+
var He = Object.defineProperty;
|
|
2
|
+
var Xe = (r, e, t) => e in r ? He(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var o = (r, e, t) => Xe(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
var M = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(M || {});
|
|
5
|
-
const
|
|
5
|
+
const Ye = () => {
|
|
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
|
+
}, Ge = () => {
|
|
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
|
+
}, je = (r) => {
|
|
12
12
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class Ae {
|
|
15
15
|
constructor(e, t, s) {
|
|
16
|
-
o(this, "host",
|
|
17
|
-
o(this, "container",
|
|
16
|
+
o(this, "host", Ye());
|
|
17
|
+
o(this, "container", Ge());
|
|
18
18
|
o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
19
19
|
o(this, "attachedNodeIds", /* @__PURE__ */ new Set());
|
|
20
20
|
o(this, "applyTransform", () => {
|
|
@@ -25,7 +25,7 @@ class me {
|
|
|
25
25
|
}
|
|
26
26
|
attachNode(e) {
|
|
27
27
|
const t = this.graphStore.getNode(e);
|
|
28
|
-
|
|
28
|
+
je(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
|
|
29
29
|
}
|
|
30
30
|
detachNode(e) {
|
|
31
31
|
const t = this.graphStore.getNode(e);
|
|
@@ -91,7 +91,7 @@ class me {
|
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
class
|
|
94
|
+
class Ke {
|
|
95
95
|
constructor(e) {
|
|
96
96
|
o(this, "xFrom", 1 / 0);
|
|
97
97
|
o(this, "yFrom", 1 / 0);
|
|
@@ -111,7 +111,7 @@ class Ge {
|
|
|
111
111
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
class
|
|
114
|
+
class Qe {
|
|
115
115
|
constructor(e, t, s, i) {
|
|
116
116
|
o(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
117
117
|
o(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -135,7 +135,7 @@ class je {
|
|
|
135
135
|
this.handleAttachEdge(a);
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
|
-
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new
|
|
138
|
+
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new Ke(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
139
139
|
}
|
|
140
140
|
attachNode(e) {
|
|
141
141
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -189,7 +189,7 @@ class je {
|
|
|
189
189
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
class
|
|
192
|
+
class Ze {
|
|
193
193
|
constructor(e, t) {
|
|
194
194
|
o(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
195
195
|
o(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
@@ -243,7 +243,7 @@ class Ke {
|
|
|
243
243
|
this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
class
|
|
246
|
+
class Q {
|
|
247
247
|
constructor() {
|
|
248
248
|
o(this, "callbacks", /* @__PURE__ */ new Set());
|
|
249
249
|
}
|
|
@@ -260,7 +260,7 @@ class j {
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
const x = () => {
|
|
263
|
-
const r = new
|
|
263
|
+
const r = new Q();
|
|
264
264
|
return [r, r];
|
|
265
265
|
};
|
|
266
266
|
class X {
|
|
@@ -279,7 +279,7 @@ class X {
|
|
|
279
279
|
this.counter = 0;
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
|
-
class
|
|
282
|
+
class Ee {
|
|
283
283
|
constructor(e, t, s, i, n, a) {
|
|
284
284
|
o(this, "nodeIdGenerator", new X(
|
|
285
285
|
(e) => this.graphStore.hasNode(e)
|
|
@@ -467,7 +467,7 @@ class ve {
|
|
|
467
467
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.viewportStore.destroy(), this.destroyed = !0);
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
class
|
|
470
|
+
class qe {
|
|
471
471
|
constructor() {
|
|
472
472
|
o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
473
473
|
o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -513,7 +513,7 @@ class A extends Error {
|
|
|
513
513
|
o(this, "name", "CanvasError");
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
class
|
|
516
|
+
class xe {
|
|
517
517
|
constructor() {
|
|
518
518
|
o(this, "nodes", /* @__PURE__ */ new Map());
|
|
519
519
|
o(this, "ports", /* @__PURE__ */ new Map());
|
|
@@ -522,7 +522,7 @@ class Ae {
|
|
|
522
522
|
o(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
523
523
|
o(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
|
|
524
524
|
o(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
525
|
-
o(this, "elementPorts", new
|
|
525
|
+
o(this, "elementPorts", new qe());
|
|
526
526
|
o(this, "afterNodeAddedEmitter");
|
|
527
527
|
o(this, "onAfterNodeAdded");
|
|
528
528
|
o(this, "afterNodeUpdatedEmitter");
|
|
@@ -776,22 +776,22 @@ class Ae {
|
|
|
776
776
|
this.portCycleEdges.get(s).delete(e), this.portCycleEdges.get(i).delete(e), this.portIncomingEdges.get(s).delete(e), this.portIncomingEdges.get(i).delete(e), this.portOutcomingEdges.get(s).delete(e), this.portOutcomingEdges.get(i).delete(e), this.edges.delete(e);
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
|
-
const
|
|
779
|
+
const le = (r) => ({
|
|
780
780
|
scale: 1 / r.scale,
|
|
781
781
|
x: -r.x / r.scale,
|
|
782
782
|
y: -r.y / r.scale
|
|
783
|
-
}),
|
|
783
|
+
}), ge = {
|
|
784
784
|
scale: 1,
|
|
785
785
|
x: 0,
|
|
786
786
|
y: 0
|
|
787
|
-
},
|
|
787
|
+
}, ue = (r, e) => ({
|
|
788
788
|
x: r.scale * e.x + r.x,
|
|
789
789
|
y: r.scale * e.y + r.y
|
|
790
790
|
});
|
|
791
|
-
class
|
|
791
|
+
class Je {
|
|
792
792
|
constructor(e) {
|
|
793
|
-
o(this, "viewportMatrix",
|
|
794
|
-
o(this, "contentMatrix",
|
|
793
|
+
o(this, "viewportMatrix", ge);
|
|
794
|
+
o(this, "contentMatrix", ge);
|
|
795
795
|
o(this, "beforeUpdateEmitter");
|
|
796
796
|
o(this, "onBeforeUpdated");
|
|
797
797
|
o(this, "afterUpdateEmitter");
|
|
@@ -814,30 +814,30 @@ class Ze {
|
|
|
814
814
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
815
815
|
x: e.x ?? this.viewportMatrix.x,
|
|
816
816
|
y: e.y ?? this.viewportMatrix.y
|
|
817
|
-
}, this.beforeUpdateEmitter.emit(), this.contentMatrix =
|
|
817
|
+
}, this.beforeUpdateEmitter.emit(), this.contentMatrix = le(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
818
818
|
}
|
|
819
819
|
patchContentMatrix(e) {
|
|
820
820
|
this.contentMatrix = {
|
|
821
821
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
822
822
|
x: e.x ?? this.contentMatrix.x,
|
|
823
823
|
y: e.y ?? this.contentMatrix.y
|
|
824
|
-
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix =
|
|
824
|
+
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix = le(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
825
825
|
}
|
|
826
826
|
getDimensions() {
|
|
827
827
|
const { width: e, height: t } = this.host.getBoundingClientRect();
|
|
828
828
|
return { width: e, height: t };
|
|
829
829
|
}
|
|
830
830
|
createContentCoords(e) {
|
|
831
|
-
return
|
|
831
|
+
return ue(this.viewportMatrix, e);
|
|
832
832
|
}
|
|
833
833
|
createViewportCoords(e) {
|
|
834
|
-
return
|
|
834
|
+
return ue(this.contentMatrix, e);
|
|
835
835
|
}
|
|
836
836
|
destroy() {
|
|
837
837
|
this.observer.disconnect();
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
|
-
class
|
|
840
|
+
class Z {
|
|
841
841
|
constructor(e) {
|
|
842
842
|
o(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
843
843
|
o(this, "nodesResizeObserver");
|
|
@@ -860,19 +860,19 @@ class K {
|
|
|
860
860
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
|
|
861
861
|
}
|
|
862
862
|
static configure(e) {
|
|
863
|
-
new
|
|
863
|
+
new Z(e);
|
|
864
864
|
}
|
|
865
865
|
handleNodeResize(e) {
|
|
866
866
|
const t = this.elementToNodeId.get(e);
|
|
867
867
|
this.canvas.updateNode(t);
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
|
-
const
|
|
870
|
+
const _e = (r, e, t) => {
|
|
871
871
|
const { x: s, y: i, width: n, height: a } = r.getBoundingClientRect();
|
|
872
872
|
return e >= s && e <= s + n && t >= i && t <= i + a;
|
|
873
|
-
},
|
|
873
|
+
}, et = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, L = (r, e, t, s) => _e(e, t, s) && et(r, t, s), B = (r, e) => {
|
|
874
874
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
875
|
-
},
|
|
875
|
+
}, $ = (r) => {
|
|
876
876
|
const e = document.createElement("div");
|
|
877
877
|
return {
|
|
878
878
|
id: r.overlayNodeId,
|
|
@@ -887,7 +887,7 @@ const qe = (r, e, t) => {
|
|
|
887
887
|
}
|
|
888
888
|
]
|
|
889
889
|
};
|
|
890
|
-
},
|
|
890
|
+
}, tt = (r, e) => {
|
|
891
891
|
let t = e;
|
|
892
892
|
for (; t !== null; ) {
|
|
893
893
|
const s = r.findPortIdsByElement(t)[0] ?? null;
|
|
@@ -906,21 +906,21 @@ const qe = (r, e, t) => {
|
|
|
906
906
|
status: "notFound"
|
|
907
907
|
};
|
|
908
908
|
};
|
|
909
|
-
function*
|
|
909
|
+
function* Se(r, e) {
|
|
910
910
|
const t = r.elementsFromPoint(e.x, e.y);
|
|
911
911
|
for (const s of t) {
|
|
912
912
|
if (s.shadowRoot !== null) {
|
|
913
|
-
const i =
|
|
913
|
+
const i = Se(s.shadowRoot, e);
|
|
914
914
|
for (const n of i)
|
|
915
915
|
yield n;
|
|
916
916
|
}
|
|
917
917
|
yield s;
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
|
-
const
|
|
921
|
-
const t =
|
|
920
|
+
const be = (r, e) => {
|
|
921
|
+
const t = Se(document, e);
|
|
922
922
|
for (const s of t) {
|
|
923
|
-
const i =
|
|
923
|
+
const i = tt(r, s);
|
|
924
924
|
if (i.status === "portFound")
|
|
925
925
|
return i.portId;
|
|
926
926
|
if (i.status === "nodeEncountered")
|
|
@@ -929,7 +929,7 @@ const xe = (r, e) => {
|
|
|
929
929
|
return null;
|
|
930
930
|
};
|
|
931
931
|
var N = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(N || {});
|
|
932
|
-
const
|
|
932
|
+
const Pe = (r, e) => ({
|
|
933
933
|
x: r / 2,
|
|
934
934
|
y: e / 2
|
|
935
935
|
}), p = {
|
|
@@ -938,7 +938,7 @@ const Se = (r, e) => ({
|
|
|
938
938
|
}, m = (r, e, t) => ({
|
|
939
939
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
940
940
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
941
|
-
}),
|
|
941
|
+
}), Ne = (r, e) => {
|
|
942
942
|
const t = {
|
|
943
943
|
x: r.x + r.width / 2,
|
|
944
944
|
y: r.y + r.height / 2
|
|
@@ -958,7 +958,7 @@ const Se = (r, e) => ({
|
|
|
958
958
|
x: e * r.x + (1 - e) / 2 * s.x,
|
|
959
959
|
y: t * r.y + (1 - t) / 2 * s.y
|
|
960
960
|
});
|
|
961
|
-
class
|
|
961
|
+
class rt {
|
|
962
962
|
constructor(e) {
|
|
963
963
|
o(this, "path");
|
|
964
964
|
o(this, "midpoint");
|
|
@@ -983,7 +983,7 @@ class et {
|
|
|
983
983
|
this.path = `${d}${h}${c}`;
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
|
-
class
|
|
986
|
+
class st {
|
|
987
987
|
constructor(e) {
|
|
988
988
|
o(this, "path");
|
|
989
989
|
o(this, "midpoint");
|
|
@@ -1038,21 +1038,21 @@ class tt {
|
|
|
1038
1038
|
].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
|
-
const
|
|
1041
|
+
const q = Object.freeze({
|
|
1042
1042
|
edgeColor: "--edge-color"
|
|
1043
|
-
}),
|
|
1043
|
+
}), Te = (r) => {
|
|
1044
1044
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1045
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(
|
|
1046
|
-
},
|
|
1045
|
+
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(q.edgeColor, r), e;
|
|
1046
|
+
}, Ce = (r) => {
|
|
1047
1047
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1048
|
-
return e.setAttribute("stroke", `var(${
|
|
1049
|
-
},
|
|
1048
|
+
return e.setAttribute("stroke", `var(${q.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
1049
|
+
}, U = () => {
|
|
1050
1050
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1051
|
-
return r.setAttribute("fill", `var(${
|
|
1052
|
-
},
|
|
1051
|
+
return r.setAttribute("fill", `var(${q.edgeColor})`), r;
|
|
1052
|
+
}, De = () => {
|
|
1053
1053
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1054
1054
|
return r.style.transformOrigin = "50% 50%", r;
|
|
1055
|
-
},
|
|
1055
|
+
}, Me = (r, e) => {
|
|
1056
1056
|
r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${Math.max(e.width, 1)}px`, r.style.height = `${Math.max(e.height, 1)}px`;
|
|
1057
1057
|
}, D = (r, e) => {
|
|
1058
1058
|
const t = [];
|
|
@@ -1074,7 +1074,7 @@ const Q = Object.freeze({
|
|
|
1074
1074
|
}
|
|
1075
1075
|
return t.join(" ");
|
|
1076
1076
|
};
|
|
1077
|
-
class
|
|
1077
|
+
class ot {
|
|
1078
1078
|
constructor(e) {
|
|
1079
1079
|
o(this, "path");
|
|
1080
1080
|
o(this, "midpoint");
|
|
@@ -1113,7 +1113,7 @@ class rt {
|
|
|
1113
1113
|
);
|
|
1114
1114
|
}
|
|
1115
1115
|
}
|
|
1116
|
-
class
|
|
1116
|
+
class it {
|
|
1117
1117
|
constructor(e) {
|
|
1118
1118
|
o(this, "path");
|
|
1119
1119
|
o(this, "midpoint");
|
|
@@ -1144,7 +1144,7 @@ class st {
|
|
|
1144
1144
|
);
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
|
-
class
|
|
1147
|
+
class nt {
|
|
1148
1148
|
constructor(e) {
|
|
1149
1149
|
o(this, "path");
|
|
1150
1150
|
o(this, "midpoint");
|
|
@@ -1174,7 +1174,7 @@ class ot {
|
|
|
1174
1174
|
this.path = D([s, a, h, i], this.params.roundness);
|
|
1175
1175
|
}
|
|
1176
1176
|
}
|
|
1177
|
-
class
|
|
1177
|
+
class at {
|
|
1178
1178
|
constructor(e) {
|
|
1179
1179
|
o(this, "path");
|
|
1180
1180
|
o(this, "midpoint");
|
|
@@ -1213,7 +1213,7 @@ class it {
|
|
|
1213
1213
|
);
|
|
1214
1214
|
}
|
|
1215
1215
|
}
|
|
1216
|
-
class
|
|
1216
|
+
class J {
|
|
1217
1217
|
constructor(e) {
|
|
1218
1218
|
o(this, "path");
|
|
1219
1219
|
o(this, "midpoint");
|
|
@@ -1233,7 +1233,7 @@ class Z {
|
|
|
1233
1233
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${D(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
1236
|
-
class
|
|
1236
|
+
class ht {
|
|
1237
1237
|
constructor(e) {
|
|
1238
1238
|
o(this, "path");
|
|
1239
1239
|
o(this, "midpoint");
|
|
@@ -1254,7 +1254,7 @@ class nt {
|
|
|
1254
1254
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
class
|
|
1257
|
+
class dt {
|
|
1258
1258
|
constructor(e) {
|
|
1259
1259
|
o(this, "path");
|
|
1260
1260
|
o(this, "midpoint");
|
|
@@ -1290,7 +1290,7 @@ class at {
|
|
|
1290
1290
|
};
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
1293
|
-
class
|
|
1293
|
+
class ct {
|
|
1294
1294
|
constructor(e) {
|
|
1295
1295
|
o(this, "path");
|
|
1296
1296
|
o(this, "midpoint");
|
|
@@ -1331,7 +1331,7 @@ class ht {
|
|
|
1331
1331
|
);
|
|
1332
1332
|
}
|
|
1333
1333
|
}
|
|
1334
|
-
class
|
|
1334
|
+
class lt {
|
|
1335
1335
|
constructor(e) {
|
|
1336
1336
|
o(this, "path");
|
|
1337
1337
|
o(this, "midpoint");
|
|
@@ -1394,30 +1394,30 @@ const f = Object.freeze({
|
|
|
1394
1394
|
curvature: 90,
|
|
1395
1395
|
interactiveWidth: 10,
|
|
1396
1396
|
preOffset: 0
|
|
1397
|
-
}),
|
|
1397
|
+
}), pe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1398
1398
|
class z {
|
|
1399
1399
|
constructor(e) {
|
|
1400
1400
|
o(this, "svg");
|
|
1401
|
-
o(this, "group",
|
|
1401
|
+
o(this, "group", De());
|
|
1402
1402
|
o(this, "line");
|
|
1403
1403
|
o(this, "sourceArrow", null);
|
|
1404
1404
|
o(this, "targetArrow", null);
|
|
1405
1405
|
o(this, "onAfterRender");
|
|
1406
1406
|
o(this, "afterRenderEmitter");
|
|
1407
1407
|
o(this, "arrowRenderer");
|
|
1408
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg =
|
|
1408
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Te(e.color), this.svg.appendChild(this.group), this.line = Ce(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = U(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = U(), this.group.appendChild(this.targetArrow));
|
|
1409
1409
|
}
|
|
1410
1410
|
render(e) {
|
|
1411
|
-
const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } =
|
|
1411
|
+
const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Ne(
|
|
1412
1412
|
e.from,
|
|
1413
1413
|
e.to
|
|
1414
1414
|
);
|
|
1415
|
-
|
|
1416
|
-
const d =
|
|
1415
|
+
Me(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1416
|
+
const d = pe(
|
|
1417
1417
|
e.from.direction,
|
|
1418
1418
|
a,
|
|
1419
1419
|
h
|
|
1420
|
-
), c =
|
|
1420
|
+
), c = pe(
|
|
1421
1421
|
e.to.direction,
|
|
1422
1422
|
a,
|
|
1423
1423
|
h
|
|
@@ -1453,7 +1453,7 @@ class z {
|
|
|
1453
1453
|
});
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
|
-
const
|
|
1456
|
+
const gt = (r) => (e) => {
|
|
1457
1457
|
const s = [
|
|
1458
1458
|
p,
|
|
1459
1459
|
{ x: e.arrowLength, y: r.radius },
|
|
@@ -1465,7 +1465,7 @@ const ct = (r) => (e) => {
|
|
|
1465
1465
|
y: h.y + e.shift.y
|
|
1466
1466
|
})), i = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
|
|
1467
1467
|
return `${i} ${n} ${a} Z`;
|
|
1468
|
-
},
|
|
1468
|
+
}, ut = (r) => (e) => {
|
|
1469
1469
|
const t = r.radius, s = e.arrowLength, i = (s * s + 2 * s * t) / (2 * t), n = i + t, a = s + t - t * (s + t) / n, h = t * i / n, c = [p, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1470
1470
|
(y) => m(y, e.direction, p)
|
|
1471
1471
|
).map((y) => ({
|
|
@@ -1473,7 +1473,7 @@ const ct = (r) => (e) => {
|
|
|
1473
1473
|
y: y.y + e.shift.y
|
|
1474
1474
|
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1475
1475
|
return `${g} ${l} ${u} ${w}`;
|
|
1476
|
-
},
|
|
1476
|
+
}, pt = (r) => (e) => {
|
|
1477
1477
|
const t = r.smallRadius, s = r.radius, i = m(
|
|
1478
1478
|
{
|
|
1479
1479
|
x: e.arrowLength,
|
|
@@ -1499,22 +1499,22 @@ const ct = (r) => (e) => {
|
|
|
1499
1499
|
return r;
|
|
1500
1500
|
switch (r.type) {
|
|
1501
1501
|
case "triangle":
|
|
1502
|
-
return
|
|
1502
|
+
return gt({
|
|
1503
1503
|
radius: r.radius ?? f.polygonArrowRadius
|
|
1504
1504
|
});
|
|
1505
1505
|
case "arc":
|
|
1506
|
-
return
|
|
1506
|
+
return ut({
|
|
1507
1507
|
radius: r.radius ?? f.circleArrowRadius
|
|
1508
1508
|
});
|
|
1509
1509
|
default:
|
|
1510
|
-
return
|
|
1510
|
+
return pt({
|
|
1511
1511
|
smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
|
|
1512
1512
|
angle: r.angle ?? f.wedgeArrowAngle,
|
|
1513
1513
|
radius: r.radius ?? f.wedgeArrowRadius
|
|
1514
1514
|
});
|
|
1515
1515
|
}
|
|
1516
1516
|
};
|
|
1517
|
-
class
|
|
1517
|
+
class wt {
|
|
1518
1518
|
constructor(e) {
|
|
1519
1519
|
o(this, "svg");
|
|
1520
1520
|
o(this, "group");
|
|
@@ -1531,7 +1531,7 @@ class ut {
|
|
|
1531
1531
|
o(this, "hasSourceArrow");
|
|
1532
1532
|
o(this, "hasTargetArrow");
|
|
1533
1533
|
o(this, "pathShape");
|
|
1534
|
-
o(this, "createCyclePath", (e) => new
|
|
1534
|
+
o(this, "createCyclePath", (e) => new ht({
|
|
1535
1535
|
sourceDirection: e,
|
|
1536
1536
|
radius: this.portCycleRadius,
|
|
1537
1537
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1539,7 +1539,7 @@ class ut {
|
|
|
1539
1539
|
hasSourceArrow: this.hasSourceArrow,
|
|
1540
1540
|
hasTargetArrow: this.hasTargetArrow
|
|
1541
1541
|
}));
|
|
1542
|
-
o(this, "createDetourPath", (e, t, s, i, n) => new
|
|
1542
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new st({
|
|
1543
1543
|
to: s,
|
|
1544
1544
|
sourceDirection: e,
|
|
1545
1545
|
targetDirection: t,
|
|
@@ -1552,7 +1552,7 @@ class ut {
|
|
|
1552
1552
|
hasSourceArrow: this.hasSourceArrow,
|
|
1553
1553
|
hasTargetArrow: this.hasTargetArrow
|
|
1554
1554
|
}));
|
|
1555
|
-
o(this, "createLinePath", (e, t, s) => new
|
|
1555
|
+
o(this, "createLinePath", (e, t, s) => new rt({
|
|
1556
1556
|
to: s,
|
|
1557
1557
|
sourceDirection: e,
|
|
1558
1558
|
targetDirection: t,
|
|
@@ -1577,7 +1577,7 @@ class ut {
|
|
|
1577
1577
|
this.pathShape.render(e);
|
|
1578
1578
|
}
|
|
1579
1579
|
}
|
|
1580
|
-
class
|
|
1580
|
+
class yt {
|
|
1581
1581
|
constructor(e) {
|
|
1582
1582
|
o(this, "svg");
|
|
1583
1583
|
o(this, "group");
|
|
@@ -1593,7 +1593,7 @@ class pt {
|
|
|
1593
1593
|
o(this, "hasSourceArrow");
|
|
1594
1594
|
o(this, "hasTargetArrow");
|
|
1595
1595
|
o(this, "pathShape");
|
|
1596
|
-
o(this, "createCyclePath", (e) => new
|
|
1596
|
+
o(this, "createCyclePath", (e) => new J({
|
|
1597
1597
|
sourceDirection: e,
|
|
1598
1598
|
arrowLength: this.arrowLength,
|
|
1599
1599
|
side: this.cycleSquareSide,
|
|
@@ -1602,7 +1602,7 @@ class pt {
|
|
|
1602
1602
|
hasSourceArrow: this.hasSourceArrow,
|
|
1603
1603
|
hasTargetArrow: this.hasTargetArrow
|
|
1604
1604
|
}));
|
|
1605
|
-
o(this, "createDetourPath", (e, t, s, i, n) => new
|
|
1605
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new ct({
|
|
1606
1606
|
to: s,
|
|
1607
1607
|
sourceDirection: e,
|
|
1608
1608
|
targetDirection: t,
|
|
@@ -1615,7 +1615,7 @@ class pt {
|
|
|
1615
1615
|
hasSourceArrow: this.hasSourceArrow,
|
|
1616
1616
|
hasTargetArrow: this.hasTargetArrow
|
|
1617
1617
|
}));
|
|
1618
|
-
o(this, "createLinePath", (e, t, s, i) => new
|
|
1618
|
+
o(this, "createLinePath", (e, t, s, i) => new ot({
|
|
1619
1619
|
to: s,
|
|
1620
1620
|
sourceDirection: e,
|
|
1621
1621
|
targetDirection: t,
|
|
@@ -1648,7 +1648,7 @@ class pt {
|
|
|
1648
1648
|
this.pathShape.render(e);
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
|
-
class
|
|
1651
|
+
class ft {
|
|
1652
1652
|
constructor(e) {
|
|
1653
1653
|
o(this, "svg");
|
|
1654
1654
|
o(this, "group");
|
|
@@ -1665,7 +1665,7 @@ class wt {
|
|
|
1665
1665
|
o(this, "hasSourceArrow");
|
|
1666
1666
|
o(this, "hasTargetArrow");
|
|
1667
1667
|
o(this, "pathShape");
|
|
1668
|
-
o(this, "createCyclePath", (e) => new
|
|
1668
|
+
o(this, "createCyclePath", (e) => new J({
|
|
1669
1669
|
sourceDirection: e,
|
|
1670
1670
|
arrowLength: this.arrowLength,
|
|
1671
1671
|
side: this.cycleSquareSide,
|
|
@@ -1674,7 +1674,7 @@ class wt {
|
|
|
1674
1674
|
hasSourceArrow: this.hasSourceArrow,
|
|
1675
1675
|
hasTargetArrow: this.hasTargetArrow
|
|
1676
1676
|
}));
|
|
1677
|
-
o(this, "createDetourPath", (e, t, s, i, n) => new
|
|
1677
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new it({
|
|
1678
1678
|
to: s,
|
|
1679
1679
|
sourceDirection: e,
|
|
1680
1680
|
targetDirection: t,
|
|
@@ -1688,7 +1688,7 @@ class wt {
|
|
|
1688
1688
|
hasSourceArrow: this.hasSourceArrow,
|
|
1689
1689
|
hasTargetArrow: this.hasTargetArrow
|
|
1690
1690
|
}));
|
|
1691
|
-
o(this, "createLinePath", (e, t, s) => new
|
|
1691
|
+
o(this, "createLinePath", (e, t, s) => new nt({
|
|
1692
1692
|
to: s,
|
|
1693
1693
|
sourceDirection: e,
|
|
1694
1694
|
targetDirection: t,
|
|
@@ -1720,7 +1720,7 @@ class wt {
|
|
|
1720
1720
|
this.pathShape.render(e);
|
|
1721
1721
|
}
|
|
1722
1722
|
}
|
|
1723
|
-
class
|
|
1723
|
+
class mt {
|
|
1724
1724
|
constructor(e) {
|
|
1725
1725
|
o(this, "svg");
|
|
1726
1726
|
o(this, "group");
|
|
@@ -1736,7 +1736,7 @@ class yt {
|
|
|
1736
1736
|
o(this, "hasSourceArrow");
|
|
1737
1737
|
o(this, "hasTargetArrow");
|
|
1738
1738
|
o(this, "pathShape");
|
|
1739
|
-
o(this, "createCyclePath", (e) => new
|
|
1739
|
+
o(this, "createCyclePath", (e) => new J({
|
|
1740
1740
|
sourceDirection: e,
|
|
1741
1741
|
arrowLength: this.arrowLength,
|
|
1742
1742
|
side: this.cycleSquareSide,
|
|
@@ -1745,7 +1745,7 @@ class yt {
|
|
|
1745
1745
|
hasSourceArrow: this.hasSourceArrow,
|
|
1746
1746
|
hasTargetArrow: this.hasTargetArrow
|
|
1747
1747
|
}));
|
|
1748
|
-
o(this, "createDetourPath", (e, t, s, i, n) => new
|
|
1748
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new lt({
|
|
1749
1749
|
to: s,
|
|
1750
1750
|
sourceDirection: e,
|
|
1751
1751
|
targetDirection: t,
|
|
@@ -1758,7 +1758,7 @@ class yt {
|
|
|
1758
1758
|
hasSourceArrow: this.hasSourceArrow,
|
|
1759
1759
|
hasTargetArrow: this.hasTargetArrow
|
|
1760
1760
|
}));
|
|
1761
|
-
o(this, "createLinePath", (e, t, s, i, n) => new
|
|
1761
|
+
o(this, "createLinePath", (e, t, s, i, n) => new at({
|
|
1762
1762
|
to: s,
|
|
1763
1763
|
sourceDirection: e,
|
|
1764
1764
|
targetDirection: t,
|
|
@@ -1791,10 +1791,10 @@ class yt {
|
|
|
1791
1791
|
this.pathShape.render(e);
|
|
1792
1792
|
}
|
|
1793
1793
|
}
|
|
1794
|
-
class
|
|
1794
|
+
class Le {
|
|
1795
1795
|
constructor(e) {
|
|
1796
1796
|
o(this, "svg");
|
|
1797
|
-
o(this, "group",
|
|
1797
|
+
o(this, "group", De());
|
|
1798
1798
|
o(this, "line");
|
|
1799
1799
|
o(this, "sourceArrow", null);
|
|
1800
1800
|
o(this, "targetArrow", null);
|
|
@@ -1806,15 +1806,15 @@ class De {
|
|
|
1806
1806
|
o(this, "onAfterRender");
|
|
1807
1807
|
o(this, "afterRenderEmitter");
|
|
1808
1808
|
o(this, "arrowRenderer");
|
|
1809
|
-
[this.afterRenderEmitter, this.onAfterRender] = x(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = F((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg =
|
|
1809
|
+
[this.afterRenderEmitter, this.onAfterRender] = x(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = F((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg = Te(this.color), this.svg.appendChild(this.group), this.line = Ce(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = U(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = U(), this.group.appendChild(this.targetArrow));
|
|
1810
1810
|
}
|
|
1811
1811
|
render(e) {
|
|
1812
|
-
const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } =
|
|
1812
|
+
const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Ne(
|
|
1813
1813
|
e.from,
|
|
1814
1814
|
e.to
|
|
1815
1815
|
);
|
|
1816
|
-
|
|
1817
|
-
const d = { x: i, y: n }, c = new
|
|
1816
|
+
Me(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1817
|
+
const d = { x: i, y: n }, c = new dt({
|
|
1818
1818
|
to: d,
|
|
1819
1819
|
sourceOffset: this.sourceOffset,
|
|
1820
1820
|
targetOffset: this.targetOffset,
|
|
@@ -1865,40 +1865,40 @@ class De {
|
|
|
1865
1865
|
});
|
|
1866
1866
|
}
|
|
1867
1867
|
}
|
|
1868
|
-
const
|
|
1868
|
+
const vt = () => {
|
|
1869
1869
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1870
1870
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1871
|
-
},
|
|
1871
|
+
}, At = (r) => {
|
|
1872
1872
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1873
1873
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1874
|
-
},
|
|
1874
|
+
}, we = (r) => {
|
|
1875
1875
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1876
1876
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1877
1877
|
};
|
|
1878
|
-
class
|
|
1878
|
+
class Et extends Error {
|
|
1879
1879
|
constructor(e) {
|
|
1880
1880
|
super(e), this.name = "InteractiveEdgeError";
|
|
1881
1881
|
}
|
|
1882
1882
|
}
|
|
1883
|
-
class
|
|
1883
|
+
class Re {
|
|
1884
1884
|
constructor(e, t) {
|
|
1885
1885
|
o(this, "svg");
|
|
1886
1886
|
o(this, "group");
|
|
1887
1887
|
o(this, "line");
|
|
1888
1888
|
o(this, "sourceArrow");
|
|
1889
1889
|
o(this, "targetArrow");
|
|
1890
|
-
o(this, "handle",
|
|
1890
|
+
o(this, "handle", vt());
|
|
1891
1891
|
o(this, "onAfterRender");
|
|
1892
1892
|
o(this, "interactiveLine");
|
|
1893
1893
|
o(this, "interactiveSourceArrow", null);
|
|
1894
1894
|
o(this, "interactiveTargetArrow", null);
|
|
1895
|
-
if (this.baseEdge = e, e instanceof
|
|
1896
|
-
throw new
|
|
1895
|
+
if (this.baseEdge = e, e instanceof Re)
|
|
1896
|
+
throw new Et(
|
|
1897
1897
|
"interactive edge can be configured only once"
|
|
1898
1898
|
);
|
|
1899
1899
|
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;
|
|
1900
1900
|
const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
|
|
1901
|
-
this.interactiveLine =
|
|
1901
|
+
this.interactiveLine = At(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = we(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = we(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
|
|
1902
1902
|
this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
|
|
1903
1903
|
});
|
|
1904
1904
|
}
|
|
@@ -1923,7 +1923,7 @@ class dr {
|
|
|
1923
1923
|
this.baseShape.render(e);
|
|
1924
1924
|
}
|
|
1925
1925
|
}
|
|
1926
|
-
class
|
|
1926
|
+
class Ve {
|
|
1927
1927
|
constructor(e) {
|
|
1928
1928
|
o(this, "onAfterNodeAdded");
|
|
1929
1929
|
o(this, "onAfterNodeUpdated");
|
|
@@ -2019,7 +2019,7 @@ class Le {
|
|
|
2019
2019
|
return this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
2020
2020
|
}
|
|
2021
2021
|
}
|
|
2022
|
-
class
|
|
2022
|
+
class Fe {
|
|
2023
2023
|
constructor(e) {
|
|
2024
2024
|
o(this, "onBeforeUpdated");
|
|
2025
2025
|
o(this, "onAfterUpdated");
|
|
@@ -2042,21 +2042,21 @@ class Re {
|
|
|
2042
2042
|
return this.viewportStore.createViewportCoords(e);
|
|
2043
2043
|
}
|
|
2044
2044
|
}
|
|
2045
|
-
const
|
|
2046
|
-
const t = new
|
|
2045
|
+
const Ie = (r, e) => {
|
|
2046
|
+
const t = new xe(), s = new Ve(t), i = new Fe(e), n = new Ae(t, e, r), a = {
|
|
2047
2047
|
nodes: {
|
|
2048
|
-
centerFn:
|
|
2048
|
+
centerFn: Pe,
|
|
2049
2049
|
priorityFn: () => 0
|
|
2050
2050
|
},
|
|
2051
2051
|
edges: {
|
|
2052
|
-
shapeFactory: () => new
|
|
2052
|
+
shapeFactory: () => new Le(),
|
|
2053
2053
|
priorityFn: () => 0
|
|
2054
2054
|
},
|
|
2055
2055
|
ports: {
|
|
2056
2056
|
direction: 0
|
|
2057
2057
|
}
|
|
2058
2058
|
};
|
|
2059
|
-
return new
|
|
2059
|
+
return new Ee(
|
|
2060
2060
|
s,
|
|
2061
2061
|
i,
|
|
2062
2062
|
t,
|
|
@@ -2174,34 +2174,36 @@ class k {
|
|
|
2174
2174
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2175
2175
|
}
|
|
2176
2176
|
}
|
|
2177
|
-
class
|
|
2177
|
+
class xt {
|
|
2178
2178
|
constructor(e, t, s) {
|
|
2179
2179
|
this.canvas = e, this.layoutAlgorithm = t, this.params = s;
|
|
2180
2180
|
}
|
|
2181
2181
|
apply() {
|
|
2182
|
-
this.layoutAlgorithm.calculateCoordinates({
|
|
2182
|
+
const e = this.layoutAlgorithm.calculateCoordinates({
|
|
2183
2183
|
graph: this.canvas.graph,
|
|
2184
2184
|
viewport: this.canvas.viewport
|
|
2185
|
-
}).forEach((t, s) => {
|
|
2186
|
-
this.params.staticNodeResolver(s) || this.canvas.updateNode(s, t);
|
|
2187
2185
|
});
|
|
2186
|
+
this.params.onBeforeApplied(), e.forEach((t, s) => {
|
|
2187
|
+
this.params.staticNodeResolver(s) || this.canvas.updateNode(s, t);
|
|
2188
|
+
}), this.params.onAfterApplied();
|
|
2188
2189
|
}
|
|
2189
2190
|
}
|
|
2190
|
-
class
|
|
2191
|
+
class St {
|
|
2191
2192
|
constructor(e, t, s) {
|
|
2192
2193
|
this.canvas = e, this.layoutAlgorithm = t, this.params = s;
|
|
2193
2194
|
}
|
|
2194
2195
|
apply(e) {
|
|
2195
|
-
this.layoutAlgorithm.calculateNextCoordinates({
|
|
2196
|
+
const t = this.layoutAlgorithm.calculateNextCoordinates({
|
|
2196
2197
|
graph: this.canvas.graph,
|
|
2197
2198
|
viewport: this.canvas.viewport,
|
|
2198
2199
|
dt: e
|
|
2199
|
-
}).forEach((s, i) => {
|
|
2200
|
-
this.params.staticNodeResolver(i) || this.canvas.updateNode(i, s);
|
|
2201
2200
|
});
|
|
2201
|
+
this.params.onBeforeApplied(), t.forEach((s, i) => {
|
|
2202
|
+
this.params.staticNodeResolver(i) || this.canvas.updateNode(i, s);
|
|
2203
|
+
}), this.params.onAfterApplied();
|
|
2202
2204
|
}
|
|
2203
2205
|
}
|
|
2204
|
-
class
|
|
2206
|
+
class _ {
|
|
2205
2207
|
constructor(e, t, s, i) {
|
|
2206
2208
|
o(this, "grabbedNode", null);
|
|
2207
2209
|
o(this, "maxNodePriority", 0);
|
|
@@ -2247,7 +2249,7 @@ class q {
|
|
|
2247
2249
|
nodeId: i,
|
|
2248
2250
|
dx: h.x - n.x,
|
|
2249
2251
|
dy: h.y - n.y
|
|
2250
|
-
},
|
|
2252
|
+
}, B(this.element, this.params.dragCursor), this.moveNodeOnTop(i), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2251
2253
|
passive: !0
|
|
2252
2254
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2253
2255
|
passive: !0
|
|
@@ -2324,7 +2326,7 @@ class q {
|
|
|
2324
2326
|
this.canvas = e, this.element = t, this.window = s, this.params = i, this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2325
2327
|
}
|
|
2326
2328
|
static configure(e, t, s, i) {
|
|
2327
|
-
new
|
|
2329
|
+
new _(e, t, s, i);
|
|
2328
2330
|
}
|
|
2329
2331
|
moveNode(e, t) {
|
|
2330
2332
|
if (!this.graph.hasNode(e.nodeId))
|
|
@@ -2350,7 +2352,7 @@ class q {
|
|
|
2350
2352
|
}
|
|
2351
2353
|
}
|
|
2352
2354
|
cancelMouseDrag() {
|
|
2353
|
-
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null,
|
|
2355
|
+
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, B(this.element, null), this.removeMouseDragListeners();
|
|
2354
2356
|
}
|
|
2355
2357
|
removeMouseDragListeners() {
|
|
2356
2358
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -2393,11 +2395,11 @@ class q {
|
|
|
2393
2395
|
return e;
|
|
2394
2396
|
}
|
|
2395
2397
|
}
|
|
2396
|
-
const
|
|
2398
|
+
const bt = (r, e, t) => ({
|
|
2397
2399
|
scale: r.scale,
|
|
2398
2400
|
x: r.x + r.scale * e,
|
|
2399
2401
|
y: r.y + r.scale * t
|
|
2400
|
-
}),
|
|
2402
|
+
}), Pt = (r, e, t, s) => ({
|
|
2401
2403
|
scale: r.scale * e,
|
|
2402
2404
|
x: r.scale * (1 - e) * t + r.x,
|
|
2403
2405
|
y: r.scale * (1 - e) * s + r.y
|
|
@@ -2430,7 +2432,7 @@ class H {
|
|
|
2430
2432
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2431
2433
|
});
|
|
2432
2434
|
o(this, "onMouseDown", (e) => {
|
|
2433
|
-
this.element === null || !this.params.mouseDownEventVerifier(e) || (
|
|
2435
|
+
this.element === null || !this.params.mouseDownEventVerifier(e) || (B(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2434
2436
|
passive: !0
|
|
2435
2437
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2436
2438
|
passive: !0
|
|
@@ -2513,7 +2515,7 @@ class H {
|
|
|
2513
2515
|
new H(e, t, s, i);
|
|
2514
2516
|
}
|
|
2515
2517
|
moveViewport(e, t) {
|
|
2516
|
-
const s = this.viewport.getViewportMatrix(), i =
|
|
2518
|
+
const s = this.viewport.getViewportMatrix(), i = bt(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
|
|
2517
2519
|
prevTransform: s,
|
|
2518
2520
|
nextTransform: i,
|
|
2519
2521
|
canvasWidth: n,
|
|
@@ -2522,7 +2524,7 @@ class H {
|
|
|
2522
2524
|
this.performTransform(h);
|
|
2523
2525
|
}
|
|
2524
2526
|
scaleViewport(e, t, s) {
|
|
2525
|
-
const i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2527
|
+
const i = this.canvas.viewport.getViewportMatrix(), n = Pt(i, e, t, s), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
|
|
2526
2528
|
prevTransform: i,
|
|
2527
2529
|
nextTransform: n,
|
|
2528
2530
|
canvasWidth: a,
|
|
@@ -2531,7 +2533,7 @@ class H {
|
|
|
2531
2533
|
this.performTransform(d);
|
|
2532
2534
|
}
|
|
2533
2535
|
stopMouseDrag() {
|
|
2534
|
-
|
|
2536
|
+
B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
2535
2537
|
}
|
|
2536
2538
|
removeMouseDragListeners() {
|
|
2537
2539
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -2561,7 +2563,7 @@ class H {
|
|
|
2561
2563
|
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
|
|
2562
2564
|
}
|
|
2563
2565
|
}
|
|
2564
|
-
class
|
|
2566
|
+
class ee {
|
|
2565
2567
|
constructor(e, t, s, i, n, a) {
|
|
2566
2568
|
o(this, "nodeHorizontal");
|
|
2567
2569
|
o(this, "nodeVertical");
|
|
@@ -2616,7 +2618,7 @@ class J {
|
|
|
2616
2618
|
), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2617
2619
|
}
|
|
2618
2620
|
static configure(e, t, s, i, n, a) {
|
|
2619
|
-
new
|
|
2621
|
+
new ee(
|
|
2620
2622
|
e,
|
|
2621
2623
|
t,
|
|
2622
2624
|
s,
|
|
@@ -2646,24 +2648,24 @@ class J {
|
|
|
2646
2648
|
});
|
|
2647
2649
|
}
|
|
2648
2650
|
}
|
|
2649
|
-
const
|
|
2651
|
+
const Nt = () => {
|
|
2650
2652
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2651
2653
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2652
|
-
},
|
|
2654
|
+
}, Tt = () => {
|
|
2653
2655
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2654
2656
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2655
|
-
},
|
|
2657
|
+
}, Ct = () => {
|
|
2656
2658
|
const r = document.createElementNS(
|
|
2657
2659
|
"http://www.w3.org/2000/svg",
|
|
2658
2660
|
"pattern"
|
|
2659
2661
|
);
|
|
2660
2662
|
return r.setAttribute("id", "pattern"), r;
|
|
2661
2663
|
};
|
|
2662
|
-
class
|
|
2664
|
+
class te {
|
|
2663
2665
|
constructor(e, t, s) {
|
|
2664
|
-
o(this, "svg",
|
|
2665
|
-
o(this, "patternRenderingRectangle",
|
|
2666
|
-
o(this, "pattern",
|
|
2666
|
+
o(this, "svg", Nt());
|
|
2667
|
+
o(this, "patternRenderingRectangle", Tt());
|
|
2668
|
+
o(this, "pattern", Ct());
|
|
2667
2669
|
o(this, "patternContent");
|
|
2668
2670
|
o(this, "tileWidth");
|
|
2669
2671
|
o(this, "tileHeight");
|
|
@@ -2684,7 +2686,7 @@ class _ {
|
|
|
2684
2686
|
}), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
2685
2687
|
}
|
|
2686
2688
|
static configure(e, t, s) {
|
|
2687
|
-
new
|
|
2689
|
+
new te(e, t, s);
|
|
2688
2690
|
}
|
|
2689
2691
|
updateVisibility() {
|
|
2690
2692
|
const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
|
|
@@ -2697,7 +2699,7 @@ class _ {
|
|
|
2697
2699
|
this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${i}`);
|
|
2698
2700
|
}
|
|
2699
2701
|
}
|
|
2700
|
-
class
|
|
2702
|
+
class re {
|
|
2701
2703
|
constructor(e, t, s, i, n) {
|
|
2702
2704
|
o(this, "overlayCanvas");
|
|
2703
2705
|
o(this, "staticPortId", null);
|
|
@@ -2705,7 +2707,7 @@ class ee {
|
|
|
2705
2707
|
o(this, "onEdgeCreated", (e) => {
|
|
2706
2708
|
this.params.onAfterEdgeCreated(e);
|
|
2707
2709
|
});
|
|
2708
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas =
|
|
2710
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ie(
|
|
2709
2711
|
this.overlayLayer,
|
|
2710
2712
|
this.viewportStore
|
|
2711
2713
|
), k.configure(
|
|
@@ -2732,7 +2734,7 @@ class ee {
|
|
|
2732
2734
|
);
|
|
2733
2735
|
}
|
|
2734
2736
|
static configure(e, t, s, i, n) {
|
|
2735
|
-
new
|
|
2737
|
+
new re(
|
|
2736
2738
|
e,
|
|
2737
2739
|
t,
|
|
2738
2740
|
s,
|
|
@@ -2760,7 +2762,7 @@ class ee {
|
|
|
2760
2762
|
};
|
|
2761
2763
|
this.isTargetDragging = s === "direct";
|
|
2762
2764
|
const [w, y] = this.isTargetDragging ? [l, u] : [u, l];
|
|
2763
|
-
this.overlayCanvas.addNode(
|
|
2765
|
+
this.overlayCanvas.addNode($(w)), this.overlayCanvas.addNode($(y)), this.overlayCanvas.addEdge({
|
|
2764
2766
|
from: w.overlayNodeId,
|
|
2765
2767
|
to: y.overlayNodeId,
|
|
2766
2768
|
shape: this.params.edgeShapeFactory(N.EdgeId)
|
|
@@ -2770,7 +2772,7 @@ class ee {
|
|
|
2770
2772
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2771
2773
|
}
|
|
2772
2774
|
tryCreateConnection(e) {
|
|
2773
|
-
const t =
|
|
2775
|
+
const t = be(this.canvas.graph, e), s = this.staticPortId;
|
|
2774
2776
|
if (t === null) {
|
|
2775
2777
|
this.params.onEdgeCreationInterrupted({
|
|
2776
2778
|
staticPortId: s,
|
|
@@ -2792,7 +2794,7 @@ class ee {
|
|
|
2792
2794
|
});
|
|
2793
2795
|
}
|
|
2794
2796
|
}
|
|
2795
|
-
class
|
|
2797
|
+
class se {
|
|
2796
2798
|
constructor(e, t, s, i, n) {
|
|
2797
2799
|
o(this, "overlayCanvas");
|
|
2798
2800
|
o(this, "staticPortId", null);
|
|
@@ -2801,7 +2803,7 @@ class te {
|
|
|
2801
2803
|
o(this, "onEdgeReattached", (e) => {
|
|
2802
2804
|
this.params.onAfterEdgeReattached(e);
|
|
2803
2805
|
});
|
|
2804
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas =
|
|
2806
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ie(
|
|
2805
2807
|
this.overlayLayer,
|
|
2806
2808
|
this.viewportStore
|
|
2807
2809
|
), k.configure(
|
|
@@ -2825,7 +2827,7 @@ class te {
|
|
|
2825
2827
|
);
|
|
2826
2828
|
}
|
|
2827
2829
|
static configure(e, t, s, i, n) {
|
|
2828
|
-
new
|
|
2830
|
+
new se(
|
|
2829
2831
|
e,
|
|
2830
2832
|
t,
|
|
2831
2833
|
s,
|
|
@@ -2865,7 +2867,7 @@ class te {
|
|
|
2865
2867
|
portCoords: y,
|
|
2866
2868
|
portDirection: d.direction
|
|
2867
2869
|
}, [b, T] = this.isTargetDragging ? [E, S] : [S, E];
|
|
2868
|
-
this.overlayCanvas.addNode(
|
|
2870
|
+
this.overlayCanvas.addNode($(b)), this.overlayCanvas.addNode($(T));
|
|
2869
2871
|
const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(N.EdgeId) : i.shape;
|
|
2870
2872
|
return this.overlayCanvas.addEdge({
|
|
2871
2873
|
id: N.EdgeId,
|
|
@@ -2888,7 +2890,7 @@ class te {
|
|
|
2888
2890
|
});
|
|
2889
2891
|
}
|
|
2890
2892
|
tryCreateConnection(e) {
|
|
2891
|
-
const t =
|
|
2893
|
+
const t = be(this.canvas.graph, e);
|
|
2892
2894
|
if (this.overlayCanvas.removeEdge(N.EdgeId), t === null) {
|
|
2893
2895
|
const d = this.draggingEdgePayload;
|
|
2894
2896
|
this.params.onEdgeReattachInterrupted({
|
|
@@ -2921,14 +2923,14 @@ class te {
|
|
|
2921
2923
|
}
|
|
2922
2924
|
}
|
|
2923
2925
|
}
|
|
2924
|
-
class
|
|
2926
|
+
class oe {
|
|
2925
2927
|
constructor(e, t) {
|
|
2926
2928
|
this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
|
|
2927
2929
|
this.applier.apply();
|
|
2928
2930
|
});
|
|
2929
2931
|
}
|
|
2930
2932
|
static configure(e, t) {
|
|
2931
|
-
new
|
|
2933
|
+
new oe(e, t);
|
|
2932
2934
|
}
|
|
2933
2935
|
}
|
|
2934
2936
|
class O {
|
|
@@ -2958,14 +2960,16 @@ class O {
|
|
|
2958
2960
|
this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
|
|
2959
2961
|
}
|
|
2960
2962
|
}
|
|
2961
|
-
class
|
|
2963
|
+
class Dt {
|
|
2962
2964
|
static configure(e, t) {
|
|
2963
|
-
const s = t.applyOn, i = new
|
|
2964
|
-
staticNodeResolver: t.staticNodeResolver
|
|
2965
|
+
const s = t.applyOn, i = new xt(e, t.algorithm, {
|
|
2966
|
+
staticNodeResolver: t.staticNodeResolver,
|
|
2967
|
+
onBeforeApplied: t.onBeforeApplied,
|
|
2968
|
+
onAfterApplied: t.onAfterApplied
|
|
2965
2969
|
});
|
|
2966
2970
|
switch (s.type) {
|
|
2967
2971
|
case "manual": {
|
|
2968
|
-
|
|
2972
|
+
oe.configure(
|
|
2969
2973
|
i,
|
|
2970
2974
|
s.trigger
|
|
2971
2975
|
);
|
|
@@ -2998,7 +3002,7 @@ class Tt {
|
|
|
2998
3002
|
}
|
|
2999
3003
|
}
|
|
3000
3004
|
}
|
|
3001
|
-
class
|
|
3005
|
+
class Mt {
|
|
3002
3006
|
constructor(e, t) {
|
|
3003
3007
|
o(this, "previousTimeStamp");
|
|
3004
3008
|
o(this, "step", (e) => {
|
|
@@ -3013,59 +3017,61 @@ class Ct {
|
|
|
3013
3017
|
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
3014
3018
|
}
|
|
3015
3019
|
}
|
|
3016
|
-
class
|
|
3020
|
+
class ie {
|
|
3017
3021
|
constructor(e, t, s) {
|
|
3018
3022
|
o(this, "applier");
|
|
3019
3023
|
o(this, "step", (e) => {
|
|
3020
3024
|
this.applier.apply(e);
|
|
3021
3025
|
});
|
|
3022
|
-
this.win = s, this.applier = new
|
|
3023
|
-
staticNodeResolver: t.staticNodeResolver
|
|
3024
|
-
|
|
3026
|
+
this.win = s, this.applier = new St(e, t.algorithm, {
|
|
3027
|
+
staticNodeResolver: t.staticNodeResolver,
|
|
3028
|
+
onBeforeApplied: t.onBeforeApplied,
|
|
3029
|
+
onAfterApplied: t.onAfterApplied
|
|
3030
|
+
}), new Mt(this.win, this.step);
|
|
3025
3031
|
}
|
|
3026
3032
|
static configure(e, t, s) {
|
|
3027
|
-
new
|
|
3033
|
+
new ie(e, t, s);
|
|
3028
3034
|
}
|
|
3029
3035
|
}
|
|
3030
|
-
const
|
|
3036
|
+
const Lt = () => {
|
|
3031
3037
|
const r = document.createElement("div");
|
|
3032
3038
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3033
|
-
},
|
|
3039
|
+
}, j = () => {
|
|
3034
3040
|
const r = document.createElement("div");
|
|
3035
3041
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3036
|
-
},
|
|
3037
|
-
const r =
|
|
3042
|
+
}, ye = () => {
|
|
3043
|
+
const r = j();
|
|
3038
3044
|
return r.style.pointerEvents = "none", r;
|
|
3039
3045
|
};
|
|
3040
|
-
class
|
|
3046
|
+
class Rt {
|
|
3041
3047
|
constructor(e) {
|
|
3042
|
-
o(this, "background",
|
|
3043
|
-
o(this, "main",
|
|
3044
|
-
o(this, "overlayConnectablePorts",
|
|
3045
|
-
o(this, "overlayDraggableEdges",
|
|
3046
|
-
o(this, "host",
|
|
3048
|
+
o(this, "background", j());
|
|
3049
|
+
o(this, "main", j());
|
|
3050
|
+
o(this, "overlayConnectablePorts", ye());
|
|
3051
|
+
o(this, "overlayDraggableEdges", ye());
|
|
3052
|
+
o(this, "host", Lt());
|
|
3047
3053
|
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);
|
|
3048
3054
|
}
|
|
3049
3055
|
destroy() {
|
|
3050
3056
|
this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
|
|
3051
3057
|
}
|
|
3052
3058
|
}
|
|
3053
|
-
const
|
|
3059
|
+
const K = (r) => () => r, fe = K(0), Vt = () => {
|
|
3054
3060
|
let r = 0;
|
|
3055
3061
|
return () => r++;
|
|
3056
|
-
},
|
|
3057
|
-
let t =
|
|
3058
|
-
const i =
|
|
3059
|
-
return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t =
|
|
3062
|
+
}, Ft = (r, e) => {
|
|
3063
|
+
let t = fe, s = fe;
|
|
3064
|
+
const i = Vt();
|
|
3065
|
+
return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = K(r)), typeof e == "number" && (s = K(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
3060
3066
|
nodesPriorityFn: t,
|
|
3061
3067
|
edgesPriorityFn: s
|
|
3062
3068
|
};
|
|
3063
|
-
},
|
|
3069
|
+
}, ne = (r) => {
|
|
3064
3070
|
if (typeof r == "function")
|
|
3065
3071
|
return r;
|
|
3066
3072
|
switch (r.type) {
|
|
3067
3073
|
case "straight":
|
|
3068
|
-
return () => new
|
|
3074
|
+
return () => new ft({
|
|
3069
3075
|
color: r.color,
|
|
3070
3076
|
width: r.width,
|
|
3071
3077
|
arrowLength: r.arrowLength,
|
|
@@ -3079,7 +3085,7 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3079
3085
|
detourDirection: r.detourDirection
|
|
3080
3086
|
});
|
|
3081
3087
|
case "horizontal":
|
|
3082
|
-
return () => new
|
|
3088
|
+
return () => new yt({
|
|
3083
3089
|
color: r.color,
|
|
3084
3090
|
width: r.width,
|
|
3085
3091
|
arrowLength: r.arrowLength,
|
|
@@ -3092,7 +3098,7 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3092
3098
|
detourDistance: r.detourDistance
|
|
3093
3099
|
});
|
|
3094
3100
|
case "vertical":
|
|
3095
|
-
return () => new
|
|
3101
|
+
return () => new mt({
|
|
3096
3102
|
color: r.color,
|
|
3097
3103
|
width: r.width,
|
|
3098
3104
|
arrowLength: r.arrowLength,
|
|
@@ -3105,7 +3111,7 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3105
3111
|
detourDistance: r.detourDistance
|
|
3106
3112
|
});
|
|
3107
3113
|
case "direct":
|
|
3108
|
-
return () => new
|
|
3114
|
+
return () => new Le({
|
|
3109
3115
|
color: r.color,
|
|
3110
3116
|
width: r.width,
|
|
3111
3117
|
arrowLength: r.arrowLength,
|
|
@@ -3116,7 +3122,7 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3116
3122
|
targetOffset: r.targetOffset
|
|
3117
3123
|
});
|
|
3118
3124
|
default:
|
|
3119
|
-
return () => new
|
|
3125
|
+
return () => new wt({
|
|
3120
3126
|
color: r.color,
|
|
3121
3127
|
width: r.width,
|
|
3122
3128
|
arrowLength: r.arrowLength,
|
|
@@ -3130,26 +3136,26 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3130
3136
|
detourDirection: r.detourDirection
|
|
3131
3137
|
});
|
|
3132
3138
|
}
|
|
3133
|
-
},
|
|
3139
|
+
}, It = (r) => {
|
|
3134
3140
|
var t, s, i, n, a;
|
|
3135
|
-
const e =
|
|
3141
|
+
const e = Ft(
|
|
3136
3142
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
3137
3143
|
(s = r.edges) == null ? void 0 : s.priority
|
|
3138
3144
|
);
|
|
3139
3145
|
return {
|
|
3140
3146
|
nodes: {
|
|
3141
|
-
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ??
|
|
3147
|
+
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? Pe,
|
|
3142
3148
|
priorityFn: e.nodesPriorityFn
|
|
3143
3149
|
},
|
|
3144
3150
|
ports: {
|
|
3145
3151
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
3146
3152
|
},
|
|
3147
3153
|
edges: {
|
|
3148
|
-
shapeFactory:
|
|
3154
|
+
shapeFactory: ne(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
3149
3155
|
priorityFn: e.edgesPriorityFn
|
|
3150
3156
|
}
|
|
3151
3157
|
};
|
|
3152
|
-
},
|
|
3158
|
+
}, Bt = (r) => {
|
|
3153
3159
|
var w, y, E, S, b, T;
|
|
3154
3160
|
const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
|
|
3155
3161
|
}), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
|
|
@@ -3167,7 +3173,7 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3167
3173
|
nodeDragVerifier: s,
|
|
3168
3174
|
onNodeDragFinished: i
|
|
3169
3175
|
};
|
|
3170
|
-
},
|
|
3176
|
+
}, $t = (r) => {
|
|
3171
3177
|
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
|
|
3172
3178
|
return (n) => {
|
|
3173
3179
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
@@ -3177,7 +3183,7 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3177
3183
|
const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
|
|
3178
3184
|
return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3179
3185
|
};
|
|
3180
|
-
},
|
|
3186
|
+
}, Ut = (r) => {
|
|
3181
3187
|
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
|
|
3182
3188
|
return (n) => {
|
|
3183
3189
|
const a = n.prevTransform, h = n.nextTransform;
|
|
@@ -3198,7 +3204,7 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3198
3204
|
y: g
|
|
3199
3205
|
};
|
|
3200
3206
|
};
|
|
3201
|
-
},
|
|
3207
|
+
}, Ot = (r) => (e) => r.reduce(
|
|
3202
3208
|
(t, s) => s({
|
|
3203
3209
|
prevTransform: e.prevTransform,
|
|
3204
3210
|
nextTransform: t,
|
|
@@ -3206,32 +3212,32 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3206
3212
|
canvasHeight: e.canvasHeight
|
|
3207
3213
|
}),
|
|
3208
3214
|
e.nextTransform
|
|
3209
|
-
),
|
|
3215
|
+
), me = (r) => {
|
|
3210
3216
|
if (typeof r == "function")
|
|
3211
3217
|
return r;
|
|
3212
3218
|
switch (r.type) {
|
|
3213
3219
|
case "scale-limit":
|
|
3214
|
-
return
|
|
3220
|
+
return Ut({
|
|
3215
3221
|
minContentScale: r.minContentScale ?? 0,
|
|
3216
3222
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3217
3223
|
});
|
|
3218
3224
|
case "shift-limit":
|
|
3219
|
-
return
|
|
3225
|
+
return $t({
|
|
3220
3226
|
minX: r.minX ?? -1 / 0,
|
|
3221
3227
|
maxX: r.maxX ?? 1 / 0,
|
|
3222
3228
|
minY: r.minY ?? -1 / 0,
|
|
3223
3229
|
maxY: r.maxY ?? 1 / 0
|
|
3224
3230
|
});
|
|
3225
3231
|
}
|
|
3226
|
-
},
|
|
3227
|
-
var y, E, S, b, T, P, R, V,
|
|
3232
|
+
}, ve = (r) => {
|
|
3233
|
+
var y, E, S, b, T, P, R, V, ae, he, de, ce;
|
|
3228
3234
|
const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
3229
3235
|
let i;
|
|
3230
|
-
s !== void 0 ? Array.isArray(s) ? i =
|
|
3236
|
+
s !== void 0 ? Array.isArray(s) ? i = Ot(
|
|
3231
3237
|
s.map(
|
|
3232
|
-
(C) =>
|
|
3238
|
+
(C) => me(C)
|
|
3233
3239
|
)
|
|
3234
|
-
) : i =
|
|
3240
|
+
) : i = me(s) : i = (C) => C.nextTransform;
|
|
3235
3241
|
const n = ((E = r == null ? void 0 : r.shift) == null ? void 0 : E.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onBeforeTransformChange) ?? (() => {
|
|
3236
3242
|
}), h = ((b = r == null ? void 0 : r.events) == null ? void 0 : b.onTransformChange) ?? (() => {
|
|
3237
3243
|
}), d = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseDownEventVerifier, c = d !== void 0 ? d : (C) => C.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (C) => C.button === 0, u = (R = r == null ? void 0 : r.scale) == null ? void 0 : R.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
|
|
@@ -3239,7 +3245,7 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3239
3245
|
wheelSensitivity: t,
|
|
3240
3246
|
onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
|
|
3241
3247
|
}),
|
|
3242
|
-
onTransformFinished: ((
|
|
3248
|
+
onTransformFinished: ((ae = r == null ? void 0 : r.events) == null ? void 0 : ae.onTransformFinished) ?? (() => {
|
|
3243
3249
|
}),
|
|
3244
3250
|
onBeforeTransformChange: a,
|
|
3245
3251
|
onTransformChange: h,
|
|
@@ -3248,30 +3254,30 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3248
3254
|
mouseDownEventVerifier: c,
|
|
3249
3255
|
mouseUpEventVerifier: l,
|
|
3250
3256
|
mouseWheelEventVerifier: w,
|
|
3251
|
-
scaleWheelFinishTimeout: ((
|
|
3252
|
-
onResizeTransformStarted: ((
|
|
3257
|
+
scaleWheelFinishTimeout: ((he = r == null ? void 0 : r.scale) == null ? void 0 : he.wheelFinishTimeout) ?? 500,
|
|
3258
|
+
onResizeTransformStarted: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onResizeTransformStarted) ?? (() => {
|
|
3253
3259
|
}),
|
|
3254
|
-
onResizeTransformFinished: ((
|
|
3260
|
+
onResizeTransformFinished: ((ce = r == null ? void 0 : r.events) == null ? void 0 : ce.onResizeTransformFinished) ?? (() => {
|
|
3255
3261
|
})
|
|
3256
3262
|
};
|
|
3257
|
-
},
|
|
3263
|
+
}, Wt = (r, e) => {
|
|
3258
3264
|
const t = document.createElementNS(
|
|
3259
3265
|
"http://www.w3.org/2000/svg",
|
|
3260
3266
|
"circle"
|
|
3261
3267
|
);
|
|
3262
3268
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3263
|
-
},
|
|
3269
|
+
}, zt = (r) => r instanceof SVGElement ? r : Wt(
|
|
3264
3270
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3265
3271
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3266
|
-
),
|
|
3267
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i =
|
|
3272
|
+
), kt = (r) => {
|
|
3273
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = zt(r.renderer ?? {});
|
|
3268
3274
|
return {
|
|
3269
3275
|
tileWidth: t,
|
|
3270
3276
|
tileHeight: s,
|
|
3271
3277
|
renderer: i,
|
|
3272
3278
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3273
3279
|
};
|
|
3274
|
-
},
|
|
3280
|
+
}, Ht = (r, e, t) => {
|
|
3275
3281
|
var c, g, l;
|
|
3276
3282
|
const s = () => "direct", i = (u) => u, n = (u) => u.button === 0, a = () => {
|
|
3277
3283
|
}, h = () => {
|
|
@@ -3286,9 +3292,9 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3286
3292
|
onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
|
|
3287
3293
|
onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? h,
|
|
3288
3294
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3289
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
3295
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? ne(r.edgeShape) : e
|
|
3290
3296
|
};
|
|
3291
|
-
},
|
|
3297
|
+
}, Xt = (r, e) => {
|
|
3292
3298
|
var c, g, l;
|
|
3293
3299
|
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, i = (u) => u.button === 0, n = (u) => {
|
|
3294
3300
|
const w = e.getPortAdjacentEdgeIds(u);
|
|
@@ -3302,15 +3308,15 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3302
3308
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
|
|
3303
3309
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
|
|
3304
3310
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3305
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
3311
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ne(r.draggingEdgeShape) : null,
|
|
3306
3312
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3307
3313
|
onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
|
|
3308
3314
|
onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
|
|
3309
3315
|
};
|
|
3310
|
-
},
|
|
3316
|
+
}, Yt = (r) => ({
|
|
3311
3317
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3312
3318
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3313
|
-
}),
|
|
3319
|
+
}), Gt = (r) => {
|
|
3314
3320
|
var e, t;
|
|
3315
3321
|
return {
|
|
3316
3322
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3319,7 +3325,7 @@ const G = (r) => () => r, we = G(0), Lt = () => {
|
|
|
3319
3325
|
})
|
|
3320
3326
|
};
|
|
3321
3327
|
};
|
|
3322
|
-
class
|
|
3328
|
+
class jt extends Error {
|
|
3323
3329
|
constructor() {
|
|
3324
3330
|
super(...arguments);
|
|
3325
3331
|
o(this, "name", "CanvasBuilderError");
|
|
@@ -3340,7 +3346,7 @@ const v = Object.freeze({
|
|
|
3340
3346
|
barnesHutAreaRadiusThreshold: 0.01,
|
|
3341
3347
|
barnesHutTheta: 1
|
|
3342
3348
|
});
|
|
3343
|
-
class
|
|
3349
|
+
class Be {
|
|
3344
3350
|
constructor(e, t, s) {
|
|
3345
3351
|
o(this, "dt");
|
|
3346
3352
|
o(this, "nodeMass");
|
|
@@ -3378,7 +3384,7 @@ class Fe {
|
|
|
3378
3384
|
});
|
|
3379
3385
|
}
|
|
3380
3386
|
}
|
|
3381
|
-
class
|
|
3387
|
+
class $e {
|
|
3382
3388
|
constructor(e) {
|
|
3383
3389
|
o(this, "PI2", 2 * Math.PI);
|
|
3384
3390
|
this.rand = e;
|
|
@@ -3397,13 +3403,13 @@ class Ie {
|
|
|
3397
3403
|
return { ex: h, ey: d, d: a };
|
|
3398
3404
|
}
|
|
3399
3405
|
}
|
|
3400
|
-
const
|
|
3406
|
+
const Ue = (r) => {
|
|
3401
3407
|
if (r.distance === 0)
|
|
3402
3408
|
return r.maxForce;
|
|
3403
3409
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
3404
3410
|
return Math.min(e, r.maxForce);
|
|
3405
3411
|
};
|
|
3406
|
-
class
|
|
3412
|
+
class Kt {
|
|
3407
3413
|
constructor(e) {
|
|
3408
3414
|
o(this, "nodeCharge");
|
|
3409
3415
|
o(this, "distanceVectorGenerator");
|
|
@@ -3418,7 +3424,7 @@ class Gt {
|
|
|
3418
3424
|
const d = s[h], c = e.get(a), g = e.get(d), l = this.distanceVectorGenerator.create(
|
|
3419
3425
|
c,
|
|
3420
3426
|
g
|
|
3421
|
-
), u =
|
|
3427
|
+
), u = Ue({
|
|
3422
3428
|
coefficient: 1,
|
|
3423
3429
|
sourceCharge: this.nodeCharge,
|
|
3424
3430
|
targetCharge: this.nodeCharge,
|
|
@@ -3430,7 +3436,7 @@ class Gt {
|
|
|
3430
3436
|
}
|
|
3431
3437
|
}
|
|
3432
3438
|
}
|
|
3433
|
-
const
|
|
3439
|
+
const Qt = (r) => {
|
|
3434
3440
|
if (r.size === 0)
|
|
3435
3441
|
return {
|
|
3436
3442
|
centerX: 0,
|
|
@@ -3448,7 +3454,7 @@ const jt = (r) => {
|
|
|
3448
3454
|
radius: h / 2
|
|
3449
3455
|
};
|
|
3450
3456
|
};
|
|
3451
|
-
class
|
|
3457
|
+
class Zt {
|
|
3452
3458
|
constructor(e) {
|
|
3453
3459
|
o(this, "root");
|
|
3454
3460
|
o(this, "leaves", /* @__PURE__ */ new Map());
|
|
@@ -3605,7 +3611,7 @@ class Kt {
|
|
|
3605
3611
|
}), { x: t / e.size, y: s / e.size };
|
|
3606
3612
|
}
|
|
3607
3613
|
}
|
|
3608
|
-
class
|
|
3614
|
+
class qt {
|
|
3609
3615
|
constructor(e) {
|
|
3610
3616
|
o(this, "areaRadiusThreshold");
|
|
3611
3617
|
o(this, "nodeMass");
|
|
@@ -3617,7 +3623,7 @@ class Qt {
|
|
|
3617
3623
|
this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
|
|
3618
3624
|
}
|
|
3619
3625
|
apply(e, t) {
|
|
3620
|
-
const s =
|
|
3626
|
+
const s = Qt(e), i = new Zt({
|
|
3621
3627
|
box: s,
|
|
3622
3628
|
coords: e,
|
|
3623
3629
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
@@ -3732,7 +3738,7 @@ class Qt {
|
|
|
3732
3738
|
const t = this.distanceVectorGenerator.create(
|
|
3733
3739
|
e.sourceCoords,
|
|
3734
3740
|
e.targetCoords
|
|
3735
|
-
), s =
|
|
3741
|
+
), s = Ue({
|
|
3736
3742
|
coefficient: this.nodeForceCoefficient,
|
|
3737
3743
|
sourceCharge: e.sourceCharge,
|
|
3738
3744
|
targetCharge: e.targetCharge,
|
|
@@ -3767,7 +3773,7 @@ class Qt {
|
|
|
3767
3773
|
}
|
|
3768
3774
|
}
|
|
3769
3775
|
}
|
|
3770
|
-
const
|
|
3776
|
+
const Oe = (r) => r.theta !== 0 ? new qt({
|
|
3771
3777
|
nodeCharge: r.nodeCharge,
|
|
3772
3778
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3773
3779
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -3775,13 +3781,13 @@ const Ue = (r) => r.theta !== 0 ? new Qt({
|
|
|
3775
3781
|
theta: r.theta,
|
|
3776
3782
|
nodeMass: r.nodeMass,
|
|
3777
3783
|
areaRadiusThreshold: r.areaRadiusThreshold
|
|
3778
|
-
}) : new
|
|
3784
|
+
}) : new Kt({
|
|
3779
3785
|
nodeCharge: r.nodeCharge,
|
|
3780
3786
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3781
3787
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
3782
3788
|
maxForce: r.maxForce
|
|
3783
3789
|
});
|
|
3784
|
-
class
|
|
3790
|
+
class We {
|
|
3785
3791
|
constructor(e) {
|
|
3786
3792
|
o(this, "rand");
|
|
3787
3793
|
o(this, "sparsity");
|
|
@@ -3801,7 +3807,7 @@ class Be {
|
|
|
3801
3807
|
}), i;
|
|
3802
3808
|
}
|
|
3803
3809
|
}
|
|
3804
|
-
class
|
|
3810
|
+
class Jt {
|
|
3805
3811
|
constructor(e) {
|
|
3806
3812
|
o(this, "distanceVectorGenerator");
|
|
3807
3813
|
o(this, "nodeForcesApplicationStrategy");
|
|
@@ -3812,7 +3818,7 @@ class Zt {
|
|
|
3812
3818
|
o(this, "edgeEquilibriumLength");
|
|
3813
3819
|
o(this, "edgeStiffness");
|
|
3814
3820
|
o(this, "convergenceVelocity");
|
|
3815
|
-
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
|
|
3821
|
+
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new $e(e.rand), this.nodeForcesApplicationStrategy = Oe({
|
|
3816
3822
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3817
3823
|
nodeCharge: e.nodeCharge,
|
|
3818
3824
|
maxForce: e.maxForce,
|
|
@@ -3820,7 +3826,7 @@ class Zt {
|
|
|
3820
3826
|
theta: e.barnesHutTheta,
|
|
3821
3827
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
3822
3828
|
nodeMass: e.nodeMass
|
|
3823
|
-
}), this.fillerLayoutAlgorithm = new
|
|
3829
|
+
}), this.fillerLayoutAlgorithm = new We({
|
|
3824
3830
|
rand: e.rand,
|
|
3825
3831
|
sparsity: e.edgeEquilibriumLength
|
|
3826
3832
|
});
|
|
@@ -3830,7 +3836,7 @@ class Zt {
|
|
|
3830
3836
|
graph: t,
|
|
3831
3837
|
viewport: s
|
|
3832
3838
|
});
|
|
3833
|
-
for (let n = 0; n < this.maxIterations && !(new
|
|
3839
|
+
for (let n = 0; n < this.maxIterations && !(new Be(
|
|
3834
3840
|
t,
|
|
3835
3841
|
i,
|
|
3836
3842
|
{
|
|
@@ -3846,7 +3852,7 @@ class Zt {
|
|
|
3846
3852
|
return i;
|
|
3847
3853
|
}
|
|
3848
3854
|
}
|
|
3849
|
-
class
|
|
3855
|
+
class _t {
|
|
3850
3856
|
constructor(e) {
|
|
3851
3857
|
o(this, "distanceVectorGenerator");
|
|
3852
3858
|
o(this, "nodeForcesApplicationStrategy");
|
|
@@ -3856,7 +3862,7 @@ class qt {
|
|
|
3856
3862
|
o(this, "edgeEquilibriumLength");
|
|
3857
3863
|
o(this, "edgeStiffness");
|
|
3858
3864
|
o(this, "fillerLayoutAlgorithm");
|
|
3859
|
-
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new
|
|
3865
|
+
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new $e(e.rand), this.nodeForcesApplicationStrategy = Oe({
|
|
3860
3866
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3861
3867
|
nodeCharge: e.nodeCharge,
|
|
3862
3868
|
maxForce: e.maxForce,
|
|
@@ -3864,7 +3870,7 @@ class qt {
|
|
|
3864
3870
|
theta: e.barnesHutTheta,
|
|
3865
3871
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
3866
3872
|
nodeMass: e.nodeMass
|
|
3867
|
-
}), this.fillerLayoutAlgorithm = new
|
|
3873
|
+
}), this.fillerLayoutAlgorithm = new We({
|
|
3868
3874
|
rand: e.rand,
|
|
3869
3875
|
sparsity: e.edgeEquilibriumLength
|
|
3870
3876
|
});
|
|
@@ -3874,7 +3880,7 @@ class qt {
|
|
|
3874
3880
|
graph: t,
|
|
3875
3881
|
viewport: s
|
|
3876
3882
|
});
|
|
3877
|
-
return new
|
|
3883
|
+
return new Be(
|
|
3878
3884
|
t,
|
|
3879
3885
|
n,
|
|
3880
3886
|
{
|
|
@@ -3891,23 +3897,23 @@ class qt {
|
|
|
3891
3897
|
}) ? /* @__PURE__ */ new Map() : n;
|
|
3892
3898
|
}
|
|
3893
3899
|
}
|
|
3894
|
-
const
|
|
3900
|
+
const ze = (r) => {
|
|
3895
3901
|
let e = 1779033703, t = 3144134277, s = 1013904242, i = 2773480762;
|
|
3896
3902
|
for (let n = 0, a; n < r.length; n++)
|
|
3897
3903
|
a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s = i ^ Math.imul(s ^ a, 951274213), i = e ^ Math.imul(i ^ a, 2716044179);
|
|
3898
3904
|
return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(i ^ t >>> 22, 2869860233), s = Math.imul(e ^ s >>> 17, 951274213), i = Math.imul(t ^ i >>> 19, 2716044179), e ^= t ^ s ^ i, t ^= e, s ^= e, i ^= e, [e >>> 0, t >>> 0, s >>> 0, i >>> 0];
|
|
3899
|
-
},
|
|
3905
|
+
}, ke = (r, e, t, s) => function() {
|
|
3900
3906
|
r |= 0, e |= 0, t |= 0, s |= 0;
|
|
3901
3907
|
const i = (r + e | 0) + s | 0;
|
|
3902
3908
|
return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + i | 0, (i >>> 0) / 4294967296;
|
|
3903
|
-
},
|
|
3909
|
+
}, er = (r) => {
|
|
3904
3910
|
var e, t;
|
|
3905
3911
|
switch (r == null ? void 0 : r.type) {
|
|
3906
3912
|
case "custom":
|
|
3907
3913
|
return r.instance;
|
|
3908
3914
|
default: {
|
|
3909
|
-
const s =
|
|
3910
|
-
return new
|
|
3915
|
+
const s = ze((r == null ? void 0 : r.seed) ?? v.seed), i = ke(s[0], s[1], s[2], s[3]);
|
|
3916
|
+
return new _t({
|
|
3911
3917
|
rand: i,
|
|
3912
3918
|
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? v.maxTimeDeltaSec,
|
|
3913
3919
|
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? v.nodeCharge,
|
|
@@ -3922,26 +3928,35 @@ const Oe = (r) => {
|
|
|
3922
3928
|
});
|
|
3923
3929
|
}
|
|
3924
3930
|
}
|
|
3925
|
-
},
|
|
3926
|
-
staticNodeResolver: () => !1
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
}
|
|
3931
|
+
}, Y = {
|
|
3932
|
+
staticNodeResolver: () => !1,
|
|
3933
|
+
onBeforeApplied: () => {
|
|
3934
|
+
},
|
|
3935
|
+
onAfterApplied: () => {
|
|
3936
|
+
}
|
|
3937
|
+
}, tr = (r) => {
|
|
3938
|
+
var t, s;
|
|
3939
|
+
return {
|
|
3940
|
+
algorithm: er((r == null ? void 0 : r.algorithm) ?? {}),
|
|
3941
|
+
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? Y.staticNodeResolver,
|
|
3942
|
+
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? Y.onBeforeApplied,
|
|
3943
|
+
onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ?? Y.onAfterApplied
|
|
3944
|
+
};
|
|
3945
|
+
}, rr = (r) => r instanceof Q ? {
|
|
3931
3946
|
type: "manual",
|
|
3932
3947
|
trigger: r
|
|
3933
3948
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
3934
3949
|
type: "topologyChangeMacrotask"
|
|
3935
3950
|
} : {
|
|
3936
3951
|
type: "topologyChangeMicrotask"
|
|
3937
|
-
},
|
|
3952
|
+
}, sr = (r) => {
|
|
3938
3953
|
var e, t;
|
|
3939
3954
|
switch (r == null ? void 0 : r.type) {
|
|
3940
3955
|
case "custom":
|
|
3941
3956
|
return r.instance;
|
|
3942
3957
|
default: {
|
|
3943
|
-
const s =
|
|
3944
|
-
return new
|
|
3958
|
+
const s = ze((r == null ? void 0 : r.seed) ?? v.seed), i = ke(s[0], s[1], s[2], s[3]);
|
|
3959
|
+
return new Jt({
|
|
3945
3960
|
dtSec: (r == null ? void 0 : r.dtSec) ?? v.dtSec,
|
|
3946
3961
|
maxIterations: (r == null ? void 0 : r.maxIterations) ?? v.maxIterations,
|
|
3947
3962
|
rand: i,
|
|
@@ -3957,13 +3972,22 @@ const Oe = (r) => {
|
|
|
3957
3972
|
});
|
|
3958
3973
|
}
|
|
3959
3974
|
}
|
|
3960
|
-
},
|
|
3961
|
-
staticNodeResolver: () => !1
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
}
|
|
3975
|
+
}, G = {
|
|
3976
|
+
staticNodeResolver: () => !1,
|
|
3977
|
+
onBeforeApplied: () => {
|
|
3978
|
+
},
|
|
3979
|
+
onAfterApplied: () => {
|
|
3980
|
+
}
|
|
3981
|
+
}, or = (r) => {
|
|
3982
|
+
var e, t;
|
|
3983
|
+
return {
|
|
3984
|
+
algorithm: sr(r == null ? void 0 : r.algorithm),
|
|
3985
|
+
applyOn: rr(r == null ? void 0 : r.applyOn),
|
|
3986
|
+
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? G.staticNodeResolver,
|
|
3987
|
+
onBeforeApplied: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onBeforeApplied) ?? G.onBeforeApplied,
|
|
3988
|
+
onAfterApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onAfterApplied) ?? G.onAfterApplied
|
|
3989
|
+
};
|
|
3990
|
+
}, ir = (r, e) => ({
|
|
3967
3991
|
...r,
|
|
3968
3992
|
onNodeDragStarted: (t) => {
|
|
3969
3993
|
e.add(t), r.onNodeDragStarted(t);
|
|
@@ -4001,14 +4025,14 @@ class cr {
|
|
|
4001
4025
|
o(this, "hasUserDraggableEdges", !1);
|
|
4002
4026
|
o(this, "hasAnimatedLayout", !1);
|
|
4003
4027
|
o(this, "hasLayout", !1);
|
|
4004
|
-
o(this, "boxRenderingTrigger", new
|
|
4028
|
+
o(this, "boxRenderingTrigger", new Q());
|
|
4005
4029
|
o(this, "graphStore");
|
|
4006
4030
|
o(this, "viewportStore");
|
|
4007
4031
|
o(this, "graph");
|
|
4008
4032
|
o(this, "viewport");
|
|
4009
4033
|
o(this, "window", window);
|
|
4010
4034
|
o(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
4011
|
-
this.element = e, this.viewportStore = new
|
|
4035
|
+
this.element = e, this.viewportStore = new Je(this.element), this.viewport = new Fe(this.viewportStore), this.graphStore = new xe(), this.graph = new Ve(this.graphStore);
|
|
4012
4036
|
}
|
|
4013
4037
|
/**
|
|
4014
4038
|
* specifies default values for graph entities
|
|
@@ -4076,9 +4100,9 @@ class cr {
|
|
|
4076
4100
|
*/
|
|
4077
4101
|
build() {
|
|
4078
4102
|
if (this.used)
|
|
4079
|
-
throw new
|
|
4103
|
+
throw new jt("CanvasBuilder is a single use object");
|
|
4080
4104
|
this.used = !0;
|
|
4081
|
-
const e = new
|
|
4105
|
+
const e = new Rt(this.element), t = this.createHtmlView(e.main), s = It(this.canvasDefaults), i = new Ee(
|
|
4082
4106
|
this.graph,
|
|
4083
4107
|
this.viewport,
|
|
4084
4108
|
this.graphStore,
|
|
@@ -4086,16 +4110,16 @@ class cr {
|
|
|
4086
4110
|
t,
|
|
4087
4111
|
s
|
|
4088
4112
|
);
|
|
4089
|
-
if (this.hasBackground &&
|
|
4113
|
+
if (this.hasBackground && te.configure(
|
|
4090
4114
|
i,
|
|
4091
|
-
|
|
4115
|
+
kt(this.backgroundConfig),
|
|
4092
4116
|
e.background
|
|
4093
|
-
), this.hasNodeResizeReactiveEdges &&
|
|
4094
|
-
let a =
|
|
4117
|
+
), this.hasNodeResizeReactiveEdges && Z.configure(i), this.hasDraggableNodes) {
|
|
4118
|
+
let a = Bt(this.dragConfig);
|
|
4095
4119
|
this.hasAnimatedLayout && (a = ir(
|
|
4096
4120
|
a,
|
|
4097
4121
|
this.animationStaticNodes
|
|
4098
|
-
)),
|
|
4122
|
+
)), _.configure(
|
|
4099
4123
|
i,
|
|
4100
4124
|
e.main,
|
|
4101
4125
|
this.window,
|
|
@@ -4103,12 +4127,12 @@ class cr {
|
|
|
4103
4127
|
);
|
|
4104
4128
|
}
|
|
4105
4129
|
if (this.hasUserConnectablePorts) {
|
|
4106
|
-
const a =
|
|
4130
|
+
const a = Ht(
|
|
4107
4131
|
this.connectablePortsConfig,
|
|
4108
4132
|
s.edges.shapeFactory,
|
|
4109
4133
|
s.ports.direction
|
|
4110
4134
|
);
|
|
4111
|
-
|
|
4135
|
+
re.configure(
|
|
4112
4136
|
i,
|
|
4113
4137
|
e.overlayConnectablePorts,
|
|
4114
4138
|
this.viewportStore,
|
|
@@ -4117,11 +4141,11 @@ class cr {
|
|
|
4117
4141
|
);
|
|
4118
4142
|
}
|
|
4119
4143
|
if (this.hasUserDraggableEdges) {
|
|
4120
|
-
const a =
|
|
4144
|
+
const a = Xt(
|
|
4121
4145
|
this.draggableEdgesConfig,
|
|
4122
4146
|
i.graph
|
|
4123
4147
|
);
|
|
4124
|
-
|
|
4148
|
+
se.configure(
|
|
4125
4149
|
i,
|
|
4126
4150
|
e.overlayDraggableEdges,
|
|
4127
4151
|
this.viewportStore,
|
|
@@ -4129,23 +4153,23 @@ class cr {
|
|
|
4129
4153
|
a
|
|
4130
4154
|
);
|
|
4131
4155
|
}
|
|
4132
|
-
if (this.virtualScrollConfig !== void 0 ?
|
|
4156
|
+
if (this.virtualScrollConfig !== void 0 ? ee.configure(
|
|
4133
4157
|
i,
|
|
4134
4158
|
e.main,
|
|
4135
4159
|
this.window,
|
|
4136
|
-
|
|
4160
|
+
ve(this.transformConfig),
|
|
4137
4161
|
this.boxRenderingTrigger,
|
|
4138
|
-
|
|
4162
|
+
Yt(this.virtualScrollConfig)
|
|
4139
4163
|
) : this.hasTransformableViewport && H.configure(
|
|
4140
4164
|
i,
|
|
4141
4165
|
e.main,
|
|
4142
4166
|
this.window,
|
|
4143
|
-
|
|
4144
|
-
), this.hasLayout &&
|
|
4167
|
+
ve(this.transformConfig)
|
|
4168
|
+
), this.hasLayout && Dt.configure(
|
|
4145
4169
|
i,
|
|
4146
4170
|
or(this.layoutConfig)
|
|
4147
4171
|
), this.hasAnimatedLayout) {
|
|
4148
|
-
let a =
|
|
4172
|
+
let a = tr(
|
|
4149
4173
|
this.animatedLayoutConfig
|
|
4150
4174
|
);
|
|
4151
4175
|
this.hasDraggableNodes && (nr(
|
|
@@ -4154,7 +4178,7 @@ class cr {
|
|
|
4154
4178
|
), a = ar(
|
|
4155
4179
|
a,
|
|
4156
4180
|
this.animationStaticNodes
|
|
4157
|
-
)),
|
|
4181
|
+
)), ie.configure(i, a, this.window);
|
|
4158
4182
|
}
|
|
4159
4183
|
const n = () => {
|
|
4160
4184
|
e.destroy(), i.onBeforeDestroy.unsubscribe(n);
|
|
@@ -4162,31 +4186,31 @@ class cr {
|
|
|
4162
4186
|
return i.onBeforeDestroy.subscribe(n), i;
|
|
4163
4187
|
}
|
|
4164
4188
|
createHtmlView(e) {
|
|
4165
|
-
let t = new
|
|
4189
|
+
let t = new Ae(
|
|
4166
4190
|
this.graphStore,
|
|
4167
4191
|
this.viewportStore,
|
|
4168
4192
|
e
|
|
4169
4193
|
);
|
|
4170
|
-
return this.virtualScrollConfig !== void 0 && (t = new
|
|
4194
|
+
return this.virtualScrollConfig !== void 0 && (t = new Qe(
|
|
4171
4195
|
t,
|
|
4172
4196
|
this.graphStore,
|
|
4173
4197
|
this.boxRenderingTrigger,
|
|
4174
|
-
|
|
4175
|
-
)), new
|
|
4198
|
+
Gt(this.virtualScrollConfig)
|
|
4199
|
+
)), new Ze(t, this.graphStore);
|
|
4176
4200
|
}
|
|
4177
4201
|
}
|
|
4178
4202
|
export {
|
|
4179
|
-
|
|
4203
|
+
wt as BezierEdgeShape,
|
|
4180
4204
|
cr as CanvasBuilder,
|
|
4181
|
-
|
|
4205
|
+
jt as CanvasBuilderError,
|
|
4182
4206
|
A as CanvasError,
|
|
4183
4207
|
M as ConnectionCategory,
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4208
|
+
Le as DirectEdgeShape,
|
|
4209
|
+
Q as EventSubject,
|
|
4210
|
+
yt as HorizontalEdgeShape,
|
|
4211
|
+
Et as InteractiveEdgeError,
|
|
4212
|
+
Re as InteractiveEdgeShape,
|
|
4189
4213
|
dr as MidpointEdgeShape,
|
|
4190
|
-
|
|
4191
|
-
|
|
4214
|
+
ft as StraightEdgeShape,
|
|
4215
|
+
mt as VerticalEdgeShape
|
|
4192
4216
|
};
|