Package not found. Please check the package name and try again.
mind-elixir 5.12.2-beta.2 → 5.12.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MindElixir.iife.js +4 -4
- package/dist/MindElixir.js +44 -49
- package/dist/MindElixirLite.iife.js +3 -3
- package/dist/MindElixirLite.js +83 -88
- package/package.json +1 -1
package/dist/MindElixirLite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const Wn = 0, Yn = 1, Rn = 2,
|
|
1
|
+
const Wn = 0, Yn = 1, Rn = 2, G = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -85,11 +85,11 @@ function q(t, e, n, o) {
|
|
|
85
85
|
y2: o + Math.sin(d) * l
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function Y() {
|
|
89
89
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substring(2)).substring(2, 18);
|
|
90
90
|
}
|
|
91
91
|
const Ot = function() {
|
|
92
|
-
const t =
|
|
92
|
+
const t = Y();
|
|
93
93
|
return {
|
|
94
94
|
topic: this.newTopicName,
|
|
95
95
|
id: t
|
|
@@ -105,7 +105,7 @@ const Ot = function() {
|
|
|
105
105
|
}, Z = (t) => t ? t.tagName === "ME-TPC" : !1, ot = (t) => {
|
|
106
106
|
const e = /translate3d\(([^,]+),\s*([^,]+)/, n = t.match(e);
|
|
107
107
|
return n ? { x: parseFloat(n[1]), y: parseFloat(n[2]) } : { x: 0, y: 0 };
|
|
108
|
-
},
|
|
108
|
+
}, vt = function(t) {
|
|
109
109
|
for (let e = 0; e < t.length; e++) {
|
|
110
110
|
const { dom: n, evt: o, func: s } = t[e];
|
|
111
111
|
n.addEventListener(o, s);
|
|
@@ -177,11 +177,11 @@ function ft(t, e, n, o = !1) {
|
|
|
177
177
|
if (e.startX = n.clientX, e.startY = n.clientY, e.pointerId = n.pointerId, t.dragged = t.currentNodes, o) {
|
|
178
178
|
xt(t, e);
|
|
179
179
|
const i = t.container.getBoundingClientRect();
|
|
180
|
-
|
|
180
|
+
bt(e.ghost, n.clientX - i.x, n.clientY - i.y);
|
|
181
181
|
}
|
|
182
182
|
return !0;
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function bt(t, e, n) {
|
|
185
185
|
t.style.transform = `translate(${e - 10}px, ${n - 10}px)`, t.style.display = "block";
|
|
186
186
|
}
|
|
187
187
|
function xt(t, e) {
|
|
@@ -199,7 +199,7 @@ function Vt(t, e, n) {
|
|
|
199
199
|
const s = n.clientX - e.startX, i = n.clientY - e.startY, r = Math.sqrt(s * s + i * i);
|
|
200
200
|
if (!e.isDragging && r > Xt && xt(t, e), !e.isDragging) return;
|
|
201
201
|
const c = t.container.getBoundingClientRect();
|
|
202
|
-
|
|
202
|
+
bt(e.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? e.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? e.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? e.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? e.edgeMoveController.move(0, -1) : e.edgeMoveController.stop(), U(e.meet);
|
|
203
203
|
const l = 12 * t.scaleVal, a = document.elementFromPoint(n.clientX, n.clientY - l);
|
|
204
204
|
if (dt(a, o)) {
|
|
205
205
|
e.meet = a;
|
|
@@ -465,9 +465,9 @@ const ee = function(t, e = !1) {
|
|
|
465
465
|
this.direction = 0, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
466
466
|
}, we = function() {
|
|
467
467
|
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
468
|
-
},
|
|
468
|
+
}, ve = function() {
|
|
469
469
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
470
|
-
},
|
|
470
|
+
}, be = function(t, e) {
|
|
471
471
|
const n = t.nodeObj;
|
|
472
472
|
typeof e == "boolean" ? n.expanded = e : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
473
473
|
const o = t.getBoundingClientRect(), s = {
|
|
@@ -506,14 +506,14 @@ const ee = function(t, e = !1) {
|
|
|
506
506
|
clearSelection: ie,
|
|
507
507
|
disableEdit: ae,
|
|
508
508
|
enableEdit: le,
|
|
509
|
-
expandNode:
|
|
509
|
+
expandNode: be,
|
|
510
510
|
expandNodeAll: xe,
|
|
511
511
|
focusNode: ge,
|
|
512
512
|
getData: ce,
|
|
513
513
|
getDataString: re,
|
|
514
514
|
initLeft: ye,
|
|
515
515
|
initRight: we,
|
|
516
|
-
initSide:
|
|
516
|
+
initSide: ve,
|
|
517
517
|
install: pe,
|
|
518
518
|
move: fe,
|
|
519
519
|
refresh: Ce,
|
|
@@ -710,25 +710,25 @@ function ke(t) {
|
|
|
710
710
|
const m = h.target;
|
|
711
711
|
Z(m) && !m.classList.contains("selected") && t.selectNode(m), t.bus.fire("showContextMenu", h);
|
|
712
712
|
}, 200);
|
|
713
|
-
},
|
|
713
|
+
}, b = (h) => {
|
|
714
714
|
if (h.stopPropagation(), h.preventDefault(), h.ctrlKey || h.metaKey) return Pe(t, h);
|
|
715
715
|
if (h.shiftKey) return t.move(-h.deltaY, 0);
|
|
716
716
|
t.move(-h.deltaX, -h.deltaY);
|
|
717
|
-
},
|
|
717
|
+
}, v = (h) => {
|
|
718
718
|
h.code === "Space" && (t.spacePressed = !0, t.container.classList.add("space-pressed"));
|
|
719
719
|
}, C = (h) => {
|
|
720
720
|
h.code === "Space" && (t.spacePressed = !1, t.container.classList.remove("space-pressed"));
|
|
721
721
|
};
|
|
722
|
-
return
|
|
722
|
+
return vt([
|
|
723
723
|
{ dom: n, evt: "pointerdown", func: p },
|
|
724
724
|
{ dom: n, evt: "pointermove", func: w },
|
|
725
725
|
{ dom: n, evt: "pointerup", func: y },
|
|
726
726
|
{ dom: n, evt: "pointercancel", func: u },
|
|
727
727
|
{ dom: n, evt: "click", func: f },
|
|
728
728
|
{ dom: n, evt: "contextmenu", func: g },
|
|
729
|
-
{ dom: n, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel :
|
|
729
|
+
{ dom: n, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : b },
|
|
730
730
|
{ dom: n, evt: "blur", func: u },
|
|
731
|
-
{ dom: n, evt: "keydown", func:
|
|
731
|
+
{ dom: n, evt: "keydown", func: v },
|
|
732
732
|
{ dom: n, evt: "keyup", func: C }
|
|
733
733
|
]);
|
|
734
734
|
}
|
|
@@ -842,11 +842,11 @@ const k = "http://www.w3.org/2000/svg", K = function(t) {
|
|
|
842
842
|
const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, s = e.offsetWidth, i = e.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
843
843
|
this.lines.innerHTML = "";
|
|
844
844
|
for (let c = 0; c < r.length; c++) {
|
|
845
|
-
const l = r[c], a = l.querySelector("me-tpc"), { offsetLeft: f, offsetTop: d } = P(this.nodes, a), p = a.offsetWidth, w = a.offsetHeight, y = l.parentNode.className, u = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: d, cL: f, cW: p, cH: w, direction: y, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette,
|
|
846
|
-
if (a.style.borderColor =
|
|
845
|
+
const l = r[c], a = l.querySelector("me-tpc"), { offsetLeft: f, offsetTop: d } = P(this.nodes, a), p = a.offsetWidth, w = a.offsetHeight, y = l.parentNode.className, u = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: d, cL: f, cW: p, cH: w, direction: y, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, b = a.nodeObj.branchColor || g[c % g.length];
|
|
846
|
+
if (a.style.borderColor = b, this.lines.appendChild(Dt(u, b, "3")), t && t !== l)
|
|
847
847
|
continue;
|
|
848
|
-
const
|
|
849
|
-
C.tagName === "svg" && C.remove(), l.appendChild(
|
|
848
|
+
const v = W("subLines"), C = l.lastChild;
|
|
849
|
+
C.tagName === "svg" && C.remove(), l.appendChild(v), Mt(this, v, b, l, y, !0);
|
|
850
850
|
}
|
|
851
851
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
852
852
|
}, Mt = function(t, e, n, o, s, i) {
|
|
@@ -854,7 +854,7 @@ const k = "http://www.w3.org/2000/svg", K = function(t) {
|
|
|
854
854
|
if (c.length === 0) return;
|
|
855
855
|
const l = r.offsetTop, a = r.offsetLeft, f = r.offsetWidth, d = r.offsetHeight;
|
|
856
856
|
for (let p = 0; p < c.length; p++) {
|
|
857
|
-
const w = c[p], y = w.firstChild, u = y.offsetTop, g = y.offsetLeft,
|
|
857
|
+
const w = c[p], y = w.firstChild, u = y.offsetTop, g = y.offsetLeft, b = y.offsetWidth, v = y.offsetHeight, C = y.firstChild.nodeObj.branchColor || n, T = t.generateSubBranch({ pT: l, pL: a, pW: f, pH: d, cT: u, cL: g, cW: b, cH: v, direction: s, isFirst: i });
|
|
858
858
|
e.appendChild(Dt(T, C, "2"));
|
|
859
859
|
const h = y.children[1];
|
|
860
860
|
if (h) {
|
|
@@ -930,27 +930,22 @@ function kt({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction:
|
|
|
930
930
|
a ? d = t + o / 2 : d = t + o;
|
|
931
931
|
const w = s + c;
|
|
932
932
|
let y = 0, u = 0, g = 0;
|
|
933
|
-
const
|
|
934
|
-
return l === O.LHS ? (g = e, y = g + f, u = g - f, p = i + f, `M ${y} ${d} C ${g} ${d} ${g +
|
|
933
|
+
const b = Math.abs(d - w) / 300 * f;
|
|
934
|
+
return l === O.LHS ? (g = e, y = g + f, u = g - f, p = i + f, `M ${y} ${d} C ${g} ${d} ${g + b} ${w} ${u} ${w} H ${p}`) : (g = e + n, y = g - f, u = g + f, p = i + r - f, `M ${y} ${d} C ${g} ${d} ${g - b} ${w} ${u} ${w} H ${p}`);
|
|
935
935
|
}
|
|
936
936
|
const Ge = function(t, e = !0) {
|
|
937
|
+
const n = this.theme || G, s = (t.type || n.type) === "dark" ? et : G;
|
|
937
938
|
this.theme = {
|
|
938
|
-
...
|
|
939
|
+
...n,
|
|
939
940
|
...t,
|
|
940
|
-
cssVar: {
|
|
941
|
-
...this.theme?.cssVar || Y.cssVar,
|
|
942
|
-
...t.cssVar || {}
|
|
943
|
-
}
|
|
941
|
+
cssVar: t.cssVar ? { ...n.cssVar, ...t.cssVar } : { ...s.cssVar }
|
|
944
942
|
}, this.generateMainBranch = this.theme.generateMainBranch || Pt, this.generateSubBranch = this.theme.generateSubBranch || kt;
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
for (let i = 0; i < s.length; i++) {
|
|
952
|
-
const r = s[i];
|
|
953
|
-
this.container.style.setProperty(r, o[r]);
|
|
943
|
+
const i = { ...this.theme.cssVar };
|
|
944
|
+
this.compact && (i["--node-gap-x"] = "15px", i["--node-gap-y"] = "2px", i["--main-gap-x"] = "30px", i["--main-gap-y"] = "6px");
|
|
945
|
+
const r = Object.keys(i);
|
|
946
|
+
for (let c = 0; c < r.length; c++) {
|
|
947
|
+
const l = r[c];
|
|
948
|
+
this.container.style.setProperty(l, i[l]);
|
|
954
949
|
}
|
|
955
950
|
e && this.refresh();
|
|
956
951
|
}, _e = function(t) {
|
|
@@ -978,7 +973,7 @@ const Ge = function(t, e = !0) {
|
|
|
978
973
|
},
|
|
979
974
|
cb: null,
|
|
980
975
|
init(e, n) {
|
|
981
|
-
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy =
|
|
976
|
+
this.cb = n, this.handleClear = this.handleClear.bind(this), this.handlePointerMove = this.handlePointerMove.bind(this), this.handlePointerDown = this.handlePointerDown.bind(this), this.destroy = vt([
|
|
982
977
|
{ dom: e, evt: "pointermove", func: this.handlePointerMove },
|
|
983
978
|
{ dom: e, evt: "pointerleave", func: this.handleClear },
|
|
984
979
|
{ dom: e, evt: "pointerup", func: this.handleClear },
|
|
@@ -1002,7 +997,7 @@ function At(t, e, n, o, s, i, r, c) {
|
|
|
1002
997
|
function je(t, e, n) {
|
|
1003
998
|
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), K(t));
|
|
1004
999
|
}
|
|
1005
|
-
function
|
|
1000
|
+
function V(t, e, n, o, s) {
|
|
1006
1001
|
D(t, {
|
|
1007
1002
|
x1: e + "",
|
|
1008
1003
|
y1: n + "",
|
|
@@ -1031,8 +1026,8 @@ function mt(t, e, n, o, s, i, r, c, l, a) {
|
|
|
1031
1026
|
if (u) {
|
|
1032
1027
|
const g = `M ${u.x1} ${u.y1} L ${e} ${n} L ${u.x2} ${u.y2}`;
|
|
1033
1028
|
if (t.arrow2.setAttribute("d", g), d.length > 2 && d[2].setAttribute("d", g), a.style) {
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1029
|
+
const b = a.style;
|
|
1030
|
+
b.stroke && t.arrow2.setAttribute("stroke", b.stroke), b.strokeWidth && t.arrow2.setAttribute("stroke-width", String(b.strokeWidth)), b.strokeLinecap && t.arrow2.setAttribute("stroke-linecap", b.strokeLinecap), b.opacity !== void 0 && t.arrow2.setAttribute("opacity", String(b.opacity));
|
|
1036
1031
|
}
|
|
1037
1032
|
}
|
|
1038
1033
|
}
|
|
@@ -1066,16 +1061,16 @@ const Ue = function(t, e, n) {
|
|
|
1066
1061
|
const o = P(t.nodes, e), s = P(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, l = s.offsetTop + n.offsetHeight / 2, a = c - i, f = l - r, d = Math.sqrt(a * a + f * f), p = Math.max(50, Math.min(200, d * 0.3)), w = Math.abs(a), y = Math.abs(f);
|
|
1067
1062
|
let u, g;
|
|
1068
1063
|
if (d < 150) {
|
|
1069
|
-
const
|
|
1070
|
-
u = { x: 200 *
|
|
1064
|
+
const v = e.closest("me-main").className === "lhs" ? -1 : 1;
|
|
1065
|
+
u = { x: 200 * v, y: 0 }, g = { x: 200 * v, y: 0 };
|
|
1071
1066
|
} else if (w > y * 1.5) {
|
|
1072
|
-
const
|
|
1073
|
-
u = { x:
|
|
1067
|
+
const v = a > 0 ? e.offsetWidth / 2 : -e.offsetWidth / 2, C = a > 0 ? -n.offsetWidth / 2 : n.offsetWidth / 2;
|
|
1068
|
+
u = { x: v + (a > 0 ? p : -p), y: 0 }, g = { x: C + (a > 0 ? -p : p), y: 0 };
|
|
1074
1069
|
} else if (y > w * 1.5) {
|
|
1075
|
-
const
|
|
1076
|
-
u = { x: 0, y:
|
|
1070
|
+
const v = f > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2, C = f > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
1071
|
+
u = { x: 0, y: v + (f > 0 ? p : -p) }, g = { x: 0, y: C + (f > 0 ? -p : p) };
|
|
1077
1072
|
} else {
|
|
1078
|
-
const
|
|
1073
|
+
const v = Math.atan2(f, a), C = e.offsetWidth / 2 * Math.cos(v), T = e.offsetHeight / 2 * Math.sin(v), h = -(n.offsetWidth / 2) * Math.cos(v), m = -(n.offsetHeight / 2) * Math.sin(v), x = p * 0.7 * (a > 0 ? 1 : -1), E = p * 0.7 * (f > 0 ? 1 : -1);
|
|
1079
1074
|
u = { x: C + x, y: T + E }, g = { x: h - x, y: m - E };
|
|
1080
1075
|
}
|
|
1081
1076
|
return {
|
|
@@ -1092,24 +1087,24 @@ const Ue = function(t, e, n) {
|
|
|
1092
1087
|
const i = j(t, e, o.delta1), r = j(t, n, o.delta2), { x: c, y: l } = I(i), { ctrlX: a, ctrlY: f } = i, { ctrlX: d, ctrlY: p } = r, { x: w, y } = I(r), u = q(d, p, w, y);
|
|
1093
1088
|
if (!u) return;
|
|
1094
1089
|
const g = `M ${u.x1} ${u.y1} L ${w} ${y} L ${u.x2} ${u.y2}`;
|
|
1095
|
-
let
|
|
1090
|
+
let b = "";
|
|
1096
1091
|
if (o.bidirectional) {
|
|
1097
1092
|
const S = q(a, f, c, l);
|
|
1098
1093
|
if (!S) return;
|
|
1099
|
-
|
|
1094
|
+
b = `M ${S.x1} ${S.y1} L ${c} ${l} L ${S.x2} ${S.y2}`;
|
|
1100
1095
|
}
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1096
|
+
const v = Ae(`M ${c} ${l} C ${a} ${f} ${d} ${p} ${w} ${y}`, g, b, o.style), { x: C, y: T } = At(c, l, a, f, d, p, w, y), h = o.style?.labelColor || "rgb(235, 95, 82)", m = "a-" + o.id;
|
|
1097
|
+
v.id = m;
|
|
1103
1098
|
const x = t.markdown ? t.markdown(o.label, o) : o.label, E = tt(x, C, T, {
|
|
1104
1099
|
anchor: "middle",
|
|
1105
1100
|
color: h,
|
|
1106
1101
|
dataType: "arrow",
|
|
1107
1102
|
svgId: m
|
|
1108
1103
|
});
|
|
1109
|
-
|
|
1104
|
+
v.labelEl = E, v.arrowObj = o, v.dataset.linkid = o.id, t.labelContainer.appendChild(E), t.arrowSvg.appendChild(v), K(E), s || (t.arrows.push(o), t.currentArrow = v, Ht(t, o, i, r));
|
|
1110
1105
|
}, Ke = function(t, e, n = {}) {
|
|
1111
1106
|
const o = {
|
|
1112
|
-
id:
|
|
1107
|
+
id: Y(),
|
|
1113
1108
|
label: "Custom Link",
|
|
1114
1109
|
from: t.nodeObj.id,
|
|
1115
1110
|
to: e.nodeObj.id,
|
|
@@ -1121,7 +1116,7 @@ const Ue = function(t, e, n) {
|
|
|
1121
1116
|
});
|
|
1122
1117
|
}, Je = function(t) {
|
|
1123
1118
|
J(this);
|
|
1124
|
-
const e = { ...t, id:
|
|
1119
|
+
const e = { ...t, id: Y() };
|
|
1125
1120
|
it(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
|
|
1126
1121
|
name: "createArrow",
|
|
1127
1122
|
obj: e
|
|
@@ -1178,15 +1173,15 @@ const Ue = function(t, e, n) {
|
|
|
1178
1173
|
const { linkController: s, P2: i, P3: r, line1: c, line2: l, nodes: a, map: f, currentArrow: d, bus: p } = t;
|
|
1179
1174
|
if (!d) return;
|
|
1180
1175
|
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", a.appendChild(s), a.appendChild(i), a.appendChild(r), $t(d, Nt);
|
|
1181
|
-
let { x: w, y } = I(n), { ctrlX: u, ctrlY: g } = n, { ctrlX:
|
|
1182
|
-
i.style.cssText = `top:${g}px;left:${u}px;`, r.style.cssText = `top:${
|
|
1176
|
+
let { x: w, y } = I(n), { ctrlX: u, ctrlY: g } = n, { ctrlX: b, ctrlY: v } = o, { x: C, y: T } = I(o);
|
|
1177
|
+
i.style.cssText = `top:${g}px;left:${u}px;`, r.style.cssText = `top:${v}px;left:${b}px;`, V(c, w, y, u, g), V(l, b, v, C, T), t.helper1 = gt.create(i), t.helper2 = gt.create(r), t.helper1.init(f, (h, m) => {
|
|
1183
1178
|
u = u + h / t.scaleVal, g = g + m / t.scaleVal;
|
|
1184
1179
|
const x = I({ ...n, ctrlX: u, ctrlY: g });
|
|
1185
|
-
w = x.x, y = x.y, i.style.top = g + "px", i.style.left = u + "px", mt(d, w, y, u, g,
|
|
1180
|
+
w = x.x, y = x.y, i.style.top = g + "px", i.style.left = u + "px", mt(d, w, y, u, g, b, v, C, T, e), V(c, w, y, u, g), e.delta1.x = Math.round(u - n.cx), e.delta1.y = Math.round(g - n.cy), p.fire("updateArrowDelta", e);
|
|
1186
1181
|
}), t.helper2.init(f, (h, m) => {
|
|
1187
|
-
|
|
1188
|
-
const x = I({ ...o, ctrlX:
|
|
1189
|
-
C = x.x, T = x.y, r.style.top =
|
|
1182
|
+
b = b + h / t.scaleVal, v = v + m / t.scaleVal;
|
|
1183
|
+
const x = I({ ...o, ctrlX: b, ctrlY: v });
|
|
1184
|
+
C = x.x, T = x.y, r.style.top = v + "px", r.style.left = b + "px", mt(d, w, y, u, g, b, v, C, T, e), V(l, b, v, C, T), e.delta2.x = Math.round(b - o.cx), e.delta2.y = Math.round(v - o.cy), p.fire("updateArrowDelta", e);
|
|
1190
1185
|
});
|
|
1191
1186
|
};
|
|
1192
1187
|
function on() {
|
|
@@ -1271,28 +1266,28 @@ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1271
1266
|
return s.parent ? i = o.closest("me-main").className : i = t.findEle(s.children[n].id).closest("me-main").className, i;
|
|
1272
1267
|
}, rt = function(t, e) {
|
|
1273
1268
|
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: l, theme: a, summarySvg: f } = t, p = t.findEle(s).nodeObj, w = dn(t, e);
|
|
1274
|
-
let y = 1 / 0, u = 0, g = 0,
|
|
1269
|
+
let y = 1 / 0, u = 0, g = 0, b = 0;
|
|
1275
1270
|
for (let B = i; B <= r; B++) {
|
|
1276
1271
|
const ct = p.children?.[B];
|
|
1277
1272
|
if (!ct)
|
|
1278
1273
|
return t.removeSummary(n), null;
|
|
1279
|
-
const
|
|
1280
|
-
B === i && (g = lt + at), B === r && (
|
|
1274
|
+
const R = hn(t.findEle(ct.id)), { offsetLeft: X, offsetTop: lt } = P(l, R), at = i === r ? 10 : 20;
|
|
1275
|
+
B === i && (g = lt + at), B === r && (b = lt + R.offsetHeight - at), X < y && (y = X), R.offsetWidth + X > u && (u = R.offsetWidth + X);
|
|
1281
1276
|
}
|
|
1282
|
-
let
|
|
1283
|
-
const T = p.parent ? 10 : 0, h = g + T, m =
|
|
1284
|
-
w === O.LHS ? (
|
|
1277
|
+
let v, C;
|
|
1278
|
+
const T = p.parent ? 10 : 0, h = g + T, m = b + T, x = (h + m) / 2, E = c?.stroke || a.cssVar["--color"], S = c?.labelColor || a.cssVar["--color"], M = "s-" + n, N = t.markdown ? t.markdown(o, e) : o;
|
|
1279
|
+
w === O.LHS ? (v = yt(`M ${y + 10} ${h} c -5 0 -10 5 -10 10 L ${y} ${m - 10} c 0 5 5 10 10 10 M ${y} ${x} h -10`, E), C = tt(N, y - 20, x, { anchor: "end", color: S, dataType: "summary", svgId: M })) : (v = yt(`M ${u - 10} ${h} c 5 0 10 5 10 10 L ${u} ${m - 10} c 0 5 -5 10 -10 10 M ${u} ${x} h 10`, E), C = tt(N, u + 20, x, { anchor: "start", color: S, dataType: "summary", svgId: M }));
|
|
1285
1280
|
const $ = an(M);
|
|
1286
|
-
return $.appendChild(
|
|
1281
|
+
return $.appendChild(v), t.labelContainer.appendChild(C), K(C), $.summaryObj = e, $.labelEl = C, f.appendChild($), $;
|
|
1287
1282
|
}, fn = function(t = {}) {
|
|
1288
1283
|
if (!this.currentNodes) return;
|
|
1289
|
-
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = ln(e), c = { id:
|
|
1284
|
+
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = ln(e), c = { id: Y(), parent: s, start: i, end: r, label: "summary", style: t.style }, l = rt(this, c);
|
|
1290
1285
|
n.push(c), this.editSummary(l), o.fire("operation", {
|
|
1291
1286
|
name: "createSummary",
|
|
1292
1287
|
obj: c
|
|
1293
1288
|
});
|
|
1294
1289
|
}, un = function(t) {
|
|
1295
|
-
const e =
|
|
1290
|
+
const e = Y(), n = { ...t, id: e };
|
|
1296
1291
|
rt(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
1297
1292
|
name: "createSummary",
|
|
1298
1293
|
obj: n
|
|
@@ -1317,7 +1312,7 @@ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1317
1312
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
1318
1313
|
}, wn = function(t) {
|
|
1319
1314
|
t && t.labelEl && Lt(this, t.labelEl, t.summaryObj);
|
|
1320
|
-
},
|
|
1315
|
+
}, vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1321
1316
|
__proto__: null,
|
|
1322
1317
|
createSummary: fn,
|
|
1323
1318
|
createSummaryFrom: un,
|
|
@@ -1327,7 +1322,7 @@ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1327
1322
|
selectSummary: gn,
|
|
1328
1323
|
unselectSummary: mn
|
|
1329
1324
|
}, Symbol.toStringTag, { value: "Module" })), L = "http://www.w3.org/2000/svg";
|
|
1330
|
-
function
|
|
1325
|
+
function bn(t, e) {
|
|
1331
1326
|
const n = document.createElementNS(L, "svg");
|
|
1332
1327
|
return D(n, {
|
|
1333
1328
|
version: "1.1",
|
|
@@ -1386,7 +1381,7 @@ function En(t, e) {
|
|
|
1386
1381
|
"stroke-width": n.borderWidth
|
|
1387
1382
|
}), i;
|
|
1388
1383
|
}
|
|
1389
|
-
function
|
|
1384
|
+
function z(t, e, n = !1) {
|
|
1390
1385
|
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = P(t.nodes, e), r = document.createElementNS(L, "rect");
|
|
1391
1386
|
D(r, {
|
|
1392
1387
|
x: s + "",
|
|
@@ -1426,8 +1421,8 @@ function Dn(t, e) {
|
|
|
1426
1421
|
href: e.src
|
|
1427
1422
|
}), i;
|
|
1428
1423
|
}
|
|
1429
|
-
const
|
|
1430
|
-
const n = t.nodes, o = n.offsetHeight +
|
|
1424
|
+
const F = 100, Ln = '<?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">', Mn = (t, e = !1) => {
|
|
1425
|
+
const n = t.nodes, o = n.offsetHeight + F * 2, s = n.offsetWidth + F * 2, i = bn(o + "px", s + "px"), r = document.createElementNS(L, "svg"), c = document.createElementNS(L, "rect");
|
|
1431
1426
|
D(c, {
|
|
1432
1427
|
x: "0",
|
|
1433
1428
|
y: "0",
|
|
@@ -1444,18 +1439,18 @@ const G = 100, Ln = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1444
1439
|
a && r.appendChild(a);
|
|
1445
1440
|
const f = n.querySelector(".summary")?.cloneNode(!0);
|
|
1446
1441
|
return f && r.appendChild(f), n.querySelectorAll("me-tpc").forEach((d) => {
|
|
1447
|
-
d.nodeObj.dangerouslySetInnerHTML ? r.appendChild(
|
|
1442
|
+
d.nodeObj.dangerouslySetInnerHTML ? r.appendChild(z(t, d, !e)) : (r.appendChild(En(t, d)), r.appendChild(z(t, d.text, !e)));
|
|
1448
1443
|
}), n.querySelectorAll(".tags > span").forEach((d) => {
|
|
1449
|
-
r.appendChild(
|
|
1444
|
+
r.appendChild(z(t, d));
|
|
1450
1445
|
}), n.querySelectorAll(".icons > span").forEach((d) => {
|
|
1451
|
-
r.appendChild(
|
|
1446
|
+
r.appendChild(z(t, d));
|
|
1452
1447
|
}), n.querySelectorAll(".hyper-link").forEach((d) => {
|
|
1453
1448
|
r.appendChild(Tn(t, d));
|
|
1454
1449
|
}), n.querySelectorAll("img").forEach((d) => {
|
|
1455
1450
|
r.appendChild(Dn(t, d));
|
|
1456
1451
|
}), D(r, {
|
|
1457
|
-
x:
|
|
1458
|
-
y:
|
|
1452
|
+
x: F + "",
|
|
1453
|
+
y: F + "",
|
|
1459
1454
|
overflow: "visible"
|
|
1460
1455
|
}), i.appendChild(r), i;
|
|
1461
1456
|
}, Pn = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), Ln + t.outerHTML);
|
|
@@ -1501,7 +1496,7 @@ const Nn = function(t = !1, e) {
|
|
|
1501
1496
|
...Se,
|
|
1502
1497
|
...Hn,
|
|
1503
1498
|
...cn,
|
|
1504
|
-
...
|
|
1499
|
+
...vn,
|
|
1505
1500
|
...$n,
|
|
1506
1501
|
init(t) {
|
|
1507
1502
|
if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData) return new Error("MindElixir: `data` is required");
|
|
@@ -1517,7 +1512,7 @@ const Nn = function(t = !1, e) {
|
|
|
1517
1512
|
enableMobileMultiSelect(t) {
|
|
1518
1513
|
this.mobileMultiSelect = t;
|
|
1519
1514
|
}
|
|
1520
|
-
}, On = "5.12.2-beta.
|
|
1515
|
+
}, On = "5.12.2-beta.3";
|
|
1521
1516
|
function Bn(t) {
|
|
1522
1517
|
return {
|
|
1523
1518
|
x: 0,
|
|
@@ -1563,8 +1558,8 @@ function A({
|
|
|
1563
1558
|
compact: y,
|
|
1564
1559
|
theme: u,
|
|
1565
1560
|
alignment: g,
|
|
1566
|
-
scaleSensitivity:
|
|
1567
|
-
scaleMax:
|
|
1561
|
+
scaleSensitivity: b,
|
|
1562
|
+
scaleMax: v,
|
|
1568
1563
|
scaleMin: C,
|
|
1569
1564
|
handleWheel: T,
|
|
1570
1565
|
markdown: h,
|
|
@@ -1575,9 +1570,9 @@ function A({
|
|
|
1575
1570
|
let S = null;
|
|
1576
1571
|
const M = Object.prototype.toString.call(t);
|
|
1577
1572
|
if (M === "[object HTMLDivElement]" ? S = t : M === "[object String]" && (S = document.querySelector(t)), !S) throw new Error("MindElixir: el is not a valid element");
|
|
1578
|
-
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = l || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = r ?? 0, this.direction = e ?? 1, this.editable = n ?? !0, this.allowUndo = f ?? !0, this.scaleSensitivity =
|
|
1573
|
+
S.style.position = "relative", S.innerHTML = "", this.el = S, this.disposable = [], this.before = l || {}, this.newTopicName = a || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = r ?? 0, this.direction = e ?? 1, this.editable = n ?? !0, this.allowUndo = f ?? !0, this.scaleSensitivity = b ?? 0.1, this.scaleMax = v ?? 1.4, this.scaleMin = C ?? 0.2, this.generateMainBranch = d || Pt, this.generateSubBranch = p || kt, this.overflowHidden = w ?? !1, this.compact = y ?? !1, this.alignment = g ?? "root", this.handleWheel = T ?? !0, this.markdown = h || void 0, this.imageProxy = m || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.mobileMultiSelect = E ?? !1, this.panHelper = Bn(this), this.bus = Ne(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
1579
1574
|
const N = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1580
|
-
this.theme = u || (N.matches ? et :
|
|
1575
|
+
this.theme = u || (N.matches ? et : G);
|
|
1581
1576
|
const $ = document.createElement("div");
|
|
1582
1577
|
$.className = "map-canvas", this.map = $, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = W("lines"), this.summarySvg = W("summary"), this.linkController = W("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 = pt(), this.line2 = pt(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.arrowSvg = W("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(ke(this)), x && (this.pasteHandler = x);
|
|
1583
1578
|
}
|
|
@@ -1591,7 +1586,7 @@ Object.defineProperty(A.prototype, "currentNode", {
|
|
|
1591
1586
|
A.LEFT = 0;
|
|
1592
1587
|
A.RIGHT = 1;
|
|
1593
1588
|
A.SIDE = 2;
|
|
1594
|
-
A.THEME =
|
|
1589
|
+
A.THEME = G;
|
|
1595
1590
|
A.DARK_THEME = et;
|
|
1596
1591
|
A.version = On;
|
|
1597
1592
|
A.E = Ct;
|
|
@@ -1600,6 +1595,6 @@ export {
|
|
|
1600
1595
|
Wn as LEFT,
|
|
1601
1596
|
Yn as RIGHT,
|
|
1602
1597
|
Rn as SIDE,
|
|
1603
|
-
|
|
1598
|
+
G as THEME,
|
|
1604
1599
|
A as default
|
|
1605
1600
|
};
|