mind-elixir 5.0.1 → 5.0.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 +380 -368
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +102 -100
- package/dist/style.css +1 -1
- package/dist/types/i18n.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/utils/pubsub.d.ts +0 -1
- package/package.json +3 -2
- package/readme.md +14 -5
package/dist/MindElixirLite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const K = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -23,7 +23,7 @@ const U = {
|
|
|
23
23
|
"--panel-border-color": "#eaeaea",
|
|
24
24
|
"--map-padding": "50px"
|
|
25
25
|
}
|
|
26
|
-
},
|
|
26
|
+
}, J = {
|
|
27
27
|
name: "Dark",
|
|
28
28
|
type: "dark",
|
|
29
29
|
palette: ["#848FA0", "#748BE9", "#D2F9FE", "#4145A5", "#789AFA", "#706CF4", "#EF987F", "#775DD5", "#FCEECF", "#DA7FBC"],
|
|
@@ -64,10 +64,10 @@ const Y = function(t, e) {
|
|
|
64
64
|
return null;
|
|
65
65
|
} else
|
|
66
66
|
return null;
|
|
67
|
-
},
|
|
67
|
+
}, Q = (t, e) => {
|
|
68
68
|
if (t.parent = e, t.children)
|
|
69
69
|
for (let n = 0; n < t.children.length; n++)
|
|
70
|
-
|
|
70
|
+
Q(t.children[n], t);
|
|
71
71
|
};
|
|
72
72
|
function R(t, e, n, o) {
|
|
73
73
|
const i = o - e, s = t - n;
|
|
@@ -83,11 +83,11 @@ function R(t, e, n, o) {
|
|
|
83
83
|
y2: o - Math.sin(Math.PI * p / 180) * a
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function V() {
|
|
87
87
|
return ((/* @__PURE__ */ new Date()).getTime().toString(16) + Math.random().toString(16).substr(2)).substr(2, 16);
|
|
88
88
|
}
|
|
89
89
|
const St = function() {
|
|
90
|
-
const t =
|
|
90
|
+
const t = V();
|
|
91
91
|
return {
|
|
92
92
|
topic: this.newTopicName,
|
|
93
93
|
id: t
|
|
@@ -97,7 +97,7 @@ const St = function() {
|
|
|
97
97
|
for (; e && e !== t; )
|
|
98
98
|
n += e.offsetLeft, o += e.offsetTop, e = e.offsetParent;
|
|
99
99
|
return { offsetLeft: n, offsetTop: o };
|
|
100
|
-
},
|
|
100
|
+
}, b = (t, e) => {
|
|
101
101
|
for (const n in e)
|
|
102
102
|
t.setAttribute(n, e[n]);
|
|
103
103
|
}, st = (t) => t ? t.tagName === "ME-TPC" : !1, ft = (t) => {
|
|
@@ -209,7 +209,7 @@ function Et(t) {
|
|
|
209
209
|
{ dom: u, evt: "click", func: n },
|
|
210
210
|
{ dom: u, evt: "dblclick", func: o },
|
|
211
211
|
{ dom: u, evt: "contextmenu", func: d },
|
|
212
|
-
{ dom: u, evt: "wheel", func: p }
|
|
212
|
+
{ dom: u, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : p }
|
|
213
213
|
]);
|
|
214
214
|
}
|
|
215
215
|
function Tt() {
|
|
@@ -269,7 +269,7 @@ const X = document, Lt = function() {
|
|
|
269
269
|
}
|
|
270
270
|
return n;
|
|
271
271
|
}, k = document, ut = function(t, e) {
|
|
272
|
-
const o = (this != null && this.el ? this.el : e || document).querySelector(`[data-nodeid=me${t}]`);
|
|
272
|
+
const o = (this != null && this.el ? this.el : e || document).querySelector(`[data-nodeid="me${t}"]`);
|
|
273
273
|
if (!o)
|
|
274
274
|
throw new Error(`FindEle: Node ${t} not found, maybe it's collapsed.`);
|
|
275
275
|
return o;
|
|
@@ -375,13 +375,13 @@ const Pt = function(t) {
|
|
|
375
375
|
return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
|
|
376
376
|
}, N = document, T = "http://www.w3.org/2000/svg", wt = function(t, e, n) {
|
|
377
377
|
const o = N.createElementNS(T, "path");
|
|
378
|
-
return
|
|
378
|
+
return b(o, {
|
|
379
379
|
d: t,
|
|
380
380
|
stroke: e || "#666",
|
|
381
381
|
fill: "none",
|
|
382
382
|
"stroke-width": n
|
|
383
383
|
}), o;
|
|
384
|
-
},
|
|
384
|
+
}, W = function(t) {
|
|
385
385
|
const e = N.createElementNS(T, "svg");
|
|
386
386
|
return e.setAttribute("class", t), e.setAttribute("overflow", "visible"), e;
|
|
387
387
|
}, ct = function() {
|
|
@@ -410,9 +410,9 @@ const Pt = function(t) {
|
|
|
410
410
|
"stroke-linecap": (o == null ? void 0 : o.strokeLinecap) || "cap",
|
|
411
411
|
"stroke-width": String((o == null ? void 0 : o.strokeWidth) || "2")
|
|
412
412
|
};
|
|
413
|
-
(o == null ? void 0 : o.opacity) !== void 0 && (p.opacity = String(o.opacity)),
|
|
413
|
+
(o == null ? void 0 : o.opacity) !== void 0 && (p.opacity = String(o.opacity)), b(d, p), a === 0 && d.setAttribute("stroke-dasharray", (o == null ? void 0 : o.strokeDasharray) || "8,2");
|
|
414
414
|
const u = N.createElementNS(T, "path");
|
|
415
|
-
|
|
415
|
+
b(u, {
|
|
416
416
|
d: f,
|
|
417
417
|
stroke: "transparent",
|
|
418
418
|
fill: "none",
|
|
@@ -462,8 +462,8 @@ const Pt = function(t) {
|
|
|
462
462
|
const f = r[a], d = f.querySelector("me-tpc"), { offsetLeft: p, offsetTop: u } = D(this.nodes, d), g = d.offsetWidth, l = d.offsetHeight, c = f.parentNode.className, h = this.generateMainBranch({ pT: n, pL: o, pW: i, pH: s, cT: u, cL: p, cW: g, cH: l, direction: c, containerHeight: this.nodes.offsetHeight }), m = this.theme.palette, w = d.nodeObj.branchColor || m[a % m.length];
|
|
463
463
|
if (d.style.borderColor = w, this.lines.appendChild(wt(h, w, "3")), t && t !== f)
|
|
464
464
|
continue;
|
|
465
|
-
const x =
|
|
466
|
-
|
|
465
|
+
const x = W("subLines"), v = f.lastChild;
|
|
466
|
+
v.tagName === "svg" && v.remove(), f.appendChild(x), yt(this, x, w, f, c, !0);
|
|
467
467
|
}
|
|
468
468
|
this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
469
469
|
}, yt = function(t, e, n, o, i, s) {
|
|
@@ -472,21 +472,21 @@ const Pt = function(t) {
|
|
|
472
472
|
return;
|
|
473
473
|
const f = r.offsetTop, d = r.offsetLeft, p = r.offsetWidth, u = r.offsetHeight;
|
|
474
474
|
for (let g = 0; g < a.length; g++) {
|
|
475
|
-
const l = a[g], c = l.firstChild, h = c.offsetTop, m = c.offsetLeft, w = c.offsetWidth, x = c.offsetHeight,
|
|
476
|
-
e.appendChild(wt(
|
|
477
|
-
const
|
|
478
|
-
if (
|
|
479
|
-
if (!
|
|
475
|
+
const l = a[g], c = l.firstChild, h = c.offsetTop, m = c.offsetLeft, w = c.offsetWidth, x = c.offsetHeight, v = c.firstChild.nodeObj.branchColor || n, y = t.generateSubBranch({ pT: f, pL: d, pW: p, pH: u, cT: h, cL: m, cW: w, cH: x, direction: i, isFirst: s });
|
|
476
|
+
e.appendChild(wt(y, v, "2"));
|
|
477
|
+
const S = c.children[1];
|
|
478
|
+
if (S) {
|
|
479
|
+
if (!S.expanded)
|
|
480
480
|
continue;
|
|
481
481
|
} else
|
|
482
482
|
continue;
|
|
483
|
-
yt(t, e,
|
|
483
|
+
yt(t, e, v, l, i);
|
|
484
484
|
}
|
|
485
485
|
};
|
|
486
|
-
const
|
|
486
|
+
const Wt = '<?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"><svg t="1750169394918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2021" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M851.91168 328.45312c-59.97056 0-108.6208 48.47104-108.91264 108.36992l-137.92768 38.4a109.14304 109.14304 0 0 0-63.46752-46.58688l1.39264-137.11872c47.29344-11.86816 82.31936-54.66624 82.31936-105.64096 0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.76288-108.91776 108.91776c0 49.18784 32.60928 90.75712 77.38368 104.27392l-1.41312 138.87488a109.19936 109.19936 0 0 0-63.50336 48.55808l-138.93632-39.48544 0.01024-0.72704c0-60.15488-48.76288-108.91776-108.91776-108.91776s-108.91776 48.75776-108.91776 108.91776c0 60.15488 48.76288 108.91264 108.91776 108.91264 39.3984 0 73.91232-20.92032 93.03552-52.2496l139.19232 39.552-0.00512 0.2304c0 25.8304 9.00096 49.5616 24.02816 68.23424l-90.14272 132.63872a108.7488 108.7488 0 0 0-34.2528-5.504c-60.15488 0-108.91776 48.768-108.91776 108.91776 0 60.16 48.76288 108.91776 108.91776 108.91776 60.16 0 108.92288-48.75776 108.92288-108.91776 0-27.14624-9.9328-51.968-26.36288-71.04l89.04704-131.03104a108.544 108.544 0 0 0 37.6832 6.70208 108.672 108.672 0 0 0 36.48512-6.272l93.13792 132.57216a108.48256 108.48256 0 0 0-24.69888 69.0688c0 60.16 48.768 108.92288 108.91776 108.92288 60.16 0 108.91776-48.76288 108.91776-108.92288 0-60.14976-48.75776-108.91776-108.91776-108.91776a108.80512 108.80512 0 0 0-36.69504 6.3488l-93.07136-132.48a108.48768 108.48768 0 0 0 24.79616-72.22784l136.09984-37.888c18.99008 31.93856 53.84192 53.3504 93.69088 53.3504 60.16 0 108.92288-48.75776 108.92288-108.91264-0.00512-60.15488-48.77312-108.92288-108.92288-108.92288z" p-id="2022"></path></svg>', Vt = '<?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"><svg t="1750169375313" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1775" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639 463.30000001L639 285.1c0-36.90000001-26.4-68.5-61.3-68.5l-150.2 0c-1.5 0-3 0.1-4.5 0.3-10.2-38.7-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c42 0 77.3-28.6 87.5-67.39999999 1.4 0.3 2.9 0.4 4.5 0.39999999L577.7 263.6c6.8 0 14.3 8.9 14.3 21.49999999l0 427.00000001c0 12.7-7.40000001 21.5-14.30000001 21.5l-150.19999999 0c-1.5 0-3 0.2-4.5 0.4-10.2-38.8-45.5-67.3-87.5-67.3-50 0-90.5 40.5-90.5 90.4 0 49.9 40.5 90.6 90.5 90.59999999 42 0 77.3-28.6 87.5-67.39999999 1.4 0.2 2.9 0.4 4.49999999 0.4L577.7 780.7c34.80000001 0 61.3-31.6 61.3-68.50000001L639 510.3l79.1 0c10.4 38.5 45.49999999 67 87.4 67 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-41.79999999 0-77.00000001 28.4-87.4 67L639 463.30000001z" fill="currentColor" p-id="1776"></path></svg>', Gt = '<?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"><svg t="1750169667709" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3037" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M385 560.69999999L385 738.9c0 36.90000001 26.4 68.5 61.3 68.5l150.2 0c1.5 0 3-0.1 4.5-0.3 10.2 38.7 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.5s-40.5-90.5-90.5-90.5c-42 0-77.3 28.6-87.5 67.39999999-1.4-0.3-2.9-0.4-4.5-0.39999999L446.3 760.4c-6.8 0-14.3-8.9-14.3-21.49999999l0-427.00000001c0-12.7 7.40000001-21.5 14.30000001-21.5l150.19999999 0c1.5 0 3-0.2 4.5-0.4 10.2 38.8 45.5 67.3 87.5 67.3 50 0 90.5-40.5 90.5-90.4 0-49.9-40.5-90.6-90.5-90.59999999-42 0-77.3 28.6-87.5 67.39999999-1.4-0.2-2.9-0.4-4.49999999-0.4L446.3 243.3c-34.80000001 0-61.3 31.6-61.3 68.50000001L385 513.7l-79.1 0c-10.4-38.5-45.49999999-67-87.4-67-50 0-90.5 40.5-90.5 90.5s40.5 90.5 90.5 90.5c41.79999999 0 77.00000001-28.4 87.4-67L385 560.69999999z" fill="currentColor" p-id="3038"></path></svg>', It = '<?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"><svg t="1750169402629" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2170" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M639.328 416c8.032 0 16.096-3.008 22.304-9.056l202.624-197.184-0.8 143.808c-0.096 17.696 14.144 32.096 31.808 32.192 0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808l1.248-222.208c0-0.672-0.352-1.248-0.384-1.92 0.032-0.512 0.288-0.896 0.288-1.408 0.032-17.664-14.272-32-31.968-32.032L671.552 96l-0.032 0c-17.664 0-31.968 14.304-32 31.968C639.488 145.632 653.824 160 671.488 160l151.872 0.224-206.368 200.8c-12.672 12.32-12.928 32.608-0.64 45.248C622.656 412.736 630.976 416 639.328 416z" p-id="2171"></path><path d="M896.032 639.552 896.032 639.552c-17.696 0-32 14.304-32.032 31.968l-0.224 151.872-200.832-206.4c-12.32-12.64-32.576-12.96-45.248-0.64-12.672 12.352-12.928 32.608-0.64 45.248l197.184 202.624-143.808-0.8c-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808-0.096 17.696 14.144 32.096 31.808 32.192l222.24 1.248c0.064 0 0.128 0 0.192 0 0.64 0 1.12-0.32 1.76-0.352 0.512 0.032 0.896 0.288 1.408 0.288l0.032 0c17.664 0 31.968-14.304 32-31.968L928 671.584C928.032 653.952 913.728 639.584 896.032 639.552z" p-id="2172"></path><path d="M209.76 159.744l143.808 0.8c0.064 0 0.128 0 0.192 0 17.6 0 31.904-14.208 32-31.808 0.096-17.696-14.144-32.096-31.808-32.192L131.68 95.328c-0.064 0-0.128 0-0.192 0-0.672 0-1.248 0.352-1.888 0.384-0.448 0-0.8-0.256-1.248-0.256 0 0-0.032 0-0.032 0-17.664 0-31.968 14.304-32 31.968L96 352.448c-0.032 17.664 14.272 32 31.968 32.032 0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968l0.224-151.936 200.832 206.4c6.272 6.464 14.624 9.696 22.944 9.696 8.032 0 16.096-3.008 22.304-9.056 12.672-12.32 12.96-32.608 0.64-45.248L209.76 159.744z" p-id="2173"></path><path d="M362.368 617.056l-202.624 197.184 0.8-143.808c0.096-17.696-14.144-32.096-31.808-32.192-0.064 0-0.128 0-0.192 0-17.6 0-31.904 14.208-32 31.808l-1.248 222.24c0 0.704 0.352 1.312 0.384 2.016 0 0.448-0.256 0.832-0.256 1.312-0.032 17.664 14.272 32 31.968 32.032L352.448 928c0 0 0.032 0 0.032 0 17.664 0 31.968-14.304 32-31.968s-14.272-32-31.968-32.032l-151.936-0.224 206.4-200.832c12.672-12.352 12.96-32.608 0.64-45.248S375.008 604.704 362.368 617.056z" p-id="2174"></path></svg>', Ft = '<?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"><svg t="1750169573443" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2883" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M514.133333 488.533333m-106.666666 0a106.666667 106.666667 0 1 0 213.333333 0 106.666667 106.666667 0 1 0-213.333333 0Z" fill="currentColor" p-id="2884"></path><path d="M512 64C264.533333 64 64 264.533333 64 512c0 236.8 183.466667 428.8 416 445.866667v-134.4c-53.333333-59.733333-200.533333-230.4-200.533333-334.933334 0-130.133333 104.533333-234.666667 234.666666-234.666666s234.666667 104.533333 234.666667 234.666666c0 61.866667-49.066667 153.6-145.066667 270.933334l-59.733333 68.266666V960C776.533333 942.933333 960 748.8 960 512c0-247.466667-200.533333-448-448-448z" fill="currentColor" p-id="2885"></path></svg>', jt = '<?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"><svg t="1750169419447" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2480" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.328 482.56l-317.344-1.12L545.984 162.816c0-17.664-14.336-32-32-32s-32 14.336-32 32l0 318.4L159.616 480.064c-0.032 0-0.064 0-0.096 0-17.632 0-31.936 14.24-32 31.904C127.424 529.632 141.728 544 159.392 544.064l322.592 1.152 0 319.168c0 17.696 14.336 32 32 32s32-14.304 32-32l0-318.944 317.088 1.12c0.064 0 0.096 0 0.128 0 17.632 0 31.936-14.24 32-31.904C895.264 496.992 880.96 482.624 863.328 482.56z" p-id="2481"></path></svg>', zt = '<?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"><svg t="1750169426515" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2730" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M863.744 544 163.424 544c-17.664 0-32-14.336-32-32s14.336-32 32-32l700.32 0c17.696 0 32 14.336 32 32S881.44 544 863.744 544z" p-id="2731"></path></svg>';
|
|
487
487
|
const Yt = {
|
|
488
|
-
side:
|
|
489
|
-
left:
|
|
488
|
+
side: Wt,
|
|
489
|
+
left: Vt,
|
|
490
490
|
right: Gt,
|
|
491
491
|
full: It,
|
|
492
492
|
living: Ft,
|
|
@@ -524,7 +524,7 @@ function qt(t) {
|
|
|
524
524
|
const _t = function(t, e = !0) {
|
|
525
525
|
this.theme = t;
|
|
526
526
|
const o = {
|
|
527
|
-
...(t.type === "dark" ?
|
|
527
|
+
...(t.type === "dark" ? J : K).cssVar,
|
|
528
528
|
...t.cssVar
|
|
529
529
|
}, i = Object.keys(o);
|
|
530
530
|
for (let s = 0; s < i.length; s++) {
|
|
@@ -572,7 +572,7 @@ const Jt = function(t) {
|
|
|
572
572
|
}, se = function() {
|
|
573
573
|
this.editable = !1;
|
|
574
574
|
}, re = function(t, e = { x: 0, y: 0 }) {
|
|
575
|
-
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, i = e.y ? e.y - n.top - n.height / 2 : 0, { dx: s, dy: r } =
|
|
575
|
+
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, i = e.y ? e.y - n.top - n.height / 2 : 0, { dx: s, dy: r } = bt(this), a = this.map.style.transform, { x: f, y: d } = ft(a), p = f - s, u = d - r, g = this.scaleVal, l = (-o + p) * (1 - t / g), c = (-i + u) * (1 - t / g);
|
|
576
576
|
this.map.style.transform = `translate(${f - l}px, ${d - c}px) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
|
|
577
577
|
}, ce = function() {
|
|
578
578
|
const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
|
|
@@ -581,12 +581,12 @@ const Jt = function(t) {
|
|
|
581
581
|
const { map: n, scaleVal: o, bus: i } = this, s = n.style.transform;
|
|
582
582
|
let { x: r, y: a } = ft(s);
|
|
583
583
|
r += t, a += e, n.style.transform = `translate(${r}px, ${a}px) scale(${o})`, i.fire("move", { dx: t, dy: e });
|
|
584
|
-
},
|
|
584
|
+
}, bt = (t) => {
|
|
585
585
|
const { container: e, map: n, nodes: o } = t, i = n.querySelector("me-root"), s = i.offsetTop, r = i.offsetLeft, a = i.offsetWidth, f = i.offsetHeight;
|
|
586
586
|
let d, p;
|
|
587
587
|
return t.alignment === "root" ? (d = e.offsetWidth / 2 - r - a / 2, p = e.offsetHeight / 2 - s - f / 2, n.style.transformOrigin = `${r + a / 2}px 50%`) : (d = (e.offsetWidth - o.offsetWidth) / 2, p = (e.offsetHeight - o.offsetHeight) / 2, n.style.transformOrigin = "50% 50%"), { dx: d, dy: p };
|
|
588
588
|
}, ae = function() {
|
|
589
|
-
const { map: t } = this, { dx: e, dy: n } =
|
|
589
|
+
const { map: t } = this, { dx: e, dy: n } = bt(this);
|
|
590
590
|
t.style.transform = `translate(${e}px, ${n}px) scale(${this.scaleVal})`;
|
|
591
591
|
}, he = function(t) {
|
|
592
592
|
t(this);
|
|
@@ -624,8 +624,8 @@ const Jt = function(t) {
|
|
|
624
624
|
};
|
|
625
625
|
typeof e == "boolean" ? o(n, e) : n.expanded !== !1 ? o(n, !1) : o(n, !0), this.refresh();
|
|
626
626
|
}, ye = function(t) {
|
|
627
|
-
t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || []),
|
|
628
|
-
},
|
|
627
|
+
t && (t = JSON.parse(JSON.stringify(t)), this.nodeData = t.nodeData, this.arrows = t.arrows || [], this.summaries = t.summaries || [], t.theme && this.changeTheme(t.theme)), Q(this.nodeData), this.layout(), this.linkDiv();
|
|
628
|
+
}, be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
629
629
|
__proto__: null,
|
|
630
630
|
cancelFocus: fe,
|
|
631
631
|
clearSelection: ee,
|
|
@@ -650,7 +650,7 @@ const Jt = function(t) {
|
|
|
650
650
|
setLocale: me,
|
|
651
651
|
toCenter: ae,
|
|
652
652
|
unselectNodes: te
|
|
653
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
653
|
+
}, Symbol.toStringTag, { value: "Module" })), ve = function(t) {
|
|
654
654
|
return {
|
|
655
655
|
dom: t,
|
|
656
656
|
moved: !1,
|
|
@@ -686,22 +686,22 @@ const Jt = function(t) {
|
|
|
686
686
|
}
|
|
687
687
|
};
|
|
688
688
|
}, lt = {
|
|
689
|
-
create:
|
|
689
|
+
create: ve
|
|
690
690
|
}, Ce = "#4dc4ff";
|
|
691
|
-
function
|
|
691
|
+
function vt(t, e, n, o, i, s, r, a) {
|
|
692
692
|
return {
|
|
693
693
|
x: t / 8 + n * 3 / 8 + i * 3 / 8 + r / 8,
|
|
694
694
|
y: e / 8 + o * 3 / 8 + s * 3 / 8 + a / 8
|
|
695
695
|
};
|
|
696
696
|
}
|
|
697
697
|
function Se(t, e, n) {
|
|
698
|
-
|
|
698
|
+
b(t, {
|
|
699
699
|
x: e + "",
|
|
700
700
|
y: n + ""
|
|
701
701
|
});
|
|
702
702
|
}
|
|
703
703
|
function F(t, e, n, o, i) {
|
|
704
|
-
|
|
704
|
+
b(t, {
|
|
705
705
|
x1: e + "",
|
|
706
706
|
y1: n + "",
|
|
707
707
|
x2: o + "",
|
|
@@ -726,7 +726,7 @@ function at(t, e, n, o, i, s, r, a, f, d) {
|
|
|
726
726
|
h.stroke && t.arrow2.setAttribute("stroke", h.stroke), h.strokeWidth && t.arrow2.setAttribute("stroke-width", String(h.strokeWidth)), h.strokeLinecap && t.arrow2.setAttribute("stroke-linecap", h.strokeLinecap), h.opacity !== void 0 && t.arrow2.setAttribute("opacity", String(h.opacity));
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
|
-
const { x: u, y: g } =
|
|
729
|
+
const { x: u, y: g } = vt(e, n, o, i, s, r, a, f);
|
|
730
730
|
Se(t.label, u, g), (l = d.style) != null && l.labelColor && t.label.setAttribute("fill", d.style.labelColor), Ne(t);
|
|
731
731
|
}
|
|
732
732
|
function q(t, e, n) {
|
|
@@ -750,14 +750,14 @@ function H(t) {
|
|
|
750
750
|
}
|
|
751
751
|
const Ee = function(t, e, n, o) {
|
|
752
752
|
const i = document.createElementNS(T, "text");
|
|
753
|
-
return
|
|
753
|
+
return b(i, {
|
|
754
754
|
"text-anchor": "middle",
|
|
755
755
|
x: e + "",
|
|
756
756
|
y: n + "",
|
|
757
757
|
fill: o || "rgb(235, 95, 82)"
|
|
758
758
|
}), i.dataset.type = "custom-link", i.innerHTML = t, i;
|
|
759
|
-
},
|
|
760
|
-
var
|
|
759
|
+
}, Z = function(t, e, n, o, i) {
|
|
760
|
+
var C;
|
|
761
761
|
if (!e || !n)
|
|
762
762
|
return;
|
|
763
763
|
const s = q(t, e, o.delta1), r = q(t, n, o.delta2), { x: a, y: f } = H(s), { ctrlX: d, ctrlY: p } = s, { ctrlX: u, ctrlY: g } = r, { x: l, y: c } = H(r), h = R(u, g, l, c);
|
|
@@ -771,11 +771,11 @@ const Ee = function(t, e, n, o) {
|
|
|
771
771
|
return;
|
|
772
772
|
w = `M ${A.x1} ${A.y1} L ${a} ${f} L ${A.x2} ${A.y2}`;
|
|
773
773
|
}
|
|
774
|
-
const x = Bt(`M ${a} ${f} C ${d} ${p} ${u} ${g} ${l} ${c}`, m, w, o.style), { x:
|
|
775
|
-
x.appendChild(
|
|
774
|
+
const x = Bt(`M ${a} ${f} C ${d} ${p} ${u} ${g} ${l} ${c}`, m, w, o.style), { x: v, y } = vt(a, f, d, p, u, g, l, c), S = (C = o.style) == null ? void 0 : C.labelColor, E = Ee(o.label, v, y, S);
|
|
775
|
+
x.appendChild(E), x.label = E, x.arrowObj = o, x.dataset.linkid = o.id, t.linkSvgGroup.appendChild(x), i || (t.arrows.push(o), t.currentArrow = x, Ct(t, o, s, r));
|
|
776
776
|
}, Te = function(t, e, n = {}) {
|
|
777
777
|
const o = {
|
|
778
|
-
id:
|
|
778
|
+
id: V(),
|
|
779
779
|
label: "Custom Link",
|
|
780
780
|
from: t.nodeObj.id,
|
|
781
781
|
to: e.nodeObj.id,
|
|
@@ -789,13 +789,14 @@ const Ee = function(t, e, n, o) {
|
|
|
789
789
|
},
|
|
790
790
|
...n
|
|
791
791
|
};
|
|
792
|
-
|
|
792
|
+
Z(this, t, e, o), this.bus.fire("operation", {
|
|
793
793
|
name: "createArrow",
|
|
794
794
|
obj: o
|
|
795
795
|
});
|
|
796
796
|
}, Le = function(t) {
|
|
797
|
-
|
|
798
|
-
|
|
797
|
+
_(this);
|
|
798
|
+
const e = { ...t, id: V() };
|
|
799
|
+
Z(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
|
|
799
800
|
name: "createArrow",
|
|
800
801
|
obj: e
|
|
801
802
|
});
|
|
@@ -803,7 +804,7 @@ const Ee = function(t, e, n, o) {
|
|
|
803
804
|
let e;
|
|
804
805
|
if (t ? e = t : e = this.currentArrow, !e)
|
|
805
806
|
return;
|
|
806
|
-
|
|
807
|
+
_(this);
|
|
807
808
|
const n = e.arrowObj.id;
|
|
808
809
|
this.arrows = this.arrows.filter((o) => o.id !== n), e.remove(), this.bus.fire("operation", {
|
|
809
810
|
name: "removeArrow",
|
|
@@ -816,10 +817,10 @@ const Ee = function(t, e, n, o) {
|
|
|
816
817
|
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), i = q(this, n, e.delta1), s = q(this, o, e.delta2);
|
|
817
818
|
Ct(this, e, i, s);
|
|
818
819
|
}, Ae = function() {
|
|
819
|
-
|
|
820
|
-
},
|
|
820
|
+
_(this), this.currentArrow = null;
|
|
821
|
+
}, U = function(t, e) {
|
|
821
822
|
const n = document.createElementNS(T, "path");
|
|
822
|
-
return
|
|
823
|
+
return b(n, {
|
|
823
824
|
d: t,
|
|
824
825
|
stroke: e,
|
|
825
826
|
fill: "none",
|
|
@@ -830,11 +831,11 @@ const Ee = function(t, e, n, o) {
|
|
|
830
831
|
}, De = function(t, e) {
|
|
831
832
|
const n = document.createElementNS(T, "g");
|
|
832
833
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
833
|
-
const o =
|
|
834
|
+
const o = U(t.line.getAttribute("d"), e);
|
|
834
835
|
n.appendChild(o);
|
|
835
|
-
const i =
|
|
836
|
+
const i = U(t.arrow1.getAttribute("d"), e);
|
|
836
837
|
if (n.appendChild(i), t.arrow2.getAttribute("d")) {
|
|
837
|
-
const s =
|
|
838
|
+
const s = U(t.arrow2.getAttribute("d"), e);
|
|
838
839
|
n.appendChild(s);
|
|
839
840
|
}
|
|
840
841
|
t.insertBefore(n, t.firstChild);
|
|
@@ -847,7 +848,7 @@ const Ee = function(t, e, n, o) {
|
|
|
847
848
|
return;
|
|
848
849
|
const n = e.querySelectorAll("path");
|
|
849
850
|
n.length >= 1 && n[0].setAttribute("d", t.line.getAttribute("d")), n.length >= 2 && n[1].setAttribute("d", t.arrow1.getAttribute("d")), n.length >= 3 && t.arrow2.getAttribute("d") && n[2].setAttribute("d", t.arrow2.getAttribute("d"));
|
|
850
|
-
},
|
|
851
|
+
}, _ = function(t) {
|
|
851
852
|
var e, n;
|
|
852
853
|
(e = t.helper1) == null || e.destroy(), (n = t.helper2) == null || n.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && Me(t.currentArrow);
|
|
853
854
|
}, Ct = function(t, e, n, o) {
|
|
@@ -855,15 +856,15 @@ const Ee = function(t, e, n, o) {
|
|
|
855
856
|
if (!u)
|
|
856
857
|
return;
|
|
857
858
|
i.style.display = "initial", s.style.display = "initial", r.style.display = "initial", d.appendChild(i), d.appendChild(s), d.appendChild(r), De(u, Ce);
|
|
858
|
-
let { x: l, y: c } = H(n), { ctrlX: h, ctrlY: m } = n, { ctrlX: w, ctrlY: x } = o, { x:
|
|
859
|
-
s.style.cssText = `top:${m}px;left:${h}px;`, r.style.cssText = `top:${x}px;left:${w}px;`, F(a, l, c, h, m), F(f, w, x,
|
|
860
|
-
h = h +
|
|
861
|
-
const
|
|
862
|
-
l =
|
|
863
|
-
}), t.helper2.init(p, (
|
|
864
|
-
w = w +
|
|
865
|
-
const
|
|
866
|
-
|
|
859
|
+
let { x: l, y: c } = H(n), { ctrlX: h, ctrlY: m } = n, { ctrlX: w, ctrlY: x } = o, { x: v, y } = H(o);
|
|
860
|
+
s.style.cssText = `top:${m}px;left:${h}px;`, r.style.cssText = `top:${x}px;left:${w}px;`, F(a, l, c, h, m), F(f, w, x, v, y), t.helper1 = lt.create(s), t.helper2 = lt.create(r), t.helper1.init(p, (S, E) => {
|
|
861
|
+
h = h + S / t.scaleVal, m = m + E / t.scaleVal;
|
|
862
|
+
const C = H({ ...n, ctrlX: h, ctrlY: m });
|
|
863
|
+
l = C.x, c = C.y, s.style.top = m + "px", s.style.left = h + "px", at(u, l, c, h, m, w, x, v, y, e), F(a, l, c, h, m), e.delta1.x = h - n.cx, e.delta1.y = m - n.cy, g.fire("updateArrowDelta", e);
|
|
864
|
+
}), t.helper2.init(p, (S, E) => {
|
|
865
|
+
w = w + S / t.scaleVal, x = x + E / t.scaleVal;
|
|
866
|
+
const C = H({ ...o, ctrlX: w, ctrlY: x });
|
|
867
|
+
v = C.x, y = C.y, r.style.top = x + "px", r.style.left = w + "px", at(u, l, c, h, m, w, x, v, y, e), F(f, w, x, v, y), e.delta2.x = w - o.cx, e.delta2.y = x - o.cy, g.fire("updateArrowDelta", e);
|
|
867
868
|
});
|
|
868
869
|
};
|
|
869
870
|
function Pe() {
|
|
@@ -871,14 +872,14 @@ function Pe() {
|
|
|
871
872
|
for (let t = 0; t < this.arrows.length; t++) {
|
|
872
873
|
const e = this.arrows[t];
|
|
873
874
|
try {
|
|
874
|
-
|
|
875
|
+
Z(this, this.findEle(e.from), this.findEle(e.to), e, !0);
|
|
875
876
|
} catch {
|
|
876
877
|
}
|
|
877
878
|
}
|
|
878
879
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
879
880
|
}
|
|
880
881
|
function He(t) {
|
|
881
|
-
if (
|
|
882
|
+
if (_(this), !t)
|
|
882
883
|
return;
|
|
883
884
|
const e = t.label;
|
|
884
885
|
xt(this, e, t.arrowObj);
|
|
@@ -896,7 +897,7 @@ const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
896
897
|
selectArrow: $e,
|
|
897
898
|
tidyArrow: Be,
|
|
898
899
|
unselectArrow: Ae
|
|
899
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
900
|
+
}, Symbol.toStringTag, { value: "Module" })), We = function(t) {
|
|
900
901
|
var f, d;
|
|
901
902
|
if (t.length === 0)
|
|
902
903
|
throw new Error("No selected node.");
|
|
@@ -939,12 +940,12 @@ const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
939
940
|
start: s,
|
|
940
941
|
end: r
|
|
941
942
|
};
|
|
942
|
-
},
|
|
943
|
+
}, Ve = function(t) {
|
|
943
944
|
const e = document.createElementNS(T, "g");
|
|
944
945
|
return e.setAttribute("id", t), e;
|
|
945
946
|
}, ht = function(t, e) {
|
|
946
947
|
const n = document.createElementNS(T, "path");
|
|
947
|
-
return
|
|
948
|
+
return b(n, {
|
|
948
949
|
d: t,
|
|
949
950
|
stroke: e || "#666",
|
|
950
951
|
fill: "none",
|
|
@@ -953,7 +954,7 @@ const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
953
954
|
}), n;
|
|
954
955
|
}, dt = function(t, e, n, o, i) {
|
|
955
956
|
const s = document.createElementNS(T, "text");
|
|
956
|
-
return
|
|
957
|
+
return b(s, {
|
|
957
958
|
"text-anchor": o,
|
|
958
959
|
x: e + "",
|
|
959
960
|
y: n + "",
|
|
@@ -975,20 +976,20 @@ const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
975
976
|
B === s && (h = nt + ot), B === r && (m = nt + G.offsetHeight - ot), I < l && (l = I), G.offsetWidth + I > c && (c = G.offsetWidth + I);
|
|
976
977
|
}
|
|
977
978
|
let w, x;
|
|
978
|
-
const
|
|
979
|
-
g === P.LHS ? (w = ht(`M ${l + 10} ${
|
|
980
|
-
const
|
|
981
|
-
return
|
|
979
|
+
const v = h + 10, y = m + 10, S = (v + y) / 2, E = f.cssVar["--color"];
|
|
980
|
+
g === P.LHS ? (w = ht(`M ${l + 10} ${v} c -5 0 -10 5 -10 10 L ${l} ${y - 10} c 0 5 5 10 10 10 M ${l} ${S} h -10`, E), x = dt(o, l - 20, S + 6, "end", E)) : (w = ht(`M ${c - 10} ${v} c 5 0 10 5 10 10 L ${c} ${y - 10} c 0 5 -5 10 -10 10 M ${c} ${S} h 10`, E), x = dt(o, c + 20, S + 6, "start", E));
|
|
981
|
+
const C = Ve("s-" + n);
|
|
982
|
+
return C.appendChild(w), C.appendChild(x), C.summaryObj = e, d.appendChild(C), C;
|
|
982
983
|
}, Fe = function() {
|
|
983
984
|
if (!this.currentNodes)
|
|
984
985
|
return;
|
|
985
|
-
const { currentNodes: t, summaries: e, bus: n } = this, { parent: o, start: i, end: s } =
|
|
986
|
+
const { currentNodes: t, summaries: e, bus: n } = this, { parent: o, start: i, end: s } = We(t), r = { id: V(), parent: o, start: i, end: s, label: "summary" }, a = tt(this, r);
|
|
986
987
|
e.push(r), this.editSummary(a), n.fire("operation", {
|
|
987
988
|
name: "createSummary",
|
|
988
989
|
obj: r
|
|
989
990
|
});
|
|
990
991
|
}, je = function(t) {
|
|
991
|
-
const e =
|
|
992
|
+
const e = V(), n = { ...t, id: e };
|
|
992
993
|
tt(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
993
994
|
name: "createSummary",
|
|
994
995
|
obj: n
|
|
@@ -1002,7 +1003,7 @@ const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1002
1003
|
});
|
|
1003
1004
|
}, Ye = function(t) {
|
|
1004
1005
|
const e = t.children[1].getBBox(), n = 6, o = 3, i = document.createElementNS(T, "rect");
|
|
1005
|
-
|
|
1006
|
+
b(i, {
|
|
1006
1007
|
x: e.x - n + "",
|
|
1007
1008
|
y: e.y - n + "",
|
|
1008
1009
|
width: e.width + n * 2 + "",
|
|
@@ -1039,7 +1040,7 @@ const Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1039
1040
|
}, Symbol.toStringTag, { value: "Module" })), L = "http://www.w3.org/2000/svg";
|
|
1040
1041
|
function Ue(t, e) {
|
|
1041
1042
|
const n = document.createElementNS(L, "svg");
|
|
1042
|
-
return
|
|
1043
|
+
return b(n, {
|
|
1043
1044
|
version: "1.1",
|
|
1044
1045
|
xmlns: L,
|
|
1045
1046
|
height: t,
|
|
@@ -1055,7 +1056,7 @@ function Je(t, e, n, o) {
|
|
|
1055
1056
|
return t.text ? s = t.text.textContent : s = t.childNodes[0].textContent, s.split(`
|
|
1056
1057
|
`).forEach((a, f) => {
|
|
1057
1058
|
const d = document.createElementNS(L, "text");
|
|
1058
|
-
|
|
1059
|
+
b(d, {
|
|
1059
1060
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1060
1061
|
y: o + parseInt(e.paddingTop) + Ke(e.lineHeight, e.fontSize) * (f + 1) + parseFloat(e.fontSize) * (f + 1) + "",
|
|
1061
1062
|
"text-anchor": "start",
|
|
@@ -1071,21 +1072,21 @@ function Qe(t, e, n, o) {
|
|
|
1071
1072
|
let i = "";
|
|
1072
1073
|
(a = t.nodeObj) != null && a.dangerouslySetInnerHTML ? i = t.nodeObj.dangerouslySetInnerHTML : t.text ? i = t.text.textContent : i = t.childNodes[0].textContent;
|
|
1073
1074
|
const s = document.createElementNS(L, "foreignObject");
|
|
1074
|
-
|
|
1075
|
+
b(s, {
|
|
1075
1076
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1076
1077
|
y: o + parseInt(e.paddingTop) + "",
|
|
1077
1078
|
width: e.width,
|
|
1078
1079
|
height: e.height
|
|
1079
1080
|
});
|
|
1080
1081
|
const r = document.createElement("div");
|
|
1081
|
-
return
|
|
1082
|
+
return b(r, {
|
|
1082
1083
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
1083
1084
|
style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
|
|
1084
1085
|
}), r.innerHTML = i, s.appendChild(r), s;
|
|
1085
1086
|
}
|
|
1086
1087
|
function Ze(t, e) {
|
|
1087
1088
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: i } = D(t.nodes, e), s = document.createElementNS(L, "rect");
|
|
1088
|
-
return
|
|
1089
|
+
return b(s, {
|
|
1089
1090
|
x: o + "",
|
|
1090
1091
|
y: i + "",
|
|
1091
1092
|
rx: n.borderRadius,
|
|
@@ -1099,7 +1100,7 @@ function Ze(t, e) {
|
|
|
1099
1100
|
}
|
|
1100
1101
|
function j(t, e, n = !1) {
|
|
1101
1102
|
const o = getComputedStyle(e), { offsetLeft: i, offsetTop: s } = D(t.nodes, e), r = document.createElementNS(L, "rect");
|
|
1102
|
-
|
|
1103
|
+
b(r, {
|
|
1103
1104
|
x: i + "",
|
|
1104
1105
|
y: s + "",
|
|
1105
1106
|
rx: o.borderRadius,
|
|
@@ -1117,7 +1118,7 @@ function j(t, e, n = !1) {
|
|
|
1117
1118
|
}
|
|
1118
1119
|
function tn(t, e) {
|
|
1119
1120
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: i } = D(t.nodes, e), s = document.createElementNS(L, "a"), r = document.createElementNS(L, "text");
|
|
1120
|
-
return
|
|
1121
|
+
return b(r, {
|
|
1121
1122
|
x: o + "",
|
|
1122
1123
|
y: i + parseInt(n.fontSize) + "",
|
|
1123
1124
|
"text-anchor": "start",
|
|
@@ -1129,7 +1130,7 @@ function tn(t, e) {
|
|
|
1129
1130
|
}
|
|
1130
1131
|
function en(t, e) {
|
|
1131
1132
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: i } = D(t.nodes, e), s = document.createElementNS(L, "image");
|
|
1132
|
-
return
|
|
1133
|
+
return b(s, {
|
|
1133
1134
|
x: o + "",
|
|
1134
1135
|
y: i + "",
|
|
1135
1136
|
width: n.width + "",
|
|
@@ -1140,7 +1141,7 @@ function en(t, e) {
|
|
|
1140
1141
|
const z = 100, nn = '<?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">', on = (t, e = !1) => {
|
|
1141
1142
|
var u, g, l;
|
|
1142
1143
|
const n = t.nodes, o = n.offsetHeight + z * 2, i = n.offsetWidth + z * 2, s = Ue(o + "px", i + "px"), r = document.createElementNS(L, "svg"), a = document.createElementNS(L, "rect");
|
|
1143
|
-
|
|
1144
|
+
b(a, {
|
|
1144
1145
|
x: "0",
|
|
1145
1146
|
y: "0",
|
|
1146
1147
|
width: `${i}`,
|
|
@@ -1165,7 +1166,7 @@ const z = 100, nn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1165
1166
|
r.appendChild(tn(t, c));
|
|
1166
1167
|
}), n.querySelectorAll("img").forEach((c) => {
|
|
1167
1168
|
r.appendChild(en(t, c));
|
|
1168
|
-
}),
|
|
1169
|
+
}), b(r, {
|
|
1169
1170
|
x: z + "",
|
|
1170
1171
|
y: z + "",
|
|
1171
1172
|
overflow: "visible"
|
|
@@ -1209,7 +1210,7 @@ const cn = function(t = !1, e) {
|
|
|
1209
1210
|
createTopic: Nt,
|
|
1210
1211
|
findEle: ut,
|
|
1211
1212
|
changeTheme: _t,
|
|
1212
|
-
...
|
|
1213
|
+
...be,
|
|
1213
1214
|
...hn,
|
|
1214
1215
|
...Oe,
|
|
1215
1216
|
..._e,
|
|
@@ -1217,7 +1218,7 @@ const cn = function(t = !1, e) {
|
|
|
1217
1218
|
init(t) {
|
|
1218
1219
|
if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData)
|
|
1219
1220
|
return new Error("MindElixir: `data` is required");
|
|
1220
|
-
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData,
|
|
1221
|
+
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, Q(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && qt(this), this.layout(), this.linkDiv(), this.toCenter();
|
|
1221
1222
|
},
|
|
1222
1223
|
destroy() {
|
|
1223
1224
|
var t;
|
|
@@ -1241,7 +1242,7 @@ function pn({ pT: t, pL: e, pW: n, pH: o, cT: i, cL: s, cW: r, cH: a, direction:
|
|
|
1241
1242
|
const w = Math.abs(u - l) / 300 * p;
|
|
1242
1243
|
return f === P.LHS ? (m = e, c = m + p, h = m - p, g = s + p, `M ${c} ${u} C ${m} ${u} ${m + w} ${l} ${h} ${l} H ${g}`) : (m = e + n, c = m - p, h = m + p, g = s + r - p, `M ${c} ${u} C ${m} ${u} ${m - w} ${l} ${h} ${l} H ${g}`);
|
|
1243
1244
|
}
|
|
1244
|
-
const un = "5.0.
|
|
1245
|
+
const un = "5.0.3";
|
|
1245
1246
|
function gn(t) {
|
|
1246
1247
|
return {
|
|
1247
1248
|
x: 0,
|
|
@@ -1277,19 +1278,20 @@ function $({
|
|
|
1277
1278
|
overflowHidden: h,
|
|
1278
1279
|
theme: m,
|
|
1279
1280
|
alignment: w,
|
|
1280
|
-
scaleSensitivity: x
|
|
1281
|
+
scaleSensitivity: x,
|
|
1282
|
+
handleWheel: v
|
|
1281
1283
|
}) {
|
|
1282
1284
|
let y = null;
|
|
1283
|
-
const
|
|
1284
|
-
if (
|
|
1285
|
+
const S = Object.prototype.toString.call(t);
|
|
1286
|
+
if (S === "[object HTMLDivElement]" ? y = t : S === "[object String]" && (y = document.querySelector(t)), !y)
|
|
1285
1287
|
throw new Error("MindElixir: el is not a valid element");
|
|
1286
|
-
y.style.position = "relative", y.innerHTML = "", this.el = y, this.disposable = [], this.before = p || {}, this.locale = n || "en", this.
|
|
1287
|
-
const
|
|
1288
|
-
this.theme = m || (
|
|
1289
|
-
const
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
}, 300), this.map =
|
|
1288
|
+
y.style.position = "relative", y.innerHTML = "", this.el = y, this.disposable = [], this.before = p || {}, this.locale = n || "en", this.newTopicName = u || "new node", this.contextMenu = s ?? !0, this.toolBar = r ?? !0, this.keypress = a ?? !0, this.mouseSelectionButton = f ?? 0, this.direction = e ?? 1, this.draggable = o ?? !0, this.editable = i ?? !0, this.allowUndo = g ?? !1, this.scaleSensitivity = x ?? 0.2, this.generateMainBranch = l || fn, this.generateSubBranch = c || pn, this.overflowHidden = h ?? !1, this.alignment = w ?? "root", this.handleWheel = v ?? !0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = gn(this), this.bus = Tt(), this.container = O.createElement("div"), this.selectionContainer = d || this.container, this.container.className = "map-container";
|
|
1289
|
+
const E = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1290
|
+
this.theme = m || (E.matches ? J : K);
|
|
1291
|
+
const C = O.createElement("div");
|
|
1292
|
+
C.className = "map-canvas", setTimeout(() => {
|
|
1293
|
+
C.style.transition = "all 0.3s";
|
|
1294
|
+
}, 300), this.map = C, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = O.createElement("me-nodes"), this.lines = W("lines"), this.summarySvg = W("summary"), this.linkController = W("linkcontroller"), this.P2 = O.createElement("div"), this.P3 = O.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = ct(), this.line2 = ct(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = W("topiclinks"), this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Et(this));
|
|
1293
1295
|
}
|
|
1294
1296
|
$.prototype = dn;
|
|
1295
1297
|
Object.defineProperty($.prototype, "currentNode", {
|
|
@@ -1301,8 +1303,8 @@ Object.defineProperty($.prototype, "currentNode", {
|
|
|
1301
1303
|
$.LEFT = 0;
|
|
1302
1304
|
$.RIGHT = 1;
|
|
1303
1305
|
$.SIDE = 2;
|
|
1304
|
-
$.THEME =
|
|
1305
|
-
$.DARK_THEME =
|
|
1306
|
+
$.THEME = K;
|
|
1307
|
+
$.DARK_THEME = J;
|
|
1306
1308
|
$.version = un;
|
|
1307
1309
|
$.E = ut;
|
|
1308
1310
|
export {
|