mind-elixir 4.3.1 → 4.3.3
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 +5 -5
- package/dist/MindElixir.js +130 -126
- package/dist/MindElixirLite.iife.js +1 -1
- package/dist/MindElixirLite.js +3 -3
- package/dist/types/types/index.d.ts +3 -1
- package/package.json +1 -1
package/dist/MindElixir.js
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
i || (i = !0, o());
|
|
15
15
|
}
|
|
16
16
|
t = function() {
|
|
17
|
-
var d, a,
|
|
18
|
-
(g = document.createElement("div")).innerHTML = c, c = null, (
|
|
17
|
+
var d, a, f, g;
|
|
18
|
+
(g = document.createElement("div")).innerHTML = c, c = null, (f = g.getElementsByTagName("svg")[0]) && (f.setAttribute("aria-hidden", "true"), f.style.position = "absolute", f.style.width = 0, f.style.height = 0, f.style.overflow = "hidden", d = f, (a = document.body).firstChild ? (g = d, (f = a.firstChild).parentNode.insertBefore(g, f)) : a.appendChild(d));
|
|
19
19
|
}, document.addEventListener ? ~["complete", "loaded", "interactive"].indexOf(document.readyState) ? setTimeout(t, 0) : (n = function() {
|
|
20
20
|
document.removeEventListener("DOMContentLoaded", n, !1), t();
|
|
21
21
|
}, document.addEventListener("DOMContentLoaded", n, !1)) : document.attachEvent && (o = t, s = e.document, i = !1, (r = function() {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
s.readyState == "complete" && (s.onreadystatechange = null, u());
|
|
30
30
|
});
|
|
31
31
|
})(window);
|
|
32
|
-
const
|
|
32
|
+
const k = 0, D = 1, re = 2, $e = {
|
|
33
33
|
name: "Latte",
|
|
34
34
|
type: "light",
|
|
35
35
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -72,10 +72,10 @@ const oe = function(e, t) {
|
|
|
72
72
|
return null;
|
|
73
73
|
} else
|
|
74
74
|
return null;
|
|
75
|
-
},
|
|
75
|
+
}, $ = (e, t) => {
|
|
76
76
|
if (e.parent = t, e.children)
|
|
77
77
|
for (let n = 0; n < e.children.length; n++)
|
|
78
|
-
|
|
78
|
+
$(e.children[n], e);
|
|
79
79
|
};
|
|
80
80
|
function he(e) {
|
|
81
81
|
if (e.id = X(), e.children)
|
|
@@ -118,7 +118,7 @@ function ue(e) {
|
|
|
118
118
|
})
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
|
-
const
|
|
121
|
+
const O = (e, t) => {
|
|
122
122
|
let n = 0, o = 0;
|
|
123
123
|
for (; t && t !== e; )
|
|
124
124
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
@@ -134,7 +134,7 @@ const $ = (e, t) => {
|
|
|
134
134
|
return !1;
|
|
135
135
|
}
|
|
136
136
|
return !0;
|
|
137
|
-
}),
|
|
137
|
+
}), T = {
|
|
138
138
|
moved: !1,
|
|
139
139
|
// diffrentiate click and move
|
|
140
140
|
mousedown: !1,
|
|
@@ -162,8 +162,8 @@ function ot(e) {
|
|
|
162
162
|
e.helper2.clear();
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
|
-
if (
|
|
166
|
-
|
|
165
|
+
if (T.moved) {
|
|
166
|
+
T.clear();
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
169
|
e.clearSelection();
|
|
@@ -182,16 +182,16 @@ function ot(e) {
|
|
|
182
182
|
const n = t.target;
|
|
183
183
|
le(n) ? e.beginEdit(n) : n.tagName === "text" && (n.dataset.type === "custom-link" ? e.editArrowLabel(n.parentElement) : e.editSummary(n.parentElement));
|
|
184
184
|
}), e.map.addEventListener("mousemove", (t) => {
|
|
185
|
-
t.target.contentEditable !== "true" &&
|
|
185
|
+
t.target.contentEditable !== "true" && T.onMove(t, e.container);
|
|
186
186
|
}), e.map.addEventListener("mousedown", (t) => {
|
|
187
187
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
188
|
-
t.button === n && t.target.contentEditable !== "true" && (
|
|
188
|
+
t.button === n && t.target.contentEditable !== "true" && (T.moved = !1, T.mousedown = !0);
|
|
189
189
|
}), e.map.addEventListener("mouseleave", (t) => {
|
|
190
190
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
191
|
-
t.button === n &&
|
|
191
|
+
t.button === n && T.clear();
|
|
192
192
|
}), e.map.addEventListener("mouseup", (t) => {
|
|
193
193
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
194
|
-
t.button === n &&
|
|
194
|
+
t.button === n && T.clear();
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
197
|
const st = {
|
|
@@ -232,7 +232,7 @@ const st = {
|
|
|
232
232
|
if (this.direction === re) {
|
|
233
233
|
let o = 0, s = 0;
|
|
234
234
|
n.map((i) => {
|
|
235
|
-
i.direction ===
|
|
235
|
+
i.direction === k ? o += 1 : i.direction === D ? s += 1 : o <= s ? (i.direction = k, o += 1) : (i.direction = D, s += 1);
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
rt(this, n, t);
|
|
@@ -243,7 +243,7 @@ const st = {
|
|
|
243
243
|
s.className = "rhs";
|
|
244
244
|
for (let i = 0; i < t.length; i++) {
|
|
245
245
|
const r = t[i], { grp: c } = e.createWrapper(r);
|
|
246
|
-
e.direction === re ? r.direction ===
|
|
246
|
+
e.direction === re ? r.direction === k ? o.appendChild(c) : s.appendChild(c) : e.direction === k ? o.appendChild(c) : s.appendChild(c);
|
|
247
247
|
}
|
|
248
248
|
e.nodes.appendChild(o), e.nodes.appendChild(n), e.nodes.appendChild(s), e.nodes.appendChild(e.lines);
|
|
249
249
|
}, ct = function(e, t) {
|
|
@@ -328,7 +328,7 @@ const ut = function(e) {
|
|
|
328
328
|
margin:${o.margin};
|
|
329
329
|
font:${o.font};
|
|
330
330
|
background-color:${o.backgroundColor !== "rgba(0, 0, 0, 0)" && o.backgroundColor};
|
|
331
|
-
border-radius:${o.borderRadius};`, this.direction ===
|
|
331
|
+
border-radius:${o.borderRadius};`, this.direction === k && (t.style.right = "0"), t.focus(), Be(t), this.bus.fire("operation", {
|
|
332
332
|
name: "beginEdit",
|
|
333
333
|
obj: e.nodeObj
|
|
334
334
|
}), t.addEventListener("keydown", (s) => {
|
|
@@ -409,13 +409,13 @@ const ut = function(e) {
|
|
|
409
409
|
const r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
410
410
|
this.lines.innerHTML = "";
|
|
411
411
|
for (let c = 0; c < r.length; c++) {
|
|
412
|
-
const l = r[c], u = l.querySelector("me-tpc"), { offsetLeft: d, offsetTop: a } =
|
|
412
|
+
const l = r[c], u = l.querySelector("me-tpc"), { offsetLeft: d, offsetTop: a } = O(this.nodes, u), f = u.offsetWidth, g = u.offsetHeight, p = l.parentNode.className, m = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: a, cL: d, cW: f, cH: g, direction: p, containerHeight: this.nodes.offsetHeight }), h = this.theme.palette, v = u.nodeObj.branchColor || h[c % h.length];
|
|
413
413
|
u.style.borderColor = v, this.lines.appendChild(He(m, v, "3"));
|
|
414
414
|
const y = l.children[0].children[1];
|
|
415
|
-
if (y && (y.style.top = (y.parentNode.offsetHeight - y.offsetHeight) / 2 + "px",
|
|
415
|
+
if (y && (y.style.top = (y.parentNode.offsetHeight - y.offsetHeight) / 2 + "px", p === "lhs" ? y.style.left = "-10px" : y.style.right = "-10px"), e && e !== l)
|
|
416
416
|
continue;
|
|
417
417
|
const b = Y("subLines"), x = l.lastChild;
|
|
418
|
-
x.tagName === "svg" && x.remove(), l.appendChild(b), Re(this, b, v, l,
|
|
418
|
+
x.tagName === "svg" && x.remove(), l.appendChild(b), Re(this, b, v, l, p, !0);
|
|
419
419
|
}
|
|
420
420
|
this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
421
421
|
}, Re = function(e, t, n, o, s, i) {
|
|
@@ -423,10 +423,10 @@ const ut = function(e) {
|
|
|
423
423
|
if (c.length === 0)
|
|
424
424
|
return;
|
|
425
425
|
const l = r.offsetTop, u = r.offsetLeft, d = r.offsetWidth, a = r.offsetHeight;
|
|
426
|
-
for (let
|
|
427
|
-
const g = c[
|
|
426
|
+
for (let f = 0; f < c.length; f++) {
|
|
427
|
+
const g = c[f], p = g.firstChild, m = p.offsetTop, h = p.offsetLeft, v = p.offsetWidth, y = p.offsetHeight, b = p.firstChild.nodeObj.branchColor || n, x = e.generateSubBranch({ pT: l, pL: u, pW: d, pH: a, cT: m, cL: h, cW: v, cH: y, direction: s, isFirst: i });
|
|
428
428
|
t.appendChild(He(x, b, "2"));
|
|
429
|
-
const w =
|
|
429
|
+
const w = p.children[1];
|
|
430
430
|
if (w) {
|
|
431
431
|
if (w.style.bottom = -(w.offsetHeight / 2) + "px", s === "lhs" ? w.style.left = "10px" : s === "rhs" && (w.style.right = "10px"), !w.expanded)
|
|
432
432
|
continue;
|
|
@@ -574,8 +574,8 @@ function mt(e, t) {
|
|
|
574
574
|
}, o = (b, x, w) => {
|
|
575
575
|
const S = document.createElement("li");
|
|
576
576
|
return S.id = b, S.innerHTML = `<span>${ne(x)}</span><span ${w ? 'class="key"' : ""}>${ne(w)}</span>`, S;
|
|
577
|
-
}, s = xe[e.locale] ? e.locale : "en", i = xe[s], r = o("cm-add_child", i.addChild, "Tab"), c = o("cm-add_parent", i.addParent, "Ctrl + Enter"), l = o("cm-add_sibling", i.addSibling, "Enter"), u = o("cm-remove_child", i.removeNode, "Delete"), d = o("cm-fucus", i.focus, ""), a = o("cm-unfucus", i.cancelFocus, ""),
|
|
578
|
-
if (h.className = "menu-list", h.appendChild(r), h.appendChild(c), h.appendChild(l), h.appendChild(u), (!t || t.focus) && (h.appendChild(d), h.appendChild(a)), h.appendChild(
|
|
577
|
+
}, s = xe[e.locale] ? e.locale : "en", i = xe[s], r = o("cm-add_child", i.addChild, "Tab"), c = o("cm-add_parent", i.addParent, "Ctrl + Enter"), l = o("cm-add_sibling", i.addSibling, "Enter"), u = o("cm-remove_child", i.removeNode, "Delete"), d = o("cm-fucus", i.focus, ""), a = o("cm-unfucus", i.cancelFocus, ""), f = o("cm-up", i.moveUp, "PgUp"), g = o("cm-down", i.moveDown, "Pgdn"), p = o("cm-link", i.link, ""), m = o("cm-summary", i.summary, ""), h = document.createElement("ul");
|
|
578
|
+
if (h.className = "menu-list", h.appendChild(r), h.appendChild(c), h.appendChild(l), h.appendChild(u), (!t || t.focus) && (h.appendChild(d), h.appendChild(a)), h.appendChild(f), h.appendChild(g), h.appendChild(m), (!t || t.link) && h.appendChild(p), t && t.extend)
|
|
579
579
|
for (let b = 0; b < t.extend.length; b++) {
|
|
580
580
|
const x = t.extend[b], w = o(x.name, x.name, x.key || "");
|
|
581
581
|
h.appendChild(w), w.onclick = (S) => {
|
|
@@ -590,9 +590,9 @@ function mt(e, t) {
|
|
|
590
590
|
return;
|
|
591
591
|
const x = b.target;
|
|
592
592
|
if (le(x)) {
|
|
593
|
-
x.parentElement.tagName === "ME-ROOT" ? y = !0 : y = !1, y ? (d.className = "disabled",
|
|
594
|
-
const w = h.getBoundingClientRect(), S = h.offsetHeight,
|
|
595
|
-
S + W > window.innerHeight ? (h.style.top = "", h.style.bottom = "0px") : (h.style.bottom = "", h.style.top = W + 15 + "px"),
|
|
593
|
+
x.parentElement.tagName === "ME-ROOT" ? y = !0 : y = !1, y ? (d.className = "disabled", f.className = "disabled", g.className = "disabled", c.className = "disabled", l.className = "disabled", u.className = "disabled") : (d.className = "", f.className = "", g.className = "", c.className = "", l.className = "", u.className = ""), e.currentNodes || e.selectNode(x), v.hidden = !1, T.mousedown && (T.mousedown = !1), h.style.top = "", h.style.bottom = "", h.style.left = "", h.style.right = "";
|
|
594
|
+
const w = h.getBoundingClientRect(), S = h.offsetHeight, P = h.offsetWidth, W = b.clientY - w.top, B = b.clientX - w.left;
|
|
595
|
+
S + W > window.innerHeight ? (h.style.top = "", h.style.bottom = "0px") : (h.style.bottom = "", h.style.top = W + 15 + "px"), P + B > window.innerWidth ? (h.style.left = "", h.style.right = "0px") : (h.style.right = "", h.style.left = B + 10 + "px");
|
|
596
596
|
}
|
|
597
597
|
}, v.onclick = (b) => {
|
|
598
598
|
b.target === v && (v.hidden = !0);
|
|
@@ -608,11 +608,11 @@ function mt(e, t) {
|
|
|
608
608
|
y || (e.focusNode(e.currentNode), v.hidden = !0);
|
|
609
609
|
}, a.onclick = () => {
|
|
610
610
|
e.cancelFocus(), v.hidden = !0;
|
|
611
|
-
},
|
|
611
|
+
}, f.onclick = () => {
|
|
612
612
|
y || (e.moveUpNode(), v.hidden = !0);
|
|
613
613
|
}, g.onclick = () => {
|
|
614
614
|
y || (e.moveDownNode(), v.hidden = !0);
|
|
615
|
-
},
|
|
615
|
+
}, p.onclick = () => {
|
|
616
616
|
v.hidden = !0;
|
|
617
617
|
const b = e.currentNode, x = n(i.clickTips);
|
|
618
618
|
e.container.appendChild(x), e.map.addEventListener(
|
|
@@ -629,7 +629,7 @@ function mt(e, t) {
|
|
|
629
629
|
}, m.onclick = () => {
|
|
630
630
|
v.hidden = !0, e.createSummary(), e.unselectNodes();
|
|
631
631
|
}, () => {
|
|
632
|
-
r.onclick = null, c.onclick = null, l.onclick = null, u.onclick = null, d.onclick = null, a.onclick = null,
|
|
632
|
+
r.onclick = null, c.onclick = null, l.onclick = null, u.onclick = null, d.onclick = null, a.onclick = null, f.onclick = null, g.onclick = null, p.onclick = null, m.onclick = null, v.onclick = null, e.container.oncontextmenu = null;
|
|
633
633
|
};
|
|
634
634
|
}
|
|
635
635
|
const gt = (e) => {
|
|
@@ -791,7 +791,7 @@ function Ct(e) {
|
|
|
791
791
|
(l = e.currentNodes) != null && l.includes(c) || (e.unselectNodes(), e.selectNode(c)), e.currentNodes ? (t = e.currentNodes, s.innerHTML = e.currentNodes.length + " nodes") : (t = [c], s.innerHTML = c.innerHTML);
|
|
792
792
|
for (const d of t)
|
|
793
793
|
d.parentElement.parentElement.style.opacity = "0.5";
|
|
794
|
-
(u = r.dataTransfer) == null || u.setDragImage(s, 0, 0),
|
|
794
|
+
(u = r.dataTransfer) == null || u.setDragImage(s, 0, 0), T.clear();
|
|
795
795
|
}), e.map.addEventListener("dragend", async (r) => {
|
|
796
796
|
if (!t)
|
|
797
797
|
return;
|
|
@@ -937,7 +937,7 @@ const Fe = (e) => (t, n, o, s = {}) => {
|
|
|
937
937
|
for (const r of n)
|
|
938
938
|
i[e](r, o, { capture: !1, ...s });
|
|
939
939
|
return [t, n, o, s];
|
|
940
|
-
},
|
|
940
|
+
}, H = Fe("addEventListener"), L = Fe("removeEventListener"), Q = (e) => {
|
|
941
941
|
var t;
|
|
942
942
|
const { clientX: n, clientY: o, target: s } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
|
|
943
943
|
return { x: n, y: o, target: s };
|
|
@@ -996,7 +996,7 @@ function Pt(e, t) {
|
|
|
996
996
|
}
|
|
997
997
|
return !1;
|
|
998
998
|
}
|
|
999
|
-
const { abs:
|
|
999
|
+
const { abs: z, max: _e, min: Me, ceil: ke } = Math, Te = (e = []) => ({
|
|
1000
1000
|
stored: e,
|
|
1001
1001
|
selected: [],
|
|
1002
1002
|
touched: [],
|
|
@@ -1063,23 +1063,23 @@ class qe extends jt {
|
|
|
1063
1063
|
}), this.enable();
|
|
1064
1064
|
}
|
|
1065
1065
|
_toggleStartEvents(t = !0) {
|
|
1066
|
-
const { document: n, features: o } = this._options, s = t ?
|
|
1066
|
+
const { document: n, features: o } = this._options, s = t ? H : L;
|
|
1067
1067
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1068
1068
|
}
|
|
1069
1069
|
_onTapStart(t, n = !1) {
|
|
1070
1070
|
const { x: o, y: s, target: i } = Q(t), { document: r, startAreas: c, boundaries: l, features: u, behaviour: d } = this._options, a = i.getBoundingClientRect();
|
|
1071
1071
|
if (t instanceof MouseEvent && !Pt(t, d.triggers))
|
|
1072
1072
|
return;
|
|
1073
|
-
const
|
|
1073
|
+
const f = F(c, r), g = F(l, r);
|
|
1074
1074
|
this._targetElement = g.find(
|
|
1075
1075
|
(v) => Se(v.getBoundingClientRect(), a)
|
|
1076
1076
|
);
|
|
1077
|
-
const
|
|
1078
|
-
if (this._targetBoundary = g.find((v) =>
|
|
1077
|
+
const p = t.composedPath(), m = f.find((v) => p.includes(v));
|
|
1078
|
+
if (this._targetBoundary = g.find((v) => p.includes(v)), !this._targetElement || !m || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1079
1079
|
return;
|
|
1080
1080
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1081
1081
|
const h = r.scrollingElement ?? r.body;
|
|
1082
|
-
this._scrollDelta = { x: h.scrollLeft, y: h.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0),
|
|
1082
|
+
this._scrollDelta = { x: h.scrollLeft, y: h.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), H(r, ["touchmove", "mousemove"], this._delayedTapMove, { passive: !1 }), H(r, ["mouseup", "touchcancel", "touchend"], this._onTapStop), H(r, "scroll", this._onScroll), u.deselectOnBlur && (this._targetBoundaryScrolled = !1, H(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
1083
1083
|
}
|
|
1084
1084
|
_onSingleTap(t) {
|
|
1085
1085
|
const { singleTap: { intersect: n }, range: o } = this._options.features, s = Q(t);
|
|
@@ -1090,8 +1090,8 @@ class qe extends jt {
|
|
|
1090
1090
|
this.resolveSelectables();
|
|
1091
1091
|
const { x: c, y: l } = s;
|
|
1092
1092
|
i = this._selectables.find((u) => {
|
|
1093
|
-
const { right: d, left: a, top:
|
|
1094
|
-
return c < d && c > a && l < g && l >
|
|
1093
|
+
const { right: d, left: a, top: f, bottom: g } = u.getBoundingClientRect();
|
|
1094
|
+
return c < d && c > a && l < g && l > f;
|
|
1095
1095
|
});
|
|
1096
1096
|
}
|
|
1097
1097
|
if (!i)
|
|
@@ -1116,14 +1116,14 @@ class qe extends jt {
|
|
|
1116
1116
|
const { container: n, document: o, behaviour: { startThreshold: s } } = this._options, { x1: i, y1: r } = this._areaLocation, { x: c, y: l } = Q(t);
|
|
1117
1117
|
if (
|
|
1118
1118
|
// Single number for both coordinates
|
|
1119
|
-
typeof s == "number" &&
|
|
1120
|
-
typeof s == "object" &&
|
|
1119
|
+
typeof s == "number" && z(c + l - (i + r)) >= s || // Different x and y threshold
|
|
1120
|
+
typeof s == "object" && z(c - i) >= s.x || z(l - r) >= s.y
|
|
1121
1121
|
) {
|
|
1122
1122
|
if (L(o, ["mousemove", "touchmove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1123
1123
|
L(o, ["mouseup", "touchcancel", "touchend"], this._onTapStop);
|
|
1124
1124
|
return;
|
|
1125
1125
|
}
|
|
1126
|
-
|
|
1126
|
+
H(o, ["mousemove", "touchmove"], this._onTapMove, { passive: !1 }), j(this._area, "display", "block"), F(n, o)[0].appendChild(this._clippingElement), this.resolveSelectables(), this._singleClick = !1, this._targetRect = this._targetElement.getBoundingClientRect(), this._scrollAvailable = this._targetElement.scrollHeight !== this._targetElement.clientHeight || this._targetElement.scrollWidth !== this._targetElement.clientWidth, this._scrollAvailable && (H(this._targetElement, "wheel", this._manualScroll, { passive: !1 }), this._selectables = this._selectables.filter((u) => this._targetElement.contains(u))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
1127
1127
|
}
|
|
1128
1128
|
this._handleMoveEvent(t);
|
|
1129
1129
|
}
|
|
@@ -1156,8 +1156,8 @@ class qe extends jt {
|
|
|
1156
1156
|
this._scrollingActive = !1;
|
|
1157
1157
|
return;
|
|
1158
1158
|
}
|
|
1159
|
-
const { scrollTop: a, scrollLeft:
|
|
1160
|
-
n.y && (c.scrollTop += ke(n.y / r), o.y1 -= c.scrollTop - a), n.x && (c.scrollLeft += ke(n.x / r), o.x1 -= c.scrollLeft -
|
|
1159
|
+
const { scrollTop: a, scrollLeft: f } = c;
|
|
1160
|
+
n.y && (c.scrollTop += ke(n.y / r), o.y1 -= c.scrollTop - a), n.x && (c.scrollLeft += ke(n.x / r), o.x1 -= c.scrollLeft - f), i.next(t), requestAnimationFrame(d);
|
|
1161
1161
|
};
|
|
1162
1162
|
requestAnimationFrame(d);
|
|
1163
1163
|
} else
|
|
@@ -1180,11 +1180,11 @@ class qe extends jt {
|
|
|
1180
1180
|
this._scrollSpeed.y += o * n, this._scrollSpeed.x += s * n, this._onTapMove(t), t.preventDefault();
|
|
1181
1181
|
}
|
|
1182
1182
|
_recalculateSelectionAreaRect() {
|
|
1183
|
-
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, { scrollTop: i, scrollHeight: r, clientHeight: c, scrollLeft: l, scrollWidth: u, clientWidth: d } = o, a = this._targetRect, { x1:
|
|
1184
|
-
let { x2:
|
|
1183
|
+
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, { scrollTop: i, scrollHeight: r, clientHeight: c, scrollLeft: l, scrollWidth: u, clientWidth: d } = o, a = this._targetRect, { x1: f, y1: g } = n;
|
|
1184
|
+
let { x2: p, y2: m } = n;
|
|
1185
1185
|
const { behaviour: { scrolling: { startScrollMargins: h } } } = s;
|
|
1186
|
-
|
|
1187
|
-
const v = Me(
|
|
1186
|
+
p < a.left + h.x ? (t.x = l ? -z(a.left - p + h.x) : 0, p = p < a.left ? a.left : p) : p > a.right - h.x ? (t.x = u - l - d ? z(a.left + a.width - p - h.x) : 0, p = p > a.right ? a.right : p) : t.x = 0, m < a.top + h.y ? (t.y = i ? -z(a.top - m + h.y) : 0, m = m < a.top ? a.top : m) : m > a.bottom - h.y ? (t.y = r - i - c ? z(a.top + a.height - m - h.y) : 0, m = m > a.bottom ? a.bottom : m) : t.y = 0;
|
|
1187
|
+
const v = Me(f, p), y = Me(g, m), b = _e(f, p), x = _e(g, m);
|
|
1188
1188
|
this._areaRect = new DOMRect(v, y, b - v, x - y);
|
|
1189
1189
|
}
|
|
1190
1190
|
_redrawSelectionArea() {
|
|
@@ -1197,7 +1197,7 @@ class qe extends jt {
|
|
|
1197
1197
|
L(this._targetElement, "scroll", this._onStartAreaScroll), L(s, ["mousemove", "touchmove"], this._delayedTapMove), L(s, ["touchmove", "mousemove"], this._onTapMove), L(s, ["mouseup", "touchcancel", "touchend"], this._onTapStop), L(s, "scroll", this._onScroll), this._keepSelection(), t && r && i.singleTap.allow ? this._onSingleTap(t) : !r && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, L(this._targetElement, "wheel", this._manualScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), j(this._area, "display", "none");
|
|
1198
1198
|
}
|
|
1199
1199
|
_updateElementSelection() {
|
|
1200
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: r, touched: c } = o, { intersect: l, overlap: u } = n.behaviour, d = u === "invert", a = [],
|
|
1200
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: r, touched: c } = o, { intersect: l, overlap: u } = n.behaviour, d = u === "invert", a = [], f = [], g = [];
|
|
1201
1201
|
for (let m = 0; m < t.length; m++) {
|
|
1202
1202
|
const h = t[m];
|
|
1203
1203
|
if (Se(s, h.getBoundingClientRect(), l)) {
|
|
@@ -1207,19 +1207,19 @@ class qe extends jt {
|
|
|
1207
1207
|
g.push(h);
|
|
1208
1208
|
continue;
|
|
1209
1209
|
} else
|
|
1210
|
-
|
|
1210
|
+
f.push(h);
|
|
1211
1211
|
a.push(h);
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
|
-
d &&
|
|
1215
|
-
const
|
|
1214
|
+
d && f.push(...i.filter((m) => !r.includes(m)));
|
|
1215
|
+
const p = u === "keep";
|
|
1216
1216
|
for (let m = 0; m < r.length; m++) {
|
|
1217
1217
|
const h = r[m];
|
|
1218
1218
|
!a.includes(h) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1219
1219
|
// not make them part of the current selection as soon as they're touched.
|
|
1220
|
-
(
|
|
1220
|
+
(p && i.includes(h)) && g.push(h);
|
|
1221
1221
|
}
|
|
1222
|
-
o.selected = a, o.changed = { added:
|
|
1222
|
+
o.selected = a, o.changed = { added: f, removed: g }, this._latestElement = void 0;
|
|
1223
1223
|
}
|
|
1224
1224
|
_emitEvent(t, n) {
|
|
1225
1225
|
return this.emit(t, {
|
|
@@ -1369,7 +1369,7 @@ function Bt(e) {
|
|
|
1369
1369
|
changed: { added: o, removed: s }
|
|
1370
1370
|
}
|
|
1371
1371
|
}) => {
|
|
1372
|
-
|
|
1372
|
+
T.moved = !0;
|
|
1373
1373
|
for (const i of o)
|
|
1374
1374
|
i.classList.add("selected");
|
|
1375
1375
|
for (const i of s)
|
|
@@ -1433,13 +1433,13 @@ function Ie(e, t, n) {
|
|
|
1433
1433
|
}
|
|
1434
1434
|
const It = function(e, t) {
|
|
1435
1435
|
var n, o;
|
|
1436
|
-
if (e ===
|
|
1437
|
-
return
|
|
1438
|
-
if (e ===
|
|
1439
|
-
return
|
|
1436
|
+
if (e === k)
|
|
1437
|
+
return k;
|
|
1438
|
+
if (e === D)
|
|
1439
|
+
return D;
|
|
1440
1440
|
if (e === re) {
|
|
1441
1441
|
const s = ((n = document.querySelector(".lhs")) == null ? void 0 : n.childElementCount) || 0, i = ((o = document.querySelector(".rhs")) == null ? void 0 : o.childElementCount) || 0;
|
|
1442
|
-
return s <= i ? (t.direction =
|
|
1442
|
+
return s <= i ? (t.direction = k, k) : (t.direction = D, D);
|
|
1443
1443
|
}
|
|
1444
1444
|
}, Ke = function(e, t, n) {
|
|
1445
1445
|
var i, r;
|
|
@@ -1453,7 +1453,7 @@ const It = function(e, t) {
|
|
|
1453
1453
|
}
|
|
1454
1454
|
e.linkDiv(n.offsetParent);
|
|
1455
1455
|
} else
|
|
1456
|
-
s.tagName === "ME-ROOT" && (It(e.direction, o.nodeObj) ===
|
|
1456
|
+
s.tagName === "ME-ROOT" && (It(e.direction, o.nodeObj) === k ? (i = e.container.querySelector(".lhs")) == null || i.appendChild(n) : (r = e.container.querySelector(".rhs")) == null || r.appendChild(n), e.linkDiv());
|
|
1457
1457
|
}, Ve = function(e, t) {
|
|
1458
1458
|
const n = e.parentNode;
|
|
1459
1459
|
if (t === 0) {
|
|
@@ -1482,11 +1482,11 @@ const It = function(e, t) {
|
|
|
1482
1482
|
const o = t.nodeObj;
|
|
1483
1483
|
o.expanded === !1 && (e.expandNode(t, !0), t = C(o.id));
|
|
1484
1484
|
const s = n || e.generateNewObj();
|
|
1485
|
-
o.children ? o.children.push(s) : o.children = [s],
|
|
1485
|
+
o.children ? o.children.push(s) : o.children = [s], $(e.nodeData);
|
|
1486
1486
|
const { grp: i, top: r } = e.createWrapper(s);
|
|
1487
1487
|
return Ke(e, t, i), { newTop: r, newNodeObj: s };
|
|
1488
1488
|
}, Vt = function(e, t, n) {
|
|
1489
|
-
var u, d, a;
|
|
1489
|
+
var u, d, a, f;
|
|
1490
1490
|
const o = t || this.currentNode;
|
|
1491
1491
|
if (!o)
|
|
1492
1492
|
return;
|
|
@@ -1501,7 +1501,11 @@ const It = function(e, t) {
|
|
|
1501
1501
|
return;
|
|
1502
1502
|
}
|
|
1503
1503
|
const i = n || this.generateNewObj();
|
|
1504
|
-
|
|
1504
|
+
if (!((f = s.parent) != null && f.parent)) {
|
|
1505
|
+
const g = o.offsetParent.offsetParent.parentElement.className === "lhs" ? k : D;
|
|
1506
|
+
i.direction = g;
|
|
1507
|
+
}
|
|
1508
|
+
Ft(i, e, s), $(this.nodeData);
|
|
1505
1509
|
const r = o.parentElement, { grp: c, top: l } = this.createWrapper(i);
|
|
1506
1510
|
r.parentElement.insertAdjacentElement(We[e], c), this.linkDiv(c.offsetParent), n || this.editTopic(l.firstChild), this.selectNode(l.firstChild, !0), this.bus.fire("operation", {
|
|
1507
1511
|
name: "insertSibling",
|
|
@@ -1517,7 +1521,7 @@ const It = function(e, t) {
|
|
|
1517
1521
|
if (!o.parent)
|
|
1518
1522
|
return;
|
|
1519
1523
|
const s = t || this.generateNewObj();
|
|
1520
|
-
qt(o, s),
|
|
1524
|
+
qt(o, s), $(this.nodeData);
|
|
1521
1525
|
const i = n.parentElement.parentElement, { grp: r, top: c } = this.createWrapper(s, !0);
|
|
1522
1526
|
c.appendChild(pe(!0)), i.insertAdjacentElement("afterend", r);
|
|
1523
1527
|
const l = this.createChildren([i]);
|
|
@@ -1625,7 +1629,7 @@ const It = function(e, t) {
|
|
|
1625
1629
|
n.expanded === !1 && (this.expandNode(t, !0), t = C(n.id));
|
|
1626
1630
|
for (const o of e) {
|
|
1627
1631
|
const s = o.nodeObj;
|
|
1628
|
-
Ie("in", s, n),
|
|
1632
|
+
Ie("in", s, n), $(this.nodeData);
|
|
1629
1633
|
const i = o.parentElement;
|
|
1630
1634
|
Ke(this, t, i.parentElement);
|
|
1631
1635
|
}
|
|
@@ -1639,7 +1643,7 @@ const It = function(e, t) {
|
|
|
1639
1643
|
const s = n.nodeObj;
|
|
1640
1644
|
for (const i of e) {
|
|
1641
1645
|
const r = i.nodeObj;
|
|
1642
|
-
Ie(t, r, s),
|
|
1646
|
+
Ie(t, r, s), $(o.nodeData), G(i);
|
|
1643
1647
|
const c = i.parentElement.parentNode;
|
|
1644
1648
|
n.parentElement.parentNode.insertAdjacentElement(We[t], c);
|
|
1645
1649
|
}
|
|
@@ -1766,7 +1770,7 @@ const rn = function(e, t, n) {
|
|
|
1766
1770
|
o.parentNode.children[1].remove();
|
|
1767
1771
|
this.linkDiv(), this.bus.fire("expandNode", n);
|
|
1768
1772
|
}, _n = function(e) {
|
|
1769
|
-
e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []),
|
|
1773
|
+
e && (e = JSON.parse(JSON.stringify(e)), this.nodeData = e.nodeData, this.arrows = e.arrows || [], this.summaries = e.summaries || []), $(this.nodeData), this.layout(), this.linkDiv();
|
|
1770
1774
|
}, Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1771
1775
|
__proto__: null,
|
|
1772
1776
|
cancelFocus: xn,
|
|
@@ -1820,7 +1824,7 @@ const rn = function(e, t, n) {
|
|
|
1820
1824
|
create: kn
|
|
1821
1825
|
};
|
|
1822
1826
|
function ie(e, t, n) {
|
|
1823
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
1827
|
+
const { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = t.offsetWidth, r = t.offsetHeight, c = o + i / 2, l = s + r / 2, u = c + n.x, d = l + n.y;
|
|
1824
1828
|
return {
|
|
1825
1829
|
w: i,
|
|
1826
1830
|
h: r,
|
|
@@ -1850,10 +1854,10 @@ const Tn = function(e, t, n, o) {
|
|
|
1850
1854
|
if (!t || !n)
|
|
1851
1855
|
return;
|
|
1852
1856
|
performance.now();
|
|
1853
|
-
const i = ie(e, t, o.delta1), r = ie(e, n, o.delta2), { x: c, y: l } = q(i), { ctrlX: u, ctrlY: d } = i, { ctrlX: a, ctrlY:
|
|
1854
|
-
`M ${c} ${l} C ${u} ${d} ${a} ${
|
|
1855
|
-
`M ${m.x1} ${m.y1} L ${g} ${
|
|
1856
|
-
), v = c / 8 + u * 3 / 8 + a * 3 / 8 + g / 8, y = l / 8 + d * 3 / 8 +
|
|
1857
|
+
const i = ie(e, t, o.delta1), r = ie(e, n, o.delta2), { x: c, y: l } = q(i), { ctrlX: u, ctrlY: d } = i, { ctrlX: a, ctrlY: f } = r, { x: g, y: p } = q(r), m = Pe(a, f, g, p), h = ft(
|
|
1858
|
+
`M ${c} ${l} C ${u} ${d} ${a} ${f} ${g} ${p}`,
|
|
1859
|
+
`M ${m.x1} ${m.y1} L ${g} ${p} L ${m.x2} ${m.y2}`
|
|
1860
|
+
), v = c / 8 + u * 3 / 8 + a * 3 / 8 + g / 8, y = l / 8 + d * 3 / 8 + f * 3 / 8 + p / 8, b = Tn(o.label, v, y, e.theme.cssVar["--color"]);
|
|
1857
1861
|
h.appendChild(b), h.arrowObj = o, h.dataset.linkid = o.id, e.linkSvgGroup.appendChild(h), s || (e.arrows.push(o), e.currentArrow = h, Ze(e, o, i, r)), performance.now();
|
|
1858
1862
|
}, Ln = function(e, t) {
|
|
1859
1863
|
const n = {
|
|
@@ -1895,7 +1899,7 @@ const Tn = function(e, t, n, o) {
|
|
|
1895
1899
|
}, Je = function(e) {
|
|
1896
1900
|
e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none";
|
|
1897
1901
|
}, Ze = function(e, t, n, o) {
|
|
1898
|
-
var
|
|
1902
|
+
var f;
|
|
1899
1903
|
e.linkController.style.display = "initial", e.P2.style.display = "initial", e.P3.style.display = "initial", e.nodes.appendChild(e.linkController), e.nodes.appendChild(e.P2), e.nodes.appendChild(e.P3);
|
|
1900
1904
|
let { x: s, y: i } = q(n), { ctrlX: r, ctrlY: c } = n, { ctrlX: l, ctrlY: u } = o, { x: d, y: a } = q(o);
|
|
1901
1905
|
e.P2.style.cssText = `top:${c}px;left:${r}px;`, e.P3.style.cssText = `top:${u}px;left:${l}px;`, N(e.line1, {
|
|
@@ -1908,9 +1912,9 @@ const Tn = function(e, t, n, o) {
|
|
|
1908
1912
|
y1: u + "",
|
|
1909
1913
|
x2: d + "",
|
|
1910
1914
|
y2: a + ""
|
|
1911
|
-
}), e.helper1 && (e.helper1.destory(e.map), (
|
|
1915
|
+
}), e.helper1 && (e.helper1.destory(e.map), (f = e.helper2) == null || f.destory(e.map)), e.helper1 = Le.create(e.P2), e.helper2 = Le.create(e.P3), e.helper1.init(e.map, (g, p) => {
|
|
1912
1916
|
var y;
|
|
1913
|
-
r = r + g / e.scaleVal, c = c +
|
|
1917
|
+
r = r + g / e.scaleVal, c = c + p / e.scaleVal;
|
|
1914
1918
|
const m = q({ ...n, ctrlX: r, ctrlY: c });
|
|
1915
1919
|
s = m.x, i = m.y;
|
|
1916
1920
|
const h = s / 8 + r * 3 / 8 + l * 3 / 8 + d / 8, v = i / 8 + c * 3 / 8 + u * 3 / 8 + a / 8;
|
|
@@ -1923,9 +1927,9 @@ const Tn = function(e, t, n, o) {
|
|
|
1923
1927
|
x2: r + "",
|
|
1924
1928
|
y2: c + ""
|
|
1925
1929
|
}), t.delta1.x = r - n.cx, t.delta1.y = c - n.cy;
|
|
1926
|
-
}), e.helper2.init(e.map, (g,
|
|
1930
|
+
}), e.helper2.init(e.map, (g, p) => {
|
|
1927
1931
|
var b, x;
|
|
1928
|
-
l = l + g / e.scaleVal, u = u +
|
|
1932
|
+
l = l + g / e.scaleVal, u = u + p / e.scaleVal;
|
|
1929
1933
|
const m = q({ ...o, ctrlX: l, ctrlY: u });
|
|
1930
1934
|
d = m.x, a = m.y;
|
|
1931
1935
|
const h = s / 8 + r * 3 / 8 + l * 3 / 8 + d / 8, v = i / 8 + c * 3 / 8 + u * 3 / 8 + a / 8, y = Pe(l, u, d, a);
|
|
@@ -1984,22 +1988,22 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1984
1988
|
const d = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
1985
1989
|
if (!a)
|
|
1986
1990
|
throw new Error("Can not select root node.");
|
|
1987
|
-
const
|
|
1991
|
+
const f = a.children.findIndex((g) => d === g);
|
|
1988
1992
|
return {
|
|
1989
1993
|
parent: a.id,
|
|
1990
|
-
start:
|
|
1991
|
-
end:
|
|
1994
|
+
start: f,
|
|
1995
|
+
end: f
|
|
1992
1996
|
};
|
|
1993
1997
|
}
|
|
1994
1998
|
let t = 0;
|
|
1995
1999
|
const n = e.map((d) => {
|
|
1996
2000
|
let a = d.nodeObj;
|
|
1997
|
-
const
|
|
2001
|
+
const f = [];
|
|
1998
2002
|
for (; a.parent; ) {
|
|
1999
|
-
const g = a.parent,
|
|
2000
|
-
a = g,
|
|
2003
|
+
const g = a.parent, p = g.children, m = p == null ? void 0 : p.indexOf(a);
|
|
2004
|
+
a = g, f.unshift({ node: a, index: m });
|
|
2001
2005
|
}
|
|
2002
|
-
return
|
|
2006
|
+
return f.length > t && (t = f.length), f;
|
|
2003
2007
|
});
|
|
2004
2008
|
let o = 0;
|
|
2005
2009
|
e:
|
|
@@ -2047,17 +2051,17 @@ const Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2047
2051
|
}, Qe = function(e, t) {
|
|
2048
2052
|
var S;
|
|
2049
2053
|
const { id: n, text: o, parent: s, start: i, end: r } = t, c = e.nodes, u = C(s).nodeObj, d = Fn(t);
|
|
2050
|
-
let a = 1 / 0,
|
|
2051
|
-
for (let
|
|
2052
|
-
const W = (S = u.children) == null ? void 0 : S[
|
|
2054
|
+
let a = 1 / 0, f = 0, g = 0, p = 0;
|
|
2055
|
+
for (let P = i; P <= r; P++) {
|
|
2056
|
+
const W = (S = u.children) == null ? void 0 : S[P];
|
|
2053
2057
|
if (!W)
|
|
2054
2058
|
return e.removeSummary(n), null;
|
|
2055
|
-
const
|
|
2056
|
-
|
|
2059
|
+
const B = Rn(W.id), { offsetLeft: J, offsetTop: ve } = O(c, B);
|
|
2060
|
+
P === i && (g = ve + 20), P === r && (p = ve + B.offsetHeight - 20), J < a && (a = J), B.offsetWidth + J > f && (f = B.offsetWidth + J);
|
|
2057
2061
|
}
|
|
2058
2062
|
let m, h;
|
|
2059
|
-
const v = g + 10, y =
|
|
2060
|
-
d === "lhs" ? (m = Ae(`M ${a + 10} ${v} c -5 0 -10 5 -10 10 L ${a} ${y - 10} c 0 5 5 10 10 10 M ${a} ${b} h -10`, x), h = je(o, a - 20, b + 6, "end", x)) : (m = Ae(`M ${
|
|
2063
|
+
const v = g + 10, y = p + 10, b = (v + y) / 2, x = e.theme.cssVar["--color"];
|
|
2064
|
+
d === "lhs" ? (m = Ae(`M ${a + 10} ${v} c -5 0 -10 5 -10 10 L ${a} ${y - 10} c 0 5 5 10 10 10 M ${a} ${b} h -10`, x), h = je(o, a - 20, b + 6, "end", x)) : (m = Ae(`M ${f - 10} ${v} c 5 0 10 5 10 10 L ${f} ${y - 10} c 0 5 -5 10 -10 10 M ${f} ${b} h 10`, x), h = je(o, f + 20, b + 6, "start", x));
|
|
2061
2065
|
const w = zn("s-" + n);
|
|
2062
2066
|
return w.appendChild(m), w.appendChild(h), w.summaryObj = t, e.summarySvg.appendChild(w), w;
|
|
2063
2067
|
}, qn = function() {
|
|
@@ -2165,7 +2169,7 @@ function Zn(e, t, n, o) {
|
|
|
2165
2169
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
2166
2170
|
}
|
|
2167
2171
|
function Qn(e, t) {
|
|
2168
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2172
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(M, "rect");
|
|
2169
2173
|
return N(i, {
|
|
2170
2174
|
x: o + "",
|
|
2171
2175
|
y: s + "",
|
|
@@ -2179,7 +2183,7 @@ function Qn(e, t) {
|
|
|
2179
2183
|
}), i;
|
|
2180
2184
|
}
|
|
2181
2185
|
function ee(e, t, n = !1) {
|
|
2182
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
2186
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = O(e.nodes, t), r = document.createElementNS(M, "rect");
|
|
2183
2187
|
N(r, {
|
|
2184
2188
|
x: s + "",
|
|
2185
2189
|
y: i + "",
|
|
@@ -2197,7 +2201,7 @@ function ee(e, t, n = !1) {
|
|
|
2197
2201
|
return n ? l = Zn(t, o, s, i) : l = Jn(t, o, s, i), c.appendChild(l), c;
|
|
2198
2202
|
}
|
|
2199
2203
|
function eo(e, t) {
|
|
2200
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2204
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(M, "a"), r = document.createElementNS(M, "text");
|
|
2201
2205
|
return N(r, {
|
|
2202
2206
|
x: o + "",
|
|
2203
2207
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -2209,7 +2213,7 @@ function eo(e, t) {
|
|
|
2209
2213
|
}), r.innerHTML = t.textContent, i.appendChild(r), i.setAttribute("href", t.href), i;
|
|
2210
2214
|
}
|
|
2211
2215
|
function to(e, t) {
|
|
2212
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2216
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(M, "image");
|
|
2213
2217
|
return N(i, {
|
|
2214
2218
|
x: o + "",
|
|
2215
2219
|
y: s + "",
|
|
@@ -2219,7 +2223,7 @@ function to(e, t) {
|
|
|
2219
2223
|
}), i;
|
|
2220
2224
|
}
|
|
2221
2225
|
const te = 100, no = '<?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">', oo = (e, t = !1) => {
|
|
2222
|
-
var a,
|
|
2226
|
+
var a, f, g;
|
|
2223
2227
|
const n = e.nodes, o = n.offsetHeight + te * 2, s = n.offsetWidth + te * 2, i = Xn(o + "px", s + "px"), r = document.createElementNS(M, "svg"), c = document.createElementNS(M, "rect");
|
|
2224
2228
|
N(c, {
|
|
2225
2229
|
x: "0",
|
|
@@ -2227,25 +2231,25 @@ const te = 100, no = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2227
2231
|
width: `${s}`,
|
|
2228
2232
|
height: `${o}`,
|
|
2229
2233
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2230
|
-
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((
|
|
2231
|
-
const m =
|
|
2234
|
+
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((p) => {
|
|
2235
|
+
const m = p.cloneNode(!0), { offsetLeft: h, offsetTop: v } = O(n, p.parentElement);
|
|
2232
2236
|
m.setAttribute("x", `${h}`), m.setAttribute("y", `${v}`), r.appendChild(m);
|
|
2233
2237
|
});
|
|
2234
2238
|
const l = (a = n.querySelector(".lines")) == null ? void 0 : a.cloneNode(!0);
|
|
2235
2239
|
l && r.appendChild(l);
|
|
2236
|
-
const u = (
|
|
2240
|
+
const u = (f = n.querySelector(".topiclinks")) == null ? void 0 : f.cloneNode(!0);
|
|
2237
2241
|
u && r.appendChild(u);
|
|
2238
2242
|
const d = (g = n.querySelector(".summary")) == null ? void 0 : g.cloneNode(!0);
|
|
2239
|
-
return d && r.appendChild(d), n.querySelectorAll("me-tpc").forEach((
|
|
2240
|
-
|
|
2241
|
-
}), n.querySelectorAll(".tags > span").forEach((
|
|
2242
|
-
r.appendChild(ee(e,
|
|
2243
|
-
}), n.querySelectorAll(".icons > span").forEach((
|
|
2244
|
-
r.appendChild(ee(e,
|
|
2245
|
-
}), n.querySelectorAll(".hyper-link").forEach((
|
|
2246
|
-
r.appendChild(eo(e,
|
|
2247
|
-
}), n.querySelectorAll("img").forEach((
|
|
2248
|
-
r.appendChild(to(e,
|
|
2243
|
+
return d && r.appendChild(d), n.querySelectorAll("me-tpc").forEach((p) => {
|
|
2244
|
+
p.nodeObj.dangerouslySetInnerHTML ? r.appendChild(ee(e, p, !t)) : (r.appendChild(Qn(e, p)), r.appendChild(ee(e, p.text, !t)));
|
|
2245
|
+
}), n.querySelectorAll(".tags > span").forEach((p) => {
|
|
2246
|
+
r.appendChild(ee(e, p));
|
|
2247
|
+
}), n.querySelectorAll(".icons > span").forEach((p) => {
|
|
2248
|
+
r.appendChild(ee(e, p));
|
|
2249
|
+
}), n.querySelectorAll(".hyper-link").forEach((p) => {
|
|
2250
|
+
r.appendChild(eo(e, p));
|
|
2251
|
+
}), n.querySelectorAll("img").forEach((p) => {
|
|
2252
|
+
r.appendChild(to(e, p));
|
|
2249
2253
|
}), N(r, {
|
|
2250
2254
|
x: te + "",
|
|
2251
2255
|
y: te + "",
|
|
@@ -2310,31 +2314,31 @@ const ho = {
|
|
|
2310
2314
|
init(e) {
|
|
2311
2315
|
if (!e || !e.nodeData)
|
|
2312
2316
|
return new Error("MindElixir: `data` is required");
|
|
2313
|
-
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData,
|
|
2317
|
+
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, $(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Tt(this), this.keypress && wt(this), this.editable && Bt(this), this.contextMenu && this.disposable.push(mt(this, this.contextMenuOption)), this.draggable && Ct(this), this.allowUndo && _t(this), this.toCenter(), this.layout(), this.linkDiv();
|
|
2314
2318
|
},
|
|
2315
2319
|
destroy() {
|
|
2316
|
-
var e
|
|
2317
|
-
this.disposable.forEach((
|
|
2320
|
+
var e;
|
|
2321
|
+
this.disposable.forEach((t) => t()), this.mindElixirBox && (this.mindElixirBox.innerHTML = ""), this.mindElixirBox = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNode = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = 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.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, (e = this.selection) == null || e.destroy(), this.selection = void 0;
|
|
2318
2322
|
}
|
|
2319
2323
|
};
|
|
2320
2324
|
function uo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, containerHeight: u }) {
|
|
2321
2325
|
let d = t + n / 2;
|
|
2322
2326
|
const a = e + o / 2;
|
|
2323
|
-
let
|
|
2324
|
-
l === "lhs" ?
|
|
2327
|
+
let f;
|
|
2328
|
+
l === "lhs" ? f = i + r : f = i;
|
|
2325
2329
|
const g = s + c / 2, m = (1 - Math.abs(g - a) / u) * 0.25 * (n / 2);
|
|
2326
|
-
return l === "lhs" ? d = d - n / 10 - m : d = d + n / 10 + m, `M ${d} ${a} Q ${d} ${g} ${
|
|
2330
|
+
return l === "lhs" ? d = d - n / 10 - m : d = d + n / 10 + m, `M ${d} ${a} Q ${d} ${g} ${f} ${g}`;
|
|
2327
2331
|
}
|
|
2328
2332
|
function fo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: l, isFirst: u }) {
|
|
2329
2333
|
const d = parseInt(this.mindElixirBox.style.getPropertyValue("--gap"));
|
|
2330
|
-
let a = 0,
|
|
2334
|
+
let a = 0, f = 0;
|
|
2331
2335
|
u ? a = e + o / 2 : a = e + o;
|
|
2332
2336
|
const g = s + c;
|
|
2333
|
-
let
|
|
2337
|
+
let p = 0, m = 0, h = 0;
|
|
2334
2338
|
const v = Math.abs(a - g) / 300 * d;
|
|
2335
|
-
return l === "lhs" ? (h = t,
|
|
2339
|
+
return l === "lhs" ? (h = t, p = h + d, m = h - d, f = i + d, `M ${p} ${a} C ${h} ${a} ${h + v} ${g} ${m} ${g} H ${f}`) : (h = t + n, p = h - d, m = h + d, f = i + r - d, `M ${p} ${a} C ${h} ${a} ${h - v} ${g} ${m} ${g} H ${f}`);
|
|
2336
2340
|
}
|
|
2337
|
-
const po = "4.3.
|
|
2341
|
+
const po = "4.3.3", U = document;
|
|
2338
2342
|
function A({
|
|
2339
2343
|
el: e,
|
|
2340
2344
|
direction: t,
|
|
@@ -2348,9 +2352,9 @@ function A({
|
|
|
2348
2352
|
mouseSelectionButton: u,
|
|
2349
2353
|
selectionContainer: d,
|
|
2350
2354
|
before: a,
|
|
2351
|
-
newTopicName:
|
|
2355
|
+
newTopicName: f,
|
|
2352
2356
|
allowUndo: g,
|
|
2353
|
-
generateMainBranch:
|
|
2357
|
+
generateMainBranch: p,
|
|
2354
2358
|
generateSubBranch: m,
|
|
2355
2359
|
overflowHidden: h,
|
|
2356
2360
|
theme: v
|
|
@@ -2359,15 +2363,15 @@ function A({
|
|
|
2359
2363
|
const b = Object.prototype.toString.call(e);
|
|
2360
2364
|
if (b === "[object HTMLDivElement]" ? y = e : b === "[object String]" && (y = document.querySelector(e)), !y)
|
|
2361
2365
|
throw new Error("MindElixir: el is not a valid element");
|
|
2362
|
-
y.className += " mind-elixir", y.innerHTML = "", this.mindElixirBox = y, this.disposable = [], this.before = a || {}, this.locale = n || "en", this.contextMenuOption = r, this.contextMenu = i === void 0 ? !0 : i, this.toolBar = c === void 0 ? !0 : c, this.keypress = l === void 0 ? !0 : l, this.mouseSelectionButton = u || 0, this.direction = typeof t == "number" ? t : 1, this.draggable = o === void 0 ? !0 : o, this.newTopicName =
|
|
2366
|
+
y.className += " mind-elixir", y.innerHTML = "", this.mindElixirBox = y, this.disposable = [], this.before = a || {}, this.locale = n || "en", this.contextMenuOption = r, this.contextMenu = i === void 0 ? !0 : i, this.toolBar = c === void 0 ? !0 : c, this.keypress = l === void 0 ? !0 : l, this.mouseSelectionButton = u || 0, this.direction = typeof t == "number" ? t : 1, this.draggable = o === void 0 ? !0 : o, this.newTopicName = f || "new node", this.editable = s === void 0 ? !0 : s, this.allowUndo = g === void 0 ? !1 : g, this.currentNode = null, this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.generateMainBranch = p || uo, this.generateSubBranch = m || fo, this.overflowHidden = h || !1, this.bus = st.create(), this.container = U.createElement("div"), this.selectionContainer = d || this.container, this.container.className = "map-container";
|
|
2363
2367
|
const x = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2364
2368
|
this.theme = v || (x.matches ? Oe : $e);
|
|
2365
2369
|
const w = U.createElement("div");
|
|
2366
2370
|
w.className = "map-canvas", this.map = w, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = U.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = Y("lines"), this.summarySvg = Y("summary"), this.linkController = Y("linkcontroller"), this.P2 = U.createElement("div"), this.P3 = U.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = ye(), this.line2 = ye(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = Y("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : ot(this);
|
|
2367
2371
|
}
|
|
2368
2372
|
A.prototype = ho;
|
|
2369
|
-
A.LEFT =
|
|
2370
|
-
A.RIGHT =
|
|
2373
|
+
A.LEFT = k;
|
|
2374
|
+
A.RIGHT = D;
|
|
2371
2375
|
A.SIDE = re;
|
|
2372
2376
|
A.THEME = $e;
|
|
2373
2377
|
A.DARK_THEME = Oe;
|