monowind 0.2.2 → 0.2.4
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/README.md +3 -2
- package/dist/cdn.js +1189 -22
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts +11 -0
- package/dist/element.d.ts.map +1 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/index.js +1170 -1006
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +5 -0
- package/dist/layout.d.ts.map +1 -1
- package/dist/plain-text.d.ts +19 -0
- package/dist/plain-text.d.ts.map +1 -1
- package/dist/sort.js +233 -5
- package/dist/sort.js.map +1 -1
- package/dist/style.d.ts.map +1 -1
- package/dist/types.d.ts +19 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/warn.d.ts +4 -0
- package/dist/warn.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/styles.css +11 -0
- package/src/utilities.css +30 -6
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ function i(e) {
|
|
|
33
33
|
if (!e.contains(a)) continue;
|
|
34
34
|
t.splice(i, 1), r = !0;
|
|
35
35
|
let l = c(getComputedStyle(a), "background-color"), u = f(o), d = f(s);
|
|
36
|
-
|
|
36
|
+
l && u && d && n.set(a, {
|
|
37
37
|
from: u,
|
|
38
38
|
to: d,
|
|
39
39
|
toValue: s,
|
|
@@ -344,49 +344,54 @@ x("blocks", {
|
|
|
344
344
|
var M = /* @__PURE__ */ new WeakMap();
|
|
345
345
|
function N(e, t) {
|
|
346
346
|
let n = M.get(e);
|
|
347
|
-
n || M.set(e, n = /* @__PURE__ */ new Set()), !n.has(t) && (n.add(t), console.warn(`[monowind] ${t}`, e));
|
|
347
|
+
n || M.set(e, n = /* @__PURE__ */ new Set()), !n.has(t) && (n.add(t), console.warn(`[monowind] ${t}`, ee(e)));
|
|
348
|
+
}
|
|
349
|
+
function ee(e) {
|
|
350
|
+
if (!globalThis.process?.versions?.node) return e;
|
|
351
|
+
let t = e.id ? `#${e.id}` : "", n = e.classList.length ? `.${Array.from(e.classList).join(".")}` : "";
|
|
352
|
+
return `<${e.tagName.toLowerCase()}${t}${n}>`;
|
|
348
353
|
}
|
|
349
354
|
//#endregion
|
|
350
355
|
//#region src/leaf.ts
|
|
351
|
-
var
|
|
352
|
-
function
|
|
356
|
+
var te = /* @__PURE__ */ new Map(), ne = /* @__PURE__ */ new Set();
|
|
357
|
+
function re(e) {
|
|
353
358
|
let t = e.tag.toLowerCase();
|
|
354
359
|
if (!t.includes("-")) {
|
|
355
360
|
console.warn(`[monowind] registerLeafRenderer: "${e.tag}" is not a custom-element tag name (needs a hyphen); ignored.`);
|
|
356
361
|
return;
|
|
357
362
|
}
|
|
358
|
-
|
|
363
|
+
te.has(t) && console.warn(`[monowind] registerLeafRenderer: replacing existing renderer for <${t}> (last registration wins).`), te.set(t, {
|
|
359
364
|
...e,
|
|
360
365
|
tag: t
|
|
361
|
-
}),
|
|
366
|
+
}), le();
|
|
362
367
|
}
|
|
363
|
-
function
|
|
364
|
-
|
|
368
|
+
function ie() {
|
|
369
|
+
le();
|
|
365
370
|
}
|
|
366
|
-
function
|
|
367
|
-
return
|
|
371
|
+
function ae(e) {
|
|
372
|
+
return te.get(e.toLowerCase());
|
|
368
373
|
}
|
|
369
|
-
function
|
|
374
|
+
function oe() {
|
|
370
375
|
let e = /* @__PURE__ */ new Set();
|
|
371
|
-
for (let t of
|
|
376
|
+
for (let t of te.values()) for (let n of t.observedAttributes ?? []) e.add(n.toLowerCase());
|
|
372
377
|
return [...e];
|
|
373
378
|
}
|
|
374
|
-
function
|
|
375
|
-
return
|
|
379
|
+
function se(e) {
|
|
380
|
+
return ne.add(e), () => ne.delete(e);
|
|
376
381
|
}
|
|
377
|
-
function
|
|
382
|
+
function ce(e, t) {
|
|
378
383
|
try {
|
|
379
384
|
return e.render(t);
|
|
380
385
|
} catch (n) {
|
|
381
386
|
return N(t, `<${e.tag}> renderer threw; rendering nothing. ${String(n)}`), null;
|
|
382
387
|
}
|
|
383
388
|
}
|
|
384
|
-
function
|
|
385
|
-
for (let e of
|
|
389
|
+
function le() {
|
|
390
|
+
for (let e of ne) e();
|
|
386
391
|
}
|
|
387
392
|
//#endregion
|
|
388
393
|
//#region src/borders.ts
|
|
389
|
-
function
|
|
394
|
+
function ue(e, t, n) {
|
|
390
395
|
let r = e.border;
|
|
391
396
|
if (r.top === 0 && r.right === 0 && r.bottom === 0 && r.left === 0) return;
|
|
392
397
|
let i = Math.max(r.top, r.right, r.bottom, r.left);
|
|
@@ -402,11 +407,11 @@ function le(e, t, n) {
|
|
|
402
407
|
width: t.width - (i.left ? a : 0) - (i.right ? a : 0),
|
|
403
408
|
height: t.height - (i.top ? a : 0) - (i.bottom ? a : 0)
|
|
404
409
|
};
|
|
405
|
-
o.width <= 0 || o.height <= 0 ||
|
|
410
|
+
o.width <= 0 || o.height <= 0 || de(n, e.borderStyle, e.borderColor, o, i, S(e.glyphSet));
|
|
406
411
|
}
|
|
407
412
|
}
|
|
408
|
-
function
|
|
409
|
-
let o =
|
|
413
|
+
function de(e, t, n, r, i, a) {
|
|
414
|
+
let o = ge(t.top, a), s = ge(t.right, a), c = ge(t.bottom, a), l = ge(t.left, a), u = (e, t, n) => n(ge(e === t ? e : "solid", a)), { x: d, y: f, width: p, height: m } = r, h = p >= 2 && m >= 2, g = d + +!!i.left, _ = d + p - +!!i.right, v = f + +!!i.top, y = f + m - +!!i.bottom;
|
|
410
415
|
if (i.top && _ > g && e.push({
|
|
411
416
|
glyph: o.h,
|
|
412
417
|
x: g,
|
|
@@ -459,13 +464,13 @@ function ue(e, t, n, r, i, a) {
|
|
|
459
464
|
color: n.bottom
|
|
460
465
|
}));
|
|
461
466
|
}
|
|
462
|
-
function
|
|
467
|
+
function fe(e, t) {
|
|
463
468
|
return e.style.position !== "static" || (t.style.display === "flex" || t.style.display === "grid") && e.style.zIndex !== null;
|
|
464
469
|
}
|
|
465
|
-
function
|
|
470
|
+
function pe(e) {
|
|
466
471
|
if (e.children.length <= 1) return e.children;
|
|
467
472
|
let t = null, n = null, r = null, i = null;
|
|
468
|
-
for (let a of e.children)
|
|
473
|
+
for (let a of e.children) fe(a, e) ? (a.style.zIndex ?? 0) < 0 ? (t ??= []).push(a) : (i ??= []).push(a) : a.inlineBox ? (r ??= []).push(a) : (n ??= []).push(a);
|
|
469
474
|
return t && t.length > 1 && t.sort((e, t) => (e.style.zIndex ?? 0) - (t.style.zIndex ?? 0)), i && i.length > 1 && i.sort((e, t) => (e.style.zIndex ?? 0) - (t.style.zIndex ?? 0)), !t && n && !r && !i ? n : !t && !n && r && !i ? r : !t && !n && !r && i ? i : [
|
|
470
475
|
...t ?? [],
|
|
471
476
|
...n ?? [],
|
|
@@ -473,11 +478,11 @@ function fe(e) {
|
|
|
473
478
|
...i ?? []
|
|
474
479
|
];
|
|
475
480
|
}
|
|
476
|
-
function
|
|
477
|
-
let r =
|
|
481
|
+
function me(e, t, n) {
|
|
482
|
+
let r = ge(e, n);
|
|
478
483
|
return t === "h" ? r.h : r.v;
|
|
479
484
|
}
|
|
480
|
-
function
|
|
485
|
+
function he(e, t, n, r, i, a) {
|
|
481
486
|
let o = (t ? 8 : 0) | (n ? 4 : 0) | (r ? 2 : 0) | !!i;
|
|
482
487
|
if (a) {
|
|
483
488
|
let t = w(o), n = t && a[e]?.[t];
|
|
@@ -485,8 +490,8 @@ function me(e, t, n, r, i, a) {
|
|
|
485
490
|
}
|
|
486
491
|
return (e === "double" ? E : T)[o];
|
|
487
492
|
}
|
|
488
|
-
function
|
|
489
|
-
let n = (n, r, i, a) =>
|
|
493
|
+
function ge(e, t) {
|
|
494
|
+
let n = (n, r, i, a) => he(e, n, r, i, a, t), r = {
|
|
490
495
|
h: n(!1, !1, !0, !0),
|
|
491
496
|
v: n(!0, !0, !1, !1),
|
|
492
497
|
tl: n(!1, !0, !1, !0),
|
|
@@ -497,24 +502,24 @@ function he(e, t) {
|
|
|
497
502
|
return e === "dashed" ? {
|
|
498
503
|
h: "╌",
|
|
499
504
|
v: "╎",
|
|
500
|
-
...
|
|
501
|
-
...
|
|
505
|
+
..._e(r),
|
|
506
|
+
...ve(t, e)
|
|
502
507
|
} : e === "dotted" ? {
|
|
503
508
|
h: "┄",
|
|
504
509
|
v: "┊",
|
|
505
|
-
...
|
|
506
|
-
...
|
|
510
|
+
..._e(r),
|
|
511
|
+
...ve(t, e)
|
|
507
512
|
} : r;
|
|
508
513
|
}
|
|
509
|
-
function
|
|
514
|
+
function _e(e) {
|
|
510
515
|
let { h: t, v: n, ...r } = e;
|
|
511
516
|
return r;
|
|
512
517
|
}
|
|
513
|
-
function
|
|
518
|
+
function ve(e, t) {
|
|
514
519
|
let n = e?.[t], r = {};
|
|
515
520
|
return n?.h && (r.h = n.h), n?.v && (r.v = n.v), r;
|
|
516
521
|
}
|
|
517
|
-
function
|
|
522
|
+
function ye(e, t, n, r) {
|
|
518
523
|
let i = e.map((e) => e.spanned ? !1 : n === "between" ? e.beforeOccupied && e.afterOccupied : n !== "around" || e.beforeOccupied || e.afterOccupied), a = [];
|
|
519
524
|
for (let n = 0; n < e.length; n++) if (a.push({
|
|
520
525
|
start: e[n].start,
|
|
@@ -558,7 +563,7 @@ function ve(e, t, n, r) {
|
|
|
558
563
|
end: e.end - r
|
|
559
564
|
})).filter((e) => e.end > e.start);
|
|
560
565
|
}
|
|
561
|
-
function
|
|
566
|
+
function be(e) {
|
|
562
567
|
let t = [], n = e.border.left + e.padding.left, r = e.border.top + e.padding.top, i = (e, t) => ({
|
|
563
568
|
line: t.bandStart + Math.floor((t.bandSize - e.width) / 2),
|
|
564
569
|
start: t.start,
|
|
@@ -567,7 +572,7 @@ function ye(e) {
|
|
|
567
572
|
endHalf: t.endHalf === !0
|
|
568
573
|
}), a = e.ruleX ? e.vertical.map((t) => i(e.ruleX, t)) : [], o = e.ruleY ? e.horizontal.map((t) => i(e.ruleY, t)) : [], s = e.ruleX?.width ?? 0, c = e.ruleY?.width ?? 0, l = (e, t, n, r) => e.some((e) => n >= e.line && n < e.line + t && (e.start < r && e.end > r || e.end === r && !e.endHalf || e.start === r && !e.startHalf)), u = (e, t) => o.some((n) => t >= n.line && t < n.line + c && e >= n.start && e < n.end);
|
|
569
574
|
if (e.ruleX) {
|
|
570
|
-
let i =
|
|
575
|
+
let i = me(e.ruleX.style, "v", e.glyphs);
|
|
571
576
|
for (let o of a) {
|
|
572
577
|
for (let a = 0; a < s; a++) for (let s = o.start; s < o.end; s++) u(o.line + a, s) || t.push({
|
|
573
578
|
glyph: i,
|
|
@@ -576,7 +581,7 @@ function ye(e) {
|
|
|
576
581
|
length: 1,
|
|
577
582
|
color: e.ruleX.color
|
|
578
583
|
});
|
|
579
|
-
|
|
584
|
+
xe(e, t, "x", o.line, o.start, o.end);
|
|
580
585
|
}
|
|
581
586
|
}
|
|
582
587
|
if (e.ruleY) {
|
|
@@ -587,7 +592,7 @@ function ye(e) {
|
|
|
587
592
|
for (let d = u.start; d < u.end; d++) {
|
|
588
593
|
let u = l(a, s, d, f), p = l(a, s, d, f + 1);
|
|
589
594
|
t.push({
|
|
590
|
-
glyph: u || p ?
|
|
595
|
+
glyph: u || p ? he(i ? "double" : "solid", u, p, l(o, c, f, d), l(o, c, f, d + 1), e.glyphs) : me(e.ruleY.style, "h", e.glyphs),
|
|
591
596
|
x: n + d,
|
|
592
597
|
y: r + f,
|
|
593
598
|
length: 1,
|
|
@@ -595,16 +600,16 @@ function ye(e) {
|
|
|
595
600
|
});
|
|
596
601
|
}
|
|
597
602
|
}
|
|
598
|
-
|
|
603
|
+
xe(e, t, "y", u.line, u.start, u.end);
|
|
599
604
|
}
|
|
600
605
|
}
|
|
601
606
|
return t;
|
|
602
607
|
}
|
|
603
|
-
function
|
|
608
|
+
function xe(e, t, n, r, i, a) {
|
|
604
609
|
let o = n === "x" ? e.ruleX : e.ruleY, s = e.border.left + e.padding.left, c = e.border.top + e.padding.top, l = s + e.contentWidth + e.padding.right + e.border.right, u = c + e.contentHeight + e.padding.bottom + e.border.bottom, d = (n, r, i, a, s, c, l, u) => {
|
|
605
610
|
let d = o.style === "double" && i === "double" ? "double" : "solid";
|
|
606
611
|
t.push({
|
|
607
|
-
glyph:
|
|
612
|
+
glyph: he(d, s, c, l, u, e.glyphs),
|
|
608
613
|
x: n,
|
|
609
614
|
y: r,
|
|
610
615
|
length: 1,
|
|
@@ -622,11 +627,11 @@ function be(e, t, n, r, i, a) {
|
|
|
622
627
|
}
|
|
623
628
|
//#endregion
|
|
624
629
|
//#region src/pointer.ts
|
|
625
|
-
function
|
|
630
|
+
function Se(e, t, n) {
|
|
626
631
|
let r = [], i = e, a = e.localRect.x, o = e.localRect.y;
|
|
627
632
|
for (;;) {
|
|
628
633
|
let e = null;
|
|
629
|
-
for (let r of
|
|
634
|
+
for (let r of pe(i)) {
|
|
630
635
|
if (r.tableHidden) continue;
|
|
631
636
|
let i = a + r.localRect.x, s = o + r.localRect.y;
|
|
632
637
|
t >= i && t < i + r.localRect.width && n >= s && n < s + r.localRect.height && (e = r);
|
|
@@ -639,8 +644,8 @@ function xe(e, t, n) {
|
|
|
639
644
|
}), a += e.localRect.x - (e.scroll?.x ?? 0), o += e.localRect.y - (e.scroll?.y ?? 0), i = e;
|
|
640
645
|
}
|
|
641
646
|
}
|
|
642
|
-
function
|
|
643
|
-
return
|
|
647
|
+
function Ce(e, t, n) {
|
|
648
|
+
return Se(e, t, n).map((e) => e.node.source);
|
|
644
649
|
}
|
|
645
650
|
//#endregion
|
|
646
651
|
//#region src/metrics.ts
|
|
@@ -650,10 +655,10 @@ function P(e) {
|
|
|
650
655
|
function F(e, t) {
|
|
651
656
|
return t <= 0 ? 0 : P(e / (.25 * t));
|
|
652
657
|
}
|
|
653
|
-
function
|
|
658
|
+
function we(e, t) {
|
|
654
659
|
return P(t * e / 100);
|
|
655
660
|
}
|
|
656
|
-
function
|
|
661
|
+
function Te(e, t) {
|
|
657
662
|
let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).letterSpacing) || 0, i = t.ownerDocument.createRange();
|
|
658
663
|
i.selectNodeContents(t);
|
|
659
664
|
let a = Math.max(0, i.getBoundingClientRect().height - n.height);
|
|
@@ -664,56 +669,56 @@ function we(e, t) {
|
|
|
664
669
|
inkOverhang: a
|
|
665
670
|
};
|
|
666
671
|
}
|
|
667
|
-
function
|
|
672
|
+
function Ee() {
|
|
668
673
|
return parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
669
674
|
}
|
|
670
675
|
//#endregion
|
|
671
676
|
//#region src/wrap.ts
|
|
672
|
-
function Ee(e, t, n = {}) {
|
|
673
|
-
return Ae(e, t, n).map((t) => e.slice(t.start, t.end));
|
|
674
|
-
}
|
|
675
677
|
function De(e, t, n = {}) {
|
|
676
|
-
return
|
|
678
|
+
return je(e, t, n).map((t) => e.slice(t.start, t.end));
|
|
677
679
|
}
|
|
678
|
-
function Oe(e, t) {
|
|
680
|
+
function Oe(e, t, n = {}) {
|
|
681
|
+
return je(e, t, n).length;
|
|
682
|
+
}
|
|
683
|
+
function ke(e, t) {
|
|
679
684
|
return t.endsWith("\n") && e.pop(), e;
|
|
680
685
|
}
|
|
681
|
-
function
|
|
686
|
+
function Ae(e) {
|
|
682
687
|
let t = [], n = 0;
|
|
683
688
|
for (let r = 0; r <= e.length; r++) (r === e.length || e[r] === "\n") && (t.push({
|
|
684
689
|
start: n,
|
|
685
690
|
end: r
|
|
686
691
|
}), n = r + 1);
|
|
687
|
-
return
|
|
692
|
+
return ke(t, e);
|
|
688
693
|
}
|
|
689
|
-
function
|
|
694
|
+
function je(e, t, n = {}) {
|
|
690
695
|
if (!/[^ \t\r\f]/.test(e)) return [];
|
|
691
696
|
let r = [], i = 0, a = n.firstLineIndent ?? 0;
|
|
692
|
-
for (let o = 0; o <= e.length; o++) (o === e.length || e[o] === "\n") && (r.push(...
|
|
693
|
-
return
|
|
697
|
+
for (let o = 0; o <= e.length; o++) (o === e.length || e[o] === "\n") && (r.push(...ze(e, i, o, t, n, a)), a = 0, i = o + 1);
|
|
698
|
+
return ke(r, e);
|
|
694
699
|
}
|
|
695
|
-
function
|
|
700
|
+
function Me(e, t, n) {
|
|
696
701
|
if (!n) return t - e;
|
|
697
702
|
let r = 0;
|
|
698
703
|
for (let i = e; i < t; i++) r += n[i] ?? 1;
|
|
699
704
|
return r;
|
|
700
705
|
}
|
|
701
706
|
function I(e, t, n, r = 0) {
|
|
702
|
-
return t <= e ? 0 :
|
|
707
|
+
return t <= e ? 0 : Me(e, t, n) - Math.min(r, Ne(t - 1, n));
|
|
703
708
|
}
|
|
704
|
-
function
|
|
709
|
+
function Ne(e, t) {
|
|
705
710
|
return t ? (t[e] ?? 1) - 1 : 0;
|
|
706
711
|
}
|
|
707
|
-
function
|
|
712
|
+
function Pe(e, t = {}) {
|
|
708
713
|
let { advances: n, tracking: r = 0 } = t, i = 0;
|
|
709
|
-
for (let t of
|
|
714
|
+
for (let t of Re(e, 0, e.length)) for (let a of Ie(e, t.start, t.end)) i = Math.max(i, I(a.start, a.end, n, r));
|
|
710
715
|
return i;
|
|
711
716
|
}
|
|
712
|
-
function
|
|
717
|
+
function Fe(e, t) {
|
|
713
718
|
let n = 0;
|
|
714
719
|
for (let r = 0; r < e.length; r++) e[r] === "" && (t(r, n), n++);
|
|
715
720
|
}
|
|
716
|
-
function
|
|
721
|
+
function Ie(e, t, n) {
|
|
717
722
|
let r = [], i = t;
|
|
718
723
|
for (let a = t; a < n; a++) {
|
|
719
724
|
if (e[a] === "") {
|
|
@@ -740,14 +745,14 @@ function Fe(e, t, n) {
|
|
|
740
745
|
end: n
|
|
741
746
|
}), r;
|
|
742
747
|
}
|
|
743
|
-
var
|
|
744
|
-
function
|
|
748
|
+
var Le = /[ \t\r\n\f]/;
|
|
749
|
+
function Re(e, t, n) {
|
|
745
750
|
let r = [], i = t;
|
|
746
751
|
for (; i < n;) {
|
|
747
|
-
for (; i < n &&
|
|
752
|
+
for (; i < n && Le.test(e[i]);) i++;
|
|
748
753
|
if (i >= n) break;
|
|
749
754
|
let t = i;
|
|
750
|
-
for (; i < n && !
|
|
755
|
+
for (; i < n && !Le.test(e[i]);) i++;
|
|
751
756
|
r.push({
|
|
752
757
|
start: t,
|
|
753
758
|
end: i
|
|
@@ -755,8 +760,8 @@ function Le(e, t, n) {
|
|
|
755
760
|
}
|
|
756
761
|
return r;
|
|
757
762
|
}
|
|
758
|
-
function
|
|
759
|
-
let s =
|
|
763
|
+
function ze(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
764
|
+
let s = Re(e, t, n);
|
|
760
765
|
if (s.length === 0) return [{
|
|
761
766
|
start: t,
|
|
762
767
|
end: t
|
|
@@ -768,8 +773,8 @@ function Re(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
768
773
|
let c = [], l = null, u = 0, d = Math.max(0, o), f = () => r - d;
|
|
769
774
|
for (let t of s) {
|
|
770
775
|
let n = !1;
|
|
771
|
-
for (let r of
|
|
772
|
-
let e = r.start, t = r.end, o = l !== null && !n ? e - 1 : e, s = u +
|
|
776
|
+
for (let r of Ie(e, t.start, t.end)) {
|
|
777
|
+
let e = r.start, t = r.end, o = l !== null && !n ? e - 1 : e, s = u + Me(o, t, i), p = Math.min(a, Ne(t - 1, i));
|
|
773
778
|
if (l !== null && s - p <= f()) l.end = t, u = s;
|
|
774
779
|
else {
|
|
775
780
|
for (l !== null && (c.push(l), d = 0);;) {
|
|
@@ -784,7 +789,7 @@ function Re(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
784
789
|
l = {
|
|
785
790
|
start: e,
|
|
786
791
|
end: t
|
|
787
|
-
}, u =
|
|
792
|
+
}, u = Me(e, t, i);
|
|
788
793
|
}
|
|
789
794
|
n = !0;
|
|
790
795
|
}
|
|
@@ -793,7 +798,7 @@ function Re(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
793
798
|
}
|
|
794
799
|
//#endregion
|
|
795
800
|
//#region src/flex.ts
|
|
796
|
-
function
|
|
801
|
+
function Be(e, t) {
|
|
797
802
|
let n = e.row.map((e) => e.node.localRect).sort((e, t) => e.x - t.x), r = [];
|
|
798
803
|
for (let e = 1; e < n.length; e++) {
|
|
799
804
|
let i = n[e - 1].x + n[e - 1].width - t, a = n[e].x - t;
|
|
@@ -804,12 +809,12 @@ function ze(e, t) {
|
|
|
804
809
|
}
|
|
805
810
|
return r;
|
|
806
811
|
}
|
|
807
|
-
function
|
|
812
|
+
function Ve(e, t, n, r, i) {
|
|
808
813
|
if (e.style.ruleBreak !== "intersection") return [{
|
|
809
814
|
start: 0,
|
|
810
815
|
end: i
|
|
811
816
|
}];
|
|
812
|
-
let a = [t[n - 1], t[n]].flatMap((e) =>
|
|
817
|
+
let a = [t[n - 1], t[n]].flatMap((e) => Be(e, r)).sort((e, t) => e.start - t.start), o = (e, t) => ({
|
|
813
818
|
start: e,
|
|
814
819
|
end: t,
|
|
815
820
|
spanned: !1,
|
|
@@ -817,39 +822,39 @@ function Be(e, t, n, r, i) {
|
|
|
817
822
|
afterOccupied: !0
|
|
818
823
|
}), s = [], c = 0;
|
|
819
824
|
for (let e of a) e.start > c && s.push(o(c, e.start)), c = Math.max(c, e.end);
|
|
820
|
-
return c < i && s.push(o(c, i)),
|
|
825
|
+
return c < i && s.push(o(c, i)), ye(s, "intersection", "all", e.style.ruleInset === "overlap-join" ? "overlap-join" : 0);
|
|
821
826
|
}
|
|
822
|
-
function
|
|
827
|
+
function He(e, t) {
|
|
823
828
|
return typeof t != "number" || t <= 0 ? e : e.map((e) => ({
|
|
824
829
|
...e,
|
|
825
830
|
start: e.start + t,
|
|
826
831
|
end: e.end - t
|
|
827
832
|
})).filter((e) => e.end > e.start);
|
|
828
833
|
}
|
|
829
|
-
function
|
|
830
|
-
let s =
|
|
831
|
-
let n =
|
|
834
|
+
function Ue(e, t, n, r, i, a, o) {
|
|
835
|
+
let s = H(e.style, "x", t), c = H(e.style, "y", n), l = Qe(e).map((e) => {
|
|
836
|
+
let n = W(e.style.margin, t);
|
|
832
837
|
return {
|
|
833
838
|
node: e,
|
|
834
|
-
base:
|
|
839
|
+
base: Ze(e, t, o),
|
|
835
840
|
grow: e.style.flexGrow,
|
|
836
841
|
shrink: e.style.flexShrink,
|
|
837
|
-
min:
|
|
838
|
-
max:
|
|
842
|
+
min: tt(e, t, o),
|
|
843
|
+
max: G(e.style.maxWidth, t),
|
|
839
844
|
margin: n
|
|
840
845
|
};
|
|
841
846
|
}), u = [];
|
|
842
847
|
if (e.style.flexWrap === "wrap") {
|
|
843
848
|
let n = [], r = 0;
|
|
844
849
|
for (let e of l) {
|
|
845
|
-
let i = Math.max(0,
|
|
850
|
+
let i = Math.max(0, V(e.base, e.min, e.max)) + (e.margin.left ?? 0) + (e.margin.right ?? 0), a = n.length === 0 ? i : r + s + i;
|
|
846
851
|
n.length > 0 && a > t && (u.push(n), n = [], r = 0), n.push(e), r = n.length === 1 ? i : r + s + i;
|
|
847
852
|
}
|
|
848
853
|
n.length > 0 && u.push(n), e.style.wrapReverse && u.reverse();
|
|
849
854
|
} else u.push(l);
|
|
850
855
|
let d = i.left + a.left, f = i.top + a.top, p = u.map((e) => {
|
|
851
|
-
let n = s * Math.max(0, e.length - 1), i = e.reduce((e, t) => e + (t.margin.left ?? 0) + (t.margin.right ?? 0), 0), a = Math.max(0, t - n - i), c = e.some((e) => e.margin.left === null || e.margin.right === null), l = e.reduce((e, t) => e + t.base, 0), u = c && l <= a ? e.map((e) => Math.max(0,
|
|
852
|
-
for (let n = 0; n < e.length; n++)
|
|
856
|
+
let n = s * Math.max(0, e.length - 1), i = e.reduce((e, t) => e + (t.margin.left ?? 0) + (t.margin.right ?? 0), 0), a = Math.max(0, t - n - i), c = e.some((e) => e.margin.left === null || e.margin.right === null), l = e.reduce((e, t) => e + t.base, 0), u = c && l <= a ? e.map((e) => Math.max(0, V(e.base, e.min, e.max))) : Je(e, a);
|
|
857
|
+
for (let n = 0; n < e.length; n++) B(e[n].node, t, r, 0, 0, "fill", o, { width: u[n] });
|
|
853
858
|
return {
|
|
854
859
|
row: e,
|
|
855
860
|
widths: u,
|
|
@@ -859,7 +864,7 @@ function He(e, t, n, r, i, a, o) {
|
|
|
859
864
|
}), m = p.map((e) => e.height), h = c * Math.max(0, p.length - 1), g;
|
|
860
865
|
if (e.style.flexWrap === "nowrap") r === void 0 ? Number.isFinite(n) && (m[0] = Math.max(n, m[0] ?? 0)) : m[0] = r, g = [0];
|
|
861
866
|
else {
|
|
862
|
-
let t = m.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - h) : 0, i =
|
|
867
|
+
let t = m.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - h) : 0, i = $e(e.style);
|
|
863
868
|
if (i === "stretch" && r > 0) {
|
|
864
869
|
let e = R(Array.from({ length: p.length }, () => 1), r);
|
|
865
870
|
for (let t = 0; t < m.length; t++) m[t] += e[t];
|
|
@@ -869,11 +874,11 @@ function He(e, t, n, r, i, a, o) {
|
|
|
869
874
|
for (let i = 0; i < p.length; i++) {
|
|
870
875
|
let { row: a, widths: l, availableForItems: u } = p[i], h = m[i], _ = g[i] + i * c;
|
|
871
876
|
for (let i = 0; i < a.length; i++) {
|
|
872
|
-
let s = a[i].node, c =
|
|
877
|
+
let s = a[i].node, c = Ye(s, e), u = a[i].margin, d = u.top === null || u.bottom === null, f = s.style.height !== void 0 && s.style.height.kind !== "auto";
|
|
873
878
|
if (c === "stretch" && !d && !f && h !== s.localRect.height) {
|
|
874
|
-
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, d =
|
|
879
|
+
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, d = V(Math.max(0, h - e - a), G(s.style.minHeight, c) ?? 0, G(s.style.maxHeight, c));
|
|
875
880
|
if (d === s.localRect.height) continue;
|
|
876
|
-
|
|
881
|
+
B(s, t, r, 0, 0, "fill", o, {
|
|
877
882
|
width: l[i],
|
|
878
883
|
height: d
|
|
879
884
|
});
|
|
@@ -884,14 +889,14 @@ function He(e, t, n, r, i, a, o) {
|
|
|
884
889
|
let e = R(Array.from({ length: b }, () => 1), y), t = 0;
|
|
885
890
|
for (let n = 0; n < a.length; n++) a[n].margin.left === null && (x[n] = e[t++]), a[n].margin.right === null && (S[n] = e[t++]);
|
|
886
891
|
C = L("start", l, 0);
|
|
887
|
-
} else C = L(
|
|
892
|
+
} else C = L(et(e.style), l, y);
|
|
888
893
|
let w = 0;
|
|
889
894
|
for (let t = 0; t < a.length; t++) {
|
|
890
895
|
let n = a[t], r = n.node, i = n.margin.left ?? 0, o = n.margin.right ?? 0;
|
|
891
896
|
w += x[t] + i, r.localRect = {
|
|
892
897
|
...r.localRect,
|
|
893
898
|
x: d + C[t] + t * s + w,
|
|
894
|
-
y: f + _ +
|
|
899
|
+
y: f + _ + Ke(r, e.style.alignItems, h, n.margin)
|
|
895
900
|
}, w += S[t] + o;
|
|
896
901
|
}
|
|
897
902
|
}
|
|
@@ -900,7 +905,7 @@ function He(e, t, n, r, i, a, o) {
|
|
|
900
905
|
let n = [], r = [];
|
|
901
906
|
for (let i = 0; i < p.length; i++) {
|
|
902
907
|
let a = g[i] + i * c;
|
|
903
|
-
for (let e of
|
|
908
|
+
for (let e of Be(p[i], d)) n.push({
|
|
904
909
|
bandStart: e.start,
|
|
905
910
|
bandSize: e.end - e.start,
|
|
906
911
|
start: a,
|
|
@@ -908,19 +913,19 @@ function He(e, t, n, r, i, a, o) {
|
|
|
908
913
|
});
|
|
909
914
|
if (i > 0) {
|
|
910
915
|
let n = g[i - 1] + (i - 1) * c + m[i - 1];
|
|
911
|
-
if (a > n) for (let o of
|
|
916
|
+
if (a > n) for (let o of Ve(e, p, i, d, t)) r.push({
|
|
912
917
|
bandStart: n,
|
|
913
918
|
bandSize: a - n,
|
|
914
919
|
...o
|
|
915
920
|
});
|
|
916
921
|
}
|
|
917
922
|
}
|
|
918
|
-
e.decorationRuns =
|
|
923
|
+
e.decorationRuns = be({
|
|
919
924
|
glyphs: S(e.style.glyphSet),
|
|
920
925
|
ruleX: e.style.ruleX,
|
|
921
926
|
ruleY: e.style.ruleY,
|
|
922
|
-
vertical:
|
|
923
|
-
horizontal:
|
|
927
|
+
vertical: He(n, e.style.ruleInset),
|
|
928
|
+
horizontal: He(r, e.style.ruleInset),
|
|
924
929
|
contentWidth: t,
|
|
925
930
|
contentHeight: v,
|
|
926
931
|
border: i,
|
|
@@ -929,10 +934,10 @@ function He(e, t, n, r, i, a, o) {
|
|
|
929
934
|
padding: a
|
|
930
935
|
});
|
|
931
936
|
}
|
|
932
|
-
return
|
|
937
|
+
return We(e, i, a, t, v), v;
|
|
933
938
|
}
|
|
934
|
-
function
|
|
935
|
-
for (let a of e.children)
|
|
939
|
+
function We(e, t, n, r, i) {
|
|
940
|
+
for (let a of e.children) z(a.style) && (a.staticSlot = {
|
|
936
941
|
kind: "flex",
|
|
937
942
|
direction: e.style.flexDirection,
|
|
938
943
|
originX: t.left + n.left,
|
|
@@ -941,37 +946,37 @@ function Ue(e, t, n, r, i) {
|
|
|
941
946
|
innerHeight: i
|
|
942
947
|
});
|
|
943
948
|
}
|
|
944
|
-
function
|
|
945
|
-
let s =
|
|
946
|
-
let a =
|
|
947
|
-
|
|
948
|
-
let l = Number.isFinite(n) ? n : void 0, u = i.style.flexBasis, d = u === void 0 || u.kind === "auto" ? i.unclampedHeight : u.kind === "cells" ? u.value : u.kind === "percent" && l !== void 0 ?
|
|
949
|
+
function Ge(e, t, n, r, i, a, o) {
|
|
950
|
+
let s = H(e.style, "y", n), c = Qe(e).map((i) => {
|
|
951
|
+
let a = W(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c = Ye(i, e) === "stretch";
|
|
952
|
+
B(i, s, r && Number.isFinite(n) ? n : void 0, 0, 0, c ? "fill" : "shrink", o);
|
|
953
|
+
let l = Number.isFinite(n) ? n : void 0, u = i.style.flexBasis, d = u === void 0 || u.kind === "auto" ? i.unclampedHeight : u.kind === "cells" ? u.value : u.kind === "percent" && l !== void 0 ? we(u.value, l) : i.unclampedHeight, f = i.style.minHeight === "auto" ? i.style.overflow.y === "visible" ? i.localRect.height : 0 : void 0;
|
|
949
954
|
return {
|
|
950
955
|
node: i,
|
|
951
956
|
base: d,
|
|
952
957
|
grow: i.style.flexGrow,
|
|
953
958
|
shrink: i.style.flexShrink,
|
|
954
|
-
min: f ??
|
|
955
|
-
max:
|
|
959
|
+
min: f ?? G(i.style.minHeight, l) ?? 0,
|
|
960
|
+
max: G(i.style.maxHeight, l),
|
|
956
961
|
margin: a
|
|
957
962
|
};
|
|
958
|
-
}), l = s * Math.max(0, c.length - 1), u = c.reduce((e, t) => e + (t.margin.top ?? 0) + (t.margin.bottom ?? 0), 0), d = Number.isFinite(n), f = c.reduce((e, t) => e + t.base, 0), p = d ? Math.max(0, n - l - u) : f, m = r ? p : Math.max(p, f), h = c.some((e) => e.margin.top === null || e.margin.bottom === null), g = d && !(d && h && f <= m) ?
|
|
963
|
+
}), l = s * Math.max(0, c.length - 1), u = c.reduce((e, t) => e + (t.margin.top ?? 0) + (t.margin.bottom ?? 0), 0), d = Number.isFinite(n), f = c.reduce((e, t) => e + t.base, 0), p = d ? Math.max(0, n - l - u) : f, m = r ? p : Math.max(p, f), h = c.some((e) => e.margin.top === null || e.margin.bottom === null), g = d && !(d && h && f <= m) ? Je(c, m) : c.map((e) => Math.max(0, V(e.base, e.min, e.max)));
|
|
959
964
|
for (let n = 0; n < c.length; n++) if (g[n] !== c[n].node.localRect.height) {
|
|
960
|
-
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a =
|
|
961
|
-
|
|
965
|
+
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a = Ye(r.node, e) === "stretch";
|
|
966
|
+
B(r.node, i, g[n], 0, 0, a ? "fill" : "shrink", o, { height: g[n] });
|
|
962
967
|
}
|
|
963
968
|
let _ = g.reduce((e, t) => e + t, 0), v = Math.max(0, m - _), y = c.reduce((e, t) => e + +(t.margin.top === null) + +(t.margin.bottom === null), 0), b = Array.from({ length: c.length }, () => 0), x = Array.from({ length: c.length }, () => 0), C;
|
|
964
969
|
if (y > 0 && v > 0) {
|
|
965
970
|
let e = R(Array.from({ length: y }, () => 1), v), t = 0;
|
|
966
971
|
for (let n = 0; n < c.length; n++) c[n].margin.top === null && (b[n] = e[t++]), c[n].margin.bottom === null && (x[n] = e[t++]);
|
|
967
972
|
C = L("start", g, 0);
|
|
968
|
-
} else C = L(
|
|
973
|
+
} else C = L(et(e.style), g, v);
|
|
969
974
|
let w = i.left + a.left, T = i.top + a.top, E = 0;
|
|
970
975
|
for (let n = 0; n < c.length; n++) {
|
|
971
976
|
let r = c[n], i = r.node, a = r.margin.top ?? 0, o = r.margin.bottom ?? 0;
|
|
972
977
|
E += b[n] + a, i.localRect = {
|
|
973
978
|
...i.localRect,
|
|
974
|
-
x: w +
|
|
979
|
+
x: w + qe(i, e.style.alignItems, t, r.margin),
|
|
975
980
|
y: T + C[n] + n * s + E
|
|
976
981
|
}, E += x[n] + o;
|
|
977
982
|
}
|
|
@@ -987,12 +992,12 @@ function We(e, t, n, r, i, a, o) {
|
|
|
987
992
|
end: t
|
|
988
993
|
});
|
|
989
994
|
}
|
|
990
|
-
e.decorationRuns =
|
|
995
|
+
e.decorationRuns = be({
|
|
991
996
|
glyphs: S(e.style.glyphSet),
|
|
992
997
|
ruleX: null,
|
|
993
998
|
ruleY: e.style.ruleY,
|
|
994
999
|
vertical: [],
|
|
995
|
-
horizontal:
|
|
1000
|
+
horizontal: He(n, e.style.ruleInset),
|
|
996
1001
|
contentWidth: t,
|
|
997
1002
|
contentHeight: O,
|
|
998
1003
|
border: i,
|
|
@@ -1001,15 +1006,15 @@ function We(e, t, n, r, i, a, o) {
|
|
|
1001
1006
|
padding: a
|
|
1002
1007
|
});
|
|
1003
1008
|
}
|
|
1004
|
-
return
|
|
1009
|
+
return We(e, i, a, t, O), O;
|
|
1005
1010
|
}
|
|
1006
|
-
function
|
|
1011
|
+
function Ke(e, t, n, r) {
|
|
1007
1012
|
let i = e.style.alignSelf === "auto" ? t : e.style.alignSelf, a = r.top ?? 0, o = r.bottom ?? 0, s = n - e.localRect.height, c = r.top === null && r.bottom === null, l = r.top === null && r.bottom !== null, u = r.bottom === null && r.top !== null;
|
|
1008
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
1013
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + Xe(i, n, e.localRect.height);
|
|
1009
1014
|
}
|
|
1010
|
-
function
|
|
1015
|
+
function qe(e, t, n, r) {
|
|
1011
1016
|
let i = e.style.alignSelf === "auto" ? t : e.style.alignSelf, a = r.left ?? 0, o = r.right ?? 0, s = n - e.localRect.width, c = r.left === null && r.right === null, l = r.left === null && r.right !== null, u = r.right === null && r.left !== null;
|
|
1012
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
1017
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + Xe(i, n, e.localRect.width);
|
|
1013
1018
|
}
|
|
1014
1019
|
function L(e, t, n) {
|
|
1015
1020
|
let r = t.length;
|
|
@@ -1029,8 +1034,8 @@ function L(e, t, n) {
|
|
|
1029
1034
|
for (let e = 0; e < r; e++) i.push(a), a += t[e];
|
|
1030
1035
|
return i;
|
|
1031
1036
|
}
|
|
1032
|
-
function
|
|
1033
|
-
let n = e.length, r = (t, n) => Math.max(0,
|
|
1037
|
+
function Je(e, t) {
|
|
1038
|
+
let n = e.length, r = (t, n) => Math.max(0, V(t, e[n].min ?? 0, e[n].max)), i = e.map((e) => e.base), a = t >= i.reduce((e, t, n) => e + r(t, n), 0), o = Array.from({ length: n }, () => 0), s = Array.from({ length: n }, () => !1);
|
|
1034
1039
|
for (let t = 0; t < n; t++) {
|
|
1035
1040
|
let n = r(i[t], t);
|
|
1036
1041
|
((a ? e[t].grow : e[t].shrink) === 0 || a && i[t] > n || !a && i[t] < n) && (o[t] = n, s[t] = !0);
|
|
@@ -1064,45 +1069,53 @@ function R(e, t) {
|
|
|
1064
1069
|
}
|
|
1065
1070
|
return i;
|
|
1066
1071
|
}
|
|
1067
|
-
function
|
|
1072
|
+
function Ye(e, t) {
|
|
1068
1073
|
return e.style.alignSelf === "auto" ? t.style.alignItems : e.style.alignSelf;
|
|
1069
1074
|
}
|
|
1070
|
-
function
|
|
1075
|
+
function Xe(e, t, n) {
|
|
1071
1076
|
return e === "center" ? Math.max(0, Math.floor((t - n) / 2)) : e === "end" ? Math.max(0, t - n) : 0;
|
|
1072
1077
|
}
|
|
1073
|
-
function
|
|
1078
|
+
function Ze(e, t, n) {
|
|
1074
1079
|
let r = e.style.flexBasis, i = e.style.width;
|
|
1075
|
-
return r !== void 0 && r.kind !== "auto" ?
|
|
1080
|
+
return r !== void 0 && r.kind !== "auto" ? K(r, t, e, n) : i !== void 0 && i.kind !== "auto" ? K(i, t, e, n) : q(e, n);
|
|
1076
1081
|
}
|
|
1077
|
-
function
|
|
1078
|
-
let t = e.children.filter((e) => !
|
|
1082
|
+
function Qe(e) {
|
|
1083
|
+
let t = e.children.filter((e) => !z(e.style)).sort((e, t) => e.style.order - t.style.order);
|
|
1079
1084
|
return e.style.flexReverse && t.reverse(), t;
|
|
1080
1085
|
}
|
|
1081
|
-
function
|
|
1086
|
+
function $e(e) {
|
|
1082
1087
|
return e.wrapReverse ? e.alignContent === "start" ? "end" : e.alignContent === "end" ? "start" : e.alignContent : e.alignContent;
|
|
1083
1088
|
}
|
|
1084
|
-
function
|
|
1089
|
+
function et(e) {
|
|
1085
1090
|
let t = e.justifyContent === "stretch" ? "start" : e.justifyContent;
|
|
1086
1091
|
return e.flexReverse ? t === "start" ? "end" : t === "end" ? "start" : t : t;
|
|
1087
1092
|
}
|
|
1088
|
-
function
|
|
1089
|
-
return e.style.minWidth === "auto" ? e.style.overflow.x === "visible" ? Y(e, n) : 0 :
|
|
1093
|
+
function tt(e, t, n) {
|
|
1094
|
+
return e.style.minWidth === "auto" ? e.style.overflow.x === "visible" ? Y(e, n) : 0 : G(e.style.minWidth, t) ?? 0;
|
|
1090
1095
|
}
|
|
1091
1096
|
//#endregion
|
|
1092
1097
|
//#region src/types.ts
|
|
1093
|
-
function
|
|
1098
|
+
function nt(e) {
|
|
1094
1099
|
return e === "auto" || e === "scroll";
|
|
1095
1100
|
}
|
|
1096
|
-
function
|
|
1097
|
-
return
|
|
1101
|
+
function rt(e) {
|
|
1102
|
+
return {
|
|
1103
|
+
right: e.scrollbarSize.y + e.scrollbarInset.x,
|
|
1104
|
+
bottom: e.scrollbarSize.x + e.scrollbarInset.y
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
function it(e) {
|
|
1108
|
+
if (e.scrollbarWidth === "none") return {
|
|
1098
1109
|
right: 0,
|
|
1099
1110
|
bottom: 0
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
|
|
1111
|
+
};
|
|
1112
|
+
let t = rt(e);
|
|
1113
|
+
return {
|
|
1114
|
+
right: e.overflow.y === "scroll" ? t.right : 0,
|
|
1115
|
+
bottom: e.overflow.x === "scroll" ? t.bottom : 0
|
|
1103
1116
|
};
|
|
1104
1117
|
}
|
|
1105
|
-
function
|
|
1118
|
+
function at() {
|
|
1106
1119
|
return {
|
|
1107
1120
|
display: "block",
|
|
1108
1121
|
flexDirection: "row",
|
|
@@ -1121,8 +1134,8 @@ function nt() {
|
|
|
1121
1134
|
justifySelf: "auto",
|
|
1122
1135
|
gridTemplateColumns: { kind: "none" },
|
|
1123
1136
|
gridTemplateRows: { kind: "none" },
|
|
1124
|
-
gridAutoColumns: [
|
|
1125
|
-
gridAutoRows: [
|
|
1137
|
+
gridAutoColumns: [st()],
|
|
1138
|
+
gridAutoRows: [st()],
|
|
1126
1139
|
gridAutoFlow: {
|
|
1127
1140
|
direction: "row",
|
|
1128
1141
|
dense: !1
|
|
@@ -1138,7 +1151,7 @@ function nt() {
|
|
|
1138
1151
|
minHeight: "auto",
|
|
1139
1152
|
maxWidth: void 0,
|
|
1140
1153
|
maxHeight: void 0,
|
|
1141
|
-
padding:
|
|
1154
|
+
padding: ot(),
|
|
1142
1155
|
margin: {
|
|
1143
1156
|
top: 0,
|
|
1144
1157
|
right: 0,
|
|
@@ -1154,7 +1167,7 @@ function nt() {
|
|
|
1154
1167
|
},
|
|
1155
1168
|
gapX: 0,
|
|
1156
1169
|
gapY: 0,
|
|
1157
|
-
border:
|
|
1170
|
+
border: ot(),
|
|
1158
1171
|
borderStyle: {
|
|
1159
1172
|
top: "solid",
|
|
1160
1173
|
right: "solid",
|
|
@@ -1170,6 +1183,10 @@ function nt() {
|
|
|
1170
1183
|
x: 1,
|
|
1171
1184
|
y: 1
|
|
1172
1185
|
},
|
|
1186
|
+
scrollbarInset: {
|
|
1187
|
+
x: 0,
|
|
1188
|
+
y: 0
|
|
1189
|
+
},
|
|
1173
1190
|
overscroll: {
|
|
1174
1191
|
x: !0,
|
|
1175
1192
|
y: !0
|
|
@@ -1220,7 +1237,7 @@ function nt() {
|
|
|
1220
1237
|
breakInsideAvoid: !1
|
|
1221
1238
|
};
|
|
1222
1239
|
}
|
|
1223
|
-
function
|
|
1240
|
+
function ot() {
|
|
1224
1241
|
return {
|
|
1225
1242
|
top: 0,
|
|
1226
1243
|
right: 0,
|
|
@@ -1228,7 +1245,7 @@ function rt() {
|
|
|
1228
1245
|
left: 0
|
|
1229
1246
|
};
|
|
1230
1247
|
}
|
|
1231
|
-
function
|
|
1248
|
+
function st() {
|
|
1232
1249
|
return {
|
|
1233
1250
|
min: { kind: "auto" },
|
|
1234
1251
|
max: { kind: "auto" }
|
|
@@ -1236,15 +1253,15 @@ function it() {
|
|
|
1236
1253
|
}
|
|
1237
1254
|
//#endregion
|
|
1238
1255
|
//#region src/grid.ts
|
|
1239
|
-
function
|
|
1240
|
-
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, u = c ? c.gap :
|
|
1256
|
+
function ct(e, t, n, r, i, a) {
|
|
1257
|
+
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, u = c ? c.gap : H(o, "x", t), d = l ? l.gap : H(o, "y", s), f = vt(e, t, s, u, d, e.subgrid ? {
|
|
1241
1258
|
col: e.subgrid.colSpan,
|
|
1242
1259
|
row: e.subgrid.rowSpan
|
|
1243
|
-
} : void 0), { children: p, placed: m, colLines: h, rowLines: g, colTracks: _, rowTracks: v, colCollapsed: y, rowCollapsed: b } = f, x = p.map((e) =>
|
|
1260
|
+
} : void 0), { children: p, placed: m, colLines: h, rowLines: g, colTracks: _, rowTracks: v, colCollapsed: y, rowCollapsed: b } = f, x = p.map((e) => W(e.style.margin, t)), C = p.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), w = p.map(lt), T = c ? dt(c) : Nt(_, y, ft(f, w, x, a), t, u, o.justifyContent === "stretch"), E = c ? c.positions : Pt(T, t, o.justifyContent), D = [];
|
|
1244
1261
|
for (let e = 0; e < p.length; e++) {
|
|
1245
|
-
let t = p[e], n = m.items[e], r =
|
|
1262
|
+
let t = p[e], n = m.items[e], r = It(E, T.sizes, n.col.start, n.col.span), i = x[e], o = Math.max(0, r - St(i)), s = w[e];
|
|
1246
1263
|
if (s.cols || s.rows) {
|
|
1247
|
-
let e = s.cols ?
|
|
1264
|
+
let e = s.cols ? ut(E, T, u, n.col.start, n.col.span, mt(t, "cols", i, r)) : void 0;
|
|
1248
1265
|
t.subgrid = {
|
|
1249
1266
|
colSpan: n.col.span,
|
|
1250
1267
|
rowSpan: n.row.span,
|
|
@@ -1253,26 +1270,26 @@ function at(e, t, n, r, i, a) {
|
|
|
1253
1270
|
};
|
|
1254
1271
|
} else t.subgrid = void 0;
|
|
1255
1272
|
let c = C[e], l = i.left === null || i.right === null, d = t.style.width !== void 0 && t.style.width.kind !== "auto";
|
|
1256
|
-
s.cols ?
|
|
1273
|
+
s.cols ? B(t, r, void 0, 0, 0, "fill", a, { width: o }) : c === "stretch" && !l && !d ? B(t, r, void 0, 0, 0, "fill", a, { width: V(o, t.style.minWidth === "auto" ? t.style.overflow.x === "visible" ? Y(t, a) : 0 : G(t.style.minWidth, r) ?? 0, Kn(t.style.maxWidth, r, t, a)) }) : B(t, o, void 0, 0, 0, "shrink", a), D.push(t.localRect.width);
|
|
1257
1274
|
}
|
|
1258
|
-
let O = l ?
|
|
1275
|
+
let O = l ? dt(l) : Nt(v, b, pt(f, w, x), s ?? "max-content", d, o.alignContent === "stretch"), k = Ft(O), A = l ? l.positions : Pt(O, s ?? k, o.alignContent), j = r.left + i.left, M = r.top + i.top;
|
|
1259
1276
|
for (let t = 0; t < p.length; t++) {
|
|
1260
|
-
let n = p[t], r = m.items[t], i = x[t], o =
|
|
1261
|
-
if (w[t].rows) n.subgrid.rows =
|
|
1277
|
+
let n = p[t], r = m.items[t], i = x[t], o = It(E, T.sizes, r.col.start, r.col.span), s = It(A, O.sizes, r.row.start, r.row.span), c = Math.max(0, s - Ct(i)), l = Ye(n, e), u = i.top === null || i.bottom === null, f = n.style.height !== void 0 && n.style.height.kind !== "auto";
|
|
1278
|
+
if (w[t].rows) n.subgrid.rows = ut(A, O, d, r.row.start, r.row.span, mt(n, "rows", i, o)), B(n, o, s, 0, 0, "fill", a, {
|
|
1262
1279
|
width: D[t],
|
|
1263
1280
|
height: c
|
|
1264
1281
|
});
|
|
1265
1282
|
else if (l === "stretch" && !u && !f) {
|
|
1266
|
-
let e =
|
|
1267
|
-
e !== n.localRect.height &&
|
|
1283
|
+
let e = V(c, n.style.minHeight === "auto" ? n.style.overflow.y === "visible" ? n.localRect.height : 0 : G(n.style.minHeight, s) ?? 0, G(n.style.maxHeight, s));
|
|
1284
|
+
e !== n.localRect.height && B(n, o, s, 0, 0, "fill", a, {
|
|
1268
1285
|
width: D[t],
|
|
1269
1286
|
height: e
|
|
1270
1287
|
});
|
|
1271
|
-
} else n.style.height?.kind === "percent" &&
|
|
1288
|
+
} else n.style.height?.kind === "percent" && B(n, o, s, 0, 0, "fill", a, { width: D[t] });
|
|
1272
1289
|
n.localRect = {
|
|
1273
1290
|
...n.localRect,
|
|
1274
|
-
x: j + E[r.col.start] +
|
|
1275
|
-
y: M + A[r.row.start] +
|
|
1291
|
+
x: j + E[r.col.start] + Lt(C[t], i.left, i.right, o, n.localRect.width),
|
|
1292
|
+
y: M + A[r.row.start] + Lt(l, i.top, i.bottom, s, n.localRect.height)
|
|
1276
1293
|
};
|
|
1277
1294
|
}
|
|
1278
1295
|
let N = Number.isFinite(n) ? Math.max(n, k) : k;
|
|
@@ -1289,7 +1306,7 @@ function at(e, t, n, r, i, a) {
|
|
|
1289
1306
|
let r = [];
|
|
1290
1307
|
for (let i = 1; i < e.length; i++) {
|
|
1291
1308
|
let a = e[i - 1] + t[i - 1], s = e[i] - a;
|
|
1292
|
-
if (!(s <= 0)) for (let e of
|
|
1309
|
+
if (!(s <= 0)) for (let e of ye(n(i - 1), o.ruleBreak, o.ruleVisibilityItems, o.ruleInset)) r.push({
|
|
1293
1310
|
bandStart: a,
|
|
1294
1311
|
bandSize: s,
|
|
1295
1312
|
...e
|
|
@@ -1297,7 +1314,7 @@ function at(e, t, n, r, i, a) {
|
|
|
1297
1314
|
}
|
|
1298
1315
|
return r;
|
|
1299
1316
|
}, f = d(E, T.sizes, (e) => u(e, A, O.sizes, c, (t) => s[e]?.[t] ?? !1, (t) => s[e + 1]?.[t] ?? !1)), p = d(A, O.sizes, (e) => u(e, E, T.sizes, l, (t) => s[t]?.[e] ?? !1, (t) => s[t]?.[e + 1] ?? !1));
|
|
1300
|
-
e.decorationRuns =
|
|
1317
|
+
e.decorationRuns = be({
|
|
1301
1318
|
glyphs: S(o.glyphSet),
|
|
1302
1319
|
ruleX: o.ruleX,
|
|
1303
1320
|
ruleY: o.ruleY,
|
|
@@ -1311,9 +1328,9 @@ function at(e, t, n, r, i, a) {
|
|
|
1311
1328
|
padding: i
|
|
1312
1329
|
});
|
|
1313
1330
|
}
|
|
1314
|
-
let ee = e.children.filter((e) =>
|
|
1331
|
+
let ee = e.children.filter((e) => z(e.style));
|
|
1315
1332
|
if (ee.length > 0) {
|
|
1316
|
-
let e =
|
|
1333
|
+
let e = z(o) ? {
|
|
1317
1334
|
x: r.left,
|
|
1318
1335
|
y: r.top,
|
|
1319
1336
|
width: i.left + t + i.right,
|
|
@@ -1325,7 +1342,7 @@ function at(e, t, n, r, i, a) {
|
|
|
1325
1342
|
height: N
|
|
1326
1343
|
};
|
|
1327
1344
|
for (let n of ee) {
|
|
1328
|
-
let r =
|
|
1345
|
+
let r = gt(n.style.gridColumnStart, n.style.gridColumnEnd, h, m.colOrigin, E, T.sizes, -i.left, t + i.right), a = gt(n.style.gridRowStart, n.style.gridRowEnd, g, m.rowOrigin, A, O.sizes, -i.top, N + i.bottom);
|
|
1329
1346
|
n.staticSlot = {
|
|
1330
1347
|
kind: "grid",
|
|
1331
1348
|
area: {
|
|
@@ -1340,14 +1357,14 @@ function at(e, t, n, r, i, a) {
|
|
|
1340
1357
|
}
|
|
1341
1358
|
return N;
|
|
1342
1359
|
}
|
|
1343
|
-
function
|
|
1360
|
+
function lt(e) {
|
|
1344
1361
|
let t = e.style.display === "grid";
|
|
1345
1362
|
return {
|
|
1346
1363
|
cols: t && e.style.gridTemplateColumns.kind === "subgrid",
|
|
1347
1364
|
rows: t && e.style.gridTemplateRows.kind === "subgrid"
|
|
1348
1365
|
};
|
|
1349
1366
|
}
|
|
1350
|
-
function
|
|
1367
|
+
function ut(e, t, n, r, i, a) {
|
|
1351
1368
|
let o = e[r] + a.start, s = t.sizes.slice(r, r + i);
|
|
1352
1369
|
return s[0] = Math.max(0, s[0] - a.start), s[i - 1] = Math.max(0, s[i - 1] - a.end), {
|
|
1353
1370
|
positions: Array.from({ length: i }, (t, n) => n === 0 ? 0 : e[r + n] - o),
|
|
@@ -1356,20 +1373,20 @@ function st(e, t, n, r, i, a) {
|
|
|
1356
1373
|
gap: n
|
|
1357
1374
|
};
|
|
1358
1375
|
}
|
|
1359
|
-
function
|
|
1376
|
+
function dt(e) {
|
|
1360
1377
|
return {
|
|
1361
1378
|
sizes: e.sizes,
|
|
1362
1379
|
gapBefore: e.gapBefore,
|
|
1363
1380
|
limits: e.sizes
|
|
1364
1381
|
};
|
|
1365
1382
|
}
|
|
1366
|
-
function
|
|
1383
|
+
function ft(e, t, n, r) {
|
|
1367
1384
|
let i = [];
|
|
1368
1385
|
return e.children.forEach((a, o) => {
|
|
1369
1386
|
let s = e.placed.items[o], c = n[o];
|
|
1370
1387
|
if (t[o].cols) {
|
|
1371
|
-
let e =
|
|
1372
|
-
for (let t of
|
|
1388
|
+
let e = mt(a, "cols", c, 0);
|
|
1389
|
+
for (let t of ht(a, "cols", s, e, r)) i.push({
|
|
1373
1390
|
...t,
|
|
1374
1391
|
start: t.start + s.col.start
|
|
1375
1392
|
});
|
|
@@ -1378,24 +1395,24 @@ function lt(e, t, n, r) {
|
|
|
1378
1395
|
i.push({
|
|
1379
1396
|
start: s.col.start,
|
|
1380
1397
|
span: s.col.span,
|
|
1381
|
-
min:
|
|
1382
|
-
max:
|
|
1398
|
+
min: J(a, "min", r) + St(c),
|
|
1399
|
+
max: J(a, "max", r) + St(c)
|
|
1383
1400
|
});
|
|
1384
1401
|
}), i;
|
|
1385
1402
|
}
|
|
1386
|
-
function
|
|
1403
|
+
function pt(e, t, n) {
|
|
1387
1404
|
let r = [];
|
|
1388
1405
|
return e.children.forEach((i, a) => {
|
|
1389
1406
|
let o = e.placed.items[a], s = n[a];
|
|
1390
1407
|
if (t[a].rows) {
|
|
1391
|
-
let e =
|
|
1392
|
-
for (let t of
|
|
1408
|
+
let e = mt(i, "rows", s, 0);
|
|
1409
|
+
for (let t of ht(i, "rows", o, e)) r.push({
|
|
1393
1410
|
...t,
|
|
1394
1411
|
start: t.start + o.row.start
|
|
1395
1412
|
});
|
|
1396
1413
|
return;
|
|
1397
1414
|
}
|
|
1398
|
-
let c = i.localRect.height +
|
|
1415
|
+
let c = i.localRect.height + Ct(s), l = i.style.minHeight === "auto" && i.style.overflow.y !== "visible" ? Ct(s) : c;
|
|
1399
1416
|
r.push({
|
|
1400
1417
|
start: o.row.start,
|
|
1401
1418
|
span: o.row.span,
|
|
@@ -1404,25 +1421,25 @@ function ut(e, t, n) {
|
|
|
1404
1421
|
});
|
|
1405
1422
|
}), r;
|
|
1406
1423
|
}
|
|
1407
|
-
function
|
|
1424
|
+
function mt(e, t, n, r) {
|
|
1408
1425
|
let { border: i, padding: a } = e.style;
|
|
1409
1426
|
return t === "cols" ? {
|
|
1410
|
-
start: (n.left ?? 0) + i.left +
|
|
1411
|
-
end: (n.right ?? 0) + i.right +
|
|
1427
|
+
start: (n.left ?? 0) + i.left + U(a.left, r),
|
|
1428
|
+
end: (n.right ?? 0) + i.right + U(a.right, r)
|
|
1412
1429
|
} : {
|
|
1413
|
-
start: (n.top ?? 0) + i.top +
|
|
1414
|
-
end: (n.bottom ?? 0) + i.bottom +
|
|
1430
|
+
start: (n.top ?? 0) + i.top + U(a.top, r),
|
|
1431
|
+
end: (n.bottom ?? 0) + i.bottom + U(a.bottom, r)
|
|
1415
1432
|
};
|
|
1416
1433
|
}
|
|
1417
|
-
function
|
|
1418
|
-
let a = t === "cols" ? n.col.span : n.row.span, o =
|
|
1434
|
+
function ht(e, t, n, r, i) {
|
|
1435
|
+
let a = t === "cols" ? n.col.span : n.row.span, o = vt(e, void 0, void 0, 0, 0, {
|
|
1419
1436
|
col: n.col.span,
|
|
1420
1437
|
row: n.row.span
|
|
1421
1438
|
}), s = [];
|
|
1422
1439
|
if (o.children.forEach((e, n) => {
|
|
1423
|
-
let c = o.placed.items[n], l = t === "cols" ? c.col : c.row, u = l.start === 0, d = l.start + l.span === a, f = (u ? r.start : 0) + (d ? r.end : 0), p =
|
|
1424
|
-
if (
|
|
1425
|
-
let n =
|
|
1440
|
+
let c = o.placed.items[n], l = t === "cols" ? c.col : c.row, u = l.start === 0, d = l.start + l.span === a, f = (u ? r.start : 0) + (d ? r.end : 0), p = W(e.style.margin, 0);
|
|
1441
|
+
if (lt(e)[t]) {
|
|
1442
|
+
let n = mt(e, t, p, 0), a = ht(e, t, c, {
|
|
1426
1443
|
start: n.start + (u ? r.start : 0),
|
|
1427
1444
|
end: n.end + (d ? r.end : 0)
|
|
1428
1445
|
}, i);
|
|
@@ -1435,11 +1452,11 @@ function ft(e, t, n, r, i) {
|
|
|
1435
1452
|
if (t === "cols") s.push({
|
|
1436
1453
|
start: l.start,
|
|
1437
1454
|
span: l.span,
|
|
1438
|
-
min:
|
|
1439
|
-
max:
|
|
1455
|
+
min: J(e, "min", i) + St(p) + f,
|
|
1456
|
+
max: J(e, "max", i) + St(p) + f
|
|
1440
1457
|
});
|
|
1441
1458
|
else {
|
|
1442
|
-
let t = e.localRect.height +
|
|
1459
|
+
let t = e.localRect.height + Ct(p) + f;
|
|
1443
1460
|
s.push({
|
|
1444
1461
|
start: l.start,
|
|
1445
1462
|
span: l.span,
|
|
@@ -1458,9 +1475,9 @@ function ft(e, t, n, r, i) {
|
|
|
1458
1475
|
}
|
|
1459
1476
|
return s;
|
|
1460
1477
|
}
|
|
1461
|
-
function
|
|
1462
|
-
let c =
|
|
1463
|
-
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l =
|
|
1478
|
+
function gt(e, t, n, r, i, a, o, s) {
|
|
1479
|
+
let c = kt(e, "start", n), l = kt(t, "end", n);
|
|
1480
|
+
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l = At(c, t, 1, n) : l !== null && e.kind === "span" && (c = At(l, e, -1, n));
|
|
1464
1481
|
let u = i.length, d = (e) => {
|
|
1465
1482
|
if (e === null) return;
|
|
1466
1483
|
let t = e - r;
|
|
@@ -1471,22 +1488,22 @@ function pt(e, t, n, r, i, a, o, s) {
|
|
|
1471
1488
|
end: h === void 0 ? s : p(h)
|
|
1472
1489
|
};
|
|
1473
1490
|
}
|
|
1474
|
-
function
|
|
1491
|
+
function _t(e, t) {
|
|
1475
1492
|
let n = t.gridIntrinsic.get(e);
|
|
1476
1493
|
if (n !== void 0) return n;
|
|
1477
|
-
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a =
|
|
1494
|
+
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a = vt(e, void 0, void 0, i, 0, e.subgrid ? {
|
|
1478
1495
|
col: e.subgrid.colSpan,
|
|
1479
1496
|
row: e.subgrid.rowSpan
|
|
1480
|
-
} : void 0), o = a.children.map(
|
|
1497
|
+
} : void 0), o = a.children.map(lt), s = a.children.map((e) => W(e.style.margin, 0)), c = Nt(a.colTracks, a.colCollapsed, ft(a, o, s, t), "min-content", i, !1), l = c.gapBefore.reduce((e, t) => e + t, 0), u = {
|
|
1481
1498
|
min: c.sizes.reduce((e, t) => e + t, 0) + l,
|
|
1482
1499
|
max: c.limits.reduce((e, t) => e + t, 0) + l
|
|
1483
1500
|
};
|
|
1484
1501
|
return t.gridIntrinsic.set(e, u), u;
|
|
1485
1502
|
}
|
|
1486
|
-
function
|
|
1487
|
-
let o = e.style, s =
|
|
1503
|
+
function vt(e, t, n, r, i, a) {
|
|
1504
|
+
let o = e.style, s = xt(e), c = o.gridTemplateColumns.kind === "subgrid" && a !== void 0, l = o.gridTemplateRows.kind === "subgrid" && a !== void 0, u = c ? yt(a.col) : wt(o.gridTemplateColumns, t, r), d = l ? yt(a.row) : wt(o.gridTemplateRows, n, i), f = o.gridTemplateAreas, p = [...u.tracks], m = [...d.tracks];
|
|
1488
1505
|
if (f) {
|
|
1489
|
-
c ||
|
|
1506
|
+
c || Et(p, u.lineNames, f.columns, o.gridAutoColumns), l || Et(m, d.lineNames, f.rows, o.gridAutoRows);
|
|
1490
1507
|
for (let [e, t] of f.areas) u.lineNames[Math.min(t.colStart, p.length)].push(`${e}-start`), u.lineNames[Math.min(t.colEnd, p.length)].push(`${e}-end`), d.lineNames[Math.min(t.rowStart, m.length)].push(`${e}-start`), d.lineNames[Math.min(t.rowEnd, m.length)].push(`${e}-end`);
|
|
1491
1508
|
}
|
|
1492
1509
|
let h = {
|
|
@@ -1495,28 +1512,28 @@ function ht(e, t, n, r, i, a) {
|
|
|
1495
1512
|
}, g = {
|
|
1496
1513
|
explicitCount: m.length,
|
|
1497
1514
|
names: d.lineNames
|
|
1498
|
-
}, _ =
|
|
1499
|
-
col:
|
|
1500
|
-
row:
|
|
1515
|
+
}, _ = Mt(s.map((e) => ({
|
|
1516
|
+
col: jt(e.style.gridColumnStart, e.style.gridColumnEnd, h),
|
|
1517
|
+
row: jt(e.style.gridRowStart, e.style.gridRowEnd, g)
|
|
1501
1518
|
})), p.length, m.length, o.gridAutoFlow);
|
|
1502
|
-
return c &&
|
|
1519
|
+
return c && bt(_, "col", p.length), l && bt(_, "row", m.length), {
|
|
1503
1520
|
children: s,
|
|
1504
1521
|
placed: _,
|
|
1505
1522
|
colLines: h,
|
|
1506
1523
|
rowLines: g,
|
|
1507
|
-
colTracks:
|
|
1508
|
-
rowTracks:
|
|
1509
|
-
colCollapsed:
|
|
1510
|
-
rowCollapsed:
|
|
1524
|
+
colTracks: Dt(p, _.colOrigin, _.colCount, o.gridAutoColumns),
|
|
1525
|
+
rowTracks: Dt(m, _.rowOrigin, _.rowCount, o.gridAutoRows),
|
|
1526
|
+
colCollapsed: Ot(u, _.colOrigin, _.colCount, _.items.map((e) => e.col)),
|
|
1527
|
+
rowCollapsed: Ot(d, _.rowOrigin, _.rowCount, _.items.map((e) => e.row))
|
|
1511
1528
|
};
|
|
1512
1529
|
}
|
|
1513
|
-
function
|
|
1530
|
+
function yt(e) {
|
|
1514
1531
|
return {
|
|
1515
|
-
tracks: Array.from({ length: e }, () =>
|
|
1532
|
+
tracks: Array.from({ length: e }, () => st()),
|
|
1516
1533
|
lineNames: Array.from({ length: e + 1 }, () => [])
|
|
1517
1534
|
};
|
|
1518
1535
|
}
|
|
1519
|
-
function
|
|
1536
|
+
function bt(e, t, n) {
|
|
1520
1537
|
let r = t === "col" ? e.colOrigin : e.rowOrigin;
|
|
1521
1538
|
for (let i of e.items) {
|
|
1522
1539
|
let e = i[t], a = Math.min(Math.max(e.start + r, 0), n - 1), o = Math.min(Math.max(e.start + r + e.span, a + 1), n);
|
|
@@ -1524,22 +1541,16 @@ function _t(e, t, n) {
|
|
|
1524
1541
|
}
|
|
1525
1542
|
t === "col" ? (e.colOrigin = 0, e.colCount = n) : (e.rowOrigin = 0, e.rowCount = n);
|
|
1526
1543
|
}
|
|
1527
|
-
function
|
|
1528
|
-
return e.children.filter((e) => !
|
|
1544
|
+
function xt(e) {
|
|
1545
|
+
return e.children.filter((e) => !z(e.style) && !e.inlineBox).sort((e, t) => e.style.order - t.style.order);
|
|
1529
1546
|
}
|
|
1530
|
-
function
|
|
1547
|
+
function St(e) {
|
|
1531
1548
|
return (e.left ?? 0) + (e.right ?? 0);
|
|
1532
1549
|
}
|
|
1533
|
-
function
|
|
1550
|
+
function Ct(e) {
|
|
1534
1551
|
return (e.top ?? 0) + (e.bottom ?? 0);
|
|
1535
1552
|
}
|
|
1536
|
-
function
|
|
1537
|
-
let r = e.style, i;
|
|
1538
|
-
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = q(r.width, 0, e, n)), i === void 0 && (i = t === "min" ? Y(e, n) : J(e, n));
|
|
1539
|
-
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
1540
|
-
return Math.max(0, H(i, a, o));
|
|
1541
|
-
}
|
|
1542
|
-
function St(e, t, n) {
|
|
1553
|
+
function wt(e, t, n) {
|
|
1543
1554
|
if (e.kind !== "tracks") return {
|
|
1544
1555
|
tracks: [],
|
|
1545
1556
|
lineNames: [[]]
|
|
@@ -1552,7 +1563,7 @@ function St(e, t, n) {
|
|
|
1552
1563
|
let { index: i, tracks: a, mode: o } = e.autoRepeat, s = 1;
|
|
1553
1564
|
if (t !== void 0) {
|
|
1554
1565
|
let e = a.reduce((e, n) => {
|
|
1555
|
-
let r =
|
|
1566
|
+
let r = Tt(n.min, t) ?? Tt(n.max, t) ?? 1;
|
|
1556
1567
|
return e + Math.max(1, r);
|
|
1557
1568
|
}, 0);
|
|
1558
1569
|
s = Math.max(1, Math.floor((t + n) / (e + n * a.length)));
|
|
@@ -1580,23 +1591,23 @@ function St(e, t, n) {
|
|
|
1580
1591
|
lineNames: d
|
|
1581
1592
|
};
|
|
1582
1593
|
}
|
|
1583
|
-
function
|
|
1594
|
+
function Tt(e, t) {
|
|
1584
1595
|
if (e.kind === "cells") return e.value;
|
|
1585
|
-
if (e.kind === "percent" && t !== void 0) return
|
|
1596
|
+
if (e.kind === "percent" && t !== void 0) return we(e.value, t);
|
|
1586
1597
|
if (e.kind === "math") {
|
|
1587
1598
|
let n = [];
|
|
1588
1599
|
for (let r of e.args) {
|
|
1589
|
-
let e =
|
|
1600
|
+
let e = Tt(r, t);
|
|
1590
1601
|
if (e === void 0) return;
|
|
1591
1602
|
n.push(e);
|
|
1592
1603
|
}
|
|
1593
1604
|
return e.fn === "min" ? Math.min(...n) : Math.max(...n);
|
|
1594
1605
|
}
|
|
1595
1606
|
}
|
|
1596
|
-
function
|
|
1607
|
+
function Et(e, t, n, r) {
|
|
1597
1608
|
for (let i = e.length; i < n; i++) e.push(r[(i - e.length) % r.length]), t.push([]);
|
|
1598
1609
|
}
|
|
1599
|
-
function
|
|
1610
|
+
function Dt(e, t, n, r) {
|
|
1600
1611
|
let i = [];
|
|
1601
1612
|
for (let a = 0; a < n; a++) {
|
|
1602
1613
|
let n = a + t;
|
|
@@ -1608,7 +1619,7 @@ function Tt(e, t, n, r) {
|
|
|
1608
1619
|
}
|
|
1609
1620
|
return i;
|
|
1610
1621
|
}
|
|
1611
|
-
function
|
|
1622
|
+
function Ot(e, t, n, r) {
|
|
1612
1623
|
let i = Array.from({ length: n }, () => !1);
|
|
1613
1624
|
if (!e.autoFit) return i;
|
|
1614
1625
|
for (let a = e.autoFit.start; a < e.autoFit.end; a++) {
|
|
@@ -1617,7 +1628,7 @@ function Et(e, t, n, r) {
|
|
|
1617
1628
|
}
|
|
1618
1629
|
return i;
|
|
1619
1630
|
}
|
|
1620
|
-
function
|
|
1631
|
+
function kt(e, t, n) {
|
|
1621
1632
|
if (e.kind === "line") return e.value > 0 ? e.value - 1 : n.explicitCount + 1 + e.value;
|
|
1622
1633
|
if (e.kind !== "name") return null;
|
|
1623
1634
|
if (e.nth === void 0) {
|
|
@@ -1632,14 +1643,14 @@ function Dt(e, t, n) {
|
|
|
1632
1643
|
for (let t = i; t >= 0; t--) if (n.names[t].includes(e.name) && ++a === -r) return t;
|
|
1633
1644
|
return -(-r - a);
|
|
1634
1645
|
}
|
|
1635
|
-
function
|
|
1646
|
+
function At(e, t, n, r) {
|
|
1636
1647
|
if (t.name === void 0) return e + n * t.value;
|
|
1637
1648
|
let i = t.value, a = e;
|
|
1638
1649
|
for (; i > 0;) a += n, (!(a >= 0 && a <= r.explicitCount) || r.names[a].includes(t.name)) && i--;
|
|
1639
1650
|
return a;
|
|
1640
1651
|
}
|
|
1641
|
-
function
|
|
1642
|
-
let r =
|
|
1652
|
+
function jt(e, t, n) {
|
|
1653
|
+
let r = kt(e, "start", n), i = kt(t, "end", n);
|
|
1643
1654
|
if (r !== null && i !== null) return r === i ? {
|
|
1644
1655
|
start: r,
|
|
1645
1656
|
span: 1
|
|
@@ -1649,10 +1660,10 @@ function kt(e, t, n) {
|
|
|
1649
1660
|
};
|
|
1650
1661
|
if (r !== null) return {
|
|
1651
1662
|
start: r,
|
|
1652
|
-
span: (t.kind === "span" ?
|
|
1663
|
+
span: (t.kind === "span" ? At(r, t, 1, n) : r + 1) - r
|
|
1653
1664
|
};
|
|
1654
1665
|
if (i !== null) {
|
|
1655
|
-
let t = e.kind === "span" ?
|
|
1666
|
+
let t = e.kind === "span" ? At(i, e, -1, n) : i - 1;
|
|
1656
1667
|
return {
|
|
1657
1668
|
start: t,
|
|
1658
1669
|
span: i - t
|
|
@@ -1663,7 +1674,7 @@ function kt(e, t, n) {
|
|
|
1663
1674
|
span: e.kind === "span" ? e.value : t.kind === "span" ? t.value : 1
|
|
1664
1675
|
};
|
|
1665
1676
|
}
|
|
1666
|
-
function
|
|
1677
|
+
function Mt(e, t, n, r) {
|
|
1667
1678
|
let i = r.direction === "row", a = e.map((e) => i ? e.row : e.col), o = e.map((e) => i ? e.col : e.row), s = i ? t : n, c = i ? n : t, l = 0, u = Math.max(s, 1);
|
|
1668
1679
|
for (let t = 0; t < e.length; t++) {
|
|
1669
1680
|
let e = o[t];
|
|
@@ -1760,7 +1771,7 @@ function At(e, t, n, r) {
|
|
|
1760
1771
|
rowCount: S
|
|
1761
1772
|
};
|
|
1762
1773
|
}
|
|
1763
|
-
function
|
|
1774
|
+
function Nt(e, t, n, r, i, a) {
|
|
1764
1775
|
let o = typeof r == "number" ? r : void 0, s = e.map((e, n) => {
|
|
1765
1776
|
if (t[n]) return {
|
|
1766
1777
|
base: 0,
|
|
@@ -1770,7 +1781,7 @@ function jt(e, t, n, r, i, a) {
|
|
|
1770
1781
|
frFactor: 0,
|
|
1771
1782
|
collapsed: !0
|
|
1772
1783
|
};
|
|
1773
|
-
let r =
|
|
1784
|
+
let r = Tt(e.min, o), i = r ?? 0, a = r === void 0, s = e.max;
|
|
1774
1785
|
if (s.kind === "fr") return {
|
|
1775
1786
|
base: i,
|
|
1776
1787
|
limit: null,
|
|
@@ -1779,7 +1790,7 @@ function jt(e, t, n, r, i, a) {
|
|
|
1779
1790
|
frFactor: s.value,
|
|
1780
1791
|
collapsed: !1
|
|
1781
1792
|
};
|
|
1782
|
-
let c =
|
|
1793
|
+
let c = Tt(s, o);
|
|
1783
1794
|
return c === void 0 ? {
|
|
1784
1795
|
base: i,
|
|
1785
1796
|
limit: null,
|
|
@@ -1904,65 +1915,65 @@ function jt(e, t, n, r, i, a) {
|
|
|
1904
1915
|
limits: s.map((e) => u(e))
|
|
1905
1916
|
};
|
|
1906
1917
|
}
|
|
1907
|
-
function
|
|
1908
|
-
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t -
|
|
1918
|
+
function Pt(e, t, n) {
|
|
1919
|
+
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t - Ft(e)), o = L(n === "stretch" ? "start" : n, r, a), s = [], c = 0;
|
|
1909
1920
|
for (let e = 0; e < r.length; e++) c += i[e], s.push(o[e] + c);
|
|
1910
1921
|
return s;
|
|
1911
1922
|
}
|
|
1912
|
-
function
|
|
1923
|
+
function Ft(e) {
|
|
1913
1924
|
return e.sizes.reduce((e, t) => e + t, 0) + e.gapBefore.reduce((e, t) => e + t, 0);
|
|
1914
1925
|
}
|
|
1915
|
-
function
|
|
1926
|
+
function It(e, t, n, r) {
|
|
1916
1927
|
let i = n + r - 1;
|
|
1917
1928
|
return e[n] === void 0 || e[i] === void 0 ? 0 : e[i] + t[i] - e[n];
|
|
1918
1929
|
}
|
|
1919
|
-
function
|
|
1930
|
+
function Lt(e, t, n, r, i) {
|
|
1920
1931
|
let a = t ?? 0, o = n ?? 0, s = r - i;
|
|
1921
|
-
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a +
|
|
1932
|
+
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a + Xe(e, r, i + a + o);
|
|
1922
1933
|
}
|
|
1923
1934
|
//#endregion
|
|
1924
1935
|
//#region src/multicol.ts
|
|
1925
|
-
function
|
|
1936
|
+
function Rt(e, t, n) {
|
|
1926
1937
|
let r = e.columnWidth === null ? null : Math.max(1, Math.floor((t + n) / (e.columnWidth + n)));
|
|
1927
1938
|
return e.columnCount !== null && r !== null ? Math.max(1, Math.min(e.columnCount, r)) : r === null ? Math.max(1, e.columnCount ?? 1) : r;
|
|
1928
1939
|
}
|
|
1929
|
-
function
|
|
1930
|
-
let r =
|
|
1940
|
+
function zt(e, t, n) {
|
|
1941
|
+
let r = Rt(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r)), a = Math.max(0, t - (r * i + (r - 1) * n));
|
|
1931
1942
|
return Array.from({ length: r }, (e, t) => i + +(t < a));
|
|
1932
1943
|
}
|
|
1933
|
-
function
|
|
1944
|
+
function Bt(e, t) {
|
|
1934
1945
|
let n = Math.max(typeof e.gapX == "number" ? e.gapX : 0, e.ruleX?.width ?? 0);
|
|
1935
1946
|
return e.columnCount === null ? Math.max(e.columnWidth ?? 1, t) : e.columnCount * t + (e.columnCount - 1) * n;
|
|
1936
1947
|
}
|
|
1937
|
-
function
|
|
1948
|
+
function Vt(e, t) {
|
|
1938
1949
|
return e === void 0 ? t : t === void 0 ? e : Math.min(e, t);
|
|
1939
1950
|
}
|
|
1940
|
-
function
|
|
1951
|
+
function Ht(e, t, n) {
|
|
1941
1952
|
for (; e < t;) {
|
|
1942
1953
|
let r = e + t >> 1;
|
|
1943
1954
|
n(r) ? t = r : e = r + 1;
|
|
1944
1955
|
}
|
|
1945
1956
|
return e;
|
|
1946
1957
|
}
|
|
1947
|
-
function
|
|
1948
|
-
let r =
|
|
1958
|
+
function Ut(e, t, n) {
|
|
1959
|
+
let r = Rt(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r));
|
|
1949
1960
|
return {
|
|
1950
1961
|
count: r,
|
|
1951
1962
|
width: i,
|
|
1952
1963
|
leftover: Math.max(0, t - (r * i + (r - 1) * n))
|
|
1953
1964
|
};
|
|
1954
1965
|
}
|
|
1955
|
-
function
|
|
1966
|
+
function Wt(e, t, n) {
|
|
1956
1967
|
return e === "all" ? !0 : e === "around" ? t || n : t && n;
|
|
1957
1968
|
}
|
|
1958
|
-
function
|
|
1959
|
-
let i =
|
|
1969
|
+
function Gt(e, t, n, r) {
|
|
1970
|
+
let i = Un(e, Math.max(1, t.width - e.style.tracking)), { heights: a, textOffsets: o } = Wn(e, i), s = e.style.lineGap, c = qt(a.map((e) => e + s)), l;
|
|
1960
1971
|
if (e.style.columnFill === "auto" && r !== void 0) l = Math.max(1, r);
|
|
1961
1972
|
else {
|
|
1962
|
-
let e =
|
|
1973
|
+
let e = Ht(c.reduce((e, t) => Math.max(e, t.rows - s), 1), Math.max(1, c.reduce((e, t) => e + t.rows, 0) - s), (e) => Kt(c, s, e).columns <= t.count);
|
|
1963
1974
|
l = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
1964
1975
|
}
|
|
1965
|
-
let u =
|
|
1976
|
+
let u = Kt(c, s, l);
|
|
1966
1977
|
return {
|
|
1967
1978
|
spans: i,
|
|
1968
1979
|
lineY: u.top,
|
|
@@ -1975,7 +1986,7 @@ function Ut(e, t, n, r) {
|
|
|
1975
1986
|
columnsUsed: i.length > 0 ? u.columns : 0
|
|
1976
1987
|
};
|
|
1977
1988
|
}
|
|
1978
|
-
function
|
|
1989
|
+
function Kt(e, t, n, r = "truncate") {
|
|
1979
1990
|
let i = 0, a = 0, o = 0, s = [], c = [];
|
|
1980
1991
|
for (let l = 0; l < e.length; l++) {
|
|
1981
1992
|
let u = e[l], d = r === "glue" || l === 0 || a > 0 ? u.pre : 0;
|
|
@@ -1996,7 +2007,7 @@ function Wt(e, t, n, r = "truncate") {
|
|
|
1996
2007
|
top: c
|
|
1997
2008
|
};
|
|
1998
2009
|
}
|
|
1999
|
-
function
|
|
2010
|
+
function qt(e) {
|
|
2000
2011
|
return e.map((e) => ({
|
|
2001
2012
|
rows: e,
|
|
2002
2013
|
pre: 0,
|
|
@@ -2005,27 +2016,27 @@ function Gt(e) {
|
|
|
2005
2016
|
lines: 1
|
|
2006
2017
|
}));
|
|
2007
2018
|
}
|
|
2008
|
-
var
|
|
2009
|
-
function
|
|
2010
|
-
if (
|
|
2019
|
+
var Jt = null;
|
|
2020
|
+
function Yt() {
|
|
2021
|
+
if (Jt !== null) return Jt;
|
|
2011
2022
|
let e = document.createElement("div");
|
|
2012
2023
|
e.style.cssText = "position:absolute;left:-9999px;visibility:hidden;columns:2;column-gap:0;column-fill:balance;width:200px;font:10px/20px monospace;orphans:1;widows:1", e.innerHTML = "<div style=\"margin:0;padding:0 0 20px 0\">aaaaaa aaaaaa aaaaaa</div><div style=\"margin:0\"><span>bbbbbb</span> bbbbbb</div>", document.body.appendChild(e);
|
|
2013
2024
|
let t = e.getBoundingClientRect().top, n = e.querySelector("span").getBoundingClientRect();
|
|
2014
|
-
return e.remove(),
|
|
2025
|
+
return e.remove(), Jt = !(n.width > 0 && n.top - t >= 10), Jt;
|
|
2015
2026
|
}
|
|
2016
|
-
function
|
|
2017
|
-
let { columnWidth: n, columnCount: r, tracking: i = 0, lineGap: a = 0, restrictingHeight: o } = t, s = i > 0 ? Array.from(e, () => 1 + i) : void 0, c =
|
|
2027
|
+
function Xt(e, t) {
|
|
2028
|
+
let { columnWidth: n, columnCount: r, tracking: i = 0, lineGap: a = 0, restrictingHeight: o } = t, s = i > 0 ? Array.from(e, () => 1 + i) : void 0, c = je(e, Math.max(1, n - i), {
|
|
2018
2029
|
advances: s,
|
|
2019
2030
|
tracking: i,
|
|
2020
2031
|
firstLineIndent: t.firstLineIndent
|
|
2021
|
-
}), l =
|
|
2032
|
+
}), l = qt(c.map(() => 1 + a)), u = Kt(l, a, o ?? Ht(1, Math.max(1, c.length * (1 + a) - a), (e) => Kt(l, a, e).columns <= r));
|
|
2022
2033
|
return c.map((t, n) => ({
|
|
2023
2034
|
text: e.slice(t.start, t.end),
|
|
2024
2035
|
column: u.column[n],
|
|
2025
2036
|
top: u.top[n]
|
|
2026
2037
|
}));
|
|
2027
2038
|
}
|
|
2028
|
-
function
|
|
2039
|
+
function Zt(e, t, n, r) {
|
|
2029
2040
|
let i = e.style;
|
|
2030
2041
|
if (!i.ruleX) return;
|
|
2031
2042
|
let a = t.columnCount * t.columnWidth + (t.columnCount - 1) * t.gap, o = t.ruleSegments ?? [{
|
|
@@ -2035,18 +2046,18 @@ function Yt(e, t, n, r) {
|
|
|
2035
2046
|
}], s = [];
|
|
2036
2047
|
for (let e of o) {
|
|
2037
2048
|
let n = Math.min(e.columns, t.columnCount);
|
|
2038
|
-
for (let r = 0; r < t.columnCount - 1; r++)
|
|
2049
|
+
for (let r = 0; r < t.columnCount - 1; r++) Wt(i.ruleVisibilityItems, r < n, r + 1 < n) && s.push({
|
|
2039
2050
|
bandStart: (r + 1) * t.columnWidth + r * t.gap,
|
|
2040
2051
|
bandSize: t.gap,
|
|
2041
2052
|
start: e.start,
|
|
2042
2053
|
end: e.end
|
|
2043
2054
|
});
|
|
2044
2055
|
}
|
|
2045
|
-
e.decorationRuns =
|
|
2056
|
+
e.decorationRuns = be({
|
|
2046
2057
|
glyphs: S(i.glyphSet),
|
|
2047
2058
|
ruleX: i.ruleX,
|
|
2048
2059
|
ruleY: null,
|
|
2049
|
-
vertical:
|
|
2060
|
+
vertical: He(s, i.ruleInset),
|
|
2050
2061
|
horizontal: [],
|
|
2051
2062
|
contentWidth: a,
|
|
2052
2063
|
contentHeight: t.totalRows,
|
|
@@ -2056,12 +2067,12 @@ function Yt(e, t, n, r) {
|
|
|
2056
2067
|
padding: r
|
|
2057
2068
|
});
|
|
2058
2069
|
}
|
|
2059
|
-
function
|
|
2070
|
+
function Qt(e, t) {
|
|
2060
2071
|
let n = e.style, r = n.padding;
|
|
2061
2072
|
return e.text !== "" && e.children.length === 0 && n.display === "block" && n.position === "static" && !n.columnSpan && n.whiteSpace === "normal" && n.lineGap === t.lineGap && n.border.top === 0 && n.border.right === 0 && n.border.bottom === 0 && n.border.left === 0 && r.top === 0 && r.right === 0 && r.bottom === 0 && r.left === 0 && n.backgroundColor === void 0 && !n.backgroundClear && n.overflow.x === "visible" && n.overflow.y === "visible" && (n.width === void 0 || n.width.kind === "auto") && (n.height === void 0 || n.height.kind === "auto") && (n.minWidth === "auto" || n.minWidth === 0 || n.minWidth === void 0) && (n.minHeight === "auto" || n.minHeight === 0 || n.minHeight === void 0) && n.maxWidth === void 0 && n.maxHeight === void 0;
|
|
2062
2073
|
}
|
|
2063
|
-
function
|
|
2064
|
-
let s = e.style, c =
|
|
2074
|
+
function $t(e, t, n, r, i, a, o) {
|
|
2075
|
+
let s = e.style, c = H(s, "x", n), l = Ut(s, n, c);
|
|
2065
2076
|
a.right += l.leftover;
|
|
2066
2077
|
let u = s.lineGap, d = i.left + a.left, f = i.top + a.top, p = n - l.leftover, m = [[]], h = [];
|
|
2067
2078
|
for (let e of t) e.style.columnSpan ? (h[m.length - 1] = e, m.push([])) : m[m.length - 1].push(e);
|
|
@@ -2071,13 +2082,13 @@ function Zt(e, t, n, r, i, a, o) {
|
|
|
2071
2082
|
if (t.length > 0) {
|
|
2072
2083
|
let i = t.map((e) => ({
|
|
2073
2084
|
node: e,
|
|
2074
|
-
spans:
|
|
2075
|
-
margin:
|
|
2085
|
+
spans: Un(e, Math.max(1, l.width - e.style.tracking)),
|
|
2086
|
+
margin: W(e.style.margin, l.width),
|
|
2076
2087
|
pre: 0,
|
|
2077
2088
|
post: 0
|
|
2078
2089
|
})), a = [], o = null, h = null, x = !1;
|
|
2079
2090
|
for (let e of i) {
|
|
2080
|
-
let { node: t, spans: n, margin: r } = e, i = o === null ? r.top ?? 0 :
|
|
2091
|
+
let { node: t, spans: n, margin: r } = e, i = o === null ? r.top ?? 0 : Yn(o, r.top ?? 0), s = i;
|
|
2081
2092
|
_ === "glue" && h !== null ? (s = 0, h.post = i, a[a.length - 1].post = i) : e.pre = i;
|
|
2082
2093
|
let c = x || t.style.breakBeforeColumn;
|
|
2083
2094
|
if (t.style.breakInsideAvoid && n.length > 0) a.push({
|
|
@@ -2100,10 +2111,10 @@ function Zt(e, t, n, r, i, a, o) {
|
|
|
2100
2111
|
let S;
|
|
2101
2112
|
if (s.columnFill === "auto" && r !== void 0) S = Math.max(1, r);
|
|
2102
2113
|
else {
|
|
2103
|
-
let e =
|
|
2114
|
+
let e = Ht(1, Math.max(1, Kt(a, u, Infinity, _).maxUsed), (e) => Kt(a, u, e, _).columns <= l.count);
|
|
2104
2115
|
S = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
2105
2116
|
}
|
|
2106
|
-
let C =
|
|
2117
|
+
let C = Kt(a, u, S, _);
|
|
2107
2118
|
for (let e = 0, t = 0; e < i.length; e++) {
|
|
2108
2119
|
let { node: n, spans: r, margin: a, pre: o, post: s } = i[e], u = [], m = [];
|
|
2109
2120
|
for (let e = 0; e < r.length; e++, t++) u.push(y + C.top[t]), m.push(C.column[t] * (l.width + c));
|
|
@@ -2142,9 +2153,9 @@ function Zt(e, t, n, r, i, a, o) {
|
|
|
2142
2153
|
}
|
|
2143
2154
|
let i = h[e];
|
|
2144
2155
|
if (i) {
|
|
2145
|
-
let e =
|
|
2146
|
-
|
|
2147
|
-
let r =
|
|
2156
|
+
let e = W(i.style.margin, p), t = (e.left ?? 0) + (e.right ?? 0);
|
|
2157
|
+
B(i, Math.max(0, p - t), void 0, 0, 0, "fill", o);
|
|
2158
|
+
let r = Jn(e, p, i.localRect.width), a = (e.top ?? 0) + n;
|
|
2148
2159
|
y += a, i.localRect = {
|
|
2149
2160
|
...i.localRect,
|
|
2150
2161
|
x: d + r,
|
|
@@ -2159,8 +2170,8 @@ function Zt(e, t, n, r, i, a, o) {
|
|
|
2159
2170
|
}
|
|
2160
2171
|
let x = y;
|
|
2161
2172
|
for (let t of e.children) {
|
|
2162
|
-
if (!
|
|
2163
|
-
let e =
|
|
2173
|
+
if (!z(t.style)) continue;
|
|
2174
|
+
let e = W(t.style.margin, n);
|
|
2164
2175
|
t.staticSlot = {
|
|
2165
2176
|
kind: "block",
|
|
2166
2177
|
x: d + (e.left ?? 0),
|
|
@@ -2183,10 +2194,10 @@ function Zt(e, t, n, r, i, a, o) {
|
|
|
2183
2194
|
} : {}
|
|
2184
2195
|
}, x;
|
|
2185
2196
|
}
|
|
2186
|
-
function
|
|
2187
|
-
let s = e.style, c =
|
|
2188
|
-
if (u.length > 0 && u.every((e) =>
|
|
2189
|
-
let f =
|
|
2197
|
+
function en(e, t, n, r, i, a, o) {
|
|
2198
|
+
let s = e.style, c = Vt(n, r), l = e.children.filter((e) => !z(e.style)), u = l.filter((e) => !e.style.columnSpan), d = l.reduce((e, t, n) => !t.style.columnSpan && (n === 0 || l[n - 1].style.columnSpan) ? e + 1 : e, 0);
|
|
2199
|
+
if (u.length > 0 && u.every((e) => Qt(e, s)) && (u.length === l.length || s.columnFill === "balance" && c === void 0 && (Yt() || d <= 1 && u.every((e) => (e.style.margin.top === 0 || e.style.margin.top === null) && (e.style.margin.bottom === 0 || e.style.margin.bottom === null))))) return $t(e, l, t, c, i, a, o);
|
|
2200
|
+
let f = H(s, "x", t), p = zt(s, t, f), m = p.length, h = [];
|
|
2190
2201
|
{
|
|
2191
2202
|
let e = 0;
|
|
2192
2203
|
for (let t of p) h.push(e), e += t + f;
|
|
@@ -2195,7 +2206,7 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2195
2206
|
let r = 0, i = 0, a = null, s = 0, c = (e) => {
|
|
2196
2207
|
if (t) for (let t of T) {
|
|
2197
2208
|
if (t.index !== e) continue;
|
|
2198
|
-
let n = a === null ? t.margin.top ?? 0 :
|
|
2209
|
+
let n = a === null ? t.margin.top ?? 0 : Yn(a, t.margin.top ?? 0);
|
|
2199
2210
|
t.child.staticSlot = {
|
|
2200
2211
|
kind: "block",
|
|
2201
2212
|
x: y + g(r) + (t.margin.left ?? 0),
|
|
@@ -2206,16 +2217,16 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2206
2217
|
for (let l = 0; l < w.length; l++) {
|
|
2207
2218
|
let u = w[l];
|
|
2208
2219
|
c(l);
|
|
2209
|
-
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 :
|
|
2220
|
+
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 : Yn(a, u.margin.top ?? 0), f = u.node.localRect.height;
|
|
2210
2221
|
if (a !== null && (u.breakBefore || i + d + f > e) && (r += 1, i = 0, a = null, d = 0), t) {
|
|
2211
2222
|
let e = u.node, t = _(r);
|
|
2212
2223
|
if (t !== v) {
|
|
2213
2224
|
let r = (u.margin.left ?? 0) + (u.margin.right ?? 0);
|
|
2214
|
-
|
|
2225
|
+
B(e, Math.max(0, t - r), n, 0, 0, "fill", o);
|
|
2215
2226
|
}
|
|
2216
2227
|
e.localRect = {
|
|
2217
2228
|
...e.localRect,
|
|
2218
|
-
x: y + g(r) +
|
|
2229
|
+
x: y + g(r) + Jn(u.margin, t, e.localRect.width),
|
|
2219
2230
|
y: b + C + i + d
|
|
2220
2231
|
};
|
|
2221
2232
|
}
|
|
@@ -2238,13 +2249,13 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2238
2249
|
let e = c === void 0 ? void 0 : Math.max(1, c - C), t = s.columnFill === "auto" && e !== void 0, r;
|
|
2239
2250
|
if (t) r = e;
|
|
2240
2251
|
else {
|
|
2241
|
-
let t =
|
|
2252
|
+
let t = Ht(1, D(Infinity, !1).maxUsed, (e) => D(e, !1).columns <= m);
|
|
2242
2253
|
r = e === void 0 ? t : Math.min(t, e);
|
|
2243
2254
|
}
|
|
2244
2255
|
let i = D(r, !0), a = t && n !== void 0 ? Math.max(i.maxUsed, r) : i.maxUsed;
|
|
2245
2256
|
if (s.ruleX) for (let e = 0; e < m - 1; e++) {
|
|
2246
2257
|
let t = Math.min(i.columns, m);
|
|
2247
|
-
|
|
2258
|
+
Wt(s.ruleVisibilityItems, e < t, e + 1 < t) && x.push({
|
|
2248
2259
|
bandStart: h[e] + p[e],
|
|
2249
2260
|
bandSize: f,
|
|
2250
2261
|
start: C,
|
|
@@ -2254,36 +2265,36 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2254
2265
|
C += a, w = [], T = [];
|
|
2255
2266
|
};
|
|
2256
2267
|
for (let r of e.children) {
|
|
2257
|
-
if (
|
|
2268
|
+
if (z(r.style)) {
|
|
2258
2269
|
T.push({
|
|
2259
2270
|
child: r,
|
|
2260
|
-
margin:
|
|
2271
|
+
margin: W(r.style.margin, t),
|
|
2261
2272
|
index: w.length
|
|
2262
2273
|
});
|
|
2263
2274
|
continue;
|
|
2264
2275
|
}
|
|
2265
2276
|
if (r.style.columnSpan) {
|
|
2266
2277
|
O(), E = !1;
|
|
2267
|
-
let e =
|
|
2268
|
-
|
|
2278
|
+
let e = W(r.style.margin, t), i = (e.left ?? 0) + (e.right ?? 0);
|
|
2279
|
+
B(r, Math.max(0, t - i), n, 0, 0, "fill", o), C += e.top ?? 0, r.localRect = {
|
|
2269
2280
|
...r.localRect,
|
|
2270
|
-
x: y +
|
|
2281
|
+
x: y + Jn(e, t, r.localRect.width),
|
|
2271
2282
|
y: b + C
|
|
2272
2283
|
}, C += r.localRect.height + (e.bottom ?? 0);
|
|
2273
2284
|
continue;
|
|
2274
2285
|
}
|
|
2275
|
-
let e =
|
|
2276
|
-
|
|
2286
|
+
let e = W(r.style.margin, v), i = (e.left ?? 0) + (e.right ?? 0);
|
|
2287
|
+
B(r, Math.max(0, v - i), n, 0, 0, "fill", o), w.push({
|
|
2277
2288
|
node: r,
|
|
2278
2289
|
margin: e,
|
|
2279
2290
|
breakBefore: E || r.style.breakBeforeColumn
|
|
2280
2291
|
}), E = r.style.breakAfterColumn;
|
|
2281
2292
|
}
|
|
2282
|
-
return O(), s.ruleX && x.length > 0 && (e.decorationRuns =
|
|
2293
|
+
return O(), s.ruleX && x.length > 0 && (e.decorationRuns = be({
|
|
2283
2294
|
glyphs: S(s.glyphSet),
|
|
2284
2295
|
ruleX: s.ruleX,
|
|
2285
2296
|
ruleY: null,
|
|
2286
|
-
vertical:
|
|
2297
|
+
vertical: He(x, s.ruleInset),
|
|
2287
2298
|
horizontal: [],
|
|
2288
2299
|
contentWidth: t,
|
|
2289
2300
|
contentHeight: C,
|
|
@@ -2295,32 +2306,32 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2295
2306
|
}
|
|
2296
2307
|
//#endregion
|
|
2297
2308
|
//#region src/table.ts
|
|
2298
|
-
function
|
|
2309
|
+
function tn(e, t) {
|
|
2299
2310
|
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" && N(t.source, "Table content outside the expected structure (rows in tables, cells in rows) can't be laid out and was hidden — no anonymous table boxes (specs/table.md).");
|
|
2300
2311
|
}
|
|
2301
|
-
function
|
|
2312
|
+
function nn(e, t) {
|
|
2302
2313
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
2303
2314
|
return Number.isNaN(n) ? 1 : t === "colspan" ? Math.min(1e3, Math.max(1, n)) : Math.min(65534, Math.max(0, n));
|
|
2304
2315
|
}
|
|
2305
|
-
function
|
|
2316
|
+
function rn(e, t, n) {
|
|
2306
2317
|
let r = (t, r) => {
|
|
2307
|
-
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ?
|
|
2318
|
+
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ? K(i, 0, t, n) : void 0, o = i && i.kind === "percent" ? i.value : void 0;
|
|
2308
2319
|
for (let t = 0; t < r; t++) e.colFixed.push(a), e.colPercent.push(o);
|
|
2309
2320
|
};
|
|
2310
2321
|
if (t.style.tableRole === "column") {
|
|
2311
|
-
r(t,
|
|
2322
|
+
r(t, an(t.source));
|
|
2312
2323
|
return;
|
|
2313
2324
|
}
|
|
2314
2325
|
let i = t.children.filter((e) => e.style.tableRole === "column");
|
|
2315
|
-
if (i.length === 0) r(t,
|
|
2316
|
-
else for (let e of i) r(e,
|
|
2317
|
-
for (let n of t.children) n.style.tableRole !== "column" &&
|
|
2326
|
+
if (i.length === 0) r(t, an(t.source));
|
|
2327
|
+
else for (let e of i) r(e, an(e.source));
|
|
2328
|
+
for (let n of t.children) n.style.tableRole !== "column" && tn(e, n);
|
|
2318
2329
|
}
|
|
2319
|
-
function
|
|
2330
|
+
function an(e) {
|
|
2320
2331
|
let t = Number.parseInt(e.getAttribute("span") ?? "", 10);
|
|
2321
2332
|
return Number.isNaN(t) ? 1 : Math.min(1e3, Math.max(1, t));
|
|
2322
2333
|
}
|
|
2323
|
-
function
|
|
2334
|
+
function on(e, t) {
|
|
2324
2335
|
let n = {
|
|
2325
2336
|
caption: null,
|
|
2326
2337
|
rows: [],
|
|
@@ -2333,7 +2344,7 @@ function rn(e, t) {
|
|
|
2333
2344
|
hidden: []
|
|
2334
2345
|
}, r = [], i = [], a = [];
|
|
2335
2346
|
for (let o of e.children) {
|
|
2336
|
-
if (
|
|
2347
|
+
if (z(o.style)) continue;
|
|
2337
2348
|
let e = o.style.tableRole;
|
|
2338
2349
|
if (e === "row") i.push({
|
|
2339
2350
|
row: o,
|
|
@@ -2341,11 +2352,11 @@ function rn(e, t) {
|
|
|
2341
2352
|
});
|
|
2342
2353
|
else if (e === "header-group" || e === "row-group" || e === "footer-group") {
|
|
2343
2354
|
let t = e === "header-group" ? r : e === "footer-group" ? a : i;
|
|
2344
|
-
for (let e of o.children)
|
|
2355
|
+
for (let e of o.children) z(e.style) || (e.style.tableRole === "row" ? t.push({
|
|
2345
2356
|
row: e,
|
|
2346
2357
|
group: o
|
|
2347
|
-
}) :
|
|
2348
|
-
} else e === "caption" ? n.caption === null ? n.caption = o :
|
|
2358
|
+
}) : tn(n, e));
|
|
2359
|
+
} else e === "caption" ? n.caption === null ? n.caption = o : tn(n, o) : e === "column" || e === "column-group" ? (rn(n, o, t), n.hidden.push(o)) : tn(n, o);
|
|
2349
2360
|
}
|
|
2350
2361
|
let o = [
|
|
2351
2362
|
...r,
|
|
@@ -2360,20 +2371,20 @@ function rn(e, t) {
|
|
|
2360
2371
|
s = e + 1;
|
|
2361
2372
|
}
|
|
2362
2373
|
}
|
|
2363
|
-
return
|
|
2374
|
+
return sn(n), n;
|
|
2364
2375
|
}
|
|
2365
|
-
function
|
|
2376
|
+
function sn(e) {
|
|
2366
2377
|
let t = [];
|
|
2367
2378
|
for (let n = 0; n < e.rows.length; n++) {
|
|
2368
2379
|
let r = e.rows[n], i = 0;
|
|
2369
2380
|
for (let a of r.children) {
|
|
2370
|
-
if (
|
|
2381
|
+
if (z(a.style)) continue;
|
|
2371
2382
|
if (a.style.tableRole !== "cell") {
|
|
2372
|
-
|
|
2383
|
+
tn(e, a);
|
|
2373
2384
|
continue;
|
|
2374
2385
|
}
|
|
2375
2386
|
for (; (t[i] ?? 0) > n;) i++;
|
|
2376
|
-
let o =
|
|
2387
|
+
let o = nn(a.source, "colspan"), s = nn(a.source, "rowspan"), c = e.groupEnds[n], l = Math.max(1, Math.min(s === 0 ? c - n : s, c - n));
|
|
2377
2388
|
for (let e = i; e < i + o; e++) t[e] = Math.max(t[e] ?? 0, n + l);
|
|
2378
2389
|
e.cells.push({
|
|
2379
2390
|
node: a,
|
|
@@ -2387,21 +2398,21 @@ function an(e) {
|
|
|
2387
2398
|
}
|
|
2388
2399
|
e.columnCount = Math.max(t.length, e.colFixed.length);
|
|
2389
2400
|
}
|
|
2390
|
-
function
|
|
2401
|
+
function cn(e, t, n) {
|
|
2391
2402
|
let r = e.style, i = Y(e, n), a;
|
|
2392
2403
|
if (t === "min") a = i;
|
|
2393
2404
|
else {
|
|
2394
|
-
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ?
|
|
2395
|
-
a = t === void 0 ?
|
|
2405
|
+
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ? K(r.width, 0, e, n) : void 0;
|
|
2406
|
+
a = t === void 0 ? q(e, n) : Math.max(i, t);
|
|
2396
2407
|
}
|
|
2397
2408
|
let o = typeof r.minWidth == "number" ? r.minWidth : 0, s = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
2398
|
-
return Math.max(0,
|
|
2409
|
+
return Math.max(0, V(a, o, s));
|
|
2399
2410
|
}
|
|
2400
|
-
function
|
|
2411
|
+
function ln(e) {
|
|
2401
2412
|
let t = e.style.width;
|
|
2402
2413
|
return t && t.kind === "percent" ? t.value : void 0;
|
|
2403
2414
|
}
|
|
2404
|
-
function
|
|
2415
|
+
function un(e, t, n) {
|
|
2405
2416
|
let r = e.columnCount, i = Array.from({ length: r }, () => 0), a = Array.from({ length: r }, () => 0), o = Array.from({ length: r }, () => void 0);
|
|
2406
2417
|
for (let t = 0; t < r; t++) e.colFixed[t] !== void 0 && (a[t] = e.colFixed[t]), o[t] = e.colPercent[t];
|
|
2407
2418
|
let s = [];
|
|
@@ -2410,15 +2421,15 @@ function cn(e, t, n) {
|
|
|
2410
2421
|
s.push(t);
|
|
2411
2422
|
continue;
|
|
2412
2423
|
}
|
|
2413
|
-
i[t.col] = Math.max(i[t.col],
|
|
2414
|
-
let e =
|
|
2424
|
+
i[t.col] = Math.max(i[t.col], cn(t.node, "min", n)), a[t.col] = Math.max(a[t.col], cn(t.node, "max", n));
|
|
2425
|
+
let e = ln(t.node);
|
|
2415
2426
|
e !== void 0 && (o[t.col] = Math.max(o[t.col] ?? 0, e));
|
|
2416
2427
|
}
|
|
2417
2428
|
s.sort((e, t) => e.colSpan - t.colSpan);
|
|
2418
2429
|
for (let e of s) {
|
|
2419
|
-
let r = e.col, o = e.col + e.colSpan, s =
|
|
2430
|
+
let r = e.col, o = e.col + e.colSpan, s = _n(t, r, o), c = a.slice(r, o);
|
|
2420
2431
|
for (let t of ["min", "max"]) {
|
|
2421
|
-
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d =
|
|
2432
|
+
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d = cn(e.node, t, n) - u;
|
|
2422
2433
|
if (d <= 0) continue;
|
|
2423
2434
|
let f = R(c.some((e) => e > 0) ? c : c.map(() => 1), d);
|
|
2424
2435
|
for (let e = r; e < o; e++) l[e] += f[e - r];
|
|
@@ -2431,7 +2442,7 @@ function cn(e, t, n) {
|
|
|
2431
2442
|
percent: o
|
|
2432
2443
|
};
|
|
2433
2444
|
}
|
|
2434
|
-
function
|
|
2445
|
+
function dn(e, t) {
|
|
2435
2446
|
let n = e.min.length, r = e.min.slice(), i = [], a = [];
|
|
2436
2447
|
for (let t = 0; t < n; t++) (e.percent[t] === void 0 ? a : i).push(t);
|
|
2437
2448
|
if (i.length > 0) {
|
|
@@ -2460,13 +2471,13 @@ function ln(e, t) {
|
|
|
2460
2471
|
}
|
|
2461
2472
|
return r;
|
|
2462
2473
|
}
|
|
2463
|
-
function
|
|
2474
|
+
function fn(e, t, n) {
|
|
2464
2475
|
let r = e.columnCount, i = Array.from({ length: r }, () => void 0);
|
|
2465
2476
|
for (let n = 0; n < r; n++) e.colFixed[n] === void 0 ? e.colPercent[n] !== void 0 && (i[n] = Math.max(0, Math.round(t * e.colPercent[n] / 100))) : i[n] = e.colFixed[n];
|
|
2466
2477
|
for (let r of e.cells) {
|
|
2467
2478
|
if (r.row !== 0) continue;
|
|
2468
2479
|
let e = r.node.style, a;
|
|
2469
|
-
if (e.width && e.width.kind === "percent" ? a = Math.max(0, Math.round(t * e.width.value / 100)) : e.width && e.width.kind !== "auto" && (a =
|
|
2480
|
+
if (e.width && e.width.kind === "percent" ? a = Math.max(0, Math.round(t * e.width.value / 100)) : e.width && e.width.kind !== "auto" && (a = K(e.width, 0, r.node, n)), a === void 0) continue;
|
|
2470
2481
|
let o = R(Array.from({ length: r.colSpan }, () => 1), a);
|
|
2471
2482
|
for (let e = 0; e < r.colSpan; e++) {
|
|
2472
2483
|
let t = r.col + e;
|
|
@@ -2480,13 +2491,13 @@ function un(e, t, n) {
|
|
|
2480
2491
|
}
|
|
2481
2492
|
return i.map((e) => e ?? 0);
|
|
2482
2493
|
}
|
|
2483
|
-
var
|
|
2494
|
+
var pn = {
|
|
2484
2495
|
double: 3,
|
|
2485
2496
|
solid: 2,
|
|
2486
2497
|
dashed: 1,
|
|
2487
2498
|
dotted: 0
|
|
2488
2499
|
};
|
|
2489
|
-
function
|
|
2500
|
+
function mn(e) {
|
|
2490
2501
|
for (let { border: t, side: n } of e) if (t?.hidden[n]) return null;
|
|
2491
2502
|
let t = null;
|
|
2492
2503
|
for (let { border: n, side: r } of e) {
|
|
@@ -2494,7 +2505,7 @@ function fn(e) {
|
|
|
2494
2505
|
let e = n.width[r];
|
|
2495
2506
|
if (e <= 0) continue;
|
|
2496
2507
|
let i = n.style[r];
|
|
2497
|
-
(t === null || e > t.width || e === t.width &&
|
|
2508
|
+
(t === null || e > t.width || e === t.width && pn[i] > pn[t.style]) && (t = {
|
|
2498
2509
|
width: e,
|
|
2499
2510
|
style: i,
|
|
2500
2511
|
color: n.color[r]
|
|
@@ -2502,7 +2513,7 @@ function fn(e) {
|
|
|
2502
2513
|
}
|
|
2503
2514
|
return t;
|
|
2504
2515
|
}
|
|
2505
|
-
function
|
|
2516
|
+
function hn(e, t) {
|
|
2506
2517
|
let n = t.columnCount, r = t.rows.length, i = e.style.borderCollapse, a = {
|
|
2507
2518
|
collapsed: i,
|
|
2508
2519
|
vLines: Array.from({ length: n + 1 }, () => 0),
|
|
@@ -2547,7 +2558,7 @@ function pn(e, t) {
|
|
|
2547
2558
|
side: u
|
|
2548
2559
|
});
|
|
2549
2560
|
}
|
|
2550
|
-
i.push(
|
|
2561
|
+
i.push(mn(l));
|
|
2551
2562
|
}
|
|
2552
2563
|
a.vSegments.push(i), a.vLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
2553
2564
|
}
|
|
@@ -2586,47 +2597,47 @@ function pn(e, t) {
|
|
|
2586
2597
|
}), e === r && l.push({
|
|
2587
2598
|
border: s,
|
|
2588
2599
|
side: "bottom"
|
|
2589
|
-
}), i.push(
|
|
2600
|
+
}), i.push(mn(l));
|
|
2590
2601
|
}
|
|
2591
2602
|
a.hSegments.push(i), a.hLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
2592
2603
|
}
|
|
2593
2604
|
return a;
|
|
2594
2605
|
}
|
|
2595
|
-
function
|
|
2606
|
+
function gn(e, t) {
|
|
2596
2607
|
return e.collapsed ? e.vLines.reduce((e, t) => e + t, 0) : (t + 1) * e.spacingX;
|
|
2597
2608
|
}
|
|
2598
|
-
function
|
|
2609
|
+
function _n(e, t, n) {
|
|
2599
2610
|
if (!e.collapsed) return e.spacingX * (n - t - 1);
|
|
2600
2611
|
let r = 0;
|
|
2601
2612
|
for (let i = t + 1; i < n; i++) r += e.vLines[i];
|
|
2602
2613
|
return r;
|
|
2603
2614
|
}
|
|
2604
|
-
function
|
|
2615
|
+
function vn(e, t, n) {
|
|
2605
2616
|
if (!e.collapsed) return e.spacingY * (n - t - 1);
|
|
2606
2617
|
let r = 0;
|
|
2607
2618
|
for (let i = t + 1; i < n; i++) r += e.hLines[i];
|
|
2608
2619
|
return r;
|
|
2609
2620
|
}
|
|
2610
|
-
function
|
|
2621
|
+
function yn(e, t) {
|
|
2611
2622
|
let n = t.tableData.get(e);
|
|
2612
2623
|
if (n) return n;
|
|
2613
|
-
let r =
|
|
2624
|
+
let r = on(e, t), i = hn(e, r), a = {
|
|
2614
2625
|
structure: r,
|
|
2615
2626
|
chrome: i,
|
|
2616
|
-
bounds:
|
|
2617
|
-
chromeX:
|
|
2627
|
+
bounds: un(r, i, t),
|
|
2628
|
+
chromeX: gn(i, r.columnCount)
|
|
2618
2629
|
};
|
|
2619
2630
|
return t.tableData.set(e, a), a;
|
|
2620
2631
|
}
|
|
2621
|
-
function
|
|
2622
|
-
let { structure: n, bounds: r, chromeX: i } =
|
|
2623
|
-
return n.caption && (a = Math.max(a, Y(n.caption, t)), o = Math.max(o,
|
|
2632
|
+
function bn(e, t) {
|
|
2633
|
+
let { structure: n, bounds: r, chromeX: i } = yn(e, t), a = r.min.reduce((e, t) => e + t, 0) + i, o = r.max.reduce((e, t) => e + t, 0) + i;
|
|
2634
|
+
return n.caption && (a = Math.max(a, Y(n.caption, t)), o = Math.max(o, q(n.caption, t))), {
|
|
2624
2635
|
min: a,
|
|
2625
2636
|
max: o
|
|
2626
2637
|
};
|
|
2627
2638
|
}
|
|
2628
|
-
function
|
|
2629
|
-
let r = e.style, { bounds: i, chromeX: a } =
|
|
2639
|
+
function xn(e, t, n) {
|
|
2640
|
+
let r = e.style, { bounds: i, chromeX: a } = yn(e, n), { min: o, max: s } = bn(e, n), c = r.border.left + r.border.right + U(r.padding.left, t) + U(r.padding.right, t) + it(r).right, l = i.max.reduce((e, t) => e + t, 0), u = 0, d = 0;
|
|
2630
2641
|
for (let e = 0; e < i.max.length; e++) {
|
|
2631
2642
|
let t = i.percent[e];
|
|
2632
2643
|
t === void 0 ? d += i.max[e] : u += t;
|
|
@@ -2642,8 +2653,8 @@ function yn(e, t, n) {
|
|
|
2642
2653
|
let f = Math.max(l + a, s) + c;
|
|
2643
2654
|
return Math.max(o + c, Math.min(f, t));
|
|
2644
2655
|
}
|
|
2645
|
-
function
|
|
2646
|
-
let { structure: o, chrome: s, bounds: c } =
|
|
2656
|
+
function Sn(e, t, n, r, i, a) {
|
|
2657
|
+
let { structure: o, chrome: s, bounds: c } = yn(e, a), l = o.columnCount, u = o.rows.length, d = r.left + i.left, f = r.top + i.top;
|
|
2647
2658
|
for (let e of o.hidden) e.tableHidden = !0, e.localRect = {
|
|
2648
2659
|
x: 0,
|
|
2649
2660
|
y: 0,
|
|
@@ -2655,16 +2666,16 @@ function bn(e, t, n, r, i, a) {
|
|
|
2655
2666
|
bottom: 0,
|
|
2656
2667
|
left: 0
|
|
2657
2668
|
}, e.unclampedHeight = 0;
|
|
2658
|
-
let p = Math.max(0, t -
|
|
2669
|
+
let p = Math.max(0, t - gn(s, l)), m = e.style, h = m.tableLayout === "fixed" && m.width !== void 0 && m.width.kind !== "auto" ? fn(o, p, a) : dn(c, p), g = [], _ = 0;
|
|
2659
2670
|
for (let e = 0; e < l; e++) _ += s.collapsed ? s.vLines[e] : s.spacingX, g.push(_), _ += h[e];
|
|
2660
2671
|
let v = _ + (s.collapsed ? s.vLines[l] ?? 0 : s.spacingX), y = 0;
|
|
2661
|
-
o.caption && (
|
|
2672
|
+
o.caption && (B(o.caption, t, void 0, d, f, "fill", a), y = o.caption.localRect.height);
|
|
2662
2673
|
let b = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
|
|
2663
2674
|
for (let e of o.cells) {
|
|
2664
|
-
let t = e.col + e.colSpan, n = h.slice(e.col, t).reduce((e, t) => e + t, 0) +
|
|
2665
|
-
x.set(e, n),
|
|
2675
|
+
let t = e.col + e.colSpan, n = h.slice(e.col, t).reduce((e, t) => e + t, 0) + _n(s, e.col, t);
|
|
2676
|
+
x.set(e, n), B(e.node, n, void 0, 0, 0, "fill", a, { width: n }), b.set(e, e.node.localRect.height);
|
|
2666
2677
|
}
|
|
2667
|
-
let C = s.collapsed ? s.hLines.reduce((e, t) => e + t, 0) : (u + 1) * s.spacingY, w = n === void 0 ? void 0 : Math.max(0, n - y - C), T = (e) => e !== void 0 && e.kind === "percent" && w !== void 0 ?
|
|
2678
|
+
let C = s.collapsed ? s.hLines.reduce((e, t) => e + t, 0) : (u + 1) * s.spacingY, w = n === void 0 ? void 0 : Math.max(0, n - y - C), T = (e) => e !== void 0 && e.kind === "percent" && w !== void 0 ? we(e.value, w) : 0, E = Array.from({ length: u }, () => 0), D = Array.from({ length: u }, () => !1);
|
|
2668
2679
|
for (let e = 0; e < u; e++) {
|
|
2669
2680
|
let t = o.rows[e].style.height;
|
|
2670
2681
|
t !== void 0 && t.kind === "cells" && (E[e] = t.value);
|
|
@@ -2677,7 +2688,7 @@ function bn(e, t, n, r, i, a) {
|
|
|
2677
2688
|
}
|
|
2678
2689
|
let O = o.cells.filter((e) => e.rowSpan > 1).sort((e, t) => e.rowSpan - t.rowSpan);
|
|
2679
2690
|
for (let e of O) {
|
|
2680
|
-
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
2691
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + vn(s, e.row, t), r = b.get(e) - n;
|
|
2681
2692
|
if (r <= 0) continue;
|
|
2682
2693
|
let i = R(Array.from({ length: e.rowSpan }, () => 1), r);
|
|
2683
2694
|
for (let n = e.row; n < t; n++) E[n] += i[n - e.row];
|
|
@@ -2728,41 +2739,41 @@ function bn(e, t, n, r, i, a) {
|
|
|
2728
2739
|
}, t.unclampedHeight = E[e];
|
|
2729
2740
|
}
|
|
2730
2741
|
for (let e of o.cells) {
|
|
2731
|
-
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
2732
|
-
e.node.children.some((e) => !
|
|
2742
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + vn(s, e.row, t);
|
|
2743
|
+
e.node.children.some((e) => !z(e.style) && e.style.height?.kind === "percent") && n !== b.get(e) && B(e.node, x.get(e), n, 0, 0, "fill", a, {
|
|
2733
2744
|
width: x.get(e),
|
|
2734
2745
|
height: n
|
|
2735
|
-
}),
|
|
2746
|
+
}), Cn(e.node, n - (e.node.naturalContentHeight ?? e.node.localRect.height)), e.node.localRect = {
|
|
2736
2747
|
x: g[e.col],
|
|
2737
2748
|
y: 0,
|
|
2738
2749
|
width: e.node.localRect.width,
|
|
2739
2750
|
height: n
|
|
2740
2751
|
};
|
|
2741
2752
|
}
|
|
2742
|
-
for (let t of e.children)
|
|
2753
|
+
for (let t of e.children) z(t.style) && (t.staticSlot = {
|
|
2743
2754
|
kind: "block",
|
|
2744
2755
|
x: d,
|
|
2745
2756
|
y: f
|
|
2746
2757
|
});
|
|
2747
|
-
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + M), s.collapsed && l > 0 && u > 0 && (e.decorationRuns =
|
|
2758
|
+
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + M), s.collapsed && l > 0 && u > 0 && (e.decorationRuns = wn(s, o, h, E, g, A, d, f, S(e.style.glyphSet))), e.style.captionSide === "bottom" ? M + y : M;
|
|
2748
2759
|
}
|
|
2749
|
-
function
|
|
2760
|
+
function Cn(e, t) {
|
|
2750
2761
|
if (t <= 0) return;
|
|
2751
2762
|
let n = e.style.verticalAlign, r = n === "center" ? Math.floor(t / 2) : n === "end" ? t : 0;
|
|
2752
|
-
if (!e.children.some((e) => !
|
|
2763
|
+
if (!e.children.some((e) => !z(e.style) && !e.inlineBox)) {
|
|
2753
2764
|
e.resolvedPadding.top += r, e.resolvedPadding.bottom += t - r;
|
|
2754
2765
|
return;
|
|
2755
2766
|
}
|
|
2756
|
-
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (
|
|
2767
|
+
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (z(t.style) ? t.staticSlot?.kind === "block" && (t.staticSlot.y += r) : t.localRect.y += r);
|
|
2757
2768
|
}
|
|
2758
|
-
function
|
|
2769
|
+
function wn(e, t, n, r, i, a, o, s, c) {
|
|
2759
2770
|
let l = t.columnCount, u = t.rows.length, d = [], f = (t) => t < l ? i[t] - e.vLines[t] : i[l - 1] + n[l - 1], p = (t) => t < u ? a[t] - e.hLines[t] : a[u - 1] + r[u - 1];
|
|
2760
2771
|
for (let t = 0; t <= l; t++) {
|
|
2761
2772
|
let n = e.vSegments[t];
|
|
2762
2773
|
for (let e = 0; e < u; e++) {
|
|
2763
2774
|
let i = n[e];
|
|
2764
2775
|
if (!i) continue;
|
|
2765
|
-
let l =
|
|
2776
|
+
let l = me(i.style, "v", c);
|
|
2766
2777
|
for (let n = 0; n < i.width; n++) for (let c = a[e]; c < a[e] + r[e]; c++) d.push({
|
|
2767
2778
|
glyph: l,
|
|
2768
2779
|
x: o + f(t) + n,
|
|
@@ -2777,7 +2788,7 @@ function Sn(e, t, n, r, i, a, o, s, c) {
|
|
|
2777
2788
|
for (let e = 0; e < l; e++) {
|
|
2778
2789
|
let a = r[e];
|
|
2779
2790
|
if (!a) continue;
|
|
2780
|
-
let l =
|
|
2791
|
+
let l = me(a.style, "h", c);
|
|
2781
2792
|
for (let r = 0; r < a.width; r++) d.push({
|
|
2782
2793
|
glyph: l,
|
|
2783
2794
|
x: o + i[e],
|
|
@@ -2796,7 +2807,7 @@ function Sn(e, t, n, r, i, a, o, s, c) {
|
|
|
2796
2807
|
m
|
|
2797
2808
|
].filter((e) => e !== null);
|
|
2798
2809
|
if (h.length === 0) continue;
|
|
2799
|
-
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width &&
|
|
2810
|
+
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width && pn[t.style] > pn[e.style] ? t : e), v = he(g, r !== null, i !== null, a !== null, m !== null, c);
|
|
2800
2811
|
for (let r = 0; r < e.vLines[t]; r++) for (let i = 0; i < e.hLines[n]; i++) d.push({
|
|
2801
2812
|
glyph: v,
|
|
2802
2813
|
x: o + f(t) + r,
|
|
@@ -2809,30 +2820,30 @@ function Sn(e, t, n, r, i, a, o, s, c) {
|
|
|
2809
2820
|
}
|
|
2810
2821
|
//#endregion
|
|
2811
2822
|
//#region src/positioning.ts
|
|
2812
|
-
function
|
|
2823
|
+
function Tn(e) {
|
|
2813
2824
|
return e.position === "absolute" || e.position === "fixed" ? "absolute" : e.position === "relative" || e.position === "sticky" ? "relative" : "static";
|
|
2814
2825
|
}
|
|
2815
|
-
function
|
|
2826
|
+
function En(e, t, n, r, i) {
|
|
2816
2827
|
for (let a of e.children) {
|
|
2817
|
-
let o =
|
|
2828
|
+
let o = Tn(a.style);
|
|
2818
2829
|
if (o === "relative") {
|
|
2819
2830
|
let t = e.localRect.width - e.style.border.left - e.style.border.right - e.resolvedPadding.left - e.resolvedPadding.right, n = e.localRect.height - e.style.border.top - e.style.border.bottom - e.resolvedPadding.top - e.resolvedPadding.bottom;
|
|
2820
|
-
a.localRect.x +=
|
|
2821
|
-
} else o === "absolute" &&
|
|
2822
|
-
|
|
2831
|
+
a.localRect.x += Dn(a.style.insets.left, a.style.insets.right, t), a.localRect.y += Dn(a.style.insets.top, a.style.insets.bottom, n);
|
|
2832
|
+
} else o === "absolute" && kn(a, e, t, n, r, i);
|
|
2833
|
+
En(a, t + a.localRect.x, n + a.localRect.y, [...r, {
|
|
2823
2834
|
node: a,
|
|
2824
2835
|
absX: t + a.localRect.x,
|
|
2825
2836
|
absY: n + a.localRect.y
|
|
2826
2837
|
}], i);
|
|
2827
2838
|
}
|
|
2828
2839
|
}
|
|
2829
|
-
function
|
|
2830
|
-
return e === null ? t === null ? 0 : -
|
|
2840
|
+
function Dn(e, t, n) {
|
|
2841
|
+
return e === null ? t === null ? 0 : -U(t, n) : U(e, n);
|
|
2831
2842
|
}
|
|
2832
|
-
function
|
|
2843
|
+
function On(e, t) {
|
|
2833
2844
|
if (!t) for (let t = e.length - 1; t > 0; t--) {
|
|
2834
2845
|
let n = e[t];
|
|
2835
|
-
if (!
|
|
2846
|
+
if (!Ln(n.node.style)) continue;
|
|
2836
2847
|
let r = n.node.style.border;
|
|
2837
2848
|
return {
|
|
2838
2849
|
x: n.absX + r.left,
|
|
@@ -2849,44 +2860,44 @@ function En(e, t) {
|
|
|
2849
2860
|
height: n.node.localRect.height
|
|
2850
2861
|
};
|
|
2851
2862
|
}
|
|
2852
|
-
function
|
|
2853
|
-
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s &&
|
|
2863
|
+
function kn(e, t, n, r, i, a) {
|
|
2864
|
+
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s && Ln(t.style) ? {
|
|
2854
2865
|
x: n + c.area.x,
|
|
2855
2866
|
y: r + c.area.y,
|
|
2856
2867
|
width: c.area.width,
|
|
2857
2868
|
height: c.area.height
|
|
2858
|
-
} :
|
|
2859
|
-
if (!y) C.width =
|
|
2860
|
-
else if (u !== null && d !== null) C.width =
|
|
2869
|
+
} : On(i, s), u = o.insets.left === null ? null : U(o.insets.left, l.width), d = o.insets.right === null ? null : U(o.insets.right, l.width), f = o.insets.top === null ? null : U(o.insets.top, l.height), p = o.insets.bottom === null ? null : U(o.insets.bottom, l.height), m = W(o.margin, l.width), h = m.left ?? 0, g = m.right ?? 0, _ = m.top ?? 0, v = m.bottom ?? 0, y = o.width === void 0 || o.width.kind === "auto", b = o.height === void 0 || o.height.kind === "auto", x = Kn(o.minWidth, l.width, e, a) ?? 0, S = Kn(o.maxWidth, l.width, e, a), C = {};
|
|
2870
|
+
if (!y) C.width = V(K(o.width, l.width, e, a), x, S);
|
|
2871
|
+
else if (u !== null && d !== null) C.width = V(Math.max(0, l.width - u - d - h - g), x, S);
|
|
2861
2872
|
else {
|
|
2862
2873
|
let t = Math.max(0, l.width - (u ?? 0) - (d ?? 0) - h - g);
|
|
2863
|
-
C.width =
|
|
2874
|
+
C.width = V(Math.min(q(e, a), Math.max(Y(e, a), t)), x, S);
|
|
2864
2875
|
}
|
|
2865
|
-
f !== null && p !== null && b && (C.height =
|
|
2876
|
+
f !== null && p !== null && b && (C.height = V(Math.max(0, l.height - f - p - _ - v), G(o.minHeight, l.height) ?? 0, G(o.maxHeight, l.height))), B(e, l.width, l.height, 0, 0, "shrink", a, C);
|
|
2866
2877
|
let w = e.localRect.width, T = e.localRect.height, E;
|
|
2867
2878
|
if (u !== null && d !== null) {
|
|
2868
2879
|
let e = Math.max(0, l.width - u - d - w - h - g), t = m.left === null && m.right === null;
|
|
2869
2880
|
E = l.x + u + h + (t ? Math.floor(e / 2) : m.left === null ? e : 0);
|
|
2870
|
-
} else E = u === null ? d === null ?
|
|
2881
|
+
} else E = u === null ? d === null ? Pn(e, t, n, w) : l.x + l.width - d - w - g : l.x + u + h;
|
|
2871
2882
|
let D;
|
|
2872
2883
|
if (f !== null && p !== null) {
|
|
2873
2884
|
let e = Math.max(0, l.height - f - p - T - _ - v), t = m.top === null && m.bottom === null;
|
|
2874
2885
|
D = l.y + f + _ + (t ? Math.floor(e / 2) : m.top === null ? e : 0);
|
|
2875
|
-
} else D = f === null ? p === null ?
|
|
2886
|
+
} else D = f === null ? p === null ? Fn(e, t, r, T) : l.y + l.height - p - T - v : l.y + f + _;
|
|
2876
2887
|
e.localRect = {
|
|
2877
2888
|
...e.localRect,
|
|
2878
2889
|
x: E - n,
|
|
2879
2890
|
y: D - r
|
|
2880
2891
|
};
|
|
2881
2892
|
}
|
|
2882
|
-
function
|
|
2893
|
+
function An(e, t, n) {
|
|
2883
2894
|
return L(e, [n], Math.max(0, t - n))[0];
|
|
2884
2895
|
}
|
|
2885
|
-
function
|
|
2886
|
-
return
|
|
2896
|
+
function jn(e, t, n, r) {
|
|
2897
|
+
return Xe(Ye(e, t), n, r);
|
|
2887
2898
|
}
|
|
2888
|
-
function
|
|
2889
|
-
let a =
|
|
2899
|
+
function Mn(e, t, n, r, i) {
|
|
2900
|
+
let a = W(e.style.margin, n.innerWidth), [o, s, c, l] = r === "x" ? [
|
|
2890
2901
|
a.left ?? 0,
|
|
2891
2902
|
a.right ?? 0,
|
|
2892
2903
|
n.innerWidth,
|
|
@@ -2897,10 +2908,10 @@ function An(e, t, n, r, i) {
|
|
|
2897
2908
|
n.innerHeight,
|
|
2898
2909
|
n.direction === "column"
|
|
2899
2910
|
], u = i + o + s;
|
|
2900
|
-
return (l ?
|
|
2911
|
+
return (l ? An(et(t.style), c, u) : jn(e, t, c, u)) + o;
|
|
2901
2912
|
}
|
|
2902
|
-
function
|
|
2903
|
-
let a =
|
|
2913
|
+
function Nn(e, t, n, r, i) {
|
|
2914
|
+
let a = W(e.style.margin, n.width), o = e.style.justifySelf === "auto" ? t.style.justifyItems : e.style.justifySelf, [s, c, l, u] = r === "x" ? [
|
|
2904
2915
|
a.left ?? 0,
|
|
2905
2916
|
a.right ?? 0,
|
|
2906
2917
|
n.width,
|
|
@@ -2909,37 +2920,37 @@ function jn(e, t, n, r, i) {
|
|
|
2909
2920
|
a.top ?? 0,
|
|
2910
2921
|
a.bottom ?? 0,
|
|
2911
2922
|
n.height,
|
|
2912
|
-
|
|
2923
|
+
Ye(e, t)
|
|
2913
2924
|
];
|
|
2914
|
-
return
|
|
2925
|
+
return Xe(u, l, i + s + c) + s;
|
|
2915
2926
|
}
|
|
2916
|
-
function
|
|
2927
|
+
function Pn(e, t, n, r) {
|
|
2917
2928
|
let i = e.staticSlot;
|
|
2918
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x +
|
|
2929
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x + Nn(e, t, i.staticArea, "x", r) : n + i.originX + Mn(e, t, i, "x", r);
|
|
2919
2930
|
}
|
|
2920
|
-
function
|
|
2931
|
+
function Fn(e, t, n, r) {
|
|
2921
2932
|
let i = e.staticSlot;
|
|
2922
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y +
|
|
2933
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y + Nn(e, t, i.staticArea, "y", r) : n + i.originY + Mn(e, t, i, "y", r);
|
|
2923
2934
|
}
|
|
2924
2935
|
//#endregion
|
|
2925
2936
|
//#region src/layout.ts
|
|
2926
|
-
function
|
|
2927
|
-
let n =
|
|
2928
|
-
|
|
2937
|
+
function In(e, t) {
|
|
2938
|
+
let n = Rn();
|
|
2939
|
+
B(e, t, void 0, 0, 0, "fill", n), En(e, 0, 0, [{
|
|
2929
2940
|
node: e,
|
|
2930
2941
|
absX: 0,
|
|
2931
2942
|
absY: 0
|
|
2932
2943
|
}], n);
|
|
2933
|
-
let r = e.localRect.height, i =
|
|
2944
|
+
let r = e.localRect.height, i = Zn(e);
|
|
2934
2945
|
return e.localRect.width = Math.max(e.localRect.width, i.x), e.localRect.height = Math.max(r, i.y), { height: r };
|
|
2935
2946
|
}
|
|
2936
|
-
function
|
|
2947
|
+
function z(e) {
|
|
2937
2948
|
return e.position === "absolute" || e.position === "fixed";
|
|
2938
2949
|
}
|
|
2939
|
-
function
|
|
2950
|
+
function Ln(e) {
|
|
2940
2951
|
return e.position !== "static";
|
|
2941
2952
|
}
|
|
2942
|
-
function
|
|
2953
|
+
function Rn() {
|
|
2943
2954
|
return {
|
|
2944
2955
|
maxContent: /* @__PURE__ */ new WeakMap(),
|
|
2945
2956
|
minContent: /* @__PURE__ */ new WeakMap(),
|
|
@@ -2947,46 +2958,49 @@ function In() {
|
|
|
2947
2958
|
tableData: /* @__PURE__ */ new WeakMap()
|
|
2948
2959
|
};
|
|
2949
2960
|
}
|
|
2950
|
-
function
|
|
2961
|
+
function B(e, t, n, r, i, a, o, s) {
|
|
2951
2962
|
let c = e.style, l = s?.height;
|
|
2952
2963
|
delete e.decorationRuns, delete e.multicolGeometry, delete e.multicolFlow, delete e.multicolFlowSpan, delete e.textExtent;
|
|
2953
|
-
let u =
|
|
2954
|
-
s?.gutter?.right && (m.right =
|
|
2955
|
-
let
|
|
2956
|
-
top:
|
|
2957
|
-
right:
|
|
2958
|
-
bottom:
|
|
2959
|
-
left:
|
|
2964
|
+
let u = Kn(c.minWidth, t, e, o) ?? 0, d = Kn(c.maxWidth, t, e, o), f = G(c.minHeight, n) ?? 0, p = G(c.maxHeight, n), m = it(c), h = rt(c);
|
|
2965
|
+
s?.gutter?.right && (m.right = h.right), s?.gutter?.bottom && (m.bottom = h.bottom);
|
|
2966
|
+
let g = {
|
|
2967
|
+
top: U(c.padding.top, t),
|
|
2968
|
+
right: U(c.padding.right, t) + m.right,
|
|
2969
|
+
bottom: U(c.padding.bottom, t) + m.bottom,
|
|
2970
|
+
left: U(c.padding.left, t)
|
|
2960
2971
|
};
|
|
2961
|
-
e.resolvedPadding =
|
|
2962
|
-
let
|
|
2972
|
+
e.resolvedPadding = g;
|
|
2973
|
+
let _ = s?.width ?? V(Xn(c, t, a, e, o), u, d), v = er(c, n), y = rr(_, l ?? v ?? (f > 0 ? f : void 0) ?? Infinity, c.border, g), b = l !== void 0 || v !== void 0, x = p === void 0 ? void 0 : Math.max(0, p - c.border.top - c.border.bottom - g.top - g.bottom), S = Bn(e), C = (t, n) => {
|
|
2963
2974
|
let r = n && Number.isFinite(t) ? t : void 0;
|
|
2964
|
-
return
|
|
2965
|
-
},
|
|
2966
|
-
!
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2975
|
+
return S ? zn(e, y.width, t, r, x, g, o) : c.display === "flex" && c.flexDirection === "row" ? Ue(e, y.width, t, r, c.border, g, o) : c.display === "flex" ? Ge(e, y.width, t, n, c.border, g, o) : c.display === "grid" ? ct(e, y.width, t, c.border, g, o) : c.display === "table" ? Sn(e, y.width, r, c.border, g, o) : c.display === "multicol" ? en(e, y.width, r, x, c.border, g, o) : qn(e, y.width, r, c.border, g, o);
|
|
2976
|
+
}, w = C(y.height, b);
|
|
2977
|
+
if (!S && (c.display === "flex" || c.display === "grid") && !b && p !== void 0) {
|
|
2978
|
+
let e = c.border.top + c.border.bottom + g.top + g.bottom, t = V(w + e, f, p) - e;
|
|
2979
|
+
t < w && (w = C(Math.max(0, t), !0));
|
|
2980
|
+
}
|
|
2981
|
+
let T = w + c.border.top + c.border.bottom + g.top + g.bottom, E = l ?? v ?? T;
|
|
2982
|
+
e.unclampedHeight = E, e.naturalContentHeight = T;
|
|
2983
|
+
let D = V(E, f, p), O = e.multicolGeometry;
|
|
2984
|
+
if (O) {
|
|
2985
|
+
let t = D - c.border.top - c.border.bottom - g.top - g.bottom;
|
|
2986
|
+
t > O.totalRows && (g.bottom += t - O.totalRows), Zt(e, O, c.border, g);
|
|
2973
2987
|
}
|
|
2974
2988
|
if (e.localRect = {
|
|
2975
2989
|
x: r,
|
|
2976
2990
|
y: i,
|
|
2977
|
-
width:
|
|
2978
|
-
height:
|
|
2979
|
-
},
|
|
2980
|
-
let l =
|
|
2991
|
+
width: _,
|
|
2992
|
+
height: D
|
|
2993
|
+
}, nt(c.overflow.x) || nt(c.overflow.y)) {
|
|
2994
|
+
let l = Zn(e), u = Math.max(0, l.x - c.border.left - g.left), d = Math.max(0, l.y - c.border.top - g.top), f = Math.max(0, _ - c.border.left - c.border.right - g.left - g.right), p = Math.max(0, D - c.border.top - c.border.bottom - g.top - g.bottom);
|
|
2981
2995
|
if (e.scrollRange = {
|
|
2982
2996
|
sizeX: u,
|
|
2983
2997
|
sizeY: d,
|
|
2984
|
-
maxX:
|
|
2985
|
-
maxY:
|
|
2998
|
+
maxX: nt(c.overflow.x) ? Math.max(0, u - f) : 0,
|
|
2999
|
+
maxY: nt(c.overflow.y) ? Math.max(0, d - p) : 0
|
|
2986
3000
|
}, !s?.gutter && c.scrollbarWidth !== "none") {
|
|
2987
3001
|
let l = c.overflow.y === "auto" && e.scrollRange.maxY > 0, u = c.overflow.x === "auto" && e.scrollRange.maxX > 0;
|
|
2988
3002
|
if (l || u) {
|
|
2989
|
-
|
|
3003
|
+
B(e, t, n, r, i, a, o, {
|
|
2990
3004
|
...s,
|
|
2991
3005
|
gutter: {
|
|
2992
3006
|
right: l,
|
|
@@ -3002,33 +3016,33 @@ function V(e, t, n, r, i, a, o, s) {
|
|
|
3002
3016
|
};
|
|
3003
3017
|
} else delete e.scrollRange, delete e.scrollGutterCells;
|
|
3004
3018
|
}
|
|
3005
|
-
function
|
|
3019
|
+
function zn(e, t, n, r, i, a, o) {
|
|
3006
3020
|
let s = e.style, c;
|
|
3007
3021
|
if (e.text) {
|
|
3008
3022
|
let l = e.children.filter((e) => e.inlineBox);
|
|
3009
|
-
|
|
3023
|
+
Fe(e.text, (n, r) => {
|
|
3010
3024
|
let i = l[r];
|
|
3011
|
-
|
|
3025
|
+
B(i, t, void 0, 0, 0, "shrink", o), e.advances[n] = Math.max(1, i.localRect.width);
|
|
3012
3026
|
});
|
|
3013
3027
|
let u, d;
|
|
3014
3028
|
if (s.display === "multicol") {
|
|
3015
|
-
let n =
|
|
3029
|
+
let n = H(s, "x", t), o = Ut(s, t, n);
|
|
3016
3030
|
a.right += o.leftover;
|
|
3017
|
-
let c =
|
|
3031
|
+
let c = Gt(e, o, n, Vt(r, i));
|
|
3018
3032
|
e.multicolGeometry = c, u = c, d = c.lineX;
|
|
3019
|
-
} else u =
|
|
3033
|
+
} else u = Hn(e, t);
|
|
3020
3034
|
if (c = u.totalRows, e.textExtent = {
|
|
3021
3035
|
width: u.spans.reduce((t, n) => Math.max(t, I(n.start, n.end, e.advances, s.tracking)), 0),
|
|
3022
3036
|
rows: u.totalRows
|
|
3023
|
-
},
|
|
3037
|
+
}, Vn(e, u, t, n, a), l.length > 0) {
|
|
3024
3038
|
let t = (e) => u.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
3025
|
-
|
|
3039
|
+
Fe(e.text, (n, r) => {
|
|
3026
3040
|
let i = t(n);
|
|
3027
3041
|
if (i === -1) return;
|
|
3028
3042
|
let o = u.spans[i];
|
|
3029
3043
|
l[r].localRect = {
|
|
3030
3044
|
...l[r].localRect,
|
|
3031
|
-
x: s.border.left + a.left + (d?.[i] ?? 0) +
|
|
3045
|
+
x: s.border.left + a.left + (d?.[i] ?? 0) + Me(o.start, n, e.advances),
|
|
3032
3046
|
y: s.border.top + a.top + u.lineY[i]
|
|
3033
3047
|
};
|
|
3034
3048
|
});
|
|
@@ -3036,7 +3050,7 @@ function Ln(e, t, n, r, i, a, o) {
|
|
|
3036
3050
|
} else c = e.intrinsicHeight;
|
|
3037
3051
|
for (let n of e.children) {
|
|
3038
3052
|
if (n.inlineBox) continue;
|
|
3039
|
-
let e =
|
|
3053
|
+
let e = W(n.style.margin, t);
|
|
3040
3054
|
n.staticSlot = {
|
|
3041
3055
|
kind: "block",
|
|
3042
3056
|
x: s.border.left + a.left + (e.left ?? 0),
|
|
@@ -3045,30 +3059,30 @@ function Ln(e, t, n, r, i, a, o) {
|
|
|
3045
3059
|
}
|
|
3046
3060
|
return c;
|
|
3047
3061
|
}
|
|
3048
|
-
function
|
|
3049
|
-
return e.children.some((e) => !
|
|
3062
|
+
function Bn(e) {
|
|
3063
|
+
return e.children.some((e) => !z(e.style) && !e.inlineBox) ? !1 : e.text !== "" || e.style.display !== "flex" && e.style.display !== "grid";
|
|
3050
3064
|
}
|
|
3051
|
-
function
|
|
3065
|
+
function V(e, t, n) {
|
|
3052
3066
|
return Math.max(t, n === void 0 ? e : Math.min(e, n));
|
|
3053
3067
|
}
|
|
3054
|
-
function
|
|
3068
|
+
function Vn(e, t, n, r, i) {
|
|
3055
3069
|
let a = e.style;
|
|
3056
3070
|
if (a.display !== "flex" && a.display !== "grid" || t.spans.length === 0) return;
|
|
3057
3071
|
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t, I(n.start, n.end, e.advances, a.tracking)), 0), c = Math.max(0, n - s);
|
|
3058
3072
|
if (c > 0) {
|
|
3059
|
-
let e = a.display === "grid" ?
|
|
3073
|
+
let e = a.display === "grid" ? Xe(a.justifyItems, n, s) : o ? Xe(a.alignItems, n, s) : L(et(a), [s], c)[0];
|
|
3060
3074
|
e > 0 && (i.left += e, i.right += c - e);
|
|
3061
3075
|
}
|
|
3062
3076
|
if (Number.isFinite(r)) {
|
|
3063
3077
|
let e = Math.max(0, r - t.totalRows);
|
|
3064
3078
|
if (e > 0) {
|
|
3065
|
-
let n = a.display === "grid" || !o ?
|
|
3079
|
+
let n = a.display === "grid" || !o ? Xe(a.alignItems, r, t.totalRows) : L(et(a), [t.totalRows], e)[0];
|
|
3066
3080
|
n > 0 && (i.top += n, i.bottom += e - n);
|
|
3067
3081
|
}
|
|
3068
3082
|
}
|
|
3069
3083
|
}
|
|
3070
|
-
function
|
|
3071
|
-
let n =
|
|
3084
|
+
function Hn(e, t) {
|
|
3085
|
+
let n = Un(e, t), { heights: r, textOffsets: i } = Wn(e, n), a = [], o = [], s = 0;
|
|
3072
3086
|
for (let t = 0; t < n.length; t++) a.push(s), o.push(s + i[t]), s += r[t] + (t < n.length - 1 ? e.style.lineGap : 0);
|
|
3073
3087
|
return {
|
|
3074
3088
|
spans: n,
|
|
@@ -3077,14 +3091,14 @@ function Bn(e, t) {
|
|
|
3077
3091
|
totalRows: s
|
|
3078
3092
|
};
|
|
3079
3093
|
}
|
|
3080
|
-
function
|
|
3081
|
-
return e.style.whiteSpace === "normal" ?
|
|
3094
|
+
function Un(e, t) {
|
|
3095
|
+
return e.style.whiteSpace === "normal" ? je(e.text, t, {
|
|
3082
3096
|
advances: e.advances,
|
|
3083
3097
|
tracking: e.style.tracking,
|
|
3084
3098
|
firstLineIndent: e.style.textIndent
|
|
3085
|
-
}) :
|
|
3099
|
+
}) : Ae(e.text);
|
|
3086
3100
|
}
|
|
3087
|
-
function
|
|
3101
|
+
function Wn(e, t) {
|
|
3088
3102
|
let n = e.children.filter((e) => e.inlineBox), r = [], i = [], a = 0;
|
|
3089
3103
|
for (let o of t) {
|
|
3090
3104
|
let t = 1, s = 0;
|
|
@@ -3100,15 +3114,15 @@ function Hn(e, t) {
|
|
|
3100
3114
|
textOffsets: i
|
|
3101
3115
|
};
|
|
3102
3116
|
}
|
|
3103
|
-
function
|
|
3104
|
-
let r =
|
|
3117
|
+
function H(e, t, n) {
|
|
3118
|
+
let r = U(t === "x" ? e.gapX : e.gapY, n), i = t === "x" ? e.ruleX : e.ruleY;
|
|
3105
3119
|
return Math.max(r, i?.width ?? 0);
|
|
3106
3120
|
}
|
|
3107
|
-
function
|
|
3108
|
-
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 :
|
|
3121
|
+
function U(e, t) {
|
|
3122
|
+
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 : we(e.percent, t);
|
|
3109
3123
|
}
|
|
3110
|
-
function
|
|
3111
|
-
let n = (e) => e === null ? null :
|
|
3124
|
+
function W(e, t) {
|
|
3125
|
+
let n = (e) => e === null ? null : U(e, t);
|
|
3112
3126
|
return {
|
|
3113
3127
|
top: n(e.top),
|
|
3114
3128
|
right: n(e.right),
|
|
@@ -3116,30 +3130,30 @@ function G(e, t) {
|
|
|
3116
3130
|
left: n(e.left)
|
|
3117
3131
|
};
|
|
3118
3132
|
}
|
|
3119
|
-
function
|
|
3133
|
+
function Gn(e) {
|
|
3120
3134
|
return typeof e == "number" ? e : 0;
|
|
3121
3135
|
}
|
|
3122
|
-
function
|
|
3123
|
-
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 :
|
|
3136
|
+
function G(e, t) {
|
|
3137
|
+
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 : we(e.percent, t);
|
|
3124
3138
|
}
|
|
3125
|
-
function
|
|
3126
|
-
return e === "min-content" || e === "max-content" || e === "fit-content" ?
|
|
3139
|
+
function Kn(e, t, n, r) {
|
|
3140
|
+
return e === "min-content" || e === "max-content" || e === "fit-content" ? K({ kind: e }, t, n, r) : G(e, t);
|
|
3127
3141
|
}
|
|
3128
|
-
function
|
|
3142
|
+
function qn(e, t, n, r, i, a) {
|
|
3129
3143
|
let o = r.left + i.left, s = r.top + i.top, c = s, l = null;
|
|
3130
3144
|
for (let r of e.children) {
|
|
3131
|
-
let e =
|
|
3132
|
-
if (
|
|
3145
|
+
let e = W(r.style.margin, t), i = e.top ?? 0, s = e.bottom ?? 0, u = e.left ?? 0, d = e.right ?? 0;
|
|
3146
|
+
if (z(r.style)) {
|
|
3133
3147
|
r.staticSlot = {
|
|
3134
3148
|
kind: "block",
|
|
3135
3149
|
x: o + u,
|
|
3136
|
-
y: c + (l === null ? i :
|
|
3150
|
+
y: c + (l === null ? i : Yn(l, i))
|
|
3137
3151
|
};
|
|
3138
3152
|
continue;
|
|
3139
3153
|
}
|
|
3140
|
-
|
|
3141
|
-
let f =
|
|
3142
|
-
c += l === null ? i :
|
|
3154
|
+
B(r, Math.max(0, t - u - d), n, 0, 0, "fill", a);
|
|
3155
|
+
let f = Jn(e, t, r.localRect.width);
|
|
3156
|
+
c += l === null ? i : Yn(l, i), r.localRect = {
|
|
3143
3157
|
...r.localRect,
|
|
3144
3158
|
x: o + f,
|
|
3145
3159
|
y: c
|
|
@@ -3147,30 +3161,30 @@ function Gn(e, t, n, r, i, a) {
|
|
|
3147
3161
|
}
|
|
3148
3162
|
return l !== null && (c += l), c - s;
|
|
3149
3163
|
}
|
|
3150
|
-
function
|
|
3164
|
+
function Jn(e, t, n) {
|
|
3151
3165
|
let r = t - n;
|
|
3152
3166
|
return e.left === null && e.right === null ? Math.floor(r / 2) : e.left === null ? r - (e.right ?? 0) : e.left;
|
|
3153
3167
|
}
|
|
3154
|
-
function
|
|
3168
|
+
function Yn(e, t) {
|
|
3155
3169
|
return e >= 0 && t >= 0 ? Math.max(e, t) : e <= 0 && t <= 0 ? Math.min(e, t) : e + t;
|
|
3156
3170
|
}
|
|
3157
|
-
function
|
|
3171
|
+
function Xn(e, t, n, r, i) {
|
|
3158
3172
|
let a = e.width;
|
|
3159
3173
|
if (e.display === "table") {
|
|
3160
|
-
if (!r.children.some((e) => !
|
|
3174
|
+
if (!r.children.some((e) => !z(e.style) && !e.inlineBox)) return a !== void 0 && a.kind !== "auto" ? K(a, t, r, i) : Math.min(t, q(r, i));
|
|
3161
3175
|
if (a !== void 0 && a.kind !== "auto") {
|
|
3162
|
-
let e =
|
|
3163
|
-
return Math.max(e,
|
|
3176
|
+
let e = K(a, t, r, i);
|
|
3177
|
+
return Math.max(e, $n(r, t, i));
|
|
3164
3178
|
}
|
|
3165
|
-
return
|
|
3179
|
+
return xn(r, t, i);
|
|
3166
3180
|
}
|
|
3167
|
-
return a !== void 0 && a.kind !== "auto" ?
|
|
3181
|
+
return a !== void 0 && a.kind !== "auto" ? K(a, t, r, i) : n === "shrink" ? Math.min(t, q(r, i)) : t;
|
|
3168
3182
|
}
|
|
3169
|
-
function
|
|
3183
|
+
function Zn(e) {
|
|
3170
3184
|
let t = 0, n = 0;
|
|
3171
3185
|
for (let r of e.children) {
|
|
3172
3186
|
if (r.style.position === "fixed") continue;
|
|
3173
|
-
let e =
|
|
3187
|
+
let e = Qn(r);
|
|
3174
3188
|
t = Math.max(t, r.localRect.x + e.x), n = Math.max(n, r.localRect.y + e.y);
|
|
3175
3189
|
}
|
|
3176
3190
|
if (e.textExtent) {
|
|
@@ -3182,75 +3196,81 @@ function Yn(e) {
|
|
|
3182
3196
|
y: n
|
|
3183
3197
|
};
|
|
3184
3198
|
}
|
|
3185
|
-
function
|
|
3199
|
+
function Qn(e) {
|
|
3186
3200
|
let { width: t, height: n } = e.localRect, r = e.style.overflow.x !== "visible", i = e.style.overflow.y !== "visible";
|
|
3187
3201
|
if (r && i) return {
|
|
3188
3202
|
x: t,
|
|
3189
3203
|
y: n
|
|
3190
3204
|
};
|
|
3191
|
-
let a =
|
|
3205
|
+
let a = Zn(e);
|
|
3192
3206
|
return {
|
|
3193
3207
|
x: r ? t : Math.max(t, a.x),
|
|
3194
3208
|
y: i ? n : Math.max(n, a.y)
|
|
3195
3209
|
};
|
|
3196
3210
|
}
|
|
3197
|
-
function
|
|
3211
|
+
function $n(e, t, n) {
|
|
3198
3212
|
let r = e.style;
|
|
3199
|
-
return
|
|
3213
|
+
return bn(e, n).min + r.border.left + r.border.right + U(r.padding.left, t) + U(r.padding.right, t) + it(r).right;
|
|
3200
3214
|
}
|
|
3201
|
-
function
|
|
3215
|
+
function er(e, t) {
|
|
3202
3216
|
if (e.height?.kind === "cells") return e.height.value;
|
|
3203
|
-
if (e.height?.kind === "percent" && t != null) return
|
|
3217
|
+
if (e.height?.kind === "percent" && t != null) return we(e.height.value, t);
|
|
3204
3218
|
}
|
|
3205
|
-
function
|
|
3219
|
+
function K(e, t, n, r) {
|
|
3206
3220
|
switch (e.kind) {
|
|
3207
3221
|
case "cells": return e.value;
|
|
3208
|
-
case "percent": return
|
|
3222
|
+
case "percent": return we(e.value, t);
|
|
3209
3223
|
case "min-content": return Y(n, r);
|
|
3210
|
-
case "max-content": return
|
|
3211
|
-
case "fit-content": return Math.min(
|
|
3212
|
-
case "auto": return
|
|
3224
|
+
case "max-content": return q(n, r);
|
|
3225
|
+
case "fit-content": return Math.min(q(n, r), Math.max(Y(n, r), t));
|
|
3226
|
+
case "auto": return q(n, r);
|
|
3213
3227
|
}
|
|
3214
3228
|
}
|
|
3215
|
-
function
|
|
3229
|
+
function q(e, t) {
|
|
3216
3230
|
let n = t.maxContent.get(e);
|
|
3217
3231
|
if (n !== void 0) return n;
|
|
3218
|
-
let r = e.style, i =
|
|
3232
|
+
let r = e.style, i = tr(e, t) + r.border.left + r.border.right + Gn(r.padding.left) + Gn(r.padding.right) + it(r).right;
|
|
3219
3233
|
return t.maxContent.set(e, i), i;
|
|
3220
3234
|
}
|
|
3221
|
-
function
|
|
3222
|
-
let n = e.children.filter((e) => !
|
|
3223
|
-
if (n.length === 0) return e.style.display === "multicol" ?
|
|
3224
|
-
if (e.style.display === "grid") return
|
|
3225
|
-
if (e.style.display === "table") return
|
|
3235
|
+
function tr(e, t) {
|
|
3236
|
+
let n = e.children.filter((e) => !z(e.style) && !e.inlineBox);
|
|
3237
|
+
if (n.length === 0) return e.style.display === "multicol" ? Bt(e.style, e.intrinsicWidth) : e.intrinsicWidth;
|
|
3238
|
+
if (e.style.display === "grid") return _t(e, t).max;
|
|
3239
|
+
if (e.style.display === "table") return bn(e, t).max;
|
|
3226
3240
|
if (e.style.display === "flex" && e.style.flexDirection === "row") {
|
|
3227
|
-
let r = Math.max(
|
|
3228
|
-
return n.reduce((e, n) => e + J(n, t), 0) + r;
|
|
3241
|
+
let r = Math.max(Gn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
3242
|
+
return n.reduce((e, n) => e + J(n, "max", t), 0) + r;
|
|
3229
3243
|
}
|
|
3230
|
-
let r = n.reduce((e, n) => Math.max(e, J(n, t)), 0);
|
|
3231
|
-
return e.style.display === "multicol" ?
|
|
3244
|
+
let r = n.reduce((e, n) => Math.max(e, J(n, "max", t)), 0);
|
|
3245
|
+
return e.style.display === "multicol" ? Bt(e.style, r) : r;
|
|
3246
|
+
}
|
|
3247
|
+
function J(e, t, n) {
|
|
3248
|
+
let r = e.style, i;
|
|
3249
|
+
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = K(r.width, 0, e, n)), i === void 0 && (i = t === "min" ? Y(e, n) : q(e, n));
|
|
3250
|
+
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
3251
|
+
return Math.max(0, V(i, a, o));
|
|
3232
3252
|
}
|
|
3233
3253
|
function Y(e, t) {
|
|
3234
3254
|
let n = t.minContent.get(e);
|
|
3235
3255
|
if (n !== void 0) return n;
|
|
3236
|
-
let r = e.style, i =
|
|
3256
|
+
let r = e.style, i = nr(e, t) + r.border.left + r.border.right + Gn(r.padding.left) + Gn(r.padding.right) + it(r).right;
|
|
3237
3257
|
return t.minContent.set(e, i), i;
|
|
3238
3258
|
}
|
|
3239
|
-
function
|
|
3240
|
-
let n = e.children.filter((e) => !
|
|
3241
|
-
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth :
|
|
3259
|
+
function nr(e, t) {
|
|
3260
|
+
let n = e.children.filter((e) => !z(e.style) && !e.inlineBox);
|
|
3261
|
+
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth : Pe(e.text, {
|
|
3242
3262
|
advances: e.advances,
|
|
3243
3263
|
tracking: e.style.tracking
|
|
3244
3264
|
});
|
|
3245
|
-
if (e.style.display === "grid") return
|
|
3246
|
-
if (e.style.display === "table") return
|
|
3265
|
+
if (e.style.display === "grid") return _t(e, t).min;
|
|
3266
|
+
if (e.style.display === "table") return bn(e, t).min;
|
|
3247
3267
|
if (e.style.display === "flex" && e.style.flexDirection === "row" && e.style.flexWrap === "nowrap") {
|
|
3248
|
-
let r = Math.max(
|
|
3249
|
-
return n.reduce((e, n) => e +
|
|
3268
|
+
let r = Math.max(Gn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
3269
|
+
return n.reduce((e, n) => e + J(n, "min", t), 0) + r;
|
|
3250
3270
|
}
|
|
3251
|
-
return n.reduce((e, n) => Math.max(e,
|
|
3271
|
+
return n.reduce((e, n) => Math.max(e, J(n, "min", t)), 0);
|
|
3252
3272
|
}
|
|
3253
|
-
function
|
|
3273
|
+
function rr(e, t, n, r) {
|
|
3254
3274
|
return {
|
|
3255
3275
|
width: Math.max(0, e - n.left - n.right - r.left - r.right),
|
|
3256
3276
|
height: Math.max(0, t - n.top - n.bottom - r.top - r.bottom)
|
|
@@ -3258,38 +3278,38 @@ function tr(e, t, n, r) {
|
|
|
3258
3278
|
}
|
|
3259
3279
|
//#endregion
|
|
3260
3280
|
//#region src/plain-text.ts
|
|
3261
|
-
function
|
|
3262
|
-
return
|
|
3281
|
+
function ir(e) {
|
|
3282
|
+
return ur(e).grid.map((e) => e.join("").trimEnd()).join("\n");
|
|
3263
3283
|
}
|
|
3264
|
-
function
|
|
3265
|
-
let { grid: t, paints: n } =
|
|
3266
|
-
return t.map((e, t) =>
|
|
3284
|
+
function ar(e) {
|
|
3285
|
+
let { grid: t, paints: n } = ur(e);
|
|
3286
|
+
return t.map((e, t) => or(e, n[t]));
|
|
3267
3287
|
}
|
|
3268
|
-
function
|
|
3288
|
+
function or(e, t) {
|
|
3269
3289
|
let n = e.length;
|
|
3270
3290
|
for (; n > 0 && e[n - 1] === " " && t[n - 1]?.backgroundColor === void 0;) n--;
|
|
3271
3291
|
let r = [];
|
|
3272
3292
|
for (let i = 0; i < n; i++) {
|
|
3273
3293
|
let n = t[i], a = r[r.length - 1];
|
|
3274
|
-
a &&
|
|
3294
|
+
a && sr(a, n) ? a.text += e[i] : r.push({
|
|
3275
3295
|
text: e[i],
|
|
3276
3296
|
...n
|
|
3277
3297
|
});
|
|
3278
3298
|
}
|
|
3279
3299
|
return r;
|
|
3280
3300
|
}
|
|
3281
|
-
function
|
|
3301
|
+
function sr(e, t) {
|
|
3282
3302
|
return e.color === t?.color && e.backgroundColor === t?.backgroundColor && e.fontWeight === t?.fontWeight && e.fontStyle === t?.fontStyle && e.textDecorationLine === t?.textDecorationLine && e.opacity === t?.opacity;
|
|
3283
3303
|
}
|
|
3284
|
-
function
|
|
3304
|
+
function cr(e, t) {
|
|
3285
3305
|
e.color !== void 0 && (t.color = e.color), e.backgroundColor !== void 0 && (t.backgroundColor = e.backgroundColor), e.fontWeight !== void 0 && (t.fontWeight = e.fontWeight), e.fontStyle !== void 0 && (t.fontStyle = e.fontStyle), e.textDecorationLine !== void 0 && (t.textDecoration = e.textDecorationLine), e.opacity !== void 0 && (t.opacity = e.opacity);
|
|
3286
3306
|
}
|
|
3287
|
-
function
|
|
3307
|
+
function lr(e) {
|
|
3288
3308
|
return e.color === void 0 && e.backgroundColor === void 0 && e.fontWeight === void 0 && e.fontStyle === void 0 && e.textDecorationLine === void 0 && e.opacity === void 0;
|
|
3289
3309
|
}
|
|
3290
|
-
function
|
|
3310
|
+
function ur(e) {
|
|
3291
3311
|
let t = Math.max(0, e.localRect.width), n = Math.max(0, e.localRect.height), r = Array.from({ length: n }, () => Array.from({ length: t }, () => " ")), i = Array.from({ length: n }, () => Array.from({ length: t }, () => void 0));
|
|
3292
|
-
return
|
|
3312
|
+
return fr(e, 0, 0, (e, a, o, s) => {
|
|
3293
3313
|
if (e >= 0 && e < t && a >= 0 && a < n) {
|
|
3294
3314
|
r[a][e] = o;
|
|
3295
3315
|
let t = i[a][e];
|
|
@@ -3303,11 +3323,11 @@ function cr(e) {
|
|
|
3303
3323
|
paints: i
|
|
3304
3324
|
};
|
|
3305
3325
|
}
|
|
3306
|
-
function
|
|
3326
|
+
function dr(e) {
|
|
3307
3327
|
let t = {};
|
|
3308
3328
|
return e.color && (t.color = e.color), e.backgroundColor && (t.backgroundColor = e.backgroundColor), e.fontWeight !== "400" && e.fontWeight !== "normal" && e.fontWeight !== "" && (t.fontWeight = e.fontWeight), e.fontStyle !== "normal" && e.fontStyle !== "" && (t.fontStyle = e.fontStyle), e.textDecorationLine !== "none" && e.textDecorationLine !== "" && (t.textDecorationLine = e.textDecorationLine), t;
|
|
3309
3329
|
}
|
|
3310
|
-
function
|
|
3330
|
+
function fr(e, t, n, r, i = 1) {
|
|
3311
3331
|
if (e.tableHidden) return;
|
|
3312
3332
|
let a = t + e.localRect.x, o = n + e.localRect.y, s = e.style, c = (e) => i >= 1 ? e : {
|
|
3313
3333
|
...e,
|
|
@@ -3318,7 +3338,7 @@ function ur(e, t, n, r, i = 1) {
|
|
|
3318
3338
|
for (let n = 0; n < e.localRect.height; n++) for (let i = 0; i < e.localRect.width; i++) r(a + i, o + n, " ", t);
|
|
3319
3339
|
}
|
|
3320
3340
|
let l = [];
|
|
3321
|
-
|
|
3341
|
+
ue(s, {
|
|
3322
3342
|
x: a,
|
|
3323
3343
|
y: o,
|
|
3324
3344
|
width: e.localRect.width,
|
|
@@ -3340,9 +3360,9 @@ function ur(e, t, n, r, i = 1) {
|
|
|
3340
3360
|
};
|
|
3341
3361
|
}
|
|
3342
3362
|
if (!e.children.some((e) => !e.inlineBox && e.style.position !== "absolute" && e.style.position !== "fixed") && e.text) {
|
|
3343
|
-
let t = m + s.border.left + u.left, n = h + s.border.top + u.top, r = e.localRect.width - s.border.left - s.border.right - u.left - u.right, i = e.multicolGeometry, { spans: a, textY: o } = i ??
|
|
3363
|
+
let t = m + s.border.left + u.left, n = h + s.border.top + u.top, r = e.localRect.width - s.border.left - s.border.right - u.left - u.right, i = e.multicolGeometry, { spans: a, textY: o } = i ?? Hn(e, r), l = i ? Math.max(1, i.columnWidth - s.tracking) : r, d = c(dr(s)), f = e.inlineElements?.map((e) => c(dr(e)));
|
|
3344
3364
|
for (let r = 0; r < a.length; r++) {
|
|
3345
|
-
let u = a[r], p = n + o[r], m = r === 0 ? s.textIndent : 0, h = s.whiteSpace !== "normal" && s.overflow.x === "clip" ?
|
|
3365
|
+
let u = a[r], p = n + o[r], m = r === 0 ? s.textIndent : 0, h = s.whiteSpace !== "normal" && s.overflow.x === "clip" ? hr(e.text, u, l - m, e.advances, s) : {
|
|
3346
3366
|
end: u.end,
|
|
3347
3367
|
ellipsis: !1
|
|
3348
3368
|
}, _ = I(u.start, u.end, e.advances, s.tracking), v = Math.max(0, l - m - _), y = s.textAlign === "end" ? v : s.textAlign === "center" ? Math.floor(v / 2) : 0, b = t + (i?.lineX[r] ?? 0) + y + m;
|
|
@@ -3351,45 +3371,55 @@ function ur(e, t, n, r, i = 1) {
|
|
|
3351
3371
|
let n = e.charInline?.[t] ?? -1, r = n >= 0 ? e.inlineElements[n] : void 0, i = r?.insets, a = i ? i.left ?? (i.right === null ? 0 : -i.right) : 0, o = i ? i.top ?? (i.bottom === null ? 0 : -i.bottom) : 0;
|
|
3352
3372
|
e.text[t] === "" ? r?.backgroundColor && g(b + a, p + o, " ", c({ backgroundColor: r.backgroundColor })) : g(b + a, p + o, e.text[t], r ? f[n] : d);
|
|
3353
3373
|
}
|
|
3354
|
-
b +=
|
|
3374
|
+
b += Me(t, t + 1, e.advances);
|
|
3355
3375
|
}
|
|
3356
3376
|
h.ellipsis && g(b, p, "…", d);
|
|
3357
3377
|
}
|
|
3358
3378
|
}
|
|
3359
|
-
for (let t of
|
|
3379
|
+
for (let t of pe(e)) fr(t, m, h, g, i * t.style.opacity);
|
|
3360
3380
|
let _ = e.scrollRange;
|
|
3361
3381
|
if (_ && d && (d.right > 0 || d.bottom > 0)) {
|
|
3362
|
-
let { track: t, thumb: n } = j(S(s.glyphSet)), i =
|
|
3363
|
-
if (d.
|
|
3364
|
-
let a
|
|
3365
|
-
for (let e = 0; e <
|
|
3366
|
-
let
|
|
3367
|
-
|
|
3368
|
-
let a = e >= o && e < o + s;
|
|
3369
|
-
r(c, i + e, a ? n : t, a ? h : m);
|
|
3370
|
-
}
|
|
3382
|
+
let { track: t, thumb: n } = j(S(s.glyphSet)), i = (e) => c(e ? { color: e } : void 0), l = i(s.scrollbarColor?.track ?? s.color), u = i(s.scrollbarColor?.thumb ?? s.color), d = pr(e, a, o);
|
|
3383
|
+
if (d.y) {
|
|
3384
|
+
let { col: i, row: a, thick: o, len: s } = d.y, { at: c, len: f } = mr(s, _.sizeY, _.maxY, e.scroll?.y ?? 0);
|
|
3385
|
+
for (let e = 0; e < o; e++) for (let o = 0; o < s; o++) {
|
|
3386
|
+
let s = o >= c && o < c + f;
|
|
3387
|
+
r(i + e, a + o, s ? n : t, s ? u : l);
|
|
3371
3388
|
}
|
|
3372
3389
|
}
|
|
3373
|
-
if (d.
|
|
3374
|
-
let i
|
|
3375
|
-
for (let e = 0; e <
|
|
3376
|
-
let s =
|
|
3377
|
-
|
|
3378
|
-
let i = e >= a && e < a + o;
|
|
3379
|
-
r(l + e, s, i ? n : t, i ? h : m);
|
|
3380
|
-
}
|
|
3390
|
+
if (d.x) {
|
|
3391
|
+
let { col: i, row: a, thick: o, len: s } = d.x, { at: c, len: f } = mr(s, _.sizeX, _.maxX, e.scroll?.x ?? 0);
|
|
3392
|
+
for (let e = 0; e < o; e++) for (let o = 0; o < s; o++) {
|
|
3393
|
+
let s = o >= c && o < c + f;
|
|
3394
|
+
r(i + o, a + e, s ? n : t, s ? u : l);
|
|
3381
3395
|
}
|
|
3382
3396
|
}
|
|
3383
3397
|
}
|
|
3384
3398
|
}
|
|
3385
|
-
function
|
|
3399
|
+
function pr(e, t, n) {
|
|
3400
|
+
let r = e.scrollGutterCells;
|
|
3401
|
+
if (!r) return {};
|
|
3402
|
+
let { border: i, scrollbarSize: a, scrollbarInset: o } = e.style, s = n + i.top, c = t + i.left, l = n + e.localRect.height - i.bottom, u = t + e.localRect.width - i.right, d = r.bottom > 0 ? l - r.bottom : l - o.y, f = r.right > 0 ? u - r.right : u - o.x, p = {};
|
|
3403
|
+
return r.right > 0 && (p.y = {
|
|
3404
|
+
col: u - r.right,
|
|
3405
|
+
row: s + o.y,
|
|
3406
|
+
thick: Math.min(a.y, r.right),
|
|
3407
|
+
len: Math.max(0, d - s - o.y)
|
|
3408
|
+
}), r.bottom > 0 && (p.x = {
|
|
3409
|
+
col: c + o.x,
|
|
3410
|
+
row: l - r.bottom,
|
|
3411
|
+
thick: Math.min(a.x, r.bottom),
|
|
3412
|
+
len: Math.max(0, f - c - o.x)
|
|
3413
|
+
}), p;
|
|
3414
|
+
}
|
|
3415
|
+
function mr(e, t, n, r) {
|
|
3386
3416
|
let i = t > 0 ? Math.min(1, e / t) : 1, a = Math.max(1, Math.round(i * e));
|
|
3387
3417
|
return n > 0 && (a = Math.max(1, Math.min(a, e - n))), {
|
|
3388
3418
|
at: n > 0 ? Math.round(Math.min(r, n) / n * (e - a)) : 0,
|
|
3389
3419
|
len: a
|
|
3390
3420
|
};
|
|
3391
3421
|
}
|
|
3392
|
-
function
|
|
3422
|
+
function hr(e, t, n, r, i) {
|
|
3393
3423
|
let { textOverflow: a, tracking: o } = i;
|
|
3394
3424
|
if (I(t.start, t.end, r, o) <= n) return {
|
|
3395
3425
|
end: t.end,
|
|
@@ -3404,61 +3434,61 @@ function fr(e, t, n, r, i) {
|
|
|
3404
3434
|
}
|
|
3405
3435
|
//#endregion
|
|
3406
3436
|
//#region src/paint.ts
|
|
3407
|
-
var
|
|
3408
|
-
function
|
|
3409
|
-
return
|
|
3410
|
-
}
|
|
3411
|
-
function
|
|
3412
|
-
let r =
|
|
3413
|
-
if (
|
|
3414
|
-
let a =
|
|
3415
|
-
if (a &&
|
|
3416
|
-
|
|
3437
|
+
var gr = /* @__PURE__ */ new WeakMap(), _r = /* @__PURE__ */ new WeakMap();
|
|
3438
|
+
function vr(e) {
|
|
3439
|
+
return xr(e, !0) !== null;
|
|
3440
|
+
}
|
|
3441
|
+
function yr(e, t, n = !1) {
|
|
3442
|
+
let r = ar(e), i = Er(r);
|
|
3443
|
+
if (gr.get(t) === i) return !0;
|
|
3444
|
+
let a = _r.get(t);
|
|
3445
|
+
if (a && br(t, a.nodes, r)) {
|
|
3446
|
+
gr.set(t, i);
|
|
3417
3447
|
for (let e = 0; e < r.length; e++) for (let t = 0; t < r[e].length; t++) {
|
|
3418
3448
|
let n = r[e][t];
|
|
3419
|
-
if (
|
|
3449
|
+
if (lr(n) || sr(n, a.segments[e][t])) continue;
|
|
3420
3450
|
let i = a.nodes[e][t];
|
|
3421
|
-
i.style.cssText = "",
|
|
3451
|
+
i.style.cssText = "", cr(n, i.style);
|
|
3422
3452
|
}
|
|
3423
3453
|
return a.segments = r, !0;
|
|
3424
3454
|
}
|
|
3425
|
-
if (n &&
|
|
3426
|
-
|
|
3455
|
+
if (n && vr(t)) return !1;
|
|
3456
|
+
gr.set(t, i);
|
|
3427
3457
|
let o = document.createDocumentFragment(), s = [];
|
|
3428
3458
|
for (let e = 0; e < r.length; e++) {
|
|
3429
3459
|
e > 0 && o.appendChild(document.createTextNode("\n"));
|
|
3430
3460
|
let t = [];
|
|
3431
3461
|
for (let n of r[e]) {
|
|
3432
|
-
if (
|
|
3462
|
+
if (lr(n)) {
|
|
3433
3463
|
let e = document.createTextNode(n.text);
|
|
3434
3464
|
t.push(e), o.appendChild(e);
|
|
3435
3465
|
continue;
|
|
3436
3466
|
}
|
|
3437
3467
|
let e = document.createElement("span");
|
|
3438
|
-
|
|
3468
|
+
cr(n, e.style), e.textContent = n.text, t.push(e), o.appendChild(e);
|
|
3439
3469
|
}
|
|
3440
3470
|
s.push(t);
|
|
3441
3471
|
}
|
|
3442
|
-
|
|
3472
|
+
_r.set(t, {
|
|
3443
3473
|
nodes: s,
|
|
3444
3474
|
segments: r
|
|
3445
3475
|
});
|
|
3446
|
-
let c =
|
|
3447
|
-
return t.replaceChildren(o), c &&
|
|
3476
|
+
let c = xr(t, !1);
|
|
3477
|
+
return t.replaceChildren(o), c && Sr(t, c), !0;
|
|
3448
3478
|
}
|
|
3449
|
-
function
|
|
3479
|
+
function br(e, t, n) {
|
|
3450
3480
|
if (t.length !== n.length) return !1;
|
|
3451
3481
|
for (let r = 0; r < n.length; r++) {
|
|
3452
3482
|
let i = t[r], a = n[r];
|
|
3453
3483
|
if (i.length !== a.length) return !1;
|
|
3454
3484
|
for (let t = 0; t < a.length; t++) {
|
|
3455
3485
|
let n = i[t];
|
|
3456
|
-
if (
|
|
3486
|
+
if (lr(a[t]) !== (n.nodeType === Node.TEXT_NODE) || n.textContent !== a[t].text || n.parentNode !== e) return !1;
|
|
3457
3487
|
}
|
|
3458
3488
|
}
|
|
3459
3489
|
return !0;
|
|
3460
3490
|
}
|
|
3461
|
-
function
|
|
3491
|
+
function xr(e, t) {
|
|
3462
3492
|
try {
|
|
3463
3493
|
let n = e.ownerDocument.getSelection();
|
|
3464
3494
|
if (!n) return null;
|
|
@@ -3474,7 +3504,7 @@ function vr(e, t) {
|
|
|
3474
3504
|
if (!e || e.rangeCount === 0) return null;
|
|
3475
3505
|
i = e.getRangeAt(0);
|
|
3476
3506
|
}
|
|
3477
|
-
let a =
|
|
3507
|
+
let a = Cr(e, i.startContainer, i.startOffset), o = Cr(e, i.endContainer, i.endOffset);
|
|
3478
3508
|
return a === null || o === null || a === o && !t ? null : {
|
|
3479
3509
|
start: a,
|
|
3480
3510
|
end: o,
|
|
@@ -3484,32 +3514,32 @@ function vr(e, t) {
|
|
|
3484
3514
|
return null;
|
|
3485
3515
|
}
|
|
3486
3516
|
}
|
|
3487
|
-
function
|
|
3517
|
+
function Sr(e, t) {
|
|
3488
3518
|
try {
|
|
3489
|
-
let n =
|
|
3519
|
+
let n = wr(e, t.start), r = wr(e, t.end);
|
|
3490
3520
|
if (!n || !r) return;
|
|
3491
3521
|
let i = e.getRootNode().getSelection?.() ?? e.ownerDocument.getSelection();
|
|
3492
3522
|
t.backward ? i?.setBaseAndExtent(r[0], r[1], n[0], n[1]) : i?.setBaseAndExtent(n[0], n[1], r[0], r[1]);
|
|
3493
3523
|
} catch {}
|
|
3494
3524
|
}
|
|
3495
|
-
function
|
|
3525
|
+
function Cr(e, t, n) {
|
|
3496
3526
|
if (!e.contains(t)) return null;
|
|
3497
3527
|
let r = e.ownerDocument.createRange();
|
|
3498
3528
|
return r.selectNodeContents(e), r.setEnd(t, n), r.toString().length;
|
|
3499
3529
|
}
|
|
3500
|
-
function
|
|
3530
|
+
function wr(e, t) {
|
|
3501
3531
|
let n = t, r = null;
|
|
3502
|
-
for (let t of
|
|
3532
|
+
for (let t of Tr(e)) {
|
|
3503
3533
|
if (n <= t.data.length) return [t, n];
|
|
3504
3534
|
n -= t.data.length, r = [t, t.data.length];
|
|
3505
3535
|
}
|
|
3506
3536
|
return r;
|
|
3507
3537
|
}
|
|
3508
|
-
function*
|
|
3538
|
+
function* Tr(e) {
|
|
3509
3539
|
let t = e.ownerDocument.createTreeWalker(e, NodeFilter.SHOW_TEXT), n = t.nextNode();
|
|
3510
3540
|
for (; n;) yield n, n = t.nextNode();
|
|
3511
3541
|
}
|
|
3512
|
-
function
|
|
3542
|
+
function Er(e) {
|
|
3513
3543
|
let t = [];
|
|
3514
3544
|
for (let n of e) {
|
|
3515
3545
|
for (let e of n) t.push(e.text, e.color ?? "", e.backgroundColor ?? "", e.fontWeight ?? "", e.fontStyle ?? "", e.textDecorationLine ?? "", e.opacity ?? "");
|
|
@@ -3519,9 +3549,9 @@ function Cr(e) {
|
|
|
3519
3549
|
}
|
|
3520
3550
|
//#endregion
|
|
3521
3551
|
//#region src/render.ts
|
|
3522
|
-
function
|
|
3552
|
+
function Dr(e) {
|
|
3523
3553
|
let t = /* @__PURE__ */ new Set();
|
|
3524
|
-
|
|
3554
|
+
Or(e, !0, t);
|
|
3525
3555
|
for (let n of Array.from(e.source.querySelectorAll("[data-mw-inline-inset]"))) if (!t.has(n)) {
|
|
3526
3556
|
n.removeAttribute("data-mw-inline-inset");
|
|
3527
3557
|
let e = n.style;
|
|
@@ -3542,33 +3572,33 @@ function Z(e, t) {
|
|
|
3542
3572
|
function Q(e, t, n) {
|
|
3543
3573
|
e.hasAttribute(t) !== n && (n ? e.setAttribute(t, "") : e.removeAttribute(t));
|
|
3544
3574
|
}
|
|
3545
|
-
function
|
|
3575
|
+
function Or(e, t, n) {
|
|
3546
3576
|
if (e.inlineElements) for (let { element: t, tracking: r, padLeft: i, padRight: a, insets: o } of e.inlineElements) {
|
|
3547
3577
|
let e = t;
|
|
3548
|
-
X(e, "--mw-ls", String(r)), i > 0 ? X(e, "--mw-ipl", String(i)) : Z(e, "--mw-ipl"), a > 0 ? X(e, "--mw-ipr", String(a)) : Z(e, "--mw-ipr"), o && (n.add(t),
|
|
3578
|
+
X(e, "--mw-ls", String(r)), i > 0 ? X(e, "--mw-ipl", String(i)) : Z(e, "--mw-ipl"), a > 0 ? X(e, "--mw-ipr", String(a)) : Z(e, "--mw-ipr"), o && (n.add(t), kr(e, o));
|
|
3549
3579
|
}
|
|
3550
|
-
if (t ||
|
|
3580
|
+
if (t || jr(e), !e.tableHidden) for (let t of pe(e)) {
|
|
3551
3581
|
let r = t.source;
|
|
3552
|
-
t.style.zIndex !== null &&
|
|
3582
|
+
t.style.zIndex !== null && fe(t, e) && !t.inlineBox ? X(r, "--mw-z", String(t.style.zIndex)) : Z(r, "--mw-z"), Or(t, !1, n);
|
|
3553
3583
|
}
|
|
3554
3584
|
}
|
|
3555
|
-
function
|
|
3585
|
+
function kr(e, t) {
|
|
3556
3586
|
Q(e, "data-mw-inline-inset", !0);
|
|
3557
3587
|
let n = (t, n) => {
|
|
3558
3588
|
n === null ? Z(e, t) : X(e, t, String(n));
|
|
3559
3589
|
};
|
|
3560
3590
|
n("--mw-it", t.top), n("--mw-ir", t.right), n("--mw-ib", t.bottom), n("--mw-il", t.left);
|
|
3561
3591
|
}
|
|
3562
|
-
function
|
|
3592
|
+
function Ar(e) {
|
|
3563
3593
|
let t = e.style;
|
|
3564
3594
|
if (t.textAlign !== "center" || !e.text || e.inlineBox || e.children.length > 0) return !1;
|
|
3565
|
-
let n = e.multicolGeometry, r = e.resolvedPadding, i = e.localRect.width - t.border.left - t.border.right - r.left - r.right, a = n ? Math.max(1, n.columnWidth - t.tracking) : i, o = n?.spans ??
|
|
3595
|
+
let n = e.multicolGeometry, r = e.resolvedPadding, i = e.localRect.width - t.border.left - t.border.right - r.left - r.right, a = n ? Math.max(1, n.columnWidth - t.tracking) : i, o = n?.spans ?? Un(e, i);
|
|
3566
3596
|
return o.length !== 0 && o.every((n, r) => {
|
|
3567
3597
|
let i = r === 0 ? t.textIndent : 0, o = a - i - I(n.start, n.end, e.advances, t.tracking);
|
|
3568
3598
|
return o > 0 && o % 2 == 1;
|
|
3569
3599
|
});
|
|
3570
3600
|
}
|
|
3571
|
-
function
|
|
3601
|
+
function jr(e) {
|
|
3572
3602
|
let t = e.source, n = e.localRect, r = e.resolvedPadding, { border: i, textAlignBlocked: a, overflow: o, whiteSpace: s, tracking: c, lineGap: l } = e.style, u = e.multicolFlow, d = e.multicolFlowSpan;
|
|
3573
3603
|
Q(t, "data-mw-laid-out", !e.inlineBox && !u && !d), Q(t, "data-mw-inline-box", !!e.inlineBox), Q(t, "data-mw-multicol-flow", !!u), Q(t, "data-mw-multicol-flow-span", !!d);
|
|
3574
3604
|
let f = u ?? d;
|
|
@@ -3578,107 +3608,111 @@ function Or(e) {
|
|
|
3578
3608
|
let { maxX: n, maxY: r } = e.scrollRange;
|
|
3579
3609
|
X(t, "--mw-se-x", String(n > 0 ? n + e.localRect.width : 1)), X(t, "--mw-se-y", String(r > 0 ? r + e.localRect.height : 1));
|
|
3580
3610
|
} else Z(t, "--mw-se-x"), Z(t, "--mw-se-y");
|
|
3581
|
-
X(t, "--mw-pt", String(r.top)), X(t, "--mw-pr", String(r.right)), X(t, "--mw-pb", String(r.bottom)), X(t, "--mw-pl", String(r.left)), X(t, "--mw-bt", String(i.top)), X(t, "--mw-br", String(i.right)), X(t, "--mw-bb", String(i.bottom)), X(t, "--mw-bl", String(i.left)), X(t, "--mw-ti", String(e.style.textIndent)), Q(t, "data-mw-text-align-blocked", a), Q(t, "data-mw-center-nudge",
|
|
3611
|
+
X(t, "--mw-pt", String(r.top)), X(t, "--mw-pr", String(r.right)), X(t, "--mw-pb", String(r.bottom)), X(t, "--mw-pl", String(r.left)), X(t, "--mw-bt", String(i.top)), X(t, "--mw-br", String(i.right)), X(t, "--mw-bb", String(i.bottom)), X(t, "--mw-bl", String(i.left)), X(t, "--mw-ti", String(e.style.textIndent)), Q(t, "data-mw-text-align-blocked", a), Q(t, "data-mw-center-nudge", Ar(e)), Q(t, "data-mw-dropped-text", !!e.droppedText), Q(t, "data-mw-table-hidden", !!e.tableHidden);
|
|
3582
3612
|
}
|
|
3583
3613
|
//#endregion
|
|
3584
3614
|
//#region src/style.ts
|
|
3585
|
-
function
|
|
3586
|
-
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a =
|
|
3587
|
-
|
|
3588
|
-
let c = r.display ||
|
|
3615
|
+
function Mr(e, t, n) {
|
|
3616
|
+
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a = ei(e) ? e.computedStyleMap() : null, o = e.getAttribute("class") ?? "", s = e.style;
|
|
3617
|
+
Yr(e, o, s);
|
|
3618
|
+
let c = (e, r, i) => _i(a, e, r, o, i, s, n, t) ?? yi(a, e, r, o, i, s, n, t) ?? ui(r, t), l = r.display || Kr[e.tagName] || "", u = qr[l] ?? "none", d = r.columnCount && r.columnCount !== "auto" ? Math.max(1, Math.floor(Number(r.columnCount) || 1)) : null, f = r.columnWidth && r.columnWidth !== "auto" ? parseFloat(r.columnWidth) : NaN, p = Number.isFinite(f) ? Math.max(1, F(f, t)) : null, m = l === "flex" || l === "inline-flex" ? "flex" : l === "grid" || l === "inline-grid" ? "grid" : l === "table" || l === "inline-table" ? "table" : l === "none" || Gr(e, r) ? "none" : d !== null || p !== null ? "multicol" : "block", h = { kind: "none" }, g = { kind: "none" }, _ = [st()], v = [st()], y = {
|
|
3589
3619
|
direction: "row",
|
|
3590
3620
|
dense: !1
|
|
3591
|
-
},
|
|
3592
|
-
if (
|
|
3593
|
-
if (a)
|
|
3621
|
+
}, b = null;
|
|
3622
|
+
if (m === "grid") {
|
|
3623
|
+
if (a) h = Si(a.get("grid-template-columns")?.toString() ?? "", t), g = Si(a.get("grid-template-rows")?.toString() ?? "", t);
|
|
3594
3624
|
else {
|
|
3595
3625
|
e.setAttribute("data-mw-degrid", "");
|
|
3596
3626
|
try {
|
|
3597
|
-
|
|
3627
|
+
h = Si(r.getPropertyValue("grid-template-columns"), t), g = Si(r.getPropertyValue("grid-template-rows"), t);
|
|
3598
3628
|
} finally {
|
|
3599
3629
|
e.removeAttribute("data-mw-degrid");
|
|
3600
3630
|
}
|
|
3601
3631
|
}
|
|
3602
|
-
|
|
3632
|
+
_ = Ei(r.getPropertyValue("grid-auto-columns"), t), v = Ei(r.getPropertyValue("grid-auto-rows"), t), y = Mi(r.getPropertyValue("grid-auto-flow")), b = Ti(r.getPropertyValue("grid-template-areas"));
|
|
3603
3633
|
}
|
|
3604
|
-
let
|
|
3605
|
-
if (
|
|
3634
|
+
let x = "auto", S = !1, C = 0, w = 0;
|
|
3635
|
+
if (m === "table" && (x = r.tableLayout === "fixed" ? "fixed" : "auto", S = r.borderCollapse === "collapse", !S)) {
|
|
3606
3636
|
let e = r.borderSpacing.split(" ");
|
|
3607
|
-
|
|
3608
|
-
}
|
|
3609
|
-
let
|
|
3610
|
-
display:
|
|
3611
|
-
tableRole:
|
|
3612
|
-
tableLayout:
|
|
3613
|
-
borderCollapse:
|
|
3614
|
-
borderSpacingX:
|
|
3615
|
-
borderSpacingY:
|
|
3637
|
+
C = F(parseFloat(e[0] ?? "") || 0, t), w = F(parseFloat(e[1] ?? e[0] ?? "") || 0, t);
|
|
3638
|
+
}
|
|
3639
|
+
let T = {
|
|
3640
|
+
display: m,
|
|
3641
|
+
tableRole: u,
|
|
3642
|
+
tableLayout: x,
|
|
3643
|
+
borderCollapse: S,
|
|
3644
|
+
borderSpacingX: C,
|
|
3645
|
+
borderSpacingY: w,
|
|
3616
3646
|
captionSide: r.captionSide === "bottom" ? "bottom" : "top",
|
|
3617
|
-
verticalAlign:
|
|
3647
|
+
verticalAlign: u === "cell" || l.startsWith("inline-") ? Jr(e, r) : "start",
|
|
3618
3648
|
flexDirection: r.flexDirection.startsWith("column") ? "column" : "row",
|
|
3619
3649
|
flexReverse: r.flexDirection.endsWith("-reverse"),
|
|
3620
3650
|
flexWrap: r.flexWrap.startsWith("wrap") ? "wrap" : "nowrap",
|
|
3621
3651
|
wrapReverse: r.flexWrap === "wrap-reverse",
|
|
3622
3652
|
flexGrow: Number(r.flexGrow) || 0,
|
|
3623
3653
|
flexShrink: r.flexShrink === "" ? 1 : Number(r.flexShrink) || 0,
|
|
3624
|
-
flexBasis:
|
|
3654
|
+
flexBasis: bi(r.flexBasis, t),
|
|
3625
3655
|
order: Number(r.order) || 0,
|
|
3626
|
-
justifyContent:
|
|
3627
|
-
alignContent:
|
|
3628
|
-
alignItems:
|
|
3629
|
-
alignSelf:
|
|
3630
|
-
justifyItems:
|
|
3631
|
-
justifySelf:
|
|
3632
|
-
gridTemplateColumns:
|
|
3633
|
-
gridTemplateRows:
|
|
3634
|
-
gridAutoColumns:
|
|
3635
|
-
gridAutoRows:
|
|
3636
|
-
gridAutoFlow:
|
|
3637
|
-
gridTemplateAreas:
|
|
3638
|
-
gridColumnStart:
|
|
3639
|
-
gridColumnEnd:
|
|
3640
|
-
gridRowStart:
|
|
3641
|
-
gridRowEnd:
|
|
3642
|
-
width:
|
|
3643
|
-
height:
|
|
3644
|
-
minWidth:
|
|
3645
|
-
minHeight:
|
|
3646
|
-
maxWidth:
|
|
3647
|
-
maxHeight:
|
|
3648
|
-
padding:
|
|
3649
|
-
margin:
|
|
3650
|
-
position:
|
|
3651
|
-
insets:
|
|
3652
|
-
gapX: $(r.columnGap === "normal" || r.columnGap === "" ?
|
|
3656
|
+
justifyContent: ti(r.justifyContent),
|
|
3657
|
+
alignContent: ti(r.alignContent),
|
|
3658
|
+
alignItems: ni(r.alignItems),
|
|
3659
|
+
alignSelf: ri(r.alignSelf),
|
|
3660
|
+
justifyItems: ni(r.justifyItems),
|
|
3661
|
+
justifySelf: ri(r.justifySelf),
|
|
3662
|
+
gridTemplateColumns: h,
|
|
3663
|
+
gridTemplateRows: g,
|
|
3664
|
+
gridAutoColumns: _,
|
|
3665
|
+
gridAutoRows: v,
|
|
3666
|
+
gridAutoFlow: y,
|
|
3667
|
+
gridTemplateAreas: b,
|
|
3668
|
+
gridColumnStart: ji(r.getPropertyValue("grid-column-start")),
|
|
3669
|
+
gridColumnEnd: ji(r.getPropertyValue("grid-column-end")),
|
|
3670
|
+
gridRowStart: ji(r.getPropertyValue("grid-row-start")),
|
|
3671
|
+
gridRowEnd: ji(r.getPropertyValue("grid-row-end")),
|
|
3672
|
+
width: pi(a, r.width, "width", t, o, s, n),
|
|
3673
|
+
height: pi(a, r.height, "height", t, o, s, n),
|
|
3674
|
+
minWidth: c("min-width", r.minWidth, "min-w") ?? "auto",
|
|
3675
|
+
minHeight: c("min-height", r.minHeight, "min-h") ?? "auto",
|
|
3676
|
+
maxWidth: c("max-width", r.maxWidth, "max-w"),
|
|
3677
|
+
maxHeight: c("max-height", r.maxHeight, "max-h"),
|
|
3678
|
+
padding: Pi(r, t),
|
|
3679
|
+
margin: ii(r, a, o, s, t),
|
|
3680
|
+
position: si(r.position),
|
|
3681
|
+
insets: ci(r, a, o, s, t),
|
|
3682
|
+
gapX: $(r.columnGap === "normal" || r.columnGap === "" ? m === "multicol" ? `${i}px` : "0px" : r.columnGap, t),
|
|
3653
3683
|
gapY: $(r.rowGap === "normal" ? "0px" : r.rowGap, t),
|
|
3654
|
-
border:
|
|
3684
|
+
border: Fi(r),
|
|
3655
3685
|
borderStyle: {
|
|
3656
|
-
top:
|
|
3657
|
-
right:
|
|
3658
|
-
bottom:
|
|
3659
|
-
left:
|
|
3686
|
+
top: li(r.borderTopStyle),
|
|
3687
|
+
right: li(r.borderRightStyle),
|
|
3688
|
+
bottom: li(r.borderBottomStyle),
|
|
3689
|
+
left: li(r.borderLeftStyle)
|
|
3660
3690
|
},
|
|
3661
|
-
overflow:
|
|
3662
|
-
scrollbarWidth:
|
|
3663
|
-
scrollbarColor:
|
|
3691
|
+
overflow: Wr(r),
|
|
3692
|
+
scrollbarWidth: Br(e, r),
|
|
3693
|
+
scrollbarColor: Vr(r.scrollbarColor),
|
|
3664
3694
|
overscroll: {
|
|
3665
3695
|
x: (r.overscrollBehaviorX || "auto") === "auto",
|
|
3666
3696
|
y: (r.overscrollBehaviorY || "auto") === "auto"
|
|
3667
3697
|
},
|
|
3668
3698
|
scrollbarSize: {
|
|
3669
|
-
x:
|
|
3670
|
-
y:
|
|
3699
|
+
x: Hr(r.getPropertyValue("--mw-scrollbar-size-x")),
|
|
3700
|
+
y: Hr(r.getPropertyValue("--mw-scrollbar-size-y"))
|
|
3701
|
+
},
|
|
3702
|
+
scrollbarInset: {
|
|
3703
|
+
x: Hr(r.getPropertyValue("--mw-scrollbar-inset-x"), 0),
|
|
3704
|
+
y: Hr(r.getPropertyValue("--mw-scrollbar-inset-y"), 0)
|
|
3671
3705
|
},
|
|
3672
3706
|
whiteSpace: r.whiteSpace === "pre" ? "pre" : r.whiteSpace === "nowrap" ? "nowrap" : "normal",
|
|
3673
3707
|
tabSize: Math.max(1, Math.floor(parseFloat(r.tabSize)) || 8),
|
|
3674
|
-
lineGap:
|
|
3675
|
-
tracking:
|
|
3708
|
+
lineGap: oi(r.lineHeight, i),
|
|
3709
|
+
tracking: ai(r.letterSpacing, i, n?.letterSpacing ?? 0),
|
|
3676
3710
|
textOverflow: r.textOverflow === "ellipsis" ? "ellipsis" : "clip",
|
|
3677
3711
|
color: r.color,
|
|
3678
3712
|
fontWeight: r.fontWeight,
|
|
3679
3713
|
fontStyle: r.fontStyle,
|
|
3680
3714
|
textDecorationLine: r.textDecorationLine,
|
|
3681
|
-
backgroundColor:
|
|
3715
|
+
backgroundColor: Fr(e, r.backgroundColor, r),
|
|
3682
3716
|
backgroundClear: r.getPropertyValue("--mw-bg-clear").trim() === "1",
|
|
3683
3717
|
borderColor: {
|
|
3684
3718
|
top: r.borderTopColor,
|
|
@@ -3686,33 +3720,33 @@ function kr(e, t, n) {
|
|
|
3686
3720
|
bottom: r.borderBottomColor,
|
|
3687
3721
|
left: r.borderLeftColor
|
|
3688
3722
|
},
|
|
3689
|
-
textAlignBlocked:
|
|
3690
|
-
textAlign:
|
|
3691
|
-
textIndent:
|
|
3692
|
-
opacity:
|
|
3723
|
+
textAlignBlocked: Qr(e, r),
|
|
3724
|
+
textAlign: $r(e, r),
|
|
3725
|
+
textIndent: fi(r, t),
|
|
3726
|
+
opacity: di(r.opacity),
|
|
3693
3727
|
glyphSet: r.getPropertyValue("--mw-border-glyphs").trim() || null,
|
|
3694
3728
|
zIndex: r.zIndex === "auto" || r.zIndex === "" ? null : Number(r.zIndex) || 0,
|
|
3695
3729
|
latticeBorder: null,
|
|
3696
|
-
ruleX:
|
|
3697
|
-
ruleY:
|
|
3698
|
-
ruleBreak:
|
|
3730
|
+
ruleX: m === "flex" || m === "grid" || m === "multicol" ? Zr(r, "x") : null,
|
|
3731
|
+
ruleY: m === "flex" || m === "grid" ? Zr(r, "y") : null,
|
|
3732
|
+
ruleBreak: Xr(r, "--mw-rule-break", ["none", "intersection"], "normal"),
|
|
3699
3733
|
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0, P(parseFloat(r.getPropertyValue("--mw-rule-inset")) || 0)),
|
|
3700
|
-
ruleVisibilityItems:
|
|
3734
|
+
ruleVisibilityItems: Xr(r, "--mw-rule-visibility-items", [
|
|
3701
3735
|
"all",
|
|
3702
3736
|
"around",
|
|
3703
3737
|
"between"
|
|
3704
3738
|
], "normal"),
|
|
3705
|
-
columnCount:
|
|
3706
|
-
columnWidth:
|
|
3739
|
+
columnCount: d,
|
|
3740
|
+
columnWidth: p,
|
|
3707
3741
|
columnFill: r.columnFill === "auto" ? "auto" : "balance",
|
|
3708
3742
|
columnSpan: r.columnSpan === "all",
|
|
3709
3743
|
breakBeforeColumn: r.breakBefore === "column",
|
|
3710
3744
|
breakAfterColumn: r.breakAfter === "column",
|
|
3711
3745
|
breakInsideAvoid: r.breakInside === "avoid" || r.breakInside === "avoid-column"
|
|
3712
3746
|
};
|
|
3713
|
-
return
|
|
3747
|
+
return Nr(T, r), T;
|
|
3714
3748
|
}
|
|
3715
|
-
function
|
|
3749
|
+
function Nr(e, t) {
|
|
3716
3750
|
t.borderCollapse === "collapse" && (e.display === "table" || e.tableRole === "cell" || e.tableRole === "row" || e.tableRole === "row-group" || e.tableRole === "header-group" || e.tableRole === "footer-group") && (e.latticeBorder = {
|
|
3717
3751
|
width: e.border,
|
|
3718
3752
|
style: e.borderStyle,
|
|
@@ -3723,37 +3757,37 @@ function Ar(e, t) {
|
|
|
3723
3757
|
bottom: t.borderBottomStyle === "hidden",
|
|
3724
3758
|
left: t.borderLeftStyle === "hidden"
|
|
3725
3759
|
}
|
|
3726
|
-
}, e.border =
|
|
3760
|
+
}, e.border = ot(), e.display === "table" && (e.padding = ot()));
|
|
3727
3761
|
}
|
|
3728
|
-
function
|
|
3762
|
+
function Pr(e) {
|
|
3729
3763
|
if (!e) return !0;
|
|
3730
3764
|
let t = e.trim().toLowerCase();
|
|
3731
3765
|
return t === "" || t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "currentcolor";
|
|
3732
3766
|
}
|
|
3733
|
-
function
|
|
3734
|
-
let i = r(e,
|
|
3767
|
+
function Fr(e, t, n) {
|
|
3768
|
+
let i = r(e, Pr(t) ? "" : t, n);
|
|
3735
3769
|
return i === "" ? void 0 : i;
|
|
3736
3770
|
}
|
|
3737
|
-
function
|
|
3771
|
+
function Ir(e) {
|
|
3738
3772
|
return e === "hidden" || e === "clip";
|
|
3739
3773
|
}
|
|
3740
|
-
var
|
|
3741
|
-
function
|
|
3742
|
-
if (
|
|
3774
|
+
var Lr = /* @__PURE__ */ new WeakMap(), Rr = null;
|
|
3775
|
+
function zr(e) {
|
|
3776
|
+
if (Rr !== null) return Rr;
|
|
3743
3777
|
if (!e.body) return !0;
|
|
3744
3778
|
let t = e.createElement("div");
|
|
3745
|
-
return t.style.cssText = "position: absolute; width: 0; height: 0; overflow: auto", e.body.appendChild(t),
|
|
3779
|
+
return t.style.cssText = "position: absolute; width: 0; height: 0; overflow: auto", e.body.appendChild(t), Rr = getComputedStyle(t).scrollbarWidth !== "none", t.remove(), Rr;
|
|
3746
3780
|
}
|
|
3747
|
-
function
|
|
3748
|
-
if (!
|
|
3781
|
+
function Br(e, t) {
|
|
3782
|
+
if (!zr(e.ownerDocument)) return "auto";
|
|
3749
3783
|
if (e.hasAttribute("data-mw-scroll")) {
|
|
3750
|
-
let t =
|
|
3784
|
+
let t = Lr.get(e);
|
|
3751
3785
|
if (t !== void 0) return t;
|
|
3752
3786
|
}
|
|
3753
3787
|
let n = t.scrollbarWidth === "none" ? "none" : "auto";
|
|
3754
|
-
return
|
|
3788
|
+
return Lr.set(e, n), n;
|
|
3755
3789
|
}
|
|
3756
|
-
function
|
|
3790
|
+
function Vr(e) {
|
|
3757
3791
|
let t = (e ?? "").trim();
|
|
3758
3792
|
if (!t || t === "auto") return null;
|
|
3759
3793
|
let n = 0;
|
|
@@ -3768,25 +3802,25 @@ function Rr(e) {
|
|
|
3768
3802
|
}
|
|
3769
3803
|
return null;
|
|
3770
3804
|
}
|
|
3771
|
-
function
|
|
3772
|
-
return Math.max(
|
|
3805
|
+
function Hr(e, t = 1) {
|
|
3806
|
+
return Math.max(t, Math.floor(Number(e) || t));
|
|
3773
3807
|
}
|
|
3774
|
-
function
|
|
3775
|
-
return
|
|
3808
|
+
function Ur(e) {
|
|
3809
|
+
return Ir(e) ? "clip" : e === "auto" || e === "scroll" ? e : "visible";
|
|
3776
3810
|
}
|
|
3777
|
-
function
|
|
3778
|
-
let t =
|
|
3811
|
+
function Wr(e) {
|
|
3812
|
+
let t = Ur(e.overflowX || e.overflow), n = Ur(e.overflowY || e.overflow);
|
|
3779
3813
|
return t !== "visible" && n === "visible" && (n = "auto"), n !== "visible" && t === "visible" && (t = "auto"), {
|
|
3780
3814
|
x: t,
|
|
3781
3815
|
y: n
|
|
3782
3816
|
};
|
|
3783
3817
|
}
|
|
3784
|
-
function
|
|
3818
|
+
function Gr(e, t) {
|
|
3785
3819
|
if (t.position !== "absolute" && t.position !== "fixed") return !1;
|
|
3786
3820
|
let n = t.clip.replace(/\s/g, "");
|
|
3787
|
-
return n === "rect(0px,0px,0px,0px)" || n === "rect(0,0,0,0)" || !
|
|
3821
|
+
return n === "rect(0px,0px,0px,0px)" || n === "rect(0,0,0,0)" || !ae(e.tagName) && (Ir(t.overflow) || Ir(t.overflowX)) && parseFloat(t.width) <= 1 && parseFloat(t.height) <= 1;
|
|
3788
3822
|
}
|
|
3789
|
-
var
|
|
3823
|
+
var Kr = {
|
|
3790
3824
|
TABLE: "table",
|
|
3791
3825
|
THEAD: "table-header-group",
|
|
3792
3826
|
TBODY: "table-row-group",
|
|
@@ -3797,7 +3831,7 @@ var Ur = {
|
|
|
3797
3831
|
CAPTION: "table-caption",
|
|
3798
3832
|
COL: "table-column",
|
|
3799
3833
|
COLGROUP: "table-column-group"
|
|
3800
|
-
},
|
|
3834
|
+
}, qr = {
|
|
3801
3835
|
"table-header-group": "header-group",
|
|
3802
3836
|
"table-row-group": "row-group",
|
|
3803
3837
|
"table-footer-group": "footer-group",
|
|
@@ -3807,38 +3841,38 @@ var Ur = {
|
|
|
3807
3841
|
"table-column": "column",
|
|
3808
3842
|
"table-column-group": "column-group"
|
|
3809
3843
|
};
|
|
3810
|
-
function
|
|
3844
|
+
function Jr(e, t) {
|
|
3811
3845
|
let n = t.verticalAlign || e.getAttribute("valign")?.toLowerCase() || (e.tagName === "TD" || e.tagName === "TH" ? "middle" : "baseline");
|
|
3812
3846
|
return n === "top" ? "start" : n === "middle" ? "center" : n === "bottom" ? "end" : "start";
|
|
3813
3847
|
}
|
|
3814
|
-
function
|
|
3848
|
+
function Yr(e, t, n) {
|
|
3815
3849
|
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") && N(e, "font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.");
|
|
3816
3850
|
}
|
|
3817
|
-
function
|
|
3851
|
+
function Xr(e, t, n, r) {
|
|
3818
3852
|
let i = e.getPropertyValue(t).trim();
|
|
3819
3853
|
return n.includes(i) ? i : r;
|
|
3820
3854
|
}
|
|
3821
|
-
function
|
|
3855
|
+
function Zr(e, t) {
|
|
3822
3856
|
let n = P(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`)) || 0);
|
|
3823
3857
|
if (n <= 0) return null;
|
|
3824
3858
|
let r = e.getPropertyValue(`--mw-rule-${t}-color`).trim();
|
|
3825
3859
|
return {
|
|
3826
3860
|
width: n,
|
|
3827
|
-
style:
|
|
3861
|
+
style: li(e.getPropertyValue(`--mw-rule-${t}-style`).trim()),
|
|
3828
3862
|
color: r && r !== "currentcolor" && r !== "currentColor" ? r : e.color
|
|
3829
3863
|
};
|
|
3830
3864
|
}
|
|
3831
|
-
function
|
|
3865
|
+
function Qr(e, t) {
|
|
3832
3866
|
return t.textAlign === "justify" || e.getAttribute("align")?.toLowerCase() === "justify";
|
|
3833
3867
|
}
|
|
3834
|
-
function
|
|
3868
|
+
function $r(e, t) {
|
|
3835
3869
|
let n = t.textAlign || e.getAttribute("align")?.toLowerCase() || "";
|
|
3836
3870
|
return n === "right" || n === "end" ? "end" : n === "center" || n.endsWith("-center") ? "center" : "start";
|
|
3837
3871
|
}
|
|
3838
|
-
function
|
|
3872
|
+
function ei(e) {
|
|
3839
3873
|
return typeof e.computedStyleMap == "function";
|
|
3840
3874
|
}
|
|
3841
|
-
function
|
|
3875
|
+
function ti(e) {
|
|
3842
3876
|
switch (e) {
|
|
3843
3877
|
case "center": return "center";
|
|
3844
3878
|
case "flex-end":
|
|
@@ -3853,7 +3887,7 @@ function Qr(e) {
|
|
|
3853
3887
|
default: return "start";
|
|
3854
3888
|
}
|
|
3855
3889
|
}
|
|
3856
|
-
function
|
|
3890
|
+
function ni(e) {
|
|
3857
3891
|
switch (e) {
|
|
3858
3892
|
case "center": return "center";
|
|
3859
3893
|
case "flex-end":
|
|
@@ -3864,10 +3898,10 @@ function $r(e) {
|
|
|
3864
3898
|
default: return "start";
|
|
3865
3899
|
}
|
|
3866
3900
|
}
|
|
3867
|
-
function
|
|
3868
|
-
return e === "auto" || e === "" || e === "normal" ? "auto" :
|
|
3901
|
+
function ri(e) {
|
|
3902
|
+
return e === "auto" || e === "" || e === "normal" ? "auto" : ni(e);
|
|
3869
3903
|
}
|
|
3870
|
-
function
|
|
3904
|
+
function ii(e, t, n, r, i) {
|
|
3871
3905
|
let a = (a, o, s) => {
|
|
3872
3906
|
if (t) {
|
|
3873
3907
|
let e = t.get(a)?.toString().trim();
|
|
@@ -3891,16 +3925,16 @@ function ti(e, t, n, r, i) {
|
|
|
3891
3925
|
left: a("margin-left", "margin-inline-start", /(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)
|
|
3892
3926
|
};
|
|
3893
3927
|
}
|
|
3894
|
-
function
|
|
3928
|
+
function ai(e, t, n) {
|
|
3895
3929
|
let r = (e === "normal" ? 0 : parseFloat(e) || 0) - n;
|
|
3896
3930
|
return r <= 0 ? 0 : Math.floor(r / (.025 * t) + 1e-6);
|
|
3897
3931
|
}
|
|
3898
|
-
function
|
|
3932
|
+
function oi(e, t) {
|
|
3899
3933
|
if (!e || e === "normal" || t <= 0) return 0;
|
|
3900
3934
|
let n = parseFloat(e);
|
|
3901
3935
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n / t + 1e-6) - 1) : 0;
|
|
3902
3936
|
}
|
|
3903
|
-
function
|
|
3937
|
+
function si(e) {
|
|
3904
3938
|
switch (e) {
|
|
3905
3939
|
case "relative":
|
|
3906
3940
|
case "absolute":
|
|
@@ -3909,7 +3943,7 @@ function ii(e) {
|
|
|
3909
3943
|
default: return "static";
|
|
3910
3944
|
}
|
|
3911
3945
|
}
|
|
3912
|
-
function
|
|
3946
|
+
function ci(e, t, n, r, i) {
|
|
3913
3947
|
let a = (a, o) => {
|
|
3914
3948
|
if (t) {
|
|
3915
3949
|
let e = t.get(a)?.toString().trim();
|
|
@@ -3928,7 +3962,7 @@ function ai(e, t, n, r, i) {
|
|
|
3928
3962
|
left: a("left", /(?:^|[\s:.[!])-?(?:left|start|inset|inset-x)-/)
|
|
3929
3963
|
};
|
|
3930
3964
|
}
|
|
3931
|
-
function
|
|
3965
|
+
function li(e) {
|
|
3932
3966
|
switch (e) {
|
|
3933
3967
|
case "double": return "double";
|
|
3934
3968
|
case "dashed": return "dashed";
|
|
@@ -3936,7 +3970,7 @@ function oi(e) {
|
|
|
3936
3970
|
default: return "solid";
|
|
3937
3971
|
}
|
|
3938
3972
|
}
|
|
3939
|
-
function
|
|
3973
|
+
function ui(e, t) {
|
|
3940
3974
|
if (!e || e === "none" || e === "auto") return;
|
|
3941
3975
|
if (e === "min-content" || e === "max-content" || e === "fit-content") return e;
|
|
3942
3976
|
if (e.endsWith("%")) {
|
|
@@ -3955,28 +3989,33 @@ function $(e, t) {
|
|
|
3955
3989
|
let n = parseFloat(e);
|
|
3956
3990
|
return Number.isFinite(n) ? F(n, t) : 0;
|
|
3957
3991
|
}
|
|
3958
|
-
function
|
|
3992
|
+
function di(e) {
|
|
3959
3993
|
let t = parseFloat(e);
|
|
3960
3994
|
return Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : 1;
|
|
3961
3995
|
}
|
|
3962
|
-
function
|
|
3996
|
+
function fi(e, t) {
|
|
3963
3997
|
let n = e.textIndent;
|
|
3964
3998
|
if (!n || n.endsWith("%")) return 0;
|
|
3965
3999
|
let r = parseFloat(n);
|
|
3966
4000
|
return Number.isFinite(r) ? Math.max(0, F(r, t)) : 0;
|
|
3967
4001
|
}
|
|
3968
|
-
function
|
|
3969
|
-
let s =
|
|
4002
|
+
function pi(e, t, n, r, i, a, o) {
|
|
4003
|
+
let s = mi(n === "width" ? a.width : a.height);
|
|
3970
4004
|
if (s !== null) return {
|
|
3971
4005
|
kind: "cells",
|
|
3972
|
-
value:
|
|
4006
|
+
value: gi(s, n, o, r)
|
|
4007
|
+
};
|
|
4008
|
+
let c = _i(e, n, t, i, n === "width" ? "w" : "h", a, o, r);
|
|
4009
|
+
if (c !== void 0) return {
|
|
4010
|
+
kind: "cells",
|
|
4011
|
+
value: c
|
|
3973
4012
|
};
|
|
3974
|
-
let
|
|
3975
|
-
if (
|
|
3976
|
-
let i = parseFloat(e ? String(e.get(n) ?? "") : t), a = Number.isFinite(i) && Math.abs(i -
|
|
4013
|
+
let l = hi(i, n === "width" ? "w" : "h");
|
|
4014
|
+
if (l !== null) {
|
|
4015
|
+
let i = parseFloat(e ? String(e.get(n) ?? "") : t), a = Number.isFinite(i) && Math.abs(i - l) <= l * .3;
|
|
3977
4016
|
if (a || !Number.isFinite(i)) return {
|
|
3978
4017
|
kind: "cells",
|
|
3979
|
-
value:
|
|
4018
|
+
value: gi(a ? i : l, n, o, r)
|
|
3980
4019
|
};
|
|
3981
4020
|
}
|
|
3982
4021
|
if (e) {
|
|
@@ -3984,7 +4023,7 @@ function ui(e, t, n, r, i, a, o) {
|
|
|
3984
4023
|
if (t == null) return;
|
|
3985
4024
|
let i = t.toString().trim();
|
|
3986
4025
|
if (i === "auto") return { kind: "auto" };
|
|
3987
|
-
let a =
|
|
4026
|
+
let a = xi(i);
|
|
3988
4027
|
if (a) return a;
|
|
3989
4028
|
if (i.endsWith("%")) return {
|
|
3990
4029
|
kind: "percent",
|
|
@@ -3998,62 +4037,62 @@ function ui(e, t, n, r, i, a, o) {
|
|
|
3998
4037
|
kind: "cells",
|
|
3999
4038
|
value: P(parseFloat(i) / .25)
|
|
4000
4039
|
};
|
|
4001
|
-
let s =
|
|
4040
|
+
let s = mi(i);
|
|
4002
4041
|
if (s !== null) return {
|
|
4003
4042
|
kind: "cells",
|
|
4004
|
-
value:
|
|
4043
|
+
value: gi(s, n, o, r)
|
|
4005
4044
|
};
|
|
4006
4045
|
}
|
|
4007
|
-
let
|
|
4008
|
-
if (
|
|
4009
|
-
if (
|
|
4010
|
-
let e =
|
|
4046
|
+
let u = n === "width" ? a.width : a.height;
|
|
4047
|
+
if (u) {
|
|
4048
|
+
if (u === "auto") return { kind: "auto" };
|
|
4049
|
+
let e = xi(u);
|
|
4011
4050
|
if (e) return e;
|
|
4012
|
-
if (
|
|
4051
|
+
if (u.endsWith("%")) return {
|
|
4013
4052
|
kind: "percent",
|
|
4014
|
-
value: parseFloat(
|
|
4053
|
+
value: parseFloat(u)
|
|
4015
4054
|
};
|
|
4016
|
-
let t = parseFloat(
|
|
4055
|
+
let t = parseFloat(u);
|
|
4017
4056
|
if (Number.isFinite(t)) return {
|
|
4018
4057
|
kind: "cells",
|
|
4019
4058
|
value: F(t, r)
|
|
4020
4059
|
};
|
|
4021
4060
|
}
|
|
4022
|
-
let
|
|
4023
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4024
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4025
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4026
|
-
let
|
|
4027
|
-
if (
|
|
4061
|
+
let d = n === "width" ? "w" : "h";
|
|
4062
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-min\\b`).test(i)) return { kind: "min-content" };
|
|
4063
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-max\\b`).test(i)) return { kind: "max-content" };
|
|
4064
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-fit\\b`).test(i)) return { kind: "fit-content" };
|
|
4065
|
+
let f = RegExp(`(?:^|[\\s:.[!])${d}-(\\d+)/(\\d+)(?![\\w./])`).exec(i);
|
|
4066
|
+
if (f) return {
|
|
4028
4067
|
kind: "percent",
|
|
4029
|
-
value: 100 * Number(
|
|
4068
|
+
value: 100 * Number(f[1]) / Number(f[2])
|
|
4030
4069
|
};
|
|
4031
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4070
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-full(?![\\w-])`).test(i)) return {
|
|
4032
4071
|
kind: "percent",
|
|
4033
4072
|
value: 100
|
|
4034
4073
|
};
|
|
4035
|
-
let
|
|
4036
|
-
if (
|
|
4074
|
+
let p = RegExp(`(?:^|[\\s:.[!])${d}-\\[(\\d+(?:\\.\\d+)?)%\\]`).exec(i);
|
|
4075
|
+
if (p) return {
|
|
4037
4076
|
kind: "percent",
|
|
4038
|
-
value: Number(
|
|
4077
|
+
value: Number(p[1])
|
|
4039
4078
|
};
|
|
4040
|
-
let
|
|
4041
|
-
if (
|
|
4079
|
+
let m = RegExp(`(?:^|[\\s:.[!])${d}-(\\d+(?:\\.\\d+)?)(?![\\w-/])`).exec(i);
|
|
4080
|
+
if (m) return {
|
|
4042
4081
|
kind: "cells",
|
|
4043
|
-
value: P(Number(
|
|
4082
|
+
value: P(Number(m[1]))
|
|
4044
4083
|
};
|
|
4045
|
-
if (!
|
|
4084
|
+
if (!Ni(i, d) || t === "auto") return { kind: "auto" };
|
|
4046
4085
|
if (t.endsWith("%")) return {
|
|
4047
4086
|
kind: "percent",
|
|
4048
4087
|
value: parseFloat(t)
|
|
4049
4088
|
};
|
|
4050
|
-
let
|
|
4051
|
-
if (Number.isFinite(
|
|
4089
|
+
let h = parseFloat(t);
|
|
4090
|
+
if (Number.isFinite(h)) return {
|
|
4052
4091
|
kind: "cells",
|
|
4053
|
-
value: F(
|
|
4092
|
+
value: F(h, r)
|
|
4054
4093
|
};
|
|
4055
4094
|
}
|
|
4056
|
-
function
|
|
4095
|
+
function mi(e) {
|
|
4057
4096
|
let t = /^(-?[\d.]+)((?:[dsl]?v)(?:h|w|min|max)|vi|vb)$/.exec(e.trim());
|
|
4058
4097
|
if (!t || typeof window > "u") return null;
|
|
4059
4098
|
let n = parseFloat(t[1]);
|
|
@@ -4061,7 +4100,7 @@ function di(e) {
|
|
|
4061
4100
|
let r = t[2], i = window.innerHeight, a = window.innerWidth, o = r.endsWith("h") ? i : r.endsWith("min") ? Math.min(a, i) : r.endsWith("max") ? Math.max(a, i) : r === "vb" ? i : a;
|
|
4062
4101
|
return n / 100 * o;
|
|
4063
4102
|
}
|
|
4064
|
-
function
|
|
4103
|
+
function hi(e, t) {
|
|
4065
4104
|
if (typeof window > "u") return null;
|
|
4066
4105
|
let n = RegExp(`(?:^|[\\s:.[!])${t}-(screen|[dsl]v[hw])(?![\\w-])`).exec(e);
|
|
4067
4106
|
if (n) {
|
|
@@ -4069,23 +4108,117 @@ function fi(e, t) {
|
|
|
4069
4108
|
return e === "screen" ? t.includes("h") ? window.innerHeight : window.innerWidth : e.endsWith("h") ? window.innerHeight : window.innerWidth;
|
|
4070
4109
|
}
|
|
4071
4110
|
let r = RegExp(`(?:^|[\\s:.[!])${t}-\\[(-?[\\d.]+(?:[dsl]?v(?:h|w|min|max)|vi|vb))\\]`).exec(e);
|
|
4072
|
-
return r ?
|
|
4111
|
+
return r ? mi(r[1]) : null;
|
|
4073
4112
|
}
|
|
4074
|
-
function
|
|
4113
|
+
function gi(e, t, n, r) {
|
|
4075
4114
|
let i = t === "width" ? n?.width : n?.height;
|
|
4076
4115
|
return i && i > 0 ? Math.max(0, Math.floor(e / i)) : F(e, r);
|
|
4077
4116
|
}
|
|
4078
|
-
function
|
|
4079
|
-
let c = t.endsWith("width") ? "width" : "height", l =
|
|
4080
|
-
if (
|
|
4081
|
-
let
|
|
4117
|
+
function _i(e, t, n, r, i, a, o, s) {
|
|
4118
|
+
let c = t.endsWith("width") ? "width" : "height", l = a.getPropertyValue(t).trim(), u = l.startsWith("calc(");
|
|
4119
|
+
if (!u && !r.includes("-[calc(")) return;
|
|
4120
|
+
let d = RegExp(`(?:^|[\\s:.[!])${i}-\\[(calc\\([^\\]]*\\))\\]`).exec(r), f = u ? l : d?.[1]?.replaceAll("_", " ");
|
|
4121
|
+
if (!f) return;
|
|
4122
|
+
let p = vi(f, c, o, s);
|
|
4123
|
+
if (!p || p.unitless) return;
|
|
4124
|
+
let m = Math.max(0, P(p.cells));
|
|
4125
|
+
if (u) return m;
|
|
4126
|
+
let h = (e ? String(e.get(t) ?? "") : n).trim(), g = parseFloat(h);
|
|
4127
|
+
return (Number.isFinite(g) ? Math.abs(g - p.px) <= Math.abs(p.px) * .3 : h === "") ? m : void 0;
|
|
4128
|
+
}
|
|
4129
|
+
function vi(e, t, n, r) {
|
|
4130
|
+
let i = e.match(/--spacing\(\s*-?[\d.]+\s*\)|calc|[\d.]+[a-z%]*|[()+\-*/]/g);
|
|
4131
|
+
if (!i || i.join("").replace(/\s+/g, "") !== e.replace(/\s+/g, "")) return null;
|
|
4132
|
+
let a = 0, o = () => i[a], s = () => i[a++], c = (e, t) => ({
|
|
4133
|
+
cells: e,
|
|
4134
|
+
px: t,
|
|
4135
|
+
unitless: !1
|
|
4136
|
+
}), l = (e) => {
|
|
4137
|
+
let i = /^--spacing\(\s*(-?[\d.]+)\s*\)$/.exec(e);
|
|
4138
|
+
if (i) {
|
|
4139
|
+
let e = parseFloat(i[1]);
|
|
4140
|
+
return c(e, e * r / 4);
|
|
4141
|
+
}
|
|
4142
|
+
let a = /^([\d.]+)([a-z%]*)$/.exec(e);
|
|
4143
|
+
if (!a) return null;
|
|
4144
|
+
let o = parseFloat(a[1]), s = a[2];
|
|
4145
|
+
if (!Number.isFinite(o)) return null;
|
|
4146
|
+
if (s === "") return {
|
|
4147
|
+
cells: o,
|
|
4148
|
+
px: o,
|
|
4149
|
+
unitless: !0
|
|
4150
|
+
};
|
|
4151
|
+
if (s === "px") return c(o / (r / 4), o);
|
|
4152
|
+
if (s === "rem") return c(o * 4, o * r);
|
|
4153
|
+
let l = mi(e);
|
|
4154
|
+
return l === null ? null : c(gi(l, t, n, r), l);
|
|
4155
|
+
}, u = (e, t, n) => {
|
|
4156
|
+
if (e === "+" || e === "-") {
|
|
4157
|
+
if (t.unitless !== n.unitless) return null;
|
|
4158
|
+
let r = e === "+" ? 1 : -1;
|
|
4159
|
+
return {
|
|
4160
|
+
cells: t.cells + r * n.cells,
|
|
4161
|
+
px: t.px + r * n.px,
|
|
4162
|
+
unitless: t.unitless
|
|
4163
|
+
};
|
|
4164
|
+
}
|
|
4165
|
+
if (e === "*") {
|
|
4166
|
+
if (!t.unitless && !n.unitless) return null;
|
|
4167
|
+
let [e, r] = t.unitless ? [t, n] : [n, t];
|
|
4168
|
+
return {
|
|
4169
|
+
cells: r.cells * e.cells,
|
|
4170
|
+
px: r.px * e.px,
|
|
4171
|
+
unitless: r.unitless && e.unitless
|
|
4172
|
+
};
|
|
4173
|
+
}
|
|
4174
|
+
return !n.unitless || n.px === 0 ? null : {
|
|
4175
|
+
cells: t.cells / n.cells,
|
|
4176
|
+
px: t.px / n.px,
|
|
4177
|
+
unitless: t.unitless
|
|
4178
|
+
};
|
|
4179
|
+
}, d = () => {
|
|
4180
|
+
let e = s();
|
|
4181
|
+
if (e === void 0) return null;
|
|
4182
|
+
if (e === "-") {
|
|
4183
|
+
let e = d();
|
|
4184
|
+
return e && {
|
|
4185
|
+
cells: -e.cells,
|
|
4186
|
+
px: -e.px,
|
|
4187
|
+
unitless: e.unitless
|
|
4188
|
+
};
|
|
4189
|
+
}
|
|
4190
|
+
return e === "calc" ? s() === "(" ? f() : null : e === "(" ? f() : l(e);
|
|
4191
|
+
}, f = () => {
|
|
4192
|
+
let e = m();
|
|
4193
|
+
return s() === ")" ? e : null;
|
|
4194
|
+
}, p = () => {
|
|
4195
|
+
let e = d();
|
|
4196
|
+
for (; e && (o() === "*" || o() === "/");) {
|
|
4197
|
+
let t = s(), n = d();
|
|
4198
|
+
e = n ? u(t, e, n) : null;
|
|
4199
|
+
}
|
|
4200
|
+
return e;
|
|
4201
|
+
}, m = () => {
|
|
4202
|
+
let e = p();
|
|
4203
|
+
for (; e && (o() === "+" || o() === "-");) {
|
|
4204
|
+
let t = s(), n = p();
|
|
4205
|
+
e = n ? u(t, e, n) : null;
|
|
4206
|
+
}
|
|
4207
|
+
return e;
|
|
4208
|
+
}, h = m();
|
|
4209
|
+
return a === i.length ? h : null;
|
|
4210
|
+
}
|
|
4211
|
+
function yi(e, t, n, r, i, a, o, s) {
|
|
4212
|
+
let c = t.endsWith("width") ? "width" : "height", l = mi(a.getPropertyValue(t)) ?? mi(e?.get(t)?.toString().trim() ?? "");
|
|
4213
|
+
if (l !== null) return gi(l, c, o, s);
|
|
4214
|
+
let u = hi(r, i);
|
|
4082
4215
|
if (u === null) return;
|
|
4083
|
-
let d =
|
|
4084
|
-
if (
|
|
4216
|
+
let d = (e ? String(e.get(t) ?? "") : n).trim(), f = parseFloat(d), p = Number.isFinite(f) && Math.abs(f - u) <= u * .3;
|
|
4217
|
+
if (p || d === "") return gi(p ? f : u, c, o, s);
|
|
4085
4218
|
}
|
|
4086
|
-
function
|
|
4219
|
+
function bi(e, t) {
|
|
4087
4220
|
if (!e || e === "auto" || e === "content") return;
|
|
4088
|
-
let n =
|
|
4221
|
+
let n = xi(e);
|
|
4089
4222
|
if (n) return n;
|
|
4090
4223
|
if (e.endsWith("%")) {
|
|
4091
4224
|
let t = parseFloat(e);
|
|
@@ -4100,27 +4233,27 @@ function hi(e, t) {
|
|
|
4100
4233
|
value: F(r, t)
|
|
4101
4234
|
} : void 0;
|
|
4102
4235
|
}
|
|
4103
|
-
function
|
|
4236
|
+
function xi(e) {
|
|
4104
4237
|
if (e === "min-content") return { kind: "min-content" };
|
|
4105
4238
|
if (e === "max-content") return { kind: "max-content" };
|
|
4106
4239
|
if (e === "fit-content") return { kind: "fit-content" };
|
|
4107
4240
|
}
|
|
4108
|
-
function
|
|
4241
|
+
function Si(e, t) {
|
|
4109
4242
|
let n = e.trim();
|
|
4110
4243
|
if (!n || n === "none") return { kind: "none" };
|
|
4111
4244
|
if (n === "subgrid" || n.startsWith("subgrid ")) return { kind: "subgrid" };
|
|
4112
4245
|
let r = [], i = [], a = [], o = (e) => {
|
|
4113
4246
|
i.push(a), a = [], r.push(e);
|
|
4114
4247
|
}, s;
|
|
4115
|
-
for (let e of
|
|
4116
|
-
let n =
|
|
4248
|
+
for (let e of Ai(n)) {
|
|
4249
|
+
let n = wi(e);
|
|
4117
4250
|
if (n) {
|
|
4118
4251
|
a.push(...n);
|
|
4119
4252
|
continue;
|
|
4120
4253
|
}
|
|
4121
4254
|
let i = e.match(/^repeat\(\s*([^,]+?)\s*,(.*)\)$/s);
|
|
4122
4255
|
if (i) {
|
|
4123
|
-
let e =
|
|
4256
|
+
let e = Ci(i[2].trim(), t);
|
|
4124
4257
|
if (e.tracks.length === 0) continue;
|
|
4125
4258
|
let n = i[1];
|
|
4126
4259
|
if (n === "auto-fill" || n === "auto-fit") {
|
|
@@ -4138,7 +4271,7 @@ function _i(e, t) {
|
|
|
4138
4271
|
}
|
|
4139
4272
|
continue;
|
|
4140
4273
|
}
|
|
4141
|
-
o(
|
|
4274
|
+
o(Di(e, t));
|
|
4142
4275
|
}
|
|
4143
4276
|
if (i.push(a), r.length === 0 && !s) return { kind: "none" };
|
|
4144
4277
|
let c = {
|
|
@@ -4147,26 +4280,26 @@ function _i(e, t) {
|
|
|
4147
4280
|
};
|
|
4148
4281
|
return i.some((e) => e.length > 0) && (c.lineNames = i), s && (c.autoRepeat = s), c;
|
|
4149
4282
|
}
|
|
4150
|
-
function
|
|
4283
|
+
function Ci(e, t) {
|
|
4151
4284
|
let n = [], r = [], i = [];
|
|
4152
|
-
for (let a of
|
|
4153
|
-
let e =
|
|
4285
|
+
for (let a of Ai(e)) {
|
|
4286
|
+
let e = wi(a);
|
|
4154
4287
|
if (e) {
|
|
4155
4288
|
i.push(...e);
|
|
4156
4289
|
continue;
|
|
4157
4290
|
}
|
|
4158
|
-
r.push(i), i = [], n.push(
|
|
4291
|
+
r.push(i), i = [], n.push(Di(a, t));
|
|
4159
4292
|
}
|
|
4160
4293
|
return r.push(i), {
|
|
4161
4294
|
tracks: n,
|
|
4162
4295
|
lineNames: r
|
|
4163
4296
|
};
|
|
4164
4297
|
}
|
|
4165
|
-
function
|
|
4298
|
+
function wi(e) {
|
|
4166
4299
|
let t = e.match(/^\[(.*)\]$/s);
|
|
4167
4300
|
return t ? t[1].split(/\s+/).filter((e) => e !== "") : null;
|
|
4168
4301
|
}
|
|
4169
|
-
function
|
|
4302
|
+
function Ti(e) {
|
|
4170
4303
|
let t = [];
|
|
4171
4304
|
for (let n of e.matchAll(/"([^"]*)"|'([^']*)'/g)) {
|
|
4172
4305
|
let e = (n[1] ?? n[2] ?? "").trim().split(/\s+/).filter((e) => e !== "");
|
|
@@ -4196,23 +4329,23 @@ function bi(e) {
|
|
|
4196
4329
|
areas: r
|
|
4197
4330
|
};
|
|
4198
4331
|
}
|
|
4199
|
-
function
|
|
4200
|
-
let n =
|
|
4201
|
-
return n.length > 0 ? n : [
|
|
4332
|
+
function Ei(e, t) {
|
|
4333
|
+
let n = Ai(e.trim()).filter((e) => e !== "" && !e.startsWith("[")).map((e) => Di(e, t));
|
|
4334
|
+
return n.length > 0 ? n : [st()];
|
|
4202
4335
|
}
|
|
4203
|
-
function
|
|
4336
|
+
function Di(e, t) {
|
|
4204
4337
|
let n = e.match(/^minmax\((.*)\)$/s);
|
|
4205
4338
|
if (n) {
|
|
4206
|
-
let e =
|
|
4339
|
+
let e = ki(n[1]).map((e) => e.trim());
|
|
4207
4340
|
return e.length === 2 ? {
|
|
4208
|
-
min:
|
|
4209
|
-
max:
|
|
4341
|
+
min: Oi(e[0], t),
|
|
4342
|
+
max: Oi(e[1], t)
|
|
4210
4343
|
} : {
|
|
4211
4344
|
min: { kind: "auto" },
|
|
4212
4345
|
max: { kind: "auto" }
|
|
4213
4346
|
};
|
|
4214
4347
|
}
|
|
4215
|
-
let r =
|
|
4348
|
+
let r = Oi(e, t);
|
|
4216
4349
|
return r.kind === "fr" ? {
|
|
4217
4350
|
min: { kind: "auto" },
|
|
4218
4351
|
max: r
|
|
@@ -4221,13 +4354,13 @@ function Si(e, t) {
|
|
|
4221
4354
|
max: r
|
|
4222
4355
|
};
|
|
4223
4356
|
}
|
|
4224
|
-
function
|
|
4357
|
+
function Oi(e, t) {
|
|
4225
4358
|
if (e === "auto" || e.startsWith("fit-content")) return { kind: "auto" };
|
|
4226
4359
|
if (e === "min-content") return { kind: "min-content" };
|
|
4227
4360
|
if (e === "max-content") return { kind: "max-content" };
|
|
4228
4361
|
let n = e.match(/^(min|max)\((.*)\)$/s);
|
|
4229
4362
|
if (n) {
|
|
4230
|
-
let e =
|
|
4363
|
+
let e = ki(n[2]).map((e) => Oi(e.trim(), t)), r = e.every((e) => e.kind === "cells" || e.kind === "percent" || e.kind === "math");
|
|
4231
4364
|
return e.length > 0 && r ? {
|
|
4232
4365
|
kind: "math",
|
|
4233
4366
|
fn: n[1],
|
|
@@ -4254,7 +4387,7 @@ function Ci(e, t) {
|
|
|
4254
4387
|
value: e.endsWith("rem") ? P(r / .25) : F(r, t)
|
|
4255
4388
|
} : { kind: "auto" };
|
|
4256
4389
|
}
|
|
4257
|
-
function
|
|
4390
|
+
function ki(e) {
|
|
4258
4391
|
let t = [], n = 0, r = 0;
|
|
4259
4392
|
for (let i = 0; i < e.length; i++) {
|
|
4260
4393
|
let a = e[i];
|
|
@@ -4262,7 +4395,7 @@ function wi(e) {
|
|
|
4262
4395
|
}
|
|
4263
4396
|
return t.push(e.slice(r)), t.filter((e) => e.trim() !== "");
|
|
4264
4397
|
}
|
|
4265
|
-
function
|
|
4398
|
+
function Ai(e) {
|
|
4266
4399
|
let t = [], n = 0, r = -1;
|
|
4267
4400
|
for (let i = 0; i < e.length; i++) {
|
|
4268
4401
|
let a = e[i];
|
|
@@ -4270,7 +4403,7 @@ function Ti(e) {
|
|
|
4270
4403
|
}
|
|
4271
4404
|
return r !== -1 && t.push(e.slice(r)), t;
|
|
4272
4405
|
}
|
|
4273
|
-
function
|
|
4406
|
+
function ji(e) {
|
|
4274
4407
|
let t = e.trim();
|
|
4275
4408
|
if (!t || t === "auto") return { kind: "auto" };
|
|
4276
4409
|
let n = !1, r, i;
|
|
@@ -4298,16 +4431,16 @@ function Ei(e) {
|
|
|
4298
4431
|
nth: r
|
|
4299
4432
|
};
|
|
4300
4433
|
}
|
|
4301
|
-
function
|
|
4434
|
+
function Mi(e) {
|
|
4302
4435
|
return {
|
|
4303
4436
|
direction: e.includes("column") ? "column" : "row",
|
|
4304
4437
|
dense: e.includes("dense")
|
|
4305
4438
|
};
|
|
4306
4439
|
}
|
|
4307
|
-
function
|
|
4440
|
+
function Ni(e, t) {
|
|
4308
4441
|
return (t === "w" ? /(?:^|[\s:.[!])w-/ : /(?:^|[\s:.[!])h-/).test(e);
|
|
4309
4442
|
}
|
|
4310
|
-
function
|
|
4443
|
+
function Pi(e, t) {
|
|
4311
4444
|
return {
|
|
4312
4445
|
top: $(e.getPropertyValue("padding-top"), t),
|
|
4313
4446
|
right: $(e.getPropertyValue("padding-right"), t),
|
|
@@ -4315,7 +4448,7 @@ function ki(e, t) {
|
|
|
4315
4448
|
left: $(e.getPropertyValue("padding-left"), t)
|
|
4316
4449
|
};
|
|
4317
4450
|
}
|
|
4318
|
-
function
|
|
4451
|
+
function Fi(e) {
|
|
4319
4452
|
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 : P(parseFloat(e.getPropertyValue(t)) || 0);
|
|
4320
4453
|
return {
|
|
4321
4454
|
top: t("border-top-width", "border-top-style"),
|
|
@@ -4326,14 +4459,14 @@ function Ai(e) {
|
|
|
4326
4459
|
}
|
|
4327
4460
|
//#endregion
|
|
4328
4461
|
//#region src/tree.ts
|
|
4329
|
-
function
|
|
4330
|
-
let i =
|
|
4462
|
+
function Ii(e, t, n, r) {
|
|
4463
|
+
let i = Mr(e, t, n);
|
|
4331
4464
|
if (i.display === "none") return null;
|
|
4332
|
-
let a =
|
|
4333
|
-
if (a) return
|
|
4334
|
-
let o = Array.from(e.children), s = o.map(
|
|
4465
|
+
let a = ae(e.tagName);
|
|
4466
|
+
if (a) return Li(e, i, a);
|
|
4467
|
+
let o = Array.from(e.children), s = o.map(Hi), c = e.tagName, l = $i(c);
|
|
4335
4468
|
if (!s.includes("block") || l) {
|
|
4336
|
-
let a =
|
|
4469
|
+
let a = Ui(e, i.tracking, {
|
|
4337
4470
|
rootFontSizePx: t,
|
|
4338
4471
|
rootLetterSpacingPx: n?.letterSpacing ?? 0,
|
|
4339
4472
|
cellMetrics: n,
|
|
@@ -4342,12 +4475,12 @@ function ji(e, t, n, r) {
|
|
|
4342
4475
|
tabSize: i.tabSize
|
|
4343
4476
|
}), u = a.chars.join("");
|
|
4344
4477
|
if (a.boxes.length > 0) {
|
|
4345
|
-
let e =
|
|
4346
|
-
|
|
4347
|
-
a.advances[t] = Math.max(1,
|
|
4478
|
+
let e = Rn();
|
|
4479
|
+
Fe(a.chars, (t, n) => {
|
|
4480
|
+
a.advances[t] = Math.max(1, q(a.boxes[n], e));
|
|
4348
4481
|
});
|
|
4349
4482
|
}
|
|
4350
|
-
let d =
|
|
4483
|
+
let d = Ji(u, a.advances, i.tracking);
|
|
4351
4484
|
if (l && d === 0) {
|
|
4352
4485
|
if (c === "INPUT") d = Number(e.size) || 20;
|
|
4353
4486
|
else if (c === "TEXTAREA") d = Number(e.cols) || 20;
|
|
@@ -4356,9 +4489,9 @@ function ji(e, t, n, r) {
|
|
|
4356
4489
|
d = Math.max(1, ...r.map((e) => e.trim().length));
|
|
4357
4490
|
}
|
|
4358
4491
|
}
|
|
4359
|
-
let f = u.length > 0 ?
|
|
4492
|
+
let f = u.length > 0 ? Yi(u) : 0, p;
|
|
4360
4493
|
if (c === "TEXTAREA") {
|
|
4361
|
-
let t = e, n = t.value ?? "", a = r?.get(t), o = +!!n.endsWith("\n"), s = a !== void 0 && a > 0 ?
|
|
4494
|
+
let t = e, n = t.value ?? "", a = r?.get(t), o = +!!n.endsWith("\n"), s = a !== void 0 && a > 0 ? Oe(n, a) + o : n === "" ? 0 : n.split(/\r\n?|\n/).length, c = getComputedStyle(e).getPropertyValue("field-sizing") === "content" ? 1 : Number(t.rows) || 2, l = Math.max(c, s);
|
|
4362
4495
|
p = l + Math.max(0, l - 1) * i.lineGap;
|
|
4363
4496
|
} else p = l ? Math.max(1, f) : f;
|
|
4364
4497
|
let m = /* @__PURE__ */ new Map(), h = [];
|
|
@@ -4368,7 +4501,7 @@ function ji(e, t, n, r) {
|
|
|
4368
4501
|
let i = o[e], a = m.get(i);
|
|
4369
4502
|
if (a) g.push(a);
|
|
4370
4503
|
else if (s[e] === "out-of-flow") {
|
|
4371
|
-
let e =
|
|
4504
|
+
let e = Ii(i, t, n, r);
|
|
4372
4505
|
e && g.push(e);
|
|
4373
4506
|
}
|
|
4374
4507
|
}
|
|
@@ -4387,14 +4520,14 @@ function ji(e, t, n, r) {
|
|
|
4387
4520
|
height: p
|
|
4388
4521
|
},
|
|
4389
4522
|
unclampedHeight: 0,
|
|
4390
|
-
resolvedPadding:
|
|
4523
|
+
resolvedPadding: ot()
|
|
4391
4524
|
};
|
|
4392
4525
|
return (a.advances.some((e) => e !== 1) || a.boxes.length > 0) && (_.advances = a.advances), a.inlineElements.length > 0 && (_.inlineElements = a.inlineElements, _.charInline = a.chars.map((e, t) => a.inlineIndex[t] ?? -1)), _;
|
|
4393
4526
|
}
|
|
4394
4527
|
let u = [];
|
|
4395
4528
|
for (let e = 0; e < o.length; e++) {
|
|
4396
4529
|
if (s[e] === "none") continue;
|
|
4397
|
-
let i =
|
|
4530
|
+
let i = Ii(o[e], t, n, r);
|
|
4398
4531
|
i && u.push(i);
|
|
4399
4532
|
}
|
|
4400
4533
|
let d = {
|
|
@@ -4411,14 +4544,14 @@ function ji(e, t, n, r) {
|
|
|
4411
4544
|
height: 0
|
|
4412
4545
|
},
|
|
4413
4546
|
unclampedHeight: 0,
|
|
4414
|
-
resolvedPadding:
|
|
4547
|
+
resolvedPadding: ot()
|
|
4415
4548
|
};
|
|
4416
|
-
return
|
|
4549
|
+
return ea(e, d), d;
|
|
4417
4550
|
}
|
|
4418
|
-
function
|
|
4419
|
-
let r =
|
|
4551
|
+
function Li(e, t, n) {
|
|
4552
|
+
let r = ce(n, e), i = r?.lines ?? [], a = i.join("\n");
|
|
4420
4553
|
t.whiteSpace = "pre", (t.width === void 0 || t.width.kind === "auto") && (t.width = { kind: "max-content" });
|
|
4421
|
-
let o = Array.from({ length: a.length }, () => 1 + t.tracking), s =
|
|
4554
|
+
let o = Array.from({ length: a.length }, () => 1 + t.tracking), s = Ji(a, o, t.tracking), c = i.length, l = {
|
|
4422
4555
|
source: e,
|
|
4423
4556
|
style: t,
|
|
4424
4557
|
children: [],
|
|
@@ -4432,7 +4565,7 @@ function Mi(e, t, n) {
|
|
|
4432
4565
|
height: c
|
|
4433
4566
|
},
|
|
4434
4567
|
unclampedHeight: 0,
|
|
4435
|
-
resolvedPadding:
|
|
4568
|
+
resolvedPadding: ot()
|
|
4436
4569
|
};
|
|
4437
4570
|
t.tracking > 0 && (l.advances = o);
|
|
4438
4571
|
let u = r?.runs ?? [];
|
|
@@ -4460,23 +4593,23 @@ function Mi(e, t, n) {
|
|
|
4460
4593
|
}
|
|
4461
4594
|
return l;
|
|
4462
4595
|
}
|
|
4463
|
-
var
|
|
4464
|
-
function
|
|
4465
|
-
return t || (
|
|
4596
|
+
var Ri = /* @__PURE__ */ new Set(/* @__PURE__ */ "A.ABBR.B.BDI.BDO.BR.CITE.CODE.DATA.DFN.EM.I.KBD.MARK.Q.S.SAMP.SMALL.SPAN.STRONG.SUB.SUP.TIME.U.VAR.WBR".split("."));
|
|
4597
|
+
function zi(e, t) {
|
|
4598
|
+
return t || (Ri.has(e.tagName) ? "inline" : "block");
|
|
4466
4599
|
}
|
|
4467
|
-
function
|
|
4468
|
-
let n =
|
|
4600
|
+
function Bi(e, t) {
|
|
4601
|
+
let n = zi(e, t);
|
|
4469
4602
|
return n === "inline" || n === "contents";
|
|
4470
4603
|
}
|
|
4471
|
-
function
|
|
4472
|
-
let n =
|
|
4604
|
+
function Vi(e, t) {
|
|
4605
|
+
let n = zi(e, t);
|
|
4473
4606
|
return n.startsWith("inline") && n !== "inline";
|
|
4474
4607
|
}
|
|
4475
|
-
function
|
|
4608
|
+
function Hi(e) {
|
|
4476
4609
|
let t = getComputedStyle(e);
|
|
4477
|
-
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" :
|
|
4610
|
+
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" : ae(e.tagName) ? "block" : Bi(e, t.display) || Vi(e, t.display) ? "inline" : "block";
|
|
4478
4611
|
}
|
|
4479
|
-
function
|
|
4612
|
+
function Ui(e, t, n) {
|
|
4480
4613
|
let r = {
|
|
4481
4614
|
chars: [],
|
|
4482
4615
|
advances: [],
|
|
@@ -4484,15 +4617,15 @@ function Ri(e, t, n) {
|
|
|
4484
4617
|
inlineElements: [],
|
|
4485
4618
|
boxes: []
|
|
4486
4619
|
};
|
|
4487
|
-
return
|
|
4620
|
+
return Wi(e, t, n, r), n.preserve ? r : qi(r);
|
|
4488
4621
|
}
|
|
4489
|
-
function
|
|
4622
|
+
function Wi(e, t, n, r) {
|
|
4490
4623
|
let i = () => {
|
|
4491
4624
|
let e = 0;
|
|
4492
4625
|
for (let t = r.chars.length - 1; t >= 0 && r.chars[t] !== "\n"; t--) e += r.advances[t];
|
|
4493
4626
|
return e;
|
|
4494
4627
|
};
|
|
4495
|
-
if (
|
|
4628
|
+
if (!$i(e.tagName)) {
|
|
4496
4629
|
for (let a of Array.from(e.childNodes)) if (a.nodeType === Node.TEXT_NODE) {
|
|
4497
4630
|
if (n.preserve) for (let e of (a.textContent ?? "").replace(/\r\n?/g, "\n")) if (e === "\n") r.chars.push("\n"), r.advances.push(0);
|
|
4498
4631
|
else if (e === " ") {
|
|
@@ -4508,24 +4641,24 @@ function zi(e, t, n, r) {
|
|
|
4508
4641
|
}
|
|
4509
4642
|
let t = getComputedStyle(e);
|
|
4510
4643
|
if (t.display === "none" || t.position === "absolute" || t.position === "fixed") continue;
|
|
4511
|
-
if (
|
|
4512
|
-
let t =
|
|
4644
|
+
if (Vi(e, t.display)) {
|
|
4645
|
+
let t = Ii(e, n.rootFontSizePx, n.cellMetrics, n.textareaWidths);
|
|
4513
4646
|
t && (t.inlineBox = !0, r.chars.push(""), r.advances.push(1), r.boxes.push(t));
|
|
4514
4647
|
continue;
|
|
4515
4648
|
}
|
|
4516
|
-
if (!
|
|
4517
|
-
|
|
4649
|
+
if (!Bi(e, t.display)) {
|
|
4650
|
+
Xi(e);
|
|
4518
4651
|
continue;
|
|
4519
4652
|
}
|
|
4520
|
-
let i =
|
|
4653
|
+
let i = ai(t.letterSpacing, parseFloat(t.fontSize) || n.rootFontSizePx, n.rootLetterSpacingPx), o = Gi(t.paddingLeft, n.rootFontSizePx), s = Gi(t.paddingRight, n.rootFontSizePx);
|
|
4521
4654
|
r.inlineElements.push({
|
|
4522
4655
|
element: e,
|
|
4523
4656
|
tracking: i,
|
|
4524
4657
|
padLeft: o,
|
|
4525
4658
|
padRight: s,
|
|
4526
|
-
insets: t.position === "static" ? null :
|
|
4659
|
+
insets: t.position === "static" ? null : Ki(t, n.rootFontSizePx),
|
|
4527
4660
|
color: t.color,
|
|
4528
|
-
backgroundColor:
|
|
4661
|
+
backgroundColor: Pr(t.backgroundColor) ? void 0 : t.backgroundColor,
|
|
4529
4662
|
fontWeight: t.fontWeight,
|
|
4530
4663
|
fontStyle: t.fontStyle,
|
|
4531
4664
|
textDecorationLine: t.textDecorationLine
|
|
@@ -4533,18 +4666,18 @@ function zi(e, t, n, r) {
|
|
|
4533
4666
|
let c = r.inlineElements.length - 1;
|
|
4534
4667
|
for (let e = 0; e < o; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
4535
4668
|
let l = r.chars.length;
|
|
4536
|
-
|
|
4669
|
+
Wi(e, i, n, r);
|
|
4537
4670
|
for (let e = l; e < r.chars.length; e++) r.inlineIndex[e] === void 0 && (r.inlineIndex[e] = c);
|
|
4538
4671
|
for (let e = 0; e < s; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
4539
4672
|
}
|
|
4540
4673
|
}
|
|
4541
4674
|
}
|
|
4542
|
-
function
|
|
4675
|
+
function Gi(e, t) {
|
|
4543
4676
|
if (!e || e.endsWith("%")) return 0;
|
|
4544
4677
|
let n = parseFloat(e);
|
|
4545
4678
|
return Number.isFinite(n) ? Math.max(0, F(n, t)) : 0;
|
|
4546
4679
|
}
|
|
4547
|
-
function
|
|
4680
|
+
function Ki(e, t) {
|
|
4548
4681
|
let n = (e) => {
|
|
4549
4682
|
if (!e || e === "auto" || e.endsWith("%")) return null;
|
|
4550
4683
|
let n = parseFloat(e);
|
|
@@ -4557,7 +4690,7 @@ function Vi(e, t) {
|
|
|
4557
4690
|
left: n(e.left)
|
|
4558
4691
|
};
|
|
4559
4692
|
}
|
|
4560
|
-
function
|
|
4693
|
+
function qi(e) {
|
|
4561
4694
|
let t = [], n = [], r = [], i = () => {
|
|
4562
4695
|
let e = t.length;
|
|
4563
4696
|
for (; e > 0 && t[e - 1] !== "\n";) e--;
|
|
@@ -4582,30 +4715,30 @@ function Hi(e) {
|
|
|
4582
4715
|
boxes: e.boxes
|
|
4583
4716
|
};
|
|
4584
4717
|
}
|
|
4585
|
-
function
|
|
4718
|
+
function Ji(e, t, n) {
|
|
4586
4719
|
let r = 0, i = 0;
|
|
4587
4720
|
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r, I(i, a, t, n)), i = a + 1);
|
|
4588
4721
|
return r;
|
|
4589
4722
|
}
|
|
4590
|
-
function
|
|
4591
|
-
return
|
|
4723
|
+
function Yi(e) {
|
|
4724
|
+
return Ae(e).length;
|
|
4592
4725
|
}
|
|
4593
|
-
function
|
|
4726
|
+
function Xi(e) {
|
|
4594
4727
|
N(e, "A block-level element nested inside a text run can't be laid out and was skipped. Give it its own place in the layout instead.");
|
|
4595
4728
|
}
|
|
4596
|
-
function
|
|
4729
|
+
function Zi(e) {
|
|
4597
4730
|
return Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? ""));
|
|
4598
4731
|
}
|
|
4599
|
-
var
|
|
4600
|
-
function
|
|
4732
|
+
var Qi = "Direct text next to block-level children can't be laid out and was hidden. Wrap each text segment in its own element (e.g. a <div>).";
|
|
4733
|
+
function $i(e) {
|
|
4601
4734
|
return e === "INPUT" || e === "SELECT" || e === "TEXTAREA";
|
|
4602
4735
|
}
|
|
4603
|
-
function
|
|
4604
|
-
|
|
4736
|
+
function ea(e, t) {
|
|
4737
|
+
Zi(e) && (t.droppedText = !0, N(e, Qi));
|
|
4605
4738
|
}
|
|
4606
4739
|
//#endregion
|
|
4607
4740
|
//#region src/element.ts
|
|
4608
|
-
var
|
|
4741
|
+
var ta = "\n<style>\n :host { display: block; position: relative; contain: layout style; }\n #viewport { position: relative; width: 100%; height: 100%; background: inherit; }\n /* When the host hides its own dropped direct text (visibility, see\n * styles.css), the render layer must not sink with it. Scoped to that\n * state so an authored 'invisible' on the host stays intact. */\n :host([data-mw-dropped-text]) #viewport { visibility: visible; }\n /* The unified grid: one <pre> with same-paint-run spans, cell-precise\n * (one monospace character = one cell). In select=\"grid\" (the\n * default, reflected onto the attribute — see DEFAULT_SELECT) the\n * grid catches drags for native selection of the ASCII; interactive\n * elements opt back into pointer-events via styles.css so clicks\n * still work. In select=\"text\" the grid is inert to events and drag\n * selects the light DOM natively. */\n /* Sized by the engine's ink extent (element.ts), not the host box:\n * visible overflow paints past the host (specs/cell-model.md\n * \"Overflow\"), and the host's background follows it there — the\n * host is the canvas, as the root element's background covers a\n * document's overflow — inherited through #viewport, the shadow\n * parent. (A translucent host background paints repeatedly inside\n * the box.) */\n #grid { position: absolute; top: 0; left: 0; margin: 0; background: inherit; font: inherit; line-height: inherit; letter-spacing: inherit; white-space: pre; pointer-events: none; user-select: none; -webkit-user-select: none; }\n :host([select=\"grid\"]) #grid { pointer-events: auto; user-select: text; -webkit-user-select: text; }\n :host([select=\"grid\"]) slot { pointer-events: none; user-select: none; -webkit-user-select: none; }\n /* Selection invert — mirror of the canonical rule in styles.css\n * (which explains the field choices); update together. */\n ::selection { color: var(--mw-bg, canvas); text-shadow: 0 0 0 var(--mw-bg, canvas); background: var(--mw-fg, canvastext); }\n</style>\n<div id=\"viewport\">\n <pre id=\"grid\" aria-hidden=\"true\"></pre>\n <slot></slot>\n</div>\n", na = "grid", ra = [
|
|
4609
4742
|
"pointerover",
|
|
4610
4743
|
"pointerleave",
|
|
4611
4744
|
"pointerdown",
|
|
@@ -4617,12 +4750,12 @@ var Xi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4617
4750
|
"focusout",
|
|
4618
4751
|
"input",
|
|
4619
4752
|
"change"
|
|
4620
|
-
],
|
|
4753
|
+
], ia = /^(color|opacity|border-(top|right|bottom|left)-color|border-color)$/, aa = 3e4, oa = 200, sa = 3, ca = 4, la = 8, ua = 100, da = 160, fa = typeof HTMLElement > "u" ? class {} : HTMLElement, pa = class e extends fa {
|
|
4621
4754
|
static observedAttributes = ["select"];
|
|
4622
4755
|
static #e = /* @__PURE__ */ new Set();
|
|
4623
4756
|
static #t = null;
|
|
4624
4757
|
static #n = () => {
|
|
4625
|
-
for (let t of e.#e) t.#
|
|
4758
|
+
for (let t of e.#e) t.#fe();
|
|
4626
4759
|
};
|
|
4627
4760
|
static #r(t) {
|
|
4628
4761
|
t instanceof HTMLLinkElement && t.rel === "stylesheet" && !t.sheet && t.addEventListener("load", e.#n, { once: !0 });
|
|
@@ -4659,7 +4792,8 @@ var Xi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4659
4792
|
#y = /* @__PURE__ */ new WeakMap();
|
|
4660
4793
|
#b = null;
|
|
4661
4794
|
#x = null;
|
|
4662
|
-
#S
|
|
4795
|
+
#S = [];
|
|
4796
|
+
#C() {
|
|
4663
4797
|
this.#u?.observe(this, {
|
|
4664
4798
|
childList: !0,
|
|
4665
4799
|
subtree: !0,
|
|
@@ -4671,73 +4805,80 @@ var Xi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4671
4805
|
"colspan",
|
|
4672
4806
|
"rowspan",
|
|
4673
4807
|
"span",
|
|
4674
|
-
...
|
|
4808
|
+
...oe()
|
|
4675
4809
|
]
|
|
4676
4810
|
});
|
|
4677
4811
|
}
|
|
4678
4812
|
constructor() {
|
|
4679
|
-
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML =
|
|
4813
|
+
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML = ta, this.#s = this.#o.getElementById("grid"), this.#c = document.createElement("span"), this.#c.setAttribute("aria-hidden", "true"), this.#c.setAttribute("data-mw-probe", ""), this.#c.style.cssText = "position:absolute!important;top:0!important;left:0!important;visibility:hidden!important;pointer-events:none!important;user-select:none!important;white-space:pre!important;overflow-wrap:normal!important;padding:0!important;margin:0!important;border:0!important;", this.#c.textContent = "M".repeat(100);
|
|
4680
4814
|
}
|
|
4681
4815
|
connectedCallback() {
|
|
4682
|
-
this.hasAttribute("select") || this.setAttribute("select",
|
|
4683
|
-
this.#
|
|
4684
|
-
}), this.#h = C(() => this.#
|
|
4816
|
+
this.hasAttribute("select") || this.setAttribute("select", na), this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#fe()), this.#l.observe(this), this.#G(), this.#l.observe(this.#c), window.addEventListener("resize", this.#ce), this.#u = new MutationObserver(() => this.#fe()), this.#C(), this.#m = se(() => {
|
|
4817
|
+
this.#C(), this.#fe();
|
|
4818
|
+
}), this.#h = C(() => this.#fe()), document.fonts?.ready.then(this.#le).catch((e) => {
|
|
4685
4819
|
console.warn("[monowind] document.fonts.ready failed:", e);
|
|
4686
|
-
}), document.fonts?.addEventListener("loadingdone", this.#
|
|
4687
|
-
for (let e of
|
|
4688
|
-
this.addEventListener("transitionrun", this
|
|
4820
|
+
}), document.fonts?.addEventListener("loadingdone", this.#le);
|
|
4821
|
+
for (let e of ra) this.addEventListener(e, this.#se);
|
|
4822
|
+
this.addEventListener("transitionrun", this.#ie), this.addEventListener("transitionend", this.#ae), this.addEventListener("transitioncancel", this.#ae), this.addEventListener("pointermove", this.#J), this.addEventListener("pointerleave", this.#Y), this.addEventListener("pointerdown", this.#X), this.addEventListener("scroll", this.#B, {
|
|
4689
4823
|
capture: !0,
|
|
4690
4824
|
passive: !0
|
|
4691
|
-
}), this.addEventListener("scrollend", this.#
|
|
4825
|
+
}), this.addEventListener("scrollend", this.#V, { capture: !0 }), this.addEventListener("wheel", this.#U, { passive: !1 }), window.addEventListener("pointerup", this.#Z), window.addEventListener("pointercancel", this.#Z), document.addEventListener("scroll", this.#Q, {
|
|
4692
4826
|
capture: !0,
|
|
4693
4827
|
passive: !0
|
|
4694
|
-
}), e.#i(this), this.#
|
|
4828
|
+
}), e.#i(this), this.#fe();
|
|
4695
4829
|
}
|
|
4696
4830
|
disconnectedCallback() {
|
|
4697
|
-
window.removeEventListener("resize", this.#
|
|
4698
|
-
for (let e of
|
|
4699
|
-
this.removeEventListener("transitionrun", this
|
|
4831
|
+
window.removeEventListener("resize", this.#ce), this.#l?.disconnect(), this.#u?.disconnect(), this.#l = null, this.#u = null, this.#m?.(), this.#m = null, this.#h?.(), this.#h = null, document.fonts?.removeEventListener("loadingdone", this.#le);
|
|
4832
|
+
for (let e of ra) this.removeEventListener(e, this.#se);
|
|
4833
|
+
this.removeEventListener("transitionrun", this.#ie), this.removeEventListener("transitionend", this.#ae), this.removeEventListener("transitioncancel", this.#ae), this.#te = 0, this.removeEventListener("pointermove", this.#J), this.removeEventListener("pointerleave", this.#Y), this.removeEventListener("pointerdown", this.#X), this.removeEventListener("scroll", this.#B, { capture: !0 }), this.removeEventListener("scrollend", this.#V, { capture: !0 }), this.removeEventListener("wheel", this.#U);
|
|
4700
4834
|
for (let e of this.#v.values()) clearTimeout(e);
|
|
4701
|
-
this.#v.clear(), this.#x = null, this.#b = null, window.removeEventListener("pointerup", this.#
|
|
4835
|
+
this.#v.clear(), this.#x = null, this.#b = null, window.removeEventListener("pointerup", this.#Z), window.removeEventListener("pointercancel", this.#Z), document.removeEventListener("scroll", this.#Q, { capture: !0 }), this.#k = null, this.#E = null, this.#D = !1, this.#O = !1, this.#$(), e.#a(this);
|
|
4702
4836
|
}
|
|
4703
|
-
#C = /* @__PURE__ */ new Set();
|
|
4704
4837
|
#w = /* @__PURE__ */ new Set();
|
|
4705
|
-
#T =
|
|
4706
|
-
#E =
|
|
4838
|
+
#T = /* @__PURE__ */ new Set();
|
|
4839
|
+
#E = null;
|
|
4707
4840
|
#D = !1;
|
|
4708
|
-
#O =
|
|
4709
|
-
#k =
|
|
4841
|
+
#O = !1;
|
|
4842
|
+
#k = null;
|
|
4710
4843
|
#A = NaN;
|
|
4711
|
-
#j =
|
|
4712
|
-
|
|
4713
|
-
#N()
|
|
4844
|
+
#j = NaN;
|
|
4845
|
+
#M = null;
|
|
4846
|
+
static #N = typeof matchMedia > "u" ? null : matchMedia("(hover: hover)");
|
|
4847
|
+
#P() {
|
|
4714
4848
|
if (this.#g || this.#d) return;
|
|
4715
4849
|
this.#g = !0;
|
|
4716
4850
|
let e = !1, t = () => {
|
|
4717
4851
|
if (e) return;
|
|
4718
4852
|
e = !0, this.#g = !1;
|
|
4719
4853
|
let t = this.#f;
|
|
4720
|
-
|
|
4854
|
+
this.isConnected && this.#p && t && (this.#F(t), this.#O = !yr(this.#p, this.#s, this.#D), this.#$());
|
|
4721
4855
|
};
|
|
4722
4856
|
requestAnimationFrame(t), setTimeout(t, 50);
|
|
4723
4857
|
}
|
|
4724
|
-
#
|
|
4858
|
+
#F(e, t) {
|
|
4725
4859
|
for (let n of this.#_) {
|
|
4726
4860
|
let r = n.source, { maxX: i, maxY: a } = n.scrollRange, o = t?.get(r);
|
|
4727
4861
|
n.scroll = o ? {
|
|
4728
4862
|
x: o.pinX ? i : Math.min(o.x, i),
|
|
4729
4863
|
y: o.pinY ? a : Math.min(o.y, a)
|
|
4730
|
-
} :
|
|
4731
|
-
x: la(r, "x", e.width, i),
|
|
4732
|
-
y: la(r, "y", e.height, a)
|
|
4733
|
-
};
|
|
4864
|
+
} : this.#I(n, e);
|
|
4734
4865
|
}
|
|
4735
4866
|
}
|
|
4736
|
-
#
|
|
4867
|
+
#I(e, t) {
|
|
4868
|
+
let n = e.source, { maxX: r, maxY: i } = e.scrollRange, a = e.scroll ?? {
|
|
4869
|
+
x: 0,
|
|
4870
|
+
y: 0
|
|
4871
|
+
};
|
|
4872
|
+
return {
|
|
4873
|
+
x: ha(n, "x", t.width, r, a.x),
|
|
4874
|
+
y: ha(n, "y", t.height, i, a.y)
|
|
4875
|
+
};
|
|
4876
|
+
}
|
|
4877
|
+
#L() {
|
|
4737
4878
|
let e = /* @__PURE__ */ new Map(), t = this.#f;
|
|
4738
4879
|
if (!t) return e;
|
|
4739
4880
|
for (let n of this.#_) {
|
|
4740
|
-
let r = n.source, { maxX: i, maxY: a } = n.scrollRange,
|
|
4881
|
+
let r = n.source, { maxX: i, maxY: a } = n.scrollRange, { x: o, y: s } = this.#I(n, t);
|
|
4741
4882
|
e.set(r, {
|
|
4742
4883
|
top: r.scrollTop,
|
|
4743
4884
|
left: r.scrollLeft,
|
|
@@ -4749,56 +4890,56 @@ var Xi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4749
4890
|
}
|
|
4750
4891
|
return e;
|
|
4751
4892
|
}
|
|
4752
|
-
#
|
|
4893
|
+
#R(e) {
|
|
4753
4894
|
for (let t of this.#_) {
|
|
4754
4895
|
let n = t.source, r = e.get(n);
|
|
4755
|
-
r && (n.scrollTop = r.pinY ? n.scrollHeight : r.top, n.scrollLeft = r.pinX ? n.scrollWidth : r.left
|
|
4896
|
+
r && (n.scrollTop, n.scrollLeft, n.scrollTop = r.pinY ? n.scrollHeight : r.top, n.scrollLeft = r.pinX ? n.scrollWidth : r.left);
|
|
4756
4897
|
}
|
|
4757
4898
|
}
|
|
4758
|
-
#
|
|
4899
|
+
#z(e, t) {
|
|
4900
|
+
clearTimeout(this.#v.get(e)), this.#v.set(e, setTimeout(() => this.#H(e), t));
|
|
4901
|
+
}
|
|
4902
|
+
#B = (e) => {
|
|
4759
4903
|
let t = e.target;
|
|
4760
|
-
|
|
4904
|
+
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (this.#P(), !(Date.now() - (this.#y.get(t) ?? 0) < oa) && (clearTimeout(this.#v.get(t)), "onscrollend" in window || this.#z(t, da)));
|
|
4761
4905
|
};
|
|
4762
|
-
#
|
|
4906
|
+
#V = (e) => {
|
|
4763
4907
|
let t = e.target;
|
|
4764
|
-
|
|
4908
|
+
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (Date.now() - (this.#y.get(t) ?? 0) < oa || this.#z(t, ua));
|
|
4765
4909
|
};
|
|
4766
|
-
#
|
|
4910
|
+
#H(e) {
|
|
4767
4911
|
if (this.#x?.el === e) return;
|
|
4768
|
-
this.#
|
|
4912
|
+
this.#P();
|
|
4769
4913
|
let t = this.#f, n = this.#_.find((t) => t.source === e);
|
|
4770
4914
|
if (!t || !n) return;
|
|
4771
|
-
let r = n.scrollRange, i = (
|
|
4772
|
-
let i = Math.min(Math.max(0, Math.round(e / t)), n);
|
|
4773
|
-
return i === n ? r : i * t;
|
|
4774
|
-
}, a = i(e.scrollTop, t.height, r.maxY, e.scrollHeight - e.clientHeight), o = i(e.scrollLeft, t.width, r.maxX, e.scrollWidth - e.clientWidth);
|
|
4915
|
+
let r = n.scrollRange, i = n.scroll ?? this.#I(n, t), a = i.y === r.maxY ? e.scrollHeight - e.clientHeight : i.y * t.height, o = i.x === r.maxX ? e.scrollWidth - e.clientWidth : i.x * t.width;
|
|
4775
4916
|
(Math.abs(e.scrollTop - a) > .5 || Math.abs(e.scrollLeft - o) > .5) && e.scrollTo({
|
|
4776
4917
|
top: a,
|
|
4777
4918
|
left: o,
|
|
4778
4919
|
behavior: "instant"
|
|
4779
4920
|
});
|
|
4780
4921
|
}
|
|
4781
|
-
#
|
|
4922
|
+
#U = (e) => {
|
|
4782
4923
|
if (this.getAttribute("select") !== "grid") return;
|
|
4783
4924
|
let t = this.#p, n = this.#f;
|
|
4784
4925
|
if (!t || !n || this.#_.length === 0) return;
|
|
4785
|
-
let r = e;
|
|
4786
|
-
if (!r.cancelable) return;
|
|
4787
|
-
let { col:
|
|
4926
|
+
let r = e, i = r.deltaMode === 1 ? n.height : r.deltaMode === 2 ? this.clientHeight : 1, a = r.deltaX * i, o = r.deltaY * i;
|
|
4927
|
+
if (!r.cancelable && this.#W(a, o)) return;
|
|
4928
|
+
let { col: s, row: c } = this.#K(r.clientX, r.clientY, n), l = Date.now(), u = Math.abs(a) + Math.abs(o);
|
|
4788
4929
|
if (u === 0) {
|
|
4789
|
-
this.#b = null;
|
|
4930
|
+
this.#b = null, r.preventDefault();
|
|
4790
4931
|
return;
|
|
4791
4932
|
}
|
|
4792
4933
|
let d = (e) => {
|
|
4793
4934
|
let t = e.scrollRange, n = e.source;
|
|
4794
|
-
return
|
|
4795
|
-
}, f = this.#b, p = Math.abs(
|
|
4935
|
+
return o !== 0 && t.maxY > 0 && (o > 0 && n.scrollTop < n.scrollHeight - n.clientHeight - .5 || o < 0 && n.scrollTop > .5) || a !== 0 && t.maxX > 0 && (a > 0 && n.scrollLeft < n.scrollWidth - n.clientWidth - .5 || a < 0 && n.scrollLeft > .5);
|
|
4936
|
+
}, f = this.#b, p = Math.abs(a) >= Math.abs(o) ? "x" : "y", m = f !== null && u > f.mag * 1.25 + 1, h = f !== null && (Math.abs(r.clientX - f.x) > sa || Math.abs(r.clientY - f.y) > sa), g = f !== null && f.decayed >= la, _ = f !== null && l - f.at < oa && p === f.axis && (h ? u <= f.mag : !(g && m)), v = null;
|
|
4796
4937
|
if (_) {
|
|
4797
4938
|
if (f.decayed = u <= f.mag && u >= f.mag * .5 ? f.decayed + 1 : g ? f.decayed : 0, f.mag = u, f.at = l, !f.el) return;
|
|
4798
4939
|
v = this.#_.find((e) => e.source === f.el) ?? null;
|
|
4799
4940
|
}
|
|
4800
4941
|
if (!v) {
|
|
4801
|
-
let e =
|
|
4942
|
+
let e = Se(t, s, c);
|
|
4802
4943
|
for (let t = e.length - 1; t >= 0; t--) {
|
|
4803
4944
|
let n = e[t].node;
|
|
4804
4945
|
if (!n.scrollRange) continue;
|
|
@@ -4807,12 +4948,12 @@ var Xi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4807
4948
|
break;
|
|
4808
4949
|
}
|
|
4809
4950
|
let r = n.style.overscroll;
|
|
4810
|
-
if (
|
|
4951
|
+
if (o !== 0 && !r.y || a !== 0 && !r.x) {
|
|
4811
4952
|
v = n;
|
|
4812
4953
|
break;
|
|
4813
4954
|
}
|
|
4814
4955
|
}
|
|
4815
|
-
if (!v && u <
|
|
4956
|
+
if (!v && u < ca) {
|
|
4816
4957
|
r.preventDefault();
|
|
4817
4958
|
return;
|
|
4818
4959
|
}
|
|
@@ -4828,116 +4969,125 @@ var Xi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4828
4969
|
}
|
|
4829
4970
|
if (!v || (r.preventDefault(), !d(v))) return;
|
|
4830
4971
|
let y = v.source, b = v.scrollRange, x = { behavior: "instant" };
|
|
4831
|
-
|
|
4972
|
+
o !== 0 && b.maxY > 0 && (x.top = o), a !== 0 && b.maxX > 0 && (x.left = a), y.scrollBy(x), this.#y.set(y, l), this.#z(y, oa);
|
|
4832
4973
|
};
|
|
4833
|
-
#
|
|
4834
|
-
|
|
4974
|
+
#W(e, t) {
|
|
4975
|
+
return this.#S.some((n) => t > 0 && n.scrollTop < n.scrollHeight - n.clientHeight - .5 || t < 0 && n.scrollTop > .5 || e > 0 && n.scrollLeft < n.scrollWidth - n.clientWidth - .5 || e < 0 && n.scrollLeft > .5);
|
|
4976
|
+
}
|
|
4977
|
+
#G() {
|
|
4978
|
+
let e = this.parentElement;
|
|
4979
|
+
if (e && this.#l) {
|
|
4980
|
+
this.#l.observe(e);
|
|
4981
|
+
for (let t of e.children) t !== this && this.#l.observe(t);
|
|
4982
|
+
}
|
|
4983
|
+
}
|
|
4984
|
+
#K(e, t, n) {
|
|
4985
|
+
if (!this.#M) {
|
|
4835
4986
|
let e = this.#s.getBoundingClientRect();
|
|
4836
|
-
this.#
|
|
4987
|
+
this.#M = {
|
|
4837
4988
|
left: e.left,
|
|
4838
4989
|
top: e.top
|
|
4839
4990
|
};
|
|
4840
4991
|
}
|
|
4841
4992
|
return {
|
|
4842
|
-
col: Math.floor((e - this.#
|
|
4843
|
-
row: Math.floor((t - this.#
|
|
4993
|
+
col: Math.floor((e - this.#M.left) / n.width),
|
|
4994
|
+
row: Math.floor((t - this.#M.top) / n.height)
|
|
4844
4995
|
};
|
|
4845
4996
|
}
|
|
4846
|
-
#
|
|
4997
|
+
#q(e, t) {
|
|
4847
4998
|
let n = this.#p, r = this.#f;
|
|
4848
4999
|
if (!n || !r || this.#_.length === 0) return null;
|
|
4849
|
-
let { col: i, row: a } = this.#
|
|
5000
|
+
let { col: i, row: a } = this.#K(e, t, r), o = Se(n, i, a);
|
|
4850
5001
|
for (let n = o.length - 1; n >= 0; n--) {
|
|
4851
5002
|
let { node: s, x: c, y: l } = o[n], u = s.scrollRange;
|
|
4852
5003
|
if (!u) continue;
|
|
4853
|
-
let d = s.
|
|
4854
|
-
if (
|
|
4855
|
-
|
|
4856
|
-
if (f.right > 0 && u.maxY > 0 && i >= _ - f.right && i < _ && a >= m && a < g) {
|
|
4857
|
-
let e = g - m - f.bottom, n = dr(e, u.sizeY, u.maxY, 0).len, i = Math.max(1, (e - n) * r.height);
|
|
5004
|
+
let d = s.source, { y: f, x: p } = pr(s, c, l);
|
|
5005
|
+
if (f && u.maxY > 0 && i >= f.col && i < f.col + f.thick && a >= f.row && a < f.row + f.len) {
|
|
5006
|
+
let e = mr(f.len, u.sizeY, u.maxY, 0).len, n = Math.max(1, (f.len - e) * r.height);
|
|
4858
5007
|
return {
|
|
4859
|
-
el:
|
|
5008
|
+
el: d,
|
|
4860
5009
|
axis: "y",
|
|
4861
5010
|
startClient: t,
|
|
4862
|
-
startPx:
|
|
4863
|
-
factor: u.maxY * r.height /
|
|
5011
|
+
startPx: d.scrollTop,
|
|
5012
|
+
factor: u.maxY * r.height / n
|
|
4864
5013
|
};
|
|
4865
5014
|
}
|
|
4866
|
-
if (
|
|
4867
|
-
let t =
|
|
5015
|
+
if (p && u.maxX > 0 && a >= p.row && a < p.row + p.thick && i >= p.col && i < p.col + p.len) {
|
|
5016
|
+
let t = mr(p.len, u.sizeX, u.maxX, 0).len, n = Math.max(1, (p.len - t) * r.width);
|
|
4868
5017
|
return {
|
|
4869
|
-
el:
|
|
5018
|
+
el: d,
|
|
4870
5019
|
axis: "x",
|
|
4871
5020
|
startClient: e,
|
|
4872
|
-
startPx:
|
|
4873
|
-
factor: u.maxX * r.width /
|
|
5021
|
+
startPx: d.scrollLeft,
|
|
5022
|
+
factor: u.maxX * r.width / n
|
|
4874
5023
|
};
|
|
4875
5024
|
}
|
|
4876
5025
|
}
|
|
4877
5026
|
return null;
|
|
4878
5027
|
}
|
|
4879
|
-
#
|
|
5028
|
+
#J = (e) => {
|
|
5029
|
+
if (_a(e)) return;
|
|
4880
5030
|
let { clientX: t, clientY: n } = e, r = this.#x;
|
|
4881
5031
|
if (r) {
|
|
4882
5032
|
let e = (r.axis === "y" ? n : t) - r.startClient, i = r.startPx + e * r.factor;
|
|
4883
5033
|
r.axis === "y" ? r.el.scrollTop = i : r.el.scrollLeft = i;
|
|
4884
5034
|
return;
|
|
4885
5035
|
}
|
|
4886
|
-
this.#
|
|
5036
|
+
this.#k = {
|
|
4887
5037
|
x: t,
|
|
4888
5038
|
y: n
|
|
4889
5039
|
};
|
|
4890
5040
|
let i = this.#f;
|
|
4891
5041
|
if (i) {
|
|
4892
|
-
let { col: e, row: r } = this.#
|
|
4893
|
-
if (e === this.#
|
|
5042
|
+
let { col: e, row: r } = this.#K(t, n, i);
|
|
5043
|
+
if (e === this.#A && r === this.#j) return;
|
|
4894
5044
|
}
|
|
4895
|
-
this
|
|
5045
|
+
this.#$();
|
|
4896
5046
|
};
|
|
4897
|
-
#
|
|
4898
|
-
this.#
|
|
5047
|
+
#Y = () => {
|
|
5048
|
+
this.#k = null, this.#$();
|
|
4899
5049
|
};
|
|
4900
|
-
#
|
|
5050
|
+
#X = (e) => {
|
|
4901
5051
|
let t = e;
|
|
4902
|
-
if (!t.isPrimary || t.button !== 0) return;
|
|
4903
|
-
let n =
|
|
5052
|
+
if (!t.isPrimary || t.button !== 0 || _a(t)) return;
|
|
5053
|
+
let n = this.#q(t.clientX, t.clientY);
|
|
4904
5054
|
if (n) {
|
|
4905
5055
|
this.#x = n, t.preventDefault(), t.isTrusted && this.setPointerCapture(t.pointerId);
|
|
4906
5056
|
return;
|
|
4907
5057
|
}
|
|
4908
|
-
this.#
|
|
5058
|
+
this.#k = {
|
|
4909
5059
|
x: t.clientX,
|
|
4910
5060
|
y: t.clientY
|
|
4911
|
-
}, this.#
|
|
5061
|
+
}, this.#D = !0, this.#$(!0);
|
|
4912
5062
|
};
|
|
4913
|
-
#
|
|
5063
|
+
#Z = (e) => {
|
|
4914
5064
|
if (e.isPrimary) {
|
|
4915
5065
|
if (this.#x) {
|
|
4916
|
-
this.#
|
|
5066
|
+
this.#H(this.#x.el), this.#x = null;
|
|
4917
5067
|
return;
|
|
4918
5068
|
}
|
|
4919
|
-
|
|
5069
|
+
(this.#D || this.#E) && (this.#D = !1, this.#E = null, this.#$(), this.#O && this.#fe());
|
|
4920
5070
|
}
|
|
4921
5071
|
};
|
|
4922
|
-
#
|
|
4923
|
-
if (!this.#
|
|
5072
|
+
#Q = (e) => {
|
|
5073
|
+
if (!this.#k) return;
|
|
4924
5074
|
let t = e.target;
|
|
4925
|
-
t instanceof HTMLElement && t.hasAttribute("data-mw-scroll") || (this.#
|
|
5075
|
+
t instanceof HTMLElement && t.hasAttribute("data-mw-scroll") || (this.#M = null, this.#$());
|
|
4926
5076
|
};
|
|
4927
|
-
|
|
5077
|
+
#$(t = !1) {
|
|
4928
5078
|
let n = this.#p, r = this.#f, i = [];
|
|
4929
|
-
if (this.#
|
|
4930
|
-
let { col: e, row: t } = this.#
|
|
4931
|
-
this.#
|
|
4932
|
-
} else this.#
|
|
5079
|
+
if (this.#k && n && r && this.isConnected && this.getAttribute("select") === "grid" && (this.#D || e.#N?.matches)) {
|
|
5080
|
+
let { col: e, row: t } = this.#K(this.#k.x, this.#k.y, r);
|
|
5081
|
+
this.#A = e, this.#j = t, i = Ce(n, e, t);
|
|
5082
|
+
} else this.#A = NaN, this.#j = NaN;
|
|
4933
5083
|
let a = i.at(-1) ?? null;
|
|
4934
|
-
t && (this.#
|
|
4935
|
-
let o = e.#
|
|
4936
|
-
l = this.#
|
|
5084
|
+
t && (this.#E = a);
|
|
5085
|
+
let o = e.#N?.matches ? i : [], s = this.#E ? i.indexOf(this.#E) : -1, c = s >= 0 ? i.slice(0, s + 1) : [], l = this.#ee("data-mw-hover", this.#w, o);
|
|
5086
|
+
l = this.#ee("data-mw-active", this.#T, c) || l;
|
|
4937
5087
|
let u = a ? getComputedStyle(a).cursor : "";
|
|
4938
|
-
this.#s.style.cursor = u === "auto" ? "" : u, l && this.isConnected && this.#
|
|
5088
|
+
this.#s.style.cursor = u === "auto" ? "" : u, l && this.isConnected && this.#fe();
|
|
4939
5089
|
}
|
|
4940
|
-
#
|
|
5090
|
+
#ee(e, t, n) {
|
|
4941
5091
|
let r = !1, i = new Set(n);
|
|
4942
5092
|
for (let n of t) i.has(n) || (n.removeAttribute(e), r = !0);
|
|
4943
5093
|
for (let n of i) t.has(n) || (n.setAttribute(e, ""), r = !0);
|
|
@@ -4945,51 +5095,53 @@ var Xi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4945
5095
|
for (let e of i) t.add(e);
|
|
4946
5096
|
return r;
|
|
4947
5097
|
}
|
|
4948
|
-
#
|
|
4949
|
-
#
|
|
4950
|
-
#
|
|
4951
|
-
|
|
4952
|
-
|
|
5098
|
+
#te = 0;
|
|
5099
|
+
#ne = !1;
|
|
5100
|
+
#re = 0;
|
|
5101
|
+
#ie = (e) => {
|
|
5102
|
+
ia.test(e.propertyName) && (this.#te++, this.#re = performance.now(), this.#oe());
|
|
4953
5103
|
};
|
|
4954
|
-
#
|
|
4955
|
-
|
|
5104
|
+
#ae = (e) => {
|
|
5105
|
+
ia.test(e.propertyName) && (this.#te = Math.max(0, this.#te - 1));
|
|
4956
5106
|
};
|
|
4957
|
-
#
|
|
4958
|
-
if (this.#
|
|
4959
|
-
this.#
|
|
5107
|
+
#oe() {
|
|
5108
|
+
if (this.#ne) return;
|
|
5109
|
+
this.#ne = !0;
|
|
4960
5110
|
let e = () => {
|
|
4961
|
-
if (!this.isConnected || this.#
|
|
4962
|
-
this.#
|
|
5111
|
+
if (!this.isConnected || this.#te === 0 && !a() || performance.now() - this.#re > aa) {
|
|
5112
|
+
this.#ne = !1, this.#te = 0, this.#fe();
|
|
4963
5113
|
return;
|
|
4964
5114
|
}
|
|
4965
|
-
this.#
|
|
5115
|
+
this.#de(), requestAnimationFrame(e);
|
|
4966
5116
|
};
|
|
4967
5117
|
requestAnimationFrame(e);
|
|
4968
5118
|
}
|
|
4969
|
-
#
|
|
4970
|
-
if ((e
|
|
4971
|
-
|
|
4972
|
-
|
|
5119
|
+
#se = (e) => {
|
|
5120
|
+
if (!_a(e)) {
|
|
5121
|
+
if ((e.type === "focusin" || e.type === "focusout") && e.target instanceof HTMLSelectElement) {
|
|
5122
|
+
this.#de();
|
|
5123
|
+
return;
|
|
5124
|
+
}
|
|
5125
|
+
this.#fe();
|
|
4973
5126
|
}
|
|
4974
|
-
this.#se();
|
|
4975
5127
|
};
|
|
4976
5128
|
attributeChangedCallback(e, t, n) {
|
|
4977
5129
|
if (e === "select" && n !== "text" && n !== "grid") {
|
|
4978
|
-
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`, this), this.setAttribute("select",
|
|
5130
|
+
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`, ee(this)), this.setAttribute("select", na);
|
|
4979
5131
|
return;
|
|
4980
5132
|
}
|
|
4981
|
-
e === "select" && this
|
|
5133
|
+
e === "select" && this.#$(), this.#fe();
|
|
4982
5134
|
}
|
|
4983
5135
|
toPlainText() {
|
|
4984
|
-
return this.#d && this.#
|
|
5136
|
+
return this.#d && this.#pe(), this.#p ? ir(this.#p) : "";
|
|
4985
5137
|
}
|
|
4986
|
-
#
|
|
4987
|
-
this.#
|
|
5138
|
+
#ce = () => {
|
|
5139
|
+
this.#fe();
|
|
4988
5140
|
};
|
|
4989
|
-
#
|
|
4990
|
-
requestAnimationFrame(() => this.#
|
|
5141
|
+
#le = () => {
|
|
5142
|
+
requestAnimationFrame(() => this.#fe());
|
|
4991
5143
|
};
|
|
4992
|
-
#
|
|
5144
|
+
#ue() {
|
|
4993
5145
|
let e = document.activeElement;
|
|
4994
5146
|
if (!(e instanceof HTMLSelectElement) || !this.contains(e)) return !1;
|
|
4995
5147
|
try {
|
|
@@ -4998,25 +5150,25 @@ var Xi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4998
5150
|
return !1;
|
|
4999
5151
|
}
|
|
5000
5152
|
}
|
|
5001
|
-
#
|
|
5153
|
+
#de() {
|
|
5002
5154
|
try {
|
|
5003
|
-
this.#
|
|
5155
|
+
this.#pe();
|
|
5004
5156
|
} catch (e) {
|
|
5005
5157
|
console.error("[monowind] layout failed:", e);
|
|
5006
5158
|
}
|
|
5007
5159
|
}
|
|
5008
|
-
#
|
|
5160
|
+
#fe() {
|
|
5009
5161
|
this.#d || (this.#d = !0, requestAnimationFrame(() => {
|
|
5010
|
-
if (this.#d = !1, this.#
|
|
5011
|
-
this.#
|
|
5162
|
+
if (this.#d = !1, this.#ue()) {
|
|
5163
|
+
this.#fe();
|
|
5012
5164
|
return;
|
|
5013
5165
|
}
|
|
5014
|
-
this.#
|
|
5166
|
+
this.#de();
|
|
5015
5167
|
}));
|
|
5016
5168
|
}
|
|
5017
|
-
#
|
|
5169
|
+
#pe() {
|
|
5018
5170
|
if (!this.isConnected) return;
|
|
5019
|
-
let e = this.#
|
|
5171
|
+
let e = this.#L(), t = /* @__PURE__ */ new Map(), n = getComputedStyle(this).getPropertyValue("--mw-cw").trim(), r = parseFloat(n);
|
|
5020
5172
|
if (Number.isFinite(r) && r > 0) for (let e of this.querySelectorAll("textarea")) {
|
|
5021
5173
|
let n = getComputedStyle(e), i = e.clientWidth - (parseFloat(n.paddingLeft) || 0) - (parseFloat(n.paddingRight) || 0);
|
|
5022
5174
|
t.set(e, Math.max(0, Math.round(i / r)));
|
|
@@ -5024,23 +5176,23 @@ var Xi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5024
5176
|
this.setAttribute("measuring", "");
|
|
5025
5177
|
try {
|
|
5026
5178
|
this.#c.parentNode !== this && this.appendChild(this.#c);
|
|
5027
|
-
let n =
|
|
5179
|
+
let n = Te(this, this.#c), r = this.#f;
|
|
5028
5180
|
(r === null || r.width !== n.width || r.height !== n.height || r.letterSpacing !== n.letterSpacing || r.inkOverhang !== n.inkOverhang) && (this.style.setProperty("--mw-cw", `${n.width}px`), this.style.setProperty("--mw-ch", `${n.height}px`), this.style.setProperty("--mw-rls", `${n.letterSpacing}px`), this.style.setProperty("--mw-ink", `${n.inkOverhang ?? 0}px`)), this.#f = n;
|
|
5029
5181
|
let i = getComputedStyle(this), a = (parseFloat(i.paddingLeft) || 0) + (parseFloat(i.paddingRight) || 0), o = Math.max(0, Math.floor((this.clientWidth - a) / n.width));
|
|
5030
5182
|
if (o === 0) return;
|
|
5031
|
-
let s =
|
|
5183
|
+
let s = Ee(), c = [];
|
|
5032
5184
|
for (let e of Array.from(this.children)) {
|
|
5033
5185
|
if (e === this.#c) continue;
|
|
5034
|
-
let r =
|
|
5186
|
+
let r = Ii(e, s, n, t);
|
|
5035
5187
|
r && c.push(r);
|
|
5036
5188
|
}
|
|
5037
|
-
if (
|
|
5189
|
+
if (Zi(this) ? (this.hasAttribute("data-mw-dropped-text") || console.warn(`[monowind] ${Qi}`, ee(this)), this.setAttribute("data-mw-dropped-text", "")) : this.removeAttribute("data-mw-dropped-text"), c.length === 0) {
|
|
5038
5190
|
this.#s.replaceChildren(), this.#p = null, this.setAttribute("data-mw-ready", "");
|
|
5039
5191
|
return;
|
|
5040
5192
|
}
|
|
5041
5193
|
let l = {
|
|
5042
5194
|
source: this,
|
|
5043
|
-
style:
|
|
5195
|
+
style: at(),
|
|
5044
5196
|
children: c,
|
|
5045
5197
|
text: "",
|
|
5046
5198
|
intrinsicWidth: 0,
|
|
@@ -5052,26 +5204,38 @@ var Xi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5052
5204
|
height: 0
|
|
5053
5205
|
},
|
|
5054
5206
|
unclampedHeight: 0,
|
|
5055
|
-
resolvedPadding:
|
|
5056
|
-
}, { height: u } =
|
|
5057
|
-
|
|
5207
|
+
resolvedPadding: ot()
|
|
5208
|
+
}, { height: u } = In(l, o);
|
|
5209
|
+
Dr(l), this.#_ = va(l), this.#F(n, e), this.#O = !yr(l, this.#s, this.#D), this.#p = l;
|
|
5058
5210
|
let d = `${l.localRect.width * n.width}px`, f = `${l.localRect.height * n.height}px`;
|
|
5059
5211
|
this.#s.style.width !== d && (this.#s.style.width = d), this.#s.style.height !== f && (this.#s.style.height = f);
|
|
5060
5212
|
let p = i.boxSizing === "border-box" ? (parseFloat(i.paddingTop) || 0) + (parseFloat(i.paddingBottom) || 0) + (parseFloat(i.borderTopWidth) || 0) + (parseFloat(i.borderBottomWidth) || 0) : 0, m = `${u * n.height + p}px`;
|
|
5061
|
-
this.style.height !== m && (this.style.height = m)
|
|
5213
|
+
this.style.height !== m && (this.style.height = m);
|
|
5214
|
+
let h = i.boxSizing === "border-box" ? a + (parseFloat(i.borderLeftWidth) || 0) + (parseFloat(i.borderRightWidth) || 0) : 0, g = `${o * n.width + h}px`;
|
|
5215
|
+
this.style.getPropertyValue("--mw-host-w") !== g && this.style.setProperty("--mw-host-w", g), this.hasAttribute("data-mw-ready") || this.setAttribute("data-mw-ready", "");
|
|
5062
5216
|
} finally {
|
|
5063
|
-
this.setAttribute("settling", ""), this.removeAttribute("measuring"), getComputedStyle(this).transitionProperty, this.removeAttribute("settling"), this.#
|
|
5217
|
+
this.setAttribute("settling", ""), this.removeAttribute("measuring"), getComputedStyle(this).transitionProperty, this.removeAttribute("settling"), this.#R(e), this.#u?.takeRecords(), i(this) && (a() ? (this.#re = performance.now(), this.#oe()) : this.#fe()), this.#G(), this.#S = [];
|
|
5218
|
+
let t = document.scrollingElement ?? document.documentElement;
|
|
5219
|
+
for (let e = this.parentElement; e; e = e.parentElement) (e === t || /auto|scroll/.test(getComputedStyle(e).overflow)) && this.#S.push(e);
|
|
5220
|
+
this.#M = null, this.#k && this.#$();
|
|
5064
5221
|
}
|
|
5065
5222
|
}
|
|
5066
5223
|
};
|
|
5067
|
-
function
|
|
5068
|
-
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind",
|
|
5224
|
+
function ma() {
|
|
5225
|
+
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind", pa);
|
|
5226
|
+
}
|
|
5227
|
+
function ha(e, t, n, r, i) {
|
|
5228
|
+
return ga(t === "y" ? e.scrollTop : e.scrollLeft, t === "y" ? e.scrollHeight - e.clientHeight : e.scrollWidth - e.clientWidth, n, r, i);
|
|
5229
|
+
}
|
|
5230
|
+
function ga(e, t, n, r, i) {
|
|
5231
|
+
if (r > 0 && e > 0 && e >= t - 1) return r;
|
|
5232
|
+
let a = e / n - i, o = Math.abs(a) <= .5 ? i : i + Math.sign(a) * Math.round(Math.abs(a));
|
|
5233
|
+
return Math.min(Math.max(0, o), r);
|
|
5069
5234
|
}
|
|
5070
|
-
function
|
|
5071
|
-
|
|
5072
|
-
return r > 0 && i > 0 && i >= a - 1 ? r : Math.min(Math.max(0, Math.floor((i + 1) / n)), r);
|
|
5235
|
+
function _a(e) {
|
|
5236
|
+
return e instanceof PointerEvent && e.pointerType === "touch" && e.type !== "pointerup";
|
|
5073
5237
|
}
|
|
5074
|
-
function
|
|
5238
|
+
function va(e) {
|
|
5075
5239
|
let t = [], n = (e) => {
|
|
5076
5240
|
e.scrollRange && t.push(e);
|
|
5077
5241
|
for (let t of e.children) n(t);
|
|
@@ -5079,6 +5243,6 @@ function ua(e) {
|
|
|
5079
5243
|
return n(e), t;
|
|
5080
5244
|
}
|
|
5081
5245
|
//#endregion
|
|
5082
|
-
export {
|
|
5246
|
+
export { pa as MonoWindElement, ma as defineMonoWind, ie as invalidateLeaves, Xt as multicolLines, x as registerBorderGlyphs, re as registerLeafRenderer, ir as renderPlainText, De as wrapLines };
|
|
5083
5247
|
|
|
5084
5248
|
//# sourceMappingURL=index.js.map
|