monowind 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn.js +42 -6
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/index.js +578 -541
- package/dist/index.js.map +1 -1
- package/dist/paint.d.ts +1 -0
- package/dist/paint.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/styles.css +37 -2
package/dist/index.js
CHANGED
|
@@ -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 te = /* @__PURE__ */ new WeakMap();
|
|
345
|
+
function j(e, t) {
|
|
346
|
+
let n = te.get(e);
|
|
347
|
+
n || te.set(e, n = /* @__PURE__ */ new Set()), !n.has(t) && (n.add(t), console.warn(`[monowind] ${t}`, ne(e)));
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function ne(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 re = /* @__PURE__ */ new Map(), ie = /* @__PURE__ */ new Set();
|
|
357
|
+
function ae(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
|
+
re.has(t) && console.warn(`[monowind] registerLeafRenderer: replacing existing renderer for <${t}> (last registration wins).`), re.set(t, {
|
|
364
364
|
...e,
|
|
365
365
|
tag: t
|
|
366
|
-
}),
|
|
366
|
+
}), de();
|
|
367
367
|
}
|
|
368
|
-
function
|
|
369
|
-
|
|
368
|
+
function oe() {
|
|
369
|
+
de();
|
|
370
370
|
}
|
|
371
|
-
function
|
|
372
|
-
return
|
|
371
|
+
function se(e) {
|
|
372
|
+
return re.get(e.toLowerCase());
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function ce() {
|
|
375
375
|
let e = /* @__PURE__ */ new Set();
|
|
376
|
-
for (let t of
|
|
376
|
+
for (let t of re.values()) for (let n of t.observedAttributes ?? []) e.add(n.toLowerCase());
|
|
377
377
|
return [...e];
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
return
|
|
379
|
+
function le(e) {
|
|
380
|
+
return ie.add(e), () => ie.delete(e);
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function ue(e, t) {
|
|
383
383
|
try {
|
|
384
384
|
return e.render(t);
|
|
385
385
|
} catch (n) {
|
|
386
|
-
return
|
|
386
|
+
return j(t, `<${e.tag}> renderer threw; rendering nothing. ${String(n)}`), null;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
function
|
|
390
|
-
for (let e of
|
|
389
|
+
function de() {
|
|
390
|
+
for (let e of ie) e();
|
|
391
391
|
}
|
|
392
392
|
//#endregion
|
|
393
393
|
//#region src/borders.ts
|
|
394
|
-
function
|
|
394
|
+
function fe(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 de(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 || pe(n, e.borderStyle, e.borderColor, o, i, S(e.glyphSet));
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
let o =
|
|
413
|
+
function pe(e, t, n, r, i, a) {
|
|
414
|
+
let o = ve(t.top, a), s = ve(t.right, a), c = ve(t.bottom, a), l = ve(t.left, a), u = (e, t, n) => n(ve(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 fe(e, t, n, r, i, a) {
|
|
|
464
464
|
color: n.bottom
|
|
465
465
|
}));
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function me(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 he(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) me(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 me(e) {
|
|
|
478
478
|
...i ?? []
|
|
479
479
|
];
|
|
480
480
|
}
|
|
481
|
-
function
|
|
482
|
-
let r =
|
|
481
|
+
function ge(e, t, n) {
|
|
482
|
+
let r = ve(e, n);
|
|
483
483
|
return t === "h" ? r.h : r.v;
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function _e(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 ge(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 ve(e, t) {
|
|
494
|
+
let n = (n, r, i, a) => _e(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 _e(e, t) {
|
|
|
502
502
|
return e === "dashed" ? {
|
|
503
503
|
h: "╌",
|
|
504
504
|
v: "╎",
|
|
505
|
-
...
|
|
506
|
-
...
|
|
505
|
+
...ye(r),
|
|
506
|
+
...be(t, e)
|
|
507
507
|
} : e === "dotted" ? {
|
|
508
508
|
h: "┄",
|
|
509
509
|
v: "┊",
|
|
510
|
-
...
|
|
511
|
-
...
|
|
510
|
+
...ye(r),
|
|
511
|
+
...be(t, e)
|
|
512
512
|
} : r;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function ye(e) {
|
|
515
515
|
let { h: t, v: n, ...r } = e;
|
|
516
516
|
return r;
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function be(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 xe(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 be(e, t, n, r) {
|
|
|
563
563
|
end: e.end - r
|
|
564
564
|
})).filter((e) => e.end > e.start);
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function Se(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 xe(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 = ge(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 xe(e) {
|
|
|
581
581
|
length: 1,
|
|
582
582
|
color: e.ruleX.color
|
|
583
583
|
});
|
|
584
|
-
|
|
584
|
+
Ce(e, t, "x", o.line, o.start, o.end);
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
if (e.ruleY) {
|
|
@@ -592,7 +592,7 @@ function xe(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 ? _e(i ? "double" : "solid", u, p, l(o, c, f, d), l(o, c, f, d + 1), e.glyphs) : ge(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 xe(e) {
|
|
|
600
600
|
});
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
|
-
|
|
603
|
+
Ce(e, t, "y", u.line, u.start, u.end);
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
return t;
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function Ce(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: _e(d, s, c, l, u, e.glyphs),
|
|
613
613
|
x: n,
|
|
614
614
|
y: r,
|
|
615
615
|
length: 1,
|
|
@@ -627,16 +627,16 @@ function Se(e, t, n, r, i, a) {
|
|
|
627
627
|
}
|
|
628
628
|
//#endregion
|
|
629
629
|
//#region src/metrics.ts
|
|
630
|
-
function
|
|
630
|
+
function M(e) {
|
|
631
631
|
return (e >= 0 ? Math.floor(e + .5) : -Math.floor(-e + .5)) || 0;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
634
|
-
return t <= 0 ? 0 :
|
|
635
|
-
}
|
|
636
|
-
function Ce(e, t) {
|
|
637
|
-
return N(t * e / 100);
|
|
633
|
+
function N(e, t) {
|
|
634
|
+
return t <= 0 ? 0 : M(e / (.25 * t));
|
|
638
635
|
}
|
|
639
636
|
function we(e, t) {
|
|
637
|
+
return M(t * e / 100);
|
|
638
|
+
}
|
|
639
|
+
function Te(e, t) {
|
|
640
640
|
let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).letterSpacing) || 0, i = t.ownerDocument.createRange();
|
|
641
641
|
i.selectNodeContents(t);
|
|
642
642
|
let a = Math.max(0, i.getBoundingClientRect().height - n.height);
|
|
@@ -647,56 +647,56 @@ function we(e, t) {
|
|
|
647
647
|
inkOverhang: a
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function Ee() {
|
|
651
651
|
return parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
652
652
|
}
|
|
653
653
|
//#endregion
|
|
654
654
|
//#region src/wrap.ts
|
|
655
|
-
function Ee(e, t, n = {}) {
|
|
656
|
-
return Ae(e, t, n).map((t) => e.slice(t.start, t.end));
|
|
657
|
-
}
|
|
658
655
|
function De(e, t, n = {}) {
|
|
659
|
-
return
|
|
656
|
+
return je(e, t, n).map((t) => e.slice(t.start, t.end));
|
|
660
657
|
}
|
|
661
|
-
function Oe(e, t) {
|
|
658
|
+
function Oe(e, t, n = {}) {
|
|
659
|
+
return je(e, t, n).length;
|
|
660
|
+
}
|
|
661
|
+
function ke(e, t) {
|
|
662
662
|
return t.endsWith("\n") && e.pop(), e;
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function Ae(e) {
|
|
665
665
|
let t = [], n = 0;
|
|
666
666
|
for (let r = 0; r <= e.length; r++) (r === e.length || e[r] === "\n") && (t.push({
|
|
667
667
|
start: n,
|
|
668
668
|
end: r
|
|
669
669
|
}), n = r + 1);
|
|
670
|
-
return
|
|
670
|
+
return ke(t, e);
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function je(e, t, n = {}) {
|
|
673
673
|
if (!/[^ \t\r\f]/.test(e)) return [];
|
|
674
674
|
let r = [], i = 0, a = n.firstLineIndent ?? 0;
|
|
675
|
-
for (let o = 0; o <= e.length; o++) (o === e.length || e[o] === "\n") && (r.push(...
|
|
676
|
-
return
|
|
675
|
+
for (let o = 0; o <= e.length; o++) (o === e.length || e[o] === "\n") && (r.push(...ze(e, i, o, t, n, a)), a = 0, i = o + 1);
|
|
676
|
+
return ke(r, e);
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function Me(e, t, n) {
|
|
679
679
|
if (!n) return t - e;
|
|
680
680
|
let r = 0;
|
|
681
681
|
for (let i = e; i < t; i++) r += n[i] ?? 1;
|
|
682
682
|
return r;
|
|
683
683
|
}
|
|
684
|
-
function
|
|
685
|
-
return t <= e ? 0 :
|
|
684
|
+
function P(e, t, n, r = 0) {
|
|
685
|
+
return t <= e ? 0 : Me(e, t, n) - Math.min(r, Ne(t - 1, n));
|
|
686
686
|
}
|
|
687
|
-
function
|
|
687
|
+
function Ne(e, t) {
|
|
688
688
|
return t ? (t[e] ?? 1) - 1 : 0;
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function Pe(e, t = {}) {
|
|
691
691
|
let { advances: n, tracking: r = 0 } = t, i = 0;
|
|
692
|
-
for (let t of
|
|
692
|
+
for (let t of Re(e, 0, e.length)) for (let a of Ie(e, t.start, t.end)) i = Math.max(i, P(a.start, a.end, n, r));
|
|
693
693
|
return i;
|
|
694
694
|
}
|
|
695
|
-
function
|
|
695
|
+
function Fe(e, t) {
|
|
696
696
|
let n = 0;
|
|
697
697
|
for (let r = 0; r < e.length; r++) e[r] === "" && (t(r, n), n++);
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function Ie(e, t, n) {
|
|
700
700
|
let r = [], i = t;
|
|
701
701
|
for (let a = t; a < n; a++) {
|
|
702
702
|
if (e[a] === "") {
|
|
@@ -723,14 +723,14 @@ function Fe(e, t, n) {
|
|
|
723
723
|
end: n
|
|
724
724
|
}), r;
|
|
725
725
|
}
|
|
726
|
-
var
|
|
727
|
-
function
|
|
726
|
+
var Le = /[ \t\r\n\f]/;
|
|
727
|
+
function Re(e, t, n) {
|
|
728
728
|
let r = [], i = t;
|
|
729
729
|
for (; i < n;) {
|
|
730
|
-
for (; i < n &&
|
|
730
|
+
for (; i < n && Le.test(e[i]);) i++;
|
|
731
731
|
if (i >= n) break;
|
|
732
732
|
let t = i;
|
|
733
|
-
for (; i < n && !
|
|
733
|
+
for (; i < n && !Le.test(e[i]);) i++;
|
|
734
734
|
r.push({
|
|
735
735
|
start: t,
|
|
736
736
|
end: i
|
|
@@ -738,8 +738,8 @@ function Le(e, t, n) {
|
|
|
738
738
|
}
|
|
739
739
|
return r;
|
|
740
740
|
}
|
|
741
|
-
function
|
|
742
|
-
let s =
|
|
741
|
+
function ze(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
742
|
+
let s = Re(e, t, n);
|
|
743
743
|
if (s.length === 0) return [{
|
|
744
744
|
start: t,
|
|
745
745
|
end: t
|
|
@@ -751,13 +751,13 @@ function Re(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
751
751
|
let c = [], l = null, u = 0, d = Math.max(0, o), f = () => r - d;
|
|
752
752
|
for (let t of s) {
|
|
753
753
|
let n = !1;
|
|
754
|
-
for (let r of
|
|
755
|
-
let e = r.start, t = r.end, o = l !== null && !n ? e - 1 : e, s = u +
|
|
754
|
+
for (let r of Ie(e, t.start, t.end)) {
|
|
755
|
+
let e = r.start, t = r.end, o = l !== null && !n ? e - 1 : e, s = u + Me(o, t, i), p = Math.min(a, Ne(t - 1, i));
|
|
756
756
|
if (l !== null && s - p <= f()) l.end = t, u = s;
|
|
757
757
|
else {
|
|
758
758
|
for (l !== null && (c.push(l), d = 0);;) {
|
|
759
759
|
let n = e;
|
|
760
|
-
for (; n < t &&
|
|
760
|
+
for (; n < t && P(e, n + 1, i, a) <= f();) n++;
|
|
761
761
|
if (n === t || n === e) break;
|
|
762
762
|
c.push({
|
|
763
763
|
start: e,
|
|
@@ -767,7 +767,7 @@ function Re(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
767
767
|
l = {
|
|
768
768
|
start: e,
|
|
769
769
|
end: t
|
|
770
|
-
}, u =
|
|
770
|
+
}, u = Me(e, t, i);
|
|
771
771
|
}
|
|
772
772
|
n = !0;
|
|
773
773
|
}
|
|
@@ -776,7 +776,7 @@ function Re(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
776
776
|
}
|
|
777
777
|
//#endregion
|
|
778
778
|
//#region src/flex.ts
|
|
779
|
-
function
|
|
779
|
+
function Be(e, t) {
|
|
780
780
|
let n = e.row.map((e) => e.node.localRect).sort((e, t) => e.x - t.x), r = [];
|
|
781
781
|
for (let e = 1; e < n.length; e++) {
|
|
782
782
|
let i = n[e - 1].x + n[e - 1].width - t, a = n[e].x - t;
|
|
@@ -787,12 +787,12 @@ function ze(e, t) {
|
|
|
787
787
|
}
|
|
788
788
|
return r;
|
|
789
789
|
}
|
|
790
|
-
function
|
|
790
|
+
function Ve(e, t, n, r, i) {
|
|
791
791
|
if (e.style.ruleBreak !== "intersection") return [{
|
|
792
792
|
start: 0,
|
|
793
793
|
end: i
|
|
794
794
|
}];
|
|
795
|
-
let a = [t[n - 1], t[n]].flatMap((e) =>
|
|
795
|
+
let a = [t[n - 1], t[n]].flatMap((e) => Be(e, r)).sort((e, t) => e.start - t.start), o = (e, t) => ({
|
|
796
796
|
start: e,
|
|
797
797
|
end: t,
|
|
798
798
|
spanned: !1,
|
|
@@ -800,25 +800,25 @@ function Be(e, t, n, r, i) {
|
|
|
800
800
|
afterOccupied: !0
|
|
801
801
|
}), s = [], c = 0;
|
|
802
802
|
for (let e of a) e.start > c && s.push(o(c, e.start)), c = Math.max(c, e.end);
|
|
803
|
-
return c < i && s.push(o(c, i)),
|
|
803
|
+
return c < i && s.push(o(c, i)), xe(s, "intersection", "all", e.style.ruleInset === "overlap-join" ? "overlap-join" : 0);
|
|
804
804
|
}
|
|
805
|
-
function
|
|
805
|
+
function He(e, t) {
|
|
806
806
|
return typeof t != "number" || t <= 0 ? e : e.map((e) => ({
|
|
807
807
|
...e,
|
|
808
808
|
start: e.start + t,
|
|
809
809
|
end: e.end - t
|
|
810
810
|
})).filter((e) => e.end > e.start);
|
|
811
811
|
}
|
|
812
|
-
function
|
|
813
|
-
let s =
|
|
814
|
-
let n =
|
|
812
|
+
function Ue(e, t, n, r, i, a, o) {
|
|
813
|
+
let s = H(e.style, "x", t), c = H(e.style, "y", n), l = Ze(e).map((e) => {
|
|
814
|
+
let n = W(e.style.margin, t);
|
|
815
815
|
return {
|
|
816
816
|
node: e,
|
|
817
817
|
base: Xe(e, t, o),
|
|
818
818
|
grow: e.style.flexGrow,
|
|
819
819
|
shrink: e.style.flexShrink,
|
|
820
820
|
min: et(e, t, o),
|
|
821
|
-
max:
|
|
821
|
+
max: G(e.style.maxWidth, t),
|
|
822
822
|
margin: n
|
|
823
823
|
};
|
|
824
824
|
}), u = [];
|
|
@@ -831,7 +831,7 @@ function He(e, t, n, r, i, a, o) {
|
|
|
831
831
|
n.length > 0 && u.push(n), e.style.wrapReverse && u.reverse();
|
|
832
832
|
} else u.push(l);
|
|
833
833
|
let d = i.left + a.left, f = i.top + a.top, p = u.map((e) => {
|
|
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))) :
|
|
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))) : Je(e, a);
|
|
835
835
|
for (let n = 0; n < e.length; n++) B(e[n].node, t, r, 0, 0, "fill", o, { width: u[n] });
|
|
836
836
|
return {
|
|
837
837
|
row: e,
|
|
@@ -844,17 +844,17 @@ function He(e, t, n, r, i, a, o) {
|
|
|
844
844
|
else {
|
|
845
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);
|
|
846
846
|
if (i === "stretch" && r > 0) {
|
|
847
|
-
let e =
|
|
847
|
+
let e = I(Array.from({ length: p.length }, () => 1), r);
|
|
848
848
|
for (let t = 0; t < m.length; t++) m[t] += e[t];
|
|
849
|
-
g =
|
|
850
|
-
} else g =
|
|
849
|
+
g = F("start", m, 0);
|
|
850
|
+
} else g = F(i === "stretch" ? "start" : i, m, r);
|
|
851
851
|
}
|
|
852
852
|
for (let i = 0; i < p.length; i++) {
|
|
853
853
|
let { row: a, widths: l, availableForItems: u } = p[i], h = m[i], _ = g[i] + i * c;
|
|
854
854
|
for (let i = 0; i < a.length; i++) {
|
|
855
|
-
let s = a[i].node, c =
|
|
855
|
+
let s = a[i].node, c = Ye(s, e), u = a[i].margin, d = u.top === null || u.bottom === null, f = s.style.height !== void 0 && s.style.height.kind !== "auto";
|
|
856
856
|
if (c === "stretch" && !d && !f && h !== s.localRect.height) {
|
|
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),
|
|
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), G(s.style.minHeight, c) ?? 0, G(s.style.maxHeight, c));
|
|
858
858
|
if (d === s.localRect.height) continue;
|
|
859
859
|
B(s, t, r, 0, 0, "fill", o, {
|
|
860
860
|
width: l[i],
|
|
@@ -864,17 +864,17 @@ function He(e, t, n, r, i, a, o) {
|
|
|
864
864
|
}
|
|
865
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;
|
|
866
866
|
if (b > 0 && y > 0) {
|
|
867
|
-
let e =
|
|
867
|
+
let e = I(Array.from({ length: b }, () => 1), y), t = 0;
|
|
868
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++]);
|
|
869
|
-
C =
|
|
870
|
-
} else C =
|
|
869
|
+
C = F("start", l, 0);
|
|
870
|
+
} else C = F($e(e.style), l, y);
|
|
871
871
|
let w = 0;
|
|
872
872
|
for (let t = 0; t < a.length; t++) {
|
|
873
873
|
let n = a[t], r = n.node, i = n.margin.left ?? 0, o = n.margin.right ?? 0;
|
|
874
874
|
w += x[t] + i, r.localRect = {
|
|
875
875
|
...r.localRect,
|
|
876
876
|
x: d + C[t] + t * s + w,
|
|
877
|
-
y: f + _ +
|
|
877
|
+
y: f + _ + Ke(r, e.style.alignItems, h, n.margin)
|
|
878
878
|
}, w += S[t] + o;
|
|
879
879
|
}
|
|
880
880
|
}
|
|
@@ -883,7 +883,7 @@ function He(e, t, n, r, i, a, o) {
|
|
|
883
883
|
let n = [], r = [];
|
|
884
884
|
for (let i = 0; i < p.length; i++) {
|
|
885
885
|
let a = g[i] + i * c;
|
|
886
|
-
for (let e of
|
|
886
|
+
for (let e of Be(p[i], d)) n.push({
|
|
887
887
|
bandStart: e.start,
|
|
888
888
|
bandSize: e.end - e.start,
|
|
889
889
|
start: a,
|
|
@@ -891,19 +891,19 @@ function He(e, t, n, r, i, a, o) {
|
|
|
891
891
|
});
|
|
892
892
|
if (i > 0) {
|
|
893
893
|
let n = g[i - 1] + (i - 1) * c + m[i - 1];
|
|
894
|
-
if (a > n) for (let o of
|
|
894
|
+
if (a > n) for (let o of Ve(e, p, i, d, t)) r.push({
|
|
895
895
|
bandStart: n,
|
|
896
896
|
bandSize: a - n,
|
|
897
897
|
...o
|
|
898
898
|
});
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
|
-
e.decorationRuns =
|
|
901
|
+
e.decorationRuns = Se({
|
|
902
902
|
glyphs: S(e.style.glyphSet),
|
|
903
903
|
ruleX: e.style.ruleX,
|
|
904
904
|
ruleY: e.style.ruleY,
|
|
905
|
-
vertical:
|
|
906
|
-
horizontal:
|
|
905
|
+
vertical: He(n, e.style.ruleInset),
|
|
906
|
+
horizontal: He(r, e.style.ruleInset),
|
|
907
907
|
contentWidth: t,
|
|
908
908
|
contentHeight: v,
|
|
909
909
|
border: i,
|
|
@@ -912,9 +912,9 @@ function He(e, t, n, r, i, a, o) {
|
|
|
912
912
|
padding: a
|
|
913
913
|
});
|
|
914
914
|
}
|
|
915
|
-
return
|
|
915
|
+
return We(e, i, a, t, v), v;
|
|
916
916
|
}
|
|
917
|
-
function
|
|
917
|
+
function We(e, t, n, r, i) {
|
|
918
918
|
for (let a of e.children) z(a.style) && (a.staticSlot = {
|
|
919
919
|
kind: "flex",
|
|
920
920
|
direction: e.style.flexDirection,
|
|
@@ -924,37 +924,37 @@ function Ue(e, t, n, r, i) {
|
|
|
924
924
|
innerHeight: i
|
|
925
925
|
});
|
|
926
926
|
}
|
|
927
|
-
function
|
|
928
|
-
let s =
|
|
929
|
-
let a =
|
|
927
|
+
function Ge(e, t, n, r, i, a, o) {
|
|
928
|
+
let s = H(e.style, "y", n), c = Ze(e).map((i) => {
|
|
929
|
+
let a = W(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c = Ye(i, e) === "stretch";
|
|
930
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 ?
|
|
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 ? we(u.value, l) : i.unclampedHeight, f = i.style.minHeight === "auto" ? i.style.overflow.y === "visible" ? i.localRect.height : 0 : void 0;
|
|
932
932
|
return {
|
|
933
933
|
node: i,
|
|
934
934
|
base: d,
|
|
935
935
|
grow: i.style.flexGrow,
|
|
936
936
|
shrink: i.style.flexShrink,
|
|
937
|
-
min: f ??
|
|
938
|
-
max:
|
|
937
|
+
min: f ?? G(i.style.minHeight, l) ?? 0,
|
|
938
|
+
max: G(i.style.maxHeight, l),
|
|
939
939
|
margin: a
|
|
940
940
|
};
|
|
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) ?
|
|
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) ? Je(c, m) : c.map((e) => Math.max(0, V(e.base, e.min, e.max)));
|
|
942
942
|
for (let n = 0; n < c.length; n++) if (g[n] !== c[n].node.localRect.height) {
|
|
943
|
-
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a =
|
|
943
|
+
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a = Ye(r.node, e) === "stretch";
|
|
944
944
|
B(r.node, i, g[n], 0, 0, a ? "fill" : "shrink", o, { height: g[n] });
|
|
945
945
|
}
|
|
946
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;
|
|
947
947
|
if (y > 0 && v > 0) {
|
|
948
|
-
let e =
|
|
948
|
+
let e = I(Array.from({ length: y }, () => 1), v), t = 0;
|
|
949
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++]);
|
|
950
|
-
C =
|
|
951
|
-
} else C =
|
|
950
|
+
C = F("start", g, 0);
|
|
951
|
+
} else C = F($e(e.style), g, v);
|
|
952
952
|
let w = i.left + a.left, T = i.top + a.top, E = 0;
|
|
953
953
|
for (let n = 0; n < c.length; n++) {
|
|
954
954
|
let r = c[n], i = r.node, a = r.margin.top ?? 0, o = r.margin.bottom ?? 0;
|
|
955
955
|
E += b[n] + a, i.localRect = {
|
|
956
956
|
...i.localRect,
|
|
957
|
-
x: w +
|
|
957
|
+
x: w + qe(i, e.style.alignItems, t, r.margin),
|
|
958
958
|
y: T + C[n] + n * s + E
|
|
959
959
|
}, E += x[n] + o;
|
|
960
960
|
}
|
|
@@ -970,12 +970,12 @@ function We(e, t, n, r, i, a, o) {
|
|
|
970
970
|
end: t
|
|
971
971
|
});
|
|
972
972
|
}
|
|
973
|
-
e.decorationRuns =
|
|
973
|
+
e.decorationRuns = Se({
|
|
974
974
|
glyphs: S(e.style.glyphSet),
|
|
975
975
|
ruleX: null,
|
|
976
976
|
ruleY: e.style.ruleY,
|
|
977
977
|
vertical: [],
|
|
978
|
-
horizontal:
|
|
978
|
+
horizontal: He(n, e.style.ruleInset),
|
|
979
979
|
contentWidth: t,
|
|
980
980
|
contentHeight: O,
|
|
981
981
|
border: i,
|
|
@@ -984,17 +984,17 @@ function We(e, t, n, r, i, a, o) {
|
|
|
984
984
|
padding: a
|
|
985
985
|
});
|
|
986
986
|
}
|
|
987
|
-
return
|
|
987
|
+
return We(e, i, a, t, O), O;
|
|
988
988
|
}
|
|
989
|
-
function
|
|
989
|
+
function Ke(e, t, n, r) {
|
|
990
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;
|
|
991
|
-
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 + L(i, n, e.localRect.height);
|
|
992
992
|
}
|
|
993
|
-
function
|
|
993
|
+
function qe(e, t, n, r) {
|
|
994
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;
|
|
995
|
-
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 + L(i, n, e.localRect.width);
|
|
996
996
|
}
|
|
997
|
-
function
|
|
997
|
+
function F(e, t, n) {
|
|
998
998
|
let r = t.length;
|
|
999
999
|
if (r === 0) return [];
|
|
1000
1000
|
let i = [], a = 0;
|
|
@@ -1004,7 +1004,7 @@ function I(e, t, n) {
|
|
|
1004
1004
|
return i;
|
|
1005
1005
|
}
|
|
1006
1006
|
if ((e === "space-around" || e === "space-evenly") && n > 0) {
|
|
1007
|
-
let o =
|
|
1007
|
+
let o = I(Array.from({ length: r + 1 }, (t, n) => e === "space-evenly" || n === 0 || n === r ? 1 : 2), n);
|
|
1008
1008
|
for (let e = 0; e < r; e++) a += o[e], i.push(a), a += t[e];
|
|
1009
1009
|
return i;
|
|
1010
1010
|
}
|
|
@@ -1012,7 +1012,7 @@ function I(e, t, n) {
|
|
|
1012
1012
|
for (let e = 0; e < r; e++) i.push(a), a += t[e];
|
|
1013
1013
|
return i;
|
|
1014
1014
|
}
|
|
1015
|
-
function
|
|
1015
|
+
function Je(e, t) {
|
|
1016
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);
|
|
1017
1017
|
for (let t = 0; t < n; t++) {
|
|
1018
1018
|
let n = r(i[t], t);
|
|
@@ -1022,7 +1022,7 @@ function qe(e, t) {
|
|
|
1022
1022
|
let c = [];
|
|
1023
1023
|
for (let e = 0; e < n; e++) s[e] || c.push(e);
|
|
1024
1024
|
if (c.length === 0) break;
|
|
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 =
|
|
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 = I(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);
|
|
1026
1026
|
if (g === 0) {
|
|
1027
1027
|
for (let e = 0; e < c.length; e++) o[c[e]] = h[e];
|
|
1028
1028
|
break;
|
|
@@ -1034,7 +1034,7 @@ function qe(e, t) {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
return o;
|
|
1036
1036
|
}
|
|
1037
|
-
function
|
|
1037
|
+
function I(e, t) {
|
|
1038
1038
|
let n = e.reduce((e, t) => e + t, 0);
|
|
1039
1039
|
if (n === 0 || t <= 0) return e.map(() => 0);
|
|
1040
1040
|
let r = e.map((e) => e / n * t), i = r.map(Math.floor), a = t - i.reduce((e, t) => e + t, 0);
|
|
@@ -1047,15 +1047,15 @@ function L(e, t) {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
return i;
|
|
1049
1049
|
}
|
|
1050
|
-
function
|
|
1050
|
+
function Ye(e, t) {
|
|
1051
1051
|
return e.style.alignSelf === "auto" ? t.style.alignItems : e.style.alignSelf;
|
|
1052
1052
|
}
|
|
1053
|
-
function
|
|
1053
|
+
function L(e, t, n) {
|
|
1054
1054
|
return e === "center" ? Math.max(0, Math.floor((t - n) / 2)) : e === "end" ? Math.max(0, t - n) : 0;
|
|
1055
1055
|
}
|
|
1056
1056
|
function Xe(e, t, n) {
|
|
1057
1057
|
let r = e.style.flexBasis, i = e.style.width;
|
|
1058
|
-
return r !== void 0 && r.kind !== "auto" ?
|
|
1058
|
+
return r !== void 0 && r.kind !== "auto" ? K(r, t, e, n) : i !== void 0 && i.kind !== "auto" ? K(i, t, e, n) : q(e, n);
|
|
1059
1059
|
}
|
|
1060
1060
|
function Ze(e) {
|
|
1061
1061
|
let t = e.children.filter((e) => !z(e.style)).sort((e, t) => e.style.order - t.style.order);
|
|
@@ -1069,7 +1069,7 @@ function $e(e) {
|
|
|
1069
1069
|
return e.flexReverse ? t === "start" ? "end" : t === "end" ? "start" : t : t;
|
|
1070
1070
|
}
|
|
1071
1071
|
function et(e, t, n) {
|
|
1072
|
-
return e.style.minWidth === "auto" ? e.style.overflow.x === "visible" ?
|
|
1072
|
+
return e.style.minWidth === "auto" ? e.style.overflow.x === "visible" ? tr(e, n) : 0 : G(e.style.minWidth, t) ?? 0;
|
|
1073
1073
|
}
|
|
1074
1074
|
//#endregion
|
|
1075
1075
|
//#region src/types.ts
|
|
@@ -1235,10 +1235,10 @@ function ot() {
|
|
|
1235
1235
|
//#endregion
|
|
1236
1236
|
//#region src/grid.ts
|
|
1237
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 :
|
|
1238
|
+
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, u = c ? c.gap : H(o, "x", t), d = l ? l.gap : H(o, "y", s), f = _t(e, t, s, u, d, e.subgrid ? {
|
|
1239
1239
|
col: e.subgrid.colSpan,
|
|
1240
1240
|
row: e.subgrid.rowSpan
|
|
1241
|
-
} : 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) => W(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 = [];
|
|
1242
1242
|
for (let e = 0; e < p.length; e++) {
|
|
1243
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];
|
|
1244
1244
|
if (s.cols || s.rows) {
|
|
@@ -1251,17 +1251,17 @@ function st(e, t, n, r, i, a) {
|
|
|
1251
1251
|
};
|
|
1252
1252
|
} else t.subgrid = void 0;
|
|
1253
1253
|
let c = C[e], l = i.left === null || i.right === null, d = t.style.width !== void 0 && t.style.width.kind !== "auto";
|
|
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" ?
|
|
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" ? tr(t, a) : 0 : G(t.style.minWidth, r) ?? 0, Gn(t.style.maxWidth, r, t, a)) }) : B(t, o, void 0, 0, 0, "shrink", a), D.push(t.localRect.width);
|
|
1255
1255
|
}
|
|
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,
|
|
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, te = r.top + i.top;
|
|
1257
1257
|
for (let t = 0; t < p.length; t++) {
|
|
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 =
|
|
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 = Ye(n, e), u = i.top === null || i.bottom === null, f = n.style.height !== void 0 && n.style.height.kind !== "auto";
|
|
1259
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, {
|
|
1260
1260
|
width: D[t],
|
|
1261
1261
|
height: c
|
|
1262
1262
|
});
|
|
1263
1263
|
else if (l === "stretch" && !u && !f) {
|
|
1264
|
-
let e = V(c, n.style.minHeight === "auto" ? n.style.overflow.y === "visible" ? n.localRect.height : 0 :
|
|
1264
|
+
let e = V(c, n.style.minHeight === "auto" ? n.style.overflow.y === "visible" ? n.localRect.height : 0 : G(n.style.minHeight, s) ?? 0, G(n.style.maxHeight, s));
|
|
1265
1265
|
e !== n.localRect.height && B(n, o, s, 0, 0, "fill", a, {
|
|
1266
1266
|
width: D[t],
|
|
1267
1267
|
height: e
|
|
@@ -1270,10 +1270,10 @@ function st(e, t, n, r, i, a) {
|
|
|
1270
1270
|
n.localRect = {
|
|
1271
1271
|
...n.localRect,
|
|
1272
1272
|
x: ee + E[r.col.start] + It(C[t], i.left, i.right, o, n.localRect.width),
|
|
1273
|
-
y:
|
|
1273
|
+
y: te + A[r.row.start] + It(l, i.top, i.bottom, s, n.localRect.height)
|
|
1274
1274
|
};
|
|
1275
1275
|
}
|
|
1276
|
-
let
|
|
1276
|
+
let j = Number.isFinite(n) ? Math.max(n, k) : k;
|
|
1277
1277
|
if (o.ruleX || o.ruleY) {
|
|
1278
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));
|
|
1279
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);
|
|
@@ -1287,7 +1287,7 @@ function st(e, t, n, r, i, a) {
|
|
|
1287
1287
|
let r = [];
|
|
1288
1288
|
for (let i = 1; i < e.length; i++) {
|
|
1289
1289
|
let a = e[i - 1] + t[i - 1], s = e[i] - a;
|
|
1290
|
-
if (!(s <= 0)) for (let e of
|
|
1290
|
+
if (!(s <= 0)) for (let e of xe(n(i - 1), o.ruleBreak, o.ruleVisibilityItems, o.ruleInset)) r.push({
|
|
1291
1291
|
bandStart: a,
|
|
1292
1292
|
bandSize: s,
|
|
1293
1293
|
...e
|
|
@@ -1295,40 +1295,40 @@ function st(e, t, n, r, i, a) {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
return r;
|
|
1297
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));
|
|
1298
|
-
e.decorationRuns =
|
|
1298
|
+
e.decorationRuns = Se({
|
|
1299
1299
|
glyphs: S(o.glyphSet),
|
|
1300
1300
|
ruleX: o.ruleX,
|
|
1301
1301
|
ruleY: o.ruleY,
|
|
1302
1302
|
vertical: f,
|
|
1303
1303
|
horizontal: p,
|
|
1304
1304
|
contentWidth: t,
|
|
1305
|
-
contentHeight:
|
|
1305
|
+
contentHeight: j,
|
|
1306
1306
|
border: r,
|
|
1307
1307
|
borderStyle: o.borderStyle,
|
|
1308
1308
|
borderColor: o.borderColor,
|
|
1309
1309
|
padding: i
|
|
1310
1310
|
});
|
|
1311
1311
|
}
|
|
1312
|
-
let
|
|
1313
|
-
if (
|
|
1312
|
+
let ne = e.children.filter((e) => z(e.style));
|
|
1313
|
+
if (ne.length > 0) {
|
|
1314
1314
|
let e = z(o) ? {
|
|
1315
1315
|
x: r.left,
|
|
1316
1316
|
y: r.top,
|
|
1317
1317
|
width: i.left + t + i.right,
|
|
1318
|
-
height: i.top +
|
|
1318
|
+
height: i.top + j + i.bottom
|
|
1319
1319
|
} : {
|
|
1320
1320
|
x: ee,
|
|
1321
|
-
y:
|
|
1321
|
+
y: te,
|
|
1322
1322
|
width: t,
|
|
1323
|
-
height:
|
|
1323
|
+
height: j
|
|
1324
1324
|
};
|
|
1325
|
-
for (let n of
|
|
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,
|
|
1325
|
+
for (let n of ne) {
|
|
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, j + i.bottom);
|
|
1327
1327
|
n.staticSlot = {
|
|
1328
1328
|
kind: "grid",
|
|
1329
1329
|
area: {
|
|
1330
1330
|
x: ee + r.start,
|
|
1331
|
-
y:
|
|
1331
|
+
y: te + a.start,
|
|
1332
1332
|
width: Math.max(0, r.end - r.start),
|
|
1333
1333
|
height: Math.max(0, a.end - a.start)
|
|
1334
1334
|
},
|
|
@@ -1336,7 +1336,7 @@ function st(e, t, n, r, i, a) {
|
|
|
1336
1336
|
};
|
|
1337
1337
|
}
|
|
1338
1338
|
}
|
|
1339
|
-
return
|
|
1339
|
+
return j;
|
|
1340
1340
|
}
|
|
1341
1341
|
function ct(e) {
|
|
1342
1342
|
let t = e.style.display === "grid";
|
|
@@ -1376,8 +1376,8 @@ function dt(e, t, n, r) {
|
|
|
1376
1376
|
i.push({
|
|
1377
1377
|
start: s.col.start,
|
|
1378
1378
|
span: s.col.span,
|
|
1379
|
-
min:
|
|
1380
|
-
max:
|
|
1379
|
+
min: J(a, "min", r) + xt(c),
|
|
1380
|
+
max: J(a, "max", r) + xt(c)
|
|
1381
1381
|
});
|
|
1382
1382
|
}), i;
|
|
1383
1383
|
}
|
|
@@ -1405,11 +1405,11 @@ function ft(e, t, n) {
|
|
|
1405
1405
|
function pt(e, t, n, r) {
|
|
1406
1406
|
let { border: i, padding: a } = e.style;
|
|
1407
1407
|
return t === "cols" ? {
|
|
1408
|
-
start: (n.left ?? 0) + i.left +
|
|
1409
|
-
end: (n.right ?? 0) + i.right +
|
|
1408
|
+
start: (n.left ?? 0) + i.left + U(a.left, r),
|
|
1409
|
+
end: (n.right ?? 0) + i.right + U(a.right, r)
|
|
1410
1410
|
} : {
|
|
1411
|
-
start: (n.top ?? 0) + i.top +
|
|
1412
|
-
end: (n.bottom ?? 0) + i.bottom +
|
|
1411
|
+
start: (n.top ?? 0) + i.top + U(a.top, r),
|
|
1412
|
+
end: (n.bottom ?? 0) + i.bottom + U(a.bottom, r)
|
|
1413
1413
|
};
|
|
1414
1414
|
}
|
|
1415
1415
|
function mt(e, t, n, r, i) {
|
|
@@ -1418,7 +1418,7 @@ function mt(e, t, n, r, i) {
|
|
|
1418
1418
|
row: n.row.span
|
|
1419
1419
|
}), s = [];
|
|
1420
1420
|
if (o.children.forEach((e, 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 =
|
|
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 = W(e.style.margin, 0);
|
|
1422
1422
|
if (ct(e)[t]) {
|
|
1423
1423
|
let n = pt(e, t, p, 0), a = mt(e, t, c, {
|
|
1424
1424
|
start: n.start + (u ? r.start : 0),
|
|
@@ -1433,8 +1433,8 @@ function mt(e, t, n, r, i) {
|
|
|
1433
1433
|
if (t === "cols") s.push({
|
|
1434
1434
|
start: l.start,
|
|
1435
1435
|
span: l.span,
|
|
1436
|
-
min:
|
|
1437
|
-
max:
|
|
1436
|
+
min: J(e, "min", i) + xt(p) + f,
|
|
1437
|
+
max: J(e, "max", i) + xt(p) + f
|
|
1438
1438
|
});
|
|
1439
1439
|
else {
|
|
1440
1440
|
let t = e.localRect.height + St(p) + f;
|
|
@@ -1475,7 +1475,7 @@ function gt(e, t) {
|
|
|
1475
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 ? {
|
|
1476
1476
|
col: e.subgrid.colSpan,
|
|
1477
1477
|
row: e.subgrid.rowSpan
|
|
1478
|
-
} : void 0), o = a.children.map(ct), s = a.children.map((e) =>
|
|
1478
|
+
} : void 0), o = a.children.map(ct), s = a.children.map((e) => W(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 = {
|
|
1479
1479
|
min: c.sizes.reduce((e, t) => e + t, 0) + l,
|
|
1480
1480
|
max: c.limits.reduce((e, t) => e + t, 0) + l
|
|
1481
1481
|
};
|
|
@@ -1574,7 +1574,7 @@ function Ct(e, t, n) {
|
|
|
1574
1574
|
}
|
|
1575
1575
|
function wt(e, t) {
|
|
1576
1576
|
if (e.kind === "cells") return e.value;
|
|
1577
|
-
if (e.kind === "percent" && t !== void 0) return
|
|
1577
|
+
if (e.kind === "percent" && t !== void 0) return we(e.value, t);
|
|
1578
1578
|
if (e.kind === "math") {
|
|
1579
1579
|
let n = [];
|
|
1580
1580
|
for (let r of e.args) {
|
|
@@ -1805,7 +1805,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1805
1805
|
if (n.length === 0) continue;
|
|
1806
1806
|
let i = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - i;
|
|
1807
1807
|
if (a > 0) {
|
|
1808
|
-
let e = n.reduce((e, t) => e + t.frFactor, 0), t =
|
|
1808
|
+
let e = n.reduce((e, t) => e + t.frFactor, 0), t = I(n.map((t) => e > 0 ? t.frFactor : 1), a);
|
|
1809
1809
|
n.forEach((e, n) => {
|
|
1810
1810
|
e.base += t[n];
|
|
1811
1811
|
});
|
|
@@ -1816,7 +1816,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1816
1816
|
if (i.length > 0) {
|
|
1817
1817
|
let n = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - n;
|
|
1818
1818
|
if (a > 0) {
|
|
1819
|
-
let e =
|
|
1819
|
+
let e = I(i.map(() => 1), a);
|
|
1820
1820
|
i.forEach((t, n) => {
|
|
1821
1821
|
t.base += e[n];
|
|
1822
1822
|
});
|
|
@@ -1827,7 +1827,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1827
1827
|
if (e.length === 0) continue;
|
|
1828
1828
|
let a = i - (t.reduce((e, t) => e + u(t), 0) + r);
|
|
1829
1829
|
if (a > 0) {
|
|
1830
|
-
let t =
|
|
1830
|
+
let t = I(e.map(() => 1), a);
|
|
1831
1831
|
e.forEach((e, n) => {
|
|
1832
1832
|
e.limit = u(e) + t[n];
|
|
1833
1833
|
});
|
|
@@ -1849,7 +1849,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1849
1849
|
n <= 0 || (t = Math.max(t, (e.max - r) / Math.max(n, 1)));
|
|
1850
1850
|
}
|
|
1851
1851
|
for (let n of e) {
|
|
1852
|
-
let e = Math.max(n.base,
|
|
1852
|
+
let e = Math.max(n.base, M(n.frFactor * t));
|
|
1853
1853
|
n.limit = e, r === "max-content" && (n.base = e);
|
|
1854
1854
|
}
|
|
1855
1855
|
}
|
|
@@ -1859,7 +1859,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1859
1859
|
for (; !(t <= 0);) {
|
|
1860
1860
|
let e = s.filter((e) => !e.collapsed && e.limitKind !== "fr" && e.base < u(e));
|
|
1861
1861
|
if (e.length === 0) break;
|
|
1862
|
-
let n =
|
|
1862
|
+
let n = I(e.map(() => 1), t), r = 0;
|
|
1863
1863
|
if (e.forEach((e, t) => {
|
|
1864
1864
|
let i = Math.min(n[t], u(e) - e.base);
|
|
1865
1865
|
e.base += i, r += i;
|
|
@@ -1869,7 +1869,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1869
1869
|
if (n.length > 0) {
|
|
1870
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);
|
|
1871
1871
|
for (a < 1 && (i = Math.floor(i * a));;) {
|
|
1872
|
-
let e =
|
|
1872
|
+
let e = I(r.map((e) => e.frFactor), i), t = r.filter((t, n) => e[n] < t.base);
|
|
1873
1873
|
if (t.length === 0) {
|
|
1874
1874
|
r.forEach((t, n) => {
|
|
1875
1875
|
t.base = Math.max(t.base, e[n]);
|
|
@@ -1883,7 +1883,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1883
1883
|
if (a) {
|
|
1884
1884
|
let t = o - e - s.reduce((e, t) => e + t.base, 0), n = s.filter((e) => !e.collapsed && e.limitKind === "intrinsic-max");
|
|
1885
1885
|
if (t > 0 && n.length > 0) {
|
|
1886
|
-
let e =
|
|
1886
|
+
let e = I(n.map(() => 1), t);
|
|
1887
1887
|
n.forEach((t, n) => {
|
|
1888
1888
|
t.base += e[n];
|
|
1889
1889
|
});
|
|
@@ -1897,7 +1897,7 @@ function Mt(e, t, n, r, i, a) {
|
|
|
1897
1897
|
};
|
|
1898
1898
|
}
|
|
1899
1899
|
function Nt(e, t, n) {
|
|
1900
|
-
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 = F(n === "stretch" ? "start" : n, r, a), s = [], c = 0;
|
|
1901
1901
|
for (let e = 0; e < r.length; e++) c += i[e], s.push(o[e] + c);
|
|
1902
1902
|
return s;
|
|
1903
1903
|
}
|
|
@@ -1910,7 +1910,7 @@ function Ft(e, t, n, r) {
|
|
|
1910
1910
|
}
|
|
1911
1911
|
function It(e, t, n, r, i) {
|
|
1912
1912
|
let a = t ?? 0, o = n ?? 0, s = r - i;
|
|
1913
|
-
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 + L(e, r, i + a + o);
|
|
1914
1914
|
}
|
|
1915
1915
|
//#endregion
|
|
1916
1916
|
//#region src/multicol.ts
|
|
@@ -2006,7 +2006,7 @@ function Jt() {
|
|
|
2006
2006
|
return e.remove(), qt = !(n.width > 0 && n.top - t >= 10), qt;
|
|
2007
2007
|
}
|
|
2008
2008
|
function Yt(e, t) {
|
|
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 =
|
|
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 = je(e, Math.max(1, n - i), {
|
|
2010
2010
|
advances: s,
|
|
2011
2011
|
tracking: i,
|
|
2012
2012
|
firstLineIndent: t.firstLineIndent
|
|
@@ -2034,11 +2034,11 @@ function Xt(e, t, n, r) {
|
|
|
2034
2034
|
end: e.end
|
|
2035
2035
|
});
|
|
2036
2036
|
}
|
|
2037
|
-
e.decorationRuns =
|
|
2037
|
+
e.decorationRuns = Se({
|
|
2038
2038
|
glyphs: S(i.glyphSet),
|
|
2039
2039
|
ruleX: i.ruleX,
|
|
2040
2040
|
ruleY: null,
|
|
2041
|
-
vertical:
|
|
2041
|
+
vertical: He(s, i.ruleInset),
|
|
2042
2042
|
horizontal: [],
|
|
2043
2043
|
contentWidth: a,
|
|
2044
2044
|
contentHeight: t.totalRows,
|
|
@@ -2053,7 +2053,7 @@ function Zt(e, t) {
|
|
|
2053
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;
|
|
2054
2054
|
}
|
|
2055
2055
|
function Qt(e, t, n, r, i, a, o) {
|
|
2056
|
-
let s = e.style, c =
|
|
2056
|
+
let s = e.style, c = H(s, "x", n), l = Ht(s, n, c);
|
|
2057
2057
|
a.right += l.leftover;
|
|
2058
2058
|
let u = s.lineGap, d = i.left + a.left, f = i.top + a.top, p = n - l.leftover, m = [[]], h = [];
|
|
2059
2059
|
for (let e of t) e.style.columnSpan ? (h[m.length - 1] = e, m.push([])) : m[m.length - 1].push(e);
|
|
@@ -2064,12 +2064,12 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2064
2064
|
let i = t.map((e) => ({
|
|
2065
2065
|
node: e,
|
|
2066
2066
|
spans: Hn(e, Math.max(1, l.width - e.style.tracking)),
|
|
2067
|
-
margin:
|
|
2067
|
+
margin: W(e.style.margin, l.width),
|
|
2068
2068
|
pre: 0,
|
|
2069
2069
|
post: 0
|
|
2070
2070
|
})), a = [], o = null, h = null, x = !1;
|
|
2071
2071
|
for (let e of i) {
|
|
2072
|
-
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 : Jn(o, r.top ?? 0), s = i;
|
|
2073
2073
|
_ === "glue" && h !== null ? (s = 0, h.post = i, a[a.length - 1].post = i) : e.pre = i;
|
|
2074
2074
|
let c = x || t.style.breakBeforeColumn;
|
|
2075
2075
|
if (t.style.breakInsideAvoid && n.length > 0) a.push({
|
|
@@ -2134,9 +2134,9 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2134
2134
|
}
|
|
2135
2135
|
let i = h[e];
|
|
2136
2136
|
if (i) {
|
|
2137
|
-
let e =
|
|
2137
|
+
let e = W(i.style.margin, p), t = (e.left ?? 0) + (e.right ?? 0);
|
|
2138
2138
|
B(i, Math.max(0, p - t), void 0, 0, 0, "fill", o);
|
|
2139
|
-
let r =
|
|
2139
|
+
let r = qn(e, p, i.localRect.width), a = (e.top ?? 0) + n;
|
|
2140
2140
|
y += a, i.localRect = {
|
|
2141
2141
|
...i.localRect,
|
|
2142
2142
|
x: d + r,
|
|
@@ -2152,7 +2152,7 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2152
2152
|
let x = y;
|
|
2153
2153
|
for (let t of e.children) {
|
|
2154
2154
|
if (!z(t.style)) continue;
|
|
2155
|
-
let e =
|
|
2155
|
+
let e = W(t.style.margin, n);
|
|
2156
2156
|
t.staticSlot = {
|
|
2157
2157
|
kind: "block",
|
|
2158
2158
|
x: d + (e.left ?? 0),
|
|
@@ -2178,7 +2178,7 @@ function Qt(e, t, n, r, i, a, o) {
|
|
|
2178
2178
|
function $t(e, t, n, r, i, a, o) {
|
|
2179
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);
|
|
2180
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);
|
|
2181
|
-
let f =
|
|
2181
|
+
let f = H(s, "x", t), p = Rt(s, t, f), m = p.length, h = [];
|
|
2182
2182
|
{
|
|
2183
2183
|
let e = 0;
|
|
2184
2184
|
for (let t of p) h.push(e), e += t + f;
|
|
@@ -2187,7 +2187,7 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2187
2187
|
let r = 0, i = 0, a = null, s = 0, c = (e) => {
|
|
2188
2188
|
if (t) for (let t of T) {
|
|
2189
2189
|
if (t.index !== e) continue;
|
|
2190
|
-
let n = a === null ? t.margin.top ?? 0 :
|
|
2190
|
+
let n = a === null ? t.margin.top ?? 0 : Jn(a, t.margin.top ?? 0);
|
|
2191
2191
|
t.child.staticSlot = {
|
|
2192
2192
|
kind: "block",
|
|
2193
2193
|
x: y + g(r) + (t.margin.left ?? 0),
|
|
@@ -2198,7 +2198,7 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2198
2198
|
for (let l = 0; l < w.length; l++) {
|
|
2199
2199
|
let u = w[l];
|
|
2200
2200
|
c(l);
|
|
2201
|
-
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 :
|
|
2201
|
+
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 : Jn(a, u.margin.top ?? 0), f = u.node.localRect.height;
|
|
2202
2202
|
if (a !== null && (u.breakBefore || i + d + f > e) && (r += 1, i = 0, a = null, d = 0), t) {
|
|
2203
2203
|
let e = u.node, t = _(r);
|
|
2204
2204
|
if (t !== v) {
|
|
@@ -2207,7 +2207,7 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2207
2207
|
}
|
|
2208
2208
|
e.localRect = {
|
|
2209
2209
|
...e.localRect,
|
|
2210
|
-
x: y + g(r) +
|
|
2210
|
+
x: y + g(r) + qn(u.margin, t, e.localRect.width),
|
|
2211
2211
|
y: b + C + i + d
|
|
2212
2212
|
};
|
|
2213
2213
|
}
|
|
@@ -2249,33 +2249,33 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2249
2249
|
if (z(r.style)) {
|
|
2250
2250
|
T.push({
|
|
2251
2251
|
child: r,
|
|
2252
|
-
margin:
|
|
2252
|
+
margin: W(r.style.margin, t),
|
|
2253
2253
|
index: w.length
|
|
2254
2254
|
});
|
|
2255
2255
|
continue;
|
|
2256
2256
|
}
|
|
2257
2257
|
if (r.style.columnSpan) {
|
|
2258
2258
|
O(), E = !1;
|
|
2259
|
-
let e =
|
|
2259
|
+
let e = W(r.style.margin, t), i = (e.left ?? 0) + (e.right ?? 0);
|
|
2260
2260
|
B(r, Math.max(0, t - i), n, 0, 0, "fill", o), C += e.top ?? 0, r.localRect = {
|
|
2261
2261
|
...r.localRect,
|
|
2262
|
-
x: y +
|
|
2262
|
+
x: y + qn(e, t, r.localRect.width),
|
|
2263
2263
|
y: b + C
|
|
2264
2264
|
}, C += r.localRect.height + (e.bottom ?? 0);
|
|
2265
2265
|
continue;
|
|
2266
2266
|
}
|
|
2267
|
-
let e =
|
|
2267
|
+
let e = W(r.style.margin, v), i = (e.left ?? 0) + (e.right ?? 0);
|
|
2268
2268
|
B(r, Math.max(0, v - i), n, 0, 0, "fill", o), w.push({
|
|
2269
2269
|
node: r,
|
|
2270
2270
|
margin: e,
|
|
2271
2271
|
breakBefore: E || r.style.breakBeforeColumn
|
|
2272
2272
|
}), E = r.style.breakAfterColumn;
|
|
2273
2273
|
}
|
|
2274
|
-
return O(), s.ruleX && x.length > 0 && (e.decorationRuns =
|
|
2274
|
+
return O(), s.ruleX && x.length > 0 && (e.decorationRuns = Se({
|
|
2275
2275
|
glyphs: S(s.glyphSet),
|
|
2276
2276
|
ruleX: s.ruleX,
|
|
2277
2277
|
ruleY: null,
|
|
2278
|
-
vertical:
|
|
2278
|
+
vertical: He(x, s.ruleInset),
|
|
2279
2279
|
horizontal: [],
|
|
2280
2280
|
contentWidth: t,
|
|
2281
2281
|
contentHeight: C,
|
|
@@ -2288,7 +2288,7 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2288
2288
|
//#endregion
|
|
2289
2289
|
//#region src/table.ts
|
|
2290
2290
|
function en(e, t) {
|
|
2291
|
-
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" && j(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).");
|
|
2292
2292
|
}
|
|
2293
2293
|
function tn(e, t) {
|
|
2294
2294
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
@@ -2296,7 +2296,7 @@ function tn(e, t) {
|
|
|
2296
2296
|
}
|
|
2297
2297
|
function nn(e, t, n) {
|
|
2298
2298
|
let r = (t, r) => {
|
|
2299
|
-
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" ? K(i, 0, t, n) : void 0, o = i && i.kind === "percent" ? i.value : void 0;
|
|
2300
2300
|
for (let t = 0; t < r; t++) e.colFixed.push(a), e.colPercent.push(o);
|
|
2301
2301
|
};
|
|
2302
2302
|
if (t.style.tableRole === "column") {
|
|
@@ -2380,11 +2380,11 @@ function on(e) {
|
|
|
2380
2380
|
e.columnCount = Math.max(t.length, e.colFixed.length);
|
|
2381
2381
|
}
|
|
2382
2382
|
function sn(e, t, n) {
|
|
2383
|
-
let r = e.style, i =
|
|
2383
|
+
let r = e.style, i = tr(e, n), a;
|
|
2384
2384
|
if (t === "min") a = i;
|
|
2385
2385
|
else {
|
|
2386
|
-
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ?
|
|
2387
|
-
a = t === void 0 ?
|
|
2386
|
+
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ? K(r.width, 0, e, n) : void 0;
|
|
2387
|
+
a = t === void 0 ? q(e, n) : Math.max(i, t);
|
|
2388
2388
|
}
|
|
2389
2389
|
let o = typeof r.minWidth == "number" ? r.minWidth : 0, s = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
2390
2390
|
return Math.max(0, V(a, o, s));
|
|
@@ -2412,7 +2412,7 @@ function ln(e, t, n) {
|
|
|
2412
2412
|
for (let t of ["min", "max"]) {
|
|
2413
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;
|
|
2414
2414
|
if (d <= 0) continue;
|
|
2415
|
-
let f =
|
|
2415
|
+
let f = I(c.some((e) => e > 0) ? c : c.map(() => 1), d);
|
|
2416
2416
|
for (let e = r; e < o; e++) l[e] += f[e - r];
|
|
2417
2417
|
}
|
|
2418
2418
|
}
|
|
@@ -2434,19 +2434,19 @@ function un(e, t) {
|
|
|
2434
2434
|
}
|
|
2435
2435
|
let s = a.reduce((t, n) => t + e.min[n], 0), c = i.reduce((e, t) => e + r[t], 0) - (t - s);
|
|
2436
2436
|
if (c > 0) {
|
|
2437
|
-
let t = i.map((t) => r[t] - e.min[t]), n =
|
|
2437
|
+
let t = i.map((t) => r[t] - e.min[t]), n = I(t, Math.min(c, t.reduce((e, t) => e + t, 0)));
|
|
2438
2438
|
i.forEach((e, t) => r[e] -= n[t]);
|
|
2439
2439
|
}
|
|
2440
2440
|
}
|
|
2441
2441
|
let o = t - r.reduce((e, t) => e + t, 0);
|
|
2442
2442
|
if (o > 0 && a.length > 0) {
|
|
2443
|
-
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 = I(t, Math.min(o, n));
|
|
2444
2444
|
a.forEach((e, t) => r[e] += i[t]), o -= Math.min(o, n);
|
|
2445
2445
|
}
|
|
2446
2446
|
if (o > 0) {
|
|
2447
2447
|
let t = a.length > 0 ? a : i;
|
|
2448
2448
|
if (t.length > 0) {
|
|
2449
|
-
let n = t.map((t) => e.max[t]), i =
|
|
2449
|
+
let n = t.map((t) => e.max[t]), i = I(n.some((e) => e > 0) ? n : n.map(() => 1), o);
|
|
2450
2450
|
t.forEach((e, t) => r[e] += i[t]);
|
|
2451
2451
|
}
|
|
2452
2452
|
}
|
|
@@ -2458,8 +2458,8 @@ function dn(e, t, n) {
|
|
|
2458
2458
|
for (let r of e.cells) {
|
|
2459
2459
|
if (r.row !== 0) continue;
|
|
2460
2460
|
let e = r.node.style, a;
|
|
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 =
|
|
2462
|
-
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 = K(e.width, 0, r.node, n)), a === void 0) continue;
|
|
2462
|
+
let o = I(Array.from({ length: r.colSpan }, () => 1), a);
|
|
2463
2463
|
for (let e = 0; e < r.colSpan; e++) {
|
|
2464
2464
|
let t = r.col + e;
|
|
2465
2465
|
i[t] === void 0 && (i[t] = o[e]);
|
|
@@ -2467,7 +2467,7 @@ function dn(e, t, n) {
|
|
|
2467
2467
|
}
|
|
2468
2468
|
let a = i.reduce((e, t) => e + (t ?? 0), 0), o = i.filter((e) => e === void 0).length;
|
|
2469
2469
|
if (o > 0) {
|
|
2470
|
-
let e =
|
|
2470
|
+
let e = I(Array.from({ length: o }, () => 1), Math.max(0, t - a)), n = 0;
|
|
2471
2471
|
for (let t = 0; t < r; t++) i[t] === void 0 && (i[t] = e[n++]);
|
|
2472
2472
|
}
|
|
2473
2473
|
return i.map((e) => e ?? 0);
|
|
@@ -2612,13 +2612,13 @@ function vn(e, t) {
|
|
|
2612
2612
|
}
|
|
2613
2613
|
function yn(e, t) {
|
|
2614
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;
|
|
2615
|
-
return n.caption && (a = Math.max(a,
|
|
2615
|
+
return n.caption && (a = Math.max(a, tr(n.caption, t)), o = Math.max(o, q(n.caption, t))), {
|
|
2616
2616
|
min: a,
|
|
2617
2617
|
max: o
|
|
2618
2618
|
};
|
|
2619
2619
|
}
|
|
2620
2620
|
function bn(e, t, n) {
|
|
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 +
|
|
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 + U(r.padding.left, t) + U(r.padding.right, t) + it(r).right, l = i.max.reduce((e, t) => e + t, 0), u = 0, d = 0;
|
|
2622
2622
|
for (let e = 0; e < i.max.length; e++) {
|
|
2623
2623
|
let t = i.percent[e];
|
|
2624
2624
|
t === void 0 ? d += i.max[e] : u += t;
|
|
@@ -2656,7 +2656,7 @@ function xn(e, t, n, r, i, a) {
|
|
|
2656
2656
|
let t = e.col + e.colSpan, n = h.slice(e.col, t).reduce((e, t) => e + t, 0) + gn(s, e.col, t);
|
|
2657
2657
|
x.set(e, n), B(e.node, n, void 0, 0, 0, "fill", a, { width: n }), b.set(e, e.node.localRect.height);
|
|
2658
2658
|
}
|
|
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 ?
|
|
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 ? we(e.value, w) : 0, E = Array.from({ length: u }, () => 0), D = Array.from({ length: u }, () => !1);
|
|
2660
2660
|
for (let e = 0; e < u; e++) {
|
|
2661
2661
|
let t = o.rows[e].style.height;
|
|
2662
2662
|
t !== void 0 && t.kind === "cells" && (E[e] = t.value);
|
|
@@ -2671,7 +2671,7 @@ function xn(e, t, n, r, i, a) {
|
|
|
2671
2671
|
for (let e of O) {
|
|
2672
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;
|
|
2673
2673
|
if (r <= 0) continue;
|
|
2674
|
-
let i =
|
|
2674
|
+
let i = I(Array.from({ length: e.rowSpan }, () => 1), r);
|
|
2675
2675
|
for (let n = e.row; n < t; n++) E[n] += i[n - e.row];
|
|
2676
2676
|
}
|
|
2677
2677
|
if (n !== void 0 && u > 0) {
|
|
@@ -2679,18 +2679,18 @@ function xn(e, t, n, r, i, a) {
|
|
|
2679
2679
|
if (e > 0) {
|
|
2680
2680
|
let t = [];
|
|
2681
2681
|
for (let e = 0; e < u; e++) D[e] || t.push(e);
|
|
2682
|
-
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 = I(n.map(() => 1), e);
|
|
2683
2683
|
n.forEach((e, t) => E[e] += r[t]);
|
|
2684
2684
|
}
|
|
2685
2685
|
}
|
|
2686
2686
|
let k = o.caption && e.style.captionSide === "top" ? y : 0, A = [], ee = k;
|
|
2687
2687
|
for (let e = 0; e < u; e++) ee += s.collapsed ? s.hLines[e] : s.spacingY, A.push(ee), ee += E[e];
|
|
2688
|
-
let
|
|
2688
|
+
let te = u > 0 ? ee + (s.collapsed ? s.hLines[u] ?? 0 : s.spacingY) : k, j = /* @__PURE__ */ new Map();
|
|
2689
2689
|
for (let e = 0; e < u; e++) {
|
|
2690
2690
|
let t = o.rowGroups[e];
|
|
2691
|
-
t && !
|
|
2691
|
+
t && !j.has(t) && j.set(t, A[e]);
|
|
2692
2692
|
}
|
|
2693
|
-
for (let [e, t] of
|
|
2693
|
+
for (let [e, t] of j) {
|
|
2694
2694
|
let n = t;
|
|
2695
2695
|
for (let t = 0; t < u; t++) o.rowGroups[t] === e && (n = A[t] + E[t]);
|
|
2696
2696
|
e.localRect = {
|
|
@@ -2706,7 +2706,7 @@ function xn(e, t, n, r, i, a) {
|
|
|
2706
2706
|
}, e.unclampedHeight = n - t;
|
|
2707
2707
|
}
|
|
2708
2708
|
for (let e = 0; e < u; e++) {
|
|
2709
|
-
let t = o.rows[e], n = o.rowGroups[e], r = n ?
|
|
2709
|
+
let t = o.rows[e], n = o.rowGroups[e], r = n ? j.get(n) : void 0;
|
|
2710
2710
|
t.localRect = {
|
|
2711
2711
|
x: r === void 0 ? d : 0,
|
|
2712
2712
|
y: r === void 0 ? f + A[e] : A[e] - r,
|
|
@@ -2736,7 +2736,7 @@ function xn(e, t, n, r, i, a) {
|
|
|
2736
2736
|
x: d,
|
|
2737
2737
|
y: f
|
|
2738
2738
|
});
|
|
2739
|
-
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 + te), 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" ? te + y : te;
|
|
2740
2740
|
}
|
|
2741
2741
|
function Sn(e, t) {
|
|
2742
2742
|
if (t <= 0) return;
|
|
@@ -2754,7 +2754,7 @@ function Cn(e, t, n, r, i, a, o, s, c) {
|
|
|
2754
2754
|
for (let e = 0; e < u; e++) {
|
|
2755
2755
|
let i = n[e];
|
|
2756
2756
|
if (!i) continue;
|
|
2757
|
-
let l =
|
|
2757
|
+
let l = ge(i.style, "v", c);
|
|
2758
2758
|
for (let n = 0; n < i.width; n++) for (let c = a[e]; c < a[e] + r[e]; c++) d.push({
|
|
2759
2759
|
glyph: l,
|
|
2760
2760
|
x: o + f(t) + n,
|
|
@@ -2769,7 +2769,7 @@ function Cn(e, t, n, r, i, a, o, s, c) {
|
|
|
2769
2769
|
for (let e = 0; e < l; e++) {
|
|
2770
2770
|
let a = r[e];
|
|
2771
2771
|
if (!a) continue;
|
|
2772
|
-
let l =
|
|
2772
|
+
let l = ge(a.style, "h", c);
|
|
2773
2773
|
for (let r = 0; r < a.width; r++) d.push({
|
|
2774
2774
|
glyph: l,
|
|
2775
2775
|
x: o + i[e],
|
|
@@ -2788,7 +2788,7 @@ function Cn(e, t, n, r, i, a, o, s, c) {
|
|
|
2788
2788
|
m
|
|
2789
2789
|
].filter((e) => e !== null);
|
|
2790
2790
|
if (h.length === 0) continue;
|
|
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 =
|
|
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 = _e(g, r !== null, i !== null, a !== null, m !== null, c);
|
|
2792
2792
|
for (let r = 0; r < e.vLines[t]; r++) for (let i = 0; i < e.hLines[n]; i++) d.push({
|
|
2793
2793
|
glyph: v,
|
|
2794
2794
|
x: o + f(t) + r,
|
|
@@ -2819,7 +2819,7 @@ function Tn(e, t, n, r, i) {
|
|
|
2819
2819
|
}
|
|
2820
2820
|
}
|
|
2821
2821
|
function En(e, t, n) {
|
|
2822
|
-
return e === null ? t === null ? 0 : -
|
|
2822
|
+
return e === null ? t === null ? 0 : -U(t, n) : U(e, n);
|
|
2823
2823
|
}
|
|
2824
2824
|
function Dn(e, t) {
|
|
2825
2825
|
if (!t) for (let t = e.length - 1; t > 0; t--) {
|
|
@@ -2847,14 +2847,14 @@ function On(e, t, n, r, i, a) {
|
|
|
2847
2847
|
y: r + c.area.y,
|
|
2848
2848
|
width: c.area.width,
|
|
2849
2849
|
height: c.area.height
|
|
2850
|
-
} : Dn(i, s), u = o.insets.left === null ? null :
|
|
2851
|
-
if (!y) C.width = V(
|
|
2850
|
+
} : Dn(i, s), u = o.insets.left === null ? null : U(o.insets.left, l.width), d = o.insets.right === null ? null : U(o.insets.right, l.width), f = o.insets.top === null ? null : U(o.insets.top, l.height), p = o.insets.bottom === null ? null : U(o.insets.bottom, l.height), m = W(o.margin, l.width), h = m.left ?? 0, g = m.right ?? 0, _ = m.top ?? 0, v = m.bottom ?? 0, y = o.width === void 0 || o.width.kind === "auto", b = o.height === void 0 || o.height.kind === "auto", x = Gn(o.minWidth, l.width, e, a) ?? 0, S = Gn(o.maxWidth, l.width, e, a), C = {};
|
|
2851
|
+
if (!y) C.width = V(K(o.width, l.width, e, a), x, S);
|
|
2852
2852
|
else if (u !== null && d !== null) C.width = V(Math.max(0, l.width - u - d - h - g), x, S);
|
|
2853
2853
|
else {
|
|
2854
2854
|
let t = Math.max(0, l.width - (u ?? 0) - (d ?? 0) - h - g);
|
|
2855
|
-
C.width = V(Math.min(
|
|
2855
|
+
C.width = V(Math.min(q(e, a), Math.max(tr(e, a), t)), x, S);
|
|
2856
2856
|
}
|
|
2857
|
-
f !== null && p !== null && b && (C.height = V(Math.max(0, l.height - f - p - _ - v),
|
|
2857
|
+
f !== null && p !== null && b && (C.height = V(Math.max(0, l.height - f - p - _ - v), G(o.minHeight, l.height) ?? 0, G(o.maxHeight, l.height))), B(e, l.width, l.height, 0, 0, "shrink", a, C);
|
|
2858
2858
|
let w = e.localRect.width, T = e.localRect.height, E;
|
|
2859
2859
|
if (u !== null && d !== null) {
|
|
2860
2860
|
let e = Math.max(0, l.width - u - d - w - h - g), t = m.left === null && m.right === null;
|
|
@@ -2872,13 +2872,13 @@ function On(e, t, n, r, i, a) {
|
|
|
2872
2872
|
};
|
|
2873
2873
|
}
|
|
2874
2874
|
function kn(e, t, n) {
|
|
2875
|
-
return
|
|
2875
|
+
return F(e, [n], Math.max(0, t - n))[0];
|
|
2876
2876
|
}
|
|
2877
2877
|
function An(e, t, n, r) {
|
|
2878
|
-
return Ye(
|
|
2878
|
+
return L(Ye(e, t), n, r);
|
|
2879
2879
|
}
|
|
2880
2880
|
function jn(e, t, n, r, i) {
|
|
2881
|
-
let a =
|
|
2881
|
+
let a = W(e.style.margin, n.innerWidth), [o, s, c, l] = r === "x" ? [
|
|
2882
2882
|
a.left ?? 0,
|
|
2883
2883
|
a.right ?? 0,
|
|
2884
2884
|
n.innerWidth,
|
|
@@ -2892,7 +2892,7 @@ function jn(e, t, n, r, i) {
|
|
|
2892
2892
|
return (l ? kn($e(t.style), c, u) : An(e, t, c, u)) + o;
|
|
2893
2893
|
}
|
|
2894
2894
|
function Mn(e, t, n, r, i) {
|
|
2895
|
-
let a =
|
|
2895
|
+
let a = W(e.style.margin, n.width), o = e.style.justifySelf === "auto" ? t.style.justifyItems : e.style.justifySelf, [s, c, l, u] = r === "x" ? [
|
|
2896
2896
|
a.left ?? 0,
|
|
2897
2897
|
a.right ?? 0,
|
|
2898
2898
|
n.width,
|
|
@@ -2901,9 +2901,9 @@ function Mn(e, t, n, r, i) {
|
|
|
2901
2901
|
a.top ?? 0,
|
|
2902
2902
|
a.bottom ?? 0,
|
|
2903
2903
|
n.height,
|
|
2904
|
-
|
|
2904
|
+
Ye(e, t)
|
|
2905
2905
|
];
|
|
2906
|
-
return
|
|
2906
|
+
return L(u, l, i + s + c) + s;
|
|
2907
2907
|
}
|
|
2908
2908
|
function Nn(e, t, n, r) {
|
|
2909
2909
|
let i = e.staticSlot;
|
|
@@ -2922,7 +2922,7 @@ function Fn(e, t) {
|
|
|
2922
2922
|
absX: 0,
|
|
2923
2923
|
absY: 0
|
|
2924
2924
|
}], n);
|
|
2925
|
-
let r = e.localRect.height, i =
|
|
2925
|
+
let r = e.localRect.height, i = Xn(e);
|
|
2926
2926
|
return e.localRect.width = Math.max(e.localRect.width, i.x), e.localRect.height = Math.max(r, i.y), { height: r };
|
|
2927
2927
|
}
|
|
2928
2928
|
function z(e) {
|
|
@@ -2942,18 +2942,18 @@ function Ln() {
|
|
|
2942
2942
|
function B(e, t, n, r, i, a, o, s) {
|
|
2943
2943
|
let c = e.style, l = s?.height;
|
|
2944
2944
|
delete e.decorationRuns, delete e.multicolGeometry, delete e.multicolFlow, delete e.multicolFlowSpan, delete e.textExtent;
|
|
2945
|
-
let u =
|
|
2945
|
+
let u = Gn(c.minWidth, t, e, o) ?? 0, d = Gn(c.maxWidth, t, e, o), f = G(c.minHeight, n) ?? 0, p = G(c.maxHeight, n), m = it(c), h = rt(c);
|
|
2946
2946
|
s?.gutter?.right && (m.right = h.right), s?.gutter?.bottom && (m.bottom = h.bottom);
|
|
2947
2947
|
let g = {
|
|
2948
|
-
top:
|
|
2949
|
-
right:
|
|
2950
|
-
bottom:
|
|
2951
|
-
left:
|
|
2948
|
+
top: U(c.padding.top, t),
|
|
2949
|
+
right: U(c.padding.right, t) + m.right,
|
|
2950
|
+
bottom: U(c.padding.bottom, t) + m.bottom,
|
|
2951
|
+
left: U(c.padding.left, t)
|
|
2952
2952
|
};
|
|
2953
2953
|
e.resolvedPadding = g;
|
|
2954
|
-
let _ = s?.width ?? V(
|
|
2954
|
+
let _ = s?.width ?? V(Yn(c, t, a, e, o), u, d), v = $n(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) => {
|
|
2955
2955
|
let r = n && Number.isFinite(t) ? t : void 0;
|
|
2956
|
-
return S ? Rn(e, y.width, t, r, x, g, o) : c.display === "flex" && c.flexDirection === "row" ?
|
|
2956
|
+
return S ? Rn(e, y.width, t, r, x, g, o) : c.display === "flex" && c.flexDirection === "row" ? Ue(e, y.width, t, r, c.border, g, o) : c.display === "flex" ? Ge(e, y.width, t, n, c.border, g, o) : c.display === "grid" ? 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) : Kn(e, y.width, r, c.border, g, o);
|
|
2957
2957
|
}, w = C(y.height, b);
|
|
2958
2958
|
if (!S && (c.display === "flex" || c.display === "grid") && !b && p !== void 0) {
|
|
2959
2959
|
let e = c.border.top + c.border.bottom + g.top + g.bottom, t = V(w + e, f, p) - e;
|
|
@@ -2972,7 +2972,7 @@ function B(e, t, n, r, i, a, o, s) {
|
|
|
2972
2972
|
width: _,
|
|
2973
2973
|
height: D
|
|
2974
2974
|
}, tt(c.overflow.x) || tt(c.overflow.y)) {
|
|
2975
|
-
let l =
|
|
2975
|
+
let l = Xn(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);
|
|
2976
2976
|
if (e.scrollRange = {
|
|
2977
2977
|
sizeX: u,
|
|
2978
2978
|
sizeY: d,
|
|
@@ -3004,29 +3004,29 @@ function Rn(e, t, n, r, i, a, o) {
|
|
|
3004
3004
|
let s = e.style, c;
|
|
3005
3005
|
if (e.text) {
|
|
3006
3006
|
let l = nt(e);
|
|
3007
|
-
|
|
3007
|
+
Fe(e.text, (n, r) => {
|
|
3008
3008
|
let i = l[r];
|
|
3009
3009
|
B(i, t, void 0, 0, 0, "shrink", o), e.advances[n] = Math.max(1, i.localRect.width);
|
|
3010
3010
|
});
|
|
3011
3011
|
let u, d;
|
|
3012
3012
|
if (s.display === "multicol") {
|
|
3013
|
-
let n =
|
|
3013
|
+
let n = H(s, "x", t), o = Ht(s, t, n);
|
|
3014
3014
|
a.right += o.leftover;
|
|
3015
3015
|
let c = Wt(e, o, n, Bt(r, i));
|
|
3016
3016
|
e.multicolGeometry = c, u = c, d = c.lineX;
|
|
3017
3017
|
} else u = Vn(e, t);
|
|
3018
3018
|
if (c = u.totalRows, e.textExtent = {
|
|
3019
|
-
width: u.spans.reduce((t, n) => Math.max(t,
|
|
3019
|
+
width: u.spans.reduce((t, n) => Math.max(t, P(n.start, n.end, e.advances, s.tracking)), 0),
|
|
3020
3020
|
rows: u.totalRows
|
|
3021
3021
|
}, Bn(e, u, t, n, a), l.length > 0) {
|
|
3022
3022
|
let t = (e) => u.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
3023
|
-
|
|
3023
|
+
Fe(e.text, (n, r) => {
|
|
3024
3024
|
let i = t(n);
|
|
3025
3025
|
if (i === -1) return;
|
|
3026
3026
|
let o = u.spans[i];
|
|
3027
3027
|
l[r].localRect = {
|
|
3028
3028
|
...l[r].localRect,
|
|
3029
|
-
x: s.border.left + a.left + (d?.[i] ?? 0) +
|
|
3029
|
+
x: s.border.left + a.left + (d?.[i] ?? 0) + Me(o.start, n, e.advances),
|
|
3030
3030
|
y: s.border.top + a.top + u.lineY[i]
|
|
3031
3031
|
};
|
|
3032
3032
|
});
|
|
@@ -3034,7 +3034,7 @@ function Rn(e, t, n, r, i, a, o) {
|
|
|
3034
3034
|
} else c = e.intrinsicHeight;
|
|
3035
3035
|
for (let n of e.children) {
|
|
3036
3036
|
if (n.inlineBox) continue;
|
|
3037
|
-
let e =
|
|
3037
|
+
let e = W(n.style.margin, t);
|
|
3038
3038
|
n.staticSlot = {
|
|
3039
3039
|
kind: "block",
|
|
3040
3040
|
x: s.border.left + a.left + (e.left ?? 0),
|
|
@@ -3052,15 +3052,15 @@ function V(e, t, n) {
|
|
|
3052
3052
|
function Bn(e, t, n, r, i) {
|
|
3053
3053
|
let a = e.style;
|
|
3054
3054
|
if (a.display !== "flex" && a.display !== "grid" || t.spans.length === 0) return;
|
|
3055
|
-
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, P(n.start, n.end, e.advances, a.tracking)), 0), c = Math.max(0, n - s);
|
|
3056
3056
|
if (c > 0) {
|
|
3057
|
-
let e = a.display === "grid" ?
|
|
3057
|
+
let e = a.display === "grid" ? L(a.justifyItems, n, s) : o ? L(a.alignItems, n, s) : F($e(a), [s], c)[0];
|
|
3058
3058
|
e > 0 && (i.left += e, i.right += c - e);
|
|
3059
3059
|
}
|
|
3060
3060
|
if (Number.isFinite(r)) {
|
|
3061
3061
|
let e = Math.max(0, r - t.totalRows);
|
|
3062
3062
|
if (e > 0) {
|
|
3063
|
-
let n = a.display === "grid" || !o ?
|
|
3063
|
+
let n = a.display === "grid" || !o ? L(a.alignItems, r, t.totalRows) : F($e(a), [t.totalRows], e)[0];
|
|
3064
3064
|
n > 0 && (i.top += n, i.bottom += e - n);
|
|
3065
3065
|
}
|
|
3066
3066
|
}
|
|
@@ -3076,11 +3076,11 @@ function Vn(e, t) {
|
|
|
3076
3076
|
};
|
|
3077
3077
|
}
|
|
3078
3078
|
function Hn(e, t) {
|
|
3079
|
-
return e.style.whiteSpace === "normal" ?
|
|
3079
|
+
return e.style.whiteSpace === "normal" ? je(e.text, t, {
|
|
3080
3080
|
advances: e.advances,
|
|
3081
3081
|
tracking: e.style.tracking,
|
|
3082
3082
|
firstLineIndent: e.style.textIndent
|
|
3083
|
-
}) :
|
|
3083
|
+
}) : Ae(e.text);
|
|
3084
3084
|
}
|
|
3085
3085
|
function Un(e, t) {
|
|
3086
3086
|
let n = nt(e), r = [], i = [], a = 0;
|
|
@@ -3089,7 +3089,7 @@ function Un(e, t) {
|
|
|
3089
3089
|
for (let r = o.start; r < o.end; r++) {
|
|
3090
3090
|
if (e.text[r] !== "") continue;
|
|
3091
3091
|
let i = n[a];
|
|
3092
|
-
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" && j(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++;
|
|
3093
3093
|
}
|
|
3094
3094
|
r.push(t), i.push(Math.min(s, t - 1));
|
|
3095
3095
|
}
|
|
@@ -3098,15 +3098,15 @@ function Un(e, t) {
|
|
|
3098
3098
|
textOffsets: i
|
|
3099
3099
|
};
|
|
3100
3100
|
}
|
|
3101
|
-
function
|
|
3102
|
-
let r =
|
|
3101
|
+
function H(e, t, n) {
|
|
3102
|
+
let r = U(t === "x" ? e.gapX : e.gapY, n), i = t === "x" ? e.ruleX : e.ruleY;
|
|
3103
3103
|
return Math.max(r, i?.width ?? 0);
|
|
3104
3104
|
}
|
|
3105
|
-
function H(e, t) {
|
|
3106
|
-
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 : Ce(e.percent, t);
|
|
3107
|
-
}
|
|
3108
3105
|
function U(e, t) {
|
|
3109
|
-
|
|
3106
|
+
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 : we(e.percent, t);
|
|
3107
|
+
}
|
|
3108
|
+
function W(e, t) {
|
|
3109
|
+
let n = (e) => e === null ? null : U(e, t);
|
|
3110
3110
|
return {
|
|
3111
3111
|
top: n(e.top),
|
|
3112
3112
|
right: n(e.right),
|
|
@@ -3114,30 +3114,30 @@ function U(e, t) {
|
|
|
3114
3114
|
left: n(e.left)
|
|
3115
3115
|
};
|
|
3116
3116
|
}
|
|
3117
|
-
function
|
|
3117
|
+
function Wn(e) {
|
|
3118
3118
|
return typeof e == "number" ? e : 0;
|
|
3119
3119
|
}
|
|
3120
|
-
function
|
|
3121
|
-
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 :
|
|
3120
|
+
function G(e, t) {
|
|
3121
|
+
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 : we(e.percent, t);
|
|
3122
3122
|
}
|
|
3123
|
-
function
|
|
3124
|
-
return e === "min-content" || e === "max-content" || e === "fit-content" ?
|
|
3123
|
+
function Gn(e, t, n, r) {
|
|
3124
|
+
return e === "min-content" || e === "max-content" || e === "fit-content" ? K({ kind: e }, t, n, r) : G(e, t);
|
|
3125
3125
|
}
|
|
3126
|
-
function
|
|
3126
|
+
function Kn(e, t, n, r, i, a) {
|
|
3127
3127
|
let o = r.left + i.left, s = r.top + i.top, c = s, l = null;
|
|
3128
3128
|
for (let r of e.children) {
|
|
3129
|
-
let e =
|
|
3129
|
+
let e = W(r.style.margin, t), i = e.top ?? 0, s = e.bottom ?? 0, u = e.left ?? 0, d = e.right ?? 0;
|
|
3130
3130
|
if (z(r.style)) {
|
|
3131
3131
|
r.staticSlot = {
|
|
3132
3132
|
kind: "block",
|
|
3133
3133
|
x: o + u,
|
|
3134
|
-
y: c + (l === null ? i :
|
|
3134
|
+
y: c + (l === null ? i : Jn(l, i))
|
|
3135
3135
|
};
|
|
3136
3136
|
continue;
|
|
3137
3137
|
}
|
|
3138
3138
|
B(r, Math.max(0, t - u - d), n, 0, 0, "fill", a);
|
|
3139
|
-
let f =
|
|
3140
|
-
c += l === null ? i :
|
|
3139
|
+
let f = qn(e, t, r.localRect.width);
|
|
3140
|
+
c += l === null ? i : Jn(l, i), r.localRect = {
|
|
3141
3141
|
...r.localRect,
|
|
3142
3142
|
x: o + f,
|
|
3143
3143
|
y: c
|
|
@@ -3145,30 +3145,30 @@ function qn(e, t, n, r, i, a) {
|
|
|
3145
3145
|
}
|
|
3146
3146
|
return l !== null && (c += l), c - s;
|
|
3147
3147
|
}
|
|
3148
|
-
function
|
|
3148
|
+
function qn(e, t, n) {
|
|
3149
3149
|
let r = t - n;
|
|
3150
3150
|
return e.left === null && e.right === null ? Math.floor(r / 2) : e.left === null ? r - (e.right ?? 0) : e.left;
|
|
3151
3151
|
}
|
|
3152
|
-
function
|
|
3152
|
+
function Jn(e, t) {
|
|
3153
3153
|
return e >= 0 && t >= 0 ? Math.max(e, t) : e <= 0 && t <= 0 ? Math.min(e, t) : e + t;
|
|
3154
3154
|
}
|
|
3155
|
-
function
|
|
3155
|
+
function Yn(e, t, n, r, i) {
|
|
3156
3156
|
let a = e.width;
|
|
3157
3157
|
if (e.display === "table") {
|
|
3158
|
-
if (!r.children.some((e) => !z(e.style) && !e.inlineBox)) return a !== void 0 && a.kind !== "auto" ?
|
|
3158
|
+
if (!r.children.some((e) => !z(e.style) && !e.inlineBox)) return a !== void 0 && a.kind !== "auto" ? K(a, t, r, i) : Math.min(t, q(r, i));
|
|
3159
3159
|
if (a !== void 0 && a.kind !== "auto") {
|
|
3160
|
-
let e =
|
|
3161
|
-
return Math.max(e,
|
|
3160
|
+
let e = K(a, t, r, i);
|
|
3161
|
+
return Math.max(e, Qn(r, t, i));
|
|
3162
3162
|
}
|
|
3163
3163
|
return bn(r, t, i);
|
|
3164
3164
|
}
|
|
3165
|
-
return a !== void 0 && a.kind !== "auto" ?
|
|
3165
|
+
return a !== void 0 && a.kind !== "auto" ? K(a, t, r, i) : n === "shrink" ? Math.min(t, q(r, i)) : t;
|
|
3166
3166
|
}
|
|
3167
|
-
function
|
|
3167
|
+
function Xn(e) {
|
|
3168
3168
|
let t = 0, n = 0;
|
|
3169
3169
|
for (let r of e.children) {
|
|
3170
3170
|
if (r.style.position === "fixed") continue;
|
|
3171
|
-
let e =
|
|
3171
|
+
let e = Zn(r);
|
|
3172
3172
|
t = Math.max(t, r.localRect.x + e.x), n = Math.max(n, r.localRect.y + e.y);
|
|
3173
3173
|
}
|
|
3174
3174
|
if (e.textExtent) {
|
|
@@ -3180,79 +3180,79 @@ function Zn(e) {
|
|
|
3180
3180
|
y: n
|
|
3181
3181
|
};
|
|
3182
3182
|
}
|
|
3183
|
-
function
|
|
3183
|
+
function Zn(e) {
|
|
3184
3184
|
let { width: t, height: n } = e.localRect, r = e.style.overflow.x !== "visible", i = e.style.overflow.y !== "visible";
|
|
3185
3185
|
if (r && i) return {
|
|
3186
3186
|
x: t,
|
|
3187
3187
|
y: n
|
|
3188
3188
|
};
|
|
3189
|
-
let a =
|
|
3189
|
+
let a = Xn(e);
|
|
3190
3190
|
return {
|
|
3191
3191
|
x: r ? t : Math.max(t, a.x),
|
|
3192
3192
|
y: i ? n : Math.max(n, a.y)
|
|
3193
3193
|
};
|
|
3194
3194
|
}
|
|
3195
|
-
function
|
|
3195
|
+
function Qn(e, t, n) {
|
|
3196
3196
|
let r = e.style;
|
|
3197
|
-
return yn(e, n).min + r.border.left + r.border.right +
|
|
3197
|
+
return yn(e, n).min + r.border.left + r.border.right + U(r.padding.left, t) + U(r.padding.right, t) + it(r).right;
|
|
3198
3198
|
}
|
|
3199
|
-
function
|
|
3199
|
+
function $n(e, t) {
|
|
3200
3200
|
if (e.height?.kind === "cells") return e.height.value;
|
|
3201
|
-
if (e.height?.kind === "percent" && t != null) return
|
|
3201
|
+
if (e.height?.kind === "percent" && t != null) return we(e.height.value, t);
|
|
3202
3202
|
}
|
|
3203
|
-
function
|
|
3203
|
+
function K(e, t, n, r) {
|
|
3204
3204
|
switch (e.kind) {
|
|
3205
3205
|
case "cells": return e.value;
|
|
3206
|
-
case "percent": return
|
|
3207
|
-
case "min-content": return
|
|
3208
|
-
case "max-content": return
|
|
3209
|
-
case "fit-content": return Math.min(
|
|
3210
|
-
case "auto": return
|
|
3206
|
+
case "percent": return we(e.value, t);
|
|
3207
|
+
case "min-content": return tr(n, r);
|
|
3208
|
+
case "max-content": return q(n, r);
|
|
3209
|
+
case "fit-content": return Math.min(q(n, r), Math.max(tr(n, r), t));
|
|
3210
|
+
case "auto": return q(n, r);
|
|
3211
3211
|
}
|
|
3212
3212
|
}
|
|
3213
|
-
function
|
|
3213
|
+
function q(e, t) {
|
|
3214
3214
|
let n = t.maxContent.get(e);
|
|
3215
3215
|
if (n !== void 0) return n;
|
|
3216
|
-
let r = e.style, i =
|
|
3216
|
+
let r = e.style, i = er(e, t) + r.border.left + r.border.right + Wn(r.padding.left) + Wn(r.padding.right) + it(r).right;
|
|
3217
3217
|
return t.maxContent.set(e, i), i;
|
|
3218
3218
|
}
|
|
3219
|
-
function
|
|
3219
|
+
function er(e, t) {
|
|
3220
3220
|
let n = e.children.filter((e) => !z(e.style) && !e.inlineBox);
|
|
3221
3221
|
if (n.length === 0) return e.style.display === "multicol" ? zt(e.style, e.intrinsicWidth) : e.intrinsicWidth;
|
|
3222
3222
|
if (e.style.display === "grid") return gt(e, t).max;
|
|
3223
3223
|
if (e.style.display === "table") return yn(e, t).max;
|
|
3224
3224
|
if (e.style.display === "flex" && e.style.flexDirection === "row") {
|
|
3225
|
-
let r = Math.max(
|
|
3226
|
-
return n.reduce((e, n) => e +
|
|
3225
|
+
let r = Math.max(Wn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
3226
|
+
return n.reduce((e, n) => e + J(n, "max", t), 0) + r;
|
|
3227
3227
|
}
|
|
3228
|
-
let r = n.reduce((e, n) => Math.max(e,
|
|
3228
|
+
let r = n.reduce((e, n) => Math.max(e, J(n, "max", t)), 0);
|
|
3229
3229
|
return e.style.display === "multicol" ? zt(e.style, r) : r;
|
|
3230
3230
|
}
|
|
3231
|
-
function
|
|
3231
|
+
function J(e, t, n) {
|
|
3232
3232
|
let r = e.style, i;
|
|
3233
|
-
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i =
|
|
3233
|
+
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = K(r.width, 0, e, n)), i === void 0 && (i = t === "min" ? tr(e, n) : q(e, n));
|
|
3234
3234
|
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
3235
3235
|
return Math.max(0, V(i, a, o));
|
|
3236
3236
|
}
|
|
3237
|
-
function
|
|
3237
|
+
function tr(e, t) {
|
|
3238
3238
|
let n = t.minContent.get(e);
|
|
3239
3239
|
if (n !== void 0) return n;
|
|
3240
|
-
let r = e.style, i = nr(e, t) + r.border.left + r.border.right +
|
|
3240
|
+
let r = e.style, i = nr(e, t) + r.border.left + r.border.right + Wn(r.padding.left) + Wn(r.padding.right) + it(r).right;
|
|
3241
3241
|
return t.minContent.set(e, i), i;
|
|
3242
3242
|
}
|
|
3243
3243
|
function nr(e, t) {
|
|
3244
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 :
|
|
3245
|
+
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth : Pe(e.text, {
|
|
3246
3246
|
advances: e.advances,
|
|
3247
3247
|
tracking: e.style.tracking
|
|
3248
3248
|
});
|
|
3249
3249
|
if (e.style.display === "grid") return gt(e, t).min;
|
|
3250
3250
|
if (e.style.display === "table") return yn(e, t).min;
|
|
3251
3251
|
if (e.style.display === "flex" && e.style.flexDirection === "row" && e.style.flexWrap === "nowrap") {
|
|
3252
|
-
let r = Math.max(
|
|
3253
|
-
return n.reduce((e, n) => e +
|
|
3252
|
+
let r = Math.max(Wn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
3253
|
+
return n.reduce((e, n) => e + J(n, "min", t), 0) + r;
|
|
3254
3254
|
}
|
|
3255
|
-
return n.reduce((e, n) => Math.max(e,
|
|
3255
|
+
return n.reduce((e, n) => Math.max(e, J(n, "min", t)), 0);
|
|
3256
3256
|
}
|
|
3257
3257
|
function rr(e, t, n, r) {
|
|
3258
3258
|
return {
|
|
@@ -3322,7 +3322,7 @@ function fr(e, t, n, r, i = 1) {
|
|
|
3322
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);
|
|
3323
3323
|
}
|
|
3324
3324
|
let l = [];
|
|
3325
|
-
|
|
3325
|
+
fe(s, {
|
|
3326
3326
|
x: a,
|
|
3327
3327
|
y: o,
|
|
3328
3328
|
width: e.localRect.width,
|
|
@@ -3350,7 +3350,7 @@ function fr(e, t, n, r, i = 1) {
|
|
|
3350
3350
|
e.text[r] === "" ? s?.backgroundColor && h(i, a, " ", c({ backgroundColor: s.backgroundColor })) : h(i, a, e.text[r], s ? n[o] : t);
|
|
3351
3351
|
}, (e, n) => h(e, n, "…", t));
|
|
3352
3352
|
}
|
|
3353
|
-
for (let t of
|
|
3353
|
+
for (let t of he(e)) fr(t, p, m, h, i * t.style.opacity);
|
|
3354
3354
|
let g = e.scrollRange;
|
|
3355
3355
|
if (g && u && (u.right > 0 || u.bottom > 0)) {
|
|
3356
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);
|
|
@@ -3376,9 +3376,9 @@ function pr(e, t, n, r, i) {
|
|
|
3376
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
3377
|
end: n.end,
|
|
3378
3378
|
ellipsis: !1
|
|
3379
|
-
}, h =
|
|
3379
|
+
}, h = P(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
3380
|
for (let t = n.start; t < m.end; t++) {
|
|
3381
|
-
let n =
|
|
3381
|
+
let n = Me(t, t + 1, e.advances);
|
|
3382
3382
|
if (e.text[t] !== "") {
|
|
3383
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
3384
|
r(t, v + a, o + s, n);
|
|
@@ -3430,12 +3430,12 @@ function _r(e, t, n, r) {
|
|
|
3430
3430
|
}
|
|
3431
3431
|
function vr(e, t, n, r, i) {
|
|
3432
3432
|
let { textOverflow: a, tracking: o } = i;
|
|
3433
|
-
if (
|
|
3433
|
+
if (P(t.start, t.end, r, o) <= n) return {
|
|
3434
3434
|
end: t.end,
|
|
3435
3435
|
ellipsis: !1
|
|
3436
3436
|
};
|
|
3437
3437
|
let s = a === "ellipsis" ? n - 1 : n, c = t.start;
|
|
3438
|
-
for (; c < t.end &&
|
|
3438
|
+
for (; c < t.end && P(t.start, c + 1, r, o) <= s;) c++;
|
|
3439
3439
|
return {
|
|
3440
3440
|
end: c,
|
|
3441
3441
|
ellipsis: a === "ellipsis" && n > 0
|
|
@@ -3447,7 +3447,7 @@ function yr(e, t, n) {
|
|
|
3447
3447
|
let r = [], i = e, a = e.localRect.x, o = e.localRect.y;
|
|
3448
3448
|
for (;;) {
|
|
3449
3449
|
let e = null;
|
|
3450
|
-
for (let r of
|
|
3450
|
+
for (let r of he(i)) {
|
|
3451
3451
|
if (r.tableHidden) continue;
|
|
3452
3452
|
let i = a + r.localRect.x, s = o + r.localRect.y;
|
|
3453
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);
|
|
@@ -3754,9 +3754,9 @@ function Qr(e, t, n) {
|
|
|
3754
3754
|
let e = t;
|
|
3755
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));
|
|
3756
3756
|
}
|
|
3757
|
-
if (t || ti(e), !e.tableHidden) for (let t of
|
|
3757
|
+
if (t || ti(e), !e.tableHidden) for (let t of he(e)) {
|
|
3758
3758
|
let r = t.source;
|
|
3759
|
-
t.style.zIndex !== null &&
|
|
3759
|
+
t.style.zIndex !== null && me(t, e) && !t.inlineBox ? Y(r, "--mw-z", String(t.style.zIndex)) : X(r, "--mw-z"), Qr(t, !1, n);
|
|
3760
3760
|
}
|
|
3761
3761
|
}
|
|
3762
3762
|
function $r(e, t) {
|
|
@@ -3771,7 +3771,7 @@ function ei(e) {
|
|
|
3771
3771
|
if (t.textAlign !== "center" || !e.text || e.inlineBox || e.children.length > 0) return !1;
|
|
3772
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);
|
|
3773
3773
|
return o.length !== 0 && o.every((n, r) => {
|
|
3774
|
-
let i = r === 0 ? t.textIndent : 0, o = a - i -
|
|
3774
|
+
let i = r === 0 ? t.textIndent : 0, o = a - i - P(n.start, n.end, e.advances, t.tracking);
|
|
3775
3775
|
return o > 0 && o % 2 == 1;
|
|
3776
3776
|
});
|
|
3777
3777
|
}
|
|
@@ -3792,7 +3792,7 @@ function ti(e) {
|
|
|
3792
3792
|
function ni(e, t, n) {
|
|
3793
3793
|
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a = wi(e) ? e.computedStyleMap() : null, o = e.getAttribute("class") ?? "", s = e.style;
|
|
3794
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,
|
|
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, N(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 = {
|
|
3796
3796
|
direction: "row",
|
|
3797
3797
|
dense: !1
|
|
3798
3798
|
}, b = null;
|
|
@@ -3811,7 +3811,7 @@ function ni(e, t, n) {
|
|
|
3811
3811
|
let x = "auto", S = !1, C = 0, w = 0;
|
|
3812
3812
|
if (m === "table" && (x = r.tableLayout === "fixed" ? "fixed" : "auto", S = r.borderCollapse === "collapse", !S)) {
|
|
3813
3813
|
let e = r.borderSpacing.split(" ");
|
|
3814
|
-
C =
|
|
3814
|
+
C = N(parseFloat(e[0] ?? "") || 0, t), w = N(parseFloat(e[1] ?? e[0] ?? "") || 0, t);
|
|
3815
3815
|
}
|
|
3816
3816
|
let T = {
|
|
3817
3817
|
display: m,
|
|
@@ -3907,7 +3907,7 @@ function ni(e, t, n) {
|
|
|
3907
3907
|
ruleX: m === "flex" || m === "grid" || m === "multicol" ? xi(r, "x") : null,
|
|
3908
3908
|
ruleY: m === "flex" || m === "grid" ? xi(r, "y") : null,
|
|
3909
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,
|
|
3910
|
+
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0, M(parseFloat(r.getPropertyValue("--mw-rule-inset")) || 0)),
|
|
3911
3911
|
ruleVisibilityItems: bi(r, "--mw-rule-visibility-items", [
|
|
3912
3912
|
"all",
|
|
3913
3913
|
"around",
|
|
@@ -3995,7 +3995,7 @@ function mi(e) {
|
|
|
3995
3995
|
function hi(e, t) {
|
|
3996
3996
|
if (t.position !== "absolute" && t.position !== "fixed") return !1;
|
|
3997
3997
|
let n = t.clip.replace(/\s/g, "");
|
|
3998
|
-
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)" || !se(e.tagName) && (oi(t.overflow) || oi(t.overflowX)) && parseFloat(t.width) <= 1 && parseFloat(t.height) <= 1;
|
|
3999
3999
|
}
|
|
4000
4000
|
var gi = {
|
|
4001
4001
|
TABLE: "table",
|
|
@@ -4023,14 +4023,14 @@ function vi(e, t) {
|
|
|
4023
4023
|
return n === "top" ? "start" : n === "middle" ? "center" : n === "bottom" ? "end" : "start";
|
|
4024
4024
|
}
|
|
4025
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 !== "") &&
|
|
4026
|
+
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") && j(e, "font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.");
|
|
4027
4027
|
}
|
|
4028
4028
|
function bi(e, t, n, r) {
|
|
4029
4029
|
let i = e.getPropertyValue(t).trim();
|
|
4030
4030
|
return n.includes(i) ? i : r;
|
|
4031
4031
|
}
|
|
4032
4032
|
function xi(e, t) {
|
|
4033
|
-
let n =
|
|
4033
|
+
let n = M(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`)) || 0);
|
|
4034
4034
|
if (n <= 0) return null;
|
|
4035
4035
|
let r = e.getPropertyValue(`--mw-rule-${t}-color`).trim();
|
|
4036
4036
|
return {
|
|
@@ -4155,7 +4155,7 @@ function Pi(e, t) {
|
|
|
4155
4155
|
return Number.isFinite(t) ? { percent: t } : void 0;
|
|
4156
4156
|
}
|
|
4157
4157
|
let n = parseFloat(e);
|
|
4158
|
-
return Number.isFinite(n) ?
|
|
4158
|
+
return Number.isFinite(n) ? N(n, t) : void 0;
|
|
4159
4159
|
}
|
|
4160
4160
|
function Q(e, t) {
|
|
4161
4161
|
if (!e || e === "auto" || e === "none") return 0;
|
|
@@ -4164,7 +4164,7 @@ function Q(e, t) {
|
|
|
4164
4164
|
return Number.isFinite(t) && t !== 0 ? { percent: t } : 0;
|
|
4165
4165
|
}
|
|
4166
4166
|
let n = parseFloat(e);
|
|
4167
|
-
return Number.isFinite(n) ?
|
|
4167
|
+
return Number.isFinite(n) ? N(n, t) : 0;
|
|
4168
4168
|
}
|
|
4169
4169
|
function Fi(e) {
|
|
4170
4170
|
let t = parseFloat(e);
|
|
@@ -4174,7 +4174,7 @@ function Ii(e, t) {
|
|
|
4174
4174
|
let n = e.textIndent;
|
|
4175
4175
|
if (!n || n.endsWith("%")) return 0;
|
|
4176
4176
|
let r = parseFloat(n);
|
|
4177
|
-
return Number.isFinite(r) ? Math.max(0,
|
|
4177
|
+
return Number.isFinite(r) ? Math.max(0, N(r, t)) : 0;
|
|
4178
4178
|
}
|
|
4179
4179
|
function Li(e, t, n, r, i, a, o) {
|
|
4180
4180
|
let s = Ri(n === "width" ? a.width : a.height);
|
|
@@ -4208,11 +4208,11 @@ function Li(e, t, n, r, i, a, o) {
|
|
|
4208
4208
|
};
|
|
4209
4209
|
if (i.endsWith("px")) return {
|
|
4210
4210
|
kind: "cells",
|
|
4211
|
-
value:
|
|
4211
|
+
value: N(parseFloat(i), r)
|
|
4212
4212
|
};
|
|
4213
4213
|
if (i.endsWith("rem")) return {
|
|
4214
4214
|
kind: "cells",
|
|
4215
|
-
value:
|
|
4215
|
+
value: M(parseFloat(i) / .25)
|
|
4216
4216
|
};
|
|
4217
4217
|
let s = Ri(i);
|
|
4218
4218
|
if (s !== null) return {
|
|
@@ -4232,7 +4232,7 @@ function Li(e, t, n, r, i, a, o) {
|
|
|
4232
4232
|
let t = parseFloat(u);
|
|
4233
4233
|
if (Number.isFinite(t)) return {
|
|
4234
4234
|
kind: "cells",
|
|
4235
|
-
value:
|
|
4235
|
+
value: N(t, r)
|
|
4236
4236
|
};
|
|
4237
4237
|
}
|
|
4238
4238
|
let d = n === "width" ? "w" : "h";
|
|
@@ -4256,7 +4256,7 @@ function Li(e, t, n, r, i, a, o) {
|
|
|
4256
4256
|
let m = RegExp(`(?:^|[\\s:.[!])${d}-(\\d+(?:\\.\\d+)?)(?![\\w-/])`).exec(i);
|
|
4257
4257
|
if (m) return {
|
|
4258
4258
|
kind: "cells",
|
|
4259
|
-
value:
|
|
4259
|
+
value: M(Number(m[1]))
|
|
4260
4260
|
};
|
|
4261
4261
|
if (!ra(i, d) || t === "auto") return { kind: "auto" };
|
|
4262
4262
|
if (t.endsWith("%")) return {
|
|
@@ -4266,7 +4266,7 @@ function Li(e, t, n, r, i, a, o) {
|
|
|
4266
4266
|
let h = parseFloat(t);
|
|
4267
4267
|
if (Number.isFinite(h)) return {
|
|
4268
4268
|
kind: "cells",
|
|
4269
|
-
value:
|
|
4269
|
+
value: N(h, r)
|
|
4270
4270
|
};
|
|
4271
4271
|
}
|
|
4272
4272
|
function Ri(e) {
|
|
@@ -4289,7 +4289,7 @@ function zi(e, t) {
|
|
|
4289
4289
|
}
|
|
4290
4290
|
function Bi(e, t, n, r) {
|
|
4291
4291
|
let i = t === "width" ? n?.width : n?.height;
|
|
4292
|
-
return i && i > 0 ? Math.max(0, Math.floor(e / i)) :
|
|
4292
|
+
return i && i > 0 ? Math.max(0, Math.floor(e / i)) : N(e, r);
|
|
4293
4293
|
}
|
|
4294
4294
|
function Vi(e, t, n, r, i, a, o, s) {
|
|
4295
4295
|
let c = t.endsWith("width") ? "width" : "height", l = a.getPropertyValue(t).trim(), u = l.startsWith("calc(");
|
|
@@ -4298,7 +4298,7 @@ function Vi(e, t, n, r, i, a, o, s) {
|
|
|
4298
4298
|
if (!f) return;
|
|
4299
4299
|
let p = Hi(f, c, o, s);
|
|
4300
4300
|
if (!p || p.unitless) return;
|
|
4301
|
-
let m = Math.max(0,
|
|
4301
|
+
let m = Math.max(0, M(p.cells));
|
|
4302
4302
|
if (u) return m;
|
|
4303
4303
|
let h = (e ? String(e.get(t) ?? "") : n).trim(), g = parseFloat(h);
|
|
4304
4304
|
return (Number.isFinite(g) ? Math.abs(g - p.px) <= Math.abs(p.px) * .3 : h === "") ? m : void 0;
|
|
@@ -4407,7 +4407,7 @@ function Wi(e, t) {
|
|
|
4407
4407
|
let r = parseFloat(e);
|
|
4408
4408
|
return Number.isFinite(r) ? {
|
|
4409
4409
|
kind: "cells",
|
|
4410
|
-
value:
|
|
4410
|
+
value: N(r, t)
|
|
4411
4411
|
} : void 0;
|
|
4412
4412
|
}
|
|
4413
4413
|
function Gi(e) {
|
|
@@ -4561,7 +4561,7 @@ function Qi(e, t) {
|
|
|
4561
4561
|
let r = parseFloat(e);
|
|
4562
4562
|
return Number.isFinite(r) ? {
|
|
4563
4563
|
kind: "cells",
|
|
4564
|
-
value: e.endsWith("rem") ?
|
|
4564
|
+
value: e.endsWith("rem") ? M(r / .25) : N(r, t)
|
|
4565
4565
|
} : { kind: "auto" };
|
|
4566
4566
|
}
|
|
4567
4567
|
function $i(e) {
|
|
@@ -4626,7 +4626,7 @@ function ia(e, t) {
|
|
|
4626
4626
|
};
|
|
4627
4627
|
}
|
|
4628
4628
|
function aa(e) {
|
|
4629
|
-
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 :
|
|
4629
|
+
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 : M(parseFloat(e.getPropertyValue(t)) || 0);
|
|
4630
4630
|
return {
|
|
4631
4631
|
top: t("border-top-width", "border-top-style"),
|
|
4632
4632
|
right: t("border-right-width", "border-right-style"),
|
|
@@ -4639,7 +4639,7 @@ function aa(e) {
|
|
|
4639
4639
|
function oa(e, t, n, r) {
|
|
4640
4640
|
let i = ni(e, t, n);
|
|
4641
4641
|
if (i.display === "none") return null;
|
|
4642
|
-
let a =
|
|
4642
|
+
let a = se(e.tagName);
|
|
4643
4643
|
if (a) return sa(e, i, a);
|
|
4644
4644
|
let o = Array.from(e.children), s = o.map(fa), c = e.tagName, l = wa(c);
|
|
4645
4645
|
if (!s.includes("block") || l) {
|
|
@@ -4653,8 +4653,8 @@ function oa(e, t, n, r) {
|
|
|
4653
4653
|
}), u = a.chars.join("");
|
|
4654
4654
|
if (a.boxes.length > 0) {
|
|
4655
4655
|
let e = Ln();
|
|
4656
|
-
|
|
4657
|
-
a.advances[t] = Math.max(1,
|
|
4656
|
+
Fe(a.chars, (t, n) => {
|
|
4657
|
+
a.advances[t] = Math.max(1, q(a.boxes[n], e));
|
|
4658
4658
|
});
|
|
4659
4659
|
}
|
|
4660
4660
|
let d = ya(u, a.advances, i.tracking);
|
|
@@ -4668,7 +4668,7 @@ function oa(e, t, n, r) {
|
|
|
4668
4668
|
}
|
|
4669
4669
|
let f = u.length > 0 ? ba(u) : 0, p;
|
|
4670
4670
|
if (c === "TEXTAREA") {
|
|
4671
|
-
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 ? Oe(n, a) + o : n === "" ? 0 : n.split(/\r\n?|\n/).length, c = getComputedStyle(e).getPropertyValue("field-sizing") === "content" ? 1 : Number(t.rows) || 2, l = Math.max(c, s);
|
|
4672
4672
|
p = l + Math.max(0, l - 1) * i.lineGap;
|
|
4673
4673
|
} else p = l ? Math.max(1, f) : f;
|
|
4674
4674
|
let m = /* @__PURE__ */ new Map(), h = [];
|
|
@@ -4728,7 +4728,7 @@ function oa(e, t, n, r) {
|
|
|
4728
4728
|
return Ta(e, d), d;
|
|
4729
4729
|
}
|
|
4730
4730
|
function sa(e, t, n) {
|
|
4731
|
-
let r =
|
|
4731
|
+
let r = ue(n, e), i = r?.lines ?? [], a = i.join("\n");
|
|
4732
4732
|
t.whiteSpace = "pre", (t.width === void 0 || t.width.kind === "auto") && (t.width = { kind: "max-content" });
|
|
4733
4733
|
let o = Array.from({ length: a.length }, () => 1 + t.tracking), s = ya(a, o, t.tracking), c = i.length, l = {
|
|
4734
4734
|
source: e,
|
|
@@ -4786,7 +4786,7 @@ function da(e, t) {
|
|
|
4786
4786
|
}
|
|
4787
4787
|
function fa(e) {
|
|
4788
4788
|
let t = getComputedStyle(e);
|
|
4789
|
-
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" : se(e.tagName) ? "block" : ua(e, t.display) || da(e, t.display) ? "inline" : "block";
|
|
4790
4790
|
}
|
|
4791
4791
|
function pa(e, t, n) {
|
|
4792
4792
|
let r = {
|
|
@@ -4870,13 +4870,13 @@ function ma(e, t, n, r) {
|
|
|
4870
4870
|
function ha(e, t) {
|
|
4871
4871
|
if (!e || e.endsWith("%")) return 0;
|
|
4872
4872
|
let n = parseFloat(e);
|
|
4873
|
-
return Number.isFinite(n) ? Math.max(0,
|
|
4873
|
+
return Number.isFinite(n) ? Math.max(0, N(n, t)) : 0;
|
|
4874
4874
|
}
|
|
4875
4875
|
function ga(e, t) {
|
|
4876
4876
|
let n = (e) => {
|
|
4877
4877
|
if (!e || e === "auto" || e.endsWith("%")) return null;
|
|
4878
4878
|
let n = parseFloat(e);
|
|
4879
|
-
return Number.isFinite(n) ?
|
|
4879
|
+
return Number.isFinite(n) ? N(n, t) : null;
|
|
4880
4880
|
};
|
|
4881
4881
|
return {
|
|
4882
4882
|
top: n(e.top),
|
|
@@ -4930,14 +4930,14 @@ function va(e) {
|
|
|
4930
4930
|
}
|
|
4931
4931
|
function ya(e, t, n) {
|
|
4932
4932
|
let r = 0, i = 0;
|
|
4933
|
-
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, P(i, a, t, n)), i = a + 1);
|
|
4934
4934
|
return r;
|
|
4935
4935
|
}
|
|
4936
4936
|
function ba(e) {
|
|
4937
|
-
return
|
|
4937
|
+
return Ae(e).length;
|
|
4938
4938
|
}
|
|
4939
4939
|
function xa(e) {
|
|
4940
|
-
|
|
4940
|
+
j(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.");
|
|
4941
4941
|
}
|
|
4942
4942
|
function Sa(e) {
|
|
4943
4943
|
return Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? ""));
|
|
@@ -4947,11 +4947,11 @@ function wa(e) {
|
|
|
4947
4947
|
return e === "INPUT" || e === "SELECT" || e === "TEXTAREA";
|
|
4948
4948
|
}
|
|
4949
4949
|
function Ta(e, t) {
|
|
4950
|
-
Sa(e) && (t.droppedText = !0,
|
|
4950
|
+
Sa(e) && (t.droppedText = !0, j(e, Ca));
|
|
4951
4951
|
}
|
|
4952
4952
|
//#endregion
|
|
4953
4953
|
//#region src/element.ts
|
|
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 = [
|
|
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 = "a, button, input, select, textarea, label, [tabindex], [role='button']", Aa = [
|
|
4955
4955
|
"pointerover",
|
|
4956
4956
|
"pointerleave",
|
|
4957
4957
|
"pointerdown",
|
|
@@ -4963,12 +4963,12 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4963
4963
|
"focusout",
|
|
4964
4964
|
"input",
|
|
4965
4965
|
"change"
|
|
4966
|
-
],
|
|
4966
|
+
], ja = /^(color|opacity|border-(top|right|bottom|left)-color|border-color)$/, Ma = 3e4, Na = 200, Pa = 3, Fa = 4, Ia = 8, La = 100, Ra = 160, za = typeof HTMLElement > "u" ? class {} : HTMLElement, Ba = class e extends za {
|
|
4967
4967
|
static observedAttributes = ["select"];
|
|
4968
4968
|
static #e = /* @__PURE__ */ new Set();
|
|
4969
4969
|
static #t = null;
|
|
4970
4970
|
static #n = () => {
|
|
4971
|
-
for (let t of e.#e) t.#
|
|
4971
|
+
for (let t of e.#e) t.#Me();
|
|
4972
4972
|
};
|
|
4973
4973
|
static #r(t) {
|
|
4974
4974
|
t instanceof HTMLLinkElement && t.rel === "stylesheet" && !t.sheet && t.addEventListener("load", e.#n, { once: !0 });
|
|
@@ -5007,8 +5007,10 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5007
5007
|
#x = null;
|
|
5008
5008
|
#S = "";
|
|
5009
5009
|
#C = null;
|
|
5010
|
-
#w =
|
|
5011
|
-
#T
|
|
5010
|
+
#w = null;
|
|
5011
|
+
#T = !1;
|
|
5012
|
+
#E = [];
|
|
5013
|
+
#D() {
|
|
5012
5014
|
this.#u?.observe(this, {
|
|
5013
5015
|
childList: !0,
|
|
5014
5016
|
subtree: !0,
|
|
@@ -5020,7 +5022,7 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5020
5022
|
"colspan",
|
|
5021
5023
|
"rowspan",
|
|
5022
5024
|
"span",
|
|
5023
|
-
...
|
|
5025
|
+
...ce()
|
|
5024
5026
|
]
|
|
5025
5027
|
});
|
|
5026
5028
|
}
|
|
@@ -5028,72 +5030,72 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5028
5030
|
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);
|
|
5029
5031
|
}
|
|
5030
5032
|
connectedCallback() {
|
|
5031
|
-
this.hasAttribute("select") || this.setAttribute("select", Da), this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#
|
|
5032
|
-
this.#
|
|
5033
|
-
}), this.#h = C(() => this.#
|
|
5033
|
+
this.hasAttribute("select") || this.setAttribute("select", Da), this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#Me()), this.#l.observe(this), this.#Y(), this.#l.observe(this.#c), window.addEventListener("resize", this.#Oe), this.#u = new MutationObserver(() => this.#Me()), this.#D(), this.#m = le(() => {
|
|
5034
|
+
this.#D(), this.#Me();
|
|
5035
|
+
}), this.#h = C(() => this.#Me()), document.fonts?.ready.then(this.#ke).catch((e) => {
|
|
5034
5036
|
console.warn("[monowind] document.fonts.ready failed:", e);
|
|
5035
|
-
}), document.fonts?.addEventListener("loadingdone", this.#
|
|
5036
|
-
for (let e of
|
|
5037
|
-
this.addEventListener("transitionrun", this.#
|
|
5037
|
+
}), document.fonts?.addEventListener("loadingdone", this.#ke);
|
|
5038
|
+
for (let e of Aa) this.addEventListener(e, this.#De);
|
|
5039
|
+
this.addEventListener("transitionrun", this.#we), this.addEventListener("transitionend", this.#Te), this.addEventListener("transitioncancel", this.#Te), this.addEventListener("pointermove", this.#Q), this.addEventListener("pointerleave", this.#he), this.addEventListener("pointerdown", this.#ge), this.addEventListener("scroll", this.#W, {
|
|
5038
5040
|
capture: !0,
|
|
5039
5041
|
passive: !0
|
|
5040
|
-
}), this.addEventListener("scrollend", this.#
|
|
5042
|
+
}), this.addEventListener("scrollend", this.#G, { capture: !0 }), this.addEventListener("wheel", this.#q, { passive: !1 }), this.addEventListener("copy", this.#$), this.addEventListener("mousedown", this.#ee), document.addEventListener("selectionchange", this.#me), window.addEventListener("pointerup", this.#_e), window.addEventListener("pointercancel", this.#_e), document.addEventListener("scroll", this.#ve, {
|
|
5041
5043
|
capture: !0,
|
|
5042
5044
|
passive: !0
|
|
5043
|
-
}), e.#i(this), this.#
|
|
5045
|
+
}), e.#i(this), this.#Me();
|
|
5044
5046
|
}
|
|
5045
5047
|
disconnectedCallback() {
|
|
5046
|
-
window.removeEventListener("resize", this.#
|
|
5047
|
-
for (let e of
|
|
5048
|
-
this.removeEventListener("transitionrun", this.#
|
|
5048
|
+
window.removeEventListener("resize", this.#Oe), 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.#ke);
|
|
5049
|
+
for (let e of Aa) this.removeEventListener(e, this.#De);
|
|
5050
|
+
this.removeEventListener("transitionrun", this.#we), this.removeEventListener("transitionend", this.#Te), this.removeEventListener("transitioncancel", this.#Te), this.#xe = 0, this.removeEventListener("pointermove", this.#Q), this.removeEventListener("pointerleave", this.#he), this.removeEventListener("pointerdown", this.#ge), this.removeEventListener("scroll", this.#W, { capture: !0 }), this.removeEventListener("scrollend", this.#G, { capture: !0 }), this.removeEventListener("wheel", this.#q), this.removeEventListener("copy", this.#$), this.removeEventListener("mousedown", this.#ee), document.removeEventListener("selectionchange", this.#me);
|
|
5049
5051
|
for (let e of this.#v.values()) clearTimeout(e);
|
|
5050
|
-
this.#v.clear(), this.#x = null, this.#b = null, window.removeEventListener("pointerup", this.#
|
|
5051
|
-
}
|
|
5052
|
-
#
|
|
5053
|
-
#
|
|
5054
|
-
#
|
|
5055
|
-
#
|
|
5056
|
-
#
|
|
5057
|
-
#
|
|
5058
|
-
#
|
|
5059
|
-
#
|
|
5060
|
-
#
|
|
5061
|
-
static #
|
|
5062
|
-
#
|
|
5052
|
+
this.#v.clear(), this.#x = null, this.#b = null, window.removeEventListener("pointerup", this.#_e), window.removeEventListener("pointercancel", this.#_e), document.removeEventListener("scroll", this.#ve, { capture: !0 }), this.#N = null, this.#A = null, this.#j = !1, this.#M = !1, this.#ye(), e.#a(this);
|
|
5053
|
+
}
|
|
5054
|
+
#O = /* @__PURE__ */ new Set();
|
|
5055
|
+
#k = /* @__PURE__ */ new Set();
|
|
5056
|
+
#A = null;
|
|
5057
|
+
#j = !1;
|
|
5058
|
+
#M = !1;
|
|
5059
|
+
#N = null;
|
|
5060
|
+
#P = NaN;
|
|
5061
|
+
#F = NaN;
|
|
5062
|
+
#I = null;
|
|
5063
|
+
static #L = typeof matchMedia > "u" ? null : matchMedia("(hover: hover)");
|
|
5064
|
+
#R() {
|
|
5063
5065
|
if (this.#g || this.#d) return;
|
|
5064
5066
|
this.#g = !0;
|
|
5065
5067
|
let e = !1, t = () => {
|
|
5066
5068
|
if (e) return;
|
|
5067
5069
|
e = !0, this.#g = !1;
|
|
5068
5070
|
let t = this.#f;
|
|
5069
|
-
this.isConnected && this.#p && t && (this.#
|
|
5071
|
+
this.isConnected && this.#p && t && (this.#z(t), this.#M = !Ur(this.#p, this.#s, this.#ne()), this.#ye());
|
|
5070
5072
|
};
|
|
5071
5073
|
requestAnimationFrame(t), setTimeout(t, 50);
|
|
5072
5074
|
}
|
|
5073
|
-
#
|
|
5075
|
+
#z(e, t) {
|
|
5074
5076
|
for (let n of this.#_) {
|
|
5075
5077
|
let r = n.source, { maxX: i, maxY: a } = n.scrollRange, o = t?.get(r);
|
|
5076
5078
|
n.scroll = o ? {
|
|
5077
5079
|
x: o.pinX ? i : Math.min(o.x, i),
|
|
5078
5080
|
y: o.pinY ? a : Math.min(o.y, a)
|
|
5079
|
-
} : this.#
|
|
5081
|
+
} : this.#B(n, e);
|
|
5080
5082
|
}
|
|
5081
5083
|
}
|
|
5082
|
-
#
|
|
5084
|
+
#B(e, t) {
|
|
5083
5085
|
let n = e.source, { maxX: r, maxY: i } = e.scrollRange, a = e.scroll ?? {
|
|
5084
5086
|
x: 0,
|
|
5085
5087
|
y: 0
|
|
5086
5088
|
};
|
|
5087
5089
|
return {
|
|
5088
|
-
x:
|
|
5089
|
-
y:
|
|
5090
|
+
x: Ha(n, "x", t.width, r, a.x),
|
|
5091
|
+
y: Ha(n, "y", t.height, i, a.y)
|
|
5090
5092
|
};
|
|
5091
5093
|
}
|
|
5092
|
-
#
|
|
5094
|
+
#V() {
|
|
5093
5095
|
let e = /* @__PURE__ */ new Map(), t = this.#f;
|
|
5094
5096
|
if (!t) return e;
|
|
5095
5097
|
for (let n of this.#_) {
|
|
5096
|
-
let r = n.source, { maxX: i, maxY: a } = n.scrollRange, { x: o, y: s } = this.#
|
|
5098
|
+
let r = n.source, { maxX: i, maxY: a } = n.scrollRange, { x: o, y: s } = this.#B(n, t);
|
|
5097
5099
|
e.set(r, {
|
|
5098
5100
|
top: r.scrollTop,
|
|
5099
5101
|
left: r.scrollLeft,
|
|
@@ -5105,42 +5107,42 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5105
5107
|
}
|
|
5106
5108
|
return e;
|
|
5107
5109
|
}
|
|
5108
|
-
#
|
|
5110
|
+
#H(e) {
|
|
5109
5111
|
for (let t of this.#_) {
|
|
5110
5112
|
let n = t.source, r = e.get(n);
|
|
5111
5113
|
r && (n.scrollTop, n.scrollLeft, n.scrollTop = r.pinY ? n.scrollHeight : r.top, n.scrollLeft = r.pinX ? n.scrollWidth : r.left);
|
|
5112
5114
|
}
|
|
5113
5115
|
}
|
|
5114
|
-
#
|
|
5115
|
-
clearTimeout(this.#v.get(e)), this.#v.set(e, setTimeout(() => this.#
|
|
5116
|
+
#U(e, t) {
|
|
5117
|
+
clearTimeout(this.#v.get(e)), this.#v.set(e, setTimeout(() => this.#K(e), t));
|
|
5116
5118
|
}
|
|
5117
|
-
#
|
|
5119
|
+
#W = (e) => {
|
|
5118
5120
|
let t = e.target;
|
|
5119
|
-
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (this.#
|
|
5121
|
+
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (this.#R(), !(Date.now() - (this.#y.get(t) ?? 0) < Na) && (clearTimeout(this.#v.get(t)), "onscrollend" in window || this.#U(t, Ra)));
|
|
5120
5122
|
};
|
|
5121
|
-
#
|
|
5123
|
+
#G = (e) => {
|
|
5122
5124
|
let t = e.target;
|
|
5123
|
-
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (Date.now() - (this.#y.get(t) ?? 0) <
|
|
5125
|
+
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (Date.now() - (this.#y.get(t) ?? 0) < Na || this.#U(t, La));
|
|
5124
5126
|
};
|
|
5125
|
-
#
|
|
5127
|
+
#K(e) {
|
|
5126
5128
|
if (this.#x?.el === e) return;
|
|
5127
|
-
this.#
|
|
5129
|
+
this.#R();
|
|
5128
5130
|
let t = this.#f, n = this.#_.find((t) => t.source === e);
|
|
5129
5131
|
if (!t || !n) return;
|
|
5130
|
-
let r = n.scrollRange, i = n.scroll ?? this.#
|
|
5132
|
+
let r = n.scrollRange, i = n.scroll ?? this.#B(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;
|
|
5131
5133
|
(Math.abs(e.scrollTop - a) > .5 || Math.abs(e.scrollLeft - o) > .5) && e.scrollTo({
|
|
5132
5134
|
top: a,
|
|
5133
5135
|
left: o,
|
|
5134
5136
|
behavior: "instant"
|
|
5135
5137
|
});
|
|
5136
5138
|
}
|
|
5137
|
-
#
|
|
5139
|
+
#q = (e) => {
|
|
5138
5140
|
if (this.getAttribute("select") !== "grid") return;
|
|
5139
5141
|
let t = this.#p, n = this.#f;
|
|
5140
5142
|
if (!t || !n || this.#_.length === 0) return;
|
|
5141
5143
|
let r = e, i = r.deltaMode === 1 ? n.height : r.deltaMode === 2 ? this.clientHeight : 1, a = r.deltaX * i, o = r.deltaY * i;
|
|
5142
|
-
if (!r.cancelable && this.#
|
|
5143
|
-
let { col: s, row: c } = this.#
|
|
5144
|
+
if (!r.cancelable && this.#J(a, o)) return;
|
|
5145
|
+
let { col: s, row: c } = this.#X(r.clientX, r.clientY, n), l = Date.now(), u = Math.abs(a) + Math.abs(o);
|
|
5144
5146
|
if (u === 0) {
|
|
5145
5147
|
this.#b = null, r.preventDefault();
|
|
5146
5148
|
return;
|
|
@@ -5148,7 +5150,7 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5148
5150
|
let d = (e) => {
|
|
5149
5151
|
let t = e.scrollRange, n = e.source;
|
|
5150
5152
|
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);
|
|
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) >
|
|
5153
|
+
}, 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) > Pa || Math.abs(r.clientY - f.y) > Pa), g = f !== null && f.decayed >= Ia, _ = f !== null && l - f.at < Na && p === f.axis && (h ? u <= f.mag : !(g && m)), v = null;
|
|
5152
5154
|
if (_) {
|
|
5153
5155
|
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;
|
|
5154
5156
|
v = this.#_.find((e) => e.source === f.el) ?? null;
|
|
@@ -5168,7 +5170,7 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5168
5170
|
break;
|
|
5169
5171
|
}
|
|
5170
5172
|
}
|
|
5171
|
-
if (!v && u <
|
|
5173
|
+
if (!v && u < Fa) {
|
|
5172
5174
|
r.preventDefault();
|
|
5173
5175
|
return;
|
|
5174
5176
|
}
|
|
@@ -5184,35 +5186,35 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5184
5186
|
}
|
|
5185
5187
|
if (!v || (r.preventDefault(), !d(v))) return;
|
|
5186
5188
|
let y = v.source, b = v.scrollRange, x = { behavior: "instant" };
|
|
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.#
|
|
5189
|
+
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.#U(y, Na);
|
|
5188
5190
|
};
|
|
5189
|
-
#
|
|
5190
|
-
return this.#
|
|
5191
|
+
#J(e, t) {
|
|
5192
|
+
return this.#E.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);
|
|
5191
5193
|
}
|
|
5192
|
-
#
|
|
5194
|
+
#Y() {
|
|
5193
5195
|
let e = this.parentElement;
|
|
5194
5196
|
if (e && this.#l) {
|
|
5195
5197
|
this.#l.observe(e);
|
|
5196
5198
|
for (let t of e.children) t !== this && this.#l.observe(t);
|
|
5197
5199
|
}
|
|
5198
5200
|
}
|
|
5199
|
-
#
|
|
5200
|
-
if (!this.#
|
|
5201
|
+
#X(e, t, n) {
|
|
5202
|
+
if (!this.#I) {
|
|
5201
5203
|
let e = this.#s.getBoundingClientRect();
|
|
5202
|
-
this.#
|
|
5204
|
+
this.#I = {
|
|
5203
5205
|
left: e.left,
|
|
5204
5206
|
top: e.top
|
|
5205
5207
|
};
|
|
5206
5208
|
}
|
|
5207
5209
|
return {
|
|
5208
|
-
col: Math.floor((e - this.#
|
|
5209
|
-
row: Math.floor((t - this.#
|
|
5210
|
+
col: Math.floor((e - this.#I.left) / n.width),
|
|
5211
|
+
row: Math.floor((t - this.#I.top) / n.height)
|
|
5210
5212
|
};
|
|
5211
5213
|
}
|
|
5212
|
-
#
|
|
5214
|
+
#Z(e, t) {
|
|
5213
5215
|
let n = this.#p, r = this.#f;
|
|
5214
5216
|
if (!n || !r || this.#_.length === 0) return null;
|
|
5215
|
-
let { col: i, row: a } = this.#
|
|
5217
|
+
let { col: i, row: a } = this.#X(e, t, r), o = yr(n, i, a);
|
|
5216
5218
|
for (let n = o.length - 1; n >= 0; n--) {
|
|
5217
5219
|
let { node: s, x: c, y: l } = o[n], u = s.scrollRange;
|
|
5218
5220
|
if (!u) continue;
|
|
@@ -5240,118 +5242,153 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5240
5242
|
}
|
|
5241
5243
|
return null;
|
|
5242
5244
|
}
|
|
5243
|
-
#
|
|
5244
|
-
if (
|
|
5245
|
+
#Q = (e) => {
|
|
5246
|
+
if (Wa(e)) return;
|
|
5245
5247
|
let { clientX: t, clientY: n } = e, r = this.#x;
|
|
5246
5248
|
if (r) {
|
|
5247
5249
|
let e = (r.axis === "y" ? n : t) - r.startClient, i = r.startPx + e * r.factor;
|
|
5248
5250
|
r.axis === "y" ? r.el.scrollTop = i : r.el.scrollLeft = i;
|
|
5249
5251
|
return;
|
|
5250
5252
|
}
|
|
5251
|
-
let i =
|
|
5252
|
-
i &&
|
|
5253
|
+
let i = !!(e.buttons & 1);
|
|
5254
|
+
i && this.#C && this.#ce(this.#C, t, n), i && this.#w && this.#se(this.#w, t, n), i && this.#T && !this.hasAttribute("data-mw-dragging") && this.setAttribute("data-mw-dragging", ""), this.#N = {
|
|
5253
5255
|
x: t,
|
|
5254
5256
|
y: n
|
|
5255
5257
|
};
|
|
5256
5258
|
let a = this.#f;
|
|
5257
5259
|
if (a) {
|
|
5258
|
-
let { col: e, row: r } = this.#
|
|
5259
|
-
if (e === this.#
|
|
5260
|
+
let { col: e, row: r } = this.#X(t, n, a);
|
|
5261
|
+
if (e === this.#P && r === this.#F) return;
|
|
5260
5262
|
}
|
|
5261
|
-
this.#
|
|
5263
|
+
this.#ye();
|
|
5262
5264
|
};
|
|
5263
|
-
|
|
5264
|
-
let { clipboardData: t } = e, n = this.#p, r = this.#
|
|
5265
|
+
#$ = (e) => {
|
|
5266
|
+
let { clipboardData: t } = e, n = this.#p, r = this.#pe();
|
|
5265
5267
|
t && n && r && (t.setData("text/plain", Er(n, r)), e.preventDefault());
|
|
5266
5268
|
};
|
|
5267
|
-
#
|
|
5269
|
+
#ee = (e) => {
|
|
5268
5270
|
let t = e;
|
|
5269
|
-
if (t.button !== 0 || this.getAttribute("select") !== "grid"
|
|
5271
|
+
if (t.button !== 0 || this.getAttribute("select") !== "grid") return;
|
|
5272
|
+
let n = t.composedPath().includes(this.#s);
|
|
5273
|
+
if (!n && !this.#re(t.target)) return;
|
|
5274
|
+
let r = this.#S === "mouse" || this.#S === "pen";
|
|
5270
5275
|
if (t.detail <= 1) {
|
|
5271
|
-
t.detail
|
|
5276
|
+
if (t.detail !== 1) return;
|
|
5277
|
+
this.removeAttribute(Oa);
|
|
5278
|
+
let e = this.#te();
|
|
5279
|
+
r && (!n || e) && (e?.blur(), this.#oe(t));
|
|
5272
5280
|
return;
|
|
5273
5281
|
}
|
|
5274
|
-
if (
|
|
5275
|
-
t.
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
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;
|
|
5282
|
+
if (!r) return;
|
|
5283
|
+
let i = t.detail === 2 ? "word" : "paragraph", a = document.getSelection(), o = this.#p, s = this.#f;
|
|
5284
|
+
if (!a || !o || !s) return;
|
|
5285
|
+
let { col: c, row: l } = this.#X(t.clientX, t.clientY, s), u = this.#ue(c, l, i);
|
|
5286
|
+
if (!u) {
|
|
5287
|
+
this.removeAttribute(Oa), this.#C = null;
|
|
5283
5288
|
return;
|
|
5284
5289
|
}
|
|
5285
|
-
this.#
|
|
5286
|
-
let
|
|
5287
|
-
node:
|
|
5288
|
-
offset:
|
|
5289
|
-
}) :
|
|
5290
|
-
this.#
|
|
5291
|
-
unit:
|
|
5292
|
-
anchor:
|
|
5290
|
+
t.preventDefault(), this.#te()?.blur(), this.#fe(u);
|
|
5291
|
+
let d = t.shiftKey && a.anchorNode && this.#pe() ? Ka({
|
|
5292
|
+
node: a.anchorNode,
|
|
5293
|
+
offset: a.anchorOffset
|
|
5294
|
+
}) : u;
|
|
5295
|
+
this.#le(a, d, u), this.#C = {
|
|
5296
|
+
unit: i,
|
|
5297
|
+
anchor: d
|
|
5293
5298
|
};
|
|
5294
5299
|
};
|
|
5295
|
-
|
|
5300
|
+
#te() {
|
|
5301
|
+
let e = document.activeElement;
|
|
5302
|
+
return e instanceof HTMLElement && e !== document.body && this.contains(e) ? e : null;
|
|
5303
|
+
}
|
|
5304
|
+
#ne() {
|
|
5305
|
+
return this.#j && !this.#w;
|
|
5306
|
+
}
|
|
5307
|
+
#re(e) {
|
|
5308
|
+
return e instanceof Element && e !== this && this.contains(e) && !e.matches(ka);
|
|
5309
|
+
}
|
|
5310
|
+
#ie(e, t) {
|
|
5311
|
+
let n = this.#s.textContent.split("\n"), r = Math.max(0, Math.min(t, n.length - 1)), i = 0;
|
|
5312
|
+
for (let e = 0; e < r; e++) i += n[e].length + 1;
|
|
5313
|
+
return i + Math.max(0, Math.min(e, n[r]?.length ?? 0));
|
|
5314
|
+
}
|
|
5315
|
+
#ae(e, t) {
|
|
5316
|
+
let n = this.#f;
|
|
5317
|
+
if (!n) return null;
|
|
5318
|
+
let { col: r, row: i } = this.#X(e, t, n), a = this.#ie(r, i), o = Jr(this.#s, a);
|
|
5319
|
+
return o && {
|
|
5320
|
+
offset: a,
|
|
5321
|
+
at: o
|
|
5322
|
+
};
|
|
5323
|
+
}
|
|
5324
|
+
#oe(e) {
|
|
5325
|
+
let t = this.#ae(e.clientX, e.clientY);
|
|
5326
|
+
t && (e.preventDefault(), document.getSelection()?.setBaseAndExtent(...t.at, ...t.at), this.#w = { anchor: t.offset });
|
|
5327
|
+
}
|
|
5328
|
+
#se(e, t, n) {
|
|
5329
|
+
let r = Jr(this.#s, e.anchor), i = this.#ae(t, n);
|
|
5330
|
+
r && i && document.getSelection()?.setBaseAndExtent(...r, ...i.at);
|
|
5331
|
+
}
|
|
5332
|
+
#ce(e, t, n) {
|
|
5296
5333
|
let r = this.#f, i = document.getSelection();
|
|
5297
5334
|
if (!r || !i) return;
|
|
5298
|
-
let { col: a, row: o } = this.#
|
|
5299
|
-
s && this.#
|
|
5335
|
+
let { col: a, row: o } = this.#X(t, n, r), s = this.#ue(a, o, e.unit);
|
|
5336
|
+
s && this.#le(i, e.anchor, s);
|
|
5300
5337
|
}
|
|
5301
|
-
#
|
|
5302
|
-
if (
|
|
5303
|
-
|
|
5338
|
+
#le(e, t, n) {
|
|
5339
|
+
if (Ja(t, n)) {
|
|
5340
|
+
qa(e, n.start, n.end);
|
|
5304
5341
|
return;
|
|
5305
5342
|
}
|
|
5306
|
-
let r = this.#
|
|
5307
|
-
xr(r.start.node, r.start.offset, i.start.node, i.start.offset) <= 0 ?
|
|
5343
|
+
let r = this.#de(t), i = this.#de(n);
|
|
5344
|
+
xr(r.start.node, r.start.offset, i.start.node, i.start.offset) <= 0 ? qa(e, r.start, i.end) : qa(e, r.end, i.start);
|
|
5308
5345
|
}
|
|
5309
|
-
#
|
|
5346
|
+
#ue(e, t, n) {
|
|
5310
5347
|
let r = this.#p;
|
|
5311
5348
|
if (!r) return null;
|
|
5312
5349
|
let i = yr(r, e, t);
|
|
5313
5350
|
for (let r = i.length - 1; r >= 0; r--) {
|
|
5314
5351
|
let { node: a, x: o, y: s } = i[r];
|
|
5315
5352
|
if (!Mr(a)) continue;
|
|
5316
|
-
let c =
|
|
5317
|
-
if (
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
let
|
|
5321
|
-
if (
|
|
5322
|
-
start:
|
|
5323
|
-
end:
|
|
5353
|
+
let c = hr(a, o, s, e, t);
|
|
5354
|
+
if (c === null) return null;
|
|
5355
|
+
let l = se(a.source.tagName)?.selectionTarget?.(a.source);
|
|
5356
|
+
if (n === "word" && !l) {
|
|
5357
|
+
let e = Ir(a, c), t = e && Cr(a, e.start), n = e && Cr(a, e.end);
|
|
5358
|
+
if (t && n) return {
|
|
5359
|
+
start: t,
|
|
5360
|
+
end: n
|
|
5324
5361
|
};
|
|
5325
5362
|
}
|
|
5326
|
-
let
|
|
5363
|
+
let u = l ?? a.source;
|
|
5327
5364
|
return {
|
|
5328
5365
|
start: {
|
|
5329
|
-
node:
|
|
5366
|
+
node: u,
|
|
5330
5367
|
offset: 0
|
|
5331
5368
|
},
|
|
5332
5369
|
end: {
|
|
5333
|
-
node:
|
|
5334
|
-
offset:
|
|
5370
|
+
node: u,
|
|
5371
|
+
offset: u.childNodes.length
|
|
5335
5372
|
}
|
|
5336
5373
|
};
|
|
5337
5374
|
}
|
|
5338
5375
|
return null;
|
|
5339
5376
|
}
|
|
5340
|
-
#
|
|
5377
|
+
#de(e) {
|
|
5341
5378
|
let t = e.start.node.getRootNode();
|
|
5342
5379
|
if (!(t instanceof ShadowRoot) || t === this.#s.getRootNode()) return e;
|
|
5343
5380
|
let n = t.host, r = n.parentNode;
|
|
5344
5381
|
if (!r) return e;
|
|
5345
5382
|
let i = Array.prototype.indexOf.call(r.childNodes, n), a = n.previousSibling, o = n.nextSibling;
|
|
5346
5383
|
return {
|
|
5347
|
-
start:
|
|
5384
|
+
start: Ga(a) ? {
|
|
5348
5385
|
node: a,
|
|
5349
5386
|
offset: a instanceof Text ? a.length : a.childNodes.length
|
|
5350
5387
|
} : {
|
|
5351
5388
|
node: r,
|
|
5352
5389
|
offset: i
|
|
5353
5390
|
},
|
|
5354
|
-
end:
|
|
5391
|
+
end: Ga(o) ? {
|
|
5355
5392
|
node: o,
|
|
5356
5393
|
offset: 0
|
|
5357
5394
|
} : {
|
|
@@ -5360,62 +5397,62 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5360
5397
|
}
|
|
5361
5398
|
};
|
|
5362
5399
|
}
|
|
5363
|
-
#
|
|
5400
|
+
#fe(e) {
|
|
5364
5401
|
this.setAttribute(Oa, "");
|
|
5365
5402
|
let t = e.start.node, n = t instanceof Element ? t : t.parentElement;
|
|
5366
5403
|
n && getComputedStyle(n).userSelect;
|
|
5367
5404
|
}
|
|
5368
|
-
#
|
|
5405
|
+
#pe() {
|
|
5369
5406
|
let e = wr(this.#s.getRootNode());
|
|
5370
5407
|
return !e || Tr(this, this.#s, e) !== "light" || e.startContainer === e.endContainer && e.startOffset === e.endOffset ? null : e;
|
|
5371
5408
|
}
|
|
5372
|
-
#
|
|
5373
|
-
this.hasAttribute(Oa) && (this.#
|
|
5409
|
+
#me = () => {
|
|
5410
|
+
this.hasAttribute(Oa) && (this.#pe() || this.removeAttribute(Oa));
|
|
5374
5411
|
};
|
|
5375
|
-
#
|
|
5376
|
-
this.#
|
|
5412
|
+
#he = () => {
|
|
5413
|
+
this.#N = null, this.#ye();
|
|
5377
5414
|
};
|
|
5378
|
-
#
|
|
5415
|
+
#ge = (e) => {
|
|
5379
5416
|
let t = e;
|
|
5380
|
-
if (!t.isPrimary || t.button !== 0 || (this.#S = t.pointerType,
|
|
5381
|
-
let n = this.#
|
|
5417
|
+
if (!t.isPrimary || t.button !== 0 || (this.#S = t.pointerType, Wa(t))) return;
|
|
5418
|
+
let n = this.#Z(t.clientX, t.clientY);
|
|
5382
5419
|
if (n) {
|
|
5383
5420
|
this.#x = n, t.preventDefault(), t.isTrusted && this.setPointerCapture(t.pointerId);
|
|
5384
5421
|
return;
|
|
5385
5422
|
}
|
|
5386
|
-
this.#
|
|
5423
|
+
this.#N = {
|
|
5387
5424
|
x: t.clientX,
|
|
5388
5425
|
y: t.clientY
|
|
5389
|
-
}, this.#
|
|
5426
|
+
}, this.#j = !0, this.#T = t.composedPath().includes(this.#s), this.#ye(!0);
|
|
5390
5427
|
};
|
|
5391
|
-
#
|
|
5428
|
+
#_e = (e) => {
|
|
5392
5429
|
if (e.isPrimary) {
|
|
5393
|
-
if (this.#C = null, this.#x) {
|
|
5394
|
-
this.#
|
|
5430
|
+
if (this.#C = null, this.#w = null, this.#T = !1, this.removeAttribute("data-mw-dragging"), this.#x) {
|
|
5431
|
+
this.#K(this.#x.el), this.#x = null;
|
|
5395
5432
|
return;
|
|
5396
5433
|
}
|
|
5397
|
-
(this.#
|
|
5434
|
+
(this.#j || this.#A) && (this.#j = !1, this.#A = null, this.#ye(), this.#M && this.#Me());
|
|
5398
5435
|
}
|
|
5399
5436
|
};
|
|
5400
|
-
#
|
|
5401
|
-
if (!this.#
|
|
5437
|
+
#ve = (e) => {
|
|
5438
|
+
if (!this.#N) return;
|
|
5402
5439
|
let t = e.target;
|
|
5403
|
-
t instanceof HTMLElement && t.hasAttribute("data-mw-scroll") || (this.#
|
|
5440
|
+
t instanceof HTMLElement && t.hasAttribute("data-mw-scroll") || (this.#I = null, this.#ye());
|
|
5404
5441
|
};
|
|
5405
|
-
#
|
|
5442
|
+
#ye(t = !1) {
|
|
5406
5443
|
let n = this.#p, r = this.#f, i = [];
|
|
5407
|
-
if (this.#
|
|
5408
|
-
let { col: e, row: t } = this.#
|
|
5409
|
-
this.#
|
|
5410
|
-
} else this.#
|
|
5444
|
+
if (this.#N && n && r && this.isConnected && this.getAttribute("select") === "grid" && (this.#j || e.#L?.matches)) {
|
|
5445
|
+
let { col: e, row: t } = this.#X(this.#N.x, this.#N.y, r);
|
|
5446
|
+
this.#P = e, this.#F = t, i = br(n, e, t);
|
|
5447
|
+
} else this.#P = NaN, this.#F = NaN;
|
|
5411
5448
|
let a = i.at(-1) ?? null;
|
|
5412
|
-
t && (this.#
|
|
5413
|
-
let o = e.#
|
|
5414
|
-
l = this.#
|
|
5449
|
+
t && (this.#A = a);
|
|
5450
|
+
let o = e.#L?.matches ? i : [], s = this.#A ? i.indexOf(this.#A) : -1, c = s >= 0 ? i.slice(0, s + 1) : [], l = this.#be("data-mw-hover", this.#O, o);
|
|
5451
|
+
l = this.#be("data-mw-active", this.#k, c) || l;
|
|
5415
5452
|
let u = a ? getComputedStyle(a).cursor : "";
|
|
5416
|
-
this.#s.style.cursor = u === "auto" ? "" : u, l && this.isConnected && this.#
|
|
5453
|
+
this.#s.style.cursor = u === "auto" ? "" : u, l && this.isConnected && this.#Me();
|
|
5417
5454
|
}
|
|
5418
|
-
#
|
|
5455
|
+
#be(e, t, n) {
|
|
5419
5456
|
let r = !1, i = new Set(n);
|
|
5420
5457
|
for (let n of t) i.has(n) || (n.removeAttribute(e), r = !0);
|
|
5421
5458
|
for (let n of i) t.has(n) || (n.setAttribute(e, ""), r = !0);
|
|
@@ -5423,53 +5460,53 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5423
5460
|
for (let e of i) t.add(e);
|
|
5424
5461
|
return r;
|
|
5425
5462
|
}
|
|
5426
|
-
#
|
|
5427
|
-
#
|
|
5428
|
-
#
|
|
5429
|
-
#
|
|
5430
|
-
|
|
5463
|
+
#xe = 0;
|
|
5464
|
+
#Se = !1;
|
|
5465
|
+
#Ce = 0;
|
|
5466
|
+
#we = (e) => {
|
|
5467
|
+
ja.test(e.propertyName) && (this.#xe++, this.#Ce = performance.now(), this.#Ee());
|
|
5431
5468
|
};
|
|
5432
|
-
#
|
|
5433
|
-
|
|
5469
|
+
#Te = (e) => {
|
|
5470
|
+
ja.test(e.propertyName) && (this.#xe = Math.max(0, this.#xe - 1));
|
|
5434
5471
|
};
|
|
5435
|
-
#
|
|
5436
|
-
if (this.#
|
|
5437
|
-
this.#
|
|
5472
|
+
#Ee() {
|
|
5473
|
+
if (this.#Se) return;
|
|
5474
|
+
this.#Se = !0;
|
|
5438
5475
|
let e = () => {
|
|
5439
|
-
if (!this.isConnected || this.#
|
|
5440
|
-
this.#
|
|
5476
|
+
if (!this.isConnected || this.#xe === 0 && !a() || performance.now() - this.#Ce > Ma) {
|
|
5477
|
+
this.#Se = !1, this.#xe = 0, this.#Me();
|
|
5441
5478
|
return;
|
|
5442
5479
|
}
|
|
5443
|
-
this.#
|
|
5480
|
+
this.#je(), requestAnimationFrame(e);
|
|
5444
5481
|
};
|
|
5445
5482
|
requestAnimationFrame(e);
|
|
5446
5483
|
}
|
|
5447
|
-
#
|
|
5448
|
-
if (!
|
|
5484
|
+
#De = (e) => {
|
|
5485
|
+
if (!Wa(e)) {
|
|
5449
5486
|
if ((e.type === "focusin" || e.type === "focusout") && e.target instanceof HTMLSelectElement) {
|
|
5450
|
-
this.#
|
|
5487
|
+
this.#je();
|
|
5451
5488
|
return;
|
|
5452
5489
|
}
|
|
5453
|
-
this.#
|
|
5490
|
+
this.#Me();
|
|
5454
5491
|
}
|
|
5455
5492
|
};
|
|
5456
5493
|
attributeChangedCallback(e, t, n) {
|
|
5457
5494
|
if (e === "select" && n !== "text" && n !== "grid") {
|
|
5458
|
-
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`,
|
|
5495
|
+
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`, ne(this)), this.setAttribute("select", Da);
|
|
5459
5496
|
return;
|
|
5460
5497
|
}
|
|
5461
|
-
e === "select" && this.#
|
|
5498
|
+
e === "select" && this.#ye(), this.#Me();
|
|
5462
5499
|
}
|
|
5463
5500
|
toPlainText() {
|
|
5464
|
-
return this.#d && this.#
|
|
5501
|
+
return this.#d && this.#Ne(), this.#p ? ir(this.#p) : "";
|
|
5465
5502
|
}
|
|
5466
|
-
#
|
|
5467
|
-
this.#
|
|
5503
|
+
#Oe = () => {
|
|
5504
|
+
this.#Me();
|
|
5468
5505
|
};
|
|
5469
|
-
#
|
|
5470
|
-
requestAnimationFrame(() => this.#
|
|
5506
|
+
#ke = () => {
|
|
5507
|
+
requestAnimationFrame(() => this.#Me());
|
|
5471
5508
|
};
|
|
5472
|
-
#
|
|
5509
|
+
#Ae() {
|
|
5473
5510
|
let e = document.activeElement;
|
|
5474
5511
|
if (!(e instanceof HTMLSelectElement) || !this.contains(e)) return !1;
|
|
5475
5512
|
try {
|
|
@@ -5478,25 +5515,25 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5478
5515
|
return !1;
|
|
5479
5516
|
}
|
|
5480
5517
|
}
|
|
5481
|
-
#
|
|
5518
|
+
#je() {
|
|
5482
5519
|
try {
|
|
5483
|
-
this.#
|
|
5520
|
+
this.#Ne();
|
|
5484
5521
|
} catch (e) {
|
|
5485
5522
|
console.error("[monowind] layout failed:", e);
|
|
5486
5523
|
}
|
|
5487
5524
|
}
|
|
5488
|
-
#
|
|
5525
|
+
#Me() {
|
|
5489
5526
|
this.#d || (this.#d = !0, requestAnimationFrame(() => {
|
|
5490
|
-
if (this.#d = !1, this.#
|
|
5491
|
-
this.#
|
|
5527
|
+
if (this.#d = !1, this.#Ae()) {
|
|
5528
|
+
this.#Me();
|
|
5492
5529
|
return;
|
|
5493
5530
|
}
|
|
5494
|
-
this.#
|
|
5531
|
+
this.#je();
|
|
5495
5532
|
}));
|
|
5496
5533
|
}
|
|
5497
|
-
#
|
|
5534
|
+
#Ne() {
|
|
5498
5535
|
if (!this.isConnected) return;
|
|
5499
|
-
let e = this.#
|
|
5536
|
+
let e = this.#V(), t = /* @__PURE__ */ new Map(), n = getComputedStyle(this).getPropertyValue("--mw-cw").trim(), r = parseFloat(n);
|
|
5500
5537
|
if (Number.isFinite(r) && r > 0) for (let e of this.querySelectorAll("textarea")) {
|
|
5501
5538
|
let n = getComputedStyle(e), i = e.clientWidth - (parseFloat(n.paddingLeft) || 0) - (parseFloat(n.paddingRight) || 0);
|
|
5502
5539
|
t.set(e, Math.max(0, Math.round(i / r)));
|
|
@@ -5504,17 +5541,17 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5504
5541
|
this.setAttribute("measuring", "");
|
|
5505
5542
|
try {
|
|
5506
5543
|
this.#c.parentNode !== this && this.appendChild(this.#c);
|
|
5507
|
-
let n =
|
|
5544
|
+
let n = Te(this, this.#c), r = this.#f;
|
|
5508
5545
|
(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;
|
|
5509
5546
|
let i = getComputedStyle(this), a = (parseFloat(i.paddingLeft) || 0) + (parseFloat(i.paddingRight) || 0), o = Math.max(0, Math.floor((this.clientWidth - a) / n.width));
|
|
5510
5547
|
if (o === 0) return;
|
|
5511
|
-
let s =
|
|
5548
|
+
let s = Ee(), c = [];
|
|
5512
5549
|
for (let e of Array.from(this.children)) {
|
|
5513
5550
|
if (e === this.#c) continue;
|
|
5514
5551
|
let r = oa(e, s, n, t);
|
|
5515
5552
|
r && c.push(r);
|
|
5516
5553
|
}
|
|
5517
|
-
if (Sa(this) ? (this.hasAttribute("data-mw-dropped-text") || console.warn(`[monowind] ${Ca}`,
|
|
5554
|
+
if (Sa(this) ? (this.hasAttribute("data-mw-dropped-text") || console.warn(`[monowind] ${Ca}`, ne(this)), this.setAttribute("data-mw-dropped-text", "")) : this.removeAttribute("data-mw-dropped-text"), c.length === 0) {
|
|
5518
5555
|
this.#s.replaceChildren(), this.#p = null, this.setAttribute("data-mw-ready", "");
|
|
5519
5556
|
return;
|
|
5520
5557
|
}
|
|
@@ -5534,7 +5571,7 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5534
5571
|
unclampedHeight: 0,
|
|
5535
5572
|
resolvedPadding: R()
|
|
5536
5573
|
}, { height: u } = Fn(l, o);
|
|
5537
|
-
Zr(l), this.#_ =
|
|
5574
|
+
Zr(l), this.#_ = Ya(l), this.#z(n, e), this.#M = !Ur(l, this.#s, this.#ne()), this.#p = l;
|
|
5538
5575
|
let d = `${l.localRect.width * n.width}px`, f = `${l.localRect.height * n.height}px`;
|
|
5539
5576
|
this.#s.style.width !== d && (this.#s.style.width = d), this.#s.style.height !== f && (this.#s.style.height = f);
|
|
5540
5577
|
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`;
|
|
@@ -5542,43 +5579,43 @@ var Ea = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5542
5579
|
let h = i.boxSizing === "border-box" ? a + (parseFloat(i.borderLeftWidth) || 0) + (parseFloat(i.borderRightWidth) || 0) : 0, g = `${o * n.width + h}px`;
|
|
5543
5580
|
this.style.getPropertyValue("--mw-host-w") !== g && this.style.setProperty("--mw-host-w", g), this.hasAttribute("data-mw-ready") || this.setAttribute("data-mw-ready", "");
|
|
5544
5581
|
} finally {
|
|
5545
|
-
this.setAttribute("settling", ""), this.removeAttribute("measuring"), getComputedStyle(this).transitionProperty, this.removeAttribute("settling"), this.#
|
|
5582
|
+
this.setAttribute("settling", ""), this.removeAttribute("measuring"), getComputedStyle(this).transitionProperty, this.removeAttribute("settling"), this.#H(e), this.#u?.takeRecords(), i(this) && (a() ? (this.#Ce = performance.now(), this.#Ee()) : this.#Me()), this.#Y(), this.#E = [];
|
|
5546
5583
|
let t = document.scrollingElement ?? document.documentElement;
|
|
5547
|
-
for (let e = this.parentElement; e; e = e.parentElement) (e === t || /auto|scroll/.test(getComputedStyle(e).overflow)) && this.#
|
|
5548
|
-
this.#
|
|
5584
|
+
for (let e = this.parentElement; e; e = e.parentElement) (e === t || /auto|scroll/.test(getComputedStyle(e).overflow)) && this.#E.push(e);
|
|
5585
|
+
this.#I = null, this.#N && this.#ye();
|
|
5549
5586
|
}
|
|
5550
5587
|
}
|
|
5551
5588
|
};
|
|
5552
|
-
function
|
|
5553
|
-
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind",
|
|
5554
|
-
}
|
|
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);
|
|
5589
|
+
function Va() {
|
|
5590
|
+
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind", Ba);
|
|
5557
5591
|
}
|
|
5558
5592
|
function Ha(e, t, n, r, i) {
|
|
5593
|
+
return Ua(t === "y" ? e.scrollTop : e.scrollLeft, t === "y" ? e.scrollHeight - e.clientHeight : e.scrollWidth - e.clientWidth, n, r, i);
|
|
5594
|
+
}
|
|
5595
|
+
function Ua(e, t, n, r, i) {
|
|
5559
5596
|
if (r > 0 && e > 0 && e >= t - 1) return r;
|
|
5560
5597
|
let a = e / n - i, o = Math.abs(a) <= .5 ? i : i + Math.sign(a) * Math.round(Math.abs(a));
|
|
5561
5598
|
return Math.min(Math.max(0, o), r);
|
|
5562
5599
|
}
|
|
5563
|
-
function
|
|
5600
|
+
function Wa(e) {
|
|
5564
5601
|
return e instanceof PointerEvent && e.pointerType === "touch" && e.type !== "pointerup";
|
|
5565
5602
|
}
|
|
5566
|
-
function
|
|
5603
|
+
function Ga(e) {
|
|
5567
5604
|
return e !== null && !(e instanceof Element && e.shadowRoot);
|
|
5568
5605
|
}
|
|
5569
|
-
function
|
|
5606
|
+
function Ka(e) {
|
|
5570
5607
|
return {
|
|
5571
5608
|
start: e,
|
|
5572
5609
|
end: e
|
|
5573
5610
|
};
|
|
5574
5611
|
}
|
|
5575
|
-
function
|
|
5612
|
+
function qa(e, t, n) {
|
|
5576
5613
|
e.setBaseAndExtent(t.node, t.offset, n.node, n.offset);
|
|
5577
5614
|
}
|
|
5578
|
-
function
|
|
5615
|
+
function Ja(e, t) {
|
|
5579
5616
|
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
5617
|
}
|
|
5581
|
-
function
|
|
5618
|
+
function Ya(e) {
|
|
5582
5619
|
let t = [], n = (e) => {
|
|
5583
5620
|
e.scrollRange && t.push(e);
|
|
5584
5621
|
for (let t of e.children) n(t);
|
|
@@ -5586,6 +5623,6 @@ function Ja(e) {
|
|
|
5586
5623
|
return n(e), t;
|
|
5587
5624
|
}
|
|
5588
5625
|
//#endregion
|
|
5589
|
-
export {
|
|
5626
|
+
export { Ba as MonoWindElement, Va as defineMonoWind, oe as invalidateLeaves, Yt as multicolLines, x as registerBorderGlyphs, ae as registerLeafRenderer, ir as renderPlainText, De as wrapLines };
|
|
5590
5627
|
|
|
5591
5628
|
//# sourceMappingURL=index.js.map
|