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