mind-elixir 5.14.0-beta.0 → 5.14.0-beta.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 +152 -160
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +211 -219
- package/package.json +1 -1
package/dist/MindElixir.js
CHANGED
|
@@ -432,11 +432,11 @@ function Ht(e, t, n) {
|
|
|
432
432
|
const { siblings: o, index: s } = z(n);
|
|
433
433
|
o !== void 0 && (t === "before" ? o.splice(s, 0, e) : o.splice(s + 1, 0, e));
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function It(e, t) {
|
|
436
436
|
const { siblings: n, index: o } = z(e);
|
|
437
437
|
n !== void 0 && (n[o] = t, t.children = [e]);
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function jt(e, t, n) {
|
|
440
440
|
if (et(t), n.parent?.parent || (t.direction = n.direction), e === "in")
|
|
441
441
|
n.children ? n.children.push(t) : n.children = [t];
|
|
442
442
|
else {
|
|
@@ -532,7 +532,7 @@ const Rt = function({ map: e, direction: t }, n) {
|
|
|
532
532
|
if (!o.parent)
|
|
533
533
|
return;
|
|
534
534
|
const s = t || this.generateNewObj();
|
|
535
|
-
|
|
535
|
+
It(o, s), B(this.nodeData);
|
|
536
536
|
const i = n.parentElement.parentElement, { grp: l, top: c } = this.createWrapper(s, !0);
|
|
537
537
|
c.appendChild(xe(!0)), i.insertAdjacentElement("afterend", l);
|
|
538
538
|
const r = this.createChildren([i]);
|
|
@@ -612,7 +612,7 @@ const Rt = function({ map: e, direction: t }, n) {
|
|
|
612
612
|
const i = [];
|
|
613
613
|
for (const c of e) {
|
|
614
614
|
const r = c.nodeObj;
|
|
615
|
-
if (
|
|
615
|
+
if (jt(t, r, s), B(o.nodeData), t === "in") {
|
|
616
616
|
const a = c.parentElement;
|
|
617
617
|
tt(o, n, a.parentElement);
|
|
618
618
|
} else {
|
|
@@ -700,8 +700,8 @@ const nn = function(e, t = !1) {
|
|
|
700
700
|
this.editable = !1;
|
|
701
701
|
}, fn = function(e, t = { x: 0, y: 0 }) {
|
|
702
702
|
if (e < this.scaleMin && e < this.scaleVal || e > this.scaleMax && e > this.scaleVal) return;
|
|
703
|
-
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = Se(this), c = this.map.style.transform, { x: r, y: a } = be(c), d = r - i, h = a - l, u = this.scaleVal,
|
|
704
|
-
this.map.style.transform = `translate3d(${r -
|
|
703
|
+
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = Se(this), c = this.map.style.transform, { x: r, y: a } = be(c), d = r - i, h = a - l, u = this.scaleVal, p = (-o + d) * (1 - e / u), v = (-s + h) * (1 - e / u);
|
|
704
|
+
this.map.style.transform = `translate3d(${r - p}px, ${a - v}px, 0) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
705
705
|
}, un = function() {
|
|
706
706
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
707
707
|
this.scaleVal = n;
|
|
@@ -713,14 +713,14 @@ const nn = function(e, t = !1) {
|
|
|
713
713
|
return;
|
|
714
714
|
const r = o.style.transform;
|
|
715
715
|
let { x: a, y: d } = be(r);
|
|
716
|
-
const h = l.getBoundingClientRect(), u = c.getBoundingClientRect(),
|
|
717
|
-
if (
|
|
718
|
-
const
|
|
719
|
-
(
|
|
716
|
+
const h = l.getBoundingClientRect(), u = c.getBoundingClientRect(), p = u.left < h.right && u.right > h.left, v = u.top < h.bottom && u.bottom > h.top;
|
|
717
|
+
if (p) {
|
|
718
|
+
const m = u.left + e, y = u.right + e;
|
|
719
|
+
(m >= h.right || y <= h.left) && (e = 0);
|
|
720
720
|
}
|
|
721
721
|
if (v) {
|
|
722
|
-
const
|
|
723
|
-
(
|
|
722
|
+
const m = u.top + t, y = u.bottom + t;
|
|
723
|
+
(m >= h.bottom || y <= h.top) && (t = 0);
|
|
724
724
|
}
|
|
725
725
|
a += e, d += t, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
726
726
|
o.style.transition = "none";
|
|
@@ -840,7 +840,7 @@ const nn = function(e, t = !1) {
|
|
|
840
840
|
if (!n || !n.nodeObj.parent) return;
|
|
841
841
|
const s = t + "Sibling", i = n.parentElement.parentElement[s];
|
|
842
842
|
i ? e.selectNode(i.firstChild.firstChild) : e.selectNode(n);
|
|
843
|
-
},
|
|
843
|
+
}, Ie = function(e, t, n) {
|
|
844
844
|
const o = t === "in" ? e.scaleSensitivity : -e.scaleSensitivity;
|
|
845
845
|
st(e, o, n);
|
|
846
846
|
}, On = (e, t) => {
|
|
@@ -910,10 +910,10 @@ function $n(e, t) {
|
|
|
910
910
|
e.moveDownNode();
|
|
911
911
|
},
|
|
912
912
|
"=": (r) => {
|
|
913
|
-
(r.metaKey || r.ctrlKey) &&
|
|
913
|
+
(r.metaKey || r.ctrlKey) && Ie(e, "in");
|
|
914
914
|
},
|
|
915
915
|
"-": (r) => {
|
|
916
|
-
(r.metaKey || r.ctrlKey) &&
|
|
916
|
+
(r.metaKey || r.ctrlKey) && Ie(e, "out");
|
|
917
917
|
},
|
|
918
918
|
0: (r) => {
|
|
919
919
|
if (r.metaKey || r.ctrlKey) {
|
|
@@ -955,7 +955,7 @@ function $n(e, t) {
|
|
|
955
955
|
try {
|
|
956
956
|
const d = JSON.parse(a);
|
|
957
957
|
if (d && d.magic === Oe && Array.isArray(d.data)) {
|
|
958
|
-
const h = d.data, u = h.map((
|
|
958
|
+
const h = d.data, u = h.map((p) => ({ nodeObj: p }));
|
|
959
959
|
h.length > 0 && e.currentNode && (e.copyNodes(u, e.currentNode), r.preventDefault());
|
|
960
960
|
return;
|
|
961
961
|
}
|
|
@@ -1097,7 +1097,7 @@ function Hn(e) {
|
|
|
1097
1097
|
})) : Me(e, c, f, !1) && (e.ptState = i.Drag, b.setPointerCapture(f.pointerId));
|
|
1098
1098
|
} else
|
|
1099
1099
|
a(b, !1);
|
|
1100
|
-
},
|
|
1100
|
+
}, p = (f) => {
|
|
1101
1101
|
switch (e.ptState) {
|
|
1102
1102
|
case i.Pinch:
|
|
1103
1103
|
l.handlePointerMove(f);
|
|
@@ -1127,15 +1127,15 @@ function Hn(e) {
|
|
|
1127
1127
|
break;
|
|
1128
1128
|
}
|
|
1129
1129
|
s.detect(f, h), (e.ptState !== i.Pinch || l.activePointers.size < 2) && (e.ptState = i.Idle), o && (!b && !w && e.selection?.deselect(o), o = null);
|
|
1130
|
-
},
|
|
1130
|
+
}, m = () => {
|
|
1131
1131
|
l.clear(), r.clear(), t.clear(), s.clear(), (c.isDragging || c.pointerId !== null) && Pe(e, c), e.ptState = i.Idle, o = null;
|
|
1132
|
-
},
|
|
1132
|
+
}, y = (f) => {
|
|
1133
1133
|
f.preventDefault(), f.button === 2 && e.editable && setTimeout(() => {
|
|
1134
1134
|
if (e.panHelper.moved || e.ptState !== i.Idle && e.ptState !== i.Pan) return;
|
|
1135
1135
|
const b = f.target;
|
|
1136
1136
|
ne(b) && !b.classList.contains("selected") && e.selectNode(b), e.bus.fire("showContextMenu", f);
|
|
1137
1137
|
}, 200);
|
|
1138
|
-
},
|
|
1138
|
+
}, g = (f) => {
|
|
1139
1139
|
if (f.stopPropagation(), f.preventDefault(), f.ctrlKey || f.metaKey) return On(e, f);
|
|
1140
1140
|
if (f.shiftKey) return e.move(-f.deltaY, 0);
|
|
1141
1141
|
e.move(-f.deltaX, -f.deltaY);
|
|
@@ -1146,18 +1146,18 @@ function Hn(e) {
|
|
|
1146
1146
|
};
|
|
1147
1147
|
return qe([
|
|
1148
1148
|
{ dom: n, evt: "pointerdown", func: u },
|
|
1149
|
-
{ dom: n, evt: "pointermove", func:
|
|
1149
|
+
{ dom: n, evt: "pointermove", func: p },
|
|
1150
1150
|
{ dom: n, evt: "pointerup", func: v },
|
|
1151
|
-
{ dom: n, evt: "pointercancel", func:
|
|
1151
|
+
{ dom: n, evt: "pointercancel", func: m },
|
|
1152
1152
|
{ dom: n, evt: "click", func: d },
|
|
1153
|
-
{ dom: n, evt: "contextmenu", func:
|
|
1154
|
-
{ dom: n, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel :
|
|
1155
|
-
{ dom: n, evt: "blur", func:
|
|
1153
|
+
{ dom: n, evt: "contextmenu", func: y },
|
|
1154
|
+
{ dom: n, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : g },
|
|
1155
|
+
{ dom: n, evt: "blur", func: m },
|
|
1156
1156
|
{ dom: n, evt: "keydown", func: x },
|
|
1157
1157
|
{ dom: n, evt: "keyup", func: E }
|
|
1158
1158
|
]);
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1160
|
+
function In() {
|
|
1161
1161
|
return {
|
|
1162
1162
|
handlers: {},
|
|
1163
1163
|
addListener: function(e, t) {
|
|
@@ -1201,10 +1201,10 @@ const M = "http://www.w3.org/2000/svg", le = function(e) {
|
|
|
1201
1201
|
}, q = function(e) {
|
|
1202
1202
|
const t = document.createElementNS(M, "svg");
|
|
1203
1203
|
return t.setAttribute("class", e), t.setAttribute("overflow", "visible"), t;
|
|
1204
|
-
},
|
|
1204
|
+
}, je = function() {
|
|
1205
1205
|
const e = document.createElementNS(M, "line");
|
|
1206
1206
|
return e.setAttribute("stroke", "#4dc4ff"), e.setAttribute("fill", "none"), e.setAttribute("stroke-width", "2"), e.setAttribute("opacity", "0.45"), e;
|
|
1207
|
-
},
|
|
1207
|
+
}, jn = function(e, t, n, o) {
|
|
1208
1208
|
const s = document.createElementNS(M, "g");
|
|
1209
1209
|
return [
|
|
1210
1210
|
{
|
|
@@ -1267,11 +1267,11 @@ const M = "http://www.w3.org/2000/svg", le = function(e) {
|
|
|
1267
1267
|
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");
|
|
1268
1268
|
this.lines.innerHTML = "";
|
|
1269
1269
|
for (let c = 0; c < l.length; c++) {
|
|
1270
|
-
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = A(this.nodes, a), u = a.offsetWidth,
|
|
1271
|
-
if (a.style.borderColor =
|
|
1270
|
+
const r = l[c], a = r.querySelector("me-tpc"), { offsetLeft: d, offsetTop: h } = A(this.nodes, a), u = a.offsetWidth, p = a.offsetHeight, v = r.parentNode.className, m = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: h, cL: d, cW: u, cH: p, direction: v, containerHeight: this.nodes.offsetHeight }), y = this.theme.palette, g = a.nodeObj.branchColor || y[c % y.length];
|
|
1271
|
+
if (a.style.borderColor = g, this.lines.appendChild(it(m, g, "3")), e && e !== r)
|
|
1272
1272
|
continue;
|
|
1273
1273
|
const x = q("subLines"), E = r.lastChild;
|
|
1274
|
-
E.tagName === "svg" && E.remove(), r.appendChild(x), lt(this, x,
|
|
1274
|
+
E.tagName === "svg" && E.remove(), r.appendChild(x), lt(this, x, g, r, v, !0);
|
|
1275
1275
|
}
|
|
1276
1276
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
1277
1277
|
}, lt = function(e, t, n, o, s, i) {
|
|
@@ -1279,14 +1279,14 @@ const M = "http://www.w3.org/2000/svg", le = function(e) {
|
|
|
1279
1279
|
if (c.length === 0) return;
|
|
1280
1280
|
const r = l.offsetTop, a = l.offsetLeft, d = l.offsetWidth, h = l.offsetHeight;
|
|
1281
1281
|
for (let u = 0; u < c.length; u++) {
|
|
1282
|
-
const
|
|
1282
|
+
const p = c[u], v = p.firstChild, m = v.offsetTop, y = v.offsetLeft, g = v.offsetWidth, x = v.offsetHeight, E = v.firstChild.nodeObj.branchColor || n, N = e.generateSubBranch({ pT: r, pL: a, pW: d, pH: h, cT: m, cL: y, cW: g, cH: x, direction: s, isFirst: i });
|
|
1283
1283
|
t.appendChild(it(N, E, "2"));
|
|
1284
1284
|
const f = v.children[1];
|
|
1285
1285
|
if (f) {
|
|
1286
1286
|
if (!f.expanded) continue;
|
|
1287
1287
|
} else
|
|
1288
1288
|
continue;
|
|
1289
|
-
lt(e, t, E,
|
|
1289
|
+
lt(e, t, E, p, s);
|
|
1290
1290
|
}
|
|
1291
1291
|
}, Bn = {
|
|
1292
1292
|
addChild: "Add child",
|
|
@@ -1315,23 +1315,23 @@ function Wn(e, t) {
|
|
|
1315
1315
|
}, s = (b, w, S) => {
|
|
1316
1316
|
const C = document.createElement("li");
|
|
1317
1317
|
return C.id = b, C.innerHTML = `<span>${de(w)}</span><span ${S ? 'class="key"' : ""}>${de(S)}</span>`, C;
|
|
1318
|
-
}, 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"),
|
|
1319
|
-
if (
|
|
1318
|
+
}, 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"), p = s("cm-down", i.moveDown, "Pgdn"), v = s("cm-link", i.link, ""), m = s("cm-link-bidirectional", i.linkBidirectional, ""), y = s("cm-summary", i.summary, ""), g = document.createElement("ul");
|
|
1319
|
+
if (g.className = "menu-list", g.appendChild(l), g.appendChild(c), g.appendChild(r), g.appendChild(a), t.focus && (g.appendChild(d), g.appendChild(h)), g.appendChild(u), g.appendChild(p), g.appendChild(y), t.link && (g.appendChild(v), g.appendChild(m)), t && t.extend)
|
|
1320
1320
|
for (let b = 0; b < t.extend.length; b++) {
|
|
1321
1321
|
const w = t.extend[b], S = s(w.name, w.name, w.key || "");
|
|
1322
|
-
|
|
1322
|
+
g.appendChild(S), S.onclick = (C) => {
|
|
1323
1323
|
w.onclick(C);
|
|
1324
1324
|
};
|
|
1325
1325
|
}
|
|
1326
1326
|
const x = document.createElement("div");
|
|
1327
|
-
x.className = "context-menu", x.appendChild(
|
|
1327
|
+
x.className = "context-menu", x.appendChild(g), x.hidden = !0, e.container.append(x);
|
|
1328
1328
|
let E = !0;
|
|
1329
1329
|
const N = (b) => {
|
|
1330
1330
|
const w = b.target;
|
|
1331
1331
|
if (ne(w)) {
|
|
1332
|
-
w.parentElement.tagName === "ME-ROOT" ? E = !0 : E = !1, E ? (d.className = "disabled", u.className = "disabled",
|
|
1333
|
-
const S =
|
|
1334
|
-
S + D > window.innerHeight ? (
|
|
1332
|
+
w.parentElement.tagName === "ME-ROOT" ? E = !0 : E = !1, E ? (d.className = "disabled", u.className = "disabled", p.className = "disabled", c.className = "disabled", r.className = "disabled", a.className = "disabled") : (d.className = "", u.className = "", p.className = "", c.className = "", r.className = "", a.className = ""), x.hidden = !1, g.style.top = "", g.style.bottom = "", g.style.left = "", g.style.right = "";
|
|
1333
|
+
const S = g.offsetHeight, C = g.offsetWidth, T = g.getBoundingClientRect(), D = b.clientY - T.top, L = b.clientX - T.left;
|
|
1334
|
+
S + D > window.innerHeight ? (g.style.top = "", g.style.bottom = "0px") : (g.style.bottom = "", g.style.top = D + 15 + "px"), C + L > window.innerWidth ? (g.style.left = "", g.style.right = "0px") : (g.style.right = "", g.style.left = L + 10 + "px");
|
|
1335
1335
|
}
|
|
1336
1336
|
};
|
|
1337
1337
|
e.bus.addListener("showContextMenu", N), x.onclick = (b) => {
|
|
@@ -1350,7 +1350,7 @@ function Wn(e, t) {
|
|
|
1350
1350
|
e.cancelFocus(), x.hidden = !0;
|
|
1351
1351
|
}, u.onclick = () => {
|
|
1352
1352
|
E || (e.moveUpNode(), x.hidden = !0);
|
|
1353
|
-
},
|
|
1353
|
+
}, p.onclick = () => {
|
|
1354
1354
|
E || (e.moveDownNode(), x.hidden = !0);
|
|
1355
1355
|
};
|
|
1356
1356
|
const f = (b) => {
|
|
@@ -1368,10 +1368,10 @@ function Wn(e, t) {
|
|
|
1368
1368
|
}
|
|
1369
1369
|
);
|
|
1370
1370
|
};
|
|
1371
|
-
return v.onclick = () => f(),
|
|
1371
|
+
return v.onclick = () => f(), m.onclick = () => f({ bidirectional: !0 }), y.onclick = () => {
|
|
1372
1372
|
x.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
1373
1373
|
}, () => {
|
|
1374
|
-
l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null,
|
|
1374
|
+
l.onclick = null, c.onclick = null, r.onclick = null, a.onclick = null, d.onclick = null, h.onclick = null, u.onclick = null, p.onclick = null, v.onclick = null, y.onclick = null, x.onclick = null, e.container.oncontextmenu = null;
|
|
1375
1375
|
};
|
|
1376
1376
|
}
|
|
1377
1377
|
const Yn = function(e) {
|
|
@@ -1452,17 +1452,17 @@ function Zn(e) {
|
|
|
1452
1452
|
t.appendChild(n), t.appendChild(o), t.appendChild(s), t.appendChild(i), t.className = "mind-elixir-toolbar rb";
|
|
1453
1453
|
let l = null;
|
|
1454
1454
|
const c = () => {
|
|
1455
|
-
const a = e.container.getBoundingClientRect(), d = be(e.map.style.transform), h = a.width / 2, u = a.height / 2,
|
|
1455
|
+
const a = e.container.getBoundingClientRect(), d = be(e.map.style.transform), h = a.width / 2, u = a.height / 2, p = (h - d.x) / e.scaleVal, v = (u - d.y) / e.scaleVal;
|
|
1456
1456
|
l = {
|
|
1457
1457
|
containerRect: a,
|
|
1458
1458
|
currentTransform: d,
|
|
1459
|
-
mapCenterX:
|
|
1459
|
+
mapCenterX: p,
|
|
1460
1460
|
mapCenterY: v
|
|
1461
1461
|
};
|
|
1462
1462
|
}, r = () => {
|
|
1463
1463
|
if (l) {
|
|
1464
|
-
const a = e.container.getBoundingClientRect(), d = a.width / 2, h = a.height / 2, u = d - l.mapCenterX * e.scaleVal,
|
|
1465
|
-
e.move(v,
|
|
1464
|
+
const a = e.container.getBoundingClientRect(), d = a.width / 2, h = a.height / 2, u = d - l.mapCenterX * e.scaleVal, p = h - l.mapCenterY * e.scaleVal, v = u - l.currentTransform.x, m = p - l.currentTransform.y;
|
|
1465
|
+
e.move(v, m);
|
|
1466
1466
|
}
|
|
1467
1467
|
};
|
|
1468
1468
|
return e.el.addEventListener("fullscreenchange", r), n.onclick = () => {
|
|
@@ -1560,7 +1560,7 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, H = ({ style: e },
|
|
|
1560
1560
|
case "shift":
|
|
1561
1561
|
return e.shiftKey;
|
|
1562
1562
|
}
|
|
1563
|
-
}) : !1), { abs:
|
|
1563
|
+
}) : !1), { abs: j, max: Ye, min: Xe, ceil: Fe } = Math, Ke = (e = []) => ({
|
|
1564
1564
|
stored: e,
|
|
1565
1565
|
selected: [],
|
|
1566
1566
|
touched: [],
|
|
@@ -1660,14 +1660,14 @@ class ro extends to {
|
|
|
1660
1660
|
const { x: o, y: s, target: i } = Q(t), { document: l, startAreas: c, boundaries: r, behaviour: a, features: d } = this._options, h = i.getBoundingClientRect();
|
|
1661
1661
|
if (!io(t, a.triggers))
|
|
1662
1662
|
return;
|
|
1663
|
-
const u = X(c, l),
|
|
1664
|
-
this._targetElement =
|
|
1665
|
-
const v = t.composedPath(),
|
|
1666
|
-
if (this._targetBoundary =
|
|
1663
|
+
const u = X(c, l), p = X(r, l);
|
|
1664
|
+
this._targetElement = p.find((g) => We(g.getBoundingClientRect(), h));
|
|
1665
|
+
const v = t.composedPath(), m = u.find((g) => v.includes(g));
|
|
1666
|
+
if (this._targetBoundary = p.find((g) => v.includes(g)), !this._targetElement || !m || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1667
1667
|
return;
|
|
1668
1668
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1669
|
-
const
|
|
1670
|
-
this._scrollDelta = { x:
|
|
1669
|
+
const y = l.scrollingElement ?? l.body;
|
|
1670
|
+
this._scrollDelta = { x: y.scrollLeft, y: y.scrollTop }, this._singleClick = !0, this.clearSelection(!1, !0), Y(l, ["pointermove"], this._delayedTapMove, { passive: !1 }), Y(l, ["pointerup", "pointercancel"], this._onTapStop), Y(l, "scroll", this._onScroll), d.deselectOnBlur && (this._targetBoundaryScrolled = !1, Y(this._targetBoundary, "scroll", this._onStartAreaScroll));
|
|
1671
1671
|
}
|
|
1672
1672
|
_onSingleTap(t) {
|
|
1673
1673
|
const {
|
|
@@ -1681,8 +1681,8 @@ class ro extends to {
|
|
|
1681
1681
|
this.resolveSelectables();
|
|
1682
1682
|
const { x: c, y: r } = s;
|
|
1683
1683
|
i = this._selectables.find((a) => {
|
|
1684
|
-
const { right: d, left: h, top: u, bottom:
|
|
1685
|
-
return c < d && c > h && r <
|
|
1684
|
+
const { right: d, left: h, top: u, bottom: p } = a.getBoundingClientRect();
|
|
1685
|
+
return c < d && c > h && r < p && r > u;
|
|
1686
1686
|
});
|
|
1687
1687
|
}
|
|
1688
1688
|
if (!i)
|
|
@@ -1712,8 +1712,8 @@ class ro extends to {
|
|
|
1712
1712
|
} = this._options, { x1: i, y1: l } = this._areaLocation, { x: c, y: r } = Q(t);
|
|
1713
1713
|
if (
|
|
1714
1714
|
// Single number for both coordinates
|
|
1715
|
-
typeof s == "number" &&
|
|
1716
|
-
typeof s == "object" &&
|
|
1715
|
+
typeof s == "number" && j(c + r - (i + l)) >= s || // Different x and y threshold
|
|
1716
|
+
typeof s == "object" && j(c - i) >= s.x || j(r - l) >= s.y
|
|
1717
1717
|
) {
|
|
1718
1718
|
if (O(o, ["pointermove"], this._delayedTapMove, { passive: !1 }), this._emitEvent("beforedrag", t) === !1) {
|
|
1719
1719
|
O(o, ["pointerup", "pointercancel"], this._onTapStop);
|
|
@@ -1786,9 +1786,9 @@ class ro extends to {
|
|
|
1786
1786
|
scrolling: { startScrollMargins: d }
|
|
1787
1787
|
}
|
|
1788
1788
|
} = s;
|
|
1789
|
-
r < i.left + d.x ? (t.x = -
|
|
1790
|
-
const h = Xe(l, r), u = Xe(c, a),
|
|
1791
|
-
this._areaRect = Be(h, u,
|
|
1789
|
+
r < i.left + d.x ? (t.x = -j(i.left - r + d.x), r = r < i.left ? i.left : r) : r > i.right - d.x ? (t.x = j(i.left + i.width - r - d.x), r = r > i.right ? i.right : r) : t.x = 0, a < i.top + d.y ? (t.y = -j(i.top - a + d.y), a = a < i.top ? i.top : a) : a > i.bottom - d.y ? (t.y = j(i.top + i.height - a - d.y), a = a > i.bottom ? i.bottom : a) : t.y = 0;
|
|
1790
|
+
const h = Xe(l, r), u = Xe(c, a), p = Ye(l, r), v = Ye(c, a);
|
|
1791
|
+
this._areaRect = Be(h, u, p - h, v - u);
|
|
1792
1792
|
}
|
|
1793
1793
|
_redrawSelectionArea() {
|
|
1794
1794
|
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
@@ -1799,29 +1799,29 @@ class ro extends to {
|
|
|
1799
1799
|
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(), H(this._area, "display", "none");
|
|
1800
1800
|
}
|
|
1801
1801
|
_updateElementSelection() {
|
|
1802
|
-
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 = [],
|
|
1803
|
-
for (let
|
|
1804
|
-
const
|
|
1805
|
-
if (We(s,
|
|
1806
|
-
if (l.includes(
|
|
1807
|
-
i.includes(
|
|
1808
|
-
else if (d && i.includes(
|
|
1809
|
-
|
|
1802
|
+
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 = [], p = [];
|
|
1803
|
+
for (let m = 0; m < t.length; m++) {
|
|
1804
|
+
const y = t[m];
|
|
1805
|
+
if (We(s, y.getBoundingClientRect(), r)) {
|
|
1806
|
+
if (l.includes(y))
|
|
1807
|
+
i.includes(y) && !c.includes(y) && c.push(y);
|
|
1808
|
+
else if (d && i.includes(y)) {
|
|
1809
|
+
p.push(y);
|
|
1810
1810
|
continue;
|
|
1811
1811
|
} else
|
|
1812
|
-
u.push(
|
|
1813
|
-
h.push(
|
|
1812
|
+
u.push(y);
|
|
1813
|
+
h.push(y);
|
|
1814
1814
|
}
|
|
1815
1815
|
}
|
|
1816
|
-
d && u.push(...i.filter((
|
|
1816
|
+
d && u.push(...i.filter((m) => !l.includes(m)));
|
|
1817
1817
|
const v = a === "keep";
|
|
1818
|
-
for (let
|
|
1819
|
-
const
|
|
1820
|
-
!h.includes(
|
|
1818
|
+
for (let m = 0; m < l.length; m++) {
|
|
1819
|
+
const y = l[m];
|
|
1820
|
+
!h.includes(y) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1821
1821
|
// not make them part of the current selection as soon as they're touched.
|
|
1822
|
-
(v && i.includes(
|
|
1822
|
+
(v && i.includes(y)) && p.push(y);
|
|
1823
1823
|
}
|
|
1824
|
-
o.selected = h, o.changed = { added: u, removed:
|
|
1824
|
+
o.selected = h, o.changed = { added: u, removed: p }, this._latestElement = void 0;
|
|
1825
1825
|
}
|
|
1826
1826
|
_emitEvent(t, n) {
|
|
1827
1827
|
return this.emit(t, {
|
|
@@ -2023,17 +2023,17 @@ function at({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction:
|
|
|
2023
2023
|
const h = e + o / 2;
|
|
2024
2024
|
let u;
|
|
2025
2025
|
r === $.LHS ? u = i + l : u = i;
|
|
2026
|
-
const
|
|
2027
|
-
return r === $.LHS ? d = d - n / 10 -
|
|
2026
|
+
const p = s + c / 2, m = (1 - Math.abs(p - h) / a) * 0.25 * (n / 2);
|
|
2027
|
+
return r === $.LHS ? d = d - n / 10 - m : d = d + n / 10 + m, `M ${d} ${h} Q ${d} ${p} ${u} ${p}`;
|
|
2028
2028
|
}
|
|
2029
2029
|
function dt({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: c, direction: r, isFirst: a }) {
|
|
2030
2030
|
const d = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2031
2031
|
let h = 0, u = 0;
|
|
2032
2032
|
a ? h = e + o / 2 : h = e + o;
|
|
2033
|
-
const
|
|
2034
|
-
let v = 0,
|
|
2035
|
-
const
|
|
2036
|
-
return r === $.LHS ? (
|
|
2033
|
+
const p = s + c;
|
|
2034
|
+
let v = 0, m = 0, y = 0;
|
|
2035
|
+
const g = Math.abs(h - p) / 300 * d;
|
|
2036
|
+
return r === $.LHS ? (y = t, v = y + d, m = y - d, u = i + d, `M ${v} ${h} C ${y} ${h} ${y + g} ${p} ${m} ${p} H ${u}`) : (y = t + n, v = y - d, m = y + d, u = i + l - d, `M ${v} ${h} C ${y} ${h} ${y - g} ${p} ${m} ${p} H ${u}`);
|
|
2037
2037
|
}
|
|
2038
2038
|
const co = function(e, t = !0) {
|
|
2039
2039
|
this.theme = e, this.generateMainBranch = this.theme.generateMainBranch || at, this.generateSubBranch = this.theme.generateSubBranch || dt;
|
|
@@ -2107,37 +2107,29 @@ function F(e, t, n, o, s) {
|
|
|
2107
2107
|
}
|
|
2108
2108
|
function ue(e, t, n, o, s, i, l, c, r, a) {
|
|
2109
2109
|
const d = `M ${t} ${n} C ${o} ${s} ${i} ${l} ${c} ${r}`;
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
if (e.arrow1.setAttribute("d", p), h.length > 1 && h[1].setAttribute("d", p), a.style) {
|
|
2120
|
-
const g = a.style;
|
|
2121
|
-
g.stroke && e.arrow1.setAttribute("stroke", g.stroke), g.strokeWidth && e.arrow1.setAttribute("stroke-width", String(g.strokeWidth)), g.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", g.strokeLinecap), g.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(g.opacity));
|
|
2122
|
-
}
|
|
2110
|
+
e.line.setAttribute("d", d);
|
|
2111
|
+
const h = a.style || {};
|
|
2112
|
+
e.line.setAttribute("stroke", h.stroke || "rgb(227, 125, 116)"), e.line.setAttribute("stroke-width", String(h.strokeWidth || "2")), e.line.setAttribute("stroke-dasharray", h.strokeDasharray || "8,2"), e.line.setAttribute("stroke-linecap", h.strokeLinecap || "cap"), h.opacity !== void 0 && h.opacity !== null && h.opacity !== "" ? e.line.setAttribute("opacity", String(h.opacity)) : e.line.removeAttribute("opacity");
|
|
2113
|
+
const u = e.querySelectorAll('path[stroke="transparent"]');
|
|
2114
|
+
u.length > 0 && u[0].setAttribute("d", d);
|
|
2115
|
+
const p = se(i, l, c, r);
|
|
2116
|
+
if (p) {
|
|
2117
|
+
const g = `M ${p.x1} ${p.y1} L ${c} ${r} L ${p.x2} ${p.y2}`;
|
|
2118
|
+
e.arrow1.setAttribute("d", g), u.length > 1 && u[1].setAttribute("d", g), e.arrow1.setAttribute("stroke", h.stroke || "rgb(227, 125, 116)"), e.arrow1.setAttribute("stroke-width", String(h.strokeWidth || "2")), e.arrow1.setAttribute("stroke-linecap", h.strokeLinecap || "cap"), h.opacity !== void 0 && h.opacity !== null && h.opacity !== "" ? e.arrow1.setAttribute("opacity", String(h.opacity)) : e.arrow1.removeAttribute("opacity");
|
|
2123
2119
|
}
|
|
2124
2120
|
if (a.bidirectional) {
|
|
2125
|
-
const
|
|
2126
|
-
if (
|
|
2127
|
-
const
|
|
2128
|
-
|
|
2129
|
-
const m = a.style;
|
|
2130
|
-
m.stroke && e.arrow2.setAttribute("stroke", m.stroke), m.strokeWidth && e.arrow2.setAttribute("stroke-width", String(m.strokeWidth)), m.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", m.strokeLinecap), m.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(m.opacity));
|
|
2131
|
-
}
|
|
2121
|
+
const g = se(o, s, t, n);
|
|
2122
|
+
if (g) {
|
|
2123
|
+
const x = `M ${g.x1} ${g.y1} L ${t} ${n} L ${g.x2} ${g.y2}`;
|
|
2124
|
+
e.arrow2.setAttribute("d", x), u.length > 2 && u[2].setAttribute("d", x);
|
|
2132
2125
|
}
|
|
2133
2126
|
} else
|
|
2134
|
-
e.arrow2.setAttribute("d", ""),
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
vo(e);
|
|
2127
|
+
e.arrow2.setAttribute("d", ""), u.length > 2 && u[2].setAttribute("d", "");
|
|
2128
|
+
e.arrow2.setAttribute("stroke", h.stroke || "rgb(227, 125, 116)"), e.arrow2.setAttribute("stroke-width", String(h.strokeWidth || "2")), e.arrow2.setAttribute("stroke-linecap", h.strokeLinecap || "cap"), h.opacity !== void 0 && h.opacity !== null && h.opacity !== "" ? e.arrow2.setAttribute("opacity", String(h.opacity)) : e.arrow2.removeAttribute("opacity");
|
|
2129
|
+
const { x: v, y: m } = ft(t, n, o, s, i, l, c, r);
|
|
2130
|
+
e.labelEl && fo(e.labelEl, v, m);
|
|
2131
|
+
const y = e.labelEl;
|
|
2132
|
+
y && (y.style.color = h.labelColor || "rgb(235, 95, 82)"), vo(e);
|
|
2141
2133
|
}
|
|
2142
2134
|
function V(e, t, n) {
|
|
2143
2135
|
const { offsetLeft: o, offsetTop: s } = A(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;
|
|
@@ -2150,7 +2142,7 @@ function V(e, t, n) {
|
|
|
2150
2142
|
ctrlY: d
|
|
2151
2143
|
};
|
|
2152
2144
|
}
|
|
2153
|
-
function
|
|
2145
|
+
function I(e) {
|
|
2154
2146
|
let t, n;
|
|
2155
2147
|
const o = (e.cy - e.ctrlY) / (e.ctrlX - e.cx);
|
|
2156
2148
|
return o > e.h / e.w || o < -e.h / e.w ? e.cy - e.ctrlY < 0 ? (t = e.cx - e.h / 2 / o, n = e.cy + e.h / 2) : (t = e.cx + e.h / 2 / o, n = e.cy - e.h / 2) : e.cx - e.ctrlX < 0 ? (t = e.cx + e.w / 2, n = e.cy - e.w * o / 2) : (t = e.cx - e.w / 2, n = e.cy + e.w * o / 2), {
|
|
@@ -2159,24 +2151,24 @@ function j(e) {
|
|
|
2159
2151
|
};
|
|
2160
2152
|
}
|
|
2161
2153
|
const ut = function(e, t, n) {
|
|
2162
|
-
const o = A(e.nodes, t), s = A(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)),
|
|
2163
|
-
let
|
|
2154
|
+
const o = A(e.nodes, t), s = A(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)), p = Math.abs(a), v = Math.abs(d);
|
|
2155
|
+
let m, y;
|
|
2164
2156
|
if (h < 150) {
|
|
2165
2157
|
const x = t.closest("me-main").className === "lhs" ? -1 : 1;
|
|
2166
|
-
|
|
2167
|
-
} else if (
|
|
2158
|
+
m = { x: 200 * x, y: 0 }, y = { x: 200 * x, y: 0 };
|
|
2159
|
+
} else if (p > v * 1.5) {
|
|
2168
2160
|
const x = a > 0 ? t.offsetWidth / 2 : -t.offsetWidth / 2, E = a > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
|
|
2169
|
-
|
|
2170
|
-
} else if (v >
|
|
2161
|
+
m = { x: x + (a > 0 ? u : -u), y: 0 }, y = { x: E + (a > 0 ? -u : u), y: 0 };
|
|
2162
|
+
} else if (v > p * 1.5) {
|
|
2171
2163
|
const x = d > 0 ? t.offsetHeight / 2 : -t.offsetHeight / 2, E = d > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
2172
|
-
|
|
2164
|
+
m = { x: 0, y: x + (d > 0 ? u : -u) }, y = { x: 0, y: E + (d > 0 ? -u : u) };
|
|
2173
2165
|
} else {
|
|
2174
2166
|
const x = Math.atan2(d, a), E = t.offsetWidth / 2 * Math.cos(x), N = t.offsetHeight / 2 * Math.sin(x), f = -(n.offsetWidth / 2) * Math.cos(x), b = -(n.offsetHeight / 2) * Math.sin(x), w = u * 0.7 * (a > 0 ? 1 : -1), S = u * 0.7 * (d > 0 ? 1 : -1);
|
|
2175
|
-
|
|
2167
|
+
m = { x: E + w, y: N + S }, y = { x: f - w, y: b - S };
|
|
2176
2168
|
}
|
|
2177
2169
|
return {
|
|
2178
|
-
delta1: { x: Math.round(
|
|
2179
|
-
delta2: { x: Math.round(
|
|
2170
|
+
delta1: { x: Math.round(m.x), y: Math.round(m.y) },
|
|
2171
|
+
delta2: { x: Math.round(y.x), y: Math.round(y.y) }
|
|
2180
2172
|
};
|
|
2181
2173
|
}, Ne = function(e, t, n, o, s) {
|
|
2182
2174
|
if (!t || !n)
|
|
@@ -2185,16 +2177,16 @@ const ut = function(e, t, n) {
|
|
|
2185
2177
|
const C = ut(e, t, n);
|
|
2186
2178
|
o.delta1 = C.delta1, o.delta2 = C.delta2;
|
|
2187
2179
|
}
|
|
2188
|
-
const i = V(e, t, o.delta1), l = V(e, n, o.delta2), { x: c, y: r } =
|
|
2189
|
-
if (!
|
|
2190
|
-
const
|
|
2191
|
-
let
|
|
2180
|
+
const i = V(e, t, o.delta1), l = V(e, n, o.delta2), { x: c, y: r } = I(i), { ctrlX: a, ctrlY: d } = i, { ctrlX: h, ctrlY: u } = l, { x: p, y: v } = I(l), m = se(h, u, p, v);
|
|
2181
|
+
if (!m) return;
|
|
2182
|
+
const y = `M ${m.x1} ${m.y1} L ${p} ${v} L ${m.x2} ${m.y2}`;
|
|
2183
|
+
let g = "";
|
|
2192
2184
|
if (o.bidirectional) {
|
|
2193
2185
|
const C = se(a, d, c, r);
|
|
2194
2186
|
if (!C) return;
|
|
2195
|
-
|
|
2187
|
+
g = `M ${C.x1} ${C.y1} L ${c} ${r} L ${C.x2} ${C.y2}`;
|
|
2196
2188
|
}
|
|
2197
|
-
const x =
|
|
2189
|
+
const x = jn(`M ${c} ${r} C ${a} ${d} ${h} ${u} ${p} ${v}`, y, g, o.style), { x: E, y: N } = ft(c, r, a, d, h, u, p, v), f = o.style?.labelColor || "rgb(235, 95, 82)", b = "a-" + o.id;
|
|
2198
2190
|
x.id = b;
|
|
2199
2191
|
const w = e.markdown ? e.markdown(o.label, o) : o.label, S = he(w, E, N, {
|
|
2200
2192
|
anchor: "middle",
|
|
@@ -2274,15 +2266,15 @@ const ut = function(e, t, n) {
|
|
|
2274
2266
|
const { linkController: s, P2: i, P3: l, line1: c, line2: r, nodes: a, map: d, currentArrow: h, bus: u } = e;
|
|
2275
2267
|
if (!h) return;
|
|
2276
2268
|
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(l), pt(h, ht);
|
|
2277
|
-
let { x:
|
|
2278
|
-
i.style.cssText = `top:${
|
|
2279
|
-
|
|
2280
|
-
const w =
|
|
2281
|
-
|
|
2269
|
+
let { x: p, y: v } = I(n), { ctrlX: m, ctrlY: y } = n, { ctrlX: g, ctrlY: x } = o, { x: E, y: N } = I(o);
|
|
2270
|
+
i.style.cssText = `top:${y}px;left:${m}px;`, l.style.cssText = `top:${x}px;left:${g}px;`, F(c, p, v, m, y), F(r, g, x, E, N), e.helper1 = Ve.create(i), e.helper2 = Ve.create(l), e.helper1.init(d, (f, b) => {
|
|
2271
|
+
m = m + f / e.scaleVal, y = y + b / e.scaleVal;
|
|
2272
|
+
const w = I({ ...n, ctrlX: m, ctrlY: y });
|
|
2273
|
+
p = w.x, v = w.y, i.style.top = y + "px", i.style.left = m + "px", ue(h, p, v, m, y, g, x, E, N, t), F(c, p, v, m, y), t.delta1.x = Math.round(m - n.cx), t.delta1.y = Math.round(y - n.cy), u.fire("updateArrowDelta", t);
|
|
2282
2274
|
}), e.helper2.init(d, (f, b) => {
|
|
2283
|
-
|
|
2284
|
-
const w =
|
|
2285
|
-
E = w.x, N = w.y, l.style.top = x + "px", l.style.left =
|
|
2275
|
+
g = g + f / e.scaleVal, x = x + b / e.scaleVal;
|
|
2276
|
+
const w = I({ ...o, ctrlX: g, ctrlY: x });
|
|
2277
|
+
E = w.x, N = w.y, l.style.top = x + "px", l.style.left = g + "px", ue(h, p, v, m, y, g, x, E, N, t), F(r, g, x, E, N), t.delta2.x = Math.round(g - o.cx), t.delta2.y = Math.round(x - o.cy), u.fire("updateArrowDelta", t);
|
|
2286
2278
|
});
|
|
2287
2279
|
};
|
|
2288
2280
|
function xo() {
|
|
@@ -2314,11 +2306,11 @@ const Co = function(e, t) {
|
|
|
2314
2306
|
const s = this.findEle(e.from), i = this.findEle(e.to);
|
|
2315
2307
|
if (s && i) {
|
|
2316
2308
|
if (!e.delta1 || !e.delta2) {
|
|
2317
|
-
const
|
|
2318
|
-
e.delta1 = e.delta1 ||
|
|
2309
|
+
const y = ut(this, s, i);
|
|
2310
|
+
e.delta1 = e.delta1 || y.delta1, e.delta2 = e.delta2 || y.delta2;
|
|
2319
2311
|
}
|
|
2320
|
-
const l = V(this, s, e.delta1), c = V(this, i, e.delta2), { x: r, y: a } =
|
|
2321
|
-
ue(o, r, a, d, h, u,
|
|
2312
|
+
const l = V(this, s, e.delta1), c = V(this, i, e.delta2), { x: r, y: a } = I(l), { ctrlX: d, ctrlY: h } = l, { ctrlX: u, ctrlY: p } = c, { x: v, y: m } = I(c);
|
|
2313
|
+
ue(o, r, a, d, h, u, p, v, m, e), this.currentArrow?.arrowObj?.id === e.id && (this.P2.style.cssText = `top:${h}px;left:${d}px;`, this.P3.style.cssText = `top:${p}px;left:${u}px;`, F(this.line1, r, a, d, h), F(this.line2, u, p, v, m));
|
|
2322
2314
|
}
|
|
2323
2315
|
}
|
|
2324
2316
|
this.bus.fire("operation", {
|
|
@@ -2354,8 +2346,8 @@ const Co = function(e, t) {
|
|
|
2354
2346
|
let a = r.nodeObj;
|
|
2355
2347
|
const d = [];
|
|
2356
2348
|
for (; a.parent; ) {
|
|
2357
|
-
const h = a.parent,
|
|
2358
|
-
a = h, d.unshift({ node: a, index:
|
|
2349
|
+
const h = a.parent, p = h.children?.indexOf(a);
|
|
2350
|
+
a = h, d.unshift({ node: a, index: p });
|
|
2359
2351
|
}
|
|
2360
2352
|
return d.length > t && (t = d.length), d;
|
|
2361
2353
|
});
|
|
@@ -2391,18 +2383,18 @@ const Co = function(e, t) {
|
|
|
2391
2383
|
let i;
|
|
2392
2384
|
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2393
2385
|
}, Te = function(e, t) {
|
|
2394
|
-
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,
|
|
2395
|
-
let v = 1 / 0,
|
|
2386
|
+
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, p = _o(e, t);
|
|
2387
|
+
let v = 1 / 0, m = 0, y = 0, g = 0;
|
|
2396
2388
|
for (let G = i; G <= l; G++) {
|
|
2397
2389
|
const ke = u.children?.[G];
|
|
2398
2390
|
if (!ke)
|
|
2399
2391
|
return e.removeSummary(n), null;
|
|
2400
2392
|
const J = ko(e.findEle(ke.id)), { offsetLeft: Z, offsetTop: _e } = A(r, J), De = i === l ? 10 : 20;
|
|
2401
|
-
G === i && (
|
|
2393
|
+
G === i && (y = _e + De), G === l && (g = _e + J.offsetHeight - De), Z < v && (v = Z), J.offsetWidth + Z > m && (m = J.offsetWidth + Z);
|
|
2402
2394
|
}
|
|
2403
2395
|
let x, E;
|
|
2404
|
-
const N = u.parent ? 10 : 0, f =
|
|
2405
|
-
|
|
2396
|
+
const N = u.parent ? 10 : 0, f = y + N, b = g + N, w = (f + b) / 2, S = c?.stroke || a.cssVar["--color"], C = c?.labelColor || a.cssVar["--color"], T = "s-" + n, D = e.markdown ? e.markdown(o, t) : o;
|
|
2397
|
+
p === $.LHS ? (x = ze(`M ${v + 10} ${f} c -5 0 -10 5 -10 10 L ${v} ${b - 10} c 0 5 5 10 10 10 M ${v} ${w} h -10`, S), E = he(D, v - 20, w, { anchor: "end", color: C, dataType: "summary", svgId: T })) : (x = ze(`M ${m - 10} ${f} c 5 0 10 5 10 10 L ${m} ${b - 10} c 0 5 -5 10 -10 10 M ${m} ${w} h 10`, S), E = he(D, m + 20, w, { anchor: "start", color: C, dataType: "summary", svgId: T }));
|
|
2406
2398
|
const L = To(T);
|
|
2407
2399
|
return L.appendChild(x), e.labelContainer.appendChild(E), le(E), L.summaryObj = t, L.labelEl = E, d.appendChild(L), L;
|
|
2408
2400
|
}, Do = function(e = {}) {
|
|
@@ -2448,7 +2440,7 @@ const Co = function(e, t) {
|
|
|
2448
2440
|
selectSummary: Mo,
|
|
2449
2441
|
unselectSummary: Po
|
|
2450
2442
|
}, Symbol.toStringTag, { value: "Module" })), _ = "http://www.w3.org/2000/svg";
|
|
2451
|
-
function
|
|
2443
|
+
function Io(e, t) {
|
|
2452
2444
|
const n = document.createElementNS(_, "svg");
|
|
2453
2445
|
return k(n, {
|
|
2454
2446
|
version: "1.1",
|
|
@@ -2457,7 +2449,7 @@ function jo(e, t) {
|
|
|
2457
2449
|
width: t
|
|
2458
2450
|
}), n;
|
|
2459
2451
|
}
|
|
2460
|
-
function
|
|
2452
|
+
function jo(e, t) {
|
|
2461
2453
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2462
2454
|
}
|
|
2463
2455
|
function Ro(e, t, n, o) {
|
|
@@ -2468,7 +2460,7 @@ function Ro(e, t, n, o) {
|
|
|
2468
2460
|
const a = document.createElementNS(_, "text");
|
|
2469
2461
|
k(a, {
|
|
2470
2462
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2471
|
-
y: o + parseInt(t.paddingTop) +
|
|
2463
|
+
y: o + parseInt(t.paddingTop) + jo(t.lineHeight, t.fontSize) * (r + 1) + parseFloat(t.fontSize) * (r + 1) + "",
|
|
2472
2464
|
"text-anchor": "start",
|
|
2473
2465
|
"font-family": t.fontFamily,
|
|
2474
2466
|
"font-size": `${t.fontSize}`,
|
|
@@ -2548,7 +2540,7 @@ function Xo(e, t) {
|
|
|
2548
2540
|
}), i;
|
|
2549
2541
|
}
|
|
2550
2542
|
const te = 100, Fo = '<?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">', Ko = (e, t = !1) => {
|
|
2551
|
-
const n = e.nodes, o = n.offsetHeight + te * 2, s = n.offsetWidth + te * 2, i =
|
|
2543
|
+
const n = e.nodes, o = n.offsetHeight + te * 2, s = n.offsetWidth + te * 2, i = Io(o + "px", s + "px"), l = document.createElementNS(_, "svg"), c = document.createElementNS(_, "rect");
|
|
2552
2544
|
k(c, {
|
|
2553
2545
|
x: "0",
|
|
2554
2546
|
y: "0",
|
|
@@ -2556,8 +2548,8 @@ const te = 100, Fo = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2556
2548
|
height: `${o}`,
|
|
2557
2549
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2558
2550
|
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((h) => {
|
|
2559
|
-
const u = h.cloneNode(!0), { offsetLeft:
|
|
2560
|
-
u.setAttribute("x", `${
|
|
2551
|
+
const u = h.cloneNode(!0), { offsetLeft: p, offsetTop: v } = A(n, h.parentElement);
|
|
2552
|
+
u.setAttribute("x", `${p}`), u.setAttribute("y", `${v}`), l.appendChild(u);
|
|
2561
2553
|
});
|
|
2562
2554
|
const r = n.querySelector(".lines")?.cloneNode(!0);
|
|
2563
2555
|
r && l.appendChild(r);
|
|
@@ -2650,7 +2642,7 @@ const Zo = {
|
|
|
2650
2642
|
enableMobileMultiSelect(e) {
|
|
2651
2643
|
this.mobileMultiSelect = e;
|
|
2652
2644
|
}
|
|
2653
|
-
}, Qo = "5.14.0-beta.
|
|
2645
|
+
}, Qo = "5.14.0-beta.1";
|
|
2654
2646
|
function es(e) {
|
|
2655
2647
|
return {
|
|
2656
2648
|
x: 0,
|
|
@@ -2692,11 +2684,11 @@ function P({
|
|
|
2692
2684
|
allowUndo: d,
|
|
2693
2685
|
generateMainBranch: h,
|
|
2694
2686
|
generateSubBranch: u,
|
|
2695
|
-
overflowHidden:
|
|
2687
|
+
overflowHidden: p,
|
|
2696
2688
|
compact: v,
|
|
2697
|
-
theme:
|
|
2698
|
-
alignment:
|
|
2699
|
-
scaleSensitivity:
|
|
2689
|
+
theme: m,
|
|
2690
|
+
alignment: y,
|
|
2691
|
+
scaleSensitivity: g,
|
|
2700
2692
|
scaleMax: x,
|
|
2701
2693
|
scaleMin: E,
|
|
2702
2694
|
handleWheel: N,
|
|
@@ -2708,11 +2700,11 @@ function P({
|
|
|
2708
2700
|
let C = null;
|
|
2709
2701
|
const T = Object.prototype.toString.call(e);
|
|
2710
2702
|
if (T === "[object HTMLDivElement]" ? C = e : T === "[object String]" && (C = document.querySelector(e)), !C) throw new Error("MindElixir: el is not a valid element");
|
|
2711
|
-
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 =
|
|
2703
|
+
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 = g ?? 0.1, this.scaleMax = x ?? 1.4, this.scaleMin = E ?? 0.2, this.generateMainBranch = h || at, this.generateSubBranch = u || dt, this.overflowHidden = p ?? !1, this.compact = v ?? !1, this.alignment = y ?? "root", this.handleWheel = N ?? !0, this.markdown = f || void 0, this.imageProxy = b || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.mobileMultiSelect = S ?? !1, this.panHelper = es(this), this.bus = In(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
2712
2704
|
const D = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2713
|
-
this.theme =
|
|
2705
|
+
this.theme = m || (D.matches ? ge : pe);
|
|
2714
2706
|
const L = document.createElement("div");
|
|
2715
|
-
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 = q("lines"), this.summarySvg = q("summary"), this.linkController = q("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 =
|
|
2707
|
+
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 = q("lines"), this.summarySvg = q("summary"), this.linkController = q("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 = q("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(Hn(this)), w && (this.pasteHandler = w);
|
|
2716
2708
|
}
|
|
2717
2709
|
P.prototype = Zo;
|
|
2718
2710
|
Object.defineProperty(P.prototype, "currentNode", {
|