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