mind-elixir 5.2.0-beta.2 → 5.2.0-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 +12 -11
- package/dist/MindElixir.js +81 -80
- package/dist/MindElixirLite.iife.js +12 -11
- package/dist/MindElixirLite.js +197 -196
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/MindElixirLite.js
CHANGED
|
@@ -83,12 +83,12 @@ const X = function(t, e) {
|
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
85
|
function q(t, e, n, o) {
|
|
86
|
-
const s = o - e,
|
|
87
|
-
let
|
|
88
|
-
if (isNaN(
|
|
86
|
+
const s = o - e, r = t - n;
|
|
87
|
+
let i = Math.atan(Math.abs(s) / Math.abs(r)) / 3.14 * 180;
|
|
88
|
+
if (isNaN(i))
|
|
89
89
|
return;
|
|
90
|
-
|
|
91
|
-
const c = 12, h = 30, d =
|
|
90
|
+
r < 0 && s > 0 && (i = 180 - i), r < 0 && s < 0 && (i = 180 + i), r > 0 && s < 0 && (i = 360 - i);
|
|
91
|
+
const c = 12, h = 30, d = i + h, p = i - h;
|
|
92
92
|
return {
|
|
93
93
|
x1: n + Math.cos(Math.PI * d / 180) * c,
|
|
94
94
|
y1: o - Math.sin(Math.PI * d / 180) * c,
|
|
@@ -105,7 +105,7 @@ const Tt = function() {
|
|
|
105
105
|
topic: this.newTopicName,
|
|
106
106
|
id: t
|
|
107
107
|
};
|
|
108
|
-
},
|
|
108
|
+
}, D = (t, e) => {
|
|
109
109
|
let n = 0, o = 0;
|
|
110
110
|
for (; e && e !== t; )
|
|
111
111
|
n += e.offsetLeft, o += e.offsetTop, e = e.offsetParent;
|
|
@@ -123,8 +123,8 @@ const Tt = function() {
|
|
|
123
123
|
}
|
|
124
124
|
return function() {
|
|
125
125
|
for (let n = 0; n < t.length; n++) {
|
|
126
|
-
const { dom: o, evt: s, func:
|
|
127
|
-
o.removeEventListener(s,
|
|
126
|
+
const { dom: o, evt: s, func: r } = t[n];
|
|
127
|
+
o.removeEventListener(s, r);
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
};
|
|
@@ -140,7 +140,9 @@ const at = function(t, e, n) {
|
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
function Lt(t) {
|
|
143
|
-
const { dragMoveHelper: e } = t
|
|
143
|
+
const { dragMoveHelper: e } = t;
|
|
144
|
+
let n = 0;
|
|
145
|
+
const o = (l) => {
|
|
144
146
|
var m, v;
|
|
145
147
|
if (l.button !== 0)
|
|
146
148
|
return;
|
|
@@ -194,7 +196,7 @@ function Lt(t) {
|
|
|
194
196
|
return;
|
|
195
197
|
}
|
|
196
198
|
}
|
|
197
|
-
},
|
|
199
|
+
}, s = (l) => {
|
|
198
200
|
if (!t.editable)
|
|
199
201
|
return;
|
|
200
202
|
const a = l.target;
|
|
@@ -230,14 +232,12 @@ function Lt(t) {
|
|
|
230
232
|
return;
|
|
231
233
|
}
|
|
232
234
|
}
|
|
233
|
-
}
|
|
234
|
-
let s = 0;
|
|
235
|
-
const i = (l) => {
|
|
235
|
+
}, r = (l) => {
|
|
236
236
|
if (l.pointerType === "mouse")
|
|
237
237
|
return;
|
|
238
|
-
const a = (/* @__PURE__ */ new Date()).getTime(), u = a -
|
|
239
|
-
u < 300 && u > 0 &&
|
|
240
|
-
},
|
|
238
|
+
const a = (/* @__PURE__ */ new Date()).getTime(), u = a - n;
|
|
239
|
+
u < 300 && u > 0 && s(l), n = a;
|
|
240
|
+
}, i = (l) => {
|
|
241
241
|
e.moved = !1;
|
|
242
242
|
const a = t.mouseSelectionButton === 0 ? 2 : 0;
|
|
243
243
|
if (l.button !== a && l.pointerType === "mouse")
|
|
@@ -268,12 +268,12 @@ function Lt(t) {
|
|
|
268
268
|
l.stopPropagation(), l.preventDefault(), l.ctrlKey || l.metaKey ? l.deltaY < 0 ? at(t, "in", t.dragMoveHelper) : t.scaleVal - t.scaleSensitivity > 0 && at(t, "out", t.dragMoveHelper) : l.shiftKey ? t.move(-l.deltaY, 0) : t.move(-l.deltaX, -l.deltaY);
|
|
269
269
|
}, { container: f } = t;
|
|
270
270
|
return gt([
|
|
271
|
-
{ dom: f, evt: "pointerdown", func:
|
|
271
|
+
{ dom: f, evt: "pointerdown", func: i },
|
|
272
272
|
{ dom: f, evt: "pointermove", func: c },
|
|
273
273
|
{ dom: f, evt: "pointerup", func: h },
|
|
274
|
-
{ dom: f, evt: "pointerup", func:
|
|
275
|
-
{ dom: f, evt: "click", func:
|
|
276
|
-
{ dom: f, evt: "dblclick", func:
|
|
274
|
+
{ dom: f, evt: "pointerup", func: r },
|
|
275
|
+
{ dom: f, evt: "click", func: o },
|
|
276
|
+
{ dom: f, evt: "dblclick", func: s },
|
|
277
277
|
{ dom: f, evt: "contextmenu", func: d },
|
|
278
278
|
{ dom: f, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : p }
|
|
279
279
|
]);
|
|
@@ -312,8 +312,8 @@ const _ = document, At = function() {
|
|
|
312
312
|
const n = this.nodeData.children || [];
|
|
313
313
|
if (this.direction === 2) {
|
|
314
314
|
let o = 0, s = 0;
|
|
315
|
-
n.map((
|
|
316
|
-
|
|
315
|
+
n.map((r) => {
|
|
316
|
+
r.direction === 0 ? o += 1 : r.direction === 1 ? s += 1 : o <= s ? (r.direction = 0, o += 1) : (r.direction = 1, s += 1);
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
319
|
Dt(this, n, e);
|
|
@@ -322,16 +322,16 @@ const _ = document, At = function() {
|
|
|
322
322
|
o.className = H.LHS;
|
|
323
323
|
const s = _.createElement("me-main");
|
|
324
324
|
s.className = H.RHS;
|
|
325
|
-
for (let
|
|
326
|
-
const
|
|
327
|
-
t.direction === 2 ?
|
|
325
|
+
for (let r = 0; r < e.length; r++) {
|
|
326
|
+
const i = e[r], { grp: c } = t.createWrapper(i);
|
|
327
|
+
t.direction === 2 ? i.direction === 0 ? o.appendChild(c) : s.appendChild(c) : t.direction === 0 ? o.appendChild(c) : s.appendChild(c);
|
|
328
328
|
}
|
|
329
329
|
t.nodes.appendChild(o), t.nodes.appendChild(n), t.nodes.appendChild(s), t.nodes.appendChild(t.lines), t.nodes.appendChild(t.labelContainer);
|
|
330
330
|
}, Nt = function(t, e) {
|
|
331
331
|
const n = _.createElement("me-children");
|
|
332
332
|
for (let o = 0; o < e.length; o++) {
|
|
333
|
-
const s = e[o], { grp:
|
|
334
|
-
n.appendChild(
|
|
333
|
+
const s = e[o], { grp: r } = t.createWrapper(s);
|
|
334
|
+
n.appendChild(r);
|
|
335
335
|
}
|
|
336
336
|
return n;
|
|
337
337
|
}, L = document, mt = function(t, e) {
|
|
@@ -382,10 +382,10 @@ const _ = document, At = function() {
|
|
|
382
382
|
}, Mt = function(t, e) {
|
|
383
383
|
const n = L.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(t);
|
|
384
384
|
if (n.appendChild(o), !e && t.children && t.children.length > 0) {
|
|
385
|
-
const
|
|
386
|
-
if (o.appendChild(
|
|
387
|
-
const
|
|
388
|
-
n.appendChild(
|
|
385
|
+
const r = Ot(t.expanded);
|
|
386
|
+
if (o.appendChild(r), t.expanded !== !1) {
|
|
387
|
+
const i = Nt(this, t.children);
|
|
388
|
+
n.appendChild(i);
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
return { grp: n, top: o, tpc: s };
|
|
@@ -408,32 +408,35 @@ function wt(t) {
|
|
|
408
408
|
const It = function(t) {
|
|
409
409
|
if (!t)
|
|
410
410
|
return;
|
|
411
|
-
const e = L.createElement("div"), n = t.nodeObj, o = n.topic;
|
|
412
|
-
|
|
413
|
-
const
|
|
414
|
-
e.style.cssText = `
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
411
|
+
const e = L.createElement("div"), n = t.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: r } = D(this.nodes, t);
|
|
412
|
+
this.nodes.appendChild(e), e.id = "input-box", e.textContent = o, e.contentEditable = "plaintext-only", e.spellcheck = !1;
|
|
413
|
+
const i = getComputedStyle(t);
|
|
414
|
+
e.style.cssText = `
|
|
415
|
+
left: ${s}px;
|
|
416
|
+
top: ${r}px;
|
|
417
|
+
min-width:${t.offsetWidth - 8}px;
|
|
418
|
+
color:${i.color};
|
|
419
|
+
padding:${i.padding};
|
|
420
|
+
margin:${i.margin};
|
|
421
|
+
background-color:${i.backgroundColor !== "rgba(0, 0, 0, 0)" && i.backgroundColor};
|
|
422
|
+
border: ${i.border};
|
|
423
|
+
border-radius:${i.borderRadius}; `, this.direction === 0 && (e.style.right = "0"), wt(e), this.bus.fire("operation", {
|
|
421
424
|
name: "beginEdit",
|
|
422
425
|
obj: t.nodeObj
|
|
423
|
-
}), e.addEventListener("keydown", (
|
|
424
|
-
|
|
425
|
-
const
|
|
426
|
-
if (
|
|
427
|
-
if (
|
|
426
|
+
}), e.addEventListener("keydown", (c) => {
|
|
427
|
+
c.stopPropagation();
|
|
428
|
+
const h = c.key;
|
|
429
|
+
if (h === "Enter" || h === "Tab") {
|
|
430
|
+
if (c.shiftKey)
|
|
428
431
|
return;
|
|
429
|
-
|
|
432
|
+
c.preventDefault(), e.blur(), this.container.focus();
|
|
430
433
|
}
|
|
431
434
|
}), e.addEventListener("blur", () => {
|
|
432
|
-
var
|
|
435
|
+
var h;
|
|
433
436
|
if (!e)
|
|
434
437
|
return;
|
|
435
|
-
const
|
|
436
|
-
|
|
438
|
+
const c = ((h = e.textContent) == null ? void 0 : h.trim()) || "";
|
|
439
|
+
c === "" ? n.topic = o : (n.topic = c, this.markdown ? t.text.innerHTML = this.markdown(n.topic, n) : t.text.textContent = c), e.remove(), c !== o && (this.linkDiv(), this.bus.fire("operation", {
|
|
437
440
|
name: "finishEdit",
|
|
438
441
|
obj: n,
|
|
439
442
|
origin: o
|
|
@@ -443,14 +446,14 @@ const It = function(t) {
|
|
|
443
446
|
const e = L.createElement("me-epd");
|
|
444
447
|
return e.expanded = t !== !1, e.className = t !== !1 ? "minus" : "", e;
|
|
445
448
|
}, O = document, A = "http://www.w3.org/2000/svg", K = function(t) {
|
|
446
|
-
const e = t.clientWidth, n = t.clientHeight, o = t.dataset, s = Number(o.x),
|
|
449
|
+
const e = t.clientWidth, n = t.clientHeight, o = t.dataset, s = Number(o.x), r = Number(o.y), i = o.anchor;
|
|
447
450
|
let c = s;
|
|
448
|
-
|
|
451
|
+
i === "middle" ? c = s - e / 2 : i === "end" && (c = s - e), t.style.left = `${c}px`, t.style.top = `${r - n / 2}px`, t.style.visibility = "visible";
|
|
449
452
|
}, tt = function(t, e, n, o) {
|
|
450
|
-
const { anchor: s = "middle", color:
|
|
451
|
-
h.className = "svg-label", h.style.color =
|
|
453
|
+
const { anchor: s = "middle", color: r, dataType: i, svgId: c } = o, h = document.createElement("div");
|
|
454
|
+
h.className = "svg-label", h.style.color = r || "#666";
|
|
452
455
|
const d = "label-" + c;
|
|
453
|
-
return h.id = d, h.innerHTML = t, h.dataset.type =
|
|
456
|
+
return h.id = d, h.innerHTML = t, h.dataset.type = i, h.dataset.svgId = c, h.dataset.x = e.toString(), h.dataset.y = n.toString(), h.dataset.anchor = s, h;
|
|
454
457
|
}, vt = function(t, e, n) {
|
|
455
458
|
const o = O.createElementNS(A, "path");
|
|
456
459
|
return S(o, {
|
|
@@ -480,8 +483,8 @@ const It = function(t) {
|
|
|
480
483
|
name: "arrow2",
|
|
481
484
|
d: n
|
|
482
485
|
}
|
|
483
|
-
].forEach((
|
|
484
|
-
const h =
|
|
486
|
+
].forEach((i, c) => {
|
|
487
|
+
const h = i.d, d = O.createElementNS(A, "path"), p = {
|
|
485
488
|
d: h,
|
|
486
489
|
stroke: (o == null ? void 0 : o.stroke) || "rgb(235, 95, 82)",
|
|
487
490
|
fill: "none",
|
|
@@ -495,7 +498,7 @@ const It = function(t) {
|
|
|
495
498
|
stroke: "transparent",
|
|
496
499
|
fill: "none",
|
|
497
500
|
"stroke-width": "15"
|
|
498
|
-
}), s.appendChild(f), s.appendChild(d), s[
|
|
501
|
+
}), s.appendChild(f), s.appendChild(d), s[i.name] = d;
|
|
499
502
|
}), s;
|
|
500
503
|
}, bt = function(t, e, n) {
|
|
501
504
|
if (!e)
|
|
@@ -505,22 +508,20 @@ const It = function(t) {
|
|
|
505
508
|
left:${e.style.left};
|
|
506
509
|
top:${e.style.top};
|
|
507
510
|
max-width: 200px;
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
i
|
|
512
|
-
|
|
513
|
-
if (r === "Enter" || r === "Tab") {
|
|
514
|
-
if (i.shiftKey)
|
|
511
|
+
`, wt(s), t.scrollIntoView(s), s.addEventListener("keydown", (r) => {
|
|
512
|
+
r.stopPropagation();
|
|
513
|
+
const i = r.key;
|
|
514
|
+
if (i === "Enter" || i === "Tab") {
|
|
515
|
+
if (r.shiftKey)
|
|
515
516
|
return;
|
|
516
|
-
|
|
517
|
+
r.preventDefault(), s.blur(), t.container.focus();
|
|
517
518
|
}
|
|
518
519
|
}), s.addEventListener("blur", () => {
|
|
519
|
-
var
|
|
520
|
+
var i;
|
|
520
521
|
if (!s)
|
|
521
522
|
return;
|
|
522
|
-
const
|
|
523
|
-
|
|
523
|
+
const r = ((i = s.textContent) == null ? void 0 : i.trim()) || "";
|
|
524
|
+
r === "" ? n.label = o : n.label = r, s.remove(), r !== o && (e.textContent = n.label, K(e), "parent" in n ? t.bus.fire("operation", {
|
|
524
525
|
name: "finishEditSummary",
|
|
525
526
|
obj: n
|
|
526
527
|
}) : t.bus.fire("operation", {
|
|
@@ -529,23 +530,23 @@ const It = function(t) {
|
|
|
529
530
|
}));
|
|
530
531
|
});
|
|
531
532
|
}, Gt = function(t) {
|
|
532
|
-
const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, s = e.offsetWidth,
|
|
533
|
+
const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, s = e.offsetWidth, r = e.offsetHeight, i = this.map.querySelectorAll("me-main > me-wrapper");
|
|
533
534
|
this.lines.innerHTML = "";
|
|
534
|
-
for (let c = 0; c <
|
|
535
|
-
const h =
|
|
535
|
+
for (let c = 0; c < i.length; c++) {
|
|
536
|
+
const h = i[c], d = h.querySelector("me-tpc"), { offsetLeft: p, offsetTop: f } = D(this.nodes, d), y = d.offsetWidth, l = d.offsetHeight, a = h.parentNode.className, u = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: r, cT: f, cL: p, cW: y, cH: l, direction: a, containerHeight: this.nodes.offsetHeight }), g = this.theme.palette, w = d.nodeObj.branchColor || g[c % g.length];
|
|
536
537
|
if (d.style.borderColor = w, this.lines.appendChild(vt(u, w, "3")), t && t !== h)
|
|
537
538
|
continue;
|
|
538
539
|
const m = G("subLines"), v = h.lastChild;
|
|
539
540
|
v.tagName === "svg" && v.remove(), h.appendChild(m), xt(this, m, w, h, a, !0);
|
|
540
541
|
}
|
|
541
|
-
this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
542
|
-
}, xt = function(t, e, n, o, s,
|
|
543
|
-
const
|
|
542
|
+
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
543
|
+
}, xt = function(t, e, n, o, s, r) {
|
|
544
|
+
const i = o.firstChild, c = o.children[1].children;
|
|
544
545
|
if (c.length === 0)
|
|
545
546
|
return;
|
|
546
|
-
const h =
|
|
547
|
+
const h = i.offsetTop, d = i.offsetLeft, p = i.offsetWidth, f = i.offsetHeight;
|
|
547
548
|
for (let y = 0; y < c.length; y++) {
|
|
548
|
-
const l = c[y], a = l.firstChild, u = a.offsetTop, g = a.offsetLeft, w = a.offsetWidth, m = a.offsetHeight, v = a.firstChild.nodeObj.branchColor || n, b = t.generateSubBranch({ pT: h, pL: d, pW: p, pH: f, cT: u, cL: g, cW: w, cH: m, direction: s, isFirst:
|
|
549
|
+
const l = c[y], a = l.firstChild, u = a.offsetTop, g = a.offsetLeft, w = a.offsetWidth, m = a.offsetHeight, v = a.firstChild.nodeObj.branchColor || n, b = t.generateSubBranch({ pT: h, pL: d, pW: p, pH: f, cT: u, cL: g, cW: w, cH: m, direction: s, isFirst: r });
|
|
549
550
|
e.appendChild(vt(b, v, "2"));
|
|
550
551
|
const x = a.children[1];
|
|
551
552
|
if (x) {
|
|
@@ -570,14 +571,14 @@ const qt = {
|
|
|
570
571
|
return n.id = t, n.innerHTML = qt[e], n;
|
|
571
572
|
};
|
|
572
573
|
function _t(t) {
|
|
573
|
-
const e = document.createElement("div"), n = P("fullscreen", "full"), o = P("toCenter", "living"), s = P("zoomout", "zoomout"),
|
|
574
|
-
return
|
|
574
|
+
const e = document.createElement("div"), n = P("fullscreen", "full"), o = P("toCenter", "living"), s = P("zoomout", "zoomout"), r = P("zoomin", "zoomin"), i = document.createElement("span");
|
|
575
|
+
return i.innerText = "100%", e.appendChild(n), e.appendChild(o), e.appendChild(s), e.appendChild(r), e.className = "mind-elixir-toolbar rb", n.onclick = () => {
|
|
575
576
|
document.fullscreenElement === t.el ? document.exitFullscreen() : t.el.requestFullscreen();
|
|
576
577
|
}, o.onclick = () => {
|
|
577
578
|
t.toCenter();
|
|
578
579
|
}, s.onclick = () => {
|
|
579
580
|
t.scale(t.scaleVal - t.scaleSensitivity);
|
|
580
|
-
},
|
|
581
|
+
}, r.onclick = () => {
|
|
581
582
|
t.scale(t.scaleVal + t.scaleSensitivity);
|
|
582
583
|
}, e;
|
|
583
584
|
}
|
|
@@ -600,9 +601,9 @@ const Jt = function(t, e = !0) {
|
|
|
600
601
|
...(t.type === "dark" ? nt : et).cssVar,
|
|
601
602
|
...t.cssVar
|
|
602
603
|
}, s = Object.keys(o);
|
|
603
|
-
for (let
|
|
604
|
-
const
|
|
605
|
-
this.container.style.setProperty(
|
|
604
|
+
for (let r = 0; r < s.length; r++) {
|
|
605
|
+
const i = s[r];
|
|
606
|
+
this.container.style.setProperty(i, o[i]);
|
|
606
607
|
}
|
|
607
608
|
e && this.refresh();
|
|
608
609
|
}, Qt = function(t) {
|
|
@@ -621,7 +622,7 @@ function Zt(t) {
|
|
|
621
622
|
const te = function(t) {
|
|
622
623
|
const e = this.container, n = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
623
624
|
if (n.top > o.bottom || n.bottom < o.top || n.left > o.right || n.right < o.left) {
|
|
624
|
-
const
|
|
625
|
+
const r = n.left + n.width / 2, i = n.top + n.height / 2, c = o.left + o.width / 2, h = o.top + o.height / 2, d = r - c, p = i - h;
|
|
625
626
|
this.move(-d, -p, !0);
|
|
626
627
|
}
|
|
627
628
|
}, ee = function(t, e, n) {
|
|
@@ -647,21 +648,21 @@ const te = function(t) {
|
|
|
647
648
|
}, ae = function(t, e = { x: 0, y: 0 }) {
|
|
648
649
|
if (t < this.scaleMin || t > this.scaleMax)
|
|
649
650
|
return;
|
|
650
|
-
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx:
|
|
651
|
+
const n = this.container.getBoundingClientRect(), o = e.x ? e.x - n.left - n.width / 2 : 0, s = e.y ? e.y - n.top - n.height / 2 : 0, { dx: r, dy: i } = Ct(this), c = this.map.style.transform, { x: h, y: d } = pt(c), p = h - r, f = d - i, y = this.scaleVal, l = (-o + p) * (1 - t / y), a = (-s + f) * (1 - t / y);
|
|
651
652
|
this.map.style.transform = `translate(${h - l}px, ${d - a}px) scale(${t})`, this.scaleVal = t, this.bus.fire("scale", t);
|
|
652
653
|
}, he = function() {
|
|
653
654
|
const t = this.nodes.offsetHeight / this.container.offsetHeight, e = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(t, e));
|
|
654
655
|
this.scaleVal = n, this.map.style.transform = "scale(" + n + ")", this.bus.fire("scale", n);
|
|
655
656
|
}, de = function(t, e, n = !1) {
|
|
656
|
-
const { map: o, scaleVal: s, bus:
|
|
657
|
-
let { x: c, y: h } = pt(
|
|
657
|
+
const { map: o, scaleVal: s, bus: r } = this, i = o.style.transform;
|
|
658
|
+
let { x: c, y: h } = pt(i);
|
|
658
659
|
c += t, h += e, n && (o.style.transition = "transform 0.3s", setTimeout(() => {
|
|
659
660
|
o.style.transition = "none";
|
|
660
|
-
}, 300)), o.style.transform = `translate(${c}px, ${h}px) scale(${s})`,
|
|
661
|
+
}, 300)), o.style.transform = `translate(${c}px, ${h}px) scale(${s})`, r.fire("move", { dx: t, dy: e });
|
|
661
662
|
}, Ct = (t) => {
|
|
662
|
-
const { container: e, map: n, nodes: o } = t, s = n.querySelector("me-root"),
|
|
663
|
+
const { container: e, map: n, nodes: o } = t, s = n.querySelector("me-root"), r = s.offsetTop, i = s.offsetLeft, c = s.offsetWidth, h = s.offsetHeight;
|
|
663
664
|
let d, p;
|
|
664
|
-
return t.alignment === "root" ? (d = e.offsetWidth / 2 -
|
|
665
|
+
return t.alignment === "root" ? (d = e.offsetWidth / 2 - i - c / 2, p = e.offsetHeight / 2 - r - h / 2, n.style.transformOrigin = `${i + c / 2}px 50%`) : (d = (e.offsetWidth - o.offsetWidth) / 2, p = (e.offsetHeight - o.offsetHeight) / 2, n.style.transformOrigin = "50% 50%"), { dx: d, dy: p };
|
|
665
666
|
}, fe = function() {
|
|
666
667
|
const { map: t } = this, { dx: e, dy: n } = Ct(this);
|
|
667
668
|
t.style.transform = `translate(${e}px, ${n}px) scale(${this.scaleVal})`;
|
|
@@ -685,14 +686,14 @@ const te = function(t) {
|
|
|
685
686
|
const o = t.getBoundingClientRect(), s = {
|
|
686
687
|
x: o.left,
|
|
687
688
|
y: o.top
|
|
688
|
-
},
|
|
689
|
-
if (
|
|
689
|
+
}, r = t.parentNode, i = r.children[1];
|
|
690
|
+
if (i.expanded = n.expanded, i.className = n.expanded ? "minus" : "", Qt(t), n.expanded) {
|
|
690
691
|
const f = this.createChildren(
|
|
691
692
|
n.children.map((y) => this.createWrapper(y).grp)
|
|
692
693
|
);
|
|
693
|
-
|
|
694
|
+
r.parentNode.appendChild(f);
|
|
694
695
|
} else
|
|
695
|
-
|
|
696
|
+
r.parentNode.children[1].remove();
|
|
696
697
|
this.linkDiv(t.closest("me-main > me-wrapper"));
|
|
697
698
|
const c = t.getBoundingClientRect(), h = {
|
|
698
699
|
x: c.left,
|
|
@@ -705,10 +706,10 @@ const te = function(t) {
|
|
|
705
706
|
y: o.top
|
|
706
707
|
};
|
|
707
708
|
Z(n, e ?? !n.expanded), this.refresh();
|
|
708
|
-
const
|
|
709
|
-
x:
|
|
710
|
-
y:
|
|
711
|
-
}, c = s.x -
|
|
709
|
+
const r = this.findEle(n.id).getBoundingClientRect(), i = {
|
|
710
|
+
x: r.left,
|
|
711
|
+
y: r.top
|
|
712
|
+
}, c = s.x - i.x, h = s.y - i.y;
|
|
712
713
|
this.move(c, h);
|
|
713
714
|
}, Ce = function(t) {
|
|
714
715
|
this.clearSelection(), 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)), ot(this.nodeData), this.layout(), this.linkDiv();
|
|
@@ -775,10 +776,10 @@ const te = function(t) {
|
|
|
775
776
|
}, dt = {
|
|
776
777
|
create: Ee
|
|
777
778
|
}, ke = "#4dc4ff";
|
|
778
|
-
function St(t, e, n, o, s,
|
|
779
|
+
function St(t, e, n, o, s, r, i, c) {
|
|
779
780
|
return {
|
|
780
|
-
x: t / 8 + n * 3 / 8 + s * 3 / 8 +
|
|
781
|
-
y: e / 8 + o * 3 / 8 +
|
|
781
|
+
x: t / 8 + n * 3 / 8 + s * 3 / 8 + i / 8,
|
|
782
|
+
y: e / 8 + o * 3 / 8 + r * 3 / 8 + c / 8
|
|
782
783
|
};
|
|
783
784
|
}
|
|
784
785
|
function Te(t, e, n) {
|
|
@@ -792,16 +793,16 @@ function Y(t, e, n, o, s) {
|
|
|
792
793
|
y2: s + ""
|
|
793
794
|
});
|
|
794
795
|
}
|
|
795
|
-
function ft(t, e, n, o, s,
|
|
796
|
+
function ft(t, e, n, o, s, r, i, c, h, d) {
|
|
796
797
|
var u;
|
|
797
|
-
const p = `M ${e} ${n} C ${o} ${s} ${
|
|
798
|
+
const p = `M ${e} ${n} C ${o} ${s} ${r} ${i} ${c} ${h}`;
|
|
798
799
|
if (t.line.setAttribute("d", p), d.style) {
|
|
799
800
|
const g = d.style;
|
|
800
801
|
g.stroke && t.line.setAttribute("stroke", g.stroke), g.strokeWidth && t.line.setAttribute("stroke-width", String(g.strokeWidth)), g.strokeDasharray && t.line.setAttribute("stroke-dasharray", g.strokeDasharray), g.strokeLinecap && t.line.setAttribute("stroke-linecap", g.strokeLinecap), g.opacity !== void 0 && t.line.setAttribute("opacity", String(g.opacity));
|
|
801
802
|
}
|
|
802
803
|
const f = t.querySelectorAll('path[stroke="transparent"]');
|
|
803
804
|
f.length > 0 && f[0].setAttribute("d", p);
|
|
804
|
-
const y = q(
|
|
805
|
+
const y = q(r, i, c, h);
|
|
805
806
|
if (y) {
|
|
806
807
|
const g = `M ${y.x1} ${y.y1} L ${c} ${h} L ${y.x2} ${y.y2}`;
|
|
807
808
|
if (t.arrow1.setAttribute("d", g), f.length > 1 && f[1].setAttribute("d", g), d.style) {
|
|
@@ -819,7 +820,7 @@ function ft(t, e, n, o, s, i, r, c, h, d) {
|
|
|
819
820
|
}
|
|
820
821
|
}
|
|
821
822
|
}
|
|
822
|
-
const { x: l, y: a } = St(e, n, o, s,
|
|
823
|
+
const { x: l, y: a } = St(e, n, o, s, r, i, c, h);
|
|
823
824
|
if (t.labelElement && Te(t.labelElement, l, a), (u = d.style) != null && u.labelColor) {
|
|
824
825
|
const g = t.label.querySelector("div");
|
|
825
826
|
g && (g.style.color = d.style.labelColor);
|
|
@@ -827,10 +828,10 @@ function ft(t, e, n, o, s, i, r, c, h, d) {
|
|
|
827
828
|
He(t);
|
|
828
829
|
}
|
|
829
830
|
function U(t, e, n) {
|
|
830
|
-
const { offsetLeft: o, offsetTop: s } =
|
|
831
|
+
const { offsetLeft: o, offsetTop: s } = D(t.nodes, e), r = e.offsetWidth, i = e.offsetHeight, c = o + r / 2, h = s + i / 2, d = c + n.x, p = h + n.y;
|
|
831
832
|
return {
|
|
832
|
-
w:
|
|
833
|
-
h:
|
|
833
|
+
w: r,
|
|
834
|
+
h: i,
|
|
834
835
|
cx: c,
|
|
835
836
|
cy: h,
|
|
836
837
|
ctrlX: d,
|
|
@@ -846,10 +847,10 @@ function I(t) {
|
|
|
846
847
|
};
|
|
847
848
|
}
|
|
848
849
|
const st = function(t, e, n, o, s) {
|
|
849
|
-
var
|
|
850
|
+
var M;
|
|
850
851
|
if (!e || !n)
|
|
851
852
|
return;
|
|
852
|
-
const
|
|
853
|
+
const r = U(t, e, o.delta1), i = U(t, n, o.delta2), { x: c, y: h } = I(r), { ctrlX: d, ctrlY: p } = r, { ctrlX: f, ctrlY: y } = i, { x: l, y: a } = I(i), u = q(f, y, l, a);
|
|
853
854
|
if (!u)
|
|
854
855
|
return;
|
|
855
856
|
const g = `M ${u.x1} ${u.y1} L ${l} ${a} L ${u.x2} ${u.y2}`;
|
|
@@ -860,7 +861,7 @@ const st = function(t, e, n, o, s) {
|
|
|
860
861
|
return;
|
|
861
862
|
w = `M ${T.x1} ${T.y1} L ${c} ${h} L ${T.x2} ${T.y2}`;
|
|
862
863
|
}
|
|
863
|
-
const m = Wt(`M ${c} ${h} C ${d} ${p} ${f} ${y} ${l} ${a}`, g, w, o.style), { x: v, y: b } = St(c, h, d, p, f, y, l, a), x = (
|
|
864
|
+
const m = Wt(`M ${c} ${h} C ${d} ${p} ${f} ${y} ${l} ${a}`, g, w, o.style), { x: v, y: b } = St(c, h, d, p, f, y, l, a), x = (M = o.style) == null ? void 0 : M.labelColor, E = "arrow-" + o.id;
|
|
864
865
|
m.id = E;
|
|
865
866
|
const C = tt(o.label, v, b, {
|
|
866
867
|
anchor: "middle",
|
|
@@ -870,7 +871,7 @@ const st = function(t, e, n, o, s) {
|
|
|
870
871
|
});
|
|
871
872
|
t.labelContainer.appendChild(C), K(C);
|
|
872
873
|
const k = document.createElementNS("http://www.w3.org/2000/svg", "foreignObject");
|
|
873
|
-
m.label = k, m.labelElement = C, m.arrowObj = o, m.dataset.linkid = o.id, t.linkSvgGroup.appendChild(m), s || (t.arrows.push(o), t.currentArrow = m, Et(t, o,
|
|
874
|
+
m.label = k, m.labelElement = C, m.arrowObj = o, m.dataset.linkid = o.id, t.linkSvgGroup.appendChild(m), s || (t.arrows.push(o), t.currentArrow = m, Et(t, o, r, i));
|
|
874
875
|
}, Le = function(t, e, n = {}) {
|
|
875
876
|
const o = {
|
|
876
877
|
id: F(),
|
|
@@ -912,8 +913,8 @@ const st = function(t, e, n, o, s) {
|
|
|
912
913
|
});
|
|
913
914
|
}, De = function(t) {
|
|
914
915
|
this.currentArrow = t;
|
|
915
|
-
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = U(this, n, e.delta1),
|
|
916
|
-
Et(this, e, s,
|
|
916
|
+
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = U(this, n, e.delta1), r = U(this, o, e.delta2);
|
|
917
|
+
Et(this, e, s, r);
|
|
917
918
|
}, Ne = function() {
|
|
918
919
|
J(this), this.currentArrow = null;
|
|
919
920
|
}, Q = function(t, e) {
|
|
@@ -933,8 +934,8 @@ const st = function(t, e, n, o, s) {
|
|
|
933
934
|
n.appendChild(o);
|
|
934
935
|
const s = Q(t.arrow1.getAttribute("d"), e);
|
|
935
936
|
if (n.appendChild(s), t.arrow2.getAttribute("d")) {
|
|
936
|
-
const
|
|
937
|
-
n.appendChild(
|
|
937
|
+
const r = Q(t.arrow2.getAttribute("d"), e);
|
|
938
|
+
n.appendChild(r);
|
|
938
939
|
}
|
|
939
940
|
t.insertBefore(n, t.firstChild);
|
|
940
941
|
}, Pe = function(t) {
|
|
@@ -950,19 +951,19 @@ const st = function(t, e, n, o, s) {
|
|
|
950
951
|
var e, n;
|
|
951
952
|
(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 && Pe(t.currentArrow);
|
|
952
953
|
}, Et = function(t, e, n, o) {
|
|
953
|
-
const { linkController: s, P2:
|
|
954
|
+
const { linkController: s, P2: r, P3: i, line1: c, line2: h, nodes: d, map: p, currentArrow: f, bus: y } = t;
|
|
954
955
|
if (!f)
|
|
955
956
|
return;
|
|
956
|
-
s.style.display = "initial",
|
|
957
|
+
s.style.display = "initial", r.style.display = "initial", i.style.display = "initial", d.appendChild(s), d.appendChild(r), d.appendChild(i), Me(f, ke);
|
|
957
958
|
let { x: l, y: a } = I(n), { ctrlX: u, ctrlY: g } = n, { ctrlX: w, ctrlY: m } = o, { x: v, y: b } = I(o);
|
|
958
|
-
|
|
959
|
+
r.style.cssText = `top:${g}px;left:${u}px;`, i.style.cssText = `top:${m}px;left:${w}px;`, Y(c, l, a, u, g), Y(h, w, m, v, b), t.helper1 = dt.create(r), t.helper2 = dt.create(i), t.helper1.init(p, (x, E) => {
|
|
959
960
|
u = u + x / t.scaleVal, g = g + E / t.scaleVal;
|
|
960
961
|
const C = I({ ...n, ctrlX: u, ctrlY: g });
|
|
961
|
-
l = C.x, a = C.y,
|
|
962
|
+
l = C.x, a = C.y, r.style.top = g + "px", r.style.left = u + "px", ft(f, l, a, u, g, w, m, v, b, e), Y(c, l, a, u, g), e.delta1.x = u - n.cx, e.delta1.y = g - n.cy, y.fire("updateArrowDelta", e);
|
|
962
963
|
}), t.helper2.init(p, (x, E) => {
|
|
963
964
|
w = w + x / t.scaleVal, m = m + E / t.scaleVal;
|
|
964
965
|
const C = I({ ...o, ctrlX: w, ctrlY: m });
|
|
965
|
-
v = C.x, b = C.y,
|
|
966
|
+
v = C.x, b = C.y, i.style.top = m + "px", i.style.left = w + "px", ft(f, l, a, u, g, w, m, v, b, e), Y(h, w, m, v, b), e.delta2.x = w - o.cx, e.delta2.y = m - o.cy, y.fire("updateArrowDelta", e);
|
|
966
967
|
});
|
|
967
968
|
};
|
|
968
969
|
function Be() {
|
|
@@ -1027,13 +1028,13 @@ const We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1027
1028
|
}
|
|
1028
1029
|
if (!o)
|
|
1029
1030
|
throw new Error("Can not select root node.");
|
|
1030
|
-
const s = n.map((p) => p[o - 1].index).sort(),
|
|
1031
|
+
const s = n.map((p) => p[o - 1].index).sort(), r = s[0] || 0, i = s[s.length - 1] || 0, c = n[0][o - 1].node;
|
|
1031
1032
|
if (!c.parent)
|
|
1032
1033
|
throw new Error("Please select nodes in the same main topic.");
|
|
1033
1034
|
return {
|
|
1034
1035
|
parent: c.id,
|
|
1035
|
-
start:
|
|
1036
|
-
end:
|
|
1036
|
+
start: r,
|
|
1037
|
+
end: i
|
|
1037
1038
|
};
|
|
1038
1039
|
}, Fe = function(t) {
|
|
1039
1040
|
const e = document.createElementNS(A, "g");
|
|
@@ -1049,18 +1050,18 @@ const We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1049
1050
|
}), n;
|
|
1050
1051
|
}, Ve = (t) => t.parentElement.parentElement, Re = function(t, { parent: e, start: n }) {
|
|
1051
1052
|
const o = t.findEle(e), s = o.nodeObj;
|
|
1052
|
-
let
|
|
1053
|
-
return s.parent ?
|
|
1053
|
+
let r;
|
|
1054
|
+
return s.parent ? r = o.closest("me-main").className : r = t.findEle(s.children[n].id).closest("me-main").className, r;
|
|
1054
1055
|
}, it = function(t, e) {
|
|
1055
|
-
var
|
|
1056
|
-
const { id: n, label: o, parent: s, start:
|
|
1056
|
+
var M;
|
|
1057
|
+
const { id: n, label: o, parent: s, start: r, end: i } = e, { nodes: c, theme: h, summarySvg: d } = t, f = t.findEle(s).nodeObj, y = Re(t, e);
|
|
1057
1058
|
let l = 1 / 0, a = 0, u = 0, g = 0;
|
|
1058
|
-
for (let T =
|
|
1059
|
-
const W = (
|
|
1059
|
+
for (let T = r; T <= i; T++) {
|
|
1060
|
+
const W = (M = f.children) == null ? void 0 : M[T];
|
|
1060
1061
|
if (!W)
|
|
1061
1062
|
return t.removeSummary(n), null;
|
|
1062
|
-
const V = Ve(t.findEle(W.id)), { offsetLeft: R, offsetTop: rt } =
|
|
1063
|
-
T ===
|
|
1063
|
+
const V = Ve(t.findEle(W.id)), { offsetLeft: R, offsetTop: rt } = D(c, V), ct = r === i ? 10 : 20;
|
|
1064
|
+
T === r && (u = rt + ct), T === i && (g = rt + V.offsetHeight - ct), R < l && (l = R), V.offsetWidth + R > a && (a = V.offsetWidth + R);
|
|
1064
1065
|
}
|
|
1065
1066
|
let w, m;
|
|
1066
1067
|
const v = u + 10, b = g + 10, x = (v + b) / 2, E = h.cssVar["--color"], C = "s-" + n;
|
|
@@ -1070,10 +1071,10 @@ const We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1070
1071
|
}, Ye = function() {
|
|
1071
1072
|
if (!this.currentNodes)
|
|
1072
1073
|
return;
|
|
1073
|
-
const { currentNodes: t, summaries: e, bus: n } = this, { parent: o, start: s, end:
|
|
1074
|
-
e.push(
|
|
1074
|
+
const { currentNodes: t, summaries: e, bus: n } = this, { parent: o, start: s, end: r } = Ge(t), i = { id: F(), parent: o, start: s, end: r, label: "summary" }, c = it(this, i);
|
|
1075
|
+
e.push(i), this.editSummary(c), n.fire("operation", {
|
|
1075
1076
|
name: "createSummary",
|
|
1076
|
-
obj:
|
|
1077
|
+
obj: i
|
|
1077
1078
|
});
|
|
1078
1079
|
}, je = function(t) {
|
|
1079
1080
|
const e = F(), n = { ...t, id: e };
|
|
@@ -1127,8 +1128,8 @@ function Qe(t, e) {
|
|
|
1127
1128
|
}
|
|
1128
1129
|
function Ze(t, e, n, o) {
|
|
1129
1130
|
const s = document.createElementNS($, "g");
|
|
1130
|
-
let
|
|
1131
|
-
return t.text ?
|
|
1131
|
+
let r = "";
|
|
1132
|
+
return t.text ? r = t.text.textContent : r = t.childNodes[0].textContent, r.split(`
|
|
1132
1133
|
`).forEach((c, h) => {
|
|
1133
1134
|
const d = document.createElementNS($, "text");
|
|
1134
1135
|
S(d, {
|
|
@@ -1146,22 +1147,22 @@ function tn(t, e, n, o) {
|
|
|
1146
1147
|
var c;
|
|
1147
1148
|
let s = "";
|
|
1148
1149
|
(c = t.nodeObj) != null && c.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
|
|
1149
|
-
const
|
|
1150
|
-
S(
|
|
1150
|
+
const r = document.createElementNS($, "foreignObject");
|
|
1151
|
+
S(r, {
|
|
1151
1152
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1152
1153
|
y: o + parseInt(e.paddingTop) + "",
|
|
1153
1154
|
width: e.width,
|
|
1154
1155
|
height: e.height
|
|
1155
1156
|
});
|
|
1156
|
-
const
|
|
1157
|
-
return S(
|
|
1157
|
+
const i = document.createElement("div");
|
|
1158
|
+
return S(i, {
|
|
1158
1159
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
1159
1160
|
style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
|
|
1160
|
-
}),
|
|
1161
|
+
}), i.innerHTML = s, r.appendChild(i), r;
|
|
1161
1162
|
}
|
|
1162
1163
|
function en(t, e) {
|
|
1163
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1164
|
-
return S(
|
|
1164
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = D(t.nodes, e), r = document.createElementNS($, "rect");
|
|
1165
|
+
return S(r, {
|
|
1165
1166
|
x: o + "",
|
|
1166
1167
|
y: s + "",
|
|
1167
1168
|
rx: n.borderRadius,
|
|
@@ -1171,13 +1172,13 @@ function en(t, e) {
|
|
|
1171
1172
|
fill: n.backgroundColor,
|
|
1172
1173
|
stroke: n.borderColor,
|
|
1173
1174
|
"stroke-width": n.borderWidth
|
|
1174
|
-
}),
|
|
1175
|
+
}), r;
|
|
1175
1176
|
}
|
|
1176
1177
|
function j(t, e, n = !1) {
|
|
1177
|
-
const o = getComputedStyle(e), { offsetLeft: s, offsetTop:
|
|
1178
|
-
S(
|
|
1178
|
+
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: r } = D(t.nodes, e), i = document.createElementNS($, "rect");
|
|
1179
|
+
S(i, {
|
|
1179
1180
|
x: s + "",
|
|
1180
|
-
y:
|
|
1181
|
+
y: r + "",
|
|
1181
1182
|
rx: o.borderRadius,
|
|
1182
1183
|
ry: o.borderRadius,
|
|
1183
1184
|
width: o.width,
|
|
@@ -1187,13 +1188,13 @@ function j(t, e, n = !1) {
|
|
|
1187
1188
|
"stroke-width": o.borderWidth
|
|
1188
1189
|
});
|
|
1189
1190
|
const c = document.createElementNS($, "g");
|
|
1190
|
-
c.appendChild(
|
|
1191
|
+
c.appendChild(i);
|
|
1191
1192
|
let h;
|
|
1192
|
-
return n ? h = tn(e, o, s,
|
|
1193
|
+
return n ? h = tn(e, o, s, r) : h = Ze(e, o, s, r), c.appendChild(h), c;
|
|
1193
1194
|
}
|
|
1194
1195
|
function nn(t, e) {
|
|
1195
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1196
|
-
return S(
|
|
1196
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = D(t.nodes, e), r = document.createElementNS($, "a"), i = document.createElementNS($, "text");
|
|
1197
|
+
return S(i, {
|
|
1197
1198
|
x: o + "",
|
|
1198
1199
|
y: s + parseInt(n.fontSize) + "",
|
|
1199
1200
|
"text-anchor": "start",
|
|
@@ -1201,51 +1202,51 @@ function nn(t, e) {
|
|
|
1201
1202
|
"font-size": `${n.fontSize}`,
|
|
1202
1203
|
"font-weight": `${n.fontWeight}`,
|
|
1203
1204
|
fill: `${n.color}`
|
|
1204
|
-
}),
|
|
1205
|
+
}), i.innerHTML = e.textContent, r.appendChild(i), r.setAttribute("href", e.href), r;
|
|
1205
1206
|
}
|
|
1206
1207
|
function on(t, e) {
|
|
1207
|
-
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } =
|
|
1208
|
-
return S(
|
|
1208
|
+
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = D(t.nodes, e), r = document.createElementNS($, "image");
|
|
1209
|
+
return S(r, {
|
|
1209
1210
|
x: o + "",
|
|
1210
1211
|
y: s + "",
|
|
1211
1212
|
width: n.width + "",
|
|
1212
1213
|
height: n.height + "",
|
|
1213
1214
|
href: e.src
|
|
1214
|
-
}),
|
|
1215
|
+
}), r;
|
|
1215
1216
|
}
|
|
1216
1217
|
const z = 100, sn = '<?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">', rn = (t, e = !1) => {
|
|
1217
1218
|
var f, y, l;
|
|
1218
|
-
const n = t.nodes, o = n.offsetHeight + z * 2, s = n.offsetWidth + z * 2,
|
|
1219
|
+
const n = t.nodes, o = n.offsetHeight + z * 2, s = n.offsetWidth + z * 2, r = Je(o + "px", s + "px"), i = document.createElementNS($, "svg"), c = document.createElementNS($, "rect");
|
|
1219
1220
|
S(c, {
|
|
1220
1221
|
x: "0",
|
|
1221
1222
|
y: "0",
|
|
1222
1223
|
width: `${s}`,
|
|
1223
1224
|
height: `${o}`,
|
|
1224
1225
|
fill: t.theme.cssVar["--bgcolor"]
|
|
1225
|
-
}),
|
|
1226
|
-
const u = a.cloneNode(!0), { offsetLeft: g, offsetTop: w } =
|
|
1227
|
-
u.setAttribute("x", `${g}`), u.setAttribute("y", `${w}`),
|
|
1226
|
+
}), r.appendChild(c), n.querySelectorAll(".subLines").forEach((a) => {
|
|
1227
|
+
const u = a.cloneNode(!0), { offsetLeft: g, offsetTop: w } = D(n, a.parentElement);
|
|
1228
|
+
u.setAttribute("x", `${g}`), u.setAttribute("y", `${w}`), i.appendChild(u);
|
|
1228
1229
|
});
|
|
1229
1230
|
const h = (f = n.querySelector(".lines")) == null ? void 0 : f.cloneNode(!0);
|
|
1230
|
-
h &&
|
|
1231
|
+
h && i.appendChild(h);
|
|
1231
1232
|
const d = (y = n.querySelector(".topiclinks")) == null ? void 0 : y.cloneNode(!0);
|
|
1232
|
-
d &&
|
|
1233
|
+
d && i.appendChild(d);
|
|
1233
1234
|
const p = (l = n.querySelector(".summary")) == null ? void 0 : l.cloneNode(!0);
|
|
1234
|
-
return p &&
|
|
1235
|
-
a.nodeObj.dangerouslySetInnerHTML ?
|
|
1235
|
+
return p && i.appendChild(p), n.querySelectorAll("me-tpc").forEach((a) => {
|
|
1236
|
+
a.nodeObj.dangerouslySetInnerHTML ? i.appendChild(j(t, a, !e)) : (i.appendChild(en(t, a)), i.appendChild(j(t, a.text, !e)));
|
|
1236
1237
|
}), n.querySelectorAll(".tags > span").forEach((a) => {
|
|
1237
|
-
|
|
1238
|
+
i.appendChild(j(t, a));
|
|
1238
1239
|
}), n.querySelectorAll(".icons > span").forEach((a) => {
|
|
1239
|
-
|
|
1240
|
+
i.appendChild(j(t, a));
|
|
1240
1241
|
}), n.querySelectorAll(".hyper-link").forEach((a) => {
|
|
1241
|
-
|
|
1242
|
+
i.appendChild(nn(t, a));
|
|
1242
1243
|
}), n.querySelectorAll("img").forEach((a) => {
|
|
1243
|
-
|
|
1244
|
-
}), S(
|
|
1244
|
+
i.appendChild(on(t, a));
|
|
1245
|
+
}), S(i, {
|
|
1245
1246
|
x: z + "",
|
|
1246
1247
|
y: z + "",
|
|
1247
1248
|
overflow: "visible"
|
|
1248
|
-
}),
|
|
1249
|
+
}), r.appendChild(i), r;
|
|
1249
1250
|
}, cn = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), sn + t.outerHTML);
|
|
1250
1251
|
function ln(t) {
|
|
1251
1252
|
return new Promise((e, n) => {
|
|
@@ -1262,12 +1263,12 @@ const an = function(t = !1, e) {
|
|
|
1262
1263
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1263
1264
|
}, hn = async function(t = !1, e) {
|
|
1264
1265
|
const n = this.exportSvg(t, e), o = await ln(n);
|
|
1265
|
-
return new Promise((s,
|
|
1266
|
-
const
|
|
1267
|
-
|
|
1266
|
+
return new Promise((s, r) => {
|
|
1267
|
+
const i = new Image();
|
|
1268
|
+
i.setAttribute("crossOrigin", "anonymous"), i.onload = () => {
|
|
1268
1269
|
const c = document.createElement("canvas");
|
|
1269
|
-
c.width =
|
|
1270
|
-
},
|
|
1270
|
+
c.width = i.width, c.height = i.height, c.getContext("2d").drawImage(i, 0, 0), c.toBlob(s, "image/png", 1);
|
|
1271
|
+
}, i.src = o, i.onerror = r;
|
|
1271
1272
|
});
|
|
1272
1273
|
}, dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1273
1274
|
__proto__: null,
|
|
@@ -1300,24 +1301,24 @@ const an = function(t = !1, e) {
|
|
|
1300
1301
|
this.disposable.forEach((e) => e()), this.el && (this.el.innerHTML = ""), this.el = void 0, this.nodeData = void 0, this.arrows = void 0, this.summaries = void 0, this.currentArrow = void 0, this.currentNodes = void 0, this.currentSummary = void 0, this.waitCopy = void 0, this.theme = void 0, this.direction = void 0, this.bus = void 0, this.container = void 0, this.map = void 0, this.lines = void 0, this.linkController = void 0, this.linkSvgGroup = void 0, this.P2 = void 0, this.P3 = void 0, this.line1 = void 0, this.line2 = void 0, this.nodes = void 0, (t = this.selection) == null || t.destroy(), this.selection = void 0;
|
|
1301
1302
|
}
|
|
1302
1303
|
};
|
|
1303
|
-
function pn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL:
|
|
1304
|
+
function pn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: r, cW: i, cH: c, direction: h, containerHeight: d }) {
|
|
1304
1305
|
let p = e + n / 2;
|
|
1305
1306
|
const f = t + o / 2;
|
|
1306
1307
|
let y;
|
|
1307
|
-
h === H.LHS ? y =
|
|
1308
|
+
h === H.LHS ? y = r + i : y = r;
|
|
1308
1309
|
const l = s + c / 2, u = (1 - Math.abs(l - f) / d) * 0.25 * (n / 2);
|
|
1309
1310
|
return h === H.LHS ? p = p - n / 10 - u : p = p + n / 10 + u, `M ${p} ${f} Q ${p} ${l} ${y} ${l}`;
|
|
1310
1311
|
}
|
|
1311
|
-
function gn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL:
|
|
1312
|
+
function gn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: r, cW: i, cH: c, direction: h, isFirst: d }) {
|
|
1312
1313
|
const p = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
1313
1314
|
let f = 0, y = 0;
|
|
1314
1315
|
d ? f = t + o / 2 : f = t + o;
|
|
1315
1316
|
const l = s + c;
|
|
1316
1317
|
let a = 0, u = 0, g = 0;
|
|
1317
1318
|
const w = Math.abs(f - l) / 300 * p;
|
|
1318
|
-
return h === H.LHS ? (g = e, a = g + p, u = g - p, y =
|
|
1319
|
+
return h === H.LHS ? (g = e, a = g + p, u = g - p, y = r + p, `M ${a} ${f} C ${g} ${f} ${g + w} ${l} ${u} ${l} H ${y}`) : (g = e + n, a = g - p, u = g + p, y = r + i - p, `M ${a} ${f} C ${g} ${f} ${g - w} ${l} ${u} ${l} H ${y}`);
|
|
1319
1320
|
}
|
|
1320
|
-
const mn = "5.2.0-beta.
|
|
1321
|
+
const mn = "5.2.0-beta.3";
|
|
1321
1322
|
function yn(t) {
|
|
1322
1323
|
return {
|
|
1323
1324
|
x: 0,
|
|
@@ -1334,14 +1335,14 @@ function yn(t) {
|
|
|
1334
1335
|
};
|
|
1335
1336
|
}
|
|
1336
1337
|
const B = document;
|
|
1337
|
-
function
|
|
1338
|
+
function N({
|
|
1338
1339
|
el: t,
|
|
1339
1340
|
direction: e,
|
|
1340
1341
|
locale: n,
|
|
1341
1342
|
draggable: o,
|
|
1342
1343
|
editable: s,
|
|
1343
|
-
contextMenu:
|
|
1344
|
-
toolBar:
|
|
1344
|
+
contextMenu: r,
|
|
1345
|
+
toolBar: i,
|
|
1345
1346
|
keypress: c,
|
|
1346
1347
|
mouseSelectionButton: h,
|
|
1347
1348
|
selectionContainer: d,
|
|
@@ -1361,29 +1362,29 @@ function D({
|
|
|
1361
1362
|
imageProxy: C
|
|
1362
1363
|
}) {
|
|
1363
1364
|
let k = null;
|
|
1364
|
-
const
|
|
1365
|
-
if (
|
|
1365
|
+
const M = Object.prototype.toString.call(t);
|
|
1366
|
+
if (M === "[object HTMLDivElement]" ? k = t : M === "[object String]" && (k = document.querySelector(t)), !k)
|
|
1366
1367
|
throw new Error("MindElixir: el is not a valid element");
|
|
1367
|
-
k.style.position = "relative", k.innerHTML = "", this.el = k, this.disposable = [], this.before = p || {}, this.locale = n || "en", this.newTopicName = f || "New Node", this.contextMenu =
|
|
1368
|
+
k.style.position = "relative", k.innerHTML = "", this.el = k, this.disposable = [], this.before = p || {}, this.locale = n || "en", this.newTopicName = f || "New Node", this.contextMenu = r ?? !0, this.toolBar = i ?? !0, this.keypress = c ?? !0, this.mouseSelectionButton = h ?? 0, this.direction = e ?? 1, this.draggable = o ?? !0, this.editable = s ?? !0, this.allowUndo = y ?? !0, this.scaleSensitivity = m ?? 0.1, this.scaleMax = v ?? 1.4, this.scaleMin = b ?? 0.2, this.generateMainBranch = l || pn, this.generateSubBranch = a || gn, this.overflowHidden = u ?? !1, this.alignment = w ?? "root", this.handleWheel = x ?? !0, this.markdown = E || void 0, this.imageProxy = C || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = yn(this), this.bus = $t(), this.container = B.createElement("div"), this.selectionContainer = d || this.container, this.container.className = "map-container";
|
|
1368
1369
|
const T = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1369
1370
|
this.theme = g || (T.matches ? nt : et);
|
|
1370
1371
|
const W = B.createElement("div");
|
|
1371
1372
|
W.className = "map-canvas", this.map = W, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = B.createElement("me-nodes"), this.lines = G("lines"), this.summarySvg = G("summary"), this.linkController = G("linkcontroller"), this.P2 = B.createElement("div"), this.P3 = B.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = ht(), this.line2 = ht(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = G("topiclinks"), this.labelContainer = B.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Lt(this));
|
|
1372
1373
|
}
|
|
1373
|
-
|
|
1374
|
-
Object.defineProperty(
|
|
1374
|
+
N.prototype = un;
|
|
1375
|
+
Object.defineProperty(N.prototype, "currentNode", {
|
|
1375
1376
|
get() {
|
|
1376
1377
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
1377
1378
|
},
|
|
1378
1379
|
enumerable: !0
|
|
1379
1380
|
});
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1381
|
+
N.LEFT = 0;
|
|
1382
|
+
N.RIGHT = 1;
|
|
1383
|
+
N.SIDE = 2;
|
|
1384
|
+
N.THEME = et;
|
|
1385
|
+
N.DARK_THEME = nt;
|
|
1386
|
+
N.version = mn;
|
|
1387
|
+
N.E = mt;
|
|
1387
1388
|
export {
|
|
1388
|
-
|
|
1389
|
+
N as default
|
|
1389
1390
|
};
|