markmap-plus 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +1034 -1002
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2545 -2499
- package/package.json +4 -4
package/dist/browser/index.js
CHANGED
|
@@ -386,7 +386,6 @@
|
|
|
386
386
|
);
|
|
387
387
|
});
|
|
388
388
|
const jsCache = {};
|
|
389
|
-
const cssCache = {};
|
|
390
389
|
async function loadJSItem(item, context) {
|
|
391
390
|
var _a2;
|
|
392
391
|
const src = item.type === "script" && ((_a2 = item.data) == null ? void 0 : _a2.src) || "";
|
|
@@ -416,35 +415,6 @@
|
|
|
416
415
|
}
|
|
417
416
|
await item.loaded;
|
|
418
417
|
}
|
|
419
|
-
async function loadCSSItem(item) {
|
|
420
|
-
const url = item.type === "stylesheet" && item.data.href || "";
|
|
421
|
-
item.loaded || (item.loaded = cssCache[url]);
|
|
422
|
-
if (!item.loaded) {
|
|
423
|
-
const deferred = defer();
|
|
424
|
-
item.loaded = deferred.promise;
|
|
425
|
-
if (url) cssCache[url] = item.loaded;
|
|
426
|
-
if (item.type === "style") {
|
|
427
|
-
document.head.append(
|
|
428
|
-
hm("style", {
|
|
429
|
-
textContent: item.data
|
|
430
|
-
})
|
|
431
|
-
);
|
|
432
|
-
deferred.resolve();
|
|
433
|
-
} else if (url) {
|
|
434
|
-
document.head.append(
|
|
435
|
-
hm("link", {
|
|
436
|
-
rel: "stylesheet",
|
|
437
|
-
...item.data
|
|
438
|
-
})
|
|
439
|
-
);
|
|
440
|
-
fetch(url).then((res) => {
|
|
441
|
-
if (res.ok) return res.text();
|
|
442
|
-
throw res;
|
|
443
|
-
}).then(() => deferred.resolve(), deferred.reject);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
await item.loaded;
|
|
447
|
-
}
|
|
448
418
|
async function loadJS(items, context) {
|
|
449
419
|
items.forEach((item) => {
|
|
450
420
|
var _a2;
|
|
@@ -460,9 +430,6 @@
|
|
|
460
430
|
await loadJSItem(item, context);
|
|
461
431
|
}
|
|
462
432
|
}
|
|
463
|
-
async function loadCSS(items) {
|
|
464
|
-
await Promise.all(items.map((item) => loadCSSItem(item)));
|
|
465
|
-
}
|
|
466
433
|
function buildJSItem(path) {
|
|
467
434
|
return {
|
|
468
435
|
type: "script",
|
|
@@ -496,13 +463,70 @@
|
|
|
496
463
|
scripts: args.flatMap((arg) => (arg == null ? void 0 : arg.scripts) || [])
|
|
497
464
|
};
|
|
498
465
|
}
|
|
499
|
-
|
|
466
|
+
class Tt {
|
|
467
|
+
constructor() {
|
|
468
|
+
this.listeners = [];
|
|
469
|
+
}
|
|
470
|
+
tap(t) {
|
|
471
|
+
return this.listeners.push(t), () => this.revoke(t);
|
|
472
|
+
}
|
|
473
|
+
revoke(t) {
|
|
474
|
+
const e = this.listeners.indexOf(t);
|
|
475
|
+
e >= 0 && this.listeners.splice(e, 1);
|
|
476
|
+
}
|
|
477
|
+
revokeAll() {
|
|
478
|
+
this.listeners.splice(0);
|
|
479
|
+
}
|
|
480
|
+
call(...t) {
|
|
481
|
+
for (const e of this.listeners)
|
|
482
|
+
e(...t);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
const Mt = Math.random().toString(36).slice(2, 8);
|
|
486
|
+
let rt = 0;
|
|
487
|
+
function Bt() {
|
|
488
|
+
return rt += 1, `mm-${Mt}-${rt}`;
|
|
489
|
+
}
|
|
490
|
+
function B() {
|
|
491
|
+
}
|
|
492
|
+
function R(n, t) {
|
|
493
|
+
const e = (i, o) => t(
|
|
494
|
+
i,
|
|
495
|
+
() => {
|
|
496
|
+
var s;
|
|
497
|
+
return (s = i.children) == null ? void 0 : s.map((a) => e(a, i));
|
|
498
|
+
},
|
|
499
|
+
o
|
|
500
|
+
);
|
|
501
|
+
return e(n);
|
|
502
|
+
}
|
|
503
|
+
function Dt(n, ...t) {
|
|
504
|
+
const e = "".split(" ").filter(Boolean);
|
|
505
|
+
return t.forEach((i) => {
|
|
506
|
+
i && e.indexOf(i) < 0 && e.push(i);
|
|
507
|
+
}), e.join(" ");
|
|
508
|
+
}
|
|
509
|
+
function jt(n, t) {
|
|
510
|
+
const e = {
|
|
511
|
+
timer: 0
|
|
512
|
+
};
|
|
513
|
+
function i() {
|
|
514
|
+
e.timer && (window.clearTimeout(e.timer), e.timer = 0);
|
|
515
|
+
}
|
|
516
|
+
function o() {
|
|
517
|
+
i(), e.args && (e.result = n(...e.args));
|
|
518
|
+
}
|
|
519
|
+
return function(...a) {
|
|
520
|
+
return i(), e.args = a, e.timer = window.setTimeout(o, t), e.result;
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
const gt = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), ne = d32.scaleOrdinal(d32.schemeCategory10), mt = (n = 1, t = 3, e = 2) => (i) => n + t / e ** i.state.depth, yt = {
|
|
500
524
|
autoFit: false,
|
|
501
525
|
duration: 500,
|
|
502
526
|
embedGlobalCSS: true,
|
|
503
527
|
fitRatio: 0.95,
|
|
504
528
|
maxInitialScale: 2,
|
|
505
|
-
scrollForPan:
|
|
529
|
+
scrollForPan: gt,
|
|
506
530
|
initialExpandLevel: -1,
|
|
507
531
|
zoom: true,
|
|
508
532
|
pan: true,
|
|
@@ -516,39 +540,39 @@
|
|
|
516
540
|
onNodeEdit: void 0,
|
|
517
541
|
onNodeAdd: void 0,
|
|
518
542
|
inputPlaceholder: "Enter text",
|
|
519
|
-
color: (
|
|
543
|
+
color: (n) => {
|
|
520
544
|
var t;
|
|
521
|
-
return
|
|
545
|
+
return ne(`${((t = n.state) == null ? void 0 : t.path) || ""}`);
|
|
522
546
|
},
|
|
523
|
-
lineWidth:
|
|
547
|
+
lineWidth: mt(),
|
|
524
548
|
maxWidth: 0,
|
|
525
549
|
nodeMinHeight: 16,
|
|
526
550
|
paddingX: 8,
|
|
527
551
|
spacingHorizontal: 80,
|
|
528
552
|
spacingVertical: 5
|
|
529
553
|
};
|
|
530
|
-
function
|
|
531
|
-
const t = {},
|
|
532
|
-
if ((
|
|
533
|
-
const h2 =
|
|
554
|
+
function Fe(n) {
|
|
555
|
+
const t = {}, e = { ...n }, { color: i, colorFreezeLevel: o, lineWidth: s } = e;
|
|
556
|
+
if ((i == null ? void 0 : i.length) === 1) {
|
|
557
|
+
const h2 = i[0];
|
|
534
558
|
t.color = () => h2;
|
|
535
|
-
} else if (
|
|
536
|
-
const h2 = d32.scaleOrdinal(
|
|
537
|
-
t.color = (
|
|
538
|
-
}
|
|
539
|
-
if (
|
|
540
|
-
const h2 = t.color ||
|
|
541
|
-
t.color = (
|
|
542
|
-
...
|
|
559
|
+
} else if (i != null && i.length) {
|
|
560
|
+
const h2 = d32.scaleOrdinal(i);
|
|
561
|
+
t.color = (c) => h2(`${c.state.path}`);
|
|
562
|
+
}
|
|
563
|
+
if (o) {
|
|
564
|
+
const h2 = t.color || yt.color;
|
|
565
|
+
t.color = (c) => (c = {
|
|
566
|
+
...c,
|
|
543
567
|
state: {
|
|
544
|
-
...
|
|
545
|
-
path:
|
|
568
|
+
...c.state,
|
|
569
|
+
path: c.state.path.split(".").slice(0, o).join(".")
|
|
546
570
|
}
|
|
547
|
-
}, h2(
|
|
571
|
+
}, h2(c));
|
|
548
572
|
}
|
|
549
|
-
if (
|
|
550
|
-
const h2 = Array.isArray(
|
|
551
|
-
t.lineWidth =
|
|
573
|
+
if (s) {
|
|
574
|
+
const h2 = Array.isArray(s) ? s : [s, 0, 1];
|
|
575
|
+
t.lineWidth = mt(
|
|
552
576
|
...h2
|
|
553
577
|
);
|
|
554
578
|
}
|
|
@@ -563,171 +587,171 @@
|
|
|
563
587
|
"spacingHorizontal",
|
|
564
588
|
"spacingVertical"
|
|
565
589
|
].forEach((h2) => {
|
|
566
|
-
const
|
|
567
|
-
typeof
|
|
590
|
+
const c = e[h2];
|
|
591
|
+
typeof c == "number" && (t[h2] = c);
|
|
568
592
|
}), ["zoom", "pan"].forEach((h2) => {
|
|
569
|
-
const
|
|
570
|
-
|
|
593
|
+
const c = e[h2];
|
|
594
|
+
c != null && (t[h2] = !!c);
|
|
571
595
|
}), t;
|
|
572
596
|
}
|
|
573
|
-
function
|
|
597
|
+
function V(n) {
|
|
574
598
|
let t = 0;
|
|
575
|
-
for (let
|
|
576
|
-
t = (t << 5) - t +
|
|
599
|
+
for (let e = 0; e < n.length; e++)
|
|
600
|
+
t = (t << 5) - t + n.charCodeAt(e) | 0;
|
|
577
601
|
return (t >>> 0).toString(36);
|
|
578
602
|
}
|
|
579
|
-
function b(
|
|
580
|
-
if (typeof
|
|
581
|
-
const
|
|
582
|
-
|
|
603
|
+
function b(n) {
|
|
604
|
+
if (typeof n == "string") {
|
|
605
|
+
const e = n;
|
|
606
|
+
n = (i) => i.matches(e);
|
|
583
607
|
}
|
|
584
|
-
const t =
|
|
608
|
+
const t = n;
|
|
585
609
|
return function() {
|
|
586
|
-
let
|
|
587
|
-
return t && (
|
|
610
|
+
let i = Array.from(this.childNodes);
|
|
611
|
+
return t && (i = i.filter((o) => t(o))), i;
|
|
588
612
|
};
|
|
589
613
|
}
|
|
590
|
-
function
|
|
591
|
-
var t = 0,
|
|
592
|
-
if (!
|
|
593
|
-
else for (; --
|
|
594
|
-
|
|
614
|
+
function oe(n) {
|
|
615
|
+
var t = 0, e = n.children, i = e && e.length;
|
|
616
|
+
if (!i) t = 1;
|
|
617
|
+
else for (; --i >= 0; ) t += e[i].value;
|
|
618
|
+
n.value = t;
|
|
595
619
|
}
|
|
596
|
-
function
|
|
597
|
-
return this.eachAfter(
|
|
620
|
+
function re() {
|
|
621
|
+
return this.eachAfter(oe);
|
|
598
622
|
}
|
|
599
|
-
function
|
|
600
|
-
var t = this,
|
|
623
|
+
function se(n) {
|
|
624
|
+
var t = this, e, i = [t], o, s, a;
|
|
601
625
|
do
|
|
602
|
-
for (
|
|
603
|
-
if (
|
|
604
|
-
|
|
605
|
-
while (
|
|
626
|
+
for (e = i.reverse(), i = []; t = e.pop(); )
|
|
627
|
+
if (n(t), o = t.children, o) for (s = 0, a = o.length; s < a; ++s)
|
|
628
|
+
i.push(o[s]);
|
|
629
|
+
while (i.length);
|
|
606
630
|
return this;
|
|
607
631
|
}
|
|
608
|
-
function
|
|
609
|
-
for (var t = this,
|
|
610
|
-
if (
|
|
611
|
-
|
|
632
|
+
function ae(n) {
|
|
633
|
+
for (var t = this, e = [t], i, o; t = e.pop(); )
|
|
634
|
+
if (n(t), i = t.children, i) for (o = i.length - 1; o >= 0; --o)
|
|
635
|
+
e.push(i[o]);
|
|
612
636
|
return this;
|
|
613
637
|
}
|
|
614
|
-
function
|
|
615
|
-
for (var t = this,
|
|
616
|
-
if (
|
|
617
|
-
|
|
618
|
-
for (; t =
|
|
619
|
-
|
|
638
|
+
function le(n) {
|
|
639
|
+
for (var t = this, e = [t], i = [], o, s, a; t = e.pop(); )
|
|
640
|
+
if (i.push(t), o = t.children, o) for (s = 0, a = o.length; s < a; ++s)
|
|
641
|
+
e.push(o[s]);
|
|
642
|
+
for (; t = i.pop(); )
|
|
643
|
+
n(t);
|
|
620
644
|
return this;
|
|
621
645
|
}
|
|
622
|
-
function
|
|
646
|
+
function ce(n) {
|
|
623
647
|
return this.eachAfter(function(t) {
|
|
624
|
-
for (var
|
|
625
|
-
t.value =
|
|
648
|
+
for (var e = +n(t.data) || 0, i = t.children, o = i && i.length; --o >= 0; ) e += i[o].value;
|
|
649
|
+
t.value = e;
|
|
626
650
|
});
|
|
627
651
|
}
|
|
628
|
-
function
|
|
652
|
+
function de(n) {
|
|
629
653
|
return this.eachBefore(function(t) {
|
|
630
|
-
t.children && t.children.sort(
|
|
654
|
+
t.children && t.children.sort(n);
|
|
631
655
|
});
|
|
632
656
|
}
|
|
633
|
-
function
|
|
634
|
-
for (var t = this,
|
|
635
|
-
t = t.parent,
|
|
636
|
-
for (var
|
|
637
|
-
|
|
638
|
-
return
|
|
639
|
-
}
|
|
640
|
-
function
|
|
641
|
-
if (
|
|
642
|
-
var
|
|
643
|
-
for (
|
|
644
|
-
|
|
645
|
-
return
|
|
646
|
-
}
|
|
647
|
-
function
|
|
648
|
-
for (var
|
|
649
|
-
t.push(
|
|
657
|
+
function he(n) {
|
|
658
|
+
for (var t = this, e = pe(t, n), i = [t]; t !== e; )
|
|
659
|
+
t = t.parent, i.push(t);
|
|
660
|
+
for (var o = i.length; n !== e; )
|
|
661
|
+
i.splice(o, 0, n), n = n.parent;
|
|
662
|
+
return i;
|
|
663
|
+
}
|
|
664
|
+
function pe(n, t) {
|
|
665
|
+
if (n === t) return n;
|
|
666
|
+
var e = n.ancestors(), i = t.ancestors(), o = null;
|
|
667
|
+
for (n = e.pop(), t = i.pop(); n === t; )
|
|
668
|
+
o = n, n = e.pop(), t = i.pop();
|
|
669
|
+
return o;
|
|
670
|
+
}
|
|
671
|
+
function ue() {
|
|
672
|
+
for (var n = this, t = [n]; n = n.parent; )
|
|
673
|
+
t.push(n);
|
|
650
674
|
return t;
|
|
651
675
|
}
|
|
652
|
-
function
|
|
653
|
-
var
|
|
676
|
+
function fe() {
|
|
677
|
+
var n = [];
|
|
654
678
|
return this.each(function(t) {
|
|
655
|
-
|
|
656
|
-
}),
|
|
679
|
+
n.push(t);
|
|
680
|
+
}), n;
|
|
657
681
|
}
|
|
658
|
-
function
|
|
659
|
-
var
|
|
682
|
+
function ge() {
|
|
683
|
+
var n = [];
|
|
660
684
|
return this.eachBefore(function(t) {
|
|
661
|
-
t.children ||
|
|
662
|
-
}),
|
|
685
|
+
t.children || n.push(t);
|
|
686
|
+
}), n;
|
|
663
687
|
}
|
|
664
|
-
function
|
|
665
|
-
var
|
|
666
|
-
return
|
|
667
|
-
|
|
688
|
+
function me() {
|
|
689
|
+
var n = this, t = [];
|
|
690
|
+
return n.each(function(e) {
|
|
691
|
+
e !== n && t.push({ source: e.parent, target: e });
|
|
668
692
|
}), t;
|
|
669
693
|
}
|
|
670
|
-
function
|
|
671
|
-
var
|
|
672
|
-
for (t == null && (t =
|
|
673
|
-
if (
|
|
674
|
-
for (
|
|
675
|
-
|
|
676
|
-
return
|
|
694
|
+
function Y(n, t) {
|
|
695
|
+
var e = new P$1(n), i = +n.value && (e.value = n.value), o, s = [e], a, l, h2, c;
|
|
696
|
+
for (t == null && (t = xe); o = s.pop(); )
|
|
697
|
+
if (i && (o.value = +o.data.value), (l = t(o.data)) && (c = l.length))
|
|
698
|
+
for (o.children = new Array(c), h2 = c - 1; h2 >= 0; --h2)
|
|
699
|
+
s.push(a = o.children[h2] = new P$1(l[h2])), a.parent = o, a.depth = o.depth + 1;
|
|
700
|
+
return e.eachBefore(ke);
|
|
677
701
|
}
|
|
678
|
-
function
|
|
679
|
-
return
|
|
702
|
+
function ye() {
|
|
703
|
+
return Y(this).eachBefore(ve);
|
|
680
704
|
}
|
|
681
|
-
function
|
|
682
|
-
return
|
|
705
|
+
function xe(n) {
|
|
706
|
+
return n.children;
|
|
683
707
|
}
|
|
684
|
-
function
|
|
685
|
-
|
|
708
|
+
function ve(n) {
|
|
709
|
+
n.data = n.data.data;
|
|
686
710
|
}
|
|
687
|
-
function
|
|
711
|
+
function ke(n) {
|
|
688
712
|
var t = 0;
|
|
689
713
|
do
|
|
690
|
-
|
|
691
|
-
while ((
|
|
692
|
-
}
|
|
693
|
-
function
|
|
694
|
-
this.data =
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
constructor:
|
|
698
|
-
count:
|
|
699
|
-
each:
|
|
700
|
-
eachAfter:
|
|
701
|
-
eachBefore:
|
|
702
|
-
sum:
|
|
703
|
-
sort:
|
|
704
|
-
path:
|
|
705
|
-
ancestors:
|
|
706
|
-
descendants:
|
|
707
|
-
leaves:
|
|
708
|
-
links:
|
|
709
|
-
copy:
|
|
714
|
+
n.height = t;
|
|
715
|
+
while ((n = n.parent) && n.height < ++t);
|
|
716
|
+
}
|
|
717
|
+
function P$1(n) {
|
|
718
|
+
this.data = n, this.depth = this.height = 0, this.parent = null;
|
|
719
|
+
}
|
|
720
|
+
P$1.prototype = Y.prototype = {
|
|
721
|
+
constructor: P$1,
|
|
722
|
+
count: re,
|
|
723
|
+
each: se,
|
|
724
|
+
eachAfter: le,
|
|
725
|
+
eachBefore: ae,
|
|
726
|
+
sum: ce,
|
|
727
|
+
sort: de,
|
|
728
|
+
path: he,
|
|
729
|
+
ancestors: ue,
|
|
730
|
+
descendants: fe,
|
|
731
|
+
leaves: ge,
|
|
732
|
+
links: me,
|
|
733
|
+
copy: ye
|
|
710
734
|
};
|
|
711
|
-
const
|
|
712
|
-
version:
|
|
713
|
-
}, { version:
|
|
714
|
-
children: (
|
|
715
|
-
nodeSize: (
|
|
735
|
+
const be = "2.1.2", we = {
|
|
736
|
+
version: be
|
|
737
|
+
}, { version: Ee } = we, Se = Object.freeze({
|
|
738
|
+
children: (n) => n.children,
|
|
739
|
+
nodeSize: (n) => n.data.size,
|
|
716
740
|
spacing: 0
|
|
717
741
|
});
|
|
718
|
-
function
|
|
719
|
-
const t = Object.assign({},
|
|
720
|
-
function
|
|
721
|
-
const h2 = t[
|
|
742
|
+
function vt(n) {
|
|
743
|
+
const t = Object.assign({}, Se, n);
|
|
744
|
+
function e(l) {
|
|
745
|
+
const h2 = t[l];
|
|
722
746
|
return typeof h2 == "function" ? h2 : () => h2;
|
|
723
747
|
}
|
|
724
|
-
function
|
|
725
|
-
const h2 = a(
|
|
748
|
+
function i(l) {
|
|
749
|
+
const h2 = a(s(), l, (c) => c.children);
|
|
726
750
|
return h2.update(), h2.data;
|
|
727
751
|
}
|
|
728
|
-
function
|
|
729
|
-
const
|
|
730
|
-
return class
|
|
752
|
+
function o() {
|
|
753
|
+
const l = e("nodeSize"), h2 = e("spacing");
|
|
754
|
+
return class xt extends Y.prototype.constructor {
|
|
731
755
|
constructor(d) {
|
|
732
756
|
super(d);
|
|
733
757
|
}
|
|
@@ -736,7 +760,7 @@
|
|
|
736
760
|
return d.each((u) => u.data = u.data.data), d;
|
|
737
761
|
}
|
|
738
762
|
get size() {
|
|
739
|
-
return
|
|
763
|
+
return l(this);
|
|
740
764
|
}
|
|
741
765
|
spacing(d) {
|
|
742
766
|
return h2(this, d);
|
|
@@ -783,7 +807,7 @@
|
|
|
783
807
|
}
|
|
784
808
|
get extents() {
|
|
785
809
|
return (this.children || []).reduce(
|
|
786
|
-
(d, u) =>
|
|
810
|
+
(d, u) => xt.maxExtents(d, u.extents),
|
|
787
811
|
this.nodeExtents
|
|
788
812
|
);
|
|
789
813
|
}
|
|
@@ -805,9 +829,9 @@
|
|
|
805
829
|
}
|
|
806
830
|
};
|
|
807
831
|
}
|
|
808
|
-
function
|
|
809
|
-
const
|
|
810
|
-
return class extends
|
|
832
|
+
function s() {
|
|
833
|
+
const l = o(), h2 = e("nodeSize"), c = e("spacing");
|
|
834
|
+
return class extends l {
|
|
811
835
|
constructor(d) {
|
|
812
836
|
super(d), Object.assign(this, {
|
|
813
837
|
x: 0,
|
|
@@ -828,7 +852,7 @@
|
|
|
828
852
|
return h2(this.data);
|
|
829
853
|
}
|
|
830
854
|
spacing(d) {
|
|
831
|
-
return
|
|
855
|
+
return c(this.data, d.data);
|
|
832
856
|
}
|
|
833
857
|
get x() {
|
|
834
858
|
return this.data.x;
|
|
@@ -843,21 +867,21 @@
|
|
|
843
867
|
this.data.y = d;
|
|
844
868
|
}
|
|
845
869
|
update() {
|
|
846
|
-
return
|
|
870
|
+
return kt(this), bt(this), this;
|
|
847
871
|
}
|
|
848
872
|
};
|
|
849
873
|
}
|
|
850
|
-
function a(
|
|
874
|
+
function a(l, h2, c) {
|
|
851
875
|
const d = (u, f) => {
|
|
852
|
-
const g = new
|
|
876
|
+
const g = new l(u);
|
|
853
877
|
Object.assign(g, {
|
|
854
878
|
parent: f,
|
|
855
879
|
depth: f === null ? 0 : f.depth + 1,
|
|
856
880
|
height: 0,
|
|
857
881
|
length: 1
|
|
858
882
|
});
|
|
859
|
-
const
|
|
860
|
-
return g.children =
|
|
883
|
+
const y = c(u) || [];
|
|
884
|
+
return g.children = y.length === 0 ? null : y.map((v) => d(v, g)), g.children && Object.assign(g, g.children.reduce(
|
|
861
885
|
(v, k) => ({
|
|
862
886
|
height: Math.max(v.height, k.height + 1),
|
|
863
887
|
length: v.length + k.length
|
|
@@ -867,115 +891,115 @@
|
|
|
867
891
|
};
|
|
868
892
|
return d(h2, null);
|
|
869
893
|
}
|
|
870
|
-
return Object.assign(
|
|
871
|
-
nodeSize(
|
|
872
|
-
return arguments.length ? (t.nodeSize =
|
|
894
|
+
return Object.assign(i, {
|
|
895
|
+
nodeSize(l) {
|
|
896
|
+
return arguments.length ? (t.nodeSize = l, i) : t.nodeSize;
|
|
873
897
|
},
|
|
874
|
-
spacing(
|
|
875
|
-
return arguments.length ? (t.spacing =
|
|
898
|
+
spacing(l) {
|
|
899
|
+
return arguments.length ? (t.spacing = l, i) : t.spacing;
|
|
876
900
|
},
|
|
877
|
-
children(
|
|
878
|
-
return arguments.length ? (t.children =
|
|
901
|
+
children(l) {
|
|
902
|
+
return arguments.length ? (t.children = l, i) : t.children;
|
|
879
903
|
},
|
|
880
|
-
hierarchy(
|
|
881
|
-
const
|
|
882
|
-
return a(
|
|
904
|
+
hierarchy(l, h2) {
|
|
905
|
+
const c = typeof h2 > "u" ? t.children : h2;
|
|
906
|
+
return a(o(), l, c);
|
|
883
907
|
},
|
|
884
|
-
dump(
|
|
885
|
-
const h2 =
|
|
886
|
-
const f = d + " ", g = d + " ", { x, y: v } = u, k = h2(u),
|
|
887
|
-
return `{ size: [${k.join(", ")}],${f}x: ${
|
|
908
|
+
dump(l) {
|
|
909
|
+
const h2 = e("nodeSize"), c = (d) => (u) => {
|
|
910
|
+
const f = d + " ", g = d + " ", { x: y, y: v } = u, k = h2(u), x = u.children || [], _ = x.length === 0 ? " " : `,${f}children: [${g}${x.map(c(g)).join(g)}${f}],${d}`;
|
|
911
|
+
return `{ size: [${k.join(", ")}],${f}x: ${y}, y: ${v}${_}},`;
|
|
888
912
|
};
|
|
889
|
-
return
|
|
890
|
-
`)(
|
|
891
|
-
}
|
|
892
|
-
}),
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
const
|
|
896
|
-
const [
|
|
897
|
-
|
|
898
|
-
const a = (
|
|
899
|
-
|
|
900
|
-
const
|
|
901
|
-
return [
|
|
902
|
-
}, [0, null]),
|
|
903
|
-
typeof t > "u" && (t = -
|
|
904
|
-
const
|
|
905
|
-
return
|
|
906
|
-
},
|
|
907
|
-
(
|
|
908
|
-
const [
|
|
909
|
-
return
|
|
913
|
+
return c(`
|
|
914
|
+
`)(l);
|
|
915
|
+
}
|
|
916
|
+
}), i;
|
|
917
|
+
}
|
|
918
|
+
vt.version = Ee;
|
|
919
|
+
const kt = (n, t = 0) => (n.y = t, (n.children || []).reduce((e, i) => {
|
|
920
|
+
const [o, s] = e;
|
|
921
|
+
kt(i, n.y + n.ySize);
|
|
922
|
+
const a = (o === 0 ? i.lExt : i.rExt).bottom;
|
|
923
|
+
o !== 0 && _e(n, o, s);
|
|
924
|
+
const l = Te(a, o, s);
|
|
925
|
+
return [o + 1, l];
|
|
926
|
+
}, [0, null]), Ce(n), Ae(n), n), bt = (n, t, e) => {
|
|
927
|
+
typeof t > "u" && (t = -n.relX - n.prelim, e = 0);
|
|
928
|
+
const i = t + n.relX;
|
|
929
|
+
return n.relX = i + n.prelim - e, n.prelim = 0, n.x = e + n.relX, (n.children || []).forEach((o) => bt(o, i, n.x)), n;
|
|
930
|
+
}, Ce = (n) => {
|
|
931
|
+
(n.children || []).reduce((t, e) => {
|
|
932
|
+
const [i, o] = t, s = i + e.shift, a = o + s + e.change;
|
|
933
|
+
return e.relX += a, [s, a];
|
|
910
934
|
}, [0, 0]);
|
|
911
|
-
},
|
|
912
|
-
const
|
|
913
|
-
let
|
|
914
|
-
for (;
|
|
915
|
-
|
|
916
|
-
const d = a +
|
|
917
|
-
(d > 0 || d < 0 &&
|
|
918
|
-
const u =
|
|
919
|
-
u <= f && (
|
|
920
|
-
}
|
|
921
|
-
!
|
|
922
|
-
},
|
|
923
|
-
|
|
924
|
-
},
|
|
925
|
-
const
|
|
926
|
-
if (
|
|
927
|
-
const a =
|
|
928
|
-
|
|
929
|
-
}
|
|
930
|
-
},
|
|
931
|
-
const
|
|
932
|
-
|
|
933
|
-
const
|
|
934
|
-
|
|
935
|
-
},
|
|
936
|
-
const
|
|
937
|
-
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
},
|
|
941
|
-
if (
|
|
942
|
-
const t =
|
|
943
|
-
Object.assign(
|
|
944
|
-
prelim:
|
|
935
|
+
}, _e = (n, t, e) => {
|
|
936
|
+
const i = n.children[t - 1], o = n.children[t];
|
|
937
|
+
let s = i, a = i.relX, l = o, h2 = o.relX, c = true;
|
|
938
|
+
for (; s && l; ) {
|
|
939
|
+
s.bottom > e.lowY && (e = e.next);
|
|
940
|
+
const d = a + s.prelim - (h2 + l.prelim) + s.xSize / 2 + l.xSize / 2 + s.spacing(l);
|
|
941
|
+
(d > 0 || d < 0 && c) && (h2 += d, Oe(o, d), Ie(n, t, e.index, d)), c = false;
|
|
942
|
+
const u = s.bottom, f = l.bottom;
|
|
943
|
+
u <= f && (s = $e(s), s && (a += s.relX)), u >= f && (l = Ne(l), l && (h2 += l.relX));
|
|
944
|
+
}
|
|
945
|
+
!s && l ? ze(n, t, l, h2) : s && !l && Re(n, t, s, a);
|
|
946
|
+
}, Oe = (n, t) => {
|
|
947
|
+
n.relX += t, n.lExtRelX += t, n.rExtRelX += t;
|
|
948
|
+
}, Ie = (n, t, e, i) => {
|
|
949
|
+
const o = n.children[t], s = t - e;
|
|
950
|
+
if (s > 1) {
|
|
951
|
+
const a = i / s;
|
|
952
|
+
n.children[e + 1].shift += a, o.shift -= a, o.change -= i - a;
|
|
953
|
+
}
|
|
954
|
+
}, Ne = (n) => n.hasChildren ? n.firstChild : n.lThr, $e = (n) => n.hasChildren ? n.lastChild : n.rThr, ze = (n, t, e, i) => {
|
|
955
|
+
const o = n.firstChild, s = o.lExt, a = n.children[t];
|
|
956
|
+
s.lThr = e;
|
|
957
|
+
const l = i - e.relX - o.lExtRelX;
|
|
958
|
+
s.relX += l, s.prelim -= l, o.lExt = a.lExt, o.lExtRelX = a.lExtRelX;
|
|
959
|
+
}, Re = (n, t, e, i) => {
|
|
960
|
+
const o = n.children[t], s = o.rExt, a = n.children[t - 1];
|
|
961
|
+
s.rThr = e;
|
|
962
|
+
const l = i - e.relX - o.rExtRelX;
|
|
963
|
+
s.relX += l, s.prelim -= l, o.rExt = a.rExt, o.rExtRelX = a.rExtRelX;
|
|
964
|
+
}, Ae = (n) => {
|
|
965
|
+
if (n.hasChildren) {
|
|
966
|
+
const t = n.firstChild, e = n.lastChild, i = (t.prelim + t.relX - t.xSize / 2 + e.relX + e.prelim + e.xSize / 2) / 2;
|
|
967
|
+
Object.assign(n, {
|
|
968
|
+
prelim: i,
|
|
945
969
|
lExt: t.lExt,
|
|
946
970
|
lExtRelX: t.lExtRelX,
|
|
947
|
-
rExt:
|
|
948
|
-
rExtRelX:
|
|
971
|
+
rExt: e.rExt,
|
|
972
|
+
rExtRelX: e.rExtRelX
|
|
949
973
|
});
|
|
950
974
|
}
|
|
951
|
-
},
|
|
952
|
-
for (;
|
|
953
|
-
|
|
975
|
+
}, Te = (n, t, e) => {
|
|
976
|
+
for (; e !== null && n >= e.lowY; )
|
|
977
|
+
e = e.next;
|
|
954
978
|
return {
|
|
955
|
-
lowY:
|
|
979
|
+
lowY: n,
|
|
956
980
|
index: t,
|
|
957
|
-
next:
|
|
981
|
+
next: e
|
|
958
982
|
};
|
|
959
|
-
},
|
|
960
|
-
class
|
|
983
|
+
}, wt = ".markmap{--markmap-max-width: 9999px;--markmap-a-color: #0097e6;--markmap-a-hover-color: #00a8ff;--markmap-code-bg: #f0f0f0;--markmap-code-color: #555;--markmap-highlight-bg: #ffeaa7;--markmap-table-border: 1px solid currentColor;--markmap-font: 300 16px/20px sans-serif;--markmap-circle-open-bg: #fff;--markmap-text-color: #333;--markmap-highlight-node-bg: #ff02;font:var(--markmap-font);color:var(--markmap-text-color)}.markmap-link{fill:none}.markmap-node>circle{cursor:pointer}.markmap-node-hovered>foreignObject>div>div{padding:2px 6px;border-radius:14px;border:2px solid #d9d9d9}.markmap-selected>foreignObject>div>div,.markmap-selected.markmap-node-hovered>foreignObject>div>div{padding:2px 6px;border-radius:14px;border:2px solid #b4b4b4}.markmap-selected>circle{opacity:0!important;pointer-events:none}.markmap-collapse-on-hover .markmap-node>circle{opacity:0;transition:opacity .2s}.markmap-collapse-on-hover .markmap-node:hover>circle{opacity:1}.markmap-foreign{display:inline-block}.markmap-foreign>div>div{padding:4px 6px}.markmap-foreign .markmap-edit-wrapper{position:relative;width:100%;padding:4px;background:#fff;border-radius:4px;box-shadow:0 2px 8px #00000026;animation:fadeIn .2s ease-in}.markmap-foreign .markmap-edit-input{width:100%;padding:8px 12px;border:2px solid #4A90E2;border-radius:4px;font-size:14px;font-family:inherit;outline:none;background:#f8f9fa;transition:all .2s}.markmap-foreign .markmap-edit-input:focus{border-color:#2d7dd2;background:#fff;box-shadow:0 0 0 3px #4a90e21a}.markmap-foreign p{margin:0}.markmap-foreign a{color:var(--markmap-a-color)}.markmap-foreign a:hover{color:var(--markmap-a-hover-color)}.markmap-foreign code{padding:.25em;font-size:calc(1em - 2px);color:var(--markmap-code-color);background-color:var(--markmap-code-bg);border-radius:2px}.markmap-foreign pre{margin:0}.markmap-foreign pre>code{display:block}.markmap-foreign del{text-decoration:line-through}.markmap-foreign em{font-style:italic}.markmap-foreign strong{font-weight:700}.markmap-foreign mark{background:var(--markmap-highlight-bg)}.markmap-foreign table,.markmap-foreign th,.markmap-foreign td{border-collapse:collapse;border:var(--markmap-table-border)}.markmap-foreign img{display:inline-block}.markmap-foreign svg{fill:currentColor}.markmap-foreign>div{width:var(--markmap-max-width);text-align:left}.markmap-foreign>div>div{display:inline-block;max-width:var(--markmap-wrap-width, 30em);overflow-wrap:break-word;word-break:break-word;white-space:normal}.markmap-highlight rect{fill:var(--markmap-highlight-node-bg)}.markmap-dark .markmap{--markmap-code-bg: #1a1b26;--markmap-code-color: #ddd;--markmap-circle-open-bg: #444;--markmap-text-color: #eee}@keyframes fadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}", L = "g.markmap-node";
|
|
984
|
+
class Me {
|
|
961
985
|
constructor(t) {
|
|
962
986
|
this.ctx = t, this.editingNode = null, this.selectedNode = null;
|
|
963
987
|
}
|
|
964
988
|
// ── Private helpers ──────────────────────────────────────────────────────
|
|
965
989
|
_getNodeContentEl(t) {
|
|
966
|
-
const
|
|
967
|
-
return
|
|
990
|
+
const e = this.ctx.findElement(t);
|
|
991
|
+
return e && d32.select(e.g).select("foreignObject").select("div").select("div").node() || null;
|
|
968
992
|
}
|
|
969
993
|
_getOverlayRoot() {
|
|
970
994
|
const t = this.ctx.svg.node();
|
|
971
995
|
return (t == null ? void 0 : t.parentElement) || document.body;
|
|
972
996
|
}
|
|
973
|
-
_positionOverlayToEl(t,
|
|
974
|
-
const
|
|
975
|
-
window.getComputedStyle(
|
|
976
|
-
const a =
|
|
977
|
-
let f = a.left -
|
|
978
|
-
(
|
|
997
|
+
_positionOverlayToEl(t, e, i) {
|
|
998
|
+
const o = this._getOverlayRoot();
|
|
999
|
+
window.getComputedStyle(o).position === "static" && (o.style.position = "relative");
|
|
1000
|
+
const a = e.getBoundingClientRect(), l = o.getBoundingClientRect(), h2 = (i == null ? void 0 : i.dx) ?? 0, c = (i == null ? void 0 : i.dy) ?? 0, d = (i == null ? void 0 : i.minW) ?? 0, u = (i == null ? void 0 : i.minH) ?? 0;
|
|
1001
|
+
let f = a.left - l.left + h2, g = a.top - l.top + c;
|
|
1002
|
+
(i == null ? void 0 : i.anchor) === "br" ? (f = a.right - l.left + h2, g = a.bottom - l.top + c) : (i == null ? void 0 : i.anchor) === "r" && (f = a.right - l.left + h2, g = a.top - l.top + c), t.style.left = `${f}px`, t.style.top = `${g}px`, d && (t.style.width = `${Math.max(d, a.width)}px`), u && (t.style.height = `${Math.max(u, a.height)}px`);
|
|
979
1003
|
}
|
|
980
1004
|
_safeRemoveEl(t) {
|
|
981
1005
|
try {
|
|
@@ -984,39 +1008,39 @@
|
|
|
984
1008
|
}
|
|
985
1009
|
}
|
|
986
1010
|
_clearSelectionCss() {
|
|
987
|
-
this.ctx.options.clickBorder && this.ctx.g.selectAll(b(
|
|
1011
|
+
this.ctx.options.clickBorder && this.ctx.g.selectAll(b(L)).classed("markmap-selected", false);
|
|
988
1012
|
}
|
|
989
1013
|
_findParent(t) {
|
|
990
1014
|
if (!this.ctx.state.data) return null;
|
|
991
|
-
let
|
|
992
|
-
return
|
|
993
|
-
if (
|
|
994
|
-
const
|
|
995
|
-
for (let a = 0; a <
|
|
996
|
-
if (
|
|
997
|
-
|
|
1015
|
+
let e = null;
|
|
1016
|
+
return R(this.ctx.state.data, (i, o) => {
|
|
1017
|
+
if (e) return;
|
|
1018
|
+
const s = i.children || [];
|
|
1019
|
+
for (let a = 0; a < s.length; a++)
|
|
1020
|
+
if (s[a] === t) {
|
|
1021
|
+
e = { parent: i, index: a };
|
|
998
1022
|
return;
|
|
999
1023
|
}
|
|
1000
|
-
|
|
1001
|
-
}),
|
|
1024
|
+
o();
|
|
1025
|
+
}), e;
|
|
1002
1026
|
}
|
|
1003
1027
|
/** Create a blank child INode and append it to parent.children. */
|
|
1004
1028
|
_insertNewChildNode(t) {
|
|
1005
|
-
var
|
|
1006
|
-
let
|
|
1007
|
-
|
|
1029
|
+
var l, h2, c;
|
|
1030
|
+
let e = 0;
|
|
1031
|
+
R(this.ctx.state.data, (d, u) => {
|
|
1008
1032
|
var f;
|
|
1009
|
-
((f = d.state) == null ? void 0 : f.id) >
|
|
1033
|
+
((f = d.state) == null ? void 0 : f.id) > e && (e = d.state.id), u();
|
|
1010
1034
|
});
|
|
1011
|
-
const
|
|
1012
|
-
content:
|
|
1035
|
+
const i = e + 1, o = (((l = t.state) == null ? void 0 : l.depth) ?? 0) + 1, s = " ", a = {
|
|
1036
|
+
content: s,
|
|
1013
1037
|
children: [],
|
|
1014
1038
|
payload: {},
|
|
1015
1039
|
state: {
|
|
1016
|
-
id:
|
|
1017
|
-
depth:
|
|
1018
|
-
key: `${(h2 = t.state) == null ? void 0 : h2.id}.${
|
|
1019
|
-
path: [(
|
|
1040
|
+
id: i,
|
|
1041
|
+
depth: o,
|
|
1042
|
+
key: `${(h2 = t.state) == null ? void 0 : h2.id}.${i}` + V(s),
|
|
1043
|
+
path: [(c = t.state) == null ? void 0 : c.path, i].filter(Boolean).join("."),
|
|
1020
1044
|
rect: { x: 0, y: 0, width: 0, height: 0 },
|
|
1021
1045
|
size: [0, 0]
|
|
1022
1046
|
}
|
|
@@ -1035,21 +1059,21 @@
|
|
|
1035
1059
|
* @param opts.onSave - Called after the overlay is torn down on a successful save.
|
|
1036
1060
|
* @param opts.onCancel - Called after the overlay is torn down on cancel / empty input.
|
|
1037
1061
|
*/
|
|
1038
|
-
_openEditOverlay(t,
|
|
1039
|
-
const
|
|
1040
|
-
window.getComputedStyle(
|
|
1041
|
-
const a =
|
|
1062
|
+
_openEditOverlay(t, e, i) {
|
|
1063
|
+
const o = this._getOverlayRoot();
|
|
1064
|
+
window.getComputedStyle(o).position === "static" && (o.style.position = "relative");
|
|
1065
|
+
const a = e.getBoundingClientRect(), l = o.getBoundingClientRect(), h2 = document.createElement("div");
|
|
1042
1066
|
h2.className = "markmap-node-edit-overlay", h2.style.cssText = `
|
|
1043
1067
|
position: absolute;
|
|
1044
|
-
left: ${a.left -
|
|
1045
|
-
top: ${a.top -
|
|
1046
|
-
width: ${Math.max(
|
|
1068
|
+
left: ${a.left - l.left}px;
|
|
1069
|
+
top: ${a.top - l.top}px;
|
|
1070
|
+
width: ${Math.max(i.minWidth, a.width)}px;
|
|
1047
1071
|
height: ${Math.max(20, a.height)}px;
|
|
1048
1072
|
z-index: 9999;
|
|
1049
1073
|
pointer-events: auto;
|
|
1050
1074
|
`;
|
|
1051
|
-
const
|
|
1052
|
-
d.type = "text", d.value =
|
|
1075
|
+
const c = window.getComputedStyle(e), d = document.createElement("input");
|
|
1076
|
+
d.type = "text", d.value = i.initialValue, i.placeholder && (d.placeholder = i.placeholder), d.autocomplete = "off", d.spellcheck = false, d.className = "markmap-node-edit-overlay-input", d.style.cssText = `
|
|
1053
1077
|
width: 100%;
|
|
1054
1078
|
height: 100%;
|
|
1055
1079
|
margin: 0;
|
|
@@ -1059,32 +1083,32 @@
|
|
|
1059
1083
|
background: #fff;
|
|
1060
1084
|
box-sizing: border-box;
|
|
1061
1085
|
outline: none;
|
|
1062
|
-
font-size: ${
|
|
1063
|
-
font-family: ${
|
|
1064
|
-
line-height: ${
|
|
1065
|
-
font-weight: ${
|
|
1066
|
-
letter-spacing: ${
|
|
1067
|
-
color: ${
|
|
1086
|
+
font-size: ${c.fontSize};
|
|
1087
|
+
font-family: ${c.fontFamily};
|
|
1088
|
+
line-height: ${c.lineHeight};
|
|
1089
|
+
font-weight: ${c.fontWeight};
|
|
1090
|
+
letter-spacing: ${c.letterSpacing};
|
|
1091
|
+
color: ${c.color};
|
|
1068
1092
|
`;
|
|
1069
|
-
const u =
|
|
1070
|
-
|
|
1071
|
-
d.focus(),
|
|
1093
|
+
const u = e.style.visibility;
|
|
1094
|
+
e.style.visibility = "hidden", h2.appendChild(d), o.appendChild(h2), this.editOverlay = { wrap: h2, input: d, contentEl: e, prevVisibility: u }, setTimeout(() => {
|
|
1095
|
+
d.focus(), i.selectAll && d.select();
|
|
1072
1096
|
}, 0);
|
|
1073
|
-
const f = (
|
|
1097
|
+
const f = (x) => x.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1074
1098
|
let g = false;
|
|
1075
|
-
const
|
|
1076
|
-
g || (g = true, d.removeEventListener("keydown", v), d.removeEventListener("blur", k), this.editOverlay ? (this.editOverlay.contentEl.style.visibility = this.editOverlay.prevVisibility, this.editOverlay.wrap.remove(), this.editOverlay = void 0) : (
|
|
1077
|
-
}, v = (
|
|
1078
|
-
if (
|
|
1079
|
-
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1082
|
-
} else
|
|
1099
|
+
const y = (x) => {
|
|
1100
|
+
g || (g = true, d.removeEventListener("keydown", v), d.removeEventListener("blur", k), this.editOverlay ? (this.editOverlay.contentEl.style.visibility = this.editOverlay.prevVisibility, this.editOverlay.wrap.remove(), this.editOverlay = void 0) : (e.style.visibility = u, h2.remove()), this.editingNode = null, x ? i.onCancel() : i.onSave(f(d.value.trim())));
|
|
1101
|
+
}, v = (x) => {
|
|
1102
|
+
if (x.key === "Enter") {
|
|
1103
|
+
x.preventDefault(), x.stopPropagation();
|
|
1104
|
+
const _ = d.value.trim();
|
|
1105
|
+
_ ? (t.content = f(_), y(false)) : y(true);
|
|
1106
|
+
} else x.key === "Escape" && (x.preventDefault(), x.stopPropagation(), y(true));
|
|
1083
1107
|
}, k = () => {
|
|
1084
1108
|
setTimeout(() => {
|
|
1085
1109
|
if (document.activeElement !== d) {
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1110
|
+
const x = d.value.trim();
|
|
1111
|
+
x ? (t.content = f(x), y(false)) : y(true);
|
|
1088
1112
|
}
|
|
1089
1113
|
}, 100);
|
|
1090
1114
|
};
|
|
@@ -1094,26 +1118,26 @@
|
|
|
1094
1118
|
* Open an edit overlay for a freshly-inserted node.
|
|
1095
1119
|
* Empty input → confirm saves; blank input → cancels and removes the node from the tree.
|
|
1096
1120
|
*/
|
|
1097
|
-
_editNewNode(t,
|
|
1098
|
-
const
|
|
1099
|
-
if (!
|
|
1121
|
+
_editNewNode(t, e) {
|
|
1122
|
+
const i = this.ctx.findElement(t);
|
|
1123
|
+
if (!i) return;
|
|
1100
1124
|
this.editingNode = t;
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1125
|
+
const o = d32.select(i.g).select("foreignObject").select("div").select("div").node();
|
|
1126
|
+
o && this._openEditOverlay(t, o, {
|
|
1103
1127
|
initialValue: "",
|
|
1104
1128
|
minWidth: 120,
|
|
1105
1129
|
placeholder: this.ctx.options.inputPlaceholder,
|
|
1106
1130
|
selectAll: false,
|
|
1107
1131
|
onCancel: () => {
|
|
1108
|
-
|
|
1132
|
+
e.children = (e.children || []).filter((s) => s !== t), this.hideAddUI(), this.selectedNode = null, this._clearSelectionCss(), this.ctx.renderData();
|
|
1109
1133
|
},
|
|
1110
1134
|
onSave: () => {
|
|
1111
|
-
var
|
|
1112
|
-
(a = (
|
|
1113
|
-
const
|
|
1114
|
-
this.selectedNode = t, this.ctx.options.clickBorder && this.ctx.g.selectAll(b(
|
|
1135
|
+
var s, a;
|
|
1136
|
+
(a = (s = this.ctx.options).onNodeAdd) == null || a.call(s, e, t), this.hideAddUI(), this.ctx.renderData().then(() => {
|
|
1137
|
+
const l = () => {
|
|
1138
|
+
this.selectedNode = t, this.ctx.options.clickBorder && this.ctx.g.selectAll(b(L)).classed("markmap-selected", (h2) => h2 === t), this.showAddUI(t);
|
|
1115
1139
|
};
|
|
1116
|
-
this.ctx.options.duration > 0 ? setTimeout(
|
|
1140
|
+
this.ctx.options.duration > 0 ? setTimeout(l, this.ctx.options.duration) : l();
|
|
1117
1141
|
});
|
|
1118
1142
|
}
|
|
1119
1143
|
});
|
|
@@ -1124,21 +1148,21 @@
|
|
|
1124
1148
|
if (this.addUI) {
|
|
1125
1149
|
const t = this._getNodeContentEl(this.addUI.node);
|
|
1126
1150
|
if (t) {
|
|
1127
|
-
const
|
|
1128
|
-
this.addUI.btn.style.width = `${
|
|
1151
|
+
const e = this.ctx.svg.node(), i = e ? d32.zoomTransform(e).k : 1, o = Math.round(16 * i), s = Math.round(14 * i);
|
|
1152
|
+
this.addUI.btn.style.width = `${o}px`, this.addUI.btn.style.height = `${o}px`, this.addUI.btn.style.fontSize = `${s}px`, this._positionOverlayToEl(this.addUI.wrap, t, { anchor: "br", dx: Math.round(14 * i), dy: 0 });
|
|
1129
1153
|
}
|
|
1130
1154
|
}
|
|
1131
1155
|
if (this.addInputUI) {
|
|
1132
1156
|
const t = this._getNodeContentEl(this.addInputUI.node);
|
|
1133
1157
|
if (t) {
|
|
1134
1158
|
this._positionOverlayToEl(this.addInputUI.wrap, t, { anchor: "r", dx: 16, dy: 0 });
|
|
1135
|
-
const
|
|
1136
|
-
this.addInputUI.wrap.style.top = `${
|
|
1159
|
+
const e = 30, i = t.getBoundingClientRect().height, o = parseFloat(this.addInputUI.wrap.style.top) || 0;
|
|
1160
|
+
this.addInputUI.wrap.style.top = `${o + i / 2 - e / 2}px`;
|
|
1137
1161
|
}
|
|
1138
1162
|
}
|
|
1139
1163
|
if (this.editOverlay) {
|
|
1140
|
-
const t = this._getOverlayRoot(),
|
|
1141
|
-
this.editOverlay.wrap.style.left = `${
|
|
1164
|
+
const t = this._getOverlayRoot(), e = this.editOverlay.contentEl.getBoundingClientRect(), i = t.getBoundingClientRect();
|
|
1165
|
+
this.editOverlay.wrap.style.left = `${e.left - i.left}px`, this.editOverlay.wrap.style.top = `${e.top - i.top}px`, this.editOverlay.wrap.style.width = `${Math.max(40, e.width)}px`, this.editOverlay.wrap.style.height = `${Math.max(20, e.height)}px`;
|
|
1142
1166
|
}
|
|
1143
1167
|
}
|
|
1144
1168
|
/** Hide and destroy the + button and any associated input overlay. */
|
|
@@ -1149,23 +1173,23 @@
|
|
|
1149
1173
|
showAddUI(t) {
|
|
1150
1174
|
var f;
|
|
1151
1175
|
if (!this.ctx.options.addable || this.editingNode) return;
|
|
1152
|
-
const
|
|
1153
|
-
if (!
|
|
1176
|
+
const e = this._getNodeContentEl(t);
|
|
1177
|
+
if (!e) return;
|
|
1154
1178
|
if (((f = this.addUI) == null ? void 0 : f.node) === t) {
|
|
1155
|
-
this._positionOverlayToEl(this.addUI.wrap,
|
|
1179
|
+
this._positionOverlayToEl(this.addUI.wrap, e, { anchor: "br", dx: 14, dy: 0 });
|
|
1156
1180
|
return;
|
|
1157
1181
|
}
|
|
1158
1182
|
this.hideAddUI();
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1183
|
+
const i = this._getOverlayRoot(), o = document.createElement("div");
|
|
1184
|
+
o.style.cssText = `
|
|
1161
1185
|
position: absolute;
|
|
1162
1186
|
z-index: 9999;
|
|
1163
1187
|
pointer-events: auto;
|
|
1164
1188
|
`;
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1167
|
-
width: ${
|
|
1168
|
-
height: ${
|
|
1189
|
+
const s = this.ctx.svg.node(), a = s ? d32.zoomTransform(s).k : 1, l = Math.round(16 * a), h2 = Math.round(14 * a), c = document.createElement("button");
|
|
1190
|
+
c.type = "button", c.className = "markmap-add-btn", c.textContent = "+", c.style.cssText = `
|
|
1191
|
+
width: ${l}px;
|
|
1192
|
+
height: ${l}px;
|
|
1169
1193
|
border-radius: 50%;
|
|
1170
1194
|
background: #b4b4b4;
|
|
1171
1195
|
color: #fff;
|
|
@@ -1181,27 +1205,27 @@
|
|
|
1181
1205
|
display: flex;
|
|
1182
1206
|
align-items: center;
|
|
1183
1207
|
justify-content: center;
|
|
1184
|
-
`,
|
|
1208
|
+
`, c.addEventListener("click", (g) => {
|
|
1185
1209
|
g.preventDefault(), g.stopPropagation(), this.showAddInput(t);
|
|
1186
|
-
}),
|
|
1210
|
+
}), o.style.transform = "translate(-50%, -50%)", o.appendChild(c), i.appendChild(o), this._positionOverlayToEl(o, e, { anchor: "br", dx: Math.round(14 * a), dy: 0 });
|
|
1187
1211
|
const d = (g) => {
|
|
1188
1212
|
var k;
|
|
1189
|
-
const
|
|
1190
|
-
if (!
|
|
1213
|
+
const y = g.target;
|
|
1214
|
+
if (!y || o.contains(y) || (k = this.addInputUI) != null && k.wrap.contains(y)) return;
|
|
1191
1215
|
const v = this._getNodeContentEl(t);
|
|
1192
|
-
v && v.contains(
|
|
1216
|
+
v && v.contains(y) || this.hideAddUI();
|
|
1193
1217
|
};
|
|
1194
1218
|
document.addEventListener("click", d, true);
|
|
1195
1219
|
const u = () => document.removeEventListener("click", d, true);
|
|
1196
|
-
this.addUI = { node: t, btn:
|
|
1220
|
+
this.addUI = { node: t, btn: c, wrap: o, cleanupDoc: u };
|
|
1197
1221
|
}
|
|
1198
1222
|
/** Delete `node` from the tree and re-render. */
|
|
1199
1223
|
deleteNode(t) {
|
|
1200
1224
|
if (!this.ctx.options.deletable || !this.ctx.state.data) return;
|
|
1201
|
-
const
|
|
1202
|
-
if (!
|
|
1203
|
-
const { parent:
|
|
1204
|
-
|
|
1225
|
+
const e = this._findParent(t);
|
|
1226
|
+
if (!e) return;
|
|
1227
|
+
const { parent: i, index: o } = e, s = [...i.children || []];
|
|
1228
|
+
s.splice(o, 1), i.children = s, this.selectedNode = null, this.hideAddUI(), this._clearSelectionCss(), this.ctx.renderData();
|
|
1205
1229
|
}
|
|
1206
1230
|
/**
|
|
1207
1231
|
* Insert a new sibling node after `sibling`, render it, then open an edit overlay.
|
|
@@ -1210,29 +1234,29 @@
|
|
|
1210
1234
|
async showAddSiblingInput(t) {
|
|
1211
1235
|
var u, f, g;
|
|
1212
1236
|
if (!this.ctx.state.data) return;
|
|
1213
|
-
const
|
|
1214
|
-
if (!
|
|
1215
|
-
const { parent:
|
|
1237
|
+
const e = this._findParent(t);
|
|
1238
|
+
if (!e) return;
|
|
1239
|
+
const { parent: i, index: o } = e;
|
|
1216
1240
|
this.hideAddUI();
|
|
1217
|
-
let
|
|
1218
|
-
|
|
1241
|
+
let s = 0;
|
|
1242
|
+
R(this.ctx.state.data, (y, v) => {
|
|
1219
1243
|
var k;
|
|
1220
|
-
((k =
|
|
1244
|
+
((k = y.state) == null ? void 0 : k.id) > s && (s = y.state.id), v();
|
|
1221
1245
|
});
|
|
1222
|
-
const a =
|
|
1246
|
+
const a = s + 1, l = ((u = t.state) == null ? void 0 : u.depth) ?? 1, h2 = " ", c = {
|
|
1223
1247
|
content: h2,
|
|
1224
1248
|
children: [],
|
|
1225
1249
|
payload: {},
|
|
1226
1250
|
state: {
|
|
1227
1251
|
id: a,
|
|
1228
|
-
depth:
|
|
1229
|
-
key: `${(f =
|
|
1230
|
-
path: [(g =
|
|
1252
|
+
depth: l,
|
|
1253
|
+
key: `${(f = i.state) == null ? void 0 : f.id}.${a}` + V(h2),
|
|
1254
|
+
path: [(g = i.state) == null ? void 0 : g.path, a].filter(Boolean).join("."),
|
|
1231
1255
|
rect: { x: 0, y: 0, width: 0, height: 0 },
|
|
1232
1256
|
size: [0, 0]
|
|
1233
1257
|
}
|
|
1234
|
-
}, d = [...
|
|
1235
|
-
d.splice(
|
|
1258
|
+
}, d = [...i.children || []];
|
|
1259
|
+
d.splice(o + 1, 0, c), i.children = d, this.ctx.options.color(c), await this.ctx.renderData(), this.ctx.options.duration > 0 && await new Promise((y) => setTimeout(y, this.ctx.options.duration)), this._editNewNode(c, i);
|
|
1236
1260
|
}
|
|
1237
1261
|
/**
|
|
1238
1262
|
* Insert a new child node under `node`, render it, then open an edit overlay.
|
|
@@ -1241,20 +1265,20 @@
|
|
|
1241
1265
|
async showAddInput(t) {
|
|
1242
1266
|
if (!this.ctx.state.data) return;
|
|
1243
1267
|
this.hideAddUI();
|
|
1244
|
-
const
|
|
1245
|
-
await this.ctx.renderData(), this.ctx.options.duration > 0 && await new Promise((
|
|
1268
|
+
const e = this._insertNewChildNode(t);
|
|
1269
|
+
await this.ctx.renderData(), this.ctx.options.duration > 0 && await new Promise((i) => setTimeout(i, this.ctx.options.duration)), this._editNewNode(e, t);
|
|
1246
1270
|
}
|
|
1247
1271
|
/**
|
|
1248
1272
|
* Open an edit overlay for an *existing* node.
|
|
1249
1273
|
* Called on double-click. On confirm the node content is updated in-place.
|
|
1250
1274
|
*/
|
|
1251
|
-
handleEdit(t,
|
|
1275
|
+
handleEdit(t, e) {
|
|
1252
1276
|
if (!this.ctx.options.editable) return;
|
|
1253
1277
|
t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation(), this.editingNode && this.saveEdit();
|
|
1254
|
-
const
|
|
1255
|
-
if (!
|
|
1256
|
-
const
|
|
1257
|
-
if (!
|
|
1278
|
+
const i = this.ctx.findElement(e);
|
|
1279
|
+
if (!i) return;
|
|
1280
|
+
const o = d32.select(i.g).select("foreignObject").select("div").select("div").node();
|
|
1281
|
+
if (!o) return;
|
|
1258
1282
|
if (this.editOverlay) {
|
|
1259
1283
|
try {
|
|
1260
1284
|
this.editOverlay.contentEl.style.visibility = this.editOverlay.prevVisibility, this.editOverlay.wrap.remove();
|
|
@@ -1262,22 +1286,22 @@
|
|
|
1262
1286
|
}
|
|
1263
1287
|
this.editOverlay = void 0;
|
|
1264
1288
|
}
|
|
1265
|
-
const
|
|
1266
|
-
this.editingNode =
|
|
1267
|
-
initialValue:
|
|
1289
|
+
const s = e.content;
|
|
1290
|
+
this.editingNode = e, this._openEditOverlay(e, o, {
|
|
1291
|
+
initialValue: o.textContent || "",
|
|
1268
1292
|
minWidth: 40,
|
|
1269
1293
|
selectAll: true,
|
|
1270
1294
|
onCancel: () => {
|
|
1271
|
-
|
|
1295
|
+
e.content = s, this.ctx.renderData();
|
|
1272
1296
|
},
|
|
1273
1297
|
onSave: (a) => {
|
|
1274
|
-
var
|
|
1275
|
-
(h2 = (
|
|
1298
|
+
var l, h2;
|
|
1299
|
+
(h2 = (l = this.ctx.options).onNodeEdit) == null || h2.call(l, e, a), this.hideAddUI(), this.ctx.renderData().then(() => {
|
|
1276
1300
|
if (!this.ctx.options.addable) return;
|
|
1277
|
-
const
|
|
1278
|
-
this.selectedNode =
|
|
1301
|
+
const c = () => {
|
|
1302
|
+
this.selectedNode = e, this.ctx.options.clickBorder && this.ctx.g.selectAll(b(L)).classed("markmap-selected", (d) => d === e), this.showAddUI(e);
|
|
1279
1303
|
};
|
|
1280
|
-
this.ctx.options.duration > 0 ? setTimeout(
|
|
1304
|
+
this.ctx.options.duration > 0 ? setTimeout(c, this.ctx.options.duration) : c();
|
|
1281
1305
|
});
|
|
1282
1306
|
}
|
|
1283
1307
|
});
|
|
@@ -1285,54 +1309,54 @@
|
|
|
1285
1309
|
/** Immediately discard any in-progress edit overlay without saving. */
|
|
1286
1310
|
saveEdit() {
|
|
1287
1311
|
if (this.editOverlay) {
|
|
1288
|
-
const { input: t, contentEl:
|
|
1289
|
-
t.remove(),
|
|
1312
|
+
const { input: t, contentEl: e, prevVisibility: i, wrap: o } = this.editOverlay;
|
|
1313
|
+
t.remove(), e.style.visibility = i, o.remove(), this.editOverlay = void 0;
|
|
1290
1314
|
}
|
|
1291
1315
|
this.editingNode && (this.editingNode = null);
|
|
1292
1316
|
}
|
|
1293
1317
|
}
|
|
1294
|
-
const
|
|
1295
|
-
function
|
|
1296
|
-
const
|
|
1297
|
-
return
|
|
1298
|
-
}
|
|
1299
|
-
function
|
|
1300
|
-
|
|
1301
|
-
}
|
|
1302
|
-
const
|
|
1303
|
-
class
|
|
1304
|
-
constructor(t,
|
|
1305
|
-
this.options = { ...
|
|
1306
|
-
const { transform:
|
|
1307
|
-
this.g.attr("transform",
|
|
1308
|
-
}, this.handlePan = (
|
|
1309
|
-
|
|
1310
|
-
const
|
|
1311
|
-
-
|
|
1312
|
-
-
|
|
1318
|
+
const We = wt, A = "g.markmap-node", Be = "path.markmap-link", De = "g.markmap-highlight", F = d32.linkHorizontal();
|
|
1319
|
+
function ct(n, t) {
|
|
1320
|
+
const e = d32.minIndex(n, t);
|
|
1321
|
+
return n[e];
|
|
1322
|
+
}
|
|
1323
|
+
function dt(n) {
|
|
1324
|
+
n.stopPropagation();
|
|
1325
|
+
}
|
|
1326
|
+
const Pe = new Tt();
|
|
1327
|
+
class Et {
|
|
1328
|
+
constructor(t, e) {
|
|
1329
|
+
this.options = { ...yt }, this._disposeList = [], this.handleZoom = (o) => {
|
|
1330
|
+
const { transform: s } = o;
|
|
1331
|
+
this.g.attr("transform", s), this._actions.repositionOverlays();
|
|
1332
|
+
}, this.handlePan = (o) => {
|
|
1333
|
+
o.preventDefault();
|
|
1334
|
+
const s = d32.zoomTransform(this.svg.node()), a = s.translate(
|
|
1335
|
+
-o.deltaX / s.k,
|
|
1336
|
+
-o.deltaY / s.k
|
|
1313
1337
|
);
|
|
1314
1338
|
this.svg.call(this.zoom.transform, a);
|
|
1315
|
-
}, this.handleClick = (
|
|
1339
|
+
}, this.handleClick = (o, s) => {
|
|
1316
1340
|
let a = this.options.toggleRecursively;
|
|
1317
|
-
(
|
|
1318
|
-
}, this.ensureView = this.ensureVisible, this.svg = t.datum ? t : d32.select(t), this.styleNode = this.svg.append("style"), this.zoom = d32.zoom().filter((
|
|
1319
|
-
id: this.options.id || this.svg.attr("id") ||
|
|
1341
|
+
(gt ? o.metaKey : o.ctrlKey) && (a = !a), this.toggleNode(s, a);
|
|
1342
|
+
}, this.ensureView = this.ensureVisible, this.svg = t.datum ? t : d32.select(t), this.styleNode = this.svg.append("style"), this.zoom = d32.zoom().filter((o) => this.options.scrollForPan && o.type === "wheel" ? o.ctrlKey && !o.button : (!o.ctrlKey || o.type === "wheel") && !o.button).on("zoom", this.handleZoom), this.setOptions(e), this.state = {
|
|
1343
|
+
id: this.options.id || this.svg.attr("id") || Bt(),
|
|
1320
1344
|
rect: { x1: 0, y1: 0, x2: 0, y2: 0 }
|
|
1321
|
-
}, this.g = this.svg.append("g"), this.g.append("g").attr("class", "markmap-highlight"), this._actions = new
|
|
1345
|
+
}, this.g = this.svg.append("g"), this.g.append("g").attr("class", "markmap-highlight"), this._actions = new Me(this), this.svg.on("click", () => {
|
|
1322
1346
|
this._actions.selectedNode && (this._actions.selectedNode = null, this.options.clickBorder && this.g.selectAll(b(A)).classed("markmap-selected", false), this._actions.hideAddUI());
|
|
1323
1347
|
});
|
|
1324
|
-
const
|
|
1348
|
+
const i = (o) => {
|
|
1325
1349
|
var a;
|
|
1326
1350
|
if (!this._actions.selectedNode || this._actions.editingNode || this._actions.editOverlay || this._actions.addInputUI) return;
|
|
1327
|
-
const
|
|
1328
|
-
|
|
1351
|
+
const s = (a = document.activeElement) == null ? void 0 : a.tagName;
|
|
1352
|
+
s === "INPUT" || s === "TEXTAREA" || (o.key === "Tab" && this.options.addable ? (o.preventDefault(), o.stopPropagation(), this._actions.showAddInput(this._actions.selectedNode)) : o.key === "Enter" && this.options.addable ? (o.preventDefault(), o.stopPropagation(), this._actions.showAddSiblingInput(this._actions.selectedNode)) : (o.key === "Delete" || o.key === "Backspace") && this.options.deletable && (o.preventDefault(), o.stopPropagation(), this._actions.deleteNode(this._actions.selectedNode)));
|
|
1329
1353
|
};
|
|
1330
|
-
document.addEventListener("keydown",
|
|
1331
|
-
|
|
1354
|
+
document.addEventListener("keydown", i), this._disposeList.push(() => document.removeEventListener("keydown", i)), this._observer = new ResizeObserver(
|
|
1355
|
+
jt(() => {
|
|
1332
1356
|
this._actions.editingNode || this.renderData();
|
|
1333
1357
|
}, 100)
|
|
1334
1358
|
), this._disposeList.push(
|
|
1335
|
-
|
|
1359
|
+
Pe.tap(() => {
|
|
1336
1360
|
this.setData();
|
|
1337
1361
|
}),
|
|
1338
1362
|
() => this._actions.hideAddUI(),
|
|
@@ -1340,39 +1364,39 @@
|
|
|
1340
1364
|
);
|
|
1341
1365
|
}
|
|
1342
1366
|
getStyleContent() {
|
|
1343
|
-
const { style: t } = this.options, { id:
|
|
1344
|
-
return [this.options.embedGlobalCSS &&
|
|
1367
|
+
const { style: t } = this.options, { id: e } = this.state, i = typeof t == "function" ? t(e) : "";
|
|
1368
|
+
return [this.options.embedGlobalCSS && wt, i].filter(Boolean).join(`
|
|
1345
1369
|
`);
|
|
1346
1370
|
}
|
|
1347
1371
|
updateStyle() {
|
|
1348
|
-
const t =
|
|
1349
|
-
this.svg.attr("class", [t,
|
|
1350
|
-
const
|
|
1351
|
-
this.styleNode.text(
|
|
1352
|
-
}
|
|
1353
|
-
async toggleNode(t,
|
|
1354
|
-
var
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1372
|
+
const t = Dt("", "markmap", this.state.id), e = this.options.collapseOnHover ? "markmap-collapse-on-hover" : "";
|
|
1373
|
+
this.svg.attr("class", [t, e].filter(Boolean).join(" "));
|
|
1374
|
+
const i = this.getStyleContent();
|
|
1375
|
+
this.styleNode.text(i);
|
|
1376
|
+
}
|
|
1377
|
+
async toggleNode(t, e = false) {
|
|
1378
|
+
var o, s;
|
|
1379
|
+
const i = (o = t.payload) != null && o.fold ? 0 : 1;
|
|
1380
|
+
e ? R(t, (a, l) => {
|
|
1357
1381
|
a.payload = {
|
|
1358
1382
|
...a.payload,
|
|
1359
|
-
fold:
|
|
1360
|
-
},
|
|
1383
|
+
fold: i
|
|
1384
|
+
}, l();
|
|
1361
1385
|
}) : t.payload = {
|
|
1362
1386
|
...t.payload,
|
|
1363
|
-
fold: (
|
|
1387
|
+
fold: (s = t.payload) != null && s.fold ? 0 : 1
|
|
1364
1388
|
}, await this.renderData(t);
|
|
1365
1389
|
}
|
|
1366
1390
|
_initializeData(t) {
|
|
1367
|
-
let
|
|
1368
|
-
const { color:
|
|
1369
|
-
let
|
|
1370
|
-
return
|
|
1371
|
-
var u, f, g,
|
|
1372
|
-
a += 1,
|
|
1373
|
-
...
|
|
1391
|
+
let e = 0;
|
|
1392
|
+
const { color: i, initialExpandLevel: o } = this.options;
|
|
1393
|
+
let s = 0, a = 0;
|
|
1394
|
+
return R(t, (l, h2, c) => {
|
|
1395
|
+
var u, f, g, y;
|
|
1396
|
+
a += 1, l.children = (u = l.children) == null ? void 0 : u.map((v) => ({ ...v })), e += 1, l.state = {
|
|
1397
|
+
...l.state,
|
|
1374
1398
|
depth: a,
|
|
1375
|
-
id:
|
|
1399
|
+
id: e,
|
|
1376
1400
|
rect: {
|
|
1377
1401
|
x: 0,
|
|
1378
1402
|
y: 0,
|
|
@@ -1380,361 +1404,361 @@
|
|
|
1380
1404
|
height: 0
|
|
1381
1405
|
},
|
|
1382
1406
|
size: [0, 0]
|
|
1383
|
-
},
|
|
1384
|
-
const d = ((
|
|
1385
|
-
d ?
|
|
1407
|
+
}, l.state.key = [(f = c == null ? void 0 : c.state) == null ? void 0 : f.id, l.state.id].filter(Boolean).join(".") + V(l.content), l.state.path = [(g = c == null ? void 0 : c.state) == null ? void 0 : g.path, l.state.id].filter(Boolean).join("."), i(l);
|
|
1408
|
+
const d = ((y = l.payload) == null ? void 0 : y.fold) === 2;
|
|
1409
|
+
d ? s += 1 : (s || o >= 0 && l.state.depth >= o) && (l.payload = { ...l.payload, fold: 1 }), h2(), d && (s -= 1), a -= 1;
|
|
1386
1410
|
}), t;
|
|
1387
1411
|
}
|
|
1388
1412
|
_relayout() {
|
|
1389
1413
|
if (!this.state.data) return;
|
|
1390
1414
|
this.g.selectAll(b(A)).selectAll(
|
|
1391
1415
|
b("foreignObject")
|
|
1392
|
-
).each(function(
|
|
1416
|
+
).each(function(c) {
|
|
1393
1417
|
var f;
|
|
1394
1418
|
const d = (f = this.firstChild) == null ? void 0 : f.firstChild, u = [d.scrollWidth, d.scrollHeight];
|
|
1395
|
-
|
|
1419
|
+
c.state.size = u;
|
|
1396
1420
|
});
|
|
1397
|
-
const { lineWidth: t, paddingX:
|
|
1421
|
+
const { lineWidth: t, paddingX: e, spacingHorizontal: i, spacingVertical: o } = this.options, s = (c) => {
|
|
1398
1422
|
var u;
|
|
1399
|
-
return (u =
|
|
1400
|
-
}, a =
|
|
1423
|
+
return (u = c.payload) != null && u.fold ? i : (c.children || []).length === 1 ? Math.round(i / 2) : i;
|
|
1424
|
+
}, a = vt({}).children((c) => {
|
|
1401
1425
|
var d;
|
|
1402
|
-
if (!((d =
|
|
1403
|
-
}).nodeSize((
|
|
1404
|
-
const [d, u] =
|
|
1405
|
-
return [u, d + (d ?
|
|
1406
|
-
}).spacing((
|
|
1407
|
-
a(
|
|
1408
|
-
const h2 =
|
|
1409
|
-
h2.forEach((
|
|
1410
|
-
const d =
|
|
1426
|
+
if (!((d = c.payload) != null && d.fold)) return c.children;
|
|
1427
|
+
}).nodeSize((c) => {
|
|
1428
|
+
const [d, u] = c.data.state.size, f = s(c.data);
|
|
1429
|
+
return [u, d + (d ? e * 2 : 0) + f];
|
|
1430
|
+
}).spacing((c, d) => (c.parent === d.parent ? o : o * 2) + t(c.data)), l = a.hierarchy(this.state.data);
|
|
1431
|
+
a(l);
|
|
1432
|
+
const h2 = l.descendants();
|
|
1433
|
+
h2.forEach((c) => {
|
|
1434
|
+
const d = c.data, u = s(d);
|
|
1411
1435
|
d.state.rect = {
|
|
1412
|
-
x:
|
|
1413
|
-
y:
|
|
1414
|
-
width:
|
|
1415
|
-
height:
|
|
1436
|
+
x: c.y,
|
|
1437
|
+
y: c.x - c.xSize / 2,
|
|
1438
|
+
width: c.ySize - u,
|
|
1439
|
+
height: c.xSize
|
|
1416
1440
|
};
|
|
1417
1441
|
}), this.state.rect = {
|
|
1418
|
-
x1: d32.min(h2, (
|
|
1419
|
-
y1: d32.min(h2, (
|
|
1442
|
+
x1: d32.min(h2, (c) => c.data.state.rect.x) || 0,
|
|
1443
|
+
y1: d32.min(h2, (c) => c.data.state.rect.y) || 0,
|
|
1420
1444
|
x2: d32.max(
|
|
1421
1445
|
h2,
|
|
1422
|
-
(
|
|
1446
|
+
(c) => c.data.state.rect.x + c.data.state.rect.width
|
|
1423
1447
|
) || 0,
|
|
1424
1448
|
y2: d32.max(
|
|
1425
1449
|
h2,
|
|
1426
|
-
(
|
|
1450
|
+
(c) => c.data.state.rect.y + c.data.state.rect.height
|
|
1427
1451
|
) || 0
|
|
1428
1452
|
};
|
|
1429
1453
|
}
|
|
1430
1454
|
setOptions(t) {
|
|
1431
|
-
const
|
|
1455
|
+
const e = (t == null ? void 0 : t.mode) === "display" ? { editable: false, addable: false, deletable: false, collapseOnHover: false, hoverBorder: false, clickBorder: false } : (t == null ? void 0 : t.mode) === "editable" ? { editable: true, addable: true, deletable: true, collapseOnHover: true, hoverBorder: true, clickBorder: true } : {};
|
|
1432
1456
|
this.options = {
|
|
1433
1457
|
...this.options,
|
|
1434
|
-
...
|
|
1458
|
+
...e,
|
|
1435
1459
|
...t
|
|
1436
1460
|
}, this.options.zoom ? this.svg.call(this.zoom) : this.svg.on(".zoom", null), this.options.pan ? this.svg.on("wheel", this.handlePan) : this.svg.on("wheel", null);
|
|
1437
1461
|
}
|
|
1438
|
-
async setData(t,
|
|
1439
|
-
|
|
1462
|
+
async setData(t, e) {
|
|
1463
|
+
e && this.setOptions(e), t && (this.state.data = this._initializeData(t)), this.state.data && (this.updateStyle(), await this.renderData());
|
|
1440
1464
|
}
|
|
1441
1465
|
getData(t) {
|
|
1442
|
-
const
|
|
1443
|
-
if (!
|
|
1444
|
-
if (!t) return
|
|
1445
|
-
const
|
|
1446
|
-
content:
|
|
1447
|
-
payload:
|
|
1448
|
-
children: (
|
|
1466
|
+
const e = this.state.data;
|
|
1467
|
+
if (!e) return;
|
|
1468
|
+
if (!t) return e;
|
|
1469
|
+
const i = (o) => ({
|
|
1470
|
+
content: o.content,
|
|
1471
|
+
payload: o.payload,
|
|
1472
|
+
children: (o.children || []).map(i)
|
|
1449
1473
|
});
|
|
1450
|
-
return e
|
|
1474
|
+
return i(e);
|
|
1451
1475
|
}
|
|
1452
1476
|
async setHighlight(t) {
|
|
1453
1477
|
this.state.highlight = t || void 0, await this.renderData();
|
|
1454
1478
|
}
|
|
1455
1479
|
_getHighlightRect(t) {
|
|
1456
|
-
const
|
|
1480
|
+
const e = this.svg.node(), o = 4 / d32.zoomTransform(e).k, s = {
|
|
1457
1481
|
...t.state.rect
|
|
1458
1482
|
};
|
|
1459
|
-
return
|
|
1483
|
+
return s.x -= o, s.y -= o, s.width += 2 * o, s.height += 2 * o, s;
|
|
1460
1484
|
}
|
|
1461
1485
|
async renderData(t) {
|
|
1462
|
-
const { paddingX:
|
|
1463
|
-
if (!
|
|
1464
|
-
const h2 = {},
|
|
1465
|
-
|
|
1486
|
+
const { paddingX: e, autoFit: i, color: o, maxWidth: s, lineWidth: a } = this.options, l = this.state.data;
|
|
1487
|
+
if (!l) return;
|
|
1488
|
+
const h2 = {}, c = {}, d = [];
|
|
1489
|
+
R(l, (r, p, m) => {
|
|
1466
1490
|
var w;
|
|
1467
|
-
(w =
|
|
1491
|
+
(w = r.payload) != null && w.fold || p(), h2[r.state.id] = r, m && (c[r.state.id] = m.state.id), d.push(r);
|
|
1468
1492
|
});
|
|
1469
|
-
const u = {}, f = {}, g = (
|
|
1470
|
-
!
|
|
1471
|
-
u[p.state.id] =
|
|
1493
|
+
const u = {}, f = {}, g = (r) => {
|
|
1494
|
+
!r || u[r.state.id] || R(r, (p, m) => {
|
|
1495
|
+
u[p.state.id] = r.state.id, m();
|
|
1472
1496
|
});
|
|
1473
|
-
},
|
|
1474
|
-
f[
|
|
1497
|
+
}, y = (r) => f[u[r.state.id]] || l.state.rect, v = (r) => (h2[u[r.state.id]] || l).state.rect;
|
|
1498
|
+
f[l.state.id] = l.state.rect, t && g(t);
|
|
1475
1499
|
let { highlight: k } = this.state;
|
|
1476
1500
|
k && !h2[k.state.id] && (k = void 0);
|
|
1477
|
-
let
|
|
1478
|
-
const
|
|
1479
|
-
f[
|
|
1480
|
-
}).data(d, (
|
|
1481
|
-
g(h2[
|
|
1482
|
-
}),
|
|
1483
|
-
g(h2[
|
|
1484
|
-
}),
|
|
1501
|
+
let x = this.g.selectAll(b(De)).selectAll(b("rect")).data(k ? [this._getHighlightRect(k)] : []).join("rect").attr("x", (r) => r.x).attr("y", (r) => r.y).attr("width", (r) => r.width).attr("height", (r) => r.height);
|
|
1502
|
+
const _ = this.g.selectAll(b(A)).each((r) => {
|
|
1503
|
+
f[r.state.id] = r.state.rect;
|
|
1504
|
+
}).data(d, (r) => r.state.key), G = _.enter().append("g").attr("data-depth", (r) => r.state.depth).attr("data-path", (r) => r.state.path).each((r) => {
|
|
1505
|
+
g(h2[c[r.state.id]]);
|
|
1506
|
+
}), T = _.exit().each((r) => {
|
|
1507
|
+
g(h2[c[r.state.id]]);
|
|
1508
|
+
}), M = _.merge(G).attr(
|
|
1485
1509
|
"class",
|
|
1486
|
-
(
|
|
1510
|
+
(r) => {
|
|
1487
1511
|
var p;
|
|
1488
|
-
return ["markmap-node", ((p =
|
|
1512
|
+
return ["markmap-node", ((p = r.payload) == null ? void 0 : p.fold) && "markmap-fold"].filter(Boolean).join(" ");
|
|
1489
1513
|
}
|
|
1490
|
-
),
|
|
1491
|
-
(
|
|
1492
|
-
(
|
|
1493
|
-
),
|
|
1494
|
-
(
|
|
1514
|
+
), q = M.selectAll(b("line")).data(
|
|
1515
|
+
(r) => [r],
|
|
1516
|
+
(r) => r.state.key
|
|
1517
|
+
), J = q.enter().append("line").attr("stroke", (r) => o(r)).attr("stroke-width", 0), Z2 = q.merge(J), j = M.selectAll(b("circle")).data(
|
|
1518
|
+
(r) => {
|
|
1495
1519
|
var p;
|
|
1496
|
-
return (p =
|
|
1520
|
+
return (p = r.children) != null && p.length ? [r] : [];
|
|
1497
1521
|
},
|
|
1498
|
-
(
|
|
1522
|
+
(r) => r.state.key
|
|
1499
1523
|
);
|
|
1500
|
-
this.transition(
|
|
1501
|
-
const
|
|
1524
|
+
this.transition(j.exit()).attr("r", 0).attr("stroke-width", 0).remove();
|
|
1525
|
+
const Q = j.enter().append("circle").attr("stroke-width", 0).attr("r", 0).on("click", (r, p) => this.handleClick(r, p)).on("mousedown", dt).merge(j).attr("stroke", (r) => o(r)).attr(
|
|
1502
1526
|
"fill",
|
|
1503
|
-
(
|
|
1527
|
+
(r) => {
|
|
1504
1528
|
var p;
|
|
1505
|
-
return (p =
|
|
1529
|
+
return (p = r.payload) != null && p.fold && r.children ? o(r) : "var(--markmap-circle-open-bg)";
|
|
1506
1530
|
}
|
|
1507
|
-
),
|
|
1508
|
-
(
|
|
1509
|
-
(
|
|
1510
|
-
),
|
|
1511
|
-
|
|
1531
|
+
), tt = this._observer, et = M.selectAll(b("foreignObject")).data(
|
|
1532
|
+
(r) => [r],
|
|
1533
|
+
(r) => r.state.key
|
|
1534
|
+
), X = et.enter().append("foreignObject").attr("class", "markmap-foreign").attr("x", e).attr("y", 0).style("opacity", 0).on("mousedown", dt).on("dblclick", (r, p) => {
|
|
1535
|
+
r.preventDefault(), r.stopPropagation(), r.stopImmediatePropagation(), this._actions.handleEdit(r, p);
|
|
1512
1536
|
});
|
|
1513
|
-
|
|
1537
|
+
X.append("xhtml:div").append("xhtml:div").html((r) => r.content).attr("xmlns", "http://www.w3.org/1999/xhtml"), X.each(function() {
|
|
1514
1538
|
var p;
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1539
|
+
const r = (p = this.firstChild) == null ? void 0 : p.firstChild;
|
|
1540
|
+
tt.observe(r);
|
|
1517
1541
|
});
|
|
1518
|
-
const
|
|
1542
|
+
const it = T.selectAll(
|
|
1519
1543
|
b("foreignObject")
|
|
1520
1544
|
);
|
|
1521
|
-
|
|
1545
|
+
it.each(function() {
|
|
1522
1546
|
var p;
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1547
|
+
const r = (p = this.firstChild) == null ? void 0 : p.firstChild;
|
|
1548
|
+
tt.unobserve(r);
|
|
1525
1549
|
});
|
|
1526
|
-
const O =
|
|
1527
|
-
O.on("dblclick", (
|
|
1528
|
-
|
|
1529
|
-
}), O.on("mouseenter", (
|
|
1530
|
-
var
|
|
1550
|
+
const O = X.merge(et);
|
|
1551
|
+
O.on("dblclick", (r, p) => {
|
|
1552
|
+
r.preventDefault(), r.stopPropagation(), r.stopImmediatePropagation(), this._actions.handleEdit(r, p);
|
|
1553
|
+
}), O.on("mouseenter", (r, p) => {
|
|
1554
|
+
var N, I;
|
|
1531
1555
|
if (!this.options.hoverBorder) return;
|
|
1532
1556
|
const m = this.findElement(p);
|
|
1533
1557
|
if (!m) return;
|
|
1534
|
-
const w = (I = (
|
|
1558
|
+
const w = (I = (N = d32.select(m.g).select("foreignObject").node()) == null ? void 0 : N.firstChild) == null ? void 0 : I.firstChild;
|
|
1535
1559
|
if (!w) return;
|
|
1536
1560
|
const E = w.getBoundingClientRect();
|
|
1537
|
-
|
|
1538
|
-
}), O.on("mousemove", (
|
|
1539
|
-
var I,
|
|
1561
|
+
r.clientX >= E.left && r.clientX <= E.right && r.clientY >= E.top && r.clientY <= E.bottom && d32.select(m.g).classed("markmap-node-hovered", true);
|
|
1562
|
+
}), O.on("mousemove", (r, p) => {
|
|
1563
|
+
var I, C;
|
|
1540
1564
|
if (!this.options.hoverBorder) return;
|
|
1541
1565
|
const m = this.findElement(p);
|
|
1542
1566
|
if (!m) return;
|
|
1543
|
-
const w = (
|
|
1567
|
+
const w = (C = (I = d32.select(m.g).select("foreignObject").node()) == null ? void 0 : I.firstChild) == null ? void 0 : C.firstChild;
|
|
1544
1568
|
if (!w) return;
|
|
1545
|
-
const E = w.getBoundingClientRect(),
|
|
1546
|
-
d32.select(m.g).classed("markmap-node-hovered",
|
|
1547
|
-
}), O.on("mouseleave", (
|
|
1569
|
+
const E = w.getBoundingClientRect(), N = r.clientX >= E.left && r.clientX <= E.right && r.clientY >= E.top && r.clientY <= E.bottom;
|
|
1570
|
+
d32.select(m.g).classed("markmap-node-hovered", N);
|
|
1571
|
+
}), O.on("mouseleave", (r, p) => {
|
|
1548
1572
|
if (!this.options.hoverBorder) return;
|
|
1549
1573
|
const m = this.findElement(p);
|
|
1550
1574
|
m && d32.select(m.g).classed("markmap-node-hovered", false);
|
|
1551
|
-
}), O.on("click", (
|
|
1552
|
-
var
|
|
1575
|
+
}), O.on("click", (r, p) => {
|
|
1576
|
+
var N, I;
|
|
1553
1577
|
if (this._actions.editingNode || this._actions.editOverlay) return;
|
|
1554
|
-
|
|
1555
|
-
const m = this.findElement(p), w = m ? (I = (
|
|
1578
|
+
r.stopPropagation();
|
|
1579
|
+
const m = this.findElement(p), w = m ? (I = (N = d32.select(m.g).select("foreignObject").node()) == null ? void 0 : N.firstChild) == null ? void 0 : I.firstChild : null;
|
|
1556
1580
|
(() => {
|
|
1557
1581
|
if (!w) return false;
|
|
1558
|
-
const
|
|
1559
|
-
return
|
|
1560
|
-
})() && (this._actions.selectedNode = p, this.options.clickBorder && this.g.selectAll(b(A)).classed("markmap-selected", (
|
|
1561
|
-
}), O.select("div").select("div").html((
|
|
1562
|
-
const
|
|
1563
|
-
(
|
|
1582
|
+
const C = w.getBoundingClientRect();
|
|
1583
|
+
return r.clientX >= C.left && r.clientX <= C.right && r.clientY >= C.top && r.clientY <= C.bottom;
|
|
1584
|
+
})() && (this._actions.selectedNode = p, this.options.clickBorder && this.g.selectAll(b(A)).classed("markmap-selected", (C) => C === p), this.options.addable && this._actions.showAddUI(p));
|
|
1585
|
+
}), O.select("div").select("div").html((r) => r.content);
|
|
1586
|
+
const St = d.flatMap(
|
|
1587
|
+
(r) => {
|
|
1564
1588
|
var p;
|
|
1565
|
-
return (p =
|
|
1589
|
+
return (p = r.payload) != null && p.fold ? [] : r.children.map((m) => ({ source: r, target: m }));
|
|
1566
1590
|
}
|
|
1567
|
-
), U = this.g.selectAll(b(
|
|
1568
|
-
const p =
|
|
1591
|
+
), U = this.g.selectAll(b(Be)).data(St, (r) => r.target.state.key), Ct = U.exit(), _t = U.enter().insert("path", "g").attr("class", "markmap-link").attr("data-depth", (r) => r.target.state.depth).attr("data-path", (r) => r.target.state.path).attr("d", (r) => {
|
|
1592
|
+
const p = y(r.target), m = [
|
|
1569
1593
|
p.x + p.width,
|
|
1570
1594
|
p.y + p.height
|
|
1571
1595
|
];
|
|
1572
|
-
return
|
|
1596
|
+
return F({ source: m, target: m });
|
|
1573
1597
|
}).attr("stroke-width", 0).merge(U);
|
|
1574
1598
|
this.svg.style(
|
|
1575
1599
|
"--markmap-max-width",
|
|
1576
|
-
|
|
1577
|
-
), await new Promise(requestAnimationFrame), this._relayout(),
|
|
1578
|
-
const p =
|
|
1579
|
-
return `translate(${p.x + p.width -
|
|
1580
|
-
}), this.transition(
|
|
1581
|
-
const p = v(
|
|
1600
|
+
s ? `${s}px` : null
|
|
1601
|
+
), await new Promise(requestAnimationFrame), this._relayout(), x = x.data(k ? [this._getHighlightRect(k)] : []).join("rect"), this.transition(x).attr("x", (r) => r.x).attr("y", (r) => r.y).attr("width", (r) => r.width).attr("height", (r) => r.height), G.attr("transform", (r) => {
|
|
1602
|
+
const p = y(r);
|
|
1603
|
+
return `translate(${p.x + p.width - r.state.rect.width},${p.y + p.height - r.state.rect.height})`;
|
|
1604
|
+
}), this.transition(T).attr("transform", (r) => {
|
|
1605
|
+
const p = v(r), m = p.x + p.width - r.state.rect.width, w = p.y + p.height - r.state.rect.height;
|
|
1582
1606
|
return `translate(${m},${w})`;
|
|
1583
|
-
}).remove(), this.transition(
|
|
1607
|
+
}).remove(), this.transition(M).attr(
|
|
1584
1608
|
"transform",
|
|
1585
|
-
(
|
|
1609
|
+
(r) => `translate(${r.state.rect.x},${r.state.rect.y})`
|
|
1586
1610
|
);
|
|
1587
|
-
const
|
|
1611
|
+
const Ot = T.selectAll(
|
|
1588
1612
|
b("line")
|
|
1589
1613
|
);
|
|
1590
|
-
this.transition(
|
|
1591
|
-
const
|
|
1614
|
+
this.transition(Ot).attr("x1", (r) => r.state.rect.width).attr("stroke-width", 0), J.attr("x1", (r) => r.state.rect.width).attr("x2", (r) => r.state.rect.width), Z2.attr("y1", (r) => r.state.rect.height + a(r) / 2).attr("y2", (r) => r.state.rect.height + a(r) / 2), this.transition(Z2).attr("x1", -1).attr("x2", (r) => r.state.rect.width + 2).attr("stroke", (r) => o(r)).attr("stroke-width", a);
|
|
1615
|
+
const It = T.selectAll(
|
|
1592
1616
|
b("circle")
|
|
1593
1617
|
);
|
|
1594
|
-
this.transition(
|
|
1595
|
-
const p = v(
|
|
1618
|
+
this.transition(It).attr("r", 0).attr("stroke-width", 0), Q.attr("cx", (r) => r.state.rect.width + 4).attr("cy", (r) => r.state.rect.height + a(r) / 2), this.transition(Q).attr("r", 6).attr("stroke-width", 1.5), this.transition(it).style("opacity", 0), O.attr("width", (r) => Math.max(0, r.state.rect.width - e * 2 + 16)).attr("height", (r) => r.state.rect.height), this.transition(O).style("opacity", 1), this.transition(Ct).attr("d", (r) => {
|
|
1619
|
+
const p = v(r.target), m = [
|
|
1596
1620
|
p.x + p.width,
|
|
1597
|
-
p.y + p.height + a(
|
|
1621
|
+
p.y + p.height + a(r.target) / 2
|
|
1598
1622
|
];
|
|
1599
|
-
return
|
|
1600
|
-
}).attr("stroke-width", 0).remove(), this.transition(
|
|
1601
|
-
const p =
|
|
1623
|
+
return F({ source: m, target: m });
|
|
1624
|
+
}).attr("stroke-width", 0).remove(), this.transition(_t).attr("stroke", (r) => o(r.target)).attr("stroke-width", (r) => a(r.target)).attr("d", (r) => {
|
|
1625
|
+
const p = r.source, m = r.target, w = [
|
|
1602
1626
|
p.state.rect.x + p.state.rect.width,
|
|
1603
1627
|
p.state.rect.y + p.state.rect.height + a(p) / 2
|
|
1604
1628
|
], E = [
|
|
1605
1629
|
m.state.rect.x,
|
|
1606
1630
|
m.state.rect.y + m.state.rect.height + a(m) / 2
|
|
1607
1631
|
];
|
|
1608
|
-
return
|
|
1609
|
-
}),
|
|
1632
|
+
return F({ source: w, target: E });
|
|
1633
|
+
}), i && this.fit();
|
|
1610
1634
|
}
|
|
1611
1635
|
transition(t) {
|
|
1612
|
-
const { duration:
|
|
1613
|
-
return t.transition().duration(
|
|
1636
|
+
const { duration: e } = this.options;
|
|
1637
|
+
return t.transition().duration(e);
|
|
1614
1638
|
}
|
|
1615
1639
|
/**
|
|
1616
1640
|
* Fit the content to the viewport.
|
|
1617
1641
|
*/
|
|
1618
1642
|
async fit(t = this.options.maxInitialScale) {
|
|
1619
|
-
const
|
|
1620
|
-
|
|
1621
|
-
|
|
1643
|
+
const e = this.svg.node(), { width: i, height: o } = e.getBoundingClientRect(), { fitRatio: s } = this.options, { x1: a, y1: l, x2: h2, y2: c } = this.state.rect, d = h2 - a, u = c - l, f = Math.min(
|
|
1644
|
+
i / d * s,
|
|
1645
|
+
o / u * s,
|
|
1622
1646
|
t
|
|
1623
1647
|
), g = d32.zoomIdentity.translate(
|
|
1624
|
-
(
|
|
1625
|
-
(
|
|
1648
|
+
(i - d * f) / 2 - a * f,
|
|
1649
|
+
(o - u * f) / 2 - l * f
|
|
1626
1650
|
).scale(f);
|
|
1627
|
-
return this.transition(this.svg).call(this.zoom.transform, g).end().catch(
|
|
1651
|
+
return this.transition(this.svg).call(this.zoom.transform, g).end().catch(B);
|
|
1628
1652
|
}
|
|
1629
1653
|
findElement(t) {
|
|
1630
|
-
let
|
|
1631
|
-
return this.g.selectAll(b(A)).each(function(
|
|
1632
|
-
|
|
1633
|
-
data:
|
|
1654
|
+
let e;
|
|
1655
|
+
return this.g.selectAll(b(A)).each(function(o) {
|
|
1656
|
+
o === t && (e = {
|
|
1657
|
+
data: o,
|
|
1634
1658
|
g: this
|
|
1635
1659
|
});
|
|
1636
|
-
}),
|
|
1660
|
+
}), e;
|
|
1637
1661
|
}
|
|
1638
1662
|
/**
|
|
1639
1663
|
* Pan the content to make the provided node visible in the viewport.
|
|
1640
1664
|
*/
|
|
1641
|
-
async ensureVisible(t,
|
|
1665
|
+
async ensureVisible(t, e) {
|
|
1642
1666
|
var k;
|
|
1643
|
-
const
|
|
1644
|
-
if (!
|
|
1645
|
-
const
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
].map((
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
].map((
|
|
1667
|
+
const i = (k = this.findElement(t)) == null ? void 0 : k.data;
|
|
1668
|
+
if (!i) return;
|
|
1669
|
+
const o = this.svg.node(), s = o.getBoundingClientRect(), a = d32.zoomTransform(o), [l, h2] = [
|
|
1670
|
+
i.state.rect.x,
|
|
1671
|
+
i.state.rect.x + i.state.rect.width + 2
|
|
1672
|
+
].map((x) => x * a.k + a.x), [c, d] = [
|
|
1673
|
+
i.state.rect.y,
|
|
1674
|
+
i.state.rect.y + i.state.rect.height
|
|
1675
|
+
].map((x) => x * a.k + a.y), u = {
|
|
1652
1676
|
left: 0,
|
|
1653
1677
|
right: 0,
|
|
1654
1678
|
top: 0,
|
|
1655
1679
|
bottom: 0,
|
|
1656
|
-
...
|
|
1657
|
-
}, f = [u.left -
|
|
1658
|
-
if (
|
|
1659
|
-
const
|
|
1660
|
-
return this.transition(this.svg).call(this.zoom.transform,
|
|
1680
|
+
...e
|
|
1681
|
+
}, f = [u.left - l, s.width - u.right - h2], g = [u.top - c, s.height - u.bottom - d], y = f[0] * f[1] > 0 ? ct(f, Math.abs) / a.k : 0, v = g[0] * g[1] > 0 ? ct(g, Math.abs) / a.k : 0;
|
|
1682
|
+
if (y || v) {
|
|
1683
|
+
const x = a.translate(y, v);
|
|
1684
|
+
return this.transition(this.svg).call(this.zoom.transform, x).end().catch(B);
|
|
1661
1685
|
}
|
|
1662
1686
|
}
|
|
1663
|
-
async centerNode(t,
|
|
1664
|
-
var
|
|
1665
|
-
const
|
|
1666
|
-
if (!
|
|
1667
|
-
const
|
|
1687
|
+
async centerNode(t, e) {
|
|
1688
|
+
var y;
|
|
1689
|
+
const i = (y = this.findElement(t)) == null ? void 0 : y.data;
|
|
1690
|
+
if (!i) return;
|
|
1691
|
+
const o = this.svg.node(), s = o.getBoundingClientRect(), a = d32.zoomTransform(o), l = (i.state.rect.x + i.state.rect.width / 2) * a.k + a.x, h2 = (i.state.rect.y + i.state.rect.height / 2) * a.k + a.y, c = {
|
|
1668
1692
|
left: 0,
|
|
1669
1693
|
right: 0,
|
|
1670
1694
|
top: 0,
|
|
1671
1695
|
bottom: 0,
|
|
1672
|
-
...
|
|
1673
|
-
}, d = (
|
|
1696
|
+
...e
|
|
1697
|
+
}, d = (c.left + s.width - c.right) / 2, u = (c.top + s.height - c.bottom) / 2, f = (d - l) / a.k, g = (u - h2) / a.k;
|
|
1674
1698
|
if (f || g) {
|
|
1675
1699
|
const v = a.translate(f, g);
|
|
1676
|
-
return this.transition(this.svg).call(this.zoom.transform, v).end().catch(
|
|
1700
|
+
return this.transition(this.svg).call(this.zoom.transform, v).end().catch(B);
|
|
1677
1701
|
}
|
|
1678
1702
|
}
|
|
1679
1703
|
/**
|
|
1680
1704
|
* Scale content with it pinned at the center of the viewport.
|
|
1681
1705
|
*/
|
|
1682
1706
|
async rescale(t) {
|
|
1683
|
-
const
|
|
1684
|
-
(
|
|
1685
|
-
(a -
|
|
1707
|
+
const e = this.svg.node(), { width: i, height: o } = e.getBoundingClientRect(), s = i / 2, a = o / 2, l = d32.zoomTransform(e), h2 = l.translate(
|
|
1708
|
+
(s - l.x) * (1 - t) / l.k,
|
|
1709
|
+
(a - l.y) * (1 - t) / l.k
|
|
1686
1710
|
).scale(t);
|
|
1687
|
-
return this.transition(this.svg).call(this.zoom.transform, h2).end().catch(
|
|
1711
|
+
return this.transition(this.svg).call(this.zoom.transform, h2).end().catch(B);
|
|
1688
1712
|
}
|
|
1689
1713
|
destroy() {
|
|
1690
1714
|
this.svg.on(".zoom", null), this.svg.html(null), this._disposeList.forEach((t) => {
|
|
1691
1715
|
t();
|
|
1692
1716
|
});
|
|
1693
1717
|
}
|
|
1694
|
-
static create(t,
|
|
1695
|
-
const
|
|
1696
|
-
return
|
|
1697
|
-
|
|
1698
|
-
}),
|
|
1718
|
+
static create(t, e, i = null) {
|
|
1719
|
+
const o = new Et(t, e);
|
|
1720
|
+
return i && o.setData(i).then(() => {
|
|
1721
|
+
o.fit();
|
|
1722
|
+
}), o;
|
|
1699
1723
|
}
|
|
1700
1724
|
}
|
|
1701
|
-
function
|
|
1702
|
-
if (!
|
|
1703
|
-
let t =
|
|
1725
|
+
function $(n) {
|
|
1726
|
+
if (!n) return "";
|
|
1727
|
+
let t = n;
|
|
1704
1728
|
return t = t.replace(
|
|
1705
1729
|
/<img(?=[^>]*?\bsrc="([^"]*)")(?=[^>]*?\balt="([^"]*)")(?=[^>]*?\btitle="([^"]*)")?[^>]*?\/?>/gi,
|
|
1706
|
-
(
|
|
1730
|
+
(e, i, o, s) => s ? `` : ``
|
|
1707
1731
|
), t = t.replace(
|
|
1708
1732
|
/<img\s[^>]*?\/?>/gi,
|
|
1709
|
-
(
|
|
1710
|
-
const
|
|
1711
|
-
return
|
|
1733
|
+
(e) => {
|
|
1734
|
+
const i = (e.match(/\bsrc="([^"]*)"/) || [])[1] ?? "", o = (e.match(/\balt="([^"]*)"/) || [])[1] ?? "", s = (e.match(/\btitle="([^"]*)"/) || [])[1];
|
|
1735
|
+
return s ? `` : ``;
|
|
1712
1736
|
}
|
|
1713
1737
|
), t = t.replace(
|
|
1714
1738
|
/<a\s[^>]*?href="([^"]*)"[^>]*?>([\s\S]*?)<\/a>/gi,
|
|
1715
|
-
(
|
|
1716
|
-
const
|
|
1717
|
-
return
|
|
1739
|
+
(e, i, o) => {
|
|
1740
|
+
const s = (e.match(/\btitle="([^"]*)"/) || [])[1], a = $(o);
|
|
1741
|
+
return s ? `[${a}](${i} "${s}")` : `[${a}](${i})`;
|
|
1718
1742
|
}
|
|
1719
|
-
), t = t.replace(/<strong>([\s\S]*?)<\/strong>/gi, (
|
|
1720
|
-
`), t = t.replace(/<[^>]+>/g, ""), t = t.replace(/&#x([0-9a-f]+);/gi, (
|
|
1743
|
+
), t = t.replace(/<strong>([\s\S]*?)<\/strong>/gi, (e, i) => `**${$(i)}**`), t = t.replace(/<b>([\s\S]*?)<\/b>/gi, (e, i) => `**${$(i)}**`), t = t.replace(/<em>([\s\S]*?)<\/em>/gi, (e, i) => `*${$(i)}*`), t = t.replace(/<i>([\s\S]*?)<\/i>/gi, (e, i) => `*${$(i)}*`), t = t.replace(/<(?:del|s)>([\s\S]*?)<\/(?:del|s)>/gi, (e, i) => `~~${$(i)}~~`), t = t.replace(/<code>([\s\S]*?)<\/code>/gi, (e, i) => "`" + i.replace(/&#x([0-9a-f]+);/gi, (s, a) => String.fromCodePoint(parseInt(a, 16))).replace(/&#([0-9]+);/g, (s, a) => String.fromCodePoint(parseInt(a, 10))).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'") + "`"), t = t.replace(/<br\s*\/?>/gi, `
|
|
1744
|
+
`), t = t.replace(/<[^>]+>/g, ""), t = t.replace(/&#x([0-9a-f]+);/gi, (e, i) => String.fromCodePoint(parseInt(i, 16))).replace(/&#([0-9]+);/g, (e, i) => String.fromCodePoint(parseInt(i, 10))).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " "), t;
|
|
1721
1745
|
}
|
|
1722
|
-
function
|
|
1746
|
+
function Ve(n) {
|
|
1723
1747
|
const t = [];
|
|
1724
|
-
function i
|
|
1725
|
-
const
|
|
1726
|
-
if (
|
|
1727
|
-
if (
|
|
1728
|
-
const a = "#".repeat(
|
|
1729
|
-
t.length > 0 && t.push(""), t.push(`${a} ${
|
|
1748
|
+
function e(i, o) {
|
|
1749
|
+
const s = $(i.content).trim();
|
|
1750
|
+
if (s)
|
|
1751
|
+
if (o <= 2) {
|
|
1752
|
+
const a = "#".repeat(o + 1);
|
|
1753
|
+
t.length > 0 && t.push(""), t.push(`${a} ${s}`);
|
|
1730
1754
|
} else {
|
|
1731
|
-
const a = " ".repeat(
|
|
1732
|
-
t.push(`${a}- ${
|
|
1755
|
+
const a = " ".repeat(o - 3);
|
|
1756
|
+
t.push(`${a}- ${s}`);
|
|
1733
1757
|
}
|
|
1734
|
-
for (const a of
|
|
1735
|
-
|
|
1758
|
+
for (const a of i.children)
|
|
1759
|
+
e(a, o + 1);
|
|
1736
1760
|
}
|
|
1737
|
-
return
|
|
1761
|
+
return e(n, 0), t.join(`
|
|
1738
1762
|
`).trimStart() + `
|
|
1739
1763
|
`;
|
|
1740
1764
|
}
|
|
@@ -3905,12 +3929,12 @@
|
|
|
3905
3929
|
} else {
|
|
3906
3930
|
const elClasses = splitNames(el.attribs["class"]);
|
|
3907
3931
|
let changed = false;
|
|
3908
|
-
for (let
|
|
3909
|
-
const index2 = elClasses.indexOf(classes[
|
|
3932
|
+
for (let j = 0; j < numClasses; j++) {
|
|
3933
|
+
const index2 = elClasses.indexOf(classes[j]);
|
|
3910
3934
|
if (index2 >= 0) {
|
|
3911
3935
|
elClasses.splice(index2, 1);
|
|
3912
3936
|
changed = true;
|
|
3913
|
-
|
|
3937
|
+
j--;
|
|
3914
3938
|
}
|
|
3915
3939
|
}
|
|
3916
3940
|
if (changed) {
|
|
@@ -3938,10 +3962,10 @@
|
|
|
3938
3962
|
if (!isTag(el))
|
|
3939
3963
|
continue;
|
|
3940
3964
|
const elementClasses = splitNames(el.attribs["class"]);
|
|
3941
|
-
for (let
|
|
3942
|
-
const index2 = elementClasses.indexOf(classNames[
|
|
3965
|
+
for (let j = 0; j < numClasses; j++) {
|
|
3966
|
+
const index2 = elementClasses.indexOf(classNames[j]);
|
|
3943
3967
|
if (state >= 0 && index2 < 0) {
|
|
3944
|
-
elementClasses.push(classNames[
|
|
3968
|
+
elementClasses.push(classNames[j]);
|
|
3945
3969
|
} else if (state <= 0 && index2 >= 0) {
|
|
3946
3970
|
elementClasses.splice(index2, 1);
|
|
3947
3971
|
}
|
|
@@ -4373,12 +4397,12 @@
|
|
|
4373
4397
|
const procNew = procs[i];
|
|
4374
4398
|
if (procNew < 0)
|
|
4375
4399
|
continue;
|
|
4376
|
-
for (let
|
|
4377
|
-
const token = arr[
|
|
4378
|
-
arr[
|
|
4379
|
-
arr[
|
|
4380
|
-
procs[
|
|
4381
|
-
procs[
|
|
4400
|
+
for (let j = i - 1; j >= 0 && procNew < procs[j]; j--) {
|
|
4401
|
+
const token = arr[j + 1];
|
|
4402
|
+
arr[j + 1] = arr[j];
|
|
4403
|
+
arr[j] = token;
|
|
4404
|
+
procs[j + 1] = procs[j];
|
|
4405
|
+
procs[j] = procNew;
|
|
4382
4406
|
}
|
|
4383
4407
|
}
|
|
4384
4408
|
}
|
|
@@ -5887,14 +5911,14 @@
|
|
|
5887
5911
|
if (!wrapperDom || !hasChildren(wrapperDom))
|
|
5888
5912
|
continue;
|
|
5889
5913
|
let elInsertLocation = wrapperDom;
|
|
5890
|
-
let
|
|
5891
|
-
while (
|
|
5892
|
-
const child = elInsertLocation.children[
|
|
5914
|
+
let j = 0;
|
|
5915
|
+
while (j < elInsertLocation.children.length) {
|
|
5916
|
+
const child = elInsertLocation.children[j];
|
|
5893
5917
|
if (isTag(child)) {
|
|
5894
5918
|
elInsertLocation = child;
|
|
5895
|
-
|
|
5919
|
+
j = 0;
|
|
5896
5920
|
} else {
|
|
5897
|
-
|
|
5921
|
+
j++;
|
|
5898
5922
|
}
|
|
5899
5923
|
}
|
|
5900
5924
|
insert(el, elInsertLocation, [wrapperDom]);
|
|
@@ -5932,14 +5956,14 @@
|
|
|
5932
5956
|
if (wrap2[i].type === "tag")
|
|
5933
5957
|
elInsertLocation = wrap2[i];
|
|
5934
5958
|
}
|
|
5935
|
-
let
|
|
5936
|
-
while (elInsertLocation &&
|
|
5937
|
-
const child = elInsertLocation.children[
|
|
5959
|
+
let j = 0;
|
|
5960
|
+
while (elInsertLocation && j < elInsertLocation.children.length) {
|
|
5961
|
+
const child = elInsertLocation.children[j];
|
|
5938
5962
|
if (child.type === "tag") {
|
|
5939
5963
|
elInsertLocation = child;
|
|
5940
|
-
|
|
5964
|
+
j = 0;
|
|
5941
5965
|
} else {
|
|
5942
|
-
|
|
5966
|
+
j++;
|
|
5943
5967
|
}
|
|
5944
5968
|
}
|
|
5945
5969
|
if (elInsertLocation)
|
|
@@ -6257,8 +6281,8 @@
|
|
|
6257
6281
|
if (isArray) {
|
|
6258
6282
|
ret[key] = this._findBySelector(selector, Number.POSITIVE_INFINITY).map((_, el) => fn(el, key, ret)).get();
|
|
6259
6283
|
} else {
|
|
6260
|
-
const $ = this._findBySelector(selector, 1);
|
|
6261
|
-
ret[key] =
|
|
6284
|
+
const $2 = this._findBySelector(selector, 1);
|
|
6285
|
+
ret[key] = $2.length > 0 ? fn($2[0], key, ret) : void 0;
|
|
6262
6286
|
}
|
|
6263
6287
|
}
|
|
6264
6288
|
return ret;
|
|
@@ -7160,7 +7184,7 @@
|
|
|
7160
7184
|
const reNameEnd = /\s|\//;
|
|
7161
7185
|
let Parser$1 = class Parser {
|
|
7162
7186
|
constructor(cbs, options = {}) {
|
|
7163
|
-
var _a2, _b, _c, _d,
|
|
7187
|
+
var _a2, _b, _c, _d, _e2, _f;
|
|
7164
7188
|
this.options = options;
|
|
7165
7189
|
this.startIndex = 0;
|
|
7166
7190
|
this.endIndex = 0;
|
|
@@ -7181,7 +7205,7 @@
|
|
|
7181
7205
|
this.recognizeSelfClosing = (_c = options.recognizeSelfClosing) !== null && _c !== void 0 ? _c : !this.htmlMode;
|
|
7182
7206
|
this.tokenizer = new ((_d = options.Tokenizer) !== null && _d !== void 0 ? _d : Tokenizer)(this.options, this);
|
|
7183
7207
|
this.foreignContext = [!this.htmlMode];
|
|
7184
|
-
(_f = (
|
|
7208
|
+
(_f = (_e2 = this.cbs).onparserinit) === null || _f === void 0 ? void 0 : _f.call(_e2, this);
|
|
7185
7209
|
}
|
|
7186
7210
|
// Tokenizer event handlers
|
|
7187
7211
|
/** @internal */
|
|
@@ -7260,7 +7284,7 @@
|
|
|
7260
7284
|
}
|
|
7261
7285
|
/** @internal */
|
|
7262
7286
|
onclosetag(start, endIndex) {
|
|
7263
|
-
var _a2, _b, _c, _d,
|
|
7287
|
+
var _a2, _b, _c, _d, _e2, _f, _g, _h;
|
|
7264
7288
|
this.endIndex = endIndex;
|
|
7265
7289
|
let name2 = this.getSlice(start, endIndex);
|
|
7266
7290
|
if (this.lowerCaseTagNames) {
|
|
@@ -7282,7 +7306,7 @@
|
|
|
7282
7306
|
}
|
|
7283
7307
|
} else if (this.htmlMode && name2 === "br") {
|
|
7284
7308
|
(_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, "br");
|
|
7285
|
-
(_f = (
|
|
7309
|
+
(_f = (_e2 = this.cbs).onopentag) === null || _f === void 0 ? void 0 : _f.call(_e2, "br", {}, true);
|
|
7286
7310
|
(_h = (_g = this.cbs).onclosetag) === null || _h === void 0 ? void 0 : _h.call(_g, "br", false);
|
|
7287
7311
|
}
|
|
7288
7312
|
this.startIndex = endIndex + 1;
|
|
@@ -7368,13 +7392,13 @@
|
|
|
7368
7392
|
}
|
|
7369
7393
|
/** @internal */
|
|
7370
7394
|
oncdata(start, endIndex, offset) {
|
|
7371
|
-
var _a2, _b, _c, _d,
|
|
7395
|
+
var _a2, _b, _c, _d, _e2, _f, _g, _h, _j, _k;
|
|
7372
7396
|
this.endIndex = endIndex;
|
|
7373
7397
|
const value = this.getSlice(start, endIndex - offset);
|
|
7374
7398
|
if (!this.htmlMode || this.options.recognizeCDATA) {
|
|
7375
7399
|
(_b = (_a2 = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a2);
|
|
7376
7400
|
(_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);
|
|
7377
|
-
(_f = (
|
|
7401
|
+
(_f = (_e2 = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e2);
|
|
7378
7402
|
} else {
|
|
7379
7403
|
(_h = (_g = this.cbs).oncomment) === null || _h === void 0 ? void 0 : _h.call(_g, `[CDATA[${value}]]`);
|
|
7380
7404
|
(_k = (_j = this.cbs).oncommentend) === null || _k === void 0 ? void 0 : _k.call(_j);
|
|
@@ -7565,9 +7589,9 @@
|
|
|
7565
7589
|
...defaultOptions$2,
|
|
7566
7590
|
...opts
|
|
7567
7591
|
};
|
|
7568
|
-
const $ = load(html2);
|
|
7569
|
-
let $root = $("body");
|
|
7570
|
-
if (!$root.length) $root =
|
|
7592
|
+
const $2 = load(html2);
|
|
7593
|
+
let $root = $2("body");
|
|
7594
|
+
if (!$root.length) $root = $2.root();
|
|
7571
7595
|
let id = 0;
|
|
7572
7596
|
const rootNode = {
|
|
7573
7597
|
id,
|
|
@@ -7621,7 +7645,7 @@
|
|
|
7621
7645
|
function getContent($node) {
|
|
7622
7646
|
var _a2;
|
|
7623
7647
|
const result = extractMagicComments($node);
|
|
7624
|
-
const html22 = (_a2 =
|
|
7648
|
+
const html22 = (_a2 = $2.html(result.$node)) == null ? void 0 : _a2.trimEnd();
|
|
7625
7649
|
return { comments: result.comments, html: html22 };
|
|
7626
7650
|
}
|
|
7627
7651
|
function extractMagicComments($node) {
|
|
@@ -7641,11 +7665,11 @@
|
|
|
7641
7665
|
function checkNodes($els, node) {
|
|
7642
7666
|
$els.each((_, child) => {
|
|
7643
7667
|
var _a2;
|
|
7644
|
-
const $child = $(child);
|
|
7668
|
+
const $child = $2(child);
|
|
7645
7669
|
const rule = (_a2 = Object.entries(options.selectorRules).find(
|
|
7646
7670
|
([selector]) => $child.is(selector)
|
|
7647
7671
|
)) == null ? void 0 : _a2[1];
|
|
7648
|
-
const result = rule == null ? void 0 : rule({ $node: $child,
|
|
7672
|
+
const result = rule == null ? void 0 : rule({ $node: $child, $: $2, getContent });
|
|
7649
7673
|
if ((result == null ? void 0 : result.queue) && !result.nesting) {
|
|
7650
7674
|
checkNodes(result.queue, node);
|
|
7651
7675
|
return;
|
|
@@ -7991,11 +8015,11 @@
|
|
|
7991
8015
|
}
|
|
7992
8016
|
if (!part.match(hostnamePartPattern)) {
|
|
7993
8017
|
let newpart = "";
|
|
7994
|
-
for (let
|
|
7995
|
-
if (part.charCodeAt(
|
|
8018
|
+
for (let j = 0, k = part.length; j < k; j++) {
|
|
8019
|
+
if (part.charCodeAt(j) > 127) {
|
|
7996
8020
|
newpart += "x";
|
|
7997
8021
|
} else {
|
|
7998
|
-
newpart += part[
|
|
8022
|
+
newpart += part[j];
|
|
7999
8023
|
}
|
|
8000
8024
|
}
|
|
8001
8025
|
if (!newpart.match(hostnamePartPattern)) {
|
|
@@ -9293,11 +9317,11 @@
|
|
|
9293
9317
|
if (!state.md.options.linkify) {
|
|
9294
9318
|
return;
|
|
9295
9319
|
}
|
|
9296
|
-
for (let
|
|
9297
|
-
if (blockTokens[
|
|
9320
|
+
for (let j = 0, l = blockTokens.length; j < l; j++) {
|
|
9321
|
+
if (blockTokens[j].type !== "inline" || !state.md.linkify.pretest(blockTokens[j].content)) {
|
|
9298
9322
|
continue;
|
|
9299
9323
|
}
|
|
9300
|
-
let tokens = blockTokens[
|
|
9324
|
+
let tokens = blockTokens[j].children;
|
|
9301
9325
|
let htmlLinkLevel = 0;
|
|
9302
9326
|
for (let i = tokens.length - 1; i >= 0; i--) {
|
|
9303
9327
|
const currentToken = tokens[i];
|
|
@@ -9372,7 +9396,7 @@
|
|
|
9372
9396
|
token.level = level;
|
|
9373
9397
|
nodes.push(token);
|
|
9374
9398
|
}
|
|
9375
|
-
blockTokens[
|
|
9399
|
+
blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
|
|
9376
9400
|
}
|
|
9377
9401
|
}
|
|
9378
9402
|
}
|
|
@@ -9444,17 +9468,17 @@
|
|
|
9444
9468
|
return str.slice(0, index2) + ch + str.slice(index2 + 1);
|
|
9445
9469
|
}
|
|
9446
9470
|
function process_inlines(tokens, state) {
|
|
9447
|
-
let
|
|
9471
|
+
let j;
|
|
9448
9472
|
const stack = [];
|
|
9449
9473
|
for (let i = 0; i < tokens.length; i++) {
|
|
9450
9474
|
const token = tokens[i];
|
|
9451
9475
|
const thisLevel = tokens[i].level;
|
|
9452
|
-
for (
|
|
9453
|
-
if (stack[
|
|
9476
|
+
for (j = stack.length - 1; j >= 0; j--) {
|
|
9477
|
+
if (stack[j].level <= thisLevel) {
|
|
9454
9478
|
break;
|
|
9455
9479
|
}
|
|
9456
9480
|
}
|
|
9457
|
-
stack.length =
|
|
9481
|
+
stack.length = j + 1;
|
|
9458
9482
|
if (token.type !== "text") {
|
|
9459
9483
|
continue;
|
|
9460
9484
|
}
|
|
@@ -9476,10 +9500,10 @@
|
|
|
9476
9500
|
if (t.index - 1 >= 0) {
|
|
9477
9501
|
lastChar = text2.charCodeAt(t.index - 1);
|
|
9478
9502
|
} else {
|
|
9479
|
-
for (
|
|
9480
|
-
if (tokens[
|
|
9481
|
-
if (!tokens[
|
|
9482
|
-
lastChar = tokens[
|
|
9503
|
+
for (j = i - 1; j >= 0; j--) {
|
|
9504
|
+
if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break;
|
|
9505
|
+
if (!tokens[j].content) continue;
|
|
9506
|
+
lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);
|
|
9483
9507
|
break;
|
|
9484
9508
|
}
|
|
9485
9509
|
}
|
|
@@ -9487,10 +9511,10 @@
|
|
|
9487
9511
|
if (pos < max) {
|
|
9488
9512
|
nextChar = text2.charCodeAt(pos);
|
|
9489
9513
|
} else {
|
|
9490
|
-
for (
|
|
9491
|
-
if (tokens[
|
|
9492
|
-
if (!tokens[
|
|
9493
|
-
nextChar = tokens[
|
|
9514
|
+
for (j = i + 1; j < tokens.length; j++) {
|
|
9515
|
+
if (tokens[j].type === "softbreak" || tokens[j].type === "hardbreak") break;
|
|
9516
|
+
if (!tokens[j].content) continue;
|
|
9517
|
+
nextChar = tokens[j].content.charCodeAt(0);
|
|
9494
9518
|
break;
|
|
9495
9519
|
}
|
|
9496
9520
|
}
|
|
@@ -9528,13 +9552,13 @@
|
|
|
9528
9552
|
continue;
|
|
9529
9553
|
}
|
|
9530
9554
|
if (canClose) {
|
|
9531
|
-
for (
|
|
9532
|
-
let item = stack[
|
|
9533
|
-
if (stack[
|
|
9555
|
+
for (j = stack.length - 1; j >= 0; j--) {
|
|
9556
|
+
let item = stack[j];
|
|
9557
|
+
if (stack[j].level < thisLevel) {
|
|
9534
9558
|
break;
|
|
9535
9559
|
}
|
|
9536
|
-
if (item.single === isSingle && stack[
|
|
9537
|
-
item = stack[
|
|
9560
|
+
if (item.single === isSingle && stack[j].level === thisLevel) {
|
|
9561
|
+
item = stack[j];
|
|
9538
9562
|
let openQuote;
|
|
9539
9563
|
let closeQuote;
|
|
9540
9564
|
if (isSingle) {
|
|
@@ -9556,7 +9580,7 @@
|
|
|
9556
9580
|
}
|
|
9557
9581
|
text2 = token.content;
|
|
9558
9582
|
max = text2.length;
|
|
9559
|
-
stack.length =
|
|
9583
|
+
stack.length = j;
|
|
9560
9584
|
continue OUTER;
|
|
9561
9585
|
}
|
|
9562
9586
|
}
|
|
@@ -9589,9 +9613,9 @@
|
|
|
9589
9613
|
let curr, last2;
|
|
9590
9614
|
const blockTokens = state.tokens;
|
|
9591
9615
|
const l = blockTokens.length;
|
|
9592
|
-
for (let
|
|
9593
|
-
if (blockTokens[
|
|
9594
|
-
const tokens = blockTokens[
|
|
9616
|
+
for (let j = 0; j < l; j++) {
|
|
9617
|
+
if (blockTokens[j].type !== "inline") continue;
|
|
9618
|
+
const tokens = blockTokens[j].children;
|
|
9595
9619
|
const max = tokens.length;
|
|
9596
9620
|
for (curr = 0; curr < max; curr++) {
|
|
9597
9621
|
if (tokens[curr].type === "text_special") {
|
|
@@ -11297,14 +11321,14 @@
|
|
|
11297
11321
|
}
|
|
11298
11322
|
while (loneMarkers.length) {
|
|
11299
11323
|
const i = loneMarkers.pop();
|
|
11300
|
-
let
|
|
11301
|
-
while (
|
|
11302
|
-
|
|
11303
|
-
}
|
|
11304
|
-
|
|
11305
|
-
if (i !==
|
|
11306
|
-
token = state.tokens[
|
|
11307
|
-
state.tokens[
|
|
11324
|
+
let j = i + 1;
|
|
11325
|
+
while (j < state.tokens.length && state.tokens[j].type === "s_close") {
|
|
11326
|
+
j++;
|
|
11327
|
+
}
|
|
11328
|
+
j--;
|
|
11329
|
+
if (i !== j) {
|
|
11330
|
+
token = state.tokens[j];
|
|
11331
|
+
state.tokens[j] = state.tokens[i];
|
|
11308
11332
|
state.tokens[i] = token;
|
|
11309
11333
|
}
|
|
11310
11334
|
}
|
|
@@ -12225,7 +12249,7 @@
|
|
|
12225
12249
|
if (!text2.length) {
|
|
12226
12250
|
return false;
|
|
12227
12251
|
}
|
|
12228
|
-
let m, ml,
|
|
12252
|
+
let m, ml, me2, len, shift, next2, re2, tld_pos, at_pos;
|
|
12229
12253
|
if (this.re.schema_test.test(text2)) {
|
|
12230
12254
|
re2 = this.re.schema_search;
|
|
12231
12255
|
re2.lastIndex = 0;
|
|
@@ -12257,9 +12281,9 @@
|
|
|
12257
12281
|
if (this.__opts__.fuzzyEmail && this.__compiled__["mailto:"]) {
|
|
12258
12282
|
at_pos = text2.indexOf("@");
|
|
12259
12283
|
if (at_pos >= 0) {
|
|
12260
|
-
if ((
|
|
12261
|
-
shift =
|
|
12262
|
-
next2 =
|
|
12284
|
+
if ((me2 = text2.match(this.re.email_fuzzy)) !== null) {
|
|
12285
|
+
shift = me2.index + me2[1].length;
|
|
12286
|
+
next2 = me2.index + me2[0].length;
|
|
12263
12287
|
if (this.__index__ < 0 || shift < this.__index__ || shift === this.__index__ && next2 > this.__last_index__) {
|
|
12264
12288
|
this.__schema__ = "mailto:";
|
|
12265
12289
|
this.__index__ = shift;
|
|
@@ -12432,11 +12456,11 @@
|
|
|
12432
12456
|
if (basic < 0) {
|
|
12433
12457
|
basic = 0;
|
|
12434
12458
|
}
|
|
12435
|
-
for (let
|
|
12436
|
-
if (input.charCodeAt(
|
|
12459
|
+
for (let j = 0; j < basic; ++j) {
|
|
12460
|
+
if (input.charCodeAt(j) >= 128) {
|
|
12437
12461
|
error("not-basic");
|
|
12438
12462
|
}
|
|
12439
|
-
output.push(input.charCodeAt(
|
|
12463
|
+
output.push(input.charCodeAt(j));
|
|
12440
12464
|
}
|
|
12441
12465
|
for (let index2 = basic > 0 ? basic + 1 : 0; index2 < inputLength; ) {
|
|
12442
12466
|
const oldi = i;
|
|
@@ -12960,14 +12984,14 @@
|
|
|
12960
12984
|
}
|
|
12961
12985
|
while (loneMarkers.length) {
|
|
12962
12986
|
const i = loneMarkers.pop();
|
|
12963
|
-
let
|
|
12964
|
-
while (
|
|
12965
|
-
|
|
12966
|
-
}
|
|
12967
|
-
|
|
12968
|
-
if (i !==
|
|
12969
|
-
token = state.tokens[
|
|
12970
|
-
state.tokens[
|
|
12987
|
+
let j = i + 1;
|
|
12988
|
+
while (j < state.tokens.length && state.tokens[j].type === "ins_close") {
|
|
12989
|
+
j++;
|
|
12990
|
+
}
|
|
12991
|
+
j--;
|
|
12992
|
+
if (i !== j) {
|
|
12993
|
+
token = state.tokens[j];
|
|
12994
|
+
state.tokens[j] = state.tokens[i];
|
|
12971
12995
|
state.tokens[i] = token;
|
|
12972
12996
|
}
|
|
12973
12997
|
}
|
|
@@ -13056,14 +13080,14 @@
|
|
|
13056
13080
|
}
|
|
13057
13081
|
while (loneMarkers.length) {
|
|
13058
13082
|
const i = loneMarkers.pop();
|
|
13059
|
-
let
|
|
13060
|
-
while (
|
|
13061
|
-
|
|
13062
|
-
}
|
|
13063
|
-
|
|
13064
|
-
if (i !==
|
|
13065
|
-
const token = state.tokens[
|
|
13066
|
-
state.tokens[
|
|
13083
|
+
let j = i + 1;
|
|
13084
|
+
while (j < state.tokens.length && state.tokens[j].type === "mark_close") {
|
|
13085
|
+
j++;
|
|
13086
|
+
}
|
|
13087
|
+
j--;
|
|
13088
|
+
if (i !== j) {
|
|
13089
|
+
const token = state.tokens[j];
|
|
13090
|
+
state.tokens[j] = state.tokens[i];
|
|
13067
13091
|
state.tokens[i] = token;
|
|
13068
13092
|
}
|
|
13069
13093
|
}
|
|
@@ -13277,7 +13301,7 @@
|
|
|
13277
13301
|
return visitor;
|
|
13278
13302
|
}
|
|
13279
13303
|
function callVisitor(key, node, visitor, path) {
|
|
13280
|
-
var _a2, _b, _c, _d,
|
|
13304
|
+
var _a2, _b, _c, _d, _e2;
|
|
13281
13305
|
if (typeof visitor === "function")
|
|
13282
13306
|
return visitor(key, node, path);
|
|
13283
13307
|
if (isMap(node))
|
|
@@ -13289,7 +13313,7 @@
|
|
|
13289
13313
|
if (isScalar(node))
|
|
13290
13314
|
return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node, path);
|
|
13291
13315
|
if (isAlias(node))
|
|
13292
|
-
return (
|
|
13316
|
+
return (_e2 = visitor.Alias) == null ? void 0 : _e2.call(visitor, key, node, path);
|
|
13293
13317
|
return void 0;
|
|
13294
13318
|
}
|
|
13295
13319
|
function replaceNode(key, path, node) {
|
|
@@ -13304,8 +13328,8 @@
|
|
|
13304
13328
|
} else if (isDocument(parent2)) {
|
|
13305
13329
|
parent2.contents = node;
|
|
13306
13330
|
} else {
|
|
13307
|
-
const
|
|
13308
|
-
throw new Error(`Cannot replace node with ${
|
|
13331
|
+
const pt = isAlias(parent2) ? "alias" : "scalar";
|
|
13332
|
+
throw new Error(`Cannot replace node with ${pt} parent`);
|
|
13309
13333
|
}
|
|
13310
13334
|
}
|
|
13311
13335
|
const escapeChars = {
|
|
@@ -13501,8 +13525,7 @@
|
|
|
13501
13525
|
return {
|
|
13502
13526
|
onAnchor: (source) => {
|
|
13503
13527
|
aliasObjects.push(source);
|
|
13504
|
-
|
|
13505
|
-
prevAnchors = anchorNames(doc);
|
|
13528
|
+
prevAnchors ?? (prevAnchors = anchorNames(doc));
|
|
13506
13529
|
const anchor = findNewAnchor(prefix, prevAnchors);
|
|
13507
13530
|
prevAnchors.add(anchor);
|
|
13508
13531
|
return anchor;
|
|
@@ -13634,23 +13657,35 @@
|
|
|
13634
13657
|
* Resolve the value of this alias within `doc`, finding the last
|
|
13635
13658
|
* instance of the `source` anchor before this node.
|
|
13636
13659
|
*/
|
|
13637
|
-
resolve(doc) {
|
|
13660
|
+
resolve(doc, ctx) {
|
|
13661
|
+
let nodes;
|
|
13662
|
+
if (ctx == null ? void 0 : ctx.aliasResolveCache) {
|
|
13663
|
+
nodes = ctx.aliasResolveCache;
|
|
13664
|
+
} else {
|
|
13665
|
+
nodes = [];
|
|
13666
|
+
visit(doc, {
|
|
13667
|
+
Node: (_key, node) => {
|
|
13668
|
+
if (isAlias(node) || hasAnchor(node))
|
|
13669
|
+
nodes.push(node);
|
|
13670
|
+
}
|
|
13671
|
+
});
|
|
13672
|
+
if (ctx)
|
|
13673
|
+
ctx.aliasResolveCache = nodes;
|
|
13674
|
+
}
|
|
13638
13675
|
let found = void 0;
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
}
|
|
13646
|
-
});
|
|
13676
|
+
for (const node of nodes) {
|
|
13677
|
+
if (node === this)
|
|
13678
|
+
break;
|
|
13679
|
+
if (node.anchor === this.source)
|
|
13680
|
+
found = node;
|
|
13681
|
+
}
|
|
13647
13682
|
return found;
|
|
13648
13683
|
}
|
|
13649
13684
|
toJSON(_arg, ctx) {
|
|
13650
13685
|
if (!ctx)
|
|
13651
13686
|
return { source: this.source };
|
|
13652
13687
|
const { anchors, doc, maxAliasCount } = ctx;
|
|
13653
|
-
const source = this.resolve(doc);
|
|
13688
|
+
const source = this.resolve(doc, ctx);
|
|
13654
13689
|
if (!source) {
|
|
13655
13690
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
13656
13691
|
throw new ReferenceError(msg);
|
|
@@ -13760,8 +13795,7 @@
|
|
|
13760
13795
|
if (aliasDuplicateObjects && value && typeof value === "object") {
|
|
13761
13796
|
ref = sourceObjects.get(value);
|
|
13762
13797
|
if (ref) {
|
|
13763
|
-
|
|
13764
|
-
ref.anchor = onAnchor(value);
|
|
13798
|
+
ref.anchor ?? (ref.anchor = onAnchor(value));
|
|
13765
13799
|
return new Alias(ref.anchor);
|
|
13766
13800
|
} else {
|
|
13767
13801
|
ref = { anchor: null, node: null };
|
|
@@ -13838,7 +13872,7 @@
|
|
|
13838
13872
|
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
13839
13873
|
if (schema2)
|
|
13840
13874
|
copy.schema = schema2;
|
|
13841
|
-
copy.items = copy.items.map((
|
|
13875
|
+
copy.items = copy.items.map((it) => isNode(it) || isPair(it) ? it.clone(schema2) : it);
|
|
13842
13876
|
if (this.range)
|
|
13843
13877
|
copy.range = this.range.slice();
|
|
13844
13878
|
return copy;
|
|
@@ -14004,12 +14038,12 @@
|
|
|
14004
14038
|
ch = text2[i += 1];
|
|
14005
14039
|
overflow = true;
|
|
14006
14040
|
}
|
|
14007
|
-
const
|
|
14008
|
-
if (escapedFolds[
|
|
14041
|
+
const j = i > escEnd + 1 ? i - 2 : escStart - 1;
|
|
14042
|
+
if (escapedFolds[j])
|
|
14009
14043
|
return text2;
|
|
14010
|
-
folds.push(
|
|
14011
|
-
escapedFolds[
|
|
14012
|
-
end2 =
|
|
14044
|
+
folds.push(j);
|
|
14045
|
+
escapedFolds[j] = true;
|
|
14046
|
+
end2 = j + endStep;
|
|
14013
14047
|
split = void 0;
|
|
14014
14048
|
} else {
|
|
14015
14049
|
overflow = true;
|
|
@@ -14274,7 +14308,7 @@ ${indent}${start}${value}${end2}`;
|
|
|
14274
14308
|
if (implicitKey && value.includes("\n") || inFlow && /[[\]{},]/.test(value)) {
|
|
14275
14309
|
return quotedString(value, ctx);
|
|
14276
14310
|
}
|
|
14277
|
-
if (
|
|
14311
|
+
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
14278
14312
|
return implicitKey || inFlow || !value.includes("\n") ? quotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
|
|
14279
14313
|
}
|
|
14280
14314
|
if (!implicitKey && !inFlow && type !== Scalar.PLAIN && value.includes("\n")) {
|
|
@@ -14401,7 +14435,7 @@ ${indent}`);
|
|
|
14401
14435
|
tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
|
|
14402
14436
|
}
|
|
14403
14437
|
if (!tagObj) {
|
|
14404
|
-
const name2 = ((_a2 = obj == null ? void 0 : obj.constructor) == null ? void 0 : _a2.name) ?? typeof obj;
|
|
14438
|
+
const name2 = ((_a2 = obj == null ? void 0 : obj.constructor) == null ? void 0 : _a2.name) ?? (obj === null ? "null" : typeof obj);
|
|
14405
14439
|
throw new Error(`Tag not resolved for ${name2} value`);
|
|
14406
14440
|
}
|
|
14407
14441
|
return tagObj;
|
|
@@ -14415,7 +14449,7 @@ ${indent}`);
|
|
|
14415
14449
|
anchors.add(anchor);
|
|
14416
14450
|
props.push(`&${anchor}`);
|
|
14417
14451
|
}
|
|
14418
|
-
const tag = node.tag
|
|
14452
|
+
const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
|
|
14419
14453
|
if (tag)
|
|
14420
14454
|
props.push(doc.directives.tagString(tag));
|
|
14421
14455
|
return props.join(" ");
|
|
@@ -14439,8 +14473,7 @@ ${indent}`);
|
|
|
14439
14473
|
}
|
|
14440
14474
|
let tagObj = void 0;
|
|
14441
14475
|
const node = isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o) => tagObj = o });
|
|
14442
|
-
|
|
14443
|
-
tagObj = getTagObject(ctx.doc.schema.tags, node);
|
|
14476
|
+
tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
|
|
14444
14477
|
const props = stringifyProps(node, tagObj, ctx);
|
|
14445
14478
|
if (props.length > 0)
|
|
14446
14479
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
@@ -14573,10 +14606,7 @@ ${ctx.indent}`;
|
|
|
14573
14606
|
}
|
|
14574
14607
|
function warn(logLevel, warning) {
|
|
14575
14608
|
if (logLevel === "debug" || logLevel === "warn") {
|
|
14576
|
-
|
|
14577
|
-
process.emitWarning(warning);
|
|
14578
|
-
else
|
|
14579
|
-
console.warn(warning);
|
|
14609
|
+
console.warn(warning);
|
|
14580
14610
|
}
|
|
14581
14611
|
}
|
|
14582
14612
|
const MERGE_KEY = "<<";
|
|
@@ -14594,11 +14624,11 @@ ${ctx.indent}`;
|
|
|
14594
14624
|
function addMergeToJSMap(ctx, map2, value) {
|
|
14595
14625
|
value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
14596
14626
|
if (isSeq(value))
|
|
14597
|
-
for (const
|
|
14598
|
-
mergeValue(ctx, map2,
|
|
14627
|
+
for (const it of value.items)
|
|
14628
|
+
mergeValue(ctx, map2, it);
|
|
14599
14629
|
else if (Array.isArray(value))
|
|
14600
|
-
for (const
|
|
14601
|
-
mergeValue(ctx, map2,
|
|
14630
|
+
for (const it of value)
|
|
14631
|
+
mergeValue(ctx, map2, it);
|
|
14602
14632
|
else
|
|
14603
14633
|
mergeValue(ctx, map2, value);
|
|
14604
14634
|
}
|
|
@@ -14837,12 +14867,12 @@ ${indent}${end2}`;
|
|
|
14837
14867
|
}
|
|
14838
14868
|
function findPair(items, key) {
|
|
14839
14869
|
const k = isScalar(key) ? key.value : key;
|
|
14840
|
-
for (const
|
|
14841
|
-
if (isPair(
|
|
14842
|
-
if (
|
|
14843
|
-
return
|
|
14844
|
-
if (isScalar(
|
|
14845
|
-
return
|
|
14870
|
+
for (const it of items) {
|
|
14871
|
+
if (isPair(it)) {
|
|
14872
|
+
if (it.key === key || it.key === k)
|
|
14873
|
+
return it;
|
|
14874
|
+
if (isScalar(it.key) && it.key.value === k)
|
|
14875
|
+
return it;
|
|
14846
14876
|
}
|
|
14847
14877
|
}
|
|
14848
14878
|
return void 0;
|
|
@@ -14917,15 +14947,15 @@ ${indent}${end2}`;
|
|
|
14917
14947
|
}
|
|
14918
14948
|
}
|
|
14919
14949
|
delete(key) {
|
|
14920
|
-
const
|
|
14921
|
-
if (!
|
|
14950
|
+
const it = findPair(this.items, key);
|
|
14951
|
+
if (!it)
|
|
14922
14952
|
return false;
|
|
14923
|
-
const del = this.items.splice(this.items.indexOf(
|
|
14953
|
+
const del = this.items.splice(this.items.indexOf(it), 1);
|
|
14924
14954
|
return del.length > 0;
|
|
14925
14955
|
}
|
|
14926
14956
|
get(key, keepScalar) {
|
|
14927
|
-
const
|
|
14928
|
-
const node =
|
|
14957
|
+
const it = findPair(this.items, key);
|
|
14958
|
+
const node = it == null ? void 0 : it.value;
|
|
14929
14959
|
return (!keepScalar && isScalar(node) ? node.value : node) ?? void 0;
|
|
14930
14960
|
}
|
|
14931
14961
|
has(key) {
|
|
@@ -15007,8 +15037,8 @@ ${indent}${end2}`;
|
|
|
15007
15037
|
const idx = asItemIndex(key);
|
|
15008
15038
|
if (typeof idx !== "number")
|
|
15009
15039
|
return void 0;
|
|
15010
|
-
const
|
|
15011
|
-
return !keepScalar && isScalar(
|
|
15040
|
+
const it = this.items[idx];
|
|
15041
|
+
return !keepScalar && isScalar(it) ? it.value : it;
|
|
15012
15042
|
}
|
|
15013
15043
|
/**
|
|
15014
15044
|
* Checks if the collection includes a value with the key `key`.
|
|
@@ -15062,12 +15092,12 @@ ${indent}${end2}`;
|
|
|
15062
15092
|
const seq2 = new this(schema2);
|
|
15063
15093
|
if (obj && Symbol.iterator in Object(obj)) {
|
|
15064
15094
|
let i = 0;
|
|
15065
|
-
for (let
|
|
15095
|
+
for (let it of obj) {
|
|
15066
15096
|
if (typeof replacer === "function") {
|
|
15067
|
-
const key = obj instanceof Set ?
|
|
15068
|
-
|
|
15097
|
+
const key = obj instanceof Set ? it : String(i++);
|
|
15098
|
+
it = replacer.call(obj, key, it);
|
|
15069
15099
|
}
|
|
15070
|
-
seq2.items.push(createNode(
|
|
15100
|
+
seq2.items.push(createNode(it, void 0, ctx));
|
|
15071
15101
|
}
|
|
15072
15102
|
}
|
|
15073
15103
|
return seq2;
|
|
@@ -15295,9 +15325,7 @@ ${indent}${end2}`;
|
|
|
15295
15325
|
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
|
15296
15326
|
*/
|
|
15297
15327
|
resolve(src, onError) {
|
|
15298
|
-
if (typeof
|
|
15299
|
-
return Buffer.from(src, "base64");
|
|
15300
|
-
} else if (typeof atob === "function") {
|
|
15328
|
+
if (typeof atob === "function") {
|
|
15301
15329
|
const str = atob(src.replace(/[\n\r]/g, ""));
|
|
15302
15330
|
const buffer = new Uint8Array(str.length);
|
|
15303
15331
|
for (let i = 0; i < str.length; ++i)
|
|
@@ -15309,11 +15337,11 @@ ${indent}${end2}`;
|
|
|
15309
15337
|
}
|
|
15310
15338
|
},
|
|
15311
15339
|
stringify({ comment: comment2, type, value }, ctx, onComment, onChompKeep) {
|
|
15340
|
+
if (!value)
|
|
15341
|
+
return "";
|
|
15312
15342
|
const buf = value;
|
|
15313
15343
|
let str;
|
|
15314
|
-
if (typeof
|
|
15315
|
-
str = buf instanceof Buffer ? buf.toString("base64") : Buffer.from(buf.buffer).toString("base64");
|
|
15316
|
-
} else if (typeof btoa === "function") {
|
|
15344
|
+
if (typeof btoa === "function") {
|
|
15317
15345
|
let s = "";
|
|
15318
15346
|
for (let i = 0; i < buf.length; ++i)
|
|
15319
15347
|
s += String.fromCharCode(buf[i]);
|
|
@@ -15321,8 +15349,7 @@ ${indent}${end2}`;
|
|
|
15321
15349
|
} else {
|
|
15322
15350
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
15323
15351
|
}
|
|
15324
|
-
|
|
15325
|
-
type = Scalar.BLOCK_LITERAL;
|
|
15352
|
+
type ?? (type = Scalar.BLOCK_LITERAL);
|
|
15326
15353
|
if (type !== Scalar.QUOTE_DOUBLE) {
|
|
15327
15354
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
15328
15355
|
const n = Math.ceil(str.length / lineWidth);
|
|
@@ -15367,26 +15394,26 @@ ${cn.comment}` : item.comment;
|
|
|
15367
15394
|
pairs2.tag = "tag:yaml.org,2002:pairs";
|
|
15368
15395
|
let i = 0;
|
|
15369
15396
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
15370
|
-
for (let
|
|
15397
|
+
for (let it of iterable) {
|
|
15371
15398
|
if (typeof replacer === "function")
|
|
15372
|
-
|
|
15399
|
+
it = replacer.call(iterable, String(i++), it);
|
|
15373
15400
|
let key, value;
|
|
15374
|
-
if (Array.isArray(
|
|
15375
|
-
if (
|
|
15376
|
-
key =
|
|
15377
|
-
value =
|
|
15401
|
+
if (Array.isArray(it)) {
|
|
15402
|
+
if (it.length === 2) {
|
|
15403
|
+
key = it[0];
|
|
15404
|
+
value = it[1];
|
|
15378
15405
|
} else
|
|
15379
|
-
throw new TypeError(`Expected [key, value] tuple: ${
|
|
15380
|
-
} else if (
|
|
15381
|
-
const keys = Object.keys(
|
|
15406
|
+
throw new TypeError(`Expected [key, value] tuple: ${it}`);
|
|
15407
|
+
} else if (it && it instanceof Object) {
|
|
15408
|
+
const keys = Object.keys(it);
|
|
15382
15409
|
if (keys.length === 1) {
|
|
15383
15410
|
key = keys[0];
|
|
15384
|
-
value =
|
|
15411
|
+
value = it[key];
|
|
15385
15412
|
} else {
|
|
15386
15413
|
throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);
|
|
15387
15414
|
}
|
|
15388
15415
|
} else {
|
|
15389
|
-
key =
|
|
15416
|
+
key = it;
|
|
15390
15417
|
}
|
|
15391
15418
|
pairs2.items.push(createPair(key, value, ctx));
|
|
15392
15419
|
}
|
|
@@ -15741,7 +15768,7 @@ ${cn.comment}` : item.comment;
|
|
|
15741
15768
|
}
|
|
15742
15769
|
return new Date(date);
|
|
15743
15770
|
},
|
|
15744
|
-
stringify: ({ value }) => value.toISOString().replace(/(T00:00:00)?\.000Z$/, "")
|
|
15771
|
+
stringify: ({ value }) => (value == null ? void 0 : value.toISOString().replace(/(T00:00:00)?\.000Z$/, "")) ?? ""
|
|
15745
15772
|
};
|
|
15746
15773
|
const schema = [
|
|
15747
15774
|
map,
|
|
@@ -16318,7 +16345,7 @@ ${pointer}
|
|
|
16318
16345
|
if (atNewline) {
|
|
16319
16346
|
if (comment2)
|
|
16320
16347
|
comment2 += token.source;
|
|
16321
|
-
else
|
|
16348
|
+
else if (!found || indicator !== "seq-item-ind")
|
|
16322
16349
|
spaceBefore = true;
|
|
16323
16350
|
} else
|
|
16324
16351
|
commentSep += token.source;
|
|
@@ -16334,8 +16361,7 @@ ${pointer}
|
|
|
16334
16361
|
if (token.source.endsWith(":"))
|
|
16335
16362
|
onError(token.offset + token.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", true);
|
|
16336
16363
|
anchor = token;
|
|
16337
|
-
|
|
16338
|
-
start = token.offset;
|
|
16364
|
+
start ?? (start = token.offset);
|
|
16339
16365
|
atNewline = false;
|
|
16340
16366
|
hasSpace = false;
|
|
16341
16367
|
reqSpace = true;
|
|
@@ -16344,8 +16370,7 @@ ${pointer}
|
|
|
16344
16370
|
if (tag)
|
|
16345
16371
|
onError(token, "MULTIPLE_TAGS", "A node can have at most one tag");
|
|
16346
16372
|
tag = token;
|
|
16347
|
-
|
|
16348
|
-
start = token.offset;
|
|
16373
|
+
start ?? (start = token.offset);
|
|
16349
16374
|
atNewline = false;
|
|
16350
16375
|
hasSpace = false;
|
|
16351
16376
|
reqSpace = true;
|
|
@@ -16407,22 +16432,22 @@ ${pointer}
|
|
|
16407
16432
|
if (key.source.includes("\n"))
|
|
16408
16433
|
return true;
|
|
16409
16434
|
if (key.end) {
|
|
16410
|
-
for (const
|
|
16411
|
-
if (
|
|
16435
|
+
for (const st of key.end)
|
|
16436
|
+
if (st.type === "newline")
|
|
16412
16437
|
return true;
|
|
16413
16438
|
}
|
|
16414
16439
|
return false;
|
|
16415
16440
|
case "flow-collection":
|
|
16416
|
-
for (const
|
|
16417
|
-
for (const
|
|
16418
|
-
if (
|
|
16441
|
+
for (const it of key.items) {
|
|
16442
|
+
for (const st of it.start)
|
|
16443
|
+
if (st.type === "newline")
|
|
16419
16444
|
return true;
|
|
16420
|
-
if (
|
|
16421
|
-
for (const
|
|
16422
|
-
if (
|
|
16445
|
+
if (it.sep) {
|
|
16446
|
+
for (const st of it.sep)
|
|
16447
|
+
if (st.type === "newline")
|
|
16423
16448
|
return true;
|
|
16424
16449
|
}
|
|
16425
|
-
if (containsNewline(
|
|
16450
|
+
if (containsNewline(it.key) || containsNewline(it.value))
|
|
16426
16451
|
return true;
|
|
16427
16452
|
}
|
|
16428
16453
|
return false;
|
|
@@ -16673,13 +16698,13 @@ ${pointer}
|
|
|
16673
16698
|
onError(props.start, "MISSING_CHAR", `Missing , between ${fcName} items`);
|
|
16674
16699
|
if (props.comment) {
|
|
16675
16700
|
let prevItemComment = "";
|
|
16676
|
-
loop: for (const
|
|
16677
|
-
switch (
|
|
16701
|
+
loop: for (const st of start) {
|
|
16702
|
+
switch (st.type) {
|
|
16678
16703
|
case "comma":
|
|
16679
16704
|
case "space":
|
|
16680
16705
|
break;
|
|
16681
16706
|
case "comment":
|
|
16682
|
-
prevItemComment =
|
|
16707
|
+
prevItemComment = st.source.substring(1);
|
|
16683
16708
|
break loop;
|
|
16684
16709
|
default:
|
|
16685
16710
|
break loop;
|
|
@@ -16722,11 +16747,11 @@ ${pointer}
|
|
|
16722
16747
|
if (valueProps.found) {
|
|
16723
16748
|
if (!isMap2 && !props.found && ctx.options.strict) {
|
|
16724
16749
|
if (sep)
|
|
16725
|
-
for (const
|
|
16726
|
-
if (
|
|
16750
|
+
for (const st of sep) {
|
|
16751
|
+
if (st === valueProps.found)
|
|
16727
16752
|
break;
|
|
16728
|
-
if (
|
|
16729
|
-
onError(
|
|
16753
|
+
if (st.type === "newline") {
|
|
16754
|
+
onError(st, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
|
|
16730
16755
|
break;
|
|
16731
16756
|
}
|
|
16732
16757
|
}
|
|
@@ -16769,19 +16794,19 @@ ${pointer}
|
|
|
16769
16794
|
}
|
|
16770
16795
|
}
|
|
16771
16796
|
const expectedEnd = isMap2 ? "}" : "]";
|
|
16772
|
-
const [
|
|
16797
|
+
const [ce2, ...ee] = fc.end;
|
|
16773
16798
|
let cePos = offset;
|
|
16774
|
-
if (
|
|
16775
|
-
cePos =
|
|
16799
|
+
if (ce2 && ce2.source === expectedEnd)
|
|
16800
|
+
cePos = ce2.offset + ce2.source.length;
|
|
16776
16801
|
else {
|
|
16777
16802
|
const name2 = fcName[0].toUpperCase() + fcName.substring(1);
|
|
16778
16803
|
const msg = atRoot ? `${name2} must end with a ${expectedEnd}` : `${name2} in block collection must be sufficiently indented and end with a ${expectedEnd}`;
|
|
16779
16804
|
onError(offset, atRoot ? "MISSING_CHAR" : "BAD_INDENT", msg);
|
|
16780
|
-
if (
|
|
16781
|
-
|
|
16805
|
+
if (ce2 && ce2.source.length !== 1)
|
|
16806
|
+
ee.unshift(ce2);
|
|
16782
16807
|
}
|
|
16783
|
-
if (
|
|
16784
|
-
const end2 = resolveEnd(
|
|
16808
|
+
if (ee.length > 0) {
|
|
16809
|
+
const end2 = resolveEnd(ee, cePos, ctx.options.strict, onError);
|
|
16785
16810
|
if (end2.comment) {
|
|
16786
16811
|
if (coll.comment)
|
|
16787
16812
|
coll.comment += "\n" + end2.comment;
|
|
@@ -16823,13 +16848,13 @@ ${pointer}
|
|
|
16823
16848
|
}
|
|
16824
16849
|
let tag = ctx.schema.tags.find((t) => t.tag === tagName && t.collection === expType);
|
|
16825
16850
|
if (!tag) {
|
|
16826
|
-
const
|
|
16827
|
-
if (
|
|
16828
|
-
ctx.schema.tags.push(Object.assign({},
|
|
16829
|
-
tag =
|
|
16851
|
+
const kt2 = ctx.schema.knownTags[tagName];
|
|
16852
|
+
if (kt2 && kt2.collection === expType) {
|
|
16853
|
+
ctx.schema.tags.push(Object.assign({}, kt2, { default: false }));
|
|
16854
|
+
tag = kt2;
|
|
16830
16855
|
} else {
|
|
16831
|
-
if (
|
|
16832
|
-
onError(tagToken, "BAD_COLLECTION_TYPE", `${
|
|
16856
|
+
if (kt2) {
|
|
16857
|
+
onError(tagToken, "BAD_COLLECTION_TYPE", `${kt2.tag} used for ${expType} collection, but expects ${kt2.collection ?? "scalar"}`, true);
|
|
16833
16858
|
} else {
|
|
16834
16859
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, true);
|
|
16835
16860
|
}
|
|
@@ -17277,10 +17302,10 @@ ${pointer}
|
|
|
17277
17302
|
for (const tag of matchWithTest)
|
|
17278
17303
|
if ((_a2 = tag.test) == null ? void 0 : _a2.test(value))
|
|
17279
17304
|
return tag;
|
|
17280
|
-
const
|
|
17281
|
-
if (
|
|
17282
|
-
schema2.tags.push(Object.assign({},
|
|
17283
|
-
return
|
|
17305
|
+
const kt2 = schema2.knownTags[tagName];
|
|
17306
|
+
if (kt2 && !kt2.collection) {
|
|
17307
|
+
schema2.tags.push(Object.assign({}, kt2, { default: false, test: void 0 }));
|
|
17308
|
+
return kt2;
|
|
17284
17309
|
}
|
|
17285
17310
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
|
|
17286
17311
|
return schema2[SCALAR$1];
|
|
@@ -17306,21 +17331,20 @@ ${pointer}
|
|
|
17306
17331
|
}
|
|
17307
17332
|
function emptyScalarPosition(offset, before2, pos) {
|
|
17308
17333
|
if (before2) {
|
|
17309
|
-
|
|
17310
|
-
pos = before2.length;
|
|
17334
|
+
pos ?? (pos = before2.length);
|
|
17311
17335
|
for (let i = pos - 1; i >= 0; --i) {
|
|
17312
|
-
let
|
|
17313
|
-
switch (
|
|
17336
|
+
let st = before2[i];
|
|
17337
|
+
switch (st.type) {
|
|
17314
17338
|
case "space":
|
|
17315
17339
|
case "comment":
|
|
17316
17340
|
case "newline":
|
|
17317
|
-
offset -=
|
|
17341
|
+
offset -= st.source.length;
|
|
17318
17342
|
continue;
|
|
17319
17343
|
}
|
|
17320
|
-
|
|
17321
|
-
while ((
|
|
17322
|
-
offset +=
|
|
17323
|
-
|
|
17344
|
+
st = before2[++i];
|
|
17345
|
+
while ((st == null ? void 0 : st.type) === "space") {
|
|
17346
|
+
offset += st.source.length;
|
|
17347
|
+
st = before2[++i];
|
|
17324
17348
|
}
|
|
17325
17349
|
break;
|
|
17326
17350
|
}
|
|
@@ -17505,11 +17529,11 @@ ${comment2}` : comment2;
|
|
|
17505
17529
|
} else if (afterEmptyLine || doc.directives.docStart || !dc) {
|
|
17506
17530
|
doc.commentBefore = comment2;
|
|
17507
17531
|
} else if (isCollection(dc) && !dc.flow && dc.items.length > 0) {
|
|
17508
|
-
let
|
|
17509
|
-
if (isPair(
|
|
17510
|
-
|
|
17511
|
-
const cb =
|
|
17512
|
-
|
|
17532
|
+
let it = dc.items[0];
|
|
17533
|
+
if (isPair(it))
|
|
17534
|
+
it = it.key;
|
|
17535
|
+
const cb = it.commentBefore;
|
|
17536
|
+
it.commentBefore = cb ? `${comment2}
|
|
17513
17537
|
${cb}` : comment2;
|
|
17514
17538
|
} else {
|
|
17515
17539
|
const cb = dc.commentBefore;
|
|
@@ -18326,8 +18350,8 @@ ${end2.comment}` : end2.comment;
|
|
|
18326
18350
|
case "document":
|
|
18327
18351
|
return parent2.start;
|
|
18328
18352
|
case "block-map": {
|
|
18329
|
-
const
|
|
18330
|
-
return
|
|
18353
|
+
const it = parent2.items[parent2.items.length - 1];
|
|
18354
|
+
return it.sep ?? it.start;
|
|
18331
18355
|
}
|
|
18332
18356
|
case "block-seq":
|
|
18333
18357
|
return parent2.items[parent2.items.length - 1].start;
|
|
@@ -18357,19 +18381,19 @@ ${end2.comment}` : end2.comment;
|
|
|
18357
18381
|
}
|
|
18358
18382
|
function fixFlowSeqItems(fc) {
|
|
18359
18383
|
if (fc.start.type === "flow-seq-start") {
|
|
18360
|
-
for (const
|
|
18361
|
-
if (
|
|
18362
|
-
if (
|
|
18363
|
-
|
|
18364
|
-
delete
|
|
18365
|
-
if (isFlowToken(
|
|
18366
|
-
if (
|
|
18367
|
-
Array.prototype.push.apply(
|
|
18384
|
+
for (const it of fc.items) {
|
|
18385
|
+
if (it.sep && !it.value && !includesToken(it.start, "explicit-key-ind") && !includesToken(it.sep, "map-value-ind")) {
|
|
18386
|
+
if (it.key)
|
|
18387
|
+
it.value = it.key;
|
|
18388
|
+
delete it.key;
|
|
18389
|
+
if (isFlowToken(it.value)) {
|
|
18390
|
+
if (it.value.end)
|
|
18391
|
+
Array.prototype.push.apply(it.value.end, it.sep);
|
|
18368
18392
|
else
|
|
18369
|
-
|
|
18393
|
+
it.value.end = it.sep;
|
|
18370
18394
|
} else
|
|
18371
|
-
Array.prototype.push.apply(
|
|
18372
|
-
delete
|
|
18395
|
+
Array.prototype.push.apply(it.start, it.sep);
|
|
18396
|
+
delete it.sep;
|
|
18373
18397
|
}
|
|
18374
18398
|
}
|
|
18375
18399
|
}
|
|
@@ -18462,13 +18486,13 @@ ${end2.comment}` : end2.comment;
|
|
|
18462
18486
|
yield* this.pop();
|
|
18463
18487
|
}
|
|
18464
18488
|
get sourceToken() {
|
|
18465
|
-
const
|
|
18489
|
+
const st = {
|
|
18466
18490
|
type: this.type,
|
|
18467
18491
|
offset: this.offset,
|
|
18468
18492
|
indent: this.indent,
|
|
18469
18493
|
source: this.source
|
|
18470
18494
|
};
|
|
18471
|
-
return
|
|
18495
|
+
return st;
|
|
18472
18496
|
}
|
|
18473
18497
|
*step() {
|
|
18474
18498
|
const top = this.peek(1);
|
|
@@ -18532,36 +18556,36 @@ ${end2.comment}` : end2.comment;
|
|
|
18532
18556
|
top.props.push(token);
|
|
18533
18557
|
break;
|
|
18534
18558
|
case "block-map": {
|
|
18535
|
-
const
|
|
18536
|
-
if (
|
|
18559
|
+
const it = top.items[top.items.length - 1];
|
|
18560
|
+
if (it.value) {
|
|
18537
18561
|
top.items.push({ start: [], key: token, sep: [] });
|
|
18538
18562
|
this.onKeyLine = true;
|
|
18539
18563
|
return;
|
|
18540
|
-
} else if (
|
|
18541
|
-
|
|
18564
|
+
} else if (it.sep) {
|
|
18565
|
+
it.value = token;
|
|
18542
18566
|
} else {
|
|
18543
|
-
Object.assign(
|
|
18544
|
-
this.onKeyLine = !
|
|
18567
|
+
Object.assign(it, { key: token, sep: [] });
|
|
18568
|
+
this.onKeyLine = !it.explicitKey;
|
|
18545
18569
|
return;
|
|
18546
18570
|
}
|
|
18547
18571
|
break;
|
|
18548
18572
|
}
|
|
18549
18573
|
case "block-seq": {
|
|
18550
|
-
const
|
|
18551
|
-
if (
|
|
18574
|
+
const it = top.items[top.items.length - 1];
|
|
18575
|
+
if (it.value)
|
|
18552
18576
|
top.items.push({ start: [], value: token });
|
|
18553
18577
|
else
|
|
18554
|
-
|
|
18578
|
+
it.value = token;
|
|
18555
18579
|
break;
|
|
18556
18580
|
}
|
|
18557
18581
|
case "flow-collection": {
|
|
18558
|
-
const
|
|
18559
|
-
if (!
|
|
18582
|
+
const it = top.items[top.items.length - 1];
|
|
18583
|
+
if (!it || it.value)
|
|
18560
18584
|
top.items.push({ start: [], key: token, sep: [] });
|
|
18561
|
-
else if (
|
|
18562
|
-
|
|
18585
|
+
else if (it.sep)
|
|
18586
|
+
it.value = token;
|
|
18563
18587
|
else
|
|
18564
|
-
Object.assign(
|
|
18588
|
+
Object.assign(it, { key: token, sep: [] });
|
|
18565
18589
|
return;
|
|
18566
18590
|
}
|
|
18567
18591
|
/* istanbul ignore next should not happen */
|
|
@@ -18571,7 +18595,7 @@ ${end2.comment}` : end2.comment;
|
|
|
18571
18595
|
}
|
|
18572
18596
|
if ((top.type === "document" || top.type === "block-map" || top.type === "block-seq") && (token.type === "block-map" || token.type === "block-seq")) {
|
|
18573
18597
|
const last2 = token.items[token.items.length - 1];
|
|
18574
|
-
if (last2 && !last2.sep && !last2.value && last2.start.length > 0 && findNonEmptyIndex(last2.start) === -1 && (token.indent === 0 || last2.start.every((
|
|
18598
|
+
if (last2 && !last2.sep && !last2.value && last2.start.length > 0 && findNonEmptyIndex(last2.start) === -1 && (token.indent === 0 || last2.start.every((st) => st.type !== "comment" || st.indent < token.indent))) {
|
|
18575
18599
|
if (top.type === "document")
|
|
18576
18600
|
top.end = last2.start;
|
|
18577
18601
|
else
|
|
@@ -18694,60 +18718,60 @@ ${end2.comment}` : end2.comment;
|
|
|
18694
18718
|
}
|
|
18695
18719
|
*blockMap(map2) {
|
|
18696
18720
|
var _a2;
|
|
18697
|
-
const
|
|
18721
|
+
const it = map2.items[map2.items.length - 1];
|
|
18698
18722
|
switch (this.type) {
|
|
18699
18723
|
case "newline":
|
|
18700
18724
|
this.onKeyLine = false;
|
|
18701
|
-
if (
|
|
18702
|
-
const end2 = "end" in
|
|
18725
|
+
if (it.value) {
|
|
18726
|
+
const end2 = "end" in it.value ? it.value.end : void 0;
|
|
18703
18727
|
const last2 = Array.isArray(end2) ? end2[end2.length - 1] : void 0;
|
|
18704
18728
|
if ((last2 == null ? void 0 : last2.type) === "comment")
|
|
18705
18729
|
end2 == null ? void 0 : end2.push(this.sourceToken);
|
|
18706
18730
|
else
|
|
18707
18731
|
map2.items.push({ start: [this.sourceToken] });
|
|
18708
|
-
} else if (
|
|
18709
|
-
|
|
18732
|
+
} else if (it.sep) {
|
|
18733
|
+
it.sep.push(this.sourceToken);
|
|
18710
18734
|
} else {
|
|
18711
|
-
|
|
18735
|
+
it.start.push(this.sourceToken);
|
|
18712
18736
|
}
|
|
18713
18737
|
return;
|
|
18714
18738
|
case "space":
|
|
18715
18739
|
case "comment":
|
|
18716
|
-
if (
|
|
18740
|
+
if (it.value) {
|
|
18717
18741
|
map2.items.push({ start: [this.sourceToken] });
|
|
18718
|
-
} else if (
|
|
18719
|
-
|
|
18742
|
+
} else if (it.sep) {
|
|
18743
|
+
it.sep.push(this.sourceToken);
|
|
18720
18744
|
} else {
|
|
18721
|
-
if (this.atIndentedComment(
|
|
18745
|
+
if (this.atIndentedComment(it.start, map2.indent)) {
|
|
18722
18746
|
const prev2 = map2.items[map2.items.length - 2];
|
|
18723
18747
|
const end2 = (_a2 = prev2 == null ? void 0 : prev2.value) == null ? void 0 : _a2.end;
|
|
18724
18748
|
if (Array.isArray(end2)) {
|
|
18725
|
-
Array.prototype.push.apply(end2,
|
|
18749
|
+
Array.prototype.push.apply(end2, it.start);
|
|
18726
18750
|
end2.push(this.sourceToken);
|
|
18727
18751
|
map2.items.pop();
|
|
18728
18752
|
return;
|
|
18729
18753
|
}
|
|
18730
18754
|
}
|
|
18731
|
-
|
|
18755
|
+
it.start.push(this.sourceToken);
|
|
18732
18756
|
}
|
|
18733
18757
|
return;
|
|
18734
18758
|
}
|
|
18735
18759
|
if (this.indent >= map2.indent) {
|
|
18736
18760
|
const atMapIndent = !this.onKeyLine && this.indent === map2.indent;
|
|
18737
|
-
const atNextItem = atMapIndent && (
|
|
18761
|
+
const atNextItem = atMapIndent && (it.sep || it.explicitKey) && this.type !== "seq-item-ind";
|
|
18738
18762
|
let start = [];
|
|
18739
|
-
if (atNextItem &&
|
|
18763
|
+
if (atNextItem && it.sep && !it.value) {
|
|
18740
18764
|
const nl = [];
|
|
18741
|
-
for (let i = 0; i <
|
|
18742
|
-
const
|
|
18743
|
-
switch (
|
|
18765
|
+
for (let i = 0; i < it.sep.length; ++i) {
|
|
18766
|
+
const st = it.sep[i];
|
|
18767
|
+
switch (st.type) {
|
|
18744
18768
|
case "newline":
|
|
18745
18769
|
nl.push(i);
|
|
18746
18770
|
break;
|
|
18747
18771
|
case "space":
|
|
18748
18772
|
break;
|
|
18749
18773
|
case "comment":
|
|
18750
|
-
if (
|
|
18774
|
+
if (st.indent > map2.indent)
|
|
18751
18775
|
nl.length = 0;
|
|
18752
18776
|
break;
|
|
18753
18777
|
default:
|
|
@@ -18755,26 +18779,26 @@ ${end2.comment}` : end2.comment;
|
|
|
18755
18779
|
}
|
|
18756
18780
|
}
|
|
18757
18781
|
if (nl.length >= 2)
|
|
18758
|
-
start =
|
|
18782
|
+
start = it.sep.splice(nl[1]);
|
|
18759
18783
|
}
|
|
18760
18784
|
switch (this.type) {
|
|
18761
18785
|
case "anchor":
|
|
18762
18786
|
case "tag":
|
|
18763
|
-
if (atNextItem ||
|
|
18787
|
+
if (atNextItem || it.value) {
|
|
18764
18788
|
start.push(this.sourceToken);
|
|
18765
18789
|
map2.items.push({ start });
|
|
18766
18790
|
this.onKeyLine = true;
|
|
18767
|
-
} else if (
|
|
18768
|
-
|
|
18791
|
+
} else if (it.sep) {
|
|
18792
|
+
it.sep.push(this.sourceToken);
|
|
18769
18793
|
} else {
|
|
18770
|
-
|
|
18794
|
+
it.start.push(this.sourceToken);
|
|
18771
18795
|
}
|
|
18772
18796
|
return;
|
|
18773
18797
|
case "explicit-key-ind":
|
|
18774
|
-
if (!
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
} else if (atNextItem ||
|
|
18798
|
+
if (!it.sep && !it.explicitKey) {
|
|
18799
|
+
it.start.push(this.sourceToken);
|
|
18800
|
+
it.explicitKey = true;
|
|
18801
|
+
} else if (atNextItem || it.value) {
|
|
18778
18802
|
start.push(this.sourceToken);
|
|
18779
18803
|
map2.items.push({ start, explicitKey: true });
|
|
18780
18804
|
} else {
|
|
@@ -18788,12 +18812,12 @@ ${end2.comment}` : end2.comment;
|
|
|
18788
18812
|
this.onKeyLine = true;
|
|
18789
18813
|
return;
|
|
18790
18814
|
case "map-value-ind":
|
|
18791
|
-
if (
|
|
18792
|
-
if (!
|
|
18793
|
-
if (includesToken(
|
|
18794
|
-
Object.assign(
|
|
18815
|
+
if (it.explicitKey) {
|
|
18816
|
+
if (!it.sep) {
|
|
18817
|
+
if (includesToken(it.start, "newline")) {
|
|
18818
|
+
Object.assign(it, { key: null, sep: [this.sourceToken] });
|
|
18795
18819
|
} else {
|
|
18796
|
-
const start2 = getFirstKeyStartProps(
|
|
18820
|
+
const start2 = getFirstKeyStartProps(it.start);
|
|
18797
18821
|
this.stack.push({
|
|
18798
18822
|
type: "block-map",
|
|
18799
18823
|
offset: this.offset,
|
|
@@ -18801,22 +18825,22 @@ ${end2.comment}` : end2.comment;
|
|
|
18801
18825
|
items: [{ start: start2, key: null, sep: [this.sourceToken] }]
|
|
18802
18826
|
});
|
|
18803
18827
|
}
|
|
18804
|
-
} else if (
|
|
18828
|
+
} else if (it.value) {
|
|
18805
18829
|
map2.items.push({ start: [], key: null, sep: [this.sourceToken] });
|
|
18806
|
-
} else if (includesToken(
|
|
18830
|
+
} else if (includesToken(it.sep, "map-value-ind")) {
|
|
18807
18831
|
this.stack.push({
|
|
18808
18832
|
type: "block-map",
|
|
18809
18833
|
offset: this.offset,
|
|
18810
18834
|
indent: this.indent,
|
|
18811
18835
|
items: [{ start, key: null, sep: [this.sourceToken] }]
|
|
18812
18836
|
});
|
|
18813
|
-
} else if (isFlowToken(
|
|
18814
|
-
const start2 = getFirstKeyStartProps(
|
|
18815
|
-
const key =
|
|
18816
|
-
const sep =
|
|
18837
|
+
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
18838
|
+
const start2 = getFirstKeyStartProps(it.start);
|
|
18839
|
+
const key = it.key;
|
|
18840
|
+
const sep = it.sep;
|
|
18817
18841
|
sep.push(this.sourceToken);
|
|
18818
|
-
delete
|
|
18819
|
-
delete
|
|
18842
|
+
delete it.key;
|
|
18843
|
+
delete it.sep;
|
|
18820
18844
|
this.stack.push({
|
|
18821
18845
|
type: "block-map",
|
|
18822
18846
|
offset: this.offset,
|
|
@@ -18824,16 +18848,16 @@ ${end2.comment}` : end2.comment;
|
|
|
18824
18848
|
items: [{ start: start2, key, sep }]
|
|
18825
18849
|
});
|
|
18826
18850
|
} else if (start.length > 0) {
|
|
18827
|
-
|
|
18851
|
+
it.sep = it.sep.concat(start, this.sourceToken);
|
|
18828
18852
|
} else {
|
|
18829
|
-
|
|
18853
|
+
it.sep.push(this.sourceToken);
|
|
18830
18854
|
}
|
|
18831
18855
|
} else {
|
|
18832
|
-
if (!
|
|
18833
|
-
Object.assign(
|
|
18834
|
-
} else if (
|
|
18856
|
+
if (!it.sep) {
|
|
18857
|
+
Object.assign(it, { key: null, sep: [this.sourceToken] });
|
|
18858
|
+
} else if (it.value || atNextItem) {
|
|
18835
18859
|
map2.items.push({ start, key: null, sep: [this.sourceToken] });
|
|
18836
|
-
} else if (includesToken(
|
|
18860
|
+
} else if (includesToken(it.sep, "map-value-ind")) {
|
|
18837
18861
|
this.stack.push({
|
|
18838
18862
|
type: "block-map",
|
|
18839
18863
|
offset: this.offset,
|
|
@@ -18841,7 +18865,7 @@ ${end2.comment}` : end2.comment;
|
|
|
18841
18865
|
items: [{ start: [], key: null, sep: [this.sourceToken] }]
|
|
18842
18866
|
});
|
|
18843
18867
|
} else {
|
|
18844
|
-
|
|
18868
|
+
it.sep.push(this.sourceToken);
|
|
18845
18869
|
}
|
|
18846
18870
|
}
|
|
18847
18871
|
this.onKeyLine = true;
|
|
@@ -18851,13 +18875,13 @@ ${end2.comment}` : end2.comment;
|
|
|
18851
18875
|
case "single-quoted-scalar":
|
|
18852
18876
|
case "double-quoted-scalar": {
|
|
18853
18877
|
const fs = this.flowScalar(this.type);
|
|
18854
|
-
if (atNextItem ||
|
|
18878
|
+
if (atNextItem || it.value) {
|
|
18855
18879
|
map2.items.push({ start, key: fs, sep: [] });
|
|
18856
18880
|
this.onKeyLine = true;
|
|
18857
|
-
} else if (
|
|
18881
|
+
} else if (it.sep) {
|
|
18858
18882
|
this.stack.push(fs);
|
|
18859
18883
|
} else {
|
|
18860
|
-
Object.assign(
|
|
18884
|
+
Object.assign(it, { key: fs, sep: [] });
|
|
18861
18885
|
this.onKeyLine = true;
|
|
18862
18886
|
}
|
|
18863
18887
|
return;
|
|
@@ -18865,7 +18889,17 @@ ${end2.comment}` : end2.comment;
|
|
|
18865
18889
|
default: {
|
|
18866
18890
|
const bv = this.startBlockValue(map2);
|
|
18867
18891
|
if (bv) {
|
|
18868
|
-
if (
|
|
18892
|
+
if (bv.type === "block-seq") {
|
|
18893
|
+
if (!it.explicitKey && it.sep && !includesToken(it.sep, "newline")) {
|
|
18894
|
+
yield* this.pop({
|
|
18895
|
+
type: "error",
|
|
18896
|
+
offset: this.offset,
|
|
18897
|
+
message: "Unexpected block-seq-ind on same line with key",
|
|
18898
|
+
source: this.source
|
|
18899
|
+
});
|
|
18900
|
+
return;
|
|
18901
|
+
}
|
|
18902
|
+
} else if (atMapIndent) {
|
|
18869
18903
|
map2.items.push({ start });
|
|
18870
18904
|
}
|
|
18871
18905
|
this.stack.push(bv);
|
|
@@ -18879,50 +18913,50 @@ ${end2.comment}` : end2.comment;
|
|
|
18879
18913
|
}
|
|
18880
18914
|
*blockSequence(seq2) {
|
|
18881
18915
|
var _a2;
|
|
18882
|
-
const
|
|
18916
|
+
const it = seq2.items[seq2.items.length - 1];
|
|
18883
18917
|
switch (this.type) {
|
|
18884
18918
|
case "newline":
|
|
18885
|
-
if (
|
|
18886
|
-
const end2 = "end" in
|
|
18919
|
+
if (it.value) {
|
|
18920
|
+
const end2 = "end" in it.value ? it.value.end : void 0;
|
|
18887
18921
|
const last2 = Array.isArray(end2) ? end2[end2.length - 1] : void 0;
|
|
18888
18922
|
if ((last2 == null ? void 0 : last2.type) === "comment")
|
|
18889
18923
|
end2 == null ? void 0 : end2.push(this.sourceToken);
|
|
18890
18924
|
else
|
|
18891
18925
|
seq2.items.push({ start: [this.sourceToken] });
|
|
18892
18926
|
} else
|
|
18893
|
-
|
|
18927
|
+
it.start.push(this.sourceToken);
|
|
18894
18928
|
return;
|
|
18895
18929
|
case "space":
|
|
18896
18930
|
case "comment":
|
|
18897
|
-
if (
|
|
18931
|
+
if (it.value)
|
|
18898
18932
|
seq2.items.push({ start: [this.sourceToken] });
|
|
18899
18933
|
else {
|
|
18900
|
-
if (this.atIndentedComment(
|
|
18934
|
+
if (this.atIndentedComment(it.start, seq2.indent)) {
|
|
18901
18935
|
const prev2 = seq2.items[seq2.items.length - 2];
|
|
18902
18936
|
const end2 = (_a2 = prev2 == null ? void 0 : prev2.value) == null ? void 0 : _a2.end;
|
|
18903
18937
|
if (Array.isArray(end2)) {
|
|
18904
|
-
Array.prototype.push.apply(end2,
|
|
18938
|
+
Array.prototype.push.apply(end2, it.start);
|
|
18905
18939
|
end2.push(this.sourceToken);
|
|
18906
18940
|
seq2.items.pop();
|
|
18907
18941
|
return;
|
|
18908
18942
|
}
|
|
18909
18943
|
}
|
|
18910
|
-
|
|
18944
|
+
it.start.push(this.sourceToken);
|
|
18911
18945
|
}
|
|
18912
18946
|
return;
|
|
18913
18947
|
case "anchor":
|
|
18914
18948
|
case "tag":
|
|
18915
|
-
if (
|
|
18949
|
+
if (it.value || this.indent <= seq2.indent)
|
|
18916
18950
|
break;
|
|
18917
|
-
|
|
18951
|
+
it.start.push(this.sourceToken);
|
|
18918
18952
|
return;
|
|
18919
18953
|
case "seq-item-ind":
|
|
18920
18954
|
if (this.indent !== seq2.indent)
|
|
18921
18955
|
break;
|
|
18922
|
-
if (
|
|
18956
|
+
if (it.value || includesToken(it.start, "seq-item-ind"))
|
|
18923
18957
|
seq2.items.push({ start: [this.sourceToken] });
|
|
18924
18958
|
else
|
|
18925
|
-
|
|
18959
|
+
it.start.push(this.sourceToken);
|
|
18926
18960
|
return;
|
|
18927
18961
|
}
|
|
18928
18962
|
if (this.indent > seq2.indent) {
|
|
@@ -18936,7 +18970,7 @@ ${end2.comment}` : end2.comment;
|
|
|
18936
18970
|
yield* this.step();
|
|
18937
18971
|
}
|
|
18938
18972
|
*flowCollection(fc) {
|
|
18939
|
-
const
|
|
18973
|
+
const it = fc.items[fc.items.length - 1];
|
|
18940
18974
|
if (this.type === "flow-error-end") {
|
|
18941
18975
|
let top;
|
|
18942
18976
|
do {
|
|
@@ -18947,42 +18981,42 @@ ${end2.comment}` : end2.comment;
|
|
|
18947
18981
|
switch (this.type) {
|
|
18948
18982
|
case "comma":
|
|
18949
18983
|
case "explicit-key-ind":
|
|
18950
|
-
if (!
|
|
18984
|
+
if (!it || it.sep)
|
|
18951
18985
|
fc.items.push({ start: [this.sourceToken] });
|
|
18952
18986
|
else
|
|
18953
|
-
|
|
18987
|
+
it.start.push(this.sourceToken);
|
|
18954
18988
|
return;
|
|
18955
18989
|
case "map-value-ind":
|
|
18956
|
-
if (!
|
|
18990
|
+
if (!it || it.value)
|
|
18957
18991
|
fc.items.push({ start: [], key: null, sep: [this.sourceToken] });
|
|
18958
|
-
else if (
|
|
18959
|
-
|
|
18992
|
+
else if (it.sep)
|
|
18993
|
+
it.sep.push(this.sourceToken);
|
|
18960
18994
|
else
|
|
18961
|
-
Object.assign(
|
|
18995
|
+
Object.assign(it, { key: null, sep: [this.sourceToken] });
|
|
18962
18996
|
return;
|
|
18963
18997
|
case "space":
|
|
18964
18998
|
case "comment":
|
|
18965
18999
|
case "newline":
|
|
18966
19000
|
case "anchor":
|
|
18967
19001
|
case "tag":
|
|
18968
|
-
if (!
|
|
19002
|
+
if (!it || it.value)
|
|
18969
19003
|
fc.items.push({ start: [this.sourceToken] });
|
|
18970
|
-
else if (
|
|
18971
|
-
|
|
19004
|
+
else if (it.sep)
|
|
19005
|
+
it.sep.push(this.sourceToken);
|
|
18972
19006
|
else
|
|
18973
|
-
|
|
19007
|
+
it.start.push(this.sourceToken);
|
|
18974
19008
|
return;
|
|
18975
19009
|
case "alias":
|
|
18976
19010
|
case "scalar":
|
|
18977
19011
|
case "single-quoted-scalar":
|
|
18978
19012
|
case "double-quoted-scalar": {
|
|
18979
19013
|
const fs = this.flowScalar(this.type);
|
|
18980
|
-
if (!
|
|
19014
|
+
if (!it || it.value)
|
|
18981
19015
|
fc.items.push({ start: [], key: fs, sep: [] });
|
|
18982
|
-
else if (
|
|
19016
|
+
else if (it.sep)
|
|
18983
19017
|
this.stack.push(fs);
|
|
18984
19018
|
else
|
|
18985
|
-
Object.assign(
|
|
19019
|
+
Object.assign(it, { key: fs, sep: [] });
|
|
18986
19020
|
return;
|
|
18987
19021
|
}
|
|
18988
19022
|
case "flow-map-end":
|
|
@@ -19099,7 +19133,7 @@ ${end2.comment}` : end2.comment;
|
|
|
19099
19133
|
return false;
|
|
19100
19134
|
if (this.indent <= indent)
|
|
19101
19135
|
return false;
|
|
19102
|
-
return start.every((
|
|
19136
|
+
return start.every((st) => st.type === "newline" || st.type === "space");
|
|
19103
19137
|
}
|
|
19104
19138
|
*documentEnd(docEnd) {
|
|
19105
19139
|
if (this.type !== "doc-mode") {
|
|
@@ -23720,18 +23754,18 @@ ${end2.comment}` : end2.comment;
|
|
|
23720
23754
|
// 0-9 monospace
|
|
23721
23755
|
];
|
|
23722
23756
|
const wideCharacterFont = function(wideChar2, mode) {
|
|
23723
|
-
const
|
|
23757
|
+
const H = wideChar2.charCodeAt(0);
|
|
23724
23758
|
const L2 = wideChar2.charCodeAt(1);
|
|
23725
|
-
const codePoint = (
|
|
23726
|
-
const
|
|
23759
|
+
const codePoint = (H - 55296) * 1024 + (L2 - 56320) + 65536;
|
|
23760
|
+
const j = mode === "math" ? 0 : 1;
|
|
23727
23761
|
if (119808 <= codePoint && codePoint < 120484) {
|
|
23728
23762
|
const i = Math.floor((codePoint - 119808) / 26);
|
|
23729
|
-
return [wideLatinLetterData[i][2], wideLatinLetterData[i][
|
|
23763
|
+
return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]];
|
|
23730
23764
|
} else if (120782 <= codePoint && codePoint <= 120831) {
|
|
23731
23765
|
const i = Math.floor((codePoint - 120782) / 10);
|
|
23732
|
-
return [wideNumeralData[i][2], wideNumeralData[i][
|
|
23766
|
+
return [wideNumeralData[i][2], wideNumeralData[i][j]];
|
|
23733
23767
|
} else if (codePoint === 120485 || codePoint === 120486) {
|
|
23734
|
-
return [wideLatinLetterData[0][2], wideLatinLetterData[0][
|
|
23768
|
+
return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]];
|
|
23735
23769
|
} else if (120486 < codePoint && codePoint < 120782) {
|
|
23736
23770
|
return ["", ""];
|
|
23737
23771
|
} else {
|
|
@@ -25815,13 +25849,13 @@ ${end2.comment}` : end2.comment;
|
|
|
25815
25849
|
for (let i = 0; i < parsedRows.length; i++) {
|
|
25816
25850
|
const rowNodes = parsedRows[i];
|
|
25817
25851
|
let cell = newCell();
|
|
25818
|
-
for (let
|
|
25819
|
-
if (!isStartOfArrow(rowNodes[
|
|
25820
|
-
cell.body.push(rowNodes[
|
|
25852
|
+
for (let j = 0; j < rowNodes.length; j++) {
|
|
25853
|
+
if (!isStartOfArrow(rowNodes[j])) {
|
|
25854
|
+
cell.body.push(rowNodes[j]);
|
|
25821
25855
|
} else {
|
|
25822
25856
|
row.push(cell);
|
|
25823
|
-
|
|
25824
|
-
const arrowChar = assertSymbolNodeType(rowNodes[
|
|
25857
|
+
j += 1;
|
|
25858
|
+
const arrowChar = assertSymbolNodeType(rowNodes[j]).text;
|
|
25825
25859
|
const labels = new Array(2);
|
|
25826
25860
|
labels[0] = {
|
|
25827
25861
|
type: "ordgroup",
|
|
@@ -25837,10 +25871,10 @@ ${end2.comment}` : end2.comment;
|
|
|
25837
25871
|
else if ("<>AV".indexOf(arrowChar) > -1) {
|
|
25838
25872
|
for (let labelNum = 0; labelNum < 2; labelNum++) {
|
|
25839
25873
|
let inLabel = true;
|
|
25840
|
-
for (let k =
|
|
25874
|
+
for (let k = j + 1; k < rowNodes.length; k++) {
|
|
25841
25875
|
if (isLabelEnd(rowNodes[k], arrowChar)) {
|
|
25842
25876
|
inLabel = false;
|
|
25843
|
-
|
|
25877
|
+
j = k;
|
|
25844
25878
|
break;
|
|
25845
25879
|
}
|
|
25846
25880
|
if (isStartOfArrow(rowNodes[k])) {
|
|
@@ -25849,11 +25883,11 @@ ${end2.comment}` : end2.comment;
|
|
|
25849
25883
|
labels[labelNum].body.push(rowNodes[k]);
|
|
25850
25884
|
}
|
|
25851
25885
|
if (inLabel) {
|
|
25852
|
-
throw new src_ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[
|
|
25886
|
+
throw new src_ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[j]);
|
|
25853
25887
|
}
|
|
25854
25888
|
}
|
|
25855
25889
|
} else {
|
|
25856
|
-
throw new src_ParseError('Expected one of "<>AV=|." after @', rowNodes[
|
|
25890
|
+
throw new src_ParseError('Expected one of "<>AV=|." after @', rowNodes[j]);
|
|
25857
25891
|
}
|
|
25858
25892
|
const arrow = cdArrow(arrowChar, labels, parser);
|
|
25859
25893
|
const wrappedArrow = {
|
|
@@ -27596,8 +27630,8 @@ ${end2.comment}` : end2.comment;
|
|
|
27596
27630
|
options.minRuleThickness
|
|
27597
27631
|
// User override.
|
|
27598
27632
|
);
|
|
27599
|
-
const
|
|
27600
|
-
let arraycolsep = 5 *
|
|
27633
|
+
const pt = 1 / options.fontMetrics().ptPerEm;
|
|
27634
|
+
let arraycolsep = 5 * pt;
|
|
27601
27635
|
if (group.colSeparationType && group.colSeparationType === "small") {
|
|
27602
27636
|
const localMultiplier = options.havingStyle(src_Style.SCRIPT).sizeMultiplier;
|
|
27603
27637
|
arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier);
|
|
@@ -27605,8 +27639,8 @@ ${end2.comment}` : end2.comment;
|
|
|
27605
27639
|
const baselineskip = group.colSeparationType === "CD" ? calculateSize({
|
|
27606
27640
|
number: 3,
|
|
27607
27641
|
unit: "ex"
|
|
27608
|
-
}, options) : 12 *
|
|
27609
|
-
const jot = 3 *
|
|
27642
|
+
}, options) : 12 * pt;
|
|
27643
|
+
const jot = 3 * pt;
|
|
27610
27644
|
const arrayskip = group.arraystretch * baselineskip;
|
|
27611
27645
|
const arstrutHeight = 0.7 * arrayskip;
|
|
27612
27646
|
const arstrutDepth = 0.3 * arrayskip;
|
|
@@ -27823,8 +27857,8 @@ ${end2.comment}` : end2.comment;
|
|
|
27823
27857
|
for (let i = 0; i < group.body.length; i++) {
|
|
27824
27858
|
const rw = group.body[i];
|
|
27825
27859
|
const row = [];
|
|
27826
|
-
for (let
|
|
27827
|
-
row.push(new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(rw[
|
|
27860
|
+
for (let j = 0; j < rw.length; j++) {
|
|
27861
|
+
row.push(new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(rw[j], options)]));
|
|
27828
27862
|
}
|
|
27829
27863
|
if (group.tags && group.tags[i]) {
|
|
27830
27864
|
row.unshift(glue);
|
|
@@ -34167,8 +34201,8 @@ ${end2.comment}` : end2.comment;
|
|
|
34167
34201
|
function definePlugin(plugin2) {
|
|
34168
34202
|
return plugin2;
|
|
34169
34203
|
}
|
|
34170
|
-
const svgMarked = '<svg width="16" height="16" viewBox="0 -3 24 24"><path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"/></svg>\
|
|
34171
|
-
const svgUnmarked = '<svg width="16" height="16" viewBox="0 -3 24 24"><path fill-rule="evenodd" d="M6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1zM3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-5z" clip-rule="evenodd"/></svg>\
|
|
34204
|
+
const svgMarked = '<svg width="16" height="16" viewBox="0 -3 24 24"><path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"/></svg>\n';
|
|
34205
|
+
const svgUnmarked = '<svg width="16" height="16" viewBox="0 -3 24 24"><path fill-rule="evenodd" d="M6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1zM3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-5z" clip-rule="evenodd"/></svg>\n';
|
|
34172
34206
|
const name$5 = "checkbox";
|
|
34173
34207
|
const images = {
|
|
34174
34208
|
" ": svgUnmarked.trim(),
|
|
@@ -34629,10 +34663,10 @@ ${end2.comment}` : end2.comment;
|
|
|
34629
34663
|
}
|
|
34630
34664
|
}
|
|
34631
34665
|
const transformerVersions = {
|
|
34632
|
-
"markmap-lib": "0.
|
|
34666
|
+
"markmap-lib": "0.18.12"
|
|
34633
34667
|
};
|
|
34634
34668
|
exports.Hook = Hook;
|
|
34635
|
-
exports.Markmap =
|
|
34669
|
+
exports.Markmap = Et;
|
|
34636
34670
|
exports.Transformer = Transformer;
|
|
34637
34671
|
exports.UrlBuilder = UrlBuilder;
|
|
34638
34672
|
exports.addClass = addClass$1;
|
|
@@ -34642,22 +34676,20 @@ ${end2.comment}` : end2.comment;
|
|
|
34642
34676
|
exports.builtInPlugins = builtInPlugins;
|
|
34643
34677
|
exports.childSelector = b;
|
|
34644
34678
|
exports.debounce = debounce;
|
|
34645
|
-
exports.defaultColorFn =
|
|
34646
|
-
exports.defaultOptions =
|
|
34679
|
+
exports.defaultColorFn = ne;
|
|
34680
|
+
exports.defaultOptions = yt;
|
|
34647
34681
|
exports.defer = defer;
|
|
34648
|
-
exports.deriveOptions =
|
|
34682
|
+
exports.deriveOptions = Fe;
|
|
34649
34683
|
exports.escapeHtml = escapeHtml$1;
|
|
34650
34684
|
exports.escapeScript = escapeScript;
|
|
34651
34685
|
exports.extractAssets = extractAssets;
|
|
34652
34686
|
exports.getId = getId;
|
|
34653
|
-
exports.globalCSS =
|
|
34687
|
+
exports.globalCSS = We;
|
|
34654
34688
|
exports.htmlClose = htmlClose;
|
|
34655
|
-
exports.htmlInlineToMarkdown =
|
|
34689
|
+
exports.htmlInlineToMarkdown = $;
|
|
34656
34690
|
exports.htmlOpen = htmlOpen;
|
|
34657
|
-
exports.isMacintosh =
|
|
34658
|
-
exports.lineWidthFactory =
|
|
34659
|
-
exports.loadCSS = loadCSS;
|
|
34660
|
-
exports.loadJS = loadJS;
|
|
34691
|
+
exports.isMacintosh = gt;
|
|
34692
|
+
exports.lineWidthFactory = mt;
|
|
34661
34693
|
exports.memoize = memoize;
|
|
34662
34694
|
exports.mergeAssets = mergeAssets;
|
|
34663
34695
|
exports.noop = noop;
|
|
@@ -34665,9 +34697,9 @@ ${end2.comment}` : end2.comment;
|
|
|
34665
34697
|
exports.patchJSItem = patchJSItem;
|
|
34666
34698
|
exports.persistCSS = persistCSS;
|
|
34667
34699
|
exports.persistJS = persistJS;
|
|
34668
|
-
exports.refreshHook =
|
|
34669
|
-
exports.simpleHash =
|
|
34670
|
-
exports.toMarkdown =
|
|
34700
|
+
exports.refreshHook = Pe;
|
|
34701
|
+
exports.simpleHash = V;
|
|
34702
|
+
exports.toMarkdown = Ve;
|
|
34671
34703
|
exports.transformerVersions = transformerVersions;
|
|
34672
34704
|
exports.urlBuilder = urlBuilder;
|
|
34673
34705
|
exports.walkTree = walkTree;
|