monowind 0.2.3 → 0.2.5
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 +14 -2
- package/dist/cdn.js +1205 -29
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/index.js +1500 -1025
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +5 -0
- package/dist/layout.d.ts.map +1 -1
- package/dist/leaf.d.ts +4 -0
- package/dist/leaf.d.ts.map +1 -1
- package/dist/paint.d.ts.map +1 -1
- package/dist/plain-text.d.ts +29 -0
- package/dist/plain-text.d.ts.map +1 -1
- package/dist/pointer.d.ts.map +1 -1
- package/dist/selection.d.ts +61 -0
- package/dist/selection.d.ts.map +1 -0
- package/dist/sort.js +233 -5
- package/dist/sort.js.map +1 -1
- package/dist/style.d.ts.map +1 -1
- package/dist/tree.d.ts.map +1 -1
- package/dist/types.d.ts +42 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- 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,
|
|
@@ -327,7 +327,7 @@ x("single", {
|
|
|
327
327
|
dashed: A,
|
|
328
328
|
dotted: A
|
|
329
329
|
});
|
|
330
|
-
function
|
|
330
|
+
function ee(e) {
|
|
331
331
|
return {
|
|
332
332
|
track: e?.solid?.scrollTrack ?? "░",
|
|
333
333
|
thumb: e?.solid?.scrollThumb ?? "█"
|
|
@@ -341,57 +341,57 @@ x("blocks", {
|
|
|
341
341
|
});
|
|
342
342
|
//#endregion
|
|
343
343
|
//#region src/warn.ts
|
|
344
|
-
var
|
|
345
|
-
function
|
|
346
|
-
let n =
|
|
347
|
-
n ||
|
|
344
|
+
var j = /* @__PURE__ */ new WeakMap();
|
|
345
|
+
function M(e, t) {
|
|
346
|
+
let n = j.get(e);
|
|
347
|
+
n || j.set(e, n = /* @__PURE__ */ new Set()), !n.has(t) && (n.add(t), console.warn(`[monowind] ${t}`, te(e)));
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function te(e) {
|
|
350
350
|
if (!globalThis.process?.versions?.node) return e;
|
|
351
351
|
let t = e.id ? `#${e.id}` : "", n = e.classList.length ? `.${Array.from(e.classList).join(".")}` : "";
|
|
352
352
|
return `<${e.tagName.toLowerCase()}${t}${n}>`;
|
|
353
353
|
}
|
|
354
354
|
//#endregion
|
|
355
355
|
//#region src/leaf.ts
|
|
356
|
-
var
|
|
357
|
-
function
|
|
356
|
+
var ne = /* @__PURE__ */ new Map(), re = /* @__PURE__ */ new Set();
|
|
357
|
+
function ie(e) {
|
|
358
358
|
let t = e.tag.toLowerCase();
|
|
359
359
|
if (!t.includes("-")) {
|
|
360
360
|
console.warn(`[monowind] registerLeafRenderer: "${e.tag}" is not a custom-element tag name (needs a hyphen); ignored.`);
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
ne.has(t) && console.warn(`[monowind] registerLeafRenderer: replacing existing renderer for <${t}> (last registration wins).`), ne.set(t, {
|
|
364
364
|
...e,
|
|
365
365
|
tag: t
|
|
366
|
-
}),
|
|
366
|
+
}), ue();
|
|
367
367
|
}
|
|
368
|
-
function
|
|
369
|
-
|
|
368
|
+
function ae() {
|
|
369
|
+
ue();
|
|
370
370
|
}
|
|
371
|
-
function
|
|
372
|
-
return
|
|
371
|
+
function oe(e) {
|
|
372
|
+
return ne.get(e.toLowerCase());
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function se() {
|
|
375
375
|
let e = /* @__PURE__ */ new Set();
|
|
376
|
-
for (let t of
|
|
376
|
+
for (let t of ne.values()) for (let n of t.observedAttributes ?? []) e.add(n.toLowerCase());
|
|
377
377
|
return [...e];
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
return
|
|
379
|
+
function ce(e) {
|
|
380
|
+
return re.add(e), () => re.delete(e);
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function le(e, t) {
|
|
383
383
|
try {
|
|
384
384
|
return e.render(t);
|
|
385
385
|
} catch (n) {
|
|
386
|
-
return
|
|
386
|
+
return M(t, `<${e.tag}> renderer threw; rendering nothing. ${String(n)}`), null;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
function
|
|
390
|
-
for (let e of
|
|
389
|
+
function ue() {
|
|
390
|
+
for (let e of re) e();
|
|
391
391
|
}
|
|
392
392
|
//#endregion
|
|
393
393
|
//#region src/borders.ts
|
|
394
|
-
function
|
|
394
|
+
function de(e, t, n) {
|
|
395
395
|
let r = e.border;
|
|
396
396
|
if (r.top === 0 && r.right === 0 && r.bottom === 0 && r.left === 0) return;
|
|
397
397
|
let i = Math.max(r.top, r.right, r.bottom, r.left);
|
|
@@ -407,11 +407,11 @@ function ue(e, t, n) {
|
|
|
407
407
|
width: t.width - (i.left ? a : 0) - (i.right ? a : 0),
|
|
408
408
|
height: t.height - (i.top ? a : 0) - (i.bottom ? a : 0)
|
|
409
409
|
};
|
|
410
|
-
o.width <= 0 || o.height <= 0 ||
|
|
410
|
+
o.width <= 0 || o.height <= 0 || fe(n, e.borderStyle, e.borderColor, o, i, S(e.glyphSet));
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
let o =
|
|
413
|
+
function fe(e, t, n, r, i, a) {
|
|
414
|
+
let o = _e(t.top, a), s = _e(t.right, a), c = _e(t.bottom, a), l = _e(t.left, a), u = (e, t, n) => n(_e(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;
|
|
415
415
|
if (i.top && _ > g && e.push({
|
|
416
416
|
glyph: o.h,
|
|
417
417
|
x: g,
|
|
@@ -464,13 +464,13 @@ function de(e, t, n, r, i, a) {
|
|
|
464
464
|
color: n.bottom
|
|
465
465
|
}));
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function pe(e, t) {
|
|
468
468
|
return e.style.position !== "static" || (t.style.display === "flex" || t.style.display === "grid") && e.style.zIndex !== null;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function me(e) {
|
|
471
471
|
if (e.children.length <= 1) return e.children;
|
|
472
472
|
let t = null, n = null, r = null, i = null;
|
|
473
|
-
for (let a of e.children)
|
|
473
|
+
for (let a of e.children) pe(a, e) ? (a.style.zIndex ?? 0) < 0 ? (t ??= []).push(a) : (i ??= []).push(a) : a.inlineBox ? (r ??= []).push(a) : (n ??= []).push(a);
|
|
474
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 : [
|
|
475
475
|
...t ?? [],
|
|
476
476
|
...n ?? [],
|
|
@@ -478,11 +478,11 @@ function pe(e) {
|
|
|
478
478
|
...i ?? []
|
|
479
479
|
];
|
|
480
480
|
}
|
|
481
|
-
function
|
|
482
|
-
let r =
|
|
481
|
+
function he(e, t, n) {
|
|
482
|
+
let r = _e(e, n);
|
|
483
483
|
return t === "h" ? r.h : r.v;
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function ge(e, t, n, r, i, a) {
|
|
486
486
|
let o = (t ? 8 : 0) | (n ? 4 : 0) | (r ? 2 : 0) | !!i;
|
|
487
487
|
if (a) {
|
|
488
488
|
let t = w(o), n = t && a[e]?.[t];
|
|
@@ -490,8 +490,8 @@ function he(e, t, n, r, i, a) {
|
|
|
490
490
|
}
|
|
491
491
|
return (e === "double" ? E : T)[o];
|
|
492
492
|
}
|
|
493
|
-
function
|
|
494
|
-
let n = (n, r, i, a) =>
|
|
493
|
+
function _e(e, t) {
|
|
494
|
+
let n = (n, r, i, a) => ge(e, n, r, i, a, t), r = {
|
|
495
495
|
h: n(!1, !1, !0, !0),
|
|
496
496
|
v: n(!0, !0, !1, !1),
|
|
497
497
|
tl: n(!1, !0, !1, !0),
|
|
@@ -502,24 +502,24 @@ function ge(e, t) {
|
|
|
502
502
|
return e === "dashed" ? {
|
|
503
503
|
h: "╌",
|
|
504
504
|
v: "╎",
|
|
505
|
-
...
|
|
506
|
-
...
|
|
505
|
+
...ve(r),
|
|
506
|
+
...ye(t, e)
|
|
507
507
|
} : e === "dotted" ? {
|
|
508
508
|
h: "┄",
|
|
509
509
|
v: "┊",
|
|
510
|
-
...
|
|
511
|
-
...
|
|
510
|
+
...ve(r),
|
|
511
|
+
...ye(t, e)
|
|
512
512
|
} : r;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function ve(e) {
|
|
515
515
|
let { h: t, v: n, ...r } = e;
|
|
516
516
|
return r;
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function ye(e, t) {
|
|
519
519
|
let n = e?.[t], r = {};
|
|
520
520
|
return n?.h && (r.h = n.h), n?.v && (r.v = n.v), r;
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function be(e, t, n, r) {
|
|
523
523
|
let i = e.map((e) => e.spanned ? !1 : n === "between" ? e.beforeOccupied && e.afterOccupied : n !== "around" || e.beforeOccupied || e.afterOccupied), a = [];
|
|
524
524
|
for (let n = 0; n < e.length; n++) if (a.push({
|
|
525
525
|
start: e[n].start,
|
|
@@ -563,7 +563,7 @@ function ye(e, t, n, r) {
|
|
|
563
563
|
end: e.end - r
|
|
564
564
|
})).filter((e) => e.end > e.start);
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function xe(e) {
|
|
567
567
|
let t = [], n = e.border.left + e.padding.left, r = e.border.top + e.padding.top, i = (e, t) => ({
|
|
568
568
|
line: t.bandStart + Math.floor((t.bandSize - e.width) / 2),
|
|
569
569
|
start: t.start,
|
|
@@ -572,7 +572,7 @@ function be(e) {
|
|
|
572
572
|
endHalf: t.endHalf === !0
|
|
573
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);
|
|
574
574
|
if (e.ruleX) {
|
|
575
|
-
let i =
|
|
575
|
+
let i = he(e.ruleX.style, "v", e.glyphs);
|
|
576
576
|
for (let o of a) {
|
|
577
577
|
for (let a = 0; a < s; a++) for (let s = o.start; s < o.end; s++) u(o.line + a, s) || t.push({
|
|
578
578
|
glyph: i,
|
|
@@ -581,7 +581,7 @@ function be(e) {
|
|
|
581
581
|
length: 1,
|
|
582
582
|
color: e.ruleX.color
|
|
583
583
|
});
|
|
584
|
-
|
|
584
|
+
Se(e, t, "x", o.line, o.start, o.end);
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
if (e.ruleY) {
|
|
@@ -592,7 +592,7 @@ function be(e) {
|
|
|
592
592
|
for (let d = u.start; d < u.end; d++) {
|
|
593
593
|
let u = l(a, s, d, f), p = l(a, s, d, f + 1);
|
|
594
594
|
t.push({
|
|
595
|
-
glyph: u || p ?
|
|
595
|
+
glyph: u || p ? ge(i ? "double" : "solid", u, p, l(o, c, f, d), l(o, c, f, d + 1), e.glyphs) : he(e.ruleY.style, "h", e.glyphs),
|
|
596
596
|
x: n + d,
|
|
597
597
|
y: r + f,
|
|
598
598
|
length: 1,
|
|
@@ -600,16 +600,16 @@ function be(e) {
|
|
|
600
600
|
});
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
|
-
|
|
603
|
+
Se(e, t, "y", u.line, u.start, u.end);
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
return t;
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function Se(e, t, n, r, i, a) {
|
|
609
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) => {
|
|
610
610
|
let d = o.style === "double" && i === "double" ? "double" : "solid";
|
|
611
611
|
t.push({
|
|
612
|
-
glyph:
|
|
612
|
+
glyph: ge(d, s, c, l, u, e.glyphs),
|
|
613
613
|
x: n,
|
|
614
614
|
y: r,
|
|
615
615
|
length: 1,
|
|
@@ -626,39 +626,17 @@ function xe(e, t, n, r, i, a) {
|
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
628
|
//#endregion
|
|
629
|
-
//#region src/pointer.ts
|
|
630
|
-
function Se(e, t, n) {
|
|
631
|
-
let r = [], i = e, a = e.localRect.x, o = e.localRect.y;
|
|
632
|
-
for (;;) {
|
|
633
|
-
let e = null;
|
|
634
|
-
for (let r of pe(i)) {
|
|
635
|
-
if (r.tableHidden) continue;
|
|
636
|
-
let i = a + r.localRect.x, s = o + r.localRect.y;
|
|
637
|
-
t >= i && t < i + r.localRect.width && n >= s && n < s + r.localRect.height && (e = r);
|
|
638
|
-
}
|
|
639
|
-
if (!e) return r;
|
|
640
|
-
r.push({
|
|
641
|
-
node: e,
|
|
642
|
-
x: a + e.localRect.x,
|
|
643
|
-
y: o + e.localRect.y
|
|
644
|
-
}), a += e.localRect.x - (e.scroll?.x ?? 0), o += e.localRect.y - (e.scroll?.y ?? 0), i = e;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
function Ce(e, t, n) {
|
|
648
|
-
return Se(e, t, n).map((e) => e.node.source);
|
|
649
|
-
}
|
|
650
|
-
//#endregion
|
|
651
629
|
//#region src/metrics.ts
|
|
652
|
-
function
|
|
630
|
+
function N(e) {
|
|
653
631
|
return (e >= 0 ? Math.floor(e + .5) : -Math.floor(-e + .5)) || 0;
|
|
654
632
|
}
|
|
655
|
-
function
|
|
656
|
-
return t <= 0 ? 0 :
|
|
633
|
+
function P(e, t) {
|
|
634
|
+
return t <= 0 ? 0 : N(e / (.25 * t));
|
|
657
635
|
}
|
|
658
|
-
function
|
|
659
|
-
return
|
|
636
|
+
function Ce(e, t) {
|
|
637
|
+
return N(t * e / 100);
|
|
660
638
|
}
|
|
661
|
-
function
|
|
639
|
+
function we(e, t) {
|
|
662
640
|
let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).letterSpacing) || 0, i = t.ownerDocument.createRange();
|
|
663
641
|
i.selectNodeContents(t);
|
|
664
642
|
let a = Math.max(0, i.getBoundingClientRect().height - n.height);
|
|
@@ -669,56 +647,56 @@ function Te(e, t) {
|
|
|
669
647
|
inkOverhang: a
|
|
670
648
|
};
|
|
671
649
|
}
|
|
672
|
-
function
|
|
650
|
+
function Te() {
|
|
673
651
|
return parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
674
652
|
}
|
|
675
653
|
//#endregion
|
|
676
654
|
//#region src/wrap.ts
|
|
677
|
-
function
|
|
678
|
-
return
|
|
655
|
+
function Ee(e, t, n = {}) {
|
|
656
|
+
return Ae(e, t, n).map((t) => e.slice(t.start, t.end));
|
|
679
657
|
}
|
|
680
|
-
function
|
|
681
|
-
return
|
|
658
|
+
function De(e, t, n = {}) {
|
|
659
|
+
return Ae(e, t, n).length;
|
|
682
660
|
}
|
|
683
|
-
function
|
|
661
|
+
function Oe(e, t) {
|
|
684
662
|
return t.endsWith("\n") && e.pop(), e;
|
|
685
663
|
}
|
|
686
|
-
function
|
|
664
|
+
function ke(e) {
|
|
687
665
|
let t = [], n = 0;
|
|
688
666
|
for (let r = 0; r <= e.length; r++) (r === e.length || e[r] === "\n") && (t.push({
|
|
689
667
|
start: n,
|
|
690
668
|
end: r
|
|
691
669
|
}), n = r + 1);
|
|
692
|
-
return
|
|
670
|
+
return Oe(t, e);
|
|
693
671
|
}
|
|
694
|
-
function
|
|
672
|
+
function Ae(e, t, n = {}) {
|
|
695
673
|
if (!/[^ \t\r\f]/.test(e)) return [];
|
|
696
674
|
let r = [], i = 0, a = n.firstLineIndent ?? 0;
|
|
697
|
-
for (let o = 0; o <= e.length; o++) (o === e.length || e[o] === "\n") && (r.push(...
|
|
698
|
-
return
|
|
675
|
+
for (let o = 0; o <= e.length; o++) (o === e.length || e[o] === "\n") && (r.push(...Re(e, i, o, t, n, a)), a = 0, i = o + 1);
|
|
676
|
+
return Oe(r, e);
|
|
699
677
|
}
|
|
700
|
-
function
|
|
678
|
+
function je(e, t, n) {
|
|
701
679
|
if (!n) return t - e;
|
|
702
680
|
let r = 0;
|
|
703
681
|
for (let i = e; i < t; i++) r += n[i] ?? 1;
|
|
704
682
|
return r;
|
|
705
683
|
}
|
|
706
|
-
function
|
|
707
|
-
return t <= e ? 0 :
|
|
684
|
+
function F(e, t, n, r = 0) {
|
|
685
|
+
return t <= e ? 0 : je(e, t, n) - Math.min(r, Me(t - 1, n));
|
|
708
686
|
}
|
|
709
|
-
function
|
|
687
|
+
function Me(e, t) {
|
|
710
688
|
return t ? (t[e] ?? 1) - 1 : 0;
|
|
711
689
|
}
|
|
712
|
-
function
|
|
690
|
+
function Ne(e, t = {}) {
|
|
713
691
|
let { advances: n, tracking: r = 0 } = t, i = 0;
|
|
714
|
-
for (let t of
|
|
692
|
+
for (let t of Le(e, 0, e.length)) for (let a of Fe(e, t.start, t.end)) i = Math.max(i, F(a.start, a.end, n, r));
|
|
715
693
|
return i;
|
|
716
694
|
}
|
|
717
|
-
function
|
|
695
|
+
function Pe(e, t) {
|
|
718
696
|
let n = 0;
|
|
719
697
|
for (let r = 0; r < e.length; r++) e[r] === "" && (t(r, n), n++);
|
|
720
698
|
}
|
|
721
|
-
function
|
|
699
|
+
function Fe(e, t, n) {
|
|
722
700
|
let r = [], i = t;
|
|
723
701
|
for (let a = t; a < n; a++) {
|
|
724
702
|
if (e[a] === "") {
|
|
@@ -745,14 +723,14 @@ function Ie(e, t, n) {
|
|
|
745
723
|
end: n
|
|
746
724
|
}), r;
|
|
747
725
|
}
|
|
748
|
-
var
|
|
749
|
-
function
|
|
726
|
+
var Ie = /[ \t\r\n\f]/;
|
|
727
|
+
function Le(e, t, n) {
|
|
750
728
|
let r = [], i = t;
|
|
751
729
|
for (; i < n;) {
|
|
752
|
-
for (; i < n &&
|
|
730
|
+
for (; i < n && Ie.test(e[i]);) i++;
|
|
753
731
|
if (i >= n) break;
|
|
754
732
|
let t = i;
|
|
755
|
-
for (; i < n && !
|
|
733
|
+
for (; i < n && !Ie.test(e[i]);) i++;
|
|
756
734
|
r.push({
|
|
757
735
|
start: t,
|
|
758
736
|
end: i
|
|
@@ -760,8 +738,8 @@ function Re(e, t, n) {
|
|
|
760
738
|
}
|
|
761
739
|
return r;
|
|
762
740
|
}
|
|
763
|
-
function
|
|
764
|
-
let s =
|
|
741
|
+
function Re(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
742
|
+
let s = Le(e, t, n);
|
|
765
743
|
if (s.length === 0) return [{
|
|
766
744
|
start: t,
|
|
767
745
|
end: t
|
|
@@ -773,13 +751,13 @@ function ze(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
773
751
|
let c = [], l = null, u = 0, d = Math.max(0, o), f = () => r - d;
|
|
774
752
|
for (let t of s) {
|
|
775
753
|
let n = !1;
|
|
776
|
-
for (let r of
|
|
777
|
-
let e = r.start, t = r.end, o = l !== null && !n ? e - 1 : e, s = u +
|
|
754
|
+
for (let r of Fe(e, t.start, t.end)) {
|
|
755
|
+
let e = r.start, t = r.end, o = l !== null && !n ? e - 1 : e, s = u + je(o, t, i), p = Math.min(a, Me(t - 1, i));
|
|
778
756
|
if (l !== null && s - p <= f()) l.end = t, u = s;
|
|
779
757
|
else {
|
|
780
758
|
for (l !== null && (c.push(l), d = 0);;) {
|
|
781
759
|
let n = e;
|
|
782
|
-
for (; n < t &&
|
|
760
|
+
for (; n < t && F(e, n + 1, i, a) <= f();) n++;
|
|
783
761
|
if (n === t || n === e) break;
|
|
784
762
|
c.push({
|
|
785
763
|
start: e,
|
|
@@ -789,7 +767,7 @@ function ze(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
789
767
|
l = {
|
|
790
768
|
start: e,
|
|
791
769
|
end: t
|
|
792
|
-
}, u =
|
|
770
|
+
}, u = je(e, t, i);
|
|
793
771
|
}
|
|
794
772
|
n = !0;
|
|
795
773
|
}
|
|
@@ -798,7 +776,7 @@ function ze(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
798
776
|
}
|
|
799
777
|
//#endregion
|
|
800
778
|
//#region src/flex.ts
|
|
801
|
-
function
|
|
779
|
+
function ze(e, t) {
|
|
802
780
|
let n = e.row.map((e) => e.node.localRect).sort((e, t) => e.x - t.x), r = [];
|
|
803
781
|
for (let e = 1; e < n.length; e++) {
|
|
804
782
|
let i = n[e - 1].x + n[e - 1].width - t, a = n[e].x - t;
|
|
@@ -809,12 +787,12 @@ function Be(e, t) {
|
|
|
809
787
|
}
|
|
810
788
|
return r;
|
|
811
789
|
}
|
|
812
|
-
function
|
|
790
|
+
function Be(e, t, n, r, i) {
|
|
813
791
|
if (e.style.ruleBreak !== "intersection") return [{
|
|
814
792
|
start: 0,
|
|
815
793
|
end: i
|
|
816
794
|
}];
|
|
817
|
-
let a = [t[n - 1], t[n]].flatMap((e) =>
|
|
795
|
+
let a = [t[n - 1], t[n]].flatMap((e) => ze(e, r)).sort((e, t) => e.start - t.start), o = (e, t) => ({
|
|
818
796
|
start: e,
|
|
819
797
|
end: t,
|
|
820
798
|
spanned: !1,
|
|
@@ -822,39 +800,39 @@ function Ve(e, t, n, r, i) {
|
|
|
822
800
|
afterOccupied: !0
|
|
823
801
|
}), s = [], c = 0;
|
|
824
802
|
for (let e of a) e.start > c && s.push(o(c, e.start)), c = Math.max(c, e.end);
|
|
825
|
-
return c < i && s.push(o(c, i)),
|
|
803
|
+
return c < i && s.push(o(c, i)), be(s, "intersection", "all", e.style.ruleInset === "overlap-join" ? "overlap-join" : 0);
|
|
826
804
|
}
|
|
827
|
-
function
|
|
805
|
+
function Ve(e, t) {
|
|
828
806
|
return typeof t != "number" || t <= 0 ? e : e.map((e) => ({
|
|
829
807
|
...e,
|
|
830
808
|
start: e.start + t,
|
|
831
809
|
end: e.end - t
|
|
832
810
|
})).filter((e) => e.end > e.start);
|
|
833
811
|
}
|
|
834
|
-
function
|
|
835
|
-
let s =
|
|
836
|
-
let n =
|
|
812
|
+
function He(e, t, n, r, i, a, o) {
|
|
813
|
+
let s = Wn(e.style, "x", t), c = Wn(e.style, "y", n), l = Ze(e).map((e) => {
|
|
814
|
+
let n = U(e.style.margin, t);
|
|
837
815
|
return {
|
|
838
816
|
node: e,
|
|
839
817
|
base: Xe(e, t, o),
|
|
840
818
|
grow: e.style.flexGrow,
|
|
841
819
|
shrink: e.style.flexShrink,
|
|
842
820
|
min: et(e, t, o),
|
|
843
|
-
max:
|
|
821
|
+
max: W(e.style.maxWidth, t),
|
|
844
822
|
margin: n
|
|
845
823
|
};
|
|
846
824
|
}), u = [];
|
|
847
825
|
if (e.style.flexWrap === "wrap") {
|
|
848
826
|
let n = [], r = 0;
|
|
849
827
|
for (let e of l) {
|
|
850
|
-
let i = Math.max(0,
|
|
828
|
+
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;
|
|
851
829
|
n.length > 0 && a > t && (u.push(n), n = [], r = 0), n.push(e), r = n.length === 1 ? i : r + s + i;
|
|
852
830
|
}
|
|
853
831
|
n.length > 0 && u.push(n), e.style.wrapReverse && u.reverse();
|
|
854
832
|
} else u.push(l);
|
|
855
833
|
let d = i.left + a.left, f = i.top + a.top, p = u.map((e) => {
|
|
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,
|
|
857
|
-
for (let n = 0; n < e.length; n++)
|
|
834
|
+
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))) : qe(e, a);
|
|
835
|
+
for (let n = 0; n < e.length; n++) B(e[n].node, t, r, 0, 0, "fill", o, { width: u[n] });
|
|
858
836
|
return {
|
|
859
837
|
row: e,
|
|
860
838
|
widths: u,
|
|
@@ -866,19 +844,19 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
866
844
|
else {
|
|
867
845
|
let t = m.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - h) : 0, i = Qe(e.style);
|
|
868
846
|
if (i === "stretch" && r > 0) {
|
|
869
|
-
let e =
|
|
847
|
+
let e = L(Array.from({ length: p.length }, () => 1), r);
|
|
870
848
|
for (let t = 0; t < m.length; t++) m[t] += e[t];
|
|
871
|
-
g =
|
|
872
|
-
} else g =
|
|
849
|
+
g = I("start", m, 0);
|
|
850
|
+
} else g = I(i === "stretch" ? "start" : i, m, r);
|
|
873
851
|
}
|
|
874
852
|
for (let i = 0; i < p.length; i++) {
|
|
875
853
|
let { row: a, widths: l, availableForItems: u } = p[i], h = m[i], _ = g[i] + i * c;
|
|
876
854
|
for (let i = 0; i < a.length; i++) {
|
|
877
|
-
let s = a[i].node, c =
|
|
855
|
+
let s = a[i].node, c = Je(s, e), u = a[i].margin, d = u.top === null || u.bottom === null, f = s.style.height !== void 0 && s.style.height.kind !== "auto";
|
|
878
856
|
if (c === "stretch" && !d && !f && h !== s.localRect.height) {
|
|
879
|
-
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, d =
|
|
857
|
+
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, d = V(Math.max(0, h - e - a), W(s.style.minHeight, c) ?? 0, W(s.style.maxHeight, c));
|
|
880
858
|
if (d === s.localRect.height) continue;
|
|
881
|
-
|
|
859
|
+
B(s, t, r, 0, 0, "fill", o, {
|
|
882
860
|
width: l[i],
|
|
883
861
|
height: d
|
|
884
862
|
});
|
|
@@ -886,17 +864,17 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
886
864
|
}
|
|
887
865
|
let v = l.reduce((e, t) => e + t, 0), y = Math.max(0, u - v), b = a.reduce((e, t) => e + +(t.margin.left === null) + +(t.margin.right === null), 0), x = Array.from({ length: a.length }, () => 0), S = Array.from({ length: a.length }, () => 0), C;
|
|
888
866
|
if (b > 0 && y > 0) {
|
|
889
|
-
let e =
|
|
867
|
+
let e = L(Array.from({ length: b }, () => 1), y), t = 0;
|
|
890
868
|
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++]);
|
|
891
|
-
C =
|
|
892
|
-
} else C =
|
|
869
|
+
C = I("start", l, 0);
|
|
870
|
+
} else C = I($e(e.style), l, y);
|
|
893
871
|
let w = 0;
|
|
894
872
|
for (let t = 0; t < a.length; t++) {
|
|
895
873
|
let n = a[t], r = n.node, i = n.margin.left ?? 0, o = n.margin.right ?? 0;
|
|
896
874
|
w += x[t] + i, r.localRect = {
|
|
897
875
|
...r.localRect,
|
|
898
876
|
x: d + C[t] + t * s + w,
|
|
899
|
-
y: f + _ +
|
|
877
|
+
y: f + _ + Ge(r, e.style.alignItems, h, n.margin)
|
|
900
878
|
}, w += S[t] + o;
|
|
901
879
|
}
|
|
902
880
|
}
|
|
@@ -905,7 +883,7 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
905
883
|
let n = [], r = [];
|
|
906
884
|
for (let i = 0; i < p.length; i++) {
|
|
907
885
|
let a = g[i] + i * c;
|
|
908
|
-
for (let e of
|
|
886
|
+
for (let e of ze(p[i], d)) n.push({
|
|
909
887
|
bandStart: e.start,
|
|
910
888
|
bandSize: e.end - e.start,
|
|
911
889
|
start: a,
|
|
@@ -913,19 +891,19 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
913
891
|
});
|
|
914
892
|
if (i > 0) {
|
|
915
893
|
let n = g[i - 1] + (i - 1) * c + m[i - 1];
|
|
916
|
-
if (a > n) for (let o of
|
|
894
|
+
if (a > n) for (let o of Be(e, p, i, d, t)) r.push({
|
|
917
895
|
bandStart: n,
|
|
918
896
|
bandSize: a - n,
|
|
919
897
|
...o
|
|
920
898
|
});
|
|
921
899
|
}
|
|
922
900
|
}
|
|
923
|
-
e.decorationRuns =
|
|
901
|
+
e.decorationRuns = xe({
|
|
924
902
|
glyphs: S(e.style.glyphSet),
|
|
925
903
|
ruleX: e.style.ruleX,
|
|
926
904
|
ruleY: e.style.ruleY,
|
|
927
|
-
vertical:
|
|
928
|
-
horizontal:
|
|
905
|
+
vertical: Ve(n, e.style.ruleInset),
|
|
906
|
+
horizontal: Ve(r, e.style.ruleInset),
|
|
929
907
|
contentWidth: t,
|
|
930
908
|
contentHeight: v,
|
|
931
909
|
border: i,
|
|
@@ -934,10 +912,10 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
934
912
|
padding: a
|
|
935
913
|
});
|
|
936
914
|
}
|
|
937
|
-
return
|
|
915
|
+
return Ue(e, i, a, t, v), v;
|
|
938
916
|
}
|
|
939
|
-
function
|
|
940
|
-
for (let a of e.children)
|
|
917
|
+
function Ue(e, t, n, r, i) {
|
|
918
|
+
for (let a of e.children) z(a.style) && (a.staticSlot = {
|
|
941
919
|
kind: "flex",
|
|
942
920
|
direction: e.style.flexDirection,
|
|
943
921
|
originX: t.left + n.left,
|
|
@@ -946,37 +924,37 @@ function We(e, t, n, r, i) {
|
|
|
946
924
|
innerHeight: i
|
|
947
925
|
});
|
|
948
926
|
}
|
|
949
|
-
function
|
|
950
|
-
let s =
|
|
951
|
-
let a =
|
|
952
|
-
|
|
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 ?
|
|
927
|
+
function We(e, t, n, r, i, a, o) {
|
|
928
|
+
let s = Wn(e.style, "y", n), c = Ze(e).map((i) => {
|
|
929
|
+
let a = U(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c = Je(i, e) === "stretch";
|
|
930
|
+
B(i, s, r && Number.isFinite(n) ? n : void 0, 0, 0, c ? "fill" : "shrink", o);
|
|
931
|
+
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 ? Ce(u.value, l) : i.unclampedHeight, f = i.style.minHeight === "auto" ? i.style.overflow.y === "visible" ? i.localRect.height : 0 : void 0;
|
|
954
932
|
return {
|
|
955
933
|
node: i,
|
|
956
934
|
base: d,
|
|
957
935
|
grow: i.style.flexGrow,
|
|
958
936
|
shrink: i.style.flexShrink,
|
|
959
|
-
min: f ??
|
|
960
|
-
max:
|
|
937
|
+
min: f ?? W(i.style.minHeight, l) ?? 0,
|
|
938
|
+
max: W(i.style.maxHeight, l),
|
|
961
939
|
margin: a
|
|
962
940
|
};
|
|
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) ?
|
|
941
|
+
}), 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) ? qe(c, m) : c.map((e) => Math.max(0, V(e.base, e.min, e.max)));
|
|
964
942
|
for (let n = 0; n < c.length; n++) if (g[n] !== c[n].node.localRect.height) {
|
|
965
|
-
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a =
|
|
966
|
-
|
|
943
|
+
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a = Je(r.node, e) === "stretch";
|
|
944
|
+
B(r.node, i, g[n], 0, 0, a ? "fill" : "shrink", o, { height: g[n] });
|
|
967
945
|
}
|
|
968
946
|
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;
|
|
969
947
|
if (y > 0 && v > 0) {
|
|
970
|
-
let e =
|
|
948
|
+
let e = L(Array.from({ length: y }, () => 1), v), t = 0;
|
|
971
949
|
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++]);
|
|
972
|
-
C =
|
|
973
|
-
} else C =
|
|
950
|
+
C = I("start", g, 0);
|
|
951
|
+
} else C = I($e(e.style), g, v);
|
|
974
952
|
let w = i.left + a.left, T = i.top + a.top, E = 0;
|
|
975
953
|
for (let n = 0; n < c.length; n++) {
|
|
976
954
|
let r = c[n], i = r.node, a = r.margin.top ?? 0, o = r.margin.bottom ?? 0;
|
|
977
955
|
E += b[n] + a, i.localRect = {
|
|
978
956
|
...i.localRect,
|
|
979
|
-
x: w +
|
|
957
|
+
x: w + Ke(i, e.style.alignItems, t, r.margin),
|
|
980
958
|
y: T + C[n] + n * s + E
|
|
981
959
|
}, E += x[n] + o;
|
|
982
960
|
}
|
|
@@ -992,12 +970,12 @@ function Ge(e, t, n, r, i, a, o) {
|
|
|
992
970
|
end: t
|
|
993
971
|
});
|
|
994
972
|
}
|
|
995
|
-
e.decorationRuns =
|
|
973
|
+
e.decorationRuns = xe({
|
|
996
974
|
glyphs: S(e.style.glyphSet),
|
|
997
975
|
ruleX: null,
|
|
998
976
|
ruleY: e.style.ruleY,
|
|
999
977
|
vertical: [],
|
|
1000
|
-
horizontal:
|
|
978
|
+
horizontal: Ve(n, e.style.ruleInset),
|
|
1001
979
|
contentWidth: t,
|
|
1002
980
|
contentHeight: O,
|
|
1003
981
|
border: i,
|
|
@@ -1006,17 +984,17 @@ function Ge(e, t, n, r, i, a, o) {
|
|
|
1006
984
|
padding: a
|
|
1007
985
|
});
|
|
1008
986
|
}
|
|
1009
|
-
return
|
|
987
|
+
return Ue(e, i, a, t, O), O;
|
|
1010
988
|
}
|
|
1011
|
-
function
|
|
989
|
+
function Ge(e, t, n, r) {
|
|
1012
990
|
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;
|
|
1013
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
991
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + Ye(i, n, e.localRect.height);
|
|
1014
992
|
}
|
|
1015
|
-
function
|
|
993
|
+
function Ke(e, t, n, r) {
|
|
1016
994
|
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;
|
|
1017
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
995
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + Ye(i, n, e.localRect.width);
|
|
1018
996
|
}
|
|
1019
|
-
function
|
|
997
|
+
function I(e, t, n) {
|
|
1020
998
|
let r = t.length;
|
|
1021
999
|
if (r === 0) return [];
|
|
1022
1000
|
let i = [], a = 0;
|
|
@@ -1026,7 +1004,7 @@ function L(e, t, n) {
|
|
|
1026
1004
|
return i;
|
|
1027
1005
|
}
|
|
1028
1006
|
if ((e === "space-around" || e === "space-evenly") && n > 0) {
|
|
1029
|
-
let o =
|
|
1007
|
+
let o = L(Array.from({ length: r + 1 }, (t, n) => e === "space-evenly" || n === 0 || n === r ? 1 : 2), n);
|
|
1030
1008
|
for (let e = 0; e < r; e++) a += o[e], i.push(a), a += t[e];
|
|
1031
1009
|
return i;
|
|
1032
1010
|
}
|
|
@@ -1034,8 +1012,8 @@ function L(e, t, n) {
|
|
|
1034
1012
|
for (let e = 0; e < r; e++) i.push(a), a += t[e];
|
|
1035
1013
|
return i;
|
|
1036
1014
|
}
|
|
1037
|
-
function
|
|
1038
|
-
let n = e.length, r = (t, n) => Math.max(0,
|
|
1015
|
+
function qe(e, t) {
|
|
1016
|
+
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);
|
|
1039
1017
|
for (let t = 0; t < n; t++) {
|
|
1040
1018
|
let n = r(i[t], t);
|
|
1041
1019
|
((a ? e[t].grow : e[t].shrink) === 0 || a && i[t] > n || !a && i[t] < n) && (o[t] = n, s[t] = !0);
|
|
@@ -1044,7 +1022,7 @@ function Je(e, t) {
|
|
|
1044
1022
|
let c = [];
|
|
1045
1023
|
for (let e = 0; e < n; e++) s[e] || c.push(e);
|
|
1046
1024
|
if (c.length === 0) break;
|
|
1047
|
-
let l = o.reduce((e, t, n) => s[n] ? e + t : e, 0), u = c.reduce((e, t) => e + i[t], 0), d = t - l - u, f = a ? Math.max(0, d) : Math.max(0, -d), p =
|
|
1025
|
+
let l = o.reduce((e, t, n) => s[n] ? e + t : e, 0), u = c.reduce((e, t) => e + i[t], 0), d = t - l - u, f = a ? Math.max(0, d) : Math.max(0, -d), p = L(c.map((t) => a ? e[t].grow : i[t] * e[t].shrink), f), m = c.map((e, t) => i[e] + (a ? p[t] : -p[t])), h = c.map((e, t) => r(m[t], e)), g = h.reduce((e, t, n) => e + (t - m[n]), 0);
|
|
1048
1026
|
if (g === 0) {
|
|
1049
1027
|
for (let e = 0; e < c.length; e++) o[c[e]] = h[e];
|
|
1050
1028
|
break;
|
|
@@ -1056,7 +1034,7 @@ function Je(e, t) {
|
|
|
1056
1034
|
}
|
|
1057
1035
|
return o;
|
|
1058
1036
|
}
|
|
1059
|
-
function
|
|
1037
|
+
function L(e, t) {
|
|
1060
1038
|
let n = e.reduce((e, t) => e + t, 0);
|
|
1061
1039
|
if (n === 0 || t <= 0) return e.map(() => 0);
|
|
1062
1040
|
let r = e.map((e) => e / n * t), i = r.map(Math.floor), a = t - i.reduce((e, t) => e + t, 0);
|
|
@@ -1069,18 +1047,18 @@ function R(e, t) {
|
|
|
1069
1047
|
}
|
|
1070
1048
|
return i;
|
|
1071
1049
|
}
|
|
1072
|
-
function
|
|
1050
|
+
function Je(e, t) {
|
|
1073
1051
|
return e.style.alignSelf === "auto" ? t.style.alignItems : e.style.alignSelf;
|
|
1074
1052
|
}
|
|
1075
|
-
function
|
|
1053
|
+
function Ye(e, t, n) {
|
|
1076
1054
|
return e === "center" ? Math.max(0, Math.floor((t - n) / 2)) : e === "end" ? Math.max(0, t - n) : 0;
|
|
1077
1055
|
}
|
|
1078
1056
|
function Xe(e, t, n) {
|
|
1079
1057
|
let r = e.style.flexBasis, i = e.style.width;
|
|
1080
|
-
return r !== void 0 && r.kind !== "auto" ?
|
|
1058
|
+
return r !== void 0 && r.kind !== "auto" ? G(r, t, e, n) : i !== void 0 && i.kind !== "auto" ? G(i, t, e, n) : K(e, n);
|
|
1081
1059
|
}
|
|
1082
1060
|
function Ze(e) {
|
|
1083
|
-
let t = e.children.filter((e) => !
|
|
1061
|
+
let t = e.children.filter((e) => !z(e.style)).sort((e, t) => e.style.order - t.style.order);
|
|
1084
1062
|
return e.style.flexReverse && t.reverse(), t;
|
|
1085
1063
|
}
|
|
1086
1064
|
function Qe(e) {
|
|
@@ -1091,7 +1069,7 @@ function $e(e) {
|
|
|
1091
1069
|
return e.flexReverse ? t === "start" ? "end" : t === "end" ? "start" : t : t;
|
|
1092
1070
|
}
|
|
1093
1071
|
function et(e, t, n) {
|
|
1094
|
-
return e.style.minWidth === "auto" ? e.style.overflow.x === "visible" ?
|
|
1072
|
+
return e.style.minWidth === "auto" ? e.style.overflow.x === "visible" ? J(e, n) : 0 : W(e.style.minWidth, t) ?? 0;
|
|
1095
1073
|
}
|
|
1096
1074
|
//#endregion
|
|
1097
1075
|
//#region src/types.ts
|
|
@@ -1099,15 +1077,26 @@ function tt(e) {
|
|
|
1099
1077
|
return e === "auto" || e === "scroll";
|
|
1100
1078
|
}
|
|
1101
1079
|
function nt(e) {
|
|
1102
|
-
return e.
|
|
1080
|
+
return e.children.filter((e) => e.inlineBox);
|
|
1081
|
+
}
|
|
1082
|
+
function rt(e) {
|
|
1083
|
+
return {
|
|
1084
|
+
right: e.scrollbarSize.y + e.scrollbarInset.x,
|
|
1085
|
+
bottom: e.scrollbarSize.x + e.scrollbarInset.y
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
function it(e) {
|
|
1089
|
+
if (e.scrollbarWidth === "none") return {
|
|
1103
1090
|
right: 0,
|
|
1104
1091
|
bottom: 0
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1092
|
+
};
|
|
1093
|
+
let t = rt(e);
|
|
1094
|
+
return {
|
|
1095
|
+
right: e.overflow.y === "scroll" ? t.right : 0,
|
|
1096
|
+
bottom: e.overflow.x === "scroll" ? t.bottom : 0
|
|
1108
1097
|
};
|
|
1109
1098
|
}
|
|
1110
|
-
function
|
|
1099
|
+
function at() {
|
|
1111
1100
|
return {
|
|
1112
1101
|
display: "block",
|
|
1113
1102
|
flexDirection: "row",
|
|
@@ -1126,8 +1115,8 @@ function rt() {
|
|
|
1126
1115
|
justifySelf: "auto",
|
|
1127
1116
|
gridTemplateColumns: { kind: "none" },
|
|
1128
1117
|
gridTemplateRows: { kind: "none" },
|
|
1129
|
-
gridAutoColumns: [
|
|
1130
|
-
gridAutoRows: [
|
|
1118
|
+
gridAutoColumns: [ot()],
|
|
1119
|
+
gridAutoRows: [ot()],
|
|
1131
1120
|
gridAutoFlow: {
|
|
1132
1121
|
direction: "row",
|
|
1133
1122
|
dense: !1
|
|
@@ -1143,7 +1132,7 @@ function rt() {
|
|
|
1143
1132
|
minHeight: "auto",
|
|
1144
1133
|
maxWidth: void 0,
|
|
1145
1134
|
maxHeight: void 0,
|
|
1146
|
-
padding:
|
|
1135
|
+
padding: R(),
|
|
1147
1136
|
margin: {
|
|
1148
1137
|
top: 0,
|
|
1149
1138
|
right: 0,
|
|
@@ -1159,7 +1148,7 @@ function rt() {
|
|
|
1159
1148
|
},
|
|
1160
1149
|
gapX: 0,
|
|
1161
1150
|
gapY: 0,
|
|
1162
|
-
border:
|
|
1151
|
+
border: R(),
|
|
1163
1152
|
borderStyle: {
|
|
1164
1153
|
top: "solid",
|
|
1165
1154
|
right: "solid",
|
|
@@ -1175,6 +1164,10 @@ function rt() {
|
|
|
1175
1164
|
x: 1,
|
|
1176
1165
|
y: 1
|
|
1177
1166
|
},
|
|
1167
|
+
scrollbarInset: {
|
|
1168
|
+
x: 0,
|
|
1169
|
+
y: 0
|
|
1170
|
+
},
|
|
1178
1171
|
overscroll: {
|
|
1179
1172
|
x: !0,
|
|
1180
1173
|
y: !0
|
|
@@ -1225,7 +1218,7 @@ function rt() {
|
|
|
1225
1218
|
breakInsideAvoid: !1
|
|
1226
1219
|
};
|
|
1227
1220
|
}
|
|
1228
|
-
function
|
|
1221
|
+
function R() {
|
|
1229
1222
|
return {
|
|
1230
1223
|
top: 0,
|
|
1231
1224
|
right: 0,
|
|
@@ -1233,7 +1226,7 @@ function it() {
|
|
|
1233
1226
|
left: 0
|
|
1234
1227
|
};
|
|
1235
1228
|
}
|
|
1236
|
-
function
|
|
1229
|
+
function ot() {
|
|
1237
1230
|
return {
|
|
1238
1231
|
min: { kind: "auto" },
|
|
1239
1232
|
max: { kind: "auto" }
|
|
@@ -1241,15 +1234,15 @@ function at() {
|
|
|
1241
1234
|
}
|
|
1242
1235
|
//#endregion
|
|
1243
1236
|
//#region src/grid.ts
|
|
1244
|
-
function
|
|
1245
|
-
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, u = c ? c.gap :
|
|
1237
|
+
function st(e, t, n, r, i, a) {
|
|
1238
|
+
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, u = c ? c.gap : Wn(o, "x", t), d = l ? l.gap : Wn(o, "y", s), f = _t(e, t, s, u, d, e.subgrid ? {
|
|
1246
1239
|
col: e.subgrid.colSpan,
|
|
1247
1240
|
row: e.subgrid.rowSpan
|
|
1248
|
-
} : void 0), { children: p, placed: m, colLines: h, rowLines: g, colTracks: _, rowTracks: v, colCollapsed: y, rowCollapsed: b } = f, x = p.map((e) =>
|
|
1241
|
+
} : void 0), { children: p, placed: m, colLines: h, rowLines: g, colTracks: _, rowTracks: v, colCollapsed: y, rowCollapsed: b } = f, x = p.map((e) => U(e.style.margin, t)), C = p.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), w = p.map(ct), T = c ? ut(c) : Mt(_, y, dt(f, w, x, a), t, u, o.justifyContent === "stretch"), E = c ? c.positions : Nt(T, t, o.justifyContent), D = [];
|
|
1249
1242
|
for (let e = 0; e < p.length; e++) {
|
|
1250
|
-
let t = p[e], n = m.items[e], r = Ft(E, T.sizes, n.col.start, n.col.span), i = x[e], o = Math.max(0, r -
|
|
1243
|
+
let t = p[e], n = m.items[e], r = Ft(E, T.sizes, n.col.start, n.col.span), i = x[e], o = Math.max(0, r - xt(i)), s = w[e];
|
|
1251
1244
|
if (s.cols || s.rows) {
|
|
1252
|
-
let e = s.cols ?
|
|
1245
|
+
let e = s.cols ? lt(E, T, u, n.col.start, n.col.span, pt(t, "cols", i, r)) : void 0;
|
|
1253
1246
|
t.subgrid = {
|
|
1254
1247
|
colSpan: n.col.span,
|
|
1255
1248
|
rowSpan: n.row.span,
|
|
@@ -1258,29 +1251,29 @@ function ot(e, t, n, r, i, a) {
|
|
|
1258
1251
|
};
|
|
1259
1252
|
} else t.subgrid = void 0;
|
|
1260
1253
|
let c = C[e], l = i.left === null || i.right === null, d = t.style.width !== void 0 && t.style.width.kind !== "auto";
|
|
1261
|
-
s.cols ?
|
|
1254
|
+
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" ? J(t, a) : 0 : W(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);
|
|
1262
1255
|
}
|
|
1263
|
-
let O = l ?
|
|
1256
|
+
let O = l ? ut(l) : Mt(v, b, ft(f, w, x), s ?? "max-content", d, o.alignContent === "stretch"), k = Pt(O), A = l ? l.positions : Nt(O, s ?? k, o.alignContent), ee = r.left + i.left, j = r.top + i.top;
|
|
1264
1257
|
for (let t = 0; t < p.length; t++) {
|
|
1265
|
-
let n = p[t], r = m.items[t], i = x[t], o = Ft(E, T.sizes, r.col.start, r.col.span), s = Ft(A, O.sizes, r.row.start, r.row.span), c = Math.max(0, s -
|
|
1266
|
-
if (w[t].rows) n.subgrid.rows =
|
|
1258
|
+
let n = p[t], r = m.items[t], i = x[t], o = Ft(E, T.sizes, r.col.start, r.col.span), s = Ft(A, O.sizes, r.row.start, r.row.span), c = Math.max(0, s - St(i)), l = Je(n, e), u = i.top === null || i.bottom === null, f = n.style.height !== void 0 && n.style.height.kind !== "auto";
|
|
1259
|
+
if (w[t].rows) n.subgrid.rows = lt(A, O, d, r.row.start, r.row.span, pt(n, "rows", i, o)), B(n, o, s, 0, 0, "fill", a, {
|
|
1267
1260
|
width: D[t],
|
|
1268
1261
|
height: c
|
|
1269
1262
|
});
|
|
1270
1263
|
else if (l === "stretch" && !u && !f) {
|
|
1271
|
-
let e =
|
|
1272
|
-
e !== n.localRect.height &&
|
|
1264
|
+
let e = V(c, n.style.minHeight === "auto" ? n.style.overflow.y === "visible" ? n.localRect.height : 0 : W(n.style.minHeight, s) ?? 0, W(n.style.maxHeight, s));
|
|
1265
|
+
e !== n.localRect.height && B(n, o, s, 0, 0, "fill", a, {
|
|
1273
1266
|
width: D[t],
|
|
1274
1267
|
height: e
|
|
1275
1268
|
});
|
|
1276
|
-
} else n.style.height?.kind === "percent" &&
|
|
1269
|
+
} else n.style.height?.kind === "percent" && B(n, o, s, 0, 0, "fill", a, { width: D[t] });
|
|
1277
1270
|
n.localRect = {
|
|
1278
1271
|
...n.localRect,
|
|
1279
|
-
x:
|
|
1280
|
-
y:
|
|
1272
|
+
x: ee + E[r.col.start] + It(C[t], i.left, i.right, o, n.localRect.width),
|
|
1273
|
+
y: j + A[r.row.start] + It(l, i.top, i.bottom, s, n.localRect.height)
|
|
1281
1274
|
};
|
|
1282
1275
|
}
|
|
1283
|
-
let
|
|
1276
|
+
let M = Number.isFinite(n) ? Math.max(n, k) : k;
|
|
1284
1277
|
if (o.ruleX || o.ruleY) {
|
|
1285
1278
|
let n = T.sizes.length, a = O.sizes.length, s = Array.from({ length: n }, () => Array.from({ length: a }, () => !1)), c = Array.from({ length: Math.max(0, n - 1) }, () => Array.from({ length: a }, () => !1)), l = Array.from({ length: Math.max(0, a - 1) }, () => Array.from({ length: n }, () => !1));
|
|
1286
1279
|
for (let e of m.items) for (let t = e.col.start; t < e.col.start + e.col.span && t < n; t++) for (let r = e.row.start; r < e.row.start + e.row.span && r < a; r++) s[t][r] = !0, t + 1 < e.col.start + e.col.span && t < n - 1 && (c[t][r] = !0), r + 1 < e.row.start + e.row.span && r < a - 1 && (l[r][t] = !0);
|
|
@@ -1294,7 +1287,7 @@ function ot(e, t, n, r, i, a) {
|
|
|
1294
1287
|
let r = [];
|
|
1295
1288
|
for (let i = 1; i < e.length; i++) {
|
|
1296
1289
|
let a = e[i - 1] + t[i - 1], s = e[i] - a;
|
|
1297
|
-
if (!(s <= 0)) for (let e of
|
|
1290
|
+
if (!(s <= 0)) for (let e of be(n(i - 1), o.ruleBreak, o.ruleVisibilityItems, o.ruleInset)) r.push({
|
|
1298
1291
|
bandStart: a,
|
|
1299
1292
|
bandSize: s,
|
|
1300
1293
|
...e
|
|
@@ -1302,40 +1295,40 @@ function ot(e, t, n, r, i, a) {
|
|
|
1302
1295
|
}
|
|
1303
1296
|
return r;
|
|
1304
1297
|
}, 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));
|
|
1305
|
-
e.decorationRuns =
|
|
1298
|
+
e.decorationRuns = xe({
|
|
1306
1299
|
glyphs: S(o.glyphSet),
|
|
1307
1300
|
ruleX: o.ruleX,
|
|
1308
1301
|
ruleY: o.ruleY,
|
|
1309
1302
|
vertical: f,
|
|
1310
1303
|
horizontal: p,
|
|
1311
1304
|
contentWidth: t,
|
|
1312
|
-
contentHeight:
|
|
1305
|
+
contentHeight: M,
|
|
1313
1306
|
border: r,
|
|
1314
1307
|
borderStyle: o.borderStyle,
|
|
1315
1308
|
borderColor: o.borderColor,
|
|
1316
1309
|
padding: i
|
|
1317
1310
|
});
|
|
1318
1311
|
}
|
|
1319
|
-
let
|
|
1320
|
-
if (
|
|
1321
|
-
let e =
|
|
1312
|
+
let te = e.children.filter((e) => z(e.style));
|
|
1313
|
+
if (te.length > 0) {
|
|
1314
|
+
let e = z(o) ? {
|
|
1322
1315
|
x: r.left,
|
|
1323
1316
|
y: r.top,
|
|
1324
1317
|
width: i.left + t + i.right,
|
|
1325
|
-
height: i.top +
|
|
1318
|
+
height: i.top + M + i.bottom
|
|
1326
1319
|
} : {
|
|
1327
|
-
x:
|
|
1328
|
-
y:
|
|
1320
|
+
x: ee,
|
|
1321
|
+
y: j,
|
|
1329
1322
|
width: t,
|
|
1330
|
-
height:
|
|
1323
|
+
height: M
|
|
1331
1324
|
};
|
|
1332
|
-
for (let n of
|
|
1333
|
-
let r =
|
|
1325
|
+
for (let n of te) {
|
|
1326
|
+
let r = ht(n.style.gridColumnStart, n.style.gridColumnEnd, h, m.colOrigin, E, T.sizes, -i.left, t + i.right), a = ht(n.style.gridRowStart, n.style.gridRowEnd, g, m.rowOrigin, A, O.sizes, -i.top, M + i.bottom);
|
|
1334
1327
|
n.staticSlot = {
|
|
1335
1328
|
kind: "grid",
|
|
1336
1329
|
area: {
|
|
1337
|
-
x:
|
|
1338
|
-
y:
|
|
1330
|
+
x: ee + r.start,
|
|
1331
|
+
y: j + a.start,
|
|
1339
1332
|
width: Math.max(0, r.end - r.start),
|
|
1340
1333
|
height: Math.max(0, a.end - a.start)
|
|
1341
1334
|
},
|
|
@@ -1343,16 +1336,16 @@ function ot(e, t, n, r, i, a) {
|
|
|
1343
1336
|
};
|
|
1344
1337
|
}
|
|
1345
1338
|
}
|
|
1346
|
-
return
|
|
1339
|
+
return M;
|
|
1347
1340
|
}
|
|
1348
|
-
function
|
|
1341
|
+
function ct(e) {
|
|
1349
1342
|
let t = e.style.display === "grid";
|
|
1350
1343
|
return {
|
|
1351
1344
|
cols: t && e.style.gridTemplateColumns.kind === "subgrid",
|
|
1352
1345
|
rows: t && e.style.gridTemplateRows.kind === "subgrid"
|
|
1353
1346
|
};
|
|
1354
1347
|
}
|
|
1355
|
-
function
|
|
1348
|
+
function lt(e, t, n, r, i, a) {
|
|
1356
1349
|
let o = e[r] + a.start, s = t.sizes.slice(r, r + i);
|
|
1357
1350
|
return s[0] = Math.max(0, s[0] - a.start), s[i - 1] = Math.max(0, s[i - 1] - a.end), {
|
|
1358
1351
|
positions: Array.from({ length: i }, (t, n) => n === 0 ? 0 : e[r + n] - o),
|
|
@@ -1361,20 +1354,20 @@ function ct(e, t, n, r, i, a) {
|
|
|
1361
1354
|
gap: n
|
|
1362
1355
|
};
|
|
1363
1356
|
}
|
|
1364
|
-
function
|
|
1357
|
+
function ut(e) {
|
|
1365
1358
|
return {
|
|
1366
1359
|
sizes: e.sizes,
|
|
1367
1360
|
gapBefore: e.gapBefore,
|
|
1368
1361
|
limits: e.sizes
|
|
1369
1362
|
};
|
|
1370
1363
|
}
|
|
1371
|
-
function
|
|
1364
|
+
function dt(e, t, n, r) {
|
|
1372
1365
|
let i = [];
|
|
1373
1366
|
return e.children.forEach((a, o) => {
|
|
1374
1367
|
let s = e.placed.items[o], c = n[o];
|
|
1375
1368
|
if (t[o].cols) {
|
|
1376
|
-
let e =
|
|
1377
|
-
for (let t of
|
|
1369
|
+
let e = pt(a, "cols", c, 0);
|
|
1370
|
+
for (let t of mt(a, "cols", s, e, r)) i.push({
|
|
1378
1371
|
...t,
|
|
1379
1372
|
start: t.start + s.col.start
|
|
1380
1373
|
});
|
|
@@ -1383,24 +1376,24 @@ function ut(e, t, n, r) {
|
|
|
1383
1376
|
i.push({
|
|
1384
1377
|
start: s.col.start,
|
|
1385
1378
|
span: s.col.span,
|
|
1386
|
-
min:
|
|
1387
|
-
max:
|
|
1379
|
+
min: q(a, "min", r) + xt(c),
|
|
1380
|
+
max: q(a, "max", r) + xt(c)
|
|
1388
1381
|
});
|
|
1389
1382
|
}), i;
|
|
1390
1383
|
}
|
|
1391
|
-
function
|
|
1384
|
+
function ft(e, t, n) {
|
|
1392
1385
|
let r = [];
|
|
1393
1386
|
return e.children.forEach((i, a) => {
|
|
1394
1387
|
let o = e.placed.items[a], s = n[a];
|
|
1395
1388
|
if (t[a].rows) {
|
|
1396
|
-
let e =
|
|
1397
|
-
for (let t of
|
|
1389
|
+
let e = pt(i, "rows", s, 0);
|
|
1390
|
+
for (let t of mt(i, "rows", o, e)) r.push({
|
|
1398
1391
|
...t,
|
|
1399
1392
|
start: t.start + o.row.start
|
|
1400
1393
|
});
|
|
1401
1394
|
return;
|
|
1402
1395
|
}
|
|
1403
|
-
let c = i.localRect.height +
|
|
1396
|
+
let c = i.localRect.height + St(s), l = i.style.minHeight === "auto" && i.style.overflow.y !== "visible" ? St(s) : c;
|
|
1404
1397
|
r.push({
|
|
1405
1398
|
start: o.row.start,
|
|
1406
1399
|
span: o.row.span,
|
|
@@ -1409,25 +1402,25 @@ function dt(e, t, n) {
|
|
|
1409
1402
|
});
|
|
1410
1403
|
}), r;
|
|
1411
1404
|
}
|
|
1412
|
-
function
|
|
1405
|
+
function pt(e, t, n, r) {
|
|
1413
1406
|
let { border: i, padding: a } = e.style;
|
|
1414
1407
|
return t === "cols" ? {
|
|
1415
|
-
start: (n.left ?? 0) + i.left +
|
|
1416
|
-
end: (n.right ?? 0) + i.right +
|
|
1408
|
+
start: (n.left ?? 0) + i.left + H(a.left, r),
|
|
1409
|
+
end: (n.right ?? 0) + i.right + H(a.right, r)
|
|
1417
1410
|
} : {
|
|
1418
|
-
start: (n.top ?? 0) + i.top +
|
|
1419
|
-
end: (n.bottom ?? 0) + i.bottom +
|
|
1411
|
+
start: (n.top ?? 0) + i.top + H(a.top, r),
|
|
1412
|
+
end: (n.bottom ?? 0) + i.bottom + H(a.bottom, r)
|
|
1420
1413
|
};
|
|
1421
1414
|
}
|
|
1422
|
-
function
|
|
1423
|
-
let a = t === "cols" ? n.col.span : n.row.span, o =
|
|
1415
|
+
function mt(e, t, n, r, i) {
|
|
1416
|
+
let a = t === "cols" ? n.col.span : n.row.span, o = _t(e, void 0, void 0, 0, 0, {
|
|
1424
1417
|
col: n.col.span,
|
|
1425
1418
|
row: n.row.span
|
|
1426
1419
|
}), s = [];
|
|
1427
1420
|
if (o.children.forEach((e, n) => {
|
|
1428
|
-
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 =
|
|
1429
|
-
if (
|
|
1430
|
-
let n =
|
|
1421
|
+
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 = U(e.style.margin, 0);
|
|
1422
|
+
if (ct(e)[t]) {
|
|
1423
|
+
let n = pt(e, t, p, 0), a = mt(e, t, c, {
|
|
1431
1424
|
start: n.start + (u ? r.start : 0),
|
|
1432
1425
|
end: n.end + (d ? r.end : 0)
|
|
1433
1426
|
}, i);
|
|
@@ -1440,11 +1433,11 @@ function pt(e, t, n, r, i) {
|
|
|
1440
1433
|
if (t === "cols") s.push({
|
|
1441
1434
|
start: l.start,
|
|
1442
1435
|
span: l.span,
|
|
1443
|
-
min:
|
|
1444
|
-
max:
|
|
1436
|
+
min: q(e, "min", i) + xt(p) + f,
|
|
1437
|
+
max: q(e, "max", i) + xt(p) + f
|
|
1445
1438
|
});
|
|
1446
1439
|
else {
|
|
1447
|
-
let t = e.localRect.height +
|
|
1440
|
+
let t = e.localRect.height + St(p) + f;
|
|
1448
1441
|
s.push({
|
|
1449
1442
|
start: l.start,
|
|
1450
1443
|
span: l.span,
|
|
@@ -1463,7 +1456,7 @@ function pt(e, t, n, r, i) {
|
|
|
1463
1456
|
}
|
|
1464
1457
|
return s;
|
|
1465
1458
|
}
|
|
1466
|
-
function
|
|
1459
|
+
function ht(e, t, n, r, i, a, o, s) {
|
|
1467
1460
|
let c = Ot(e, "start", n), l = Ot(t, "end", n);
|
|
1468
1461
|
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l = kt(c, t, 1, n) : l !== null && e.kind === "span" && (c = kt(l, e, -1, n));
|
|
1469
1462
|
let u = i.length, d = (e) => {
|
|
@@ -1476,20 +1469,20 @@ function mt(e, t, n, r, i, a, o, s) {
|
|
|
1476
1469
|
end: h === void 0 ? s : p(h)
|
|
1477
1470
|
};
|
|
1478
1471
|
}
|
|
1479
|
-
function
|
|
1472
|
+
function gt(e, t) {
|
|
1480
1473
|
let n = t.gridIntrinsic.get(e);
|
|
1481
1474
|
if (n !== void 0) return n;
|
|
1482
|
-
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a =
|
|
1475
|
+
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a = _t(e, void 0, void 0, i, 0, e.subgrid ? {
|
|
1483
1476
|
col: e.subgrid.colSpan,
|
|
1484
1477
|
row: e.subgrid.rowSpan
|
|
1485
|
-
} : void 0), o = a.children.map(
|
|
1478
|
+
} : void 0), o = a.children.map(ct), s = a.children.map((e) => U(e.style.margin, 0)), c = Mt(a.colTracks, a.colCollapsed, dt(a, o, s, t), "min-content", i, !1), l = c.gapBefore.reduce((e, t) => e + t, 0), u = {
|
|
1486
1479
|
min: c.sizes.reduce((e, t) => e + t, 0) + l,
|
|
1487
1480
|
max: c.limits.reduce((e, t) => e + t, 0) + l
|
|
1488
1481
|
};
|
|
1489
1482
|
return t.gridIntrinsic.set(e, u), u;
|
|
1490
1483
|
}
|
|
1491
|
-
function
|
|
1492
|
-
let o = e.style, s =
|
|
1484
|
+
function _t(e, t, n, r, i, a) {
|
|
1485
|
+
let o = e.style, s = bt(e), c = o.gridTemplateColumns.kind === "subgrid" && a !== void 0, l = o.gridTemplateRows.kind === "subgrid" && a !== void 0, u = c ? vt(a.col) : Ct(o.gridTemplateColumns, t, r), d = l ? vt(a.row) : Ct(o.gridTemplateRows, n, i), f = o.gridTemplateAreas, p = [...u.tracks], m = [...d.tracks];
|
|
1493
1486
|
if (f) {
|
|
1494
1487
|
c || Tt(p, u.lineNames, f.columns, o.gridAutoColumns), l || Tt(m, d.lineNames, f.rows, o.gridAutoRows);
|
|
1495
1488
|
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`);
|
|
@@ -1504,7 +1497,7 @@ function gt(e, t, n, r, i, a) {
|
|
|
1504
1497
|
col: At(e.style.gridColumnStart, e.style.gridColumnEnd, h),
|
|
1505
1498
|
row: At(e.style.gridRowStart, e.style.gridRowEnd, g)
|
|
1506
1499
|
})), p.length, m.length, o.gridAutoFlow);
|
|
1507
|
-
return c &&
|
|
1500
|
+
return c && yt(_, "col", p.length), l && yt(_, "row", m.length), {
|
|
1508
1501
|
children: s,
|
|
1509
1502
|
placed: _,
|
|
1510
1503
|
colLines: h,
|
|
@@ -1515,13 +1508,13 @@ function gt(e, t, n, r, i, a) {
|
|
|
1515
1508
|
rowCollapsed: Dt(d, _.rowOrigin, _.rowCount, _.items.map((e) => e.row))
|
|
1516
1509
|
};
|
|
1517
1510
|
}
|
|
1518
|
-
function
|
|
1511
|
+
function vt(e) {
|
|
1519
1512
|
return {
|
|
1520
|
-
tracks: Array.from({ length: e }, () =>
|
|
1513
|
+
tracks: Array.from({ length: e }, () => ot()),
|
|
1521
1514
|
lineNames: Array.from({ length: e + 1 }, () => [])
|
|
1522
1515
|
};
|
|
1523
1516
|
}
|
|
1524
|
-
function
|
|
1517
|
+
function yt(e, t, n) {
|
|
1525
1518
|
let r = t === "col" ? e.colOrigin : e.rowOrigin;
|
|
1526
1519
|
for (let i of e.items) {
|
|
1527
1520
|
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);
|
|
@@ -1529,20 +1522,14 @@ function vt(e, t, n) {
|
|
|
1529
1522
|
}
|
|
1530
1523
|
t === "col" ? (e.colOrigin = 0, e.colCount = n) : (e.rowOrigin = 0, e.rowCount = n);
|
|
1531
1524
|
}
|
|
1532
|
-
function yt(e) {
|
|
1533
|
-
return e.children.filter((e) => !B(e.style) && !e.inlineBox).sort((e, t) => e.style.order - t.style.order);
|
|
1534
|
-
}
|
|
1535
1525
|
function bt(e) {
|
|
1536
|
-
return (e
|
|
1526
|
+
return e.children.filter((e) => !z(e.style) && !e.inlineBox).sort((e, t) => e.style.order - t.style.order);
|
|
1537
1527
|
}
|
|
1538
1528
|
function xt(e) {
|
|
1539
|
-
return (e.
|
|
1529
|
+
return (e.left ?? 0) + (e.right ?? 0);
|
|
1540
1530
|
}
|
|
1541
|
-
function St(e
|
|
1542
|
-
|
|
1543
|
-
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));
|
|
1544
|
-
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
1545
|
-
return Math.max(0, H(i, a, o));
|
|
1531
|
+
function St(e) {
|
|
1532
|
+
return (e.top ?? 0) + (e.bottom ?? 0);
|
|
1546
1533
|
}
|
|
1547
1534
|
function Ct(e, t, n) {
|
|
1548
1535
|
if (e.kind !== "tracks") return {
|
|
@@ -1587,7 +1574,7 @@ function Ct(e, t, n) {
|
|
|
1587
1574
|
}
|
|
1588
1575
|
function wt(e, t) {
|
|
1589
1576
|
if (e.kind === "cells") return e.value;
|
|
1590
|
-
if (e.kind === "percent" && t !== void 0) return
|
|
1577
|
+
if (e.kind === "percent" && t !== void 0) return Ce(e.value, t);
|
|
1591
1578
|
if (e.kind === "math") {
|
|
1592
1579
|
let n = [];
|
|
1593
1580
|
for (let r of e.args) {
|
|
@@ -1818,7 +1805,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1818
1805
|
if (n.length === 0) continue;
|
|
1819
1806
|
let i = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - i;
|
|
1820
1807
|
if (a > 0) {
|
|
1821
|
-
let e = n.reduce((e, t) => e + t.frFactor, 0), t =
|
|
1808
|
+
let e = n.reduce((e, t) => e + t.frFactor, 0), t = L(n.map((t) => e > 0 ? t.frFactor : 1), a);
|
|
1822
1809
|
n.forEach((e, n) => {
|
|
1823
1810
|
e.base += t[n];
|
|
1824
1811
|
});
|
|
@@ -1829,7 +1816,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1829
1816
|
if (i.length > 0) {
|
|
1830
1817
|
let n = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - n;
|
|
1831
1818
|
if (a > 0) {
|
|
1832
|
-
let e =
|
|
1819
|
+
let e = L(i.map(() => 1), a);
|
|
1833
1820
|
i.forEach((t, n) => {
|
|
1834
1821
|
t.base += e[n];
|
|
1835
1822
|
});
|
|
@@ -1840,7 +1827,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1840
1827
|
if (e.length === 0) continue;
|
|
1841
1828
|
let a = i - (t.reduce((e, t) => e + u(t), 0) + r);
|
|
1842
1829
|
if (a > 0) {
|
|
1843
|
-
let t =
|
|
1830
|
+
let t = L(e.map(() => 1), a);
|
|
1844
1831
|
e.forEach((e, n) => {
|
|
1845
1832
|
e.limit = u(e) + t[n];
|
|
1846
1833
|
});
|
|
@@ -1862,7 +1849,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1862
1849
|
n <= 0 || (t = Math.max(t, (e.max - r) / Math.max(n, 1)));
|
|
1863
1850
|
}
|
|
1864
1851
|
for (let n of e) {
|
|
1865
|
-
let e = Math.max(n.base,
|
|
1852
|
+
let e = Math.max(n.base, N(n.frFactor * t));
|
|
1866
1853
|
n.limit = e, r === "max-content" && (n.base = e);
|
|
1867
1854
|
}
|
|
1868
1855
|
}
|
|
@@ -1872,7 +1859,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1872
1859
|
for (; !(t <= 0);) {
|
|
1873
1860
|
let e = s.filter((e) => !e.collapsed && e.limitKind !== "fr" && e.base < u(e));
|
|
1874
1861
|
if (e.length === 0) break;
|
|
1875
|
-
let n =
|
|
1862
|
+
let n = L(e.map(() => 1), t), r = 0;
|
|
1876
1863
|
if (e.forEach((e, t) => {
|
|
1877
1864
|
let i = Math.min(n[t], u(e) - e.base);
|
|
1878
1865
|
e.base += i, r += i;
|
|
@@ -1882,7 +1869,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1882
1869
|
if (n.length > 0) {
|
|
1883
1870
|
let t = Math.max(0, o - e - s.reduce((e, t) => e + (t.limitKind === "fr" ? 0 : t.base), 0)), r = n, i = t, a = n.reduce((e, t) => e + t.frFactor, 0);
|
|
1884
1871
|
for (a < 1 && (i = Math.floor(i * a));;) {
|
|
1885
|
-
let e =
|
|
1872
|
+
let e = L(r.map((e) => e.frFactor), i), t = r.filter((t, n) => e[n] < t.base);
|
|
1886
1873
|
if (t.length === 0) {
|
|
1887
1874
|
r.forEach((t, n) => {
|
|
1888
1875
|
t.base = Math.max(t.base, e[n]);
|
|
@@ -1896,7 +1883,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1896
1883
|
if (a) {
|
|
1897
1884
|
let t = o - e - s.reduce((e, t) => e + t.base, 0), n = s.filter((e) => !e.collapsed && e.limitKind === "intrinsic-max");
|
|
1898
1885
|
if (t > 0 && n.length > 0) {
|
|
1899
|
-
let e =
|
|
1886
|
+
let e = L(n.map(() => 1), t);
|
|
1900
1887
|
n.forEach((t, n) => {
|
|
1901
1888
|
t.base += e[n];
|
|
1902
1889
|
});
|
|
@@ -1910,7 +1897,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1910
1897
|
};
|
|
1911
1898
|
}
|
|
1912
1899
|
function Nt(e, t, n) {
|
|
1913
|
-
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t - Pt(e)), o =
|
|
1900
|
+
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t - Pt(e)), o = I(n === "stretch" ? "start" : n, r, a), s = [], c = 0;
|
|
1914
1901
|
for (let e = 0; e < r.length; e++) c += i[e], s.push(o[e] + c);
|
|
1915
1902
|
return s;
|
|
1916
1903
|
}
|
|
@@ -1923,7 +1910,7 @@ function Ft(e, t, n, r) {
|
|
|
1923
1910
|
}
|
|
1924
1911
|
function It(e, t, n, r, i) {
|
|
1925
1912
|
let a = t ?? 0, o = n ?? 0, s = r - i;
|
|
1926
|
-
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a +
|
|
1913
|
+
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a + Ye(e, r, i + a + o);
|
|
1927
1914
|
}
|
|
1928
1915
|
//#endregion
|
|
1929
1916
|
//#region src/multicol.ts
|
|
@@ -2019,7 +2006,7 @@ function Jt() {
|
|
|
2019
2006
|
return e.remove(), qt = !(n.width > 0 && n.top - t >= 10), qt;
|
|
2020
2007
|
}
|
|
2021
2008
|
function Yt(e, t) {
|
|
2022
|
-
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 =
|
|
2009
|
+
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 = Ae(e, Math.max(1, n - i), {
|
|
2023
2010
|
advances: s,
|
|
2024
2011
|
tracking: i,
|
|
2025
2012
|
firstLineIndent: t.firstLineIndent
|
|
@@ -2047,11 +2034,11 @@ function Xt(e, t, n, r) {
|
|
|
2047
2034
|
end: e.end
|
|
2048
2035
|
});
|
|
2049
2036
|
}
|
|
2050
|
-
e.decorationRuns =
|
|
2037
|
+
e.decorationRuns = xe({
|
|
2051
2038
|
glyphs: S(i.glyphSet),
|
|
2052
2039
|
ruleX: i.ruleX,
|
|
2053
2040
|
ruleY: null,
|
|
2054
|
-
vertical:
|
|
2041
|
+
vertical: Ve(s, i.ruleInset),
|
|
2055
2042
|
horizontal: [],
|
|
2056
2043
|
contentWidth: a,
|
|
2057
2044
|
contentHeight: t.totalRows,
|
|
@@ -2066,7 +2053,7 @@ function Zt(e, t) {
|
|
|
2066
2053
|
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;
|
|
2067
2054
|
}
|
|
2068
2055
|
function Qt(e, t, n, r, i, a, o) {
|
|
2069
|
-
let s = e.style, c =
|
|
2056
|
+
let s = e.style, c = Wn(s, "x", n), l = Ht(s, n, c);
|
|
2070
2057
|
a.right += l.leftover;
|
|
2071
2058
|
let u = s.lineGap, d = i.left + a.left, f = i.top + a.top, p = n - l.leftover, m = [[]], h = [];
|
|
2072
2059
|
for (let e of t) e.style.columnSpan ? (h[m.length - 1] = e, m.push([])) : m[m.length - 1].push(e);
|
|
@@ -2077,12 +2064,12 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2077
2064
|
let i = t.map((e) => ({
|
|
2078
2065
|
node: e,
|
|
2079
2066
|
spans: Hn(e, Math.max(1, l.width - e.style.tracking)),
|
|
2080
|
-
margin:
|
|
2067
|
+
margin: U(e.style.margin, l.width),
|
|
2081
2068
|
pre: 0,
|
|
2082
2069
|
post: 0
|
|
2083
2070
|
})), a = [], o = null, h = null, x = !1;
|
|
2084
2071
|
for (let e of i) {
|
|
2085
|
-
let { node: t, spans: n, margin: r } = e, i = o === null ? r.top ?? 0 :
|
|
2072
|
+
let { node: t, spans: n, margin: r } = e, i = o === null ? r.top ?? 0 : Yn(o, r.top ?? 0), s = i;
|
|
2086
2073
|
_ === "glue" && h !== null ? (s = 0, h.post = i, a[a.length - 1].post = i) : e.pre = i;
|
|
2087
2074
|
let c = x || t.style.breakBeforeColumn;
|
|
2088
2075
|
if (t.style.breakInsideAvoid && n.length > 0) a.push({
|
|
@@ -2147,9 +2134,9 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2147
2134
|
}
|
|
2148
2135
|
let i = h[e];
|
|
2149
2136
|
if (i) {
|
|
2150
|
-
let e =
|
|
2151
|
-
|
|
2152
|
-
let r =
|
|
2137
|
+
let e = U(i.style.margin, p), t = (e.left ?? 0) + (e.right ?? 0);
|
|
2138
|
+
B(i, Math.max(0, p - t), void 0, 0, 0, "fill", o);
|
|
2139
|
+
let r = Jn(e, p, i.localRect.width), a = (e.top ?? 0) + n;
|
|
2153
2140
|
y += a, i.localRect = {
|
|
2154
2141
|
...i.localRect,
|
|
2155
2142
|
x: d + r,
|
|
@@ -2164,8 +2151,8 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2164
2151
|
}
|
|
2165
2152
|
let x = y;
|
|
2166
2153
|
for (let t of e.children) {
|
|
2167
|
-
if (!
|
|
2168
|
-
let e =
|
|
2154
|
+
if (!z(t.style)) continue;
|
|
2155
|
+
let e = U(t.style.margin, n);
|
|
2169
2156
|
t.staticSlot = {
|
|
2170
2157
|
kind: "block",
|
|
2171
2158
|
x: d + (e.left ?? 0),
|
|
@@ -2189,9 +2176,9 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2189
2176
|
}, x;
|
|
2190
2177
|
}
|
|
2191
2178
|
function $t(e, t, n, r, i, a, o) {
|
|
2192
|
-
let s = e.style, c = Bt(n, r), l = e.children.filter((e) => !
|
|
2179
|
+
let s = e.style, c = Bt(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);
|
|
2193
2180
|
if (u.length > 0 && u.every((e) => Zt(e, s)) && (u.length === l.length || s.columnFill === "balance" && c === void 0 && (Jt() || 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 Qt(e, l, t, c, i, a, o);
|
|
2194
|
-
let f =
|
|
2181
|
+
let f = Wn(s, "x", t), p = Rt(s, t, f), m = p.length, h = [];
|
|
2195
2182
|
{
|
|
2196
2183
|
let e = 0;
|
|
2197
2184
|
for (let t of p) h.push(e), e += t + f;
|
|
@@ -2200,7 +2187,7 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2200
2187
|
let r = 0, i = 0, a = null, s = 0, c = (e) => {
|
|
2201
2188
|
if (t) for (let t of T) {
|
|
2202
2189
|
if (t.index !== e) continue;
|
|
2203
|
-
let n = a === null ? t.margin.top ?? 0 :
|
|
2190
|
+
let n = a === null ? t.margin.top ?? 0 : Yn(a, t.margin.top ?? 0);
|
|
2204
2191
|
t.child.staticSlot = {
|
|
2205
2192
|
kind: "block",
|
|
2206
2193
|
x: y + g(r) + (t.margin.left ?? 0),
|
|
@@ -2211,16 +2198,16 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2211
2198
|
for (let l = 0; l < w.length; l++) {
|
|
2212
2199
|
let u = w[l];
|
|
2213
2200
|
c(l);
|
|
2214
|
-
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 :
|
|
2201
|
+
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 : Yn(a, u.margin.top ?? 0), f = u.node.localRect.height;
|
|
2215
2202
|
if (a !== null && (u.breakBefore || i + d + f > e) && (r += 1, i = 0, a = null, d = 0), t) {
|
|
2216
2203
|
let e = u.node, t = _(r);
|
|
2217
2204
|
if (t !== v) {
|
|
2218
2205
|
let r = (u.margin.left ?? 0) + (u.margin.right ?? 0);
|
|
2219
|
-
|
|
2206
|
+
B(e, Math.max(0, t - r), n, 0, 0, "fill", o);
|
|
2220
2207
|
}
|
|
2221
2208
|
e.localRect = {
|
|
2222
2209
|
...e.localRect,
|
|
2223
|
-
x: y + g(r) +
|
|
2210
|
+
x: y + g(r) + Jn(u.margin, t, e.localRect.width),
|
|
2224
2211
|
y: b + C + i + d
|
|
2225
2212
|
};
|
|
2226
2213
|
}
|
|
@@ -2259,36 +2246,36 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2259
2246
|
C += a, w = [], T = [];
|
|
2260
2247
|
};
|
|
2261
2248
|
for (let r of e.children) {
|
|
2262
|
-
if (
|
|
2249
|
+
if (z(r.style)) {
|
|
2263
2250
|
T.push({
|
|
2264
2251
|
child: r,
|
|
2265
|
-
margin:
|
|
2252
|
+
margin: U(r.style.margin, t),
|
|
2266
2253
|
index: w.length
|
|
2267
2254
|
});
|
|
2268
2255
|
continue;
|
|
2269
2256
|
}
|
|
2270
2257
|
if (r.style.columnSpan) {
|
|
2271
2258
|
O(), E = !1;
|
|
2272
|
-
let e =
|
|
2273
|
-
|
|
2259
|
+
let e = U(r.style.margin, t), i = (e.left ?? 0) + (e.right ?? 0);
|
|
2260
|
+
B(r, Math.max(0, t - i), n, 0, 0, "fill", o), C += e.top ?? 0, r.localRect = {
|
|
2274
2261
|
...r.localRect,
|
|
2275
|
-
x: y +
|
|
2262
|
+
x: y + Jn(e, t, r.localRect.width),
|
|
2276
2263
|
y: b + C
|
|
2277
2264
|
}, C += r.localRect.height + (e.bottom ?? 0);
|
|
2278
2265
|
continue;
|
|
2279
2266
|
}
|
|
2280
|
-
let e =
|
|
2281
|
-
|
|
2267
|
+
let e = U(r.style.margin, v), i = (e.left ?? 0) + (e.right ?? 0);
|
|
2268
|
+
B(r, Math.max(0, v - i), n, 0, 0, "fill", o), w.push({
|
|
2282
2269
|
node: r,
|
|
2283
2270
|
margin: e,
|
|
2284
2271
|
breakBefore: E || r.style.breakBeforeColumn
|
|
2285
2272
|
}), E = r.style.breakAfterColumn;
|
|
2286
2273
|
}
|
|
2287
|
-
return O(), s.ruleX && x.length > 0 && (e.decorationRuns =
|
|
2274
|
+
return O(), s.ruleX && x.length > 0 && (e.decorationRuns = xe({
|
|
2288
2275
|
glyphs: S(s.glyphSet),
|
|
2289
2276
|
ruleX: s.ruleX,
|
|
2290
2277
|
ruleY: null,
|
|
2291
|
-
vertical:
|
|
2278
|
+
vertical: Ve(x, s.ruleInset),
|
|
2292
2279
|
horizontal: [],
|
|
2293
2280
|
contentWidth: t,
|
|
2294
2281
|
contentHeight: C,
|
|
@@ -2301,7 +2288,7 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2301
2288
|
//#endregion
|
|
2302
2289
|
//#region src/table.ts
|
|
2303
2290
|
function en(e, t) {
|
|
2304
|
-
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" &&
|
|
2291
|
+
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" && M(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).");
|
|
2305
2292
|
}
|
|
2306
2293
|
function tn(e, t) {
|
|
2307
2294
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
@@ -2309,7 +2296,7 @@ function tn(e, t) {
|
|
|
2309
2296
|
}
|
|
2310
2297
|
function nn(e, t, n) {
|
|
2311
2298
|
let r = (t, r) => {
|
|
2312
|
-
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ?
|
|
2299
|
+
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ? G(i, 0, t, n) : void 0, o = i && i.kind === "percent" ? i.value : void 0;
|
|
2313
2300
|
for (let t = 0; t < r; t++) e.colFixed.push(a), e.colPercent.push(o);
|
|
2314
2301
|
};
|
|
2315
2302
|
if (t.style.tableRole === "column") {
|
|
@@ -2338,7 +2325,7 @@ function an(e, t) {
|
|
|
2338
2325
|
hidden: []
|
|
2339
2326
|
}, r = [], i = [], a = [];
|
|
2340
2327
|
for (let o of e.children) {
|
|
2341
|
-
if (
|
|
2328
|
+
if (z(o.style)) continue;
|
|
2342
2329
|
let e = o.style.tableRole;
|
|
2343
2330
|
if (e === "row") i.push({
|
|
2344
2331
|
row: o,
|
|
@@ -2346,7 +2333,7 @@ function an(e, t) {
|
|
|
2346
2333
|
});
|
|
2347
2334
|
else if (e === "header-group" || e === "row-group" || e === "footer-group") {
|
|
2348
2335
|
let t = e === "header-group" ? r : e === "footer-group" ? a : i;
|
|
2349
|
-
for (let e of o.children)
|
|
2336
|
+
for (let e of o.children) z(e.style) || (e.style.tableRole === "row" ? t.push({
|
|
2350
2337
|
row: e,
|
|
2351
2338
|
group: o
|
|
2352
2339
|
}) : en(n, e));
|
|
@@ -2372,7 +2359,7 @@ function on(e) {
|
|
|
2372
2359
|
for (let n = 0; n < e.rows.length; n++) {
|
|
2373
2360
|
let r = e.rows[n], i = 0;
|
|
2374
2361
|
for (let a of r.children) {
|
|
2375
|
-
if (
|
|
2362
|
+
if (z(a.style)) continue;
|
|
2376
2363
|
if (a.style.tableRole !== "cell") {
|
|
2377
2364
|
en(e, a);
|
|
2378
2365
|
continue;
|
|
@@ -2393,14 +2380,14 @@ function on(e) {
|
|
|
2393
2380
|
e.columnCount = Math.max(t.length, e.colFixed.length);
|
|
2394
2381
|
}
|
|
2395
2382
|
function sn(e, t, n) {
|
|
2396
|
-
let r = e.style, i =
|
|
2383
|
+
let r = e.style, i = J(e, n), a;
|
|
2397
2384
|
if (t === "min") a = i;
|
|
2398
2385
|
else {
|
|
2399
|
-
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ?
|
|
2400
|
-
a = t === void 0 ?
|
|
2386
|
+
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ? G(r.width, 0, e, n) : void 0;
|
|
2387
|
+
a = t === void 0 ? K(e, n) : Math.max(i, t);
|
|
2401
2388
|
}
|
|
2402
2389
|
let o = typeof r.minWidth == "number" ? r.minWidth : 0, s = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
2403
|
-
return Math.max(0,
|
|
2390
|
+
return Math.max(0, V(a, o, s));
|
|
2404
2391
|
}
|
|
2405
2392
|
function cn(e) {
|
|
2406
2393
|
let t = e.style.width;
|
|
@@ -2425,7 +2412,7 @@ function ln(e, t, n) {
|
|
|
2425
2412
|
for (let t of ["min", "max"]) {
|
|
2426
2413
|
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d = sn(e.node, t, n) - u;
|
|
2427
2414
|
if (d <= 0) continue;
|
|
2428
|
-
let f =
|
|
2415
|
+
let f = L(c.some((e) => e > 0) ? c : c.map(() => 1), d);
|
|
2429
2416
|
for (let e = r; e < o; e++) l[e] += f[e - r];
|
|
2430
2417
|
}
|
|
2431
2418
|
}
|
|
@@ -2447,19 +2434,19 @@ function un(e, t) {
|
|
|
2447
2434
|
}
|
|
2448
2435
|
let s = a.reduce((t, n) => t + e.min[n], 0), c = i.reduce((e, t) => e + r[t], 0) - (t - s);
|
|
2449
2436
|
if (c > 0) {
|
|
2450
|
-
let t = i.map((t) => r[t] - e.min[t]), n =
|
|
2437
|
+
let t = i.map((t) => r[t] - e.min[t]), n = L(t, Math.min(c, t.reduce((e, t) => e + t, 0)));
|
|
2451
2438
|
i.forEach((e, t) => r[e] -= n[t]);
|
|
2452
2439
|
}
|
|
2453
2440
|
}
|
|
2454
2441
|
let o = t - r.reduce((e, t) => e + t, 0);
|
|
2455
2442
|
if (o > 0 && a.length > 0) {
|
|
2456
|
-
let t = a.map((t) => e.max[t] - e.min[t]), n = t.reduce((e, t) => e + t, 0), i =
|
|
2443
|
+
let t = a.map((t) => e.max[t] - e.min[t]), n = t.reduce((e, t) => e + t, 0), i = L(t, Math.min(o, n));
|
|
2457
2444
|
a.forEach((e, t) => r[e] += i[t]), o -= Math.min(o, n);
|
|
2458
2445
|
}
|
|
2459
2446
|
if (o > 0) {
|
|
2460
2447
|
let t = a.length > 0 ? a : i;
|
|
2461
2448
|
if (t.length > 0) {
|
|
2462
|
-
let n = t.map((t) => e.max[t]), i =
|
|
2449
|
+
let n = t.map((t) => e.max[t]), i = L(n.some((e) => e > 0) ? n : n.map(() => 1), o);
|
|
2463
2450
|
t.forEach((e, t) => r[e] += i[t]);
|
|
2464
2451
|
}
|
|
2465
2452
|
}
|
|
@@ -2471,8 +2458,8 @@ function dn(e, t, n) {
|
|
|
2471
2458
|
for (let r of e.cells) {
|
|
2472
2459
|
if (r.row !== 0) continue;
|
|
2473
2460
|
let e = r.node.style, a;
|
|
2474
|
-
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 =
|
|
2475
|
-
let o =
|
|
2461
|
+
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 = G(e.width, 0, r.node, n)), a === void 0) continue;
|
|
2462
|
+
let o = L(Array.from({ length: r.colSpan }, () => 1), a);
|
|
2476
2463
|
for (let e = 0; e < r.colSpan; e++) {
|
|
2477
2464
|
let t = r.col + e;
|
|
2478
2465
|
i[t] === void 0 && (i[t] = o[e]);
|
|
@@ -2480,7 +2467,7 @@ function dn(e, t, n) {
|
|
|
2480
2467
|
}
|
|
2481
2468
|
let a = i.reduce((e, t) => e + (t ?? 0), 0), o = i.filter((e) => e === void 0).length;
|
|
2482
2469
|
if (o > 0) {
|
|
2483
|
-
let e =
|
|
2470
|
+
let e = L(Array.from({ length: o }, () => 1), Math.max(0, t - a)), n = 0;
|
|
2484
2471
|
for (let t = 0; t < r; t++) i[t] === void 0 && (i[t] = e[n++]);
|
|
2485
2472
|
}
|
|
2486
2473
|
return i.map((e) => e ?? 0);
|
|
@@ -2625,13 +2612,13 @@ function vn(e, t) {
|
|
|
2625
2612
|
}
|
|
2626
2613
|
function yn(e, t) {
|
|
2627
2614
|
let { structure: n, bounds: r, chromeX: i } = vn(e, t), a = r.min.reduce((e, t) => e + t, 0) + i, o = r.max.reduce((e, t) => e + t, 0) + i;
|
|
2628
|
-
return n.caption && (a = Math.max(a,
|
|
2615
|
+
return n.caption && (a = Math.max(a, J(n.caption, t)), o = Math.max(o, K(n.caption, t))), {
|
|
2629
2616
|
min: a,
|
|
2630
2617
|
max: o
|
|
2631
2618
|
};
|
|
2632
2619
|
}
|
|
2633
2620
|
function bn(e, t, n) {
|
|
2634
|
-
let r = e.style, { bounds: i, chromeX: a } = vn(e, n), { min: o, max: s } = yn(e, n), c = r.border.left + r.border.right +
|
|
2621
|
+
let r = e.style, { bounds: i, chromeX: a } = vn(e, n), { min: o, max: s } = yn(e, n), c = r.border.left + r.border.right + H(r.padding.left, t) + H(r.padding.right, t) + it(r).right, l = i.max.reduce((e, t) => e + t, 0), u = 0, d = 0;
|
|
2635
2622
|
for (let e = 0; e < i.max.length; e++) {
|
|
2636
2623
|
let t = i.percent[e];
|
|
2637
2624
|
t === void 0 ? d += i.max[e] : u += t;
|
|
@@ -2663,13 +2650,13 @@ function xn(e, t, n, r, i, a) {
|
|
|
2663
2650
|
let p = Math.max(0, t - hn(s, l)), m = e.style, h = m.tableLayout === "fixed" && m.width !== void 0 && m.width.kind !== "auto" ? dn(o, p, a) : un(c, p), g = [], _ = 0;
|
|
2664
2651
|
for (let e = 0; e < l; e++) _ += s.collapsed ? s.vLines[e] : s.spacingX, g.push(_), _ += h[e];
|
|
2665
2652
|
let v = _ + (s.collapsed ? s.vLines[l] ?? 0 : s.spacingX), y = 0;
|
|
2666
|
-
o.caption && (
|
|
2653
|
+
o.caption && (B(o.caption, t, void 0, d, f, "fill", a), y = o.caption.localRect.height);
|
|
2667
2654
|
let b = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
|
|
2668
2655
|
for (let e of o.cells) {
|
|
2669
2656
|
let t = e.col + e.colSpan, n = h.slice(e.col, t).reduce((e, t) => e + t, 0) + gn(s, e.col, t);
|
|
2670
|
-
x.set(e, n),
|
|
2657
|
+
x.set(e, n), B(e.node, n, void 0, 0, 0, "fill", a, { width: n }), b.set(e, e.node.localRect.height);
|
|
2671
2658
|
}
|
|
2672
|
-
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 ?
|
|
2659
|
+
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 ? Ce(e.value, w) : 0, E = Array.from({ length: u }, () => 0), D = Array.from({ length: u }, () => !1);
|
|
2673
2660
|
for (let e = 0; e < u; e++) {
|
|
2674
2661
|
let t = o.rows[e].style.height;
|
|
2675
2662
|
t !== void 0 && t.kind === "cells" && (E[e] = t.value);
|
|
@@ -2684,7 +2671,7 @@ function xn(e, t, n, r, i, a) {
|
|
|
2684
2671
|
for (let e of O) {
|
|
2685
2672
|
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + _n(s, e.row, t), r = b.get(e) - n;
|
|
2686
2673
|
if (r <= 0) continue;
|
|
2687
|
-
let i =
|
|
2674
|
+
let i = L(Array.from({ length: e.rowSpan }, () => 1), r);
|
|
2688
2675
|
for (let n = e.row; n < t; n++) E[n] += i[n - e.row];
|
|
2689
2676
|
}
|
|
2690
2677
|
if (n !== void 0 && u > 0) {
|
|
@@ -2692,18 +2679,18 @@ function xn(e, t, n, r, i, a) {
|
|
|
2692
2679
|
if (e > 0) {
|
|
2693
2680
|
let t = [];
|
|
2694
2681
|
for (let e = 0; e < u; e++) D[e] || t.push(e);
|
|
2695
|
-
let n = t.length > 0 ? t : Array.from({ length: u }, (e, t) => t), r =
|
|
2682
|
+
let n = t.length > 0 ? t : Array.from({ length: u }, (e, t) => t), r = L(n.map(() => 1), e);
|
|
2696
2683
|
n.forEach((e, t) => E[e] += r[t]);
|
|
2697
2684
|
}
|
|
2698
2685
|
}
|
|
2699
|
-
let k = o.caption && e.style.captionSide === "top" ? y : 0, A = [],
|
|
2700
|
-
for (let e = 0; e < u; e++)
|
|
2701
|
-
let
|
|
2686
|
+
let k = o.caption && e.style.captionSide === "top" ? y : 0, A = [], ee = k;
|
|
2687
|
+
for (let e = 0; e < u; e++) ee += s.collapsed ? s.hLines[e] : s.spacingY, A.push(ee), ee += E[e];
|
|
2688
|
+
let j = u > 0 ? ee + (s.collapsed ? s.hLines[u] ?? 0 : s.spacingY) : k, M = /* @__PURE__ */ new Map();
|
|
2702
2689
|
for (let e = 0; e < u; e++) {
|
|
2703
2690
|
let t = o.rowGroups[e];
|
|
2704
|
-
t && !
|
|
2691
|
+
t && !M.has(t) && M.set(t, A[e]);
|
|
2705
2692
|
}
|
|
2706
|
-
for (let [e, t] of
|
|
2693
|
+
for (let [e, t] of M) {
|
|
2707
2694
|
let n = t;
|
|
2708
2695
|
for (let t = 0; t < u; t++) o.rowGroups[t] === e && (n = A[t] + E[t]);
|
|
2709
2696
|
e.localRect = {
|
|
@@ -2719,7 +2706,7 @@ function xn(e, t, n, r, i, a) {
|
|
|
2719
2706
|
}, e.unclampedHeight = n - t;
|
|
2720
2707
|
}
|
|
2721
2708
|
for (let e = 0; e < u; e++) {
|
|
2722
|
-
let t = o.rows[e], n = o.rowGroups[e], r = n ?
|
|
2709
|
+
let t = o.rows[e], n = o.rowGroups[e], r = n ? M.get(n) : void 0;
|
|
2723
2710
|
t.localRect = {
|
|
2724
2711
|
x: r === void 0 ? d : 0,
|
|
2725
2712
|
y: r === void 0 ? f + A[e] : A[e] - r,
|
|
@@ -2734,7 +2721,7 @@ function xn(e, t, n, r, i, a) {
|
|
|
2734
2721
|
}
|
|
2735
2722
|
for (let e of o.cells) {
|
|
2736
2723
|
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + _n(s, e.row, t);
|
|
2737
|
-
e.node.children.some((e) => !
|
|
2724
|
+
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, {
|
|
2738
2725
|
width: x.get(e),
|
|
2739
2726
|
height: n
|
|
2740
2727
|
}), Sn(e.node, n - (e.node.naturalContentHeight ?? e.node.localRect.height)), e.node.localRect = {
|
|
@@ -2744,21 +2731,21 @@ function xn(e, t, n, r, i, a) {
|
|
|
2744
2731
|
height: n
|
|
2745
2732
|
};
|
|
2746
2733
|
}
|
|
2747
|
-
for (let t of e.children)
|
|
2734
|
+
for (let t of e.children) z(t.style) && (t.staticSlot = {
|
|
2748
2735
|
kind: "block",
|
|
2749
2736
|
x: d,
|
|
2750
2737
|
y: f
|
|
2751
2738
|
});
|
|
2752
|
-
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f +
|
|
2739
|
+
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + j), s.collapsed && l > 0 && u > 0 && (e.decorationRuns = Cn(s, o, h, E, g, A, d, f, S(e.style.glyphSet))), e.style.captionSide === "bottom" ? j + y : j;
|
|
2753
2740
|
}
|
|
2754
2741
|
function Sn(e, t) {
|
|
2755
2742
|
if (t <= 0) return;
|
|
2756
2743
|
let n = e.style.verticalAlign, r = n === "center" ? Math.floor(t / 2) : n === "end" ? t : 0;
|
|
2757
|
-
if (!e.children.some((e) => !
|
|
2744
|
+
if (!e.children.some((e) => !z(e.style) && !e.inlineBox)) {
|
|
2758
2745
|
e.resolvedPadding.top += r, e.resolvedPadding.bottom += t - r;
|
|
2759
2746
|
return;
|
|
2760
2747
|
}
|
|
2761
|
-
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (
|
|
2748
|
+
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);
|
|
2762
2749
|
}
|
|
2763
2750
|
function Cn(e, t, n, r, i, a, o, s, c) {
|
|
2764
2751
|
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];
|
|
@@ -2767,7 +2754,7 @@ function Cn(e, t, n, r, i, a, o, s, c) {
|
|
|
2767
2754
|
for (let e = 0; e < u; e++) {
|
|
2768
2755
|
let i = n[e];
|
|
2769
2756
|
if (!i) continue;
|
|
2770
|
-
let l =
|
|
2757
|
+
let l = he(i.style, "v", c);
|
|
2771
2758
|
for (let n = 0; n < i.width; n++) for (let c = a[e]; c < a[e] + r[e]; c++) d.push({
|
|
2772
2759
|
glyph: l,
|
|
2773
2760
|
x: o + f(t) + n,
|
|
@@ -2782,7 +2769,7 @@ function Cn(e, t, n, r, i, a, o, s, c) {
|
|
|
2782
2769
|
for (let e = 0; e < l; e++) {
|
|
2783
2770
|
let a = r[e];
|
|
2784
2771
|
if (!a) continue;
|
|
2785
|
-
let l =
|
|
2772
|
+
let l = he(a.style, "h", c);
|
|
2786
2773
|
for (let r = 0; r < a.width; r++) d.push({
|
|
2787
2774
|
glyph: l,
|
|
2788
2775
|
x: o + i[e],
|
|
@@ -2801,7 +2788,7 @@ function Cn(e, t, n, r, i, a, o, s, c) {
|
|
|
2801
2788
|
m
|
|
2802
2789
|
].filter((e) => e !== null);
|
|
2803
2790
|
if (h.length === 0) continue;
|
|
2804
|
-
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width && fn[t.style] > fn[e.style] ? t : e), v =
|
|
2791
|
+
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width && fn[t.style] > fn[e.style] ? t : e), v = ge(g, r !== null, i !== null, a !== null, m !== null, c);
|
|
2805
2792
|
for (let r = 0; r < e.vLines[t]; r++) for (let i = 0; i < e.hLines[n]; i++) d.push({
|
|
2806
2793
|
glyph: v,
|
|
2807
2794
|
x: o + f(t) + r,
|
|
@@ -2832,7 +2819,7 @@ function Tn(e, t, n, r, i) {
|
|
|
2832
2819
|
}
|
|
2833
2820
|
}
|
|
2834
2821
|
function En(e, t, n) {
|
|
2835
|
-
return e === null ? t === null ? 0 : -
|
|
2822
|
+
return e === null ? t === null ? 0 : -H(t, n) : H(e, n);
|
|
2836
2823
|
}
|
|
2837
2824
|
function Dn(e, t) {
|
|
2838
2825
|
if (!t) for (let t = e.length - 1; t > 0; t--) {
|
|
@@ -2860,14 +2847,14 @@ function On(e, t, n, r, i, a) {
|
|
|
2860
2847
|
y: r + c.area.y,
|
|
2861
2848
|
width: c.area.width,
|
|
2862
2849
|
height: c.area.height
|
|
2863
|
-
} : Dn(i, s), u = o.insets.left === null ? null :
|
|
2864
|
-
if (!y) C.width =
|
|
2865
|
-
else if (u !== null && d !== null) C.width =
|
|
2850
|
+
} : Dn(i, s), u = o.insets.left === null ? null : H(o.insets.left, l.width), d = o.insets.right === null ? null : H(o.insets.right, l.width), f = o.insets.top === null ? null : H(o.insets.top, l.height), p = o.insets.bottom === null ? null : H(o.insets.bottom, l.height), m = U(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 = {};
|
|
2851
|
+
if (!y) C.width = V(G(o.width, l.width, e, a), x, S);
|
|
2852
|
+
else if (u !== null && d !== null) C.width = V(Math.max(0, l.width - u - d - h - g), x, S);
|
|
2866
2853
|
else {
|
|
2867
2854
|
let t = Math.max(0, l.width - (u ?? 0) - (d ?? 0) - h - g);
|
|
2868
|
-
C.width =
|
|
2855
|
+
C.width = V(Math.min(K(e, a), Math.max(J(e, a), t)), x, S);
|
|
2869
2856
|
}
|
|
2870
|
-
f !== null && p !== null && b && (C.height =
|
|
2857
|
+
f !== null && p !== null && b && (C.height = V(Math.max(0, l.height - f - p - _ - v), W(o.minHeight, l.height) ?? 0, W(o.maxHeight, l.height))), B(e, l.width, l.height, 0, 0, "shrink", a, C);
|
|
2871
2858
|
let w = e.localRect.width, T = e.localRect.height, E;
|
|
2872
2859
|
if (u !== null && d !== null) {
|
|
2873
2860
|
let e = Math.max(0, l.width - u - d - w - h - g), t = m.left === null && m.right === null;
|
|
@@ -2885,13 +2872,13 @@ function On(e, t, n, r, i, a) {
|
|
|
2885
2872
|
};
|
|
2886
2873
|
}
|
|
2887
2874
|
function kn(e, t, n) {
|
|
2888
|
-
return
|
|
2875
|
+
return I(e, [n], Math.max(0, t - n))[0];
|
|
2889
2876
|
}
|
|
2890
2877
|
function An(e, t, n, r) {
|
|
2891
|
-
return
|
|
2878
|
+
return Ye(Je(e, t), n, r);
|
|
2892
2879
|
}
|
|
2893
2880
|
function jn(e, t, n, r, i) {
|
|
2894
|
-
let a =
|
|
2881
|
+
let a = U(e.style.margin, n.innerWidth), [o, s, c, l] = r === "x" ? [
|
|
2895
2882
|
a.left ?? 0,
|
|
2896
2883
|
a.right ?? 0,
|
|
2897
2884
|
n.innerWidth,
|
|
@@ -2905,7 +2892,7 @@ function jn(e, t, n, r, i) {
|
|
|
2905
2892
|
return (l ? kn($e(t.style), c, u) : An(e, t, c, u)) + o;
|
|
2906
2893
|
}
|
|
2907
2894
|
function Mn(e, t, n, r, i) {
|
|
2908
|
-
let a =
|
|
2895
|
+
let a = U(e.style.margin, n.width), o = e.style.justifySelf === "auto" ? t.style.justifyItems : e.style.justifySelf, [s, c, l, u] = r === "x" ? [
|
|
2909
2896
|
a.left ?? 0,
|
|
2910
2897
|
a.right ?? 0,
|
|
2911
2898
|
n.width,
|
|
@@ -2914,9 +2901,9 @@ function Mn(e, t, n, r, i) {
|
|
|
2914
2901
|
a.top ?? 0,
|
|
2915
2902
|
a.bottom ?? 0,
|
|
2916
2903
|
n.height,
|
|
2917
|
-
|
|
2904
|
+
Je(e, t)
|
|
2918
2905
|
];
|
|
2919
|
-
return
|
|
2906
|
+
return Ye(u, l, i + s + c) + s;
|
|
2920
2907
|
}
|
|
2921
2908
|
function Nn(e, t, n, r) {
|
|
2922
2909
|
let i = e.staticSlot;
|
|
@@ -2930,15 +2917,15 @@ function Pn(e, t, n, r) {
|
|
|
2930
2917
|
//#region src/layout.ts
|
|
2931
2918
|
function Fn(e, t) {
|
|
2932
2919
|
let n = Ln();
|
|
2933
|
-
|
|
2920
|
+
B(e, t, void 0, 0, 0, "fill", n), Tn(e, 0, 0, [{
|
|
2934
2921
|
node: e,
|
|
2935
2922
|
absX: 0,
|
|
2936
2923
|
absY: 0
|
|
2937
2924
|
}], n);
|
|
2938
|
-
let r = e.localRect.height, i =
|
|
2925
|
+
let r = e.localRect.height, i = Zn(e);
|
|
2939
2926
|
return e.localRect.width = Math.max(e.localRect.width, i.x), e.localRect.height = Math.max(r, i.y), { height: r };
|
|
2940
2927
|
}
|
|
2941
|
-
function
|
|
2928
|
+
function z(e) {
|
|
2942
2929
|
return e.position === "absolute" || e.position === "fixed";
|
|
2943
2930
|
}
|
|
2944
2931
|
function In(e) {
|
|
@@ -2952,50 +2939,56 @@ function Ln() {
|
|
|
2952
2939
|
tableData: /* @__PURE__ */ new WeakMap()
|
|
2953
2940
|
};
|
|
2954
2941
|
}
|
|
2955
|
-
function
|
|
2942
|
+
function B(e, t, n, r, i, a, o, s) {
|
|
2956
2943
|
let c = e.style, l = s?.height;
|
|
2957
2944
|
delete e.decorationRuns, delete e.multicolGeometry, delete e.multicolFlow, delete e.multicolFlowSpan, delete e.textExtent;
|
|
2958
|
-
let u =
|
|
2959
|
-
s?.gutter?.right && (m.right =
|
|
2960
|
-
let
|
|
2961
|
-
top:
|
|
2962
|
-
right:
|
|
2963
|
-
bottom:
|
|
2964
|
-
left:
|
|
2945
|
+
let u = Kn(c.minWidth, t, e, o) ?? 0, d = Kn(c.maxWidth, t, e, o), f = W(c.minHeight, n) ?? 0, p = W(c.maxHeight, n), m = it(c), h = rt(c);
|
|
2946
|
+
s?.gutter?.right && (m.right = h.right), s?.gutter?.bottom && (m.bottom = h.bottom);
|
|
2947
|
+
let g = {
|
|
2948
|
+
top: H(c.padding.top, t),
|
|
2949
|
+
right: H(c.padding.right, t) + m.right,
|
|
2950
|
+
bottom: H(c.padding.bottom, t) + m.bottom,
|
|
2951
|
+
left: H(c.padding.left, t)
|
|
2965
2952
|
};
|
|
2966
|
-
e.resolvedPadding =
|
|
2967
|
-
let
|
|
2953
|
+
e.resolvedPadding = g;
|
|
2954
|
+
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 = zn(e), C = (t, n) => {
|
|
2968
2955
|
let r = n && Number.isFinite(t) ? t : void 0;
|
|
2969
|
-
return
|
|
2970
|
-
},
|
|
2971
|
-
!
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2956
|
+
return S ? Rn(e, y.width, t, r, x, g, o) : c.display === "flex" && c.flexDirection === "row" ? He(e, y.width, t, r, c.border, g, o) : c.display === "flex" ? We(e, y.width, t, n, c.border, g, o) : c.display === "grid" ? st(e, y.width, t, c.border, g, o) : c.display === "table" ? xn(e, y.width, r, c.border, g, o) : c.display === "multicol" ? $t(e, y.width, r, x, c.border, g, o) : qn(e, y.width, r, c.border, g, o);
|
|
2957
|
+
}, w = C(y.height, b);
|
|
2958
|
+
if (!S && (c.display === "flex" || c.display === "grid") && !b && p !== void 0) {
|
|
2959
|
+
let e = c.border.top + c.border.bottom + g.top + g.bottom, t = V(w + e, f, p) - e;
|
|
2960
|
+
t < w && (w = C(Math.max(0, t), !0));
|
|
2961
|
+
}
|
|
2962
|
+
let T = w + c.border.top + c.border.bottom + g.top + g.bottom, E = l ?? v ?? T;
|
|
2963
|
+
e.unclampedHeight = E, e.naturalContentHeight = T;
|
|
2964
|
+
let D = V(E, f, p), O = e.multicolGeometry;
|
|
2965
|
+
if (O) {
|
|
2966
|
+
let t = D - c.border.top - c.border.bottom - g.top - g.bottom;
|
|
2967
|
+
t > O.totalRows && (g.bottom += t - O.totalRows), Xt(e, O, c.border, g);
|
|
2978
2968
|
}
|
|
2979
2969
|
if (e.localRect = {
|
|
2980
2970
|
x: r,
|
|
2981
2971
|
y: i,
|
|
2982
|
-
width:
|
|
2983
|
-
height:
|
|
2972
|
+
width: _,
|
|
2973
|
+
height: D
|
|
2984
2974
|
}, tt(c.overflow.x) || tt(c.overflow.y)) {
|
|
2985
|
-
let l =
|
|
2975
|
+
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);
|
|
2986
2976
|
if (e.scrollRange = {
|
|
2987
2977
|
sizeX: u,
|
|
2988
2978
|
sizeY: d,
|
|
2989
2979
|
maxX: tt(c.overflow.x) ? Math.max(0, u - f) : 0,
|
|
2990
2980
|
maxY: tt(c.overflow.y) ? Math.max(0, d - p) : 0
|
|
2991
|
-
},
|
|
2992
|
-
let l =
|
|
2993
|
-
|
|
2994
|
-
|
|
2981
|
+
}, c.scrollbarWidth !== "none") {
|
|
2982
|
+
let l = s?.gutter ?? {
|
|
2983
|
+
right: !1,
|
|
2984
|
+
bottom: !1
|
|
2985
|
+
}, u = l.right || c.overflow.y === "auto" && e.scrollRange.maxY > 0, d = l.bottom || c.overflow.x === "auto" && e.scrollRange.maxX > 0;
|
|
2986
|
+
if (u !== l.right || d !== l.bottom) {
|
|
2987
|
+
B(e, t, n, r, i, a, o, {
|
|
2995
2988
|
...s,
|
|
2996
2989
|
gutter: {
|
|
2997
|
-
right:
|
|
2998
|
-
bottom:
|
|
2990
|
+
right: u,
|
|
2991
|
+
bottom: d
|
|
2999
2992
|
}
|
|
3000
2993
|
});
|
|
3001
2994
|
return;
|
|
@@ -3010,30 +3003,30 @@ function V(e, t, n, r, i, a, o, s) {
|
|
|
3010
3003
|
function Rn(e, t, n, r, i, a, o) {
|
|
3011
3004
|
let s = e.style, c;
|
|
3012
3005
|
if (e.text) {
|
|
3013
|
-
let l =
|
|
3014
|
-
|
|
3006
|
+
let l = nt(e);
|
|
3007
|
+
Pe(e.text, (n, r) => {
|
|
3015
3008
|
let i = l[r];
|
|
3016
|
-
|
|
3009
|
+
B(i, t, void 0, 0, 0, "shrink", o), e.advances[n] = Math.max(1, i.localRect.width);
|
|
3017
3010
|
});
|
|
3018
3011
|
let u, d;
|
|
3019
3012
|
if (s.display === "multicol") {
|
|
3020
|
-
let n =
|
|
3013
|
+
let n = Wn(s, "x", t), o = Ht(s, t, n);
|
|
3021
3014
|
a.right += o.leftover;
|
|
3022
3015
|
let c = Wt(e, o, n, Bt(r, i));
|
|
3023
3016
|
e.multicolGeometry = c, u = c, d = c.lineX;
|
|
3024
3017
|
} else u = Vn(e, t);
|
|
3025
3018
|
if (c = u.totalRows, e.textExtent = {
|
|
3026
|
-
width: u.spans.reduce((t, n) => Math.max(t,
|
|
3019
|
+
width: u.spans.reduce((t, n) => Math.max(t, F(n.start, n.end, e.advances, s.tracking)), 0),
|
|
3027
3020
|
rows: u.totalRows
|
|
3028
3021
|
}, Bn(e, u, t, n, a), l.length > 0) {
|
|
3029
3022
|
let t = (e) => u.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
3030
|
-
|
|
3023
|
+
Pe(e.text, (n, r) => {
|
|
3031
3024
|
let i = t(n);
|
|
3032
3025
|
if (i === -1) return;
|
|
3033
3026
|
let o = u.spans[i];
|
|
3034
3027
|
l[r].localRect = {
|
|
3035
3028
|
...l[r].localRect,
|
|
3036
|
-
x: s.border.left + a.left + (d?.[i] ?? 0) +
|
|
3029
|
+
x: s.border.left + a.left + (d?.[i] ?? 0) + je(o.start, n, e.advances),
|
|
3037
3030
|
y: s.border.top + a.top + u.lineY[i]
|
|
3038
3031
|
};
|
|
3039
3032
|
});
|
|
@@ -3041,7 +3034,7 @@ function Rn(e, t, n, r, i, a, o) {
|
|
|
3041
3034
|
} else c = e.intrinsicHeight;
|
|
3042
3035
|
for (let n of e.children) {
|
|
3043
3036
|
if (n.inlineBox) continue;
|
|
3044
|
-
let e =
|
|
3037
|
+
let e = U(n.style.margin, t);
|
|
3045
3038
|
n.staticSlot = {
|
|
3046
3039
|
kind: "block",
|
|
3047
3040
|
x: s.border.left + a.left + (e.left ?? 0),
|
|
@@ -3051,23 +3044,23 @@ function Rn(e, t, n, r, i, a, o) {
|
|
|
3051
3044
|
return c;
|
|
3052
3045
|
}
|
|
3053
3046
|
function zn(e) {
|
|
3054
|
-
return e.children.some((e) => !
|
|
3047
|
+
return e.children.some((e) => !z(e.style) && !e.inlineBox) ? !1 : e.text !== "" || e.style.display !== "flex" && e.style.display !== "grid";
|
|
3055
3048
|
}
|
|
3056
|
-
function
|
|
3049
|
+
function V(e, t, n) {
|
|
3057
3050
|
return Math.max(t, n === void 0 ? e : Math.min(e, n));
|
|
3058
3051
|
}
|
|
3059
3052
|
function Bn(e, t, n, r, i) {
|
|
3060
3053
|
let a = e.style;
|
|
3061
3054
|
if (a.display !== "flex" && a.display !== "grid" || t.spans.length === 0) return;
|
|
3062
|
-
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t,
|
|
3055
|
+
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t, F(n.start, n.end, e.advances, a.tracking)), 0), c = Math.max(0, n - s);
|
|
3063
3056
|
if (c > 0) {
|
|
3064
|
-
let e = a.display === "grid" ?
|
|
3057
|
+
let e = a.display === "grid" ? Ye(a.justifyItems, n, s) : o ? Ye(a.alignItems, n, s) : I($e(a), [s], c)[0];
|
|
3065
3058
|
e > 0 && (i.left += e, i.right += c - e);
|
|
3066
3059
|
}
|
|
3067
3060
|
if (Number.isFinite(r)) {
|
|
3068
3061
|
let e = Math.max(0, r - t.totalRows);
|
|
3069
3062
|
if (e > 0) {
|
|
3070
|
-
let n = a.display === "grid" || !o ?
|
|
3063
|
+
let n = a.display === "grid" || !o ? Ye(a.alignItems, r, t.totalRows) : I($e(a), [t.totalRows], e)[0];
|
|
3071
3064
|
n > 0 && (i.top += n, i.bottom += e - n);
|
|
3072
3065
|
}
|
|
3073
3066
|
}
|
|
@@ -3083,20 +3076,20 @@ function Vn(e, t) {
|
|
|
3083
3076
|
};
|
|
3084
3077
|
}
|
|
3085
3078
|
function Hn(e, t) {
|
|
3086
|
-
return e.style.whiteSpace === "normal" ?
|
|
3079
|
+
return e.style.whiteSpace === "normal" ? Ae(e.text, t, {
|
|
3087
3080
|
advances: e.advances,
|
|
3088
3081
|
tracking: e.style.tracking,
|
|
3089
3082
|
firstLineIndent: e.style.textIndent
|
|
3090
|
-
}) :
|
|
3083
|
+
}) : ke(e.text);
|
|
3091
3084
|
}
|
|
3092
3085
|
function Un(e, t) {
|
|
3093
|
-
let n =
|
|
3086
|
+
let n = nt(e), r = [], i = [], a = 0;
|
|
3094
3087
|
for (let o of t) {
|
|
3095
3088
|
let t = 1, s = 0;
|
|
3096
3089
|
for (let r = o.start; r < o.end; r++) {
|
|
3097
3090
|
if (e.text[r] !== "") continue;
|
|
3098
3091
|
let i = n[a];
|
|
3099
|
-
t = Math.max(t, i.localRect.height), i.style.verticalAlign === "end" ? s = Math.max(s, i.localRect.height - 1) : i.style.verticalAlign === "center" &&
|
|
3092
|
+
t = Math.max(t, i.localRect.height), i.style.verticalAlign === "end" ? s = Math.max(s, i.localRect.height - 1) : i.style.verticalAlign === "center" && M(i.source, "vertical-align: middle on an inline box can't land on whole rows and behaves as top. Use align-top or align-bottom."), a++;
|
|
3100
3093
|
}
|
|
3101
3094
|
r.push(t), i.push(Math.min(s, t - 1));
|
|
3102
3095
|
}
|
|
@@ -3105,15 +3098,15 @@ function Un(e, t) {
|
|
|
3105
3098
|
textOffsets: i
|
|
3106
3099
|
};
|
|
3107
3100
|
}
|
|
3108
|
-
function
|
|
3109
|
-
let r =
|
|
3101
|
+
function Wn(e, t, n) {
|
|
3102
|
+
let r = H(t === "x" ? e.gapX : e.gapY, n), i = t === "x" ? e.ruleX : e.ruleY;
|
|
3110
3103
|
return Math.max(r, i?.width ?? 0);
|
|
3111
3104
|
}
|
|
3112
|
-
function
|
|
3113
|
-
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 :
|
|
3105
|
+
function H(e, t) {
|
|
3106
|
+
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 : Ce(e.percent, t);
|
|
3114
3107
|
}
|
|
3115
|
-
function
|
|
3116
|
-
let n = (e) => e === null ? null :
|
|
3108
|
+
function U(e, t) {
|
|
3109
|
+
let n = (e) => e === null ? null : H(e, t);
|
|
3117
3110
|
return {
|
|
3118
3111
|
top: n(e.top),
|
|
3119
3112
|
right: n(e.right),
|
|
@@ -3121,30 +3114,30 @@ function G(e, t) {
|
|
|
3121
3114
|
left: n(e.left)
|
|
3122
3115
|
};
|
|
3123
3116
|
}
|
|
3124
|
-
function
|
|
3117
|
+
function Gn(e) {
|
|
3125
3118
|
return typeof e == "number" ? e : 0;
|
|
3126
3119
|
}
|
|
3127
|
-
function
|
|
3128
|
-
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 :
|
|
3120
|
+
function W(e, t) {
|
|
3121
|
+
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 : Ce(e.percent, t);
|
|
3129
3122
|
}
|
|
3130
|
-
function
|
|
3131
|
-
return e === "min-content" || e === "max-content" || e === "fit-content" ?
|
|
3123
|
+
function Kn(e, t, n, r) {
|
|
3124
|
+
return e === "min-content" || e === "max-content" || e === "fit-content" ? G({ kind: e }, t, n, r) : W(e, t);
|
|
3132
3125
|
}
|
|
3133
|
-
function
|
|
3126
|
+
function qn(e, t, n, r, i, a) {
|
|
3134
3127
|
let o = r.left + i.left, s = r.top + i.top, c = s, l = null;
|
|
3135
3128
|
for (let r of e.children) {
|
|
3136
|
-
let e =
|
|
3137
|
-
if (
|
|
3129
|
+
let e = U(r.style.margin, t), i = e.top ?? 0, s = e.bottom ?? 0, u = e.left ?? 0, d = e.right ?? 0;
|
|
3130
|
+
if (z(r.style)) {
|
|
3138
3131
|
r.staticSlot = {
|
|
3139
3132
|
kind: "block",
|
|
3140
3133
|
x: o + u,
|
|
3141
|
-
y: c + (l === null ? i :
|
|
3134
|
+
y: c + (l === null ? i : Yn(l, i))
|
|
3142
3135
|
};
|
|
3143
3136
|
continue;
|
|
3144
3137
|
}
|
|
3145
|
-
|
|
3146
|
-
let f =
|
|
3147
|
-
c += l === null ? i :
|
|
3138
|
+
B(r, Math.max(0, t - u - d), n, 0, 0, "fill", a);
|
|
3139
|
+
let f = Jn(e, t, r.localRect.width);
|
|
3140
|
+
c += l === null ? i : Yn(l, i), r.localRect = {
|
|
3148
3141
|
...r.localRect,
|
|
3149
3142
|
x: o + f,
|
|
3150
3143
|
y: c
|
|
@@ -3152,30 +3145,30 @@ function Kn(e, t, n, r, i, a) {
|
|
|
3152
3145
|
}
|
|
3153
3146
|
return l !== null && (c += l), c - s;
|
|
3154
3147
|
}
|
|
3155
|
-
function
|
|
3148
|
+
function Jn(e, t, n) {
|
|
3156
3149
|
let r = t - n;
|
|
3157
3150
|
return e.left === null && e.right === null ? Math.floor(r / 2) : e.left === null ? r - (e.right ?? 0) : e.left;
|
|
3158
3151
|
}
|
|
3159
|
-
function
|
|
3152
|
+
function Yn(e, t) {
|
|
3160
3153
|
return e >= 0 && t >= 0 ? Math.max(e, t) : e <= 0 && t <= 0 ? Math.min(e, t) : e + t;
|
|
3161
3154
|
}
|
|
3162
|
-
function
|
|
3155
|
+
function Xn(e, t, n, r, i) {
|
|
3163
3156
|
let a = e.width;
|
|
3164
3157
|
if (e.display === "table") {
|
|
3165
|
-
if (!r.children.some((e) => !
|
|
3158
|
+
if (!r.children.some((e) => !z(e.style) && !e.inlineBox)) return a !== void 0 && a.kind !== "auto" ? G(a, t, r, i) : Math.min(t, K(r, i));
|
|
3166
3159
|
if (a !== void 0 && a.kind !== "auto") {
|
|
3167
|
-
let e =
|
|
3168
|
-
return Math.max(e,
|
|
3160
|
+
let e = G(a, t, r, i);
|
|
3161
|
+
return Math.max(e, $n(r, t, i));
|
|
3169
3162
|
}
|
|
3170
3163
|
return bn(r, t, i);
|
|
3171
3164
|
}
|
|
3172
|
-
return a !== void 0 && a.kind !== "auto" ?
|
|
3165
|
+
return a !== void 0 && a.kind !== "auto" ? G(a, t, r, i) : n === "shrink" ? Math.min(t, K(r, i)) : t;
|
|
3173
3166
|
}
|
|
3174
|
-
function
|
|
3167
|
+
function Zn(e) {
|
|
3175
3168
|
let t = 0, n = 0;
|
|
3176
3169
|
for (let r of e.children) {
|
|
3177
3170
|
if (r.style.position === "fixed") continue;
|
|
3178
|
-
let e =
|
|
3171
|
+
let e = Qn(r);
|
|
3179
3172
|
t = Math.max(t, r.localRect.x + e.x), n = Math.max(n, r.localRect.y + e.y);
|
|
3180
3173
|
}
|
|
3181
3174
|
if (e.textExtent) {
|
|
@@ -3187,75 +3180,81 @@ function Xn(e) {
|
|
|
3187
3180
|
y: n
|
|
3188
3181
|
};
|
|
3189
3182
|
}
|
|
3190
|
-
function
|
|
3183
|
+
function Qn(e) {
|
|
3191
3184
|
let { width: t, height: n } = e.localRect, r = e.style.overflow.x !== "visible", i = e.style.overflow.y !== "visible";
|
|
3192
3185
|
if (r && i) return {
|
|
3193
3186
|
x: t,
|
|
3194
3187
|
y: n
|
|
3195
3188
|
};
|
|
3196
|
-
let a =
|
|
3189
|
+
let a = Zn(e);
|
|
3197
3190
|
return {
|
|
3198
3191
|
x: r ? t : Math.max(t, a.x),
|
|
3199
3192
|
y: i ? n : Math.max(n, a.y)
|
|
3200
3193
|
};
|
|
3201
3194
|
}
|
|
3202
|
-
function
|
|
3195
|
+
function $n(e, t, n) {
|
|
3203
3196
|
let r = e.style;
|
|
3204
|
-
return yn(e, n).min + r.border.left + r.border.right +
|
|
3197
|
+
return yn(e, n).min + r.border.left + r.border.right + H(r.padding.left, t) + H(r.padding.right, t) + it(r).right;
|
|
3205
3198
|
}
|
|
3206
|
-
function
|
|
3199
|
+
function er(e, t) {
|
|
3207
3200
|
if (e.height?.kind === "cells") return e.height.value;
|
|
3208
|
-
if (e.height?.kind === "percent" && t != null) return
|
|
3201
|
+
if (e.height?.kind === "percent" && t != null) return Ce(e.height.value, t);
|
|
3209
3202
|
}
|
|
3210
|
-
function
|
|
3203
|
+
function G(e, t, n, r) {
|
|
3211
3204
|
switch (e.kind) {
|
|
3212
3205
|
case "cells": return e.value;
|
|
3213
|
-
case "percent": return
|
|
3214
|
-
case "min-content": return
|
|
3215
|
-
case "max-content": return
|
|
3216
|
-
case "fit-content": return Math.min(
|
|
3217
|
-
case "auto": return
|
|
3206
|
+
case "percent": return Ce(e.value, t);
|
|
3207
|
+
case "min-content": return J(n, r);
|
|
3208
|
+
case "max-content": return K(n, r);
|
|
3209
|
+
case "fit-content": return Math.min(K(n, r), Math.max(J(n, r), t));
|
|
3210
|
+
case "auto": return K(n, r);
|
|
3218
3211
|
}
|
|
3219
3212
|
}
|
|
3220
|
-
function
|
|
3213
|
+
function K(e, t) {
|
|
3221
3214
|
let n = t.maxContent.get(e);
|
|
3222
3215
|
if (n !== void 0) return n;
|
|
3223
|
-
let r = e.style, i =
|
|
3216
|
+
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;
|
|
3224
3217
|
return t.maxContent.set(e, i), i;
|
|
3225
3218
|
}
|
|
3226
|
-
function
|
|
3227
|
-
let n = e.children.filter((e) => !
|
|
3219
|
+
function tr(e, t) {
|
|
3220
|
+
let n = e.children.filter((e) => !z(e.style) && !e.inlineBox);
|
|
3228
3221
|
if (n.length === 0) return e.style.display === "multicol" ? zt(e.style, e.intrinsicWidth) : e.intrinsicWidth;
|
|
3229
|
-
if (e.style.display === "grid") return
|
|
3222
|
+
if (e.style.display === "grid") return gt(e, t).max;
|
|
3230
3223
|
if (e.style.display === "table") return yn(e, t).max;
|
|
3231
3224
|
if (e.style.display === "flex" && e.style.flexDirection === "row") {
|
|
3232
|
-
let r = Math.max(
|
|
3233
|
-
return n.reduce((e, n) => e +
|
|
3225
|
+
let r = Math.max(Gn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
3226
|
+
return n.reduce((e, n) => e + q(n, "max", t), 0) + r;
|
|
3234
3227
|
}
|
|
3235
|
-
let r = n.reduce((e, n) => Math.max(e,
|
|
3228
|
+
let r = n.reduce((e, n) => Math.max(e, q(n, "max", t)), 0);
|
|
3236
3229
|
return e.style.display === "multicol" ? zt(e.style, r) : r;
|
|
3237
3230
|
}
|
|
3238
|
-
function
|
|
3231
|
+
function q(e, t, n) {
|
|
3232
|
+
let r = e.style, i;
|
|
3233
|
+
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = G(r.width, 0, e, n)), i === void 0 && (i = t === "min" ? J(e, n) : K(e, n));
|
|
3234
|
+
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
3235
|
+
return Math.max(0, V(i, a, o));
|
|
3236
|
+
}
|
|
3237
|
+
function J(e, t) {
|
|
3239
3238
|
let n = t.minContent.get(e);
|
|
3240
3239
|
if (n !== void 0) return n;
|
|
3241
|
-
let r = e.style, i =
|
|
3240
|
+
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;
|
|
3242
3241
|
return t.minContent.set(e, i), i;
|
|
3243
3242
|
}
|
|
3244
|
-
function
|
|
3245
|
-
let n = e.children.filter((e) => !
|
|
3246
|
-
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth :
|
|
3243
|
+
function nr(e, t) {
|
|
3244
|
+
let n = e.children.filter((e) => !z(e.style) && !e.inlineBox);
|
|
3245
|
+
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth : Ne(e.text, {
|
|
3247
3246
|
advances: e.advances,
|
|
3248
3247
|
tracking: e.style.tracking
|
|
3249
3248
|
});
|
|
3250
|
-
if (e.style.display === "grid") return
|
|
3249
|
+
if (e.style.display === "grid") return gt(e, t).min;
|
|
3251
3250
|
if (e.style.display === "table") return yn(e, t).min;
|
|
3252
3251
|
if (e.style.display === "flex" && e.style.flexDirection === "row" && e.style.flexWrap === "nowrap") {
|
|
3253
|
-
let r = Math.max(
|
|
3254
|
-
return n.reduce((e, n) => e +
|
|
3252
|
+
let r = Math.max(Gn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
3253
|
+
return n.reduce((e, n) => e + q(n, "min", t), 0) + r;
|
|
3255
3254
|
}
|
|
3256
|
-
return n.reduce((e, n) => Math.max(e,
|
|
3255
|
+
return n.reduce((e, n) => Math.max(e, q(n, "min", t)), 0);
|
|
3257
3256
|
}
|
|
3258
|
-
function
|
|
3257
|
+
function rr(e, t, n, r) {
|
|
3259
3258
|
return {
|
|
3260
3259
|
width: Math.max(0, e - n.left - n.right - r.left - r.right),
|
|
3261
3260
|
height: Math.max(0, t - n.top - n.bottom - r.top - r.bottom)
|
|
@@ -3263,38 +3262,38 @@ function nr(e, t, n, r) {
|
|
|
3263
3262
|
}
|
|
3264
3263
|
//#endregion
|
|
3265
3264
|
//#region src/plain-text.ts
|
|
3266
|
-
function rr(e) {
|
|
3267
|
-
return lr(e).grid.map((e) => e.join("").trimEnd()).join("\n");
|
|
3268
|
-
}
|
|
3269
3265
|
function ir(e) {
|
|
3270
|
-
|
|
3271
|
-
|
|
3266
|
+
return ur(e).grid.map((e) => e.join("").trimEnd()).join("\n");
|
|
3267
|
+
}
|
|
3268
|
+
function ar(e) {
|
|
3269
|
+
let { grid: t, paints: n } = ur(e);
|
|
3270
|
+
return t.map((e, t) => or(e, n[t]));
|
|
3272
3271
|
}
|
|
3273
|
-
function
|
|
3272
|
+
function or(e, t) {
|
|
3274
3273
|
let n = e.length;
|
|
3275
3274
|
for (; n > 0 && e[n - 1] === " " && t[n - 1]?.backgroundColor === void 0;) n--;
|
|
3276
3275
|
let r = [];
|
|
3277
3276
|
for (let i = 0; i < n; i++) {
|
|
3278
3277
|
let n = t[i], a = r[r.length - 1];
|
|
3279
|
-
a &&
|
|
3278
|
+
a && sr(a, n) ? a.text += e[i] : r.push({
|
|
3280
3279
|
text: e[i],
|
|
3281
3280
|
...n
|
|
3282
3281
|
});
|
|
3283
3282
|
}
|
|
3284
3283
|
return r;
|
|
3285
3284
|
}
|
|
3286
|
-
function
|
|
3285
|
+
function sr(e, t) {
|
|
3287
3286
|
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;
|
|
3288
3287
|
}
|
|
3289
|
-
function
|
|
3288
|
+
function cr(e, t) {
|
|
3290
3289
|
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);
|
|
3291
3290
|
}
|
|
3292
|
-
function
|
|
3291
|
+
function lr(e) {
|
|
3293
3292
|
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;
|
|
3294
3293
|
}
|
|
3295
|
-
function
|
|
3294
|
+
function ur(e) {
|
|
3296
3295
|
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));
|
|
3297
|
-
return
|
|
3296
|
+
return fr(e, 0, 0, (e, a, o, s) => {
|
|
3298
3297
|
if (e >= 0 && e < t && a >= 0 && a < n) {
|
|
3299
3298
|
r[a][e] = o;
|
|
3300
3299
|
let t = i[a][e];
|
|
@@ -3308,11 +3307,11 @@ function lr(e) {
|
|
|
3308
3307
|
paints: i
|
|
3309
3308
|
};
|
|
3310
3309
|
}
|
|
3311
|
-
function
|
|
3310
|
+
function dr(e) {
|
|
3312
3311
|
let t = {};
|
|
3313
3312
|
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;
|
|
3314
3313
|
}
|
|
3315
|
-
function
|
|
3314
|
+
function fr(e, t, n, r, i = 1) {
|
|
3316
3315
|
if (e.tableHidden) return;
|
|
3317
3316
|
let a = t + e.localRect.x, o = n + e.localRect.y, s = e.style, c = (e) => i >= 1 ? e : {
|
|
3318
3317
|
...e,
|
|
@@ -3323,7 +3322,7 @@ function dr(e, t, n, r, i = 1) {
|
|
|
3323
3322
|
for (let n = 0; n < e.localRect.height; n++) for (let i = 0; i < e.localRect.width; i++) r(a + i, o + n, " ", t);
|
|
3324
3323
|
}
|
|
3325
3324
|
let l = [];
|
|
3326
|
-
|
|
3325
|
+
de(s, {
|
|
3327
3326
|
x: a,
|
|
3328
3327
|
y: o,
|
|
3329
3328
|
width: e.localRect.width,
|
|
@@ -3337,149 +3336,352 @@ function dr(e, t, n, r, i = 1) {
|
|
|
3337
3336
|
let e = c(t.color === void 0 ? void 0 : { color: t.color });
|
|
3338
3337
|
for (let n = 0; n < t.length; n++) r(a + t.x + n, o + t.y, t.glyph, e);
|
|
3339
3338
|
}
|
|
3340
|
-
let u = e.
|
|
3341
|
-
if (
|
|
3342
|
-
let t = a + s.border.left, n = o + s.border.top, i = a + e.localRect.width - s.border.right - (
|
|
3343
|
-
|
|
3344
|
-
|
|
3339
|
+
let u = e.scrollGutterCells, d = s.overflow.x !== "visible", f = s.overflow.y !== "visible", p = a - (e.scroll?.x ?? 0), m = o - (e.scroll?.y ?? 0), h = r;
|
|
3340
|
+
if (d || f) {
|
|
3341
|
+
let t = a + s.border.left, n = o + s.border.top, i = a + e.localRect.width - s.border.right - (u?.right ?? 0), c = o + e.localRect.height - s.border.bottom - (u?.bottom ?? 0);
|
|
3342
|
+
h = (e, a, o, s) => {
|
|
3343
|
+
d && (e < t || e >= i) || f && (a < n || a >= c) || r(e, a, o, s);
|
|
3345
3344
|
};
|
|
3346
3345
|
}
|
|
3347
3346
|
if (!e.children.some((e) => !e.inlineBox && e.style.position !== "absolute" && e.style.position !== "fixed") && e.text) {
|
|
3348
|
-
let t =
|
|
3349
|
-
|
|
3350
|
-
let
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3347
|
+
let t = c(dr(s)), n = e.inlineElements?.map((e) => c(dr(e)));
|
|
3348
|
+
pr(e, p, m, (r, i, a) => {
|
|
3349
|
+
let o = e.charInline?.[r] ?? -1, s = o >= 0 ? e.inlineElements[o] : void 0;
|
|
3350
|
+
e.text[r] === "" ? s?.backgroundColor && h(i, a, " ", c({ backgroundColor: s.backgroundColor })) : h(i, a, e.text[r], s ? n[o] : t);
|
|
3351
|
+
}, (e, n) => h(e, n, "…", t));
|
|
3352
|
+
}
|
|
3353
|
+
for (let t of me(e)) fr(t, p, m, h, i * t.style.opacity);
|
|
3354
|
+
let g = e.scrollRange;
|
|
3355
|
+
if (g && u && (u.right > 0 || u.bottom > 0)) {
|
|
3356
|
+
let { track: t, thumb: n } = ee(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 = gr(e, a, o);
|
|
3357
|
+
if (d.y) {
|
|
3358
|
+
let { col: i, row: a, thick: o, len: s } = d.y, { at: c, len: f } = _r(s, g.sizeY, g.maxY, e.scroll?.y ?? 0);
|
|
3359
|
+
for (let e = 0; e < o; e++) for (let o = 0; o < s; o++) {
|
|
3360
|
+
let s = o >= c && o < c + f;
|
|
3361
|
+
r(i + e, a + o, s ? n : t, s ? u : l);
|
|
3360
3362
|
}
|
|
3361
|
-
h.ellipsis && g(b, p, "…", d);
|
|
3362
3363
|
}
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
if (d.right > 0) {
|
|
3369
|
-
let a = u - i - d.bottom, { at: o, len: s } = fr(a, _.sizeY, _.maxY, e.scroll?.y ?? 0);
|
|
3370
|
-
for (let e = 0; e < d.right; e++) {
|
|
3371
|
-
let c = f - d.right + e;
|
|
3372
|
-
for (let e = 0; e < a; e++) {
|
|
3373
|
-
let a = e >= o && e < o + s;
|
|
3374
|
-
r(c, i + e, a ? n : t, a ? h : m);
|
|
3375
|
-
}
|
|
3376
|
-
}
|
|
3377
|
-
}
|
|
3378
|
-
if (d.bottom > 0) {
|
|
3379
|
-
let i = f - l - d.right, { at: a, len: o } = fr(i, _.sizeX, _.maxX, e.scroll?.x ?? 0);
|
|
3380
|
-
for (let e = 0; e < d.bottom; e++) {
|
|
3381
|
-
let s = u - d.bottom + e;
|
|
3382
|
-
for (let e = 0; e < i; e++) {
|
|
3383
|
-
let i = e >= a && e < a + o;
|
|
3384
|
-
r(l + e, s, i ? n : t, i ? h : m);
|
|
3385
|
-
}
|
|
3364
|
+
if (d.x) {
|
|
3365
|
+
let { col: i, row: a, thick: o, len: s } = d.x, { at: c, len: f } = _r(s, g.sizeX, g.maxX, e.scroll?.x ?? 0);
|
|
3366
|
+
for (let e = 0; e < o; e++) for (let o = 0; o < s; o++) {
|
|
3367
|
+
let s = o >= c && o < c + f;
|
|
3368
|
+
r(i + o, a + e, s ? n : t, s ? u : l);
|
|
3386
3369
|
}
|
|
3387
3370
|
}
|
|
3388
3371
|
}
|
|
3389
3372
|
}
|
|
3390
|
-
function
|
|
3373
|
+
function pr(e, t, n, r, i) {
|
|
3374
|
+
let a = e.style, o = e.resolvedPadding, s = t + a.border.left + o.left, c = n + a.border.top + o.top, l = e.localRect.width - a.border.left - a.border.right - o.left - o.right, u = e.multicolGeometry, { spans: d, textY: f } = u ?? Vn(e, l), p = u ? Math.max(1, u.columnWidth - a.tracking) : l;
|
|
3375
|
+
for (let t = 0; t < d.length; t++) {
|
|
3376
|
+
let n = d[t], o = c + f[t], l = t === 0 ? a.textIndent : 0, m = a.whiteSpace !== "normal" && a.overflow.x === "clip" ? vr(e.text, n, p - l, e.advances, a) : {
|
|
3377
|
+
end: n.end,
|
|
3378
|
+
ellipsis: !1
|
|
3379
|
+
}, h = F(n.start, n.end, e.advances, a.tracking), g = Math.max(0, p - l - h), _ = a.textAlign === "end" ? g : a.textAlign === "center" ? Math.floor(g / 2) : 0, v = s + (u?.lineX[t] ?? 0) + _ + l;
|
|
3380
|
+
for (let t = n.start; t < m.end; t++) {
|
|
3381
|
+
let n = je(t, t + 1, e.advances);
|
|
3382
|
+
if (e.text[t] !== "") {
|
|
3383
|
+
let i = e.inlineElements?.[e.charInline?.[t] ?? -1]?.insets, a = i ? i.left ?? (i.right === null ? 0 : -i.right) : 0, s = i ? i.top ?? (i.bottom === null ? 0 : -i.bottom) : 0;
|
|
3384
|
+
r(t, v + a, o + s, n);
|
|
3385
|
+
}
|
|
3386
|
+
v += n;
|
|
3387
|
+
}
|
|
3388
|
+
m.ellipsis && i?.(v, o);
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
function mr(e, t, n, r, i) {
|
|
3392
|
+
let a = e.multicolGeometry;
|
|
3393
|
+
if (!a) return !1;
|
|
3394
|
+
let o = e.style, s = e.resolvedPadding, c = r - (t + o.border.left + s.left), l = i - (n + o.border.top + s.top), { lineX: u, lineY: d } = a;
|
|
3395
|
+
for (let e = 0; e < d.length; e++) {
|
|
3396
|
+
if (c < u[e] || c >= u[e] + a.columnWidth) continue;
|
|
3397
|
+
let t = (e + 1 < d.length && u[e + 1] === u[e] ? d[e + 1] : void 0) ?? d[e] + 1 + o.lineGap;
|
|
3398
|
+
if (l >= d[e] && l < t) return !0;
|
|
3399
|
+
}
|
|
3400
|
+
return !1;
|
|
3401
|
+
}
|
|
3402
|
+
function hr(e, t, n, r, i) {
|
|
3403
|
+
let a = null;
|
|
3404
|
+
return pr(e, t - (e.scroll?.x ?? 0), n - (e.scroll?.y ?? 0), (e, t, n, o) => {
|
|
3405
|
+
a === null && n === i && r >= t && r < t + o && (a = e);
|
|
3406
|
+
}), a;
|
|
3407
|
+
}
|
|
3408
|
+
function gr(e, t, n) {
|
|
3409
|
+
let r = e.scrollGutterCells;
|
|
3410
|
+
if (!r) return {};
|
|
3411
|
+
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 = {};
|
|
3412
|
+
return r.right > 0 && (p.y = {
|
|
3413
|
+
col: u - r.right,
|
|
3414
|
+
row: s + o.y,
|
|
3415
|
+
thick: Math.min(a.y, r.right),
|
|
3416
|
+
len: Math.max(0, d - s - o.y)
|
|
3417
|
+
}), r.bottom > 0 && (p.x = {
|
|
3418
|
+
col: c + o.x,
|
|
3419
|
+
row: l - r.bottom,
|
|
3420
|
+
thick: Math.min(a.x, r.bottom),
|
|
3421
|
+
len: Math.max(0, f - c - o.x)
|
|
3422
|
+
}), p;
|
|
3423
|
+
}
|
|
3424
|
+
function _r(e, t, n, r) {
|
|
3391
3425
|
let i = t > 0 ? Math.min(1, e / t) : 1, a = Math.max(1, Math.round(i * e));
|
|
3392
3426
|
return n > 0 && (a = Math.max(1, Math.min(a, e - n))), {
|
|
3393
3427
|
at: n > 0 ? Math.round(Math.min(r, n) / n * (e - a)) : 0,
|
|
3394
3428
|
len: a
|
|
3395
3429
|
};
|
|
3396
3430
|
}
|
|
3397
|
-
function
|
|
3431
|
+
function vr(e, t, n, r, i) {
|
|
3398
3432
|
let { textOverflow: a, tracking: o } = i;
|
|
3399
|
-
if (
|
|
3433
|
+
if (F(t.start, t.end, r, o) <= n) return {
|
|
3400
3434
|
end: t.end,
|
|
3401
3435
|
ellipsis: !1
|
|
3402
3436
|
};
|
|
3403
3437
|
let s = a === "ellipsis" ? n - 1 : n, c = t.start;
|
|
3404
|
-
for (; c < t.end &&
|
|
3438
|
+
for (; c < t.end && F(t.start, c + 1, r, o) <= s;) c++;
|
|
3405
3439
|
return {
|
|
3406
3440
|
end: c,
|
|
3407
3441
|
ellipsis: a === "ellipsis" && n > 0
|
|
3408
3442
|
};
|
|
3409
3443
|
}
|
|
3410
3444
|
//#endregion
|
|
3445
|
+
//#region src/pointer.ts
|
|
3446
|
+
function yr(e, t, n) {
|
|
3447
|
+
let r = [], i = e, a = e.localRect.x, o = e.localRect.y;
|
|
3448
|
+
for (;;) {
|
|
3449
|
+
let e = null;
|
|
3450
|
+
for (let r of me(i)) {
|
|
3451
|
+
if (r.tableHidden) continue;
|
|
3452
|
+
let i = a + r.localRect.x, s = o + r.localRect.y;
|
|
3453
|
+
(r.multicolFlow ? mr(r, i, s, t, n) : t >= i && t < i + r.localRect.width && n >= s && n < s + r.localRect.height) && (e = r);
|
|
3454
|
+
}
|
|
3455
|
+
if (!e) return r;
|
|
3456
|
+
r.push({
|
|
3457
|
+
node: e,
|
|
3458
|
+
x: a + e.localRect.x,
|
|
3459
|
+
y: o + e.localRect.y
|
|
3460
|
+
}), a += e.localRect.x - (e.scroll?.x ?? 0), o += e.localRect.y - (e.scroll?.y ?? 0), i = e;
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
function br(e, t, n) {
|
|
3464
|
+
return yr(e, t, n).map((e) => e.node.source);
|
|
3465
|
+
}
|
|
3466
|
+
//#endregion
|
|
3467
|
+
//#region src/selection.ts
|
|
3468
|
+
function xr(e, t, n, r) {
|
|
3469
|
+
let i = e.ownerDocument, a = i.createRange();
|
|
3470
|
+
a.setStart(e, t), a.collapse(!0);
|
|
3471
|
+
let o = i.createRange();
|
|
3472
|
+
return o.setStart(n, r), o.collapse(!0), a.compareBoundaryPoints(a.START_TO_START, o);
|
|
3473
|
+
}
|
|
3474
|
+
function Sr(e, t, n) {
|
|
3475
|
+
let r = nt(e).findIndex((e) => e.source.contains(t));
|
|
3476
|
+
if (r >= 0) {
|
|
3477
|
+
let t = -1;
|
|
3478
|
+
for (let n = 0; n <= r; n++) t = e.text.indexOf("", t + 1);
|
|
3479
|
+
if (t >= 0) return t;
|
|
3480
|
+
}
|
|
3481
|
+
let i = e.charSource ?? [], a = 0, o = i.length;
|
|
3482
|
+
for (; a < o;) {
|
|
3483
|
+
let e = a + o >> 1, r = i[e];
|
|
3484
|
+
xr(r.node, r.offset, t, n) <= 0 ? a = e + 1 : o = e;
|
|
3485
|
+
}
|
|
3486
|
+
if (a === 0) return 0;
|
|
3487
|
+
let s = i[a - 1];
|
|
3488
|
+
return t === s.node && n < s.offset + s.length ? s.index + (n - s.offset) : s.index + s.length;
|
|
3489
|
+
}
|
|
3490
|
+
function Cr(e, t) {
|
|
3491
|
+
let n = e.charSource ?? [], r = 0, i = n.length;
|
|
3492
|
+
for (; r < i;) {
|
|
3493
|
+
let e = r + i >> 1;
|
|
3494
|
+
n[e].index <= t ? r = e + 1 : i = e;
|
|
3495
|
+
}
|
|
3496
|
+
let a = n[r - 1];
|
|
3497
|
+
if (!a) return null;
|
|
3498
|
+
let o = t - a.index;
|
|
3499
|
+
return o <= a.length ? {
|
|
3500
|
+
node: a.node,
|
|
3501
|
+
offset: a.offset + o
|
|
3502
|
+
} : null;
|
|
3503
|
+
}
|
|
3504
|
+
function wr(e) {
|
|
3505
|
+
try {
|
|
3506
|
+
let t = e.ownerDocument.getSelection();
|
|
3507
|
+
if (!t) return null;
|
|
3508
|
+
if (t.getComposedRanges) return t.getComposedRanges({ shadowRoots: [e] })[0] ?? null;
|
|
3509
|
+
let n = e.getSelection?.();
|
|
3510
|
+
return !n || n.rangeCount === 0 ? null : n.getRangeAt(0);
|
|
3511
|
+
} catch {
|
|
3512
|
+
return null;
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3515
|
+
function Tr(e, t, n) {
|
|
3516
|
+
let { startContainer: r, endContainer: i } = n;
|
|
3517
|
+
return t.contains(r) && t.contains(i) ? "grid" : e.contains(r) && e.contains(i) ? "light" : "outside";
|
|
3518
|
+
}
|
|
3519
|
+
function Er(e, t) {
|
|
3520
|
+
let n = e.source.ownerDocument.createRange();
|
|
3521
|
+
n.setStart(t.startContainer, t.startOffset), n.setEnd(t.endContainer, t.endOffset);
|
|
3522
|
+
let r = [];
|
|
3523
|
+
return Dr(e, n, r), Pr(r);
|
|
3524
|
+
}
|
|
3525
|
+
function Dr(e, t, n) {
|
|
3526
|
+
if (e.tableHidden || !t.intersectsNode(e.source)) return;
|
|
3527
|
+
let r = jr(e);
|
|
3528
|
+
if (r && n.push({ breaks: r }), e.style.tableRole === "row") Or(e, t, n);
|
|
3529
|
+
else if (e.style.display === "table") {
|
|
3530
|
+
let r = Ar(e);
|
|
3531
|
+
for (let r of e.children) r.style.tableRole === "row" || kr(r) || Dr(r, t, n);
|
|
3532
|
+
let i = !1;
|
|
3533
|
+
for (let e of r) t.intersectsNode(e.source) && (i && n.push({ text: "\n" }), Dr(e, t, n), i = !0);
|
|
3534
|
+
} else {
|
|
3535
|
+
Mr(e) && n.push({ text: Nr(e, t) });
|
|
3536
|
+
for (let r of e.children) r.inlineBox || Dr(r, t, n);
|
|
3537
|
+
}
|
|
3538
|
+
r && n.push({ breaks: r });
|
|
3539
|
+
}
|
|
3540
|
+
function Or(e, t, n) {
|
|
3541
|
+
let r = !1;
|
|
3542
|
+
for (let i of e.children) i.style.tableRole !== "cell" || i.tableHidden || t.intersectsNode(i.source) && (r && n.push({ text: " " }), Dr(i, t, n), r = !0);
|
|
3543
|
+
}
|
|
3544
|
+
function kr(e) {
|
|
3545
|
+
let t = e.style.tableRole;
|
|
3546
|
+
return t === "header-group" || t === "row-group" || t === "footer-group";
|
|
3547
|
+
}
|
|
3548
|
+
function Ar(e) {
|
|
3549
|
+
let t = [];
|
|
3550
|
+
for (let n of e.children) if (n.style.tableRole === "row") t.push(n);
|
|
3551
|
+
else if (kr(n)) for (let e of n.children) e.style.tableRole === "row" && t.push(e);
|
|
3552
|
+
return t;
|
|
3553
|
+
}
|
|
3554
|
+
function jr(e) {
|
|
3555
|
+
if (e.inlineBox) return 0;
|
|
3556
|
+
let t = e.style.tableRole;
|
|
3557
|
+
return t === "row" || t === "cell" || kr(e) || t === "column" || t === "column-group" ? 0 : e.source.tagName === "P" ? 2 : 1;
|
|
3558
|
+
}
|
|
3559
|
+
function Mr(e) {
|
|
3560
|
+
return e.text.length !== 0 && !e.children.some((e) => !e.inlineBox && e.style.position !== "absolute" && e.style.position !== "fixed");
|
|
3561
|
+
}
|
|
3562
|
+
function Nr(e, t) {
|
|
3563
|
+
let { text: n } = e, r = 0, i = n.length;
|
|
3564
|
+
e.charSource && (e.source.contains(t.startContainer) && (r = Sr(e, t.startContainer, t.startOffset)), e.source.contains(t.endContainer) && (i = Sr(e, t.endContainer, t.endOffset)));
|
|
3565
|
+
let a = n.slice(r, i);
|
|
3566
|
+
i === n.length && a.endsWith("\n") && (a = a.slice(0, -1));
|
|
3567
|
+
let o = nt(e), s = n.slice(0, r).split("").length - 1;
|
|
3568
|
+
return a = a.replaceAll("", () => {
|
|
3569
|
+
let e = o[s++];
|
|
3570
|
+
if (!e || !t.intersectsNode(e.source)) return "";
|
|
3571
|
+
let n = [];
|
|
3572
|
+
return Dr(e, t, n), Pr(n);
|
|
3573
|
+
}), a.replaceAll("", "");
|
|
3574
|
+
}
|
|
3575
|
+
function Pr(e) {
|
|
3576
|
+
let t = "", n = 0;
|
|
3577
|
+
for (let r of e) {
|
|
3578
|
+
if ("breaks" in r) {
|
|
3579
|
+
n = Math.max(n, r.breaks);
|
|
3580
|
+
continue;
|
|
3581
|
+
}
|
|
3582
|
+
r.text.length !== 0 && (t.length > 0 && n > 0 && (t += "\n".repeat(n)), n = 0, t += r.text);
|
|
3583
|
+
}
|
|
3584
|
+
return t;
|
|
3585
|
+
}
|
|
3586
|
+
var Fr = /* @__PURE__ */ new Map();
|
|
3587
|
+
function Ir(e, t) {
|
|
3588
|
+
let { text: n } = e;
|
|
3589
|
+
if (t < 0 || t >= n.length || Lr(n[t])) return null;
|
|
3590
|
+
let r = t;
|
|
3591
|
+
for (; r > 0 && !Lr(n[r - 1]);) r--;
|
|
3592
|
+
let i = t;
|
|
3593
|
+
for (; i < n.length && !Lr(n[i]);) i++;
|
|
3594
|
+
let a = Rr(e.source.closest?.("[lang]")?.getAttribute("lang") ?? "");
|
|
3595
|
+
if (!a) return null;
|
|
3596
|
+
for (let e of a.segment(n.slice(r, i))) {
|
|
3597
|
+
let n = r + e.index, i = n + e.segment.length;
|
|
3598
|
+
if (t >= n && t < i) return {
|
|
3599
|
+
start: n,
|
|
3600
|
+
end: i
|
|
3601
|
+
};
|
|
3602
|
+
}
|
|
3603
|
+
return null;
|
|
3604
|
+
}
|
|
3605
|
+
function Lr(e) {
|
|
3606
|
+
return e === "\n" || e === "" || e === "";
|
|
3607
|
+
}
|
|
3608
|
+
function Rr(e) {
|
|
3609
|
+
let t = Fr.get(e);
|
|
3610
|
+
return t === void 0 && (t = zr(e) ?? zr(""), Fr.set(e, t)), t;
|
|
3611
|
+
}
|
|
3612
|
+
function zr(e) {
|
|
3613
|
+
if (typeof Intl.Segmenter != "function") return null;
|
|
3614
|
+
try {
|
|
3615
|
+
return new Intl.Segmenter(e || void 0, { granularity: "word" });
|
|
3616
|
+
} catch {
|
|
3617
|
+
return null;
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
//#endregion
|
|
3411
3621
|
//#region src/paint.ts
|
|
3412
|
-
var
|
|
3413
|
-
function
|
|
3414
|
-
return
|
|
3415
|
-
}
|
|
3416
|
-
function
|
|
3417
|
-
let r =
|
|
3418
|
-
if (
|
|
3419
|
-
let a =
|
|
3420
|
-
if (a &&
|
|
3421
|
-
|
|
3622
|
+
var Br = /* @__PURE__ */ new WeakMap(), Vr = /* @__PURE__ */ new WeakMap();
|
|
3623
|
+
function Hr(e) {
|
|
3624
|
+
return Gr(e, !0) !== null;
|
|
3625
|
+
}
|
|
3626
|
+
function Ur(e, t, n = !1) {
|
|
3627
|
+
let r = ar(e), i = Xr(r);
|
|
3628
|
+
if (Br.get(t) === i) return !0;
|
|
3629
|
+
let a = Vr.get(t);
|
|
3630
|
+
if (a && Wr(t, a.nodes, r)) {
|
|
3631
|
+
Br.set(t, i);
|
|
3422
3632
|
for (let e = 0; e < r.length; e++) for (let t = 0; t < r[e].length; t++) {
|
|
3423
3633
|
let n = r[e][t];
|
|
3424
|
-
if (
|
|
3634
|
+
if (lr(n) || sr(n, a.segments[e][t])) continue;
|
|
3425
3635
|
let i = a.nodes[e][t];
|
|
3426
|
-
i.style.cssText = "",
|
|
3636
|
+
i.style.cssText = "", cr(n, i.style);
|
|
3427
3637
|
}
|
|
3428
3638
|
return a.segments = r, !0;
|
|
3429
3639
|
}
|
|
3430
|
-
if (n &&
|
|
3431
|
-
|
|
3640
|
+
if (n && Hr(t)) return !1;
|
|
3641
|
+
Br.set(t, i);
|
|
3432
3642
|
let o = document.createDocumentFragment(), s = [];
|
|
3433
3643
|
for (let e = 0; e < r.length; e++) {
|
|
3434
3644
|
e > 0 && o.appendChild(document.createTextNode("\n"));
|
|
3435
3645
|
let t = [];
|
|
3436
3646
|
for (let n of r[e]) {
|
|
3437
|
-
if (
|
|
3647
|
+
if (lr(n)) {
|
|
3438
3648
|
let e = document.createTextNode(n.text);
|
|
3439
3649
|
t.push(e), o.appendChild(e);
|
|
3440
3650
|
continue;
|
|
3441
3651
|
}
|
|
3442
3652
|
let e = document.createElement("span");
|
|
3443
|
-
|
|
3653
|
+
cr(n, e.style), e.textContent = n.text, t.push(e), o.appendChild(e);
|
|
3444
3654
|
}
|
|
3445
3655
|
s.push(t);
|
|
3446
3656
|
}
|
|
3447
|
-
|
|
3657
|
+
Vr.set(t, {
|
|
3448
3658
|
nodes: s,
|
|
3449
3659
|
segments: r
|
|
3450
3660
|
});
|
|
3451
|
-
let c =
|
|
3452
|
-
return t.replaceChildren(o), c &&
|
|
3661
|
+
let c = Gr(t, !1);
|
|
3662
|
+
return t.replaceChildren(o), c && Kr(t, c), !0;
|
|
3453
3663
|
}
|
|
3454
|
-
function
|
|
3664
|
+
function Wr(e, t, n) {
|
|
3455
3665
|
if (t.length !== n.length) return !1;
|
|
3456
3666
|
for (let r = 0; r < n.length; r++) {
|
|
3457
3667
|
let i = t[r], a = n[r];
|
|
3458
3668
|
if (i.length !== a.length) return !1;
|
|
3459
3669
|
for (let t = 0; t < a.length; t++) {
|
|
3460
3670
|
let n = i[t];
|
|
3461
|
-
if (
|
|
3671
|
+
if (lr(a[t]) !== (n.nodeType === Node.TEXT_NODE) || n.textContent !== a[t].text || n.parentNode !== e) return !1;
|
|
3462
3672
|
}
|
|
3463
3673
|
}
|
|
3464
3674
|
return !0;
|
|
3465
3675
|
}
|
|
3466
|
-
function
|
|
3676
|
+
function Gr(e, t) {
|
|
3467
3677
|
try {
|
|
3468
3678
|
let n = e.ownerDocument.getSelection();
|
|
3469
3679
|
if (!n) return null;
|
|
3470
3680
|
let r = e.getRootNode();
|
|
3471
3681
|
if (!(r instanceof ShadowRoot)) return null;
|
|
3472
|
-
let i;
|
|
3473
|
-
if (
|
|
3474
|
-
|
|
3475
|
-
if (e.length === 0) return null;
|
|
3476
|
-
i = e[0];
|
|
3477
|
-
} else {
|
|
3478
|
-
let e = r.getSelection?.();
|
|
3479
|
-
if (!e || e.rangeCount === 0) return null;
|
|
3480
|
-
i = e.getRangeAt(0);
|
|
3481
|
-
}
|
|
3482
|
-
let a = xr(e, i.startContainer, i.startOffset), o = xr(e, i.endContainer, i.endOffset);
|
|
3682
|
+
let i = wr(r);
|
|
3683
|
+
if (!i) return null;
|
|
3684
|
+
let a = qr(e, i.startContainer, i.startOffset), o = qr(e, i.endContainer, i.endOffset);
|
|
3483
3685
|
return a === null || o === null || a === o && !t ? null : {
|
|
3484
3686
|
start: a,
|
|
3485
3687
|
end: o,
|
|
@@ -3489,32 +3691,32 @@ function yr(e, t) {
|
|
|
3489
3691
|
return null;
|
|
3490
3692
|
}
|
|
3491
3693
|
}
|
|
3492
|
-
function
|
|
3694
|
+
function Kr(e, t) {
|
|
3493
3695
|
try {
|
|
3494
|
-
let n =
|
|
3696
|
+
let n = Jr(e, t.start), r = Jr(e, t.end);
|
|
3495
3697
|
if (!n || !r) return;
|
|
3496
3698
|
let i = e.getRootNode().getSelection?.() ?? e.ownerDocument.getSelection();
|
|
3497
3699
|
t.backward ? i?.setBaseAndExtent(r[0], r[1], n[0], n[1]) : i?.setBaseAndExtent(n[0], n[1], r[0], r[1]);
|
|
3498
3700
|
} catch {}
|
|
3499
3701
|
}
|
|
3500
|
-
function
|
|
3702
|
+
function qr(e, t, n) {
|
|
3501
3703
|
if (!e.contains(t)) return null;
|
|
3502
3704
|
let r = e.ownerDocument.createRange();
|
|
3503
3705
|
return r.selectNodeContents(e), r.setEnd(t, n), r.toString().length;
|
|
3504
3706
|
}
|
|
3505
|
-
function
|
|
3707
|
+
function Jr(e, t) {
|
|
3506
3708
|
let n = t, r = null;
|
|
3507
|
-
for (let t of
|
|
3709
|
+
for (let t of Yr(e)) {
|
|
3508
3710
|
if (n <= t.data.length) return [t, n];
|
|
3509
3711
|
n -= t.data.length, r = [t, t.data.length];
|
|
3510
3712
|
}
|
|
3511
3713
|
return r;
|
|
3512
3714
|
}
|
|
3513
|
-
function*
|
|
3715
|
+
function* Yr(e) {
|
|
3514
3716
|
let t = e.ownerDocument.createTreeWalker(e, NodeFilter.SHOW_TEXT), n = t.nextNode();
|
|
3515
3717
|
for (; n;) yield n, n = t.nextNode();
|
|
3516
3718
|
}
|
|
3517
|
-
function
|
|
3719
|
+
function Xr(e) {
|
|
3518
3720
|
let t = [];
|
|
3519
3721
|
for (let n of e) {
|
|
3520
3722
|
for (let e of n) t.push(e.text, e.color ?? "", e.backgroundColor ?? "", e.fontWeight ?? "", e.fontStyle ?? "", e.textDecorationLine ?? "", e.opacity ?? "");
|
|
@@ -3524,9 +3726,9 @@ function wr(e) {
|
|
|
3524
3726
|
}
|
|
3525
3727
|
//#endregion
|
|
3526
3728
|
//#region src/render.ts
|
|
3527
|
-
function
|
|
3729
|
+
function Zr(e) {
|
|
3528
3730
|
let t = /* @__PURE__ */ new Set();
|
|
3529
|
-
|
|
3731
|
+
Qr(e, !0, t);
|
|
3530
3732
|
for (let n of Array.from(e.source.querySelectorAll("[data-mw-inline-inset]"))) if (!t.has(n)) {
|
|
3531
3733
|
n.removeAttribute("data-mw-inline-inset");
|
|
3532
3734
|
let e = n.style;
|
|
@@ -3538,152 +3740,156 @@ function Tr(e) {
|
|
|
3538
3740
|
]) e.removeProperty(t);
|
|
3539
3741
|
}
|
|
3540
3742
|
}
|
|
3541
|
-
function
|
|
3743
|
+
function Y(e, t, n) {
|
|
3542
3744
|
e.style.getPropertyValue(t) !== n && e.style.setProperty(t, n);
|
|
3543
3745
|
}
|
|
3544
|
-
function
|
|
3746
|
+
function X(e, t) {
|
|
3545
3747
|
e.style.getPropertyValue(t) !== "" && e.style.removeProperty(t);
|
|
3546
3748
|
}
|
|
3547
|
-
function
|
|
3749
|
+
function Z(e, t, n) {
|
|
3548
3750
|
e.hasAttribute(t) !== n && (n ? e.setAttribute(t, "") : e.removeAttribute(t));
|
|
3549
3751
|
}
|
|
3550
|
-
function
|
|
3752
|
+
function Qr(e, t, n) {
|
|
3551
3753
|
if (e.inlineElements) for (let { element: t, tracking: r, padLeft: i, padRight: a, insets: o } of e.inlineElements) {
|
|
3552
3754
|
let e = t;
|
|
3553
|
-
|
|
3755
|
+
Y(e, "--mw-ls", String(r)), i > 0 ? Y(e, "--mw-ipl", String(i)) : X(e, "--mw-ipl"), a > 0 ? Y(e, "--mw-ipr", String(a)) : X(e, "--mw-ipr"), o && (n.add(t), $r(e, o));
|
|
3554
3756
|
}
|
|
3555
|
-
if (t ||
|
|
3757
|
+
if (t || ti(e), !e.tableHidden) for (let t of me(e)) {
|
|
3556
3758
|
let r = t.source;
|
|
3557
|
-
t.style.zIndex !== null &&
|
|
3759
|
+
t.style.zIndex !== null && pe(t, e) && !t.inlineBox ? Y(r, "--mw-z", String(t.style.zIndex)) : X(r, "--mw-z"), Qr(t, !1, n);
|
|
3558
3760
|
}
|
|
3559
3761
|
}
|
|
3560
|
-
function
|
|
3561
|
-
|
|
3762
|
+
function $r(e, t) {
|
|
3763
|
+
Z(e, "data-mw-inline-inset", !0);
|
|
3562
3764
|
let n = (t, n) => {
|
|
3563
|
-
n === null ?
|
|
3765
|
+
n === null ? X(e, t) : Y(e, t, String(n));
|
|
3564
3766
|
};
|
|
3565
3767
|
n("--mw-it", t.top), n("--mw-ir", t.right), n("--mw-ib", t.bottom), n("--mw-il", t.left);
|
|
3566
3768
|
}
|
|
3567
|
-
function
|
|
3769
|
+
function ei(e) {
|
|
3568
3770
|
let t = e.style;
|
|
3569
3771
|
if (t.textAlign !== "center" || !e.text || e.inlineBox || e.children.length > 0) return !1;
|
|
3570
3772
|
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 ?? Hn(e, i);
|
|
3571
3773
|
return o.length !== 0 && o.every((n, r) => {
|
|
3572
|
-
let i = r === 0 ? t.textIndent : 0, o = a - i -
|
|
3774
|
+
let i = r === 0 ? t.textIndent : 0, o = a - i - F(n.start, n.end, e.advances, t.tracking);
|
|
3573
3775
|
return o > 0 && o % 2 == 1;
|
|
3574
3776
|
});
|
|
3575
3777
|
}
|
|
3576
|
-
function
|
|
3778
|
+
function ti(e) {
|
|
3577
3779
|
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;
|
|
3578
|
-
|
|
3780
|
+
Z(t, "data-mw-laid-out", !e.inlineBox && !u && !d), Z(t, "data-mw-inline-box", !!e.inlineBox), Z(t, "data-mw-multicol-flow", !!u), Z(t, "data-mw-multicol-flow-span", !!d);
|
|
3579
3781
|
let f = u ?? d;
|
|
3580
|
-
f ? (
|
|
3782
|
+
f ? (Y(t, "--mw-mt", String(f.top ?? 0)), Y(t, "--mw-mr", String(f.right ?? 0)), Y(t, "--mw-mb", String(f.bottom ?? 0)), Y(t, "--mw-ml", String(f.left ?? 0))) : (X(t, "--mw-mt"), X(t, "--mw-mr"), X(t, "--mw-mb"), X(t, "--mw-ml")), Z(t, "data-mw-vbottom", !!e.inlineBox && e.style.verticalAlign === "end"), Y(t, "--mw-ls", String(c)), Y(t, "--mw-lh", String(l + 1)), Y(t, "--mw-lhs", String(-l / 2)), Z(t, "data-mw-nowrap", s !== "normal");
|
|
3581
3783
|
let p = u || d ? void 0 : e.multicolGeometry;
|
|
3582
|
-
if (
|
|
3784
|
+
if (Z(t, "data-mw-multicol", !!p), Z(t, "data-mw-multicol-balance", !!p?.nativeBalance), p ? (Y(t, "--mw-colc", String(p.columnCount)), Y(t, "--mw-colg", String(p.gap))) : (X(t, "--mw-colc"), X(t, "--mw-colg")), Z(t, "data-mw-pre", s === "pre"), Y(t, "--mw-x", String(n.x)), Y(t, "--mw-y", String(n.y)), Y(t, "--mw-w", String(n.width)), Y(t, "--mw-h", String(n.height)), Z(t, "data-mw-clip", o.x === "clip" || o.y === "clip"), Z(t, "data-mw-scroll", e.scrollRange !== void 0), e.scrollRange) {
|
|
3583
3785
|
let { maxX: n, maxY: r } = e.scrollRange;
|
|
3584
|
-
|
|
3585
|
-
} else
|
|
3586
|
-
|
|
3786
|
+
Y(t, "--mw-se-x", String(n > 0 ? n + e.localRect.width : 1)), Y(t, "--mw-se-y", String(r > 0 ? r + e.localRect.height : 1));
|
|
3787
|
+
} else X(t, "--mw-se-x"), X(t, "--mw-se-y");
|
|
3788
|
+
Y(t, "--mw-pt", String(r.top)), Y(t, "--mw-pr", String(r.right)), Y(t, "--mw-pb", String(r.bottom)), Y(t, "--mw-pl", String(r.left)), Y(t, "--mw-bt", String(i.top)), Y(t, "--mw-br", String(i.right)), Y(t, "--mw-bb", String(i.bottom)), Y(t, "--mw-bl", String(i.left)), Y(t, "--mw-ti", String(e.style.textIndent)), Z(t, "data-mw-text-align-blocked", a), Z(t, "data-mw-center-nudge", ei(e)), Z(t, "data-mw-dropped-text", !!e.droppedText), Z(t, "data-mw-table-hidden", !!e.tableHidden);
|
|
3587
3789
|
}
|
|
3588
3790
|
//#endregion
|
|
3589
3791
|
//#region src/style.ts
|
|
3590
|
-
function
|
|
3591
|
-
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a =
|
|
3592
|
-
|
|
3593
|
-
let c = r.display ||
|
|
3792
|
+
function ni(e, t, n) {
|
|
3793
|
+
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a = wi(e) ? e.computedStyleMap() : null, o = e.getAttribute("class") ?? "", s = e.style;
|
|
3794
|
+
yi(e, o, s);
|
|
3795
|
+
let c = (e, r, i) => Vi(a, e, r, o, i, s, n, t) ?? Ui(a, e, r, o, i, s, n, t) ?? Pi(r, t), l = r.display || gi[e.tagName] || "", u = _i[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, P(f, t)) : null, m = l === "flex" || l === "inline-flex" ? "flex" : l === "grid" || l === "inline-grid" ? "grid" : l === "table" || l === "inline-table" ? "table" : l === "none" || hi(e, r) ? "none" : d !== null || p !== null ? "multicol" : "block", h = { kind: "none" }, g = { kind: "none" }, _ = [ot()], v = [ot()], y = {
|
|
3594
3796
|
direction: "row",
|
|
3595
3797
|
dense: !1
|
|
3596
|
-
},
|
|
3597
|
-
if (
|
|
3598
|
-
if (a)
|
|
3798
|
+
}, b = null;
|
|
3799
|
+
if (m === "grid") {
|
|
3800
|
+
if (a) h = Ki(a.get("grid-template-columns")?.toString() ?? "", t), g = Ki(a.get("grid-template-rows")?.toString() ?? "", t);
|
|
3599
3801
|
else {
|
|
3600
3802
|
e.setAttribute("data-mw-degrid", "");
|
|
3601
3803
|
try {
|
|
3602
|
-
|
|
3804
|
+
h = Ki(r.getPropertyValue("grid-template-columns"), t), g = Ki(r.getPropertyValue("grid-template-rows"), t);
|
|
3603
3805
|
} finally {
|
|
3604
3806
|
e.removeAttribute("data-mw-degrid");
|
|
3605
3807
|
}
|
|
3606
3808
|
}
|
|
3607
|
-
|
|
3809
|
+
_ = Xi(r.getPropertyValue("grid-auto-columns"), t), v = Xi(r.getPropertyValue("grid-auto-rows"), t), y = na(r.getPropertyValue("grid-auto-flow")), b = Yi(r.getPropertyValue("grid-template-areas"));
|
|
3608
3810
|
}
|
|
3609
|
-
let
|
|
3610
|
-
if (
|
|
3811
|
+
let x = "auto", S = !1, C = 0, w = 0;
|
|
3812
|
+
if (m === "table" && (x = r.tableLayout === "fixed" ? "fixed" : "auto", S = r.borderCollapse === "collapse", !S)) {
|
|
3611
3813
|
let e = r.borderSpacing.split(" ");
|
|
3612
|
-
|
|
3613
|
-
}
|
|
3614
|
-
let
|
|
3615
|
-
display:
|
|
3616
|
-
tableRole:
|
|
3617
|
-
tableLayout:
|
|
3618
|
-
borderCollapse:
|
|
3619
|
-
borderSpacingX:
|
|
3620
|
-
borderSpacingY:
|
|
3814
|
+
C = P(parseFloat(e[0] ?? "") || 0, t), w = P(parseFloat(e[1] ?? e[0] ?? "") || 0, t);
|
|
3815
|
+
}
|
|
3816
|
+
let T = {
|
|
3817
|
+
display: m,
|
|
3818
|
+
tableRole: u,
|
|
3819
|
+
tableLayout: x,
|
|
3820
|
+
borderCollapse: S,
|
|
3821
|
+
borderSpacingX: C,
|
|
3822
|
+
borderSpacingY: w,
|
|
3621
3823
|
captionSide: r.captionSide === "bottom" ? "bottom" : "top",
|
|
3622
|
-
verticalAlign:
|
|
3824
|
+
verticalAlign: u === "cell" || l.startsWith("inline-") ? vi(e, r) : "start",
|
|
3623
3825
|
flexDirection: r.flexDirection.startsWith("column") ? "column" : "row",
|
|
3624
3826
|
flexReverse: r.flexDirection.endsWith("-reverse"),
|
|
3625
3827
|
flexWrap: r.flexWrap.startsWith("wrap") ? "wrap" : "nowrap",
|
|
3626
3828
|
wrapReverse: r.flexWrap === "wrap-reverse",
|
|
3627
3829
|
flexGrow: Number(r.flexGrow) || 0,
|
|
3628
3830
|
flexShrink: r.flexShrink === "" ? 1 : Number(r.flexShrink) || 0,
|
|
3629
|
-
flexBasis:
|
|
3831
|
+
flexBasis: Wi(r.flexBasis, t),
|
|
3630
3832
|
order: Number(r.order) || 0,
|
|
3631
|
-
justifyContent:
|
|
3632
|
-
alignContent:
|
|
3633
|
-
alignItems:
|
|
3634
|
-
alignSelf:
|
|
3635
|
-
justifyItems:
|
|
3636
|
-
justifySelf:
|
|
3637
|
-
gridTemplateColumns:
|
|
3638
|
-
gridTemplateRows:
|
|
3639
|
-
gridAutoColumns:
|
|
3640
|
-
gridAutoRows:
|
|
3641
|
-
gridAutoFlow:
|
|
3642
|
-
gridTemplateAreas:
|
|
3643
|
-
gridColumnStart:
|
|
3644
|
-
gridColumnEnd:
|
|
3645
|
-
gridRowStart:
|
|
3646
|
-
gridRowEnd:
|
|
3647
|
-
width:
|
|
3648
|
-
height:
|
|
3649
|
-
minWidth:
|
|
3650
|
-
minHeight:
|
|
3651
|
-
maxWidth:
|
|
3652
|
-
maxHeight:
|
|
3653
|
-
padding:
|
|
3654
|
-
margin:
|
|
3655
|
-
position:
|
|
3656
|
-
insets:
|
|
3657
|
-
gapX:
|
|
3658
|
-
gapY:
|
|
3659
|
-
border:
|
|
3833
|
+
justifyContent: Ti(r.justifyContent),
|
|
3834
|
+
alignContent: Ti(r.alignContent),
|
|
3835
|
+
alignItems: Ei(r.alignItems),
|
|
3836
|
+
alignSelf: Di(r.alignSelf),
|
|
3837
|
+
justifyItems: Ei(r.justifyItems),
|
|
3838
|
+
justifySelf: Di(r.justifySelf),
|
|
3839
|
+
gridTemplateColumns: h,
|
|
3840
|
+
gridTemplateRows: g,
|
|
3841
|
+
gridAutoColumns: _,
|
|
3842
|
+
gridAutoRows: v,
|
|
3843
|
+
gridAutoFlow: y,
|
|
3844
|
+
gridTemplateAreas: b,
|
|
3845
|
+
gridColumnStart: ta(r.getPropertyValue("grid-column-start")),
|
|
3846
|
+
gridColumnEnd: ta(r.getPropertyValue("grid-column-end")),
|
|
3847
|
+
gridRowStart: ta(r.getPropertyValue("grid-row-start")),
|
|
3848
|
+
gridRowEnd: ta(r.getPropertyValue("grid-row-end")),
|
|
3849
|
+
width: Li(a, r.width, "width", t, o, s, n),
|
|
3850
|
+
height: Li(a, r.height, "height", t, o, s, n),
|
|
3851
|
+
minWidth: c("min-width", r.minWidth, "min-w") ?? "auto",
|
|
3852
|
+
minHeight: c("min-height", r.minHeight, "min-h") ?? "auto",
|
|
3853
|
+
maxWidth: c("max-width", r.maxWidth, "max-w"),
|
|
3854
|
+
maxHeight: c("max-height", r.maxHeight, "max-h"),
|
|
3855
|
+
padding: ia(r, t),
|
|
3856
|
+
margin: Oi(r, a, o, s, t),
|
|
3857
|
+
position: ji(r.position),
|
|
3858
|
+
insets: Mi(r, a, o, s, t),
|
|
3859
|
+
gapX: Q(r.columnGap === "normal" || r.columnGap === "" ? m === "multicol" ? `${i}px` : "0px" : r.columnGap, t),
|
|
3860
|
+
gapY: Q(r.rowGap === "normal" ? "0px" : r.rowGap, t),
|
|
3861
|
+
border: aa(r),
|
|
3660
3862
|
borderStyle: {
|
|
3661
|
-
top:
|
|
3662
|
-
right:
|
|
3663
|
-
bottom:
|
|
3664
|
-
left:
|
|
3863
|
+
top: Ni(r.borderTopStyle),
|
|
3864
|
+
right: Ni(r.borderRightStyle),
|
|
3865
|
+
bottom: Ni(r.borderBottomStyle),
|
|
3866
|
+
left: Ni(r.borderLeftStyle)
|
|
3665
3867
|
},
|
|
3666
|
-
overflow:
|
|
3667
|
-
scrollbarWidth:
|
|
3668
|
-
scrollbarColor:
|
|
3868
|
+
overflow: mi(r),
|
|
3869
|
+
scrollbarWidth: ui(e, r),
|
|
3870
|
+
scrollbarColor: di(r.scrollbarColor),
|
|
3669
3871
|
overscroll: {
|
|
3670
3872
|
x: (r.overscrollBehaviorX || "auto") === "auto",
|
|
3671
3873
|
y: (r.overscrollBehaviorY || "auto") === "auto"
|
|
3672
3874
|
},
|
|
3673
3875
|
scrollbarSize: {
|
|
3674
|
-
x:
|
|
3675
|
-
y:
|
|
3876
|
+
x: fi(r.getPropertyValue("--mw-scrollbar-size-x")),
|
|
3877
|
+
y: fi(r.getPropertyValue("--mw-scrollbar-size-y"))
|
|
3878
|
+
},
|
|
3879
|
+
scrollbarInset: {
|
|
3880
|
+
x: fi(r.getPropertyValue("--mw-scrollbar-inset-x"), 0),
|
|
3881
|
+
y: fi(r.getPropertyValue("--mw-scrollbar-inset-y"), 0)
|
|
3676
3882
|
},
|
|
3677
3883
|
whiteSpace: r.whiteSpace === "pre" ? "pre" : r.whiteSpace === "nowrap" ? "nowrap" : "normal",
|
|
3678
3884
|
tabSize: Math.max(1, Math.floor(parseFloat(r.tabSize)) || 8),
|
|
3679
|
-
lineGap:
|
|
3680
|
-
tracking:
|
|
3885
|
+
lineGap: Ai(r.lineHeight, i),
|
|
3886
|
+
tracking: ki(r.letterSpacing, i, n?.letterSpacing ?? 0),
|
|
3681
3887
|
textOverflow: r.textOverflow === "ellipsis" ? "ellipsis" : "clip",
|
|
3682
3888
|
color: r.color,
|
|
3683
3889
|
fontWeight: r.fontWeight,
|
|
3684
3890
|
fontStyle: r.fontStyle,
|
|
3685
3891
|
textDecorationLine: r.textDecorationLine,
|
|
3686
|
-
backgroundColor:
|
|
3892
|
+
backgroundColor: ai(e, r.backgroundColor, r),
|
|
3687
3893
|
backgroundClear: r.getPropertyValue("--mw-bg-clear").trim() === "1",
|
|
3688
3894
|
borderColor: {
|
|
3689
3895
|
top: r.borderTopColor,
|
|
@@ -3691,33 +3897,33 @@ function Ar(e, t, n) {
|
|
|
3691
3897
|
bottom: r.borderBottomColor,
|
|
3692
3898
|
left: r.borderLeftColor
|
|
3693
3899
|
},
|
|
3694
|
-
textAlignBlocked:
|
|
3695
|
-
textAlign:
|
|
3696
|
-
textIndent:
|
|
3697
|
-
opacity:
|
|
3900
|
+
textAlignBlocked: Si(e, r),
|
|
3901
|
+
textAlign: Ci(e, r),
|
|
3902
|
+
textIndent: Ii(r, t),
|
|
3903
|
+
opacity: Fi(r.opacity),
|
|
3698
3904
|
glyphSet: r.getPropertyValue("--mw-border-glyphs").trim() || null,
|
|
3699
3905
|
zIndex: r.zIndex === "auto" || r.zIndex === "" ? null : Number(r.zIndex) || 0,
|
|
3700
3906
|
latticeBorder: null,
|
|
3701
|
-
ruleX:
|
|
3702
|
-
ruleY:
|
|
3703
|
-
ruleBreak:
|
|
3704
|
-
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0,
|
|
3705
|
-
ruleVisibilityItems:
|
|
3907
|
+
ruleX: m === "flex" || m === "grid" || m === "multicol" ? xi(r, "x") : null,
|
|
3908
|
+
ruleY: m === "flex" || m === "grid" ? xi(r, "y") : null,
|
|
3909
|
+
ruleBreak: bi(r, "--mw-rule-break", ["none", "intersection"], "normal"),
|
|
3910
|
+
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0, N(parseFloat(r.getPropertyValue("--mw-rule-inset")) || 0)),
|
|
3911
|
+
ruleVisibilityItems: bi(r, "--mw-rule-visibility-items", [
|
|
3706
3912
|
"all",
|
|
3707
3913
|
"around",
|
|
3708
3914
|
"between"
|
|
3709
3915
|
], "normal"),
|
|
3710
|
-
columnCount:
|
|
3711
|
-
columnWidth:
|
|
3916
|
+
columnCount: d,
|
|
3917
|
+
columnWidth: p,
|
|
3712
3918
|
columnFill: r.columnFill === "auto" ? "auto" : "balance",
|
|
3713
3919
|
columnSpan: r.columnSpan === "all",
|
|
3714
3920
|
breakBeforeColumn: r.breakBefore === "column",
|
|
3715
3921
|
breakAfterColumn: r.breakAfter === "column",
|
|
3716
3922
|
breakInsideAvoid: r.breakInside === "avoid" || r.breakInside === "avoid-column"
|
|
3717
3923
|
};
|
|
3718
|
-
return
|
|
3924
|
+
return ri(T, r), T;
|
|
3719
3925
|
}
|
|
3720
|
-
function
|
|
3926
|
+
function ri(e, t) {
|
|
3721
3927
|
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 = {
|
|
3722
3928
|
width: e.border,
|
|
3723
3929
|
style: e.borderStyle,
|
|
@@ -3728,37 +3934,37 @@ function jr(e, t) {
|
|
|
3728
3934
|
bottom: t.borderBottomStyle === "hidden",
|
|
3729
3935
|
left: t.borderLeftStyle === "hidden"
|
|
3730
3936
|
}
|
|
3731
|
-
}, e.border =
|
|
3937
|
+
}, e.border = R(), e.display === "table" && (e.padding = R()));
|
|
3732
3938
|
}
|
|
3733
|
-
function
|
|
3939
|
+
function ii(e) {
|
|
3734
3940
|
if (!e) return !0;
|
|
3735
3941
|
let t = e.trim().toLowerCase();
|
|
3736
3942
|
return t === "" || t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "currentcolor";
|
|
3737
3943
|
}
|
|
3738
|
-
function
|
|
3739
|
-
let i = r(e,
|
|
3944
|
+
function ai(e, t, n) {
|
|
3945
|
+
let i = r(e, ii(t) ? "" : t, n);
|
|
3740
3946
|
return i === "" ? void 0 : i;
|
|
3741
3947
|
}
|
|
3742
|
-
function
|
|
3948
|
+
function oi(e) {
|
|
3743
3949
|
return e === "hidden" || e === "clip";
|
|
3744
3950
|
}
|
|
3745
|
-
var
|
|
3746
|
-
function
|
|
3747
|
-
if (
|
|
3951
|
+
var si = /* @__PURE__ */ new WeakMap(), ci = null;
|
|
3952
|
+
function li(e) {
|
|
3953
|
+
if (ci !== null) return ci;
|
|
3748
3954
|
if (!e.body) return !0;
|
|
3749
3955
|
let t = e.createElement("div");
|
|
3750
|
-
return t.style.cssText = "position: absolute; width: 0; height: 0; overflow: auto", e.body.appendChild(t),
|
|
3956
|
+
return t.style.cssText = "position: absolute; width: 0; height: 0; overflow: auto", e.body.appendChild(t), ci = getComputedStyle(t).scrollbarWidth !== "none", t.remove(), ci;
|
|
3751
3957
|
}
|
|
3752
|
-
function
|
|
3753
|
-
if (!
|
|
3958
|
+
function ui(e, t) {
|
|
3959
|
+
if (!li(e.ownerDocument)) return "auto";
|
|
3754
3960
|
if (e.hasAttribute("data-mw-scroll")) {
|
|
3755
|
-
let t =
|
|
3961
|
+
let t = si.get(e);
|
|
3756
3962
|
if (t !== void 0) return t;
|
|
3757
3963
|
}
|
|
3758
3964
|
let n = t.scrollbarWidth === "none" ? "none" : "auto";
|
|
3759
|
-
return
|
|
3965
|
+
return si.set(e, n), n;
|
|
3760
3966
|
}
|
|
3761
|
-
function
|
|
3967
|
+
function di(e) {
|
|
3762
3968
|
let t = (e ?? "").trim();
|
|
3763
3969
|
if (!t || t === "auto") return null;
|
|
3764
3970
|
let n = 0;
|
|
@@ -3773,25 +3979,25 @@ function zr(e) {
|
|
|
3773
3979
|
}
|
|
3774
3980
|
return null;
|
|
3775
3981
|
}
|
|
3776
|
-
function
|
|
3777
|
-
return Math.max(
|
|
3982
|
+
function fi(e, t = 1) {
|
|
3983
|
+
return Math.max(t, Math.floor(Number(e) || t));
|
|
3778
3984
|
}
|
|
3779
|
-
function
|
|
3780
|
-
return
|
|
3985
|
+
function pi(e) {
|
|
3986
|
+
return oi(e) ? "clip" : e === "auto" || e === "scroll" ? e : "visible";
|
|
3781
3987
|
}
|
|
3782
|
-
function
|
|
3783
|
-
let t =
|
|
3988
|
+
function mi(e) {
|
|
3989
|
+
let t = pi(e.overflowX || e.overflow), n = pi(e.overflowY || e.overflow);
|
|
3784
3990
|
return t !== "visible" && n === "visible" && (n = "auto"), n !== "visible" && t === "visible" && (t = "auto"), {
|
|
3785
3991
|
x: t,
|
|
3786
3992
|
y: n
|
|
3787
3993
|
};
|
|
3788
3994
|
}
|
|
3789
|
-
function
|
|
3995
|
+
function hi(e, t) {
|
|
3790
3996
|
if (t.position !== "absolute" && t.position !== "fixed") return !1;
|
|
3791
3997
|
let n = t.clip.replace(/\s/g, "");
|
|
3792
|
-
return n === "rect(0px,0px,0px,0px)" || n === "rect(0,0,0,0)" || !
|
|
3998
|
+
return n === "rect(0px,0px,0px,0px)" || n === "rect(0,0,0,0)" || !oe(e.tagName) && (oi(t.overflow) || oi(t.overflowX)) && parseFloat(t.width) <= 1 && parseFloat(t.height) <= 1;
|
|
3793
3999
|
}
|
|
3794
|
-
var
|
|
4000
|
+
var gi = {
|
|
3795
4001
|
TABLE: "table",
|
|
3796
4002
|
THEAD: "table-header-group",
|
|
3797
4003
|
TBODY: "table-row-group",
|
|
@@ -3802,7 +4008,7 @@ var Wr = {
|
|
|
3802
4008
|
CAPTION: "table-caption",
|
|
3803
4009
|
COL: "table-column",
|
|
3804
4010
|
COLGROUP: "table-column-group"
|
|
3805
|
-
},
|
|
4011
|
+
}, _i = {
|
|
3806
4012
|
"table-header-group": "header-group",
|
|
3807
4013
|
"table-row-group": "row-group",
|
|
3808
4014
|
"table-footer-group": "footer-group",
|
|
@@ -3812,38 +4018,38 @@ var Wr = {
|
|
|
3812
4018
|
"table-column": "column",
|
|
3813
4019
|
"table-column-group": "column-group"
|
|
3814
4020
|
};
|
|
3815
|
-
function
|
|
4021
|
+
function vi(e, t) {
|
|
3816
4022
|
let n = t.verticalAlign || e.getAttribute("valign")?.toLowerCase() || (e.tagName === "TD" || e.tagName === "TH" ? "middle" : "baseline");
|
|
3817
4023
|
return n === "top" ? "start" : n === "middle" ? "center" : n === "bottom" ? "end" : "start";
|
|
3818
4024
|
}
|
|
3819
|
-
function
|
|
3820
|
-
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") &&
|
|
4025
|
+
function yi(e, t, n) {
|
|
4026
|
+
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") && M(e, "font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.");
|
|
3821
4027
|
}
|
|
3822
|
-
function
|
|
4028
|
+
function bi(e, t, n, r) {
|
|
3823
4029
|
let i = e.getPropertyValue(t).trim();
|
|
3824
4030
|
return n.includes(i) ? i : r;
|
|
3825
4031
|
}
|
|
3826
|
-
function
|
|
3827
|
-
let n =
|
|
4032
|
+
function xi(e, t) {
|
|
4033
|
+
let n = N(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`)) || 0);
|
|
3828
4034
|
if (n <= 0) return null;
|
|
3829
4035
|
let r = e.getPropertyValue(`--mw-rule-${t}-color`).trim();
|
|
3830
4036
|
return {
|
|
3831
4037
|
width: n,
|
|
3832
|
-
style:
|
|
4038
|
+
style: Ni(e.getPropertyValue(`--mw-rule-${t}-style`).trim()),
|
|
3833
4039
|
color: r && r !== "currentcolor" && r !== "currentColor" ? r : e.color
|
|
3834
4040
|
};
|
|
3835
4041
|
}
|
|
3836
|
-
function
|
|
4042
|
+
function Si(e, t) {
|
|
3837
4043
|
return t.textAlign === "justify" || e.getAttribute("align")?.toLowerCase() === "justify";
|
|
3838
4044
|
}
|
|
3839
|
-
function
|
|
4045
|
+
function Ci(e, t) {
|
|
3840
4046
|
let n = t.textAlign || e.getAttribute("align")?.toLowerCase() || "";
|
|
3841
4047
|
return n === "right" || n === "end" ? "end" : n === "center" || n.endsWith("-center") ? "center" : "start";
|
|
3842
4048
|
}
|
|
3843
|
-
function
|
|
4049
|
+
function wi(e) {
|
|
3844
4050
|
return typeof e.computedStyleMap == "function";
|
|
3845
4051
|
}
|
|
3846
|
-
function
|
|
4052
|
+
function Ti(e) {
|
|
3847
4053
|
switch (e) {
|
|
3848
4054
|
case "center": return "center";
|
|
3849
4055
|
case "flex-end":
|
|
@@ -3858,7 +4064,7 @@ function $r(e) {
|
|
|
3858
4064
|
default: return "start";
|
|
3859
4065
|
}
|
|
3860
4066
|
}
|
|
3861
|
-
function
|
|
4067
|
+
function Ei(e) {
|
|
3862
4068
|
switch (e) {
|
|
3863
4069
|
case "center": return "center";
|
|
3864
4070
|
case "flex-end":
|
|
@@ -3869,10 +4075,10 @@ function ei(e) {
|
|
|
3869
4075
|
default: return "start";
|
|
3870
4076
|
}
|
|
3871
4077
|
}
|
|
3872
|
-
function
|
|
3873
|
-
return e === "auto" || e === "" || e === "normal" ? "auto" :
|
|
4078
|
+
function Di(e) {
|
|
4079
|
+
return e === "auto" || e === "" || e === "normal" ? "auto" : Ei(e);
|
|
3874
4080
|
}
|
|
3875
|
-
function
|
|
4081
|
+
function Oi(e, t, n, r, i) {
|
|
3876
4082
|
let a = (a, o, s) => {
|
|
3877
4083
|
if (t) {
|
|
3878
4084
|
let e = t.get(a)?.toString().trim();
|
|
@@ -3884,10 +4090,10 @@ function ni(e, t, n, r, i) {
|
|
|
3884
4090
|
} else if (s.test(n) || r.getPropertyValue(a) === "auto") return null;
|
|
3885
4091
|
let c = e.getPropertyValue(a);
|
|
3886
4092
|
if (c === "auto") return null;
|
|
3887
|
-
let l =
|
|
4093
|
+
let l = Q(c, i);
|
|
3888
4094
|
if (l !== 0) return l;
|
|
3889
4095
|
let u = e.getPropertyValue(o);
|
|
3890
|
-
return u === "auto" ? null :
|
|
4096
|
+
return u === "auto" ? null : Q(u, i);
|
|
3891
4097
|
};
|
|
3892
4098
|
return {
|
|
3893
4099
|
top: a("margin-top", "margin-block-start", /(?:^|[\s:.[!])(?:m|my|mt)-auto\b/),
|
|
@@ -3896,16 +4102,16 @@ function ni(e, t, n, r, i) {
|
|
|
3896
4102
|
left: a("margin-left", "margin-inline-start", /(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)
|
|
3897
4103
|
};
|
|
3898
4104
|
}
|
|
3899
|
-
function
|
|
4105
|
+
function ki(e, t, n) {
|
|
3900
4106
|
let r = (e === "normal" ? 0 : parseFloat(e) || 0) - n;
|
|
3901
4107
|
return r <= 0 ? 0 : Math.floor(r / (.025 * t) + 1e-6);
|
|
3902
4108
|
}
|
|
3903
|
-
function
|
|
4109
|
+
function Ai(e, t) {
|
|
3904
4110
|
if (!e || e === "normal" || t <= 0) return 0;
|
|
3905
4111
|
let n = parseFloat(e);
|
|
3906
4112
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n / t + 1e-6) - 1) : 0;
|
|
3907
4113
|
}
|
|
3908
|
-
function
|
|
4114
|
+
function ji(e) {
|
|
3909
4115
|
switch (e) {
|
|
3910
4116
|
case "relative":
|
|
3911
4117
|
case "absolute":
|
|
@@ -3914,17 +4120,17 @@ function ai(e) {
|
|
|
3914
4120
|
default: return "static";
|
|
3915
4121
|
}
|
|
3916
4122
|
}
|
|
3917
|
-
function
|
|
4123
|
+
function Mi(e, t, n, r, i) {
|
|
3918
4124
|
let a = (a, o) => {
|
|
3919
4125
|
if (t) {
|
|
3920
4126
|
let e = t.get(a)?.toString().trim();
|
|
3921
|
-
return !e || e === "auto" ? null :
|
|
4127
|
+
return !e || e === "auto" ? null : Q(e, i);
|
|
3922
4128
|
}
|
|
3923
4129
|
let s = r[a];
|
|
3924
|
-
if (s) return s === "auto" ? null :
|
|
4130
|
+
if (s) return s === "auto" ? null : Q(s, i);
|
|
3925
4131
|
if (!o.test(n)) return null;
|
|
3926
4132
|
let c = e.getPropertyValue(a);
|
|
3927
|
-
return !c || c === "auto" ? null :
|
|
4133
|
+
return !c || c === "auto" ? null : Q(c, i);
|
|
3928
4134
|
};
|
|
3929
4135
|
return {
|
|
3930
4136
|
top: a("top", /(?:^|[\s:.[!])-?(?:top|inset|inset-y)-/),
|
|
@@ -3933,7 +4139,7 @@ function oi(e, t, n, r, i) {
|
|
|
3933
4139
|
left: a("left", /(?:^|[\s:.[!])-?(?:left|start|inset|inset-x)-/)
|
|
3934
4140
|
};
|
|
3935
4141
|
}
|
|
3936
|
-
function
|
|
4142
|
+
function Ni(e) {
|
|
3937
4143
|
switch (e) {
|
|
3938
4144
|
case "double": return "double";
|
|
3939
4145
|
case "dashed": return "dashed";
|
|
@@ -3941,7 +4147,7 @@ function si(e) {
|
|
|
3941
4147
|
default: return "solid";
|
|
3942
4148
|
}
|
|
3943
4149
|
}
|
|
3944
|
-
function
|
|
4150
|
+
function Pi(e, t) {
|
|
3945
4151
|
if (!e || e === "none" || e === "auto") return;
|
|
3946
4152
|
if (e === "min-content" || e === "max-content" || e === "fit-content") return e;
|
|
3947
4153
|
if (e.endsWith("%")) {
|
|
@@ -3949,39 +4155,44 @@ function ci(e, t) {
|
|
|
3949
4155
|
return Number.isFinite(t) ? { percent: t } : void 0;
|
|
3950
4156
|
}
|
|
3951
4157
|
let n = parseFloat(e);
|
|
3952
|
-
return Number.isFinite(n) ?
|
|
4158
|
+
return Number.isFinite(n) ? P(n, t) : void 0;
|
|
3953
4159
|
}
|
|
3954
|
-
function
|
|
4160
|
+
function Q(e, t) {
|
|
3955
4161
|
if (!e || e === "auto" || e === "none") return 0;
|
|
3956
4162
|
if (e.endsWith("%")) {
|
|
3957
4163
|
let t = parseFloat(e);
|
|
3958
4164
|
return Number.isFinite(t) && t !== 0 ? { percent: t } : 0;
|
|
3959
4165
|
}
|
|
3960
4166
|
let n = parseFloat(e);
|
|
3961
|
-
return Number.isFinite(n) ?
|
|
4167
|
+
return Number.isFinite(n) ? P(n, t) : 0;
|
|
3962
4168
|
}
|
|
3963
|
-
function
|
|
4169
|
+
function Fi(e) {
|
|
3964
4170
|
let t = parseFloat(e);
|
|
3965
4171
|
return Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : 1;
|
|
3966
4172
|
}
|
|
3967
|
-
function
|
|
4173
|
+
function Ii(e, t) {
|
|
3968
4174
|
let n = e.textIndent;
|
|
3969
4175
|
if (!n || n.endsWith("%")) return 0;
|
|
3970
4176
|
let r = parseFloat(n);
|
|
3971
|
-
return Number.isFinite(r) ? Math.max(0,
|
|
4177
|
+
return Number.isFinite(r) ? Math.max(0, P(r, t)) : 0;
|
|
3972
4178
|
}
|
|
3973
|
-
function
|
|
3974
|
-
let s =
|
|
4179
|
+
function Li(e, t, n, r, i, a, o) {
|
|
4180
|
+
let s = Ri(n === "width" ? a.width : a.height);
|
|
3975
4181
|
if (s !== null) return {
|
|
3976
4182
|
kind: "cells",
|
|
3977
|
-
value:
|
|
4183
|
+
value: Bi(s, n, o, r)
|
|
3978
4184
|
};
|
|
3979
|
-
let c =
|
|
3980
|
-
if (c !==
|
|
3981
|
-
|
|
4185
|
+
let c = Vi(e, n, t, i, n === "width" ? "w" : "h", a, o, r);
|
|
4186
|
+
if (c !== void 0) return {
|
|
4187
|
+
kind: "cells",
|
|
4188
|
+
value: c
|
|
4189
|
+
};
|
|
4190
|
+
let l = zi(i, n === "width" ? "w" : "h");
|
|
4191
|
+
if (l !== null) {
|
|
4192
|
+
let i = parseFloat(e ? String(e.get(n) ?? "") : t), a = Number.isFinite(i) && Math.abs(i - l) <= l * .3;
|
|
3982
4193
|
if (a || !Number.isFinite(i)) return {
|
|
3983
4194
|
kind: "cells",
|
|
3984
|
-
value:
|
|
4195
|
+
value: Bi(a ? i : l, n, o, r)
|
|
3985
4196
|
};
|
|
3986
4197
|
}
|
|
3987
4198
|
if (e) {
|
|
@@ -3989,7 +4200,7 @@ function di(e, t, n, r, i, a, o) {
|
|
|
3989
4200
|
if (t == null) return;
|
|
3990
4201
|
let i = t.toString().trim();
|
|
3991
4202
|
if (i === "auto") return { kind: "auto" };
|
|
3992
|
-
let a =
|
|
4203
|
+
let a = Gi(i);
|
|
3993
4204
|
if (a) return a;
|
|
3994
4205
|
if (i.endsWith("%")) return {
|
|
3995
4206
|
kind: "percent",
|
|
@@ -3997,68 +4208,68 @@ function di(e, t, n, r, i, a, o) {
|
|
|
3997
4208
|
};
|
|
3998
4209
|
if (i.endsWith("px")) return {
|
|
3999
4210
|
kind: "cells",
|
|
4000
|
-
value:
|
|
4211
|
+
value: P(parseFloat(i), r)
|
|
4001
4212
|
};
|
|
4002
4213
|
if (i.endsWith("rem")) return {
|
|
4003
4214
|
kind: "cells",
|
|
4004
|
-
value:
|
|
4215
|
+
value: N(parseFloat(i) / .25)
|
|
4005
4216
|
};
|
|
4006
|
-
let s =
|
|
4217
|
+
let s = Ri(i);
|
|
4007
4218
|
if (s !== null) return {
|
|
4008
4219
|
kind: "cells",
|
|
4009
|
-
value:
|
|
4220
|
+
value: Bi(s, n, o, r)
|
|
4010
4221
|
};
|
|
4011
4222
|
}
|
|
4012
|
-
let
|
|
4013
|
-
if (
|
|
4014
|
-
if (
|
|
4015
|
-
let e =
|
|
4223
|
+
let u = n === "width" ? a.width : a.height;
|
|
4224
|
+
if (u) {
|
|
4225
|
+
if (u === "auto") return { kind: "auto" };
|
|
4226
|
+
let e = Gi(u);
|
|
4016
4227
|
if (e) return e;
|
|
4017
|
-
if (
|
|
4228
|
+
if (u.endsWith("%")) return {
|
|
4018
4229
|
kind: "percent",
|
|
4019
|
-
value: parseFloat(
|
|
4230
|
+
value: parseFloat(u)
|
|
4020
4231
|
};
|
|
4021
|
-
let t = parseFloat(
|
|
4232
|
+
let t = parseFloat(u);
|
|
4022
4233
|
if (Number.isFinite(t)) return {
|
|
4023
4234
|
kind: "cells",
|
|
4024
|
-
value:
|
|
4235
|
+
value: P(t, r)
|
|
4025
4236
|
};
|
|
4026
4237
|
}
|
|
4027
|
-
let
|
|
4028
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4029
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4030
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4031
|
-
let
|
|
4032
|
-
if (
|
|
4238
|
+
let d = n === "width" ? "w" : "h";
|
|
4239
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-min\\b`).test(i)) return { kind: "min-content" };
|
|
4240
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-max\\b`).test(i)) return { kind: "max-content" };
|
|
4241
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-fit\\b`).test(i)) return { kind: "fit-content" };
|
|
4242
|
+
let f = RegExp(`(?:^|[\\s:.[!])${d}-(\\d+)/(\\d+)(?![\\w./])`).exec(i);
|
|
4243
|
+
if (f) return {
|
|
4033
4244
|
kind: "percent",
|
|
4034
|
-
value: 100 * Number(
|
|
4245
|
+
value: 100 * Number(f[1]) / Number(f[2])
|
|
4035
4246
|
};
|
|
4036
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
4247
|
+
if (RegExp(`(?:^|[\\s:.[!])${d}-full(?![\\w-])`).test(i)) return {
|
|
4037
4248
|
kind: "percent",
|
|
4038
4249
|
value: 100
|
|
4039
4250
|
};
|
|
4040
|
-
let
|
|
4041
|
-
if (
|
|
4251
|
+
let p = RegExp(`(?:^|[\\s:.[!])${d}-\\[(\\d+(?:\\.\\d+)?)%\\]`).exec(i);
|
|
4252
|
+
if (p) return {
|
|
4042
4253
|
kind: "percent",
|
|
4043
|
-
value: Number(
|
|
4254
|
+
value: Number(p[1])
|
|
4044
4255
|
};
|
|
4045
|
-
let
|
|
4046
|
-
if (
|
|
4256
|
+
let m = RegExp(`(?:^|[\\s:.[!])${d}-(\\d+(?:\\.\\d+)?)(?![\\w-/])`).exec(i);
|
|
4257
|
+
if (m) return {
|
|
4047
4258
|
kind: "cells",
|
|
4048
|
-
value:
|
|
4259
|
+
value: N(Number(m[1]))
|
|
4049
4260
|
};
|
|
4050
|
-
if (!
|
|
4261
|
+
if (!ra(i, d) || t === "auto") return { kind: "auto" };
|
|
4051
4262
|
if (t.endsWith("%")) return {
|
|
4052
4263
|
kind: "percent",
|
|
4053
4264
|
value: parseFloat(t)
|
|
4054
4265
|
};
|
|
4055
|
-
let
|
|
4056
|
-
if (Number.isFinite(
|
|
4266
|
+
let h = parseFloat(t);
|
|
4267
|
+
if (Number.isFinite(h)) return {
|
|
4057
4268
|
kind: "cells",
|
|
4058
|
-
value:
|
|
4269
|
+
value: P(h, r)
|
|
4059
4270
|
};
|
|
4060
4271
|
}
|
|
4061
|
-
function
|
|
4272
|
+
function Ri(e) {
|
|
4062
4273
|
let t = /^(-?[\d.]+)((?:[dsl]?v)(?:h|w|min|max)|vi|vb)$/.exec(e.trim());
|
|
4063
4274
|
if (!t || typeof window > "u") return null;
|
|
4064
4275
|
let n = parseFloat(t[1]);
|
|
@@ -4066,7 +4277,7 @@ function fi(e) {
|
|
|
4066
4277
|
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;
|
|
4067
4278
|
return n / 100 * o;
|
|
4068
4279
|
}
|
|
4069
|
-
function
|
|
4280
|
+
function zi(e, t) {
|
|
4070
4281
|
if (typeof window > "u") return null;
|
|
4071
4282
|
let n = RegExp(`(?:^|[\\s:.[!])${t}-(screen|[dsl]v[hw])(?![\\w-])`).exec(e);
|
|
4072
4283
|
if (n) {
|
|
@@ -4074,23 +4285,117 @@ function pi(e, t) {
|
|
|
4074
4285
|
return e === "screen" ? t.includes("h") ? window.innerHeight : window.innerWidth : e.endsWith("h") ? window.innerHeight : window.innerWidth;
|
|
4075
4286
|
}
|
|
4076
4287
|
let r = RegExp(`(?:^|[\\s:.[!])${t}-\\[(-?[\\d.]+(?:[dsl]?v(?:h|w|min|max)|vi|vb))\\]`).exec(e);
|
|
4077
|
-
return r ?
|
|
4288
|
+
return r ? Ri(r[1]) : null;
|
|
4078
4289
|
}
|
|
4079
|
-
function
|
|
4290
|
+
function Bi(e, t, n, r) {
|
|
4080
4291
|
let i = t === "width" ? n?.width : n?.height;
|
|
4081
|
-
return i && i > 0 ? Math.max(0, Math.floor(e / i)) :
|
|
4292
|
+
return i && i > 0 ? Math.max(0, Math.floor(e / i)) : P(e, r);
|
|
4293
|
+
}
|
|
4294
|
+
function Vi(e, t, n, r, i, a, o, s) {
|
|
4295
|
+
let c = t.endsWith("width") ? "width" : "height", l = a.getPropertyValue(t).trim(), u = l.startsWith("calc(");
|
|
4296
|
+
if (!u && !r.includes("-[calc(")) return;
|
|
4297
|
+
let d = RegExp(`(?:^|[\\s:.[!])${i}-\\[(calc\\([^\\]]*\\))\\]`).exec(r), f = u ? l : d?.[1]?.replaceAll("_", " ");
|
|
4298
|
+
if (!f) return;
|
|
4299
|
+
let p = Hi(f, c, o, s);
|
|
4300
|
+
if (!p || p.unitless) return;
|
|
4301
|
+
let m = Math.max(0, N(p.cells));
|
|
4302
|
+
if (u) return m;
|
|
4303
|
+
let h = (e ? String(e.get(t) ?? "") : n).trim(), g = parseFloat(h);
|
|
4304
|
+
return (Number.isFinite(g) ? Math.abs(g - p.px) <= Math.abs(p.px) * .3 : h === "") ? m : void 0;
|
|
4305
|
+
}
|
|
4306
|
+
function Hi(e, t, n, r) {
|
|
4307
|
+
let i = e.match(/--spacing\(\s*-?[\d.]+\s*\)|calc|[\d.]+[a-z%]*|[()+\-*/]/g);
|
|
4308
|
+
if (!i || i.join("").replace(/\s+/g, "") !== e.replace(/\s+/g, "")) return null;
|
|
4309
|
+
let a = 0, o = () => i[a], s = () => i[a++], c = (e, t) => ({
|
|
4310
|
+
cells: e,
|
|
4311
|
+
px: t,
|
|
4312
|
+
unitless: !1
|
|
4313
|
+
}), l = (e) => {
|
|
4314
|
+
let i = /^--spacing\(\s*(-?[\d.]+)\s*\)$/.exec(e);
|
|
4315
|
+
if (i) {
|
|
4316
|
+
let e = parseFloat(i[1]);
|
|
4317
|
+
return c(e, e * r / 4);
|
|
4318
|
+
}
|
|
4319
|
+
let a = /^([\d.]+)([a-z%]*)$/.exec(e);
|
|
4320
|
+
if (!a) return null;
|
|
4321
|
+
let o = parseFloat(a[1]), s = a[2];
|
|
4322
|
+
if (!Number.isFinite(o)) return null;
|
|
4323
|
+
if (s === "") return {
|
|
4324
|
+
cells: o,
|
|
4325
|
+
px: o,
|
|
4326
|
+
unitless: !0
|
|
4327
|
+
};
|
|
4328
|
+
if (s === "px") return c(o / (r / 4), o);
|
|
4329
|
+
if (s === "rem") return c(o * 4, o * r);
|
|
4330
|
+
let l = Ri(e);
|
|
4331
|
+
return l === null ? null : c(Bi(l, t, n, r), l);
|
|
4332
|
+
}, u = (e, t, n) => {
|
|
4333
|
+
if (e === "+" || e === "-") {
|
|
4334
|
+
if (t.unitless !== n.unitless) return null;
|
|
4335
|
+
let r = e === "+" ? 1 : -1;
|
|
4336
|
+
return {
|
|
4337
|
+
cells: t.cells + r * n.cells,
|
|
4338
|
+
px: t.px + r * n.px,
|
|
4339
|
+
unitless: t.unitless
|
|
4340
|
+
};
|
|
4341
|
+
}
|
|
4342
|
+
if (e === "*") {
|
|
4343
|
+
if (!t.unitless && !n.unitless) return null;
|
|
4344
|
+
let [e, r] = t.unitless ? [t, n] : [n, t];
|
|
4345
|
+
return {
|
|
4346
|
+
cells: r.cells * e.cells,
|
|
4347
|
+
px: r.px * e.px,
|
|
4348
|
+
unitless: r.unitless && e.unitless
|
|
4349
|
+
};
|
|
4350
|
+
}
|
|
4351
|
+
return !n.unitless || n.px === 0 ? null : {
|
|
4352
|
+
cells: t.cells / n.cells,
|
|
4353
|
+
px: t.px / n.px,
|
|
4354
|
+
unitless: t.unitless
|
|
4355
|
+
};
|
|
4356
|
+
}, d = () => {
|
|
4357
|
+
let e = s();
|
|
4358
|
+
if (e === void 0) return null;
|
|
4359
|
+
if (e === "-") {
|
|
4360
|
+
let e = d();
|
|
4361
|
+
return e && {
|
|
4362
|
+
cells: -e.cells,
|
|
4363
|
+
px: -e.px,
|
|
4364
|
+
unitless: e.unitless
|
|
4365
|
+
};
|
|
4366
|
+
}
|
|
4367
|
+
return e === "calc" ? s() === "(" ? f() : null : e === "(" ? f() : l(e);
|
|
4368
|
+
}, f = () => {
|
|
4369
|
+
let e = m();
|
|
4370
|
+
return s() === ")" ? e : null;
|
|
4371
|
+
}, p = () => {
|
|
4372
|
+
let e = d();
|
|
4373
|
+
for (; e && (o() === "*" || o() === "/");) {
|
|
4374
|
+
let t = s(), n = d();
|
|
4375
|
+
e = n ? u(t, e, n) : null;
|
|
4376
|
+
}
|
|
4377
|
+
return e;
|
|
4378
|
+
}, m = () => {
|
|
4379
|
+
let e = p();
|
|
4380
|
+
for (; e && (o() === "+" || o() === "-");) {
|
|
4381
|
+
let t = s(), n = p();
|
|
4382
|
+
e = n ? u(t, e, n) : null;
|
|
4383
|
+
}
|
|
4384
|
+
return e;
|
|
4385
|
+
}, h = m();
|
|
4386
|
+
return a === i.length ? h : null;
|
|
4082
4387
|
}
|
|
4083
|
-
function
|
|
4084
|
-
let c = t.endsWith("width") ? "width" : "height", l =
|
|
4085
|
-
if (l !== null) return
|
|
4086
|
-
let u =
|
|
4388
|
+
function Ui(e, t, n, r, i, a, o, s) {
|
|
4389
|
+
let c = t.endsWith("width") ? "width" : "height", l = Ri(a.getPropertyValue(t)) ?? Ri(e?.get(t)?.toString().trim() ?? "");
|
|
4390
|
+
if (l !== null) return Bi(l, c, o, s);
|
|
4391
|
+
let u = zi(r, i);
|
|
4087
4392
|
if (u === null) return;
|
|
4088
|
-
let d =
|
|
4089
|
-
if (
|
|
4393
|
+
let d = (e ? String(e.get(t) ?? "") : n).trim(), f = parseFloat(d), p = Number.isFinite(f) && Math.abs(f - u) <= u * .3;
|
|
4394
|
+
if (p || d === "") return Bi(p ? f : u, c, o, s);
|
|
4090
4395
|
}
|
|
4091
|
-
function
|
|
4396
|
+
function Wi(e, t) {
|
|
4092
4397
|
if (!e || e === "auto" || e === "content") return;
|
|
4093
|
-
let n =
|
|
4398
|
+
let n = Gi(e);
|
|
4094
4399
|
if (n) return n;
|
|
4095
4400
|
if (e.endsWith("%")) {
|
|
4096
4401
|
let t = parseFloat(e);
|
|
@@ -4102,30 +4407,30 @@ function gi(e, t) {
|
|
|
4102
4407
|
let r = parseFloat(e);
|
|
4103
4408
|
return Number.isFinite(r) ? {
|
|
4104
4409
|
kind: "cells",
|
|
4105
|
-
value:
|
|
4410
|
+
value: P(r, t)
|
|
4106
4411
|
} : void 0;
|
|
4107
4412
|
}
|
|
4108
|
-
function
|
|
4413
|
+
function Gi(e) {
|
|
4109
4414
|
if (e === "min-content") return { kind: "min-content" };
|
|
4110
4415
|
if (e === "max-content") return { kind: "max-content" };
|
|
4111
4416
|
if (e === "fit-content") return { kind: "fit-content" };
|
|
4112
4417
|
}
|
|
4113
|
-
function
|
|
4418
|
+
function Ki(e, t) {
|
|
4114
4419
|
let n = e.trim();
|
|
4115
4420
|
if (!n || n === "none") return { kind: "none" };
|
|
4116
4421
|
if (n === "subgrid" || n.startsWith("subgrid ")) return { kind: "subgrid" };
|
|
4117
4422
|
let r = [], i = [], a = [], o = (e) => {
|
|
4118
4423
|
i.push(a), a = [], r.push(e);
|
|
4119
4424
|
}, s;
|
|
4120
|
-
for (let e of
|
|
4121
|
-
let n =
|
|
4425
|
+
for (let e of ea(n)) {
|
|
4426
|
+
let n = Ji(e);
|
|
4122
4427
|
if (n) {
|
|
4123
4428
|
a.push(...n);
|
|
4124
4429
|
continue;
|
|
4125
4430
|
}
|
|
4126
4431
|
let i = e.match(/^repeat\(\s*([^,]+?)\s*,(.*)\)$/s);
|
|
4127
4432
|
if (i) {
|
|
4128
|
-
let e =
|
|
4433
|
+
let e = qi(i[2].trim(), t);
|
|
4129
4434
|
if (e.tracks.length === 0) continue;
|
|
4130
4435
|
let n = i[1];
|
|
4131
4436
|
if (n === "auto-fill" || n === "auto-fit") {
|
|
@@ -4143,7 +4448,7 @@ function vi(e, t) {
|
|
|
4143
4448
|
}
|
|
4144
4449
|
continue;
|
|
4145
4450
|
}
|
|
4146
|
-
o(
|
|
4451
|
+
o(Zi(e, t));
|
|
4147
4452
|
}
|
|
4148
4453
|
if (i.push(a), r.length === 0 && !s) return { kind: "none" };
|
|
4149
4454
|
let c = {
|
|
@@ -4152,26 +4457,26 @@ function vi(e, t) {
|
|
|
4152
4457
|
};
|
|
4153
4458
|
return i.some((e) => e.length > 0) && (c.lineNames = i), s && (c.autoRepeat = s), c;
|
|
4154
4459
|
}
|
|
4155
|
-
function
|
|
4460
|
+
function qi(e, t) {
|
|
4156
4461
|
let n = [], r = [], i = [];
|
|
4157
|
-
for (let a of
|
|
4158
|
-
let e =
|
|
4462
|
+
for (let a of ea(e)) {
|
|
4463
|
+
let e = Ji(a);
|
|
4159
4464
|
if (e) {
|
|
4160
4465
|
i.push(...e);
|
|
4161
4466
|
continue;
|
|
4162
4467
|
}
|
|
4163
|
-
r.push(i), i = [], n.push(
|
|
4468
|
+
r.push(i), i = [], n.push(Zi(a, t));
|
|
4164
4469
|
}
|
|
4165
4470
|
return r.push(i), {
|
|
4166
4471
|
tracks: n,
|
|
4167
4472
|
lineNames: r
|
|
4168
4473
|
};
|
|
4169
4474
|
}
|
|
4170
|
-
function
|
|
4475
|
+
function Ji(e) {
|
|
4171
4476
|
let t = e.match(/^\[(.*)\]$/s);
|
|
4172
4477
|
return t ? t[1].split(/\s+/).filter((e) => e !== "") : null;
|
|
4173
4478
|
}
|
|
4174
|
-
function
|
|
4479
|
+
function Yi(e) {
|
|
4175
4480
|
let t = [];
|
|
4176
4481
|
for (let n of e.matchAll(/"([^"]*)"|'([^']*)'/g)) {
|
|
4177
4482
|
let e = (n[1] ?? n[2] ?? "").trim().split(/\s+/).filter((e) => e !== "");
|
|
@@ -4201,23 +4506,23 @@ function xi(e) {
|
|
|
4201
4506
|
areas: r
|
|
4202
4507
|
};
|
|
4203
4508
|
}
|
|
4204
|
-
function
|
|
4205
|
-
let n =
|
|
4206
|
-
return n.length > 0 ? n : [
|
|
4509
|
+
function Xi(e, t) {
|
|
4510
|
+
let n = ea(e.trim()).filter((e) => e !== "" && !e.startsWith("[")).map((e) => Zi(e, t));
|
|
4511
|
+
return n.length > 0 ? n : [ot()];
|
|
4207
4512
|
}
|
|
4208
|
-
function
|
|
4513
|
+
function Zi(e, t) {
|
|
4209
4514
|
let n = e.match(/^minmax\((.*)\)$/s);
|
|
4210
4515
|
if (n) {
|
|
4211
|
-
let e =
|
|
4516
|
+
let e = $i(n[1]).map((e) => e.trim());
|
|
4212
4517
|
return e.length === 2 ? {
|
|
4213
|
-
min:
|
|
4214
|
-
max:
|
|
4518
|
+
min: Qi(e[0], t),
|
|
4519
|
+
max: Qi(e[1], t)
|
|
4215
4520
|
} : {
|
|
4216
4521
|
min: { kind: "auto" },
|
|
4217
4522
|
max: { kind: "auto" }
|
|
4218
4523
|
};
|
|
4219
4524
|
}
|
|
4220
|
-
let r =
|
|
4525
|
+
let r = Qi(e, t);
|
|
4221
4526
|
return r.kind === "fr" ? {
|
|
4222
4527
|
min: { kind: "auto" },
|
|
4223
4528
|
max: r
|
|
@@ -4226,13 +4531,13 @@ function Ci(e, t) {
|
|
|
4226
4531
|
max: r
|
|
4227
4532
|
};
|
|
4228
4533
|
}
|
|
4229
|
-
function
|
|
4534
|
+
function Qi(e, t) {
|
|
4230
4535
|
if (e === "auto" || e.startsWith("fit-content")) return { kind: "auto" };
|
|
4231
4536
|
if (e === "min-content") return { kind: "min-content" };
|
|
4232
4537
|
if (e === "max-content") return { kind: "max-content" };
|
|
4233
4538
|
let n = e.match(/^(min|max)\((.*)\)$/s);
|
|
4234
4539
|
if (n) {
|
|
4235
|
-
let e =
|
|
4540
|
+
let e = $i(n[2]).map((e) => Qi(e.trim(), t)), r = e.every((e) => e.kind === "cells" || e.kind === "percent" || e.kind === "math");
|
|
4236
4541
|
return e.length > 0 && r ? {
|
|
4237
4542
|
kind: "math",
|
|
4238
4543
|
fn: n[1],
|
|
@@ -4256,10 +4561,10 @@ function wi(e, t) {
|
|
|
4256
4561
|
let r = parseFloat(e);
|
|
4257
4562
|
return Number.isFinite(r) ? {
|
|
4258
4563
|
kind: "cells",
|
|
4259
|
-
value: e.endsWith("rem") ?
|
|
4564
|
+
value: e.endsWith("rem") ? N(r / .25) : P(r, t)
|
|
4260
4565
|
} : { kind: "auto" };
|
|
4261
4566
|
}
|
|
4262
|
-
function
|
|
4567
|
+
function $i(e) {
|
|
4263
4568
|
let t = [], n = 0, r = 0;
|
|
4264
4569
|
for (let i = 0; i < e.length; i++) {
|
|
4265
4570
|
let a = e[i];
|
|
@@ -4267,7 +4572,7 @@ function Ti(e) {
|
|
|
4267
4572
|
}
|
|
4268
4573
|
return t.push(e.slice(r)), t.filter((e) => e.trim() !== "");
|
|
4269
4574
|
}
|
|
4270
|
-
function
|
|
4575
|
+
function ea(e) {
|
|
4271
4576
|
let t = [], n = 0, r = -1;
|
|
4272
4577
|
for (let i = 0; i < e.length; i++) {
|
|
4273
4578
|
let a = e[i];
|
|
@@ -4275,7 +4580,7 @@ function Ei(e) {
|
|
|
4275
4580
|
}
|
|
4276
4581
|
return r !== -1 && t.push(e.slice(r)), t;
|
|
4277
4582
|
}
|
|
4278
|
-
function
|
|
4583
|
+
function ta(e) {
|
|
4279
4584
|
let t = e.trim();
|
|
4280
4585
|
if (!t || t === "auto") return { kind: "auto" };
|
|
4281
4586
|
let n = !1, r, i;
|
|
@@ -4303,25 +4608,25 @@ function Di(e) {
|
|
|
4303
4608
|
nth: r
|
|
4304
4609
|
};
|
|
4305
4610
|
}
|
|
4306
|
-
function
|
|
4611
|
+
function na(e) {
|
|
4307
4612
|
return {
|
|
4308
4613
|
direction: e.includes("column") ? "column" : "row",
|
|
4309
4614
|
dense: e.includes("dense")
|
|
4310
4615
|
};
|
|
4311
4616
|
}
|
|
4312
|
-
function
|
|
4617
|
+
function ra(e, t) {
|
|
4313
4618
|
return (t === "w" ? /(?:^|[\s:.[!])w-/ : /(?:^|[\s:.[!])h-/).test(e);
|
|
4314
4619
|
}
|
|
4315
|
-
function
|
|
4620
|
+
function ia(e, t) {
|
|
4316
4621
|
return {
|
|
4317
|
-
top:
|
|
4318
|
-
right:
|
|
4319
|
-
bottom:
|
|
4320
|
-
left:
|
|
4622
|
+
top: Q(e.getPropertyValue("padding-top"), t),
|
|
4623
|
+
right: Q(e.getPropertyValue("padding-right"), t),
|
|
4624
|
+
bottom: Q(e.getPropertyValue("padding-bottom"), t),
|
|
4625
|
+
left: Q(e.getPropertyValue("padding-left"), t)
|
|
4321
4626
|
};
|
|
4322
4627
|
}
|
|
4323
|
-
function
|
|
4324
|
-
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 :
|
|
4628
|
+
function aa(e) {
|
|
4629
|
+
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 : N(parseFloat(e.getPropertyValue(t)) || 0);
|
|
4325
4630
|
return {
|
|
4326
4631
|
top: t("border-top-width", "border-top-style"),
|
|
4327
4632
|
right: t("border-right-width", "border-right-style"),
|
|
@@ -4331,14 +4636,14 @@ function ji(e) {
|
|
|
4331
4636
|
}
|
|
4332
4637
|
//#endregion
|
|
4333
4638
|
//#region src/tree.ts
|
|
4334
|
-
function
|
|
4335
|
-
let i =
|
|
4639
|
+
function oa(e, t, n, r) {
|
|
4640
|
+
let i = ni(e, t, n);
|
|
4336
4641
|
if (i.display === "none") return null;
|
|
4337
|
-
let a =
|
|
4338
|
-
if (a) return
|
|
4339
|
-
let o = Array.from(e.children), s = o.map(
|
|
4642
|
+
let a = oe(e.tagName);
|
|
4643
|
+
if (a) return sa(e, i, a);
|
|
4644
|
+
let o = Array.from(e.children), s = o.map(fa), c = e.tagName, l = wa(c);
|
|
4340
4645
|
if (!s.includes("block") || l) {
|
|
4341
|
-
let a =
|
|
4646
|
+
let a = pa(e, i.tracking, {
|
|
4342
4647
|
rootFontSizePx: t,
|
|
4343
4648
|
rootLetterSpacingPx: n?.letterSpacing ?? 0,
|
|
4344
4649
|
cellMetrics: n,
|
|
@@ -4348,11 +4653,11 @@ function Mi(e, t, n, r) {
|
|
|
4348
4653
|
}), u = a.chars.join("");
|
|
4349
4654
|
if (a.boxes.length > 0) {
|
|
4350
4655
|
let e = Ln();
|
|
4351
|
-
|
|
4352
|
-
a.advances[t] = Math.max(1,
|
|
4656
|
+
Pe(a.chars, (t, n) => {
|
|
4657
|
+
a.advances[t] = Math.max(1, K(a.boxes[n], e));
|
|
4353
4658
|
});
|
|
4354
4659
|
}
|
|
4355
|
-
let d =
|
|
4660
|
+
let d = ya(u, a.advances, i.tracking);
|
|
4356
4661
|
if (l && d === 0) {
|
|
4357
4662
|
if (c === "INPUT") d = Number(e.size) || 20;
|
|
4358
4663
|
else if (c === "TEXTAREA") d = Number(e.cols) || 20;
|
|
@@ -4361,9 +4666,9 @@ function Mi(e, t, n, r) {
|
|
|
4361
4666
|
d = Math.max(1, ...r.map((e) => e.trim().length));
|
|
4362
4667
|
}
|
|
4363
4668
|
}
|
|
4364
|
-
let f = u.length > 0 ?
|
|
4669
|
+
let f = u.length > 0 ? ba(u) : 0, p;
|
|
4365
4670
|
if (c === "TEXTAREA") {
|
|
4366
|
-
let t = e, n = t.value ?? "", a = r?.get(t), o = +!!n.endsWith("\n"), s = a !== void 0 && a > 0 ?
|
|
4671
|
+
let t = e, n = t.value ?? "", a = r?.get(t), o = +!!n.endsWith("\n"), s = a !== void 0 && a > 0 ? De(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);
|
|
4367
4672
|
p = l + Math.max(0, l - 1) * i.lineGap;
|
|
4368
4673
|
} else p = l ? Math.max(1, f) : f;
|
|
4369
4674
|
let m = /* @__PURE__ */ new Map(), h = [];
|
|
@@ -4373,11 +4678,11 @@ function Mi(e, t, n, r) {
|
|
|
4373
4678
|
let i = o[e], a = m.get(i);
|
|
4374
4679
|
if (a) g.push(a);
|
|
4375
4680
|
else if (s[e] === "out-of-flow") {
|
|
4376
|
-
let e =
|
|
4681
|
+
let e = oa(i, t, n, r);
|
|
4377
4682
|
e && g.push(e);
|
|
4378
4683
|
}
|
|
4379
4684
|
}
|
|
4380
|
-
g.push(...h);
|
|
4685
|
+
h.length > 0 && (g.push(...h), g.sort((e, t) => e.source.compareDocumentPosition(t.source) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1));
|
|
4381
4686
|
let _ = {
|
|
4382
4687
|
source: e,
|
|
4383
4688
|
style: i,
|
|
@@ -4392,14 +4697,16 @@ function Mi(e, t, n, r) {
|
|
|
4392
4697
|
height: p
|
|
4393
4698
|
},
|
|
4394
4699
|
unclampedHeight: 0,
|
|
4395
|
-
resolvedPadding:
|
|
4700
|
+
resolvedPadding: R()
|
|
4396
4701
|
};
|
|
4397
|
-
|
|
4702
|
+
(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));
|
|
4703
|
+
let v = va(a);
|
|
4704
|
+
return v.length > 0 && (_.charSource = v), _;
|
|
4398
4705
|
}
|
|
4399
4706
|
let u = [];
|
|
4400
4707
|
for (let e = 0; e < o.length; e++) {
|
|
4401
4708
|
if (s[e] === "none") continue;
|
|
4402
|
-
let i =
|
|
4709
|
+
let i = oa(o[e], t, n, r);
|
|
4403
4710
|
i && u.push(i);
|
|
4404
4711
|
}
|
|
4405
4712
|
let d = {
|
|
@@ -4416,14 +4723,14 @@ function Mi(e, t, n, r) {
|
|
|
4416
4723
|
height: 0
|
|
4417
4724
|
},
|
|
4418
4725
|
unclampedHeight: 0,
|
|
4419
|
-
resolvedPadding:
|
|
4726
|
+
resolvedPadding: R()
|
|
4420
4727
|
};
|
|
4421
|
-
return
|
|
4728
|
+
return Ta(e, d), d;
|
|
4422
4729
|
}
|
|
4423
|
-
function
|
|
4424
|
-
let r =
|
|
4730
|
+
function sa(e, t, n) {
|
|
4731
|
+
let r = le(n, e), i = r?.lines ?? [], a = i.join("\n");
|
|
4425
4732
|
t.whiteSpace = "pre", (t.width === void 0 || t.width.kind === "auto") && (t.width = { kind: "max-content" });
|
|
4426
|
-
let o = Array.from({ length: a.length }, () => 1 + t.tracking), s =
|
|
4733
|
+
let o = Array.from({ length: a.length }, () => 1 + t.tracking), s = ya(a, o, t.tracking), c = i.length, l = {
|
|
4427
4734
|
source: e,
|
|
4428
4735
|
style: t,
|
|
4429
4736
|
children: [],
|
|
@@ -4437,7 +4744,7 @@ function Ni(e, t, n) {
|
|
|
4437
4744
|
height: c
|
|
4438
4745
|
},
|
|
4439
4746
|
unclampedHeight: 0,
|
|
4440
|
-
resolvedPadding:
|
|
4747
|
+
resolvedPadding: R()
|
|
4441
4748
|
};
|
|
4442
4749
|
t.tracking > 0 && (l.advances = o);
|
|
4443
4750
|
let u = r?.runs ?? [];
|
|
@@ -4465,95 +4772,111 @@ function Ni(e, t, n) {
|
|
|
4465
4772
|
}
|
|
4466
4773
|
return l;
|
|
4467
4774
|
}
|
|
4468
|
-
var
|
|
4469
|
-
function
|
|
4470
|
-
return t || (
|
|
4775
|
+
var ca = /* @__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("."));
|
|
4776
|
+
function la(e, t) {
|
|
4777
|
+
return t || (ca.has(e.tagName) ? "inline" : "block");
|
|
4471
4778
|
}
|
|
4472
|
-
function
|
|
4473
|
-
let n =
|
|
4779
|
+
function ua(e, t) {
|
|
4780
|
+
let n = la(e, t);
|
|
4474
4781
|
return n === "inline" || n === "contents";
|
|
4475
4782
|
}
|
|
4476
|
-
function
|
|
4477
|
-
let n =
|
|
4783
|
+
function da(e, t) {
|
|
4784
|
+
let n = la(e, t);
|
|
4478
4785
|
return n.startsWith("inline") && n !== "inline";
|
|
4479
4786
|
}
|
|
4480
|
-
function
|
|
4787
|
+
function fa(e) {
|
|
4481
4788
|
let t = getComputedStyle(e);
|
|
4482
|
-
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" :
|
|
4789
|
+
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" : oe(e.tagName) ? "block" : ua(e, t.display) || da(e, t.display) ? "inline" : "block";
|
|
4483
4790
|
}
|
|
4484
|
-
function
|
|
4791
|
+
function pa(e, t, n) {
|
|
4485
4792
|
let r = {
|
|
4486
4793
|
chars: [],
|
|
4487
4794
|
advances: [],
|
|
4795
|
+
sourceNode: [],
|
|
4796
|
+
sourceOffset: [],
|
|
4488
4797
|
inlineIndex: [],
|
|
4489
4798
|
inlineElements: [],
|
|
4490
4799
|
boxes: []
|
|
4491
4800
|
};
|
|
4492
|
-
return
|
|
4801
|
+
return ma(e, t, n, r), n.preserve ? r : _a(r);
|
|
4493
4802
|
}
|
|
4494
|
-
function
|
|
4803
|
+
function ma(e, t, n, r) {
|
|
4495
4804
|
let i = () => {
|
|
4496
4805
|
let e = 0;
|
|
4497
4806
|
for (let t = r.chars.length - 1; t >= 0 && r.chars[t] !== "\n"; t--) e += r.advances[t];
|
|
4498
4807
|
return e;
|
|
4499
4808
|
};
|
|
4500
|
-
if (!
|
|
4809
|
+
if (!wa(e.tagName)) {
|
|
4501
4810
|
for (let a of Array.from(e.childNodes)) if (a.nodeType === Node.TEXT_NODE) {
|
|
4502
|
-
if (n.preserve)
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4811
|
+
if (n.preserve) {
|
|
4812
|
+
let e = a.textContent ?? "", o = 0;
|
|
4813
|
+
for (let s of e) {
|
|
4814
|
+
let c = o;
|
|
4815
|
+
if (o += s.length, s === "\r") {
|
|
4816
|
+
if (e[o] === "\n") continue;
|
|
4817
|
+
$(r, "\n", 0, a, c);
|
|
4818
|
+
} else if (s === "\n") $(r, "\n", 0, a, c);
|
|
4819
|
+
else if (s === " ") {
|
|
4820
|
+
let e = (Math.floor(i() / n.tabSize) + 1) * n.tabSize;
|
|
4821
|
+
for (let t = i(); t < e; t++) $(r, " ", 1, a, c);
|
|
4822
|
+
} else $(r, s, 1 + t, a, c);
|
|
4823
|
+
}
|
|
4824
|
+
} else {
|
|
4825
|
+
let e = 0, n = !1;
|
|
4826
|
+
for (let i of a.textContent ?? "") {
|
|
4827
|
+
let o = i === " " || i === " " || i === "\r" || i === "\n" || i === "\f";
|
|
4828
|
+
o ? n || $(r, " ", 1 + t, a, e) : $(r, i, 1 + t, a, e), n = o, e += i.length;
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4508
4831
|
} else if (a.nodeType === Node.ELEMENT_NODE) {
|
|
4509
4832
|
let e = a;
|
|
4510
4833
|
if (e.tagName === "BR") {
|
|
4511
|
-
r
|
|
4834
|
+
$(r, "\n", 0, null, -1);
|
|
4512
4835
|
continue;
|
|
4513
4836
|
}
|
|
4514
4837
|
let t = getComputedStyle(e);
|
|
4515
4838
|
if (t.display === "none" || t.position === "absolute" || t.position === "fixed") continue;
|
|
4516
|
-
if (
|
|
4517
|
-
let t =
|
|
4518
|
-
t && (t.inlineBox = !0, r
|
|
4839
|
+
if (da(e, t.display)) {
|
|
4840
|
+
let t = oa(e, n.rootFontSizePx, n.cellMetrics, n.textareaWidths);
|
|
4841
|
+
t && (t.inlineBox = !0, $(r, "", 1, null, -1), r.boxes.push(t));
|
|
4519
4842
|
continue;
|
|
4520
4843
|
}
|
|
4521
|
-
if (!
|
|
4522
|
-
|
|
4844
|
+
if (!ua(e, t.display)) {
|
|
4845
|
+
xa(e);
|
|
4523
4846
|
continue;
|
|
4524
4847
|
}
|
|
4525
|
-
let i =
|
|
4848
|
+
let i = ki(t.letterSpacing, parseFloat(t.fontSize) || n.rootFontSizePx, n.rootLetterSpacingPx), o = ha(t.paddingLeft, n.rootFontSizePx), s = ha(t.paddingRight, n.rootFontSizePx);
|
|
4526
4849
|
r.inlineElements.push({
|
|
4527
4850
|
element: e,
|
|
4528
4851
|
tracking: i,
|
|
4529
4852
|
padLeft: o,
|
|
4530
4853
|
padRight: s,
|
|
4531
|
-
insets: t.position === "static" ? null :
|
|
4854
|
+
insets: t.position === "static" ? null : ga(t, n.rootFontSizePx),
|
|
4532
4855
|
color: t.color,
|
|
4533
|
-
backgroundColor:
|
|
4856
|
+
backgroundColor: ii(t.backgroundColor) ? void 0 : t.backgroundColor,
|
|
4534
4857
|
fontWeight: t.fontWeight,
|
|
4535
4858
|
fontStyle: t.fontStyle,
|
|
4536
4859
|
textDecorationLine: t.textDecorationLine
|
|
4537
4860
|
});
|
|
4538
4861
|
let c = r.inlineElements.length - 1;
|
|
4539
|
-
for (let e = 0; e < o; e++) r.inlineIndex[r.chars.length] = c, r
|
|
4862
|
+
for (let e = 0; e < o; e++) r.inlineIndex[r.chars.length] = c, $(r, "", 1, null, -1);
|
|
4540
4863
|
let l = r.chars.length;
|
|
4541
|
-
|
|
4864
|
+
ma(e, i, n, r);
|
|
4542
4865
|
for (let e = l; e < r.chars.length; e++) r.inlineIndex[e] === void 0 && (r.inlineIndex[e] = c);
|
|
4543
|
-
for (let e = 0; e < s; e++) r.inlineIndex[r.chars.length] = c, r
|
|
4866
|
+
for (let e = 0; e < s; e++) r.inlineIndex[r.chars.length] = c, $(r, "", 1, null, -1);
|
|
4544
4867
|
}
|
|
4545
4868
|
}
|
|
4546
4869
|
}
|
|
4547
|
-
function
|
|
4870
|
+
function ha(e, t) {
|
|
4548
4871
|
if (!e || e.endsWith("%")) return 0;
|
|
4549
4872
|
let n = parseFloat(e);
|
|
4550
|
-
return Number.isFinite(n) ? Math.max(0,
|
|
4873
|
+
return Number.isFinite(n) ? Math.max(0, P(n, t)) : 0;
|
|
4551
4874
|
}
|
|
4552
|
-
function
|
|
4875
|
+
function ga(e, t) {
|
|
4553
4876
|
let n = (e) => {
|
|
4554
4877
|
if (!e || e === "auto" || e.endsWith("%")) return null;
|
|
4555
4878
|
let n = parseFloat(e);
|
|
4556
|
-
return Number.isFinite(n) ?
|
|
4879
|
+
return Number.isFinite(n) ? P(n, t) : null;
|
|
4557
4880
|
};
|
|
4558
4881
|
return {
|
|
4559
4882
|
top: n(e.top),
|
|
@@ -4562,55 +4885,73 @@ function Hi(e, t) {
|
|
|
4562
4885
|
left: n(e.left)
|
|
4563
4886
|
};
|
|
4564
4887
|
}
|
|
4565
|
-
function
|
|
4566
|
-
let t = [], n = [], r = [], i = () => {
|
|
4888
|
+
function _a(e) {
|
|
4889
|
+
let t = [], n = [], r = [], i = [], a = [], o = () => {
|
|
4567
4890
|
let e = t.length;
|
|
4568
4891
|
for (; e > 0 && t[e - 1] !== "\n";) e--;
|
|
4569
4892
|
return e;
|
|
4570
|
-
},
|
|
4571
|
-
for (; t.length >
|
|
4893
|
+
}, s = () => {
|
|
4894
|
+
for (; t.length > o() && t[t.length - 1] === " ";) t.pop(), n.pop(), r.pop(), i.pop(), a.pop();
|
|
4572
4895
|
};
|
|
4573
|
-
for (let
|
|
4574
|
-
let
|
|
4575
|
-
if (
|
|
4896
|
+
for (let o = 0; o < e.chars.length; o++) {
|
|
4897
|
+
let c = e.chars[o];
|
|
4898
|
+
if (c === " ") {
|
|
4576
4899
|
let e = t.length - 1;
|
|
4577
4900
|
for (; e >= 0 && t[e] === "";) e--;
|
|
4578
4901
|
if (e < 0 || t[e] === "\n" || t[e] === " ") continue;
|
|
4579
|
-
} else
|
|
4580
|
-
t.push(
|
|
4902
|
+
} else c === "\n" && s();
|
|
4903
|
+
t.push(c), n.push(e.advances[o]), r.push(e.sourceNode[o] ?? null), i.push(e.sourceOffset[o] ?? -1), a.push(e.inlineIndex[o] ?? -1);
|
|
4581
4904
|
}
|
|
4582
|
-
return
|
|
4905
|
+
return s(), {
|
|
4583
4906
|
chars: t,
|
|
4584
4907
|
advances: n,
|
|
4585
|
-
|
|
4908
|
+
sourceNode: r,
|
|
4909
|
+
sourceOffset: i,
|
|
4910
|
+
inlineIndex: a,
|
|
4586
4911
|
inlineElements: e.inlineElements,
|
|
4587
4912
|
boxes: e.boxes
|
|
4588
4913
|
};
|
|
4589
4914
|
}
|
|
4590
|
-
function
|
|
4915
|
+
function $(e, t, n, r, i) {
|
|
4916
|
+
e.chars.push(t), e.advances.push(n), e.sourceNode.push(r), e.sourceOffset.push(i);
|
|
4917
|
+
}
|
|
4918
|
+
function va(e) {
|
|
4919
|
+
let t = [], n = 0;
|
|
4920
|
+
for (let r = 0; r < e.chars.length; r++) {
|
|
4921
|
+
let i = e.chars[r], a = e.sourceNode[r], o = e.sourceOffset[r], s = t[t.length - 1];
|
|
4922
|
+
a && (s && s.node === a && s.offset + s.length === o ? s.length += i.length : t.push({
|
|
4923
|
+
index: n,
|
|
4924
|
+
length: i.length,
|
|
4925
|
+
node: a,
|
|
4926
|
+
offset: o
|
|
4927
|
+
})), n += i.length;
|
|
4928
|
+
}
|
|
4929
|
+
return t;
|
|
4930
|
+
}
|
|
4931
|
+
function ya(e, t, n) {
|
|
4591
4932
|
let r = 0, i = 0;
|
|
4592
|
-
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r,
|
|
4933
|
+
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r, F(i, a, t, n)), i = a + 1);
|
|
4593
4934
|
return r;
|
|
4594
4935
|
}
|
|
4595
|
-
function
|
|
4596
|
-
return
|
|
4936
|
+
function ba(e) {
|
|
4937
|
+
return ke(e).length;
|
|
4597
4938
|
}
|
|
4598
|
-
function
|
|
4599
|
-
|
|
4939
|
+
function xa(e) {
|
|
4940
|
+
M(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.");
|
|
4600
4941
|
}
|
|
4601
|
-
function
|
|
4942
|
+
function Sa(e) {
|
|
4602
4943
|
return Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? ""));
|
|
4603
4944
|
}
|
|
4604
|
-
var
|
|
4605
|
-
function
|
|
4945
|
+
var Ca = "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>).";
|
|
4946
|
+
function wa(e) {
|
|
4606
4947
|
return e === "INPUT" || e === "SELECT" || e === "TEXTAREA";
|
|
4607
4948
|
}
|
|
4608
|
-
function
|
|
4609
|
-
|
|
4949
|
+
function Ta(e, t) {
|
|
4950
|
+
Sa(e) && (t.droppedText = !0, M(e, Ca));
|
|
4610
4951
|
}
|
|
4611
4952
|
//#endregion
|
|
4612
4953
|
//#region src/element.ts
|
|
4613
|
-
var
|
|
4954
|
+
var Ea = "\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 /* A live semantic selection (specs/semantic-selection.md) lifts the\n * lock so the element selection copies; pointer events stay off. */\n :host([select=\"grid\"][data-mw-semantic-selection]) slot { user-select: text; -webkit-user-select: text; }\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", Da = "grid", Oa = "data-mw-semantic-selection", ka = [
|
|
4614
4955
|
"pointerover",
|
|
4615
4956
|
"pointerleave",
|
|
4616
4957
|
"pointerdown",
|
|
@@ -4622,12 +4963,12 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4622
4963
|
"focusout",
|
|
4623
4964
|
"input",
|
|
4624
4965
|
"change"
|
|
4625
|
-
],
|
|
4966
|
+
], Aa = /^(color|opacity|border-(top|right|bottom|left)-color|border-color)$/, ja = 3e4, Ma = 200, Na = 3, Pa = 4, Fa = 8, Ia = 100, La = 160, Ra = typeof HTMLElement > "u" ? class {} : HTMLElement, za = class e extends Ra {
|
|
4626
4967
|
static observedAttributes = ["select"];
|
|
4627
4968
|
static #e = /* @__PURE__ */ new Set();
|
|
4628
4969
|
static #t = null;
|
|
4629
4970
|
static #n = () => {
|
|
4630
|
-
for (let t of e.#e) t.#
|
|
4971
|
+
for (let t of e.#e) t.#Ce();
|
|
4631
4972
|
};
|
|
4632
4973
|
static #r(t) {
|
|
4633
4974
|
t instanceof HTMLLinkElement && t.rel === "stylesheet" && !t.sheet && t.addEventListener("load", e.#n, { once: !0 });
|
|
@@ -4664,8 +5005,10 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4664
5005
|
#y = /* @__PURE__ */ new WeakMap();
|
|
4665
5006
|
#b = null;
|
|
4666
5007
|
#x = null;
|
|
4667
|
-
#S =
|
|
4668
|
-
#C
|
|
5008
|
+
#S = "";
|
|
5009
|
+
#C = null;
|
|
5010
|
+
#w = [];
|
|
5011
|
+
#T() {
|
|
4669
5012
|
this.#u?.observe(this, {
|
|
4670
5013
|
childList: !0,
|
|
4671
5014
|
subtree: !0,
|
|
@@ -4677,80 +5020,80 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4677
5020
|
"colspan",
|
|
4678
5021
|
"rowspan",
|
|
4679
5022
|
"span",
|
|
4680
|
-
...
|
|
5023
|
+
...se()
|
|
4681
5024
|
]
|
|
4682
5025
|
});
|
|
4683
5026
|
}
|
|
4684
5027
|
constructor() {
|
|
4685
|
-
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML =
|
|
5028
|
+
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML = Ea, 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);
|
|
4686
5029
|
}
|
|
4687
5030
|
connectedCallback() {
|
|
4688
|
-
this.hasAttribute("select") || this.setAttribute("select",
|
|
4689
|
-
this.#
|
|
4690
|
-
}), this.#h = C(() => this.#
|
|
5031
|
+
this.hasAttribute("select") || this.setAttribute("select", Da), this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#Ce()), this.#l.observe(this), this.#q(), this.#l.observe(this.#c), window.addEventListener("resize", this.#ye), this.#u = new MutationObserver(() => this.#Ce()), this.#T(), this.#m = ce(() => {
|
|
5032
|
+
this.#T(), this.#Ce();
|
|
5033
|
+
}), this.#h = C(() => this.#Ce()), document.fonts?.ready.then(this.#be).catch((e) => {
|
|
4691
5034
|
console.warn("[monowind] document.fonts.ready failed:", e);
|
|
4692
|
-
}), document.fonts?.addEventListener("loadingdone", this.#
|
|
4693
|
-
for (let e of
|
|
4694
|
-
this.addEventListener("transitionrun", this.#
|
|
5035
|
+
}), document.fonts?.addEventListener("loadingdone", this.#be);
|
|
5036
|
+
for (let e of ka) this.addEventListener(e, this.#ve);
|
|
5037
|
+
this.addEventListener("transitionrun", this.#he), this.addEventListener("transitionend", this.#ge), this.addEventListener("transitioncancel", this.#ge), this.addEventListener("pointermove", this.#X), this.addEventListener("pointerleave", this.#oe), this.addEventListener("pointerdown", this.#se), this.addEventListener("scroll", this.#H, {
|
|
4695
5038
|
capture: !0,
|
|
4696
5039
|
passive: !0
|
|
4697
|
-
}), this.addEventListener("scrollend", this.#
|
|
5040
|
+
}), this.addEventListener("scrollend", this.#U, { capture: !0 }), this.addEventListener("wheel", this.#G, { passive: !1 }), this.addEventListener("copy", this.#Z), this.addEventListener("mousedown", this.#Q), document.addEventListener("selectionchange", this.#ae), window.addEventListener("pointerup", this.#ce), window.addEventListener("pointercancel", this.#ce), document.addEventListener("scroll", this.#le, {
|
|
4698
5041
|
capture: !0,
|
|
4699
5042
|
passive: !0
|
|
4700
|
-
}), e.#i(this), this.#
|
|
5043
|
+
}), e.#i(this), this.#Ce();
|
|
4701
5044
|
}
|
|
4702
5045
|
disconnectedCallback() {
|
|
4703
|
-
window.removeEventListener("resize", this.#
|
|
4704
|
-
for (let e of
|
|
4705
|
-
this.removeEventListener("transitionrun", this.#
|
|
5046
|
+
window.removeEventListener("resize", this.#ye), 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.#be);
|
|
5047
|
+
for (let e of ka) this.removeEventListener(e, this.#ve);
|
|
5048
|
+
this.removeEventListener("transitionrun", this.#he), this.removeEventListener("transitionend", this.#ge), this.removeEventListener("transitioncancel", this.#ge), this.#fe = 0, this.removeEventListener("pointermove", this.#X), this.removeEventListener("pointerleave", this.#oe), this.removeEventListener("pointerdown", this.#se), this.removeEventListener("scroll", this.#H, { capture: !0 }), this.removeEventListener("scrollend", this.#U, { capture: !0 }), this.removeEventListener("wheel", this.#G), this.removeEventListener("copy", this.#Z), this.removeEventListener("mousedown", this.#Q), document.removeEventListener("selectionchange", this.#ae);
|
|
4706
5049
|
for (let e of this.#v.values()) clearTimeout(e);
|
|
4707
|
-
this.#v.clear(), this.#x = null, this.#b = null, window.removeEventListener("pointerup", this.#
|
|
4708
|
-
}
|
|
4709
|
-
#
|
|
4710
|
-
#
|
|
4711
|
-
#
|
|
4712
|
-
#
|
|
4713
|
-
#
|
|
4714
|
-
#
|
|
4715
|
-
#
|
|
4716
|
-
#
|
|
4717
|
-
#
|
|
4718
|
-
static #
|
|
4719
|
-
#
|
|
5050
|
+
this.#v.clear(), this.#x = null, this.#b = null, window.removeEventListener("pointerup", this.#ce), window.removeEventListener("pointercancel", this.#ce), document.removeEventListener("scroll", this.#le, { capture: !0 }), this.#j = null, this.#O = null, this.#k = !1, this.#A = !1, this.#ue(), e.#a(this);
|
|
5051
|
+
}
|
|
5052
|
+
#E = /* @__PURE__ */ new Set();
|
|
5053
|
+
#D = /* @__PURE__ */ new Set();
|
|
5054
|
+
#O = null;
|
|
5055
|
+
#k = !1;
|
|
5056
|
+
#A = !1;
|
|
5057
|
+
#j = null;
|
|
5058
|
+
#M = NaN;
|
|
5059
|
+
#N = NaN;
|
|
5060
|
+
#P = null;
|
|
5061
|
+
static #F = typeof matchMedia > "u" ? null : matchMedia("(hover: hover)");
|
|
5062
|
+
#I() {
|
|
4720
5063
|
if (this.#g || this.#d) return;
|
|
4721
5064
|
this.#g = !0;
|
|
4722
5065
|
let e = !1, t = () => {
|
|
4723
5066
|
if (e) return;
|
|
4724
5067
|
e = !0, this.#g = !1;
|
|
4725
5068
|
let t = this.#f;
|
|
4726
|
-
|
|
5069
|
+
this.isConnected && this.#p && t && (this.#L(t), this.#A = !Ur(this.#p, this.#s, this.#k), this.#ue());
|
|
4727
5070
|
};
|
|
4728
5071
|
requestAnimationFrame(t), setTimeout(t, 50);
|
|
4729
5072
|
}
|
|
4730
|
-
#
|
|
5073
|
+
#L(e, t) {
|
|
4731
5074
|
for (let n of this.#_) {
|
|
4732
5075
|
let r = n.source, { maxX: i, maxY: a } = n.scrollRange, o = t?.get(r);
|
|
4733
5076
|
n.scroll = o ? {
|
|
4734
5077
|
x: o.pinX ? i : Math.min(o.x, i),
|
|
4735
5078
|
y: o.pinY ? a : Math.min(o.y, a)
|
|
4736
|
-
} : this.#
|
|
5079
|
+
} : this.#R(n, e);
|
|
4737
5080
|
}
|
|
4738
5081
|
}
|
|
4739
|
-
#
|
|
5082
|
+
#R(e, t) {
|
|
4740
5083
|
let n = e.source, { maxX: r, maxY: i } = e.scrollRange, a = e.scroll ?? {
|
|
4741
5084
|
x: 0,
|
|
4742
5085
|
y: 0
|
|
4743
5086
|
};
|
|
4744
5087
|
return {
|
|
4745
|
-
x:
|
|
4746
|
-
y:
|
|
5088
|
+
x: Va(n, "x", t.width, r, a.x),
|
|
5089
|
+
y: Va(n, "y", t.height, i, a.y)
|
|
4747
5090
|
};
|
|
4748
5091
|
}
|
|
4749
|
-
#
|
|
5092
|
+
#z() {
|
|
4750
5093
|
let e = /* @__PURE__ */ new Map(), t = this.#f;
|
|
4751
5094
|
if (!t) return e;
|
|
4752
5095
|
for (let n of this.#_) {
|
|
4753
|
-
let r = n.source, { maxX: i, maxY: a } = n.scrollRange, { x: o, y: s } = this.#
|
|
5096
|
+
let r = n.source, { maxX: i, maxY: a } = n.scrollRange, { x: o, y: s } = this.#R(n, t);
|
|
4754
5097
|
e.set(r, {
|
|
4755
5098
|
top: r.scrollTop,
|
|
4756
5099
|
left: r.scrollLeft,
|
|
@@ -4762,42 +5105,42 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4762
5105
|
}
|
|
4763
5106
|
return e;
|
|
4764
5107
|
}
|
|
4765
|
-
#
|
|
5108
|
+
#B(e) {
|
|
4766
5109
|
for (let t of this.#_) {
|
|
4767
5110
|
let n = t.source, r = e.get(n);
|
|
4768
5111
|
r && (n.scrollTop, n.scrollLeft, n.scrollTop = r.pinY ? n.scrollHeight : r.top, n.scrollLeft = r.pinX ? n.scrollWidth : r.left);
|
|
4769
5112
|
}
|
|
4770
5113
|
}
|
|
4771
|
-
#
|
|
4772
|
-
clearTimeout(this.#v.get(e)), this.#v.set(e, setTimeout(() => this.#
|
|
5114
|
+
#V(e, t) {
|
|
5115
|
+
clearTimeout(this.#v.get(e)), this.#v.set(e, setTimeout(() => this.#W(e), t));
|
|
4773
5116
|
}
|
|
4774
|
-
#
|
|
5117
|
+
#H = (e) => {
|
|
4775
5118
|
let t = e.target;
|
|
4776
|
-
|
|
5119
|
+
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (this.#I(), !(Date.now() - (this.#y.get(t) ?? 0) < Ma) && (clearTimeout(this.#v.get(t)), "onscrollend" in window || this.#V(t, La)));
|
|
4777
5120
|
};
|
|
4778
|
-
#
|
|
5121
|
+
#U = (e) => {
|
|
4779
5122
|
let t = e.target;
|
|
4780
|
-
|
|
5123
|
+
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (Date.now() - (this.#y.get(t) ?? 0) < Ma || this.#V(t, Ia));
|
|
4781
5124
|
};
|
|
4782
|
-
#
|
|
5125
|
+
#W(e) {
|
|
4783
5126
|
if (this.#x?.el === e) return;
|
|
4784
|
-
this.#
|
|
5127
|
+
this.#I();
|
|
4785
5128
|
let t = this.#f, n = this.#_.find((t) => t.source === e);
|
|
4786
5129
|
if (!t || !n) return;
|
|
4787
|
-
let r = n.scrollRange, i = n.scroll ?? this.#
|
|
5130
|
+
let r = n.scrollRange, i = n.scroll ?? this.#R(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;
|
|
4788
5131
|
(Math.abs(e.scrollTop - a) > .5 || Math.abs(e.scrollLeft - o) > .5) && e.scrollTo({
|
|
4789
5132
|
top: a,
|
|
4790
5133
|
left: o,
|
|
4791
5134
|
behavior: "instant"
|
|
4792
5135
|
});
|
|
4793
5136
|
}
|
|
4794
|
-
#
|
|
5137
|
+
#G = (e) => {
|
|
4795
5138
|
if (this.getAttribute("select") !== "grid") return;
|
|
4796
5139
|
let t = this.#p, n = this.#f;
|
|
4797
5140
|
if (!t || !n || this.#_.length === 0) return;
|
|
4798
5141
|
let r = e, i = r.deltaMode === 1 ? n.height : r.deltaMode === 2 ? this.clientHeight : 1, a = r.deltaX * i, o = r.deltaY * i;
|
|
4799
|
-
if (!r.cancelable && this.#
|
|
4800
|
-
let { col: s, row: c } = this.#
|
|
5142
|
+
if (!r.cancelable && this.#K(a, o)) return;
|
|
5143
|
+
let { col: s, row: c } = this.#J(r.clientX, r.clientY, n), l = Date.now(), u = Math.abs(a) + Math.abs(o);
|
|
4801
5144
|
if (u === 0) {
|
|
4802
5145
|
this.#b = null, r.preventDefault();
|
|
4803
5146
|
return;
|
|
@@ -4805,13 +5148,13 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4805
5148
|
let d = (e) => {
|
|
4806
5149
|
let t = e.scrollRange, n = e.source;
|
|
4807
5150
|
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);
|
|
4808
|
-
}, 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) >
|
|
5151
|
+
}, 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) > Na || Math.abs(r.clientY - f.y) > Na), g = f !== null && f.decayed >= Fa, _ = f !== null && l - f.at < Ma && p === f.axis && (h ? u <= f.mag : !(g && m)), v = null;
|
|
4809
5152
|
if (_) {
|
|
4810
5153
|
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;
|
|
4811
5154
|
v = this.#_.find((e) => e.source === f.el) ?? null;
|
|
4812
5155
|
}
|
|
4813
5156
|
if (!v) {
|
|
4814
|
-
let e =
|
|
5157
|
+
let e = yr(t, s, c);
|
|
4815
5158
|
for (let t = e.length - 1; t >= 0; t--) {
|
|
4816
5159
|
let n = e[t].node;
|
|
4817
5160
|
if (!n.scrollRange) continue;
|
|
@@ -4825,7 +5168,7 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4825
5168
|
break;
|
|
4826
5169
|
}
|
|
4827
5170
|
}
|
|
4828
|
-
if (!v && u <
|
|
5171
|
+
if (!v && u < Pa) {
|
|
4829
5172
|
r.preventDefault();
|
|
4830
5173
|
return;
|
|
4831
5174
|
}
|
|
@@ -4841,126 +5184,238 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4841
5184
|
}
|
|
4842
5185
|
if (!v || (r.preventDefault(), !d(v))) return;
|
|
4843
5186
|
let y = v.source, b = v.scrollRange, x = { behavior: "instant" };
|
|
4844
|
-
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.#
|
|
5187
|
+
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.#V(y, Ma);
|
|
4845
5188
|
};
|
|
4846
|
-
#
|
|
4847
|
-
return this.#
|
|
5189
|
+
#K(e, t) {
|
|
5190
|
+
return this.#w.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);
|
|
4848
5191
|
}
|
|
4849
|
-
#
|
|
5192
|
+
#q() {
|
|
4850
5193
|
let e = this.parentElement;
|
|
4851
|
-
if (
|
|
5194
|
+
if (e && this.#l) {
|
|
4852
5195
|
this.#l.observe(e);
|
|
4853
5196
|
for (let t of e.children) t !== this && this.#l.observe(t);
|
|
4854
5197
|
}
|
|
4855
5198
|
}
|
|
4856
|
-
#
|
|
4857
|
-
if (!this.#
|
|
5199
|
+
#J(e, t, n) {
|
|
5200
|
+
if (!this.#P) {
|
|
4858
5201
|
let e = this.#s.getBoundingClientRect();
|
|
4859
|
-
this.#
|
|
5202
|
+
this.#P = {
|
|
4860
5203
|
left: e.left,
|
|
4861
5204
|
top: e.top
|
|
4862
5205
|
};
|
|
4863
5206
|
}
|
|
4864
5207
|
return {
|
|
4865
|
-
col: Math.floor((e - this.#
|
|
4866
|
-
row: Math.floor((t - this.#
|
|
5208
|
+
col: Math.floor((e - this.#P.left) / n.width),
|
|
5209
|
+
row: Math.floor((t - this.#P.top) / n.height)
|
|
4867
5210
|
};
|
|
4868
5211
|
}
|
|
4869
|
-
#
|
|
5212
|
+
#Y(e, t) {
|
|
4870
5213
|
let n = this.#p, r = this.#f;
|
|
4871
5214
|
if (!n || !r || this.#_.length === 0) return null;
|
|
4872
|
-
let { col: i, row: a } = this.#
|
|
5215
|
+
let { col: i, row: a } = this.#J(e, t, r), o = yr(n, i, a);
|
|
4873
5216
|
for (let n = o.length - 1; n >= 0; n--) {
|
|
4874
5217
|
let { node: s, x: c, y: l } = o[n], u = s.scrollRange;
|
|
4875
5218
|
if (!u) continue;
|
|
4876
|
-
let d = s.
|
|
4877
|
-
if (
|
|
4878
|
-
|
|
4879
|
-
if (f.right > 0 && u.maxY > 0 && i >= _ - f.right && i < _ && a >= m && a < g) {
|
|
4880
|
-
let e = g - m - f.bottom, n = fr(e, u.sizeY, u.maxY, 0).len, i = Math.max(1, (e - n) * r.height);
|
|
5219
|
+
let d = s.source, { y: f, x: p } = gr(s, c, l);
|
|
5220
|
+
if (f && u.maxY > 0 && i >= f.col && i < f.col + f.thick && a >= f.row && a < f.row + f.len) {
|
|
5221
|
+
let e = _r(f.len, u.sizeY, u.maxY, 0).len, n = Math.max(1, (f.len - e) * r.height);
|
|
4881
5222
|
return {
|
|
4882
|
-
el:
|
|
5223
|
+
el: d,
|
|
4883
5224
|
axis: "y",
|
|
4884
5225
|
startClient: t,
|
|
4885
|
-
startPx:
|
|
4886
|
-
factor: u.maxY * r.height /
|
|
5226
|
+
startPx: d.scrollTop,
|
|
5227
|
+
factor: u.maxY * r.height / n
|
|
4887
5228
|
};
|
|
4888
5229
|
}
|
|
4889
|
-
if (
|
|
4890
|
-
let t =
|
|
5230
|
+
if (p && u.maxX > 0 && a >= p.row && a < p.row + p.thick && i >= p.col && i < p.col + p.len) {
|
|
5231
|
+
let t = _r(p.len, u.sizeX, u.maxX, 0).len, n = Math.max(1, (p.len - t) * r.width);
|
|
4891
5232
|
return {
|
|
4892
|
-
el:
|
|
5233
|
+
el: d,
|
|
4893
5234
|
axis: "x",
|
|
4894
5235
|
startClient: e,
|
|
4895
|
-
startPx:
|
|
4896
|
-
factor: u.maxX * r.width /
|
|
5236
|
+
startPx: d.scrollLeft,
|
|
5237
|
+
factor: u.maxX * r.width / n
|
|
4897
5238
|
};
|
|
4898
5239
|
}
|
|
4899
5240
|
}
|
|
4900
5241
|
return null;
|
|
4901
5242
|
}
|
|
4902
|
-
#
|
|
5243
|
+
#X = (e) => {
|
|
5244
|
+
if (Ua(e)) return;
|
|
4903
5245
|
let { clientX: t, clientY: n } = e, r = this.#x;
|
|
4904
5246
|
if (r) {
|
|
4905
5247
|
let e = (r.axis === "y" ? n : t) - r.startClient, i = r.startPx + e * r.factor;
|
|
4906
5248
|
r.axis === "y" ? r.el.scrollTop = i : r.el.scrollLeft = i;
|
|
4907
5249
|
return;
|
|
4908
5250
|
}
|
|
4909
|
-
|
|
5251
|
+
let i = this.#C;
|
|
5252
|
+
i && e.buttons & 1 && this.#$(i, t, n), this.#j = {
|
|
4910
5253
|
x: t,
|
|
4911
5254
|
y: n
|
|
4912
5255
|
};
|
|
4913
|
-
let
|
|
4914
|
-
if (
|
|
4915
|
-
let { col: e, row: r } = this.#
|
|
4916
|
-
if (e === this.#
|
|
5256
|
+
let a = this.#f;
|
|
5257
|
+
if (a) {
|
|
5258
|
+
let { col: e, row: r } = this.#J(t, n, a);
|
|
5259
|
+
if (e === this.#M && r === this.#N) return;
|
|
4917
5260
|
}
|
|
4918
|
-
this
|
|
5261
|
+
this.#ue();
|
|
4919
5262
|
};
|
|
4920
|
-
#
|
|
4921
|
-
|
|
5263
|
+
#Z = (e) => {
|
|
5264
|
+
let { clipboardData: t } = e, n = this.#p, r = this.#ie();
|
|
5265
|
+
t && n && r && (t.setData("text/plain", Er(n, r)), e.preventDefault());
|
|
4922
5266
|
};
|
|
4923
|
-
#
|
|
5267
|
+
#Q = (e) => {
|
|
4924
5268
|
let t = e;
|
|
4925
|
-
if (
|
|
4926
|
-
|
|
5269
|
+
if (t.button !== 0 || this.getAttribute("select") !== "grid" || !t.composedPath().includes(this.#s)) return;
|
|
5270
|
+
if (t.detail <= 1) {
|
|
5271
|
+
t.detail === 1 && this.removeAttribute(Oa);
|
|
5272
|
+
return;
|
|
5273
|
+
}
|
|
5274
|
+
if (this.#S !== "mouse" && this.#S !== "pen") return;
|
|
5275
|
+
t.preventDefault();
|
|
5276
|
+
let n = document.activeElement;
|
|
5277
|
+
n instanceof HTMLElement && n !== document.body && this.contains(n) && n.blur();
|
|
5278
|
+
let r = t.detail === 2 ? "word" : "paragraph", i = document.getSelection(), a = this.#p, o = this.#f;
|
|
5279
|
+
if (!i || !a || !o) return;
|
|
5280
|
+
let { col: s, row: c } = this.#J(t.clientX, t.clientY, o), l = this.#te(s, c, r);
|
|
5281
|
+
if (!l) {
|
|
5282
|
+
i.removeAllRanges(), this.#C = null;
|
|
5283
|
+
return;
|
|
5284
|
+
}
|
|
5285
|
+
this.#re(l);
|
|
5286
|
+
let u = t.shiftKey && i.anchorNode && this.#ie() ? Ga({
|
|
5287
|
+
node: i.anchorNode,
|
|
5288
|
+
offset: i.anchorOffset
|
|
5289
|
+
}) : l;
|
|
5290
|
+
this.#ee(i, u, l), this.#C = {
|
|
5291
|
+
unit: r,
|
|
5292
|
+
anchor: u
|
|
5293
|
+
};
|
|
5294
|
+
};
|
|
5295
|
+
#$(e, t, n) {
|
|
5296
|
+
let r = this.#f, i = document.getSelection();
|
|
5297
|
+
if (!r || !i) return;
|
|
5298
|
+
let { col: a, row: o } = this.#J(t, n, r), s = this.#te(a, o, e.unit);
|
|
5299
|
+
s && this.#ee(i, e.anchor, s);
|
|
5300
|
+
}
|
|
5301
|
+
#ee(e, t, n) {
|
|
5302
|
+
if (qa(t, n)) {
|
|
5303
|
+
Ka(e, n.start, n.end);
|
|
5304
|
+
return;
|
|
5305
|
+
}
|
|
5306
|
+
let r = this.#ne(t), i = this.#ne(n);
|
|
5307
|
+
xr(r.start.node, r.start.offset, i.start.node, i.start.offset) <= 0 ? Ka(e, r.start, i.end) : Ka(e, r.end, i.start);
|
|
5308
|
+
}
|
|
5309
|
+
#te(e, t, n) {
|
|
5310
|
+
let r = this.#p;
|
|
5311
|
+
if (!r) return null;
|
|
5312
|
+
let i = yr(r, e, t);
|
|
5313
|
+
for (let r = i.length - 1; r >= 0; r--) {
|
|
5314
|
+
let { node: a, x: o, y: s } = i[r];
|
|
5315
|
+
if (!Mr(a)) continue;
|
|
5316
|
+
let c = oe(a.source.tagName)?.selectionTarget?.(a.source);
|
|
5317
|
+
if (n === "word" && !c) {
|
|
5318
|
+
let n = hr(a, o, s, e, t);
|
|
5319
|
+
if (n === null) return null;
|
|
5320
|
+
let r = Ir(a, n), i = r && Cr(a, r.start), c = r && Cr(a, r.end);
|
|
5321
|
+
if (i && c) return {
|
|
5322
|
+
start: i,
|
|
5323
|
+
end: c
|
|
5324
|
+
};
|
|
5325
|
+
}
|
|
5326
|
+
let l = c ?? a.source;
|
|
5327
|
+
return {
|
|
5328
|
+
start: {
|
|
5329
|
+
node: l,
|
|
5330
|
+
offset: 0
|
|
5331
|
+
},
|
|
5332
|
+
end: {
|
|
5333
|
+
node: l,
|
|
5334
|
+
offset: l.childNodes.length
|
|
5335
|
+
}
|
|
5336
|
+
};
|
|
5337
|
+
}
|
|
5338
|
+
return null;
|
|
5339
|
+
}
|
|
5340
|
+
#ne(e) {
|
|
5341
|
+
let t = e.start.node.getRootNode();
|
|
5342
|
+
if (!(t instanceof ShadowRoot) || t === this.#s.getRootNode()) return e;
|
|
5343
|
+
let n = t.host, r = n.parentNode;
|
|
5344
|
+
if (!r) return e;
|
|
5345
|
+
let i = Array.prototype.indexOf.call(r.childNodes, n), a = n.previousSibling, o = n.nextSibling;
|
|
5346
|
+
return {
|
|
5347
|
+
start: Wa(a) ? {
|
|
5348
|
+
node: a,
|
|
5349
|
+
offset: a instanceof Text ? a.length : a.childNodes.length
|
|
5350
|
+
} : {
|
|
5351
|
+
node: r,
|
|
5352
|
+
offset: i
|
|
5353
|
+
},
|
|
5354
|
+
end: Wa(o) ? {
|
|
5355
|
+
node: o,
|
|
5356
|
+
offset: 0
|
|
5357
|
+
} : {
|
|
5358
|
+
node: r,
|
|
5359
|
+
offset: i + 1
|
|
5360
|
+
}
|
|
5361
|
+
};
|
|
5362
|
+
}
|
|
5363
|
+
#re(e) {
|
|
5364
|
+
this.setAttribute(Oa, "");
|
|
5365
|
+
let t = e.start.node, n = t instanceof Element ? t : t.parentElement;
|
|
5366
|
+
n && getComputedStyle(n).userSelect;
|
|
5367
|
+
}
|
|
5368
|
+
#ie() {
|
|
5369
|
+
let e = wr(this.#s.getRootNode());
|
|
5370
|
+
return !e || Tr(this, this.#s, e) !== "light" || e.startContainer === e.endContainer && e.startOffset === e.endOffset ? null : e;
|
|
5371
|
+
}
|
|
5372
|
+
#ae = () => {
|
|
5373
|
+
this.hasAttribute(Oa) && (this.#ie() || this.removeAttribute(Oa));
|
|
5374
|
+
};
|
|
5375
|
+
#oe = () => {
|
|
5376
|
+
this.#j = null, this.#ue();
|
|
5377
|
+
};
|
|
5378
|
+
#se = (e) => {
|
|
5379
|
+
let t = e;
|
|
5380
|
+
if (!t.isPrimary || t.button !== 0 || (this.#S = t.pointerType, Ua(t))) return;
|
|
5381
|
+
let n = this.#Y(t.clientX, t.clientY);
|
|
4927
5382
|
if (n) {
|
|
4928
5383
|
this.#x = n, t.preventDefault(), t.isTrusted && this.setPointerCapture(t.pointerId);
|
|
4929
5384
|
return;
|
|
4930
5385
|
}
|
|
4931
|
-
this.#
|
|
5386
|
+
this.#j = {
|
|
4932
5387
|
x: t.clientX,
|
|
4933
5388
|
y: t.clientY
|
|
4934
|
-
}, this.#
|
|
5389
|
+
}, this.#k = !0, this.#ue(!0);
|
|
4935
5390
|
};
|
|
4936
|
-
#
|
|
5391
|
+
#ce = (e) => {
|
|
4937
5392
|
if (e.isPrimary) {
|
|
4938
|
-
if (this.#x) {
|
|
4939
|
-
this.#
|
|
5393
|
+
if (this.#C = null, this.#x) {
|
|
5394
|
+
this.#W(this.#x.el), this.#x = null;
|
|
4940
5395
|
return;
|
|
4941
5396
|
}
|
|
4942
|
-
|
|
5397
|
+
(this.#k || this.#O) && (this.#k = !1, this.#O = null, this.#ue(), this.#A && this.#Ce());
|
|
4943
5398
|
}
|
|
4944
5399
|
};
|
|
4945
|
-
#
|
|
4946
|
-
if (!this.#
|
|
5400
|
+
#le = (e) => {
|
|
5401
|
+
if (!this.#j) return;
|
|
4947
5402
|
let t = e.target;
|
|
4948
|
-
t instanceof HTMLElement && t.hasAttribute("data-mw-scroll") || (this.#
|
|
5403
|
+
t instanceof HTMLElement && t.hasAttribute("data-mw-scroll") || (this.#P = null, this.#ue());
|
|
4949
5404
|
};
|
|
4950
|
-
|
|
5405
|
+
#ue(t = !1) {
|
|
4951
5406
|
let n = this.#p, r = this.#f, i = [];
|
|
4952
|
-
if (this.#
|
|
4953
|
-
let { col: e, row: t } = this.#
|
|
4954
|
-
this.#
|
|
4955
|
-
} else this.#
|
|
5407
|
+
if (this.#j && n && r && this.isConnected && this.getAttribute("select") === "grid" && (this.#k || e.#F?.matches)) {
|
|
5408
|
+
let { col: e, row: t } = this.#J(this.#j.x, this.#j.y, r);
|
|
5409
|
+
this.#M = e, this.#N = t, i = br(n, e, t);
|
|
5410
|
+
} else this.#M = NaN, this.#N = NaN;
|
|
4956
5411
|
let a = i.at(-1) ?? null;
|
|
4957
|
-
t && (this.#
|
|
4958
|
-
let o = e.#
|
|
4959
|
-
l = this.#
|
|
5412
|
+
t && (this.#O = a);
|
|
5413
|
+
let o = e.#F?.matches ? i : [], s = this.#O ? i.indexOf(this.#O) : -1, c = s >= 0 ? i.slice(0, s + 1) : [], l = this.#de("data-mw-hover", this.#E, o);
|
|
5414
|
+
l = this.#de("data-mw-active", this.#D, c) || l;
|
|
4960
5415
|
let u = a ? getComputedStyle(a).cursor : "";
|
|
4961
|
-
this.#s.style.cursor = u === "auto" ? "" : u, l && this.isConnected && this.#
|
|
5416
|
+
this.#s.style.cursor = u === "auto" ? "" : u, l && this.isConnected && this.#Ce();
|
|
4962
5417
|
}
|
|
4963
|
-
#
|
|
5418
|
+
#de(e, t, n) {
|
|
4964
5419
|
let r = !1, i = new Set(n);
|
|
4965
5420
|
for (let n of t) i.has(n) || (n.removeAttribute(e), r = !0);
|
|
4966
5421
|
for (let n of i) t.has(n) || (n.setAttribute(e, ""), r = !0);
|
|
@@ -4968,51 +5423,53 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4968
5423
|
for (let e of i) t.add(e);
|
|
4969
5424
|
return r;
|
|
4970
5425
|
}
|
|
4971
|
-
#
|
|
4972
|
-
#
|
|
4973
|
-
#
|
|
4974
|
-
#
|
|
4975
|
-
|
|
5426
|
+
#fe = 0;
|
|
5427
|
+
#pe = !1;
|
|
5428
|
+
#me = 0;
|
|
5429
|
+
#he = (e) => {
|
|
5430
|
+
Aa.test(e.propertyName) && (this.#fe++, this.#me = performance.now(), this.#_e());
|
|
4976
5431
|
};
|
|
4977
|
-
#
|
|
4978
|
-
|
|
5432
|
+
#ge = (e) => {
|
|
5433
|
+
Aa.test(e.propertyName) && (this.#fe = Math.max(0, this.#fe - 1));
|
|
4979
5434
|
};
|
|
4980
|
-
#
|
|
4981
|
-
if (this.#
|
|
4982
|
-
this.#
|
|
5435
|
+
#_e() {
|
|
5436
|
+
if (this.#pe) return;
|
|
5437
|
+
this.#pe = !0;
|
|
4983
5438
|
let e = () => {
|
|
4984
|
-
if (!this.isConnected || this.#
|
|
4985
|
-
this.#
|
|
5439
|
+
if (!this.isConnected || this.#fe === 0 && !a() || performance.now() - this.#me > ja) {
|
|
5440
|
+
this.#pe = !1, this.#fe = 0, this.#Ce();
|
|
4986
5441
|
return;
|
|
4987
5442
|
}
|
|
4988
|
-
this.#
|
|
5443
|
+
this.#Se(), requestAnimationFrame(e);
|
|
4989
5444
|
};
|
|
4990
5445
|
requestAnimationFrame(e);
|
|
4991
5446
|
}
|
|
4992
|
-
#
|
|
4993
|
-
if ((e
|
|
4994
|
-
|
|
4995
|
-
|
|
5447
|
+
#ve = (e) => {
|
|
5448
|
+
if (!Ua(e)) {
|
|
5449
|
+
if ((e.type === "focusin" || e.type === "focusout") && e.target instanceof HTMLSelectElement) {
|
|
5450
|
+
this.#Se();
|
|
5451
|
+
return;
|
|
5452
|
+
}
|
|
5453
|
+
this.#Ce();
|
|
4996
5454
|
}
|
|
4997
|
-
this.#fe();
|
|
4998
5455
|
};
|
|
4999
5456
|
attributeChangedCallback(e, t, n) {
|
|
5000
5457
|
if (e === "select" && n !== "text" && n !== "grid") {
|
|
5001
|
-
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`,
|
|
5458
|
+
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`, te(this)), this.setAttribute("select", Da);
|
|
5002
5459
|
return;
|
|
5003
5460
|
}
|
|
5004
|
-
e === "select" && this
|
|
5461
|
+
e === "select" && this.#ue(), this.#Ce();
|
|
5005
5462
|
}
|
|
5006
5463
|
toPlainText() {
|
|
5007
|
-
return this.#d && this.#
|
|
5464
|
+
return this.#d && this.#we(), this.#p ? ir(this.#p) : "";
|
|
5008
5465
|
}
|
|
5009
|
-
#
|
|
5010
|
-
this.#
|
|
5466
|
+
#ye = () => {
|
|
5467
|
+
this.#Ce();
|
|
5011
5468
|
};
|
|
5012
|
-
#
|
|
5013
|
-
requestAnimationFrame(() => this.#
|
|
5469
|
+
#be = () => {
|
|
5470
|
+
requestAnimationFrame(() => this.#Ce());
|
|
5014
5471
|
};
|
|
5015
|
-
#
|
|
5472
|
+
#xe() {
|
|
5016
5473
|
let e = document.activeElement;
|
|
5017
5474
|
if (!(e instanceof HTMLSelectElement) || !this.contains(e)) return !1;
|
|
5018
5475
|
try {
|
|
@@ -5021,25 +5478,25 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5021
5478
|
return !1;
|
|
5022
5479
|
}
|
|
5023
5480
|
}
|
|
5024
|
-
#
|
|
5481
|
+
#Se() {
|
|
5025
5482
|
try {
|
|
5026
|
-
this.#
|
|
5483
|
+
this.#we();
|
|
5027
5484
|
} catch (e) {
|
|
5028
5485
|
console.error("[monowind] layout failed:", e);
|
|
5029
5486
|
}
|
|
5030
5487
|
}
|
|
5031
|
-
#
|
|
5488
|
+
#Ce() {
|
|
5032
5489
|
this.#d || (this.#d = !0, requestAnimationFrame(() => {
|
|
5033
|
-
if (this.#d = !1, this.#
|
|
5034
|
-
this.#
|
|
5490
|
+
if (this.#d = !1, this.#xe()) {
|
|
5491
|
+
this.#Ce();
|
|
5035
5492
|
return;
|
|
5036
5493
|
}
|
|
5037
|
-
this.#
|
|
5494
|
+
this.#Se();
|
|
5038
5495
|
}));
|
|
5039
5496
|
}
|
|
5040
|
-
#
|
|
5497
|
+
#we() {
|
|
5041
5498
|
if (!this.isConnected) return;
|
|
5042
|
-
let e = this.#
|
|
5499
|
+
let e = this.#z(), t = /* @__PURE__ */ new Map(), n = getComputedStyle(this).getPropertyValue("--mw-cw").trim(), r = parseFloat(n);
|
|
5043
5500
|
if (Number.isFinite(r) && r > 0) for (let e of this.querySelectorAll("textarea")) {
|
|
5044
5501
|
let n = getComputedStyle(e), i = e.clientWidth - (parseFloat(n.paddingLeft) || 0) - (parseFloat(n.paddingRight) || 0);
|
|
5045
5502
|
t.set(e, Math.max(0, Math.round(i / r)));
|
|
@@ -5047,23 +5504,23 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5047
5504
|
this.setAttribute("measuring", "");
|
|
5048
5505
|
try {
|
|
5049
5506
|
this.#c.parentNode !== this && this.appendChild(this.#c);
|
|
5050
|
-
let n =
|
|
5507
|
+
let n = we(this, this.#c), r = this.#f;
|
|
5051
5508
|
(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;
|
|
5052
5509
|
let i = getComputedStyle(this), a = (parseFloat(i.paddingLeft) || 0) + (parseFloat(i.paddingRight) || 0), o = Math.max(0, Math.floor((this.clientWidth - a) / n.width));
|
|
5053
5510
|
if (o === 0) return;
|
|
5054
|
-
let s =
|
|
5511
|
+
let s = Te(), c = [];
|
|
5055
5512
|
for (let e of Array.from(this.children)) {
|
|
5056
5513
|
if (e === this.#c) continue;
|
|
5057
|
-
let r =
|
|
5514
|
+
let r = oa(e, s, n, t);
|
|
5058
5515
|
r && c.push(r);
|
|
5059
5516
|
}
|
|
5060
|
-
if (
|
|
5517
|
+
if (Sa(this) ? (this.hasAttribute("data-mw-dropped-text") || console.warn(`[monowind] ${Ca}`, te(this)), this.setAttribute("data-mw-dropped-text", "")) : this.removeAttribute("data-mw-dropped-text"), c.length === 0) {
|
|
5061
5518
|
this.#s.replaceChildren(), this.#p = null, this.setAttribute("data-mw-ready", "");
|
|
5062
5519
|
return;
|
|
5063
5520
|
}
|
|
5064
5521
|
let l = {
|
|
5065
5522
|
source: this,
|
|
5066
|
-
style:
|
|
5523
|
+
style: at(),
|
|
5067
5524
|
children: c,
|
|
5068
5525
|
text: "",
|
|
5069
5526
|
intrinsicWidth: 0,
|
|
@@ -5075,9 +5532,9 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5075
5532
|
height: 0
|
|
5076
5533
|
},
|
|
5077
5534
|
unclampedHeight: 0,
|
|
5078
|
-
resolvedPadding:
|
|
5535
|
+
resolvedPadding: R()
|
|
5079
5536
|
}, { height: u } = Fn(l, o);
|
|
5080
|
-
|
|
5537
|
+
Zr(l), this.#_ = Ja(l), this.#L(n, e), this.#A = !Ur(l, this.#s, this.#k), this.#p = l;
|
|
5081
5538
|
let d = `${l.localRect.width * n.width}px`, f = `${l.localRect.height * n.height}px`;
|
|
5082
5539
|
this.#s.style.width !== d && (this.#s.style.width = d), this.#s.style.height !== f && (this.#s.style.height = f);
|
|
5083
5540
|
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`;
|
|
@@ -5085,25 +5542,43 @@ var Zi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5085
5542
|
let h = i.boxSizing === "border-box" ? a + (parseFloat(i.borderLeftWidth) || 0) + (parseFloat(i.borderRightWidth) || 0) : 0, g = `${o * n.width + h}px`;
|
|
5086
5543
|
this.style.getPropertyValue("--mw-host-w") !== g && this.style.setProperty("--mw-host-w", g), this.hasAttribute("data-mw-ready") || this.setAttribute("data-mw-ready", "");
|
|
5087
5544
|
} finally {
|
|
5088
|
-
this.setAttribute("settling", ""), this.removeAttribute("measuring"), getComputedStyle(this).transitionProperty, this.removeAttribute("settling"), this.#
|
|
5545
|
+
this.setAttribute("settling", ""), this.removeAttribute("measuring"), getComputedStyle(this).transitionProperty, this.removeAttribute("settling"), this.#B(e), this.#u?.takeRecords(), i(this) && (a() ? (this.#me = performance.now(), this.#_e()) : this.#Ce()), this.#q(), this.#w = [];
|
|
5089
5546
|
let t = document.scrollingElement ?? document.documentElement;
|
|
5090
|
-
for (let e = this.parentElement; e; e = e.parentElement) (e === t || /auto|scroll/.test(getComputedStyle(e).overflow)) && this.#
|
|
5091
|
-
this.#
|
|
5547
|
+
for (let e = this.parentElement; e; e = e.parentElement) (e === t || /auto|scroll/.test(getComputedStyle(e).overflow)) && this.#w.push(e);
|
|
5548
|
+
this.#P = null, this.#j && this.#ue();
|
|
5092
5549
|
}
|
|
5093
5550
|
}
|
|
5094
5551
|
};
|
|
5095
|
-
function
|
|
5096
|
-
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind",
|
|
5552
|
+
function Ba() {
|
|
5553
|
+
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind", za);
|
|
5097
5554
|
}
|
|
5098
|
-
function
|
|
5099
|
-
return
|
|
5555
|
+
function Va(e, t, n, r, i) {
|
|
5556
|
+
return Ha(t === "y" ? e.scrollTop : e.scrollLeft, t === "y" ? e.scrollHeight - e.clientHeight : e.scrollWidth - e.clientWidth, n, r, i);
|
|
5100
5557
|
}
|
|
5101
|
-
function
|
|
5558
|
+
function Ha(e, t, n, r, i) {
|
|
5102
5559
|
if (r > 0 && e > 0 && e >= t - 1) return r;
|
|
5103
5560
|
let a = e / n - i, o = Math.abs(a) <= .5 ? i : i + Math.sign(a) * Math.round(Math.abs(a));
|
|
5104
5561
|
return Math.min(Math.max(0, o), r);
|
|
5105
5562
|
}
|
|
5106
|
-
function
|
|
5563
|
+
function Ua(e) {
|
|
5564
|
+
return e instanceof PointerEvent && e.pointerType === "touch" && e.type !== "pointerup";
|
|
5565
|
+
}
|
|
5566
|
+
function Wa(e) {
|
|
5567
|
+
return e !== null && !(e instanceof Element && e.shadowRoot);
|
|
5568
|
+
}
|
|
5569
|
+
function Ga(e) {
|
|
5570
|
+
return {
|
|
5571
|
+
start: e,
|
|
5572
|
+
end: e
|
|
5573
|
+
};
|
|
5574
|
+
}
|
|
5575
|
+
function Ka(e, t, n) {
|
|
5576
|
+
e.setBaseAndExtent(t.node, t.offset, n.node, n.offset);
|
|
5577
|
+
}
|
|
5578
|
+
function qa(e, t) {
|
|
5579
|
+
return e.start.node === t.start.node && e.start.offset === t.start.offset && e.end.node === t.end.node && e.end.offset === t.end.offset;
|
|
5580
|
+
}
|
|
5581
|
+
function Ja(e) {
|
|
5107
5582
|
let t = [], n = (e) => {
|
|
5108
5583
|
e.scrollRange && t.push(e);
|
|
5109
5584
|
for (let t of e.children) n(t);
|
|
@@ -5111,6 +5586,6 @@ function pa(e) {
|
|
|
5111
5586
|
return n(e), t;
|
|
5112
5587
|
}
|
|
5113
5588
|
//#endregion
|
|
5114
|
-
export {
|
|
5589
|
+
export { za as MonoWindElement, Ba as defineMonoWind, ae as invalidateLeaves, Yt as multicolLines, x as registerBorderGlyphs, ie as registerLeafRenderer, ir as renderPlainText, Ee as wrapLines };
|
|
5115
5590
|
|
|
5116
5591
|
//# sourceMappingURL=index.js.map
|