mind-elixir 5.2.0-beta.6 → 5.2.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 +273 -284
- package/dist/MindElixirLite.iife.js +4 -4
- package/dist/MindElixirLite.js +175 -186
- package/dist/style.css +1 -1
- package/dist/types/summary.d.ts +1 -1
- package/dist/types/types/dom.d.ts +0 -1
- package/package.json +106 -107
- package/readme/es.md +430 -0
- package/readme/fr.md +430 -0
- package/readme/ja.md +429 -0
- package/readme/ko.md +430 -0
- package/readme/pt.md +430 -0
- package/readme/ru.md +430 -0
- package/readme/zh.md +430 -0
package/dist/MindElixir.js
CHANGED
|
@@ -158,10 +158,10 @@ var D = /* @__PURE__ */ ((e) => (e.LHS = "lhs", e.RHS = "rhs", e))(D || {});
|
|
|
158
158
|
const vt = (e) => {
|
|
159
159
|
const t = e.map.querySelectorAll(".lhs>me-wrapper>me-parent>me-tpc");
|
|
160
160
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
161
|
-
},
|
|
161
|
+
}, yt = (e) => {
|
|
162
162
|
const t = e.map.querySelectorAll(".rhs>me-wrapper>me-parent>me-tpc");
|
|
163
163
|
e.selectNode(t[Math.ceil(t.length / 2) - 1]);
|
|
164
|
-
},
|
|
164
|
+
}, bt = (e) => {
|
|
165
165
|
e.selectNode(e.map.querySelector("me-root>me-tpc"));
|
|
166
166
|
}, wt = function(e, t) {
|
|
167
167
|
const n = t.parentElement.parentElement.parentElement.previousSibling;
|
|
@@ -181,7 +181,7 @@ const vt = (e) => {
|
|
|
181
181
|
if (!n)
|
|
182
182
|
return;
|
|
183
183
|
const o = n.nodeObj, s = n.offsetParent.offsetParent.parentElement;
|
|
184
|
-
o.parent ? s.className === t ? xt(e, n) : (l = o.parent) != null && l.parent ? wt(e, n) :
|
|
184
|
+
o.parent ? s.className === t ? xt(e, n) : (l = o.parent) != null && l.parent ? wt(e, n) : bt(e) : t === D.LHS ? vt(e) : yt(e);
|
|
185
185
|
}, $e = function(e, t) {
|
|
186
186
|
const n = e.currentNode;
|
|
187
187
|
if (!n || !n.nodeObj.parent)
|
|
@@ -298,14 +298,14 @@ function Et(e) {
|
|
|
298
298
|
let n = 0;
|
|
299
299
|
e.spacePressed = !1;
|
|
300
300
|
const o = (a) => {
|
|
301
|
-
var
|
|
301
|
+
var C, S;
|
|
302
302
|
if (a.button !== 0)
|
|
303
303
|
return;
|
|
304
|
-
if ((
|
|
304
|
+
if ((C = e.helper1) != null && C.moved) {
|
|
305
305
|
e.helper1.clear();
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
if ((
|
|
308
|
+
if ((S = e.helper2) != null && S.moved) {
|
|
309
309
|
e.helper2.clear();
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
@@ -313,118 +313,107 @@ function Et(e) {
|
|
|
313
313
|
t.clear();
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
318
|
-
a.ctrlKey || a.metaKey ? e.expandNodeAll(
|
|
319
|
-
else if (
|
|
320
|
-
e.selectNode(
|
|
316
|
+
const h = a.target;
|
|
317
|
+
if (h.tagName === "ME-EPD")
|
|
318
|
+
a.ctrlKey || a.metaKey ? e.expandNodeAll(h.previousSibling) : e.expandNode(h.previousSibling);
|
|
319
|
+
else if (h.tagName === "ME-TPC" && e.currentNodes.length > 1)
|
|
320
|
+
e.selectNode(h);
|
|
321
321
|
else if (!e.editable)
|
|
322
322
|
return;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
return;
|
|
333
|
-
} else if (_) {
|
|
334
|
-
e.selectSummary(C);
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
323
|
+
if (h.classList.contains("svg-label")) {
|
|
324
|
+
const b = h.dataset.svgId, x = h.dataset.type, E = document.getElementById(b);
|
|
325
|
+
if (E) {
|
|
326
|
+
if (x === "arrow") {
|
|
327
|
+
e.selectArrow(E);
|
|
328
|
+
return;
|
|
329
|
+
} else if (x === "summary") {
|
|
330
|
+
e.selectSummary(E);
|
|
331
|
+
return;
|
|
337
332
|
}
|
|
338
333
|
}
|
|
339
334
|
}
|
|
340
|
-
if (
|
|
341
|
-
const
|
|
342
|
-
if (
|
|
343
|
-
e.selectArrow(
|
|
335
|
+
if (h.closest(".topiclinks")) {
|
|
336
|
+
const b = h.closest("g");
|
|
337
|
+
if (b) {
|
|
338
|
+
e.selectArrow(b);
|
|
344
339
|
return;
|
|
345
340
|
}
|
|
346
341
|
}
|
|
347
|
-
if (
|
|
348
|
-
const
|
|
349
|
-
if (
|
|
350
|
-
e.selectSummary(
|
|
342
|
+
if (h.closest(".summary")) {
|
|
343
|
+
const b = h.closest("g");
|
|
344
|
+
if (b) {
|
|
345
|
+
e.selectSummary(b);
|
|
351
346
|
return;
|
|
352
347
|
}
|
|
353
348
|
}
|
|
354
349
|
}, s = (a) => {
|
|
355
350
|
if (!e.editable)
|
|
356
351
|
return;
|
|
357
|
-
const
|
|
358
|
-
ge(
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
e.editArrowLabel(w);
|
|
368
|
-
return;
|
|
369
|
-
} else if (C) {
|
|
370
|
-
e.editSummary(w);
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
352
|
+
const h = a.target;
|
|
353
|
+
if (ge(h) && e.beginEdit(h), h.classList.contains("svg-label")) {
|
|
354
|
+
const C = h.dataset.svgId, S = h.dataset.type, b = document.getElementById(C);
|
|
355
|
+
if (b) {
|
|
356
|
+
if (S === "arrow") {
|
|
357
|
+
e.editArrowLabel(b);
|
|
358
|
+
return;
|
|
359
|
+
} else if (S === "summary") {
|
|
360
|
+
e.editSummary(b);
|
|
361
|
+
return;
|
|
373
362
|
}
|
|
374
363
|
}
|
|
375
364
|
}
|
|
376
|
-
if (
|
|
377
|
-
const
|
|
378
|
-
if (
|
|
379
|
-
e.editArrowLabel(
|
|
365
|
+
if (h.closest(".topiclinks")) {
|
|
366
|
+
const C = h.closest("g");
|
|
367
|
+
if (C) {
|
|
368
|
+
e.editArrowLabel(C);
|
|
380
369
|
return;
|
|
381
370
|
}
|
|
382
371
|
}
|
|
383
|
-
if (
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
386
|
-
e.editSummary(
|
|
372
|
+
if (h.closest(".summary")) {
|
|
373
|
+
const C = h.closest("g");
|
|
374
|
+
if (C) {
|
|
375
|
+
e.editSummary(C);
|
|
387
376
|
return;
|
|
388
377
|
}
|
|
389
378
|
}
|
|
390
379
|
}, i = (a) => {
|
|
391
380
|
if (a.pointerType === "mouse")
|
|
392
381
|
return;
|
|
393
|
-
const
|
|
394
|
-
v < 300 && v > 0 && s(a), n =
|
|
382
|
+
const h = (/* @__PURE__ */ new Date()).getTime(), v = h - n;
|
|
383
|
+
v < 300 && v > 0 && s(a), n = h;
|
|
395
384
|
}, l = (a) => {
|
|
396
385
|
a.code === "Space" && (e.spacePressed = !0, e.container.classList.add("space-pressed"), a.preventDefault());
|
|
397
386
|
}, r = (a) => {
|
|
398
387
|
a.code === "Space" && (e.spacePressed = !1, e.container.classList.remove("space-pressed"));
|
|
399
388
|
}, c = (a) => {
|
|
400
389
|
t.moved = !1;
|
|
401
|
-
const
|
|
402
|
-
if (!
|
|
390
|
+
const h = e.spacePressed && a.button === 0 && a.pointerType === "mouse", v = e.mouseSelectionButton === 0 ? 2 : 0, w = a.button === v && a.pointerType === "mouse";
|
|
391
|
+
if (!h && !w)
|
|
403
392
|
return;
|
|
404
393
|
t.x = a.clientX, t.y = a.clientY;
|
|
405
|
-
const
|
|
406
|
-
(
|
|
394
|
+
const C = a.target;
|
|
395
|
+
(h || C.className !== "circle" && C.contentEditable !== "plaintext-only") && (t.mousedown = !0, C.setPointerCapture(a.pointerId));
|
|
407
396
|
}, d = (a) => {
|
|
408
397
|
if (a.target.contentEditable !== "plaintext-only" || e.spacePressed && t.mousedown) {
|
|
409
|
-
const
|
|
410
|
-
t.onMove(
|
|
398
|
+
const h = a.clientX - t.x, v = a.clientY - t.y;
|
|
399
|
+
t.onMove(h, v);
|
|
411
400
|
}
|
|
412
401
|
t.x = a.clientX, t.y = a.clientY;
|
|
413
402
|
}, f = (a) => {
|
|
414
403
|
if (!t.mousedown)
|
|
415
404
|
return;
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
},
|
|
405
|
+
const h = a.target;
|
|
406
|
+
h.hasPointerCapture && h.hasPointerCapture(a.pointerId) && h.releasePointerCapture(a.pointerId), t.clear();
|
|
407
|
+
}, u = () => {
|
|
419
408
|
t.mousedown && t.clear();
|
|
420
409
|
}, g = (a) => {
|
|
421
410
|
if (a.preventDefault(), a.button !== 2 || !e.editable)
|
|
422
411
|
return;
|
|
423
|
-
const
|
|
424
|
-
ge(
|
|
412
|
+
const h = a.target;
|
|
413
|
+
ge(h) && !h.classList.contains("selected") && e.selectNode(h), setTimeout(() => {
|
|
425
414
|
e.dragMoveHelper.moved || e.bus.fire("showContextMenu", a);
|
|
426
415
|
}, 200);
|
|
427
|
-
},
|
|
416
|
+
}, y = (a) => {
|
|
428
417
|
a.stopPropagation(), a.preventDefault(), a.ctrlKey || a.metaKey ? a.deltaY < 0 ? le(e, "in", e.dragMoveHelper) : e.scaleVal - e.scaleSensitivity > 0 && le(e, "out", e.dragMoveHelper) : a.shiftKey ? e.move(-a.deltaY, 0) : e.move(-a.deltaX, -a.deltaY);
|
|
429
418
|
}, { container: p } = e;
|
|
430
419
|
return Se([
|
|
@@ -435,8 +424,8 @@ function Et(e) {
|
|
|
435
424
|
{ dom: p, evt: "click", func: o },
|
|
436
425
|
{ dom: p, evt: "dblclick", func: s },
|
|
437
426
|
{ dom: p, evt: "contextmenu", func: g },
|
|
438
|
-
{ dom: p, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel :
|
|
439
|
-
{ dom: p, evt: "blur", func:
|
|
427
|
+
{ dom: p, evt: "wheel", func: typeof e.handleWheel == "function" ? e.handleWheel : y },
|
|
428
|
+
{ dom: p, evt: "blur", func: u },
|
|
440
429
|
{ dom: document, evt: "keydown", func: l },
|
|
441
430
|
{ dom: document, evt: "keyup", func: r }
|
|
442
431
|
]);
|
|
@@ -497,7 +486,7 @@ const ce = document, Nt = function() {
|
|
|
497
486
|
n.appendChild(i);
|
|
498
487
|
}
|
|
499
488
|
return n;
|
|
500
|
-
},
|
|
489
|
+
}, _ = document, Je = function(e, t) {
|
|
501
490
|
const o = (this != null && this.el ? this.el : t || document).querySelector(`[data-nodeid="me${e}"]`);
|
|
502
491
|
if (!o)
|
|
503
492
|
throw new Error(`FindEle: Node ${e} not found, maybe it's collapsed.`);
|
|
@@ -515,35 +504,35 @@ const ce = document, Nt = function() {
|
|
|
515
504
|
if (t.image) {
|
|
516
505
|
const n = t.image;
|
|
517
506
|
if (n.url && n.width && n.height) {
|
|
518
|
-
const o =
|
|
507
|
+
const o = _.createElement("img");
|
|
519
508
|
o.src = this.imageProxy ? this.imageProxy(n.url) : n.url, o.style.width = n.width + "px", o.style.height = n.height + "px", n.fit && (o.style.objectFit = n.fit), e.appendChild(o), e.image = o;
|
|
520
509
|
}
|
|
521
510
|
} else
|
|
522
511
|
e.image && (e.image = void 0);
|
|
523
512
|
{
|
|
524
|
-
const n =
|
|
513
|
+
const n = _.createElement("span");
|
|
525
514
|
n.className = "text", this.markdown ? n.innerHTML = this.markdown(t.topic, t) : n.textContent = t.topic, e.appendChild(n), e.text = n;
|
|
526
515
|
}
|
|
527
516
|
if (t.hyperLink) {
|
|
528
|
-
const n =
|
|
517
|
+
const n = _.createElement("a");
|
|
529
518
|
n.className = "hyper-link", n.target = "_blank", n.innerText = "🔗", n.href = t.hyperLink, e.appendChild(n), e.link = n;
|
|
530
519
|
} else
|
|
531
520
|
e.link && (e.link = void 0);
|
|
532
521
|
if (t.icons && t.icons.length) {
|
|
533
|
-
const n =
|
|
522
|
+
const n = _.createElement("span");
|
|
534
523
|
n.className = "icons", n.innerHTML = t.icons.map((o) => `<span>${pe(o)}</span>`).join(""), e.appendChild(n), e.icons = n;
|
|
535
524
|
} else
|
|
536
525
|
e.icons && (e.icons = void 0);
|
|
537
526
|
if (t.tags && t.tags.length) {
|
|
538
|
-
const n =
|
|
527
|
+
const n = _.createElement("div");
|
|
539
528
|
n.className = "tags", t.tags.forEach((o) => {
|
|
540
|
-
const s =
|
|
529
|
+
const s = _.createElement("span");
|
|
541
530
|
typeof o == "string" ? s.textContent = o : (s.textContent = o.text, o.className && (s.className = o.className), o.style && Object.assign(s.style, o.style)), n.appendChild(s);
|
|
542
531
|
}), e.appendChild(n), e.tags = n;
|
|
543
532
|
} else
|
|
544
533
|
e.tags && (e.tags = void 0);
|
|
545
534
|
}, Tt = function(e, t) {
|
|
546
|
-
const n =
|
|
535
|
+
const n = _.createElement("me-wrapper"), { p: o, tpc: s } = this.createParent(e);
|
|
547
536
|
if (n.appendChild(o), !t && e.children && e.children.length > 0) {
|
|
548
537
|
const i = ke(e.expanded);
|
|
549
538
|
if (o.appendChild(i), e.expanded !== !1) {
|
|
@@ -553,17 +542,17 @@ const ce = document, Nt = function() {
|
|
|
553
542
|
}
|
|
554
543
|
return { grp: n, top: o, tpc: s };
|
|
555
544
|
}, Lt = function(e) {
|
|
556
|
-
const t =
|
|
545
|
+
const t = _.createElement("me-parent"), n = this.createTopic(e);
|
|
557
546
|
return Ne.call(this, n, e), t.appendChild(n), { p: t, tpc: n };
|
|
558
547
|
}, At = function(e) {
|
|
559
|
-
const t =
|
|
548
|
+
const t = _.createElement("me-children");
|
|
560
549
|
return t.append(...e), t;
|
|
561
550
|
}, Mt = function(e) {
|
|
562
|
-
const t =
|
|
551
|
+
const t = _.createElement("me-tpc");
|
|
563
552
|
return t.nodeObj = e, t.dataset.nodeid = "me" + e.id, t.draggable = this.draggable, t;
|
|
564
553
|
};
|
|
565
554
|
function Ze(e) {
|
|
566
|
-
const t =
|
|
555
|
+
const t = _.createRange();
|
|
567
556
|
t.selectNodeContents(e);
|
|
568
557
|
const n = window.getSelection();
|
|
569
558
|
n && (n.removeAllRanges(), n.addRange(t));
|
|
@@ -571,7 +560,7 @@ function Ze(e) {
|
|
|
571
560
|
const Dt = function(e) {
|
|
572
561
|
if (!e)
|
|
573
562
|
return;
|
|
574
|
-
const t =
|
|
563
|
+
const t = _.createElement("div"), n = e.nodeObj, o = n.topic, { offsetLeft: s, offsetTop: i } = O(this.nodes, e);
|
|
575
564
|
this.nodes.appendChild(t), t.id = "input-box", t.textContent = o, t.contentEditable = "plaintext-only", t.spellcheck = !1;
|
|
576
565
|
const l = getComputedStyle(e);
|
|
577
566
|
t.style.cssText = `
|
|
@@ -607,7 +596,7 @@ const Dt = function(e) {
|
|
|
607
596
|
}));
|
|
608
597
|
});
|
|
609
598
|
}, ke = function(e) {
|
|
610
|
-
const t =
|
|
599
|
+
const t = _.createElement("me-epd");
|
|
611
600
|
return t.expanded = e !== !1, t.className = e !== !1 ? "minus" : "", t;
|
|
612
601
|
}, q = document, P = "http://www.w3.org/2000/svg", he = function(e) {
|
|
613
602
|
const t = e.clientWidth, n = e.clientHeight, o = e.dataset, s = Number(o.x), i = Number(o.y), l = o.anchor;
|
|
@@ -656,13 +645,13 @@ const Dt = function(e) {
|
|
|
656
645
|
"stroke-width": String((o == null ? void 0 : o.strokeWidth) || "2")
|
|
657
646
|
};
|
|
658
647
|
(o == null ? void 0 : o.opacity) !== void 0 && (f.opacity = String(o.opacity)), k(d, f), r === 0 && d.setAttribute("stroke-dasharray", (o == null ? void 0 : o.strokeDasharray) || "8,2");
|
|
659
|
-
const
|
|
660
|
-
k(
|
|
648
|
+
const u = q.createElementNS(P, "path");
|
|
649
|
+
k(u, {
|
|
661
650
|
d: c,
|
|
662
651
|
stroke: "transparent",
|
|
663
652
|
fill: "none",
|
|
664
653
|
"stroke-width": "15"
|
|
665
|
-
}), s.appendChild(
|
|
654
|
+
}), s.appendChild(u), s.appendChild(d), s[l.name] = d;
|
|
666
655
|
}), s;
|
|
667
656
|
}, et = function(e, t, n) {
|
|
668
657
|
if (!t)
|
|
@@ -697,28 +686,28 @@ const Dt = function(e) {
|
|
|
697
686
|
const t = this.map.querySelector("me-root"), n = t.offsetTop, o = t.offsetLeft, s = t.offsetWidth, i = t.offsetHeight, l = this.map.querySelectorAll("me-main > me-wrapper");
|
|
698
687
|
this.lines.innerHTML = "";
|
|
699
688
|
for (let r = 0; r < l.length; r++) {
|
|
700
|
-
const c = l[r], d = c.querySelector("me-tpc"), { offsetLeft: f, offsetTop:
|
|
701
|
-
if (d.style.borderColor =
|
|
689
|
+
const c = l[r], d = c.querySelector("me-tpc"), { offsetLeft: f, offsetTop: u } = O(this.nodes, d), g = d.offsetWidth, y = d.offsetHeight, p = c.parentNode.className, m = this.generateMainBranch({ pT: n, pL: o, pW: s, pH: i, cT: u, cL: f, cW: g, cH: y, direction: p, containerHeight: this.nodes.offsetHeight }), a = this.theme.palette, h = d.nodeObj.branchColor || a[r % a.length];
|
|
690
|
+
if (d.style.borderColor = h, this.lines.appendChild(Qe(m, h, "3")), e && e !== c)
|
|
702
691
|
continue;
|
|
703
|
-
const v = J("subLines"),
|
|
704
|
-
|
|
692
|
+
const v = J("subLines"), w = c.lastChild;
|
|
693
|
+
w.tagName === "svg" && w.remove(), c.appendChild(v), tt(this, v, h, c, p, !0);
|
|
705
694
|
}
|
|
706
695
|
this.labelContainer.innerHTML = "", this.renderArrow(), this.renderSummary(), this.bus.fire("linkDiv");
|
|
707
696
|
}, tt = function(e, t, n, o, s, i) {
|
|
708
697
|
const l = o.firstChild, r = o.children[1].children;
|
|
709
698
|
if (r.length === 0)
|
|
710
699
|
return;
|
|
711
|
-
const c = l.offsetTop, d = l.offsetLeft, f = l.offsetWidth,
|
|
700
|
+
const c = l.offsetTop, d = l.offsetLeft, f = l.offsetWidth, u = l.offsetHeight;
|
|
712
701
|
for (let g = 0; g < r.length; g++) {
|
|
713
|
-
const
|
|
714
|
-
t.appendChild(Qe(
|
|
715
|
-
const
|
|
716
|
-
if (
|
|
717
|
-
if (!
|
|
702
|
+
const y = r[g], p = y.firstChild, m = p.offsetTop, a = p.offsetLeft, h = p.offsetWidth, v = p.offsetHeight, w = p.firstChild.nodeObj.branchColor || n, C = e.generateSubBranch({ pT: c, pL: d, pW: f, pH: u, cT: m, cL: a, cW: h, cH: v, direction: s, isFirst: i });
|
|
703
|
+
t.appendChild(Qe(C, w, "2"));
|
|
704
|
+
const S = p.children[1];
|
|
705
|
+
if (S) {
|
|
706
|
+
if (!S.expanded)
|
|
718
707
|
continue;
|
|
719
708
|
} else
|
|
720
709
|
continue;
|
|
721
|
-
tt(e, t,
|
|
710
|
+
tt(e, t, w, y, s);
|
|
722
711
|
}
|
|
723
712
|
}, je = {
|
|
724
713
|
addChild: "插入子节点",
|
|
@@ -868,78 +857,78 @@ function Ot(e, t) {
|
|
|
868
857
|
focus: !0,
|
|
869
858
|
link: !0
|
|
870
859
|
} : t;
|
|
871
|
-
const n = (
|
|
872
|
-
const
|
|
873
|
-
return
|
|
874
|
-
}, o = (
|
|
860
|
+
const n = (b) => {
|
|
861
|
+
const x = document.createElement("div");
|
|
862
|
+
return x.innerText = b, x.className = "tips", x;
|
|
863
|
+
}, o = (b, x, E) => {
|
|
875
864
|
const N = document.createElement("li");
|
|
876
|
-
return N.id =
|
|
877
|
-
}, s = He[e.locale] ? e.locale : "en", i = He[s], l = o("cm-add_child", i.addChild, "Tab"), r = o("cm-add_parent", i.addParent, "Ctrl + Enter"), c = o("cm-add_sibling", i.addSibling, "Enter"), d = o("cm-remove_child", i.removeNode, "Delete"), f = o("cm-fucus", i.focus, ""),
|
|
878
|
-
if (
|
|
879
|
-
for (let
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
|
|
865
|
+
return N.id = b, N.innerHTML = `<span>${pe(x)}</span><span ${E ? 'class="key"' : ""}>${pe(E)}</span>`, N;
|
|
866
|
+
}, s = He[e.locale] ? e.locale : "en", i = He[s], l = o("cm-add_child", i.addChild, "Tab"), r = o("cm-add_parent", i.addParent, "Ctrl + Enter"), c = o("cm-add_sibling", i.addSibling, "Enter"), d = o("cm-remove_child", i.removeNode, "Delete"), f = o("cm-fucus", i.focus, ""), u = o("cm-unfucus", i.cancelFocus, ""), g = o("cm-up", i.moveUp, "PgUp"), y = o("cm-down", i.moveDown, "Pgdn"), p = o("cm-link", i.link, ""), m = o("cm-link-bidirectional", i.linkBidirectional, ""), a = o("cm-summary", i.summary, ""), h = document.createElement("ul");
|
|
867
|
+
if (h.className = "menu-list", h.appendChild(l), h.appendChild(r), h.appendChild(c), h.appendChild(d), t.focus && (h.appendChild(f), h.appendChild(u)), h.appendChild(g), h.appendChild(y), h.appendChild(a), t.link && (h.appendChild(p), h.appendChild(m)), t && t.extend)
|
|
868
|
+
for (let b = 0; b < t.extend.length; b++) {
|
|
869
|
+
const x = t.extend[b], E = o(x.name, x.name, x.key || "");
|
|
870
|
+
h.appendChild(E), E.onclick = (N) => {
|
|
871
|
+
x.onclick(N);
|
|
883
872
|
};
|
|
884
873
|
}
|
|
885
874
|
const v = document.createElement("div");
|
|
886
|
-
v.className = "context-menu", v.appendChild(
|
|
887
|
-
let
|
|
888
|
-
const
|
|
889
|
-
const
|
|
890
|
-
if (ge(
|
|
891
|
-
|
|
892
|
-
const
|
|
893
|
-
N + A > window.innerHeight ? (
|
|
875
|
+
v.className = "context-menu", v.appendChild(h), v.hidden = !0, e.container.append(v);
|
|
876
|
+
let w = !0;
|
|
877
|
+
const C = (b) => {
|
|
878
|
+
const x = b.target;
|
|
879
|
+
if (ge(x)) {
|
|
880
|
+
x.parentElement.tagName === "ME-ROOT" ? w = !0 : w = !1, w ? (f.className = "disabled", g.className = "disabled", y.className = "disabled", r.className = "disabled", c.className = "disabled", d.className = "disabled") : (f.className = "", g.className = "", y.className = "", r.className = "", c.className = "", d.className = ""), v.hidden = !1, h.style.top = "", h.style.bottom = "", h.style.left = "", h.style.right = "";
|
|
881
|
+
const E = h.getBoundingClientRect(), N = h.offsetHeight, L = h.offsetWidth, A = b.clientY - E.top, V = b.clientX - E.left;
|
|
882
|
+
N + A > window.innerHeight ? (h.style.top = "", h.style.bottom = "0px") : (h.style.bottom = "", h.style.top = A + 15 + "px"), L + V > window.innerWidth ? (h.style.left = "", h.style.right = "0px") : (h.style.right = "", h.style.left = V + 10 + "px");
|
|
894
883
|
}
|
|
895
884
|
};
|
|
896
|
-
e.bus.addListener("showContextMenu",
|
|
897
|
-
|
|
885
|
+
e.bus.addListener("showContextMenu", C), v.onclick = (b) => {
|
|
886
|
+
b.target === v && (v.hidden = !0);
|
|
898
887
|
}, l.onclick = () => {
|
|
899
888
|
e.addChild(), v.hidden = !0;
|
|
900
889
|
}, r.onclick = () => {
|
|
901
890
|
e.insertParent(), v.hidden = !0;
|
|
902
891
|
}, c.onclick = () => {
|
|
903
|
-
|
|
892
|
+
w || (e.insertSibling("after"), v.hidden = !0);
|
|
904
893
|
}, d.onclick = () => {
|
|
905
|
-
|
|
894
|
+
w || (e.removeNodes(e.currentNodes || []), v.hidden = !0);
|
|
906
895
|
}, f.onclick = () => {
|
|
907
|
-
|
|
908
|
-
},
|
|
896
|
+
w || (e.focusNode(e.currentNode), v.hidden = !0);
|
|
897
|
+
}, u.onclick = () => {
|
|
909
898
|
e.cancelFocus(), v.hidden = !0;
|
|
910
899
|
}, g.onclick = () => {
|
|
911
|
-
|
|
912
|
-
},
|
|
913
|
-
|
|
900
|
+
w || (e.moveUpNode(), v.hidden = !0);
|
|
901
|
+
}, y.onclick = () => {
|
|
902
|
+
w || (e.moveDownNode(), v.hidden = !0);
|
|
914
903
|
};
|
|
915
|
-
const
|
|
904
|
+
const S = (b) => {
|
|
916
905
|
v.hidden = !0;
|
|
917
|
-
const
|
|
918
|
-
e.container.appendChild(
|
|
906
|
+
const x = e.currentNode, E = n(i.clickTips);
|
|
907
|
+
e.container.appendChild(E), e.map.addEventListener(
|
|
919
908
|
"click",
|
|
920
909
|
(N) => {
|
|
921
|
-
N.preventDefault(),
|
|
922
|
-
const
|
|
923
|
-
(
|
|
910
|
+
N.preventDefault(), E.remove();
|
|
911
|
+
const L = N.target;
|
|
912
|
+
(L.parentElement.tagName === "ME-PARENT" || L.parentElement.tagName === "ME-ROOT") && e.createArrow(x, L, b);
|
|
924
913
|
},
|
|
925
914
|
{
|
|
926
915
|
once: !0
|
|
927
916
|
}
|
|
928
917
|
);
|
|
929
918
|
};
|
|
930
|
-
return p.onclick = () =>
|
|
919
|
+
return p.onclick = () => S(), m.onclick = () => S({ bidirectional: !0 }), a.onclick = () => {
|
|
931
920
|
v.hidden = !0, e.createSummary(), e.unselectNodes(e.currentNodes);
|
|
932
921
|
}, () => {
|
|
933
|
-
l.onclick = null, r.onclick = null, c.onclick = null, d.onclick = null, f.onclick = null,
|
|
922
|
+
l.onclick = null, r.onclick = null, c.onclick = null, d.onclick = null, f.onclick = null, u.onclick = null, g.onclick = null, y.onclick = null, p.onclick = null, a.onclick = null, v.onclick = null, e.container.oncontextmenu = null;
|
|
934
923
|
};
|
|
935
924
|
}
|
|
936
925
|
const ve = document, jt = function(e, t) {
|
|
937
926
|
if (!t)
|
|
938
|
-
return
|
|
927
|
+
return ye(e), e;
|
|
939
928
|
let n = e.querySelector(".insert-preview");
|
|
940
929
|
const o = `insert-preview ${t} show`;
|
|
941
930
|
return n || (n = ve.createElement("div"), e.appendChild(n)), n.className = o, e;
|
|
942
|
-
},
|
|
931
|
+
}, ye = function(e) {
|
|
943
932
|
if (!e)
|
|
944
933
|
return;
|
|
945
934
|
const t = e.querySelectorAll(".insert-preview");
|
|
@@ -986,9 +975,9 @@ function Rt(e) {
|
|
|
986
975
|
d.preventDefault();
|
|
987
976
|
return;
|
|
988
977
|
}
|
|
989
|
-
let
|
|
990
|
-
|
|
991
|
-
for (const g of
|
|
978
|
+
let u = e.currentNodes;
|
|
979
|
+
u != null && u.includes(f) || (e.selectNode(f), u = e.currentNodes), e.dragged = u, u.length > 1 ? o.innerHTML = u.length + "" : o.innerHTML = f.innerHTML;
|
|
980
|
+
for (const g of u)
|
|
992
981
|
g.parentElement.parentElement.style.opacity = "0.5";
|
|
993
982
|
d.dataTransfer.setDragImage(o, 0, 0), d.dataTransfer.dropEffect = "move", e.dragMoveHelper.clear();
|
|
994
983
|
}, l = (d) => {
|
|
@@ -998,23 +987,23 @@ function Rt(e) {
|
|
|
998
987
|
s.stop();
|
|
999
988
|
for (const g of f)
|
|
1000
989
|
g.parentElement.parentElement.style.opacity = "1";
|
|
1001
|
-
const
|
|
1002
|
-
|
|
990
|
+
const u = d.target;
|
|
991
|
+
u.style.opacity = "", n && (ye(n), t === "before" ? e.moveNodeBefore(f, n) : t === "after" ? e.moveNodeAfter(f, n) : t === "in" && e.moveNodeIn(f, n), e.dragged = null, o.innerHTML = "");
|
|
1003
992
|
}, r = (d) => {
|
|
1004
993
|
d.preventDefault();
|
|
1005
|
-
const f = 12 * e.scaleVal, { dragged:
|
|
1006
|
-
if (!
|
|
994
|
+
const f = 12 * e.scaleVal, { dragged: u } = e;
|
|
995
|
+
if (!u)
|
|
1007
996
|
return;
|
|
1008
997
|
const g = e.container.getBoundingClientRect();
|
|
1009
|
-
d.clientX < g.x + 50 ? s.move(1, 0) : d.clientX > g.x + g.width - 50 ? s.move(-1, 0) : d.clientY < g.y + 50 ? s.move(0, 1) : d.clientY > g.y + g.height - 50 ? s.move(0, -1) : s.stop(),
|
|
1010
|
-
const
|
|
1011
|
-
if (Be(
|
|
1012
|
-
n =
|
|
1013
|
-
const p =
|
|
998
|
+
d.clientX < g.x + 50 ? s.move(1, 0) : d.clientX > g.x + g.width - 50 ? s.move(-1, 0) : d.clientY < g.y + 50 ? s.move(0, 1) : d.clientY > g.y + g.height - 50 ? s.move(0, -1) : s.stop(), ye(n);
|
|
999
|
+
const y = ve.elementFromPoint(d.clientX, d.clientY - f);
|
|
1000
|
+
if (Be(y, u)) {
|
|
1001
|
+
n = y;
|
|
1002
|
+
const p = y.getBoundingClientRect(), m = p.y;
|
|
1014
1003
|
d.clientY > m + p.height ? t = "after" : t = "in";
|
|
1015
1004
|
} else {
|
|
1016
1005
|
const p = ve.elementFromPoint(d.clientX, d.clientY + f), m = p.getBoundingClientRect();
|
|
1017
|
-
if (Be(p,
|
|
1006
|
+
if (Be(p, u)) {
|
|
1018
1007
|
n = p;
|
|
1019
1008
|
const a = m.y;
|
|
1020
1009
|
d.clientY < a ? t = "before" : t = "in";
|
|
@@ -1075,7 +1064,7 @@ function It(e) {
|
|
|
1075
1064
|
const d = e.getData(), f = {
|
|
1076
1065
|
prev: o,
|
|
1077
1066
|
operation: c.name,
|
|
1078
|
-
currentSelected: s.map((
|
|
1067
|
+
currentSelected: s.map((u) => u.id),
|
|
1079
1068
|
currentTarget: Ft(c),
|
|
1080
1069
|
next: d
|
|
1081
1070
|
};
|
|
@@ -1182,8 +1171,8 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1182
1171
|
case "touch":
|
|
1183
1172
|
return e.right >= t.left && e.left <= t.right && e.bottom >= t.top && e.top <= t.bottom;
|
|
1184
1173
|
}
|
|
1185
|
-
}, tn = () => matchMedia("(hover: none), (pointer: coarse)").matches, nn = () => "safari" in window,
|
|
1186
|
-
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n =
|
|
1174
|
+
}, tn = () => matchMedia("(hover: none), (pointer: coarse)").matches, nn = () => "safari" in window, be = (e) => Array.isArray(e) ? e : [e], nt = (e) => (t, n, o, s = {}) => {
|
|
1175
|
+
(t instanceof HTMLCollection || t instanceof NodeList) && (t = Array.from(t)), n = be(n), t = be(t);
|
|
1187
1176
|
for (const i of t)
|
|
1188
1177
|
if (i)
|
|
1189
1178
|
for (const l of n)
|
|
@@ -1192,7 +1181,7 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1192
1181
|
var t;
|
|
1193
1182
|
const { clientX: n, clientY: o, target: s } = ((t = e.touches) == null ? void 0 : t[0]) ?? e;
|
|
1194
1183
|
return { x: n, y: o, target: s };
|
|
1195
|
-
}, W = (e, t = document) =>
|
|
1184
|
+
}, W = (e, t = document) => be(e).map(
|
|
1196
1185
|
(n) => typeof n == "string" ? Array.from(t.querySelectorAll(n)) : n instanceof Element ? n : null
|
|
1197
1186
|
).flat().filter(Boolean), on = (e, t) => t.some((n) => typeof n == "number" ? e.button === n : typeof n == "object" ? n.button !== e.button ? !1 : n.modifiers.every((o) => {
|
|
1198
1187
|
switch (o) {
|
|
@@ -1273,15 +1262,15 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1273
1262
|
s(n, "mousedown", this._onTapStart), o.touch && s(n, "touchstart", this._onTapStart, { passive: !1 });
|
|
1274
1263
|
}
|
|
1275
1264
|
_onTapStart(t, n = !1) {
|
|
1276
|
-
const { x: o, y: s, target: i } = te(t), { document: l, startAreas: r, boundaries: c, features: d, behaviour: f } = this._options,
|
|
1265
|
+
const { x: o, y: s, target: i } = te(t), { document: l, startAreas: r, boundaries: c, features: d, behaviour: f } = this._options, u = i.getBoundingClientRect();
|
|
1277
1266
|
if (t instanceof MouseEvent && !on(t, f.triggers))
|
|
1278
1267
|
return;
|
|
1279
|
-
const g = W(r, l),
|
|
1280
|
-
this._targetElement =
|
|
1281
|
-
(
|
|
1268
|
+
const g = W(r, l), y = W(c, l);
|
|
1269
|
+
this._targetElement = y.find(
|
|
1270
|
+
(h) => Ie(h.getBoundingClientRect(), u)
|
|
1282
1271
|
);
|
|
1283
|
-
const p = t.composedPath(), m = g.find((
|
|
1284
|
-
if (this._targetBoundary =
|
|
1272
|
+
const p = t.composedPath(), m = g.find((h) => p.includes(h));
|
|
1273
|
+
if (this._targetBoundary = y.find((h) => p.includes(h)), !this._targetElement || !m || !this._targetBoundary || !n && this._emitEvent("beforestart", t) === !1)
|
|
1285
1274
|
return;
|
|
1286
1275
|
this._areaLocation = { x1: o, y1: s, x2: 0, y2: 0 };
|
|
1287
1276
|
const a = l.scrollingElement ?? l.body;
|
|
@@ -1296,8 +1285,8 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1296
1285
|
this.resolveSelectables();
|
|
1297
1286
|
const { x: r, y: c } = s;
|
|
1298
1287
|
i = this._selectables.find((d) => {
|
|
1299
|
-
const { right: f, left:
|
|
1300
|
-
return r < f && r >
|
|
1288
|
+
const { right: f, left: u, top: g, bottom: y } = d.getBoundingClientRect();
|
|
1289
|
+
return r < f && r > u && c < y && c > g;
|
|
1301
1290
|
});
|
|
1302
1291
|
}
|
|
1303
1292
|
if (!i)
|
|
@@ -1312,7 +1301,7 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1312
1301
|
const { stored: l } = this._selection;
|
|
1313
1302
|
if (this._emitEvent("start", t), t.shiftKey && o && this._latestElement) {
|
|
1314
1303
|
const r = this._latestElement, [c, d] = r.compareDocumentPosition(i) & 4 ? [i, r] : [r, i], f = [...this._selectables.filter(
|
|
1315
|
-
(
|
|
1304
|
+
(u) => u.compareDocumentPosition(c) & 4 && u.compareDocumentPosition(d) & 2
|
|
1316
1305
|
), c, d];
|
|
1317
1306
|
this.select(f), this._latestElement = r;
|
|
1318
1307
|
} else
|
|
@@ -1362,8 +1351,8 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1362
1351
|
this._scrollingActive = !1;
|
|
1363
1352
|
return;
|
|
1364
1353
|
}
|
|
1365
|
-
const { scrollTop:
|
|
1366
|
-
n.y && (r.scrollTop += Ge(n.y / l), o.y1 -= r.scrollTop -
|
|
1354
|
+
const { scrollTop: u, scrollLeft: g } = r;
|
|
1355
|
+
n.y && (r.scrollTop += Ge(n.y / l), o.y1 -= r.scrollTop - u), n.x && (r.scrollLeft += Ge(n.x / l), o.x1 -= r.scrollLeft - g), i.next(t), requestAnimationFrame(f);
|
|
1367
1356
|
};
|
|
1368
1357
|
requestAnimationFrame(f);
|
|
1369
1358
|
} else
|
|
@@ -1395,12 +1384,12 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1395
1384
|
});
|
|
1396
1385
|
}
|
|
1397
1386
|
_recalculateSelectionAreaRect() {
|
|
1398
|
-
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, { scrollTop: i, scrollHeight: l, clientHeight: r, scrollLeft: c, scrollWidth: d, clientWidth: f } = o,
|
|
1387
|
+
const { _scrollSpeed: t, _areaLocation: n, _targetElement: o, _options: s } = this, { scrollTop: i, scrollHeight: l, clientHeight: r, scrollLeft: c, scrollWidth: d, clientWidth: f } = o, u = this._targetRect, { x1: g, y1: y } = n;
|
|
1399
1388
|
let { x2: p, y2: m } = n;
|
|
1400
1389
|
const { behaviour: { scrolling: { startScrollMargins: a } } } = s;
|
|
1401
|
-
p <
|
|
1402
|
-
const
|
|
1403
|
-
this._areaRect = Fe(
|
|
1390
|
+
p < u.left + a.x ? (t.x = c ? -R(u.left - p + a.x) : 0, p = p < u.left ? u.left : p) : p > u.right - a.x ? (t.x = d - c - f ? R(u.left + u.width - p - a.x) : 0, p = p > u.right ? u.right : p) : t.x = 0, m < u.top + a.y ? (t.y = i ? -R(u.top - m + a.y) : 0, m = m < u.top ? u.top : m) : m > u.bottom - a.y ? (t.y = l - i - r ? R(u.top + u.height - m - a.y) : 0, m = m > u.bottom ? u.bottom : m) : t.y = 0;
|
|
1391
|
+
const h = Ke(g, p), v = Ke(y, m), w = We(g, p), C = We(y, m);
|
|
1392
|
+
this._areaRect = Fe(h, v, w - h, C - v);
|
|
1404
1393
|
}
|
|
1405
1394
|
_redrawSelectionArea() {
|
|
1406
1395
|
const { x: t, y: n, width: o, height: s } = this._areaRect, { style: i } = this._area;
|
|
@@ -1412,29 +1401,29 @@ const Re = (e, t = "px") => typeof e == "number" ? e + t : e, j = ({ style: e },
|
|
|
1412
1401
|
M(this._targetElement, "scroll", this._onStartAreaScroll), M(s, ["mousemove", "touchmove"], this._delayedTapMove), M(s, ["touchmove", "mousemove"], this._onTapMove), M(s, ["mouseup", "touchcancel", "touchend"], this._onTapStop), M(s, "scroll", this._onScroll), this._keepSelection(), t && l && i.singleTap.allow ? this._onSingleTap(t) : !l && !n && (this._updateElementSelection(), this._emitEvent("stop", t)), this._scrollSpeed.x = 0, this._scrollSpeed.y = 0, M(this._targetElement, "wheel", this._wheelScroll, { passive: !0 }), M(this._options.document, "keydown", this._keyboardScroll, { passive: !0 }), this._clippingElement.remove(), (o = this._frame) == null || o.cancel(), j(this._area, "display", "none");
|
|
1413
1402
|
}
|
|
1414
1403
|
_updateElementSelection() {
|
|
1415
|
-
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: r } = o, { intersect: c, overlap: d } = n.behaviour, f = d === "invert",
|
|
1404
|
+
const { _selectables: t, _options: n, _selection: o, _areaRect: s } = this, { stored: i, selected: l, touched: r } = o, { intersect: c, overlap: d } = n.behaviour, f = d === "invert", u = [], g = [], y = [];
|
|
1416
1405
|
for (let m = 0; m < t.length; m++) {
|
|
1417
1406
|
const a = t[m];
|
|
1418
1407
|
if (Ie(s, a.getBoundingClientRect(), c)) {
|
|
1419
1408
|
if (l.includes(a))
|
|
1420
1409
|
i.includes(a) && !r.includes(a) && r.push(a);
|
|
1421
1410
|
else if (f && i.includes(a)) {
|
|
1422
|
-
|
|
1411
|
+
y.push(a);
|
|
1423
1412
|
continue;
|
|
1424
1413
|
} else
|
|
1425
1414
|
g.push(a);
|
|
1426
|
-
|
|
1415
|
+
u.push(a);
|
|
1427
1416
|
}
|
|
1428
1417
|
}
|
|
1429
1418
|
f && g.push(...i.filter((m) => !l.includes(m)));
|
|
1430
1419
|
const p = d === "keep";
|
|
1431
1420
|
for (let m = 0; m < l.length; m++) {
|
|
1432
1421
|
const a = l[m];
|
|
1433
|
-
!
|
|
1422
|
+
!u.includes(a) && !// Check if the user wants to keep previously selected elements, e.g.,
|
|
1434
1423
|
// not make them part of the current selection as soon as they're touched.
|
|
1435
|
-
(p && i.includes(a)) &&
|
|
1424
|
+
(p && i.includes(a)) && y.push(a);
|
|
1436
1425
|
}
|
|
1437
|
-
o.selected =
|
|
1426
|
+
o.selected = u, o.changed = { added: g, removed: y }, this._latestElement = void 0;
|
|
1438
1427
|
}
|
|
1439
1428
|
_emitEvent(t, n) {
|
|
1440
1429
|
return this.emit(t, {
|
|
@@ -1745,13 +1734,13 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1745
1734
|
const { grp: i, top: l } = e.createWrapper(s);
|
|
1746
1735
|
return rt(e, t, i), { newTop: l, newNodeObj: s };
|
|
1747
1736
|
}, gn = function(e, t, n) {
|
|
1748
|
-
var d, f,
|
|
1737
|
+
var d, f, u, g;
|
|
1749
1738
|
const o = t || this.currentNode;
|
|
1750
1739
|
if (!o)
|
|
1751
1740
|
return;
|
|
1752
1741
|
const s = o.nodeObj;
|
|
1753
1742
|
if (s.parent) {
|
|
1754
|
-
if (!((d = s.parent) != null && d.parent) && ((
|
|
1743
|
+
if (!((d = s.parent) != null && d.parent) && ((u = (f = s.parent) == null ? void 0 : f.children) == null ? void 0 : u.length) === 1 && this.direction === 2) {
|
|
1755
1744
|
this.addChild(this.findEle(s.parent.id), n);
|
|
1756
1745
|
return;
|
|
1757
1746
|
}
|
|
@@ -1761,8 +1750,8 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1761
1750
|
}
|
|
1762
1751
|
const i = n || this.generateNewObj();
|
|
1763
1752
|
if (!((g = s.parent) != null && g.parent)) {
|
|
1764
|
-
const
|
|
1765
|
-
i.direction =
|
|
1753
|
+
const y = o.closest("me-main").className === D.LHS ? 0 : 1;
|
|
1754
|
+
i.direction = y;
|
|
1766
1755
|
}
|
|
1767
1756
|
dn(i, e, s), B(this.nodeData);
|
|
1768
1757
|
const l = o.parentElement, { grp: r, top: c } = this.createWrapper(i);
|
|
@@ -1800,7 +1789,7 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1800
1789
|
name: "addChild",
|
|
1801
1790
|
obj: i
|
|
1802
1791
|
}), t || this.editTopic(s.firstChild), this.selectNode(s.firstChild, !0);
|
|
1803
|
-
},
|
|
1792
|
+
}, yn = function(e, t) {
|
|
1804
1793
|
const n = Ee(e.nodeObj);
|
|
1805
1794
|
Ce(n);
|
|
1806
1795
|
const o = _e(this, t, n);
|
|
@@ -1811,7 +1800,7 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1811
1800
|
name: "copyNode",
|
|
1812
1801
|
obj: s
|
|
1813
1802
|
});
|
|
1814
|
-
},
|
|
1803
|
+
}, bn = function(e, t) {
|
|
1815
1804
|
e = de(e);
|
|
1816
1805
|
const n = [];
|
|
1817
1806
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -1906,8 +1895,8 @@ const un = function({ map: e, direction: t }, n) {
|
|
|
1906
1895
|
__proto__: null,
|
|
1907
1896
|
addChild: vn,
|
|
1908
1897
|
beginEdit: kn,
|
|
1909
|
-
copyNode:
|
|
1910
|
-
copyNodes:
|
|
1898
|
+
copyNode: yn,
|
|
1899
|
+
copyNodes: bn,
|
|
1911
1900
|
insertParent: mn,
|
|
1912
1901
|
insertSibling: gn,
|
|
1913
1902
|
moveDownNode: xn,
|
|
@@ -1958,8 +1947,8 @@ const Ln = function(e) {
|
|
|
1958
1947
|
}, Bn = function(e, t = { x: 0, y: 0 }) {
|
|
1959
1948
|
if (e < this.scaleMin || e > this.scaleMax)
|
|
1960
1949
|
return;
|
|
1961
|
-
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = dt(this), r = this.map.style.transform, { x: c, y: d } = Xe(r), f = c - i,
|
|
1962
|
-
this.map.style.transform = `translate(${c -
|
|
1950
|
+
const n = this.container.getBoundingClientRect(), o = t.x ? t.x - n.left - n.width / 2 : 0, s = t.y ? t.y - n.top - n.height / 2 : 0, { dx: i, dy: l } = dt(this), r = this.map.style.transform, { x: c, y: d } = Xe(r), f = c - i, u = d - l, g = this.scaleVal, y = (-o + f) * (1 - e / g), p = (-s + u) * (1 - e / g);
|
|
1951
|
+
this.map.style.transform = `translate(${c - y}px, ${d - p}px) scale(${e})`, this.scaleVal = e, this.bus.fire("scale", e);
|
|
1963
1952
|
}, Rn = function() {
|
|
1964
1953
|
const e = this.nodes.offsetHeight / this.container.offsetHeight, t = this.nodes.offsetWidth / this.container.offsetWidth, n = 1 / Math.max(1, Math.max(e, t));
|
|
1965
1954
|
this.scaleVal = n, this.map.style.transform = "scale(" + n + ")", this.bus.fire("scale", n);
|
|
@@ -1998,10 +1987,10 @@ const Ln = function(e) {
|
|
|
1998
1987
|
y: o.top
|
|
1999
1988
|
}, i = e.parentNode, l = i.children[1];
|
|
2000
1989
|
if (l.expanded = n.expanded, l.className = n.expanded ? "minus" : "", Z(e), n.expanded) {
|
|
2001
|
-
const
|
|
1990
|
+
const u = this.createChildren(
|
|
2002
1991
|
n.children.map((g) => this.createWrapper(g).grp)
|
|
2003
1992
|
);
|
|
2004
|
-
i.parentNode.appendChild(
|
|
1993
|
+
i.parentNode.appendChild(u);
|
|
2005
1994
|
} else
|
|
2006
1995
|
i.parentNode.children[1].remove();
|
|
2007
1996
|
this.linkDiv(e.closest("me-main > me-wrapper"));
|
|
@@ -2110,29 +2099,29 @@ function ze(e, t, n, o, s, i, l, r, c, d) {
|
|
|
2110
2099
|
const a = d.style;
|
|
2111
2100
|
a.stroke && e.line.setAttribute("stroke", a.stroke), a.strokeWidth && e.line.setAttribute("stroke-width", String(a.strokeWidth)), a.strokeDasharray && e.line.setAttribute("stroke-dasharray", a.strokeDasharray), a.strokeLinecap && e.line.setAttribute("stroke-linecap", a.strokeLinecap), a.opacity !== void 0 && e.line.setAttribute("opacity", String(a.opacity));
|
|
2112
2101
|
}
|
|
2113
|
-
const
|
|
2114
|
-
|
|
2102
|
+
const u = e.querySelectorAll('path[stroke="transparent"]');
|
|
2103
|
+
u.length > 0 && u[0].setAttribute("d", f);
|
|
2115
2104
|
const g = re(i, l, r, c);
|
|
2116
2105
|
if (g) {
|
|
2117
2106
|
const a = `M ${g.x1} ${g.y1} L ${r} ${c} L ${g.x2} ${g.y2}`;
|
|
2118
|
-
if (e.arrow1.setAttribute("d", a),
|
|
2119
|
-
const
|
|
2120
|
-
|
|
2107
|
+
if (e.arrow1.setAttribute("d", a), u.length > 1 && u[1].setAttribute("d", a), d.style) {
|
|
2108
|
+
const h = d.style;
|
|
2109
|
+
h.stroke && e.arrow1.setAttribute("stroke", h.stroke), h.strokeWidth && e.arrow1.setAttribute("stroke-width", String(h.strokeWidth)), h.strokeLinecap && e.arrow1.setAttribute("stroke-linecap", h.strokeLinecap), h.opacity !== void 0 && e.arrow1.setAttribute("opacity", String(h.opacity));
|
|
2121
2110
|
}
|
|
2122
2111
|
}
|
|
2123
2112
|
if (d.bidirectional) {
|
|
2124
2113
|
const a = re(o, s, t, n);
|
|
2125
2114
|
if (a) {
|
|
2126
|
-
const
|
|
2127
|
-
if (e.arrow2.setAttribute("d",
|
|
2115
|
+
const h = `M ${a.x1} ${a.y1} L ${t} ${n} L ${a.x2} ${a.y2}`;
|
|
2116
|
+
if (e.arrow2.setAttribute("d", h), u.length > 2 && u[2].setAttribute("d", h), d.style) {
|
|
2128
2117
|
const v = d.style;
|
|
2129
2118
|
v.stroke && e.arrow2.setAttribute("stroke", v.stroke), v.strokeWidth && e.arrow2.setAttribute("stroke-width", String(v.strokeWidth)), v.strokeLinecap && e.arrow2.setAttribute("stroke-linecap", v.strokeLinecap), v.opacity !== void 0 && e.arrow2.setAttribute("opacity", String(v.opacity));
|
|
2130
2119
|
}
|
|
2131
2120
|
}
|
|
2132
2121
|
}
|
|
2133
|
-
const { x:
|
|
2134
|
-
if (e.labelEl && to(e.labelEl,
|
|
2135
|
-
const a = e.
|
|
2122
|
+
const { x: y, y: p } = ht(t, n, o, s, i, l, r, c);
|
|
2123
|
+
if (e.labelEl && to(e.labelEl, y, p), (m = d.style) != null && m.labelColor) {
|
|
2124
|
+
const a = e.labelEl;
|
|
2136
2125
|
a && (a.style.color = d.style.labelColor);
|
|
2137
2126
|
}
|
|
2138
2127
|
ao(e);
|
|
@@ -2157,29 +2146,29 @@ function G(e) {
|
|
|
2157
2146
|
};
|
|
2158
2147
|
}
|
|
2159
2148
|
const Te = function(e, t, n, o, s) {
|
|
2160
|
-
var
|
|
2149
|
+
var E;
|
|
2161
2150
|
if (!t || !n)
|
|
2162
2151
|
return;
|
|
2163
|
-
const i = ae(e, t, o.delta1), l = ae(e, n, o.delta2), { x: r, y: c } = G(i), { ctrlX: d, ctrlY: f } = i, { ctrlX:
|
|
2152
|
+
const i = ae(e, t, o.delta1), l = ae(e, n, o.delta2), { x: r, y: c } = G(i), { ctrlX: d, ctrlY: f } = i, { ctrlX: u, ctrlY: g } = l, { x: y, y: p } = G(l), m = re(u, g, y, p);
|
|
2164
2153
|
if (!m)
|
|
2165
2154
|
return;
|
|
2166
|
-
const a = `M ${m.x1} ${m.y1} L ${
|
|
2167
|
-
let
|
|
2155
|
+
const a = `M ${m.x1} ${m.y1} L ${y} ${p} L ${m.x2} ${m.y2}`;
|
|
2156
|
+
let h = "";
|
|
2168
2157
|
if (o.bidirectional) {
|
|
2169
2158
|
const N = re(d, f, r, c);
|
|
2170
2159
|
if (!N)
|
|
2171
2160
|
return;
|
|
2172
|
-
|
|
2161
|
+
h = `M ${N.x1} ${N.y1} L ${r} ${c} L ${N.x2} ${N.y2}`;
|
|
2173
2162
|
}
|
|
2174
|
-
const v = Pt(`M ${r} ${c} C ${d} ${f} ${
|
|
2175
|
-
v.id =
|
|
2176
|
-
const
|
|
2163
|
+
const v = Pt(`M ${r} ${c} C ${d} ${f} ${u} ${g} ${y} ${p}`, a, h, o.style), { x: w, y: C } = ht(r, c, d, f, u, g, y, p), S = ((E = o.style) == null ? void 0 : E.labelColor) || "rgb(235, 95, 82)", b = "arrow-" + o.id;
|
|
2164
|
+
v.id = b;
|
|
2165
|
+
const x = me(o.label, w, C, {
|
|
2177
2166
|
anchor: "middle",
|
|
2178
|
-
color:
|
|
2179
|
-
dataType: "
|
|
2180
|
-
svgId:
|
|
2167
|
+
color: S,
|
|
2168
|
+
dataType: "arrow",
|
|
2169
|
+
svgId: b
|
|
2181
2170
|
});
|
|
2182
|
-
v.labelEl =
|
|
2171
|
+
v.labelEl = x, v.arrowObj = o, v.dataset.linkid = o.id, e.labelContainer.appendChild(x), e.linkSvgGroup.appendChild(v), he(x), s || (e.arrows.push(o), e.currentArrow = v, ut(e, o, i, l));
|
|
2183
2172
|
}, no = function(e, t, n = {}) {
|
|
2184
2173
|
const o = {
|
|
2185
2174
|
id: I(),
|
|
@@ -2259,19 +2248,19 @@ const Te = function(e, t, n, o, s) {
|
|
|
2259
2248
|
var t, n;
|
|
2260
2249
|
(t = e.helper1) == null || t.destroy(), (n = e.helper2) == null || n.destroy(), e.linkController.style.display = "none", e.P2.style.display = "none", e.P3.style.display = "none", e.currentArrow && co(e.currentArrow);
|
|
2261
2250
|
}, ut = function(e, t, n, o) {
|
|
2262
|
-
const { linkController: s, P2: i, P3: l, line1: r, line2: c, nodes: d, map: f, currentArrow:
|
|
2263
|
-
if (!
|
|
2251
|
+
const { linkController: s, P2: i, P3: l, line1: r, line2: c, nodes: d, map: f, currentArrow: u, bus: g } = e;
|
|
2252
|
+
if (!u)
|
|
2264
2253
|
return;
|
|
2265
|
-
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", d.appendChild(s), d.appendChild(i), d.appendChild(l), lo(
|
|
2266
|
-
let { x:
|
|
2267
|
-
i.style.cssText = `top:${a}px;left:${m}px;`, l.style.cssText = `top:${v}px;left:${
|
|
2268
|
-
m = m +
|
|
2269
|
-
const
|
|
2270
|
-
|
|
2271
|
-
}), e.helper2.init(f, (
|
|
2272
|
-
|
|
2273
|
-
const
|
|
2274
|
-
|
|
2254
|
+
s.style.display = "initial", i.style.display = "initial", l.style.display = "initial", d.appendChild(s), d.appendChild(i), d.appendChild(l), lo(u, eo);
|
|
2255
|
+
let { x: y, y: p } = G(n), { ctrlX: m, ctrlY: a } = n, { ctrlX: h, ctrlY: v } = o, { x: w, y: C } = G(o);
|
|
2256
|
+
i.style.cssText = `top:${a}px;left:${m}px;`, l.style.cssText = `top:${v}px;left:${h}px;`, ne(r, y, p, m, a), ne(c, h, v, w, C), e.helper1 = qe.create(i), e.helper2 = qe.create(l), e.helper1.init(f, (S, b) => {
|
|
2257
|
+
m = m + S / e.scaleVal, a = a + b / e.scaleVal;
|
|
2258
|
+
const x = G({ ...n, ctrlX: m, ctrlY: a });
|
|
2259
|
+
y = x.x, p = x.y, i.style.top = a + "px", i.style.left = m + "px", ze(u, y, p, m, a, h, v, w, C, t), ne(r, y, p, m, a), t.delta1.x = m - n.cx, t.delta1.y = a - n.cy, g.fire("updateArrowDelta", t);
|
|
2260
|
+
}), e.helper2.init(f, (S, b) => {
|
|
2261
|
+
h = h + S / e.scaleVal, v = v + b / e.scaleVal;
|
|
2262
|
+
const x = G({ ...o, ctrlX: h, ctrlY: v });
|
|
2263
|
+
w = x.x, C = x.y, l.style.top = v + "px", l.style.left = h + "px", ze(u, y, p, m, a, h, v, w, C, t), ne(c, h, v, w, C), t.delta2.x = h - o.cx, t.delta2.y = v - o.cy, g.fire("updateArrowDelta", t);
|
|
2275
2264
|
});
|
|
2276
2265
|
};
|
|
2277
2266
|
function ho() {
|
|
@@ -2306,23 +2295,23 @@ const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2306
2295
|
if (e.length === 0)
|
|
2307
2296
|
throw new Error("No selected node.");
|
|
2308
2297
|
if (e.length === 1) {
|
|
2309
|
-
const f = e[0].nodeObj,
|
|
2310
|
-
if (!
|
|
2298
|
+
const f = e[0].nodeObj, u = e[0].nodeObj.parent;
|
|
2299
|
+
if (!u)
|
|
2311
2300
|
throw new Error("Can not select root node.");
|
|
2312
|
-
const g =
|
|
2301
|
+
const g = u.children.findIndex((y) => f === y);
|
|
2313
2302
|
return {
|
|
2314
|
-
parent:
|
|
2303
|
+
parent: u.id,
|
|
2315
2304
|
start: g,
|
|
2316
2305
|
end: g
|
|
2317
2306
|
};
|
|
2318
2307
|
}
|
|
2319
2308
|
let t = 0;
|
|
2320
2309
|
const n = e.map((f) => {
|
|
2321
|
-
let
|
|
2310
|
+
let u = f.nodeObj;
|
|
2322
2311
|
const g = [];
|
|
2323
|
-
for (;
|
|
2324
|
-
const
|
|
2325
|
-
|
|
2312
|
+
for (; u.parent; ) {
|
|
2313
|
+
const y = u.parent, p = y.children, m = p == null ? void 0 : p.indexOf(u);
|
|
2314
|
+
u = y, g.unshift({ node: u, index: m });
|
|
2326
2315
|
}
|
|
2327
2316
|
return g.length > t && (t = g.length), g;
|
|
2328
2317
|
});
|
|
@@ -2330,8 +2319,8 @@ const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2330
2319
|
e:
|
|
2331
2320
|
for (; o < t; o++) {
|
|
2332
2321
|
const f = (c = n[0][o]) == null ? void 0 : c.node;
|
|
2333
|
-
for (let
|
|
2334
|
-
if (((d = n[
|
|
2322
|
+
for (let u = 1; u < n.length; u++)
|
|
2323
|
+
if (((d = n[u][o]) == null ? void 0 : d.node) !== f)
|
|
2335
2324
|
break e;
|
|
2336
2325
|
}
|
|
2337
2326
|
if (!o)
|
|
@@ -2356,27 +2345,27 @@ const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2356
2345
|
"stroke-linecap": "round",
|
|
2357
2346
|
"stroke-width": "2"
|
|
2358
2347
|
}), n;
|
|
2359
|
-
}, vo = (e) => e.parentElement.parentElement,
|
|
2348
|
+
}, vo = (e) => e.parentElement.parentElement, yo = function(e, { parent: t, start: n }) {
|
|
2360
2349
|
const o = e.findEle(t), s = o.nodeObj;
|
|
2361
2350
|
let i;
|
|
2362
2351
|
return s.parent ? i = o.closest("me-main").className : i = e.findEle(s.children[n].id).closest("me-main").className, i;
|
|
2363
2352
|
}, Le = function(e, t) {
|
|
2364
2353
|
var V;
|
|
2365
|
-
const { id: n, label: o, parent: s, start: i, end: l, style: r } = t, { nodes: c, theme: d, summarySvg: f } = e, g = e.findEle(s).nodeObj,
|
|
2366
|
-
let p = 1 / 0, m = 0, a = 0,
|
|
2354
|
+
const { id: n, label: o, parent: s, start: i, end: l, style: r } = t, { nodes: c, theme: d, summarySvg: f } = e, g = e.findEle(s).nodeObj, y = yo(e, t);
|
|
2355
|
+
let p = 1 / 0, m = 0, a = 0, h = 0;
|
|
2367
2356
|
for (let U = i; U <= l; U++) {
|
|
2368
2357
|
const Ae = (V = g.children) == null ? void 0 : V[U];
|
|
2369
2358
|
if (!Ae)
|
|
2370
2359
|
return e.removeSummary(n), null;
|
|
2371
2360
|
const Q = vo(e.findEle(Ae.id)), { offsetLeft: ee, offsetTop: Me } = O(c, Q), De = i === l ? 10 : 20;
|
|
2372
|
-
U === i && (a = Me + De), U === l && (
|
|
2373
|
-
}
|
|
2374
|
-
let v,
|
|
2375
|
-
const
|
|
2376
|
-
|
|
2377
|
-
const A = mo(
|
|
2378
|
-
return A.appendChild(v), e.labelContainer.appendChild(
|
|
2379
|
-
},
|
|
2361
|
+
U === i && (a = Me + De), U === l && (h = Me + Q.offsetHeight - De), ee < p && (p = ee), Q.offsetWidth + ee > m && (m = Q.offsetWidth + ee);
|
|
2362
|
+
}
|
|
2363
|
+
let v, w;
|
|
2364
|
+
const C = g.parent ? 10 : 0, S = a + C, b = h + C, x = (S + b) / 2, E = (r == null ? void 0 : r.stroke) || d.cssVar["--color"], N = (r == null ? void 0 : r.labelColor) || d.cssVar["--color"], L = "s-" + n;
|
|
2365
|
+
y === D.LHS ? (v = Ve(`M ${p + 10} ${S} c -5 0 -10 5 -10 10 L ${p} ${b - 10} c 0 5 5 10 10 10 M ${p} ${x} h -10`, E), w = me(o, p - 20, x, { anchor: "end", color: N, dataType: "summary", svgId: L })) : (v = Ve(`M ${m - 10} ${S} c 5 0 10 5 10 10 L ${m} ${b - 10} c 0 5 -5 10 -10 10 M ${m} ${x} h 10`, E), w = me(o, m + 20, x, { anchor: "start", color: N, dataType: "summary", svgId: L }));
|
|
2366
|
+
const A = mo(L);
|
|
2367
|
+
return A.appendChild(v), e.labelContainer.appendChild(w), he(w), A.summaryObj = t, A.labelEl = w, f.appendChild(A), A;
|
|
2368
|
+
}, bo = function(e = {}) {
|
|
2380
2369
|
if (!this.currentNodes)
|
|
2381
2370
|
return;
|
|
2382
2371
|
const { currentNodes: t, summaries: n, bus: o } = this, { parent: s, start: i, end: l } = go(t), r = { id: I(), parent: s, start: i, end: l, label: "summary", style: e.style }, c = Le(this, r);
|
|
@@ -2414,19 +2403,19 @@ const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2414
2403
|
e && e.labelEl && et(this, e.labelEl, e.summaryObj);
|
|
2415
2404
|
}, ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2416
2405
|
__proto__: null,
|
|
2417
|
-
createSummary:
|
|
2406
|
+
createSummary: bo,
|
|
2418
2407
|
createSummaryFrom: wo,
|
|
2419
2408
|
editSummary: No,
|
|
2420
2409
|
removeSummary: xo,
|
|
2421
2410
|
renderSummary: So,
|
|
2422
2411
|
selectSummary: Co,
|
|
2423
2412
|
unselectSummary: Eo
|
|
2424
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2413
|
+
}, Symbol.toStringTag, { value: "Module" })), T = "http://www.w3.org/2000/svg";
|
|
2425
2414
|
function _o(e, t) {
|
|
2426
|
-
const n = document.createElementNS(
|
|
2415
|
+
const n = document.createElementNS(T, "svg");
|
|
2427
2416
|
return k(n, {
|
|
2428
2417
|
version: "1.1",
|
|
2429
|
-
xmlns:
|
|
2418
|
+
xmlns: T,
|
|
2430
2419
|
height: e,
|
|
2431
2420
|
width: t
|
|
2432
2421
|
}), n;
|
|
@@ -2435,11 +2424,11 @@ function To(e, t) {
|
|
|
2435
2424
|
return (parseInt(e) - parseInt(t)) / 2;
|
|
2436
2425
|
}
|
|
2437
2426
|
function Lo(e, t, n, o) {
|
|
2438
|
-
const s = document.createElementNS(
|
|
2427
|
+
const s = document.createElementNS(T, "g");
|
|
2439
2428
|
let i = "";
|
|
2440
2429
|
return e.text ? i = e.text.textContent : i = e.childNodes[0].textContent, i.split(`
|
|
2441
2430
|
`).forEach((r, c) => {
|
|
2442
|
-
const d = document.createElementNS(
|
|
2431
|
+
const d = document.createElementNS(T, "text");
|
|
2443
2432
|
k(d, {
|
|
2444
2433
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2445
2434
|
y: o + parseInt(t.paddingTop) + To(t.lineHeight, t.fontSize) * (c + 1) + parseFloat(t.fontSize) * (c + 1) + "",
|
|
@@ -2455,7 +2444,7 @@ function Ao(e, t, n, o) {
|
|
|
2455
2444
|
var r;
|
|
2456
2445
|
let s = "";
|
|
2457
2446
|
(r = e.nodeObj) != null && r.dangerouslySetInnerHTML ? s = e.nodeObj.dangerouslySetInnerHTML : e.text ? s = e.text.textContent : s = e.childNodes[0].textContent;
|
|
2458
|
-
const i = document.createElementNS(
|
|
2447
|
+
const i = document.createElementNS(T, "foreignObject");
|
|
2459
2448
|
k(i, {
|
|
2460
2449
|
x: n + parseInt(t.paddingLeft) + "",
|
|
2461
2450
|
y: o + parseInt(t.paddingTop) + "",
|
|
@@ -2469,7 +2458,7 @@ function Ao(e, t, n, o) {
|
|
|
2469
2458
|
}), l.innerHTML = s, i.appendChild(l), i;
|
|
2470
2459
|
}
|
|
2471
2460
|
function Mo(e, t) {
|
|
2472
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(
|
|
2461
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(T, "rect");
|
|
2473
2462
|
return k(i, {
|
|
2474
2463
|
x: o + "",
|
|
2475
2464
|
y: s + "",
|
|
@@ -2483,7 +2472,7 @@ function Mo(e, t) {
|
|
|
2483
2472
|
}), i;
|
|
2484
2473
|
}
|
|
2485
2474
|
function oe(e, t, n = !1) {
|
|
2486
|
-
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = O(e.nodes, t), l = document.createElementNS(
|
|
2475
|
+
const o = getComputedStyle(t), { offsetLeft: s, offsetTop: i } = O(e.nodes, t), l = document.createElementNS(T, "rect");
|
|
2487
2476
|
k(l, {
|
|
2488
2477
|
x: s + "",
|
|
2489
2478
|
y: i + "",
|
|
@@ -2495,13 +2484,13 @@ function oe(e, t, n = !1) {
|
|
|
2495
2484
|
stroke: o.borderColor,
|
|
2496
2485
|
"stroke-width": o.borderWidth
|
|
2497
2486
|
});
|
|
2498
|
-
const r = document.createElementNS(
|
|
2487
|
+
const r = document.createElementNS(T, "g");
|
|
2499
2488
|
r.appendChild(l);
|
|
2500
2489
|
let c;
|
|
2501
2490
|
return n ? c = Ao(t, o, s, i) : c = Lo(t, o, s, i), r.appendChild(c), r;
|
|
2502
2491
|
}
|
|
2503
2492
|
function Do(e, t) {
|
|
2504
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(
|
|
2493
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(T, "a"), l = document.createElementNS(T, "text");
|
|
2505
2494
|
return k(l, {
|
|
2506
2495
|
x: o + "",
|
|
2507
2496
|
y: s + parseInt(n.fontSize) + "",
|
|
@@ -2513,7 +2502,7 @@ function Do(e, t) {
|
|
|
2513
2502
|
}), l.innerHTML = t.textContent, i.appendChild(l), i.setAttribute("href", t.href), i;
|
|
2514
2503
|
}
|
|
2515
2504
|
function Po(e, t) {
|
|
2516
|
-
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(
|
|
2505
|
+
const n = getComputedStyle(t), { offsetLeft: o, offsetTop: s } = O(e.nodes, t), i = document.createElementNS(T, "image");
|
|
2517
2506
|
return k(i, {
|
|
2518
2507
|
x: o + "",
|
|
2519
2508
|
y: s + "",
|
|
@@ -2523,8 +2512,8 @@ function Po(e, t) {
|
|
|
2523
2512
|
}), i;
|
|
2524
2513
|
}
|
|
2525
2514
|
const se = 100, $o = '<?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">', Oo = (e, t = !1) => {
|
|
2526
|
-
var
|
|
2527
|
-
const n = e.nodes, o = n.offsetHeight + se * 2, s = n.offsetWidth + se * 2, i = _o(o + "px", s + "px"), l = document.createElementNS(
|
|
2515
|
+
var u, g, y;
|
|
2516
|
+
const n = e.nodes, o = n.offsetHeight + se * 2, s = n.offsetWidth + se * 2, i = _o(o + "px", s + "px"), l = document.createElementNS(T, "svg"), r = document.createElementNS(T, "rect");
|
|
2528
2517
|
k(r, {
|
|
2529
2518
|
x: "0",
|
|
2530
2519
|
y: "0",
|
|
@@ -2532,14 +2521,14 @@ const se = 100, $o = '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC
|
|
|
2532
2521
|
height: `${o}`,
|
|
2533
2522
|
fill: e.theme.cssVar["--bgcolor"]
|
|
2534
2523
|
}), i.appendChild(r), n.querySelectorAll(".subLines").forEach((p) => {
|
|
2535
|
-
const m = p.cloneNode(!0), { offsetLeft: a, offsetTop:
|
|
2536
|
-
m.setAttribute("x", `${a}`), m.setAttribute("y", `${
|
|
2524
|
+
const m = p.cloneNode(!0), { offsetLeft: a, offsetTop: h } = O(n, p.parentElement);
|
|
2525
|
+
m.setAttribute("x", `${a}`), m.setAttribute("y", `${h}`), l.appendChild(m);
|
|
2537
2526
|
});
|
|
2538
|
-
const c = (
|
|
2527
|
+
const c = (u = n.querySelector(".lines")) == null ? void 0 : u.cloneNode(!0);
|
|
2539
2528
|
c && l.appendChild(c);
|
|
2540
2529
|
const d = (g = n.querySelector(".topiclinks")) == null ? void 0 : g.cloneNode(!0);
|
|
2541
2530
|
d && l.appendChild(d);
|
|
2542
|
-
const f = (
|
|
2531
|
+
const f = (y = n.querySelector(".summary")) == null ? void 0 : y.cloneNode(!0);
|
|
2543
2532
|
return f && l.appendChild(f), n.querySelectorAll("me-tpc").forEach((p) => {
|
|
2544
2533
|
p.nodeObj.dangerouslySetInnerHTML ? l.appendChild(oe(e, p, !t)) : (l.appendChild(Mo(e, p)), l.appendChild(oe(e, p.text, !t)));
|
|
2545
2534
|
}), n.querySelectorAll(".tags > span").forEach((p) => {
|
|
@@ -2623,22 +2612,22 @@ const Wo = {
|
|
|
2623
2612
|
};
|
|
2624
2613
|
function Ko({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, containerHeight: d }) {
|
|
2625
2614
|
let f = t + n / 2;
|
|
2626
|
-
const
|
|
2615
|
+
const u = e + o / 2;
|
|
2627
2616
|
let g;
|
|
2628
2617
|
c === D.LHS ? g = i + l : g = i;
|
|
2629
|
-
const
|
|
2630
|
-
return c === D.LHS ? f = f - n / 10 - m : f = f + n / 10 + m, `M ${f} ${
|
|
2618
|
+
const y = s + r / 2, m = (1 - Math.abs(y - u) / d) * 0.25 * (n / 2);
|
|
2619
|
+
return c === D.LHS ? f = f - n / 10 - m : f = f + n / 10 + m, `M ${f} ${u} Q ${f} ${y} ${g} ${y}`;
|
|
2631
2620
|
}
|
|
2632
2621
|
function Go({ pT: e, pL: t, pW: n, pH: o, cT: s, cL: i, cW: l, cH: r, direction: c, isFirst: d }) {
|
|
2633
2622
|
const f = parseInt(this.container.style.getPropertyValue("--node-gap-x"));
|
|
2634
|
-
let
|
|
2635
|
-
d ?
|
|
2636
|
-
const
|
|
2623
|
+
let u = 0, g = 0;
|
|
2624
|
+
d ? u = e + o / 2 : u = e + o;
|
|
2625
|
+
const y = s + r;
|
|
2637
2626
|
let p = 0, m = 0, a = 0;
|
|
2638
|
-
const
|
|
2639
|
-
return c === D.LHS ? (a = t, p = a + f, m = a - f, g = i + f, `M ${p} ${
|
|
2627
|
+
const h = Math.abs(u - y) / 300 * f;
|
|
2628
|
+
return c === D.LHS ? (a = t, p = a + f, m = a - f, g = i + f, `M ${p} ${u} C ${a} ${u} ${a + h} ${y} ${m} ${y} H ${g}`) : (a = t + n, p = a - f, m = a + f, g = i + l - f, `M ${p} ${u} C ${a} ${u} ${a - h} ${y} ${m} ${y} H ${g}`);
|
|
2640
2629
|
}
|
|
2641
|
-
const Yo = "5.2.0
|
|
2630
|
+
const Yo = "5.2.0";
|
|
2642
2631
|
function qo(e) {
|
|
2643
2632
|
return {
|
|
2644
2633
|
x: 0,
|
|
@@ -2667,27 +2656,27 @@ function $({
|
|
|
2667
2656
|
mouseSelectionButton: c,
|
|
2668
2657
|
selectionContainer: d,
|
|
2669
2658
|
before: f,
|
|
2670
|
-
newTopicName:
|
|
2659
|
+
newTopicName: u,
|
|
2671
2660
|
allowUndo: g,
|
|
2672
|
-
generateMainBranch:
|
|
2661
|
+
generateMainBranch: y,
|
|
2673
2662
|
generateSubBranch: p,
|
|
2674
2663
|
overflowHidden: m,
|
|
2675
2664
|
theme: a,
|
|
2676
|
-
alignment:
|
|
2665
|
+
alignment: h,
|
|
2677
2666
|
scaleSensitivity: v,
|
|
2678
|
-
scaleMax:
|
|
2679
|
-
scaleMin:
|
|
2680
|
-
handleWheel:
|
|
2681
|
-
markdown:
|
|
2682
|
-
imageProxy:
|
|
2667
|
+
scaleMax: w,
|
|
2668
|
+
scaleMin: C,
|
|
2669
|
+
handleWheel: S,
|
|
2670
|
+
markdown: b,
|
|
2671
|
+
imageProxy: x
|
|
2683
2672
|
}) {
|
|
2684
|
-
let
|
|
2673
|
+
let E = null;
|
|
2685
2674
|
const N = Object.prototype.toString.call(e);
|
|
2686
|
-
if (N === "[object HTMLDivElement]" ?
|
|
2675
|
+
if (N === "[object HTMLDivElement]" ? E = e : N === "[object String]" && (E = document.querySelector(e)), !E)
|
|
2687
2676
|
throw new Error("MindElixir: el is not a valid element");
|
|
2688
|
-
|
|
2689
|
-
const
|
|
2690
|
-
this.theme = a || (
|
|
2677
|
+
E.style.position = "relative", E.innerHTML = "", this.el = E, this.disposable = [], this.before = f || {}, this.locale = n || "en", this.newTopicName = u || "New Node", this.contextMenu = i ?? !0, this.toolBar = l ?? !0, this.keypress = r ?? !0, this.mouseSelectionButton = c ?? 0, this.direction = t ?? 1, this.draggable = o ?? !0, this.editable = s ?? !0, this.allowUndo = g ?? !0, this.scaleSensitivity = v ?? 0.1, this.scaleMax = w ?? 1.4, this.scaleMin = C ?? 0.2, this.generateMainBranch = y || Ko, this.generateSubBranch = p || Go, this.overflowHidden = m ?? !1, this.alignment = h ?? "root", this.handleWheel = S ?? !0, this.markdown = b || void 0, this.imageProxy = x || void 0, this.currentNodes = [], this.currentArrow = null, this.scaleVal = 1, this.tempDirection = null, this.dragMoveHelper = qo(this), this.bus = St(), this.container = K.createElement("div"), this.selectionContainer = d || this.container, this.container.className = "map-container";
|
|
2678
|
+
const L = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2679
|
+
this.theme = a || (L.matches ? xe : we);
|
|
2691
2680
|
const A = K.createElement("div");
|
|
2692
2681
|
A.className = "map-canvas", this.map = A, this.container.setAttribute("tabindex", "0"), this.container.appendChild(this.map), this.el.appendChild(this.container), this.nodes = K.createElement("me-nodes"), this.lines = J("lines"), this.summarySvg = J("summary"), this.linkController = J("linkcontroller"), this.P2 = K.createElement("div"), this.P3 = K.createElement("div"), this.P2.className = this.P3.className = "circle", this.P2.style.display = this.P3.style.display = "none", this.line1 = Oe(), this.line2 = Oe(), this.linkController.appendChild(this.line1), this.linkController.appendChild(this.line2), this.linkSvgGroup = J("topiclinks"), this.labelContainer = K.createElement("div"), this.labelContainer.className = "label-container", this.map.appendChild(this.nodes), this.overflowHidden ? this.container.style.overflow = "hidden" : this.disposable.push(Et(this));
|
|
2693
2682
|
}
|