monowind 0.1.5 → 0.1.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 +30 -29
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/flex.d.ts +2 -0
- package/dist/flex.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1046 -625
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +32 -8
- package/dist/layout.d.ts.map +1 -1
- package/dist/metrics.d.ts.map +1 -1
- package/dist/multicol.d.ts +77 -0
- package/dist/multicol.d.ts.map +1 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/sort.d.ts +2 -0
- package/dist/sort.d.ts.map +1 -0
- package/dist/sort.js +548 -0
- package/dist/sort.js.map +1 -0
- package/dist/style.d.ts.map +1 -1
- package/dist/types.d.ts +76 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/wrap.d.ts +4 -0
- package/dist/wrap.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/styles.css +110 -3
package/dist/index.js
CHANGED
|
@@ -264,11 +264,14 @@ function m(e, t) {
|
|
|
264
264
|
return f(t * e / 100);
|
|
265
265
|
}
|
|
266
266
|
function h(e, t) {
|
|
267
|
-
let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).letterSpacing) || 0;
|
|
267
|
+
let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).letterSpacing) || 0, i = t.ownerDocument.createRange();
|
|
268
|
+
i.selectNodeContents(t);
|
|
269
|
+
let a = Math.max(0, i.getBoundingClientRect().height - n.height);
|
|
268
270
|
return {
|
|
269
271
|
width: n.width / 100,
|
|
270
272
|
height: n.height,
|
|
271
|
-
letterSpacing: r
|
|
273
|
+
letterSpacing: r,
|
|
274
|
+
inkOverhang: a
|
|
272
275
|
};
|
|
273
276
|
}
|
|
274
277
|
function g() {
|
|
@@ -295,8 +298,8 @@ function b(e) {
|
|
|
295
298
|
}
|
|
296
299
|
function x(e, t, n = {}) {
|
|
297
300
|
if (!/[^ \t\r\f]/.test(e)) return [];
|
|
298
|
-
let r = [], i = 0;
|
|
299
|
-
for (let
|
|
301
|
+
let r = [], i = 0, a = n.firstLineIndent ?? 0;
|
|
302
|
+
for (let o = 0; o <= e.length; o++) (o === e.length || e[o] === "\n") && (r.push(...A(e, i, o, t, n, a)), a = 0, i = o + 1);
|
|
300
303
|
return y(r, e);
|
|
301
304
|
}
|
|
302
305
|
function S(e, t, n) {
|
|
@@ -362,41 +365,41 @@ function k(e, t, n) {
|
|
|
362
365
|
}
|
|
363
366
|
return r;
|
|
364
367
|
}
|
|
365
|
-
function A(e, t, n, r, { advances: i, tracking: a = 0 }) {
|
|
366
|
-
let
|
|
367
|
-
if (
|
|
368
|
+
function A(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
369
|
+
let s = k(e, t, n);
|
|
370
|
+
if (s.length === 0) return [{
|
|
368
371
|
start: t,
|
|
369
372
|
end: t
|
|
370
373
|
}];
|
|
371
374
|
if (r <= 0) return [{
|
|
372
|
-
start:
|
|
373
|
-
end:
|
|
375
|
+
start: s[0].start,
|
|
376
|
+
end: s[s.length - 1].end
|
|
374
377
|
}];
|
|
375
|
-
let
|
|
376
|
-
for (let t of
|
|
378
|
+
let c = [], l = null, u = 0, d = Math.max(0, o), f = () => r - d;
|
|
379
|
+
for (let t of s) {
|
|
377
380
|
let n = !1;
|
|
378
|
-
for (let
|
|
379
|
-
let e =
|
|
380
|
-
if (
|
|
381
|
+
for (let r of D(e, t.start, t.end)) {
|
|
382
|
+
let e = r.start, t = r.end, o = l !== null && !n ? e - 1 : e, s = u + S(o, t, i), p = Math.min(a, w(t - 1, i));
|
|
383
|
+
if (l !== null && s - p <= f()) l.end = t, u = s;
|
|
381
384
|
else {
|
|
382
|
-
for (
|
|
385
|
+
for (l !== null && (c.push(l), d = 0);;) {
|
|
383
386
|
let n = e;
|
|
384
|
-
for (; n < t && C(e, n + 1, i, a) <=
|
|
387
|
+
for (; n < t && C(e, n + 1, i, a) <= f();) n++;
|
|
385
388
|
if (n === t || n === e) break;
|
|
386
|
-
|
|
389
|
+
c.push({
|
|
387
390
|
start: e,
|
|
388
391
|
end: n
|
|
389
|
-
}), e = n;
|
|
392
|
+
}), d = 0, e = n;
|
|
390
393
|
}
|
|
391
|
-
|
|
394
|
+
l = {
|
|
392
395
|
start: e,
|
|
393
396
|
end: t
|
|
394
|
-
},
|
|
397
|
+
}, u = S(e, t, i);
|
|
395
398
|
}
|
|
396
399
|
n = !0;
|
|
397
400
|
}
|
|
398
401
|
}
|
|
399
|
-
return
|
|
402
|
+
return l !== null && c.push(l), c;
|
|
400
403
|
}
|
|
401
404
|
//#endregion
|
|
402
405
|
//#region src/flex.ts
|
|
@@ -434,29 +437,29 @@ function N(e, t) {
|
|
|
434
437
|
})).filter((e) => e.end > e.start);
|
|
435
438
|
}
|
|
436
439
|
function P(e, t, n, r, i, a, o) {
|
|
437
|
-
let s =
|
|
440
|
+
let s = U(e.style, "x", t), c = U(e.style, "y", n), l = se(e).map((e) => {
|
|
438
441
|
let n = G(e.style.margin, t);
|
|
439
442
|
return {
|
|
440
443
|
node: e,
|
|
441
|
-
base:
|
|
444
|
+
base: oe(e, t, o),
|
|
442
445
|
grow: e.style.flexGrow,
|
|
443
446
|
shrink: e.style.flexShrink,
|
|
444
|
-
min:
|
|
445
|
-
max:
|
|
447
|
+
min: ue(e, t, o),
|
|
448
|
+
max: K(e.style.maxWidth, t),
|
|
446
449
|
margin: n
|
|
447
450
|
};
|
|
448
451
|
}), d = [];
|
|
449
452
|
if (e.style.flexWrap === "wrap") {
|
|
450
453
|
let n = [], r = 0;
|
|
451
454
|
for (let e of l) {
|
|
452
|
-
let i = Math.max(0,
|
|
455
|
+
let i = Math.max(0, H(e.base, e.min, e.max)) + (e.margin.left ?? 0) + (e.margin.right ?? 0), a = n.length === 0 ? i : r + s + i;
|
|
453
456
|
n.length > 0 && a > t && (d.push(n), n = [], r = 0), n.push(e), r = n.length === 1 ? i : r + s + i;
|
|
454
457
|
}
|
|
455
458
|
n.length > 0 && d.push(n), e.style.wrapReverse && d.reverse();
|
|
456
459
|
} else d.push(l);
|
|
457
460
|
let f = i.left + a.left, p = i.top + a.top, m = d.map((e) => {
|
|
458
|
-
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,
|
|
459
|
-
for (let n = 0; n < e.length; n++)
|
|
461
|
+
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, H(e.base, e.min, e.max))) : ie(e, a);
|
|
462
|
+
for (let n = 0; n < e.length; n++) V(e[n].node, t, r, 0, 0, "fill", o, { width: u[n] });
|
|
460
463
|
return {
|
|
461
464
|
row: e,
|
|
462
465
|
widths: u,
|
|
@@ -466,7 +469,7 @@ function P(e, t, n, r, i, a, o) {
|
|
|
466
469
|
}), h = m.map((e) => e.height), g = c * Math.max(0, m.length - 1), _;
|
|
467
470
|
if (e.style.flexWrap === "nowrap") Number.isFinite(n) && (h[0] = Math.max(n, h[0] ?? 0)), _ = [0];
|
|
468
471
|
else {
|
|
469
|
-
let t = h.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - g) : 0, i =
|
|
472
|
+
let t = h.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - g) : 0, i = ce(e.style);
|
|
470
473
|
if (i === "stretch" && r > 0) {
|
|
471
474
|
let e = I(Array.from({ length: m.length }, () => 1), r);
|
|
472
475
|
for (let t = 0; t < h.length; t++) h[t] += e[t];
|
|
@@ -476,11 +479,11 @@ function P(e, t, n, r, i, a, o) {
|
|
|
476
479
|
for (let i = 0; i < m.length; i++) {
|
|
477
480
|
let { row: a, widths: l, availableForItems: u } = m[i], d = h[i], g = _[i] + i * c;
|
|
478
481
|
for (let i = 0; i < a.length; i++) {
|
|
479
|
-
let s = a[i].node, c =
|
|
482
|
+
let s = a[i].node, c = ae(s, e), u = a[i].margin, f = u.top === null || u.bottom === null, p = s.style.height !== void 0 && s.style.height.kind !== "auto";
|
|
480
483
|
if (c === "stretch" && !f && !p && d > s.localRect.height) {
|
|
481
|
-
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, f =
|
|
484
|
+
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, f = H(Math.max(0, d - e - a), K(s.style.minHeight, c) ?? 0, K(s.style.maxHeight, c));
|
|
482
485
|
if (f === s.localRect.height) continue;
|
|
483
|
-
|
|
486
|
+
V(s, t, r, 0, 0, "fill", o, {
|
|
484
487
|
width: l[i],
|
|
485
488
|
height: f
|
|
486
489
|
});
|
|
@@ -491,7 +494,7 @@ function P(e, t, n, r, i, a, o) {
|
|
|
491
494
|
let e = I(Array.from({ length: b }, () => 1), y), t = 0;
|
|
492
495
|
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++]);
|
|
493
496
|
C = F("start", l, 0);
|
|
494
|
-
} else C = F(
|
|
497
|
+
} else C = F(le(e.style), l, y);
|
|
495
498
|
let w = 0;
|
|
496
499
|
for (let t = 0; t < a.length; t++) {
|
|
497
500
|
let n = a[t], r = n.node, i = n.margin.left ?? 0, o = n.margin.right ?? 0;
|
|
@@ -538,7 +541,7 @@ function P(e, t, n, r, i, a, o) {
|
|
|
538
541
|
return ee(e, i, a, t, y), y;
|
|
539
542
|
}
|
|
540
543
|
function ee(e, t, n, r, i) {
|
|
541
|
-
for (let a of e.children)
|
|
544
|
+
for (let a of e.children) B(a.style) && (a.staticSlot = {
|
|
542
545
|
kind: "flex",
|
|
543
546
|
direction: e.style.flexDirection,
|
|
544
547
|
originX: t.left + n.left,
|
|
@@ -548,30 +551,30 @@ function ee(e, t, n, r, i) {
|
|
|
548
551
|
});
|
|
549
552
|
}
|
|
550
553
|
function te(e, t, n, r, i, a, o) {
|
|
551
|
-
let s =
|
|
552
|
-
let a = G(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c =
|
|
553
|
-
|
|
554
|
+
let s = U(e.style, "y", n), c = se(e).map((i) => {
|
|
555
|
+
let a = G(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c = ae(i, e) === "stretch";
|
|
556
|
+
V(i, s, r && Number.isFinite(n) ? n : void 0, 0, 0, c ? "fill" : "shrink", o);
|
|
554
557
|
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 ? m(u.value, l) : i.unclampedHeight, f = i.style.minHeight === "auto" ? i.style.overflow === "visible" ? i.localRect.height : 0 : void 0;
|
|
555
558
|
return {
|
|
556
559
|
node: i,
|
|
557
560
|
base: d,
|
|
558
561
|
grow: i.style.flexGrow,
|
|
559
562
|
shrink: i.style.flexShrink,
|
|
560
|
-
min: f ??
|
|
561
|
-
max:
|
|
563
|
+
min: f ?? K(i.style.minHeight, l) ?? 0,
|
|
564
|
+
max: K(i.style.maxHeight, l),
|
|
562
565
|
margin: a
|
|
563
566
|
};
|
|
564
|
-
}), l = s * Math.max(0, c.length - 1), d = c.reduce((e, t) => e + (t.margin.top ?? 0) + (t.margin.bottom ?? 0), 0), f = Number.isFinite(n), p = c.reduce((e, t) => e + t.base, 0), h = f ? Math.max(0, n - l - d) : p, g = r ? h : Math.max(h, p), _ = c.some((e) => e.margin.top === null || e.margin.bottom === null), v = f && !(f && _ && p <= g) ? ie(c, g) : c.map((e) => Math.max(0,
|
|
567
|
+
}), l = s * Math.max(0, c.length - 1), d = c.reduce((e, t) => e + (t.margin.top ?? 0) + (t.margin.bottom ?? 0), 0), f = Number.isFinite(n), p = c.reduce((e, t) => e + t.base, 0), h = f ? Math.max(0, n - l - d) : p, g = r ? h : Math.max(h, p), _ = c.some((e) => e.margin.top === null || e.margin.bottom === null), v = f && !(f && _ && p <= g) ? ie(c, g) : c.map((e) => Math.max(0, H(e.base, e.min, e.max)));
|
|
565
568
|
for (let n = 0; n < c.length; n++) if (v[n] !== c[n].node.localRect.height) {
|
|
566
|
-
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a =
|
|
567
|
-
|
|
569
|
+
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a = ae(r.node, e) === "stretch";
|
|
570
|
+
V(r.node, i, v[n], 0, 0, a ? "fill" : "shrink", o, { height: v[n] });
|
|
568
571
|
}
|
|
569
572
|
let y = v.reduce((e, t) => e + t, 0), b = Math.max(0, g - y), x = c.reduce((e, t) => e + +(t.margin.top === null) + +(t.margin.bottom === null), 0), S = Array.from({ length: c.length }, () => 0), C = Array.from({ length: c.length }, () => 0), w;
|
|
570
573
|
if (x > 0 && b > 0) {
|
|
571
574
|
let e = I(Array.from({ length: x }, () => 1), b), t = 0;
|
|
572
575
|
for (let n = 0; n < c.length; n++) c[n].margin.top === null && (S[n] = e[t++]), c[n].margin.bottom === null && (C[n] = e[t++]);
|
|
573
576
|
w = F("start", v, 0);
|
|
574
|
-
} else w = F(
|
|
577
|
+
} else w = F(le(e.style), v, b);
|
|
575
578
|
let T = i.left + a.left, E = i.top + a.top, D = 0;
|
|
576
579
|
for (let n = 0; n < c.length; n++) {
|
|
577
580
|
let r = c[n], i = r.node, a = r.margin.top ?? 0, o = r.margin.bottom ?? 0;
|
|
@@ -610,11 +613,11 @@ function te(e, t, n, r, i, a, o) {
|
|
|
610
613
|
}
|
|
611
614
|
function ne(e, t, n, r) {
|
|
612
615
|
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;
|
|
613
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
616
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + L(i, n, e.localRect.height);
|
|
614
617
|
}
|
|
615
618
|
function re(e, t, n, r) {
|
|
616
619
|
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;
|
|
617
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
620
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + L(i, n, e.localRect.width);
|
|
618
621
|
}
|
|
619
622
|
function F(e, t, n) {
|
|
620
623
|
let r = t.length;
|
|
@@ -635,7 +638,7 @@ function F(e, t, n) {
|
|
|
635
638
|
return i;
|
|
636
639
|
}
|
|
637
640
|
function ie(e, t) {
|
|
638
|
-
let n = e.length, r = (t, n) => Math.max(0,
|
|
641
|
+
let n = e.length, r = (t, n) => Math.max(0, H(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);
|
|
639
642
|
for (let t = 0; t < n; t++) {
|
|
640
643
|
let n = r(i[t], t);
|
|
641
644
|
((a ? e[t].grow : e[t].shrink) === 0 || a && i[t] > n || !a && i[t] < n) && (o[t] = n, s[t] = !0);
|
|
@@ -669,33 +672,33 @@ function I(e, t) {
|
|
|
669
672
|
}
|
|
670
673
|
return i;
|
|
671
674
|
}
|
|
672
|
-
function
|
|
675
|
+
function ae(e, t) {
|
|
673
676
|
return e.style.alignSelf === "auto" ? t.style.alignItems : e.style.alignSelf;
|
|
674
677
|
}
|
|
675
|
-
function
|
|
678
|
+
function L(e, t, n) {
|
|
676
679
|
return e === "center" ? Math.max(0, Math.floor((t - n) / 2)) : e === "end" ? Math.max(0, t - n) : 0;
|
|
677
680
|
}
|
|
678
|
-
function
|
|
681
|
+
function oe(e, t, n) {
|
|
679
682
|
let r = e.style.flexBasis, i = e.style.width;
|
|
680
|
-
return r !== void 0 && r.kind !== "auto" ?
|
|
683
|
+
return r !== void 0 && r.kind !== "auto" ? q(r, t, e, n) : i !== void 0 && i.kind !== "auto" ? q(i, t, e, n) : J(e, n);
|
|
681
684
|
}
|
|
682
|
-
function
|
|
683
|
-
let t = e.children.filter((e) => !
|
|
685
|
+
function se(e) {
|
|
686
|
+
let t = e.children.filter((e) => !B(e.style)).sort((e, t) => e.style.order - t.style.order);
|
|
684
687
|
return e.style.flexReverse && t.reverse(), t;
|
|
685
688
|
}
|
|
686
|
-
function
|
|
689
|
+
function ce(e) {
|
|
687
690
|
return e.wrapReverse ? e.alignContent === "start" ? "end" : e.alignContent === "end" ? "start" : e.alignContent : e.alignContent;
|
|
688
691
|
}
|
|
689
|
-
function
|
|
692
|
+
function le(e) {
|
|
690
693
|
let t = e.justifyContent === "stretch" ? "start" : e.justifyContent;
|
|
691
694
|
return e.flexReverse ? t === "start" ? "end" : t === "end" ? "start" : t : t;
|
|
692
695
|
}
|
|
693
|
-
function
|
|
694
|
-
return e.style.minWidth === "auto" ? e.style.overflow === "visible" ?
|
|
696
|
+
function ue(e, t, n) {
|
|
697
|
+
return e.style.minWidth === "auto" ? e.style.overflow === "visible" ? Y(e, n) : 0 : K(e.style.minWidth, t) ?? 0;
|
|
695
698
|
}
|
|
696
699
|
//#endregion
|
|
697
700
|
//#region src/types.ts
|
|
698
|
-
function
|
|
701
|
+
function de() {
|
|
699
702
|
return {
|
|
700
703
|
display: "block",
|
|
701
704
|
flexDirection: "row",
|
|
@@ -714,8 +717,8 @@ function ue() {
|
|
|
714
717
|
justifySelf: "auto",
|
|
715
718
|
gridTemplateColumns: { kind: "none" },
|
|
716
719
|
gridTemplateRows: { kind: "none" },
|
|
717
|
-
gridAutoColumns: [
|
|
718
|
-
gridAutoRows: [
|
|
720
|
+
gridAutoColumns: [fe()],
|
|
721
|
+
gridAutoRows: [fe()],
|
|
719
722
|
gridAutoFlow: {
|
|
720
723
|
direction: "row",
|
|
721
724
|
dense: !1
|
|
@@ -731,7 +734,7 @@ function ue() {
|
|
|
731
734
|
minHeight: "auto",
|
|
732
735
|
maxWidth: void 0,
|
|
733
736
|
maxHeight: void 0,
|
|
734
|
-
padding:
|
|
737
|
+
padding: R(),
|
|
735
738
|
margin: {
|
|
736
739
|
top: 0,
|
|
737
740
|
right: 0,
|
|
@@ -747,7 +750,7 @@ function ue() {
|
|
|
747
750
|
},
|
|
748
751
|
gapX: 0,
|
|
749
752
|
gapY: 0,
|
|
750
|
-
border:
|
|
753
|
+
border: R(),
|
|
751
754
|
borderStyle: {
|
|
752
755
|
top: "solid",
|
|
753
756
|
right: "solid",
|
|
@@ -774,6 +777,7 @@ function ue() {
|
|
|
774
777
|
},
|
|
775
778
|
textAlignBlocked: !1,
|
|
776
779
|
textAlign: "start",
|
|
780
|
+
textIndent: 0,
|
|
777
781
|
tableRole: "none",
|
|
778
782
|
tableLayout: "auto",
|
|
779
783
|
borderCollapse: !1,
|
|
@@ -787,10 +791,17 @@ function ue() {
|
|
|
787
791
|
ruleY: null,
|
|
788
792
|
ruleBreak: "normal",
|
|
789
793
|
ruleInset: 0,
|
|
790
|
-
ruleVisibilityItems: "normal"
|
|
794
|
+
ruleVisibilityItems: "normal",
|
|
795
|
+
columnCount: null,
|
|
796
|
+
columnWidth: null,
|
|
797
|
+
columnFill: "balance",
|
|
798
|
+
columnSpan: !1,
|
|
799
|
+
breakBeforeColumn: !1,
|
|
800
|
+
breakAfterColumn: !1,
|
|
801
|
+
breakInsideAvoid: !1
|
|
791
802
|
};
|
|
792
803
|
}
|
|
793
|
-
function
|
|
804
|
+
function R() {
|
|
794
805
|
return {
|
|
795
806
|
top: 0,
|
|
796
807
|
right: 0,
|
|
@@ -798,7 +809,7 @@ function z() {
|
|
|
798
809
|
left: 0
|
|
799
810
|
};
|
|
800
811
|
}
|
|
801
|
-
function
|
|
812
|
+
function fe() {
|
|
802
813
|
return {
|
|
803
814
|
min: { kind: "auto" },
|
|
804
815
|
max: { kind: "auto" }
|
|
@@ -806,15 +817,15 @@ function B() {
|
|
|
806
817
|
}
|
|
807
818
|
//#endregion
|
|
808
819
|
//#region src/grid.ts
|
|
809
|
-
function
|
|
810
|
-
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, d = e.subgrid?.rows, f = c ? c.gap :
|
|
820
|
+
function pe(e, t, n, r, i, a) {
|
|
821
|
+
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, d = e.subgrid?.rows, f = c ? c.gap : U(o, "x", t), p = d ? d.gap : U(o, "y", s), m = Ce(e, t, s, f, p, e.subgrid ? {
|
|
811
822
|
col: e.subgrid.colSpan,
|
|
812
823
|
row: e.subgrid.rowSpan
|
|
813
|
-
} : void 0), { children: h, placed: g, colLines: _, rowLines: v, colTracks: y, rowTracks: b, colCollapsed: x, rowCollapsed: S } = m, C = h.map((e) => G(e.style.margin, t)), w = h.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), T = h.map(
|
|
824
|
+
} : void 0), { children: h, placed: g, colLines: _, rowLines: v, colTracks: y, rowTracks: b, colCollapsed: x, rowCollapsed: S } = m, C = h.map((e) => G(e.style.margin, t)), w = h.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), T = h.map(me), E = c ? ge(c) : ze(y, x, _e(m, T, C, a), t, f, o.justifyContent === "stretch"), D = c ? c.positions : Be(E, t, o.justifyContent), O = [];
|
|
814
825
|
for (let e = 0; e < h.length; e++) {
|
|
815
|
-
let t = h[e], n = g.items[e], r =
|
|
826
|
+
let t = h[e], n = g.items[e], r = He(D, E.sizes, n.col.start, n.col.span), i = C[e], o = Math.max(0, r - De(i)), s = T[e];
|
|
816
827
|
if (s.cols || s.rows) {
|
|
817
|
-
let e = s.cols ?
|
|
828
|
+
let e = s.cols ? he(D, E, f, n.col.start, n.col.span, ye(t, "cols", i, r)) : void 0;
|
|
818
829
|
t.subgrid = {
|
|
819
830
|
colSpan: n.col.span,
|
|
820
831
|
rowSpan: n.row.span,
|
|
@@ -823,26 +834,26 @@ function de(e, t, n, r, i, a) {
|
|
|
823
834
|
};
|
|
824
835
|
} else t.subgrid = void 0;
|
|
825
836
|
let c = w[e], l = i.left === null || i.right === null, u = t.style.width !== void 0 && t.style.width.kind !== "auto";
|
|
826
|
-
s.cols ?
|
|
837
|
+
s.cols ? V(t, r, void 0, 0, 0, "fill", a, { width: o }) : c === "stretch" && !l && !u ? V(t, r, void 0, 0, 0, "fill", a, { width: H(o, t.style.minWidth === "auto" ? t.style.overflow === "visible" ? Y(t, a) : 0 : K(t.style.minWidth, r) ?? 0, Xt(t.style.maxWidth, r, t, a)) }) : V(t, o, void 0, 0, 0, "shrink", a), O.push(t.localRect.width);
|
|
827
838
|
}
|
|
828
|
-
let k = d ?
|
|
839
|
+
let k = d ? ge(d) : ze(b, S, ve(m, T, C), s ?? "max-content", p, o.alignContent === "stretch"), A = Ve(k), j = d ? d.positions : Be(k, s ?? A, o.alignContent), M = r.left + i.left, N = r.top + i.top;
|
|
829
840
|
for (let t = 0; t < h.length; t++) {
|
|
830
|
-
let n = h[t], r = g.items[t], i = C[t], o =
|
|
831
|
-
if (T[t].rows) n.subgrid.rows =
|
|
841
|
+
let n = h[t], r = g.items[t], i = C[t], o = He(D, E.sizes, r.col.start, r.col.span), s = He(j, k.sizes, r.row.start, r.row.span), c = Math.max(0, s - Oe(i)), l = ae(n, e), u = i.top === null || i.bottom === null, d = n.style.height !== void 0 && n.style.height.kind !== "auto";
|
|
842
|
+
if (T[t].rows) n.subgrid.rows = he(j, k, p, r.row.start, r.row.span, ye(n, "rows", i, o)), V(n, o, s, 0, 0, "fill", a, {
|
|
832
843
|
width: O[t],
|
|
833
844
|
height: c
|
|
834
845
|
});
|
|
835
846
|
else if (l === "stretch" && !u && !d) {
|
|
836
|
-
let e =
|
|
837
|
-
e !== n.localRect.height &&
|
|
847
|
+
let e = H(c, n.style.minHeight === "auto" ? n.style.overflow === "visible" ? n.localRect.height : 0 : K(n.style.minHeight, s) ?? 0, K(n.style.maxHeight, s));
|
|
848
|
+
e !== n.localRect.height && V(n, o, s, 0, 0, "fill", a, {
|
|
838
849
|
width: O[t],
|
|
839
850
|
height: e
|
|
840
851
|
});
|
|
841
|
-
} else n.style.height?.kind === "percent" &&
|
|
852
|
+
} else n.style.height?.kind === "percent" && V(n, o, s, 0, 0, "fill", a, { width: O[t] });
|
|
842
853
|
n.localRect = {
|
|
843
854
|
...n.localRect,
|
|
844
|
-
x: M + D[r.col.start] +
|
|
845
|
-
y: N + j[r.row.start] +
|
|
855
|
+
x: M + D[r.col.start] + Ue(w[t], i.left, i.right, o, n.localRect.width),
|
|
856
|
+
y: N + j[r.row.start] + Ue(l, i.top, i.bottom, s, n.localRect.height)
|
|
846
857
|
};
|
|
847
858
|
}
|
|
848
859
|
let P = Number.isFinite(n) ? Math.max(n, A) : A;
|
|
@@ -880,9 +891,9 @@ function de(e, t, n, r, i, a) {
|
|
|
880
891
|
padding: i
|
|
881
892
|
});
|
|
882
893
|
}
|
|
883
|
-
let ee = e.children.filter((e) =>
|
|
894
|
+
let ee = e.children.filter((e) => B(e.style));
|
|
884
895
|
if (ee.length > 0) {
|
|
885
|
-
let e =
|
|
896
|
+
let e = B(o) ? {
|
|
886
897
|
x: r.left,
|
|
887
898
|
y: r.top,
|
|
888
899
|
width: i.left + t + i.right,
|
|
@@ -894,7 +905,7 @@ function de(e, t, n, r, i, a) {
|
|
|
894
905
|
height: P
|
|
895
906
|
};
|
|
896
907
|
for (let n of ee) {
|
|
897
|
-
let r =
|
|
908
|
+
let r = xe(n.style.gridColumnStart, n.style.gridColumnEnd, _, g.colOrigin, D, E.sizes, -i.left, t + i.right), a = xe(n.style.gridRowStart, n.style.gridRowEnd, v, g.rowOrigin, j, k.sizes, -i.top, P + i.bottom);
|
|
898
909
|
n.staticSlot = {
|
|
899
910
|
kind: "grid",
|
|
900
911
|
area: {
|
|
@@ -909,14 +920,14 @@ function de(e, t, n, r, i, a) {
|
|
|
909
920
|
}
|
|
910
921
|
return P;
|
|
911
922
|
}
|
|
912
|
-
function
|
|
923
|
+
function me(e) {
|
|
913
924
|
let t = e.style.display === "grid";
|
|
914
925
|
return {
|
|
915
926
|
cols: t && e.style.gridTemplateColumns.kind === "subgrid",
|
|
916
927
|
rows: t && e.style.gridTemplateRows.kind === "subgrid"
|
|
917
928
|
};
|
|
918
929
|
}
|
|
919
|
-
function
|
|
930
|
+
function he(e, t, n, r, i, a) {
|
|
920
931
|
let o = e[r] + a.start, s = t.sizes.slice(r, r + i);
|
|
921
932
|
return s[0] = Math.max(0, s[0] - a.start), s[i - 1] = Math.max(0, s[i - 1] - a.end), {
|
|
922
933
|
positions: Array.from({ length: i }, (t, n) => n === 0 ? 0 : e[r + n] - o),
|
|
@@ -925,20 +936,20 @@ function pe(e, t, n, r, i, a) {
|
|
|
925
936
|
gap: n
|
|
926
937
|
};
|
|
927
938
|
}
|
|
928
|
-
function
|
|
939
|
+
function ge(e) {
|
|
929
940
|
return {
|
|
930
941
|
sizes: e.sizes,
|
|
931
942
|
gapBefore: e.gapBefore,
|
|
932
943
|
limits: e.sizes
|
|
933
944
|
};
|
|
934
945
|
}
|
|
935
|
-
function
|
|
946
|
+
function _e(e, t, n, r) {
|
|
936
947
|
let i = [];
|
|
937
948
|
return e.children.forEach((a, o) => {
|
|
938
949
|
let s = e.placed.items[o], c = n[o];
|
|
939
950
|
if (t[o].cols) {
|
|
940
|
-
let e =
|
|
941
|
-
for (let t of
|
|
951
|
+
let e = ye(a, "cols", c, 0);
|
|
952
|
+
for (let t of be(a, "cols", s, e, r)) i.push({
|
|
942
953
|
...t,
|
|
943
954
|
start: t.start + s.col.start
|
|
944
955
|
});
|
|
@@ -947,24 +958,24 @@ function he(e, t, n, r) {
|
|
|
947
958
|
i.push({
|
|
948
959
|
start: s.col.start,
|
|
949
960
|
span: s.col.span,
|
|
950
|
-
min:
|
|
951
|
-
max:
|
|
961
|
+
min: ke(a, "min", r) + De(c),
|
|
962
|
+
max: ke(a, "max", r) + De(c)
|
|
952
963
|
});
|
|
953
964
|
}), i;
|
|
954
965
|
}
|
|
955
|
-
function
|
|
966
|
+
function ve(e, t, n) {
|
|
956
967
|
let r = [];
|
|
957
968
|
return e.children.forEach((i, a) => {
|
|
958
969
|
let o = e.placed.items[a], s = n[a];
|
|
959
970
|
if (t[a].rows) {
|
|
960
|
-
let e =
|
|
961
|
-
for (let t of
|
|
971
|
+
let e = ye(i, "rows", s, 0);
|
|
972
|
+
for (let t of be(i, "rows", o, e)) r.push({
|
|
962
973
|
...t,
|
|
963
974
|
start: t.start + o.row.start
|
|
964
975
|
});
|
|
965
976
|
return;
|
|
966
977
|
}
|
|
967
|
-
let c = i.localRect.height +
|
|
978
|
+
let c = i.localRect.height + Oe(s);
|
|
968
979
|
r.push({
|
|
969
980
|
start: o.row.start,
|
|
970
981
|
span: o.row.span,
|
|
@@ -973,7 +984,7 @@ function ge(e, t, n) {
|
|
|
973
984
|
});
|
|
974
985
|
}), r;
|
|
975
986
|
}
|
|
976
|
-
function
|
|
987
|
+
function ye(e, t, n, r) {
|
|
977
988
|
let { border: i, padding: a } = e.style;
|
|
978
989
|
return t === "cols" ? {
|
|
979
990
|
start: (n.left ?? 0) + i.left + W(a.left, r),
|
|
@@ -983,15 +994,15 @@ function _e(e, t, n, r) {
|
|
|
983
994
|
end: (n.bottom ?? 0) + i.bottom + W(a.bottom, r)
|
|
984
995
|
};
|
|
985
996
|
}
|
|
986
|
-
function
|
|
987
|
-
let a = t === "cols" ? n.col.span : n.row.span, o =
|
|
997
|
+
function be(e, t, n, r, i) {
|
|
998
|
+
let a = t === "cols" ? n.col.span : n.row.span, o = Ce(e, void 0, void 0, 0, 0, {
|
|
988
999
|
col: n.col.span,
|
|
989
1000
|
row: n.row.span
|
|
990
1001
|
}), s = [];
|
|
991
1002
|
if (o.children.forEach((e, n) => {
|
|
992
1003
|
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 = G(e.style.margin, 0);
|
|
993
|
-
if (
|
|
994
|
-
let n =
|
|
1004
|
+
if (me(e)[t]) {
|
|
1005
|
+
let n = ye(e, t, p, 0), a = be(e, t, c, {
|
|
995
1006
|
start: n.start + (u ? r.start : 0),
|
|
996
1007
|
end: n.end + (d ? r.end : 0)
|
|
997
1008
|
}, i);
|
|
@@ -1004,11 +1015,11 @@ function ve(e, t, n, r, i) {
|
|
|
1004
1015
|
if (t === "cols") s.push({
|
|
1005
1016
|
start: l.start,
|
|
1006
1017
|
span: l.span,
|
|
1007
|
-
min:
|
|
1008
|
-
max:
|
|
1018
|
+
min: ke(e, "min", i) + De(p) + f,
|
|
1019
|
+
max: ke(e, "max", i) + De(p) + f
|
|
1009
1020
|
});
|
|
1010
1021
|
else {
|
|
1011
|
-
let t = e.localRect.height +
|
|
1022
|
+
let t = e.localRect.height + Oe(p) + f;
|
|
1012
1023
|
s.push({
|
|
1013
1024
|
start: l.start,
|
|
1014
1025
|
span: l.span,
|
|
@@ -1027,9 +1038,9 @@ function ve(e, t, n, r, i) {
|
|
|
1027
1038
|
}
|
|
1028
1039
|
return s;
|
|
1029
1040
|
}
|
|
1030
|
-
function
|
|
1031
|
-
let c =
|
|
1032
|
-
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l =
|
|
1041
|
+
function xe(e, t, n, r, i, a, o, s) {
|
|
1042
|
+
let c = Fe(e, "start", n), l = Fe(t, "end", n);
|
|
1043
|
+
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l = Ie(c, t, 1, n) : l !== null && e.kind === "span" && (c = Ie(l, e, -1, n));
|
|
1033
1044
|
let u = i.length, d = (e) => {
|
|
1034
1045
|
if (e === null) return;
|
|
1035
1046
|
let t = e - r;
|
|
@@ -1040,22 +1051,22 @@ function ye(e, t, n, r, i, a, o, s) {
|
|
|
1040
1051
|
end: h === void 0 ? s : p(h)
|
|
1041
1052
|
};
|
|
1042
1053
|
}
|
|
1043
|
-
function
|
|
1054
|
+
function Se(e, t) {
|
|
1044
1055
|
let n = t.gridIntrinsic.get(e);
|
|
1045
1056
|
if (n !== void 0) return n;
|
|
1046
|
-
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a =
|
|
1057
|
+
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a = Ce(e, void 0, void 0, i, 0, e.subgrid ? {
|
|
1047
1058
|
col: e.subgrid.colSpan,
|
|
1048
1059
|
row: e.subgrid.rowSpan
|
|
1049
|
-
} : void 0), o = a.children.map(
|
|
1060
|
+
} : void 0), o = a.children.map(me), s = a.children.map((e) => G(e.style.margin, 0)), c = ze(a.colTracks, a.colCollapsed, _e(a, o, s, t), "min-content", i, !1), l = c.gapBefore.reduce((e, t) => e + t, 0), u = {
|
|
1050
1061
|
min: c.sizes.reduce((e, t) => e + t, 0) + l,
|
|
1051
1062
|
max: c.limits.reduce((e, t) => e + t, 0) + l
|
|
1052
1063
|
};
|
|
1053
1064
|
return t.gridIntrinsic.set(e, u), u;
|
|
1054
1065
|
}
|
|
1055
|
-
function
|
|
1056
|
-
let o = e.style, s =
|
|
1066
|
+
function Ce(e, t, n, r, i, a) {
|
|
1067
|
+
let o = e.style, s = Ee(e), c = o.gridTemplateColumns.kind === "subgrid" && a !== void 0, l = o.gridTemplateRows.kind === "subgrid" && a !== void 0, u = c ? we(a.col) : Ae(o.gridTemplateColumns, t, r), d = l ? we(a.row) : Ae(o.gridTemplateRows, n, i), f = o.gridTemplateAreas, p = [...u.tracks], m = [...d.tracks];
|
|
1057
1068
|
if (f) {
|
|
1058
|
-
c ||
|
|
1069
|
+
c || Me(p, u.lineNames, f.columns, o.gridAutoColumns), l || Me(m, d.lineNames, f.rows, o.gridAutoRows);
|
|
1059
1070
|
for (let [e, t] of f.areas) u.lineNames[Math.min(t.colStart, p.length)].push(`${e}-start`), u.lineNames[Math.min(t.colEnd, p.length)].push(`${e}-end`), d.lineNames[Math.min(t.rowStart, m.length)].push(`${e}-start`), d.lineNames[Math.min(t.rowEnd, m.length)].push(`${e}-end`);
|
|
1060
1071
|
}
|
|
1061
1072
|
let h = {
|
|
@@ -1064,28 +1075,28 @@ function xe(e, t, n, r, i, a) {
|
|
|
1064
1075
|
}, g = {
|
|
1065
1076
|
explicitCount: m.length,
|
|
1066
1077
|
names: d.lineNames
|
|
1067
|
-
}, _ =
|
|
1068
|
-
col:
|
|
1069
|
-
row:
|
|
1078
|
+
}, _ = Re(s.map((e) => ({
|
|
1079
|
+
col: Le(e.style.gridColumnStart, e.style.gridColumnEnd, h),
|
|
1080
|
+
row: Le(e.style.gridRowStart, e.style.gridRowEnd, g)
|
|
1070
1081
|
})), p.length, m.length, o.gridAutoFlow);
|
|
1071
|
-
return c &&
|
|
1082
|
+
return c && Te(_, "col", p.length), l && Te(_, "row", m.length), {
|
|
1072
1083
|
children: s,
|
|
1073
1084
|
placed: _,
|
|
1074
1085
|
colLines: h,
|
|
1075
1086
|
rowLines: g,
|
|
1076
|
-
colTracks:
|
|
1077
|
-
rowTracks:
|
|
1078
|
-
colCollapsed:
|
|
1079
|
-
rowCollapsed:
|
|
1087
|
+
colTracks: Ne(p, _.colOrigin, _.colCount, o.gridAutoColumns),
|
|
1088
|
+
rowTracks: Ne(m, _.rowOrigin, _.rowCount, o.gridAutoRows),
|
|
1089
|
+
colCollapsed: Pe(u, _.colOrigin, _.colCount, _.items.map((e) => e.col)),
|
|
1090
|
+
rowCollapsed: Pe(d, _.rowOrigin, _.rowCount, _.items.map((e) => e.row))
|
|
1080
1091
|
};
|
|
1081
1092
|
}
|
|
1082
|
-
function
|
|
1093
|
+
function we(e) {
|
|
1083
1094
|
return {
|
|
1084
|
-
tracks: Array.from({ length: e }, () =>
|
|
1095
|
+
tracks: Array.from({ length: e }, () => fe()),
|
|
1085
1096
|
lineNames: Array.from({ length: e + 1 }, () => [])
|
|
1086
1097
|
};
|
|
1087
1098
|
}
|
|
1088
|
-
function
|
|
1099
|
+
function Te(e, t, n) {
|
|
1089
1100
|
let r = t === "col" ? e.colOrigin : e.rowOrigin;
|
|
1090
1101
|
for (let i of e.items) {
|
|
1091
1102
|
let e = i[t], a = Math.min(Math.max(e.start + r, 0), n - 1), o = Math.min(Math.max(e.start + r + e.span, a + 1), n);
|
|
@@ -1093,22 +1104,22 @@ function Ce(e, t, n) {
|
|
|
1093
1104
|
}
|
|
1094
1105
|
t === "col" ? (e.colOrigin = 0, e.colCount = n) : (e.rowOrigin = 0, e.rowCount = n);
|
|
1095
1106
|
}
|
|
1096
|
-
function
|
|
1097
|
-
return e.children.filter((e) => !
|
|
1107
|
+
function Ee(e) {
|
|
1108
|
+
return e.children.filter((e) => !B(e.style) && !e.inlineBox).sort((e, t) => e.style.order - t.style.order);
|
|
1098
1109
|
}
|
|
1099
|
-
function
|
|
1110
|
+
function De(e) {
|
|
1100
1111
|
return (e.left ?? 0) + (e.right ?? 0);
|
|
1101
1112
|
}
|
|
1102
|
-
function
|
|
1113
|
+
function Oe(e) {
|
|
1103
1114
|
return (e.top ?? 0) + (e.bottom ?? 0);
|
|
1104
1115
|
}
|
|
1105
|
-
function
|
|
1116
|
+
function ke(e, t, n) {
|
|
1106
1117
|
let r = e.style, i;
|
|
1107
|
-
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i =
|
|
1118
|
+
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = q(r.width, 0, e, n)), i === void 0 && (i = t === "min" ? Y(e, n) : J(e, n));
|
|
1108
1119
|
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
1109
|
-
return Math.max(0,
|
|
1120
|
+
return Math.max(0, H(i, a, o));
|
|
1110
1121
|
}
|
|
1111
|
-
function
|
|
1122
|
+
function Ae(e, t, n) {
|
|
1112
1123
|
if (e.kind !== "tracks") return {
|
|
1113
1124
|
tracks: [],
|
|
1114
1125
|
lineNames: [[]]
|
|
@@ -1121,7 +1132,7 @@ function Oe(e, t, n) {
|
|
|
1121
1132
|
let { index: i, tracks: a, mode: o } = e.autoRepeat, s = 1;
|
|
1122
1133
|
if (t !== void 0) {
|
|
1123
1134
|
let e = a.reduce((e, n) => {
|
|
1124
|
-
let r =
|
|
1135
|
+
let r = je(n.min, t) ?? je(n.max, t) ?? 1;
|
|
1125
1136
|
return e + Math.max(1, r);
|
|
1126
1137
|
}, 0);
|
|
1127
1138
|
s = Math.max(1, Math.floor((t + n) / (e + n * a.length)));
|
|
@@ -1149,23 +1160,23 @@ function Oe(e, t, n) {
|
|
|
1149
1160
|
lineNames: d
|
|
1150
1161
|
};
|
|
1151
1162
|
}
|
|
1152
|
-
function
|
|
1163
|
+
function je(e, t) {
|
|
1153
1164
|
if (e.kind === "cells") return e.value;
|
|
1154
1165
|
if (e.kind === "percent" && t !== void 0) return m(e.value, t);
|
|
1155
1166
|
if (e.kind === "math") {
|
|
1156
1167
|
let n = [];
|
|
1157
1168
|
for (let r of e.args) {
|
|
1158
|
-
let e =
|
|
1169
|
+
let e = je(r, t);
|
|
1159
1170
|
if (e === void 0) return;
|
|
1160
1171
|
n.push(e);
|
|
1161
1172
|
}
|
|
1162
1173
|
return e.fn === "min" ? Math.min(...n) : Math.max(...n);
|
|
1163
1174
|
}
|
|
1164
1175
|
}
|
|
1165
|
-
function
|
|
1176
|
+
function Me(e, t, n, r) {
|
|
1166
1177
|
for (let i = e.length; i < n; i++) e.push(r[(i - e.length) % r.length]), t.push([]);
|
|
1167
1178
|
}
|
|
1168
|
-
function
|
|
1179
|
+
function Ne(e, t, n, r) {
|
|
1169
1180
|
let i = [];
|
|
1170
1181
|
for (let a = 0; a < n; a++) {
|
|
1171
1182
|
let n = a + t;
|
|
@@ -1177,7 +1188,7 @@ function je(e, t, n, r) {
|
|
|
1177
1188
|
}
|
|
1178
1189
|
return i;
|
|
1179
1190
|
}
|
|
1180
|
-
function
|
|
1191
|
+
function Pe(e, t, n, r) {
|
|
1181
1192
|
let i = Array.from({ length: n }, () => !1);
|
|
1182
1193
|
if (!e.autoFit) return i;
|
|
1183
1194
|
for (let a = e.autoFit.start; a < e.autoFit.end; a++) {
|
|
@@ -1186,7 +1197,7 @@ function Me(e, t, n, r) {
|
|
|
1186
1197
|
}
|
|
1187
1198
|
return i;
|
|
1188
1199
|
}
|
|
1189
|
-
function
|
|
1200
|
+
function Fe(e, t, n) {
|
|
1190
1201
|
if (e.kind === "line") return e.value > 0 ? e.value - 1 : n.explicitCount + 1 + e.value;
|
|
1191
1202
|
if (e.kind !== "name") return null;
|
|
1192
1203
|
if (e.nth === void 0) {
|
|
@@ -1201,14 +1212,14 @@ function Ne(e, t, n) {
|
|
|
1201
1212
|
for (let t = i; t >= 0; t--) if (n.names[t].includes(e.name) && ++a === -r) return t;
|
|
1202
1213
|
return -(-r - a);
|
|
1203
1214
|
}
|
|
1204
|
-
function
|
|
1215
|
+
function Ie(e, t, n, r) {
|
|
1205
1216
|
if (t.name === void 0) return e + n * t.value;
|
|
1206
1217
|
let i = t.value, a = e;
|
|
1207
1218
|
for (; i > 0;) a += n, (!(a >= 0 && a <= r.explicitCount) || r.names[a].includes(t.name)) && i--;
|
|
1208
1219
|
return a;
|
|
1209
1220
|
}
|
|
1210
|
-
function
|
|
1211
|
-
let r =
|
|
1221
|
+
function Le(e, t, n) {
|
|
1222
|
+
let r = Fe(e, "start", n), i = Fe(t, "end", n);
|
|
1212
1223
|
if (r !== null && i !== null) return r === i ? {
|
|
1213
1224
|
start: r,
|
|
1214
1225
|
span: 1
|
|
@@ -1218,10 +1229,10 @@ function Fe(e, t, n) {
|
|
|
1218
1229
|
};
|
|
1219
1230
|
if (r !== null) return {
|
|
1220
1231
|
start: r,
|
|
1221
|
-
span: (t.kind === "span" ?
|
|
1232
|
+
span: (t.kind === "span" ? Ie(r, t, 1, n) : r + 1) - r
|
|
1222
1233
|
};
|
|
1223
1234
|
if (i !== null) {
|
|
1224
|
-
let t = e.kind === "span" ?
|
|
1235
|
+
let t = e.kind === "span" ? Ie(i, e, -1, n) : i - 1;
|
|
1225
1236
|
return {
|
|
1226
1237
|
start: t,
|
|
1227
1238
|
span: i - t
|
|
@@ -1232,7 +1243,7 @@ function Fe(e, t, n) {
|
|
|
1232
1243
|
span: e.kind === "span" ? e.value : t.kind === "span" ? t.value : 1
|
|
1233
1244
|
};
|
|
1234
1245
|
}
|
|
1235
|
-
function
|
|
1246
|
+
function Re(e, t, n, r) {
|
|
1236
1247
|
let i = r.direction === "row", a = e.map((e) => i ? e.row : e.col), o = e.map((e) => i ? e.col : e.row), s = i ? t : n, c = i ? n : t, l = 0, u = Math.max(s, 1);
|
|
1237
1248
|
for (let t = 0; t < e.length; t++) {
|
|
1238
1249
|
let e = o[t];
|
|
@@ -1329,7 +1340,7 @@ function Ie(e, t, n, r) {
|
|
|
1329
1340
|
rowCount: S
|
|
1330
1341
|
};
|
|
1331
1342
|
}
|
|
1332
|
-
function
|
|
1343
|
+
function ze(e, t, n, r, i, a) {
|
|
1333
1344
|
let o = typeof r == "number" ? r : void 0, s = e.map((e, n) => {
|
|
1334
1345
|
if (t[n]) return {
|
|
1335
1346
|
base: 0,
|
|
@@ -1339,7 +1350,7 @@ function Le(e, t, n, r, i, a) {
|
|
|
1339
1350
|
frFactor: 0,
|
|
1340
1351
|
collapsed: !0
|
|
1341
1352
|
};
|
|
1342
|
-
let r =
|
|
1353
|
+
let r = je(e.min, o), i = r ?? 0, a = r === void 0, s = e.max;
|
|
1343
1354
|
if (s.kind === "fr") return {
|
|
1344
1355
|
base: i,
|
|
1345
1356
|
limit: null,
|
|
@@ -1348,7 +1359,7 @@ function Le(e, t, n, r, i, a) {
|
|
|
1348
1359
|
frFactor: s.value,
|
|
1349
1360
|
collapsed: !1
|
|
1350
1361
|
};
|
|
1351
|
-
let c =
|
|
1362
|
+
let c = je(s, o);
|
|
1352
1363
|
return c === void 0 ? {
|
|
1353
1364
|
base: i,
|
|
1354
1365
|
limit: null,
|
|
@@ -1473,57 +1484,406 @@ function Le(e, t, n, r, i, a) {
|
|
|
1473
1484
|
limits: s.map((e) => u(e))
|
|
1474
1485
|
};
|
|
1475
1486
|
}
|
|
1476
|
-
function
|
|
1477
|
-
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t -
|
|
1487
|
+
function Be(e, t, n) {
|
|
1488
|
+
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t - Ve(e)), o = F(n === "stretch" ? "start" : n, r, a), s = [], c = 0;
|
|
1478
1489
|
for (let e = 0; e < r.length; e++) c += i[e], s.push(o[e] + c);
|
|
1479
1490
|
return s;
|
|
1480
1491
|
}
|
|
1481
|
-
function
|
|
1492
|
+
function Ve(e) {
|
|
1482
1493
|
return e.sizes.reduce((e, t) => e + t, 0) + e.gapBefore.reduce((e, t) => e + t, 0);
|
|
1483
1494
|
}
|
|
1484
|
-
function
|
|
1495
|
+
function He(e, t, n, r) {
|
|
1485
1496
|
let i = n + r - 1;
|
|
1486
1497
|
return e[n] === void 0 || e[i] === void 0 ? 0 : e[i] + t[i] - e[n];
|
|
1487
1498
|
}
|
|
1488
|
-
function
|
|
1499
|
+
function Ue(e, t, n, r, i) {
|
|
1489
1500
|
let a = t ?? 0, o = n ?? 0, s = r - i;
|
|
1490
|
-
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a +
|
|
1501
|
+
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a + L(e, r, i + a + o);
|
|
1502
|
+
}
|
|
1503
|
+
//#endregion
|
|
1504
|
+
//#region src/multicol.ts
|
|
1505
|
+
function We(e, t, n) {
|
|
1506
|
+
let r = e.columnWidth === null ? null : Math.max(1, Math.floor((t + n) / (e.columnWidth + n)));
|
|
1507
|
+
return e.columnCount !== null && r !== null ? Math.max(1, Math.min(e.columnCount, r)) : r === null ? Math.max(1, e.columnCount ?? 1) : r;
|
|
1508
|
+
}
|
|
1509
|
+
function Ge(e, t, n) {
|
|
1510
|
+
let r = We(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r)), a = Math.max(0, t - (r * i + (r - 1) * n));
|
|
1511
|
+
return Array.from({ length: r }, (e, t) => i + +(t < a));
|
|
1512
|
+
}
|
|
1513
|
+
function Ke(e, t) {
|
|
1514
|
+
let n = Math.max(typeof e.gapX == "number" ? e.gapX : 0, e.ruleX?.width ?? 0);
|
|
1515
|
+
return e.columnCount === null ? Math.max(e.columnWidth ?? 1, t) : e.columnCount * t + (e.columnCount - 1) * n;
|
|
1516
|
+
}
|
|
1517
|
+
function qe(e, t) {
|
|
1518
|
+
return e === void 0 ? t : t === void 0 ? e : Math.min(e, t);
|
|
1519
|
+
}
|
|
1520
|
+
function Je(e, t, n) {
|
|
1521
|
+
for (; e < t;) {
|
|
1522
|
+
let r = e + t >> 1;
|
|
1523
|
+
n(r) ? t = r : e = r + 1;
|
|
1524
|
+
}
|
|
1525
|
+
return e;
|
|
1526
|
+
}
|
|
1527
|
+
function Ye(e, t, n) {
|
|
1528
|
+
let r = We(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r));
|
|
1529
|
+
return {
|
|
1530
|
+
count: r,
|
|
1531
|
+
width: i,
|
|
1532
|
+
leftover: Math.max(0, t - (r * i + (r - 1) * n))
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
function Xe(e, t, n) {
|
|
1536
|
+
return e === "all" ? !0 : e === "around" ? t || n : t && n;
|
|
1537
|
+
}
|
|
1538
|
+
function Ze(e, t, n, r) {
|
|
1539
|
+
let i = qt(e, Math.max(1, t.width - e.style.tracking)), { heights: a, textOffsets: o } = Jt(e, i), s = e.style.lineGap, c = Qe(a.map((e) => e + s)), l;
|
|
1540
|
+
if (e.style.columnFill === "auto" && r !== void 0) l = Math.max(1, r);
|
|
1541
|
+
else {
|
|
1542
|
+
let e = Je(c.reduce((e, t) => Math.max(e, t.rows - s), 1), Math.max(1, c.reduce((e, t) => e + t.rows, 0) - s), (e) => z(c, s, e).columns <= t.count);
|
|
1543
|
+
l = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
1544
|
+
}
|
|
1545
|
+
let u = z(c, s, l);
|
|
1546
|
+
return {
|
|
1547
|
+
spans: i,
|
|
1548
|
+
lineY: u.top,
|
|
1549
|
+
textY: u.top.map((e, t) => e + o[t]),
|
|
1550
|
+
lineX: u.column.map((e) => e * (t.width + n)),
|
|
1551
|
+
totalRows: u.maxUsed,
|
|
1552
|
+
columnCount: t.count,
|
|
1553
|
+
columnWidth: t.width,
|
|
1554
|
+
gap: n,
|
|
1555
|
+
columnsUsed: i.length > 0 ? u.columns : 0
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
function z(e, t, n) {
|
|
1559
|
+
let r = 0, i = 0, a = 0, o = [], s = [];
|
|
1560
|
+
for (let c = 0; c < e.length; c++) {
|
|
1561
|
+
let l = e[c], u = c === 0 || i > 0 ? l.pre : 0;
|
|
1562
|
+
i > 0 && (l.forced || i + u + l.rows - t > n) && (r += 1, i = 0, u = 0);
|
|
1563
|
+
let d = l.rows / l.lines;
|
|
1564
|
+
if (l.lines > 1 && l.rows - t > n) {
|
|
1565
|
+
for (let e = 0; e < l.lines; e++) i > 0 && i + u + d - t > n && (r += 1, i = 0, u = 0), o.push(r), s.push(i + u), i += u + d, u = 0, a = Math.max(a, i - t);
|
|
1566
|
+
continue;
|
|
1567
|
+
}
|
|
1568
|
+
for (let e = 0; e < l.lines; e++) o.push(r), s.push(i + u + e * d);
|
|
1569
|
+
i += u + l.rows, a = Math.max(a, i - t);
|
|
1570
|
+
}
|
|
1571
|
+
return {
|
|
1572
|
+
columns: r + 1,
|
|
1573
|
+
maxUsed: a,
|
|
1574
|
+
column: o,
|
|
1575
|
+
top: s
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
function Qe(e) {
|
|
1579
|
+
return e.map((e) => ({
|
|
1580
|
+
rows: e,
|
|
1581
|
+
pre: 0,
|
|
1582
|
+
forced: !1,
|
|
1583
|
+
lines: 1
|
|
1584
|
+
}));
|
|
1585
|
+
}
|
|
1586
|
+
function $e(e, t) {
|
|
1587
|
+
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 = x(e, Math.max(1, n - i), {
|
|
1588
|
+
advances: s,
|
|
1589
|
+
tracking: i,
|
|
1590
|
+
firstLineIndent: t.firstLineIndent
|
|
1591
|
+
}), l = Qe(c.map(() => 1 + a)), u = z(l, a, o ?? Je(1, Math.max(1, c.length * (1 + a) - a), (e) => z(l, a, e).columns <= r));
|
|
1592
|
+
return c.map((t, n) => ({
|
|
1593
|
+
text: e.slice(t.start, t.end),
|
|
1594
|
+
column: u.column[n],
|
|
1595
|
+
top: u.top[n]
|
|
1596
|
+
}));
|
|
1597
|
+
}
|
|
1598
|
+
function et(e, t, n, r) {
|
|
1599
|
+
let i = e.style;
|
|
1600
|
+
if (!i.ruleX) return;
|
|
1601
|
+
let a = t.columnCount * t.columnWidth + (t.columnCount - 1) * t.gap, o = t.ruleSegments ?? [{
|
|
1602
|
+
start: 0,
|
|
1603
|
+
end: t.totalRows,
|
|
1604
|
+
columns: t.columnsUsed
|
|
1605
|
+
}], s = [];
|
|
1606
|
+
for (let e of o) {
|
|
1607
|
+
let n = Math.min(e.columns, t.columnCount);
|
|
1608
|
+
for (let r = 0; r < t.columnCount - 1; r++) Xe(i.ruleVisibilityItems, r < n, r + 1 < n) && s.push({
|
|
1609
|
+
bandStart: (r + 1) * t.columnWidth + r * t.gap,
|
|
1610
|
+
bandSize: t.gap,
|
|
1611
|
+
start: e.start,
|
|
1612
|
+
end: e.end
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
e.decorationRuns = u({
|
|
1616
|
+
ruleX: i.ruleX,
|
|
1617
|
+
ruleY: null,
|
|
1618
|
+
vertical: N(s, i.ruleInset),
|
|
1619
|
+
horizontal: [],
|
|
1620
|
+
contentWidth: a,
|
|
1621
|
+
contentHeight: t.totalRows,
|
|
1622
|
+
border: n,
|
|
1623
|
+
borderStyle: i.borderStyle,
|
|
1624
|
+
borderColor: i.borderColor,
|
|
1625
|
+
padding: r
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
function tt(e, t) {
|
|
1629
|
+
let n = e.style, r = n.padding;
|
|
1630
|
+
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.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;
|
|
1631
|
+
}
|
|
1632
|
+
function nt(e, t, n, r, i, a, o) {
|
|
1633
|
+
let s = e.style, c = U(s, "x", n), l = Ye(s, n, c);
|
|
1634
|
+
a.right += l.leftover;
|
|
1635
|
+
let u = s.lineGap, d = i.left + a.left, f = i.top + a.top, p = n - l.leftover, m = [[]], h = [];
|
|
1636
|
+
for (let e of t) e.style.columnSpan ? (h[m.length - 1] = e, m.push([])) : m[m.length - 1].push(e);
|
|
1637
|
+
let g = m.length > 1, _ = [], v = 0, y = 0;
|
|
1638
|
+
for (let e = 0; e < m.length; e++) {
|
|
1639
|
+
let t = m[e];
|
|
1640
|
+
if (t.length > 0) {
|
|
1641
|
+
let n = t.map((e) => ({
|
|
1642
|
+
node: e,
|
|
1643
|
+
spans: qt(e, Math.max(1, l.width - e.style.tracking)),
|
|
1644
|
+
margin: G(e.style.margin, l.width)
|
|
1645
|
+
})), i = [], a = null, o = !1;
|
|
1646
|
+
for (let { node: e, spans: t, margin: r } of n) {
|
|
1647
|
+
let n = a === null ? r.top ?? 0 : $t(a, r.top ?? 0), s = o || e.style.breakBeforeColumn;
|
|
1648
|
+
if (e.style.breakInsideAvoid && t.length > 0) i.push({
|
|
1649
|
+
rows: t.length * (1 + u),
|
|
1650
|
+
pre: n,
|
|
1651
|
+
forced: s,
|
|
1652
|
+
lines: t.length
|
|
1653
|
+
});
|
|
1654
|
+
else for (let e = 0; e < t.length; e++) i.push({
|
|
1655
|
+
rows: 1 + u,
|
|
1656
|
+
pre: e > 0 ? 0 : n,
|
|
1657
|
+
forced: e === 0 && s,
|
|
1658
|
+
lines: 1
|
|
1659
|
+
});
|
|
1660
|
+
t.length > 0 && (a = r.bottom ?? 0), o = e.style.breakAfterColumn;
|
|
1661
|
+
}
|
|
1662
|
+
let h;
|
|
1663
|
+
if (s.columnFill === "auto" && r !== void 0) h = Math.max(1, r);
|
|
1664
|
+
else {
|
|
1665
|
+
let e = Je(1, Math.max(1, z(i, u, Infinity).maxUsed), (e) => z(i, u, e).columns <= l.count);
|
|
1666
|
+
h = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
1667
|
+
}
|
|
1668
|
+
let g = z(i, u, h);
|
|
1669
|
+
for (let e = 0, t = 0; e < n.length; e++) {
|
|
1670
|
+
let { node: r, spans: i, margin: a } = n[e], o = [], s = [];
|
|
1671
|
+
for (let e = 0; e < i.length; e++, t++) o.push(v + g.top[t]), s.push(g.column[t] * (l.width + c));
|
|
1672
|
+
delete r.decorationRuns, r.multicolGeometry = {
|
|
1673
|
+
spans: i,
|
|
1674
|
+
lineY: o,
|
|
1675
|
+
textY: o,
|
|
1676
|
+
lineX: s,
|
|
1677
|
+
totalRows: v + g.maxUsed,
|
|
1678
|
+
columnCount: l.count,
|
|
1679
|
+
columnWidth: l.width,
|
|
1680
|
+
gap: c,
|
|
1681
|
+
columnsUsed: g.columns
|
|
1682
|
+
}, r.multicolFlow = a, r.localRect = {
|
|
1683
|
+
x: d,
|
|
1684
|
+
y: f,
|
|
1685
|
+
width: p,
|
|
1686
|
+
height: g.maxUsed
|
|
1687
|
+
}, r.resolvedPadding = {
|
|
1688
|
+
top: 0,
|
|
1689
|
+
right: 0,
|
|
1690
|
+
bottom: 0,
|
|
1691
|
+
left: 0
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
i.length > 0 && (_.push({
|
|
1695
|
+
start: v,
|
|
1696
|
+
end: v + g.maxUsed,
|
|
1697
|
+
columns: g.columns
|
|
1698
|
+
}), y = Math.max(y, g.columns), v += g.maxUsed + (e < m.length - 1 ? u : 0));
|
|
1699
|
+
}
|
|
1700
|
+
let n = h[e];
|
|
1701
|
+
if (n) {
|
|
1702
|
+
let e = G(n.style.margin, p), t = (e.left ?? 0) + (e.right ?? 0);
|
|
1703
|
+
V(n, Math.max(0, p - t), void 0, 0, 0, "fill", o);
|
|
1704
|
+
let r = Qt(e, p, n.localRect.width);
|
|
1705
|
+
v += e.top ?? 0, n.localRect = {
|
|
1706
|
+
...n.localRect,
|
|
1707
|
+
x: d + r,
|
|
1708
|
+
y: f + v
|
|
1709
|
+
}, n.multicolFlowSpan = {
|
|
1710
|
+
top: e.top ?? 0,
|
|
1711
|
+
right: 0,
|
|
1712
|
+
bottom: e.bottom ?? 0,
|
|
1713
|
+
left: r
|
|
1714
|
+
}, v += n.localRect.height + (e.bottom ?? 0);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
let b = v;
|
|
1718
|
+
for (let t of e.children) {
|
|
1719
|
+
if (!B(t.style)) continue;
|
|
1720
|
+
let e = G(t.style.margin, n);
|
|
1721
|
+
t.staticSlot = {
|
|
1722
|
+
kind: "block",
|
|
1723
|
+
x: d + (e.left ?? 0),
|
|
1724
|
+
y: f + (e.top ?? 0)
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1727
|
+
return e.multicolGeometry = {
|
|
1728
|
+
spans: [],
|
|
1729
|
+
lineY: [],
|
|
1730
|
+
textY: [],
|
|
1731
|
+
lineX: [],
|
|
1732
|
+
totalRows: b,
|
|
1733
|
+
columnCount: l.count,
|
|
1734
|
+
columnWidth: l.width,
|
|
1735
|
+
gap: c,
|
|
1736
|
+
columnsUsed: y,
|
|
1737
|
+
...g ? {
|
|
1738
|
+
ruleSegments: _,
|
|
1739
|
+
nativeBalance: !0
|
|
1740
|
+
} : {}
|
|
1741
|
+
}, b;
|
|
1742
|
+
}
|
|
1743
|
+
function rt(e, t, n, r, i, a, o) {
|
|
1744
|
+
let s = e.style, c = qe(n, r), l = e.children.filter((e) => !B(e.style)), d = l.filter((e) => !e.style.columnSpan);
|
|
1745
|
+
if (d.length > 0 && d.every((e) => tt(e, s)) && (d.length === l.length || s.columnFill === "balance" && c === void 0 && d.every((e) => (e.style.margin.top === 0 || e.style.margin.top === null) && (e.style.margin.bottom === 0 || e.style.margin.bottom === null)))) return nt(e, l, t, c, i, a, o);
|
|
1746
|
+
let f = U(s, "x", t), p = Ge(s, t, f), m = p.length, h = [];
|
|
1747
|
+
{
|
|
1748
|
+
let e = 0;
|
|
1749
|
+
for (let t of p) h.push(e), e += t + f;
|
|
1750
|
+
}
|
|
1751
|
+
let g = (e) => e < m ? h[e] : h[m - 1] + (e - m + 1) * (p[m - 1] + f), _ = (e) => p[Math.min(e, m - 1)], v = p[m - 1], y = i.left + a.left, b = i.top + a.top, x = [], S = 0, C = [], w = [], T = !1, E = (e, t) => {
|
|
1752
|
+
let r = 0, i = 0, a = null, s = 0, c = (e) => {
|
|
1753
|
+
if (t) for (let t of w) {
|
|
1754
|
+
if (t.index !== e) continue;
|
|
1755
|
+
let n = a === null ? t.margin.top ?? 0 : $t(a, t.margin.top ?? 0);
|
|
1756
|
+
t.child.staticSlot = {
|
|
1757
|
+
kind: "block",
|
|
1758
|
+
x: y + g(r) + (t.margin.left ?? 0),
|
|
1759
|
+
y: b + S + i + n
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
};
|
|
1763
|
+
for (let l = 0; l < C.length; l++) {
|
|
1764
|
+
let u = C[l];
|
|
1765
|
+
c(l);
|
|
1766
|
+
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 : $t(a, u.margin.top ?? 0), f = u.node.localRect.height;
|
|
1767
|
+
if (a !== null && (u.breakBefore || i + d + f > e) && (r += 1, i = 0, a = null, d = 0), t) {
|
|
1768
|
+
let e = u.node, t = _(r);
|
|
1769
|
+
if (t !== v) {
|
|
1770
|
+
let r = (u.margin.left ?? 0) + (u.margin.right ?? 0);
|
|
1771
|
+
V(e, Math.max(0, t - r), n, 0, 0, "fill", o);
|
|
1772
|
+
}
|
|
1773
|
+
e.localRect = {
|
|
1774
|
+
...e.localRect,
|
|
1775
|
+
x: y + g(r) + Qt(u.margin, t, e.localRect.width),
|
|
1776
|
+
y: b + S + i + d
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
i += d + u.node.localRect.height, s = Math.max(s, i), a = u.margin.bottom ?? 0;
|
|
1780
|
+
}
|
|
1781
|
+
return c(C.length), {
|
|
1782
|
+
columns: r + 1,
|
|
1783
|
+
maxUsed: s
|
|
1784
|
+
};
|
|
1785
|
+
}, D = () => {
|
|
1786
|
+
if (C.length === 0) {
|
|
1787
|
+
for (let e of w) e.child.staticSlot = {
|
|
1788
|
+
kind: "block",
|
|
1789
|
+
x: y + (e.margin.left ?? 0),
|
|
1790
|
+
y: b + S + (e.margin.top ?? 0)
|
|
1791
|
+
};
|
|
1792
|
+
w = [];
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
let e = c === void 0 ? void 0 : Math.max(1, c - S), t = s.columnFill === "auto" && e !== void 0, r;
|
|
1796
|
+
if (t) r = e;
|
|
1797
|
+
else {
|
|
1798
|
+
let t = Je(1, E(Infinity, !1).maxUsed, (e) => E(e, !1).columns <= m);
|
|
1799
|
+
r = e === void 0 ? t : Math.min(t, e);
|
|
1800
|
+
}
|
|
1801
|
+
let i = E(r, !0), a = t && n !== void 0 ? Math.max(i.maxUsed, r) : i.maxUsed;
|
|
1802
|
+
if (s.ruleX) for (let e = 0; e < m - 1; e++) {
|
|
1803
|
+
let t = Math.min(i.columns, m);
|
|
1804
|
+
Xe(s.ruleVisibilityItems, e < t, e + 1 < t) && x.push({
|
|
1805
|
+
bandStart: h[e] + p[e],
|
|
1806
|
+
bandSize: f,
|
|
1807
|
+
start: S,
|
|
1808
|
+
end: S + a
|
|
1809
|
+
});
|
|
1810
|
+
}
|
|
1811
|
+
S += a, C = [], w = [];
|
|
1812
|
+
};
|
|
1813
|
+
for (let r of e.children) {
|
|
1814
|
+
if (B(r.style)) {
|
|
1815
|
+
w.push({
|
|
1816
|
+
child: r,
|
|
1817
|
+
margin: G(r.style.margin, t),
|
|
1818
|
+
index: C.length
|
|
1819
|
+
});
|
|
1820
|
+
continue;
|
|
1821
|
+
}
|
|
1822
|
+
if (r.style.columnSpan) {
|
|
1823
|
+
D(), T = !1;
|
|
1824
|
+
let e = G(r.style.margin, t), i = (e.left ?? 0) + (e.right ?? 0);
|
|
1825
|
+
V(r, Math.max(0, t - i), n, 0, 0, "fill", o), S += e.top ?? 0, r.localRect = {
|
|
1826
|
+
...r.localRect,
|
|
1827
|
+
x: y + Qt(e, t, r.localRect.width),
|
|
1828
|
+
y: b + S
|
|
1829
|
+
}, S += r.localRect.height + (e.bottom ?? 0);
|
|
1830
|
+
continue;
|
|
1831
|
+
}
|
|
1832
|
+
let e = G(r.style.margin, v), i = (e.left ?? 0) + (e.right ?? 0);
|
|
1833
|
+
V(r, Math.max(0, v - i), n, 0, 0, "fill", o), C.push({
|
|
1834
|
+
node: r,
|
|
1835
|
+
margin: e,
|
|
1836
|
+
breakBefore: T || r.style.breakBeforeColumn
|
|
1837
|
+
}), T = r.style.breakAfterColumn;
|
|
1838
|
+
}
|
|
1839
|
+
return D(), s.ruleX && x.length > 0 && (e.decorationRuns = u({
|
|
1840
|
+
ruleX: s.ruleX,
|
|
1841
|
+
ruleY: null,
|
|
1842
|
+
vertical: N(x, s.ruleInset),
|
|
1843
|
+
horizontal: [],
|
|
1844
|
+
contentWidth: t,
|
|
1845
|
+
contentHeight: S,
|
|
1846
|
+
border: i,
|
|
1847
|
+
borderStyle: s.borderStyle,
|
|
1848
|
+
borderColor: s.borderColor,
|
|
1849
|
+
padding: a
|
|
1850
|
+
})), S;
|
|
1491
1851
|
}
|
|
1492
1852
|
//#endregion
|
|
1493
1853
|
//#region src/warn.ts
|
|
1494
|
-
var
|
|
1495
|
-
function
|
|
1496
|
-
let n =
|
|
1497
|
-
n ||
|
|
1854
|
+
var it = /* @__PURE__ */ new WeakMap();
|
|
1855
|
+
function at(e, t) {
|
|
1856
|
+
let n = it.get(e);
|
|
1857
|
+
n || it.set(e, n = /* @__PURE__ */ new Set()), !n.has(t) && (n.add(t), console.warn(`[monowind] ${t}`, e));
|
|
1498
1858
|
}
|
|
1499
1859
|
//#endregion
|
|
1500
1860
|
//#region src/table.ts
|
|
1501
|
-
function
|
|
1502
|
-
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" &&
|
|
1861
|
+
function ot(e, t) {
|
|
1862
|
+
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" && at(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).");
|
|
1503
1863
|
}
|
|
1504
|
-
function
|
|
1864
|
+
function st(e, t) {
|
|
1505
1865
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
1506
1866
|
return Number.isNaN(n) ? 1 : t === "colspan" ? Math.min(1e3, Math.max(1, n)) : Math.min(65534, Math.max(0, n));
|
|
1507
1867
|
}
|
|
1508
|
-
function
|
|
1868
|
+
function ct(e, t, n) {
|
|
1509
1869
|
let r = (t, r) => {
|
|
1510
|
-
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ?
|
|
1870
|
+
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ? q(i, 0, t, n) : void 0, o = i && i.kind === "percent" ? i.value : void 0;
|
|
1511
1871
|
for (let t = 0; t < r; t++) e.colFixed.push(a), e.colPercent.push(o);
|
|
1512
1872
|
};
|
|
1513
1873
|
if (t.style.tableRole === "column") {
|
|
1514
|
-
r(t,
|
|
1874
|
+
r(t, lt(t.source));
|
|
1515
1875
|
return;
|
|
1516
1876
|
}
|
|
1517
1877
|
let i = t.children.filter((e) => e.style.tableRole === "column");
|
|
1518
|
-
if (i.length === 0) r(t,
|
|
1519
|
-
else for (let e of i) r(e,
|
|
1520
|
-
for (let n of t.children) n.style.tableRole !== "column" &&
|
|
1878
|
+
if (i.length === 0) r(t, lt(t.source));
|
|
1879
|
+
else for (let e of i) r(e, lt(e.source));
|
|
1880
|
+
for (let n of t.children) n.style.tableRole !== "column" && ot(e, n);
|
|
1521
1881
|
}
|
|
1522
|
-
function
|
|
1882
|
+
function lt(e) {
|
|
1523
1883
|
let t = Number.parseInt(e.getAttribute("span") ?? "", 10);
|
|
1524
1884
|
return Number.isNaN(t) ? 1 : Math.min(1e3, Math.max(1, t));
|
|
1525
1885
|
}
|
|
1526
|
-
function
|
|
1886
|
+
function ut(e, t) {
|
|
1527
1887
|
let n = {
|
|
1528
1888
|
caption: null,
|
|
1529
1889
|
rows: [],
|
|
@@ -1536,7 +1896,7 @@ function Je(e, t) {
|
|
|
1536
1896
|
hidden: []
|
|
1537
1897
|
}, r = [], i = [], a = [];
|
|
1538
1898
|
for (let o of e.children) {
|
|
1539
|
-
if (
|
|
1899
|
+
if (B(o.style)) continue;
|
|
1540
1900
|
let e = o.style.tableRole;
|
|
1541
1901
|
if (e === "row") i.push({
|
|
1542
1902
|
row: o,
|
|
@@ -1544,11 +1904,11 @@ function Je(e, t) {
|
|
|
1544
1904
|
});
|
|
1545
1905
|
else if (e === "header-group" || e === "row-group" || e === "footer-group") {
|
|
1546
1906
|
let t = e === "header-group" ? r : e === "footer-group" ? a : i;
|
|
1547
|
-
for (let e of o.children)
|
|
1907
|
+
for (let e of o.children) B(e.style) || (e.style.tableRole === "row" ? t.push({
|
|
1548
1908
|
row: e,
|
|
1549
1909
|
group: o
|
|
1550
|
-
}) :
|
|
1551
|
-
} else e === "caption" ? n.caption === null ? n.caption = o :
|
|
1910
|
+
}) : ot(n, e));
|
|
1911
|
+
} else e === "caption" ? n.caption === null ? n.caption = o : ot(n, o) : e === "column" || e === "column-group" ? (ct(n, o, t), n.hidden.push(o)) : ot(n, o);
|
|
1552
1912
|
}
|
|
1553
1913
|
let o = [
|
|
1554
1914
|
...r,
|
|
@@ -1563,20 +1923,20 @@ function Je(e, t) {
|
|
|
1563
1923
|
s = e + 1;
|
|
1564
1924
|
}
|
|
1565
1925
|
}
|
|
1566
|
-
return
|
|
1926
|
+
return dt(n), n;
|
|
1567
1927
|
}
|
|
1568
|
-
function
|
|
1928
|
+
function dt(e) {
|
|
1569
1929
|
let t = [];
|
|
1570
1930
|
for (let n = 0; n < e.rows.length; n++) {
|
|
1571
1931
|
let r = e.rows[n], i = 0;
|
|
1572
1932
|
for (let a of r.children) {
|
|
1573
|
-
if (
|
|
1933
|
+
if (B(a.style)) continue;
|
|
1574
1934
|
if (a.style.tableRole !== "cell") {
|
|
1575
|
-
|
|
1935
|
+
ot(e, a);
|
|
1576
1936
|
continue;
|
|
1577
1937
|
}
|
|
1578
1938
|
for (; (t[i] ?? 0) > n;) i++;
|
|
1579
|
-
let o =
|
|
1939
|
+
let o = st(a.source, "colspan"), s = st(a.source, "rowspan"), c = e.groupEnds[n], l = Math.max(1, Math.min(s === 0 ? c - n : s, c - n));
|
|
1580
1940
|
for (let e = i; e < i + o; e++) t[e] = Math.max(t[e] ?? 0, n + l);
|
|
1581
1941
|
e.cells.push({
|
|
1582
1942
|
node: a,
|
|
@@ -1590,21 +1950,21 @@ function Ye(e) {
|
|
|
1590
1950
|
}
|
|
1591
1951
|
e.columnCount = Math.max(t.length, e.colFixed.length);
|
|
1592
1952
|
}
|
|
1593
|
-
function
|
|
1594
|
-
let r = e.style, i =
|
|
1953
|
+
function ft(e, t, n) {
|
|
1954
|
+
let r = e.style, i = Y(e, n), a;
|
|
1595
1955
|
if (t === "min") a = i;
|
|
1596
1956
|
else {
|
|
1597
|
-
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ?
|
|
1598
|
-
a = t === void 0 ?
|
|
1957
|
+
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ? q(r.width, 0, e, n) : void 0;
|
|
1958
|
+
a = t === void 0 ? J(e, n) : Math.max(i, t);
|
|
1599
1959
|
}
|
|
1600
1960
|
let o = typeof r.minWidth == "number" ? r.minWidth : 0, s = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
1601
|
-
return Math.max(0,
|
|
1961
|
+
return Math.max(0, H(a, o, s));
|
|
1602
1962
|
}
|
|
1603
|
-
function
|
|
1963
|
+
function pt(e) {
|
|
1604
1964
|
let t = e.style.width;
|
|
1605
1965
|
return t && t.kind === "percent" ? t.value : void 0;
|
|
1606
1966
|
}
|
|
1607
|
-
function
|
|
1967
|
+
function mt(e, t, n) {
|
|
1608
1968
|
let r = e.columnCount, i = Array.from({ length: r }, () => 0), a = Array.from({ length: r }, () => 0), o = Array.from({ length: r }, () => void 0);
|
|
1609
1969
|
for (let t = 0; t < r; t++) e.colFixed[t] !== void 0 && (a[t] = e.colFixed[t]), o[t] = e.colPercent[t];
|
|
1610
1970
|
let s = [];
|
|
@@ -1613,15 +1973,15 @@ function Qe(e, t, n) {
|
|
|
1613
1973
|
s.push(t);
|
|
1614
1974
|
continue;
|
|
1615
1975
|
}
|
|
1616
|
-
i[t.col] = Math.max(i[t.col],
|
|
1617
|
-
let e =
|
|
1976
|
+
i[t.col] = Math.max(i[t.col], ft(t.node, "min", n)), a[t.col] = Math.max(a[t.col], ft(t.node, "max", n));
|
|
1977
|
+
let e = pt(t.node);
|
|
1618
1978
|
e !== void 0 && (o[t.col] = Math.max(o[t.col] ?? 0, e));
|
|
1619
1979
|
}
|
|
1620
1980
|
s.sort((e, t) => e.colSpan - t.colSpan);
|
|
1621
1981
|
for (let e of s) {
|
|
1622
|
-
let r = e.col, o = e.col + e.colSpan, s =
|
|
1982
|
+
let r = e.col, o = e.col + e.colSpan, s = xt(t, r, o), c = a.slice(r, o);
|
|
1623
1983
|
for (let t of ["min", "max"]) {
|
|
1624
|
-
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d =
|
|
1984
|
+
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d = ft(e.node, t, n) - u;
|
|
1625
1985
|
if (d <= 0) continue;
|
|
1626
1986
|
let f = I(c.some((e) => e > 0) ? c : c.map(() => 1), d);
|
|
1627
1987
|
for (let e = r; e < o; e++) l[e] += f[e - r];
|
|
@@ -1634,7 +1994,7 @@ function Qe(e, t, n) {
|
|
|
1634
1994
|
percent: o
|
|
1635
1995
|
};
|
|
1636
1996
|
}
|
|
1637
|
-
function
|
|
1997
|
+
function ht(e, t) {
|
|
1638
1998
|
let n = e.min.length, r = e.min.slice(), i = [], a = [];
|
|
1639
1999
|
for (let t = 0; t < n; t++) (e.percent[t] === void 0 ? a : i).push(t);
|
|
1640
2000
|
if (i.length > 0) {
|
|
@@ -1663,13 +2023,13 @@ function $e(e, t) {
|
|
|
1663
2023
|
}
|
|
1664
2024
|
return r;
|
|
1665
2025
|
}
|
|
1666
|
-
function
|
|
2026
|
+
function gt(e, t, n) {
|
|
1667
2027
|
let r = e.columnCount, i = Array.from({ length: r }, () => void 0);
|
|
1668
2028
|
for (let n = 0; n < r; n++) e.colFixed[n] === void 0 ? e.colPercent[n] !== void 0 && (i[n] = Math.max(0, Math.round(t * e.colPercent[n] / 100))) : i[n] = e.colFixed[n];
|
|
1669
2029
|
for (let r of e.cells) {
|
|
1670
2030
|
if (r.row !== 0) continue;
|
|
1671
2031
|
let e = r.node.style, a;
|
|
1672
|
-
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 =
|
|
2032
|
+
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 = q(e.width, 0, r.node, n)), a === void 0) continue;
|
|
1673
2033
|
let o = I(Array.from({ length: r.colSpan }, () => 1), a);
|
|
1674
2034
|
for (let e = 0; e < r.colSpan; e++) {
|
|
1675
2035
|
let t = r.col + e;
|
|
@@ -1683,13 +2043,13 @@ function et(e, t, n) {
|
|
|
1683
2043
|
}
|
|
1684
2044
|
return i.map((e) => e ?? 0);
|
|
1685
2045
|
}
|
|
1686
|
-
var
|
|
2046
|
+
var _t = {
|
|
1687
2047
|
double: 3,
|
|
1688
2048
|
solid: 2,
|
|
1689
2049
|
dashed: 1,
|
|
1690
2050
|
dotted: 0
|
|
1691
2051
|
};
|
|
1692
|
-
function
|
|
2052
|
+
function vt(e) {
|
|
1693
2053
|
for (let { border: t, side: n } of e) if (t?.hidden[n]) return null;
|
|
1694
2054
|
let t = null;
|
|
1695
2055
|
for (let { border: n, side: r } of e) {
|
|
@@ -1697,7 +2057,7 @@ function nt(e) {
|
|
|
1697
2057
|
let e = n.width[r];
|
|
1698
2058
|
if (e <= 0) continue;
|
|
1699
2059
|
let i = n.style[r];
|
|
1700
|
-
(t === null || e > t.width || e === t.width &&
|
|
2060
|
+
(t === null || e > t.width || e === t.width && _t[i] > _t[t.style]) && (t = {
|
|
1701
2061
|
width: e,
|
|
1702
2062
|
style: i,
|
|
1703
2063
|
color: n.color[r]
|
|
@@ -1705,7 +2065,7 @@ function nt(e) {
|
|
|
1705
2065
|
}
|
|
1706
2066
|
return t;
|
|
1707
2067
|
}
|
|
1708
|
-
function
|
|
2068
|
+
function yt(e, t) {
|
|
1709
2069
|
let n = t.columnCount, r = t.rows.length, i = e.style.borderCollapse, a = {
|
|
1710
2070
|
collapsed: i,
|
|
1711
2071
|
vLines: Array.from({ length: n + 1 }, () => 0),
|
|
@@ -1750,7 +2110,7 @@ function rt(e, t) {
|
|
|
1750
2110
|
side: u
|
|
1751
2111
|
});
|
|
1752
2112
|
}
|
|
1753
|
-
i.push(
|
|
2113
|
+
i.push(vt(l));
|
|
1754
2114
|
}
|
|
1755
2115
|
a.vSegments.push(i), a.vLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
1756
2116
|
}
|
|
@@ -1789,47 +2149,47 @@ function rt(e, t) {
|
|
|
1789
2149
|
}), e === r && l.push({
|
|
1790
2150
|
border: s,
|
|
1791
2151
|
side: "bottom"
|
|
1792
|
-
}), i.push(
|
|
2152
|
+
}), i.push(vt(l));
|
|
1793
2153
|
}
|
|
1794
2154
|
a.hSegments.push(i), a.hLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
1795
2155
|
}
|
|
1796
2156
|
return a;
|
|
1797
2157
|
}
|
|
1798
|
-
function
|
|
2158
|
+
function bt(e, t) {
|
|
1799
2159
|
return e.collapsed ? e.vLines.reduce((e, t) => e + t, 0) : (t + 1) * e.spacingX;
|
|
1800
2160
|
}
|
|
1801
|
-
function
|
|
2161
|
+
function xt(e, t, n) {
|
|
1802
2162
|
if (!e.collapsed) return e.spacingX * (n - t - 1);
|
|
1803
2163
|
let r = 0;
|
|
1804
2164
|
for (let i = t + 1; i < n; i++) r += e.vLines[i];
|
|
1805
2165
|
return r;
|
|
1806
2166
|
}
|
|
1807
|
-
function
|
|
2167
|
+
function St(e, t, n) {
|
|
1808
2168
|
if (!e.collapsed) return e.spacingY * (n - t - 1);
|
|
1809
2169
|
let r = 0;
|
|
1810
2170
|
for (let i = t + 1; i < n; i++) r += e.hLines[i];
|
|
1811
2171
|
return r;
|
|
1812
2172
|
}
|
|
1813
|
-
function
|
|
2173
|
+
function Ct(e, t) {
|
|
1814
2174
|
let n = t.tableData.get(e);
|
|
1815
2175
|
if (n) return n;
|
|
1816
|
-
let r =
|
|
2176
|
+
let r = ut(e, t), i = yt(e, r), a = {
|
|
1817
2177
|
structure: r,
|
|
1818
2178
|
chrome: i,
|
|
1819
|
-
bounds:
|
|
1820
|
-
chromeX:
|
|
2179
|
+
bounds: mt(r, i, t),
|
|
2180
|
+
chromeX: bt(i, r.columnCount)
|
|
1821
2181
|
};
|
|
1822
2182
|
return t.tableData.set(e, a), a;
|
|
1823
2183
|
}
|
|
1824
|
-
function
|
|
1825
|
-
let { structure: n, bounds: r, chromeX: i } =
|
|
1826
|
-
return n.caption && (a = Math.max(a,
|
|
2184
|
+
function wt(e, t) {
|
|
2185
|
+
let { structure: n, bounds: r, chromeX: i } = Ct(e, t), a = r.min.reduce((e, t) => e + t, 0) + i, o = r.max.reduce((e, t) => e + t, 0) + i;
|
|
2186
|
+
return n.caption && (a = Math.max(a, Y(n.caption, t)), o = Math.max(o, J(n.caption, t))), {
|
|
1827
2187
|
min: a,
|
|
1828
2188
|
max: o
|
|
1829
2189
|
};
|
|
1830
2190
|
}
|
|
1831
|
-
function
|
|
1832
|
-
let r = e.style, { bounds: i, chromeX: a } =
|
|
2191
|
+
function Tt(e, t, n) {
|
|
2192
|
+
let r = e.style, { bounds: i, chromeX: a } = Ct(e, n), { min: o, max: s } = wt(e, n), c = r.border.left + r.border.right + W(r.padding.left, t) + W(r.padding.right, t), l = i.max.reduce((e, t) => e + t, 0), u = 0, d = 0;
|
|
1833
2193
|
for (let e = 0; e < i.max.length; e++) {
|
|
1834
2194
|
let t = i.percent[e];
|
|
1835
2195
|
t === void 0 ? d += i.max[e] : u += t;
|
|
@@ -1845,8 +2205,8 @@ function lt(e, t, n) {
|
|
|
1845
2205
|
let f = Math.max(l + a, s) + c;
|
|
1846
2206
|
return Math.max(o + c, Math.min(f, t));
|
|
1847
2207
|
}
|
|
1848
|
-
function
|
|
1849
|
-
let { structure: o, chrome: s, bounds: c } =
|
|
2208
|
+
function Et(e, t, n, r, i, a) {
|
|
2209
|
+
let { structure: o, chrome: s, bounds: c } = Ct(e, a), l = o.columnCount, u = o.rows.length, d = r.left + i.left, f = r.top + i.top;
|
|
1850
2210
|
for (let e of o.hidden) e.tableHidden = !0, e.localRect = {
|
|
1851
2211
|
x: 0,
|
|
1852
2212
|
y: 0,
|
|
@@ -1858,14 +2218,14 @@ function ut(e, t, n, r, i, a) {
|
|
|
1858
2218
|
bottom: 0,
|
|
1859
2219
|
left: 0
|
|
1860
2220
|
}, e.unclampedHeight = 0;
|
|
1861
|
-
let p = Math.max(0, t -
|
|
2221
|
+
let p = Math.max(0, t - bt(s, l)), h = e.style, g = h.tableLayout === "fixed" && h.width !== void 0 && h.width.kind !== "auto" ? gt(o, p, a) : ht(c, p), _ = [], v = 0;
|
|
1862
2222
|
for (let e = 0; e < l; e++) v += s.collapsed ? s.vLines[e] : s.spacingX, _.push(v), v += g[e];
|
|
1863
2223
|
let y = v + (s.collapsed ? s.vLines[l] ?? 0 : s.spacingX), b = 0;
|
|
1864
|
-
o.caption && (
|
|
2224
|
+
o.caption && (V(o.caption, t, void 0, d, f, "fill", a), b = o.caption.localRect.height);
|
|
1865
2225
|
let x = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
|
|
1866
2226
|
for (let e of o.cells) {
|
|
1867
|
-
let t = e.col + e.colSpan, n = g.slice(e.col, t).reduce((e, t) => e + t, 0) +
|
|
1868
|
-
S.set(e, n),
|
|
2227
|
+
let t = e.col + e.colSpan, n = g.slice(e.col, t).reduce((e, t) => e + t, 0) + xt(s, e.col, t);
|
|
2228
|
+
S.set(e, n), V(e.node, n, void 0, 0, 0, "fill", a, { width: n }), x.set(e, e.node.localRect.height);
|
|
1869
2229
|
}
|
|
1870
2230
|
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 - b - C), T = (e) => e !== void 0 && e.kind === "percent" && w !== void 0 ? m(e.value, w) : 0, E = Array.from({ length: u }, () => 0), D = Array.from({ length: u }, () => !1);
|
|
1871
2231
|
for (let e = 0; e < u; e++) {
|
|
@@ -1880,7 +2240,7 @@ function ut(e, t, n, r, i, a) {
|
|
|
1880
2240
|
}
|
|
1881
2241
|
let O = o.cells.filter((e) => e.rowSpan > 1).sort((e, t) => e.rowSpan - t.rowSpan);
|
|
1882
2242
|
for (let e of O) {
|
|
1883
|
-
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
2243
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + St(s, e.row, t), r = x.get(e) - n;
|
|
1884
2244
|
if (r <= 0) continue;
|
|
1885
2245
|
let i = I(Array.from({ length: e.rowSpan }, () => 1), r);
|
|
1886
2246
|
for (let n = e.row; n < t; n++) E[n] += i[n - e.row];
|
|
@@ -1931,34 +2291,34 @@ function ut(e, t, n, r, i, a) {
|
|
|
1931
2291
|
}, t.unclampedHeight = E[e];
|
|
1932
2292
|
}
|
|
1933
2293
|
for (let e of o.cells) {
|
|
1934
|
-
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
1935
|
-
e.node.children.some((e) => !
|
|
2294
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + St(s, e.row, t);
|
|
2295
|
+
e.node.children.some((e) => !B(e.style) && e.style.height?.kind === "percent") && n !== x.get(e) && V(e.node, S.get(e), n, 0, 0, "fill", a, {
|
|
1936
2296
|
width: S.get(e),
|
|
1937
2297
|
height: n
|
|
1938
|
-
}),
|
|
2298
|
+
}), Dt(e.node, n - (e.node.naturalContentHeight ?? e.node.localRect.height)), e.node.localRect = {
|
|
1939
2299
|
x: _[e.col],
|
|
1940
2300
|
y: 0,
|
|
1941
2301
|
width: e.node.localRect.width,
|
|
1942
2302
|
height: n
|
|
1943
2303
|
};
|
|
1944
2304
|
}
|
|
1945
|
-
for (let t of e.children)
|
|
2305
|
+
for (let t of e.children) B(t.style) && (t.staticSlot = {
|
|
1946
2306
|
kind: "block",
|
|
1947
2307
|
x: d,
|
|
1948
2308
|
y: f
|
|
1949
2309
|
});
|
|
1950
|
-
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + M), s.collapsed && l > 0 && u > 0 && (e.decorationRuns =
|
|
2310
|
+
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + M), s.collapsed && l > 0 && u > 0 && (e.decorationRuns = Ot(s, o, g, E, _, A, d, f)), e.style.captionSide === "bottom" ? M + b : M;
|
|
1951
2311
|
}
|
|
1952
|
-
function
|
|
2312
|
+
function Dt(e, t) {
|
|
1953
2313
|
if (t <= 0) return;
|
|
1954
2314
|
let n = e.style.verticalAlign, r = n === "center" ? Math.floor(t / 2) : n === "end" ? t : 0;
|
|
1955
|
-
if (!e.children.some((e) => !
|
|
2315
|
+
if (!e.children.some((e) => !B(e.style) && !e.inlineBox)) {
|
|
1956
2316
|
e.resolvedPadding.top += r, e.resolvedPadding.bottom += t - r;
|
|
1957
2317
|
return;
|
|
1958
2318
|
}
|
|
1959
|
-
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (
|
|
2319
|
+
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (B(t.style) ? t.staticSlot?.kind === "block" && (t.staticSlot.y += r) : t.localRect.y += r);
|
|
1960
2320
|
}
|
|
1961
|
-
function
|
|
2321
|
+
function Ot(e, t, n, r, o, s, c, l) {
|
|
1962
2322
|
let u = t.columnCount, d = t.rows.length, f = [], p = (t) => t < u ? o[t] - e.vLines[t] : o[u - 1] + n[u - 1], m = (t) => t < d ? s[t] - e.hLines[t] : s[d - 1] + r[d - 1];
|
|
1963
2323
|
for (let t = 0; t <= u; t++) {
|
|
1964
2324
|
let n = e.vSegments[t];
|
|
@@ -1999,7 +2359,7 @@ function ft(e, t, n, r, o, s, c, l) {
|
|
|
1999
2359
|
s
|
|
2000
2360
|
].filter((e) => e !== null);
|
|
2001
2361
|
if (h.length === 0) continue;
|
|
2002
|
-
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width &&
|
|
2362
|
+
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width && _t[t.style] > _t[e.style] ? t : e), v = a(g, r !== null, i !== null, o !== null, s !== null);
|
|
2003
2363
|
for (let r = 0; r < e.vLines[t]; r++) for (let i = 0; i < e.hLines[n]; i++) f.push({
|
|
2004
2364
|
glyph: v,
|
|
2005
2365
|
x: c + p(t) + r,
|
|
@@ -2012,30 +2372,30 @@ function ft(e, t, n, r, o, s, c, l) {
|
|
|
2012
2372
|
}
|
|
2013
2373
|
//#endregion
|
|
2014
2374
|
//#region src/positioning.ts
|
|
2015
|
-
function
|
|
2375
|
+
function kt(e) {
|
|
2016
2376
|
return e.position === "absolute" || e.position === "fixed" ? "absolute" : e.position === "relative" || e.position === "sticky" ? "relative" : "static";
|
|
2017
2377
|
}
|
|
2018
|
-
function
|
|
2378
|
+
function At(e, t, n, r, i) {
|
|
2019
2379
|
for (let a of e.children) {
|
|
2020
|
-
let o =
|
|
2380
|
+
let o = kt(a.style);
|
|
2021
2381
|
if (o === "relative") {
|
|
2022
2382
|
let t = e.localRect.width - e.style.border.left - e.style.border.right - e.resolvedPadding.left - e.resolvedPadding.right, n = e.localRect.height - e.style.border.top - e.style.border.bottom - e.resolvedPadding.top - e.resolvedPadding.bottom;
|
|
2023
|
-
a.localRect.x +=
|
|
2024
|
-
} else o === "absolute" &&
|
|
2025
|
-
|
|
2383
|
+
a.localRect.x += jt(a.style.insets.left, a.style.insets.right, t), a.localRect.y += jt(a.style.insets.top, a.style.insets.bottom, n);
|
|
2384
|
+
} else o === "absolute" && Nt(a, e, t, n, r, i);
|
|
2385
|
+
At(a, t + a.localRect.x, n + a.localRect.y, [...r, {
|
|
2026
2386
|
node: a,
|
|
2027
2387
|
absX: t + a.localRect.x,
|
|
2028
2388
|
absY: n + a.localRect.y
|
|
2029
2389
|
}], i);
|
|
2030
2390
|
}
|
|
2031
2391
|
}
|
|
2032
|
-
function
|
|
2392
|
+
function jt(e, t, n) {
|
|
2033
2393
|
return e === null ? t === null ? 0 : -W(t, n) : W(e, n);
|
|
2034
2394
|
}
|
|
2035
|
-
function
|
|
2395
|
+
function Mt(e, t) {
|
|
2036
2396
|
if (!t) for (let t = e.length - 1; t > 0; t--) {
|
|
2037
2397
|
let n = e[t];
|
|
2038
|
-
if (!
|
|
2398
|
+
if (!Vt(n.node.style)) continue;
|
|
2039
2399
|
let r = n.node.style.border;
|
|
2040
2400
|
return {
|
|
2041
2401
|
x: n.absX + r.left,
|
|
@@ -2052,43 +2412,43 @@ function gt(e, t) {
|
|
|
2052
2412
|
height: n.node.localRect.height
|
|
2053
2413
|
};
|
|
2054
2414
|
}
|
|
2055
|
-
function
|
|
2056
|
-
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s &&
|
|
2415
|
+
function Nt(e, t, n, r, i, a) {
|
|
2416
|
+
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s && Vt(t.style) ? {
|
|
2057
2417
|
x: n + c.area.x,
|
|
2058
2418
|
y: r + c.area.y,
|
|
2059
2419
|
width: c.area.width,
|
|
2060
2420
|
height: c.area.height
|
|
2061
|
-
} :
|
|
2062
|
-
if (!y) C.width =
|
|
2063
|
-
else if (u !== null && d !== null) C.width =
|
|
2421
|
+
} : Mt(i, s), u = o.insets.left === null ? null : W(o.insets.left, l.width), d = o.insets.right === null ? null : W(o.insets.right, l.width), f = o.insets.top === null ? null : W(o.insets.top, l.height), p = o.insets.bottom === null ? null : W(o.insets.bottom, l.height), m = G(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 = Xt(o.minWidth, l.width, e, a) ?? 0, S = Xt(o.maxWidth, l.width, e, a), C = {};
|
|
2422
|
+
if (!y) C.width = H(q(o.width, l.width, e, a), x, S);
|
|
2423
|
+
else if (u !== null && d !== null) C.width = H(Math.max(0, l.width - u - d - h - g), x, S);
|
|
2064
2424
|
else {
|
|
2065
2425
|
let t = Math.max(0, l.width - (u ?? 0) - (d ?? 0) - h - g);
|
|
2066
|
-
C.width =
|
|
2426
|
+
C.width = H(Math.min(J(e, a), Math.max(Y(e, a), t)), x, S);
|
|
2067
2427
|
}
|
|
2068
|
-
f !== null && p !== null && b && (C.height =
|
|
2428
|
+
f !== null && p !== null && b && (C.height = H(Math.max(0, l.height - f - p - _ - v), K(o.minHeight, l.height) ?? 0, K(o.maxHeight, l.height))), V(e, l.width, l.height, 0, 0, "shrink", a, C);
|
|
2069
2429
|
let w = e.localRect.width, T = e.localRect.height, E;
|
|
2070
2430
|
if (u !== null && d !== null) {
|
|
2071
2431
|
let e = Math.max(0, l.width - u - d - w - h - g), t = m.left === null && m.right === null;
|
|
2072
2432
|
E = l.x + u + h + (t ? Math.floor(e / 2) : m.left === null ? e : 0);
|
|
2073
|
-
} else E = u === null ? d === null ?
|
|
2433
|
+
} else E = u === null ? d === null ? Rt(e, t, n, w) : l.x + l.width - d - w - g : l.x + u + h;
|
|
2074
2434
|
let D;
|
|
2075
2435
|
if (f !== null && p !== null) {
|
|
2076
2436
|
let e = Math.max(0, l.height - f - p - T - _ - v), t = m.top === null && m.bottom === null;
|
|
2077
2437
|
D = l.y + f + _ + (t ? Math.floor(e / 2) : m.top === null ? e : 0);
|
|
2078
|
-
} else D = f === null ? p === null ?
|
|
2438
|
+
} else D = f === null ? p === null ? zt(e, t, r, T) : l.y + l.height - p - T - v : l.y + f + _;
|
|
2079
2439
|
e.localRect = {
|
|
2080
2440
|
...e.localRect,
|
|
2081
2441
|
x: E - n,
|
|
2082
2442
|
y: D - r
|
|
2083
2443
|
};
|
|
2084
2444
|
}
|
|
2085
|
-
function
|
|
2445
|
+
function Pt(e, t, n) {
|
|
2086
2446
|
return F(e, [n], Math.max(0, t - n))[0];
|
|
2087
2447
|
}
|
|
2088
|
-
function
|
|
2089
|
-
return
|
|
2448
|
+
function Ft(e, t, n, r) {
|
|
2449
|
+
return L(ae(e, t), n, r);
|
|
2090
2450
|
}
|
|
2091
|
-
function
|
|
2451
|
+
function It(e, t, n, r, i) {
|
|
2092
2452
|
let a = G(e.style.margin, n.innerWidth), [o, s, c, l] = r === "x" ? [
|
|
2093
2453
|
a.left ?? 0,
|
|
2094
2454
|
a.right ?? 0,
|
|
@@ -2100,9 +2460,9 @@ function bt(e, t, n, r, i) {
|
|
|
2100
2460
|
n.innerHeight,
|
|
2101
2461
|
n.direction === "column"
|
|
2102
2462
|
], u = i + o + s;
|
|
2103
|
-
return (l ?
|
|
2463
|
+
return (l ? Pt(le(t.style), c, u) : Ft(e, t, c, u)) + o;
|
|
2104
2464
|
}
|
|
2105
|
-
function
|
|
2465
|
+
function Lt(e, t, n, r, i) {
|
|
2106
2466
|
let a = G(e.style.margin, n.width), o = e.style.justifySelf === "auto" ? t.style.justifyItems : e.style.justifySelf, [s, c, l, u] = r === "x" ? [
|
|
2107
2467
|
a.left ?? 0,
|
|
2108
2468
|
a.right ?? 0,
|
|
@@ -2112,35 +2472,35 @@ function xt(e, t, n, r, i) {
|
|
|
2112
2472
|
a.top ?? 0,
|
|
2113
2473
|
a.bottom ?? 0,
|
|
2114
2474
|
n.height,
|
|
2115
|
-
|
|
2475
|
+
ae(e, t)
|
|
2116
2476
|
];
|
|
2117
|
-
return
|
|
2477
|
+
return L(u, l, i + s + c) + s;
|
|
2118
2478
|
}
|
|
2119
|
-
function
|
|
2479
|
+
function Rt(e, t, n, r) {
|
|
2120
2480
|
let i = e.staticSlot;
|
|
2121
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x +
|
|
2481
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x + Lt(e, t, i.staticArea, "x", r) : n + i.originX + It(e, t, i, "x", r);
|
|
2122
2482
|
}
|
|
2123
|
-
function
|
|
2483
|
+
function zt(e, t, n, r) {
|
|
2124
2484
|
let i = e.staticSlot;
|
|
2125
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y +
|
|
2485
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y + Lt(e, t, i.staticArea, "y", r) : n + i.originY + It(e, t, i, "y", r);
|
|
2126
2486
|
}
|
|
2127
2487
|
//#endregion
|
|
2128
2488
|
//#region src/layout.ts
|
|
2129
|
-
function
|
|
2130
|
-
let n =
|
|
2131
|
-
return
|
|
2489
|
+
function Bt(e, t) {
|
|
2490
|
+
let n = Ht();
|
|
2491
|
+
return V(e, t, void 0, 0, 0, "fill", n), At(e, 0, 0, [{
|
|
2132
2492
|
node: e,
|
|
2133
2493
|
absX: 0,
|
|
2134
2494
|
absY: 0
|
|
2135
2495
|
}], n), { height: e.localRect.height };
|
|
2136
2496
|
}
|
|
2137
|
-
function
|
|
2497
|
+
function B(e) {
|
|
2138
2498
|
return e.position === "absolute" || e.position === "fixed";
|
|
2139
2499
|
}
|
|
2140
|
-
function
|
|
2500
|
+
function Vt(e) {
|
|
2141
2501
|
return e.position !== "static";
|
|
2142
2502
|
}
|
|
2143
|
-
function
|
|
2503
|
+
function Ht() {
|
|
2144
2504
|
return {
|
|
2145
2505
|
maxContent: /* @__PURE__ */ new WeakMap(),
|
|
2146
2506
|
minContent: /* @__PURE__ */ new WeakMap(),
|
|
@@ -2148,102 +2508,128 @@ function Et() {
|
|
|
2148
2508
|
tableData: /* @__PURE__ */ new WeakMap()
|
|
2149
2509
|
};
|
|
2150
2510
|
}
|
|
2151
|
-
function
|
|
2511
|
+
function V(e, t, n, r, i, a, o, s) {
|
|
2152
2512
|
let c = e.style, l = s?.height;
|
|
2153
|
-
delete e.decorationRuns;
|
|
2154
|
-
let u =
|
|
2513
|
+
delete e.decorationRuns, delete e.multicolGeometry, delete e.multicolFlow, delete e.multicolFlowSpan;
|
|
2514
|
+
let u = Xt(c.minWidth, t, e, o) ?? 0, d = Xt(c.maxWidth, t, e, o), f = K(c.minHeight, n) ?? 0, p = K(c.maxHeight, n), m = {
|
|
2155
2515
|
top: W(c.padding.top, t),
|
|
2156
2516
|
right: W(c.padding.right, t),
|
|
2157
2517
|
bottom: W(c.padding.bottom, t),
|
|
2158
2518
|
left: W(c.padding.left, t)
|
|
2159
2519
|
};
|
|
2160
2520
|
e.resolvedPadding = m;
|
|
2161
|
-
let h = s?.width ??
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
let r = (e) => n.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
2172
|
-
E(e.text, (i, a) => {
|
|
2173
|
-
let o = r(i);
|
|
2174
|
-
if (o === -1) return;
|
|
2175
|
-
let s = n.spans[o];
|
|
2176
|
-
t[a].localRect = {
|
|
2177
|
-
...t[a].localRect,
|
|
2178
|
-
x: c.border.left + m.left + S(s.start, i, e.advances),
|
|
2179
|
-
y: c.border.top + m.top + n.lineY[o]
|
|
2180
|
-
};
|
|
2181
|
-
});
|
|
2182
|
-
}
|
|
2183
|
-
} else b = e.intrinsicHeight;
|
|
2184
|
-
for (let t of e.children) {
|
|
2185
|
-
if (t.inlineBox) continue;
|
|
2186
|
-
let e = G(t.style.margin, _.width);
|
|
2187
|
-
t.staticSlot = {
|
|
2188
|
-
kind: "block",
|
|
2189
|
-
x: c.border.left + m.left + (e.left ?? 0),
|
|
2190
|
-
y: c.border.top + m.top + (e.top ?? 0)
|
|
2191
|
-
};
|
|
2192
|
-
}
|
|
2193
|
-
} else b = c.display === "flex" && c.flexDirection === "row" ? P(e, _.width, _.height, y, c.border, m, o) : c.display === "flex" && c.flexDirection === "column" ? te(e, _.width, _.height, v, c.border, m, o) : c.display === "grid" ? de(e, _.width, _.height, c.border, m, o) : c.display === "table" ? ut(e, _.width, y, c.border, m, o) : Mt(e, _.width, y, c.border, m, o);
|
|
2194
|
-
let x = b + c.border.top + c.border.bottom + m.top + m.bottom, C = l ?? g ?? x;
|
|
2195
|
-
e.unclampedHeight = C, e.naturalContentHeight = x, e.localRect = {
|
|
2521
|
+
let h = s?.width ?? H(en(c, t, a, e, o), u, d), g = nn(c, n), _ = on(h, l ?? g ?? (f > 0 ? f : void 0) ?? Infinity, c.border, m), v = l !== void 0 || g !== void 0, y = v && Number.isFinite(_.height) ? _.height : void 0, b = p === void 0 ? void 0 : Math.max(0, p - c.border.top - c.border.bottom - m.top - m.bottom), x;
|
|
2522
|
+
x = Wt(e) ? Ut(e, _.width, _.height, y, b, m, o) : c.display === "flex" && c.flexDirection === "row" ? P(e, _.width, _.height, y, c.border, m, o) : c.display === "flex" && c.flexDirection === "column" ? te(e, _.width, _.height, v, c.border, m, o) : c.display === "grid" ? pe(e, _.width, _.height, c.border, m, o) : c.display === "table" ? Et(e, _.width, y, c.border, m, o) : c.display === "multicol" ? rt(e, _.width, y, b, c.border, m, o) : Zt(e, _.width, y, c.border, m, o);
|
|
2523
|
+
let S = x + c.border.top + c.border.bottom + m.top + m.bottom, C = l ?? g ?? S;
|
|
2524
|
+
e.unclampedHeight = C, e.naturalContentHeight = S;
|
|
2525
|
+
let w = H(C, f, p), T = e.multicolGeometry;
|
|
2526
|
+
if (T) {
|
|
2527
|
+
let t = w - c.border.top - c.border.bottom - m.top - m.bottom;
|
|
2528
|
+
t > T.totalRows && (m.bottom += t - T.totalRows), et(e, T, c.border, m);
|
|
2529
|
+
}
|
|
2530
|
+
e.localRect = {
|
|
2196
2531
|
x: r,
|
|
2197
2532
|
y: i,
|
|
2198
2533
|
width: h,
|
|
2199
|
-
height:
|
|
2534
|
+
height: w
|
|
2200
2535
|
};
|
|
2201
2536
|
}
|
|
2202
|
-
function
|
|
2203
|
-
|
|
2537
|
+
function Ut(e, t, n, r, i, a, o) {
|
|
2538
|
+
let s = e.style, c;
|
|
2539
|
+
if (e.text) {
|
|
2540
|
+
let l = e.children.filter((e) => e.inlineBox);
|
|
2541
|
+
E(e.text, (n, r) => {
|
|
2542
|
+
let i = l[r];
|
|
2543
|
+
V(i, t, void 0, 0, 0, "shrink", o), e.advances[n] = Math.max(1, i.localRect.width);
|
|
2544
|
+
});
|
|
2545
|
+
let u, d;
|
|
2546
|
+
if (s.display === "multicol") {
|
|
2547
|
+
let n = U(s, "x", t), o = Ye(s, t, n);
|
|
2548
|
+
a.right += o.leftover;
|
|
2549
|
+
let c = Ze(e, o, n, qe(r, i));
|
|
2550
|
+
e.multicolGeometry = c, u = c, d = c.lineX;
|
|
2551
|
+
} else u = Kt(e, t);
|
|
2552
|
+
if (c = u.totalRows, Gt(e, u, t, n, a), l.length > 0) {
|
|
2553
|
+
let t = (e) => u.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
2554
|
+
E(e.text, (n, r) => {
|
|
2555
|
+
let i = t(n);
|
|
2556
|
+
if (i === -1) return;
|
|
2557
|
+
let o = u.spans[i];
|
|
2558
|
+
l[r].localRect = {
|
|
2559
|
+
...l[r].localRect,
|
|
2560
|
+
x: s.border.left + a.left + (d?.[i] ?? 0) + S(o.start, n, e.advances),
|
|
2561
|
+
y: s.border.top + a.top + u.lineY[i]
|
|
2562
|
+
};
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
} else c = e.intrinsicHeight;
|
|
2566
|
+
for (let n of e.children) {
|
|
2567
|
+
if (n.inlineBox) continue;
|
|
2568
|
+
let e = G(n.style.margin, t);
|
|
2569
|
+
n.staticSlot = {
|
|
2570
|
+
kind: "block",
|
|
2571
|
+
x: s.border.left + a.left + (e.left ?? 0),
|
|
2572
|
+
y: s.border.top + a.top + (e.top ?? 0)
|
|
2573
|
+
};
|
|
2574
|
+
}
|
|
2575
|
+
return c;
|
|
2576
|
+
}
|
|
2577
|
+
function Wt(e) {
|
|
2578
|
+
return e.children.some((e) => !B(e.style) && !e.inlineBox) ? !1 : e.text !== "" || e.style.display !== "flex" && e.style.display !== "grid";
|
|
2204
2579
|
}
|
|
2205
|
-
function
|
|
2580
|
+
function H(e, t, n) {
|
|
2206
2581
|
return Math.max(t, n === void 0 ? e : Math.min(e, n));
|
|
2207
2582
|
}
|
|
2208
|
-
function
|
|
2583
|
+
function Gt(e, t, n, r, i) {
|
|
2209
2584
|
let a = e.style;
|
|
2210
2585
|
if (a.display !== "flex" && a.display !== "grid" || t.spans.length === 0) return;
|
|
2211
2586
|
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t, C(n.start, n.end, e.advances, a.tracking)), 0), c = Math.max(0, n - s);
|
|
2212
2587
|
if (c > 0) {
|
|
2213
|
-
let e = a.display === "grid" ?
|
|
2588
|
+
let e = a.display === "grid" ? L(a.justifyItems, n, s) : o ? L(a.alignItems, n, s) : F(le(a), [s], c)[0];
|
|
2214
2589
|
e > 0 && (i.left += e, i.right += c - e);
|
|
2215
2590
|
}
|
|
2216
2591
|
if (Number.isFinite(r)) {
|
|
2217
2592
|
let e = Math.max(0, r - t.totalRows);
|
|
2218
2593
|
if (e > 0) {
|
|
2219
|
-
let n = a.display === "grid" || !o ?
|
|
2594
|
+
let n = a.display === "grid" || !o ? L(a.alignItems, r, t.totalRows) : F(le(a), [t.totalRows], e)[0];
|
|
2220
2595
|
n > 0 && (i.top += n, i.bottom += e - n);
|
|
2221
2596
|
}
|
|
2222
2597
|
}
|
|
2223
2598
|
}
|
|
2224
|
-
function
|
|
2225
|
-
let n = e
|
|
2599
|
+
function Kt(e, t) {
|
|
2600
|
+
let n = qt(e, t), { heights: r, textOffsets: i } = Jt(e, n), a = [], o = [], s = 0;
|
|
2601
|
+
for (let t = 0; t < n.length; t++) a.push(s), o.push(s + i[t]), s += r[t] + (t < n.length - 1 ? e.style.lineGap : 0);
|
|
2602
|
+
return {
|
|
2603
|
+
spans: n,
|
|
2604
|
+
lineY: a,
|
|
2605
|
+
textY: o,
|
|
2606
|
+
totalRows: s
|
|
2607
|
+
};
|
|
2608
|
+
}
|
|
2609
|
+
function qt(e, t) {
|
|
2610
|
+
return e.style.whiteSpace === "normal" ? x(e.text, t, {
|
|
2226
2611
|
advances: e.advances,
|
|
2227
|
-
tracking: e.style.tracking
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2612
|
+
tracking: e.style.tracking,
|
|
2613
|
+
firstLineIndent: e.style.textIndent
|
|
2614
|
+
}) : b(e.text);
|
|
2615
|
+
}
|
|
2616
|
+
function Jt(e, t) {
|
|
2617
|
+
let n = e.children.filter((e) => e.inlineBox), r = [], i = [], a = 0;
|
|
2618
|
+
for (let o of t) {
|
|
2619
|
+
let t = 1, s = 0;
|
|
2620
|
+
for (let r = o.start; r < o.end; r++) {
|
|
2621
|
+
if (e.text[r] !== "") continue;
|
|
2622
|
+
let i = n[a];
|
|
2623
|
+
t = Math.max(t, i.localRect.height), i.style.verticalAlign === "end" ? s = Math.max(s, i.localRect.height - 1) : i.style.verticalAlign === "center" && at(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++;
|
|
2236
2624
|
}
|
|
2237
|
-
|
|
2625
|
+
r.push(t), i.push(Math.min(s, t - 1));
|
|
2238
2626
|
}
|
|
2239
2627
|
return {
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
textY: a,
|
|
2243
|
-
totalRows: o
|
|
2628
|
+
heights: r,
|
|
2629
|
+
textOffsets: i
|
|
2244
2630
|
};
|
|
2245
2631
|
}
|
|
2246
|
-
function
|
|
2632
|
+
function U(e, t, n) {
|
|
2247
2633
|
let r = W(t === "x" ? e.gapX : e.gapY, n), i = t === "x" ? e.ruleX : e.ruleY;
|
|
2248
2634
|
return Math.max(r, i?.width ?? 0);
|
|
2249
2635
|
}
|
|
@@ -2259,110 +2645,113 @@ function G(e, t) {
|
|
|
2259
2645
|
left: n(e.left)
|
|
2260
2646
|
};
|
|
2261
2647
|
}
|
|
2262
|
-
function
|
|
2648
|
+
function Yt(e) {
|
|
2263
2649
|
return typeof e == "number" ? e : 0;
|
|
2264
2650
|
}
|
|
2265
|
-
function
|
|
2651
|
+
function K(e, t) {
|
|
2266
2652
|
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 : m(e.percent, t);
|
|
2267
2653
|
}
|
|
2268
|
-
function
|
|
2269
|
-
return e === "min-content" || e === "max-content" || e === "fit-content" ?
|
|
2654
|
+
function Xt(e, t, n, r) {
|
|
2655
|
+
return e === "min-content" || e === "max-content" || e === "fit-content" ? q({ kind: e }, t, n, r) : K(e, t);
|
|
2270
2656
|
}
|
|
2271
|
-
function
|
|
2657
|
+
function Zt(e, t, n, r, i, a) {
|
|
2272
2658
|
let o = r.left + i.left, s = r.top + i.top, c = s, l = null;
|
|
2273
2659
|
for (let r of e.children) {
|
|
2274
2660
|
let e = G(r.style.margin, t), i = e.top ?? 0, s = e.bottom ?? 0, u = e.left ?? 0, d = e.right ?? 0;
|
|
2275
|
-
if (
|
|
2661
|
+
if (B(r.style)) {
|
|
2276
2662
|
r.staticSlot = {
|
|
2277
2663
|
kind: "block",
|
|
2278
2664
|
x: o + u,
|
|
2279
|
-
y: c + (l === null ? i :
|
|
2665
|
+
y: c + (l === null ? i : $t(l, i))
|
|
2280
2666
|
};
|
|
2281
2667
|
continue;
|
|
2282
2668
|
}
|
|
2283
|
-
|
|
2284
|
-
let f = t
|
|
2285
|
-
|
|
2286
|
-
let h;
|
|
2287
|
-
h = p ? Math.floor(f / 2) : m ? f - d : u, c += l === null ? i : Nt(l, i), r.localRect = {
|
|
2669
|
+
V(r, Math.max(0, t - u - d), n, 0, 0, "fill", a);
|
|
2670
|
+
let f = Qt(e, t, r.localRect.width);
|
|
2671
|
+
c += l === null ? i : $t(l, i), r.localRect = {
|
|
2288
2672
|
...r.localRect,
|
|
2289
|
-
x: o +
|
|
2673
|
+
x: o + f,
|
|
2290
2674
|
y: c
|
|
2291
2675
|
}, c += r.localRect.height, l = s;
|
|
2292
2676
|
}
|
|
2293
2677
|
return l !== null && (c += l), c - s;
|
|
2294
2678
|
}
|
|
2295
|
-
function
|
|
2679
|
+
function Qt(e, t, n) {
|
|
2680
|
+
let r = t - n;
|
|
2681
|
+
return e.left === null && e.right === null ? Math.floor(r / 2) : e.left === null ? r - (e.right ?? 0) : e.left;
|
|
2682
|
+
}
|
|
2683
|
+
function $t(e, t) {
|
|
2296
2684
|
return e >= 0 && t >= 0 ? Math.max(e, t) : e <= 0 && t <= 0 ? Math.min(e, t) : e + t;
|
|
2297
2685
|
}
|
|
2298
|
-
function
|
|
2686
|
+
function en(e, t, n, r, i) {
|
|
2299
2687
|
let a = e.width;
|
|
2300
2688
|
if (e.display === "table") {
|
|
2301
|
-
if (!r.children.some((e) => !
|
|
2689
|
+
if (!r.children.some((e) => !B(e.style) && !e.inlineBox)) return a !== void 0 && a.kind !== "auto" ? q(a, t, r, i) : Math.min(t, J(r, i));
|
|
2302
2690
|
if (a !== void 0 && a.kind !== "auto") {
|
|
2303
|
-
let e =
|
|
2304
|
-
return Math.max(e,
|
|
2691
|
+
let e = q(a, t, r, i);
|
|
2692
|
+
return Math.max(e, tn(r, t, i));
|
|
2305
2693
|
}
|
|
2306
|
-
return
|
|
2694
|
+
return Tt(r, t, i);
|
|
2307
2695
|
}
|
|
2308
|
-
return a !== void 0 && a.kind !== "auto" ?
|
|
2696
|
+
return a !== void 0 && a.kind !== "auto" ? q(a, t, r, i) : n === "shrink" ? Math.min(t, J(r, i)) : t;
|
|
2309
2697
|
}
|
|
2310
|
-
function
|
|
2698
|
+
function tn(e, t, n) {
|
|
2311
2699
|
let r = e.style;
|
|
2312
|
-
return
|
|
2700
|
+
return wt(e, n).min + r.border.left + r.border.right + W(r.padding.left, t) + W(r.padding.right, t);
|
|
2313
2701
|
}
|
|
2314
|
-
function
|
|
2702
|
+
function nn(e, t) {
|
|
2315
2703
|
if (e.height?.kind === "cells") return e.height.value;
|
|
2316
2704
|
if (e.height?.kind === "percent" && t != null) return m(e.height.value, t);
|
|
2317
2705
|
}
|
|
2318
|
-
function
|
|
2706
|
+
function q(e, t, n, r) {
|
|
2319
2707
|
switch (e.kind) {
|
|
2320
2708
|
case "cells": return e.value;
|
|
2321
2709
|
case "percent": return m(e.value, t);
|
|
2322
|
-
case "min-content": return
|
|
2323
|
-
case "max-content": return
|
|
2324
|
-
case "fit-content": return Math.min(
|
|
2325
|
-
case "auto": return
|
|
2710
|
+
case "min-content": return Y(n, r);
|
|
2711
|
+
case "max-content": return J(n, r);
|
|
2712
|
+
case "fit-content": return Math.min(J(n, r), Math.max(Y(n, r), t));
|
|
2713
|
+
case "auto": return J(n, r);
|
|
2326
2714
|
}
|
|
2327
2715
|
}
|
|
2328
|
-
function
|
|
2716
|
+
function J(e, t) {
|
|
2329
2717
|
let n = t.maxContent.get(e);
|
|
2330
2718
|
if (n !== void 0) return n;
|
|
2331
|
-
let r = e.style, i =
|
|
2719
|
+
let r = e.style, i = rn(e, t) + r.border.left + r.border.right + Yt(r.padding.left) + Yt(r.padding.right);
|
|
2332
2720
|
return t.maxContent.set(e, i), i;
|
|
2333
2721
|
}
|
|
2334
|
-
function
|
|
2335
|
-
let n = e.children.filter((e) => !
|
|
2336
|
-
if (n.length === 0) return e.intrinsicWidth;
|
|
2337
|
-
if (e.style.display === "grid") return
|
|
2338
|
-
if (e.style.display === "table") return
|
|
2722
|
+
function rn(e, t) {
|
|
2723
|
+
let n = e.children.filter((e) => !B(e.style) && !e.inlineBox);
|
|
2724
|
+
if (n.length === 0) return e.style.display === "multicol" ? Ke(e.style, e.intrinsicWidth) : e.intrinsicWidth;
|
|
2725
|
+
if (e.style.display === "grid") return Se(e, t).max;
|
|
2726
|
+
if (e.style.display === "table") return wt(e, t).max;
|
|
2339
2727
|
if (e.style.display === "flex" && e.style.flexDirection === "row") {
|
|
2340
|
-
let r = Math.max(
|
|
2341
|
-
return n.reduce((e, n) => e +
|
|
2728
|
+
let r = Math.max(Yt(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
2729
|
+
return n.reduce((e, n) => e + J(n, t), 0) + r;
|
|
2342
2730
|
}
|
|
2343
|
-
|
|
2731
|
+
let r = n.reduce((e, n) => Math.max(e, J(n, t)), 0);
|
|
2732
|
+
return e.style.display === "multicol" ? Ke(e.style, r) : r;
|
|
2344
2733
|
}
|
|
2345
|
-
function
|
|
2734
|
+
function Y(e, t) {
|
|
2346
2735
|
let n = t.minContent.get(e);
|
|
2347
2736
|
if (n !== void 0) return n;
|
|
2348
|
-
let r = e.style, i =
|
|
2737
|
+
let r = e.style, i = an(e, t) + r.border.left + r.border.right + Yt(r.padding.left) + Yt(r.padding.right);
|
|
2349
2738
|
return t.minContent.set(e, i), i;
|
|
2350
2739
|
}
|
|
2351
|
-
function
|
|
2352
|
-
let n = e.children.filter((e) => !
|
|
2740
|
+
function an(e, t) {
|
|
2741
|
+
let n = e.children.filter((e) => !B(e.style) && !e.inlineBox);
|
|
2353
2742
|
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth : T(e.text, {
|
|
2354
2743
|
advances: e.advances,
|
|
2355
2744
|
tracking: e.style.tracking
|
|
2356
2745
|
});
|
|
2357
|
-
if (e.style.display === "grid") return
|
|
2358
|
-
if (e.style.display === "table") return
|
|
2746
|
+
if (e.style.display === "grid") return Se(e, t).min;
|
|
2747
|
+
if (e.style.display === "table") return wt(e, t).min;
|
|
2359
2748
|
if (e.style.display === "flex" && e.style.flexDirection === "row" && e.style.flexWrap === "nowrap") {
|
|
2360
|
-
let r = Math.max(
|
|
2361
|
-
return n.reduce((e, n) => e +
|
|
2749
|
+
let r = Math.max(Yt(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
2750
|
+
return n.reduce((e, n) => e + Y(n, t), 0) + r;
|
|
2362
2751
|
}
|
|
2363
|
-
return n.reduce((e, n) => Math.max(e,
|
|
2752
|
+
return n.reduce((e, n) => Math.max(e, Y(n, t)), 0);
|
|
2364
2753
|
}
|
|
2365
|
-
function
|
|
2754
|
+
function on(e, t, n, r) {
|
|
2366
2755
|
return {
|
|
2367
2756
|
width: Math.max(0, e - n.left - n.right - r.left - r.right),
|
|
2368
2757
|
height: Math.max(0, t - n.top - n.bottom - r.top - r.bottom)
|
|
@@ -2370,38 +2759,38 @@ function zt(e, t, n, r) {
|
|
|
2370
2759
|
}
|
|
2371
2760
|
//#endregion
|
|
2372
2761
|
//#region src/plain-text.ts
|
|
2373
|
-
function
|
|
2374
|
-
return
|
|
2762
|
+
function sn(e) {
|
|
2763
|
+
return pn(e).grid.map((e) => e.join("").trimEnd()).join("\n");
|
|
2375
2764
|
}
|
|
2376
|
-
function
|
|
2377
|
-
let { grid: t, paints: n } =
|
|
2378
|
-
return t.map((e, t) =>
|
|
2765
|
+
function cn(e) {
|
|
2766
|
+
let { grid: t, paints: n } = pn(e);
|
|
2767
|
+
return t.map((e, t) => ln(e, n[t]));
|
|
2379
2768
|
}
|
|
2380
|
-
function
|
|
2769
|
+
function ln(e, t) {
|
|
2381
2770
|
let n = e.length;
|
|
2382
2771
|
for (; n > 0 && e[n - 1] === " " && t[n - 1]?.backgroundColor === void 0;) n--;
|
|
2383
2772
|
let r = [];
|
|
2384
2773
|
for (let i = 0; i < n; i++) {
|
|
2385
2774
|
let n = t[i], a = r[r.length - 1];
|
|
2386
|
-
a &&
|
|
2775
|
+
a && un(a, n) ? a.text += e[i] : r.push({
|
|
2387
2776
|
text: e[i],
|
|
2388
2777
|
...n
|
|
2389
2778
|
});
|
|
2390
2779
|
}
|
|
2391
2780
|
return r;
|
|
2392
2781
|
}
|
|
2393
|
-
function
|
|
2782
|
+
function un(e, t) {
|
|
2394
2783
|
return e.color === t?.color && e.backgroundColor === t?.backgroundColor && e.fontWeight === t?.fontWeight && e.fontStyle === t?.fontStyle && e.textDecorationLine === t?.textDecorationLine;
|
|
2395
2784
|
}
|
|
2396
|
-
function
|
|
2785
|
+
function dn(e, t) {
|
|
2397
2786
|
e.color !== void 0 && (t.color = e.color), e.backgroundColor !== void 0 && (t.backgroundColor = e.backgroundColor), e.fontWeight !== void 0 && (t.fontWeight = e.fontWeight), e.fontStyle !== void 0 && (t.fontStyle = e.fontStyle), e.textDecorationLine !== void 0 && (t.textDecoration = e.textDecorationLine);
|
|
2398
2787
|
}
|
|
2399
|
-
function
|
|
2788
|
+
function fn(e) {
|
|
2400
2789
|
return e.color === void 0 && e.backgroundColor === void 0 && e.fontWeight === void 0 && e.fontStyle === void 0 && e.textDecorationLine === void 0;
|
|
2401
2790
|
}
|
|
2402
|
-
function
|
|
2791
|
+
function pn(e) {
|
|
2403
2792
|
let t = Math.max(0, e.localRect.width), n = Math.max(0, e.localRect.height), r = Array.from({ length: n }, () => Array.from({ length: t }, () => " ")), i = Array.from({ length: n }, () => Array.from({ length: t }, () => void 0));
|
|
2404
|
-
return
|
|
2793
|
+
return hn(e, 0, 0, (e, a, o, s) => {
|
|
2405
2794
|
if (e >= 0 && e < t && a >= 0 && a < n) {
|
|
2406
2795
|
r[a][e] = o;
|
|
2407
2796
|
let t = i[a][e];
|
|
@@ -2415,11 +2804,11 @@ function Kt(e) {
|
|
|
2415
2804
|
paints: i
|
|
2416
2805
|
};
|
|
2417
2806
|
}
|
|
2418
|
-
function
|
|
2807
|
+
function mn(e) {
|
|
2419
2808
|
let t = {};
|
|
2420
2809
|
return e.color && (t.color = e.color), e.backgroundColor && (t.backgroundColor = e.backgroundColor), e.fontWeight !== "400" && e.fontWeight !== "normal" && e.fontWeight !== "" && (t.fontWeight = e.fontWeight), e.fontStyle !== "normal" && e.fontStyle !== "" && (t.fontStyle = e.fontStyle), e.textDecorationLine !== "none" && e.textDecorationLine !== "" && (t.textDecorationLine = e.textDecorationLine), t;
|
|
2421
2810
|
}
|
|
2422
|
-
function
|
|
2811
|
+
function hn(t, n, i, a) {
|
|
2423
2812
|
if (t.tableHidden) return;
|
|
2424
2813
|
let o = n + t.localRect.x, s = i + t.localRect.y, c = t.style;
|
|
2425
2814
|
if (c.backgroundColor !== void 0 || c.backgroundClear) {
|
|
@@ -2442,25 +2831,25 @@ function Jt(t, n, i, a) {
|
|
|
2442
2831
|
for (let n = 0; n < e.length; n++) a(o + e.x + n, s + e.y, e.glyph, t);
|
|
2443
2832
|
}
|
|
2444
2833
|
if (!t.children.some((e) => !e.inlineBox && e.style.position !== "absolute" && e.style.position !== "fixed") && t.text) {
|
|
2445
|
-
let e = t.resolvedPadding, n = o + c.border.left + e.left, r = s + c.border.top + e.top, i = t.localRect.width - c.border.left - c.border.right - e.left - e.right, { spans:
|
|
2446
|
-
for (let e = 0; e <
|
|
2447
|
-
let
|
|
2448
|
-
end:
|
|
2834
|
+
let e = t.resolvedPadding, n = o + c.border.left + e.left, r = s + c.border.top + e.top, i = t.localRect.width - c.border.left - c.border.right - e.left - e.right, l = t.multicolGeometry, { spans: u, textY: d } = l ?? Kt(t, i), f = l ? Math.max(1, l.columnWidth - c.tracking) : i, p = mn(c), m = t.inlineElements?.map((e) => mn(e));
|
|
2835
|
+
for (let e = 0; e < u.length; e++) {
|
|
2836
|
+
let i = u[e], o = r + d[e], s = e === 0 ? c.textIndent : 0, h = c.whiteSpace !== "normal" && c.overflow === "clip" ? gn(t.text, i, f - s, t.advances, c) : {
|
|
2837
|
+
end: i.end,
|
|
2449
2838
|
ellipsis: !1
|
|
2450
|
-
},
|
|
2451
|
-
for (let e =
|
|
2839
|
+
}, g = C(i.start, i.end, t.advances, c.tracking), _ = Math.max(0, f - s - g), v = c.textAlign === "end" ? _ : c.textAlign === "center" ? Math.floor(_ / 2) : 0, y = n + (l?.lineX[e] ?? 0) + v + s;
|
|
2840
|
+
for (let e = i.start; e < h.end; e++) {
|
|
2452
2841
|
if (t.text[e] !== "") {
|
|
2453
|
-
let n = t.charInline?.[e] ?? -1, r = n >= 0 ? t.inlineElements[n] : void 0, i = r?.insets,
|
|
2454
|
-
t.text[e] === "" ? r?.backgroundColor && a(
|
|
2842
|
+
let n = t.charInline?.[e] ?? -1, r = n >= 0 ? t.inlineElements[n] : void 0, i = r?.insets, s = i ? i.left ?? (i.right === null ? 0 : -i.right) : 0, c = i ? i.top ?? (i.bottom === null ? 0 : -i.bottom) : 0;
|
|
2843
|
+
t.text[e] === "" ? r?.backgroundColor && a(y + s, o + c, " ", { backgroundColor: r.backgroundColor }) : a(y + s, o + c, t.text[e], r ? m[n] : p);
|
|
2455
2844
|
}
|
|
2456
|
-
|
|
2845
|
+
y += S(e, e + 1, t.advances);
|
|
2457
2846
|
}
|
|
2458
|
-
|
|
2847
|
+
h.ellipsis && a(y, o, "…", p);
|
|
2459
2848
|
}
|
|
2460
2849
|
}
|
|
2461
|
-
for (let e of r(t))
|
|
2850
|
+
for (let e of r(t)) hn(e, o, s, a);
|
|
2462
2851
|
}
|
|
2463
|
-
function
|
|
2852
|
+
function gn(e, t, n, r, i) {
|
|
2464
2853
|
let { textOverflow: a, tracking: o } = i;
|
|
2465
2854
|
if (C(t.start, t.end, r, o) <= n) return {
|
|
2466
2855
|
end: t.end,
|
|
@@ -2475,26 +2864,26 @@ function Yt(e, t, n, r, i) {
|
|
|
2475
2864
|
}
|
|
2476
2865
|
//#endregion
|
|
2477
2866
|
//#region src/paint.ts
|
|
2478
|
-
var
|
|
2479
|
-
function
|
|
2480
|
-
let n =
|
|
2481
|
-
if (
|
|
2482
|
-
|
|
2867
|
+
var _n = /* @__PURE__ */ new WeakMap();
|
|
2868
|
+
function vn(e, t) {
|
|
2869
|
+
let n = cn(e), r = yn(n);
|
|
2870
|
+
if (_n.get(t) === r) return;
|
|
2871
|
+
_n.set(t, r);
|
|
2483
2872
|
let i = document.createDocumentFragment();
|
|
2484
2873
|
for (let e = 0; e < n.length; e++) {
|
|
2485
2874
|
e > 0 && i.appendChild(document.createTextNode("\n"));
|
|
2486
2875
|
for (let t of n[e]) {
|
|
2487
|
-
if (
|
|
2876
|
+
if (fn(t)) {
|
|
2488
2877
|
i.appendChild(document.createTextNode(t.text));
|
|
2489
2878
|
continue;
|
|
2490
2879
|
}
|
|
2491
2880
|
let e = document.createElement("span");
|
|
2492
|
-
|
|
2881
|
+
dn(t, e.style), e.textContent = t.text, i.appendChild(e);
|
|
2493
2882
|
}
|
|
2494
2883
|
}
|
|
2495
2884
|
t.replaceChildren(i);
|
|
2496
2885
|
}
|
|
2497
|
-
function
|
|
2886
|
+
function yn(e) {
|
|
2498
2887
|
let t = [];
|
|
2499
2888
|
for (let n of e) {
|
|
2500
2889
|
for (let e of n) t.push(e.text, e.color ?? "", e.backgroundColor ?? "", e.fontWeight ?? "", e.fontStyle ?? "", e.textDecorationLine ?? "");
|
|
@@ -2504,9 +2893,9 @@ function Qt(e) {
|
|
|
2504
2893
|
}
|
|
2505
2894
|
//#endregion
|
|
2506
2895
|
//#region src/render.ts
|
|
2507
|
-
function
|
|
2896
|
+
function bn(e) {
|
|
2508
2897
|
let t = /* @__PURE__ */ new Set();
|
|
2509
|
-
|
|
2898
|
+
xn(e, !0, t);
|
|
2510
2899
|
for (let n of Array.from(e.source.querySelectorAll("[data-mw-inline-inset]"))) if (!t.has(n)) {
|
|
2511
2900
|
n.removeAttribute("data-mw-inline-inset");
|
|
2512
2901
|
let e = n.style;
|
|
@@ -2518,125 +2907,138 @@ function $t(e) {
|
|
|
2518
2907
|
]) e.removeProperty(t);
|
|
2519
2908
|
}
|
|
2520
2909
|
}
|
|
2521
|
-
function
|
|
2910
|
+
function X(e, t, n) {
|
|
2522
2911
|
e.style.getPropertyValue(t) !== n && e.style.setProperty(t, n);
|
|
2523
2912
|
}
|
|
2524
|
-
function
|
|
2913
|
+
function Z(e, t) {
|
|
2525
2914
|
e.style.getPropertyValue(t) !== "" && e.style.removeProperty(t);
|
|
2526
2915
|
}
|
|
2527
2916
|
function Q(e, t, n) {
|
|
2528
2917
|
e.hasAttribute(t) !== n && (n ? e.setAttribute(t, "") : e.removeAttribute(t));
|
|
2529
2918
|
}
|
|
2530
|
-
function
|
|
2919
|
+
function xn(e, t, i) {
|
|
2531
2920
|
if (e.inlineElements) for (let { element: t, tracking: n, padLeft: r, padRight: a, insets: o } of e.inlineElements) {
|
|
2532
2921
|
let e = t;
|
|
2533
|
-
|
|
2922
|
+
X(e, "--mw-ls", String(n)), r > 0 ? X(e, "--mw-ipl", String(r)) : Z(e, "--mw-ipl"), a > 0 ? X(e, "--mw-ipr", String(a)) : Z(e, "--mw-ipr"), o && (i.add(t), Sn(e, o));
|
|
2534
2923
|
}
|
|
2535
|
-
if (t ||
|
|
2924
|
+
if (t || wn(e), !e.tableHidden) for (let t of r(e)) {
|
|
2536
2925
|
let r = t.source;
|
|
2537
|
-
t.style.zIndex !== null && n(t, e) && !t.inlineBox ?
|
|
2926
|
+
t.style.zIndex !== null && n(t, e) && !t.inlineBox ? X(r, "--mw-z", String(t.style.zIndex)) : Z(r, "--mw-z"), xn(t, !1, i);
|
|
2538
2927
|
}
|
|
2539
2928
|
}
|
|
2540
|
-
function
|
|
2929
|
+
function Sn(e, t) {
|
|
2541
2930
|
Q(e, "data-mw-inline-inset", !0);
|
|
2542
2931
|
let n = (t, n) => {
|
|
2543
|
-
n === null ?
|
|
2932
|
+
n === null ? Z(e, t) : X(e, t, String(n));
|
|
2544
2933
|
};
|
|
2545
2934
|
n("--mw-it", t.top), n("--mw-ir", t.right), n("--mw-ib", t.bottom), n("--mw-il", t.left);
|
|
2546
2935
|
}
|
|
2547
|
-
function
|
|
2548
|
-
let t = e.
|
|
2549
|
-
|
|
2936
|
+
function Cn(e) {
|
|
2937
|
+
let t = e.style;
|
|
2938
|
+
if (t.textAlign !== "center" || !e.text || e.inlineBox || e.children.length > 0) return !1;
|
|
2939
|
+
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 ?? qt(e, i);
|
|
2940
|
+
return o.length !== 0 && o.every((n, r) => {
|
|
2941
|
+
let i = r === 0 ? t.textIndent : 0, o = a - i - C(n.start, n.end, e.advances, t.tracking);
|
|
2942
|
+
return o > 0 && o % 2 == 1;
|
|
2943
|
+
});
|
|
2944
|
+
}
|
|
2945
|
+
function wn(e) {
|
|
2946
|
+
let t = e.source, n = e.localRect, r = e.resolvedPadding, { border: i, textAlignBlocked: a, overflow: o, whiteSpace: s, tracking: c, lineGap: l } = e.style, u = e.multicolFlow, d = e.multicolFlowSpan;
|
|
2947
|
+
Q(t, "data-mw-laid-out", !e.inlineBox && !u && !d), Q(t, "data-mw-inline-box", !!e.inlineBox), Q(t, "data-mw-multicol-flow", !!u), Q(t, "data-mw-multicol-flow-span", !!d);
|
|
2948
|
+
let f = u ?? d;
|
|
2949
|
+
f ? (X(t, "--mw-mt", String(f.top ?? 0)), X(t, "--mw-mr", String(f.right ?? 0)), X(t, "--mw-mb", String(f.bottom ?? 0)), X(t, "--mw-ml", String(f.left ?? 0))) : (Z(t, "--mw-mt"), Z(t, "--mw-mr"), Z(t, "--mw-mb"), Z(t, "--mw-ml")), Q(t, "data-mw-vbottom", !!e.inlineBox && e.style.verticalAlign === "end"), X(t, "--mw-ls", String(c)), X(t, "--mw-lh", String(l + 1)), X(t, "--mw-lhs", String(-l / 2)), Q(t, "data-mw-nowrap", s !== "normal");
|
|
2950
|
+
let p = u || d ? void 0 : e.multicolGeometry;
|
|
2951
|
+
Q(t, "data-mw-multicol", !!p), Q(t, "data-mw-multicol-balance", !!p?.nativeBalance), p ? (X(t, "--mw-colc", String(p.columnCount)), X(t, "--mw-colg", String(p.gap))) : (Z(t, "--mw-colc"), Z(t, "--mw-colg")), Q(t, "data-mw-pre", s === "pre"), X(t, "--mw-x", String(n.x)), X(t, "--mw-y", String(n.y)), X(t, "--mw-w", String(n.width)), X(t, "--mw-h", String(n.height)), Q(t, "data-mw-clip", o === "clip"), X(t, "--mw-pt", String(r.top)), X(t, "--mw-pr", String(r.right)), X(t, "--mw-pb", String(r.bottom)), X(t, "--mw-pl", String(r.left)), X(t, "--mw-bt", String(i.top)), X(t, "--mw-br", String(i.right)), X(t, "--mw-bb", String(i.bottom)), X(t, "--mw-bl", String(i.left)), X(t, "--mw-ti", String(e.style.textIndent)), Q(t, "data-mw-text-align-blocked", a), Q(t, "data-mw-center-nudge", Cn(e)), Q(t, "data-mw-dropped-text", !!e.droppedText), Q(t, "data-mw-table-hidden", !!e.tableHidden);
|
|
2550
2952
|
}
|
|
2551
2953
|
//#endregion
|
|
2552
2954
|
//#region src/style.ts
|
|
2553
|
-
function
|
|
2554
|
-
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a =
|
|
2555
|
-
|
|
2556
|
-
let c = r.display ||
|
|
2955
|
+
function Tn(e, t, n) {
|
|
2956
|
+
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a = Rn(e) ? e.computedStyleMap() : null, o = e.getAttribute("class") ?? "", s = e.style;
|
|
2957
|
+
Nn(e, o, s);
|
|
2958
|
+
let c = r.display || An[e.tagName] || "", l = jn[c] ?? "none", u = r.columnCount && r.columnCount !== "auto" ? Math.max(1, Math.floor(Number(r.columnCount) || 1)) : null, d = r.columnWidth && r.columnWidth !== "auto" ? parseFloat(r.columnWidth) : NaN, m = Number.isFinite(d) ? Math.max(1, p(d, t)) : null, h = c === "flex" || c === "inline-flex" ? "flex" : c === "grid" || c === "inline-grid" ? "grid" : c === "table" || c === "inline-table" ? "table" : c === "none" || kn(r) ? "none" : u !== null || m !== null ? "multicol" : "block", g = { kind: "none" }, _ = { kind: "none" }, v = [fe()], y = [fe()], b = {
|
|
2557
2959
|
direction: "row",
|
|
2558
2960
|
dense: !1
|
|
2559
|
-
},
|
|
2560
|
-
if (
|
|
2561
|
-
if (a)
|
|
2961
|
+
}, x = null;
|
|
2962
|
+
if (h === "grid") {
|
|
2963
|
+
if (a) g = rr(a.get("grid-template-columns")?.toString() ?? "", t), _ = rr(a.get("grid-template-rows")?.toString() ?? "", t);
|
|
2562
2964
|
else {
|
|
2563
2965
|
e.setAttribute("data-mw-degrid", "");
|
|
2564
2966
|
try {
|
|
2565
|
-
|
|
2967
|
+
g = rr(r.getPropertyValue("grid-template-columns"), t), _ = rr(r.getPropertyValue("grid-template-rows"), t);
|
|
2566
2968
|
} finally {
|
|
2567
2969
|
e.removeAttribute("data-mw-degrid");
|
|
2568
2970
|
}
|
|
2569
2971
|
}
|
|
2570
|
-
|
|
2972
|
+
v = sr(r.getPropertyValue("grid-auto-columns"), t), y = sr(r.getPropertyValue("grid-auto-rows"), t), b = pr(r.getPropertyValue("grid-auto-flow")), x = or(r.getPropertyValue("grid-template-areas"));
|
|
2571
2973
|
}
|
|
2572
|
-
let
|
|
2573
|
-
if (
|
|
2974
|
+
let S = "auto", C = !1, w = 0, T = 0;
|
|
2975
|
+
if (h === "table" && (S = r.tableLayout === "fixed" ? "fixed" : "auto", C = r.borderCollapse === "collapse", !C)) {
|
|
2574
2976
|
let e = r.borderSpacing.split(" ");
|
|
2575
|
-
|
|
2977
|
+
w = p(parseFloat(e[0] ?? "") || 0, t), T = p(parseFloat(e[1] ?? e[0] ?? "") || 0, t);
|
|
2576
2978
|
}
|
|
2577
|
-
let
|
|
2578
|
-
display:
|
|
2979
|
+
let E = {
|
|
2980
|
+
display: h,
|
|
2579
2981
|
tableRole: l,
|
|
2580
|
-
tableLayout:
|
|
2581
|
-
borderCollapse:
|
|
2582
|
-
borderSpacingX:
|
|
2583
|
-
borderSpacingY:
|
|
2982
|
+
tableLayout: S,
|
|
2983
|
+
borderCollapse: C,
|
|
2984
|
+
borderSpacingX: w,
|
|
2985
|
+
borderSpacingY: T,
|
|
2584
2986
|
captionSide: r.captionSide === "bottom" ? "bottom" : "top",
|
|
2585
|
-
verticalAlign: l === "cell" || c.startsWith("inline-") ?
|
|
2987
|
+
verticalAlign: l === "cell" || c.startsWith("inline-") ? Mn(e, r) : "start",
|
|
2586
2988
|
flexDirection: r.flexDirection.startsWith("column") ? "column" : "row",
|
|
2587
2989
|
flexReverse: r.flexDirection.endsWith("-reverse"),
|
|
2588
2990
|
flexWrap: r.flexWrap.startsWith("wrap") ? "wrap" : "nowrap",
|
|
2589
2991
|
wrapReverse: r.flexWrap === "wrap-reverse",
|
|
2590
2992
|
flexGrow: Number(r.flexGrow) || 0,
|
|
2591
2993
|
flexShrink: r.flexShrink === "" ? 1 : Number(r.flexShrink) || 0,
|
|
2592
|
-
flexBasis:
|
|
2994
|
+
flexBasis: tr(r.flexBasis, t),
|
|
2593
2995
|
order: Number(r.order) || 0,
|
|
2594
|
-
justifyContent:
|
|
2595
|
-
alignContent:
|
|
2596
|
-
alignItems:
|
|
2597
|
-
alignSelf:
|
|
2598
|
-
justifyItems:
|
|
2599
|
-
justifySelf:
|
|
2600
|
-
gridTemplateColumns:
|
|
2601
|
-
gridTemplateRows:
|
|
2602
|
-
gridAutoColumns:
|
|
2603
|
-
gridAutoRows:
|
|
2604
|
-
gridAutoFlow:
|
|
2605
|
-
gridTemplateAreas:
|
|
2606
|
-
gridColumnStart:
|
|
2607
|
-
gridColumnEnd:
|
|
2608
|
-
gridRowStart:
|
|
2609
|
-
gridRowEnd:
|
|
2610
|
-
width:
|
|
2611
|
-
height:
|
|
2612
|
-
minWidth:
|
|
2613
|
-
minHeight:
|
|
2614
|
-
maxWidth:
|
|
2615
|
-
maxHeight:
|
|
2616
|
-
padding:
|
|
2617
|
-
margin:
|
|
2618
|
-
position:
|
|
2619
|
-
insets:
|
|
2620
|
-
gapX: $(r.columnGap === "normal" ? "0px" : r.columnGap, t),
|
|
2996
|
+
justifyContent: zn(r.justifyContent),
|
|
2997
|
+
alignContent: zn(r.alignContent),
|
|
2998
|
+
alignItems: Bn(r.alignItems),
|
|
2999
|
+
alignSelf: Vn(r.alignSelf),
|
|
3000
|
+
justifyItems: Bn(r.justifyItems),
|
|
3001
|
+
justifySelf: Vn(r.justifySelf),
|
|
3002
|
+
gridTemplateColumns: g,
|
|
3003
|
+
gridTemplateRows: _,
|
|
3004
|
+
gridAutoColumns: v,
|
|
3005
|
+
gridAutoRows: y,
|
|
3006
|
+
gridAutoFlow: b,
|
|
3007
|
+
gridTemplateAreas: x,
|
|
3008
|
+
gridColumnStart: fr(r.getPropertyValue("grid-column-start")),
|
|
3009
|
+
gridColumnEnd: fr(r.getPropertyValue("grid-column-end")),
|
|
3010
|
+
gridRowStart: fr(r.getPropertyValue("grid-row-start")),
|
|
3011
|
+
gridRowEnd: fr(r.getPropertyValue("grid-row-end")),
|
|
3012
|
+
width: Xn(a, r.width, "width", t, o, s, n),
|
|
3013
|
+
height: Xn(a, r.height, "height", t, o, s, n),
|
|
3014
|
+
minWidth: er(a, "min-width", r.minWidth, o, "min-w", s, n, t) ?? Jn(r.minWidth, t) ?? "auto",
|
|
3015
|
+
minHeight: er(a, "min-height", r.minHeight, o, "min-h", s, n, t) ?? Jn(r.minHeight, t) ?? "auto",
|
|
3016
|
+
maxWidth: er(a, "max-width", r.maxWidth, o, "max-w", s, n, t) ?? Jn(r.maxWidth, t),
|
|
3017
|
+
maxHeight: er(a, "max-height", r.maxHeight, o, "max-h", s, n, t) ?? Jn(r.maxHeight, t),
|
|
3018
|
+
padding: hr(r, t),
|
|
3019
|
+
margin: Hn(r, a, o, s, t),
|
|
3020
|
+
position: Gn(r.position),
|
|
3021
|
+
insets: Kn(r, a, o, s, t),
|
|
3022
|
+
gapX: $(r.columnGap === "normal" || r.columnGap === "" ? h === "multicol" ? `${i}px` : "0px" : r.columnGap, t),
|
|
2621
3023
|
gapY: $(r.rowGap === "normal" ? "0px" : r.rowGap, t),
|
|
2622
|
-
border:
|
|
3024
|
+
border: gr(r),
|
|
2623
3025
|
borderStyle: {
|
|
2624
|
-
top:
|
|
2625
|
-
right:
|
|
2626
|
-
bottom:
|
|
2627
|
-
left:
|
|
3026
|
+
top: qn(r.borderTopStyle),
|
|
3027
|
+
right: qn(r.borderRightStyle),
|
|
3028
|
+
bottom: qn(r.borderBottomStyle),
|
|
3029
|
+
left: qn(r.borderLeftStyle)
|
|
2628
3030
|
},
|
|
2629
|
-
overflow:
|
|
3031
|
+
overflow: On(r.overflow) || On(r.overflowX) || On(r.overflowY) ? "clip" : "visible",
|
|
2630
3032
|
whiteSpace: r.whiteSpace === "pre" ? "pre" : r.whiteSpace === "nowrap" ? "nowrap" : "normal",
|
|
2631
3033
|
tabSize: Math.max(1, Math.floor(parseFloat(r.tabSize)) || 8),
|
|
2632
|
-
lineGap:
|
|
2633
|
-
tracking:
|
|
3034
|
+
lineGap: Wn(r.lineHeight, i),
|
|
3035
|
+
tracking: Un(r.letterSpacing, i, n?.letterSpacing ?? 0),
|
|
2634
3036
|
textOverflow: r.textOverflow === "ellipsis" ? "ellipsis" : "clip",
|
|
2635
3037
|
color: r.color,
|
|
2636
3038
|
fontWeight: r.fontWeight,
|
|
2637
3039
|
fontStyle: r.fontStyle,
|
|
2638
3040
|
textDecorationLine: r.textDecorationLine,
|
|
2639
|
-
backgroundColor:
|
|
3041
|
+
backgroundColor: Dn(r.backgroundColor) ? void 0 : r.backgroundColor,
|
|
2640
3042
|
backgroundClear: r.getPropertyValue("--mw-bg-clear").trim() === "1",
|
|
2641
3043
|
borderColor: {
|
|
2642
3044
|
top: r.borderTopColor,
|
|
@@ -2644,23 +3046,31 @@ function an(e, t, n) {
|
|
|
2644
3046
|
bottom: r.borderBottomColor,
|
|
2645
3047
|
left: r.borderLeftColor
|
|
2646
3048
|
},
|
|
2647
|
-
textAlignBlocked:
|
|
2648
|
-
textAlign:
|
|
3049
|
+
textAlignBlocked: In(e, r),
|
|
3050
|
+
textAlign: Ln(e, r),
|
|
3051
|
+
textIndent: Yn(r, t),
|
|
2649
3052
|
zIndex: r.zIndex === "auto" || r.zIndex === "" ? null : Number(r.zIndex) || 0,
|
|
2650
3053
|
latticeBorder: null,
|
|
2651
|
-
ruleX:
|
|
2652
|
-
ruleY:
|
|
2653
|
-
ruleBreak:
|
|
3054
|
+
ruleX: h === "flex" || h === "grid" || h === "multicol" ? Fn(r, "x") : null,
|
|
3055
|
+
ruleY: h === "flex" || h === "grid" ? Fn(r, "y") : null,
|
|
3056
|
+
ruleBreak: Pn(r, "--mw-rule-break", ["none", "intersection"], "normal"),
|
|
2654
3057
|
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0, f(parseFloat(r.getPropertyValue("--mw-rule-inset")) || 0)),
|
|
2655
|
-
ruleVisibilityItems:
|
|
3058
|
+
ruleVisibilityItems: Pn(r, "--mw-rule-visibility-items", [
|
|
2656
3059
|
"all",
|
|
2657
3060
|
"around",
|
|
2658
3061
|
"between"
|
|
2659
|
-
], "normal")
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
3062
|
+
], "normal"),
|
|
3063
|
+
columnCount: u,
|
|
3064
|
+
columnWidth: m,
|
|
3065
|
+
columnFill: r.columnFill === "auto" ? "auto" : "balance",
|
|
3066
|
+
columnSpan: r.columnSpan === "all",
|
|
3067
|
+
breakBeforeColumn: r.breakBefore === "column",
|
|
3068
|
+
breakAfterColumn: r.breakAfter === "column",
|
|
3069
|
+
breakInsideAvoid: r.breakInside === "avoid" || r.breakInside === "avoid-column"
|
|
3070
|
+
};
|
|
3071
|
+
return En(E, r), E;
|
|
3072
|
+
}
|
|
3073
|
+
function En(e, t) {
|
|
2664
3074
|
t.borderCollapse === "collapse" && (e.display === "table" || e.tableRole === "cell" || e.tableRole === "row" || e.tableRole === "row-group" || e.tableRole === "header-group" || e.tableRole === "footer-group") && (e.latticeBorder = {
|
|
2665
3075
|
width: e.border,
|
|
2666
3076
|
style: e.borderStyle,
|
|
@@ -2671,22 +3081,22 @@ function on(e, t) {
|
|
|
2671
3081
|
bottom: t.borderBottomStyle === "hidden",
|
|
2672
3082
|
left: t.borderLeftStyle === "hidden"
|
|
2673
3083
|
}
|
|
2674
|
-
}, e.border =
|
|
3084
|
+
}, e.border = R(), e.display === "table" && (e.padding = R()));
|
|
2675
3085
|
}
|
|
2676
|
-
function
|
|
3086
|
+
function Dn(e) {
|
|
2677
3087
|
if (!e) return !0;
|
|
2678
3088
|
let t = e.trim().toLowerCase();
|
|
2679
3089
|
return t === "" || t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "currentcolor";
|
|
2680
3090
|
}
|
|
2681
|
-
function
|
|
3091
|
+
function On(e) {
|
|
2682
3092
|
return e === "hidden" || e === "clip";
|
|
2683
3093
|
}
|
|
2684
|
-
function
|
|
3094
|
+
function kn(e) {
|
|
2685
3095
|
if (e.position !== "absolute" && e.position !== "fixed") return !1;
|
|
2686
3096
|
let t = e.clip.replace(/\s/g, "");
|
|
2687
|
-
return t === "rect(0px,0px,0px,0px)" || t === "rect(0,0,0,0)" || (
|
|
3097
|
+
return t === "rect(0px,0px,0px,0px)" || t === "rect(0,0,0,0)" || (On(e.overflow) || On(e.overflowX)) && parseFloat(e.width) <= 1 && parseFloat(e.height) <= 1;
|
|
2688
3098
|
}
|
|
2689
|
-
var
|
|
3099
|
+
var An = {
|
|
2690
3100
|
TABLE: "table",
|
|
2691
3101
|
THEAD: "table-header-group",
|
|
2692
3102
|
TBODY: "table-row-group",
|
|
@@ -2697,7 +3107,7 @@ var un = {
|
|
|
2697
3107
|
CAPTION: "table-caption",
|
|
2698
3108
|
COL: "table-column",
|
|
2699
3109
|
COLGROUP: "table-column-group"
|
|
2700
|
-
},
|
|
3110
|
+
}, jn = {
|
|
2701
3111
|
"table-header-group": "header-group",
|
|
2702
3112
|
"table-row-group": "row-group",
|
|
2703
3113
|
"table-footer-group": "footer-group",
|
|
@@ -2707,38 +3117,38 @@ var un = {
|
|
|
2707
3117
|
"table-column": "column",
|
|
2708
3118
|
"table-column-group": "column-group"
|
|
2709
3119
|
};
|
|
2710
|
-
function
|
|
3120
|
+
function Mn(e, t) {
|
|
2711
3121
|
let n = t.verticalAlign || e.getAttribute("valign")?.toLowerCase() || (e.tagName === "TD" || e.tagName === "TH" ? "middle" : "baseline");
|
|
2712
3122
|
return n === "top" ? "start" : n === "middle" ? "center" : n === "bottom" ? "end" : "start";
|
|
2713
3123
|
}
|
|
2714
|
-
function
|
|
2715
|
-
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") &&
|
|
3124
|
+
function Nn(e, t, n) {
|
|
3125
|
+
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") && at(e, "font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.");
|
|
2716
3126
|
}
|
|
2717
|
-
function
|
|
3127
|
+
function Pn(e, t, n, r) {
|
|
2718
3128
|
let i = e.getPropertyValue(t).trim();
|
|
2719
3129
|
return n.includes(i) ? i : r;
|
|
2720
3130
|
}
|
|
2721
|
-
function
|
|
3131
|
+
function Fn(e, t) {
|
|
2722
3132
|
let n = f(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`)) || 0);
|
|
2723
3133
|
if (n <= 0) return null;
|
|
2724
3134
|
let r = e.getPropertyValue(`--mw-rule-${t}-color`).trim();
|
|
2725
3135
|
return {
|
|
2726
3136
|
width: n,
|
|
2727
|
-
style:
|
|
3137
|
+
style: qn(e.getPropertyValue(`--mw-rule-${t}-style`).trim()),
|
|
2728
3138
|
color: r && r !== "currentcolor" && r !== "currentColor" ? r : e.color
|
|
2729
3139
|
};
|
|
2730
3140
|
}
|
|
2731
|
-
function
|
|
3141
|
+
function In(e, t) {
|
|
2732
3142
|
return t.textAlign === "justify" || e.getAttribute("align")?.toLowerCase() === "justify";
|
|
2733
3143
|
}
|
|
2734
|
-
function
|
|
3144
|
+
function Ln(e, t) {
|
|
2735
3145
|
let n = t.textAlign || e.getAttribute("align")?.toLowerCase() || "";
|
|
2736
3146
|
return n === "right" || n === "end" ? "end" : n === "center" || n.endsWith("-center") ? "center" : "start";
|
|
2737
3147
|
}
|
|
2738
|
-
function
|
|
3148
|
+
function Rn(e) {
|
|
2739
3149
|
return typeof e.computedStyleMap == "function";
|
|
2740
3150
|
}
|
|
2741
|
-
function
|
|
3151
|
+
function zn(e) {
|
|
2742
3152
|
switch (e) {
|
|
2743
3153
|
case "center": return "center";
|
|
2744
3154
|
case "flex-end":
|
|
@@ -2753,7 +3163,7 @@ function yn(e) {
|
|
|
2753
3163
|
default: return "start";
|
|
2754
3164
|
}
|
|
2755
3165
|
}
|
|
2756
|
-
function
|
|
3166
|
+
function Bn(e) {
|
|
2757
3167
|
switch (e) {
|
|
2758
3168
|
case "center": return "center";
|
|
2759
3169
|
case "flex-end":
|
|
@@ -2764,10 +3174,10 @@ function bn(e) {
|
|
|
2764
3174
|
default: return "start";
|
|
2765
3175
|
}
|
|
2766
3176
|
}
|
|
2767
|
-
function
|
|
2768
|
-
return e === "auto" || e === "" || e === "normal" ? "auto" :
|
|
3177
|
+
function Vn(e) {
|
|
3178
|
+
return e === "auto" || e === "" || e === "normal" ? "auto" : Bn(e);
|
|
2769
3179
|
}
|
|
2770
|
-
function
|
|
3180
|
+
function Hn(e, t, n, r, i) {
|
|
2771
3181
|
let a = (a, o, s) => {
|
|
2772
3182
|
if (t) {
|
|
2773
3183
|
let e = t.get(a)?.toString().trim();
|
|
@@ -2791,16 +3201,16 @@ function Sn(e, t, n, r, i) {
|
|
|
2791
3201
|
left: a("margin-left", "margin-inline-start", /(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)
|
|
2792
3202
|
};
|
|
2793
3203
|
}
|
|
2794
|
-
function
|
|
3204
|
+
function Un(e, t, n) {
|
|
2795
3205
|
let r = (e === "normal" ? 0 : parseFloat(e) || 0) - n;
|
|
2796
3206
|
return r <= 0 ? 0 : Math.floor(r / (.025 * t) + 1e-6);
|
|
2797
3207
|
}
|
|
2798
|
-
function
|
|
3208
|
+
function Wn(e, t) {
|
|
2799
3209
|
if (!e || e === "normal" || t <= 0) return 0;
|
|
2800
3210
|
let n = parseFloat(e);
|
|
2801
3211
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n / t + 1e-6) - 1) : 0;
|
|
2802
3212
|
}
|
|
2803
|
-
function
|
|
3213
|
+
function Gn(e) {
|
|
2804
3214
|
switch (e) {
|
|
2805
3215
|
case "relative":
|
|
2806
3216
|
case "absolute":
|
|
@@ -2809,7 +3219,7 @@ function Tn(e) {
|
|
|
2809
3219
|
default: return "static";
|
|
2810
3220
|
}
|
|
2811
3221
|
}
|
|
2812
|
-
function
|
|
3222
|
+
function Kn(e, t, n, r, i) {
|
|
2813
3223
|
let a = (a, o) => {
|
|
2814
3224
|
if (t) {
|
|
2815
3225
|
let e = t.get(a)?.toString().trim();
|
|
@@ -2828,7 +3238,7 @@ function En(e, t, n, r, i) {
|
|
|
2828
3238
|
left: a("left", /(?:^|[\s:.[!])-?(?:left|start|inset|inset-x)-/)
|
|
2829
3239
|
};
|
|
2830
3240
|
}
|
|
2831
|
-
function
|
|
3241
|
+
function qn(e) {
|
|
2832
3242
|
switch (e) {
|
|
2833
3243
|
case "double": return "double";
|
|
2834
3244
|
case "dashed": return "dashed";
|
|
@@ -2836,7 +3246,7 @@ function Dn(e) {
|
|
|
2836
3246
|
default: return "solid";
|
|
2837
3247
|
}
|
|
2838
3248
|
}
|
|
2839
|
-
function
|
|
3249
|
+
function Jn(e, t) {
|
|
2840
3250
|
if (!e || e === "none" || e === "auto") return;
|
|
2841
3251
|
if (e === "min-content" || e === "max-content" || e === "fit-content") return e;
|
|
2842
3252
|
if (e.endsWith("%")) {
|
|
@@ -2855,18 +3265,24 @@ function $(e, t) {
|
|
|
2855
3265
|
let n = parseFloat(e);
|
|
2856
3266
|
return Number.isFinite(n) ? p(n, t) : 0;
|
|
2857
3267
|
}
|
|
2858
|
-
function
|
|
2859
|
-
let
|
|
3268
|
+
function Yn(e, t) {
|
|
3269
|
+
let n = e.textIndent;
|
|
3270
|
+
if (!n || n.endsWith("%")) return 0;
|
|
3271
|
+
let r = parseFloat(n);
|
|
3272
|
+
return Number.isFinite(r) ? Math.max(0, p(r, t)) : 0;
|
|
3273
|
+
}
|
|
3274
|
+
function Xn(e, t, n, r, i, a, o) {
|
|
3275
|
+
let s = Zn(n === "width" ? a.width : a.height);
|
|
2860
3276
|
if (s !== null) return {
|
|
2861
3277
|
kind: "cells",
|
|
2862
|
-
value:
|
|
3278
|
+
value: $n(s, n, o, r)
|
|
2863
3279
|
};
|
|
2864
|
-
let c =
|
|
3280
|
+
let c = Qn(i, n === "width" ? "w" : "h");
|
|
2865
3281
|
if (c !== null) {
|
|
2866
3282
|
let i = parseFloat(e ? String(e.get(n) ?? "") : t), a = Number.isFinite(i) && Math.abs(i - c) <= c * .3;
|
|
2867
3283
|
if (a || !Number.isFinite(i)) return {
|
|
2868
3284
|
kind: "cells",
|
|
2869
|
-
value:
|
|
3285
|
+
value: $n(a ? i : c, n, o, r)
|
|
2870
3286
|
};
|
|
2871
3287
|
}
|
|
2872
3288
|
if (e) {
|
|
@@ -2874,7 +3290,7 @@ function kn(e, t, n, r, i, a, o) {
|
|
|
2874
3290
|
if (t == null) return;
|
|
2875
3291
|
let i = t.toString().trim();
|
|
2876
3292
|
if (i === "auto") return { kind: "auto" };
|
|
2877
|
-
let a =
|
|
3293
|
+
let a = nr(i);
|
|
2878
3294
|
if (a) return a;
|
|
2879
3295
|
if (i.endsWith("%")) return {
|
|
2880
3296
|
kind: "percent",
|
|
@@ -2888,16 +3304,16 @@ function kn(e, t, n, r, i, a, o) {
|
|
|
2888
3304
|
kind: "cells",
|
|
2889
3305
|
value: f(parseFloat(i) / .25)
|
|
2890
3306
|
};
|
|
2891
|
-
let s =
|
|
3307
|
+
let s = Zn(i);
|
|
2892
3308
|
if (s !== null) return {
|
|
2893
3309
|
kind: "cells",
|
|
2894
|
-
value:
|
|
3310
|
+
value: $n(s, n, o, r)
|
|
2895
3311
|
};
|
|
2896
3312
|
}
|
|
2897
3313
|
let l = n === "width" ? a.width : a.height;
|
|
2898
3314
|
if (l) {
|
|
2899
3315
|
if (l === "auto") return { kind: "auto" };
|
|
2900
|
-
let e =
|
|
3316
|
+
let e = nr(l);
|
|
2901
3317
|
if (e) return e;
|
|
2902
3318
|
if (l.endsWith("%")) return {
|
|
2903
3319
|
kind: "percent",
|
|
@@ -2932,7 +3348,7 @@ function kn(e, t, n, r, i, a, o) {
|
|
|
2932
3348
|
kind: "cells",
|
|
2933
3349
|
value: f(Number(h[1]))
|
|
2934
3350
|
};
|
|
2935
|
-
if (!
|
|
3351
|
+
if (!mr(i, u) || t === "auto") return { kind: "auto" };
|
|
2936
3352
|
if (t.endsWith("%")) return {
|
|
2937
3353
|
kind: "percent",
|
|
2938
3354
|
value: parseFloat(t)
|
|
@@ -2943,7 +3359,7 @@ function kn(e, t, n, r, i, a, o) {
|
|
|
2943
3359
|
value: p(g, r)
|
|
2944
3360
|
};
|
|
2945
3361
|
}
|
|
2946
|
-
function
|
|
3362
|
+
function Zn(e) {
|
|
2947
3363
|
let t = /^(-?[\d.]+)((?:[dsl]?v)(?:h|w|min|max)|vi|vb)$/.exec(e.trim());
|
|
2948
3364
|
if (!t || typeof window > "u") return null;
|
|
2949
3365
|
let n = parseFloat(t[1]);
|
|
@@ -2951,7 +3367,7 @@ function An(e) {
|
|
|
2951
3367
|
let r = t[2], i = window.innerHeight, a = window.innerWidth, o = r.endsWith("h") ? i : r.endsWith("min") ? Math.min(a, i) : r.endsWith("max") ? Math.max(a, i) : r === "vb" ? i : a;
|
|
2952
3368
|
return n / 100 * o;
|
|
2953
3369
|
}
|
|
2954
|
-
function
|
|
3370
|
+
function Qn(e, t) {
|
|
2955
3371
|
if (typeof window > "u") return null;
|
|
2956
3372
|
let n = RegExp(`(?:^|[\\s:.[!])${t}-(screen|[dsl]v[hw])(?![\\w-])`).exec(e);
|
|
2957
3373
|
if (n) {
|
|
@@ -2959,23 +3375,23 @@ function jn(e, t) {
|
|
|
2959
3375
|
return e === "screen" ? t.includes("h") ? window.innerHeight : window.innerWidth : e.endsWith("h") ? window.innerHeight : window.innerWidth;
|
|
2960
3376
|
}
|
|
2961
3377
|
let r = RegExp(`(?:^|[\\s:.[!])${t}-\\[(-?[\\d.]+(?:[dsl]?v(?:h|w|min|max)|vi|vb))\\]`).exec(e);
|
|
2962
|
-
return r ?
|
|
3378
|
+
return r ? Zn(r[1]) : null;
|
|
2963
3379
|
}
|
|
2964
|
-
function
|
|
3380
|
+
function $n(e, t, n, r) {
|
|
2965
3381
|
let i = t === "width" ? n?.width : n?.height;
|
|
2966
3382
|
return i && i > 0 ? Math.max(0, Math.floor(e / i)) : p(e, r);
|
|
2967
3383
|
}
|
|
2968
|
-
function
|
|
2969
|
-
let c = t.endsWith("width") ? "width" : "height", l =
|
|
2970
|
-
if (l !== null) return
|
|
2971
|
-
let u =
|
|
3384
|
+
function er(e, t, n, r, i, a, o, s) {
|
|
3385
|
+
let c = t.endsWith("width") ? "width" : "height", l = Zn(a.getPropertyValue(t)) ?? Zn(e?.get(t)?.toString().trim() ?? "");
|
|
3386
|
+
if (l !== null) return $n(l, c, o, s);
|
|
3387
|
+
let u = Qn(r, i);
|
|
2972
3388
|
if (u === null) return;
|
|
2973
3389
|
let d = parseFloat(e ? String(e.get(t) ?? "") : n), f = Number.isFinite(d) && Math.abs(d - u) <= u * .3;
|
|
2974
|
-
if (!(!f && Number.isFinite(d))) return
|
|
3390
|
+
if (!(!f && Number.isFinite(d))) return $n(f ? d : u, c, o, s);
|
|
2975
3391
|
}
|
|
2976
|
-
function
|
|
3392
|
+
function tr(e, t) {
|
|
2977
3393
|
if (!e || e === "auto" || e === "content") return;
|
|
2978
|
-
let n =
|
|
3394
|
+
let n = nr(e);
|
|
2979
3395
|
if (n) return n;
|
|
2980
3396
|
if (e.endsWith("%")) {
|
|
2981
3397
|
let t = parseFloat(e);
|
|
@@ -2990,27 +3406,27 @@ function Pn(e, t) {
|
|
|
2990
3406
|
value: p(r, t)
|
|
2991
3407
|
} : void 0;
|
|
2992
3408
|
}
|
|
2993
|
-
function
|
|
3409
|
+
function nr(e) {
|
|
2994
3410
|
if (e === "min-content") return { kind: "min-content" };
|
|
2995
3411
|
if (e === "max-content") return { kind: "max-content" };
|
|
2996
3412
|
if (e === "fit-content") return { kind: "fit-content" };
|
|
2997
3413
|
}
|
|
2998
|
-
function
|
|
3414
|
+
function rr(e, t) {
|
|
2999
3415
|
let n = e.trim();
|
|
3000
3416
|
if (!n || n === "none") return { kind: "none" };
|
|
3001
3417
|
if (n === "subgrid" || n.startsWith("subgrid ")) return { kind: "subgrid" };
|
|
3002
3418
|
let r = [], i = [], a = [], o = (e) => {
|
|
3003
3419
|
i.push(a), a = [], r.push(e);
|
|
3004
3420
|
}, s;
|
|
3005
|
-
for (let e of
|
|
3006
|
-
let n =
|
|
3421
|
+
for (let e of dr(n)) {
|
|
3422
|
+
let n = ar(e);
|
|
3007
3423
|
if (n) {
|
|
3008
3424
|
a.push(...n);
|
|
3009
3425
|
continue;
|
|
3010
3426
|
}
|
|
3011
3427
|
let i = e.match(/^repeat\(\s*([^,]+?)\s*,(.*)\)$/s);
|
|
3012
3428
|
if (i) {
|
|
3013
|
-
let e =
|
|
3429
|
+
let e = ir(i[2].trim(), t);
|
|
3014
3430
|
if (e.tracks.length === 0) continue;
|
|
3015
3431
|
let n = i[1];
|
|
3016
3432
|
if (n === "auto-fill" || n === "auto-fit") {
|
|
@@ -3028,7 +3444,7 @@ function In(e, t) {
|
|
|
3028
3444
|
}
|
|
3029
3445
|
continue;
|
|
3030
3446
|
}
|
|
3031
|
-
o(
|
|
3447
|
+
o(cr(e, t));
|
|
3032
3448
|
}
|
|
3033
3449
|
if (i.push(a), r.length === 0 && !s) return { kind: "none" };
|
|
3034
3450
|
let c = {
|
|
@@ -3037,26 +3453,26 @@ function In(e, t) {
|
|
|
3037
3453
|
};
|
|
3038
3454
|
return i.some((e) => e.length > 0) && (c.lineNames = i), s && (c.autoRepeat = s), c;
|
|
3039
3455
|
}
|
|
3040
|
-
function
|
|
3456
|
+
function ir(e, t) {
|
|
3041
3457
|
let n = [], r = [], i = [];
|
|
3042
|
-
for (let a of
|
|
3043
|
-
let e =
|
|
3458
|
+
for (let a of dr(e)) {
|
|
3459
|
+
let e = ar(a);
|
|
3044
3460
|
if (e) {
|
|
3045
3461
|
i.push(...e);
|
|
3046
3462
|
continue;
|
|
3047
3463
|
}
|
|
3048
|
-
r.push(i), i = [], n.push(
|
|
3464
|
+
r.push(i), i = [], n.push(cr(a, t));
|
|
3049
3465
|
}
|
|
3050
3466
|
return r.push(i), {
|
|
3051
3467
|
tracks: n,
|
|
3052
3468
|
lineNames: r
|
|
3053
3469
|
};
|
|
3054
3470
|
}
|
|
3055
|
-
function
|
|
3471
|
+
function ar(e) {
|
|
3056
3472
|
let t = e.match(/^\[(.*)\]$/s);
|
|
3057
3473
|
return t ? t[1].split(/\s+/).filter((e) => e !== "") : null;
|
|
3058
3474
|
}
|
|
3059
|
-
function
|
|
3475
|
+
function or(e) {
|
|
3060
3476
|
let t = [];
|
|
3061
3477
|
for (let n of e.matchAll(/"([^"]*)"|'([^']*)'/g)) {
|
|
3062
3478
|
let e = (n[1] ?? n[2] ?? "").trim().split(/\s+/).filter((e) => e !== "");
|
|
@@ -3086,23 +3502,23 @@ function zn(e) {
|
|
|
3086
3502
|
areas: r
|
|
3087
3503
|
};
|
|
3088
3504
|
}
|
|
3089
|
-
function
|
|
3090
|
-
let n =
|
|
3091
|
-
return n.length > 0 ? n : [
|
|
3505
|
+
function sr(e, t) {
|
|
3506
|
+
let n = dr(e.trim()).filter((e) => e !== "" && !e.startsWith("[")).map((e) => cr(e, t));
|
|
3507
|
+
return n.length > 0 ? n : [fe()];
|
|
3092
3508
|
}
|
|
3093
|
-
function
|
|
3509
|
+
function cr(e, t) {
|
|
3094
3510
|
let n = e.match(/^minmax\((.*)\)$/s);
|
|
3095
3511
|
if (n) {
|
|
3096
|
-
let e =
|
|
3512
|
+
let e = ur(n[1]).map((e) => e.trim());
|
|
3097
3513
|
return e.length === 2 ? {
|
|
3098
|
-
min:
|
|
3099
|
-
max:
|
|
3514
|
+
min: lr(e[0], t),
|
|
3515
|
+
max: lr(e[1], t)
|
|
3100
3516
|
} : {
|
|
3101
3517
|
min: { kind: "auto" },
|
|
3102
3518
|
max: { kind: "auto" }
|
|
3103
3519
|
};
|
|
3104
3520
|
}
|
|
3105
|
-
let r =
|
|
3521
|
+
let r = lr(e, t);
|
|
3106
3522
|
return r.kind === "fr" ? {
|
|
3107
3523
|
min: { kind: "auto" },
|
|
3108
3524
|
max: r
|
|
@@ -3111,13 +3527,13 @@ function Vn(e, t) {
|
|
|
3111
3527
|
max: r
|
|
3112
3528
|
};
|
|
3113
3529
|
}
|
|
3114
|
-
function
|
|
3530
|
+
function lr(e, t) {
|
|
3115
3531
|
if (e === "auto" || e.startsWith("fit-content")) return { kind: "auto" };
|
|
3116
3532
|
if (e === "min-content") return { kind: "min-content" };
|
|
3117
3533
|
if (e === "max-content") return { kind: "max-content" };
|
|
3118
3534
|
let n = e.match(/^(min|max)\((.*)\)$/s);
|
|
3119
3535
|
if (n) {
|
|
3120
|
-
let e =
|
|
3536
|
+
let e = ur(n[2]).map((e) => lr(e.trim(), t)), r = e.every((e) => e.kind === "cells" || e.kind === "percent" || e.kind === "math");
|
|
3121
3537
|
return e.length > 0 && r ? {
|
|
3122
3538
|
kind: "math",
|
|
3123
3539
|
fn: n[1],
|
|
@@ -3144,7 +3560,7 @@ function Hn(e, t) {
|
|
|
3144
3560
|
value: e.endsWith("rem") ? f(r / .25) : p(r, t)
|
|
3145
3561
|
} : { kind: "auto" };
|
|
3146
3562
|
}
|
|
3147
|
-
function
|
|
3563
|
+
function ur(e) {
|
|
3148
3564
|
let t = [], n = 0, r = 0;
|
|
3149
3565
|
for (let i = 0; i < e.length; i++) {
|
|
3150
3566
|
let a = e[i];
|
|
@@ -3152,7 +3568,7 @@ function Un(e) {
|
|
|
3152
3568
|
}
|
|
3153
3569
|
return t.push(e.slice(r)), t.filter((e) => e.trim() !== "");
|
|
3154
3570
|
}
|
|
3155
|
-
function
|
|
3571
|
+
function dr(e) {
|
|
3156
3572
|
let t = [], n = 0, r = -1;
|
|
3157
3573
|
for (let i = 0; i < e.length; i++) {
|
|
3158
3574
|
let a = e[i];
|
|
@@ -3160,7 +3576,7 @@ function Wn(e) {
|
|
|
3160
3576
|
}
|
|
3161
3577
|
return r !== -1 && t.push(e.slice(r)), t;
|
|
3162
3578
|
}
|
|
3163
|
-
function
|
|
3579
|
+
function fr(e) {
|
|
3164
3580
|
let t = e.trim();
|
|
3165
3581
|
if (!t || t === "auto") return { kind: "auto" };
|
|
3166
3582
|
let n = !1, r, i;
|
|
@@ -3188,16 +3604,16 @@ function Gn(e) {
|
|
|
3188
3604
|
nth: r
|
|
3189
3605
|
};
|
|
3190
3606
|
}
|
|
3191
|
-
function
|
|
3607
|
+
function pr(e) {
|
|
3192
3608
|
return {
|
|
3193
3609
|
direction: e.includes("column") ? "column" : "row",
|
|
3194
3610
|
dense: e.includes("dense")
|
|
3195
3611
|
};
|
|
3196
3612
|
}
|
|
3197
|
-
function
|
|
3613
|
+
function mr(e, t) {
|
|
3198
3614
|
return (t === "w" ? /(?:^|[\s:.[!])w-/ : /(?:^|[\s:.[!])h-/).test(e);
|
|
3199
3615
|
}
|
|
3200
|
-
function
|
|
3616
|
+
function hr(e, t) {
|
|
3201
3617
|
return {
|
|
3202
3618
|
top: $(e.getPropertyValue("padding-top"), t),
|
|
3203
3619
|
right: $(e.getPropertyValue("padding-right"), t),
|
|
@@ -3205,7 +3621,7 @@ function Jn(e, t) {
|
|
|
3205
3621
|
left: $(e.getPropertyValue("padding-left"), t)
|
|
3206
3622
|
};
|
|
3207
3623
|
}
|
|
3208
|
-
function
|
|
3624
|
+
function gr(e) {
|
|
3209
3625
|
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 : f(parseFloat(e.getPropertyValue(t)) || 0);
|
|
3210
3626
|
return {
|
|
3211
3627
|
top: t("border-top-width", "border-top-style"),
|
|
@@ -3216,12 +3632,12 @@ function Yn(e) {
|
|
|
3216
3632
|
}
|
|
3217
3633
|
//#endregion
|
|
3218
3634
|
//#region src/tree.ts
|
|
3219
|
-
function
|
|
3220
|
-
let i =
|
|
3635
|
+
function _r(e, t, n, r) {
|
|
3636
|
+
let i = Tn(e, t, n);
|
|
3221
3637
|
if (i.display === "none") return null;
|
|
3222
|
-
let a = Array.from(e.children), o = a.map(
|
|
3638
|
+
let a = Array.from(e.children), o = a.map(Sr), s = e.tagName, c = Nr(s);
|
|
3223
3639
|
if (!o.includes("block") || c) {
|
|
3224
|
-
let l =
|
|
3640
|
+
let l = Cr(e, i.tracking, {
|
|
3225
3641
|
rootFontSizePx: t,
|
|
3226
3642
|
rootLetterSpacingPx: n?.letterSpacing ?? 0,
|
|
3227
3643
|
cellMetrics: n,
|
|
@@ -3230,12 +3646,12 @@ function Xn(e, t, n, r) {
|
|
|
3230
3646
|
tabSize: i.tabSize
|
|
3231
3647
|
}), u = l.chars.join("");
|
|
3232
3648
|
if (l.boxes.length > 0) {
|
|
3233
|
-
let e =
|
|
3649
|
+
let e = Ht();
|
|
3234
3650
|
E(l.chars, (t, n) => {
|
|
3235
|
-
l.advances[t] = Math.max(1,
|
|
3651
|
+
l.advances[t] = Math.max(1, J(l.boxes[n], e));
|
|
3236
3652
|
});
|
|
3237
3653
|
}
|
|
3238
|
-
let d =
|
|
3654
|
+
let d = Or(u, l.advances, i.tracking);
|
|
3239
3655
|
if (c && d === 0) {
|
|
3240
3656
|
if (s === "INPUT") d = Number(e.size) || 20;
|
|
3241
3657
|
else if (s === "TEXTAREA") d = Number(e.cols) || 20;
|
|
@@ -3244,7 +3660,7 @@ function Xn(e, t, n, r) {
|
|
|
3244
3660
|
d = Math.max(1, ...r.map((e) => e.trim().length));
|
|
3245
3661
|
}
|
|
3246
3662
|
}
|
|
3247
|
-
let f = u.length > 0 ?
|
|
3663
|
+
let f = u.length > 0 ? kr(u) : 0, p;
|
|
3248
3664
|
if (s === "TEXTAREA") {
|
|
3249
3665
|
let t = e, n = t.value ?? "", a = r?.get(t), o = +!!n.endsWith("\n"), s = a !== void 0 && a > 0 ? v(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);
|
|
3250
3666
|
p = l + Math.max(0, l - 1) * i.lineGap;
|
|
@@ -3256,7 +3672,7 @@ function Xn(e, t, n, r) {
|
|
|
3256
3672
|
let i = a[e], s = m.get(i);
|
|
3257
3673
|
if (s) g.push(s);
|
|
3258
3674
|
else if (o[e] === "out-of-flow") {
|
|
3259
|
-
let e =
|
|
3675
|
+
let e = _r(i, t, n, r);
|
|
3260
3676
|
e && g.push(e);
|
|
3261
3677
|
}
|
|
3262
3678
|
}
|
|
@@ -3275,14 +3691,14 @@ function Xn(e, t, n, r) {
|
|
|
3275
3691
|
height: p
|
|
3276
3692
|
},
|
|
3277
3693
|
unclampedHeight: 0,
|
|
3278
|
-
resolvedPadding:
|
|
3694
|
+
resolvedPadding: R()
|
|
3279
3695
|
};
|
|
3280
3696
|
return (l.advances.some((e) => e !== 1) || l.boxes.length > 0) && (_.advances = l.advances), l.inlineElements.length > 0 && (_.inlineElements = l.inlineElements, _.charInline = l.chars.map((e, t) => l.inlineIndex[t] ?? -1)), _;
|
|
3281
3697
|
}
|
|
3282
3698
|
let l = [];
|
|
3283
3699
|
for (let e = 0; e < a.length; e++) {
|
|
3284
3700
|
if (o[e] === "none") continue;
|
|
3285
|
-
let i =
|
|
3701
|
+
let i = _r(a[e], t, n, r);
|
|
3286
3702
|
i && l.push(i);
|
|
3287
3703
|
}
|
|
3288
3704
|
let u = {
|
|
@@ -3299,27 +3715,27 @@ function Xn(e, t, n, r) {
|
|
|
3299
3715
|
height: 0
|
|
3300
3716
|
},
|
|
3301
3717
|
unclampedHeight: 0,
|
|
3302
|
-
resolvedPadding:
|
|
3718
|
+
resolvedPadding: R()
|
|
3303
3719
|
};
|
|
3304
|
-
return
|
|
3720
|
+
return Pr(e, u), u;
|
|
3305
3721
|
}
|
|
3306
|
-
var
|
|
3307
|
-
function
|
|
3308
|
-
return t || (
|
|
3722
|
+
var vr = /* @__PURE__ */ new Set(/* @__PURE__ */ "A.ABBR.B.BDI.BDO.BR.CITE.CODE.DATA.DFN.EM.I.KBD.MARK.Q.S.SAMP.SMALL.SPAN.STRONG.SUB.SUP.TIME.U.VAR.WBR".split("."));
|
|
3723
|
+
function yr(e, t) {
|
|
3724
|
+
return t || (vr.has(e.tagName) ? "inline" : "block");
|
|
3309
3725
|
}
|
|
3310
|
-
function
|
|
3311
|
-
let n =
|
|
3726
|
+
function br(e, t) {
|
|
3727
|
+
let n = yr(e, t);
|
|
3312
3728
|
return n === "inline" || n === "contents";
|
|
3313
3729
|
}
|
|
3314
|
-
function
|
|
3315
|
-
let n =
|
|
3730
|
+
function xr(e, t) {
|
|
3731
|
+
let n = yr(e, t);
|
|
3316
3732
|
return n.startsWith("inline") && n !== "inline";
|
|
3317
3733
|
}
|
|
3318
|
-
function
|
|
3734
|
+
function Sr(e) {
|
|
3319
3735
|
let t = getComputedStyle(e);
|
|
3320
|
-
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" :
|
|
3736
|
+
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" : br(e, t.display) || xr(e, t.display) ? "inline" : "block";
|
|
3321
3737
|
}
|
|
3322
|
-
function
|
|
3738
|
+
function Cr(e, t, n) {
|
|
3323
3739
|
let r = {
|
|
3324
3740
|
chars: [],
|
|
3325
3741
|
advances: [],
|
|
@@ -3327,15 +3743,15 @@ function nr(e, t, n) {
|
|
|
3327
3743
|
inlineElements: [],
|
|
3328
3744
|
boxes: []
|
|
3329
3745
|
};
|
|
3330
|
-
return
|
|
3746
|
+
return wr(e, t, n, r), n.preserve ? r : Dr(r);
|
|
3331
3747
|
}
|
|
3332
|
-
function
|
|
3748
|
+
function wr(e, t, n, r) {
|
|
3333
3749
|
let i = () => {
|
|
3334
3750
|
let e = 0;
|
|
3335
3751
|
for (let t = r.chars.length - 1; t >= 0 && r.chars[t] !== "\n"; t--) e += r.advances[t];
|
|
3336
3752
|
return e;
|
|
3337
3753
|
};
|
|
3338
|
-
if (!
|
|
3754
|
+
if (!Nr(e.tagName)) {
|
|
3339
3755
|
for (let a of Array.from(e.childNodes)) if (a.nodeType === Node.TEXT_NODE) {
|
|
3340
3756
|
if (n.preserve) for (let e of (a.textContent ?? "").replace(/\r\n?/g, "\n")) if (e === "\n") r.chars.push("\n"), r.advances.push(0);
|
|
3341
3757
|
else if (e === " ") {
|
|
@@ -3351,24 +3767,24 @@ function rr(e, t, n, r) {
|
|
|
3351
3767
|
}
|
|
3352
3768
|
let t = getComputedStyle(e);
|
|
3353
3769
|
if (t.display === "none" || t.position === "absolute" || t.position === "fixed") continue;
|
|
3354
|
-
if (
|
|
3355
|
-
let t =
|
|
3770
|
+
if (xr(e, t.display)) {
|
|
3771
|
+
let t = _r(e, n.rootFontSizePx, n.cellMetrics, n.textareaWidths);
|
|
3356
3772
|
t && (t.inlineBox = !0, r.chars.push(""), r.advances.push(1), r.boxes.push(t));
|
|
3357
3773
|
continue;
|
|
3358
3774
|
}
|
|
3359
|
-
if (
|
|
3360
|
-
|
|
3775
|
+
if (!br(e, t.display)) {
|
|
3776
|
+
Ar(e);
|
|
3361
3777
|
continue;
|
|
3362
3778
|
}
|
|
3363
|
-
let i =
|
|
3779
|
+
let i = Un(t.letterSpacing, parseFloat(t.fontSize) || n.rootFontSizePx, n.rootLetterSpacingPx), o = Tr(t.paddingLeft, n.rootFontSizePx), s = Tr(t.paddingRight, n.rootFontSizePx);
|
|
3364
3780
|
r.inlineElements.push({
|
|
3365
3781
|
element: e,
|
|
3366
3782
|
tracking: i,
|
|
3367
3783
|
padLeft: o,
|
|
3368
3784
|
padRight: s,
|
|
3369
|
-
insets: t.position === "static" ? null :
|
|
3785
|
+
insets: t.position === "static" ? null : Er(t, n.rootFontSizePx),
|
|
3370
3786
|
color: t.color,
|
|
3371
|
-
backgroundColor:
|
|
3787
|
+
backgroundColor: Dn(t.backgroundColor) ? void 0 : t.backgroundColor,
|
|
3372
3788
|
fontWeight: t.fontWeight,
|
|
3373
3789
|
fontStyle: t.fontStyle,
|
|
3374
3790
|
textDecorationLine: t.textDecorationLine
|
|
@@ -3376,18 +3792,18 @@ function rr(e, t, n, r) {
|
|
|
3376
3792
|
let c = r.inlineElements.length - 1;
|
|
3377
3793
|
for (let e = 0; e < o; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
3378
3794
|
let l = r.chars.length;
|
|
3379
|
-
|
|
3795
|
+
wr(e, i, n, r);
|
|
3380
3796
|
for (let e = l; e < r.chars.length; e++) r.inlineIndex[e] === void 0 && (r.inlineIndex[e] = c);
|
|
3381
3797
|
for (let e = 0; e < s; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
3382
3798
|
}
|
|
3383
3799
|
}
|
|
3384
3800
|
}
|
|
3385
|
-
function
|
|
3801
|
+
function Tr(e, t) {
|
|
3386
3802
|
if (!e || e.endsWith("%")) return 0;
|
|
3387
3803
|
let n = parseFloat(e);
|
|
3388
3804
|
return Number.isFinite(n) ? Math.max(0, p(n, t)) : 0;
|
|
3389
3805
|
}
|
|
3390
|
-
function
|
|
3806
|
+
function Er(e, t) {
|
|
3391
3807
|
let n = (e) => {
|
|
3392
3808
|
if (!e || e === "auto" || e.endsWith("%")) return null;
|
|
3393
3809
|
let n = parseFloat(e);
|
|
@@ -3400,7 +3816,7 @@ function ar(e, t) {
|
|
|
3400
3816
|
left: n(e.left)
|
|
3401
3817
|
};
|
|
3402
3818
|
}
|
|
3403
|
-
function
|
|
3819
|
+
function Dr(e) {
|
|
3404
3820
|
let t = [], n = [], r = [], i = () => {
|
|
3405
3821
|
let e = t.length;
|
|
3406
3822
|
for (; e > 0 && t[e - 1] !== "\n";) e--;
|
|
@@ -3425,37 +3841,37 @@ function or(e) {
|
|
|
3425
3841
|
boxes: e.boxes
|
|
3426
3842
|
};
|
|
3427
3843
|
}
|
|
3428
|
-
function
|
|
3844
|
+
function Or(e, t, n) {
|
|
3429
3845
|
let r = 0, i = 0;
|
|
3430
3846
|
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r, C(i, a, t, n)), i = a + 1);
|
|
3431
3847
|
return r;
|
|
3432
3848
|
}
|
|
3433
|
-
function
|
|
3849
|
+
function kr(e) {
|
|
3434
3850
|
return b(e).length;
|
|
3435
3851
|
}
|
|
3436
|
-
function
|
|
3437
|
-
|
|
3852
|
+
function Ar(e) {
|
|
3853
|
+
at(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.");
|
|
3438
3854
|
}
|
|
3439
|
-
function
|
|
3855
|
+
function jr(e) {
|
|
3440
3856
|
return Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? ""));
|
|
3441
3857
|
}
|
|
3442
|
-
var
|
|
3443
|
-
function
|
|
3858
|
+
var Mr = "Direct text next to block-level children can't be laid out and was hidden. Wrap each text segment in its own element (e.g. a <div>).";
|
|
3859
|
+
function Nr(e) {
|
|
3444
3860
|
return e === "INPUT" || e === "SELECT" || e === "TEXTAREA";
|
|
3445
3861
|
}
|
|
3446
|
-
function
|
|
3447
|
-
|
|
3862
|
+
function Pr(e, t) {
|
|
3863
|
+
jr(e) && (t.droppedText = !0, at(e, Mr));
|
|
3448
3864
|
}
|
|
3449
3865
|
//#endregion
|
|
3450
3866
|
//#region src/element.ts
|
|
3451
|
-
var
|
|
3867
|
+
var Fr = "\n<style>\n :host { display: block; position: relative; contain: layout style; }\n #viewport { position: relative; width: 100%; height: 100%; }\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 #grid { position: absolute; inset: 0; margin: 0; 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 /* Full invert on selection (TUI-native, matches focus-visible).\n * Both fields spelled out — setting only color makes some engines\n * drop the OS default background. */\n ::selection { color: 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", Ir = "grid", Lr = [
|
|
3452
3868
|
"pointerover",
|
|
3453
3869
|
"pointerleave",
|
|
3454
3870
|
"focusin",
|
|
3455
3871
|
"focusout",
|
|
3456
3872
|
"input",
|
|
3457
3873
|
"change"
|
|
3458
|
-
],
|
|
3874
|
+
], Rr = typeof HTMLElement > "u" ? class {} : HTMLElement, zr = class e extends Rr {
|
|
3459
3875
|
static observedAttributes = ["select"];
|
|
3460
3876
|
static #e = /* @__PURE__ */ new Set();
|
|
3461
3877
|
static #t = null;
|
|
@@ -3490,10 +3906,10 @@ var mr = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
3490
3906
|
#f = null;
|
|
3491
3907
|
#p = null;
|
|
3492
3908
|
constructor() {
|
|
3493
|
-
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML =
|
|
3909
|
+
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML = Fr, 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);
|
|
3494
3910
|
}
|
|
3495
3911
|
connectedCallback() {
|
|
3496
|
-
this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#y()), this.#l.observe(this), window.addEventListener("resize", this.#h), this.#u = new MutationObserver(() => this.#y()), this.#u.observe(this, {
|
|
3912
|
+
this.hasAttribute("select") || this.setAttribute("select", Ir), this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#y()), this.#l.observe(this), this.#l.observe(this.#c), window.addEventListener("resize", this.#h), this.#u = new MutationObserver(() => this.#y()), this.#u.observe(this, {
|
|
3497
3913
|
childList: !0,
|
|
3498
3914
|
subtree: !0,
|
|
3499
3915
|
characterData: !0,
|
|
@@ -3508,12 +3924,12 @@ var mr = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
3508
3924
|
}), document.fonts?.ready.then(this.#g).catch((e) => {
|
|
3509
3925
|
console.warn("[monowind] document.fonts.ready failed:", e);
|
|
3510
3926
|
}), document.fonts?.addEventListener("loadingdone", this.#g);
|
|
3511
|
-
for (let e of
|
|
3927
|
+
for (let e of Lr) this.addEventListener(e, this.#m);
|
|
3512
3928
|
e.#i(this), this.#y();
|
|
3513
3929
|
}
|
|
3514
3930
|
disconnectedCallback() {
|
|
3515
3931
|
window.removeEventListener("resize", this.#h), this.#l?.disconnect(), this.#u?.disconnect(), this.#l = null, this.#u = null, document.fonts?.removeEventListener("loadingdone", this.#g);
|
|
3516
|
-
for (let e of
|
|
3932
|
+
for (let e of Lr) this.removeEventListener(e, this.#m);
|
|
3517
3933
|
e.#a(this);
|
|
3518
3934
|
}
|
|
3519
3935
|
#m = (e) => {
|
|
@@ -3524,10 +3940,14 @@ var mr = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
3524
3940
|
this.#y();
|
|
3525
3941
|
};
|
|
3526
3942
|
attributeChangedCallback(e, t, n) {
|
|
3527
|
-
e === "select" && n !==
|
|
3943
|
+
if (e === "select" && n !== "text" && n !== "grid") {
|
|
3944
|
+
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`, this), this.setAttribute("select", Ir);
|
|
3945
|
+
return;
|
|
3946
|
+
}
|
|
3947
|
+
this.#y();
|
|
3528
3948
|
}
|
|
3529
3949
|
toPlainText() {
|
|
3530
|
-
return this.#d && this.#b(), this.#p ?
|
|
3950
|
+
return this.#d && this.#b(), this.#p ? sn(this.#p) : "";
|
|
3531
3951
|
}
|
|
3532
3952
|
#h = () => {
|
|
3533
3953
|
this.#y();
|
|
@@ -3569,23 +3989,24 @@ var mr = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
3569
3989
|
}
|
|
3570
3990
|
this.setAttribute("measuring", "");
|
|
3571
3991
|
try {
|
|
3992
|
+
this.#c.parentNode !== this && this.appendChild(this.#c);
|
|
3572
3993
|
let t = h(this, this.#c), n = this.#f;
|
|
3573
|
-
(n === null || n.width !== t.width || n.height !== t.height || n.letterSpacing !== t.letterSpacing) && (this.style.setProperty("--mw-cw", `${t.width}px`), this.style.setProperty("--mw-ch", `${t.height}px`), this.style.setProperty("--mw-rls", `${t.letterSpacing}px`)), this.#f = t;
|
|
3994
|
+
(n === null || n.width !== t.width || n.height !== t.height || n.letterSpacing !== t.letterSpacing || n.inkOverhang !== t.inkOverhang) && (this.style.setProperty("--mw-cw", `${t.width}px`), this.style.setProperty("--mw-ch", `${t.height}px`), this.style.setProperty("--mw-rls", `${t.letterSpacing}px`), this.style.setProperty("--mw-ink", `${t.inkOverhang ?? 0}px`)), this.#f = t;
|
|
3574
3995
|
let r = getComputedStyle(this), i = (parseFloat(r.paddingLeft) || 0) + (parseFloat(r.paddingRight) || 0), a = Math.max(0, Math.floor((this.clientWidth - i) / t.width));
|
|
3575
3996
|
if (a === 0) return;
|
|
3576
3997
|
let o = g(), s = [];
|
|
3577
3998
|
for (let n of Array.from(this.children)) {
|
|
3578
3999
|
if (n === this.#c) continue;
|
|
3579
|
-
let r =
|
|
4000
|
+
let r = _r(n, o, t, e);
|
|
3580
4001
|
r && s.push(r);
|
|
3581
4002
|
}
|
|
3582
|
-
if (
|
|
4003
|
+
if (jr(this) ? (this.hasAttribute("data-mw-dropped-text") || console.warn(`[monowind] ${Mr}`, this), this.setAttribute("data-mw-dropped-text", "")) : this.removeAttribute("data-mw-dropped-text"), s.length === 0) {
|
|
3583
4004
|
this.#s.replaceChildren(), this.#p = null, this.setAttribute("data-mw-ready", "");
|
|
3584
4005
|
return;
|
|
3585
4006
|
}
|
|
3586
4007
|
let c = {
|
|
3587
4008
|
source: this,
|
|
3588
|
-
style:
|
|
4009
|
+
style: de(),
|
|
3589
4010
|
children: s,
|
|
3590
4011
|
text: "",
|
|
3591
4012
|
intrinsicWidth: 0,
|
|
@@ -3597,9 +4018,9 @@ var mr = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
3597
4018
|
height: 0
|
|
3598
4019
|
},
|
|
3599
4020
|
unclampedHeight: 0,
|
|
3600
|
-
resolvedPadding:
|
|
3601
|
-
}, { height: l } =
|
|
3602
|
-
|
|
4021
|
+
resolvedPadding: R()
|
|
4022
|
+
}, { height: l } = Bt(c, a);
|
|
4023
|
+
bn(c), vn(c, this.#s), this.#p = c;
|
|
3603
4024
|
let u = r.boxSizing === "border-box" ? (parseFloat(r.paddingTop) || 0) + (parseFloat(r.paddingBottom) || 0) + (parseFloat(r.borderTopWidth) || 0) + (parseFloat(r.borderBottomWidth) || 0) : 0, d = `${l * t.height + u}px`;
|
|
3604
4025
|
this.style.height !== d && (this.style.height = d), this.hasAttribute("data-mw-ready") || this.setAttribute("data-mw-ready", "");
|
|
3605
4026
|
} finally {
|
|
@@ -3607,10 +4028,10 @@ var mr = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
3607
4028
|
}
|
|
3608
4029
|
}
|
|
3609
4030
|
};
|
|
3610
|
-
function
|
|
3611
|
-
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind",
|
|
4031
|
+
function Br() {
|
|
4032
|
+
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind", zr);
|
|
3612
4033
|
}
|
|
3613
4034
|
//#endregion
|
|
3614
|
-
export {
|
|
4035
|
+
export { zr as MonoWindElement, Br as defineMonoWind, $e as multicolLines, sn as renderPlainText, _ as wrapLines };
|
|
3615
4036
|
|
|
3616
4037
|
//# sourceMappingURL=index.js.map
|