mind-elixir 5.11.3 → 5.12.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/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +225 -219
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +169 -163
- package/dist/types/index.d.ts +4 -2
- package/dist/types/methods.d.ts +7 -1
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/utils/theme.d.ts +1 -0
- package/package.json +1 -1
package/dist/MindElixirLite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Wn = 0, Yn = 1, Rn = 2, tt = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -94,7 +94,7 @@ const Ht = function() {
|
|
|
94
94
|
topic: this.newTopicName,
|
|
95
95
|
id: t
|
|
96
96
|
};
|
|
97
|
-
},
|
|
97
|
+
}, P = (t, e) => {
|
|
98
98
|
let n = 0, o = 0;
|
|
99
99
|
for (; e && e !== t; )
|
|
100
100
|
n += e.offsetLeft, o += e.offsetTop, e = e.offsetParent;
|
|
@@ -234,7 +234,7 @@ function ut(t, e) {
|
|
|
234
234
|
e.meet && j(e.meet), e.ghost.style.display = "none", e.ghost.innerHTML = "", t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
const
|
|
237
|
+
const O = {
|
|
238
238
|
LHS: "lhs",
|
|
239
239
|
RHS: "rhs"
|
|
240
240
|
}, Vt = function() {
|
|
@@ -253,9 +253,9 @@ const I = {
|
|
|
253
253
|
zt(this, n, e);
|
|
254
254
|
}, zt = function(t, e, n) {
|
|
255
255
|
const o = document.createElement("me-main");
|
|
256
|
-
o.className =
|
|
256
|
+
o.className = O.LHS;
|
|
257
257
|
const s = document.createElement("me-main");
|
|
258
|
-
s.className =
|
|
258
|
+
s.className = O.RHS;
|
|
259
259
|
for (let i = 0; i < e.length; i++) {
|
|
260
260
|
const r = e[i], { grp: c } = t.createWrapper(r);
|
|
261
261
|
t.direction === 2 ? r.direction === 0 ? o.appendChild(c) : s.appendChild(c) : t.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
@@ -336,7 +336,7 @@ function Et(t) {
|
|
|
336
336
|
}
|
|
337
337
|
const Ut = function(t) {
|
|
338
338
|
if (!t) return;
|
|
339
|
-
const e = document.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } =
|
|
339
|
+
const e = document.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = P(this.nodes, t);
|
|
340
340
|
this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
|
|
341
341
|
const r = getComputedStyle(t);
|
|
342
342
|
e.style.cssText = `
|
|
@@ -550,8 +550,8 @@ function Me(t) {
|
|
|
550
550
|
this.clear();
|
|
551
551
|
return;
|
|
552
552
|
}
|
|
553
|
-
const x = (/* @__PURE__ */ new Date()).getTime(),
|
|
554
|
-
this.lastTap = x, this.lastTapTarget = h.target,
|
|
553
|
+
const x = (/* @__PURE__ */ new Date()).getTime(), E = x - this.lastTap, S = E < this.DOUBLE_CLICK_THRESHOLD && E > 0 && this.lastTapTarget === h.target;
|
|
554
|
+
this.lastTap = x, this.lastTapTarget = h.target, S && m(h);
|
|
555
555
|
},
|
|
556
556
|
clear() {
|
|
557
557
|
this.lastTap = 0, this.lastTapTarget = null;
|
|
@@ -579,15 +579,15 @@ function Me(t) {
|
|
|
579
579
|
handlePointerMove(h) {
|
|
580
580
|
if (h.pointerType !== "touch" || !this.activePointers.has(h.pointerId)) return !1;
|
|
581
581
|
if (this.activePointers.set(h.pointerId, { x: h.clientX, y: h.clientY }), this.activePointers.size >= 2) {
|
|
582
|
-
const [m, x] = Array.from(this.activePointers.values()),
|
|
582
|
+
const [m, x] = Array.from(this.activePointers.values()), E = ht(m, x);
|
|
583
583
|
if (this.lastDistance !== null && this.lastDistance > 0) {
|
|
584
|
-
const
|
|
585
|
-
t.scale(t.scaleVal *
|
|
584
|
+
const S = E / this.lastDistance;
|
|
585
|
+
t.scale(t.scaleVal * S, {
|
|
586
586
|
x: (m.x + x.x) / 2,
|
|
587
587
|
y: (m.y + x.y) / 2
|
|
588
588
|
});
|
|
589
589
|
}
|
|
590
|
-
return this.lastDistance =
|
|
590
|
+
return this.lastDistance = E, !0;
|
|
591
591
|
}
|
|
592
592
|
return !1;
|
|
593
593
|
},
|
|
@@ -619,10 +619,10 @@ function Me(t) {
|
|
|
619
619
|
}
|
|
620
620
|
}, a = (h, m) => {
|
|
621
621
|
if (h.closest("#input-box")) return !1;
|
|
622
|
-
const x = h.closest(".svg-label"),
|
|
623
|
-
if (!
|
|
624
|
-
const { type:
|
|
625
|
-
return t.clearSelection(),
|
|
622
|
+
const x = h.closest(".svg-label"), E = h.closest(".topiclinks, .summary"), S = x ? { type: x.dataset.type, element: document.getElementById(x.dataset.svgId) } : E ? { type: E.classList.contains("topiclinks") ? "arrow" : "summary", element: h.closest("g") } : null;
|
|
623
|
+
if (!S?.type || !S?.element) return !1;
|
|
624
|
+
const { type: M, element: N } = S;
|
|
625
|
+
return t.clearSelection(), M === "arrow" ? m ? t.editArrowLabel(N) : t.selectArrow(N) : m ? t.editSummary(N) : t.selectSummary(N), !0;
|
|
626
626
|
}, f = (h) => {
|
|
627
627
|
if (h.pointerType === "mouse" && h.button !== 0) return;
|
|
628
628
|
if (t.helper1?.moved) {
|
|
@@ -663,10 +663,10 @@ function Me(t) {
|
|
|
663
663
|
if (e.handlePointerDown(h), e.mousedown && (t.ptState = i.Pan), h.button === 0 || h.pointerType === "touch")
|
|
664
664
|
if (J(m)) {
|
|
665
665
|
t.selection?.cancel();
|
|
666
|
-
const
|
|
667
|
-
if (h.ctrlKey || h.metaKey || t.mobileMultiSelect ?
|
|
668
|
-
h.pointerType === "touch" ? (t.ptState = i.DragWait, l.start(h, (
|
|
669
|
-
ft(t, c,
|
|
666
|
+
const E = t.currentNodes || [];
|
|
667
|
+
if (h.ctrlKey || h.metaKey || t.mobileMultiSelect ? E.includes(m) ? o = m : ((t.currentArrow || t.currentSummary) && t.clearSelection(), t.selection?.select(m)) : E.includes(m) || t.selectNode(m), !t.editable) return;
|
|
668
|
+
h.pointerType === "touch" ? (t.ptState = i.DragWait, l.start(h, (M) => {
|
|
669
|
+
ft(t, c, M, !0) && (t.ptState = i.Drag, m.setPointerCapture(M.pointerId));
|
|
670
670
|
})) : ft(t, c, h, !1) && (t.ptState = i.Drag, m.setPointerCapture(h.pointerId));
|
|
671
671
|
} else
|
|
672
672
|
a(m, !1);
|
|
@@ -754,7 +754,7 @@ function Pe() {
|
|
|
754
754
|
}
|
|
755
755
|
};
|
|
756
756
|
}
|
|
757
|
-
const
|
|
757
|
+
const k = "http://www.w3.org/2000/svg", U = function(t) {
|
|
758
758
|
const e = t.clientWidth, n = t.clientHeight, o = t.dataset, s = Number(o.x), i = Number(o.y), r = o.anchor;
|
|
759
759
|
let c = s;
|
|
760
760
|
r === "middle" ? c = s - e / 2 : r === "end" && (c = s - e), t.style.left = `${c}px`, t.style.top = `${i - n / 2}px`, t.style.visibility = "visible";
|
|
@@ -764,7 +764,7 @@ const N = "http://www.w3.org/2000/svg", U = function(t) {
|
|
|
764
764
|
const a = "label-" + c;
|
|
765
765
|
return l.id = a, l.innerHTML = t, l.dataset.type = r, l.dataset.svgId = c, l.dataset.x = e.toString(), l.dataset.y = n.toString(), l.dataset.anchor = s, l;
|
|
766
766
|
}, Dt = function(t, e, n) {
|
|
767
|
-
const o = document.createElementNS(
|
|
767
|
+
const o = document.createElementNS(k, "path");
|
|
768
768
|
return D(o, {
|
|
769
769
|
d: t,
|
|
770
770
|
stroke: e || "#666",
|
|
@@ -772,13 +772,13 @@ const N = "http://www.w3.org/2000/svg", U = function(t) {
|
|
|
772
772
|
"stroke-width": n
|
|
773
773
|
}), o;
|
|
774
774
|
}, W = function(t) {
|
|
775
|
-
const e = document.createElementNS(
|
|
775
|
+
const e = document.createElementNS(k, "svg");
|
|
776
776
|
return e.setAttribute("class", t), e.setAttribute("overflow", "visible"), e;
|
|
777
777
|
}, pt = function() {
|
|
778
|
-
const t = document.createElementNS(
|
|
778
|
+
const t = document.createElementNS(k, "line");
|
|
779
779
|
return t.setAttribute("stroke", "#4dc4ff"), t.setAttribute("fill", "none"), t.setAttribute("stroke-width", "2"), t.setAttribute("opacity", "0.45"), t;
|
|
780
780
|
}, ke = function(t, e, n, o) {
|
|
781
|
-
const s = document.createElementNS(
|
|
781
|
+
const s = document.createElementNS(k, "g");
|
|
782
782
|
return [
|
|
783
783
|
{
|
|
784
784
|
name: "line",
|
|
@@ -793,7 +793,7 @@ const N = "http://www.w3.org/2000/svg", U = function(t) {
|
|
|
793
793
|
d: n
|
|
794
794
|
}
|
|
795
795
|
].forEach((r, c) => {
|
|
796
|
-
const l = r.d, a = document.createElementNS(
|
|
796
|
+
const l = r.d, a = document.createElementNS(k, "path"), f = {
|
|
797
797
|
d: l,
|
|
798
798
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
799
799
|
fill: "none",
|
|
@@ -801,7 +801,7 @@ const N = "http://www.w3.org/2000/svg", U = function(t) {
|
|
|
801
801
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
802
802
|
};
|
|
803
803
|
o?.opacity !== void 0 && (f.opacity = String(o.opacity)), D(a, f), c === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
804
|
-
const d = document.createElementNS(
|
|
804
|
+
const d = document.createElementNS(k, "path");
|
|
805
805
|
D(d, {
|
|
806
806
|
d: l,
|
|
807
807
|
stroke: "transparent",
|
|
@@ -840,7 +840,7 @@ const N = "http://www.w3.org/2000/svg", U = function(t) {
|
|
|
840
840
|
const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, s = e.offsetWidth, i = e.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
841
841
|
this.lines.innerHTML = "";
|
|
842
842
|
for (let c = 0; c < r.length; c++) {
|
|
843
|
-
const l = r[c], a = l.querySelector("me-tpc"), { offsetLeft: f, offsetTop: d } =
|
|
843
|
+
const l = r[c], a = l.querySelector("me-tpc"), { offsetLeft: f, offsetTop: d } = P(this.nodes, a), p = a.offsetWidth, w = a.offsetHeight, y = l.parentNode.className, u = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: d, cL: f, cW: p, cH: w, direction: y, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, b = a.nodeObj.branchColor || g[c % g.length];
|
|
844
844
|
if (a.style.borderColor = b, this.lines.appendChild(Dt(u, b, "3")), t && t !== l)
|
|
845
845
|
continue;
|
|
846
846
|
const v = W("subLines"), C = l.lastChild;
|
|
@@ -869,12 +869,12 @@ const N = "http://www.w3.org/2000/svg", U = function(t) {
|
|
|
869
869
|
living: Oe,
|
|
870
870
|
zoomin: Be,
|
|
871
871
|
zoomout: We
|
|
872
|
-
},
|
|
872
|
+
}, H = (t, e) => {
|
|
873
873
|
const n = document.createElement("span");
|
|
874
874
|
return n.id = t, n.innerHTML = Ye[e], n;
|
|
875
875
|
};
|
|
876
876
|
function Re(t) {
|
|
877
|
-
const e = document.createElement("div"), n =
|
|
877
|
+
const e = document.createElement("div"), n = H("fullscreen", "full"), o = H("toCenter", "living"), s = H("zoomout", "zoomout"), i = H("zoomin", "zoomin");
|
|
878
878
|
e.appendChild(n), e.appendChild(o), e.appendChild(s), e.appendChild(i), e.className = "mind-elixir-toolbar rb";
|
|
879
879
|
let r = null;
|
|
880
880
|
const c = () => {
|
|
@@ -902,7 +902,7 @@ function Re(t) {
|
|
|
902
902
|
}, e;
|
|
903
903
|
}
|
|
904
904
|
function Xe(t) {
|
|
905
|
-
const e = document.createElement("div"), n =
|
|
905
|
+
const e = document.createElement("div"), n = H("tbltl", "left"), o = H("tbltr", "right"), s = H("tblts", "side");
|
|
906
906
|
return e.appendChild(n), e.appendChild(o), e.appendChild(s), e.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
907
907
|
t.initLeft();
|
|
908
908
|
}, o.onclick = () => {
|
|
@@ -919,13 +919,17 @@ const ze = function(t, e = !0) {
|
|
|
919
919
|
const o = {
|
|
920
920
|
...(t.type === "dark" ? et : tt).cssVar,
|
|
921
921
|
...t.cssVar
|
|
922
|
-
}
|
|
922
|
+
};
|
|
923
|
+
this.compact && (o["--node-gap-x"] = "15px", o["--node-gap-y"] = "2px", o["--main-gap-x"] = "30px", o["--main-gap-y"] = "6px");
|
|
924
|
+
const s = Object.keys(o);
|
|
923
925
|
for (let i = 0; i < s.length; i++) {
|
|
924
926
|
const r = s[i];
|
|
925
927
|
this.container.style.setProperty(r, o[r]);
|
|
926
928
|
}
|
|
927
929
|
e && this.refresh();
|
|
928
930
|
}, Fe = function(t) {
|
|
931
|
+
this.compact = t, this.theme && this.changeTheme(this.theme);
|
|
932
|
+
}, Ge = function(t) {
|
|
929
933
|
return {
|
|
930
934
|
dom: t,
|
|
931
935
|
moved: !1,
|
|
@@ -961,7 +965,7 @@ const ze = function(t, e = !0) {
|
|
|
961
965
|
}
|
|
962
966
|
};
|
|
963
967
|
}, gt = {
|
|
964
|
-
create:
|
|
968
|
+
create: Ge
|
|
965
969
|
}, Pt = "#4dc4ff";
|
|
966
970
|
function kt(t, e, n, o, s, i, r, c) {
|
|
967
971
|
return {
|
|
@@ -969,7 +973,7 @@ function kt(t, e, n, o, s, i, r, c) {
|
|
|
969
973
|
y: e / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
970
974
|
};
|
|
971
975
|
}
|
|
972
|
-
function
|
|
976
|
+
function _e(t, e, n) {
|
|
973
977
|
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), U(t));
|
|
974
978
|
}
|
|
975
979
|
function V(t, e, n, o, s) {
|
|
@@ -1007,14 +1011,14 @@ function mt(t, e, n, o, s, i, r, c, l, a) {
|
|
|
1007
1011
|
}
|
|
1008
1012
|
}
|
|
1009
1013
|
const { x: w, y } = kt(e, n, o, s, i, r, c, l);
|
|
1010
|
-
if (t.labelEl &&
|
|
1014
|
+
if (t.labelEl && _e(t.labelEl, w, y), a.style?.labelColor) {
|
|
1011
1015
|
const u = t.labelEl;
|
|
1012
1016
|
u && (u.style.color = a.style.labelColor);
|
|
1013
1017
|
}
|
|
1014
|
-
|
|
1018
|
+
tn(t);
|
|
1015
1019
|
}
|
|
1016
1020
|
function q(t, e, n) {
|
|
1017
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
1021
|
+
const { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, c = o + i / 2, l = s + r / 2, a = c + n.x, f = l + n.y;
|
|
1018
1022
|
return {
|
|
1019
1023
|
w: i,
|
|
1020
1024
|
h: r,
|
|
@@ -1024,7 +1028,7 @@ function q(t, e, n) {
|
|
|
1024
1028
|
ctrlY: f
|
|
1025
1029
|
};
|
|
1026
1030
|
}
|
|
1027
|
-
function
|
|
1031
|
+
function I(t) {
|
|
1028
1032
|
let e, n;
|
|
1029
1033
|
const o = (t.cy - t.ctrlY) / (t.ctrlX - t.cx);
|
|
1030
1034
|
return o > t.h / t.w || o < -t.h / t.w ? t.cy - t.ctrlY < 0 ? (e = t.cx - t.h / 2 / o, n = t.cy + t.h / 2) : (e = t.cx + t.h / 2 / o, n = t.cy - t.h / 2) : t.cx - t.ctrlX < 0 ? (e = t.cx + t.w / 2, n = t.cy - t.w * o / 2) : (e = t.cx - t.w / 2, n = t.cy + t.w * o / 2), {
|
|
@@ -1032,8 +1036,8 @@ function H(t) {
|
|
|
1032
1036
|
y: n
|
|
1033
1037
|
};
|
|
1034
1038
|
}
|
|
1035
|
-
const
|
|
1036
|
-
const o =
|
|
1039
|
+
const qe = function(t, e, n) {
|
|
1040
|
+
const o = P(t.nodes, e), s = P(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, l = s.offsetTop + n.offsetHeight / 2, a = c - i, f = l - r, d = Math.sqrt(a * a + f * f), p = Math.max(50, Math.min(200, d * 0.3)), w = Math.abs(a), y = Math.abs(f);
|
|
1037
1041
|
let u, g;
|
|
1038
1042
|
if (d < 150) {
|
|
1039
1043
|
const v = e.closest("me-main").className === "lhs" ? -1 : 1;
|
|
@@ -1045,8 +1049,8 @@ const _e = function(t, e, n) {
|
|
|
1045
1049
|
const v = f > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2, C = f > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
1046
1050
|
u = { x: 0, y: v + (f > 0 ? p : -p) }, g = { x: 0, y: C + (f > 0 ? -p : p) };
|
|
1047
1051
|
} else {
|
|
1048
|
-
const v = Math.atan2(f, a), C = e.offsetWidth / 2 * Math.cos(v), T = e.offsetHeight / 2 * Math.sin(v), h = -(n.offsetWidth / 2) * Math.cos(v), m = -(n.offsetHeight / 2) * Math.sin(v), x = p * 0.7 * (a > 0 ? 1 : -1),
|
|
1049
|
-
u = { x: C + x, y: T +
|
|
1052
|
+
const v = Math.atan2(f, a), C = e.offsetWidth / 2 * Math.cos(v), T = e.offsetHeight / 2 * Math.sin(v), h = -(n.offsetWidth / 2) * Math.cos(v), m = -(n.offsetHeight / 2) * Math.sin(v), x = p * 0.7 * (a > 0 ? 1 : -1), E = p * 0.7 * (f > 0 ? 1 : -1);
|
|
1053
|
+
u = { x: C + x, y: T + E }, g = { x: h - x, y: m - E };
|
|
1050
1054
|
}
|
|
1051
1055
|
return {
|
|
1052
1056
|
delta1: { x: Math.round(u.x), y: Math.round(u.y) },
|
|
@@ -1056,28 +1060,28 @@ const _e = function(t, e, n) {
|
|
|
1056
1060
|
if (!e || !n)
|
|
1057
1061
|
return;
|
|
1058
1062
|
if (!o.delta1 || !o.delta2) {
|
|
1059
|
-
const
|
|
1060
|
-
o.delta1 =
|
|
1063
|
+
const S = qe(t, e, n);
|
|
1064
|
+
o.delta1 = S.delta1, o.delta2 = S.delta2;
|
|
1061
1065
|
}
|
|
1062
|
-
const i = q(t, e, o.delta1), r = q(t, n, o.delta2), { x: c, y: l } =
|
|
1066
|
+
const i = q(t, e, o.delta1), r = q(t, n, o.delta2), { x: c, y: l } = I(i), { ctrlX: a, ctrlY: f } = i, { ctrlX: d, ctrlY: p } = r, { x: w, y } = I(r), u = _(d, p, w, y);
|
|
1063
1067
|
if (!u) return;
|
|
1064
1068
|
const g = `M ${u.x1} ${u.y1} L ${w} ${y} L ${u.x2} ${u.y2}`;
|
|
1065
1069
|
let b = "";
|
|
1066
1070
|
if (o.bidirectional) {
|
|
1067
|
-
const
|
|
1068
|
-
if (!
|
|
1069
|
-
b = `M ${
|
|
1071
|
+
const S = _(a, f, c, l);
|
|
1072
|
+
if (!S) return;
|
|
1073
|
+
b = `M ${S.x1} ${S.y1} L ${c} ${l} L ${S.x2} ${S.y2}`;
|
|
1070
1074
|
}
|
|
1071
1075
|
const v = ke(`M ${c} ${l} C ${a} ${f} ${d} ${p} ${w} ${y}`, g, b, o.style), { x: C, y: T } = kt(c, l, a, f, d, p, w, y), h = o.style?.labelColor || "rgb(235, 95, 82)", m = "a-" + o.id;
|
|
1072
1076
|
v.id = m;
|
|
1073
|
-
const x = t.markdown ? t.markdown(o.label, o) : o.label,
|
|
1077
|
+
const x = t.markdown ? t.markdown(o.label, o) : o.label, E = Q(x, C, T, {
|
|
1074
1078
|
anchor: "middle",
|
|
1075
1079
|
color: h,
|
|
1076
1080
|
dataType: "arrow",
|
|
1077
1081
|
svgId: m
|
|
1078
1082
|
});
|
|
1079
|
-
v.labelEl =
|
|
1080
|
-
},
|
|
1083
|
+
v.labelEl = E, v.arrowObj = o, v.dataset.linkid = o.id, t.labelContainer.appendChild(E), t.arrowSvg.appendChild(v), U(E), s || (t.arrows.push(o), t.currentArrow = v, At(t, o, i, r));
|
|
1084
|
+
}, je = function(t, e, n = {}) {
|
|
1081
1085
|
const o = {
|
|
1082
1086
|
id: Y(),
|
|
1083
1087
|
label: "Custom Link",
|
|
@@ -1089,14 +1093,14 @@ const _e = function(t, e, n) {
|
|
|
1089
1093
|
name: "createArrow",
|
|
1090
1094
|
obj: o
|
|
1091
1095
|
});
|
|
1092
|
-
},
|
|
1096
|
+
}, Ue = function(t) {
|
|
1093
1097
|
K(this);
|
|
1094
1098
|
const e = { ...t, id: Y() };
|
|
1095
1099
|
it(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
|
|
1096
1100
|
name: "createArrow",
|
|
1097
1101
|
obj: e
|
|
1098
1102
|
});
|
|
1099
|
-
},
|
|
1103
|
+
}, Ke = function(t) {
|
|
1100
1104
|
let e;
|
|
1101
1105
|
if (t ? e = t : e = this.currentArrow, !e) return;
|
|
1102
1106
|
K(this);
|
|
@@ -1107,14 +1111,14 @@ const _e = function(t, e, n) {
|
|
|
1107
1111
|
id: n
|
|
1108
1112
|
}
|
|
1109
1113
|
});
|
|
1110
|
-
},
|
|
1114
|
+
}, Je = function(t) {
|
|
1111
1115
|
this.currentArrow = t;
|
|
1112
1116
|
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = q(this, n, e.delta1), i = q(this, o, e.delta2);
|
|
1113
1117
|
this.editable ? At(this, e, s, i) : Nt(t, Pt), this.bus.fire("selectArrow", e);
|
|
1114
|
-
},
|
|
1118
|
+
}, Ze = function() {
|
|
1115
1119
|
K(this), this.currentArrow = null, this.bus.fire("unselectArrow");
|
|
1116
1120
|
}, Z = function(t, e) {
|
|
1117
|
-
const n = document.createElementNS(
|
|
1121
|
+
const n = document.createElementNS(k, "path");
|
|
1118
1122
|
return D(n, {
|
|
1119
1123
|
d: t,
|
|
1120
1124
|
stroke: e,
|
|
@@ -1124,7 +1128,7 @@ const _e = function(t, e, n) {
|
|
|
1124
1128
|
"stroke-linejoin": "round"
|
|
1125
1129
|
}), n;
|
|
1126
1130
|
}, Nt = function(t, e) {
|
|
1127
|
-
const n = document.createElementNS(
|
|
1131
|
+
const n = document.createElementNS(k, "g");
|
|
1128
1132
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
1129
1133
|
const o = Z(t.line.getAttribute("d"), e);
|
|
1130
1134
|
n.appendChild(o);
|
|
@@ -1134,32 +1138,32 @@ const _e = function(t, e, n) {
|
|
|
1134
1138
|
n.appendChild(i);
|
|
1135
1139
|
}
|
|
1136
1140
|
t.insertBefore(n, t.firstChild);
|
|
1137
|
-
},
|
|
1141
|
+
}, Qe = function(t) {
|
|
1138
1142
|
const e = t.querySelector(".arrow-highlight");
|
|
1139
1143
|
e && e.remove();
|
|
1140
|
-
},
|
|
1144
|
+
}, tn = function(t) {
|
|
1141
1145
|
const e = t.querySelector(".arrow-highlight");
|
|
1142
1146
|
if (!e) return;
|
|
1143
1147
|
const n = e.querySelectorAll("path");
|
|
1144
1148
|
n.length >= 1 && n[0].setAttribute("d", t.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", t.arrow1.getAttribute("d")), n.length >= 3 && t.arrow2.getAttribute("d") && n[2].setAttribute("d", t.arrow2.getAttribute("d"));
|
|
1145
1149
|
}, K = function(t) {
|
|
1146
|
-
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow &&
|
|
1150
|
+
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && Qe(t.currentArrow);
|
|
1147
1151
|
}, At = function(t, e, n, o) {
|
|
1148
1152
|
const { linkController: s, P2: i, P3: r, line1: c, line2: l, nodes: a, map: f, currentArrow: d, bus: p } = t;
|
|
1149
1153
|
if (!d) return;
|
|
1150
1154
|
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(r), Nt(d, Pt);
|
|
1151
|
-
let { x: w, y } =
|
|
1155
|
+
let { x: w, y } = I(n), { ctrlX: u, ctrlY: g } = n, { ctrlX: b, ctrlY: v } = o, { x: C, y: T } = I(o);
|
|
1152
1156
|
i.style.cssText = `top:${g}px;left:${u}px;`, r.style.cssText = `top:${v}px;left:${b}px;`, V(c, w, y, u, g), V(l, b, v, C, T), t.helper1 = gt.create(i), t.helper2 = gt.create(r), t.helper1.init(f, (h, m) => {
|
|
1153
1157
|
u = u + h / t.scaleVal, g = g + m / t.scaleVal;
|
|
1154
|
-
const x =
|
|
1158
|
+
const x = I({ ...n, ctrlX: u, ctrlY: g });
|
|
1155
1159
|
w = x.x, y = x.y, i.style.top = g + "px", i.style.left = u + "px", mt(d, w, y, u, g, b, v, C, T, e), V(c, w, y, u, g), e.delta1.x = Math.round(u - n.cx), e.delta1.y = Math.round(g - n.cy), p.fire("updateArrowDelta", e);
|
|
1156
1160
|
}), t.helper2.init(f, (h, m) => {
|
|
1157
1161
|
b = b + h / t.scaleVal, v = v + m / t.scaleVal;
|
|
1158
|
-
const x =
|
|
1162
|
+
const x = I({ ...o, ctrlX: b, ctrlY: v });
|
|
1159
1163
|
C = x.x, T = x.y, r.style.top = v + "px", r.style.left = b + "px", mt(d, w, y, u, g, b, v, C, T, e), V(l, b, v, C, T), e.delta2.x = Math.round(b - o.cx), e.delta2.y = Math.round(v - o.cy), p.fire("updateArrowDelta", e);
|
|
1160
1164
|
});
|
|
1161
1165
|
};
|
|
1162
|
-
function
|
|
1166
|
+
function en() {
|
|
1163
1167
|
this.arrowSvg.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((e) => e.remove());
|
|
1164
1168
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
1165
1169
|
const n = this.arrows[e];
|
|
@@ -1170,23 +1174,23 @@ function tn() {
|
|
|
1170
1174
|
}
|
|
1171
1175
|
this.nodes.appendChild(this.arrowSvg);
|
|
1172
1176
|
}
|
|
1173
|
-
function
|
|
1177
|
+
function nn(t) {
|
|
1174
1178
|
K(this), t && t.labelEl && Lt(this, t.labelEl, t.arrowObj);
|
|
1175
1179
|
}
|
|
1176
|
-
function
|
|
1180
|
+
function on() {
|
|
1177
1181
|
this.arrows = this.arrows.filter((t) => G(t.from, this.nodeData) && G(t.to, this.nodeData));
|
|
1178
1182
|
}
|
|
1179
|
-
const
|
|
1183
|
+
const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1180
1184
|
__proto__: null,
|
|
1181
|
-
createArrow:
|
|
1182
|
-
createArrowFrom:
|
|
1183
|
-
editArrowLabel:
|
|
1184
|
-
removeArrow:
|
|
1185
|
-
renderArrow:
|
|
1186
|
-
selectArrow:
|
|
1187
|
-
tidyArrow:
|
|
1188
|
-
unselectArrow:
|
|
1189
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1185
|
+
createArrow: je,
|
|
1186
|
+
createArrowFrom: Ue,
|
|
1187
|
+
editArrowLabel: nn,
|
|
1188
|
+
removeArrow: Ke,
|
|
1189
|
+
renderArrow: en,
|
|
1190
|
+
selectArrow: Je,
|
|
1191
|
+
tidyArrow: on,
|
|
1192
|
+
unselectArrow: Ze
|
|
1193
|
+
}, Symbol.toStringTag, { value: "Module" })), rn = function(t) {
|
|
1190
1194
|
if (t.length === 0) throw new Error("No selected node.");
|
|
1191
1195
|
if (t.length === 1) {
|
|
1192
1196
|
const l = t[0].nodeObj, a = t[0].nodeObj.parent;
|
|
@@ -1223,11 +1227,11 @@ const on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1223
1227
|
start: i,
|
|
1224
1228
|
end: r
|
|
1225
1229
|
};
|
|
1226
|
-
},
|
|
1227
|
-
const e = document.createElementNS(
|
|
1230
|
+
}, cn = function(t) {
|
|
1231
|
+
const e = document.createElementNS(k, "g");
|
|
1228
1232
|
return e.setAttribute("id", t), e;
|
|
1229
1233
|
}, yt = function(t, e) {
|
|
1230
|
-
const n = document.createElementNS(
|
|
1234
|
+
const n = document.createElementNS(k, "path");
|
|
1231
1235
|
return D(n, {
|
|
1232
1236
|
d: t,
|
|
1233
1237
|
stroke: e || "#666",
|
|
@@ -1235,69 +1239,69 @@ const on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1235
1239
|
"stroke-linecap": "round",
|
|
1236
1240
|
"stroke-width": "2"
|
|
1237
1241
|
}), n;
|
|
1238
|
-
},
|
|
1242
|
+
}, ln = (t) => t.parentElement.parentElement, an = function(t, { parent: e, start: n }) {
|
|
1239
1243
|
const o = t.findEle(e), s = o.nodeObj;
|
|
1240
1244
|
let i;
|
|
1241
1245
|
return s.parent ? i = o.closest("me-main").className : i = t.findEle(s.children[n].id).closest("me-main").className, i;
|
|
1242
1246
|
}, rt = function(t, e) {
|
|
1243
|
-
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: l, theme: a, summarySvg: f } = t, p = t.findEle(s).nodeObj, w =
|
|
1247
|
+
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: l, theme: a, summarySvg: f } = t, p = t.findEle(s).nodeObj, w = an(t, e);
|
|
1244
1248
|
let y = 1 / 0, u = 0, g = 0, b = 0;
|
|
1245
1249
|
for (let B = i; B <= r; B++) {
|
|
1246
1250
|
const ct = p.children?.[B];
|
|
1247
1251
|
if (!ct)
|
|
1248
1252
|
return t.removeSummary(n), null;
|
|
1249
|
-
const R =
|
|
1253
|
+
const R = ln(t.findEle(ct.id)), { offsetLeft: X, offsetTop: lt } = P(l, R), at = i === r ? 10 : 20;
|
|
1250
1254
|
B === i && (g = lt + at), B === r && (b = lt + R.offsetHeight - at), X < y && (y = X), R.offsetWidth + X > u && (u = R.offsetWidth + X);
|
|
1251
1255
|
}
|
|
1252
1256
|
let v, C;
|
|
1253
|
-
const T = p.parent ? 10 : 0, h = g + T, m = b + T, x = (h + m) / 2,
|
|
1254
|
-
w ===
|
|
1255
|
-
const
|
|
1256
|
-
return
|
|
1257
|
-
},
|
|
1257
|
+
const T = p.parent ? 10 : 0, h = g + T, m = b + T, x = (h + m) / 2, E = c?.stroke || a.cssVar["--color"], S = c?.labelColor || a.cssVar["--color"], M = "s-" + n, N = t.markdown ? t.markdown(o, e) : o;
|
|
1258
|
+
w === O.LHS ? (v = yt(`M ${y + 10} ${h} c -5 0 -10 5 -10 10 L ${y} ${m - 10} c 0 5 5 10 10 10 M ${y} ${x} h -10`, E), C = Q(N, y - 20, x, { anchor: "end", color: S, dataType: "summary", svgId: M })) : (v = yt(`M ${u - 10} ${h} c 5 0 10 5 10 10 L ${u} ${m - 10} c 0 5 -5 10 -10 10 M ${u} ${x} h 10`, E), C = Q(N, u + 20, x, { anchor: "start", color: S, dataType: "summary", svgId: M }));
|
|
1259
|
+
const $ = cn(M);
|
|
1260
|
+
return $.appendChild(v), t.labelContainer.appendChild(C), U(C), $.summaryObj = e, $.labelEl = C, f.appendChild($), $;
|
|
1261
|
+
}, hn = function(t = {}) {
|
|
1258
1262
|
if (!this.currentNodes) return;
|
|
1259
|
-
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } =
|
|
1263
|
+
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = rn(e), c = { id: Y(), parent: s, start: i, end: r, label: "summary", style: t.style }, l = rt(this, c);
|
|
1260
1264
|
n.push(c), this.editSummary(l), o.fire("operation", {
|
|
1261
1265
|
name: "createSummary",
|
|
1262
1266
|
obj: c
|
|
1263
1267
|
});
|
|
1264
|
-
},
|
|
1268
|
+
}, dn = function(t) {
|
|
1265
1269
|
const e = Y(), n = { ...t, id: e };
|
|
1266
1270
|
rt(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
1267
1271
|
name: "createSummary",
|
|
1268
1272
|
obj: n
|
|
1269
1273
|
});
|
|
1270
|
-
},
|
|
1274
|
+
}, fn = function(t) {
|
|
1271
1275
|
const e = this.summaries.findIndex((n) => n.id === t);
|
|
1272
1276
|
e > -1 && (this.summaries.splice(e, 1), this.nodes.querySelector("#s-" + t)?.remove(), this.nodes.querySelector("#label-s-" + t)?.remove()), this.bus.fire("operation", {
|
|
1273
1277
|
name: "removeSummary",
|
|
1274
1278
|
obj: { id: t }
|
|
1275
1279
|
});
|
|
1276
|
-
},
|
|
1280
|
+
}, un = function(t) {
|
|
1277
1281
|
const e = t.labelEl;
|
|
1278
1282
|
e && e.classList.add("selected"), this.currentSummary = t, this.bus.fire("selectSummary", t.summaryObj);
|
|
1279
|
-
}, un = function() {
|
|
1280
|
-
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
1281
1283
|
}, pn = function() {
|
|
1284
|
+
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
1285
|
+
}, gn = function() {
|
|
1282
1286
|
this.summarySvg.innerHTML = "", this.summaries.forEach((t) => {
|
|
1283
1287
|
try {
|
|
1284
1288
|
rt(this, t);
|
|
1285
1289
|
} catch {
|
|
1286
1290
|
}
|
|
1287
1291
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
1288
|
-
},
|
|
1292
|
+
}, mn = function(t) {
|
|
1289
1293
|
t && t.labelEl && Lt(this, t.labelEl, t.summaryObj);
|
|
1290
|
-
},
|
|
1294
|
+
}, yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1291
1295
|
__proto__: null,
|
|
1292
|
-
createSummary:
|
|
1293
|
-
createSummaryFrom:
|
|
1294
|
-
editSummary:
|
|
1295
|
-
removeSummary:
|
|
1296
|
-
renderSummary:
|
|
1297
|
-
selectSummary:
|
|
1298
|
-
unselectSummary:
|
|
1296
|
+
createSummary: hn,
|
|
1297
|
+
createSummaryFrom: dn,
|
|
1298
|
+
editSummary: mn,
|
|
1299
|
+
removeSummary: fn,
|
|
1300
|
+
renderSummary: gn,
|
|
1301
|
+
selectSummary: un,
|
|
1302
|
+
unselectSummary: pn
|
|
1299
1303
|
}, Symbol.toStringTag, { value: "Module" })), L = "http://www.w3.org/2000/svg";
|
|
1300
|
-
function
|
|
1304
|
+
function wn(t, e) {
|
|
1301
1305
|
const n = document.createElementNS(L, "svg");
|
|
1302
1306
|
return D(n, {
|
|
1303
1307
|
version: "1.1",
|
|
@@ -1306,10 +1310,10 @@ function yn(t, e) {
|
|
|
1306
1310
|
width: e
|
|
1307
1311
|
}), n;
|
|
1308
1312
|
}
|
|
1309
|
-
function
|
|
1313
|
+
function vn(t, e) {
|
|
1310
1314
|
return (parseInt(t) - parseInt(e)) / 2;
|
|
1311
1315
|
}
|
|
1312
|
-
function
|
|
1316
|
+
function bn(t, e, n, o) {
|
|
1313
1317
|
const s = document.createElementNS(L, "g");
|
|
1314
1318
|
let i = "";
|
|
1315
1319
|
return t.text ? i = t.text.textContent : i = t.childNodes[0].textContent, i.split(`
|
|
@@ -1317,7 +1321,7 @@ function vn(t, e, n, o) {
|
|
|
1317
1321
|
const a = document.createElementNS(L, "text");
|
|
1318
1322
|
D(a, {
|
|
1319
1323
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1320
|
-
y: o + parseInt(e.paddingTop) +
|
|
1324
|
+
y: o + parseInt(e.paddingTop) + vn(e.lineHeight, e.fontSize) * (l + 1) + parseFloat(e.fontSize) * (l + 1) + "",
|
|
1321
1325
|
"text-anchor": "start",
|
|
1322
1326
|
"font-family": e.fontFamily,
|
|
1323
1327
|
"font-size": `${e.fontSize}`,
|
|
@@ -1326,7 +1330,7 @@ function vn(t, e, n, o) {
|
|
|
1326
1330
|
}), a.innerHTML = c, s.appendChild(a);
|
|
1327
1331
|
}), s;
|
|
1328
1332
|
}
|
|
1329
|
-
function
|
|
1333
|
+
function xn(t, e, n, o) {
|
|
1330
1334
|
let s = "";
|
|
1331
1335
|
t.nodeObj?.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
|
|
1332
1336
|
const i = document.createElementNS(L, "foreignObject");
|
|
@@ -1342,8 +1346,8 @@ function bn(t, e, n, o) {
|
|
|
1342
1346
|
style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
|
|
1343
1347
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
1344
1348
|
}
|
|
1345
|
-
function
|
|
1346
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1349
|
+
function Cn(t, e) {
|
|
1350
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = document.createElementNS(L, "rect");
|
|
1347
1351
|
return D(i, {
|
|
1348
1352
|
x: o + "",
|
|
1349
1353
|
y: s + "",
|
|
@@ -1357,7 +1361,7 @@ function xn(t, e) {
|
|
|
1357
1361
|
}), i;
|
|
1358
1362
|
}
|
|
1359
1363
|
function z(t, e, n = !1) {
|
|
1360
|
-
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } =
|
|
1364
|
+
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = P(t.nodes, e), r = document.createElementNS(L, "rect");
|
|
1361
1365
|
D(r, {
|
|
1362
1366
|
x: s + "",
|
|
1363
1367
|
y: i + "",
|
|
@@ -1372,10 +1376,10 @@ function z(t, e, n = !1) {
|
|
|
1372
1376
|
const c = document.createElementNS(L, "g");
|
|
1373
1377
|
c.appendChild(r);
|
|
1374
1378
|
let l;
|
|
1375
|
-
return n ? l =
|
|
1379
|
+
return n ? l = xn(e, o, s, i) : l = bn(e, o, s, i), c.appendChild(l), c;
|
|
1376
1380
|
}
|
|
1377
|
-
function
|
|
1378
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1381
|
+
function Sn(t, e) {
|
|
1382
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = document.createElementNS(L, "a"), r = document.createElementNS(L, "text");
|
|
1379
1383
|
return D(r, {
|
|
1380
1384
|
x: o + "",
|
|
1381
1385
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -1386,8 +1390,8 @@ function Cn(t, e) {
|
|
|
1386
1390
|
fill: `${n.color}`
|
|
1387
1391
|
}), r.innerHTML = e.textContent, i.appendChild(r), i.setAttribute("href", e.href), i;
|
|
1388
1392
|
}
|
|
1389
|
-
function
|
|
1390
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1393
|
+
function En(t, e) {
|
|
1394
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = P(t.nodes, e), i = document.createElementNS(L, "image");
|
|
1391
1395
|
return D(i, {
|
|
1392
1396
|
x: o + "",
|
|
1393
1397
|
y: s + "",
|
|
@@ -1396,8 +1400,8 @@ function Sn(t, e) {
|
|
|
1396
1400
|
href: e.src
|
|
1397
1401
|
}), i;
|
|
1398
1402
|
}
|
|
1399
|
-
const F = 100,
|
|
1400
|
-
const n = t.nodes, o = n.offsetHeight + F * 2, s = n.offsetWidth + F * 2, i =
|
|
1403
|
+
const F = 100, Tn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">', Dn = (t, e = !1) => {
|
|
1404
|
+
const n = t.nodes, o = n.offsetHeight + F * 2, s = n.offsetWidth + F * 2, i = wn(o + "px", s + "px"), r = document.createElementNS(L, "svg"), c = document.createElementNS(L, "rect");
|
|
1401
1405
|
D(c, {
|
|
1402
1406
|
x: "0",
|
|
1403
1407
|
y: "0",
|
|
@@ -1405,7 +1409,7 @@ const F = 100, En = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1405
1409
|
height: `${o}`,
|
|
1406
1410
|
fill: t.theme.cssVar["--bgcolor"]
|
|
1407
1411
|
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((d) => {
|
|
1408
|
-
const p = d.cloneNode(!0), { offsetLeft: w, offsetTop: y } =
|
|
1412
|
+
const p = d.cloneNode(!0), { offsetLeft: w, offsetTop: y } = P(n, d.parentElement);
|
|
1409
1413
|
p.setAttribute("x", `${w}`), p.setAttribute("y", `${y}`), r.appendChild(p);
|
|
1410
1414
|
});
|
|
1411
1415
|
const l = n.querySelector(".lines")?.cloneNode(!0);
|
|
@@ -1414,22 +1418,22 @@ const F = 100, En = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1414
1418
|
a && r.appendChild(a);
|
|
1415
1419
|
const f = n.querySelector(".summary")?.cloneNode(!0);
|
|
1416
1420
|
return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((d) => {
|
|
1417
|
-
d.nodeObj.dangerouslySetInnerHTML ? r.appendChild(z(t, d, !e)) : (r.appendChild(
|
|
1421
|
+
d.nodeObj.dangerouslySetInnerHTML ? r.appendChild(z(t, d, !e)) : (r.appendChild(Cn(t, d)), r.appendChild(z(t, d.text, !e)));
|
|
1418
1422
|
}), n.querySelectorAll(".tags > span").forEach((d) => {
|
|
1419
1423
|
r.appendChild(z(t, d));
|
|
1420
1424
|
}), n.querySelectorAll(".icons > span").forEach((d) => {
|
|
1421
1425
|
r.appendChild(z(t, d));
|
|
1422
1426
|
}), n.querySelectorAll(".hyper-link").forEach((d) => {
|
|
1423
|
-
r.appendChild(Cn(t, d));
|
|
1424
|
-
}), n.querySelectorAll("img").forEach((d) => {
|
|
1425
1427
|
r.appendChild(Sn(t, d));
|
|
1428
|
+
}), n.querySelectorAll("img").forEach((d) => {
|
|
1429
|
+
r.appendChild(En(t, d));
|
|
1426
1430
|
}), D(r, {
|
|
1427
1431
|
x: F + "",
|
|
1428
1432
|
y: F + "",
|
|
1429
1433
|
overflow: "visible"
|
|
1430
1434
|
}), i.appendChild(r), i;
|
|
1431
|
-
},
|
|
1432
|
-
function
|
|
1435
|
+
}, Ln = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), Tn + t.outerHTML);
|
|
1436
|
+
function Mn(t) {
|
|
1433
1437
|
return new Promise((e, n) => {
|
|
1434
1438
|
const o = new FileReader();
|
|
1435
1439
|
o.onload = (s) => {
|
|
@@ -1439,11 +1443,11 @@ function Ln(t) {
|
|
|
1439
1443
|
}, o.readAsDataURL(t);
|
|
1440
1444
|
});
|
|
1441
1445
|
}
|
|
1442
|
-
const
|
|
1443
|
-
const n =
|
|
1446
|
+
const Pn = function(t = !1, e) {
|
|
1447
|
+
const n = Dn(this, t), o = Ln(n, e);
|
|
1444
1448
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1445
|
-
},
|
|
1446
|
-
const n = this.exportSvg(t, e), o = await
|
|
1449
|
+
}, kn = async function(t = !1, e) {
|
|
1450
|
+
const n = this.exportSvg(t, e), o = await Mn(n);
|
|
1447
1451
|
return new Promise((s, i) => {
|
|
1448
1452
|
const r = new Image();
|
|
1449
1453
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
@@ -1451,11 +1455,11 @@ const Mn = function(t = !1, e) {
|
|
|
1451
1455
|
c.width = r.width, c.height = r.height, c.getContext("2d").drawImage(r, 0, 0), c.toBlob(s, "image/png", 1);
|
|
1452
1456
|
}, r.src = o, r.onerror = i;
|
|
1453
1457
|
});
|
|
1454
|
-
},
|
|
1458
|
+
}, Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1455
1459
|
__proto__: null,
|
|
1456
|
-
exportPng:
|
|
1457
|
-
exportSvg:
|
|
1458
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1460
|
+
exportPng: kn,
|
|
1461
|
+
exportSvg: Pn
|
|
1462
|
+
}, Symbol.toStringTag, { value: "Module" })), An = {}, $n = {
|
|
1459
1463
|
getObjById: G,
|
|
1460
1464
|
generateNewObj: Ht,
|
|
1461
1465
|
layout: Vt,
|
|
@@ -1467,11 +1471,12 @@ const Mn = function(t = !1, e) {
|
|
|
1467
1471
|
createTopic: jt,
|
|
1468
1472
|
findEle: Ct,
|
|
1469
1473
|
changeTheme: ze,
|
|
1474
|
+
changeCompact: Fe,
|
|
1470
1475
|
...xe,
|
|
1476
|
+
...An,
|
|
1477
|
+
...sn,
|
|
1478
|
+
...yn,
|
|
1471
1479
|
...Nn,
|
|
1472
|
-
...on,
|
|
1473
|
-
...mn,
|
|
1474
|
-
...kn,
|
|
1475
1480
|
init(t) {
|
|
1476
1481
|
if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData) return new Error("MindElixir: `data` is required");
|
|
1477
1482
|
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, nt(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && Ve(this), this.layout(), this.linkDiv(), this.toCenter();
|
|
@@ -1487,25 +1492,25 @@ const Mn = function(t = !1, e) {
|
|
|
1487
1492
|
this.mobileMultiSelect = t;
|
|
1488
1493
|
}
|
|
1489
1494
|
};
|
|
1490
|
-
function
|
|
1495
|
+
function Hn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, containerHeight: a }) {
|
|
1491
1496
|
let f = e + n / 2;
|
|
1492
1497
|
const d = t + o / 2;
|
|
1493
1498
|
let p;
|
|
1494
|
-
l ===
|
|
1499
|
+
l === O.LHS ? p = i + r : p = i;
|
|
1495
1500
|
const w = s + c / 2, u = (1 - Math.abs(w - d) / a) * 0.25 * (n / 2);
|
|
1496
|
-
return l ===
|
|
1501
|
+
return l === O.LHS ? f = f - n / 10 - u : f = f + n / 10 + u, `M ${f} ${d} Q ${f} ${w} ${p} ${w}`;
|
|
1497
1502
|
}
|
|
1498
|
-
function
|
|
1503
|
+
function In({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, isFirst: a }) {
|
|
1499
1504
|
const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
1500
1505
|
let d = 0, p = 0;
|
|
1501
1506
|
a ? d = t + o / 2 : d = t + o;
|
|
1502
1507
|
const w = s + c;
|
|
1503
1508
|
let y = 0, u = 0, g = 0;
|
|
1504
1509
|
const b = Math.abs(d - w) / 300 * f;
|
|
1505
|
-
return l ===
|
|
1510
|
+
return l === O.LHS ? (g = e, y = g + f, u = g - f, p = i + f, `M ${y} ${d} C ${g} ${d} ${g + b} ${w} ${u} ${w} H ${p}`) : (g = e + n, y = g - f, u = g + f, p = i + r - f, `M ${y} ${d} C ${g} ${d} ${g - b} ${w} ${u} ${w} H ${p}`);
|
|
1506
1511
|
}
|
|
1507
|
-
const
|
|
1508
|
-
function
|
|
1512
|
+
const On = "5.12.0";
|
|
1513
|
+
function Bn(t) {
|
|
1509
1514
|
return {
|
|
1510
1515
|
x: 0,
|
|
1511
1516
|
y: 0,
|
|
@@ -1547,27 +1552,28 @@ function A({
|
|
|
1547
1552
|
generateMainBranch: d,
|
|
1548
1553
|
generateSubBranch: p,
|
|
1549
1554
|
overflowHidden: w,
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1555
|
+
compact: y,
|
|
1556
|
+
theme: u,
|
|
1557
|
+
alignment: g,
|
|
1558
|
+
scaleSensitivity: b,
|
|
1559
|
+
scaleMax: v,
|
|
1560
|
+
scaleMin: C,
|
|
1561
|
+
handleWheel: T,
|
|
1562
|
+
markdown: h,
|
|
1563
|
+
imageProxy: m,
|
|
1564
|
+
pasteHandler: x,
|
|
1565
|
+
mobileMultiSelect: E
|
|
1560
1566
|
}) {
|
|
1561
1567
|
let S = null;
|
|
1562
|
-
const
|
|
1563
|
-
if (
|
|
1564
|
-
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = l || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = r ?? 0, this.direction = e ?? 1, this.editable = n ?? !0, this.allowUndo = f ?? !0, this.scaleSensitivity =
|
|
1565
|
-
const
|
|
1566
|
-
this.theme =
|
|
1567
|
-
const
|
|
1568
|
-
|
|
1568
|
+
const M = Object.prototype.toString.call(t);
|
|
1569
|
+
if (M === "[object HTMLDivElement]" ? S = t : M === "[object String]" && (S = document.querySelector(t)), !S) throw new Error("MindElixir: el is not a valid element");
|
|
1570
|
+
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = l || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = r ?? 0, this.direction = e ?? 1, this.editable = n ?? !0, this.allowUndo = f ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = v ?? 1.4, this.scaleMin = C ?? 0.2, this.generateMainBranch = d || Hn, this.generateSubBranch = p || In, this.overflowHidden = w ?? !1, this.compact = y ?? !1, this.alignment = g ?? "root", this.handleWheel = T ?? !0, this.markdown = h || void 0, this.imageProxy = m || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.mobileMultiSelect = E ?? !1, this.panHelper = Bn(this), this.bus = Pe(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
1571
|
+
const N = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1572
|
+
this.theme = u || (N.matches ? et : tt);
|
|
1573
|
+
const $ = document.createElement("div");
|
|
1574
|
+
$.className = "map-canvas", this.map = $, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = W("lines"), this.summarySvg = W("summary"), this.linkController = W("linkcontroller"), this.P2 = document.createElement("div"), this.P3 = document.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = pt(), this.line2 = pt(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.arrowSvg = W("topiclinks"), this.labelContainer = document.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Me(this)), x && (this.pasteHandler = x);
|
|
1569
1575
|
}
|
|
1570
|
-
A.prototype =
|
|
1576
|
+
A.prototype = $n;
|
|
1571
1577
|
Object.defineProperty(A.prototype, "currentNode", {
|
|
1572
1578
|
get() {
|
|
1573
1579
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
@@ -1579,13 +1585,13 @@ A.RIGHT = 1;
|
|
|
1579
1585
|
A.SIDE = 2;
|
|
1580
1586
|
A.THEME = tt;
|
|
1581
1587
|
A.DARK_THEME = et;
|
|
1582
|
-
A.version =
|
|
1588
|
+
A.version = On;
|
|
1583
1589
|
A.E = Ct;
|
|
1584
1590
|
export {
|
|
1585
1591
|
et as DARK_THEME,
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1592
|
+
Wn as LEFT,
|
|
1593
|
+
Yn as RIGHT,
|
|
1594
|
+
Rn as SIDE,
|
|
1589
1595
|
tt as THEME,
|
|
1590
1596
|
A as default
|
|
1591
1597
|
};
|