mind-elixir 5.9.3 → 5.10.0
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 +610 -753
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +232 -236
- package/dist/PlaintextConverter.js +125 -119
- package/dist/i18n.js +242 -0
- package/dist/types/docs.d.ts +2 -2
- package/dist/types/i18n.d.ts +19 -7
- package/dist/types/index.d.ts +2 -4
- package/dist/types/interact.d.ts +0 -8
- package/dist/types/methods.d.ts +0 -1
- package/dist/types/plugin/contextMenu.d.ts +2 -0
- package/dist/types/types/index.d.ts +13 -2
- package/package.json +8 -15
- package/readme.md +2 -2
package/dist/MindElixirLite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Hn = 0, In = 1, On = 2, rt = {
|
|
2
2
|
name: "Latte",
|
|
3
3
|
type: "light",
|
|
4
4
|
palette: ["#dd7878", "#ea76cb", "#8839ef", "#e64553", "#fe640b", "#df8e1d", "#40a02b", "#209fb5", "#1e66f5", "#7287fd"],
|
|
@@ -99,7 +99,7 @@ const It = function() {
|
|
|
99
99
|
for (; e && e !== t; )
|
|
100
100
|
n += e.offsetLeft, o += e.offsetTop, e = e.offsetParent;
|
|
101
101
|
return { offsetLeft: n, offsetTop: o };
|
|
102
|
-
},
|
|
102
|
+
}, D = (t, e) => {
|
|
103
103
|
for (const n in e)
|
|
104
104
|
t.setAttribute(n, e[n]);
|
|
105
105
|
}, nt = (t) => t ? t.tagName === "ME-TPC" : !1, at = (t) => {
|
|
@@ -350,9 +350,7 @@ const jt = function(t) {
|
|
|
350
350
|
this.direction = 1, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
351
351
|
}, he = function() {
|
|
352
352
|
this.direction = 2, this.refresh(), this.toCenter(), this.bus.fire("changeDirection", this.direction);
|
|
353
|
-
}, fe = function(t) {
|
|
354
|
-
this.locale = t, this.refresh();
|
|
355
|
-
}, ue = function(t, e) {
|
|
353
|
+
}, fe = function(t, e) {
|
|
356
354
|
const n = t.nodeObj;
|
|
357
355
|
typeof e == "boolean" ? n.expanded = e : n.expanded !== !1 ? n.expanded = !1 : n.expanded = !0;
|
|
358
356
|
const o = t.getBoundingClientRect(), s = {
|
|
@@ -372,7 +370,7 @@ const jt = function(t) {
|
|
|
372
370
|
y: c.top
|
|
373
371
|
}, l = s.x - a.x, h = s.y - a.y;
|
|
374
372
|
this.move(l, h), this.bus.fire("expandNode", n);
|
|
375
|
-
},
|
|
373
|
+
}, ue = function(t, e) {
|
|
376
374
|
const n = t.nodeObj, o = t.getBoundingClientRect(), s = {
|
|
377
375
|
x: o.left,
|
|
378
376
|
y: o.top
|
|
@@ -383,16 +381,16 @@ const jt = function(t) {
|
|
|
383
381
|
y: i.top
|
|
384
382
|
}, c = s.x - r.x, a = s.y - r.y;
|
|
385
383
|
this.move(c, a);
|
|
386
|
-
},
|
|
384
|
+
}, pe = function(t) {
|
|
387
385
|
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)), lt(this.nodeData), this.layout(), this.linkDiv();
|
|
388
|
-
},
|
|
386
|
+
}, ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
389
387
|
__proto__: null,
|
|
390
388
|
cancelFocus: le,
|
|
391
389
|
clearSelection: Jt,
|
|
392
390
|
disableEdit: ee,
|
|
393
391
|
enableEdit: te,
|
|
394
|
-
expandNode:
|
|
395
|
-
expandNodeAll:
|
|
392
|
+
expandNode: fe,
|
|
393
|
+
expandNodeAll: ue,
|
|
396
394
|
focusNode: ce,
|
|
397
395
|
getData: Zt,
|
|
398
396
|
getDataString: Qt,
|
|
@@ -401,13 +399,12 @@ const jt = function(t) {
|
|
|
401
399
|
initSide: he,
|
|
402
400
|
install: re,
|
|
403
401
|
move: se,
|
|
404
|
-
refresh:
|
|
402
|
+
refresh: pe,
|
|
405
403
|
scale: ne,
|
|
406
404
|
scaleFit: oe,
|
|
407
405
|
scrollIntoView: jt,
|
|
408
406
|
selectNode: _t,
|
|
409
407
|
selectNodes: Ut,
|
|
410
|
-
setLocale: fe,
|
|
411
408
|
stringifyData: Lt,
|
|
412
409
|
toCenter: ie,
|
|
413
410
|
unselectNodes: Kt
|
|
@@ -420,7 +417,7 @@ const jt = function(t) {
|
|
|
420
417
|
case "out":
|
|
421
418
|
t.scale(o - s, n);
|
|
422
419
|
}
|
|
423
|
-
},
|
|
420
|
+
}, me = function(t, e) {
|
|
424
421
|
if (!e)
|
|
425
422
|
return Z(t), t;
|
|
426
423
|
let n = t.querySelector(".insert-preview");
|
|
@@ -437,11 +434,11 @@ const jt = function(t) {
|
|
|
437
434
|
if (!(t && t.tagName === "ME-TPC" && t !== n && !o && t.nodeObj.parent)) return !1;
|
|
438
435
|
}
|
|
439
436
|
return !0;
|
|
440
|
-
},
|
|
437
|
+
}, ye = function(t) {
|
|
441
438
|
const e = document.createElement("div");
|
|
442
439
|
return e.className = "mind-elixir-ghost", t.container.appendChild(e), e;
|
|
443
440
|
};
|
|
444
|
-
class
|
|
441
|
+
class ve {
|
|
445
442
|
mind;
|
|
446
443
|
isMoving = !1;
|
|
447
444
|
interval = null;
|
|
@@ -458,19 +455,19 @@ class we {
|
|
|
458
455
|
this.isMoving = !1, this.interval && (clearInterval(this.interval), this.interval = null);
|
|
459
456
|
}
|
|
460
457
|
}
|
|
461
|
-
function
|
|
458
|
+
function we(t) {
|
|
462
459
|
return {
|
|
463
460
|
isDragging: !1,
|
|
464
461
|
insertType: null,
|
|
465
462
|
meet: null,
|
|
466
|
-
ghost:
|
|
467
|
-
edgeMoveController: new
|
|
463
|
+
ghost: ye(t),
|
|
464
|
+
edgeMoveController: new ve(t),
|
|
468
465
|
startX: 0,
|
|
469
466
|
startY: 0,
|
|
470
467
|
pointerId: null
|
|
471
468
|
};
|
|
472
469
|
}
|
|
473
|
-
const
|
|
470
|
+
const be = 5;
|
|
474
471
|
function mt(t, e, n, o = !1) {
|
|
475
472
|
if (t.spacePressed) return !1;
|
|
476
473
|
const s = n.target;
|
|
@@ -491,11 +488,11 @@ function Mt(t, e) {
|
|
|
491
488
|
s.parentElement.parentElement.style.opacity = "0.5";
|
|
492
489
|
t.dragMoveHelper.clear();
|
|
493
490
|
}
|
|
494
|
-
function
|
|
491
|
+
function xe(t, e, n) {
|
|
495
492
|
const { dragged: o } = t;
|
|
496
493
|
if (!o || e.pointerId !== n.pointerId) return;
|
|
497
494
|
const s = n.clientX - e.startX, i = n.clientY - e.startY, r = Math.sqrt(s * s + i * i);
|
|
498
|
-
if (!e.isDragging && r >
|
|
495
|
+
if (!e.isDragging && r > be && Mt(t, e), !e.isDragging) return;
|
|
499
496
|
const c = t.container.getBoundingClientRect();
|
|
500
497
|
Dt(e.ghost, n.clientX - c.x, n.clientY - c.y), n.clientX < c.x + 50 ? e.edgeMoveController.move(1, 0) : n.clientX > c.x + c.width - 50 ? e.edgeMoveController.move(-1, 0) : n.clientY < c.y + 50 ? e.edgeMoveController.move(0, 1) : n.clientY > c.y + c.height - 50 ? e.edgeMoveController.move(0, -1) : e.edgeMoveController.stop(), Z(e.meet);
|
|
501
498
|
const a = 12 * t.scaleVal, l = document.elementFromPoint(n.clientX, n.clientY - a);
|
|
@@ -512,9 +509,9 @@ function Ce(t, e, n) {
|
|
|
512
509
|
} else
|
|
513
510
|
e.insertType = null, e.meet = null;
|
|
514
511
|
}
|
|
515
|
-
e.meet &&
|
|
512
|
+
e.meet && me(e.meet, e.insertType);
|
|
516
513
|
}
|
|
517
|
-
function
|
|
514
|
+
function Ce(t, e, n) {
|
|
518
515
|
const { dragged: o } = t;
|
|
519
516
|
if (!(!o || e.pointerId !== n.pointerId)) {
|
|
520
517
|
e.edgeMoveController.stop();
|
|
@@ -532,12 +529,12 @@ function ot(t, e) {
|
|
|
532
529
|
e.meet && Z(e.meet), e.ghost.style.display = "none", e.ghost.innerHTML = "", t.dragged = null, e.isDragging = !1, e.insertType = null, e.meet = null, e.pointerId = null;
|
|
533
530
|
}
|
|
534
531
|
}
|
|
535
|
-
function
|
|
532
|
+
function Ee(t) {
|
|
536
533
|
const { dragMoveHelper: e } = t;
|
|
537
534
|
let n = 0;
|
|
538
535
|
t.spacePressed = !1;
|
|
539
536
|
let o = null;
|
|
540
|
-
const s = /* @__PURE__ */ new Map(), i =
|
|
537
|
+
const s = /* @__PURE__ */ new Map(), i = we(t);
|
|
541
538
|
let r = null, c = null, a = null, l = null;
|
|
542
539
|
const h = 500, f = 10, u = () => {
|
|
543
540
|
r !== null && (clearTimeout(r), r = null, c = null, a = null, l = null);
|
|
@@ -545,9 +542,9 @@ function Se(t) {
|
|
|
545
542
|
d.hasPointerCapture && d.hasPointerCapture(v) && d.releasePointerCapture(v);
|
|
546
543
|
}, m = (d, v) => {
|
|
547
544
|
if (d.id === "input-box" || d.closest("#input-box")) return !1;
|
|
548
|
-
const
|
|
549
|
-
if (
|
|
550
|
-
const $ =
|
|
545
|
+
const E = d.closest(".svg-label");
|
|
546
|
+
if (E) {
|
|
547
|
+
const $ = E.dataset.svgId, q = E.dataset.type, G = document.getElementById($);
|
|
551
548
|
if (G) {
|
|
552
549
|
if (q === "arrow")
|
|
553
550
|
return v ? t.editArrowLabel(G) : t.selectArrow(G), !0;
|
|
@@ -596,8 +593,8 @@ function Se(t) {
|
|
|
596
593
|
nt(v) && t.beginEdit(v), m(v, !0);
|
|
597
594
|
}, b = (d) => {
|
|
598
595
|
if (d.pointerType === "mouse" || s.size > 1) return;
|
|
599
|
-
const v = (/* @__PURE__ */ new Date()).getTime(),
|
|
600
|
-
|
|
596
|
+
const v = (/* @__PURE__ */ new Date()).getTime(), E = v - n;
|
|
597
|
+
E < 300 && E > 0 && g(d), n = v;
|
|
601
598
|
}, w = (d) => {
|
|
602
599
|
d.code === "Space" && (t.spacePressed = !0, t.container.classList.add("space-pressed"));
|
|
603
600
|
}, x = (d) => {
|
|
@@ -608,7 +605,7 @@ function Se(t) {
|
|
|
608
605
|
o = ut($, q), u();
|
|
609
606
|
}
|
|
610
607
|
e.moved = !1;
|
|
611
|
-
const v = d.target,
|
|
608
|
+
const v = d.target, E = t.mouseSelectionButton === 0 ? 2 : 0;
|
|
612
609
|
if (t.editable && i && (d.button === 0 || d.pointerType === "touch")) {
|
|
613
610
|
if (d.pointerType === "touch" && s.size > 1)
|
|
614
611
|
(i.isDragging || i.pointerId !== null) && ot(t, i);
|
|
@@ -621,24 +618,24 @@ function Se(t) {
|
|
|
621
618
|
return;
|
|
622
619
|
}
|
|
623
620
|
}
|
|
624
|
-
const P = t.spacePressed && d.button === 0 && d.pointerType === "mouse", B = !t.editable || d.button ===
|
|
621
|
+
const P = t.spacePressed && d.button === 0 && d.pointerType === "mouse", B = !t.editable || d.button === E && d.pointerType === "mouse" || d.pointerType === "touch";
|
|
625
622
|
!P && !B || (e.x = d.clientX, e.y = d.clientY, v.className !== "circle" && v.contentEditable !== "plaintext-only" && (e.mousedown = !0, v.setPointerCapture(d.pointerId)));
|
|
626
623
|
}, T = (d) => {
|
|
627
624
|
if (d.pointerType === "touch" && s.has(d.pointerId)) {
|
|
628
625
|
if (s.set(d.pointerId, { x: d.clientX, y: d.clientY }), r !== null && c !== null && d.pointerId === l) {
|
|
629
|
-
const v = d.clientX - c.x,
|
|
630
|
-
Math.sqrt(v * v +
|
|
626
|
+
const v = d.clientX - c.x, E = d.clientY - c.y;
|
|
627
|
+
Math.sqrt(v * v + E * E) > f && u();
|
|
631
628
|
}
|
|
632
629
|
if (s.size >= 2) {
|
|
633
|
-
const [v,
|
|
630
|
+
const [v, E] = Array.from(s.values()), P = ut(v, E);
|
|
634
631
|
if (o == null)
|
|
635
632
|
o = P;
|
|
636
633
|
else {
|
|
637
634
|
if (o > 0) {
|
|
638
635
|
const B = P / o;
|
|
639
636
|
t.scale(t.scaleVal * B, {
|
|
640
|
-
x: (v.x +
|
|
641
|
-
y: (v.y +
|
|
637
|
+
x: (v.x + E.x) / 2,
|
|
638
|
+
y: (v.y + E.y) / 2
|
|
642
639
|
});
|
|
643
640
|
}
|
|
644
641
|
o = P;
|
|
@@ -646,25 +643,25 @@ function Se(t) {
|
|
|
646
643
|
return;
|
|
647
644
|
}
|
|
648
645
|
}
|
|
649
|
-
if (!(i && i.pointerId !== null && (
|
|
646
|
+
if (!(i && i.pointerId !== null && (xe(t, i, d), i.isDragging))) {
|
|
650
647
|
if (d.target.contentEditable !== "plaintext-only" || t.spacePressed && e.mousedown) {
|
|
651
|
-
const v = d.clientX - e.x,
|
|
652
|
-
e.onMove(v,
|
|
648
|
+
const v = d.clientX - e.x, E = d.clientY - e.y;
|
|
649
|
+
e.onMove(v, E);
|
|
653
650
|
}
|
|
654
651
|
e.x = d.clientX, e.y = d.clientY;
|
|
655
652
|
}
|
|
656
|
-
},
|
|
653
|
+
}, L = (d) => {
|
|
657
654
|
if (d.pointerType === "touch" && (s.delete(d.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId !== null) {
|
|
658
655
|
const v = i.isDragging;
|
|
659
|
-
if (
|
|
656
|
+
if (Ce(t, i, d), y(d.target, d.pointerId), v)
|
|
660
657
|
return;
|
|
661
658
|
}
|
|
662
659
|
e.mousedown && (y(d.target, d.pointerId), e.clear());
|
|
663
|
-
},
|
|
660
|
+
}, C = () => {
|
|
664
661
|
u(), e.mousedown && e.clear(), i && (i.isDragging || i.pointerId !== null) && ot(t, i);
|
|
665
|
-
},
|
|
666
|
-
d.pointerType === "touch" && (s.delete(d.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === d.pointerId && ot(t, i),
|
|
667
|
-
},
|
|
662
|
+
}, N = (d) => {
|
|
663
|
+
d.pointerType === "touch" && (s.delete(d.pointerId), s.size < 2 && (o = null), u()), i && i.pointerId === d.pointerId && ot(t, i), L(d);
|
|
664
|
+
}, M = (d) => {
|
|
668
665
|
if (d.preventDefault(), d.button !== 2 || !t.editable) return;
|
|
669
666
|
const v = d.target;
|
|
670
667
|
nt(v) && !v.classList.contains("selected") && t.selectNode(v), setTimeout(() => {
|
|
@@ -672,23 +669,23 @@ function Se(t) {
|
|
|
672
669
|
}, 200);
|
|
673
670
|
}, Y = (d) => {
|
|
674
671
|
d.stopPropagation(), d.preventDefault(), d.ctrlKey || d.metaKey ? d.deltaY < 0 ? pt(t, "in", t.dragMoveHelper) : t.scaleVal - t.scaleSensitivity > 0 && pt(t, "out", t.dragMoveHelper) : d.shiftKey ? t.move(-d.deltaY, 0) : t.move(-d.deltaX, -d.deltaY);
|
|
675
|
-
}, { container:
|
|
672
|
+
}, { container: k } = t;
|
|
676
673
|
return Ct([
|
|
677
|
-
{ dom:
|
|
678
|
-
{ dom:
|
|
679
|
-
{ dom:
|
|
680
|
-
{ dom:
|
|
681
|
-
{ dom:
|
|
682
|
-
{ dom:
|
|
683
|
-
{ dom:
|
|
684
|
-
{ dom:
|
|
685
|
-
{ dom:
|
|
686
|
-
{ dom:
|
|
687
|
-
{ dom:
|
|
688
|
-
{ dom:
|
|
674
|
+
{ dom: k, evt: "pointerdown", func: S },
|
|
675
|
+
{ dom: k, evt: "pointermove", func: T },
|
|
676
|
+
{ dom: k, evt: "pointerup", func: L },
|
|
677
|
+
{ dom: k, evt: "pointercancel", func: N },
|
|
678
|
+
{ dom: k, evt: "pointerdown", func: b },
|
|
679
|
+
{ dom: k, evt: "click", func: p },
|
|
680
|
+
{ dom: k, evt: "dblclick", func: g },
|
|
681
|
+
{ dom: k, evt: "contextmenu", func: M },
|
|
682
|
+
{ dom: k, evt: "wheel", func: typeof t.handleWheel == "function" ? t.handleWheel : Y },
|
|
683
|
+
{ dom: k, evt: "blur", func: C },
|
|
684
|
+
{ dom: k, evt: "keydown", func: w },
|
|
685
|
+
{ dom: k, evt: "keyup", func: x }
|
|
689
686
|
]);
|
|
690
687
|
}
|
|
691
|
-
function
|
|
688
|
+
function Se() {
|
|
692
689
|
return {
|
|
693
690
|
handlers: {},
|
|
694
691
|
addListener: function(t, e) {
|
|
@@ -723,7 +720,7 @@ const I = "http://www.w3.org/2000/svg", tt = function(t) {
|
|
|
723
720
|
return a.id = l, a.innerHTML = t, a.dataset.type = r, a.dataset.svgId = c, a.dataset.x = e.toString(), a.dataset.y = n.toString(), a.dataset.anchor = s, a;
|
|
724
721
|
}, kt = function(t, e, n) {
|
|
725
722
|
const o = document.createElementNS(I, "path");
|
|
726
|
-
return
|
|
723
|
+
return D(o, {
|
|
727
724
|
d: t,
|
|
728
725
|
stroke: e || "#666",
|
|
729
726
|
fill: "none",
|
|
@@ -735,7 +732,7 @@ const I = "http://www.w3.org/2000/svg", tt = function(t) {
|
|
|
735
732
|
}, yt = function() {
|
|
736
733
|
const t = document.createElementNS(I, "line");
|
|
737
734
|
return t.setAttribute("stroke", "#4dc4ff"), t.setAttribute("fill", "none"), t.setAttribute("stroke-width", "2"), t.setAttribute("opacity", "0.45"), t;
|
|
738
|
-
},
|
|
735
|
+
}, Te = function(t, e, n, o) {
|
|
739
736
|
const s = document.createElementNS(I, "g");
|
|
740
737
|
return [
|
|
741
738
|
{
|
|
@@ -758,9 +755,9 @@ const I = "http://www.w3.org/2000/svg", tt = function(t) {
|
|
|
758
755
|
"stroke-linecap": o?.strokeLinecap || "cap",
|
|
759
756
|
"stroke-width": String(o?.strokeWidth || "2")
|
|
760
757
|
};
|
|
761
|
-
o?.opacity !== void 0 && (h.opacity = String(o.opacity)),
|
|
758
|
+
o?.opacity !== void 0 && (h.opacity = String(o.opacity)), D(l, h), c === 0 && l.setAttribute("stroke-dasharray", o?.strokeDasharray || "8,2");
|
|
762
759
|
const f = document.createElementNS(I, "path");
|
|
763
|
-
|
|
760
|
+
D(f, {
|
|
764
761
|
d: a,
|
|
765
762
|
stroke: "transparent",
|
|
766
763
|
fill: "none",
|
|
@@ -792,7 +789,7 @@ const I = "http://www.w3.org/2000/svg", tt = function(t) {
|
|
|
792
789
|
obj: n
|
|
793
790
|
}));
|
|
794
791
|
});
|
|
795
|
-
},
|
|
792
|
+
}, Le = function(t) {
|
|
796
793
|
const e = this.map.querySelector("me-root"), n = e.offsetTop, o = e.offsetLeft, s = e.offsetWidth, i = e.offsetHeight, r = this.map.querySelectorAll("me-main > me-wrapper");
|
|
797
794
|
this.lines.innerHTML = "";
|
|
798
795
|
for (let c = 0; c < r.length; c++) {
|
|
@@ -817,19 +814,19 @@ const I = "http://www.w3.org/2000/svg", tt = function(t) {
|
|
|
817
814
|
continue;
|
|
818
815
|
$t(t, e, x, y, s);
|
|
819
816
|
}
|
|
820
|
-
},
|
|
821
|
-
side:
|
|
822
|
-
left:
|
|
823
|
-
right:
|
|
824
|
-
full:
|
|
825
|
-
living:
|
|
826
|
-
zoomin:
|
|
827
|
-
zoomout:
|
|
817
|
+
}, De = '<?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>', Me = '<?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>', ke = '<?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>', Ne = '<?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>', $e = '<?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>', Ae = '<?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>', Pe = '<?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>', He = {
|
|
818
|
+
side: De,
|
|
819
|
+
left: Me,
|
|
820
|
+
right: ke,
|
|
821
|
+
full: Ne,
|
|
822
|
+
living: $e,
|
|
823
|
+
zoomin: Ae,
|
|
824
|
+
zoomout: Pe
|
|
828
825
|
}, R = (t, e) => {
|
|
829
826
|
const n = document.createElement("span");
|
|
830
|
-
return n.id = t, n.innerHTML =
|
|
827
|
+
return n.id = t, n.innerHTML = He[e], n;
|
|
831
828
|
};
|
|
832
|
-
function
|
|
829
|
+
function Ie(t) {
|
|
833
830
|
const e = document.createElement("div"), n = R("fullscreen", "full"), o = R("toCenter", "living"), s = R("zoomout", "zoomout"), i = R("zoomin", "zoomin");
|
|
834
831
|
e.appendChild(n), e.appendChild(o), e.appendChild(s), e.appendChild(i), e.className = "mind-elixir-toolbar rb";
|
|
835
832
|
let r = null;
|
|
@@ -857,7 +854,7 @@ function Oe(t) {
|
|
|
857
854
|
t.scale(t.scaleVal + t.scaleSensitivity);
|
|
858
855
|
}, e;
|
|
859
856
|
}
|
|
860
|
-
function
|
|
857
|
+
function Oe(t) {
|
|
861
858
|
const e = document.createElement("div"), n = R("tbltl", "left"), o = R("tbltr", "right"), s = R("tblts", "side");
|
|
862
859
|
return e.appendChild(n), e.appendChild(o), e.appendChild(s), e.className = "mind-elixir-toolbar lt", n.onclick = () => {
|
|
863
860
|
t.initLeft();
|
|
@@ -867,10 +864,10 @@ function Ye(t) {
|
|
|
867
864
|
t.initSide();
|
|
868
865
|
}, e;
|
|
869
866
|
}
|
|
870
|
-
function
|
|
871
|
-
t.container.append(
|
|
867
|
+
function Ye(t) {
|
|
868
|
+
t.container.append(Ie(t)), t.container.append(Oe(t));
|
|
872
869
|
}
|
|
873
|
-
const
|
|
870
|
+
const Be = function(t, e = !0) {
|
|
874
871
|
this.theme = t;
|
|
875
872
|
const o = {
|
|
876
873
|
...(t.type === "dark" ? ct : rt).cssVar,
|
|
@@ -881,7 +878,7 @@ const Re = function(t, e = !0) {
|
|
|
881
878
|
this.container.style.setProperty(r, o[r]);
|
|
882
879
|
}
|
|
883
880
|
e && this.refresh();
|
|
884
|
-
},
|
|
881
|
+
}, Re = function(t) {
|
|
885
882
|
return {
|
|
886
883
|
dom: t,
|
|
887
884
|
moved: !1,
|
|
@@ -917,19 +914,19 @@ const Re = function(t, e = !0) {
|
|
|
917
914
|
}
|
|
918
915
|
};
|
|
919
916
|
}, vt = {
|
|
920
|
-
create:
|
|
921
|
-
},
|
|
917
|
+
create: Re
|
|
918
|
+
}, We = "#4dc4ff";
|
|
922
919
|
function At(t, e, n, o, s, i, r, c) {
|
|
923
920
|
return {
|
|
924
921
|
x: t / 8 + n * 3 / 8 + s * 3 / 8 + r / 8,
|
|
925
922
|
y: e / 8 + o * 3 / 8 + i * 3 / 8 + c / 8
|
|
926
923
|
};
|
|
927
924
|
}
|
|
928
|
-
function
|
|
925
|
+
function Xe(t, e, n) {
|
|
929
926
|
t && (t.dataset.x = e.toString(), t.dataset.y = n.toString(), tt(t));
|
|
930
927
|
}
|
|
931
928
|
function j(t, e, n, o, s) {
|
|
932
|
-
|
|
929
|
+
D(t, {
|
|
933
930
|
x1: e + "",
|
|
934
931
|
y1: n + "",
|
|
935
932
|
x2: o + "",
|
|
@@ -963,11 +960,11 @@ function wt(t, e, n, o, s, i, r, c, a, l) {
|
|
|
963
960
|
}
|
|
964
961
|
}
|
|
965
962
|
const { x: y, y: m } = At(e, n, o, s, i, r, c, a);
|
|
966
|
-
if (t.labelEl &&
|
|
963
|
+
if (t.labelEl && Xe(t.labelEl, y, m), l.style?.labelColor) {
|
|
967
964
|
const p = t.labelEl;
|
|
968
965
|
p && (p.style.color = l.style.labelColor);
|
|
969
966
|
}
|
|
970
|
-
|
|
967
|
+
Ke(t);
|
|
971
968
|
}
|
|
972
969
|
function Q(t, e, n) {
|
|
973
970
|
const { offsetLeft: o, offsetTop: s } = H(t.nodes, e), i = e.offsetWidth, r = e.offsetHeight, c = o + i / 2, a = s + r / 2, l = c + n.x, h = a + n.y;
|
|
@@ -988,7 +985,7 @@ function X(t) {
|
|
|
988
985
|
y: n
|
|
989
986
|
};
|
|
990
987
|
}
|
|
991
|
-
const
|
|
988
|
+
const Ve = function(t, e, n) {
|
|
992
989
|
const o = H(t.nodes, e), s = H(t.nodes, n), i = o.offsetLeft + e.offsetWidth / 2, r = o.offsetTop + e.offsetHeight / 2, c = s.offsetLeft + n.offsetWidth / 2, a = s.offsetTop + n.offsetHeight / 2, l = c - i, h = a - r, f = Math.sqrt(l * l + h * h), u = Math.max(50, Math.min(200, f * 0.3)), y = Math.abs(l), m = Math.abs(h);
|
|
993
990
|
let p, g;
|
|
994
991
|
if (f < 150) {
|
|
@@ -1001,36 +998,36 @@ const Ge = function(t, e, n) {
|
|
|
1001
998
|
const w = h > 0 ? e.offsetHeight / 2 : -e.offsetHeight / 2, x = h > 0 ? -n.offsetHeight / 2 : n.offsetHeight / 2;
|
|
1002
999
|
p = { x: 0, y: w + (h > 0 ? u : -u) }, g = { x: 0, y: x + (h > 0 ? -u : u) };
|
|
1003
1000
|
} else {
|
|
1004
|
-
const w = Math.atan2(h, l), x = e.offsetWidth / 2 * Math.cos(w), S = e.offsetHeight / 2 * Math.sin(w), T = -(n.offsetWidth / 2) * Math.cos(w),
|
|
1005
|
-
p = { x: x +
|
|
1001
|
+
const w = Math.atan2(h, l), x = e.offsetWidth / 2 * Math.cos(w), S = e.offsetHeight / 2 * Math.sin(w), T = -(n.offsetWidth / 2) * Math.cos(w), L = -(n.offsetHeight / 2) * Math.sin(w), C = u * 0.7 * (l > 0 ? 1 : -1), N = u * 0.7 * (h > 0 ? 1 : -1);
|
|
1002
|
+
p = { x: x + C, y: S + N }, g = { x: T - C, y: L - N };
|
|
1006
1003
|
}
|
|
1007
1004
|
return { delta1: p, delta2: g };
|
|
1008
1005
|
}, ht = function(t, e, n, o, s) {
|
|
1009
1006
|
if (!e || !n)
|
|
1010
1007
|
return;
|
|
1011
1008
|
if (!o.delta1 || !o.delta2) {
|
|
1012
|
-
const
|
|
1013
|
-
o.delta1 =
|
|
1009
|
+
const M = Ve(t, e, n);
|
|
1010
|
+
o.delta1 = M.delta1, o.delta2 = M.delta2;
|
|
1014
1011
|
}
|
|
1015
1012
|
const i = Q(t, e, o.delta1), r = Q(t, n, o.delta2), { x: c, y: a } = X(i), { ctrlX: l, ctrlY: h } = i, { ctrlX: f, ctrlY: u } = r, { x: y, y: m } = X(r), p = J(f, u, y, m);
|
|
1016
1013
|
if (!p) return;
|
|
1017
1014
|
const g = `M ${p.x1} ${p.y1} L ${y} ${m} L ${p.x2} ${p.y2}`;
|
|
1018
1015
|
let b = "";
|
|
1019
1016
|
if (o.bidirectional) {
|
|
1020
|
-
const
|
|
1021
|
-
if (!
|
|
1022
|
-
b = `M ${
|
|
1017
|
+
const M = J(l, h, c, a);
|
|
1018
|
+
if (!M) return;
|
|
1019
|
+
b = `M ${M.x1} ${M.y1} L ${c} ${a} L ${M.x2} ${M.y2}`;
|
|
1023
1020
|
}
|
|
1024
|
-
const w =
|
|
1025
|
-
w.id =
|
|
1026
|
-
const
|
|
1021
|
+
const w = Te(`M ${c} ${a} C ${l} ${h} ${f} ${u} ${y} ${m}`, g, b, o.style), { x, y: S } = At(c, a, l, h, f, u, y, m), T = o.style?.labelColor || "rgb(235, 95, 82)", L = "arrow-" + o.id;
|
|
1022
|
+
w.id = L;
|
|
1023
|
+
const C = t.markdown ? t.markdown(o.label, o) : o.label, N = it(C, x, S, {
|
|
1027
1024
|
anchor: "middle",
|
|
1028
1025
|
color: T,
|
|
1029
1026
|
dataType: "arrow",
|
|
1030
|
-
svgId:
|
|
1027
|
+
svgId: L
|
|
1031
1028
|
});
|
|
1032
|
-
w.labelEl =
|
|
1033
|
-
},
|
|
1029
|
+
w.labelEl = N, w.arrowObj = o, w.dataset.linkid = o.id, t.labelContainer.appendChild(N), t.linkSvgGroup.appendChild(w), tt(N), s || (t.arrows.push(o), t.currentArrow = w, Pt(t, o, i, r));
|
|
1030
|
+
}, Ge = function(t, e, n = {}) {
|
|
1034
1031
|
const o = {
|
|
1035
1032
|
id: F(),
|
|
1036
1033
|
label: "Custom Link",
|
|
@@ -1042,14 +1039,14 @@ const Ge = function(t, e, n) {
|
|
|
1042
1039
|
name: "createArrow",
|
|
1043
1040
|
obj: o
|
|
1044
1041
|
});
|
|
1045
|
-
},
|
|
1042
|
+
}, ze = function(t) {
|
|
1046
1043
|
et(this);
|
|
1047
1044
|
const e = { ...t, id: F() };
|
|
1048
1045
|
ht(this, this.findEle(e.from), this.findEle(e.to), e), this.bus.fire("operation", {
|
|
1049
1046
|
name: "createArrow",
|
|
1050
1047
|
obj: e
|
|
1051
1048
|
});
|
|
1052
|
-
},
|
|
1049
|
+
}, Fe = function(t) {
|
|
1053
1050
|
let e;
|
|
1054
1051
|
if (t ? e = t : e = this.currentArrow, !e) return;
|
|
1055
1052
|
et(this);
|
|
@@ -1060,15 +1057,15 @@ const Ge = function(t, e, n) {
|
|
|
1060
1057
|
id: n
|
|
1061
1058
|
}
|
|
1062
1059
|
});
|
|
1063
|
-
},
|
|
1060
|
+
}, qe = function(t) {
|
|
1064
1061
|
this.currentArrow = t;
|
|
1065
1062
|
const e = t.arrowObj, n = this.findEle(e.from), o = this.findEle(e.to), s = Q(this, n, e.delta1), i = Q(this, o, e.delta2);
|
|
1066
1063
|
Pt(this, e, s, i);
|
|
1067
|
-
},
|
|
1064
|
+
}, je = function() {
|
|
1068
1065
|
et(this), this.currentArrow = null;
|
|
1069
1066
|
}, st = function(t, e) {
|
|
1070
1067
|
const n = document.createElementNS(I, "path");
|
|
1071
|
-
return
|
|
1068
|
+
return D(n, {
|
|
1072
1069
|
d: t,
|
|
1073
1070
|
stroke: e,
|
|
1074
1071
|
fill: "none",
|
|
@@ -1076,7 +1073,7 @@ const Ge = function(t, e, n) {
|
|
|
1076
1073
|
"stroke-linecap": "round",
|
|
1077
1074
|
"stroke-linejoin": "round"
|
|
1078
1075
|
}), n;
|
|
1079
|
-
},
|
|
1076
|
+
}, _e = function(t, e) {
|
|
1080
1077
|
const n = document.createElementNS(I, "g");
|
|
1081
1078
|
n.setAttribute("class", "arrow-highlight"), n.setAttribute("opacity", "0.45");
|
|
1082
1079
|
const o = st(t.line.getAttribute("d"), e);
|
|
@@ -1087,32 +1084,32 @@ const Ge = function(t, e, n) {
|
|
|
1087
1084
|
n.appendChild(i);
|
|
1088
1085
|
}
|
|
1089
1086
|
t.insertBefore(n, t.firstChild);
|
|
1090
|
-
},
|
|
1087
|
+
}, Ue = function(t) {
|
|
1091
1088
|
const e = t.querySelector(".arrow-highlight");
|
|
1092
1089
|
e && e.remove();
|
|
1093
|
-
},
|
|
1090
|
+
}, Ke = function(t) {
|
|
1094
1091
|
const e = t.querySelector(".arrow-highlight");
|
|
1095
1092
|
if (!e) return;
|
|
1096
1093
|
const n = e.querySelectorAll("path");
|
|
1097
1094
|
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"));
|
|
1098
1095
|
}, et = function(t) {
|
|
1099
|
-
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow &&
|
|
1096
|
+
t.helper1?.destroy(), t.helper2?.destroy(), t.linkController.style.display = "none", t.P2.style.display = "none", t.P3.style.display = "none", t.currentArrow && Ue(t.currentArrow);
|
|
1100
1097
|
}, Pt = function(t, e, n, o) {
|
|
1101
1098
|
const { linkController: s, P2: i, P3: r, line1: c, line2: a, nodes: l, map: h, currentArrow: f, bus: u } = t;
|
|
1102
1099
|
if (!f) return;
|
|
1103
|
-
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", l.appendChild(s), l.appendChild(i), l.appendChild(r),
|
|
1100
|
+
s.style.display = "initial", i.style.display = "initial", r.style.display = "initial", l.appendChild(s), l.appendChild(i), l.appendChild(r), _e(f, We);
|
|
1104
1101
|
let { x: y, y: m } = X(n), { ctrlX: p, ctrlY: g } = n, { ctrlX: b, ctrlY: w } = o, { x, y: S } = X(o);
|
|
1105
|
-
i.style.cssText = `top:${g}px;left:${p}px;`, r.style.cssText = `top:${w}px;left:${b}px;`, j(c, y, m, p, g), j(a, b, w, x, S), t.helper1 = vt.create(i), t.helper2 = vt.create(r), t.helper1.init(h, (T,
|
|
1106
|
-
p = p + T / t.scaleVal, g = g +
|
|
1107
|
-
const
|
|
1108
|
-
y =
|
|
1109
|
-
}), t.helper2.init(h, (T,
|
|
1110
|
-
b = b + T / t.scaleVal, w = w +
|
|
1111
|
-
const
|
|
1112
|
-
x =
|
|
1102
|
+
i.style.cssText = `top:${g}px;left:${p}px;`, r.style.cssText = `top:${w}px;left:${b}px;`, j(c, y, m, p, g), j(a, b, w, x, S), t.helper1 = vt.create(i), t.helper2 = vt.create(r), t.helper1.init(h, (T, L) => {
|
|
1103
|
+
p = p + T / t.scaleVal, g = g + L / t.scaleVal;
|
|
1104
|
+
const C = X({ ...n, ctrlX: p, ctrlY: g });
|
|
1105
|
+
y = C.x, m = C.y, i.style.top = g + "px", i.style.left = p + "px", wt(f, y, m, p, g, b, w, x, S, e), j(c, y, m, p, g), e.delta1.x = p - n.cx, e.delta1.y = g - n.cy, u.fire("updateArrowDelta", e);
|
|
1106
|
+
}), t.helper2.init(h, (T, L) => {
|
|
1107
|
+
b = b + T / t.scaleVal, w = w + L / t.scaleVal;
|
|
1108
|
+
const C = X({ ...o, ctrlX: b, ctrlY: w });
|
|
1109
|
+
x = C.x, S = C.y, r.style.top = w + "px", r.style.left = b + "px", wt(f, y, m, p, g, b, w, x, S, e), j(a, b, w, x, S), e.delta2.x = b - o.cx, e.delta2.y = w - o.cy, u.fire("updateArrowDelta", e);
|
|
1113
1110
|
});
|
|
1114
1111
|
};
|
|
1115
|
-
function
|
|
1112
|
+
function Je() {
|
|
1116
1113
|
this.linkSvgGroup.innerHTML = "", this.labelContainer.querySelectorAll('.svg-label[data-type="arrow"]').forEach((e) => e.remove());
|
|
1117
1114
|
for (let e = 0; e < this.arrows.length; e++) {
|
|
1118
1115
|
const n = this.arrows[e];
|
|
@@ -1123,23 +1120,23 @@ function Qe() {
|
|
|
1123
1120
|
}
|
|
1124
1121
|
this.nodes.appendChild(this.linkSvgGroup);
|
|
1125
1122
|
}
|
|
1126
|
-
function
|
|
1123
|
+
function Qe(t) {
|
|
1127
1124
|
et(this), t && t.labelEl && Nt(this, t.labelEl, t.arrowObj);
|
|
1128
1125
|
}
|
|
1129
|
-
function
|
|
1126
|
+
function Ze() {
|
|
1130
1127
|
this.arrows = this.arrows.filter((t) => K(t.from, this.nodeData) && K(t.to, this.nodeData));
|
|
1131
1128
|
}
|
|
1132
|
-
const
|
|
1129
|
+
const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1133
1130
|
__proto__: null,
|
|
1134
|
-
createArrow:
|
|
1135
|
-
createArrowFrom:
|
|
1136
|
-
editArrowLabel:
|
|
1137
|
-
removeArrow:
|
|
1138
|
-
renderArrow:
|
|
1139
|
-
selectArrow:
|
|
1140
|
-
tidyArrow:
|
|
1141
|
-
unselectArrow:
|
|
1142
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1131
|
+
createArrow: Ge,
|
|
1132
|
+
createArrowFrom: ze,
|
|
1133
|
+
editArrowLabel: Qe,
|
|
1134
|
+
removeArrow: Fe,
|
|
1135
|
+
renderArrow: Je,
|
|
1136
|
+
selectArrow: qe,
|
|
1137
|
+
tidyArrow: Ze,
|
|
1138
|
+
unselectArrow: je
|
|
1139
|
+
}, Symbol.toStringTag, { value: "Module" })), en = function(t) {
|
|
1143
1140
|
if (t.length === 0) throw new Error("No selected node.");
|
|
1144
1141
|
if (t.length === 1) {
|
|
1145
1142
|
const a = t[0].nodeObj, l = t[0].nodeObj.parent;
|
|
@@ -1176,101 +1173,101 @@ const en = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1176
1173
|
start: i,
|
|
1177
1174
|
end: r
|
|
1178
1175
|
};
|
|
1179
|
-
},
|
|
1176
|
+
}, nn = function(t) {
|
|
1180
1177
|
const e = document.createElementNS(I, "g");
|
|
1181
1178
|
return e.setAttribute("id", t), e;
|
|
1182
1179
|
}, bt = function(t, e) {
|
|
1183
1180
|
const n = document.createElementNS(I, "path");
|
|
1184
|
-
return
|
|
1181
|
+
return D(n, {
|
|
1185
1182
|
d: t,
|
|
1186
1183
|
stroke: e || "#666",
|
|
1187
1184
|
fill: "none",
|
|
1188
1185
|
"stroke-linecap": "round",
|
|
1189
1186
|
"stroke-width": "2"
|
|
1190
1187
|
}), n;
|
|
1191
|
-
},
|
|
1188
|
+
}, on = (t) => t.parentElement.parentElement, sn = function(t, { parent: e, start: n }) {
|
|
1192
1189
|
const o = t.findEle(e), s = o.nodeObj;
|
|
1193
1190
|
let i;
|
|
1194
1191
|
return s.parent ? i = o.closest("me-main").className : i = t.findEle(s.children[n].id).closest("me-main").className, i;
|
|
1195
1192
|
}, ft = function(t, e) {
|
|
1196
|
-
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: a, theme: l, summarySvg: h } = t, u = t.findEle(s).nodeObj, y =
|
|
1193
|
+
const { id: n, label: o, parent: s, start: i, end: r, style: c } = e, { nodes: a, theme: l, summarySvg: h } = t, u = t.findEle(s).nodeObj, y = sn(t, e);
|
|
1197
1194
|
let m = 1 / 0, p = 0, g = 0, b = 0;
|
|
1198
1195
|
for (let d = i; d <= r; d++) {
|
|
1199
1196
|
const v = u.children?.[d];
|
|
1200
1197
|
if (!v)
|
|
1201
1198
|
return t.removeSummary(n), null;
|
|
1202
|
-
const
|
|
1203
|
-
d === i && (g = B + $), d === r && (b = B +
|
|
1199
|
+
const E = on(t.findEle(v.id)), { offsetLeft: P, offsetTop: B } = H(a, E), $ = i === r ? 10 : 20;
|
|
1200
|
+
d === i && (g = B + $), d === r && (b = B + E.offsetHeight - $), P < m && (m = P), E.offsetWidth + P > p && (p = E.offsetWidth + P);
|
|
1204
1201
|
}
|
|
1205
1202
|
let w, x;
|
|
1206
|
-
const S = u.parent ? 10 : 0, T = g + S,
|
|
1207
|
-
y === V.LHS ? (w = bt(`M ${m + 10} ${T} c -5 0 -10 5 -10 10 L ${m} ${
|
|
1208
|
-
const W =
|
|
1203
|
+
const S = u.parent ? 10 : 0, T = g + S, L = b + S, C = (T + L) / 2, N = c?.stroke || l.cssVar["--color"], M = c?.labelColor || l.cssVar["--color"], Y = "s-" + n, k = t.markdown ? t.markdown(o, e) : o;
|
|
1204
|
+
y === V.LHS ? (w = bt(`M ${m + 10} ${T} c -5 0 -10 5 -10 10 L ${m} ${L - 10} c 0 5 5 10 10 10 M ${m} ${C} h -10`, N), x = it(k, m - 20, C, { anchor: "end", color: M, dataType: "summary", svgId: Y })) : (w = bt(`M ${p - 10} ${T} c 5 0 10 5 10 10 L ${p} ${L - 10} c 0 5 -5 10 -10 10 M ${p} ${C} h 10`, N), x = it(k, p + 20, C, { anchor: "start", color: M, dataType: "summary", svgId: Y }));
|
|
1205
|
+
const W = nn(Y);
|
|
1209
1206
|
return W.appendChild(w), t.labelContainer.appendChild(x), tt(x), W.summaryObj = e, W.labelEl = x, h.appendChild(W), W;
|
|
1210
|
-
},
|
|
1207
|
+
}, rn = function(t = {}) {
|
|
1211
1208
|
if (!this.currentNodes) return;
|
|
1212
|
-
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } =
|
|
1209
|
+
const { currentNodes: e, summaries: n, bus: o } = this, { parent: s, start: i, end: r } = en(e), c = { id: F(), parent: s, start: i, end: r, label: "summary", style: t.style }, a = ft(this, c);
|
|
1213
1210
|
n.push(c), this.editSummary(a), o.fire("operation", {
|
|
1214
1211
|
name: "createSummary",
|
|
1215
1212
|
obj: c
|
|
1216
1213
|
});
|
|
1217
|
-
},
|
|
1214
|
+
}, cn = function(t) {
|
|
1218
1215
|
const e = F(), n = { ...t, id: e };
|
|
1219
1216
|
ft(this, n), this.summaries.push(n), this.bus.fire("operation", {
|
|
1220
1217
|
name: "createSummary",
|
|
1221
1218
|
obj: n
|
|
1222
1219
|
});
|
|
1223
|
-
},
|
|
1220
|
+
}, ln = function(t) {
|
|
1224
1221
|
const e = this.summaries.findIndex((n) => n.id === t);
|
|
1225
1222
|
e > -1 && (this.summaries.splice(e, 1), this.nodes.querySelector("#s-" + t)?.remove(), this.nodes.querySelector("#label-s-" + t)?.remove()), this.bus.fire("operation", {
|
|
1226
1223
|
name: "removeSummary",
|
|
1227
1224
|
obj: { id: t }
|
|
1228
1225
|
});
|
|
1229
|
-
},
|
|
1226
|
+
}, an = function(t) {
|
|
1230
1227
|
const e = t.labelEl;
|
|
1231
1228
|
e && e.classList.add("selected"), this.currentSummary = t;
|
|
1232
|
-
},
|
|
1229
|
+
}, dn = function() {
|
|
1233
1230
|
this.currentSummary?.labelEl?.classList.remove("selected"), this.currentSummary = null;
|
|
1234
|
-
},
|
|
1231
|
+
}, hn = function() {
|
|
1235
1232
|
this.summarySvg.innerHTML = "", this.summaries.forEach((t) => {
|
|
1236
1233
|
try {
|
|
1237
1234
|
ft(this, t);
|
|
1238
1235
|
} catch {
|
|
1239
1236
|
}
|
|
1240
1237
|
}), this.nodes.insertAdjacentElement("beforeend", this.summarySvg);
|
|
1241
|
-
},
|
|
1238
|
+
}, fn = function(t) {
|
|
1242
1239
|
t && t.labelEl && Nt(this, t.labelEl, t.summaryObj);
|
|
1243
|
-
},
|
|
1240
|
+
}, un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1244
1241
|
__proto__: null,
|
|
1245
|
-
createSummary:
|
|
1246
|
-
createSummaryFrom:
|
|
1247
|
-
editSummary:
|
|
1248
|
-
removeSummary:
|
|
1249
|
-
renderSummary:
|
|
1250
|
-
selectSummary:
|
|
1251
|
-
unselectSummary:
|
|
1242
|
+
createSummary: rn,
|
|
1243
|
+
createSummaryFrom: cn,
|
|
1244
|
+
editSummary: fn,
|
|
1245
|
+
removeSummary: ln,
|
|
1246
|
+
renderSummary: hn,
|
|
1247
|
+
selectSummary: an,
|
|
1248
|
+
unselectSummary: dn
|
|
1252
1249
|
}, Symbol.toStringTag, { value: "Module" })), A = "http://www.w3.org/2000/svg";
|
|
1253
|
-
function
|
|
1250
|
+
function pn(t, e) {
|
|
1254
1251
|
const n = document.createElementNS(A, "svg");
|
|
1255
|
-
return
|
|
1252
|
+
return D(n, {
|
|
1256
1253
|
version: "1.1",
|
|
1257
1254
|
xmlns: A,
|
|
1258
1255
|
height: t,
|
|
1259
1256
|
width: e
|
|
1260
1257
|
}), n;
|
|
1261
1258
|
}
|
|
1262
|
-
function
|
|
1259
|
+
function gn(t, e) {
|
|
1263
1260
|
return (parseInt(t) - parseInt(e)) / 2;
|
|
1264
1261
|
}
|
|
1265
|
-
function
|
|
1262
|
+
function mn(t, e, n, o) {
|
|
1266
1263
|
const s = document.createElementNS(A, "g");
|
|
1267
1264
|
let i = "";
|
|
1268
1265
|
return t.text ? i = t.text.textContent : i = t.childNodes[0].textContent, i.split(`
|
|
1269
1266
|
`).forEach((c, a) => {
|
|
1270
1267
|
const l = document.createElementNS(A, "text");
|
|
1271
|
-
|
|
1268
|
+
D(l, {
|
|
1272
1269
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1273
|
-
y: o + parseInt(e.paddingTop) +
|
|
1270
|
+
y: o + parseInt(e.paddingTop) + gn(e.lineHeight, e.fontSize) * (a + 1) + parseFloat(e.fontSize) * (a + 1) + "",
|
|
1274
1271
|
"text-anchor": "start",
|
|
1275
1272
|
"font-family": e.fontFamily,
|
|
1276
1273
|
"font-size": `${e.fontSize}`,
|
|
@@ -1279,25 +1276,25 @@ function yn(t, e, n, o) {
|
|
|
1279
1276
|
}), l.innerHTML = c, s.appendChild(l);
|
|
1280
1277
|
}), s;
|
|
1281
1278
|
}
|
|
1282
|
-
function
|
|
1279
|
+
function yn(t, e, n, o) {
|
|
1283
1280
|
let s = "";
|
|
1284
1281
|
t.nodeObj?.dangerouslySetInnerHTML ? s = t.nodeObj.dangerouslySetInnerHTML : t.text ? s = t.text.textContent : s = t.childNodes[0].textContent;
|
|
1285
1282
|
const i = document.createElementNS(A, "foreignObject");
|
|
1286
|
-
|
|
1283
|
+
D(i, {
|
|
1287
1284
|
x: n + parseInt(e.paddingLeft) + "",
|
|
1288
1285
|
y: o + parseInt(e.paddingTop) + "",
|
|
1289
1286
|
width: e.width,
|
|
1290
1287
|
height: e.height
|
|
1291
1288
|
});
|
|
1292
1289
|
const r = document.createElement("div");
|
|
1293
|
-
return
|
|
1290
|
+
return D(r, {
|
|
1294
1291
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
1295
1292
|
style: `font-family: ${e.fontFamily}; font-size: ${e.fontSize}; font-weight: ${e.fontWeight}; color: ${e.color}; white-space: pre-wrap;`
|
|
1296
1293
|
}), r.innerHTML = s, i.appendChild(r), i;
|
|
1297
1294
|
}
|
|
1298
|
-
function
|
|
1295
|
+
function vn(t, e) {
|
|
1299
1296
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = H(t.nodes, e), i = document.createElementNS(A, "rect");
|
|
1300
|
-
return
|
|
1297
|
+
return D(i, {
|
|
1301
1298
|
x: o + "",
|
|
1302
1299
|
y: s + "",
|
|
1303
1300
|
rx: n.borderRadius,
|
|
@@ -1311,7 +1308,7 @@ function wn(t, e) {
|
|
|
1311
1308
|
}
|
|
1312
1309
|
function _(t, e, n = !1) {
|
|
1313
1310
|
const o = getComputedStyle(e), { offsetLeft: s, offsetTop: i } = H(t.nodes, e), r = document.createElementNS(A, "rect");
|
|
1314
|
-
|
|
1311
|
+
D(r, {
|
|
1315
1312
|
x: s + "",
|
|
1316
1313
|
y: i + "",
|
|
1317
1314
|
rx: o.borderRadius,
|
|
@@ -1325,11 +1322,11 @@ function _(t, e, n = !1) {
|
|
|
1325
1322
|
const c = document.createElementNS(A, "g");
|
|
1326
1323
|
c.appendChild(r);
|
|
1327
1324
|
let a;
|
|
1328
|
-
return n ? a =
|
|
1325
|
+
return n ? a = yn(e, o, s, i) : a = mn(e, o, s, i), c.appendChild(a), c;
|
|
1329
1326
|
}
|
|
1330
|
-
function
|
|
1327
|
+
function wn(t, e) {
|
|
1331
1328
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = H(t.nodes, e), i = document.createElementNS(A, "a"), r = document.createElementNS(A, "text");
|
|
1332
|
-
return
|
|
1329
|
+
return D(r, {
|
|
1333
1330
|
x: o + "",
|
|
1334
1331
|
y: s + parseInt(n.fontSize) + "",
|
|
1335
1332
|
"text-anchor": "start",
|
|
@@ -1339,9 +1336,9 @@ function bn(t, e) {
|
|
|
1339
1336
|
fill: `${n.color}`
|
|
1340
1337
|
}), r.innerHTML = e.textContent, i.appendChild(r), i.setAttribute("href", e.href), i;
|
|
1341
1338
|
}
|
|
1342
|
-
function
|
|
1339
|
+
function bn(t, e) {
|
|
1343
1340
|
const n = getComputedStyle(e), { offsetLeft: o, offsetTop: s } = H(t.nodes, e), i = document.createElementNS(A, "image");
|
|
1344
|
-
return
|
|
1341
|
+
return D(i, {
|
|
1345
1342
|
x: o + "",
|
|
1346
1343
|
y: s + "",
|
|
1347
1344
|
width: n.width + "",
|
|
@@ -1349,9 +1346,9 @@ function xn(t, e) {
|
|
|
1349
1346
|
href: e.src
|
|
1350
1347
|
}), i;
|
|
1351
1348
|
}
|
|
1352
|
-
const U = 100,
|
|
1353
|
-
const n = t.nodes, o = n.offsetHeight + U * 2, s = n.offsetWidth + U * 2, i =
|
|
1354
|
-
|
|
1349
|
+
const U = 100, xn = '<?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">', Cn = (t, e = !1) => {
|
|
1350
|
+
const n = t.nodes, o = n.offsetHeight + U * 2, s = n.offsetWidth + U * 2, i = pn(o + "px", s + "px"), r = document.createElementNS(A, "svg"), c = document.createElementNS(A, "rect");
|
|
1351
|
+
D(c, {
|
|
1355
1352
|
x: "0",
|
|
1356
1353
|
y: "0",
|
|
1357
1354
|
width: `${s}`,
|
|
@@ -1367,22 +1364,22 @@ const U = 100, Cn = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "
|
|
|
1367
1364
|
l && r.appendChild(l);
|
|
1368
1365
|
const h = n.querySelector(".summary")?.cloneNode(!0);
|
|
1369
1366
|
return h && r.appendChild(h), n.querySelectorAll("me-tpc").forEach((f) => {
|
|
1370
|
-
f.nodeObj.dangerouslySetInnerHTML ? r.appendChild(_(t, f, !e)) : (r.appendChild(
|
|
1367
|
+
f.nodeObj.dangerouslySetInnerHTML ? r.appendChild(_(t, f, !e)) : (r.appendChild(vn(t, f)), r.appendChild(_(t, f.text, !e)));
|
|
1371
1368
|
}), n.querySelectorAll(".tags > span").forEach((f) => {
|
|
1372
1369
|
r.appendChild(_(t, f));
|
|
1373
1370
|
}), n.querySelectorAll(".icons > span").forEach((f) => {
|
|
1374
1371
|
r.appendChild(_(t, f));
|
|
1375
1372
|
}), n.querySelectorAll(".hyper-link").forEach((f) => {
|
|
1376
|
-
r.appendChild(
|
|
1373
|
+
r.appendChild(wn(t, f));
|
|
1377
1374
|
}), n.querySelectorAll("img").forEach((f) => {
|
|
1378
|
-
r.appendChild(
|
|
1379
|
-
}),
|
|
1375
|
+
r.appendChild(bn(t, f));
|
|
1376
|
+
}), D(r, {
|
|
1380
1377
|
x: U + "",
|
|
1381
1378
|
y: U + "",
|
|
1382
1379
|
overflow: "visible"
|
|
1383
1380
|
}), i.appendChild(r), i;
|
|
1384
|
-
},
|
|
1385
|
-
function
|
|
1381
|
+
}, En = (t, e) => (e && t.insertAdjacentHTML("afterbegin", "<style>" + e + "</style>"), xn + t.outerHTML);
|
|
1382
|
+
function Sn(t) {
|
|
1386
1383
|
return new Promise((e, n) => {
|
|
1387
1384
|
const o = new FileReader();
|
|
1388
1385
|
o.onload = (s) => {
|
|
@@ -1392,11 +1389,11 @@ function Tn(t) {
|
|
|
1392
1389
|
}, o.readAsDataURL(t);
|
|
1393
1390
|
});
|
|
1394
1391
|
}
|
|
1395
|
-
const
|
|
1396
|
-
const n =
|
|
1392
|
+
const Tn = function(t = !1, e) {
|
|
1393
|
+
const n = Cn(this, t), o = En(n, e);
|
|
1397
1394
|
return new Blob([o], { type: "image/svg+xml" });
|
|
1398
|
-
},
|
|
1399
|
-
const n = this.exportSvg(t, e), o = await
|
|
1395
|
+
}, Ln = async function(t = !1, e) {
|
|
1396
|
+
const n = this.exportSvg(t, e), o = await Sn(n);
|
|
1400
1397
|
return new Promise((s, i) => {
|
|
1401
1398
|
const r = new Image();
|
|
1402
1399
|
r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
@@ -1404,36 +1401,36 @@ const Ln = function(t = !1, e) {
|
|
|
1404
1401
|
c.width = r.width, c.height = r.height, c.getContext("2d").drawImage(r, 0, 0), c.toBlob(s, "image/png", 1);
|
|
1405
1402
|
}, r.src = o, r.onerror = i;
|
|
1406
1403
|
});
|
|
1407
|
-
},
|
|
1404
|
+
}, Dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1408
1405
|
__proto__: null,
|
|
1409
|
-
exportPng:
|
|
1410
|
-
exportSvg:
|
|
1411
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1406
|
+
exportPng: Ln,
|
|
1407
|
+
exportSvg: Tn
|
|
1408
|
+
}, Symbol.toStringTag, { value: "Module" })), Mn = {}, kn = {
|
|
1412
1409
|
getObjById: K,
|
|
1413
1410
|
generateNewObj: It,
|
|
1414
1411
|
layout: Ot,
|
|
1415
|
-
linkDiv:
|
|
1412
|
+
linkDiv: Le,
|
|
1416
1413
|
editTopic: Gt,
|
|
1417
1414
|
createWrapper: Rt,
|
|
1418
1415
|
createParent: Wt,
|
|
1419
1416
|
createChildren: Xt,
|
|
1420
1417
|
createTopic: Vt,
|
|
1421
1418
|
findEle: Et,
|
|
1422
|
-
changeTheme:
|
|
1423
|
-
...
|
|
1424
|
-
...kn,
|
|
1425
|
-
...en,
|
|
1426
|
-
...pn,
|
|
1419
|
+
changeTheme: Be,
|
|
1420
|
+
...ge,
|
|
1427
1421
|
...Mn,
|
|
1422
|
+
...tn,
|
|
1423
|
+
...un,
|
|
1424
|
+
...Dn,
|
|
1428
1425
|
init(t) {
|
|
1429
1426
|
if (t = JSON.parse(JSON.stringify(t)), !t || !t.nodeData) return new Error("MindElixir: `data` is required");
|
|
1430
|
-
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, lt(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar &&
|
|
1427
|
+
t.direction !== void 0 && (this.direction = t.direction), this.changeTheme(t.theme || this.theme, !1), this.nodeData = t.nodeData, lt(this.nodeData), this.arrows = t.arrows || [], this.summaries = t.summaries || [], this.tidyArrow(), this.toolBar && Ye(this), this.layout(), this.linkDiv(), this.toCenter();
|
|
1431
1428
|
},
|
|
1432
1429
|
destroy() {
|
|
1433
1430
|
this.disposable.forEach((t) => t()), 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.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, this.selection?.destroy(), this.selection = void 0;
|
|
1434
1431
|
}
|
|
1435
1432
|
};
|
|
1436
|
-
function
|
|
1433
|
+
function Nn({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, containerHeight: l }) {
|
|
1437
1434
|
let h = e + n / 2;
|
|
1438
1435
|
const f = t + o / 2;
|
|
1439
1436
|
let u;
|
|
@@ -1441,7 +1438,7 @@ function $n({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction:
|
|
|
1441
1438
|
const y = s + c / 2, p = (1 - Math.abs(y - f) / l) * 0.25 * (n / 2);
|
|
1442
1439
|
return a === V.LHS ? h = h - n / 10 - p : h = h + n / 10 + p, `M ${h} ${f} Q ${h} ${y} ${u} ${y}`;
|
|
1443
1440
|
}
|
|
1444
|
-
function
|
|
1441
|
+
function $n({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction: a, isFirst: l }) {
|
|
1445
1442
|
const h = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
1446
1443
|
let f = 0, u = 0;
|
|
1447
1444
|
l ? f = t + o / 2 : f = t + o;
|
|
@@ -1450,8 +1447,8 @@ function An({ pT: t, pL: e, pW: n, pH: o, cT: s, cL: i, cW: r, cH: c, direction:
|
|
|
1450
1447
|
const b = Math.abs(f - y) / 300 * h;
|
|
1451
1448
|
return a === V.LHS ? (g = e, m = g + h, p = g - h, u = i + h, `M ${m} ${f} C ${g} ${f} ${g + b} ${y} ${p} ${y} H ${u}`) : (g = e + n, m = g - h, p = g + h, u = i + r - h, `M ${m} ${f} C ${g} ${f} ${g - b} ${y} ${p} ${y} H ${u}`);
|
|
1452
1449
|
}
|
|
1453
|
-
const
|
|
1454
|
-
function
|
|
1450
|
+
const An = "5.10.0";
|
|
1451
|
+
function Pn(t) {
|
|
1455
1452
|
return {
|
|
1456
1453
|
x: 0,
|
|
1457
1454
|
y: 0,
|
|
@@ -1469,39 +1466,38 @@ function Hn(t) {
|
|
|
1469
1466
|
function O({
|
|
1470
1467
|
el: t,
|
|
1471
1468
|
direction: e,
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
pasteHandler: E
|
|
1469
|
+
editable: n,
|
|
1470
|
+
contextMenu: o,
|
|
1471
|
+
toolBar: s,
|
|
1472
|
+
keypress: i,
|
|
1473
|
+
mouseSelectionButton: r,
|
|
1474
|
+
selectionContainer: c,
|
|
1475
|
+
before: a,
|
|
1476
|
+
newTopicName: l,
|
|
1477
|
+
allowUndo: h,
|
|
1478
|
+
generateMainBranch: f,
|
|
1479
|
+
generateSubBranch: u,
|
|
1480
|
+
overflowHidden: y,
|
|
1481
|
+
theme: m,
|
|
1482
|
+
alignment: p,
|
|
1483
|
+
scaleSensitivity: g,
|
|
1484
|
+
scaleMax: b,
|
|
1485
|
+
scaleMin: w,
|
|
1486
|
+
handleWheel: x,
|
|
1487
|
+
markdown: S,
|
|
1488
|
+
imageProxy: T,
|
|
1489
|
+
pasteHandler: L
|
|
1494
1490
|
}) {
|
|
1495
|
-
let
|
|
1496
|
-
const
|
|
1497
|
-
if (
|
|
1498
|
-
|
|
1499
|
-
const
|
|
1500
|
-
this.theme =
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1491
|
+
let C = null;
|
|
1492
|
+
const N = Object.prototype.toString.call(t);
|
|
1493
|
+
if (N === "[object HTMLDivElement]" ? C = t : N === "[object String]" && (C = document.querySelector(t)), !C) throw new Error("MindElixir: el is not a valid element");
|
|
1494
|
+
C.style.position = "relative", C.innerHTML = "", this.el = C, this.disposable = [], this.before = a || {}, this.newTopicName = l || "New Node", this.contextMenu = o ?? !0, this.toolBar = s ?? !0, this.keypress = i ?? !0, this.mouseSelectionButton = r ?? 0, this.direction = e ?? 1, this.editable = n ?? !0, this.allowUndo = h ?? !0, this.scaleSensitivity = g ?? 0.1, this.scaleMax = b ?? 1.4, this.scaleMin = w ?? 0.2, this.generateMainBranch = f || Nn, this.generateSubBranch = u || $n, this.overflowHidden = y ?? !1, this.alignment = p ?? "root", this.handleWheel = x ?? !0, this.markdown = S || void 0, this.imageProxy = T || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = Pn(this), this.bus = Se(), this.container = document.createElement("div"), this.selectionContainer = c || this.container, this.container.className = "map-container";
|
|
1495
|
+
const M = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1496
|
+
this.theme = m || (M.matches ? ct : rt);
|
|
1497
|
+
const Y = document.createElement("div");
|
|
1498
|
+
Y.className = "map-canvas", this.map = Y, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = document.createElement("me-nodes"), this.lines = z("lines"), this.summarySvg = z("summary"), this.linkController = z("linkcontroller"), this.P2 = document.createElement("div"), this.P3 = document.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = yt(), this.line2 = yt(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = z("topiclinks"), this.labelContainer = document.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Ee(this)), L && (this.pasteHandler = L);
|
|
1503
1499
|
}
|
|
1504
|
-
O.prototype =
|
|
1500
|
+
O.prototype = kn;
|
|
1505
1501
|
Object.defineProperty(O.prototype, "currentNode", {
|
|
1506
1502
|
get() {
|
|
1507
1503
|
return this.currentNodes[this.currentNodes.length - 1];
|
|
@@ -1513,13 +1509,13 @@ O.RIGHT = 1;
|
|
|
1513
1509
|
O.SIDE = 2;
|
|
1514
1510
|
O.THEME = rt;
|
|
1515
1511
|
O.DARK_THEME = ct;
|
|
1516
|
-
O.version =
|
|
1512
|
+
O.version = An;
|
|
1517
1513
|
O.E = Et;
|
|
1518
1514
|
export {
|
|
1519
1515
|
ct as DARK_THEME,
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1516
|
+
Hn as LEFT,
|
|
1517
|
+
In as RIGHT,
|
|
1518
|
+
On as SIDE,
|
|
1523
1519
|
rt as THEME,
|
|
1524
1520
|
O as default
|
|
1525
1521
|
};
|