@html-graph/html-graph 8.6.0 → 8.7.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 +0 -4
- package/dist/html-graph.js +441 -429
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -10,6 +10,8 @@ const Ze = () => {
|
|
|
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
|
}, _e = (r) => {
|
|
12
12
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
13
|
+
}, et = (r) => {
|
|
14
|
+
r.style.removeProperty("position"), r.style.removeProperty("top"), r.style.removeProperty("left"), r.style.removeProperty("visibility"), r.style.removeProperty("transform");
|
|
13
15
|
};
|
|
14
16
|
class Ee {
|
|
15
17
|
constructor(e, t, s) {
|
|
@@ -29,7 +31,7 @@ class Ee {
|
|
|
29
31
|
}
|
|
30
32
|
detachNode(e) {
|
|
31
33
|
const t = this.graphStore.getNode(e);
|
|
32
|
-
this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
|
|
34
|
+
et(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
|
|
33
35
|
}
|
|
34
36
|
attachEdge(e) {
|
|
35
37
|
const t = this.graphStore.getEdge(e).payload.shape.svg;
|
|
@@ -47,7 +49,7 @@ class Ee {
|
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
51
|
destroy() {
|
|
50
|
-
this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
|
|
52
|
+
this.clear(), this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
|
|
51
53
|
}
|
|
52
54
|
updateNodePosition(e) {
|
|
53
55
|
const t = this.graphStore.getNode(e), { width: s, height: o } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(s, o), d = a.x - n * h.x, c = a.y - n * h.y;
|
|
@@ -91,7 +93,7 @@ class Ee {
|
|
|
91
93
|
};
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
|
-
class
|
|
96
|
+
class tt {
|
|
95
97
|
constructor(e) {
|
|
96
98
|
i(this, "xFrom", 1 / 0);
|
|
97
99
|
i(this, "yFrom", 1 / 0);
|
|
@@ -111,7 +113,7 @@ class et {
|
|
|
111
113
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
|
-
class
|
|
116
|
+
class rt {
|
|
115
117
|
constructor(e, t, s, o) {
|
|
116
118
|
i(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
117
119
|
i(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -135,7 +137,7 @@ class tt {
|
|
|
135
137
|
this.handleAttachEdge(a);
|
|
136
138
|
});
|
|
137
139
|
});
|
|
138
|
-
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new
|
|
140
|
+
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new tt(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
139
141
|
}
|
|
140
142
|
attachNode(e) {
|
|
141
143
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -189,7 +191,7 @@ class tt {
|
|
|
189
191
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
190
192
|
}
|
|
191
193
|
}
|
|
192
|
-
class
|
|
194
|
+
class st {
|
|
193
195
|
constructor(e, t) {
|
|
194
196
|
i(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
195
197
|
i(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
@@ -316,7 +318,7 @@ class Se {
|
|
|
316
318
|
this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
|
|
317
319
|
}
|
|
318
320
|
}
|
|
319
|
-
class
|
|
321
|
+
class ot {
|
|
320
322
|
constructor() {
|
|
321
323
|
i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
322
324
|
i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -371,7 +373,7 @@ class be {
|
|
|
371
373
|
i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
372
374
|
i(this, "portOutgoingEdges", /* @__PURE__ */ new Map());
|
|
373
375
|
i(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
374
|
-
i(this, "elementPorts", new
|
|
376
|
+
i(this, "elementPorts", new ot());
|
|
375
377
|
i(this, "afterNodeAddedEmitter");
|
|
376
378
|
i(this, "onAfterNodeAdded");
|
|
377
379
|
i(this, "afterNodeUpdatedEmitter");
|
|
@@ -637,7 +639,7 @@ const ue = (r) => ({
|
|
|
637
639
|
x: r.scale * e.x + r.x,
|
|
638
640
|
y: r.scale * e.y + r.y
|
|
639
641
|
});
|
|
640
|
-
class
|
|
642
|
+
class it {
|
|
641
643
|
constructor(e) {
|
|
642
644
|
i(this, "viewportMatrix", pe);
|
|
643
645
|
i(this, "contentMatrix", pe);
|
|
@@ -698,15 +700,18 @@ class Q {
|
|
|
698
700
|
const t = this.canvas.graph.getNode(e);
|
|
699
701
|
this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
|
|
700
702
|
});
|
|
701
|
-
i(this, "
|
|
703
|
+
i(this, "reset", () => {
|
|
702
704
|
this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
|
|
703
705
|
});
|
|
706
|
+
i(this, "revert", () => {
|
|
707
|
+
this.reset();
|
|
708
|
+
});
|
|
704
709
|
this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
|
|
705
710
|
t.forEach((s) => {
|
|
706
711
|
const o = s.target;
|
|
707
712
|
this.handleNodeResize(o);
|
|
708
713
|
});
|
|
709
|
-
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.
|
|
714
|
+
}), 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);
|
|
710
715
|
}
|
|
711
716
|
static configure(e) {
|
|
712
717
|
new Q(e);
|
|
@@ -716,10 +721,10 @@ class Q {
|
|
|
716
721
|
this.canvas.updateNode(t);
|
|
717
722
|
}
|
|
718
723
|
}
|
|
719
|
-
const
|
|
724
|
+
const nt = (r, e, t) => {
|
|
720
725
|
const { x: s, y: o, width: n, height: a } = r.getBoundingClientRect();
|
|
721
726
|
return e >= s && e <= s + n && t >= o && t <= o + a;
|
|
722
|
-
},
|
|
727
|
+
}, at = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, R = (r, e, t, s) => nt(e, t, s) && at(r, t, s), U = (r, e) => {
|
|
723
728
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
724
729
|
}, O = (r) => {
|
|
725
730
|
const e = document.createElement("div");
|
|
@@ -736,7 +741,7 @@ const it = (r, e, t) => {
|
|
|
736
741
|
}
|
|
737
742
|
]
|
|
738
743
|
};
|
|
739
|
-
},
|
|
744
|
+
}, ht = (r, e) => {
|
|
740
745
|
let t = e;
|
|
741
746
|
for (; t !== null; ) {
|
|
742
747
|
const s = r.findPortIdsByElement(t)[0] ?? null;
|
|
@@ -769,7 +774,7 @@ function* Pe(r, e) {
|
|
|
769
774
|
const Ce = (r, e) => {
|
|
770
775
|
const t = Pe(document, e);
|
|
771
776
|
for (const s of t) {
|
|
772
|
-
const o =
|
|
777
|
+
const o = ht(r, s);
|
|
773
778
|
if (o.status === "portFound")
|
|
774
779
|
return o.portId;
|
|
775
780
|
if (o.status === "nodeEncountered")
|
|
@@ -781,7 +786,7 @@ var N = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "
|
|
|
781
786
|
const Ne = (r, e) => ({
|
|
782
787
|
x: r / 2,
|
|
783
788
|
y: e / 2
|
|
784
|
-
}),
|
|
789
|
+
}), y = {
|
|
785
790
|
x: 0,
|
|
786
791
|
y: 0
|
|
787
792
|
}, m = (r, e, t) => ({
|
|
@@ -807,7 +812,7 @@ const Ne = (r, e) => ({
|
|
|
807
812
|
x: e * r.x + (1 - e) / 2 * s.x,
|
|
808
813
|
y: t * r.y + (1 - t) / 2 * s.y
|
|
809
814
|
});
|
|
810
|
-
class
|
|
815
|
+
class dt {
|
|
811
816
|
constructor(e) {
|
|
812
817
|
i(this, "path");
|
|
813
818
|
i(this, "midpoint");
|
|
@@ -815,9 +820,9 @@ class ht {
|
|
|
815
820
|
const t = this.params.to;
|
|
816
821
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
817
822
|
const s = m(
|
|
818
|
-
{ x: this.params.arrowLength, y:
|
|
823
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
819
824
|
this.params.sourceDirection,
|
|
820
|
-
|
|
825
|
+
y
|
|
821
826
|
), o = m(
|
|
822
827
|
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
823
828
|
this.params.targetDirection,
|
|
@@ -828,20 +833,20 @@ class ht {
|
|
|
828
833
|
}, a = {
|
|
829
834
|
x: o.x - this.params.targetDirection.x * this.params.curvature,
|
|
830
835
|
y: o.y - this.params.targetDirection.y * this.params.curvature
|
|
831
|
-
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${o.x} ${o.y}`, d = this.params.hasSourceArrow ? "" : `M ${
|
|
836
|
+
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${o.x} ${o.y}`, d = this.params.hasSourceArrow ? "" : `M ${y.x} ${y.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${this.params.to.x} ${this.params.to.y}`;
|
|
832
837
|
this.path = `${d}${h}${c}`;
|
|
833
838
|
}
|
|
834
839
|
}
|
|
835
|
-
class
|
|
840
|
+
class ct {
|
|
836
841
|
constructor(e) {
|
|
837
842
|
i(this, "path");
|
|
838
843
|
i(this, "midpoint");
|
|
839
844
|
this.params = e;
|
|
840
845
|
const t = this.params.hasSourceArrow ? m(
|
|
841
|
-
{ x: this.params.arrowLength, y:
|
|
846
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
842
847
|
this.params.sourceDirection,
|
|
843
|
-
|
|
844
|
-
) :
|
|
848
|
+
y
|
|
849
|
+
) : y, s = this.params.hasTargetArrow ? m(
|
|
845
850
|
{
|
|
846
851
|
x: this.params.to.x - this.params.arrowLength,
|
|
847
852
|
y: this.params.to.y
|
|
@@ -849,9 +854,9 @@ class dt {
|
|
|
849
854
|
this.params.targetDirection,
|
|
850
855
|
this.params.to
|
|
851
856
|
) : this.params.to, o = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = m(
|
|
852
|
-
{ x: o, y:
|
|
857
|
+
{ x: o, y: y.y },
|
|
853
858
|
this.params.sourceDirection,
|
|
854
|
-
|
|
859
|
+
y
|
|
855
860
|
), g = {
|
|
856
861
|
x: c.x + h,
|
|
857
862
|
y: c.y + d
|
|
@@ -862,10 +867,10 @@ class dt {
|
|
|
862
867
|
), u = {
|
|
863
868
|
x: l.x + h,
|
|
864
869
|
y: l.y + d
|
|
865
|
-
},
|
|
870
|
+
}, w = {
|
|
866
871
|
x: (g.x + u.x) / 2,
|
|
867
872
|
y: (g.y + u.y) / 2
|
|
868
|
-
},
|
|
873
|
+
}, p = {
|
|
869
874
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
870
875
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
871
876
|
}, v = {
|
|
@@ -881,10 +886,10 @@ class dt {
|
|
|
881
886
|
this.path = [
|
|
882
887
|
`M ${t.x} ${t.y}`,
|
|
883
888
|
`L ${c.x} ${c.y}`,
|
|
884
|
-
`C ${
|
|
889
|
+
`C ${p.x} ${p.y} ${x.x} ${x.y} ${w.x} ${w.y}`,
|
|
885
890
|
`C ${b.x} ${b.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
|
|
886
891
|
`L ${s.x} ${s.y}`
|
|
887
|
-
].join(" "), this.midpoint = z(
|
|
892
|
+
].join(" "), this.midpoint = z(w, e.flipX, e.flipY, e.to);
|
|
888
893
|
}
|
|
889
894
|
}
|
|
890
895
|
const Z = Object.freeze({
|
|
@@ -910,20 +915,20 @@ const Z = Object.freeze({
|
|
|
910
915
|
let o = 0, n = 0, a = 0;
|
|
911
916
|
r.forEach((h, d) => {
|
|
912
917
|
let c = 0, g = 0, l = 0;
|
|
913
|
-
const u = d > 0,
|
|
914
|
-
if (u && (c = -o, g = -n, l = a),
|
|
918
|
+
const u = d > 0, w = d < s, p = u && w;
|
|
919
|
+
if (u && (c = -o, g = -n, l = a), w) {
|
|
915
920
|
const V = r[d + 1];
|
|
916
921
|
o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
|
|
917
922
|
}
|
|
918
|
-
const x = a !== 0 ? Math.min((
|
|
919
|
-
d > 0 && t.push(`L ${L.x} ${L.y}`),
|
|
923
|
+
const x = a !== 0 ? Math.min((p ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, b = p ? { x: h.x + o * x, y: h.y + n * x } : h, C = l !== 0 ? Math.min((p ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, L = p ? { x: h.x + c * C, y: h.y + g * C } : h;
|
|
924
|
+
d > 0 && t.push(`L ${L.x} ${L.y}`), p && t.push(
|
|
920
925
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${b.x} ${b.y}`
|
|
921
926
|
);
|
|
922
927
|
});
|
|
923
928
|
}
|
|
924
929
|
return t.join(" ");
|
|
925
930
|
};
|
|
926
|
-
class
|
|
931
|
+
class lt {
|
|
927
932
|
constructor(e) {
|
|
928
933
|
i(this, "path");
|
|
929
934
|
i(this, "midpoint");
|
|
@@ -931,10 +936,10 @@ class ct {
|
|
|
931
936
|
const t = this.params.to;
|
|
932
937
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
933
938
|
const s = this.params.hasSourceArrow ? m(
|
|
934
|
-
{ x: this.params.arrowLength, y:
|
|
939
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
935
940
|
this.params.sourceDirection,
|
|
936
|
-
|
|
937
|
-
) :
|
|
941
|
+
y
|
|
942
|
+
) : y, o = this.params.hasTargetArrow ? m(
|
|
938
943
|
{
|
|
939
944
|
x: this.params.to.x - this.params.arrowLength,
|
|
940
945
|
y: this.params.to.y
|
|
@@ -942,9 +947,9 @@ class ct {
|
|
|
942
947
|
this.params.targetDirection,
|
|
943
948
|
this.params.to
|
|
944
949
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
945
|
-
{ x: a, y:
|
|
950
|
+
{ x: a, y: y.y },
|
|
946
951
|
this.params.sourceDirection,
|
|
947
|
-
|
|
952
|
+
y
|
|
948
953
|
), d = m(
|
|
949
954
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
950
955
|
this.params.targetDirection,
|
|
@@ -952,26 +957,26 @@ class ct {
|
|
|
952
957
|
), c = Math.max((h.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
|
|
953
958
|
x: this.params.flipX > 0 ? c : -n,
|
|
954
959
|
y: h.y
|
|
955
|
-
}, u = { x: l.x, y: g },
|
|
960
|
+
}, u = { x: l.x, y: g }, w = {
|
|
956
961
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
957
962
|
y: d.y
|
|
958
|
-
},
|
|
963
|
+
}, p = { x: w.x, y: g };
|
|
959
964
|
this.path = M(
|
|
960
|
-
[s, h, l, u,
|
|
965
|
+
[s, h, l, u, p, w, d, o],
|
|
961
966
|
this.params.roundness
|
|
962
967
|
);
|
|
963
968
|
}
|
|
964
969
|
}
|
|
965
|
-
class
|
|
970
|
+
class gt {
|
|
966
971
|
constructor(e) {
|
|
967
972
|
i(this, "path");
|
|
968
973
|
i(this, "midpoint");
|
|
969
974
|
this.params = e;
|
|
970
975
|
const t = this.params.hasSourceArrow ? m(
|
|
971
|
-
{ x: this.params.arrowLength, y:
|
|
976
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
972
977
|
this.params.sourceDirection,
|
|
973
|
-
|
|
974
|
-
) :
|
|
978
|
+
y
|
|
979
|
+
) : y, s = this.params.hasTargetArrow ? m(
|
|
975
980
|
{
|
|
976
981
|
x: this.params.to.x - this.params.arrowLength,
|
|
977
982
|
y: this.params.to.y
|
|
@@ -979,21 +984,21 @@ class lt {
|
|
|
979
984
|
this.params.targetDirection,
|
|
980
985
|
this.params.to
|
|
981
986
|
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
982
|
-
{ x: o, y:
|
|
987
|
+
{ x: o, y: y.y },
|
|
983
988
|
this.params.sourceDirection,
|
|
984
|
-
|
|
989
|
+
y
|
|
985
990
|
), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = m(
|
|
986
991
|
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
987
992
|
this.params.targetDirection,
|
|
988
993
|
this.params.to
|
|
989
|
-
), u = { x: l.x + d, y: l.y + c },
|
|
990
|
-
this.midpoint = z(
|
|
994
|
+
), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
|
|
995
|
+
this.midpoint = z(w, e.flipX, e.flipY, e.to), this.path = M(
|
|
991
996
|
[t, n, g, u, l, s],
|
|
992
997
|
this.params.roundness
|
|
993
998
|
);
|
|
994
999
|
}
|
|
995
1000
|
}
|
|
996
|
-
class
|
|
1001
|
+
class ut {
|
|
997
1002
|
constructor(e) {
|
|
998
1003
|
i(this, "path");
|
|
999
1004
|
i(this, "midpoint");
|
|
@@ -1001,10 +1006,10 @@ class gt {
|
|
|
1001
1006
|
const t = this.params.to;
|
|
1002
1007
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1003
1008
|
const s = this.params.hasSourceArrow ? m(
|
|
1004
|
-
{ x: this.params.arrowLength, y:
|
|
1009
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1005
1010
|
this.params.sourceDirection,
|
|
1006
|
-
|
|
1007
|
-
) :
|
|
1011
|
+
y
|
|
1012
|
+
) : y, o = this.params.hasTargetArrow ? m(
|
|
1008
1013
|
{
|
|
1009
1014
|
x: this.params.to.x - this.params.arrowLength,
|
|
1010
1015
|
y: this.params.to.y
|
|
@@ -1012,9 +1017,9 @@ class gt {
|
|
|
1012
1017
|
this.params.targetDirection,
|
|
1013
1018
|
this.params.to
|
|
1014
1019
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = m(
|
|
1015
|
-
{ x: n, y:
|
|
1020
|
+
{ x: n, y: y.y },
|
|
1016
1021
|
this.params.sourceDirection,
|
|
1017
|
-
|
|
1022
|
+
y
|
|
1018
1023
|
), h = m(
|
|
1019
1024
|
{ x: this.params.to.x - n, y: this.params.to.y },
|
|
1020
1025
|
this.params.targetDirection,
|
|
@@ -1023,7 +1028,7 @@ class gt {
|
|
|
1023
1028
|
this.path = M([s, a, h, o], this.params.roundness);
|
|
1024
1029
|
}
|
|
1025
1030
|
}
|
|
1026
|
-
class
|
|
1031
|
+
class pt {
|
|
1027
1032
|
constructor(e) {
|
|
1028
1033
|
i(this, "path");
|
|
1029
1034
|
i(this, "midpoint");
|
|
@@ -1031,10 +1036,10 @@ class ut {
|
|
|
1031
1036
|
const t = this.params.to;
|
|
1032
1037
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1033
1038
|
const s = this.params.hasSourceArrow ? m(
|
|
1034
|
-
{ x: this.params.arrowLength, y:
|
|
1039
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1035
1040
|
this.params.sourceDirection,
|
|
1036
|
-
|
|
1037
|
-
) :
|
|
1041
|
+
y
|
|
1042
|
+
) : y, o = this.params.hasTargetArrow ? m(
|
|
1038
1043
|
{
|
|
1039
1044
|
x: this.params.to.x - this.params.arrowLength,
|
|
1040
1045
|
y: this.params.to.y
|
|
@@ -1042,9 +1047,9 @@ class ut {
|
|
|
1042
1047
|
this.params.targetDirection,
|
|
1043
1048
|
this.params.to
|
|
1044
1049
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
1045
|
-
{ x: a, y:
|
|
1050
|
+
{ x: a, y: y.y },
|
|
1046
1051
|
this.params.sourceDirection,
|
|
1047
|
-
|
|
1052
|
+
y
|
|
1048
1053
|
), d = m(
|
|
1049
1054
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1050
1055
|
this.params.targetDirection,
|
|
@@ -1052,12 +1057,12 @@ class ut {
|
|
|
1052
1057
|
), c = Math.max((h.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
|
|
1053
1058
|
x: h.x,
|
|
1054
1059
|
y: this.params.flipY > 0 ? c : -n
|
|
1055
|
-
}, u = { x: g, y: l.y },
|
|
1060
|
+
}, u = { x: g, y: l.y }, w = {
|
|
1056
1061
|
x: d.x,
|
|
1057
1062
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1058
|
-
},
|
|
1063
|
+
}, p = { x: g, y: w.y };
|
|
1059
1064
|
this.path = M(
|
|
1060
|
-
[s, h, l, u,
|
|
1065
|
+
[s, h, l, u, p, w, d, o],
|
|
1061
1066
|
this.params.roundness
|
|
1062
1067
|
);
|
|
1063
1068
|
}
|
|
@@ -1068,42 +1073,42 @@ class J {
|
|
|
1068
1073
|
i(this, "midpoint");
|
|
1069
1074
|
this.params = e;
|
|
1070
1075
|
const t = this.params.arrowOffset, s = this.params.side, o = this.params.arrowLength + t, n = o + 2 * s, h = [
|
|
1071
|
-
{ x: this.params.arrowLength, y:
|
|
1072
|
-
{ x: o, y:
|
|
1076
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1077
|
+
{ x: o, y: y.y },
|
|
1073
1078
|
{ x: o, y: this.params.side },
|
|
1074
1079
|
{ x: n, y: this.params.side },
|
|
1075
1080
|
{ x: n, y: -this.params.side },
|
|
1076
1081
|
{ x: o, y: -this.params.side },
|
|
1077
|
-
{ x: o, y:
|
|
1078
|
-
{ x: this.params.arrowLength, y:
|
|
1082
|
+
{ x: o, y: y.y },
|
|
1083
|
+
{ x: this.params.arrowLength, y: y.y }
|
|
1079
1084
|
].map(
|
|
1080
|
-
(c) => m(c, this.params.sourceDirection,
|
|
1081
|
-
), d = `M ${
|
|
1085
|
+
(c) => m(c, this.params.sourceDirection, y)
|
|
1086
|
+
), d = `M ${y.x} ${y.y} L ${h[0].x} ${h[0].y} `;
|
|
1082
1087
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${M(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1083
1088
|
}
|
|
1084
1089
|
}
|
|
1085
|
-
class
|
|
1090
|
+
class wt {
|
|
1086
1091
|
constructor(e) {
|
|
1087
1092
|
i(this, "path");
|
|
1088
1093
|
i(this, "midpoint");
|
|
1089
1094
|
this.params = e;
|
|
1090
1095
|
const t = this.params.smallRadius, s = this.params.radius, o = t + s, n = t * s / o, a = Math.sqrt(o * o - t * t), h = a * t / o, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, l = [
|
|
1091
|
-
{ x: this.params.arrowLength, y:
|
|
1096
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1092
1097
|
{ x: c, y: n },
|
|
1093
1098
|
{ x: c, y: -n },
|
|
1094
1099
|
{ x: d, y: 0 }
|
|
1095
1100
|
].map(
|
|
1096
|
-
(
|
|
1101
|
+
(p) => m(p, this.params.sourceDirection, y)
|
|
1097
1102
|
), u = [
|
|
1098
1103
|
`M ${l[0].x} ${l[0].y}`,
|
|
1099
1104
|
`A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
|
|
1100
1105
|
`A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
|
|
1101
1106
|
`A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
|
|
1102
|
-
].join(" "),
|
|
1103
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" :
|
|
1107
|
+
].join(" "), w = `M 0 0 L ${l[0].x} ${l[0].y} `;
|
|
1108
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
|
|
1104
1109
|
}
|
|
1105
1110
|
}
|
|
1106
|
-
class
|
|
1111
|
+
class yt {
|
|
1107
1112
|
constructor(e) {
|
|
1108
1113
|
i(this, "path");
|
|
1109
1114
|
i(this, "midpoint");
|
|
@@ -1122,7 +1127,7 @@ class wt {
|
|
|
1122
1127
|
offset: this.params.sourceOffset,
|
|
1123
1128
|
hasArrow: this.params.hasSourceArrow,
|
|
1124
1129
|
flip: 1,
|
|
1125
|
-
shift:
|
|
1130
|
+
shift: y
|
|
1126
1131
|
}), n = this.createDirectLinePoint({
|
|
1127
1132
|
offset: this.params.targetOffset,
|
|
1128
1133
|
hasArrow: this.params.hasTargetArrow,
|
|
@@ -1145,10 +1150,10 @@ class ft {
|
|
|
1145
1150
|
i(this, "midpoint");
|
|
1146
1151
|
this.params = e;
|
|
1147
1152
|
const t = this.params.hasSourceArrow ? m(
|
|
1148
|
-
{ x: this.params.arrowLength, y:
|
|
1153
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1149
1154
|
this.params.sourceDirection,
|
|
1150
|
-
|
|
1151
|
-
) :
|
|
1155
|
+
y
|
|
1156
|
+
) : y, s = this.params.hasTargetArrow ? m(
|
|
1152
1157
|
{
|
|
1153
1158
|
x: this.params.to.x - this.params.arrowLength,
|
|
1154
1159
|
y: this.params.to.y
|
|
@@ -1156,9 +1161,9 @@ class ft {
|
|
|
1156
1161
|
this.params.targetDirection,
|
|
1157
1162
|
this.params.to
|
|
1158
1163
|
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1159
|
-
{ x: o, y:
|
|
1164
|
+
{ x: o, y: y.y },
|
|
1160
1165
|
this.params.sourceDirection,
|
|
1161
|
-
|
|
1166
|
+
y
|
|
1162
1167
|
), a = m(
|
|
1163
1168
|
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1164
1169
|
this.params.targetDirection,
|
|
@@ -1180,16 +1185,16 @@ class ft {
|
|
|
1180
1185
|
);
|
|
1181
1186
|
}
|
|
1182
1187
|
}
|
|
1183
|
-
class
|
|
1188
|
+
class mt {
|
|
1184
1189
|
constructor(e) {
|
|
1185
1190
|
i(this, "path");
|
|
1186
1191
|
i(this, "midpoint");
|
|
1187
1192
|
this.params = e;
|
|
1188
1193
|
const t = this.params.hasSourceArrow ? m(
|
|
1189
|
-
{ x: this.params.arrowLength, y:
|
|
1194
|
+
{ x: this.params.arrowLength, y: y.y },
|
|
1190
1195
|
this.params.sourceDirection,
|
|
1191
|
-
|
|
1192
|
-
) :
|
|
1196
|
+
y
|
|
1197
|
+
) : y, s = this.params.hasTargetArrow ? m(
|
|
1193
1198
|
{
|
|
1194
1199
|
x: this.params.to.x - this.params.arrowLength,
|
|
1195
1200
|
y: this.params.to.y
|
|
@@ -1197,9 +1202,9 @@ class yt {
|
|
|
1197
1202
|
this.params.targetDirection,
|
|
1198
1203
|
this.params.to
|
|
1199
1204
|
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1200
|
-
{ x: o, y:
|
|
1205
|
+
{ x: o, y: y.y },
|
|
1201
1206
|
this.params.sourceDirection,
|
|
1202
|
-
|
|
1207
|
+
y
|
|
1203
1208
|
), a = m(
|
|
1204
1209
|
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1205
1210
|
this.params.targetDirection,
|
|
@@ -1221,7 +1226,7 @@ class yt {
|
|
|
1221
1226
|
);
|
|
1222
1227
|
}
|
|
1223
1228
|
}
|
|
1224
|
-
const
|
|
1229
|
+
const f = Object.freeze({
|
|
1225
1230
|
color: "#777777",
|
|
1226
1231
|
width: 1,
|
|
1227
1232
|
arrowLength: 20,
|
|
@@ -1243,7 +1248,7 @@ const y = Object.freeze({
|
|
|
1243
1248
|
curvature: 90,
|
|
1244
1249
|
interactiveWidth: 10,
|
|
1245
1250
|
preOffset: 0
|
|
1246
|
-
}),
|
|
1251
|
+
}), ye = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1247
1252
|
class k {
|
|
1248
1253
|
constructor(e) {
|
|
1249
1254
|
i(this, "svg");
|
|
@@ -1262,11 +1267,11 @@ class k {
|
|
|
1262
1267
|
e.to
|
|
1263
1268
|
);
|
|
1264
1269
|
Le(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1265
|
-
const d =
|
|
1270
|
+
const d = ye(
|
|
1266
1271
|
e.from.direction,
|
|
1267
1272
|
a,
|
|
1268
1273
|
h
|
|
1269
|
-
), c =
|
|
1274
|
+
), c = ye(
|
|
1270
1275
|
e.to.direction,
|
|
1271
1276
|
a,
|
|
1272
1277
|
h
|
|
@@ -1276,53 +1281,53 @@ class k {
|
|
|
1276
1281
|
};
|
|
1277
1282
|
let l = { x: -c.x, y: -c.y }, u;
|
|
1278
1283
|
e.category === D.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === D.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
|
|
1279
|
-
const
|
|
1284
|
+
const w = u(
|
|
1280
1285
|
d,
|
|
1281
1286
|
c,
|
|
1282
1287
|
g,
|
|
1283
1288
|
a,
|
|
1284
1289
|
h
|
|
1285
1290
|
);
|
|
1286
|
-
this.line.setAttribute("d",
|
|
1287
|
-
let
|
|
1288
|
-
this.sourceArrow && (
|
|
1291
|
+
this.line.setAttribute("d", w.path);
|
|
1292
|
+
let p = null;
|
|
1293
|
+
this.sourceArrow && (p = this.arrowRenderer({
|
|
1289
1294
|
direction: d,
|
|
1290
|
-
shift:
|
|
1295
|
+
shift: y,
|
|
1291
1296
|
arrowLength: this.params.arrowLength
|
|
1292
|
-
}), this.sourceArrow.setAttribute("d",
|
|
1297
|
+
}), this.sourceArrow.setAttribute("d", p));
|
|
1293
1298
|
let v = null;
|
|
1294
1299
|
this.targetArrow && (v = this.arrowRenderer({
|
|
1295
1300
|
direction: l,
|
|
1296
1301
|
shift: g,
|
|
1297
1302
|
arrowLength: this.params.arrowLength
|
|
1298
1303
|
}), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
|
|
1299
|
-
edgePath:
|
|
1300
|
-
sourceArrowPath:
|
|
1304
|
+
edgePath: w,
|
|
1305
|
+
sourceArrowPath: p,
|
|
1301
1306
|
targetArrowPath: v
|
|
1302
1307
|
});
|
|
1303
1308
|
}
|
|
1304
1309
|
}
|
|
1305
|
-
const
|
|
1310
|
+
const vt = (r) => (e) => {
|
|
1306
1311
|
const s = [
|
|
1307
|
-
|
|
1312
|
+
y,
|
|
1308
1313
|
{ x: e.arrowLength, y: r.radius },
|
|
1309
1314
|
{ x: e.arrowLength, y: -r.radius }
|
|
1310
1315
|
].map(
|
|
1311
|
-
(h) => m(h, e.direction,
|
|
1316
|
+
(h) => m(h, e.direction, y)
|
|
1312
1317
|
).map((h) => ({
|
|
1313
1318
|
x: h.x + e.shift.x,
|
|
1314
1319
|
y: h.y + e.shift.y
|
|
1315
1320
|
})), o = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
|
|
1316
1321
|
return `${o} ${n} ${a} Z`;
|
|
1317
|
-
}, vt = (r) => (e) => {
|
|
1318
|
-
const t = r.radius, s = e.arrowLength, o = (s * s + 2 * s * t) / (2 * t), n = o + t, a = s + t - t * (s + t) / n, h = t * o / n, c = [w, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1319
|
-
(f) => m(f, e.direction, w)
|
|
1320
|
-
).map((f) => ({
|
|
1321
|
-
x: f.x + e.shift.x,
|
|
1322
|
-
y: f.y + e.shift.y
|
|
1323
|
-
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${o} ${o} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, p = `A ${o} ${o} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1324
|
-
return `${g} ${l} ${u} ${p}`;
|
|
1325
1322
|
}, At = (r) => (e) => {
|
|
1323
|
+
const t = r.radius, s = e.arrowLength, o = (s * s + 2 * s * t) / (2 * t), n = o + t, a = s + t - t * (s + t) / n, h = t * o / n, c = [y, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1324
|
+
(p) => m(p, e.direction, y)
|
|
1325
|
+
).map((p) => ({
|
|
1326
|
+
x: p.x + e.shift.x,
|
|
1327
|
+
y: p.y + e.shift.y
|
|
1328
|
+
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${o} ${o} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${o} ${o} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1329
|
+
return `${g} ${l} ${u} ${w}`;
|
|
1330
|
+
}, xt = (r) => (e) => {
|
|
1326
1331
|
const t = r.smallRadius, s = r.radius, o = m(
|
|
1327
1332
|
{
|
|
1328
1333
|
x: e.arrowLength,
|
|
@@ -1336,8 +1341,8 @@ const mt = (r) => (e) => {
|
|
|
1336
1341
|
x: e.arrowLength + r.smallRadius,
|
|
1337
1342
|
y: 0
|
|
1338
1343
|
}
|
|
1339
|
-
), a = [
|
|
1340
|
-
(l) => m(l, e.direction,
|
|
1344
|
+
), a = [y, { x: o.x, y: -o.y }, o].map(
|
|
1345
|
+
(l) => m(l, e.direction, y)
|
|
1341
1346
|
).map((l) => ({
|
|
1342
1347
|
x: l.x + e.shift.x,
|
|
1343
1348
|
y: l.y + e.shift.y
|
|
@@ -1348,22 +1353,22 @@ const mt = (r) => (e) => {
|
|
|
1348
1353
|
return r;
|
|
1349
1354
|
switch (r.type) {
|
|
1350
1355
|
case "triangle":
|
|
1351
|
-
return
|
|
1352
|
-
radius: r.radius ??
|
|
1356
|
+
return vt({
|
|
1357
|
+
radius: r.radius ?? f.polygonArrowRadius
|
|
1353
1358
|
});
|
|
1354
1359
|
case "arc":
|
|
1355
|
-
return
|
|
1356
|
-
radius: r.radius ??
|
|
1360
|
+
return At({
|
|
1361
|
+
radius: r.radius ?? f.circleArrowRadius
|
|
1357
1362
|
});
|
|
1358
1363
|
default:
|
|
1359
|
-
return
|
|
1360
|
-
smallRadius: r.smallRadius ??
|
|
1361
|
-
angle: r.angle ??
|
|
1362
|
-
radius: r.radius ??
|
|
1364
|
+
return xt({
|
|
1365
|
+
smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
|
|
1366
|
+
angle: r.angle ?? f.wedgeArrowAngle,
|
|
1367
|
+
radius: r.radius ?? f.wedgeArrowRadius
|
|
1363
1368
|
});
|
|
1364
1369
|
}
|
|
1365
1370
|
};
|
|
1366
|
-
class
|
|
1371
|
+
class Et {
|
|
1367
1372
|
constructor(e) {
|
|
1368
1373
|
i(this, "svg");
|
|
1369
1374
|
i(this, "group");
|
|
@@ -1380,7 +1385,7 @@ class xt {
|
|
|
1380
1385
|
i(this, "hasSourceArrow");
|
|
1381
1386
|
i(this, "hasTargetArrow");
|
|
1382
1387
|
i(this, "pathShape");
|
|
1383
|
-
i(this, "createCyclePath", (e) => new
|
|
1388
|
+
i(this, "createCyclePath", (e) => new wt({
|
|
1384
1389
|
sourceDirection: e,
|
|
1385
1390
|
radius: this.portCycleRadius,
|
|
1386
1391
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1388,7 +1393,7 @@ class xt {
|
|
|
1388
1393
|
hasSourceArrow: this.hasSourceArrow,
|
|
1389
1394
|
hasTargetArrow: this.hasTargetArrow
|
|
1390
1395
|
}));
|
|
1391
|
-
i(this, "createDetourPath", (e, t, s, o, n) => new
|
|
1396
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new ct({
|
|
1392
1397
|
to: s,
|
|
1393
1398
|
sourceDirection: e,
|
|
1394
1399
|
targetDirection: t,
|
|
@@ -1401,7 +1406,7 @@ class xt {
|
|
|
1401
1406
|
hasSourceArrow: this.hasSourceArrow,
|
|
1402
1407
|
hasTargetArrow: this.hasTargetArrow
|
|
1403
1408
|
}));
|
|
1404
|
-
i(this, "createLinePath", (e, t, s) => new
|
|
1409
|
+
i(this, "createLinePath", (e, t, s) => new dt({
|
|
1405
1410
|
to: s,
|
|
1406
1411
|
sourceDirection: e,
|
|
1407
1412
|
targetDirection: t,
|
|
@@ -1410,9 +1415,9 @@ class xt {
|
|
|
1410
1415
|
hasSourceArrow: this.hasSourceArrow,
|
|
1411
1416
|
hasTargetArrow: this.hasTargetArrow
|
|
1412
1417
|
}));
|
|
1413
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1414
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1415
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1418
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? f.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? f.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? f.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1419
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1420
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1416
1421
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1417
1422
|
arrowLength: this.arrowLength,
|
|
1418
1423
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1426,7 +1431,7 @@ class xt {
|
|
|
1426
1431
|
this.pathShape.render(e);
|
|
1427
1432
|
}
|
|
1428
1433
|
}
|
|
1429
|
-
class
|
|
1434
|
+
class St {
|
|
1430
1435
|
constructor(e) {
|
|
1431
1436
|
i(this, "svg");
|
|
1432
1437
|
i(this, "group");
|
|
@@ -1464,7 +1469,7 @@ class Et {
|
|
|
1464
1469
|
hasSourceArrow: this.hasSourceArrow,
|
|
1465
1470
|
hasTargetArrow: this.hasTargetArrow
|
|
1466
1471
|
}));
|
|
1467
|
-
i(this, "createLinePath", (e, t, s, o) => new
|
|
1472
|
+
i(this, "createLinePath", (e, t, s, o) => new lt({
|
|
1468
1473
|
to: s,
|
|
1469
1474
|
sourceDirection: e,
|
|
1470
1475
|
targetDirection: t,
|
|
@@ -1475,15 +1480,15 @@ class Et {
|
|
|
1475
1480
|
hasSourceArrow: this.hasSourceArrow,
|
|
1476
1481
|
hasTargetArrow: this.hasTargetArrow
|
|
1477
1482
|
}));
|
|
1478
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1479
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1483
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
|
|
1484
|
+
const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
|
|
1480
1485
|
this.roundness = Math.min(
|
|
1481
1486
|
t,
|
|
1482
1487
|
this.arrowOffset,
|
|
1483
1488
|
this.cycleSquareSide / 2
|
|
1484
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ??
|
|
1485
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1486
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1489
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1490
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1491
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1487
1492
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1488
1493
|
arrowLength: this.arrowLength,
|
|
1489
1494
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1497,7 +1502,7 @@ class Et {
|
|
|
1497
1502
|
this.pathShape.render(e);
|
|
1498
1503
|
}
|
|
1499
1504
|
}
|
|
1500
|
-
class
|
|
1505
|
+
class bt {
|
|
1501
1506
|
constructor(e) {
|
|
1502
1507
|
i(this, "svg");
|
|
1503
1508
|
i(this, "group");
|
|
@@ -1523,7 +1528,7 @@ class St {
|
|
|
1523
1528
|
hasSourceArrow: this.hasSourceArrow,
|
|
1524
1529
|
hasTargetArrow: this.hasTargetArrow
|
|
1525
1530
|
}));
|
|
1526
|
-
i(this, "createDetourPath", (e, t, s, o, n) => new
|
|
1531
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new gt({
|
|
1527
1532
|
to: s,
|
|
1528
1533
|
sourceDirection: e,
|
|
1529
1534
|
targetDirection: t,
|
|
@@ -1537,7 +1542,7 @@ class St {
|
|
|
1537
1542
|
hasSourceArrow: this.hasSourceArrow,
|
|
1538
1543
|
hasTargetArrow: this.hasTargetArrow
|
|
1539
1544
|
}));
|
|
1540
|
-
i(this, "createLinePath", (e, t, s) => new
|
|
1545
|
+
i(this, "createLinePath", (e, t, s) => new ut({
|
|
1541
1546
|
to: s,
|
|
1542
1547
|
sourceDirection: e,
|
|
1543
1548
|
targetDirection: t,
|
|
@@ -1547,15 +1552,15 @@ class St {
|
|
|
1547
1552
|
hasSourceArrow: this.hasSourceArrow,
|
|
1548
1553
|
hasTargetArrow: this.hasTargetArrow
|
|
1549
1554
|
}));
|
|
1550
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1551
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1555
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
|
|
1556
|
+
const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
|
|
1552
1557
|
this.roundness = Math.min(
|
|
1553
1558
|
t,
|
|
1554
1559
|
this.arrowOffset,
|
|
1555
1560
|
this.cycleSquareSide / 2
|
|
1556
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ??
|
|
1557
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1558
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1561
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1562
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1563
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1559
1564
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1560
1565
|
arrowLength: this.arrowLength,
|
|
1561
1566
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1569,7 +1574,7 @@ class St {
|
|
|
1569
1574
|
this.pathShape.render(e);
|
|
1570
1575
|
}
|
|
1571
1576
|
}
|
|
1572
|
-
class
|
|
1577
|
+
class Pt {
|
|
1573
1578
|
constructor(e) {
|
|
1574
1579
|
i(this, "svg");
|
|
1575
1580
|
i(this, "group");
|
|
@@ -1594,7 +1599,7 @@ class bt {
|
|
|
1594
1599
|
hasSourceArrow: this.hasSourceArrow,
|
|
1595
1600
|
hasTargetArrow: this.hasTargetArrow
|
|
1596
1601
|
}));
|
|
1597
|
-
i(this, "createDetourPath", (e, t, s, o, n) => new
|
|
1602
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new mt({
|
|
1598
1603
|
to: s,
|
|
1599
1604
|
sourceDirection: e,
|
|
1600
1605
|
targetDirection: t,
|
|
@@ -1607,7 +1612,7 @@ class bt {
|
|
|
1607
1612
|
hasSourceArrow: this.hasSourceArrow,
|
|
1608
1613
|
hasTargetArrow: this.hasTargetArrow
|
|
1609
1614
|
}));
|
|
1610
|
-
i(this, "createLinePath", (e, t, s, o, n) => new
|
|
1615
|
+
i(this, "createLinePath", (e, t, s, o, n) => new pt({
|
|
1611
1616
|
to: s,
|
|
1612
1617
|
sourceDirection: e,
|
|
1613
1618
|
targetDirection: t,
|
|
@@ -1618,15 +1623,15 @@ class bt {
|
|
|
1618
1623
|
hasSourceArrow: this.hasSourceArrow,
|
|
1619
1624
|
hasTargetArrow: this.hasTargetArrow
|
|
1620
1625
|
}));
|
|
1621
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1622
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1626
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
|
|
1627
|
+
const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
|
|
1623
1628
|
this.roundness = Math.min(
|
|
1624
1629
|
t,
|
|
1625
1630
|
this.arrowOffset,
|
|
1626
1631
|
this.cycleSquareSide / 2
|
|
1627
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ??
|
|
1628
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1629
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1632
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1633
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1634
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1630
1635
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1631
1636
|
arrowLength: this.arrowLength,
|
|
1632
1637
|
hasSourceArrow: this.hasSourceArrow,
|
|
@@ -1655,7 +1660,7 @@ class Ve {
|
|
|
1655
1660
|
i(this, "onAfterRender");
|
|
1656
1661
|
i(this, "afterRenderEmitter");
|
|
1657
1662
|
i(this, "arrowRenderer");
|
|
1658
|
-
[this.afterRenderEmitter, this.onAfterRender] = S(), this.color = (e == null ? void 0 : e.color) ??
|
|
1663
|
+
[this.afterRenderEmitter, this.onAfterRender] = S(), 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 = I((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 = Me(this.color), this.svg.appendChild(this.group), this.line = De(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = W(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = W(), this.group.appendChild(this.targetArrow));
|
|
1659
1664
|
}
|
|
1660
1665
|
render(e) {
|
|
1661
1666
|
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Te(
|
|
@@ -1663,7 +1668,7 @@ class Ve {
|
|
|
1663
1668
|
e.to
|
|
1664
1669
|
);
|
|
1665
1670
|
Le(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1666
|
-
const d = { x: o, y: n }, c = new
|
|
1671
|
+
const d = { x: o, y: n }, c = new yt({
|
|
1667
1672
|
to: d,
|
|
1668
1673
|
sourceOffset: this.sourceOffset,
|
|
1669
1674
|
targetOffset: this.targetOffset,
|
|
@@ -1677,31 +1682,31 @@ class Ve {
|
|
|
1677
1682
|
if (u === 0)
|
|
1678
1683
|
this.sourceArrow !== null && (g = "", this.sourceArrow.setAttribute("d", g)), this.targetArrow !== null && (l = "", this.targetArrow.setAttribute("d", l));
|
|
1679
1684
|
else {
|
|
1680
|
-
const
|
|
1685
|
+
const w = {
|
|
1681
1686
|
x: d.x / u,
|
|
1682
1687
|
y: d.y / u
|
|
1683
1688
|
};
|
|
1684
1689
|
if (this.sourceArrow) {
|
|
1685
|
-
const
|
|
1686
|
-
x:
|
|
1687
|
-
y:
|
|
1690
|
+
const p = {
|
|
1691
|
+
x: w.x * this.sourceOffset,
|
|
1692
|
+
y: w.y * this.sourceOffset
|
|
1688
1693
|
};
|
|
1689
1694
|
g = this.arrowRenderer({
|
|
1690
|
-
direction:
|
|
1691
|
-
shift:
|
|
1695
|
+
direction: w,
|
|
1696
|
+
shift: p,
|
|
1692
1697
|
arrowLength: this.arrowLength
|
|
1693
1698
|
}), this.sourceArrow.setAttribute("d", g);
|
|
1694
1699
|
}
|
|
1695
1700
|
if (this.targetArrow) {
|
|
1696
|
-
const
|
|
1697
|
-
x:
|
|
1698
|
-
y:
|
|
1701
|
+
const p = {
|
|
1702
|
+
x: w.x * this.targetOffset,
|
|
1703
|
+
y: w.y * this.targetOffset
|
|
1699
1704
|
};
|
|
1700
1705
|
l = this.arrowRenderer({
|
|
1701
|
-
direction: { x: -
|
|
1706
|
+
direction: { x: -w.x, y: -w.y },
|
|
1702
1707
|
shift: {
|
|
1703
|
-
x: d.x -
|
|
1704
|
-
y: d.y -
|
|
1708
|
+
x: d.x - p.x,
|
|
1709
|
+
y: d.y - p.y
|
|
1705
1710
|
},
|
|
1706
1711
|
arrowLength: this.arrowLength
|
|
1707
1712
|
}), this.targetArrow.setAttribute("d", l);
|
|
@@ -1714,17 +1719,17 @@ class Ve {
|
|
|
1714
1719
|
});
|
|
1715
1720
|
}
|
|
1716
1721
|
}
|
|
1717
|
-
const
|
|
1722
|
+
const Ct = () => {
|
|
1718
1723
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1719
1724
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1720
|
-
},
|
|
1725
|
+
}, Nt = (r) => {
|
|
1721
1726
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1722
1727
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1723
|
-
},
|
|
1728
|
+
}, fe = (r) => {
|
|
1724
1729
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1725
1730
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1726
1731
|
};
|
|
1727
|
-
class
|
|
1732
|
+
class Tt extends Error {
|
|
1728
1733
|
constructor(e) {
|
|
1729
1734
|
super(e), this.name = "InteractiveEdgeError";
|
|
1730
1735
|
}
|
|
@@ -1736,18 +1741,18 @@ class Fe {
|
|
|
1736
1741
|
i(this, "line");
|
|
1737
1742
|
i(this, "sourceArrow");
|
|
1738
1743
|
i(this, "targetArrow");
|
|
1739
|
-
i(this, "handle",
|
|
1744
|
+
i(this, "handle", Ct());
|
|
1740
1745
|
i(this, "onAfterRender");
|
|
1741
1746
|
i(this, "interactiveLine");
|
|
1742
1747
|
i(this, "interactiveSourceArrow", null);
|
|
1743
1748
|
i(this, "interactiveTargetArrow", null);
|
|
1744
1749
|
if (this.baseEdge = e, e instanceof Fe)
|
|
1745
|
-
throw new
|
|
1750
|
+
throw new Tt(
|
|
1746
1751
|
"interactive edge can be configured only once"
|
|
1747
1752
|
);
|
|
1748
1753
|
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;
|
|
1749
|
-
const s = (t == null ? void 0 : t.distance) ??
|
|
1750
|
-
this.interactiveLine =
|
|
1754
|
+
const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
|
|
1755
|
+
this.interactiveLine = Nt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = fe(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = fe(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((o) => {
|
|
1751
1756
|
this.interactiveLine.setAttribute("d", o.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", o.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", o.targetArrowPath);
|
|
1752
1757
|
});
|
|
1753
1758
|
}
|
|
@@ -1755,7 +1760,7 @@ class Fe {
|
|
|
1755
1760
|
this.baseEdge.render(e);
|
|
1756
1761
|
}
|
|
1757
1762
|
}
|
|
1758
|
-
class
|
|
1763
|
+
class Cr {
|
|
1759
1764
|
constructor(e, t) {
|
|
1760
1765
|
i(this, "group");
|
|
1761
1766
|
i(this, "line");
|
|
@@ -2006,7 +2011,7 @@ class Be {
|
|
|
2006
2011
|
this.graphStore.clear();
|
|
2007
2012
|
}
|
|
2008
2013
|
destroy() {
|
|
2009
|
-
this.
|
|
2014
|
+
this.graphStore.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.unsubscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.unsubscribe(
|
|
2010
2015
|
this.onAfterNodePriorityUpdated
|
|
2011
2016
|
), this.graphStore.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.unsubscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.unsubscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.unsubscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.unsubscribe(
|
|
2012
2017
|
this.onAfterEdgeShapeUpdated
|
|
@@ -2015,11 +2020,11 @@ class Be {
|
|
|
2015
2020
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
2016
2021
|
}
|
|
2017
2022
|
}
|
|
2018
|
-
const
|
|
2023
|
+
const Mt = (r) => {
|
|
2019
2024
|
setTimeout(() => {
|
|
2020
2025
|
r();
|
|
2021
2026
|
});
|
|
2022
|
-
},
|
|
2027
|
+
}, Dt = (r) => {
|
|
2023
2028
|
queueMicrotask(() => {
|
|
2024
2029
|
r();
|
|
2025
2030
|
});
|
|
@@ -2049,7 +2054,7 @@ class $e {
|
|
|
2049
2054
|
return this.viewportStore.createViewportCoords(e);
|
|
2050
2055
|
}
|
|
2051
2056
|
}
|
|
2052
|
-
const
|
|
2057
|
+
const Rt = (r, e) => Symbol.iterator in r ? {
|
|
2053
2058
|
minContentScale: e.focus.minContentScale,
|
|
2054
2059
|
nodes: r,
|
|
2055
2060
|
contentOffset: e.focus.contentOffset
|
|
@@ -2092,7 +2097,7 @@ class We {
|
|
|
2092
2097
|
this.viewportStore.patchViewportMatrix(g);
|
|
2093
2098
|
}
|
|
2094
2099
|
focus(e) {
|
|
2095
|
-
const t =
|
|
2100
|
+
const t = Rt(e ?? {}, this.params);
|
|
2096
2101
|
this.params.focus.schedule(() => {
|
|
2097
2102
|
this.navigate(t);
|
|
2098
2103
|
});
|
|
@@ -2113,9 +2118,9 @@ class We {
|
|
|
2113
2118
|
const d = {
|
|
2114
2119
|
x: (t + s) / 2,
|
|
2115
2120
|
y: (o + n) / 2
|
|
2116
|
-
}, c = (s - t) / 2, g = (n - o) / 2, { width: l, height: u } = this.viewportStore.getDimensions(),
|
|
2117
|
-
c /
|
|
2118
|
-
g /
|
|
2121
|
+
}, c = (s - t) / 2, g = (n - o) / 2, { width: l, height: u } = this.viewportStore.getDimensions(), w = l / 2, p = u / 2, v = Math.max(
|
|
2122
|
+
c / w,
|
|
2123
|
+
g / p
|
|
2119
2124
|
), { scale: x } = this.viewportStore.getContentMatrix(), b = v > 1 ? x / v : x, P = Math.max(b, e.minContentScale);
|
|
2120
2125
|
this.center(d, { contentScale: P });
|
|
2121
2126
|
}
|
|
@@ -2223,16 +2228,16 @@ class H {
|
|
|
2223
2228
|
const t = e.changedTouches[0];
|
|
2224
2229
|
this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
|
|
2225
2230
|
});
|
|
2226
|
-
i(this, "
|
|
2231
|
+
i(this, "reset", () => {
|
|
2227
2232
|
this.canvas.graph.getAllPortIds().forEach((e) => {
|
|
2228
2233
|
const t = this.canvas.graph.getPort(e);
|
|
2229
2234
|
this.unhookPortEvents(t.element);
|
|
2230
2235
|
});
|
|
2231
2236
|
});
|
|
2232
|
-
i(this, "
|
|
2233
|
-
this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
2237
|
+
i(this, "revert", () => {
|
|
2238
|
+
this.params.onStopDrag(), this.reset(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
2234
2239
|
});
|
|
2235
|
-
this.canvas = e, this.element = t, this.window = s, this.params = o, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.
|
|
2240
|
+
this.canvas = e, this.element = t, this.window = s, this.params = o, 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);
|
|
2236
2241
|
}
|
|
2237
2242
|
static configure(e, t, s, o) {
|
|
2238
2243
|
new H(e, t, s, o);
|
|
@@ -2260,7 +2265,7 @@ class H {
|
|
|
2260
2265
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2261
2266
|
}
|
|
2262
2267
|
}
|
|
2263
|
-
class
|
|
2268
|
+
class Lt {
|
|
2264
2269
|
constructor(e, t, s) {
|
|
2265
2270
|
this.canvas = e, this.layoutAlgorithm = t, this.params = s;
|
|
2266
2271
|
}
|
|
@@ -2274,7 +2279,7 @@ class Rt {
|
|
|
2274
2279
|
}), this.params.onAfterApplied();
|
|
2275
2280
|
}
|
|
2276
2281
|
}
|
|
2277
|
-
class
|
|
2282
|
+
class Vt {
|
|
2278
2283
|
constructor(e, t, s) {
|
|
2279
2284
|
this.canvas = e, this.layoutAlgorithm = t, this.params = s;
|
|
2280
2285
|
}
|
|
@@ -2310,15 +2315,6 @@ class ee {
|
|
|
2310
2315
|
const { element: t } = this.graph.getNode(e);
|
|
2311
2316
|
t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
|
|
2312
2317
|
});
|
|
2313
|
-
i(this, "onBeforeDestroy", () => {
|
|
2314
|
-
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2315
|
-
});
|
|
2316
|
-
i(this, "onBeforeClear", () => {
|
|
2317
|
-
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
2318
|
-
const { element: t } = this.canvas.graph.getNode(e);
|
|
2319
|
-
t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
|
|
2320
|
-
}), this.maxNodePriority = 0;
|
|
2321
|
-
});
|
|
2322
2318
|
i(this, "onMouseDown", (e) => {
|
|
2323
2319
|
const t = e;
|
|
2324
2320
|
if (!this.params.mouseDownEventVerifier(t))
|
|
@@ -2409,7 +2405,16 @@ class ee {
|
|
|
2409
2405
|
i(this, "onWindowTouchFinish", () => {
|
|
2410
2406
|
this.cancelTouchDrag();
|
|
2411
2407
|
});
|
|
2412
|
-
|
|
2408
|
+
i(this, "reset", () => {
|
|
2409
|
+
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
2410
|
+
const { element: t } = this.canvas.graph.getNode(e);
|
|
2411
|
+
t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
|
|
2412
|
+
}), this.maxNodePriority = 0;
|
|
2413
|
+
});
|
|
2414
|
+
i(this, "revert", () => {
|
|
2415
|
+
this.reset(), this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2416
|
+
});
|
|
2417
|
+
this.canvas = e, this.element = t, this.window = s, this.params = o, 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);
|
|
2413
2418
|
}
|
|
2414
2419
|
static configure(e, t, s, o) {
|
|
2415
2420
|
new ee(e, t, s, o);
|
|
@@ -2506,7 +2511,7 @@ class Y {
|
|
|
2506
2511
|
i(this, "prevTouches", null);
|
|
2507
2512
|
i(this, "wheelFinishTimer", null);
|
|
2508
2513
|
i(this, "transformInProgress", !1);
|
|
2509
|
-
i(this, "
|
|
2514
|
+
i(this, "revert", () => {
|
|
2510
2515
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2511
2516
|
});
|
|
2512
2517
|
i(this, "onMouseDown", (e) => {
|
|
@@ -2587,7 +2592,7 @@ class Y {
|
|
|
2587
2592
|
passive: !0
|
|
2588
2593
|
}), this.element.addEventListener("touchstart", this.onTouchStart, {
|
|
2589
2594
|
passive: !0
|
|
2590
|
-
}), e.onBeforeDestroy.subscribe(this.
|
|
2595
|
+
}), e.onBeforeDestroy.subscribe(this.revert);
|
|
2591
2596
|
}
|
|
2592
2597
|
static configure(e, t, s, o) {
|
|
2593
2598
|
new Y(e, t, s, o);
|
|
@@ -2726,13 +2731,13 @@ class te {
|
|
|
2726
2731
|
});
|
|
2727
2732
|
}
|
|
2728
2733
|
}
|
|
2729
|
-
const
|
|
2734
|
+
const Ft = () => {
|
|
2730
2735
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2731
2736
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2732
|
-
},
|
|
2737
|
+
}, It = () => {
|
|
2733
2738
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2734
2739
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2735
|
-
},
|
|
2740
|
+
}, Bt = () => {
|
|
2736
2741
|
const r = document.createElementNS(
|
|
2737
2742
|
"http://www.w3.org/2000/svg",
|
|
2738
2743
|
"pattern"
|
|
@@ -2741,9 +2746,9 @@ const Vt = () => {
|
|
|
2741
2746
|
};
|
|
2742
2747
|
class re {
|
|
2743
2748
|
constructor(e, t, s) {
|
|
2744
|
-
i(this, "svg",
|
|
2745
|
-
i(this, "patternRenderingRectangle",
|
|
2746
|
-
i(this, "pattern",
|
|
2749
|
+
i(this, "svg", Ft());
|
|
2750
|
+
i(this, "patternRenderingRectangle", It());
|
|
2751
|
+
i(this, "pattern", Bt());
|
|
2747
2752
|
i(this, "patternContent");
|
|
2748
2753
|
i(this, "tileWidth");
|
|
2749
2754
|
i(this, "tileHeight");
|
|
@@ -2839,10 +2844,10 @@ class se {
|
|
|
2839
2844
|
portDirection: this.params.dragPortDirection
|
|
2840
2845
|
};
|
|
2841
2846
|
this.isTargetDragging = s === "direct";
|
|
2842
|
-
const [
|
|
2843
|
-
this.overlayCanvas.addNode(O(
|
|
2844
|
-
from:
|
|
2845
|
-
to:
|
|
2847
|
+
const [w, p] = this.isTargetDragging ? [l, u] : [u, l];
|
|
2848
|
+
this.overlayCanvas.addNode(O(w)), this.overlayCanvas.addNode(O(p)), this.overlayCanvas.addEdge({
|
|
2849
|
+
from: w.overlayNodeId,
|
|
2850
|
+
to: p.overlayNodeId,
|
|
2846
2851
|
shape: this.params.edgeShapeFactory(N.EdgeId)
|
|
2847
2852
|
});
|
|
2848
2853
|
}
|
|
@@ -2922,10 +2927,10 @@ class oe {
|
|
|
2922
2927
|
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
|
|
2923
2928
|
x: g.x + g.width / 2,
|
|
2924
2929
|
y: g.y + g.height / 2
|
|
2925
|
-
}, u = this.overlayLayer.getBoundingClientRect(),
|
|
2930
|
+
}, u = this.overlayLayer.getBoundingClientRect(), w = this.canvas.viewport.createContentCoords({
|
|
2926
2931
|
x: l.x - u.x,
|
|
2927
2932
|
y: l.y - u.y
|
|
2928
|
-
}),
|
|
2933
|
+
}), p = this.canvas.viewport.createContentCoords({
|
|
2929
2934
|
x: t.x - u.x,
|
|
2930
2935
|
y: t.y - u.y
|
|
2931
2936
|
});
|
|
@@ -2938,11 +2943,11 @@ class oe {
|
|
|
2938
2943
|
}, this.canvas.removeEdge(s);
|
|
2939
2944
|
const v = {
|
|
2940
2945
|
overlayNodeId: N.StaticNodeId,
|
|
2941
|
-
portCoords:
|
|
2946
|
+
portCoords: w,
|
|
2942
2947
|
portDirection: c.direction
|
|
2943
2948
|
}, x = {
|
|
2944
2949
|
overlayNodeId: N.DraggingNodeId,
|
|
2945
|
-
portCoords:
|
|
2950
|
+
portCoords: p,
|
|
2946
2951
|
portDirection: d.direction
|
|
2947
2952
|
}, [b, P] = this.isTargetDragging ? [v, x] : [x, v];
|
|
2948
2953
|
this.overlayCanvas.addNode(O(b)), this.overlayCanvas.addNode(O(P));
|
|
@@ -3038,9 +3043,9 @@ class ne {
|
|
|
3038
3043
|
this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
|
|
3039
3044
|
}
|
|
3040
3045
|
}
|
|
3041
|
-
class
|
|
3046
|
+
class $t {
|
|
3042
3047
|
static configure(e, t) {
|
|
3043
|
-
const s = t.applyOn, o = new
|
|
3048
|
+
const s = t.applyOn, o = new Lt(e, t.algorithm, {
|
|
3044
3049
|
staticNodeResolver: t.staticNodeResolver,
|
|
3045
3050
|
onBeforeApplied: t.onBeforeApplied,
|
|
3046
3051
|
onAfterApplied: t.onAfterApplied
|
|
@@ -3064,7 +3069,7 @@ class Bt {
|
|
|
3064
3069
|
}
|
|
3065
3070
|
}
|
|
3066
3071
|
}
|
|
3067
|
-
class
|
|
3072
|
+
class Ut {
|
|
3068
3073
|
constructor(e, t) {
|
|
3069
3074
|
i(this, "previousTimeStamp");
|
|
3070
3075
|
i(this, "step", (e) => {
|
|
@@ -3085,17 +3090,17 @@ class ae {
|
|
|
3085
3090
|
i(this, "step", (e) => {
|
|
3086
3091
|
this.applier.apply(e);
|
|
3087
3092
|
});
|
|
3088
|
-
this.win = s, this.applier = new
|
|
3093
|
+
this.win = s, this.applier = new Vt(e, t.algorithm, {
|
|
3089
3094
|
staticNodeResolver: t.staticNodeResolver,
|
|
3090
3095
|
onBeforeApplied: t.onBeforeApplied,
|
|
3091
3096
|
onAfterApplied: t.onAfterApplied
|
|
3092
|
-
}), new
|
|
3097
|
+
}), new Ut(this.win, this.step);
|
|
3093
3098
|
}
|
|
3094
3099
|
static configure(e, t, s) {
|
|
3095
3100
|
new ae(e, t, s);
|
|
3096
3101
|
}
|
|
3097
3102
|
}
|
|
3098
|
-
const
|
|
3103
|
+
const Ot = () => {
|
|
3099
3104
|
const r = document.createElement("div");
|
|
3100
3105
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3101
3106
|
}, j = () => {
|
|
@@ -3105,23 +3110,23 @@ const Ut = () => {
|
|
|
3105
3110
|
const r = j();
|
|
3106
3111
|
return r.style.pointerEvents = "none", r;
|
|
3107
3112
|
};
|
|
3108
|
-
class
|
|
3113
|
+
class Wt {
|
|
3109
3114
|
constructor(e) {
|
|
3110
3115
|
i(this, "background", j());
|
|
3111
3116
|
i(this, "main", j());
|
|
3112
3117
|
i(this, "overlayConnectablePorts", me());
|
|
3113
3118
|
i(this, "overlayDraggableEdges", me());
|
|
3114
|
-
i(this, "host",
|
|
3119
|
+
i(this, "host", Ot());
|
|
3115
3120
|
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);
|
|
3116
3121
|
}
|
|
3117
3122
|
destroy() {
|
|
3118
3123
|
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);
|
|
3119
3124
|
}
|
|
3120
3125
|
}
|
|
3121
|
-
const
|
|
3122
|
-
var
|
|
3123
|
-
const e = ((
|
|
3124
|
-
}), t = ((
|
|
3126
|
+
const zt = (r) => {
|
|
3127
|
+
var w, p, v, x, b, P;
|
|
3128
|
+
const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
|
|
3129
|
+
}), t = ((p = r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
|
|
3125
3130
|
}), s = r.nodeDragVerifier ?? (() => !0), o = ((v = r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
|
|
3126
3131
|
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (x = r.mouse) == null ? void 0 : x.dragCursor, d = h !== void 0 ? h : "grab", c = (b = r.mouse) == null ? void 0 : b.mouseDownEventVerifier, g = c !== void 0 ? c : (C) => C.button === 0, l = (P = r.mouse) == null ? void 0 : P.mouseUpEventVerifier, u = l !== void 0 ? l : (C) => C.button === 0;
|
|
3127
3132
|
return {
|
|
@@ -3136,7 +3141,7 @@ const Wt = (r) => {
|
|
|
3136
3141
|
nodeDragVerifier: s,
|
|
3137
3142
|
onNodeDragFinished: o
|
|
3138
3143
|
};
|
|
3139
|
-
},
|
|
3144
|
+
}, kt = (r) => {
|
|
3140
3145
|
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, o = r.maxY !== null ? r.maxY : 1 / 0;
|
|
3141
3146
|
return (n) => {
|
|
3142
3147
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
@@ -3146,7 +3151,7 @@ const Wt = (r) => {
|
|
|
3146
3151
|
const g = n.canvasHeight * n.prevTransform.scale, l = o - g;
|
|
3147
3152
|
return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3148
3153
|
};
|
|
3149
|
-
},
|
|
3154
|
+
}, Ht = (r) => {
|
|
3150
3155
|
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, o = t !== null ? 1 / t : 1 / 0;
|
|
3151
3156
|
return (n) => {
|
|
3152
3157
|
const a = n.prevTransform, h = n.nextTransform;
|
|
@@ -3167,7 +3172,7 @@ const Wt = (r) => {
|
|
|
3167
3172
|
y: g
|
|
3168
3173
|
};
|
|
3169
3174
|
};
|
|
3170
|
-
},
|
|
3175
|
+
}, Yt = (r) => (e) => r.reduce(
|
|
3171
3176
|
(t, s) => s({
|
|
3172
3177
|
prevTransform: e.prevTransform,
|
|
3173
3178
|
nextTransform: t,
|
|
@@ -3180,12 +3185,12 @@ const Wt = (r) => {
|
|
|
3180
3185
|
return r;
|
|
3181
3186
|
switch (r.type) {
|
|
3182
3187
|
case "scale-limit":
|
|
3183
|
-
return
|
|
3188
|
+
return Ht({
|
|
3184
3189
|
minContentScale: r.minContentScale ?? 0,
|
|
3185
3190
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3186
3191
|
});
|
|
3187
3192
|
case "shift-limit":
|
|
3188
|
-
return
|
|
3193
|
+
return kt({
|
|
3189
3194
|
minX: r.minX ?? -1 / 0,
|
|
3190
3195
|
maxX: r.maxX ?? 1 / 0,
|
|
3191
3196
|
minY: r.minY ?? -1 / 0,
|
|
@@ -3193,17 +3198,17 @@ const Wt = (r) => {
|
|
|
3193
3198
|
});
|
|
3194
3199
|
}
|
|
3195
3200
|
}, Ae = (r) => {
|
|
3196
|
-
var
|
|
3197
|
-
const e = (
|
|
3201
|
+
var p, v, x, b, P, C, L, V, de, ce, le, ge;
|
|
3202
|
+
const e = (p = r == null ? void 0 : r.scale) == null ? void 0 : p.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
3198
3203
|
let o;
|
|
3199
|
-
s !== void 0 ? Array.isArray(s) ? o =
|
|
3204
|
+
s !== void 0 ? Array.isArray(s) ? o = Yt(
|
|
3200
3205
|
s.map(
|
|
3201
3206
|
(T) => ve(T)
|
|
3202
3207
|
)
|
|
3203
3208
|
) : o = ve(s) : o = (T) => T.nextTransform;
|
|
3204
3209
|
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onBeforeTransformChange) ?? (() => {
|
|
3205
3210
|
}), h = ((b = r == null ? void 0 : r.events) == null ? void 0 : b.onTransformChange) ?? (() => {
|
|
3206
|
-
}), d = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseDownEventVerifier, c = d !== void 0 ? d : (T) => T.button === 0, g = (C = r == null ? void 0 : r.shift) == null ? void 0 : C.mouseUpEventVerifier, l = g !== void 0 ? g : (T) => T.button === 0, u = (L = r == null ? void 0 : r.scale) == null ? void 0 : L.mouseWheelEventVerifier,
|
|
3211
|
+
}), d = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseDownEventVerifier, c = d !== void 0 ? d : (T) => T.button === 0, g = (C = r == null ? void 0 : r.shift) == null ? void 0 : C.mouseUpEventVerifier, l = g !== void 0 ? g : (T) => T.button === 0, u = (L = r == null ? void 0 : r.scale) == null ? void 0 : L.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
|
|
3207
3212
|
return {
|
|
3208
3213
|
wheelSensitivity: t,
|
|
3209
3214
|
onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
|
|
@@ -3216,24 +3221,24 @@ const Wt = (r) => {
|
|
|
3216
3221
|
shiftCursor: n,
|
|
3217
3222
|
mouseDownEventVerifier: c,
|
|
3218
3223
|
mouseUpEventVerifier: l,
|
|
3219
|
-
mouseWheelEventVerifier:
|
|
3224
|
+
mouseWheelEventVerifier: w,
|
|
3220
3225
|
scaleWheelFinishTimeout: ((ce = r == null ? void 0 : r.scale) == null ? void 0 : ce.wheelFinishTimeout) ?? 500,
|
|
3221
3226
|
onResizeTransformStarted: ((le = r == null ? void 0 : r.events) == null ? void 0 : le.onResizeTransformStarted) ?? (() => {
|
|
3222
3227
|
}),
|
|
3223
3228
|
onResizeTransformFinished: ((ge = r == null ? void 0 : r.events) == null ? void 0 : ge.onResizeTransformFinished) ?? (() => {
|
|
3224
3229
|
})
|
|
3225
3230
|
};
|
|
3226
|
-
},
|
|
3231
|
+
}, Xt = (r, e) => {
|
|
3227
3232
|
const t = document.createElementNS(
|
|
3228
3233
|
"http://www.w3.org/2000/svg",
|
|
3229
3234
|
"circle"
|
|
3230
3235
|
);
|
|
3231
3236
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3232
|
-
},
|
|
3237
|
+
}, Gt = (r) => r instanceof SVGElement ? r : Xt(
|
|
3233
3238
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3234
3239
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3235
|
-
),
|
|
3236
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o =
|
|
3240
|
+
), jt = (r) => {
|
|
3241
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o = Gt(r.renderer ?? {});
|
|
3237
3242
|
return {
|
|
3238
3243
|
tileWidth: t,
|
|
3239
3244
|
tileHeight: s,
|
|
@@ -3245,7 +3250,7 @@ const Wt = (r) => {
|
|
|
3245
3250
|
return r;
|
|
3246
3251
|
switch (r.type) {
|
|
3247
3252
|
case "straight":
|
|
3248
|
-
return () => new
|
|
3253
|
+
return () => new bt({
|
|
3249
3254
|
color: r.color,
|
|
3250
3255
|
width: r.width,
|
|
3251
3256
|
arrowLength: r.arrowLength,
|
|
@@ -3259,7 +3264,7 @@ const Wt = (r) => {
|
|
|
3259
3264
|
detourDirection: r.detourDirection
|
|
3260
3265
|
});
|
|
3261
3266
|
case "horizontal":
|
|
3262
|
-
return () => new
|
|
3267
|
+
return () => new St({
|
|
3263
3268
|
color: r.color,
|
|
3264
3269
|
width: r.width,
|
|
3265
3270
|
arrowLength: r.arrowLength,
|
|
@@ -3272,7 +3277,7 @@ const Wt = (r) => {
|
|
|
3272
3277
|
detourDistance: r.detourDistance
|
|
3273
3278
|
});
|
|
3274
3279
|
case "vertical":
|
|
3275
|
-
return () => new
|
|
3280
|
+
return () => new Pt({
|
|
3276
3281
|
color: r.color,
|
|
3277
3282
|
width: r.width,
|
|
3278
3283
|
arrowLength: r.arrowLength,
|
|
@@ -3296,7 +3301,7 @@ const Wt = (r) => {
|
|
|
3296
3301
|
targetOffset: r.targetOffset
|
|
3297
3302
|
});
|
|
3298
3303
|
default:
|
|
3299
|
-
return () => new
|
|
3304
|
+
return () => new Et({
|
|
3300
3305
|
color: r.color,
|
|
3301
3306
|
width: r.width,
|
|
3302
3307
|
arrowLength: r.arrowLength,
|
|
@@ -3310,7 +3315,7 @@ const Wt = (r) => {
|
|
|
3310
3315
|
detourDirection: r.detourDirection
|
|
3311
3316
|
});
|
|
3312
3317
|
}
|
|
3313
|
-
},
|
|
3318
|
+
}, qt = (r, e, t) => {
|
|
3314
3319
|
var c, g, l;
|
|
3315
3320
|
const s = () => "direct", o = (u) => u, n = (u) => u.button === 0, a = () => {
|
|
3316
3321
|
}, h = () => {
|
|
@@ -3327,11 +3332,11 @@ const Wt = (r) => {
|
|
|
3327
3332
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3328
3333
|
edgeShapeFactory: r.edgeShape !== void 0 ? he(r.edgeShape) : e
|
|
3329
3334
|
};
|
|
3330
|
-
},
|
|
3335
|
+
}, Kt = (r, e) => {
|
|
3331
3336
|
var c, g, l;
|
|
3332
3337
|
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
|
|
3333
|
-
const
|
|
3334
|
-
return
|
|
3338
|
+
const w = e.getPortAdjacentEdgeIds(u);
|
|
3339
|
+
return w.length > 0 ? w[w.length - 1] : null;
|
|
3335
3340
|
}, a = () => {
|
|
3336
3341
|
}, h = () => {
|
|
3337
3342
|
}, d = () => {
|
|
@@ -3346,10 +3351,10 @@ const Wt = (r) => {
|
|
|
3346
3351
|
onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
|
|
3347
3352
|
onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
|
|
3348
3353
|
};
|
|
3349
|
-
},
|
|
3354
|
+
}, Qt = (r) => ({
|
|
3350
3355
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3351
3356
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3352
|
-
}),
|
|
3357
|
+
}), Zt = (r) => {
|
|
3353
3358
|
var e, t;
|
|
3354
3359
|
return {
|
|
3355
3360
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3358,7 +3363,7 @@ const Wt = (r) => {
|
|
|
3358
3363
|
})
|
|
3359
3364
|
};
|
|
3360
3365
|
};
|
|
3361
|
-
class
|
|
3366
|
+
class Jt extends Error {
|
|
3362
3367
|
constructor() {
|
|
3363
3368
|
super(...arguments);
|
|
3364
3369
|
i(this, "name", "CanvasBuilderError");
|
|
@@ -3397,8 +3402,8 @@ class ke {
|
|
|
3397
3402
|
const s = this.graph.getEdge(t), o = this.graph.getPort(s.from), n = this.graph.getPort(s.to), a = this.currentCoords.get(o.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
|
|
3398
3403
|
a,
|
|
3399
3404
|
h
|
|
3400
|
-
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g,
|
|
3401
|
-
|
|
3405
|
+
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, w = e.get(o.nodeId), p = e.get(n.nodeId);
|
|
3406
|
+
w.x += l, w.y += u, p.x -= l, p.y -= u;
|
|
3402
3407
|
});
|
|
3403
3408
|
}
|
|
3404
3409
|
}
|
|
@@ -3427,7 +3432,7 @@ const Ye = (r) => {
|
|
|
3427
3432
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
3428
3433
|
return Math.min(e, r.maxForce);
|
|
3429
3434
|
};
|
|
3430
|
-
class
|
|
3435
|
+
class _t {
|
|
3431
3436
|
constructor(e) {
|
|
3432
3437
|
i(this, "nodeCharge");
|
|
3433
3438
|
i(this, "distanceVectorGenerator");
|
|
@@ -3448,13 +3453,13 @@ class Jt {
|
|
|
3448
3453
|
targetCharge: this.nodeCharge,
|
|
3449
3454
|
distance: l.d,
|
|
3450
3455
|
maxForce: this.maxForce
|
|
3451
|
-
}),
|
|
3452
|
-
v.x -=
|
|
3456
|
+
}), w = u * l.ex, p = u * l.ey, v = t.get(a), x = t.get(d);
|
|
3457
|
+
v.x -= w, v.y -= p, x.x += w, x.y += p;
|
|
3453
3458
|
}
|
|
3454
3459
|
}
|
|
3455
3460
|
}
|
|
3456
3461
|
}
|
|
3457
|
-
const
|
|
3462
|
+
const er = (r) => {
|
|
3458
3463
|
if (r.size === 0)
|
|
3459
3464
|
return {
|
|
3460
3465
|
centerX: 0,
|
|
@@ -3472,7 +3477,7 @@ const _t = (r) => {
|
|
|
3472
3477
|
radius: h / 2
|
|
3473
3478
|
};
|
|
3474
3479
|
};
|
|
3475
|
-
class
|
|
3480
|
+
class tr {
|
|
3476
3481
|
constructor(e) {
|
|
3477
3482
|
i(this, "root");
|
|
3478
3483
|
i(this, "leaves", /* @__PURE__ */ new Map());
|
|
@@ -3527,8 +3532,8 @@ class er {
|
|
|
3527
3532
|
this.sortedParentNodes.push(e);
|
|
3528
3533
|
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = o / 2;
|
|
3529
3534
|
e.nodeIds.forEach((u) => {
|
|
3530
|
-
const { x:
|
|
3531
|
-
|
|
3535
|
+
const { x: w, y: p } = this.coords.get(u);
|
|
3536
|
+
w < t ? p < s ? d.add(u) : h.add(u) : p < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
|
|
3532
3537
|
});
|
|
3533
3538
|
const g = {
|
|
3534
3539
|
parent: e,
|
|
@@ -3629,7 +3634,7 @@ class er {
|
|
|
3629
3634
|
}), { x: t / e.size, y: s / e.size };
|
|
3630
3635
|
}
|
|
3631
3636
|
}
|
|
3632
|
-
class
|
|
3637
|
+
class rr {
|
|
3633
3638
|
constructor(e) {
|
|
3634
3639
|
i(this, "areaRadiusThreshold");
|
|
3635
3640
|
i(this, "nodeMass");
|
|
@@ -3641,7 +3646,7 @@ class tr {
|
|
|
3641
3646
|
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;
|
|
3642
3647
|
}
|
|
3643
3648
|
apply(e, t) {
|
|
3644
|
-
const s =
|
|
3649
|
+
const s = er(e), o = new tr({
|
|
3645
3650
|
box: s,
|
|
3646
3651
|
coords: e,
|
|
3647
3652
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
@@ -3791,7 +3796,7 @@ class tr {
|
|
|
3791
3796
|
}
|
|
3792
3797
|
}
|
|
3793
3798
|
}
|
|
3794
|
-
const Xe = (r) => r.theta !== 0 ? new
|
|
3799
|
+
const Xe = (r) => r.theta !== 0 ? new rr({
|
|
3795
3800
|
nodeCharge: r.nodeCharge,
|
|
3796
3801
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3797
3802
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -3799,7 +3804,7 @@ const Xe = (r) => r.theta !== 0 ? new tr({
|
|
|
3799
3804
|
theta: r.theta,
|
|
3800
3805
|
nodeMass: r.nodeMass,
|
|
3801
3806
|
areaRadiusThreshold: r.areaRadiusThreshold
|
|
3802
|
-
}) : new
|
|
3807
|
+
}) : new _t({
|
|
3803
3808
|
nodeCharge: r.nodeCharge,
|
|
3804
3809
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3805
3810
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -3812,23 +3817,23 @@ class Ge {
|
|
|
3812
3817
|
this.rand = e.rand, this.sparsity = e.sparsity;
|
|
3813
3818
|
}
|
|
3814
3819
|
calculateCoordinates(e) {
|
|
3815
|
-
const { graph: t, viewport: s } = e, o = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((
|
|
3816
|
-
const v = t.getNode(
|
|
3820
|
+
const { graph: t, viewport: s } = e, o = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((p) => {
|
|
3821
|
+
const v = t.getNode(p);
|
|
3817
3822
|
return v.x === null || v.y === null;
|
|
3818
3823
|
}), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = s.getDimensions(), c = { x: h / 2, y: d / 2 }, g = s.createContentCoords(c), l = a / 2, u = {
|
|
3819
3824
|
x: g.x - l,
|
|
3820
3825
|
y: g.y - l
|
|
3821
3826
|
};
|
|
3822
|
-
return t.getAllNodeIds().forEach((
|
|
3823
|
-
const v = t.getNode(
|
|
3824
|
-
o.set(
|
|
3827
|
+
return t.getAllNodeIds().forEach((p) => {
|
|
3828
|
+
const v = t.getNode(p);
|
|
3829
|
+
o.set(p, {
|
|
3825
3830
|
x: v.x ?? u.x + a * this.rand(),
|
|
3826
3831
|
y: v.y ?? u.y + a * this.rand()
|
|
3827
3832
|
});
|
|
3828
3833
|
}), o;
|
|
3829
3834
|
}
|
|
3830
3835
|
}
|
|
3831
|
-
class
|
|
3836
|
+
class sr {
|
|
3832
3837
|
constructor(e) {
|
|
3833
3838
|
i(this, "distanceVectorGenerator");
|
|
3834
3839
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -3873,7 +3878,7 @@ class rr {
|
|
|
3873
3878
|
return o;
|
|
3874
3879
|
}
|
|
3875
3880
|
}
|
|
3876
|
-
class
|
|
3881
|
+
class or {
|
|
3877
3882
|
constructor(e) {
|
|
3878
3883
|
i(this, "forest", /* @__PURE__ */ new Set());
|
|
3879
3884
|
i(this, "remainingNodeIds");
|
|
@@ -3916,70 +3921,80 @@ class sr {
|
|
|
3916
3921
|
}
|
|
3917
3922
|
}
|
|
3918
3923
|
}
|
|
3919
|
-
class
|
|
3924
|
+
class ir {
|
|
3920
3925
|
constructor(e) {
|
|
3921
|
-
|
|
3922
|
-
this.baseRadius = e.radius;
|
|
3926
|
+
this.params = e;
|
|
3923
3927
|
}
|
|
3924
|
-
|
|
3925
|
-
let t = 0
|
|
3926
|
-
const o = [];
|
|
3927
|
-
e.forEach((h) => {
|
|
3928
|
-
|
|
3928
|
+
generate(e) {
|
|
3929
|
+
let t = 0;
|
|
3930
|
+
const s = [], o = e.length - 1, n = [];
|
|
3931
|
+
e.forEach((h, d) => {
|
|
3932
|
+
if (t += this.params.spaceAroundRadius, h.forEach((c, g) => {
|
|
3933
|
+
n[g] === void 0 ? n[g] = {
|
|
3934
|
+
start: t + c.start,
|
|
3935
|
+
end: t + c.end
|
|
3936
|
+
} : n[g].end = t + c.end;
|
|
3937
|
+
}), s.push(t), t += this.params.spaceAroundRadius, d !== o) {
|
|
3938
|
+
const c = e[d + 1];
|
|
3939
|
+
t += this.calculateMaxDiff(h, c);
|
|
3940
|
+
}
|
|
3929
3941
|
});
|
|
3930
|
-
const
|
|
3931
|
-
let a = 0;
|
|
3932
|
-
if (e.length > 0) {
|
|
3933
|
-
const h = e[e.length - 1] ?? 0, d = o[o.length - 1];
|
|
3934
|
-
a = Math.max(
|
|
3935
|
-
a,
|
|
3936
|
-
d + h - t
|
|
3937
|
-
);
|
|
3938
|
-
const c = e[0] ?? 0, g = o[0];
|
|
3939
|
-
a = Math.max(a, c - g);
|
|
3940
|
-
}
|
|
3942
|
+
const a = t / 2;
|
|
3941
3943
|
return {
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
+
childOffsets: s.map((h) => h - a),
|
|
3945
|
+
subtreeSpans: n.map((h) => ({
|
|
3946
|
+
start: h.start - a,
|
|
3947
|
+
end: h.end - a
|
|
3948
|
+
}))
|
|
3944
3949
|
};
|
|
3945
3950
|
}
|
|
3951
|
+
calculateMaxDiff(e, t) {
|
|
3952
|
+
let s = 0;
|
|
3953
|
+
const o = Math.min(e.length, t.length);
|
|
3954
|
+
for (let n = 0; n < o; n++) {
|
|
3955
|
+
const a = e[n].end - t[n].start;
|
|
3956
|
+
s = Math.max(s, a);
|
|
3957
|
+
}
|
|
3958
|
+
return s - 2 * this.params.spaceAroundRadius;
|
|
3959
|
+
}
|
|
3946
3960
|
}
|
|
3947
|
-
class
|
|
3961
|
+
class nr {
|
|
3948
3962
|
constructor(e, t) {
|
|
3949
3963
|
i(this, "offsets", /* @__PURE__ */ new Map());
|
|
3950
|
-
i(this, "
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
})
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
this.
|
|
3962
|
-
|
|
3963
|
-
s
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3964
|
+
i(this, "treeSpans", /* @__PURE__ */ new Map());
|
|
3965
|
+
this.tree = e;
|
|
3966
|
+
const s = t.spaceAroundRadius, o = new ir({
|
|
3967
|
+
spaceAroundRadius: s
|
|
3968
|
+
});
|
|
3969
|
+
[...this.tree.sequence].reverse().forEach((n) => {
|
|
3970
|
+
const a = Array.from(n.children).map(
|
|
3971
|
+
(c) => this.treeSpans.get(c.nodeId)
|
|
3972
|
+
), h = o.generate(a);
|
|
3973
|
+
let d = 0;
|
|
3974
|
+
n.children.forEach((c) => {
|
|
3975
|
+
this.offsets.set(c.nodeId, h.childOffsets[d]), d++;
|
|
3976
|
+
}), this.treeSpans.set(n.nodeId, [
|
|
3977
|
+
{ start: -s, end: s },
|
|
3978
|
+
...h.subtreeSpans
|
|
3979
|
+
]), n.children.forEach((c) => {
|
|
3980
|
+
this.treeSpans.delete(c.nodeId);
|
|
3981
|
+
});
|
|
3967
3982
|
}), this.offsets.set(this.tree.root.nodeId, 0);
|
|
3968
3983
|
}
|
|
3969
3984
|
generate() {
|
|
3970
3985
|
return this.offsets;
|
|
3971
3986
|
}
|
|
3972
3987
|
}
|
|
3973
|
-
class
|
|
3988
|
+
class ar {
|
|
3974
3989
|
constructor(e) {
|
|
3975
3990
|
this.params = e;
|
|
3976
3991
|
}
|
|
3977
3992
|
calculateCoordinates(e) {
|
|
3978
|
-
const t = /* @__PURE__ */ new Map(), o = new
|
|
3993
|
+
const t = /* @__PURE__ */ new Map(), o = new or(e.graph).generate();
|
|
3979
3994
|
let n = 0;
|
|
3980
3995
|
return o.forEach((a) => {
|
|
3981
3996
|
t.set(a.root.nodeId, { x: n, y: 0 });
|
|
3982
|
-
const d = new
|
|
3997
|
+
const d = new nr(a, {
|
|
3983
3998
|
spaceAroundRadius: this.params.layerSpace / 2
|
|
3984
3999
|
}).generate();
|
|
3985
4000
|
let c = [a.root];
|
|
@@ -3987,21 +4002,20 @@ class nr {
|
|
|
3987
4002
|
const g = [];
|
|
3988
4003
|
n += this.params.layerWidth, c.forEach((l) => {
|
|
3989
4004
|
l.children.forEach((u) => {
|
|
3990
|
-
const
|
|
4005
|
+
const w = t.get(l.nodeId).y;
|
|
3991
4006
|
t.set(u.nodeId, {
|
|
3992
|
-
y:
|
|
4007
|
+
y: w + d.get(u.nodeId),
|
|
3993
4008
|
x: n
|
|
3994
4009
|
}), g.push(u);
|
|
3995
4010
|
});
|
|
3996
4011
|
}), c = g;
|
|
3997
4012
|
}
|
|
3998
|
-
}), t.forEach((a) => {
|
|
3999
|
-
|
|
4000
|
-
a.x = h.x, a.y = h.y;
|
|
4013
|
+
}), t.forEach((a, h) => {
|
|
4014
|
+
t.set(h, this.params.transform(a));
|
|
4001
4015
|
}), t;
|
|
4002
4016
|
}
|
|
4003
4017
|
}
|
|
4004
|
-
class
|
|
4018
|
+
class hr {
|
|
4005
4019
|
constructor(e) {
|
|
4006
4020
|
i(this, "distanceVectorGenerator");
|
|
4007
4021
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4069,14 +4083,14 @@ const je = (r) => {
|
|
|
4069
4083
|
nodeForceCoefficient: 1,
|
|
4070
4084
|
barnesHutAreaRadiusThreshold: 0.01,
|
|
4071
4085
|
barnesHutTheta: 1
|
|
4072
|
-
}),
|
|
4086
|
+
}), dr = (r) => {
|
|
4073
4087
|
var e, t;
|
|
4074
4088
|
switch (r == null ? void 0 : r.type) {
|
|
4075
4089
|
case "custom":
|
|
4076
4090
|
return r.instance;
|
|
4077
4091
|
default: {
|
|
4078
4092
|
const s = je((r == null ? void 0 : r.seed) ?? A.seed), o = qe(s[0], s[1], s[2], s[3]);
|
|
4079
|
-
return new
|
|
4093
|
+
return new hr({
|
|
4080
4094
|
rand: o,
|
|
4081
4095
|
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? A.maxTimeDeltaSec,
|
|
4082
4096
|
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
|
|
@@ -4097,23 +4111,23 @@ const je = (r) => {
|
|
|
4097
4111
|
},
|
|
4098
4112
|
onAfterApplied: () => {
|
|
4099
4113
|
}
|
|
4100
|
-
},
|
|
4114
|
+
}, cr = (r) => {
|
|
4101
4115
|
var t, s;
|
|
4102
4116
|
return {
|
|
4103
|
-
algorithm:
|
|
4117
|
+
algorithm: dr((r == null ? void 0 : r.algorithm) ?? {}),
|
|
4104
4118
|
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? G.staticNodeResolver,
|
|
4105
4119
|
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? G.onBeforeApplied,
|
|
4106
4120
|
onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ?? G.onAfterApplied
|
|
4107
4121
|
};
|
|
4108
|
-
},
|
|
4122
|
+
}, lr = (r) => r instanceof K ? {
|
|
4109
4123
|
type: "trigger",
|
|
4110
4124
|
trigger: r
|
|
4111
4125
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
4112
4126
|
type: "topologyChangeSchedule",
|
|
4113
|
-
schedule:
|
|
4127
|
+
schedule: Mt
|
|
4114
4128
|
} : {
|
|
4115
4129
|
type: "topologyChangeSchedule",
|
|
4116
|
-
schedule:
|
|
4130
|
+
schedule: Dt
|
|
4117
4131
|
}, F = Object.freeze({
|
|
4118
4132
|
staticNodeResolver: () => !1,
|
|
4119
4133
|
onBeforeApplied: () => {
|
|
@@ -4131,7 +4145,7 @@ const je = (r) => {
|
|
|
4131
4145
|
d: r.d * e.a + r.e * e.d,
|
|
4132
4146
|
e: r.d * e.b + r.e * e.e,
|
|
4133
4147
|
f: r.d * e.c + r.e * e.f + r.f
|
|
4134
|
-
}),
|
|
4148
|
+
}), gr = (r) => {
|
|
4135
4149
|
const { a: e, b: t, c: s, d: o, e: n, f: a } = r, h = e * n - t * o;
|
|
4136
4150
|
return {
|
|
4137
4151
|
a: n / h,
|
|
@@ -4142,7 +4156,7 @@ const je = (r) => {
|
|
|
4142
4156
|
f: (s * o - e * a) / h
|
|
4143
4157
|
};
|
|
4144
4158
|
};
|
|
4145
|
-
class
|
|
4159
|
+
class ur {
|
|
4146
4160
|
resolve(e) {
|
|
4147
4161
|
if ("shift" in e)
|
|
4148
4162
|
return this.createShiftBaseMatrix(e.shift);
|
|
@@ -4186,7 +4200,7 @@ class gr {
|
|
|
4186
4200
|
const s = $(
|
|
4187
4201
|
t,
|
|
4188
4202
|
e
|
|
4189
|
-
), o =
|
|
4203
|
+
), o = gr(t);
|
|
4190
4204
|
return $(s, o);
|
|
4191
4205
|
}
|
|
4192
4206
|
createShiftBaseMatrix(e) {
|
|
@@ -4231,7 +4245,7 @@ class gr {
|
|
|
4231
4245
|
};
|
|
4232
4246
|
}
|
|
4233
4247
|
}
|
|
4234
|
-
const
|
|
4248
|
+
const pr = (r) => {
|
|
4235
4249
|
if (r === void 0)
|
|
4236
4250
|
return (o) => o;
|
|
4237
4251
|
if (typeof r == "function")
|
|
@@ -4245,7 +4259,7 @@ const ur = (r) => {
|
|
|
4245
4259
|
e: 1,
|
|
4246
4260
|
f: 0
|
|
4247
4261
|
};
|
|
4248
|
-
const s = new
|
|
4262
|
+
const s = new ur();
|
|
4249
4263
|
return e.forEach((o) => {
|
|
4250
4264
|
const n = s.resolve(o);
|
|
4251
4265
|
t = $(t, n);
|
|
@@ -4256,20 +4270,20 @@ const ur = (r) => {
|
|
|
4256
4270
|
y: t.d * n + t.e * a + t.f
|
|
4257
4271
|
};
|
|
4258
4272
|
};
|
|
4259
|
-
},
|
|
4273
|
+
}, wr = (r) => {
|
|
4260
4274
|
var e, t;
|
|
4261
4275
|
switch (r == null ? void 0 : r.type) {
|
|
4262
4276
|
case "custom":
|
|
4263
4277
|
return r.instance;
|
|
4264
4278
|
case "hierarchical":
|
|
4265
|
-
return new
|
|
4279
|
+
return new ar({
|
|
4266
4280
|
layerWidth: r.layerWidth ?? F.hierarchicalLayout.layerWidth,
|
|
4267
4281
|
layerSpace: r.layerSpace ?? F.hierarchicalLayout.layerSpace,
|
|
4268
|
-
transform:
|
|
4282
|
+
transform: pr(r.transform)
|
|
4269
4283
|
});
|
|
4270
4284
|
default: {
|
|
4271
4285
|
const s = je((r == null ? void 0 : r.seed) ?? A.seed), o = qe(s[0], s[1], s[2], s[3]);
|
|
4272
|
-
return new
|
|
4286
|
+
return new sr({
|
|
4273
4287
|
dtSec: (r == null ? void 0 : r.dtSec) ?? A.dtSec,
|
|
4274
4288
|
maxIterations: (r == null ? void 0 : r.maxIterations) ?? A.maxIterations,
|
|
4275
4289
|
rand: o,
|
|
@@ -4285,11 +4299,11 @@ const ur = (r) => {
|
|
|
4285
4299
|
});
|
|
4286
4300
|
}
|
|
4287
4301
|
}
|
|
4288
|
-
},
|
|
4302
|
+
}, yr = (r) => {
|
|
4289
4303
|
var e, t;
|
|
4290
4304
|
return {
|
|
4291
|
-
algorithm:
|
|
4292
|
-
applyOn:
|
|
4305
|
+
algorithm: wr(r.algorithm),
|
|
4306
|
+
applyOn: lr(r.applyOn),
|
|
4293
4307
|
staticNodeResolver: r.staticNodeResolver ?? F.staticNodeResolver,
|
|
4294
4308
|
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? F.onBeforeApplied,
|
|
4295
4309
|
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? F.onAfterApplied
|
|
@@ -4302,28 +4316,30 @@ const ur = (r) => {
|
|
|
4302
4316
|
onNodeDragFinished: (t) => {
|
|
4303
4317
|
e.delete(t), r.onNodeDragFinished(t);
|
|
4304
4318
|
}
|
|
4305
|
-
}),
|
|
4306
|
-
r.onBeforeNodeRemoved.subscribe((t) => {
|
|
4319
|
+
}), mr = (r, e) => {
|
|
4320
|
+
r.graph.onBeforeNodeRemoved.subscribe((t) => {
|
|
4307
4321
|
e.delete(t);
|
|
4308
|
-
}), r.onBeforeClear.subscribe(() => {
|
|
4322
|
+
}), r.graph.onBeforeClear.subscribe(() => {
|
|
4323
|
+
e.clear();
|
|
4324
|
+
}), r.onBeforeDestroy.subscribe(() => {
|
|
4309
4325
|
e.clear();
|
|
4310
4326
|
});
|
|
4311
|
-
},
|
|
4327
|
+
}, vr = (r, e) => ({
|
|
4312
4328
|
...r,
|
|
4313
4329
|
staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
|
|
4314
|
-
}), q = (r) => () => r, xe = q(0),
|
|
4330
|
+
}), q = (r) => () => r, xe = q(0), Ar = () => {
|
|
4315
4331
|
let r = 0;
|
|
4316
4332
|
return () => r++;
|
|
4317
|
-
},
|
|
4333
|
+
}, xr = (r, e) => {
|
|
4318
4334
|
let t = xe, s = xe;
|
|
4319
|
-
const o =
|
|
4335
|
+
const o = Ar();
|
|
4320
4336
|
return r === "incremental" && (t = o), e === "incremental" && (s = o), typeof r == "number" && (t = q(r)), typeof e == "number" && (s = q(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
4321
4337
|
nodesPriorityFn: t,
|
|
4322
4338
|
edgesPriorityFn: s
|
|
4323
4339
|
};
|
|
4324
|
-
},
|
|
4340
|
+
}, Er = (r) => {
|
|
4325
4341
|
var t, s, o, n, a;
|
|
4326
|
-
const e =
|
|
4342
|
+
const e = xr(
|
|
4327
4343
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
4328
4344
|
(s = r.edges) == null ? void 0 : s.priority
|
|
4329
4345
|
);
|
|
@@ -4340,9 +4356,9 @@ const ur = (r) => {
|
|
|
4340
4356
|
priorityFn: e.edgesPriorityFn
|
|
4341
4357
|
}
|
|
4342
4358
|
};
|
|
4343
|
-
},
|
|
4359
|
+
}, Sr = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : _, br = (r) => {
|
|
4344
4360
|
var s, o;
|
|
4345
|
-
const { canvasDefaults: e } = r, t = r.hasLayout ?
|
|
4361
|
+
const { canvasDefaults: e } = r, t = r.hasLayout ? Sr(r.layoutParams) : _;
|
|
4346
4362
|
return {
|
|
4347
4363
|
focus: {
|
|
4348
4364
|
contentOffset: ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
|
|
@@ -4351,7 +4367,7 @@ const ur = (r) => {
|
|
|
4351
4367
|
}
|
|
4352
4368
|
};
|
|
4353
4369
|
};
|
|
4354
|
-
class
|
|
4370
|
+
class Nr {
|
|
4355
4371
|
constructor(e) {
|
|
4356
4372
|
i(this, "used", !1);
|
|
4357
4373
|
i(this, "canvasDefaults", {});
|
|
@@ -4372,13 +4388,9 @@ class Cr {
|
|
|
4372
4388
|
i(this, "hasAnimatedLayout", !1);
|
|
4373
4389
|
i(this, "hasLayout", !1);
|
|
4374
4390
|
i(this, "boxRenderingTrigger", new K());
|
|
4375
|
-
i(this, "graphStore");
|
|
4376
|
-
i(this, "viewportStore");
|
|
4377
|
-
i(this, "graph");
|
|
4378
|
-
i(this, "viewport");
|
|
4379
4391
|
i(this, "window", window);
|
|
4380
4392
|
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
4381
|
-
this.element = e
|
|
4393
|
+
this.element = e;
|
|
4382
4394
|
}
|
|
4383
4395
|
setDefaults(e) {
|
|
4384
4396
|
return this.canvasDefaults = e, this;
|
|
@@ -4412,126 +4424,126 @@ class Cr {
|
|
|
4412
4424
|
}
|
|
4413
4425
|
build() {
|
|
4414
4426
|
if (this.used)
|
|
4415
|
-
throw new
|
|
4427
|
+
throw new Jt("CanvasBuilder is a single use object");
|
|
4416
4428
|
this.used = !0;
|
|
4417
|
-
const e = new
|
|
4429
|
+
const e = new it(this.element), t = new be(), s = new Wt(this.element), o = this.createHtmlView(
|
|
4430
|
+
s.main,
|
|
4431
|
+
t,
|
|
4432
|
+
e
|
|
4433
|
+
), n = Er(
|
|
4418
4434
|
this.canvasDefaults
|
|
4419
|
-
),
|
|
4420
|
-
this.graphStore,
|
|
4435
|
+
), a = new Be(
|
|
4421
4436
|
t,
|
|
4422
|
-
|
|
4423
|
-
|
|
4437
|
+
o,
|
|
4438
|
+
n
|
|
4439
|
+
), h = yr(this.layoutConfig), d = br({
|
|
4424
4440
|
canvasDefaults: this.canvasDefaults,
|
|
4425
4441
|
hasLayout: this.hasLayout,
|
|
4426
|
-
layoutParams:
|
|
4427
|
-
}),
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
),
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4442
|
+
layoutParams: h
|
|
4443
|
+
}), c = new We(
|
|
4444
|
+
t,
|
|
4445
|
+
e,
|
|
4446
|
+
d
|
|
4447
|
+
), g = new $e(e), l = new Ie(t), u = new Se(
|
|
4448
|
+
l,
|
|
4449
|
+
g,
|
|
4450
|
+
a,
|
|
4451
|
+
c
|
|
4436
4452
|
);
|
|
4437
4453
|
if (this.hasBackground && re.configure(
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
), this.hasNodeResizeReactiveEdges && Q.configure(
|
|
4442
|
-
let
|
|
4443
|
-
this.hasAnimatedLayout && (
|
|
4444
|
-
|
|
4454
|
+
u,
|
|
4455
|
+
jt(this.backgroundConfig),
|
|
4456
|
+
s.background
|
|
4457
|
+
), this.hasNodeResizeReactiveEdges && Q.configure(u), this.hasDraggableNodes) {
|
|
4458
|
+
let p = zt(this.dragConfig);
|
|
4459
|
+
this.hasAnimatedLayout && (p = fr(
|
|
4460
|
+
p,
|
|
4445
4461
|
this.animationStaticNodes
|
|
4446
4462
|
)), ee.configure(
|
|
4447
|
-
|
|
4448
|
-
|
|
4463
|
+
u,
|
|
4464
|
+
s.main,
|
|
4449
4465
|
this.window,
|
|
4450
|
-
|
|
4466
|
+
p
|
|
4451
4467
|
);
|
|
4452
4468
|
}
|
|
4453
4469
|
if (this.hasUserConnectablePorts) {
|
|
4454
|
-
const
|
|
4470
|
+
const p = qt(
|
|
4455
4471
|
this.connectablePortsConfig,
|
|
4456
|
-
|
|
4457
|
-
|
|
4472
|
+
n.edges.shapeFactory,
|
|
4473
|
+
n.ports.direction
|
|
4458
4474
|
);
|
|
4459
4475
|
se.configure(
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4476
|
+
u,
|
|
4477
|
+
s.overlayConnectablePorts,
|
|
4478
|
+
e,
|
|
4463
4479
|
this.window,
|
|
4464
|
-
|
|
4480
|
+
p
|
|
4465
4481
|
);
|
|
4466
4482
|
}
|
|
4467
4483
|
if (this.hasUserDraggableEdges) {
|
|
4468
|
-
const
|
|
4484
|
+
const p = Kt(
|
|
4469
4485
|
this.draggableEdgesConfig,
|
|
4470
|
-
|
|
4486
|
+
u.graph
|
|
4471
4487
|
);
|
|
4472
4488
|
oe.configure(
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4489
|
+
u,
|
|
4490
|
+
s.overlayDraggableEdges,
|
|
4491
|
+
e,
|
|
4476
4492
|
this.window,
|
|
4477
|
-
|
|
4493
|
+
p
|
|
4478
4494
|
);
|
|
4479
4495
|
}
|
|
4480
4496
|
if (this.virtualScrollConfig !== void 0 ? te.configure(
|
|
4481
|
-
|
|
4482
|
-
|
|
4497
|
+
u,
|
|
4498
|
+
s.main,
|
|
4483
4499
|
this.window,
|
|
4484
4500
|
Ae(this.transformConfig),
|
|
4485
4501
|
this.boxRenderingTrigger,
|
|
4486
|
-
|
|
4502
|
+
Qt(this.virtualScrollConfig)
|
|
4487
4503
|
) : this.hasTransformableViewport && Y.configure(
|
|
4488
|
-
|
|
4489
|
-
|
|
4504
|
+
u,
|
|
4505
|
+
s.main,
|
|
4490
4506
|
this.window,
|
|
4491
4507
|
Ae(this.transformConfig)
|
|
4492
|
-
), this.hasLayout &&
|
|
4493
|
-
let
|
|
4508
|
+
), this.hasLayout && $t.configure(u, h), this.hasAnimatedLayout) {
|
|
4509
|
+
let p = cr(
|
|
4494
4510
|
this.animatedLayoutConfig
|
|
4495
4511
|
);
|
|
4496
|
-
this.hasDraggableNodes && (
|
|
4497
|
-
|
|
4512
|
+
this.hasDraggableNodes && (mr(
|
|
4513
|
+
u,
|
|
4498
4514
|
this.animationStaticNodes
|
|
4499
|
-
),
|
|
4500
|
-
|
|
4515
|
+
), p = vr(
|
|
4516
|
+
p,
|
|
4501
4517
|
this.animationStaticNodes
|
|
4502
|
-
)), ae.configure(
|
|
4518
|
+
)), ae.configure(u, p, this.window);
|
|
4503
4519
|
}
|
|
4504
|
-
const
|
|
4505
|
-
|
|
4520
|
+
const w = () => {
|
|
4521
|
+
s.destroy(), u.onBeforeDestroy.unsubscribe(w);
|
|
4506
4522
|
};
|
|
4507
|
-
return
|
|
4523
|
+
return u.onBeforeDestroy.subscribe(w), u;
|
|
4508
4524
|
}
|
|
4509
|
-
createHtmlView(e) {
|
|
4510
|
-
let
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
e
|
|
4514
|
-
);
|
|
4515
|
-
return this.virtualScrollConfig !== void 0 && (t = new tt(
|
|
4525
|
+
createHtmlView(e, t, s) {
|
|
4526
|
+
let o = new Ee(t, s, e);
|
|
4527
|
+
return this.virtualScrollConfig !== void 0 && (o = new rt(
|
|
4528
|
+
o,
|
|
4516
4529
|
t,
|
|
4517
|
-
this.graphStore,
|
|
4518
4530
|
this.boxRenderingTrigger,
|
|
4519
|
-
|
|
4520
|
-
)),
|
|
4531
|
+
Zt(this.virtualScrollConfig)
|
|
4532
|
+
)), o = new st(o, t), o;
|
|
4521
4533
|
}
|
|
4522
4534
|
}
|
|
4523
4535
|
export {
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4536
|
+
Et as BezierEdgeShape,
|
|
4537
|
+
Nr as CanvasBuilder,
|
|
4538
|
+
Jt as CanvasBuilderError,
|
|
4527
4539
|
E as CanvasError,
|
|
4528
4540
|
D as ConnectionCategory,
|
|
4529
4541
|
Ve as DirectEdgeShape,
|
|
4530
4542
|
K as EventSubject,
|
|
4531
|
-
|
|
4532
|
-
|
|
4543
|
+
St as HorizontalEdgeShape,
|
|
4544
|
+
Tt as InteractiveEdgeError,
|
|
4533
4545
|
Fe as InteractiveEdgeShape,
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4546
|
+
Cr as MidpointEdgeShape,
|
|
4547
|
+
bt as StraightEdgeShape,
|
|
4548
|
+
Pt as VerticalEdgeShape
|
|
4537
4549
|
};
|