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/MindElixir.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const es = 0, ts = 1, ns = 2, fe = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -115,7 +115,7 @@ function ge(e) {
|
|
|
115
115
|
})
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
|
-
const
|
|
118
|
+
const M = (e, t) => {
|
|
119
119
|
let n = 0, o = 0;
|
|
120
120
|
for (; t && t !== e; )
|
|
121
121
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
@@ -267,7 +267,7 @@ function Et(e) {
|
|
|
267
267
|
return () => {
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
|
-
const
|
|
270
|
+
const H = {
|
|
271
271
|
LHS: "lhs",
|
|
272
272
|
RHS: "rhs"
|
|
273
273
|
}, Ct = function() {
|
|
@@ -286,9 +286,9 @@ const O = {
|
|
|
286
286
|
St(this, n, t);
|
|
287
287
|
}, St = function(e, t, n) {
|
|
288
288
|
const o = document.createElement("me-main");
|
|
289
|
-
o.className =
|
|
289
|
+
o.className = H.LHS;
|
|
290
290
|
const s = document.createElement("me-main");
|
|
291
|
-
s.className =
|
|
291
|
+
s.className = H.RHS;
|
|
292
292
|
for (let i = 0; i < t.length; i++) {
|
|
293
293
|
const l = t[i], { grp: c } = e.createWrapper(l);
|
|
294
294
|
e.direction === 2 ? l.direction === 0 ? o.appendChild(c) : s.appendChild(c) : e.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
@@ -369,7 +369,7 @@ function Qe(e) {
|
|
|
369
369
|
}
|
|
370
370
|
const Lt = function(e) {
|
|
371
371
|
if (!e) return;
|
|
372
|
-
const t = document.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } =
|
|
372
|
+
const t = document.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = M(this.nodes, e);
|
|
373
373
|
this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
374
374
|
const l = getComputedStyle(e);
|
|
375
375
|
t.style.cssText = `
|
|
@@ -511,7 +511,7 @@ const $t = function({ map: e, direction: t }, n) {
|
|
|
511
511
|
}
|
|
512
512
|
const i = n || this.generateNewObj();
|
|
513
513
|
if (!s.parent?.parent) {
|
|
514
|
-
const a = o.closest("me-main").className ===
|
|
514
|
+
const a = o.closest("me-main").className === H.LHS ? 0 : 1;
|
|
515
515
|
i.direction = a;
|
|
516
516
|
}
|
|
517
517
|
Pt(i, e, s), R(this.nodeData);
|
|
@@ -893,12 +893,12 @@ function An(e, t) {
|
|
|
893
893
|
ArrowLeft: (r) => {
|
|
894
894
|
if (r.metaKey || r.ctrlKey)
|
|
895
895
|
return e.initLeft();
|
|
896
|
-
Oe(e,
|
|
896
|
+
Oe(e, H.LHS);
|
|
897
897
|
},
|
|
898
898
|
ArrowRight: (r) => {
|
|
899
899
|
if (r.metaKey || r.ctrlKey)
|
|
900
900
|
return e.initRight();
|
|
901
|
-
Oe(e,
|
|
901
|
+
Oe(e, H.RHS);
|
|
902
902
|
},
|
|
903
903
|
PageUp: () => e.moveUpNode(),
|
|
904
904
|
PageDown: () => {
|
|
@@ -972,8 +972,8 @@ function Pn(e) {
|
|
|
972
972
|
this.clear();
|
|
973
973
|
return;
|
|
974
974
|
}
|
|
975
|
-
const x = (/* @__PURE__ */ new Date()).getTime(),
|
|
976
|
-
this.lastTap = x, this.lastTapTarget = f.target,
|
|
975
|
+
const x = (/* @__PURE__ */ new Date()).getTime(), S = x - this.lastTap, C = S < this.DOUBLE_CLICK_THRESHOLD && S > 0 && this.lastTapTarget === f.target;
|
|
976
|
+
this.lastTap = x, this.lastTapTarget = f.target, C && y(f);
|
|
977
977
|
},
|
|
978
978
|
clear() {
|
|
979
979
|
this.lastTap = 0, this.lastTapTarget = null;
|
|
@@ -1001,15 +1001,15 @@ function Pn(e) {
|
|
|
1001
1001
|
handlePointerMove(f) {
|
|
1002
1002
|
if (f.pointerType !== "touch" || !this.activePointers.has(f.pointerId)) return !1;
|
|
1003
1003
|
if (this.activePointers.set(f.pointerId, { x: f.clientX, y: f.clientY }), this.activePointers.size >= 2) {
|
|
1004
|
-
const [y, x] = Array.from(this.activePointers.values()),
|
|
1004
|
+
const [y, x] = Array.from(this.activePointers.values()), S = De(y, x);
|
|
1005
1005
|
if (this.lastDistance !== null && this.lastDistance > 0) {
|
|
1006
|
-
const
|
|
1007
|
-
e.scale(e.scaleVal *
|
|
1006
|
+
const C = S / this.lastDistance;
|
|
1007
|
+
e.scale(e.scaleVal * C, {
|
|
1008
1008
|
x: (y.x + x.x) / 2,
|
|
1009
1009
|
y: (y.y + x.y) / 2
|
|
1010
1010
|
});
|
|
1011
1011
|
}
|
|
1012
|
-
return this.lastDistance =
|
|
1012
|
+
return this.lastDistance = S, !0;
|
|
1013
1013
|
}
|
|
1014
1014
|
return !1;
|
|
1015
1015
|
},
|
|
@@ -1041,10 +1041,10 @@ function Pn(e) {
|
|
|
1041
1041
|
}
|
|
1042
1042
|
}, a = (f, y) => {
|
|
1043
1043
|
if (f.closest("#input-box")) return !1;
|
|
1044
|
-
const x = f.closest(".svg-label"),
|
|
1045
|
-
if (!
|
|
1046
|
-
const { type: T, element:
|
|
1047
|
-
return e.clearSelection(), T === "arrow" ? y ? e.editArrowLabel(
|
|
1044
|
+
const x = f.closest(".svg-label"), S = f.closest(".topiclinks, .summary"), C = x ? { type: x.dataset.type, element: document.getElementById(x.dataset.svgId) } : S ? { type: S.classList.contains("topiclinks") ? "arrow" : "summary", element: f.closest("g") } : null;
|
|
1045
|
+
if (!C?.type || !C?.element) return !1;
|
|
1046
|
+
const { type: T, element: D } = C;
|
|
1047
|
+
return e.clearSelection(), T === "arrow" ? y ? e.editArrowLabel(D) : e.selectArrow(D) : y ? e.editSummary(D) : e.selectSummary(D), !0;
|
|
1048
1048
|
}, d = (f) => {
|
|
1049
1049
|
if (f.pointerType === "mouse" && f.button !== 0) return;
|
|
1050
1050
|
if (e.helper1?.moved) {
|
|
@@ -1085,8 +1085,8 @@ function Pn(e) {
|
|
|
1085
1085
|
if (t.handlePointerDown(f), t.mousedown && (e.ptState = i.Pan), f.button === 0 || f.pointerType === "touch")
|
|
1086
1086
|
if (te(y)) {
|
|
1087
1087
|
e.selection?.cancel();
|
|
1088
|
-
const
|
|
1089
|
-
if (f.ctrlKey || f.metaKey || e.mobileMultiSelect ?
|
|
1088
|
+
const S = e.currentNodes || [];
|
|
1089
|
+
if (f.ctrlKey || f.metaKey || e.mobileMultiSelect ? S.includes(y) ? o = y : ((e.currentArrow || e.currentSummary) && e.clearSelection(), e.selection?.select(y)) : S.includes(y) || e.selectNode(y), !e.editable) return;
|
|
1090
1090
|
f.pointerType === "touch" ? (e.ptState = i.DragWait, r.start(f, (T) => {
|
|
1091
1091
|
Me(e, c, T, !0) && (e.ptState = i.Drag, y.setPointerCapture(T.pointerId));
|
|
1092
1092
|
})) : Me(e, c, f, !1) && (e.ptState = i.Drag, y.setPointerCapture(f.pointerId));
|
|
@@ -1136,7 +1136,7 @@ function Pn(e) {
|
|
|
1136
1136
|
e.move(-f.deltaX, -f.deltaY);
|
|
1137
1137
|
}, w = (f) => {
|
|
1138
1138
|
f.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"));
|
|
1139
|
-
},
|
|
1139
|
+
}, E = (f) => {
|
|
1140
1140
|
f.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
1141
1141
|
};
|
|
1142
1142
|
return qe([
|
|
@@ -1149,7 +1149,7 @@ function Pn(e) {
|
|
|
1149
1149
|
{ dom: n, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : m },
|
|
1150
1150
|
{ dom: n, evt: "blur", func: p },
|
|
1151
1151
|
{ dom: n, evt: "keydown", func: w },
|
|
1152
|
-
{ dom: n, evt: "keyup", func:
|
|
1152
|
+
{ dom: n, evt: "keyup", func: E }
|
|
1153
1153
|
]);
|
|
1154
1154
|
}
|
|
1155
1155
|
function On() {
|
|
@@ -1176,7 +1176,7 @@ function On() {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
};
|
|
1178
1178
|
}
|
|
1179
|
-
const
|
|
1179
|
+
const A = "http://www.w3.org/2000/svg", re = function(e) {
|
|
1180
1180
|
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
1181
1181
|
let c = s;
|
|
1182
1182
|
l === "middle" ? c = s - t / 2 : l === "end" && (c = s - t), e.style.left = `${c}px`, e.style.top = `${i - n / 2}px`, e.style.visibility = "visible";
|
|
@@ -1186,7 +1186,7 @@ const M = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1186
1186
|
const a = "label-" + c;
|
|
1187
1187
|
return r.id = a, r.innerHTML = e, r.dataset.type = l, r.dataset.svgId = c, r.dataset.x = t.toString(), r.dataset.y = n.toString(), r.dataset.anchor = s, r;
|
|
1188
1188
|
}, it = function(e, t, n) {
|
|
1189
|
-
const o = document.createElementNS(
|
|
1189
|
+
const o = document.createElementNS(A, "path");
|
|
1190
1190
|
return k(o, {
|
|
1191
1191
|
d: e,
|
|
1192
1192
|
stroke: t || "#666",
|
|
@@ -1194,13 +1194,13 @@ const M = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1194
1194
|
"stroke-width": n
|
|
1195
1195
|
}), o;
|
|
1196
1196
|
}, z = function(e) {
|
|
1197
|
-
const t = document.createElementNS(
|
|
1197
|
+
const t = document.createElementNS(A, "svg");
|
|
1198
1198
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
1199
1199
|
}, je = function() {
|
|
1200
|
-
const e = document.createElementNS(
|
|
1200
|
+
const e = document.createElementNS(A, "line");
|
|
1201
1201
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
1202
1202
|
}, Hn = function(e, t, n, o) {
|
|
1203
|
-
const s = document.createElementNS(
|
|
1203
|
+
const s = document.createElementNS(A, "g");
|
|
1204
1204
|
return [
|
|
1205
1205
|
{
|
|
1206
1206
|
name: "line",
|
|
@@ -1215,7 +1215,7 @@ const M = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1215
1215
|
d: n
|
|
1216
1216
|
}
|
|
1217
1217
|
].forEach((l, c) => {
|
|
1218
|
-
const r = l.d, a = document.createElementNS(
|
|
1218
|
+
const r = l.d, a = document.createElementNS(A, "path"), d = {
|
|
1219
1219
|
d: r,
|
|
1220
1220
|
stroke: o?.stroke || "rgb(227, 125, 116)",
|
|
1221
1221
|
fill: "none",
|
|
@@ -1223,7 +1223,7 @@ const M = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1223
1223
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
1224
1224
|
};
|
|
1225
1225
|
o?.opacity !== void 0 && (d.opacity = String(o.opacity)), k(a, d), c === 0 && a.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
1226
|
-
const h = document.createElementNS(
|
|
1226
|
+
const h = document.createElementNS(A, "path");
|
|
1227
1227
|
k(h, {
|
|
1228
1228
|
d: r,
|
|
1229
1229
|
stroke: "transparent",
|
|
@@ -1262,11 +1262,11 @@ const M = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1262
1262
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight, l = this.map.querySelectorAll("me-main > me-wrapper");
|
|
1263
1263
|
this.lines.innerHTML = "";
|
|
1264
1264
|
for (let c = 0; c < l.length; c++) {
|
|
1265
|
-
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } =
|
|
1265
|
+
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = M(this.nodes, a), u = a.offsetWidth, b = a.offsetHeight, v = r.parentNode.className, p = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: h, cL: d, cW: u, cH: b, direction: v, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, m = a.nodeObj.branchColor || g[c % g.length];
|
|
1266
1266
|
if (a.style.borderColor = m, this.lines.appendChild(it(p, m, "3")), e && e !== r)
|
|
1267
1267
|
continue;
|
|
1268
|
-
const w = z("subLines"),
|
|
1269
|
-
|
|
1268
|
+
const w = z("subLines"), E = r.lastChild;
|
|
1269
|
+
E.tagName === "svg" && E.remove(), r.appendChild(w), lt(this, w, m, r, v, !0);
|
|
1270
1270
|
}
|
|
1271
1271
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
1272
1272
|
}, lt = function(e, t, n, o, s, i) {
|
|
@@ -1274,14 +1274,14 @@ const M = "http://www.w3.org/2000/svg", re = function(e) {
|
|
|
1274
1274
|
if (c.length === 0) return;
|
|
1275
1275
|
const r = l.offsetTop, a = l.offsetLeft, d = l.offsetWidth, h = l.offsetHeight;
|
|
1276
1276
|
for (let u = 0; u < c.length; u++) {
|
|
1277
|
-
const b = c[u], v = b.firstChild, p = v.offsetTop, g = v.offsetLeft, m = v.offsetWidth, w = v.offsetHeight,
|
|
1278
|
-
t.appendChild(it(N,
|
|
1277
|
+
const b = c[u], v = b.firstChild, p = v.offsetTop, g = v.offsetLeft, m = v.offsetWidth, w = v.offsetHeight, E = v.firstChild.nodeObj.branchColor || n, N = e.generateSubBranch({ pT: r, pL: a, pW: d, pH: h, cT: p, cL: g, cW: m, cH: w, direction: s, isFirst: i });
|
|
1278
|
+
t.appendChild(it(N, E, "2"));
|
|
1279
1279
|
const f = v.children[1];
|
|
1280
1280
|
if (f) {
|
|
1281
1281
|
if (!f.expanded) continue;
|
|
1282
1282
|
} else
|
|
1283
1283
|
continue;
|
|
1284
|
-
lt(e, t,
|
|
1284
|
+
lt(e, t, E, b, s);
|
|
1285
1285
|
}
|
|
1286
1286
|
}, jn = {
|
|
1287
1287
|
addChild: "Add child",
|
|
@@ -1307,26 +1307,26 @@ function In(e, t) {
|
|
|
1307
1307
|
const o = (y) => {
|
|
1308
1308
|
const x = document.createElement("div");
|
|
1309
1309
|
return x.innerText = y, x.className = "tips", x;
|
|
1310
|
-
}, s = (y, x,
|
|
1311
|
-
const
|
|
1312
|
-
return
|
|
1310
|
+
}, s = (y, x, S) => {
|
|
1311
|
+
const C = document.createElement("li");
|
|
1312
|
+
return C.id = y, C.innerHTML = `<span>${ae(x)}</span><span ${S ? 'class="key"' : ""}>${ae(S)}</span>`, C;
|
|
1313
1313
|
}, i = t.locale, l = s("cm-add_child", i.addChild, "Tab"), c = s("cm-add_parent", i.addParent, "Ctrl + Enter"), r = s("cm-add_sibling", i.addSibling, "Enter"), a = s("cm-remove_child", i.removeNode, "Delete"), d = s("cm-fucus", i.focus, ""), h = s("cm-unfucus", i.cancelFocus, ""), u = s("cm-up", i.moveUp, "PgUp"), b = s("cm-down", i.moveDown, "Pgdn"), v = s("cm-link", i.link, ""), p = s("cm-link-bidirectional", i.linkBidirectional, ""), g = s("cm-summary", i.summary, ""), m = document.createElement("ul");
|
|
1314
1314
|
if (m.className = "menu-list", m.appendChild(l), m.appendChild(c), m.appendChild(r), m.appendChild(a), t.focus && (m.appendChild(d), m.appendChild(h)), m.appendChild(u), m.appendChild(b), m.appendChild(g), t.link && (m.appendChild(v), m.appendChild(p)), t && t.extend)
|
|
1315
1315
|
for (let y = 0; y < t.extend.length; y++) {
|
|
1316
|
-
const x = t.extend[y],
|
|
1317
|
-
m.appendChild(
|
|
1318
|
-
x.onclick(
|
|
1316
|
+
const x = t.extend[y], S = s(x.name, x.name, x.key || "");
|
|
1317
|
+
m.appendChild(S), S.onclick = (C) => {
|
|
1318
|
+
x.onclick(C);
|
|
1319
1319
|
};
|
|
1320
1320
|
}
|
|
1321
1321
|
const w = document.createElement("div");
|
|
1322
1322
|
w.className = "context-menu", w.appendChild(m), w.hidden = !0, e.container.append(w);
|
|
1323
|
-
let
|
|
1323
|
+
let E = !0;
|
|
1324
1324
|
const N = (y) => {
|
|
1325
1325
|
const x = y.target;
|
|
1326
1326
|
if (te(x)) {
|
|
1327
|
-
x.parentElement.tagName === "ME-ROOT" ?
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1327
|
+
x.parentElement.tagName === "ME-ROOT" ? E = !0 : E = !1, E ? (d.className = "disabled", u.className = "disabled", b.className = "disabled", c.className = "disabled", r.className = "disabled", a.className = "disabled") : (d.className = "", u.className = "", b.className = "", c.className = "", r.className = "", a.className = ""), w.hidden = !1, m.style.top = "", m.style.bottom = "", m.style.left = "", m.style.right = "";
|
|
1328
|
+
const S = m.offsetHeight, C = m.offsetWidth, T = m.getBoundingClientRect(), D = y.clientY - T.top, L = y.clientX - T.left;
|
|
1329
|
+
S + D > window.innerHeight ? (m.style.top = "", m.style.bottom = "0px") : (m.style.bottom = "", m.style.top = D + 15 + "px"), C + L > window.innerWidth ? (m.style.left = "", m.style.right = "0px") : (m.style.right = "", m.style.left = L + 10 + "px");
|
|
1330
1330
|
}
|
|
1331
1331
|
};
|
|
1332
1332
|
e.bus.addListener("showContextMenu", N), w.onclick = (y) => {
|
|
@@ -1336,26 +1336,26 @@ function In(e, t) {
|
|
|
1336
1336
|
}, c.onclick = () => {
|
|
1337
1337
|
e.insertParent(), w.hidden = !0;
|
|
1338
1338
|
}, r.onclick = () => {
|
|
1339
|
-
|
|
1339
|
+
E || (e.insertSibling("after"), w.hidden = !0);
|
|
1340
1340
|
}, a.onclick = () => {
|
|
1341
|
-
|
|
1341
|
+
E || (e.removeNodes(e.currentNodes || []), w.hidden = !0);
|
|
1342
1342
|
}, d.onclick = () => {
|
|
1343
|
-
|
|
1343
|
+
E || (e.focusNode(e.currentNode), w.hidden = !0);
|
|
1344
1344
|
}, h.onclick = () => {
|
|
1345
1345
|
e.cancelFocus(), w.hidden = !0;
|
|
1346
1346
|
}, u.onclick = () => {
|
|
1347
|
-
|
|
1347
|
+
E || (e.moveUpNode(), w.hidden = !0);
|
|
1348
1348
|
}, b.onclick = () => {
|
|
1349
|
-
|
|
1349
|
+
E || (e.moveDownNode(), w.hidden = !0);
|
|
1350
1350
|
};
|
|
1351
1351
|
const f = (y) => {
|
|
1352
1352
|
w.hidden = !0;
|
|
1353
|
-
const x = e.currentNode,
|
|
1354
|
-
e.container.appendChild(
|
|
1353
|
+
const x = e.currentNode, S = o(i.clickTips);
|
|
1354
|
+
e.container.appendChild(S), e.map.addEventListener(
|
|
1355
1355
|
"click",
|
|
1356
|
-
(
|
|
1357
|
-
|
|
1358
|
-
const T =
|
|
1356
|
+
(C) => {
|
|
1357
|
+
C.preventDefault(), S.remove();
|
|
1358
|
+
const T = C.target;
|
|
1359
1359
|
(T.parentElement.tagName === "ME-PARENT" || T.parentElement.tagName === "ME-ROOT") && e.createArrow(x, T, y);
|
|
1360
1360
|
},
|
|
1361
1361
|
{
|
|
@@ -1543,7 +1543,7 @@ const Ie = (e, t = "px") => typeof e == "number" ? e + t : e, $ = ({ style: e },
|
|
|
1543
1543
|
if (i)
|
|
1544
1544
|
for (const l of n)
|
|
1545
1545
|
i[e](l, o, { capture: !1, ...s });
|
|
1546
|
-
}, W = ct("addEventListener"),
|
|
1546
|
+
}, W = ct("addEventListener"), O = ct("removeEventListener"), J = (e) => {
|
|
1547
1547
|
const { clientX: t, clientY: n, target: o } = e.touches?.[0] ?? e;
|
|
1548
1548
|
return { x: t, y: n, target: o };
|
|
1549
1549
|
}, Y = (e, t = document) => he(e).map((n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null).flat().filter(Boolean), no = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
@@ -1649,7 +1649,7 @@ class oo extends Zn {
|
|
|
1649
1649
|
}
|
|
1650
1650
|
_toggleStartEvents(t = !0) {
|
|
1651
1651
|
const { document: n } = this._options;
|
|
1652
|
-
(t ? W :
|
|
1652
|
+
(t ? W : O)(n, "pointerdown", this._onTapStart);
|
|
1653
1653
|
}
|
|
1654
1654
|
_onTapStart(t, n = !1) {
|
|
1655
1655
|
const { x: o, y: s, target: i } = J(t), { document: l, startAreas: c, boundaries: r, behaviour: a, features: d } = this._options, h = i.getBoundingClientRect();
|
|
@@ -1710,8 +1710,8 @@ class oo extends Zn {
|
|
|
1710
1710
|
typeof s == "number" && j(c + r - (i + l)) >= s || // Different x and y threshold
|
|
1711
1711
|
typeof s == "object" && j(c - i) >= s.x || j(r - l) >= s.y
|
|
1712
1712
|
) {
|
|
1713
|
-
if (
|
|
1714
|
-
|
|
1713
|
+
if (O(o, ["pointermove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1714
|
+
O(o, ["pointerup", "pointercancel"], this._onTapStop);
|
|
1715
1715
|
return;
|
|
1716
1716
|
}
|
|
1717
1717
|
W(o, ["pointermove"], this._onTapMove, { passive: !1 }), $(this._area, "display", "block"), Y(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 && (this._selectables = this._selectables.filter((a) => this._targetElement.contains(a))), this._setupSelectionArea(), this._emitEvent("start", t), this._onTapMove(t);
|
|
@@ -1771,7 +1771,7 @@ class oo extends Zn {
|
|
|
1771
1771
|
this._areaLocation.x1 += t.x - s, this._areaLocation.y1 += t.y - o, t.x = s, t.y = o, this._setupSelectionArea(), this._frame.next(null);
|
|
1772
1772
|
}
|
|
1773
1773
|
_onStartAreaScroll() {
|
|
1774
|
-
this._targetBoundaryScrolled = !0,
|
|
1774
|
+
this._targetBoundaryScrolled = !0, O(this._targetElement, "scroll", this._onStartAreaScroll);
|
|
1775
1775
|
}
|
|
1776
1776
|
_recalculateSelectionAreaRect() {
|
|
1777
1777
|
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, i = this._targetRect, { x1: l, y1: c } = n;
|
|
@@ -1791,7 +1791,7 @@ class oo extends Zn {
|
|
|
1791
1791
|
}
|
|
1792
1792
|
_onTapStop(t, n) {
|
|
1793
1793
|
const { document: o, features: s } = this._options, { _singleClick: i } = this;
|
|
1794
|
-
|
|
1794
|
+
O(this._targetElement, "scroll", this._onStartAreaScroll), O(o, ["pointermove"], this._delayedTapMove), O(o, ["pointermove"], this._onTapMove), O(o, ["pointerup", "pointercancel"], this._onTapStop), O(o, "scroll", this._onScroll), this._keepSelection(), t && i && s.singleTap.allow ? this._onSingleTap(t) : !i && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, this._clippingElement.remove(), this._frame?.cancel(), $(this._area, "display", "none");
|
|
1795
1795
|
}
|
|
1796
1796
|
_updateElementSelection() {
|
|
1797
1797
|
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: c } = o, { intersect: r, overlap: a } = n.behaviour, d = a === "invert", h = [], u = [], b = [];
|
|
@@ -2018,13 +2018,17 @@ const io = function(e, t = !0) {
|
|
|
2018
2018
|
const o = {
|
|
2019
2019
|
...(e.type === "dark" ? ue : fe).cssVar,
|
|
2020
2020
|
...e.cssVar
|
|
2021
|
-
}
|
|
2021
|
+
};
|
|
2022
|
+
this.compact && (o["--node-gap-x"] = "15px", o["--node-gap-y"] = "2px", o["--main-gap-x"] = "30px", o["--main-gap-y"] = "6px");
|
|
2023
|
+
const s = Object.keys(o);
|
|
2022
2024
|
for (let i = 0; i < s.length; i++) {
|
|
2023
2025
|
const l = s[i];
|
|
2024
2026
|
this.container.style.setProperty(l, o[l]);
|
|
2025
2027
|
}
|
|
2026
2028
|
t && this.refresh();
|
|
2027
2029
|
}, ro = function(e) {
|
|
2030
|
+
this.compact = e, this.theme && this.changeTheme(this.theme);
|
|
2031
|
+
}, lo = function(e) {
|
|
2028
2032
|
return {
|
|
2029
2033
|
dom: e,
|
|
2030
2034
|
moved: !1,
|
|
@@ -2060,7 +2064,7 @@ const io = function(e, t = !0) {
|
|
|
2060
2064
|
}
|
|
2061
2065
|
};
|
|
2062
2066
|
}, Ke = {
|
|
2063
|
-
create:
|
|
2067
|
+
create: lo
|
|
2064
2068
|
}, at = "#4dc4ff";
|
|
2065
2069
|
function dt(e, t, n, o, s, i, l, c) {
|
|
2066
2070
|
return {
|
|
@@ -2068,7 +2072,7 @@ function dt(e, t, n, o, s, i, l, c) {
|
|
|
2068
2072
|
y: t / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
2069
2073
|
};
|
|
2070
2074
|
}
|
|
2071
|
-
function
|
|
2075
|
+
function co(e, t, n) {
|
|
2072
2076
|
e && (e.dataset.x = t.toString(), e.dataset.y = n.toString(), re(e));
|
|
2073
2077
|
}
|
|
2074
2078
|
function Z(e, t, n, o, s) {
|
|
@@ -2106,14 +2110,14 @@ function Ve(e, t, n, o, s, i, l, c, r, a) {
|
|
|
2106
2110
|
}
|
|
2107
2111
|
}
|
|
2108
2112
|
const { x: b, y: v } = dt(t, n, o, s, i, l, c, r);
|
|
2109
|
-
if (e.labelEl &&
|
|
2113
|
+
if (e.labelEl && co(e.labelEl, b, v), a.style?.labelColor) {
|
|
2110
2114
|
const p = e.labelEl;
|
|
2111
2115
|
p && (p.style.color = a.style.labelColor);
|
|
2112
2116
|
}
|
|
2113
|
-
|
|
2117
|
+
yo(e);
|
|
2114
2118
|
}
|
|
2115
2119
|
function se(e, t, n) {
|
|
2116
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
2120
|
+
const { offsetLeft: o, offsetTop: s } = M(e.nodes, t), i = t.offsetWidth, l = t.offsetHeight, c = o + i / 2, r = s + l / 2, a = c + n.x, d = r + n.y;
|
|
2117
2121
|
return {
|
|
2118
2122
|
w: i,
|
|
2119
2123
|
h: l,
|
|
@@ -2131,21 +2135,21 @@ function X(e) {
|
|
|
2131
2135
|
y: n
|
|
2132
2136
|
};
|
|
2133
2137
|
}
|
|
2134
|
-
const
|
|
2135
|
-
const o =
|
|
2138
|
+
const ao = function(e, t, n) {
|
|
2139
|
+
const o = M(e.nodes, t), s = M(e.nodes, n), i = o.offsetLeft + t.offsetWidth / 2, l = o.offsetTop + t.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, r = s.offsetTop + n.offsetHeight / 2, a = c - i, d = r - l, h = Math.sqrt(a * a + d * d), u = Math.max(50, Math.min(200, h * 0.3)), b = Math.abs(a), v = Math.abs(d);
|
|
2136
2140
|
let p, g;
|
|
2137
2141
|
if (h < 150) {
|
|
2138
2142
|
const w = t.closest("me-main").className === "lhs" ? -1 : 1;
|
|
2139
2143
|
p = { x: 200 * w, y: 0 }, g = { x: 200 * w, y: 0 };
|
|
2140
2144
|
} else if (b > v * 1.5) {
|
|
2141
|
-
const w = a > 0 ? t.offsetWidth / 2 : -t.offsetWidth / 2,
|
|
2142
|
-
p = { x: w + (a > 0 ? u : -u), y: 0 }, g = { x:
|
|
2145
|
+
const w = a > 0 ? t.offsetWidth / 2 : -t.offsetWidth / 2, E = a > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
|
|
2146
|
+
p = { x: w + (a > 0 ? u : -u), y: 0 }, g = { x: E + (a > 0 ? -u : u), y: 0 };
|
|
2143
2147
|
} else if (v > b * 1.5) {
|
|
2144
|
-
const w = d > 0 ? t.offsetHeight / 2 : -t.offsetHeight / 2,
|
|
2145
|
-
p = { x: 0, y: w + (d > 0 ? u : -u) }, g = { x: 0, y:
|
|
2148
|
+
const w = d > 0 ? t.offsetHeight / 2 : -t.offsetHeight / 2, E = d > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
2149
|
+
p = { x: 0, y: w + (d > 0 ? u : -u) }, g = { x: 0, y: E + (d > 0 ? -u : u) };
|
|
2146
2150
|
} else {
|
|
2147
|
-
const w = Math.atan2(d, a),
|
|
2148
|
-
p = { x:
|
|
2151
|
+
const w = Math.atan2(d, a), E = t.offsetWidth / 2 * Math.cos(w), N = t.offsetHeight / 2 * Math.sin(w), f = -(n.offsetWidth / 2) * Math.cos(w), y = -(n.offsetHeight / 2) * Math.sin(w), x = u * 0.7 * (a > 0 ? 1 : -1), S = u * 0.7 * (d > 0 ? 1 : -1);
|
|
2152
|
+
p = { x: E + x, y: N + S }, g = { x: f - x, y: y - S };
|
|
2149
2153
|
}
|
|
2150
2154
|
return {
|
|
2151
2155
|
delta1: { x: Math.round(p.x), y: Math.round(p.y) },
|
|
@@ -2155,28 +2159,28 @@ const co = function(e, t, n) {
|
|
|
2155
2159
|
if (!t || !n)
|
|
2156
2160
|
return;
|
|
2157
2161
|
if (!o.delta1 || !o.delta2) {
|
|
2158
|
-
const
|
|
2159
|
-
o.delta1 =
|
|
2162
|
+
const C = ao(e, t, n);
|
|
2163
|
+
o.delta1 = C.delta1, o.delta2 = C.delta2;
|
|
2160
2164
|
}
|
|
2161
2165
|
const i = se(e, t, o.delta1), l = se(e, n, o.delta2), { x: c, y: r } = X(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: b, y: v } = X(l), p = oe(h, u, b, v);
|
|
2162
2166
|
if (!p) return;
|
|
2163
2167
|
const g = `M ${p.x1} ${p.y1} L ${b} ${v} L ${p.x2} ${p.y2}`;
|
|
2164
2168
|
let m = "";
|
|
2165
2169
|
if (o.bidirectional) {
|
|
2166
|
-
const
|
|
2167
|
-
if (!
|
|
2168
|
-
m = `M ${
|
|
2170
|
+
const C = oe(a, d, c, r);
|
|
2171
|
+
if (!C) return;
|
|
2172
|
+
m = `M ${C.x1} ${C.y1} L ${c} ${r} L ${C.x2} ${C.y2}`;
|
|
2169
2173
|
}
|
|
2170
|
-
const w = Hn(`M ${c} ${r} C ${a} ${d} ${h} ${u} ${b} ${v}`, g, m, o.style), { x:
|
|
2174
|
+
const w = Hn(`M ${c} ${r} C ${a} ${d} ${h} ${u} ${b} ${v}`, g, m, o.style), { x: E, y: N } = dt(c, r, a, d, h, u, b, v), f = o.style?.labelColor || "rgb(235, 95, 82)", y = "a-" + o.id;
|
|
2171
2175
|
w.id = y;
|
|
2172
|
-
const x = e.markdown ? e.markdown(o.label, o) : o.label,
|
|
2176
|
+
const x = e.markdown ? e.markdown(o.label, o) : o.label, S = de(x, E, N, {
|
|
2173
2177
|
anchor: "middle",
|
|
2174
2178
|
color: f,
|
|
2175
2179
|
dataType: "arrow",
|
|
2176
2180
|
svgId: y
|
|
2177
2181
|
});
|
|
2178
|
-
w.labelEl =
|
|
2179
|
-
},
|
|
2182
|
+
w.labelEl = S, w.arrowObj = o, w.dataset.linkid = o.id, e.labelContainer.appendChild(S), e.arrowSvg.appendChild(w), re(S), s || (e.arrows.push(o), e.currentArrow = w, ft(e, o, i, l));
|
|
2183
|
+
}, ho = function(e, t, n = {}) {
|
|
2180
2184
|
const o = {
|
|
2181
2185
|
id: B(),
|
|
2182
2186
|
label: "Custom Link",
|
|
@@ -2188,14 +2192,14 @@ const co = function(e, t, n) {
|
|
|
2188
2192
|
name: "createArrow",
|
|
2189
2193
|
obj: o
|
|
2190
2194
|
});
|
|
2191
|
-
},
|
|
2195
|
+
}, fo = function(e) {
|
|
2192
2196
|
le(this);
|
|
2193
2197
|
const t = { ...e, id: B() };
|
|
2194
2198
|
Se(this, this.findEle(t.from), this.findEle(t.to), t), this.bus.fire("operation", {
|
|
2195
2199
|
name: "createArrow",
|
|
2196
2200
|
obj: t
|
|
2197
2201
|
});
|
|
2198
|
-
},
|
|
2202
|
+
}, uo = function(e) {
|
|
2199
2203
|
let t;
|
|
2200
2204
|
if (e ? t = e : t = this.currentArrow, !t) return;
|
|
2201
2205
|
le(this);
|
|
@@ -2206,14 +2210,14 @@ const co = function(e, t, n) {
|
|
|
2206
2210
|
id: n
|
|
2207
2211
|
}
|
|
2208
2212
|
});
|
|
2209
|
-
},
|
|
2213
|
+
}, po = function(e) {
|
|
2210
2214
|
this.currentArrow = e;
|
|
2211
2215
|
const t = e.arrowObj, n = this.findEle(t.from), o = this.findEle(t.to), s = se(this, n, t.delta1), i = se(this, o, t.delta2);
|
|
2212
2216
|
this.editable ? ft(this, t, s, i) : ht(e, at), this.bus.fire("selectArrow", t);
|
|
2213
|
-
},
|
|
2217
|
+
}, go = function() {
|
|
2214
2218
|
le(this), this.currentArrow = null, this.bus.fire("unselectArrow");
|
|
2215
2219
|
}, ce = function(e, t) {
|
|
2216
|
-
const n = document.createElementNS(
|
|
2220
|
+
const n = document.createElementNS(A, "path");
|
|
2217
2221
|
return k(n, {
|
|
2218
2222
|
d: e,
|
|
2219
2223
|
stroke: t,
|
|
@@ -2223,7 +2227,7 @@ const co = function(e, t, n) {
|
|
|
2223
2227
|
"stroke-linejoin": "round"
|
|
2224
2228
|
}), n;
|
|
2225
2229
|
}, ht = function(e, t) {
|
|
2226
|
-
const n = document.createElementNS(
|
|
2230
|
+
const n = document.createElementNS(A, "g");
|
|
2227
2231
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
2228
2232
|
const o = ce(e.line.getAttribute("d"), t);
|
|
2229
2233
|
n.appendChild(o);
|
|
@@ -2233,32 +2237,32 @@ const co = function(e, t, n) {
|
|
|
2233
2237
|
n.appendChild(i);
|
|
2234
2238
|
}
|
|
2235
2239
|
e.insertBefore(n, e.firstChild);
|
|
2236
|
-
},
|
|
2240
|
+
}, mo = function(e) {
|
|
2237
2241
|
const t = e.querySelector(".arrow-highlight");
|
|
2238
2242
|
t && t.remove();
|
|
2239
|
-
},
|
|
2243
|
+
}, yo = function(e) {
|
|
2240
2244
|
const t = e.querySelector(".arrow-highlight");
|
|
2241
2245
|
if (!t) return;
|
|
2242
2246
|
const n = t.querySelectorAll("path");
|
|
2243
2247
|
n.length >= 1 && n[0].setAttribute("d", e.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", e.arrow1.getAttribute("d")), n.length >= 3 && e.arrow2.getAttribute("d") && n[2].setAttribute("d", e.arrow2.getAttribute("d"));
|
|
2244
2248
|
}, le = function(e) {
|
|
2245
|
-
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow &&
|
|
2249
|
+
e.helper1?.destroy(), e.helper2?.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && mo(e.currentArrow);
|
|
2246
2250
|
}, ft = function(e, t, n, o) {
|
|
2247
2251
|
const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map: d, currentArrow: h, bus: u } = e;
|
|
2248
2252
|
if (!h) return;
|
|
2249
2253
|
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), ht(h, at);
|
|
2250
|
-
let { x: b, y: v } = X(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: m, ctrlY: w } = o, { x:
|
|
2251
|
-
i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${w}px;left:${m}px;`, Z(c, b, v, p, g), Z(r, m, w,
|
|
2254
|
+
let { x: b, y: v } = X(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: m, ctrlY: w } = o, { x: E, y: N } = X(o);
|
|
2255
|
+
i.style.cssText = `top:${g}px;left:${p}px;`, l.style.cssText = `top:${w}px;left:${m}px;`, Z(c, b, v, p, g), Z(r, m, w, E, N), e.helper1 = Ke.create(i), e.helper2 = Ke.create(l), e.helper1.init(d, (f, y) => {
|
|
2252
2256
|
p = p + f / e.scaleVal, g = g + y / e.scaleVal;
|
|
2253
2257
|
const x = X({ ...n, ctrlX: p, ctrlY: g });
|
|
2254
|
-
b = x.x, v = x.y, i.style.top = g + "px", i.style.left = p + "px", Ve(h, b, v, p, g, m, w,
|
|
2258
|
+
b = x.x, v = x.y, i.style.top = g + "px", i.style.left = p + "px", Ve(h, b, v, p, g, m, w, E, N, t), Z(c, b, v, p, g), t.delta1.x = Math.round(p - n.cx), t.delta1.y = Math.round(g - n.cy), u.fire("updateArrowDelta", t);
|
|
2255
2259
|
}), e.helper2.init(d, (f, y) => {
|
|
2256
2260
|
m = m + f / e.scaleVal, w = w + y / e.scaleVal;
|
|
2257
2261
|
const x = X({ ...o, ctrlX: m, ctrlY: w });
|
|
2258
|
-
|
|
2262
|
+
E = x.x, N = x.y, l.style.top = w + "px", l.style.left = m + "px", Ve(h, b, v, p, g, m, w, E, N, t), Z(r, m, w, E, N), t.delta2.x = Math.round(m - o.cx), t.delta2.y = Math.round(w - o.cy), u.fire("updateArrowDelta", t);
|
|
2259
2263
|
});
|
|
2260
2264
|
};
|
|
2261
|
-
function
|
|
2265
|
+
function bo() {
|
|
2262
2266
|
this.arrowSvg.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((t) => t.remove());
|
|
2263
2267
|
for (let t = 0; t < this.arrows.length; t++) {
|
|
2264
2268
|
const n = this.arrows[t];
|
|
@@ -2269,23 +2273,23 @@ function yo() {
|
|
|
2269
2273
|
}
|
|
2270
2274
|
this.nodes.appendChild(this.arrowSvg);
|
|
2271
2275
|
}
|
|
2272
|
-
function
|
|
2276
|
+
function vo(e) {
|
|
2273
2277
|
le(this), e && e.labelEl && rt(this, e.labelEl, e.arrowObj);
|
|
2274
2278
|
}
|
|
2275
|
-
function
|
|
2279
|
+
function wo() {
|
|
2276
2280
|
this.arrows = this.arrows.filter((e) => ne(e.from, this.nodeData) && ne(e.to, this.nodeData));
|
|
2277
2281
|
}
|
|
2278
|
-
const
|
|
2282
|
+
const xo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2279
2283
|
__proto__: null,
|
|
2280
|
-
createArrow:
|
|
2281
|
-
createArrowFrom:
|
|
2282
|
-
editArrowLabel:
|
|
2283
|
-
removeArrow:
|
|
2284
|
-
renderArrow:
|
|
2285
|
-
selectArrow:
|
|
2286
|
-
tidyArrow:
|
|
2287
|
-
unselectArrow:
|
|
2288
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2284
|
+
createArrow: ho,
|
|
2285
|
+
createArrowFrom: fo,
|
|
2286
|
+
editArrowLabel: vo,
|
|
2287
|
+
removeArrow: uo,
|
|
2288
|
+
renderArrow: bo,
|
|
2289
|
+
selectArrow: po,
|
|
2290
|
+
tidyArrow: wo,
|
|
2291
|
+
unselectArrow: go
|
|
2292
|
+
}, Symbol.toStringTag, { value: "Module" })), Eo = function(e) {
|
|
2289
2293
|
if (e.length === 0) throw new Error("No selected node.");
|
|
2290
2294
|
if (e.length === 1) {
|
|
2291
2295
|
const r = e[0].nodeObj, a = e[0].nodeObj.parent;
|
|
@@ -2322,11 +2326,11 @@ const wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2322
2326
|
start: i,
|
|
2323
2327
|
end: l
|
|
2324
2328
|
};
|
|
2325
|
-
},
|
|
2326
|
-
const t = document.createElementNS(
|
|
2329
|
+
}, Co = function(e) {
|
|
2330
|
+
const t = document.createElementNS(A, "g");
|
|
2327
2331
|
return t.setAttribute("id", e), t;
|
|
2328
2332
|
}, ze = function(e, t) {
|
|
2329
|
-
const n = document.createElementNS(
|
|
2333
|
+
const n = document.createElementNS(A, "path");
|
|
2330
2334
|
return k(n, {
|
|
2331
2335
|
d: e,
|
|
2332
2336
|
stroke: t || "#666",
|
|
@@ -2334,89 +2338,89 @@ const wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2334
2338
|
"stroke-linecap": "round",
|
|
2335
2339
|
"stroke-width": "2"
|
|
2336
2340
|
}), n;
|
|
2337
|
-
},
|
|
2341
|
+
}, So = (e) => e.parentElement.parentElement, No = function(e, { parent: t, start: n }) {
|
|
2338
2342
|
const o = e.findEle(t), s = o.nodeObj;
|
|
2339
2343
|
let i;
|
|
2340
2344
|
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2341
2345
|
}, Ne = function(e, t) {
|
|
2342
|
-
const { id: n, label: o, parent: s, start: i, end: l, style: c } = t, { nodes: r, theme: a, summarySvg: d } = e, u = e.findEle(s).nodeObj, b =
|
|
2346
|
+
const { id: n, label: o, parent: s, start: i, end: l, style: c } = t, { nodes: r, theme: a, summarySvg: d } = e, u = e.findEle(s).nodeObj, b = No(e, t);
|
|
2343
2347
|
let v = 1 / 0, p = 0, g = 0, m = 0;
|
|
2344
2348
|
for (let V = i; V <= l; V++) {
|
|
2345
2349
|
const Te = u.children?.[V];
|
|
2346
2350
|
if (!Te)
|
|
2347
2351
|
return e.removeSummary(n), null;
|
|
2348
|
-
const q =
|
|
2352
|
+
const q = So(e.findEle(Te.id)), { offsetLeft: U, offsetTop: ke } = M(r, q), _e = i === l ? 10 : 20;
|
|
2349
2353
|
V === i && (g = ke + _e), V === l && (m = ke + q.offsetHeight - _e), U < v && (v = U), q.offsetWidth + U > p && (p = q.offsetWidth + U);
|
|
2350
2354
|
}
|
|
2351
|
-
let w,
|
|
2352
|
-
const N = u.parent ? 10 : 0, f = g + N, y = m + N, x = (f + y) / 2,
|
|
2353
|
-
b ===
|
|
2354
|
-
const
|
|
2355
|
-
return
|
|
2356
|
-
},
|
|
2355
|
+
let w, E;
|
|
2356
|
+
const N = u.parent ? 10 : 0, f = g + N, y = m + N, x = (f + y) / 2, S = c?.stroke || a.cssVar["--color"], C = c?.labelColor || a.cssVar["--color"], T = "s-" + n, D = e.markdown ? e.markdown(o, t) : o;
|
|
2357
|
+
b === H.LHS ? (w = ze(`M ${v + 10} ${f} c -5 0 -10 5 -10 10 L ${v} ${y - 10} c 0 5 5 10 10 10 M ${v} ${x} h -10`, S), E = de(D, v - 20, x, { anchor: "end", color: C, dataType: "summary", svgId: T })) : (w = ze(`M ${p - 10} ${f} c 5 0 10 5 10 10 L ${p} ${y - 10} c 0 5 -5 10 -10 10 M ${p} ${x} h 10`, S), E = de(D, p + 20, x, { anchor: "start", color: C, dataType: "summary", svgId: T }));
|
|
2358
|
+
const L = Co(T);
|
|
2359
|
+
return L.appendChild(w), e.labelContainer.appendChild(E), re(E), L.summaryObj = t, L.labelEl = E, d.appendChild(L), L;
|
|
2360
|
+
}, To = function(e = {}) {
|
|
2357
2361
|
if (!this.currentNodes) return;
|
|
2358
|
-
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } =
|
|
2362
|
+
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = Eo(t), c = { id: B(), parent: s, start: i, end: l, label: "summary", style: e.style }, r = Ne(this, c);
|
|
2359
2363
|
n.push(c), this.editSummary(r), o.fire("operation", {
|
|
2360
2364
|
name: "createSummary",
|
|
2361
2365
|
obj: c
|
|
2362
2366
|
});
|
|
2363
|
-
},
|
|
2367
|
+
}, ko = function(e) {
|
|
2364
2368
|
const t = B(), n = { ...e, id: t };
|
|
2365
2369
|
Ne(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
2366
2370
|
name: "createSummary",
|
|
2367
2371
|
obj: n
|
|
2368
2372
|
});
|
|
2369
|
-
},
|
|
2373
|
+
}, _o = function(e) {
|
|
2370
2374
|
const t = this.summaries.findIndex((n) => n.id === e);
|
|
2371
2375
|
t > -1 && (this.summaries.splice(t, 1), this.nodes.querySelector("#s-" + e)?.remove(), this.nodes.querySelector("#label-s-" + e)?.remove()), this.bus.fire("operation", {
|
|
2372
2376
|
name: "removeSummary",
|
|
2373
2377
|
obj: { id: e }
|
|
2374
2378
|
});
|
|
2375
|
-
},
|
|
2379
|
+
}, Do = function(e) {
|
|
2376
2380
|
const t = e.labelEl;
|
|
2377
2381
|
t && t.classList.add("selected"), this.currentSummary = e, this.bus.fire("selectSummary", e.summaryObj);
|
|
2378
|
-
}, Do = function() {
|
|
2379
|
-
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
2380
2382
|
}, Lo = function() {
|
|
2383
|
+
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null, this.bus.fire("unselectSummary");
|
|
2384
|
+
}, Mo = function() {
|
|
2381
2385
|
this.summarySvg.innerHTML = "", this.summaries.forEach((e) => {
|
|
2382
2386
|
try {
|
|
2383
2387
|
Ne(this, e);
|
|
2384
2388
|
} catch {
|
|
2385
2389
|
}
|
|
2386
2390
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
2387
|
-
},
|
|
2391
|
+
}, Ao = function(e) {
|
|
2388
2392
|
e && e.labelEl && rt(this, e.labelEl, e.summaryObj);
|
|
2389
|
-
},
|
|
2393
|
+
}, Po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2390
2394
|
__proto__: null,
|
|
2391
|
-
createSummary:
|
|
2392
|
-
createSummaryFrom:
|
|
2393
|
-
editSummary:
|
|
2394
|
-
removeSummary:
|
|
2395
|
-
renderSummary:
|
|
2396
|
-
selectSummary:
|
|
2397
|
-
unselectSummary:
|
|
2398
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2399
|
-
function
|
|
2400
|
-
const n = document.createElementNS(
|
|
2395
|
+
createSummary: To,
|
|
2396
|
+
createSummaryFrom: ko,
|
|
2397
|
+
editSummary: Ao,
|
|
2398
|
+
removeSummary: _o,
|
|
2399
|
+
renderSummary: Mo,
|
|
2400
|
+
selectSummary: Do,
|
|
2401
|
+
unselectSummary: Lo
|
|
2402
|
+
}, Symbol.toStringTag, { value: "Module" })), _ = "http://www.w3.org/2000/svg";
|
|
2403
|
+
function Oo(e, t) {
|
|
2404
|
+
const n = document.createElementNS(_, "svg");
|
|
2401
2405
|
return k(n, {
|
|
2402
2406
|
version: "1.1",
|
|
2403
|
-
xmlns:
|
|
2407
|
+
xmlns: _,
|
|
2404
2408
|
height: e,
|
|
2405
2409
|
width: t
|
|
2406
2410
|
}), n;
|
|
2407
2411
|
}
|
|
2408
|
-
function
|
|
2412
|
+
function Ho(e, t) {
|
|
2409
2413
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2410
2414
|
}
|
|
2411
|
-
function
|
|
2412
|
-
const s = document.createElementNS(
|
|
2415
|
+
function $o(e, t, n, o) {
|
|
2416
|
+
const s = document.createElementNS(_, "g");
|
|
2413
2417
|
let i = "";
|
|
2414
2418
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2415
2419
|
`).forEach((c, r) => {
|
|
2416
|
-
const a = document.createElementNS(
|
|
2420
|
+
const a = document.createElementNS(_, "text");
|
|
2417
2421
|
k(a, {
|
|
2418
2422
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2419
|
-
y: o + parseInt(t.paddingTop) +
|
|
2423
|
+
y: o + parseInt(t.paddingTop) + Ho(t.lineHeight, t.fontSize) * (r + 1) + parseFloat(t.fontSize) * (r + 1) + "",
|
|
2420
2424
|
"text-anchor": "start",
|
|
2421
2425
|
"font-family": t.fontFamily,
|
|
2422
2426
|
"font-size": `${t.fontSize}`,
|
|
@@ -2425,10 +2429,10 @@ function Ho(e, t, n, o) {
|
|
|
2425
2429
|
}), a.innerHTML = c, s.appendChild(a);
|
|
2426
2430
|
}), s;
|
|
2427
2431
|
}
|
|
2428
|
-
function
|
|
2432
|
+
function jo(e, t, n, o) {
|
|
2429
2433
|
let s = "";
|
|
2430
2434
|
e.nodeObj?.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2431
|
-
const i = document.createElementNS(
|
|
2435
|
+
const i = document.createElementNS(_, "foreignObject");
|
|
2432
2436
|
k(i, {
|
|
2433
2437
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2434
2438
|
y: o + parseInt(t.paddingTop) + "",
|
|
@@ -2441,8 +2445,8 @@ function $o(e, t, n, o) {
|
|
|
2441
2445
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
2442
2446
|
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2443
2447
|
}
|
|
2444
|
-
function
|
|
2445
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2448
|
+
function Io(e, t) {
|
|
2449
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = M(e.nodes, t), i = document.createElementNS(_, "rect");
|
|
2446
2450
|
return k(i, {
|
|
2447
2451
|
x: o + "",
|
|
2448
2452
|
y: s + "",
|
|
@@ -2456,7 +2460,7 @@ function jo(e, t) {
|
|
|
2456
2460
|
}), i;
|
|
2457
2461
|
}
|
|
2458
2462
|
function Q(e, t, n = !1) {
|
|
2459
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
2463
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = M(e.nodes, t), l = document.createElementNS(_, "rect");
|
|
2460
2464
|
k(l, {
|
|
2461
2465
|
x: s + "",
|
|
2462
2466
|
y: i + "",
|
|
@@ -2468,13 +2472,13 @@ function Q(e, t, n = !1) {
|
|
|
2468
2472
|
stroke: o.borderColor,
|
|
2469
2473
|
"stroke-width": o.borderWidth
|
|
2470
2474
|
});
|
|
2471
|
-
const c = document.createElementNS(
|
|
2475
|
+
const c = document.createElementNS(_, "g");
|
|
2472
2476
|
c.appendChild(l);
|
|
2473
2477
|
let r;
|
|
2474
|
-
return n ? r =
|
|
2478
|
+
return n ? r = jo(t, o, s, i) : r = $o(t, o, s, i), c.appendChild(r), c;
|
|
2475
2479
|
}
|
|
2476
|
-
function
|
|
2477
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2480
|
+
function Ro(e, t) {
|
|
2481
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = M(e.nodes, t), i = document.createElementNS(_, "a"), l = document.createElementNS(_, "text");
|
|
2478
2482
|
return k(l, {
|
|
2479
2483
|
x: o + "",
|
|
2480
2484
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -2485,8 +2489,8 @@ function Io(e, t) {
|
|
|
2485
2489
|
fill: `${n.color}`
|
|
2486
2490
|
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2487
2491
|
}
|
|
2488
|
-
function
|
|
2489
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
2492
|
+
function Bo(e, t) {
|
|
2493
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = M(e.nodes, t), i = document.createElementNS(_, "image");
|
|
2490
2494
|
return k(i, {
|
|
2491
2495
|
x: o + "",
|
|
2492
2496
|
y: s + "",
|
|
@@ -2495,8 +2499,8 @@ function Ro(e, t) {
|
|
|
2495
2499
|
href: t.src
|
|
2496
2500
|
}), i;
|
|
2497
2501
|
}
|
|
2498
|
-
const ee = 100,
|
|
2499
|
-
const n = e.nodes, o = n.offsetHeight + ee * 2, s = n.offsetWidth + ee * 2, i =
|
|
2502
|
+
const ee = 100, Wo = '<?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">', Yo = (e, t = !1) => {
|
|
2503
|
+
const n = e.nodes, o = n.offsetHeight + ee * 2, s = n.offsetWidth + ee * 2, i = Oo(o + "px", s + "px"), l = document.createElementNS(_, "svg"), c = document.createElementNS(_, "rect");
|
|
2500
2504
|
k(c, {
|
|
2501
2505
|
x: "0",
|
|
2502
2506
|
y: "0",
|
|
@@ -2504,7 +2508,7 @@ const ee = 100, Bo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2504
2508
|
height: `${o}`,
|
|
2505
2509
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2506
2510
|
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((h) => {
|
|
2507
|
-
const u = h.cloneNode(!0), { offsetLeft: b, offsetTop: v } =
|
|
2511
|
+
const u = h.cloneNode(!0), { offsetLeft: b, offsetTop: v } = M(n, h.parentElement);
|
|
2508
2512
|
u.setAttribute("x", `${b}`), u.setAttribute("y", `${v}`), l.appendChild(u);
|
|
2509
2513
|
});
|
|
2510
2514
|
const r = n.querySelector(".lines")?.cloneNode(!0);
|
|
@@ -2513,22 +2517,22 @@ const ee = 100, Bo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2513
2517
|
a && l.appendChild(a);
|
|
2514
2518
|
const d = n.querySelector(".summary")?.cloneNode(!0);
|
|
2515
2519
|
return d && l.appendChild(d), n.querySelectorAll("me-tpc").forEach((h) => {
|
|
2516
|
-
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(Q(e, h, !t)) : (l.appendChild(
|
|
2520
|
+
h.nodeObj.dangerouslySetInnerHTML ? l.appendChild(Q(e, h, !t)) : (l.appendChild(Io(e, h)), l.appendChild(Q(e, h.text, !t)));
|
|
2517
2521
|
}), n.querySelectorAll(".tags > span").forEach((h) => {
|
|
2518
2522
|
l.appendChild(Q(e, h));
|
|
2519
2523
|
}), n.querySelectorAll(".icons > span").forEach((h) => {
|
|
2520
2524
|
l.appendChild(Q(e, h));
|
|
2521
2525
|
}), n.querySelectorAll(".hyper-link").forEach((h) => {
|
|
2522
|
-
l.appendChild(Io(e, h));
|
|
2523
|
-
}), n.querySelectorAll("img").forEach((h) => {
|
|
2524
2526
|
l.appendChild(Ro(e, h));
|
|
2527
|
+
}), n.querySelectorAll("img").forEach((h) => {
|
|
2528
|
+
l.appendChild(Bo(e, h));
|
|
2525
2529
|
}), k(l, {
|
|
2526
2530
|
x: ee + "",
|
|
2527
2531
|
y: ee + "",
|
|
2528
2532
|
overflow: "visible"
|
|
2529
2533
|
}), i.appendChild(l), i;
|
|
2530
|
-
},
|
|
2531
|
-
function
|
|
2534
|
+
}, Xo = (e, t) => (t && e.insertAdjacentHTML("afterbegin", "<style>" + t + "</style>"), Wo + e.outerHTML);
|
|
2535
|
+
function Fo(e) {
|
|
2532
2536
|
return new Promise((t, n) => {
|
|
2533
2537
|
const o = new FileReader();
|
|
2534
2538
|
o.onload = (s) => {
|
|
@@ -2538,11 +2542,11 @@ function Xo(e) {
|
|
|
2538
2542
|
}, o.readAsDataURL(e);
|
|
2539
2543
|
});
|
|
2540
2544
|
}
|
|
2541
|
-
const
|
|
2542
|
-
const n =
|
|
2545
|
+
const Ko = function(e = !1, t) {
|
|
2546
|
+
const n = Yo(this, e), o = Xo(n, t);
|
|
2543
2547
|
return new Blob([o], { type: "image/svg+xml" });
|
|
2544
|
-
},
|
|
2545
|
-
const n = this.exportSvg(e, t), o = await
|
|
2548
|
+
}, Vo = async function(e = !1, t) {
|
|
2549
|
+
const n = this.exportSvg(e, t), o = await Fo(n);
|
|
2546
2550
|
return new Promise((s, i) => {
|
|
2547
2551
|
const l = new Image();
|
|
2548
2552
|
l.setAttribute("crossOrigin", "anonymous"), l.onload = () => {
|
|
@@ -2550,12 +2554,12 @@ const Fo = function(e = !1, t) {
|
|
|
2550
2554
|
c.width = l.width, c.height = l.height, c.getContext("2d").drawImage(l, 0, 0), c.toBlob(s, "image/png", 1);
|
|
2551
2555
|
}, l.src = o, l.onerror = i;
|
|
2552
2556
|
});
|
|
2553
|
-
},
|
|
2557
|
+
}, zo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2554
2558
|
__proto__: null,
|
|
2555
|
-
exportPng:
|
|
2556
|
-
exportSvg:
|
|
2559
|
+
exportPng: Vo,
|
|
2560
|
+
exportSvg: Ko
|
|
2557
2561
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2558
|
-
function
|
|
2562
|
+
function Go(e, t) {
|
|
2559
2563
|
return async function(...n) {
|
|
2560
2564
|
const o = this.before[t];
|
|
2561
2565
|
o && !await o.apply(this, n) || e.apply(this, n);
|
|
@@ -2564,9 +2568,9 @@ function zo(e, t) {
|
|
|
2564
2568
|
const Ge = Object.keys(ot), ut = {};
|
|
2565
2569
|
for (let e = 0; e < Ge.length; e++) {
|
|
2566
2570
|
const t = Ge[e];
|
|
2567
|
-
ut[t] =
|
|
2571
|
+
ut[t] = Go(ot[t], t);
|
|
2568
2572
|
}
|
|
2569
|
-
const
|
|
2573
|
+
const qo = {
|
|
2570
2574
|
getObjById: ne,
|
|
2571
2575
|
generateNewObj: pt,
|
|
2572
2576
|
layout: Ct,
|
|
@@ -2578,11 +2582,12 @@ const Go = {
|
|
|
2578
2582
|
createTopic: Dt,
|
|
2579
2583
|
findEle: Ze,
|
|
2580
2584
|
changeTheme: io,
|
|
2585
|
+
changeCompact: ro,
|
|
2581
2586
|
...En,
|
|
2582
2587
|
...ut,
|
|
2583
|
-
...
|
|
2584
|
-
...
|
|
2585
|
-
...
|
|
2588
|
+
...xo,
|
|
2589
|
+
...Po,
|
|
2590
|
+
...zo,
|
|
2586
2591
|
init(e) {
|
|
2587
2592
|
if (e = JSON.parse(JSON.stringify(e)), !e || !e.nodeData) return new Error("MindElixir: `data` is required");
|
|
2588
2593
|
e.direction !== void 0 && (this.direction = e.direction), this.changeTheme(e.theme || this.theme, !1), this.nodeData = e.nodeData, R(this.nodeData), this.arrows = e.arrows || [], this.summaries = e.summaries || [], this.tidyArrow(), this.toolBar && Jn(this), this.keypress && An(this, this.keypress), so(this), this.disposable.push(Et()), this.contextMenu && this.disposable.push(In(this, this.contextMenu)), this.allowUndo && this.disposable.push(Bn(this)), this.layout(), this.linkDiv(), this.toCenter();
|
|
@@ -2598,25 +2603,25 @@ const Go = {
|
|
|
2598
2603
|
this.mobileMultiSelect = e;
|
|
2599
2604
|
}
|
|
2600
2605
|
};
|
|
2601
|
-
function
|
|
2606
|
+
function Uo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, containerHeight: a }) {
|
|
2602
2607
|
let d = t + n / 2;
|
|
2603
2608
|
const h = e + o / 2;
|
|
2604
2609
|
let u;
|
|
2605
|
-
r ===
|
|
2610
|
+
r === H.LHS ? u = i + l : u = i;
|
|
2606
2611
|
const b = s + c / 2, p = (1 - Math.abs(b - h) / a) * 0.25 * (n / 2);
|
|
2607
|
-
return r ===
|
|
2612
|
+
return r === H.LHS ? d = d - n / 10 - p : d = d + n / 10 + p, `M ${d} ${h} Q ${d} ${b} ${u} ${b}`;
|
|
2608
2613
|
}
|
|
2609
|
-
function
|
|
2614
|
+
function Jo({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, isFirst: a }) {
|
|
2610
2615
|
const d = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2611
2616
|
let h = 0, u = 0;
|
|
2612
2617
|
a ? h = e + o / 2 : h = e + o;
|
|
2613
2618
|
const b = s + c;
|
|
2614
2619
|
let v = 0, p = 0, g = 0;
|
|
2615
2620
|
const m = Math.abs(h - b) / 300 * d;
|
|
2616
|
-
return r ===
|
|
2621
|
+
return r === H.LHS ? (g = t, v = g + d, p = g - d, u = i + d, `M ${v} ${h} C ${g} ${h} ${g + m} ${b} ${p} ${b} H ${u}`) : (g = t + n, v = g - d, p = g + d, u = i + l - d, `M ${v} ${h} C ${g} ${h} ${g - m} ${b} ${p} ${b} H ${u}`);
|
|
2617
2622
|
}
|
|
2618
|
-
const
|
|
2619
|
-
function
|
|
2623
|
+
const Zo = "5.12.0";
|
|
2624
|
+
function Qo(e) {
|
|
2620
2625
|
return {
|
|
2621
2626
|
x: 0,
|
|
2622
2627
|
y: 0,
|
|
@@ -2643,7 +2648,7 @@ function Zo(e) {
|
|
|
2643
2648
|
}
|
|
2644
2649
|
};
|
|
2645
2650
|
}
|
|
2646
|
-
function
|
|
2651
|
+
function P({
|
|
2647
2652
|
el: e,
|
|
2648
2653
|
direction: t,
|
|
2649
2654
|
editable: n,
|
|
@@ -2658,41 +2663,42 @@ function A({
|
|
|
2658
2663
|
generateMainBranch: h,
|
|
2659
2664
|
generateSubBranch: u,
|
|
2660
2665
|
overflowHidden: b,
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2666
|
+
compact: v,
|
|
2667
|
+
theme: p,
|
|
2668
|
+
alignment: g,
|
|
2669
|
+
scaleSensitivity: m,
|
|
2670
|
+
scaleMax: w,
|
|
2671
|
+
scaleMin: E,
|
|
2672
|
+
handleWheel: N,
|
|
2673
|
+
markdown: f,
|
|
2674
|
+
imageProxy: y,
|
|
2675
|
+
pasteHandler: x,
|
|
2676
|
+
mobileMultiSelect: S
|
|
2671
2677
|
}) {
|
|
2672
|
-
let
|
|
2673
|
-
const
|
|
2674
|
-
if (
|
|
2675
|
-
|
|
2676
|
-
const
|
|
2677
|
-
this.theme =
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2678
|
+
let C = null;
|
|
2679
|
+
const T = Object.prototype.toString.call(e);
|
|
2680
|
+
if (T === "[object HTMLDivElement]" ? C = e : T === "[object String]" && (C = document.querySelector(e)), !C) throw new Error("MindElixir: el is not a valid element");
|
|
2681
|
+
C.style.position = "relative", C.innerHTML = "", this.el = C, this.disposable = [], this.before = r || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = l ?? 0, this.direction = t ?? 1, this.editable = n ?? !0, this.allowUndo = d ?? !0, this.scaleSensitivity = m ?? 0.1, this.scaleMax = w ?? 1.4, this.scaleMin = E ?? 0.2, this.generateMainBranch = h || Uo, this.generateSubBranch = u || Jo, this.overflowHidden = b ?? !1, this.compact = v ?? !1, this.alignment = g ?? "root", this.handleWheel = N ?? !0, this.markdown = f || void 0, this.imageProxy = y || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.mobileMultiSelect = S ?? !1, this.panHelper = Qo(this), this.bus = On(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
2682
|
+
const D = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2683
|
+
this.theme = p || (D.matches ? ue : fe);
|
|
2684
|
+
const L = document.createElement("div");
|
|
2685
|
+
L.className = "map-canvas", this.map = L, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = z("lines"), this.summarySvg = z("summary"), this.linkController = z("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 = je(), this.line2 = je(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.arrowSvg = z("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(Pn(this)), x && (this.pasteHandler = x);
|
|
2680
2686
|
}
|
|
2681
|
-
|
|
2682
|
-
Object.defineProperty(
|
|
2687
|
+
P.prototype = qo;
|
|
2688
|
+
Object.defineProperty(P.prototype, "currentNode", {
|
|
2683
2689
|
get() {
|
|
2684
2690
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
2685
2691
|
},
|
|
2686
2692
|
enumerable: !0
|
|
2687
2693
|
});
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2694
|
+
P.LEFT = 0;
|
|
2695
|
+
P.RIGHT = 1;
|
|
2696
|
+
P.SIDE = 2;
|
|
2697
|
+
P.THEME = fe;
|
|
2698
|
+
P.DARK_THEME = ue;
|
|
2699
|
+
P.version = Zo;
|
|
2700
|
+
P.E = Ze;
|
|
2701
|
+
P.new = (e) => ({
|
|
2696
2702
|
nodeData: {
|
|
2697
2703
|
id: B(),
|
|
2698
2704
|
topic: e || "new topic",
|
|
@@ -2701,9 +2707,9 @@ A.new = (e) => ({
|
|
|
2701
2707
|
});
|
|
2702
2708
|
export {
|
|
2703
2709
|
ue as DARK_THEME,
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2710
|
+
es as LEFT,
|
|
2711
|
+
ts as RIGHT,
|
|
2712
|
+
ns as SIDE,
|
|
2707
2713
|
fe as THEME,
|
|
2708
|
-
|
|
2714
|
+
P as default
|
|
2709
2715
|
};
|