mind-elixir 4.3.4 → 4.3.5
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 +6 -6
- package/dist/MindElixir.js +80 -77
- package/dist/MindElixirLite.iife.js +2 -2
- package/dist/MindElixirLite.js +78 -75
- package/dist/types/index.d.ts +8 -0
- package/package.json +1 -1
package/dist/MindElixirLite.js
CHANGED
|
@@ -98,15 +98,15 @@ const ye = function() {
|
|
|
98
98
|
topic: this.newTopicName,
|
|
99
99
|
id: e
|
|
100
100
|
};
|
|
101
|
-
},
|
|
101
|
+
}, N = (e, t) => {
|
|
102
102
|
let n = 0, o = 0;
|
|
103
103
|
for (; t && t !== e; )
|
|
104
104
|
n += t.offsetLeft, o += t.offsetTop, t = t.offsetParent;
|
|
105
105
|
return { offsetLeft: n, offsetTop: o };
|
|
106
|
-
},
|
|
106
|
+
}, v = (e, t) => {
|
|
107
107
|
for (const n in t)
|
|
108
108
|
e.setAttribute(n, t[n]);
|
|
109
|
-
}, Z = (e) => e ? e.tagName === "ME-TPC" : !1,
|
|
109
|
+
}, Z = (e) => e ? e.tagName === "ME-TPC" : !1, $ = {
|
|
110
110
|
moved: !1,
|
|
111
111
|
// diffrentiate click and move
|
|
112
112
|
mousedown: !1,
|
|
@@ -118,10 +118,12 @@ const ye = function() {
|
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
120
|
clear() {
|
|
121
|
-
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
this.moved = !1, this.mousedown = !1;
|
|
123
|
+
}, 0);
|
|
122
124
|
}
|
|
123
125
|
};
|
|
124
|
-
function
|
|
126
|
+
function ve(e) {
|
|
125
127
|
e.map.addEventListener("click", (t) => {
|
|
126
128
|
var o, s;
|
|
127
129
|
if (t.button !== 0)
|
|
@@ -134,8 +136,8 @@ function xe(e) {
|
|
|
134
136
|
e.helper2.clear();
|
|
135
137
|
return;
|
|
136
138
|
}
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
+
if ($.moved) {
|
|
140
|
+
$.clear();
|
|
139
141
|
return;
|
|
140
142
|
}
|
|
141
143
|
e.clearSelection();
|
|
@@ -154,19 +156,19 @@ function xe(e) {
|
|
|
154
156
|
const n = t.target;
|
|
155
157
|
Z(n) ? e.beginEdit(n) : n.tagName === "text" && (n.dataset.type === "custom-link" ? e.editArrowLabel(n.parentElement) : e.editSummary(n.parentElement));
|
|
156
158
|
}), e.map.addEventListener("mousemove", (t) => {
|
|
157
|
-
t.target.contentEditable !== "true" &&
|
|
159
|
+
t.target.contentEditable !== "true" && $.onMove(t, e.container);
|
|
158
160
|
}), e.map.addEventListener("mousedown", (t) => {
|
|
159
161
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
160
|
-
t.button === n && t.target.contentEditable !== "true" && (
|
|
162
|
+
t.button === n && t.target.contentEditable !== "true" && ($.moved = !1, $.mousedown = !0);
|
|
161
163
|
}), e.map.addEventListener("mouseleave", (t) => {
|
|
162
164
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
163
|
-
t.button === n &&
|
|
165
|
+
t.button === n && $.clear();
|
|
164
166
|
}), e.map.addEventListener("mouseup", (t) => {
|
|
165
167
|
const n = e.mouseSelectionButton === 0 ? 2 : 0;
|
|
166
|
-
t.button === n &&
|
|
168
|
+
t.button === n && $.clear();
|
|
167
169
|
});
|
|
168
170
|
}
|
|
169
|
-
const
|
|
171
|
+
const xe = {
|
|
170
172
|
create() {
|
|
171
173
|
return {
|
|
172
174
|
handlers: {},
|
|
@@ -327,7 +329,7 @@ const $e = function(e) {
|
|
|
327
329
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
328
330
|
}, H = document, A = "http://www.w3.org/2000/svg", ae = function(e, t, n) {
|
|
329
331
|
const o = H.createElementNS(A, "path");
|
|
330
|
-
return
|
|
332
|
+
return v(o, {
|
|
331
333
|
d: e,
|
|
332
334
|
stroke: t || "#666",
|
|
333
335
|
fill: "none",
|
|
@@ -346,10 +348,10 @@ const $e = function(e) {
|
|
|
346
348
|
"stroke-linecap": "cap",
|
|
347
349
|
"stroke-width": "2"
|
|
348
350
|
}, o = H.createElementNS(A, "g"), s = H.createElementNS(A, "path"), i = H.createElementNS(A, "path");
|
|
349
|
-
return
|
|
351
|
+
return v(i, {
|
|
350
352
|
d: t,
|
|
351
353
|
...n
|
|
352
|
-
}),
|
|
354
|
+
}), v(s, {
|
|
353
355
|
d: e,
|
|
354
356
|
...n,
|
|
355
357
|
"stroke-dasharray": "8,2"
|
|
@@ -386,13 +388,13 @@ const $e = function(e) {
|
|
|
386
388
|
const r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
387
389
|
this.lines.innerHTML = "";
|
|
388
390
|
for (let c = 0; c < r.length; c++) {
|
|
389
|
-
const l = r[c], f = l.querySelector("me-tpc"), { offsetLeft: h, offsetTop: a } =
|
|
390
|
-
f.style.borderColor =
|
|
391
|
+
const l = r[c], f = l.querySelector("me-tpc"), { offsetLeft: h, offsetTop: a } = N(this.nodes, f), d = f.offsetWidth, p = f.offsetHeight, u = l.parentNode.className, m = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: a, cL: h, cW: d, cH: p, direction: u, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, x = f.nodeObj.branchColor || g[c % g.length];
|
|
392
|
+
f.style.borderColor = x, this.lines.appendChild(ae(m, x, "3"));
|
|
391
393
|
const y = l.children[0].children[1];
|
|
392
394
|
if (y && (y.style.top = (y.parentNode.offsetHeight - y.offsetHeight) / 2 + "px", u === "lhs" ? y.style.left = "-10px" : y.style.right = "-10px"), e && e !== l)
|
|
393
395
|
continue;
|
|
394
396
|
const b = z("subLines"), C = l.lastChild;
|
|
395
|
-
C.tagName === "svg" && C.remove(), l.appendChild(b), de(this, b,
|
|
397
|
+
C.tagName === "svg" && C.remove(), l.appendChild(b), de(this, b, x, l, u, !0);
|
|
396
398
|
}
|
|
397
399
|
this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
398
400
|
}, de = function(e, t, n, o, s, i) {
|
|
@@ -401,7 +403,7 @@ const $e = function(e) {
|
|
|
401
403
|
return;
|
|
402
404
|
const l = r.offsetTop, f = r.offsetLeft, h = r.offsetWidth, a = r.offsetHeight;
|
|
403
405
|
for (let d = 0; d < c.length; d++) {
|
|
404
|
-
const p = c[d], u = p.firstChild, m = u.offsetTop, g = u.offsetLeft,
|
|
406
|
+
const p = c[d], u = p.firstChild, m = u.offsetTop, g = u.offsetLeft, x = u.offsetWidth, y = u.offsetHeight, b = u.firstChild.nodeObj.branchColor || n, C = e.generateSubBranch({ pT: l, pL: f, pW: h, pH: a, cT: m, cL: g, cW: x, cH: y, direction: s, isFirst: i });
|
|
405
407
|
t.appendChild(ae(C, b, "2"));
|
|
406
408
|
const w = u.children[1];
|
|
407
409
|
if (w) {
|
|
@@ -600,7 +602,7 @@ const ze = function(e, t, n) {
|
|
|
600
602
|
create: st
|
|
601
603
|
};
|
|
602
604
|
function F(e, t, n) {
|
|
603
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
605
|
+
const { offsetLeft: o, offsetTop: s } = N(e.nodes, t), i = t.offsetWidth, r = t.offsetHeight, c = o + i / 2, l = s + r / 2, f = c + n.x, h = l + n.y;
|
|
604
606
|
return {
|
|
605
607
|
w: i,
|
|
606
608
|
h: r,
|
|
@@ -620,7 +622,7 @@ function k(e) {
|
|
|
620
622
|
}
|
|
621
623
|
const it = function(e, t, n, o) {
|
|
622
624
|
const s = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
623
|
-
return
|
|
625
|
+
return v(s, {
|
|
624
626
|
"text-anchor": "middle",
|
|
625
627
|
x: t + "",
|
|
626
628
|
y: n + "",
|
|
@@ -633,7 +635,7 @@ const it = function(e, t, n, o) {
|
|
|
633
635
|
const i = F(e, t, o.delta1), r = F(e, n, o.delta2), { x: c, y: l } = k(i), { ctrlX: f, ctrlY: h } = i, { ctrlX: a, ctrlY: d } = r, { x: p, y: u } = k(r), m = re(a, d, p, u), g = Te(
|
|
634
636
|
`M ${c} ${l} C ${f} ${h} ${a} ${d} ${p} ${u}`,
|
|
635
637
|
`M ${m.x1} ${m.y1} L ${p} ${u} L ${m.x2} ${m.y2}`
|
|
636
|
-
),
|
|
638
|
+
), x = c / 8 + f * 3 / 8 + a * 3 / 8 + p / 8, y = l / 8 + h * 3 / 8 + d * 3 / 8 + u / 8, b = it(o.label, x, y, e.theme.cssVar["--color"]);
|
|
637
639
|
g.appendChild(b), g.arrowObj = o, g.dataset.linkid = o.id, e.linkSvgGroup.appendChild(g), s || (e.arrows.push(o), e.currentArrow = g, me(e, o, i, r)), performance.now();
|
|
638
640
|
}, rt = function(e, t) {
|
|
639
641
|
const n = {
|
|
@@ -678,12 +680,12 @@ const it = function(e, t, n, o) {
|
|
|
678
680
|
var d;
|
|
679
681
|
e.linkController.style.display = "initial", e.P2.style.display = "initial", e.P3.style.display = "initial", e.nodes.appendChild(e.linkController), e.nodes.appendChild(e.P2), e.nodes.appendChild(e.P3);
|
|
680
682
|
let { x: s, y: i } = k(n), { ctrlX: r, ctrlY: c } = n, { ctrlX: l, ctrlY: f } = o, { x: h, y: a } = k(o);
|
|
681
|
-
e.P2.style.cssText = `top:${c}px;left:${r}px;`, e.P3.style.cssText = `top:${f}px;left:${l}px;`,
|
|
683
|
+
e.P2.style.cssText = `top:${c}px;left:${r}px;`, e.P3.style.cssText = `top:${f}px;left:${l}px;`, v(e.line1, {
|
|
682
684
|
x1: s + "",
|
|
683
685
|
y1: i + "",
|
|
684
686
|
x2: r + "",
|
|
685
687
|
y2: c + ""
|
|
686
|
-
}),
|
|
688
|
+
}), v(e.line2, {
|
|
687
689
|
x1: l + "",
|
|
688
690
|
y1: f + "",
|
|
689
691
|
x2: h + "",
|
|
@@ -693,11 +695,11 @@ const it = function(e, t, n, o) {
|
|
|
693
695
|
r = r + p / e.scaleVal, c = c + u / e.scaleVal;
|
|
694
696
|
const m = k({ ...n, ctrlX: r, ctrlY: c });
|
|
695
697
|
s = m.x, i = m.y;
|
|
696
|
-
const g = s / 8 + r * 3 / 8 + l * 3 / 8 + h / 8,
|
|
697
|
-
e.P2.style.top = c + "px", e.P2.style.left = r + "px", (y = e.currentArrow) == null || y.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${f} ${h} ${a}`),
|
|
698
|
+
const g = s / 8 + r * 3 / 8 + l * 3 / 8 + h / 8, x = i / 8 + c * 3 / 8 + f * 3 / 8 + a / 8;
|
|
699
|
+
e.P2.style.top = c + "px", e.P2.style.left = r + "px", (y = e.currentArrow) == null || y.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${f} ${h} ${a}`), v(e.currentArrow.children[2], {
|
|
698
700
|
x: g + "",
|
|
699
|
-
y:
|
|
700
|
-
}),
|
|
701
|
+
y: x + ""
|
|
702
|
+
}), v(e.line1, {
|
|
701
703
|
x1: s + "",
|
|
702
704
|
y1: i + "",
|
|
703
705
|
x2: r + "",
|
|
@@ -708,11 +710,11 @@ const it = function(e, t, n, o) {
|
|
|
708
710
|
l = l + p / e.scaleVal, f = f + u / e.scaleVal;
|
|
709
711
|
const m = k({ ...o, ctrlX: l, ctrlY: f });
|
|
710
712
|
h = m.x, a = m.y;
|
|
711
|
-
const g = s / 8 + r * 3 / 8 + l * 3 / 8 + h / 8,
|
|
712
|
-
e.P3.style.top = f + "px", e.P3.style.left = l + "px", (b = e.currentArrow) == null || b.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${f} ${h} ${a}`), (C = e.currentArrow) == null || C.children[1].setAttribute("d", `M ${y.x1} ${y.y1} L ${h} ${a} L ${y.x2} ${y.y2}`),
|
|
713
|
+
const g = s / 8 + r * 3 / 8 + l * 3 / 8 + h / 8, x = i / 8 + c * 3 / 8 + f * 3 / 8 + a / 8, y = re(l, f, h, a);
|
|
714
|
+
e.P3.style.top = f + "px", e.P3.style.left = l + "px", (b = e.currentArrow) == null || b.children[0].setAttribute("d", `M ${s} ${i} C ${r} ${c} ${l} ${f} ${h} ${a}`), (C = e.currentArrow) == null || C.children[1].setAttribute("d", `M ${y.x1} ${y.y1} L ${h} ${a} L ${y.x2} ${y.y2}`), v(e.currentArrow.children[2], {
|
|
713
715
|
x: g + "",
|
|
714
|
-
y:
|
|
715
|
-
}),
|
|
716
|
+
y: x + ""
|
|
717
|
+
}), v(e.line2, {
|
|
716
718
|
x1: l + "",
|
|
717
719
|
y1: f + "",
|
|
718
720
|
x2: h + "",
|
|
@@ -804,7 +806,7 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
804
806
|
return t.setAttribute("id", e), t;
|
|
805
807
|
}, ne = function(e, t) {
|
|
806
808
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
807
|
-
return
|
|
809
|
+
return v(n, {
|
|
808
810
|
d: e,
|
|
809
811
|
stroke: t || "#666",
|
|
810
812
|
fill: "none",
|
|
@@ -813,7 +815,7 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
813
815
|
}), n;
|
|
814
816
|
}, oe = function(e, t, n, o, s) {
|
|
815
817
|
const i = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
816
|
-
return
|
|
818
|
+
return v(i, {
|
|
817
819
|
"text-anchor": o,
|
|
818
820
|
x: t + "",
|
|
819
821
|
y: n + "",
|
|
@@ -832,15 +834,15 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
832
834
|
const U = (X = f.children) == null ? void 0 : X[B];
|
|
833
835
|
if (!U)
|
|
834
836
|
return e.removeSummary(n), null;
|
|
835
|
-
const j = gt(U.id), { offsetLeft: O, offsetTop: J } =
|
|
837
|
+
const j = gt(U.id), { offsetLeft: O, offsetTop: J } = N(c, j), K = i === r ? 10 : 20;
|
|
836
838
|
B === i && (p = J + K), B === r && (u = J + j.offsetHeight - K), O < a && (a = O), j.offsetWidth + O > d && (d = j.offsetWidth + O);
|
|
837
839
|
}
|
|
838
840
|
let m, g;
|
|
839
|
-
const
|
|
840
|
-
h === "lhs" ? (m = ne(`M ${a + 10} ${
|
|
841
|
+
const x = p + 10, y = u + 10, b = (x + y) / 2, C = e.theme.cssVar["--color"];
|
|
842
|
+
h === "lhs" ? (m = ne(`M ${a + 10} ${x} c -5 0 -10 5 -10 10 L ${a} ${y - 10} c 0 5 5 10 10 10 M ${a} ${b} h -10`, C), g = oe(o, a - 20, b + 6, "end", C)) : (m = ne(`M ${d - 10} ${x} c 5 0 10 5 10 10 L ${d} ${y - 10} c 0 5 -5 10 -10 10 M ${d} ${b} h 10`, C), g = oe(o, d + 20, b + 6, "start", C));
|
|
841
843
|
const w = mt("s-" + n);
|
|
842
844
|
return w.appendChild(m), w.appendChild(g), w.summaryObj = t, e.summarySvg.appendChild(w), w;
|
|
843
|
-
},
|
|
845
|
+
}, vt = function() {
|
|
844
846
|
let e = [];
|
|
845
847
|
this.currentNode ? e = [this.currentNode] : this.currentNodes && (e = this.currentNodes);
|
|
846
848
|
const { parent: t, start: n, end: o } = pt(e), s = { id: Y(), parent: t, start: n, end: o, text: "summary" }, i = ge(this, s);
|
|
@@ -848,7 +850,7 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
848
850
|
name: "createSummary",
|
|
849
851
|
obj: s
|
|
850
852
|
});
|
|
851
|
-
},
|
|
853
|
+
}, xt = function(e) {
|
|
852
854
|
var n;
|
|
853
855
|
const t = this.summaries.findIndex((o) => o.id === e);
|
|
854
856
|
t > -1 && (this.summaries.splice(t, 1), (n = document.querySelector("#s-" + e)) == null || n.remove()), this.bus.fire("operation", {
|
|
@@ -857,7 +859,7 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
857
859
|
});
|
|
858
860
|
}, bt = function(e) {
|
|
859
861
|
const t = e.children[1].getBBox(), n = 6, o = 3, s = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
860
|
-
|
|
862
|
+
v(s, {
|
|
861
863
|
x: t.x - n + "",
|
|
862
864
|
y: t.y - n + "",
|
|
863
865
|
width: t.width + n * 2 + "",
|
|
@@ -891,16 +893,16 @@ const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
891
893
|
});
|
|
892
894
|
}, Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
893
895
|
__proto__: null,
|
|
894
|
-
createSummary:
|
|
896
|
+
createSummary: vt,
|
|
895
897
|
editSummary: Et,
|
|
896
|
-
removeSummary:
|
|
898
|
+
removeSummary: xt,
|
|
897
899
|
renderSummary: Ct,
|
|
898
900
|
selectSummary: bt,
|
|
899
901
|
unselectSummary: wt
|
|
900
902
|
}, Symbol.toStringTag, { value: "Module" })), L = "http://www.w3.org/2000/svg";
|
|
901
903
|
function St(e, t) {
|
|
902
904
|
const n = document.createElementNS(L, "svg");
|
|
903
|
-
return
|
|
905
|
+
return v(n, {
|
|
904
906
|
version: "1.1",
|
|
905
907
|
xmlns: L,
|
|
906
908
|
height: e,
|
|
@@ -916,7 +918,7 @@ function $t(e, t, n, o) {
|
|
|
916
918
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
917
919
|
`).forEach((c, l) => {
|
|
918
920
|
const f = document.createElementNS(L, "text");
|
|
919
|
-
|
|
921
|
+
v(f, {
|
|
920
922
|
x: n + parseInt(t.paddingLeft) + "",
|
|
921
923
|
y: o + parseInt(t.paddingTop) + Mt(t.lineHeight, t.fontSize) * (l + 1) + parseFloat(t.fontSize) * (l + 1) + "",
|
|
922
924
|
"text-anchor": "start",
|
|
@@ -932,21 +934,21 @@ function Nt(e, t, n, o) {
|
|
|
932
934
|
let s = "";
|
|
933
935
|
(c = e.nodeObj) != null && c.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
934
936
|
const i = document.createElementNS(L, "foreignObject");
|
|
935
|
-
|
|
937
|
+
v(i, {
|
|
936
938
|
x: n + parseInt(t.paddingLeft) + "",
|
|
937
939
|
y: o + parseInt(t.paddingTop) + "",
|
|
938
940
|
width: t.width,
|
|
939
941
|
height: t.height
|
|
940
942
|
});
|
|
941
943
|
const r = document.createElement("div");
|
|
942
|
-
return
|
|
944
|
+
return v(r, {
|
|
943
945
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
944
946
|
style: `font-family: ${t.fontFamily}; font-size: ${t.fontSize}; font-weight: ${t.fontWeight}; color: ${t.color}; white-space: pre-wrap;`
|
|
945
947
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
946
948
|
}
|
|
947
949
|
function Tt(e, t) {
|
|
948
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
949
|
-
return
|
|
950
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = N(e.nodes, t), i = document.createElementNS(L, "rect");
|
|
951
|
+
return v(i, {
|
|
950
952
|
x: o + "",
|
|
951
953
|
y: s + "",
|
|
952
954
|
rx: n.borderRadius,
|
|
@@ -959,8 +961,8 @@ function Tt(e, t) {
|
|
|
959
961
|
}), i;
|
|
960
962
|
}
|
|
961
963
|
function V(e, t, n = !1) {
|
|
962
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } =
|
|
963
|
-
|
|
964
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = N(e.nodes, t), r = document.createElementNS(L, "rect");
|
|
965
|
+
v(r, {
|
|
964
966
|
x: s + "",
|
|
965
967
|
y: i + "",
|
|
966
968
|
rx: o.borderRadius,
|
|
@@ -977,8 +979,8 @@ function V(e, t, n = !1) {
|
|
|
977
979
|
return n ? l = Nt(t, o, s, i) : l = $t(t, o, s, i), c.appendChild(l), c;
|
|
978
980
|
}
|
|
979
981
|
function kt(e, t) {
|
|
980
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
981
|
-
return
|
|
982
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = N(e.nodes, t), i = document.createElementNS(L, "a"), r = document.createElementNS(L, "text");
|
|
983
|
+
return v(r, {
|
|
982
984
|
x: o + "",
|
|
983
985
|
y: s + parseInt(n.fontSize) + "",
|
|
984
986
|
"text-anchor": "start",
|
|
@@ -989,8 +991,8 @@ function kt(e, t) {
|
|
|
989
991
|
}), r.innerHTML = t.textContent, i.appendChild(r), i.setAttribute("href", t.href), i;
|
|
990
992
|
}
|
|
991
993
|
function Ht(e, t) {
|
|
992
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } =
|
|
993
|
-
return
|
|
994
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = N(e.nodes, t), i = document.createElementNS(L, "image");
|
|
995
|
+
return v(i, {
|
|
994
996
|
x: o + "",
|
|
995
997
|
y: s + "",
|
|
996
998
|
width: n.width + "",
|
|
@@ -1001,15 +1003,15 @@ function Ht(e, t) {
|
|
|
1001
1003
|
const _ = 100, At = '<?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">', Dt = (e, t = !1) => {
|
|
1002
1004
|
var a, d, p;
|
|
1003
1005
|
const n = e.nodes, o = n.offsetHeight + _ * 2, s = n.offsetWidth + _ * 2, i = St(o + "px", s + "px"), r = document.createElementNS(L, "svg"), c = document.createElementNS(L, "rect");
|
|
1004
|
-
|
|
1006
|
+
v(c, {
|
|
1005
1007
|
x: "0",
|
|
1006
1008
|
y: "0",
|
|
1007
1009
|
width: `${s}`,
|
|
1008
1010
|
height: `${o}`,
|
|
1009
1011
|
fill: e.theme.cssVar["--bgcolor"]
|
|
1010
1012
|
}), i.appendChild(c), n.querySelectorAll(".subLines").forEach((u) => {
|
|
1011
|
-
const m = u.cloneNode(!0), { offsetLeft: g, offsetTop:
|
|
1012
|
-
m.setAttribute("x", `${g}`), m.setAttribute("y", `${
|
|
1013
|
+
const m = u.cloneNode(!0), { offsetLeft: g, offsetTop: x } = N(n, u.parentElement);
|
|
1014
|
+
m.setAttribute("x", `${g}`), m.setAttribute("y", `${x}`), r.appendChild(m);
|
|
1013
1015
|
});
|
|
1014
1016
|
const l = (a = n.querySelector(".lines")) == null ? void 0 : a.cloneNode(!0);
|
|
1015
1017
|
l && r.appendChild(l);
|
|
@@ -1026,7 +1028,7 @@ const _ = 100, At = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1026
1028
|
r.appendChild(kt(e, u));
|
|
1027
1029
|
}), n.querySelectorAll("img").forEach((u) => {
|
|
1028
1030
|
r.appendChild(Ht(e, u));
|
|
1029
|
-
}),
|
|
1031
|
+
}), v(r, {
|
|
1030
1032
|
x: _ + "",
|
|
1031
1033
|
y: _ + "",
|
|
1032
1034
|
overflow: "visible"
|
|
@@ -1099,11 +1101,11 @@ function It({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction:
|
|
|
1099
1101
|
f ? a = e + o / 2 : a = e + o;
|
|
1100
1102
|
const p = s + c;
|
|
1101
1103
|
let u = 0, m = 0, g = 0;
|
|
1102
|
-
const
|
|
1103
|
-
return l === "lhs" ? (g = t, u = g + h, m = g - h, d = i + h, `M ${u} ${a} C ${g} ${a} ${g +
|
|
1104
|
+
const x = Math.abs(a - p) / 300 * h;
|
|
1105
|
+
return l === "lhs" ? (g = t, u = g + h, m = g - h, d = i + h, `M ${u} ${a} C ${g} ${a} ${g + x} ${p} ${m} ${p} H ${d}`) : (g = t + n, u = g - h, m = g + h, d = i + r - h, `M ${u} ${a} C ${g} ${a} ${g - x} ${p} ${m} ${p} H ${d}`);
|
|
1104
1106
|
}
|
|
1105
|
-
const Ft = "4.3.
|
|
1106
|
-
function
|
|
1107
|
+
const Ft = "4.3.5", P = document;
|
|
1108
|
+
function M({
|
|
1107
1109
|
el: e,
|
|
1108
1110
|
direction: t,
|
|
1109
1111
|
locale: n,
|
|
@@ -1121,26 +1123,27 @@ function $({
|
|
|
1121
1123
|
generateMainBranch: u,
|
|
1122
1124
|
generateSubBranch: m,
|
|
1123
1125
|
overflowHidden: g,
|
|
1124
|
-
theme:
|
|
1126
|
+
theme: x
|
|
1125
1127
|
}) {
|
|
1126
1128
|
let y = null;
|
|
1127
1129
|
const b = Object.prototype.toString.call(e);
|
|
1128
1130
|
if (b === "[object HTMLDivElement]" ? y = e : b === "[object String]" && (y = document.querySelector(e)), !y)
|
|
1129
1131
|
throw new Error("MindElixir: el is not a valid element");
|
|
1130
|
-
y.className += " mind-elixir", y.innerHTML = "", this.mindElixirBox = y, this.disposable = [], this.before = a || {}, this.locale = n || "en", this.contextMenuOption = r, this.contextMenu = i === void 0 ? !0 : i, this.toolBar = c === void 0 ? !0 : c, this.keypress = l === void 0 ? !0 : l, this.mouseSelectionButton = f || 0, this.direction = typeof t == "number" ? t : 1, this.draggable = o === void 0 ? !0 : o, this.newTopicName = d || "new node", this.editable = s === void 0 ? !0 : s, this.allowUndo = p === void 0 ? !1 : p, this.currentNode = null, this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.generateMainBranch = u || qt, this.generateSubBranch = m || It, this.overflowHidden = g || !1, this.bus =
|
|
1132
|
+
y.className += " mind-elixir", y.innerHTML = "", this.mindElixirBox = y, this.disposable = [], this.before = a || {}, this.locale = n || "en", this.contextMenuOption = r, this.contextMenu = i === void 0 ? !0 : i, this.toolBar = c === void 0 ? !0 : c, this.keypress = l === void 0 ? !0 : l, this.mouseSelectionButton = f || 0, this.direction = typeof t == "number" ? t : 1, this.draggable = o === void 0 ? !0 : o, this.newTopicName = d || "new node", this.editable = s === void 0 ? !0 : s, this.allowUndo = p === void 0 ? !1 : p, this.currentNode = null, this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.generateMainBranch = u || qt, this.generateSubBranch = m || It, this.overflowHidden = g || !1, this.bus = xe.create(), this.container = P.createElement("div"), this.selectionContainer = h || this.container, this.container.className = "map-container";
|
|
1131
1133
|
const C = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1132
|
-
this.theme =
|
|
1134
|
+
this.theme = x || (C.matches ? ie : se);
|
|
1133
1135
|
const w = P.createElement("div");
|
|
1134
|
-
w.className = "map-canvas", this.map = w, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = P.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = z("lines"), this.summarySvg = z("summary"), this.linkController = z("linkcontroller"), this.P2 = P.createElement("div"), this.P3 = P.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = ee(), this.line2 = ee(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = z("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" :
|
|
1136
|
+
w.className = "map-canvas", this.map = w, this.map.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.mindElixirBox.appendChild(this.container), this.nodes = P.createElement("me-nodes"), this.nodes.className = "main-node-container", this.lines = z("lines"), this.summarySvg = z("summary"), this.linkController = z("linkcontroller"), this.P2 = P.createElement("div"), this.P3 = P.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = ee(), this.line2 = ee(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = z("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : ve(this);
|
|
1135
1137
|
}
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1138
|
+
M.prototype = _t;
|
|
1139
|
+
M.LEFT = D;
|
|
1140
|
+
M.RIGHT = W;
|
|
1141
|
+
M.SIDE = R;
|
|
1142
|
+
M.THEME = se;
|
|
1143
|
+
M.DARK_THEME = ie;
|
|
1144
|
+
M.version = Ft;
|
|
1145
|
+
M.E = S;
|
|
1146
|
+
M.dragMoveHelper = $;
|
|
1144
1147
|
export {
|
|
1145
|
-
|
|
1148
|
+
M as default
|
|
1146
1149
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import './index.less';
|
|
|
2
2
|
import './iconfont/iconfont.js';
|
|
3
3
|
import { LEFT, RIGHT, SIDE, DARK_THEME, THEME } from './const';
|
|
4
4
|
import { findEle } from './utils/dom';
|
|
5
|
+
import dragMoveHelper from './utils/dragMoveHelper';
|
|
5
6
|
export * from './types/index';
|
|
6
7
|
export * from './types/dom';
|
|
7
8
|
import type { MindElixirData, MindElixirInstance, MindElixirMethods, Options } from './types/index';
|
|
@@ -89,6 +90,12 @@ declare namespace MindElixir {
|
|
|
89
90
|
export var version: any;
|
|
90
91
|
export var E: (id: string, instance?: MindElixirInstance) => import("./types/dom").Topic;
|
|
91
92
|
var _a: (topic: string) => MindElixirData;
|
|
93
|
+
export var dragMoveHelper: {
|
|
94
|
+
moved: boolean;
|
|
95
|
+
mousedown: boolean;
|
|
96
|
+
onMove(e: MouseEvent, container: HTMLElement): void;
|
|
97
|
+
clear(): void;
|
|
98
|
+
};
|
|
92
99
|
export { _a as new };
|
|
93
100
|
}
|
|
94
101
|
export interface MindElixirCtor {
|
|
@@ -102,6 +109,7 @@ export interface MindElixirCtor {
|
|
|
102
109
|
THEME: typeof THEME;
|
|
103
110
|
DARK_THEME: typeof DARK_THEME;
|
|
104
111
|
prototype: MindElixirMethods;
|
|
112
|
+
dragMoveHelper: typeof dragMoveHelper;
|
|
105
113
|
}
|
|
106
114
|
declare const _default: MindElixirCtor;
|
|
107
115
|
export default _default;
|