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