monowind 0.1.8 → 0.1.9
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 +29 -28
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +843 -753
- package/dist/index.js.map +1 -1
- package/dist/leaf.d.ts +73 -0
- package/dist/leaf.d.ts.map +1 -0
- package/dist/tree.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -213,8 +213,53 @@ function v(e, t, n) {
|
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
//#endregion
|
|
216
|
+
//#region src/warn.ts
|
|
217
|
+
var y = /* @__PURE__ */ new WeakMap();
|
|
218
|
+
function b(e, t) {
|
|
219
|
+
let n = y.get(e);
|
|
220
|
+
n || y.set(e, n = /* @__PURE__ */ new Set()), !n.has(t) && (n.add(t), console.warn(`[monowind] ${t}`, e));
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/leaf.ts
|
|
224
|
+
var x = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Set();
|
|
225
|
+
function C(e) {
|
|
226
|
+
let t = e.tag.toLowerCase();
|
|
227
|
+
if (!t.includes("-")) {
|
|
228
|
+
console.warn(`[monowind] registerLeafRenderer: "${e.tag}" is not a custom-element tag name (needs a hyphen); ignored.`);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
x.has(t) && console.warn(`[monowind] registerLeafRenderer: replacing existing renderer for <${t}> (last registration wins).`), x.set(t, {
|
|
232
|
+
...e,
|
|
233
|
+
tag: t
|
|
234
|
+
}), O();
|
|
235
|
+
}
|
|
236
|
+
function w() {
|
|
237
|
+
O();
|
|
238
|
+
}
|
|
239
|
+
function T(e) {
|
|
240
|
+
return x.get(e.toLowerCase());
|
|
241
|
+
}
|
|
242
|
+
function E() {
|
|
243
|
+
let e = /* @__PURE__ */ new Set();
|
|
244
|
+
for (let t of x.values()) for (let n of t.observedAttributes ?? []) e.add(n.toLowerCase());
|
|
245
|
+
return [...e];
|
|
246
|
+
}
|
|
247
|
+
function D(e) {
|
|
248
|
+
return S.add(e), () => S.delete(e);
|
|
249
|
+
}
|
|
250
|
+
function ee(e, t) {
|
|
251
|
+
try {
|
|
252
|
+
return e.render(t);
|
|
253
|
+
} catch (n) {
|
|
254
|
+
return b(t, `<${e.tag}> renderer threw; rendering nothing. ${String(n)}`), null;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function O() {
|
|
258
|
+
for (let e of S) e();
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
216
261
|
//#region src/borders.ts
|
|
217
|
-
function
|
|
262
|
+
function k(e, t, n) {
|
|
218
263
|
let r = e.border;
|
|
219
264
|
if (r.top === 0 && r.right === 0 && r.bottom === 0 && r.left === 0) return;
|
|
220
265
|
let i = Math.max(r.top, r.right, r.bottom, r.left);
|
|
@@ -230,11 +275,11 @@ function y(e, t, n) {
|
|
|
230
275
|
width: t.width - (i.left ? a : 0) - (i.right ? a : 0),
|
|
231
276
|
height: t.height - (i.top ? a : 0) - (i.bottom ? a : 0)
|
|
232
277
|
};
|
|
233
|
-
o.width <= 0 || o.height <= 0 ||
|
|
278
|
+
o.width <= 0 || o.height <= 0 || A(n, e.borderStyle, e.borderColor, o, i);
|
|
234
279
|
}
|
|
235
280
|
}
|
|
236
|
-
function
|
|
237
|
-
let a =
|
|
281
|
+
function A(e, t, n, r, i) {
|
|
282
|
+
let a = oe(t.top), o = oe(t.right), s = oe(t.bottom), c = oe(t.left), l = (e, t, n) => n(oe(e === t ? e : "solid")), { x: u, y: d, width: f, height: p } = r, m = f >= 2 && p >= 2, h = u + +!!i.left, g = u + f - +!!i.right, _ = d + +!!i.top, v = d + p - +!!i.bottom;
|
|
238
283
|
if (i.top && g > h && e.push({
|
|
239
284
|
glyph: a.h,
|
|
240
285
|
x: h,
|
|
@@ -287,27 +332,27 @@ function b(e, t, n, r, i) {
|
|
|
287
332
|
color: n.bottom
|
|
288
333
|
}));
|
|
289
334
|
}
|
|
290
|
-
function
|
|
335
|
+
function j(e, t) {
|
|
291
336
|
return e.style.position !== "static" || t.style.display === "flex" || t.style.display === "grid";
|
|
292
337
|
}
|
|
293
|
-
function
|
|
338
|
+
function te(e) {
|
|
294
339
|
if (e.children.length <= 1) return e.children;
|
|
295
340
|
let t = null, n = null, r = null;
|
|
296
|
-
for (let i of e.children)
|
|
341
|
+
for (let i of e.children) j(i, e) ? (r ??= []).push(i) : i.inlineBox ? (n ??= []).push(i) : (t ??= []).push(i);
|
|
297
342
|
return r && r.length > 1 && r.sort((e, t) => (e.style.zIndex ?? 0) - (t.style.zIndex ?? 0)), t && !n && !r ? t : !t && n && !r ? n : !t && !n && r ? r : [
|
|
298
343
|
...t ?? [],
|
|
299
344
|
...n ?? [],
|
|
300
345
|
...r ?? []
|
|
301
346
|
];
|
|
302
347
|
}
|
|
303
|
-
function
|
|
304
|
-
let n =
|
|
348
|
+
function ne(e, t) {
|
|
349
|
+
let n = oe(e);
|
|
305
350
|
return t === "h" ? n.h : n.v;
|
|
306
351
|
}
|
|
307
|
-
function
|
|
308
|
-
return (e === "double" ?
|
|
352
|
+
function re(e, t, n, r, i) {
|
|
353
|
+
return (e === "double" ? ae : ie)[(t ? 8 : 0) | (n ? 4 : 0) | (r ? 2 : 0) | !!i];
|
|
309
354
|
}
|
|
310
|
-
var
|
|
355
|
+
var ie = [
|
|
311
356
|
" ",
|
|
312
357
|
"─",
|
|
313
358
|
"─",
|
|
@@ -324,7 +369,7 @@ var T = [
|
|
|
324
369
|
"├",
|
|
325
370
|
"┤",
|
|
326
371
|
"┼"
|
|
327
|
-
],
|
|
372
|
+
], ae = [
|
|
328
373
|
" ",
|
|
329
374
|
"═",
|
|
330
375
|
"═",
|
|
@@ -342,8 +387,8 @@ var T = [
|
|
|
342
387
|
"╣",
|
|
343
388
|
"╬"
|
|
344
389
|
];
|
|
345
|
-
function
|
|
346
|
-
let t = (t, n, r, i) =>
|
|
390
|
+
function oe(e) {
|
|
391
|
+
let t = (t, n, r, i) => re(e, t, n, r, i), n = {
|
|
347
392
|
h: t(!1, !1, !0, !0),
|
|
348
393
|
v: t(!0, !0, !1, !1),
|
|
349
394
|
tl: t(!1, !0, !1, !0),
|
|
@@ -361,7 +406,7 @@ function D(e) {
|
|
|
361
406
|
v: "┊"
|
|
362
407
|
} : n;
|
|
363
408
|
}
|
|
364
|
-
function
|
|
409
|
+
function se(e, t, n, r) {
|
|
365
410
|
let i = e.map((e) => e.spanned ? !1 : n === "between" ? e.beforeOccupied && e.afterOccupied : n !== "around" || e.beforeOccupied || e.afterOccupied), a = [];
|
|
366
411
|
for (let n = 0; n < e.length; n++) if (a.push({
|
|
367
412
|
start: e[n].start,
|
|
@@ -405,7 +450,7 @@ function ee(e, t, n, r) {
|
|
|
405
450
|
end: e.end - r
|
|
406
451
|
})).filter((e) => e.end > e.start);
|
|
407
452
|
}
|
|
408
|
-
function
|
|
453
|
+
function ce(e) {
|
|
409
454
|
let t = [], n = e.border.left + e.padding.left, r = e.border.top + e.padding.top, i = (e, t) => ({
|
|
410
455
|
line: t.bandStart + Math.floor((t.bandSize - e.width) / 2),
|
|
411
456
|
start: t.start,
|
|
@@ -414,7 +459,7 @@ function O(e) {
|
|
|
414
459
|
endHalf: t.endHalf === !0
|
|
415
460
|
}), a = e.ruleX ? e.vertical.map((t) => i(e.ruleX, t)) : [], o = e.ruleY ? e.horizontal.map((t) => i(e.ruleY, t)) : [], s = e.ruleX?.width ?? 0, c = e.ruleY?.width ?? 0, l = (e, t, n, r) => e.some((e) => n >= e.line && n < e.line + t && (e.start < r && e.end > r || e.end === r && !e.endHalf || e.start === r && !e.startHalf)), u = (e, t) => o.some((n) => t >= n.line && t < n.line + c && e >= n.start && e < n.end);
|
|
416
461
|
if (e.ruleX) {
|
|
417
|
-
let i =
|
|
462
|
+
let i = ne(e.ruleX.style, "v");
|
|
418
463
|
for (let o of a) {
|
|
419
464
|
for (let a = 0; a < s; a++) for (let s = o.start; s < o.end; s++) u(o.line + a, s) || t.push({
|
|
420
465
|
glyph: i,
|
|
@@ -423,7 +468,7 @@ function O(e) {
|
|
|
423
468
|
length: 1,
|
|
424
469
|
color: e.ruleX.color
|
|
425
470
|
});
|
|
426
|
-
|
|
471
|
+
le(e, t, "x", o.line, o.start, o.end);
|
|
427
472
|
}
|
|
428
473
|
}
|
|
429
474
|
if (e.ruleY) {
|
|
@@ -434,7 +479,7 @@ function O(e) {
|
|
|
434
479
|
for (let d = u.start; d < u.end; d++) {
|
|
435
480
|
let u = l(a, s, d, f), p = l(a, s, d, f + 1);
|
|
436
481
|
t.push({
|
|
437
|
-
glyph: u || p ?
|
|
482
|
+
glyph: u || p ? re(i ? "double" : "solid", u, p, l(o, c, f, d), l(o, c, f, d + 1)) : ne(e.ruleY.style, "h"),
|
|
438
483
|
x: n + d,
|
|
439
484
|
y: r + f,
|
|
440
485
|
length: 1,
|
|
@@ -442,16 +487,16 @@ function O(e) {
|
|
|
442
487
|
});
|
|
443
488
|
}
|
|
444
489
|
}
|
|
445
|
-
|
|
490
|
+
le(e, t, "y", u.line, u.start, u.end);
|
|
446
491
|
}
|
|
447
492
|
}
|
|
448
493
|
return t;
|
|
449
494
|
}
|
|
450
|
-
function
|
|
495
|
+
function le(e, t, n, r, i, a) {
|
|
451
496
|
let o = n === "x" ? e.ruleX : e.ruleY, s = e.border.left + e.padding.left, c = e.border.top + e.padding.top, l = s + e.contentWidth + e.padding.right + e.border.right, u = c + e.contentHeight + e.padding.bottom + e.border.bottom, d = (e, n, r, i, a, s, c, l) => {
|
|
452
497
|
let u = o.style === "double" && r === "double" ? "double" : "solid";
|
|
453
498
|
t.push({
|
|
454
|
-
glyph:
|
|
499
|
+
glyph: re(u, a, s, c, l),
|
|
455
500
|
x: e,
|
|
456
501
|
y: n,
|
|
457
502
|
length: 1,
|
|
@@ -469,11 +514,11 @@ function k(e, t, n, r, i, a) {
|
|
|
469
514
|
}
|
|
470
515
|
//#endregion
|
|
471
516
|
//#region src/pointer.ts
|
|
472
|
-
function
|
|
517
|
+
function ue(e, t, n) {
|
|
473
518
|
let r = [], i = e, a = e.localRect.x, o = e.localRect.y;
|
|
474
519
|
for (;;) {
|
|
475
520
|
let e = null;
|
|
476
|
-
for (let r of
|
|
521
|
+
for (let r of te(i)) {
|
|
477
522
|
if (r.tableHidden) continue;
|
|
478
523
|
let i = a + r.localRect.x, s = o + r.localRect.y;
|
|
479
524
|
t >= i && t < i + r.localRect.width && n >= s && n < s + r.localRect.height && (e = r);
|
|
@@ -484,16 +529,16 @@ function A(e, t, n) {
|
|
|
484
529
|
}
|
|
485
530
|
//#endregion
|
|
486
531
|
//#region src/metrics.ts
|
|
487
|
-
function
|
|
532
|
+
function M(e) {
|
|
488
533
|
return (e >= 0 ? Math.floor(e + .5) : -Math.floor(-e + .5)) || 0;
|
|
489
534
|
}
|
|
490
|
-
function M(e, t) {
|
|
491
|
-
return t <= 0 ? 0 : j(e / (.25 * t));
|
|
492
|
-
}
|
|
493
535
|
function N(e, t) {
|
|
494
|
-
return
|
|
536
|
+
return t <= 0 ? 0 : M(e / (.25 * t));
|
|
537
|
+
}
|
|
538
|
+
function de(e, t) {
|
|
539
|
+
return M(t * e / 100);
|
|
495
540
|
}
|
|
496
|
-
function
|
|
541
|
+
function fe(e, t) {
|
|
497
542
|
let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).letterSpacing) || 0, i = t.ownerDocument.createRange();
|
|
498
543
|
i.selectNodeContents(t);
|
|
499
544
|
let a = Math.max(0, i.getBoundingClientRect().height - n.height);
|
|
@@ -504,56 +549,56 @@ function te(e, t) {
|
|
|
504
549
|
inkOverhang: a
|
|
505
550
|
};
|
|
506
551
|
}
|
|
507
|
-
function
|
|
552
|
+
function pe() {
|
|
508
553
|
return parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
509
554
|
}
|
|
510
555
|
//#endregion
|
|
511
556
|
//#region src/wrap.ts
|
|
512
|
-
function
|
|
513
|
-
return
|
|
557
|
+
function me(e, t, n = {}) {
|
|
558
|
+
return ve(e, t, n).map((t) => e.slice(t.start, t.end));
|
|
514
559
|
}
|
|
515
|
-
function
|
|
516
|
-
return
|
|
560
|
+
function he(e, t, n = {}) {
|
|
561
|
+
return ve(e, t, n).length;
|
|
517
562
|
}
|
|
518
|
-
function
|
|
563
|
+
function ge(e, t) {
|
|
519
564
|
return t.endsWith("\n") && e.pop(), e;
|
|
520
565
|
}
|
|
521
|
-
function
|
|
566
|
+
function _e(e) {
|
|
522
567
|
let t = [], n = 0;
|
|
523
568
|
for (let r = 0; r <= e.length; r++) (r === e.length || e[r] === "\n") && (t.push({
|
|
524
569
|
start: n,
|
|
525
570
|
end: r
|
|
526
571
|
}), n = r + 1);
|
|
527
|
-
return
|
|
572
|
+
return ge(t, e);
|
|
528
573
|
}
|
|
529
|
-
function
|
|
574
|
+
function ve(e, t, n = {}) {
|
|
530
575
|
if (!/[^ \t\r\f]/.test(e)) return [];
|
|
531
576
|
let r = [], i = 0, a = n.firstLineIndent ?? 0;
|
|
532
|
-
for (let o = 0; o <= e.length; o++) (o === e.length || e[o] === "\n") && (r.push(...
|
|
533
|
-
return
|
|
577
|
+
for (let o = 0; o <= e.length; o++) (o === e.length || e[o] === "\n") && (r.push(...Ee(e, i, o, t, n, a)), a = 0, i = o + 1);
|
|
578
|
+
return ge(r, e);
|
|
534
579
|
}
|
|
535
|
-
function
|
|
580
|
+
function ye(e, t, n) {
|
|
536
581
|
if (!n) return t - e;
|
|
537
582
|
let r = 0;
|
|
538
583
|
for (let i = e; i < t; i++) r += n[i] ?? 1;
|
|
539
584
|
return r;
|
|
540
585
|
}
|
|
541
586
|
function P(e, t, n, r = 0) {
|
|
542
|
-
return t <= e ? 0 :
|
|
587
|
+
return t <= e ? 0 : ye(e, t, n) - Math.min(r, be(t - 1, n));
|
|
543
588
|
}
|
|
544
|
-
function
|
|
589
|
+
function be(e, t) {
|
|
545
590
|
return t ? (t[e] ?? 1) - 1 : 0;
|
|
546
591
|
}
|
|
547
|
-
function
|
|
592
|
+
function xe(e, t = {}) {
|
|
548
593
|
let { advances: n, tracking: r = 0 } = t, i = 0;
|
|
549
|
-
for (let t of
|
|
594
|
+
for (let t of Te(e, 0, e.length)) for (let a of Ce(e, t.start, t.end)) i = Math.max(i, P(a.start, a.end, n, r));
|
|
550
595
|
return i;
|
|
551
596
|
}
|
|
552
|
-
function
|
|
597
|
+
function Se(e, t) {
|
|
553
598
|
let n = 0;
|
|
554
599
|
for (let r = 0; r < e.length; r++) e[r] === "" && (t(r, n), n++);
|
|
555
600
|
}
|
|
556
|
-
function
|
|
601
|
+
function Ce(e, t, n) {
|
|
557
602
|
let r = [], i = t;
|
|
558
603
|
for (let a = t; a < n; a++) {
|
|
559
604
|
if (e[a] === "") {
|
|
@@ -580,14 +625,14 @@ function fe(e, t, n) {
|
|
|
580
625
|
end: n
|
|
581
626
|
}), r;
|
|
582
627
|
}
|
|
583
|
-
var
|
|
584
|
-
function
|
|
628
|
+
var we = /[ \t\r\n\f]/;
|
|
629
|
+
function Te(e, t, n) {
|
|
585
630
|
let r = [], i = t;
|
|
586
631
|
for (; i < n;) {
|
|
587
|
-
for (; i < n &&
|
|
632
|
+
for (; i < n && we.test(e[i]);) i++;
|
|
588
633
|
if (i >= n) break;
|
|
589
634
|
let t = i;
|
|
590
|
-
for (; i < n && !
|
|
635
|
+
for (; i < n && !we.test(e[i]);) i++;
|
|
591
636
|
r.push({
|
|
592
637
|
start: t,
|
|
593
638
|
end: i
|
|
@@ -595,8 +640,8 @@ function me(e, t, n) {
|
|
|
595
640
|
}
|
|
596
641
|
return r;
|
|
597
642
|
}
|
|
598
|
-
function
|
|
599
|
-
let s =
|
|
643
|
+
function Ee(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
644
|
+
let s = Te(e, t, n);
|
|
600
645
|
if (s.length === 0) return [{
|
|
601
646
|
start: t,
|
|
602
647
|
end: t
|
|
@@ -608,8 +653,8 @@ function he(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
608
653
|
let c = [], l = null, u = 0, d = Math.max(0, o), f = () => r - d;
|
|
609
654
|
for (let t of s) {
|
|
610
655
|
let n = !1;
|
|
611
|
-
for (let r of
|
|
612
|
-
let e = r.start, t = r.end, o = l !== null && !n ? e - 1 : e, s = u +
|
|
656
|
+
for (let r of Ce(e, t.start, t.end)) {
|
|
657
|
+
let e = r.start, t = r.end, o = l !== null && !n ? e - 1 : e, s = u + ye(o, t, i), p = Math.min(a, be(t - 1, i));
|
|
613
658
|
if (l !== null && s - p <= f()) l.end = t, u = s;
|
|
614
659
|
else {
|
|
615
660
|
for (l !== null && (c.push(l), d = 0);;) {
|
|
@@ -624,7 +669,7 @@ function he(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
624
669
|
l = {
|
|
625
670
|
start: e,
|
|
626
671
|
end: t
|
|
627
|
-
}, u =
|
|
672
|
+
}, u = ye(e, t, i);
|
|
628
673
|
}
|
|
629
674
|
n = !0;
|
|
630
675
|
}
|
|
@@ -633,7 +678,7 @@ function he(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
633
678
|
}
|
|
634
679
|
//#endregion
|
|
635
680
|
//#region src/flex.ts
|
|
636
|
-
function
|
|
681
|
+
function De(e, t) {
|
|
637
682
|
let n = e.row.map((e) => e.node.localRect).sort((e, t) => e.x - t.x), r = [];
|
|
638
683
|
for (let e = 1; e < n.length; e++) {
|
|
639
684
|
let i = n[e - 1].x + n[e - 1].width - t, a = n[e].x - t;
|
|
@@ -644,12 +689,12 @@ function ge(e, t) {
|
|
|
644
689
|
}
|
|
645
690
|
return r;
|
|
646
691
|
}
|
|
647
|
-
function
|
|
692
|
+
function Oe(e, t, n, r, i) {
|
|
648
693
|
if (e.style.ruleBreak !== "intersection") return [{
|
|
649
694
|
start: 0,
|
|
650
695
|
end: i
|
|
651
696
|
}];
|
|
652
|
-
let a = [t[n - 1], t[n]].flatMap((e) =>
|
|
697
|
+
let a = [t[n - 1], t[n]].flatMap((e) => De(e, r)).sort((e, t) => e.start - t.start), o = (e, t) => ({
|
|
653
698
|
start: e,
|
|
654
699
|
end: t,
|
|
655
700
|
spanned: !1,
|
|
@@ -657,24 +702,24 @@ function _e(e, t, n, r, i) {
|
|
|
657
702
|
afterOccupied: !0
|
|
658
703
|
}), s = [], c = 0;
|
|
659
704
|
for (let e of a) e.start > c && s.push(o(c, e.start)), c = Math.max(c, e.end);
|
|
660
|
-
return c < i && s.push(o(c, i)),
|
|
705
|
+
return c < i && s.push(o(c, i)), se(s, "intersection", "all", e.style.ruleInset === "overlap-join" ? "overlap-join" : 0);
|
|
661
706
|
}
|
|
662
|
-
function
|
|
707
|
+
function ke(e, t) {
|
|
663
708
|
return typeof t != "number" || t <= 0 ? e : e.map((e) => ({
|
|
664
709
|
...e,
|
|
665
710
|
start: e.start + t,
|
|
666
711
|
end: e.end - t
|
|
667
712
|
})).filter((e) => e.end > e.start);
|
|
668
713
|
}
|
|
669
|
-
function
|
|
670
|
-
let s = U(e.style, "x", t), c = U(e.style, "y", n), l =
|
|
714
|
+
function Ae(e, t, n, r, i, a, o) {
|
|
715
|
+
let s = U(e.style, "x", t), c = U(e.style, "y", n), l = Re(e).map((e) => {
|
|
671
716
|
let n = G(e.style.margin, t);
|
|
672
717
|
return {
|
|
673
718
|
node: e,
|
|
674
|
-
base:
|
|
719
|
+
base: Le(e, t, o),
|
|
675
720
|
grow: e.style.flexGrow,
|
|
676
721
|
shrink: e.style.flexShrink,
|
|
677
|
-
min:
|
|
722
|
+
min: Ve(e, t, o),
|
|
678
723
|
max: K(e.style.maxWidth, t),
|
|
679
724
|
margin: n
|
|
680
725
|
};
|
|
@@ -688,7 +733,7 @@ function ye(e, t, n, r, i, a, o) {
|
|
|
688
733
|
n.length > 0 && u.push(n), e.style.wrapReverse && u.reverse();
|
|
689
734
|
} else u.push(l);
|
|
690
735
|
let d = i.left + a.left, f = i.top + a.top, p = u.map((e) => {
|
|
691
|
-
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))) :
|
|
736
|
+
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))) : Fe(e, a);
|
|
692
737
|
for (let n = 0; n < e.length; n++) V(e[n].node, t, r, 0, 0, "fill", o, { width: u[n] });
|
|
693
738
|
return {
|
|
694
739
|
row: e,
|
|
@@ -699,7 +744,7 @@ function ye(e, t, n, r, i, a, o) {
|
|
|
699
744
|
}), m = p.map((e) => e.height), h = c * Math.max(0, p.length - 1), g;
|
|
700
745
|
if (e.style.flexWrap === "nowrap") Number.isFinite(n) && (m[0] = Math.max(n, m[0] ?? 0)), g = [0];
|
|
701
746
|
else {
|
|
702
|
-
let t = m.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - h) : 0, i =
|
|
747
|
+
let t = m.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - h) : 0, i = ze(e.style);
|
|
703
748
|
if (i === "stretch" && r > 0) {
|
|
704
749
|
let e = I(Array.from({ length: p.length }, () => 1), r);
|
|
705
750
|
for (let t = 0; t < m.length; t++) m[t] += e[t];
|
|
@@ -709,7 +754,7 @@ function ye(e, t, n, r, i, a, o) {
|
|
|
709
754
|
for (let i = 0; i < p.length; i++) {
|
|
710
755
|
let { row: a, widths: l, availableForItems: u } = p[i], h = m[i], _ = g[i] + i * c;
|
|
711
756
|
for (let i = 0; i < a.length; i++) {
|
|
712
|
-
let s = a[i].node, c =
|
|
757
|
+
let s = a[i].node, c = Ie(s, e), u = a[i].margin, d = u.top === null || u.bottom === null, f = s.style.height !== void 0 && s.style.height.kind !== "auto";
|
|
713
758
|
if (c === "stretch" && !d && !f && h > s.localRect.height) {
|
|
714
759
|
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, d = H(Math.max(0, h - e - a), K(s.style.minHeight, c) ?? 0, K(s.style.maxHeight, c));
|
|
715
760
|
if (d === s.localRect.height) continue;
|
|
@@ -724,14 +769,14 @@ function ye(e, t, n, r, i, a, o) {
|
|
|
724
769
|
let e = I(Array.from({ length: b }, () => 1), y), t = 0;
|
|
725
770
|
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++]);
|
|
726
771
|
C = F("start", l, 0);
|
|
727
|
-
} else C = F(
|
|
772
|
+
} else C = F(Be(e.style), l, y);
|
|
728
773
|
let w = 0;
|
|
729
774
|
for (let t = 0; t < a.length; t++) {
|
|
730
775
|
let n = a[t], r = n.node, i = n.margin.left ?? 0, o = n.margin.right ?? 0;
|
|
731
776
|
w += x[t] + i, r.localRect = {
|
|
732
777
|
...r.localRect,
|
|
733
778
|
x: d + C[t] + t * s + w,
|
|
734
|
-
y: f + _ +
|
|
779
|
+
y: f + _ + Ne(r, e.style.alignItems, h, n.margin)
|
|
735
780
|
}, w += S[t] + o;
|
|
736
781
|
}
|
|
737
782
|
}
|
|
@@ -740,7 +785,7 @@ function ye(e, t, n, r, i, a, o) {
|
|
|
740
785
|
let n = [], r = [];
|
|
741
786
|
for (let i = 0; i < p.length; i++) {
|
|
742
787
|
let a = g[i] + i * c;
|
|
743
|
-
for (let e of
|
|
788
|
+
for (let e of De(p[i], d)) n.push({
|
|
744
789
|
bandStart: e.start,
|
|
745
790
|
bandSize: e.end - e.start,
|
|
746
791
|
start: a,
|
|
@@ -748,18 +793,18 @@ function ye(e, t, n, r, i, a, o) {
|
|
|
748
793
|
});
|
|
749
794
|
if (i > 0) {
|
|
750
795
|
let n = g[i - 1] + (i - 1) * c + m[i - 1];
|
|
751
|
-
if (a > n) for (let o of
|
|
796
|
+
if (a > n) for (let o of Oe(e, p, i, d, t)) r.push({
|
|
752
797
|
bandStart: n,
|
|
753
798
|
bandSize: a - n,
|
|
754
799
|
...o
|
|
755
800
|
});
|
|
756
801
|
}
|
|
757
802
|
}
|
|
758
|
-
e.decorationRuns =
|
|
803
|
+
e.decorationRuns = ce({
|
|
759
804
|
ruleX: e.style.ruleX,
|
|
760
805
|
ruleY: e.style.ruleY,
|
|
761
|
-
vertical:
|
|
762
|
-
horizontal:
|
|
806
|
+
vertical: ke(n, e.style.ruleInset),
|
|
807
|
+
horizontal: ke(r, e.style.ruleInset),
|
|
763
808
|
contentWidth: t,
|
|
764
809
|
contentHeight: v,
|
|
765
810
|
border: i,
|
|
@@ -768,9 +813,9 @@ function ye(e, t, n, r, i, a, o) {
|
|
|
768
813
|
padding: a
|
|
769
814
|
});
|
|
770
815
|
}
|
|
771
|
-
return
|
|
816
|
+
return je(e, i, a, t, v), v;
|
|
772
817
|
}
|
|
773
|
-
function
|
|
818
|
+
function je(e, t, n, r, i) {
|
|
774
819
|
for (let a of e.children) B(a.style) && (a.staticSlot = {
|
|
775
820
|
kind: "flex",
|
|
776
821
|
direction: e.style.flexDirection,
|
|
@@ -780,11 +825,11 @@ function be(e, t, n, r, i) {
|
|
|
780
825
|
innerHeight: i
|
|
781
826
|
});
|
|
782
827
|
}
|
|
783
|
-
function
|
|
784
|
-
let s = U(e.style, "y", n), c =
|
|
785
|
-
let a = G(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c =
|
|
828
|
+
function Me(e, t, n, r, i, a, o) {
|
|
829
|
+
let s = U(e.style, "y", n), c = Re(e).map((i) => {
|
|
830
|
+
let a = G(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c = Ie(i, e) === "stretch";
|
|
786
831
|
V(i, s, r && Number.isFinite(n) ? n : void 0, 0, 0, c ? "fill" : "shrink", o);
|
|
787
|
-
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 ?
|
|
832
|
+
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 ? de(u.value, l) : i.unclampedHeight, f = i.style.minHeight === "auto" ? i.style.overflow === "visible" ? i.localRect.height : 0 : void 0;
|
|
788
833
|
return {
|
|
789
834
|
node: i,
|
|
790
835
|
base: d,
|
|
@@ -794,9 +839,9 @@ function xe(e, t, n, r, i, a, o) {
|
|
|
794
839
|
max: K(i.style.maxHeight, l),
|
|
795
840
|
margin: a
|
|
796
841
|
};
|
|
797
|
-
}), l = s * Math.max(0, c.length - 1), u = c.reduce((e, t) => e + (t.margin.top ?? 0) + (t.margin.bottom ?? 0), 0), d = Number.isFinite(n), f = c.reduce((e, t) => e + t.base, 0), p = d ? Math.max(0, n - l - u) : f, m = r ? p : Math.max(p, f), h = c.some((e) => e.margin.top === null || e.margin.bottom === null), g = d && !(d && h && f <= m) ?
|
|
842
|
+
}), l = s * Math.max(0, c.length - 1), u = c.reduce((e, t) => e + (t.margin.top ?? 0) + (t.margin.bottom ?? 0), 0), d = Number.isFinite(n), f = c.reduce((e, t) => e + t.base, 0), p = d ? Math.max(0, n - l - u) : f, m = r ? p : Math.max(p, f), h = c.some((e) => e.margin.top === null || e.margin.bottom === null), g = d && !(d && h && f <= m) ? Fe(c, m) : c.map((e) => Math.max(0, H(e.base, e.min, e.max)));
|
|
798
843
|
for (let n = 0; n < c.length; n++) if (g[n] !== c[n].node.localRect.height) {
|
|
799
|
-
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a =
|
|
844
|
+
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a = Ie(r.node, e) === "stretch";
|
|
800
845
|
V(r.node, i, g[n], 0, 0, a ? "fill" : "shrink", o, { height: g[n] });
|
|
801
846
|
}
|
|
802
847
|
let _ = g.reduce((e, t) => e + t, 0), v = Math.max(0, m - _), y = c.reduce((e, t) => e + +(t.margin.top === null) + +(t.margin.bottom === null), 0), b = Array.from({ length: c.length }, () => 0), x = Array.from({ length: c.length }, () => 0), S;
|
|
@@ -804,13 +849,13 @@ function xe(e, t, n, r, i, a, o) {
|
|
|
804
849
|
let e = I(Array.from({ length: y }, () => 1), v), t = 0;
|
|
805
850
|
for (let n = 0; n < c.length; n++) c[n].margin.top === null && (b[n] = e[t++]), c[n].margin.bottom === null && (x[n] = e[t++]);
|
|
806
851
|
S = F("start", g, 0);
|
|
807
|
-
} else S = F(
|
|
852
|
+
} else S = F(Be(e.style), g, v);
|
|
808
853
|
let C = i.left + a.left, w = i.top + a.top, T = 0;
|
|
809
854
|
for (let n = 0; n < c.length; n++) {
|
|
810
855
|
let r = c[n], i = r.node, a = r.margin.top ?? 0, o = r.margin.bottom ?? 0;
|
|
811
856
|
T += b[n] + a, i.localRect = {
|
|
812
857
|
...i.localRect,
|
|
813
|
-
x: C +
|
|
858
|
+
x: C + Pe(i, e.style.alignItems, t, r.margin),
|
|
814
859
|
y: w + S[n] + n * s + T
|
|
815
860
|
}, T += x[n] + o;
|
|
816
861
|
}
|
|
@@ -826,11 +871,11 @@ function xe(e, t, n, r, i, a, o) {
|
|
|
826
871
|
end: t
|
|
827
872
|
});
|
|
828
873
|
}
|
|
829
|
-
e.decorationRuns =
|
|
874
|
+
e.decorationRuns = ce({
|
|
830
875
|
ruleX: null,
|
|
831
876
|
ruleY: e.style.ruleY,
|
|
832
877
|
vertical: [],
|
|
833
|
-
horizontal:
|
|
878
|
+
horizontal: ke(n, e.style.ruleInset),
|
|
834
879
|
contentWidth: t,
|
|
835
880
|
contentHeight: D,
|
|
836
881
|
border: i,
|
|
@@ -839,13 +884,13 @@ function xe(e, t, n, r, i, a, o) {
|
|
|
839
884
|
padding: a
|
|
840
885
|
});
|
|
841
886
|
}
|
|
842
|
-
return
|
|
887
|
+
return je(e, i, a, t, D), D;
|
|
843
888
|
}
|
|
844
|
-
function
|
|
889
|
+
function Ne(e, t, n, r) {
|
|
845
890
|
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;
|
|
846
891
|
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + L(i, n, e.localRect.height);
|
|
847
892
|
}
|
|
848
|
-
function
|
|
893
|
+
function Pe(e, t, n, r) {
|
|
849
894
|
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;
|
|
850
895
|
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + L(i, n, e.localRect.width);
|
|
851
896
|
}
|
|
@@ -867,7 +912,7 @@ function F(e, t, n) {
|
|
|
867
912
|
for (let e = 0; e < r; e++) i.push(a), a += t[e];
|
|
868
913
|
return i;
|
|
869
914
|
}
|
|
870
|
-
function
|
|
915
|
+
function Fe(e, t) {
|
|
871
916
|
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);
|
|
872
917
|
for (let t = 0; t < n; t++) {
|
|
873
918
|
let n = r(i[t], t);
|
|
@@ -902,33 +947,33 @@ function I(e, t) {
|
|
|
902
947
|
}
|
|
903
948
|
return i;
|
|
904
949
|
}
|
|
905
|
-
function
|
|
950
|
+
function Ie(e, t) {
|
|
906
951
|
return e.style.alignSelf === "auto" ? t.style.alignItems : e.style.alignSelf;
|
|
907
952
|
}
|
|
908
953
|
function L(e, t, n) {
|
|
909
954
|
return e === "center" ? Math.max(0, Math.floor((t - n) / 2)) : e === "end" ? Math.max(0, t - n) : 0;
|
|
910
955
|
}
|
|
911
|
-
function
|
|
956
|
+
function Le(e, t, n) {
|
|
912
957
|
let r = e.style.flexBasis, i = e.style.width;
|
|
913
958
|
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);
|
|
914
959
|
}
|
|
915
|
-
function
|
|
960
|
+
function Re(e) {
|
|
916
961
|
let t = e.children.filter((e) => !B(e.style)).sort((e, t) => e.style.order - t.style.order);
|
|
917
962
|
return e.style.flexReverse && t.reverse(), t;
|
|
918
963
|
}
|
|
919
|
-
function
|
|
964
|
+
function ze(e) {
|
|
920
965
|
return e.wrapReverse ? e.alignContent === "start" ? "end" : e.alignContent === "end" ? "start" : e.alignContent : e.alignContent;
|
|
921
966
|
}
|
|
922
|
-
function
|
|
967
|
+
function Be(e) {
|
|
923
968
|
let t = e.justifyContent === "stretch" ? "start" : e.justifyContent;
|
|
924
969
|
return e.flexReverse ? t === "start" ? "end" : t === "end" ? "start" : t : t;
|
|
925
970
|
}
|
|
926
|
-
function
|
|
971
|
+
function Ve(e, t, n) {
|
|
927
972
|
return e.style.minWidth === "auto" ? e.style.overflow === "visible" ? Y(e, n) : 0 : K(e.style.minWidth, t) ?? 0;
|
|
928
973
|
}
|
|
929
974
|
//#endregion
|
|
930
975
|
//#region src/types.ts
|
|
931
|
-
function
|
|
976
|
+
function He() {
|
|
932
977
|
return {
|
|
933
978
|
display: "block",
|
|
934
979
|
flexDirection: "row",
|
|
@@ -947,8 +992,8 @@ function je() {
|
|
|
947
992
|
justifySelf: "auto",
|
|
948
993
|
gridTemplateColumns: { kind: "none" },
|
|
949
994
|
gridTemplateRows: { kind: "none" },
|
|
950
|
-
gridAutoColumns: [
|
|
951
|
-
gridAutoRows: [
|
|
995
|
+
gridAutoColumns: [Ue()],
|
|
996
|
+
gridAutoRows: [Ue()],
|
|
952
997
|
gridAutoFlow: {
|
|
953
998
|
direction: "row",
|
|
954
999
|
dense: !1
|
|
@@ -1040,7 +1085,7 @@ function R() {
|
|
|
1040
1085
|
left: 0
|
|
1041
1086
|
};
|
|
1042
1087
|
}
|
|
1043
|
-
function
|
|
1088
|
+
function Ue() {
|
|
1044
1089
|
return {
|
|
1045
1090
|
min: { kind: "auto" },
|
|
1046
1091
|
max: { kind: "auto" }
|
|
@@ -1048,15 +1093,15 @@ function Me() {
|
|
|
1048
1093
|
}
|
|
1049
1094
|
//#endregion
|
|
1050
1095
|
//#region src/grid.ts
|
|
1051
|
-
function
|
|
1052
|
-
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, u = c ? c.gap : U(o, "x", t), d = l ? l.gap : U(o, "y", s), f =
|
|
1096
|
+
function We(e, t, n, r, i, a) {
|
|
1097
|
+
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, u = c ? c.gap : U(o, "x", t), d = l ? l.gap : U(o, "y", s), f = et(e, t, s, u, d, e.subgrid ? {
|
|
1053
1098
|
col: e.subgrid.colSpan,
|
|
1054
1099
|
row: e.subgrid.rowSpan
|
|
1055
|
-
} : void 0), { children: p, placed: m, colLines: h, rowLines: g, colTracks: _, rowTracks: v, colCollapsed: y, rowCollapsed: b } = f, x = p.map((e) => G(e.style.margin, t)), S = p.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), C = p.map(
|
|
1100
|
+
} : void 0), { children: p, placed: m, colLines: h, rowLines: g, colTracks: _, rowTracks: v, colCollapsed: y, rowCollapsed: b } = f, x = p.map((e) => G(e.style.margin, t)), S = p.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), C = p.map(Ge), w = c ? qe(c) : gt(_, y, Je(f, C, x, a), t, u, o.justifyContent === "stretch"), T = c ? c.positions : _t(w, t, o.justifyContent), E = [];
|
|
1056
1101
|
for (let e = 0; e < p.length; e++) {
|
|
1057
|
-
let t = p[e], n = m.items[e], r =
|
|
1102
|
+
let t = p[e], n = m.items[e], r = yt(T, w.sizes, n.col.start, n.col.span), i = x[e], o = Math.max(0, r - it(i)), s = C[e];
|
|
1058
1103
|
if (s.cols || s.rows) {
|
|
1059
|
-
let e = s.cols ?
|
|
1104
|
+
let e = s.cols ? Ke(T, w, u, n.col.start, n.col.span, Xe(t, "cols", i, r)) : void 0;
|
|
1060
1105
|
t.subgrid = {
|
|
1061
1106
|
colSpan: n.col.span,
|
|
1062
1107
|
rowSpan: n.row.span,
|
|
@@ -1065,12 +1110,12 @@ function Ne(e, t, n, r, i, a) {
|
|
|
1065
1110
|
};
|
|
1066
1111
|
} else t.subgrid = void 0;
|
|
1067
1112
|
let c = S[e], l = i.left === null || i.right === null, d = t.style.width !== void 0 && t.style.width.kind !== "auto";
|
|
1068
|
-
s.cols ? V(t, r, void 0, 0, 0, "fill", a, { width: o }) : c === "stretch" && !l && !d ? 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,
|
|
1113
|
+
s.cols ? V(t, r, void 0, 0, 0, "fill", a, { width: o }) : c === "stretch" && !l && !d ? 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, On(t.style.maxWidth, r, t, a)) }) : V(t, o, void 0, 0, 0, "shrink", a), E.push(t.localRect.width);
|
|
1069
1114
|
}
|
|
1070
|
-
let D = l ?
|
|
1115
|
+
let D = l ? qe(l) : gt(v, b, Ye(f, C, x), s ?? "max-content", d, o.alignContent === "stretch"), ee = vt(D), O = l ? l.positions : _t(D, s ?? ee, o.alignContent), k = r.left + i.left, A = r.top + i.top;
|
|
1071
1116
|
for (let t = 0; t < p.length; t++) {
|
|
1072
|
-
let n = p[t], r = m.items[t], i = x[t], o =
|
|
1073
|
-
if (C[t].rows) n.subgrid.rows =
|
|
1117
|
+
let n = p[t], r = m.items[t], i = x[t], o = yt(T, w.sizes, r.col.start, r.col.span), s = yt(O, D.sizes, r.row.start, r.row.span), c = Math.max(0, s - at(i)), l = Ie(n, e), u = i.top === null || i.bottom === null, f = n.style.height !== void 0 && n.style.height.kind !== "auto";
|
|
1118
|
+
if (C[t].rows) n.subgrid.rows = Ke(O, D, d, r.row.start, r.row.span, Xe(n, "rows", i, o)), V(n, o, s, 0, 0, "fill", a, {
|
|
1074
1119
|
width: E[t],
|
|
1075
1120
|
height: c
|
|
1076
1121
|
});
|
|
@@ -1083,11 +1128,11 @@ function Ne(e, t, n, r, i, a) {
|
|
|
1083
1128
|
} else n.style.height?.kind === "percent" && V(n, o, s, 0, 0, "fill", a, { width: E[t] });
|
|
1084
1129
|
n.localRect = {
|
|
1085
1130
|
...n.localRect,
|
|
1086
|
-
x:
|
|
1087
|
-
y:
|
|
1131
|
+
x: k + T[r.col.start] + bt(S[t], i.left, i.right, o, n.localRect.width),
|
|
1132
|
+
y: A + O[r.row.start] + bt(l, i.top, i.bottom, s, n.localRect.height)
|
|
1088
1133
|
};
|
|
1089
1134
|
}
|
|
1090
|
-
let
|
|
1135
|
+
let j = Number.isFinite(n) ? Math.max(n, ee) : ee;
|
|
1091
1136
|
if (o.ruleX || o.ruleY) {
|
|
1092
1137
|
let n = w.sizes.length, a = D.sizes.length, s = Array.from({ length: n }, () => Array.from({ length: a }, () => !1)), c = Array.from({ length: Math.max(0, n - 1) }, () => Array.from({ length: a }, () => !1)), l = Array.from({ length: Math.max(0, a - 1) }, () => Array.from({ length: n }, () => !1));
|
|
1093
1138
|
for (let e of m.items) for (let t = e.col.start; t < e.col.start + e.col.span && t < n; t++) for (let r = e.row.start; r < e.row.start + e.row.span && r < a; r++) s[t][r] = !0, t + 1 < e.col.start + e.col.span && t < n - 1 && (c[t][r] = !0), r + 1 < e.row.start + e.row.span && r < a - 1 && (l[r][t] = !0);
|
|
@@ -1101,21 +1146,21 @@ function Ne(e, t, n, r, i, a) {
|
|
|
1101
1146
|
let r = [];
|
|
1102
1147
|
for (let i = 1; i < e.length; i++) {
|
|
1103
1148
|
let a = e[i - 1] + t[i - 1], s = e[i] - a;
|
|
1104
|
-
if (!(s <= 0)) for (let e of
|
|
1149
|
+
if (!(s <= 0)) for (let e of se(n(i - 1), o.ruleBreak, o.ruleVisibilityItems, o.ruleInset)) r.push({
|
|
1105
1150
|
bandStart: a,
|
|
1106
1151
|
bandSize: s,
|
|
1107
1152
|
...e
|
|
1108
1153
|
});
|
|
1109
1154
|
}
|
|
1110
1155
|
return r;
|
|
1111
|
-
}, f = d(T, w.sizes, (e) => u(e,
|
|
1112
|
-
e.decorationRuns =
|
|
1156
|
+
}, f = d(T, w.sizes, (e) => u(e, O, D.sizes, c, (t) => s[e]?.[t] ?? !1, (t) => s[e + 1]?.[t] ?? !1)), p = d(O, D.sizes, (e) => u(e, T, w.sizes, l, (t) => s[t]?.[e] ?? !1, (t) => s[t]?.[e + 1] ?? !1));
|
|
1157
|
+
e.decorationRuns = ce({
|
|
1113
1158
|
ruleX: o.ruleX,
|
|
1114
1159
|
ruleY: o.ruleY,
|
|
1115
1160
|
vertical: f,
|
|
1116
1161
|
horizontal: p,
|
|
1117
1162
|
contentWidth: t,
|
|
1118
|
-
contentHeight:
|
|
1163
|
+
contentHeight: j,
|
|
1119
1164
|
border: r,
|
|
1120
1165
|
borderStyle: o.borderStyle,
|
|
1121
1166
|
borderColor: o.borderColor,
|
|
@@ -1128,20 +1173,20 @@ function Ne(e, t, n, r, i, a) {
|
|
|
1128
1173
|
x: r.left,
|
|
1129
1174
|
y: r.top,
|
|
1130
1175
|
width: i.left + t + i.right,
|
|
1131
|
-
height: i.top +
|
|
1176
|
+
height: i.top + j + i.bottom
|
|
1132
1177
|
} : {
|
|
1133
|
-
x:
|
|
1134
|
-
y:
|
|
1178
|
+
x: k,
|
|
1179
|
+
y: A,
|
|
1135
1180
|
width: t,
|
|
1136
|
-
height:
|
|
1181
|
+
height: j
|
|
1137
1182
|
};
|
|
1138
1183
|
for (let n of te) {
|
|
1139
|
-
let r =
|
|
1184
|
+
let r = Qe(n.style.gridColumnStart, n.style.gridColumnEnd, h, m.colOrigin, T, w.sizes, -i.left, t + i.right), a = Qe(n.style.gridRowStart, n.style.gridRowEnd, g, m.rowOrigin, O, D.sizes, -i.top, j + i.bottom);
|
|
1140
1185
|
n.staticSlot = {
|
|
1141
1186
|
kind: "grid",
|
|
1142
1187
|
area: {
|
|
1143
|
-
x:
|
|
1144
|
-
y:
|
|
1188
|
+
x: k + r.start,
|
|
1189
|
+
y: A + a.start,
|
|
1145
1190
|
width: Math.max(0, r.end - r.start),
|
|
1146
1191
|
height: Math.max(0, a.end - a.start)
|
|
1147
1192
|
},
|
|
@@ -1149,16 +1194,16 @@ function Ne(e, t, n, r, i, a) {
|
|
|
1149
1194
|
};
|
|
1150
1195
|
}
|
|
1151
1196
|
}
|
|
1152
|
-
return
|
|
1197
|
+
return j;
|
|
1153
1198
|
}
|
|
1154
|
-
function
|
|
1199
|
+
function Ge(e) {
|
|
1155
1200
|
let t = e.style.display === "grid";
|
|
1156
1201
|
return {
|
|
1157
1202
|
cols: t && e.style.gridTemplateColumns.kind === "subgrid",
|
|
1158
1203
|
rows: t && e.style.gridTemplateRows.kind === "subgrid"
|
|
1159
1204
|
};
|
|
1160
1205
|
}
|
|
1161
|
-
function
|
|
1206
|
+
function Ke(e, t, n, r, i, a) {
|
|
1162
1207
|
let o = e[r] + a.start, s = t.sizes.slice(r, r + i);
|
|
1163
1208
|
return s[0] = Math.max(0, s[0] - a.start), s[i - 1] = Math.max(0, s[i - 1] - a.end), {
|
|
1164
1209
|
positions: Array.from({ length: i }, (t, n) => n === 0 ? 0 : e[r + n] - o),
|
|
@@ -1167,20 +1212,20 @@ function Fe(e, t, n, r, i, a) {
|
|
|
1167
1212
|
gap: n
|
|
1168
1213
|
};
|
|
1169
1214
|
}
|
|
1170
|
-
function
|
|
1215
|
+
function qe(e) {
|
|
1171
1216
|
return {
|
|
1172
1217
|
sizes: e.sizes,
|
|
1173
1218
|
gapBefore: e.gapBefore,
|
|
1174
1219
|
limits: e.sizes
|
|
1175
1220
|
};
|
|
1176
1221
|
}
|
|
1177
|
-
function
|
|
1222
|
+
function Je(e, t, n, r) {
|
|
1178
1223
|
let i = [];
|
|
1179
1224
|
return e.children.forEach((a, o) => {
|
|
1180
1225
|
let s = e.placed.items[o], c = n[o];
|
|
1181
1226
|
if (t[o].cols) {
|
|
1182
|
-
let e =
|
|
1183
|
-
for (let t of
|
|
1227
|
+
let e = Xe(a, "cols", c, 0);
|
|
1228
|
+
for (let t of Ze(a, "cols", s, e, r)) i.push({
|
|
1184
1229
|
...t,
|
|
1185
1230
|
start: t.start + s.col.start
|
|
1186
1231
|
});
|
|
@@ -1189,24 +1234,24 @@ function Le(e, t, n, r) {
|
|
|
1189
1234
|
i.push({
|
|
1190
1235
|
start: s.col.start,
|
|
1191
1236
|
span: s.col.span,
|
|
1192
|
-
min:
|
|
1193
|
-
max:
|
|
1237
|
+
min: ot(a, "min", r) + it(c),
|
|
1238
|
+
max: ot(a, "max", r) + it(c)
|
|
1194
1239
|
});
|
|
1195
1240
|
}), i;
|
|
1196
1241
|
}
|
|
1197
|
-
function
|
|
1242
|
+
function Ye(e, t, n) {
|
|
1198
1243
|
let r = [];
|
|
1199
1244
|
return e.children.forEach((i, a) => {
|
|
1200
1245
|
let o = e.placed.items[a], s = n[a];
|
|
1201
1246
|
if (t[a].rows) {
|
|
1202
|
-
let e =
|
|
1203
|
-
for (let t of
|
|
1247
|
+
let e = Xe(i, "rows", s, 0);
|
|
1248
|
+
for (let t of Ze(i, "rows", o, e)) r.push({
|
|
1204
1249
|
...t,
|
|
1205
1250
|
start: t.start + o.row.start
|
|
1206
1251
|
});
|
|
1207
1252
|
return;
|
|
1208
1253
|
}
|
|
1209
|
-
let c = i.localRect.height +
|
|
1254
|
+
let c = i.localRect.height + at(s);
|
|
1210
1255
|
r.push({
|
|
1211
1256
|
start: o.row.start,
|
|
1212
1257
|
span: o.row.span,
|
|
@@ -1215,7 +1260,7 @@ function Re(e, t, n) {
|
|
|
1215
1260
|
});
|
|
1216
1261
|
}), r;
|
|
1217
1262
|
}
|
|
1218
|
-
function
|
|
1263
|
+
function Xe(e, t, n, r) {
|
|
1219
1264
|
let { border: i, padding: a } = e.style;
|
|
1220
1265
|
return t === "cols" ? {
|
|
1221
1266
|
start: (n.left ?? 0) + i.left + W(a.left, r),
|
|
@@ -1225,15 +1270,15 @@ function ze(e, t, n, r) {
|
|
|
1225
1270
|
end: (n.bottom ?? 0) + i.bottom + W(a.bottom, r)
|
|
1226
1271
|
};
|
|
1227
1272
|
}
|
|
1228
|
-
function
|
|
1229
|
-
let a = t === "cols" ? n.col.span : n.row.span, o =
|
|
1273
|
+
function Ze(e, t, n, r, i) {
|
|
1274
|
+
let a = t === "cols" ? n.col.span : n.row.span, o = et(e, void 0, void 0, 0, 0, {
|
|
1230
1275
|
col: n.col.span,
|
|
1231
1276
|
row: n.row.span
|
|
1232
1277
|
}), s = [];
|
|
1233
1278
|
if (o.children.forEach((e, n) => {
|
|
1234
1279
|
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);
|
|
1235
|
-
if (
|
|
1236
|
-
let n =
|
|
1280
|
+
if (Ge(e)[t]) {
|
|
1281
|
+
let n = Xe(e, t, p, 0), a = Ze(e, t, c, {
|
|
1237
1282
|
start: n.start + (u ? r.start : 0),
|
|
1238
1283
|
end: n.end + (d ? r.end : 0)
|
|
1239
1284
|
}, i);
|
|
@@ -1246,11 +1291,11 @@ function Be(e, t, n, r, i) {
|
|
|
1246
1291
|
if (t === "cols") s.push({
|
|
1247
1292
|
start: l.start,
|
|
1248
1293
|
span: l.span,
|
|
1249
|
-
min:
|
|
1250
|
-
max:
|
|
1294
|
+
min: ot(e, "min", i) + it(p) + f,
|
|
1295
|
+
max: ot(e, "max", i) + it(p) + f
|
|
1251
1296
|
});
|
|
1252
1297
|
else {
|
|
1253
|
-
let t = e.localRect.height +
|
|
1298
|
+
let t = e.localRect.height + at(p) + f;
|
|
1254
1299
|
s.push({
|
|
1255
1300
|
start: l.start,
|
|
1256
1301
|
span: l.span,
|
|
@@ -1269,9 +1314,9 @@ function Be(e, t, n, r, i) {
|
|
|
1269
1314
|
}
|
|
1270
1315
|
return s;
|
|
1271
1316
|
}
|
|
1272
|
-
function
|
|
1273
|
-
let c =
|
|
1274
|
-
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l =
|
|
1317
|
+
function Qe(e, t, n, r, i, a, o, s) {
|
|
1318
|
+
let c = ft(e, "start", n), l = ft(t, "end", n);
|
|
1319
|
+
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l = pt(c, t, 1, n) : l !== null && e.kind === "span" && (c = pt(l, e, -1, n));
|
|
1275
1320
|
let u = i.length, d = (e) => {
|
|
1276
1321
|
if (e === null) return;
|
|
1277
1322
|
let t = e - r;
|
|
@@ -1282,22 +1327,22 @@ function Ve(e, t, n, r, i, a, o, s) {
|
|
|
1282
1327
|
end: h === void 0 ? s : p(h)
|
|
1283
1328
|
};
|
|
1284
1329
|
}
|
|
1285
|
-
function
|
|
1330
|
+
function $e(e, t) {
|
|
1286
1331
|
let n = t.gridIntrinsic.get(e);
|
|
1287
1332
|
if (n !== void 0) return n;
|
|
1288
|
-
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a =
|
|
1333
|
+
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a = et(e, void 0, void 0, i, 0, e.subgrid ? {
|
|
1289
1334
|
col: e.subgrid.colSpan,
|
|
1290
1335
|
row: e.subgrid.rowSpan
|
|
1291
|
-
} : void 0), o = a.children.map(
|
|
1336
|
+
} : void 0), o = a.children.map(Ge), s = a.children.map((e) => G(e.style.margin, 0)), c = gt(a.colTracks, a.colCollapsed, Je(a, o, s, t), "min-content", i, !1), l = c.gapBefore.reduce((e, t) => e + t, 0), u = {
|
|
1292
1337
|
min: c.sizes.reduce((e, t) => e + t, 0) + l,
|
|
1293
1338
|
max: c.limits.reduce((e, t) => e + t, 0) + l
|
|
1294
1339
|
};
|
|
1295
1340
|
return t.gridIntrinsic.set(e, u), u;
|
|
1296
1341
|
}
|
|
1297
|
-
function
|
|
1298
|
-
let o = e.style, s =
|
|
1342
|
+
function et(e, t, n, r, i, a) {
|
|
1343
|
+
let o = e.style, s = rt(e), c = o.gridTemplateColumns.kind === "subgrid" && a !== void 0, l = o.gridTemplateRows.kind === "subgrid" && a !== void 0, u = c ? tt(a.col) : st(o.gridTemplateColumns, t, r), d = l ? tt(a.row) : st(o.gridTemplateRows, n, i), f = o.gridTemplateAreas, p = [...u.tracks], m = [...d.tracks];
|
|
1299
1344
|
if (f) {
|
|
1300
|
-
c ||
|
|
1345
|
+
c || lt(p, u.lineNames, f.columns, o.gridAutoColumns), l || lt(m, d.lineNames, f.rows, o.gridAutoRows);
|
|
1301
1346
|
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`);
|
|
1302
1347
|
}
|
|
1303
1348
|
let h = {
|
|
@@ -1306,28 +1351,28 @@ function Ue(e, t, n, r, i, a) {
|
|
|
1306
1351
|
}, g = {
|
|
1307
1352
|
explicitCount: m.length,
|
|
1308
1353
|
names: d.lineNames
|
|
1309
|
-
}, _ =
|
|
1310
|
-
col:
|
|
1311
|
-
row:
|
|
1354
|
+
}, _ = ht(s.map((e) => ({
|
|
1355
|
+
col: mt(e.style.gridColumnStart, e.style.gridColumnEnd, h),
|
|
1356
|
+
row: mt(e.style.gridRowStart, e.style.gridRowEnd, g)
|
|
1312
1357
|
})), p.length, m.length, o.gridAutoFlow);
|
|
1313
|
-
return c &&
|
|
1358
|
+
return c && nt(_, "col", p.length), l && nt(_, "row", m.length), {
|
|
1314
1359
|
children: s,
|
|
1315
1360
|
placed: _,
|
|
1316
1361
|
colLines: h,
|
|
1317
1362
|
rowLines: g,
|
|
1318
|
-
colTracks:
|
|
1319
|
-
rowTracks:
|
|
1320
|
-
colCollapsed:
|
|
1321
|
-
rowCollapsed:
|
|
1363
|
+
colTracks: ut(p, _.colOrigin, _.colCount, o.gridAutoColumns),
|
|
1364
|
+
rowTracks: ut(m, _.rowOrigin, _.rowCount, o.gridAutoRows),
|
|
1365
|
+
colCollapsed: dt(u, _.colOrigin, _.colCount, _.items.map((e) => e.col)),
|
|
1366
|
+
rowCollapsed: dt(d, _.rowOrigin, _.rowCount, _.items.map((e) => e.row))
|
|
1322
1367
|
};
|
|
1323
1368
|
}
|
|
1324
|
-
function
|
|
1369
|
+
function tt(e) {
|
|
1325
1370
|
return {
|
|
1326
|
-
tracks: Array.from({ length: e }, () =>
|
|
1371
|
+
tracks: Array.from({ length: e }, () => Ue()),
|
|
1327
1372
|
lineNames: Array.from({ length: e + 1 }, () => [])
|
|
1328
1373
|
};
|
|
1329
1374
|
}
|
|
1330
|
-
function
|
|
1375
|
+
function nt(e, t, n) {
|
|
1331
1376
|
let r = t === "col" ? e.colOrigin : e.rowOrigin;
|
|
1332
1377
|
for (let i of e.items) {
|
|
1333
1378
|
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);
|
|
@@ -1335,22 +1380,22 @@ function Ge(e, t, n) {
|
|
|
1335
1380
|
}
|
|
1336
1381
|
t === "col" ? (e.colOrigin = 0, e.colCount = n) : (e.rowOrigin = 0, e.rowCount = n);
|
|
1337
1382
|
}
|
|
1338
|
-
function
|
|
1383
|
+
function rt(e) {
|
|
1339
1384
|
return e.children.filter((e) => !B(e.style) && !e.inlineBox).sort((e, t) => e.style.order - t.style.order);
|
|
1340
1385
|
}
|
|
1341
|
-
function
|
|
1386
|
+
function it(e) {
|
|
1342
1387
|
return (e.left ?? 0) + (e.right ?? 0);
|
|
1343
1388
|
}
|
|
1344
|
-
function
|
|
1389
|
+
function at(e) {
|
|
1345
1390
|
return (e.top ?? 0) + (e.bottom ?? 0);
|
|
1346
1391
|
}
|
|
1347
|
-
function
|
|
1392
|
+
function ot(e, t, n) {
|
|
1348
1393
|
let r = e.style, i;
|
|
1349
1394
|
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));
|
|
1350
1395
|
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
1351
1396
|
return Math.max(0, H(i, a, o));
|
|
1352
1397
|
}
|
|
1353
|
-
function
|
|
1398
|
+
function st(e, t, n) {
|
|
1354
1399
|
if (e.kind !== "tracks") return {
|
|
1355
1400
|
tracks: [],
|
|
1356
1401
|
lineNames: [[]]
|
|
@@ -1363,7 +1408,7 @@ function Xe(e, t, n) {
|
|
|
1363
1408
|
let { index: i, tracks: a, mode: o } = e.autoRepeat, s = 1;
|
|
1364
1409
|
if (t !== void 0) {
|
|
1365
1410
|
let e = a.reduce((e, n) => {
|
|
1366
|
-
let r =
|
|
1411
|
+
let r = ct(n.min, t) ?? ct(n.max, t) ?? 1;
|
|
1367
1412
|
return e + Math.max(1, r);
|
|
1368
1413
|
}, 0);
|
|
1369
1414
|
s = Math.max(1, Math.floor((t + n) / (e + n * a.length)));
|
|
@@ -1391,23 +1436,23 @@ function Xe(e, t, n) {
|
|
|
1391
1436
|
lineNames: d
|
|
1392
1437
|
};
|
|
1393
1438
|
}
|
|
1394
|
-
function
|
|
1439
|
+
function ct(e, t) {
|
|
1395
1440
|
if (e.kind === "cells") return e.value;
|
|
1396
|
-
if (e.kind === "percent" && t !== void 0) return
|
|
1441
|
+
if (e.kind === "percent" && t !== void 0) return de(e.value, t);
|
|
1397
1442
|
if (e.kind === "math") {
|
|
1398
1443
|
let n = [];
|
|
1399
1444
|
for (let r of e.args) {
|
|
1400
|
-
let e =
|
|
1445
|
+
let e = ct(r, t);
|
|
1401
1446
|
if (e === void 0) return;
|
|
1402
1447
|
n.push(e);
|
|
1403
1448
|
}
|
|
1404
1449
|
return e.fn === "min" ? Math.min(...n) : Math.max(...n);
|
|
1405
1450
|
}
|
|
1406
1451
|
}
|
|
1407
|
-
function
|
|
1452
|
+
function lt(e, t, n, r) {
|
|
1408
1453
|
for (let i = e.length; i < n; i++) e.push(r[(i - e.length) % r.length]), t.push([]);
|
|
1409
1454
|
}
|
|
1410
|
-
function
|
|
1455
|
+
function ut(e, t, n, r) {
|
|
1411
1456
|
let i = [];
|
|
1412
1457
|
for (let a = 0; a < n; a++) {
|
|
1413
1458
|
let n = a + t;
|
|
@@ -1419,7 +1464,7 @@ function $e(e, t, n, r) {
|
|
|
1419
1464
|
}
|
|
1420
1465
|
return i;
|
|
1421
1466
|
}
|
|
1422
|
-
function
|
|
1467
|
+
function dt(e, t, n, r) {
|
|
1423
1468
|
let i = Array.from({ length: n }, () => !1);
|
|
1424
1469
|
if (!e.autoFit) return i;
|
|
1425
1470
|
for (let a = e.autoFit.start; a < e.autoFit.end; a++) {
|
|
@@ -1428,7 +1473,7 @@ function et(e, t, n, r) {
|
|
|
1428
1473
|
}
|
|
1429
1474
|
return i;
|
|
1430
1475
|
}
|
|
1431
|
-
function
|
|
1476
|
+
function ft(e, t, n) {
|
|
1432
1477
|
if (e.kind === "line") return e.value > 0 ? e.value - 1 : n.explicitCount + 1 + e.value;
|
|
1433
1478
|
if (e.kind !== "name") return null;
|
|
1434
1479
|
if (e.nth === void 0) {
|
|
@@ -1443,14 +1488,14 @@ function tt(e, t, n) {
|
|
|
1443
1488
|
for (let t = i; t >= 0; t--) if (n.names[t].includes(e.name) && ++a === -r) return t;
|
|
1444
1489
|
return -(-r - a);
|
|
1445
1490
|
}
|
|
1446
|
-
function
|
|
1491
|
+
function pt(e, t, n, r) {
|
|
1447
1492
|
if (t.name === void 0) return e + n * t.value;
|
|
1448
1493
|
let i = t.value, a = e;
|
|
1449
1494
|
for (; i > 0;) a += n, (!(a >= 0 && a <= r.explicitCount) || r.names[a].includes(t.name)) && i--;
|
|
1450
1495
|
return a;
|
|
1451
1496
|
}
|
|
1452
|
-
function
|
|
1453
|
-
let r =
|
|
1497
|
+
function mt(e, t, n) {
|
|
1498
|
+
let r = ft(e, "start", n), i = ft(t, "end", n);
|
|
1454
1499
|
if (r !== null && i !== null) return r === i ? {
|
|
1455
1500
|
start: r,
|
|
1456
1501
|
span: 1
|
|
@@ -1460,10 +1505,10 @@ function rt(e, t, n) {
|
|
|
1460
1505
|
};
|
|
1461
1506
|
if (r !== null) return {
|
|
1462
1507
|
start: r,
|
|
1463
|
-
span: (t.kind === "span" ?
|
|
1508
|
+
span: (t.kind === "span" ? pt(r, t, 1, n) : r + 1) - r
|
|
1464
1509
|
};
|
|
1465
1510
|
if (i !== null) {
|
|
1466
|
-
let t = e.kind === "span" ?
|
|
1511
|
+
let t = e.kind === "span" ? pt(i, e, -1, n) : i - 1;
|
|
1467
1512
|
return {
|
|
1468
1513
|
start: t,
|
|
1469
1514
|
span: i - t
|
|
@@ -1474,7 +1519,7 @@ function rt(e, t, n) {
|
|
|
1474
1519
|
span: e.kind === "span" ? e.value : t.kind === "span" ? t.value : 1
|
|
1475
1520
|
};
|
|
1476
1521
|
}
|
|
1477
|
-
function
|
|
1522
|
+
function ht(e, t, n, r) {
|
|
1478
1523
|
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);
|
|
1479
1524
|
for (let t = 0; t < e.length; t++) {
|
|
1480
1525
|
let e = o[t];
|
|
@@ -1571,7 +1616,7 @@ function it(e, t, n, r) {
|
|
|
1571
1616
|
rowCount: S
|
|
1572
1617
|
};
|
|
1573
1618
|
}
|
|
1574
|
-
function
|
|
1619
|
+
function gt(e, t, n, r, i, a) {
|
|
1575
1620
|
let o = typeof r == "number" ? r : void 0, s = e.map((e, n) => {
|
|
1576
1621
|
if (t[n]) return {
|
|
1577
1622
|
base: 0,
|
|
@@ -1581,7 +1626,7 @@ function at(e, t, n, r, i, a) {
|
|
|
1581
1626
|
frFactor: 0,
|
|
1582
1627
|
collapsed: !0
|
|
1583
1628
|
};
|
|
1584
|
-
let r =
|
|
1629
|
+
let r = ct(e.min, o), i = r ?? 0, a = r === void 0, s = e.max;
|
|
1585
1630
|
if (s.kind === "fr") return {
|
|
1586
1631
|
base: i,
|
|
1587
1632
|
limit: null,
|
|
@@ -1590,7 +1635,7 @@ function at(e, t, n, r, i, a) {
|
|
|
1590
1635
|
frFactor: s.value,
|
|
1591
1636
|
collapsed: !1
|
|
1592
1637
|
};
|
|
1593
|
-
let c =
|
|
1638
|
+
let c = ct(s, o);
|
|
1594
1639
|
return c === void 0 ? {
|
|
1595
1640
|
base: i,
|
|
1596
1641
|
limit: null,
|
|
@@ -1668,7 +1713,7 @@ function at(e, t, n, r, i, a) {
|
|
|
1668
1713
|
n <= 0 || (t = Math.max(t, (e.max - r) / Math.max(n, 1)));
|
|
1669
1714
|
}
|
|
1670
1715
|
for (let n of e) {
|
|
1671
|
-
let e = Math.max(n.base,
|
|
1716
|
+
let e = Math.max(n.base, M(n.frFactor * t));
|
|
1672
1717
|
n.limit = e, r === "max-content" && (n.base = e);
|
|
1673
1718
|
}
|
|
1674
1719
|
}
|
|
@@ -1715,62 +1760,62 @@ function at(e, t, n, r, i, a) {
|
|
|
1715
1760
|
limits: s.map((e) => u(e))
|
|
1716
1761
|
};
|
|
1717
1762
|
}
|
|
1718
|
-
function
|
|
1719
|
-
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t -
|
|
1763
|
+
function _t(e, t, n) {
|
|
1764
|
+
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t - vt(e)), o = F(n === "stretch" ? "start" : n, r, a), s = [], c = 0;
|
|
1720
1765
|
for (let e = 0; e < r.length; e++) c += i[e], s.push(o[e] + c);
|
|
1721
1766
|
return s;
|
|
1722
1767
|
}
|
|
1723
|
-
function
|
|
1768
|
+
function vt(e) {
|
|
1724
1769
|
return e.sizes.reduce((e, t) => e + t, 0) + e.gapBefore.reduce((e, t) => e + t, 0);
|
|
1725
1770
|
}
|
|
1726
|
-
function
|
|
1771
|
+
function yt(e, t, n, r) {
|
|
1727
1772
|
let i = n + r - 1;
|
|
1728
1773
|
return e[n] === void 0 || e[i] === void 0 ? 0 : e[i] + t[i] - e[n];
|
|
1729
1774
|
}
|
|
1730
|
-
function
|
|
1775
|
+
function bt(e, t, n, r, i) {
|
|
1731
1776
|
let a = t ?? 0, o = n ?? 0, s = r - i;
|
|
1732
1777
|
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a + L(e, r, i + a + o);
|
|
1733
1778
|
}
|
|
1734
1779
|
//#endregion
|
|
1735
1780
|
//#region src/multicol.ts
|
|
1736
|
-
function
|
|
1781
|
+
function xt(e, t, n) {
|
|
1737
1782
|
let r = e.columnWidth === null ? null : Math.max(1, Math.floor((t + n) / (e.columnWidth + n)));
|
|
1738
1783
|
return e.columnCount !== null && r !== null ? Math.max(1, Math.min(e.columnCount, r)) : r === null ? Math.max(1, e.columnCount ?? 1) : r;
|
|
1739
1784
|
}
|
|
1740
|
-
function
|
|
1741
|
-
let r =
|
|
1785
|
+
function St(e, t, n) {
|
|
1786
|
+
let r = xt(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r)), a = Math.max(0, t - (r * i + (r - 1) * n));
|
|
1742
1787
|
return Array.from({ length: r }, (e, t) => i + +(t < a));
|
|
1743
1788
|
}
|
|
1744
|
-
function
|
|
1789
|
+
function Ct(e, t) {
|
|
1745
1790
|
let n = Math.max(typeof e.gapX == "number" ? e.gapX : 0, e.ruleX?.width ?? 0);
|
|
1746
1791
|
return e.columnCount === null ? Math.max(e.columnWidth ?? 1, t) : e.columnCount * t + (e.columnCount - 1) * n;
|
|
1747
1792
|
}
|
|
1748
|
-
function
|
|
1793
|
+
function wt(e, t) {
|
|
1749
1794
|
return e === void 0 ? t : t === void 0 ? e : Math.min(e, t);
|
|
1750
1795
|
}
|
|
1751
|
-
function
|
|
1796
|
+
function Tt(e, t, n) {
|
|
1752
1797
|
for (; e < t;) {
|
|
1753
1798
|
let r = e + t >> 1;
|
|
1754
1799
|
n(r) ? t = r : e = r + 1;
|
|
1755
1800
|
}
|
|
1756
1801
|
return e;
|
|
1757
1802
|
}
|
|
1758
|
-
function
|
|
1759
|
-
let r =
|
|
1803
|
+
function Et(e, t, n) {
|
|
1804
|
+
let r = xt(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r));
|
|
1760
1805
|
return {
|
|
1761
1806
|
count: r,
|
|
1762
1807
|
width: i,
|
|
1763
1808
|
leftover: Math.max(0, t - (r * i + (r - 1) * n))
|
|
1764
1809
|
};
|
|
1765
1810
|
}
|
|
1766
|
-
function
|
|
1811
|
+
function Dt(e, t, n) {
|
|
1767
1812
|
return e === "all" ? !0 : e === "around" ? t || n : t && n;
|
|
1768
1813
|
}
|
|
1769
|
-
function
|
|
1770
|
-
let i =
|
|
1814
|
+
function Ot(e, t, n, r) {
|
|
1815
|
+
let i = Tn(e, Math.max(1, t.width - e.style.tracking)), { heights: a, textOffsets: o } = En(e, i), s = e.style.lineGap, c = kt(a.map((e) => e + s)), l;
|
|
1771
1816
|
if (e.style.columnFill === "auto" && r !== void 0) l = Math.max(1, r);
|
|
1772
1817
|
else {
|
|
1773
|
-
let e =
|
|
1818
|
+
let e = Tt(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);
|
|
1774
1819
|
l = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
1775
1820
|
}
|
|
1776
1821
|
let u = z(c, s, l);
|
|
@@ -1807,7 +1852,7 @@ function z(e, t, n, r = "truncate") {
|
|
|
1807
1852
|
top: c
|
|
1808
1853
|
};
|
|
1809
1854
|
}
|
|
1810
|
-
function
|
|
1855
|
+
function kt(e) {
|
|
1811
1856
|
return e.map((e) => ({
|
|
1812
1857
|
rows: e,
|
|
1813
1858
|
pre: 0,
|
|
@@ -1816,27 +1861,27 @@ function vt(e) {
|
|
|
1816
1861
|
lines: 1
|
|
1817
1862
|
}));
|
|
1818
1863
|
}
|
|
1819
|
-
var
|
|
1820
|
-
function
|
|
1821
|
-
if (
|
|
1864
|
+
var At = null;
|
|
1865
|
+
function jt() {
|
|
1866
|
+
if (At !== null) return At;
|
|
1822
1867
|
let e = document.createElement("div");
|
|
1823
1868
|
e.style.cssText = "position:absolute;left:-9999px;visibility:hidden;columns:2;column-gap:0;column-fill:balance;width:200px;font:10px/20px monospace;orphans:1;widows:1", e.innerHTML = "<div style=\"margin:0;padding:0 0 20px 0\">aaaaaa aaaaaa aaaaaa</div><div style=\"margin:0\"><span>bbbbbb</span> bbbbbb</div>", document.body.appendChild(e);
|
|
1824
1869
|
let t = e.getBoundingClientRect().top, n = e.querySelector("span").getBoundingClientRect();
|
|
1825
|
-
return e.remove(),
|
|
1870
|
+
return e.remove(), At = !(n.width > 0 && n.top - t >= 10), At;
|
|
1826
1871
|
}
|
|
1827
|
-
function
|
|
1828
|
-
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 =
|
|
1872
|
+
function Mt(e, t) {
|
|
1873
|
+
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 = ve(e, Math.max(1, n - i), {
|
|
1829
1874
|
advances: s,
|
|
1830
1875
|
tracking: i,
|
|
1831
1876
|
firstLineIndent: t.firstLineIndent
|
|
1832
|
-
}), l =
|
|
1877
|
+
}), l = kt(c.map(() => 1 + a)), u = z(l, a, o ?? Tt(1, Math.max(1, c.length * (1 + a) - a), (e) => z(l, a, e).columns <= r));
|
|
1833
1878
|
return c.map((t, n) => ({
|
|
1834
1879
|
text: e.slice(t.start, t.end),
|
|
1835
1880
|
column: u.column[n],
|
|
1836
1881
|
top: u.top[n]
|
|
1837
1882
|
}));
|
|
1838
1883
|
}
|
|
1839
|
-
function
|
|
1884
|
+
function Nt(e, t, n, r) {
|
|
1840
1885
|
let i = e.style;
|
|
1841
1886
|
if (!i.ruleX) return;
|
|
1842
1887
|
let a = t.columnCount * t.columnWidth + (t.columnCount - 1) * t.gap, o = t.ruleSegments ?? [{
|
|
@@ -1846,17 +1891,17 @@ function St(e, t, n, r) {
|
|
|
1846
1891
|
}], s = [];
|
|
1847
1892
|
for (let e of o) {
|
|
1848
1893
|
let n = Math.min(e.columns, t.columnCount);
|
|
1849
|
-
for (let r = 0; r < t.columnCount - 1; r++)
|
|
1894
|
+
for (let r = 0; r < t.columnCount - 1; r++) Dt(i.ruleVisibilityItems, r < n, r + 1 < n) && s.push({
|
|
1850
1895
|
bandStart: (r + 1) * t.columnWidth + r * t.gap,
|
|
1851
1896
|
bandSize: t.gap,
|
|
1852
1897
|
start: e.start,
|
|
1853
1898
|
end: e.end
|
|
1854
1899
|
});
|
|
1855
1900
|
}
|
|
1856
|
-
e.decorationRuns =
|
|
1901
|
+
e.decorationRuns = ce({
|
|
1857
1902
|
ruleX: i.ruleX,
|
|
1858
1903
|
ruleY: null,
|
|
1859
|
-
vertical:
|
|
1904
|
+
vertical: ke(s, i.ruleInset),
|
|
1860
1905
|
horizontal: [],
|
|
1861
1906
|
contentWidth: a,
|
|
1862
1907
|
contentHeight: t.totalRows,
|
|
@@ -1866,12 +1911,12 @@ function St(e, t, n, r) {
|
|
|
1866
1911
|
padding: r
|
|
1867
1912
|
});
|
|
1868
1913
|
}
|
|
1869
|
-
function
|
|
1914
|
+
function Pt(e, t) {
|
|
1870
1915
|
let n = e.style, r = n.padding;
|
|
1871
1916
|
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;
|
|
1872
1917
|
}
|
|
1873
|
-
function
|
|
1874
|
-
let s = e.style, c = U(s, "x", n), l =
|
|
1918
|
+
function Ft(e, t, n, r, i, a, o) {
|
|
1919
|
+
let s = e.style, c = U(s, "x", n), l = Et(s, n, c);
|
|
1875
1920
|
a.right += l.leftover;
|
|
1876
1921
|
let u = s.lineGap, d = i.left + a.left, f = i.top + a.top, p = n - l.leftover, m = [[]], h = [];
|
|
1877
1922
|
for (let e of t) e.style.columnSpan ? (h[m.length - 1] = e, m.push([])) : m[m.length - 1].push(e);
|
|
@@ -1881,13 +1926,13 @@ function wt(e, t, n, r, i, a, o) {
|
|
|
1881
1926
|
if (t.length > 0) {
|
|
1882
1927
|
let i = t.map((e) => ({
|
|
1883
1928
|
node: e,
|
|
1884
|
-
spans:
|
|
1929
|
+
spans: Tn(e, Math.max(1, l.width - e.style.tracking)),
|
|
1885
1930
|
margin: G(e.style.margin, l.width),
|
|
1886
1931
|
pre: 0,
|
|
1887
1932
|
post: 0
|
|
1888
1933
|
})), a = [], o = null, h = null, x = !1;
|
|
1889
1934
|
for (let e of i) {
|
|
1890
|
-
let { node: t, spans: n, margin: r } = e, i = o === null ? r.top ?? 0 :
|
|
1935
|
+
let { node: t, spans: n, margin: r } = e, i = o === null ? r.top ?? 0 : jn(o, r.top ?? 0), s = i;
|
|
1891
1936
|
_ === "glue" && h !== null ? (s = 0, h.post = i, a[a.length - 1].post = i) : e.pre = i;
|
|
1892
1937
|
let c = x || t.style.breakBeforeColumn;
|
|
1893
1938
|
if (t.style.breakInsideAvoid && n.length > 0) a.push({
|
|
@@ -1910,7 +1955,7 @@ function wt(e, t, n, r, i, a, o) {
|
|
|
1910
1955
|
let S;
|
|
1911
1956
|
if (s.columnFill === "auto" && r !== void 0) S = Math.max(1, r);
|
|
1912
1957
|
else {
|
|
1913
|
-
let e =
|
|
1958
|
+
let e = Tt(1, Math.max(1, z(a, u, Infinity, _).maxUsed), (e) => z(a, u, e, _).columns <= l.count);
|
|
1914
1959
|
S = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
1915
1960
|
}
|
|
1916
1961
|
let C = z(a, u, S, _);
|
|
@@ -1954,7 +1999,7 @@ function wt(e, t, n, r, i, a, o) {
|
|
|
1954
1999
|
if (i) {
|
|
1955
2000
|
let e = G(i.style.margin, p), t = (e.left ?? 0) + (e.right ?? 0);
|
|
1956
2001
|
V(i, Math.max(0, p - t), void 0, 0, 0, "fill", o);
|
|
1957
|
-
let r =
|
|
2002
|
+
let r = An(e, p, i.localRect.width), a = (e.top ?? 0) + n;
|
|
1958
2003
|
y += a, i.localRect = {
|
|
1959
2004
|
...i.localRect,
|
|
1960
2005
|
x: d + r,
|
|
@@ -1993,10 +2038,10 @@ function wt(e, t, n, r, i, a, o) {
|
|
|
1993
2038
|
} : {}
|
|
1994
2039
|
}, x;
|
|
1995
2040
|
}
|
|
1996
|
-
function
|
|
1997
|
-
let s = e.style, c =
|
|
1998
|
-
if (u.length > 0 && u.every((e) =>
|
|
1999
|
-
let f = U(s, "x", t), p =
|
|
2041
|
+
function It(e, t, n, r, i, a, o) {
|
|
2042
|
+
let s = e.style, c = wt(n, r), l = e.children.filter((e) => !B(e.style)), u = l.filter((e) => !e.style.columnSpan), d = l.reduce((e, t, n) => !t.style.columnSpan && (n === 0 || l[n - 1].style.columnSpan) ? e + 1 : e, 0);
|
|
2043
|
+
if (u.length > 0 && u.every((e) => Pt(e, s)) && (u.length === l.length || s.columnFill === "balance" && c === void 0 && (jt() || d <= 1 && u.every((e) => (e.style.margin.top === 0 || e.style.margin.top === null) && (e.style.margin.bottom === 0 || e.style.margin.bottom === null))))) return Ft(e, l, t, c, i, a, o);
|
|
2044
|
+
let f = U(s, "x", t), p = St(s, t, f), m = p.length, h = [];
|
|
2000
2045
|
{
|
|
2001
2046
|
let e = 0;
|
|
2002
2047
|
for (let t of p) h.push(e), e += t + f;
|
|
@@ -2005,7 +2050,7 @@ function Tt(e, t, n, r, i, a, o) {
|
|
|
2005
2050
|
let r = 0, i = 0, a = null, s = 0, c = (e) => {
|
|
2006
2051
|
if (t) for (let t of w) {
|
|
2007
2052
|
if (t.index !== e) continue;
|
|
2008
|
-
let n = a === null ? t.margin.top ?? 0 :
|
|
2053
|
+
let n = a === null ? t.margin.top ?? 0 : jn(a, t.margin.top ?? 0);
|
|
2009
2054
|
t.child.staticSlot = {
|
|
2010
2055
|
kind: "block",
|
|
2011
2056
|
x: y + g(r) + (t.margin.left ?? 0),
|
|
@@ -2016,7 +2061,7 @@ function Tt(e, t, n, r, i, a, o) {
|
|
|
2016
2061
|
for (let l = 0; l < C.length; l++) {
|
|
2017
2062
|
let u = C[l];
|
|
2018
2063
|
c(l);
|
|
2019
|
-
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 :
|
|
2064
|
+
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 : jn(a, u.margin.top ?? 0), f = u.node.localRect.height;
|
|
2020
2065
|
if (a !== null && (u.breakBefore || i + d + f > e) && (r += 1, i = 0, a = null, d = 0), t) {
|
|
2021
2066
|
let e = u.node, t = _(r);
|
|
2022
2067
|
if (t !== v) {
|
|
@@ -2025,7 +2070,7 @@ function Tt(e, t, n, r, i, a, o) {
|
|
|
2025
2070
|
}
|
|
2026
2071
|
e.localRect = {
|
|
2027
2072
|
...e.localRect,
|
|
2028
|
-
x: y + g(r) +
|
|
2073
|
+
x: y + g(r) + An(u.margin, t, e.localRect.width),
|
|
2029
2074
|
y: b + S + i + d
|
|
2030
2075
|
};
|
|
2031
2076
|
}
|
|
@@ -2048,13 +2093,13 @@ function Tt(e, t, n, r, i, a, o) {
|
|
|
2048
2093
|
let e = c === void 0 ? void 0 : Math.max(1, c - S), t = s.columnFill === "auto" && e !== void 0, r;
|
|
2049
2094
|
if (t) r = e;
|
|
2050
2095
|
else {
|
|
2051
|
-
let t =
|
|
2096
|
+
let t = Tt(1, E(Infinity, !1).maxUsed, (e) => E(e, !1).columns <= m);
|
|
2052
2097
|
r = e === void 0 ? t : Math.min(t, e);
|
|
2053
2098
|
}
|
|
2054
2099
|
let i = E(r, !0), a = t && n !== void 0 ? Math.max(i.maxUsed, r) : i.maxUsed;
|
|
2055
2100
|
if (s.ruleX) for (let e = 0; e < m - 1; e++) {
|
|
2056
2101
|
let t = Math.min(i.columns, m);
|
|
2057
|
-
|
|
2102
|
+
Dt(s.ruleVisibilityItems, e < t, e + 1 < t) && x.push({
|
|
2058
2103
|
bandStart: h[e] + p[e],
|
|
2059
2104
|
bandSize: f,
|
|
2060
2105
|
start: S,
|
|
@@ -2077,7 +2122,7 @@ function Tt(e, t, n, r, i, a, o) {
|
|
|
2077
2122
|
let e = G(r.style.margin, t), i = (e.left ?? 0) + (e.right ?? 0);
|
|
2078
2123
|
V(r, Math.max(0, t - i), n, 0, 0, "fill", o), S += e.top ?? 0, r.localRect = {
|
|
2079
2124
|
...r.localRect,
|
|
2080
|
-
x: y +
|
|
2125
|
+
x: y + An(e, t, r.localRect.width),
|
|
2081
2126
|
y: b + S
|
|
2082
2127
|
}, S += r.localRect.height + (e.bottom ?? 0);
|
|
2083
2128
|
continue;
|
|
@@ -2089,10 +2134,10 @@ function Tt(e, t, n, r, i, a, o) {
|
|
|
2089
2134
|
breakBefore: T || r.style.breakBeforeColumn
|
|
2090
2135
|
}), T = r.style.breakAfterColumn;
|
|
2091
2136
|
}
|
|
2092
|
-
return D(), s.ruleX && x.length > 0 && (e.decorationRuns =
|
|
2137
|
+
return D(), s.ruleX && x.length > 0 && (e.decorationRuns = ce({
|
|
2093
2138
|
ruleX: s.ruleX,
|
|
2094
2139
|
ruleY: null,
|
|
2095
|
-
vertical:
|
|
2140
|
+
vertical: ke(x, s.ruleInset),
|
|
2096
2141
|
horizontal: [],
|
|
2097
2142
|
contentWidth: t,
|
|
2098
2143
|
contentHeight: S,
|
|
@@ -2103,40 +2148,33 @@ function Tt(e, t, n, r, i, a, o) {
|
|
|
2103
2148
|
})), S;
|
|
2104
2149
|
}
|
|
2105
2150
|
//#endregion
|
|
2106
|
-
//#region src/warn.ts
|
|
2107
|
-
var Et = /* @__PURE__ */ new WeakMap();
|
|
2108
|
-
function Dt(e, t) {
|
|
2109
|
-
let n = Et.get(e);
|
|
2110
|
-
n || Et.set(e, n = /* @__PURE__ */ new Set()), !n.has(t) && (n.add(t), console.warn(`[monowind] ${t}`, e));
|
|
2111
|
-
}
|
|
2112
|
-
//#endregion
|
|
2113
2151
|
//#region src/table.ts
|
|
2114
|
-
function
|
|
2115
|
-
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" &&
|
|
2152
|
+
function Lt(e, t) {
|
|
2153
|
+
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" && b(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).");
|
|
2116
2154
|
}
|
|
2117
|
-
function
|
|
2155
|
+
function Rt(e, t) {
|
|
2118
2156
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
2119
2157
|
return Number.isNaN(n) ? 1 : t === "colspan" ? Math.min(1e3, Math.max(1, n)) : Math.min(65534, Math.max(0, n));
|
|
2120
2158
|
}
|
|
2121
|
-
function
|
|
2159
|
+
function zt(e, t, n) {
|
|
2122
2160
|
let r = (t, r) => {
|
|
2123
2161
|
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;
|
|
2124
2162
|
for (let t = 0; t < r; t++) e.colFixed.push(a), e.colPercent.push(o);
|
|
2125
2163
|
};
|
|
2126
2164
|
if (t.style.tableRole === "column") {
|
|
2127
|
-
r(t,
|
|
2165
|
+
r(t, Bt(t.source));
|
|
2128
2166
|
return;
|
|
2129
2167
|
}
|
|
2130
2168
|
let i = t.children.filter((e) => e.style.tableRole === "column");
|
|
2131
|
-
if (i.length === 0) r(t,
|
|
2132
|
-
else for (let e of i) r(e,
|
|
2133
|
-
for (let n of t.children) n.style.tableRole !== "column" &&
|
|
2169
|
+
if (i.length === 0) r(t, Bt(t.source));
|
|
2170
|
+
else for (let e of i) r(e, Bt(e.source));
|
|
2171
|
+
for (let n of t.children) n.style.tableRole !== "column" && Lt(e, n);
|
|
2134
2172
|
}
|
|
2135
|
-
function
|
|
2173
|
+
function Bt(e) {
|
|
2136
2174
|
let t = Number.parseInt(e.getAttribute("span") ?? "", 10);
|
|
2137
2175
|
return Number.isNaN(t) ? 1 : Math.min(1e3, Math.max(1, t));
|
|
2138
2176
|
}
|
|
2139
|
-
function
|
|
2177
|
+
function Vt(e, t) {
|
|
2140
2178
|
let n = {
|
|
2141
2179
|
caption: null,
|
|
2142
2180
|
rows: [],
|
|
@@ -2160,8 +2198,8 @@ function Mt(e, t) {
|
|
|
2160
2198
|
for (let e of o.children) B(e.style) || (e.style.tableRole === "row" ? t.push({
|
|
2161
2199
|
row: e,
|
|
2162
2200
|
group: o
|
|
2163
|
-
}) :
|
|
2164
|
-
} else e === "caption" ? n.caption === null ? n.caption = o :
|
|
2201
|
+
}) : Lt(n, e));
|
|
2202
|
+
} else e === "caption" ? n.caption === null ? n.caption = o : Lt(n, o) : e === "column" || e === "column-group" ? (zt(n, o, t), n.hidden.push(o)) : Lt(n, o);
|
|
2165
2203
|
}
|
|
2166
2204
|
let o = [
|
|
2167
2205
|
...r,
|
|
@@ -2176,20 +2214,20 @@ function Mt(e, t) {
|
|
|
2176
2214
|
s = e + 1;
|
|
2177
2215
|
}
|
|
2178
2216
|
}
|
|
2179
|
-
return
|
|
2217
|
+
return Ht(n), n;
|
|
2180
2218
|
}
|
|
2181
|
-
function
|
|
2219
|
+
function Ht(e) {
|
|
2182
2220
|
let t = [];
|
|
2183
2221
|
for (let n = 0; n < e.rows.length; n++) {
|
|
2184
2222
|
let r = e.rows[n], i = 0;
|
|
2185
2223
|
for (let a of r.children) {
|
|
2186
2224
|
if (B(a.style)) continue;
|
|
2187
2225
|
if (a.style.tableRole !== "cell") {
|
|
2188
|
-
|
|
2226
|
+
Lt(e, a);
|
|
2189
2227
|
continue;
|
|
2190
2228
|
}
|
|
2191
2229
|
for (; (t[i] ?? 0) > n;) i++;
|
|
2192
|
-
let o =
|
|
2230
|
+
let o = Rt(a.source, "colspan"), s = Rt(a.source, "rowspan"), c = e.groupEnds[n], l = Math.max(1, Math.min(s === 0 ? c - n : s, c - n));
|
|
2193
2231
|
for (let e = i; e < i + o; e++) t[e] = Math.max(t[e] ?? 0, n + l);
|
|
2194
2232
|
e.cells.push({
|
|
2195
2233
|
node: a,
|
|
@@ -2203,7 +2241,7 @@ function Nt(e) {
|
|
|
2203
2241
|
}
|
|
2204
2242
|
e.columnCount = Math.max(t.length, e.colFixed.length);
|
|
2205
2243
|
}
|
|
2206
|
-
function
|
|
2244
|
+
function Ut(e, t, n) {
|
|
2207
2245
|
let r = e.style, i = Y(e, n), a;
|
|
2208
2246
|
if (t === "min") a = i;
|
|
2209
2247
|
else {
|
|
@@ -2213,11 +2251,11 @@ function Pt(e, t, n) {
|
|
|
2213
2251
|
let o = typeof r.minWidth == "number" ? r.minWidth : 0, s = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
2214
2252
|
return Math.max(0, H(a, o, s));
|
|
2215
2253
|
}
|
|
2216
|
-
function
|
|
2254
|
+
function Wt(e) {
|
|
2217
2255
|
let t = e.style.width;
|
|
2218
2256
|
return t && t.kind === "percent" ? t.value : void 0;
|
|
2219
2257
|
}
|
|
2220
|
-
function
|
|
2258
|
+
function Gt(e, t, n) {
|
|
2221
2259
|
let r = e.columnCount, i = Array.from({ length: r }, () => 0), a = Array.from({ length: r }, () => 0), o = Array.from({ length: r }, () => void 0);
|
|
2222
2260
|
for (let t = 0; t < r; t++) e.colFixed[t] !== void 0 && (a[t] = e.colFixed[t]), o[t] = e.colPercent[t];
|
|
2223
2261
|
let s = [];
|
|
@@ -2226,15 +2264,15 @@ function It(e, t, n) {
|
|
|
2226
2264
|
s.push(t);
|
|
2227
2265
|
continue;
|
|
2228
2266
|
}
|
|
2229
|
-
i[t.col] = Math.max(i[t.col],
|
|
2230
|
-
let e =
|
|
2267
|
+
i[t.col] = Math.max(i[t.col], Ut(t.node, "min", n)), a[t.col] = Math.max(a[t.col], Ut(t.node, "max", n));
|
|
2268
|
+
let e = Wt(t.node);
|
|
2231
2269
|
e !== void 0 && (o[t.col] = Math.max(o[t.col] ?? 0, e));
|
|
2232
2270
|
}
|
|
2233
2271
|
s.sort((e, t) => e.colSpan - t.colSpan);
|
|
2234
2272
|
for (let e of s) {
|
|
2235
|
-
let r = e.col, o = e.col + e.colSpan, s =
|
|
2273
|
+
let r = e.col, o = e.col + e.colSpan, s = Qt(t, r, o), c = a.slice(r, o);
|
|
2236
2274
|
for (let t of ["min", "max"]) {
|
|
2237
|
-
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d =
|
|
2275
|
+
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d = Ut(e.node, t, n) - u;
|
|
2238
2276
|
if (d <= 0) continue;
|
|
2239
2277
|
let f = I(c.some((e) => e > 0) ? c : c.map(() => 1), d);
|
|
2240
2278
|
for (let e = r; e < o; e++) l[e] += f[e - r];
|
|
@@ -2247,7 +2285,7 @@ function It(e, t, n) {
|
|
|
2247
2285
|
percent: o
|
|
2248
2286
|
};
|
|
2249
2287
|
}
|
|
2250
|
-
function
|
|
2288
|
+
function Kt(e, t) {
|
|
2251
2289
|
let n = e.min.length, r = e.min.slice(), i = [], a = [];
|
|
2252
2290
|
for (let t = 0; t < n; t++) (e.percent[t] === void 0 ? a : i).push(t);
|
|
2253
2291
|
if (i.length > 0) {
|
|
@@ -2276,7 +2314,7 @@ function Lt(e, t) {
|
|
|
2276
2314
|
}
|
|
2277
2315
|
return r;
|
|
2278
2316
|
}
|
|
2279
|
-
function
|
|
2317
|
+
function qt(e, t, n) {
|
|
2280
2318
|
let r = e.columnCount, i = Array.from({ length: r }, () => void 0);
|
|
2281
2319
|
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];
|
|
2282
2320
|
for (let r of e.cells) {
|
|
@@ -2296,13 +2334,13 @@ function Rt(e, t, n) {
|
|
|
2296
2334
|
}
|
|
2297
2335
|
return i.map((e) => e ?? 0);
|
|
2298
2336
|
}
|
|
2299
|
-
var
|
|
2337
|
+
var Jt = {
|
|
2300
2338
|
double: 3,
|
|
2301
2339
|
solid: 2,
|
|
2302
2340
|
dashed: 1,
|
|
2303
2341
|
dotted: 0
|
|
2304
2342
|
};
|
|
2305
|
-
function
|
|
2343
|
+
function Yt(e) {
|
|
2306
2344
|
for (let { border: t, side: n } of e) if (t?.hidden[n]) return null;
|
|
2307
2345
|
let t = null;
|
|
2308
2346
|
for (let { border: n, side: r } of e) {
|
|
@@ -2310,7 +2348,7 @@ function Bt(e) {
|
|
|
2310
2348
|
let e = n.width[r];
|
|
2311
2349
|
if (e <= 0) continue;
|
|
2312
2350
|
let i = n.style[r];
|
|
2313
|
-
(t === null || e > t.width || e === t.width &&
|
|
2351
|
+
(t === null || e > t.width || e === t.width && Jt[i] > Jt[t.style]) && (t = {
|
|
2314
2352
|
width: e,
|
|
2315
2353
|
style: i,
|
|
2316
2354
|
color: n.color[r]
|
|
@@ -2318,7 +2356,7 @@ function Bt(e) {
|
|
|
2318
2356
|
}
|
|
2319
2357
|
return t;
|
|
2320
2358
|
}
|
|
2321
|
-
function
|
|
2359
|
+
function Xt(e, t) {
|
|
2322
2360
|
let n = t.columnCount, r = t.rows.length, i = e.style.borderCollapse, a = {
|
|
2323
2361
|
collapsed: i,
|
|
2324
2362
|
vLines: Array.from({ length: n + 1 }, () => 0),
|
|
@@ -2363,7 +2401,7 @@ function Vt(e, t) {
|
|
|
2363
2401
|
side: u
|
|
2364
2402
|
});
|
|
2365
2403
|
}
|
|
2366
|
-
i.push(
|
|
2404
|
+
i.push(Yt(l));
|
|
2367
2405
|
}
|
|
2368
2406
|
a.vSegments.push(i), a.vLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
2369
2407
|
}
|
|
@@ -2402,47 +2440,47 @@ function Vt(e, t) {
|
|
|
2402
2440
|
}), e === r && l.push({
|
|
2403
2441
|
border: s,
|
|
2404
2442
|
side: "bottom"
|
|
2405
|
-
}), i.push(
|
|
2443
|
+
}), i.push(Yt(l));
|
|
2406
2444
|
}
|
|
2407
2445
|
a.hSegments.push(i), a.hLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
2408
2446
|
}
|
|
2409
2447
|
return a;
|
|
2410
2448
|
}
|
|
2411
|
-
function
|
|
2449
|
+
function Zt(e, t) {
|
|
2412
2450
|
return e.collapsed ? e.vLines.reduce((e, t) => e + t, 0) : (t + 1) * e.spacingX;
|
|
2413
2451
|
}
|
|
2414
|
-
function
|
|
2452
|
+
function Qt(e, t, n) {
|
|
2415
2453
|
if (!e.collapsed) return e.spacingX * (n - t - 1);
|
|
2416
2454
|
let r = 0;
|
|
2417
2455
|
for (let i = t + 1; i < n; i++) r += e.vLines[i];
|
|
2418
2456
|
return r;
|
|
2419
2457
|
}
|
|
2420
|
-
function
|
|
2458
|
+
function $t(e, t, n) {
|
|
2421
2459
|
if (!e.collapsed) return e.spacingY * (n - t - 1);
|
|
2422
2460
|
let r = 0;
|
|
2423
2461
|
for (let i = t + 1; i < n; i++) r += e.hLines[i];
|
|
2424
2462
|
return r;
|
|
2425
2463
|
}
|
|
2426
|
-
function
|
|
2464
|
+
function en(e, t) {
|
|
2427
2465
|
let n = t.tableData.get(e);
|
|
2428
2466
|
if (n) return n;
|
|
2429
|
-
let r =
|
|
2467
|
+
let r = Vt(e, t), i = Xt(e, r), a = {
|
|
2430
2468
|
structure: r,
|
|
2431
2469
|
chrome: i,
|
|
2432
|
-
bounds:
|
|
2433
|
-
chromeX:
|
|
2470
|
+
bounds: Gt(r, i, t),
|
|
2471
|
+
chromeX: Zt(i, r.columnCount)
|
|
2434
2472
|
};
|
|
2435
2473
|
return t.tableData.set(e, a), a;
|
|
2436
2474
|
}
|
|
2437
|
-
function
|
|
2438
|
-
let { structure: n, bounds: r, chromeX: i } =
|
|
2475
|
+
function tn(e, t) {
|
|
2476
|
+
let { structure: n, bounds: r, chromeX: i } = en(e, t), a = r.min.reduce((e, t) => e + t, 0) + i, o = r.max.reduce((e, t) => e + t, 0) + i;
|
|
2439
2477
|
return n.caption && (a = Math.max(a, Y(n.caption, t)), o = Math.max(o, J(n.caption, t))), {
|
|
2440
2478
|
min: a,
|
|
2441
2479
|
max: o
|
|
2442
2480
|
};
|
|
2443
2481
|
}
|
|
2444
|
-
function
|
|
2445
|
-
let r = e.style, { bounds: i, chromeX: a } =
|
|
2482
|
+
function nn(e, t, n) {
|
|
2483
|
+
let r = e.style, { bounds: i, chromeX: a } = en(e, n), { min: o, max: s } = tn(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;
|
|
2446
2484
|
for (let e = 0; e < i.max.length; e++) {
|
|
2447
2485
|
let t = i.percent[e];
|
|
2448
2486
|
t === void 0 ? d += i.max[e] : u += t;
|
|
@@ -2458,8 +2496,8 @@ function qt(e, t, n) {
|
|
|
2458
2496
|
let f = Math.max(l + a, s) + c;
|
|
2459
2497
|
return Math.max(o + c, Math.min(f, t));
|
|
2460
2498
|
}
|
|
2461
|
-
function
|
|
2462
|
-
let { structure: o, chrome: s, bounds: c } =
|
|
2499
|
+
function rn(e, t, n, r, i, a) {
|
|
2500
|
+
let { structure: o, chrome: s, bounds: c } = en(e, a), l = o.columnCount, u = o.rows.length, d = r.left + i.left, f = r.top + i.top;
|
|
2463
2501
|
for (let e of o.hidden) e.tableHidden = !0, e.localRect = {
|
|
2464
2502
|
x: 0,
|
|
2465
2503
|
y: 0,
|
|
@@ -2471,16 +2509,16 @@ function Jt(e, t, n, r, i, a) {
|
|
|
2471
2509
|
bottom: 0,
|
|
2472
2510
|
left: 0
|
|
2473
2511
|
}, e.unclampedHeight = 0;
|
|
2474
|
-
let p = Math.max(0, t -
|
|
2512
|
+
let p = Math.max(0, t - Zt(s, l)), m = e.style, h = m.tableLayout === "fixed" && m.width !== void 0 && m.width.kind !== "auto" ? qt(o, p, a) : Kt(c, p), g = [], _ = 0;
|
|
2475
2513
|
for (let e = 0; e < l; e++) _ += s.collapsed ? s.vLines[e] : s.spacingX, g.push(_), _ += h[e];
|
|
2476
2514
|
let v = _ + (s.collapsed ? s.vLines[l] ?? 0 : s.spacingX), y = 0;
|
|
2477
2515
|
o.caption && (V(o.caption, t, void 0, d, f, "fill", a), y = o.caption.localRect.height);
|
|
2478
2516
|
let b = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
|
|
2479
2517
|
for (let e of o.cells) {
|
|
2480
|
-
let t = e.col + e.colSpan, n = h.slice(e.col, t).reduce((e, t) => e + t, 0) +
|
|
2518
|
+
let t = e.col + e.colSpan, n = h.slice(e.col, t).reduce((e, t) => e + t, 0) + Qt(s, e.col, t);
|
|
2481
2519
|
x.set(e, n), V(e.node, n, void 0, 0, 0, "fill", a, { width: n }), b.set(e, e.node.localRect.height);
|
|
2482
2520
|
}
|
|
2483
|
-
let S = s.collapsed ? s.hLines.reduce((e, t) => e + t, 0) : (u + 1) * s.spacingY, C = n === void 0 ? void 0 : Math.max(0, n - y - S), w = (e) => e !== void 0 && e.kind === "percent" && C !== void 0 ?
|
|
2521
|
+
let S = s.collapsed ? s.hLines.reduce((e, t) => e + t, 0) : (u + 1) * s.spacingY, C = n === void 0 ? void 0 : Math.max(0, n - y - S), w = (e) => e !== void 0 && e.kind === "percent" && C !== void 0 ? de(e.value, C) : 0, T = Array.from({ length: u }, () => 0), E = Array.from({ length: u }, () => !1);
|
|
2484
2522
|
for (let e = 0; e < u; e++) {
|
|
2485
2523
|
let t = o.rows[e].style.height;
|
|
2486
2524
|
t !== void 0 && t.kind === "cells" && (T[e] = t.value);
|
|
@@ -2493,7 +2531,7 @@ function Jt(e, t, n, r, i, a) {
|
|
|
2493
2531
|
}
|
|
2494
2532
|
let D = o.cells.filter((e) => e.rowSpan > 1).sort((e, t) => e.rowSpan - t.rowSpan);
|
|
2495
2533
|
for (let e of D) {
|
|
2496
|
-
let t = e.row + e.rowSpan, n = T.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
2534
|
+
let t = e.row + e.rowSpan, n = T.slice(e.row, t).reduce((e, t) => e + t, 0) + $t(s, e.row, t), r = b.get(e) - n;
|
|
2497
2535
|
if (r <= 0) continue;
|
|
2498
2536
|
let i = I(Array.from({ length: e.rowSpan }, () => 1), r);
|
|
2499
2537
|
for (let n = e.row; n < t; n++) T[n] += i[n - e.row];
|
|
@@ -2544,11 +2582,11 @@ function Jt(e, t, n, r, i, a) {
|
|
|
2544
2582
|
}, t.unclampedHeight = T[e];
|
|
2545
2583
|
}
|
|
2546
2584
|
for (let e of o.cells) {
|
|
2547
|
-
let t = e.row + e.rowSpan, n = T.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
2585
|
+
let t = e.row + e.rowSpan, n = T.slice(e.row, t).reduce((e, t) => e + t, 0) + $t(s, e.row, t);
|
|
2548
2586
|
e.node.children.some((e) => !B(e.style) && e.style.height?.kind === "percent") && n !== b.get(e) && V(e.node, x.get(e), n, 0, 0, "fill", a, {
|
|
2549
2587
|
width: x.get(e),
|
|
2550
2588
|
height: n
|
|
2551
|
-
}),
|
|
2589
|
+
}), an(e.node, n - (e.node.naturalContentHeight ?? e.node.localRect.height)), e.node.localRect = {
|
|
2552
2590
|
x: g[e.col],
|
|
2553
2591
|
y: 0,
|
|
2554
2592
|
width: e.node.localRect.width,
|
|
@@ -2560,9 +2598,9 @@ function Jt(e, t, n, r, i, a) {
|
|
|
2560
2598
|
x: d,
|
|
2561
2599
|
y: f
|
|
2562
2600
|
});
|
|
2563
|
-
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + A), s.collapsed && l > 0 && u > 0 && (e.decorationRuns =
|
|
2601
|
+
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + A), s.collapsed && l > 0 && u > 0 && (e.decorationRuns = on(s, o, h, T, g, O, d, f)), e.style.captionSide === "bottom" ? A + y : A;
|
|
2564
2602
|
}
|
|
2565
|
-
function
|
|
2603
|
+
function an(e, t) {
|
|
2566
2604
|
if (t <= 0) return;
|
|
2567
2605
|
let n = e.style.verticalAlign, r = n === "center" ? Math.floor(t / 2) : n === "end" ? t : 0;
|
|
2568
2606
|
if (!e.children.some((e) => !B(e.style) && !e.inlineBox)) {
|
|
@@ -2571,14 +2609,14 @@ function Yt(e, t) {
|
|
|
2571
2609
|
}
|
|
2572
2610
|
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);
|
|
2573
2611
|
}
|
|
2574
|
-
function
|
|
2612
|
+
function on(e, t, n, r, i, a, o, s) {
|
|
2575
2613
|
let c = t.columnCount, l = t.rows.length, u = [], d = (t) => t < c ? i[t] - e.vLines[t] : i[c - 1] + n[c - 1], f = (t) => t < l ? a[t] - e.hLines[t] : a[l - 1] + r[l - 1];
|
|
2576
2614
|
for (let t = 0; t <= c; t++) {
|
|
2577
2615
|
let n = e.vSegments[t];
|
|
2578
2616
|
for (let e = 0; e < l; e++) {
|
|
2579
2617
|
let i = n[e];
|
|
2580
2618
|
if (!i) continue;
|
|
2581
|
-
let c =
|
|
2619
|
+
let c = ne(i.style, "v");
|
|
2582
2620
|
for (let n = 0; n < i.width; n++) for (let l = a[e]; l < a[e] + r[e]; l++) u.push({
|
|
2583
2621
|
glyph: c,
|
|
2584
2622
|
x: o + d(t) + n,
|
|
@@ -2593,7 +2631,7 @@ function Xt(e, t, n, r, i, a, o, s) {
|
|
|
2593
2631
|
for (let e = 0; e < c; e++) {
|
|
2594
2632
|
let a = r[e];
|
|
2595
2633
|
if (!a) continue;
|
|
2596
|
-
let c =
|
|
2634
|
+
let c = ne(a.style, "h");
|
|
2597
2635
|
for (let r = 0; r < a.width; r++) u.push({
|
|
2598
2636
|
glyph: c,
|
|
2599
2637
|
x: o + i[e],
|
|
@@ -2612,7 +2650,7 @@ function Xt(e, t, n, r, i, a, o, s) {
|
|
|
2612
2650
|
p
|
|
2613
2651
|
].filter((e) => e !== null);
|
|
2614
2652
|
if (m.length === 0) continue;
|
|
2615
|
-
let h = m.every((e) => e.style === "double") ? "double" : "solid", g = m.reduce((e, t) => t.width > e.width || t.width === e.width &&
|
|
2653
|
+
let h = m.every((e) => e.style === "double") ? "double" : "solid", g = m.reduce((e, t) => t.width > e.width || t.width === e.width && Jt[t.style] > Jt[e.style] ? t : e), _ = re(h, r !== null, i !== null, a !== null, p !== null);
|
|
2616
2654
|
for (let r = 0; r < e.vLines[t]; r++) for (let i = 0; i < e.hLines[n]; i++) u.push({
|
|
2617
2655
|
glyph: _,
|
|
2618
2656
|
x: o + d(t) + r,
|
|
@@ -2625,30 +2663,30 @@ function Xt(e, t, n, r, i, a, o, s) {
|
|
|
2625
2663
|
}
|
|
2626
2664
|
//#endregion
|
|
2627
2665
|
//#region src/positioning.ts
|
|
2628
|
-
function
|
|
2666
|
+
function sn(e) {
|
|
2629
2667
|
return e.position === "absolute" || e.position === "fixed" ? "absolute" : e.position === "relative" || e.position === "sticky" ? "relative" : "static";
|
|
2630
2668
|
}
|
|
2631
|
-
function
|
|
2669
|
+
function cn(e, t, n, r, i) {
|
|
2632
2670
|
for (let a of e.children) {
|
|
2633
|
-
let o =
|
|
2671
|
+
let o = sn(a.style);
|
|
2634
2672
|
if (o === "relative") {
|
|
2635
2673
|
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;
|
|
2636
|
-
a.localRect.x +=
|
|
2637
|
-
} else o === "absolute" &&
|
|
2638
|
-
|
|
2674
|
+
a.localRect.x += ln(a.style.insets.left, a.style.insets.right, t), a.localRect.y += ln(a.style.insets.top, a.style.insets.bottom, n);
|
|
2675
|
+
} else o === "absolute" && dn(a, e, t, n, r, i);
|
|
2676
|
+
cn(a, t + a.localRect.x, n + a.localRect.y, [...r, {
|
|
2639
2677
|
node: a,
|
|
2640
2678
|
absX: t + a.localRect.x,
|
|
2641
2679
|
absY: n + a.localRect.y
|
|
2642
2680
|
}], i);
|
|
2643
2681
|
}
|
|
2644
2682
|
}
|
|
2645
|
-
function
|
|
2683
|
+
function ln(e, t, n) {
|
|
2646
2684
|
return e === null ? t === null ? 0 : -W(t, n) : W(e, n);
|
|
2647
2685
|
}
|
|
2648
|
-
function
|
|
2686
|
+
function un(e, t) {
|
|
2649
2687
|
if (!t) for (let t = e.length - 1; t > 0; t--) {
|
|
2650
2688
|
let n = e[t];
|
|
2651
|
-
if (!
|
|
2689
|
+
if (!yn(n.node.style)) continue;
|
|
2652
2690
|
let r = n.node.style.border;
|
|
2653
2691
|
return {
|
|
2654
2692
|
x: n.absX + r.left,
|
|
@@ -2665,13 +2703,13 @@ function en(e, t) {
|
|
|
2665
2703
|
height: n.node.localRect.height
|
|
2666
2704
|
};
|
|
2667
2705
|
}
|
|
2668
|
-
function
|
|
2669
|
-
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s &&
|
|
2706
|
+
function dn(e, t, n, r, i, a) {
|
|
2707
|
+
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s && yn(t.style) ? {
|
|
2670
2708
|
x: n + c.area.x,
|
|
2671
2709
|
y: r + c.area.y,
|
|
2672
2710
|
width: c.area.width,
|
|
2673
2711
|
height: c.area.height
|
|
2674
|
-
} :
|
|
2712
|
+
} : un(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 = On(o.minWidth, l.width, e, a) ?? 0, S = On(o.maxWidth, l.width, e, a), C = {};
|
|
2675
2713
|
if (!y) C.width = H(q(o.width, l.width, e, a), x, S);
|
|
2676
2714
|
else if (u !== null && d !== null) C.width = H(Math.max(0, l.width - u - d - h - g), x, S);
|
|
2677
2715
|
else {
|
|
@@ -2683,25 +2721,25 @@ function tn(e, t, n, r, i, a) {
|
|
|
2683
2721
|
if (u !== null && d !== null) {
|
|
2684
2722
|
let e = Math.max(0, l.width - u - d - w - h - g), t = m.left === null && m.right === null;
|
|
2685
2723
|
E = l.x + u + h + (t ? Math.floor(e / 2) : m.left === null ? e : 0);
|
|
2686
|
-
} else E = u === null ? d === null ?
|
|
2724
|
+
} else E = u === null ? d === null ? gn(e, t, n, w) : l.x + l.width - d - w - g : l.x + u + h;
|
|
2687
2725
|
let D;
|
|
2688
2726
|
if (f !== null && p !== null) {
|
|
2689
2727
|
let e = Math.max(0, l.height - f - p - T - _ - v), t = m.top === null && m.bottom === null;
|
|
2690
2728
|
D = l.y + f + _ + (t ? Math.floor(e / 2) : m.top === null ? e : 0);
|
|
2691
|
-
} else D = f === null ? p === null ?
|
|
2729
|
+
} else D = f === null ? p === null ? _n(e, t, r, T) : l.y + l.height - p - T - v : l.y + f + _;
|
|
2692
2730
|
e.localRect = {
|
|
2693
2731
|
...e.localRect,
|
|
2694
2732
|
x: E - n,
|
|
2695
2733
|
y: D - r
|
|
2696
2734
|
};
|
|
2697
2735
|
}
|
|
2698
|
-
function
|
|
2736
|
+
function fn(e, t, n) {
|
|
2699
2737
|
return F(e, [n], Math.max(0, t - n))[0];
|
|
2700
2738
|
}
|
|
2701
|
-
function
|
|
2702
|
-
return L(
|
|
2739
|
+
function pn(e, t, n, r) {
|
|
2740
|
+
return L(Ie(e, t), n, r);
|
|
2703
2741
|
}
|
|
2704
|
-
function
|
|
2742
|
+
function mn(e, t, n, r, i) {
|
|
2705
2743
|
let a = G(e.style.margin, n.innerWidth), [o, s, c, l] = r === "x" ? [
|
|
2706
2744
|
a.left ?? 0,
|
|
2707
2745
|
a.right ?? 0,
|
|
@@ -2713,9 +2751,9 @@ function an(e, t, n, r, i) {
|
|
|
2713
2751
|
n.innerHeight,
|
|
2714
2752
|
n.direction === "column"
|
|
2715
2753
|
], u = i + o + s;
|
|
2716
|
-
return (l ?
|
|
2754
|
+
return (l ? fn(Be(t.style), c, u) : pn(e, t, c, u)) + o;
|
|
2717
2755
|
}
|
|
2718
|
-
function
|
|
2756
|
+
function hn(e, t, n, r, i) {
|
|
2719
2757
|
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" ? [
|
|
2720
2758
|
a.left ?? 0,
|
|
2721
2759
|
a.right ?? 0,
|
|
@@ -2725,23 +2763,23 @@ function on(e, t, n, r, i) {
|
|
|
2725
2763
|
a.top ?? 0,
|
|
2726
2764
|
a.bottom ?? 0,
|
|
2727
2765
|
n.height,
|
|
2728
|
-
|
|
2766
|
+
Ie(e, t)
|
|
2729
2767
|
];
|
|
2730
2768
|
return L(u, l, i + s + c) + s;
|
|
2731
2769
|
}
|
|
2732
|
-
function
|
|
2770
|
+
function gn(e, t, n, r) {
|
|
2733
2771
|
let i = e.staticSlot;
|
|
2734
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x +
|
|
2772
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x + hn(e, t, i.staticArea, "x", r) : n + i.originX + mn(e, t, i, "x", r);
|
|
2735
2773
|
}
|
|
2736
|
-
function
|
|
2774
|
+
function _n(e, t, n, r) {
|
|
2737
2775
|
let i = e.staticSlot;
|
|
2738
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y +
|
|
2776
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y + hn(e, t, i.staticArea, "y", r) : n + i.originY + mn(e, t, i, "y", r);
|
|
2739
2777
|
}
|
|
2740
2778
|
//#endregion
|
|
2741
2779
|
//#region src/layout.ts
|
|
2742
|
-
function
|
|
2743
|
-
let n =
|
|
2744
|
-
return V(e, t, void 0, 0, 0, "fill", n),
|
|
2780
|
+
function vn(e, t) {
|
|
2781
|
+
let n = bn();
|
|
2782
|
+
return V(e, t, void 0, 0, 0, "fill", n), cn(e, 0, 0, [{
|
|
2745
2783
|
node: e,
|
|
2746
2784
|
absX: 0,
|
|
2747
2785
|
absY: 0
|
|
@@ -2750,10 +2788,10 @@ function ln(e, t) {
|
|
|
2750
2788
|
function B(e) {
|
|
2751
2789
|
return e.position === "absolute" || e.position === "fixed";
|
|
2752
2790
|
}
|
|
2753
|
-
function
|
|
2791
|
+
function yn(e) {
|
|
2754
2792
|
return e.position !== "static";
|
|
2755
2793
|
}
|
|
2756
|
-
function
|
|
2794
|
+
function bn() {
|
|
2757
2795
|
return {
|
|
2758
2796
|
maxContent: /* @__PURE__ */ new WeakMap(),
|
|
2759
2797
|
minContent: /* @__PURE__ */ new WeakMap(),
|
|
@@ -2764,21 +2802,21 @@ function dn() {
|
|
|
2764
2802
|
function V(e, t, n, r, i, a, o, s) {
|
|
2765
2803
|
let c = e.style, l = s?.height;
|
|
2766
2804
|
delete e.decorationRuns, delete e.multicolGeometry, delete e.multicolFlow, delete e.multicolFlowSpan;
|
|
2767
|
-
let u =
|
|
2805
|
+
let u = On(c.minWidth, t, e, o) ?? 0, d = On(c.maxWidth, t, e, o), f = K(c.minHeight, n) ?? 0, p = K(c.maxHeight, n), m = {
|
|
2768
2806
|
top: W(c.padding.top, t),
|
|
2769
2807
|
right: W(c.padding.right, t),
|
|
2770
2808
|
bottom: W(c.padding.bottom, t),
|
|
2771
2809
|
left: W(c.padding.left, t)
|
|
2772
2810
|
};
|
|
2773
2811
|
e.resolvedPadding = m;
|
|
2774
|
-
let h = s?.width ?? H(
|
|
2775
|
-
x =
|
|
2812
|
+
let h = s?.width ?? H(Mn(c, t, a, e, o), u, d), g = Pn(c, n), _ = Ln(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;
|
|
2813
|
+
x = Sn(e) ? xn(e, _.width, _.height, y, b, m, o) : c.display === "flex" && c.flexDirection === "row" ? Ae(e, _.width, _.height, y, c.border, m, o) : c.display === "flex" && c.flexDirection === "column" ? Me(e, _.width, _.height, v, c.border, m, o) : c.display === "grid" ? We(e, _.width, _.height, c.border, m, o) : c.display === "table" ? rn(e, _.width, y, c.border, m, o) : c.display === "multicol" ? It(e, _.width, y, b, c.border, m, o) : kn(e, _.width, y, c.border, m, o);
|
|
2776
2814
|
let S = x + c.border.top + c.border.bottom + m.top + m.bottom, C = l ?? g ?? S;
|
|
2777
2815
|
e.unclampedHeight = C, e.naturalContentHeight = S;
|
|
2778
2816
|
let w = H(C, f, p), T = e.multicolGeometry;
|
|
2779
2817
|
if (T) {
|
|
2780
2818
|
let t = w - c.border.top - c.border.bottom - m.top - m.bottom;
|
|
2781
|
-
t > T.totalRows && (m.bottom += t - T.totalRows),
|
|
2819
|
+
t > T.totalRows && (m.bottom += t - T.totalRows), Nt(e, T, c.border, m);
|
|
2782
2820
|
}
|
|
2783
2821
|
e.localRect = {
|
|
2784
2822
|
x: r,
|
|
@@ -2787,30 +2825,30 @@ function V(e, t, n, r, i, a, o, s) {
|
|
|
2787
2825
|
height: w
|
|
2788
2826
|
};
|
|
2789
2827
|
}
|
|
2790
|
-
function
|
|
2828
|
+
function xn(e, t, n, r, i, a, o) {
|
|
2791
2829
|
let s = e.style, c;
|
|
2792
2830
|
if (e.text) {
|
|
2793
2831
|
let l = e.children.filter((e) => e.inlineBox);
|
|
2794
|
-
|
|
2832
|
+
Se(e.text, (n, r) => {
|
|
2795
2833
|
let i = l[r];
|
|
2796
2834
|
V(i, t, void 0, 0, 0, "shrink", o), e.advances[n] = Math.max(1, i.localRect.width);
|
|
2797
2835
|
});
|
|
2798
2836
|
let u, d;
|
|
2799
2837
|
if (s.display === "multicol") {
|
|
2800
|
-
let n = U(s, "x", t), o =
|
|
2838
|
+
let n = U(s, "x", t), o = Et(s, t, n);
|
|
2801
2839
|
a.right += o.leftover;
|
|
2802
|
-
let c =
|
|
2840
|
+
let c = Ot(e, o, n, wt(r, i));
|
|
2803
2841
|
e.multicolGeometry = c, u = c, d = c.lineX;
|
|
2804
|
-
} else u =
|
|
2805
|
-
if (c = u.totalRows,
|
|
2842
|
+
} else u = wn(e, t);
|
|
2843
|
+
if (c = u.totalRows, Cn(e, u, t, n, a), l.length > 0) {
|
|
2806
2844
|
let t = (e) => u.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
2807
|
-
|
|
2845
|
+
Se(e.text, (n, r) => {
|
|
2808
2846
|
let i = t(n);
|
|
2809
2847
|
if (i === -1) return;
|
|
2810
2848
|
let o = u.spans[i];
|
|
2811
2849
|
l[r].localRect = {
|
|
2812
2850
|
...l[r].localRect,
|
|
2813
|
-
x: s.border.left + a.left + (d?.[i] ?? 0) +
|
|
2851
|
+
x: s.border.left + a.left + (d?.[i] ?? 0) + ye(o.start, n, e.advances),
|
|
2814
2852
|
y: s.border.top + a.top + u.lineY[i]
|
|
2815
2853
|
};
|
|
2816
2854
|
});
|
|
@@ -2827,30 +2865,30 @@ function fn(e, t, n, r, i, a, o) {
|
|
|
2827
2865
|
}
|
|
2828
2866
|
return c;
|
|
2829
2867
|
}
|
|
2830
|
-
function
|
|
2868
|
+
function Sn(e) {
|
|
2831
2869
|
return e.children.some((e) => !B(e.style) && !e.inlineBox) ? !1 : e.text !== "" || e.style.display !== "flex" && e.style.display !== "grid";
|
|
2832
2870
|
}
|
|
2833
2871
|
function H(e, t, n) {
|
|
2834
2872
|
return Math.max(t, n === void 0 ? e : Math.min(e, n));
|
|
2835
2873
|
}
|
|
2836
|
-
function
|
|
2874
|
+
function Cn(e, t, n, r, i) {
|
|
2837
2875
|
let a = e.style;
|
|
2838
2876
|
if (a.display !== "flex" && a.display !== "grid" || t.spans.length === 0) return;
|
|
2839
2877
|
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t, P(n.start, n.end, e.advances, a.tracking)), 0), c = Math.max(0, n - s);
|
|
2840
2878
|
if (c > 0) {
|
|
2841
|
-
let e = a.display === "grid" ? L(a.justifyItems, n, s) : o ? L(a.alignItems, n, s) : F(
|
|
2879
|
+
let e = a.display === "grid" ? L(a.justifyItems, n, s) : o ? L(a.alignItems, n, s) : F(Be(a), [s], c)[0];
|
|
2842
2880
|
e > 0 && (i.left += e, i.right += c - e);
|
|
2843
2881
|
}
|
|
2844
2882
|
if (Number.isFinite(r)) {
|
|
2845
2883
|
let e = Math.max(0, r - t.totalRows);
|
|
2846
2884
|
if (e > 0) {
|
|
2847
|
-
let n = a.display === "grid" || !o ? L(a.alignItems, r, t.totalRows) : F(
|
|
2885
|
+
let n = a.display === "grid" || !o ? L(a.alignItems, r, t.totalRows) : F(Be(a), [t.totalRows], e)[0];
|
|
2848
2886
|
n > 0 && (i.top += n, i.bottom += e - n);
|
|
2849
2887
|
}
|
|
2850
2888
|
}
|
|
2851
2889
|
}
|
|
2852
|
-
function
|
|
2853
|
-
let n =
|
|
2890
|
+
function wn(e, t) {
|
|
2891
|
+
let n = Tn(e, t), { heights: r, textOffsets: i } = En(e, n), a = [], o = [], s = 0;
|
|
2854
2892
|
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);
|
|
2855
2893
|
return {
|
|
2856
2894
|
spans: n,
|
|
@@ -2859,21 +2897,21 @@ function hn(e, t) {
|
|
|
2859
2897
|
totalRows: s
|
|
2860
2898
|
};
|
|
2861
2899
|
}
|
|
2862
|
-
function
|
|
2863
|
-
return e.style.whiteSpace === "normal" ?
|
|
2900
|
+
function Tn(e, t) {
|
|
2901
|
+
return e.style.whiteSpace === "normal" ? ve(e.text, t, {
|
|
2864
2902
|
advances: e.advances,
|
|
2865
2903
|
tracking: e.style.tracking,
|
|
2866
2904
|
firstLineIndent: e.style.textIndent
|
|
2867
|
-
}) :
|
|
2905
|
+
}) : _e(e.text);
|
|
2868
2906
|
}
|
|
2869
|
-
function
|
|
2907
|
+
function En(e, t) {
|
|
2870
2908
|
let n = e.children.filter((e) => e.inlineBox), r = [], i = [], a = 0;
|
|
2871
2909
|
for (let o of t) {
|
|
2872
2910
|
let t = 1, s = 0;
|
|
2873
2911
|
for (let r = o.start; r < o.end; r++) {
|
|
2874
2912
|
if (e.text[r] !== "") continue;
|
|
2875
2913
|
let i = n[a];
|
|
2876
|
-
t = Math.max(t, i.localRect.height), i.style.verticalAlign === "end" ? s = Math.max(s, i.localRect.height - 1) : i.style.verticalAlign === "center" &&
|
|
2914
|
+
t = Math.max(t, i.localRect.height), i.style.verticalAlign === "end" ? s = Math.max(s, i.localRect.height - 1) : i.style.verticalAlign === "center" && b(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++;
|
|
2877
2915
|
}
|
|
2878
2916
|
r.push(t), i.push(Math.min(s, t - 1));
|
|
2879
2917
|
}
|
|
@@ -2887,7 +2925,7 @@ function U(e, t, n) {
|
|
|
2887
2925
|
return Math.max(r, i?.width ?? 0);
|
|
2888
2926
|
}
|
|
2889
2927
|
function W(e, t) {
|
|
2890
|
-
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 :
|
|
2928
|
+
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 : de(e.percent, t);
|
|
2891
2929
|
}
|
|
2892
2930
|
function G(e, t) {
|
|
2893
2931
|
let n = (e) => e === null ? null : W(e, t);
|
|
@@ -2898,16 +2936,16 @@ function G(e, t) {
|
|
|
2898
2936
|
left: n(e.left)
|
|
2899
2937
|
};
|
|
2900
2938
|
}
|
|
2901
|
-
function
|
|
2939
|
+
function Dn(e) {
|
|
2902
2940
|
return typeof e == "number" ? e : 0;
|
|
2903
2941
|
}
|
|
2904
2942
|
function K(e, t) {
|
|
2905
|
-
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 :
|
|
2943
|
+
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 : de(e.percent, t);
|
|
2906
2944
|
}
|
|
2907
|
-
function
|
|
2945
|
+
function On(e, t, n, r) {
|
|
2908
2946
|
return e === "min-content" || e === "max-content" || e === "fit-content" ? q({ kind: e }, t, n, r) : K(e, t);
|
|
2909
2947
|
}
|
|
2910
|
-
function
|
|
2948
|
+
function kn(e, t, n, r, i, a) {
|
|
2911
2949
|
let o = r.left + i.left, s = r.top + i.top, c = s, l = null;
|
|
2912
2950
|
for (let r of e.children) {
|
|
2913
2951
|
let e = G(r.style.margin, t), i = e.top ?? 0, s = e.bottom ?? 0, u = e.left ?? 0, d = e.right ?? 0;
|
|
@@ -2915,13 +2953,13 @@ function bn(e, t, n, r, i, a) {
|
|
|
2915
2953
|
r.staticSlot = {
|
|
2916
2954
|
kind: "block",
|
|
2917
2955
|
x: o + u,
|
|
2918
|
-
y: c + (l === null ? i :
|
|
2956
|
+
y: c + (l === null ? i : jn(l, i))
|
|
2919
2957
|
};
|
|
2920
2958
|
continue;
|
|
2921
2959
|
}
|
|
2922
2960
|
V(r, Math.max(0, t - u - d), n, 0, 0, "fill", a);
|
|
2923
|
-
let f =
|
|
2924
|
-
c += l === null ? i :
|
|
2961
|
+
let f = An(e, t, r.localRect.width);
|
|
2962
|
+
c += l === null ? i : jn(l, i), r.localRect = {
|
|
2925
2963
|
...r.localRect,
|
|
2926
2964
|
x: o + f,
|
|
2927
2965
|
y: c
|
|
@@ -2929,37 +2967,37 @@ function bn(e, t, n, r, i, a) {
|
|
|
2929
2967
|
}
|
|
2930
2968
|
return l !== null && (c += l), c - s;
|
|
2931
2969
|
}
|
|
2932
|
-
function
|
|
2970
|
+
function An(e, t, n) {
|
|
2933
2971
|
let r = t - n;
|
|
2934
2972
|
return e.left === null && e.right === null ? Math.floor(r / 2) : e.left === null ? r - (e.right ?? 0) : e.left;
|
|
2935
2973
|
}
|
|
2936
|
-
function
|
|
2974
|
+
function jn(e, t) {
|
|
2937
2975
|
return e >= 0 && t >= 0 ? Math.max(e, t) : e <= 0 && t <= 0 ? Math.min(e, t) : e + t;
|
|
2938
2976
|
}
|
|
2939
|
-
function
|
|
2977
|
+
function Mn(e, t, n, r, i) {
|
|
2940
2978
|
let a = e.width;
|
|
2941
2979
|
if (e.display === "table") {
|
|
2942
2980
|
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));
|
|
2943
2981
|
if (a !== void 0 && a.kind !== "auto") {
|
|
2944
2982
|
let e = q(a, t, r, i);
|
|
2945
|
-
return Math.max(e,
|
|
2983
|
+
return Math.max(e, Nn(r, t, i));
|
|
2946
2984
|
}
|
|
2947
|
-
return
|
|
2985
|
+
return nn(r, t, i);
|
|
2948
2986
|
}
|
|
2949
2987
|
return a !== void 0 && a.kind !== "auto" ? q(a, t, r, i) : n === "shrink" ? Math.min(t, J(r, i)) : t;
|
|
2950
2988
|
}
|
|
2951
|
-
function
|
|
2989
|
+
function Nn(e, t, n) {
|
|
2952
2990
|
let r = e.style;
|
|
2953
|
-
return
|
|
2991
|
+
return tn(e, n).min + r.border.left + r.border.right + W(r.padding.left, t) + W(r.padding.right, t);
|
|
2954
2992
|
}
|
|
2955
|
-
function
|
|
2993
|
+
function Pn(e, t) {
|
|
2956
2994
|
if (e.height?.kind === "cells") return e.height.value;
|
|
2957
|
-
if (e.height?.kind === "percent" && t != null) return
|
|
2995
|
+
if (e.height?.kind === "percent" && t != null) return de(e.height.value, t);
|
|
2958
2996
|
}
|
|
2959
2997
|
function q(e, t, n, r) {
|
|
2960
2998
|
switch (e.kind) {
|
|
2961
2999
|
case "cells": return e.value;
|
|
2962
|
-
case "percent": return
|
|
3000
|
+
case "percent": return de(e.value, t);
|
|
2963
3001
|
case "min-content": return Y(n, r);
|
|
2964
3002
|
case "max-content": return J(n, r);
|
|
2965
3003
|
case "fit-content": return Math.min(J(n, r), Math.max(Y(n, r), t));
|
|
@@ -2969,42 +3007,42 @@ function q(e, t, n, r) {
|
|
|
2969
3007
|
function J(e, t) {
|
|
2970
3008
|
let n = t.maxContent.get(e);
|
|
2971
3009
|
if (n !== void 0) return n;
|
|
2972
|
-
let r = e.style, i =
|
|
3010
|
+
let r = e.style, i = Fn(e, t) + r.border.left + r.border.right + Dn(r.padding.left) + Dn(r.padding.right);
|
|
2973
3011
|
return t.maxContent.set(e, i), i;
|
|
2974
3012
|
}
|
|
2975
|
-
function
|
|
3013
|
+
function Fn(e, t) {
|
|
2976
3014
|
let n = e.children.filter((e) => !B(e.style) && !e.inlineBox);
|
|
2977
|
-
if (n.length === 0) return e.style.display === "multicol" ?
|
|
2978
|
-
if (e.style.display === "grid") return
|
|
2979
|
-
if (e.style.display === "table") return
|
|
3015
|
+
if (n.length === 0) return e.style.display === "multicol" ? Ct(e.style, e.intrinsicWidth) : e.intrinsicWidth;
|
|
3016
|
+
if (e.style.display === "grid") return $e(e, t).max;
|
|
3017
|
+
if (e.style.display === "table") return tn(e, t).max;
|
|
2980
3018
|
if (e.style.display === "flex" && e.style.flexDirection === "row") {
|
|
2981
|
-
let r = Math.max(
|
|
3019
|
+
let r = Math.max(Dn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
2982
3020
|
return n.reduce((e, n) => e + J(n, t), 0) + r;
|
|
2983
3021
|
}
|
|
2984
3022
|
let r = n.reduce((e, n) => Math.max(e, J(n, t)), 0);
|
|
2985
|
-
return e.style.display === "multicol" ?
|
|
3023
|
+
return e.style.display === "multicol" ? Ct(e.style, r) : r;
|
|
2986
3024
|
}
|
|
2987
3025
|
function Y(e, t) {
|
|
2988
3026
|
let n = t.minContent.get(e);
|
|
2989
3027
|
if (n !== void 0) return n;
|
|
2990
|
-
let r = e.style, i =
|
|
3028
|
+
let r = e.style, i = In(e, t) + r.border.left + r.border.right + Dn(r.padding.left) + Dn(r.padding.right);
|
|
2991
3029
|
return t.minContent.set(e, i), i;
|
|
2992
3030
|
}
|
|
2993
|
-
function
|
|
3031
|
+
function In(e, t) {
|
|
2994
3032
|
let n = e.children.filter((e) => !B(e.style) && !e.inlineBox);
|
|
2995
|
-
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth :
|
|
3033
|
+
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth : xe(e.text, {
|
|
2996
3034
|
advances: e.advances,
|
|
2997
3035
|
tracking: e.style.tracking
|
|
2998
3036
|
});
|
|
2999
|
-
if (e.style.display === "grid") return
|
|
3000
|
-
if (e.style.display === "table") return
|
|
3037
|
+
if (e.style.display === "grid") return $e(e, t).min;
|
|
3038
|
+
if (e.style.display === "table") return tn(e, t).min;
|
|
3001
3039
|
if (e.style.display === "flex" && e.style.flexDirection === "row" && e.style.flexWrap === "nowrap") {
|
|
3002
|
-
let r = Math.max(
|
|
3040
|
+
let r = Math.max(Dn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
3003
3041
|
return n.reduce((e, n) => e + Y(n, t), 0) + r;
|
|
3004
3042
|
}
|
|
3005
3043
|
return n.reduce((e, n) => Math.max(e, Y(n, t)), 0);
|
|
3006
3044
|
}
|
|
3007
|
-
function
|
|
3045
|
+
function Ln(e, t, n, r) {
|
|
3008
3046
|
return {
|
|
3009
3047
|
width: Math.max(0, e - n.left - n.right - r.left - r.right),
|
|
3010
3048
|
height: Math.max(0, t - n.top - n.bottom - r.top - r.bottom)
|
|
@@ -3012,38 +3050,38 @@ function On(e, t, n, r) {
|
|
|
3012
3050
|
}
|
|
3013
3051
|
//#endregion
|
|
3014
3052
|
//#region src/plain-text.ts
|
|
3015
|
-
function
|
|
3016
|
-
return
|
|
3053
|
+
function Rn(e) {
|
|
3054
|
+
return Wn(e).grid.map((e) => e.join("").trimEnd()).join("\n");
|
|
3017
3055
|
}
|
|
3018
|
-
function
|
|
3019
|
-
let { grid: t, paints: n } =
|
|
3020
|
-
return t.map((e, t) =>
|
|
3056
|
+
function zn(e) {
|
|
3057
|
+
let { grid: t, paints: n } = Wn(e);
|
|
3058
|
+
return t.map((e, t) => Bn(e, n[t]));
|
|
3021
3059
|
}
|
|
3022
|
-
function
|
|
3060
|
+
function Bn(e, t) {
|
|
3023
3061
|
let n = e.length;
|
|
3024
3062
|
for (; n > 0 && e[n - 1] === " " && t[n - 1]?.backgroundColor === void 0;) n--;
|
|
3025
3063
|
let r = [];
|
|
3026
3064
|
for (let i = 0; i < n; i++) {
|
|
3027
3065
|
let n = t[i], a = r[r.length - 1];
|
|
3028
|
-
a &&
|
|
3066
|
+
a && Vn(a, n) ? a.text += e[i] : r.push({
|
|
3029
3067
|
text: e[i],
|
|
3030
3068
|
...n
|
|
3031
3069
|
});
|
|
3032
3070
|
}
|
|
3033
3071
|
return r;
|
|
3034
3072
|
}
|
|
3035
|
-
function
|
|
3073
|
+
function Vn(e, t) {
|
|
3036
3074
|
return e.color === t?.color && e.backgroundColor === t?.backgroundColor && e.fontWeight === t?.fontWeight && e.fontStyle === t?.fontStyle && e.textDecorationLine === t?.textDecorationLine && e.opacity === t?.opacity;
|
|
3037
3075
|
}
|
|
3038
|
-
function
|
|
3076
|
+
function Hn(e, t) {
|
|
3039
3077
|
e.color !== void 0 && (t.color = e.color), e.backgroundColor !== void 0 && (t.backgroundColor = e.backgroundColor), e.fontWeight !== void 0 && (t.fontWeight = e.fontWeight), e.fontStyle !== void 0 && (t.fontStyle = e.fontStyle), e.textDecorationLine !== void 0 && (t.textDecoration = e.textDecorationLine), e.opacity !== void 0 && (t.opacity = e.opacity);
|
|
3040
3078
|
}
|
|
3041
|
-
function
|
|
3079
|
+
function Un(e) {
|
|
3042
3080
|
return e.color === void 0 && e.backgroundColor === void 0 && e.fontWeight === void 0 && e.fontStyle === void 0 && e.textDecorationLine === void 0 && e.opacity === void 0;
|
|
3043
3081
|
}
|
|
3044
|
-
function
|
|
3082
|
+
function Wn(e) {
|
|
3045
3083
|
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));
|
|
3046
|
-
return
|
|
3084
|
+
return Kn(e, 0, 0, (e, a, o, s) => {
|
|
3047
3085
|
if (e >= 0 && e < t && a >= 0 && a < n) {
|
|
3048
3086
|
r[a][e] = o;
|
|
3049
3087
|
let t = i[a][e];
|
|
@@ -3057,11 +3095,11 @@ function Fn(e) {
|
|
|
3057
3095
|
paints: i
|
|
3058
3096
|
};
|
|
3059
3097
|
}
|
|
3060
|
-
function
|
|
3098
|
+
function Gn(e) {
|
|
3061
3099
|
let t = {};
|
|
3062
3100
|
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;
|
|
3063
3101
|
}
|
|
3064
|
-
function
|
|
3102
|
+
function Kn(e, t, n, r, i = 1) {
|
|
3065
3103
|
if (e.tableHidden) return;
|
|
3066
3104
|
let a = t + e.localRect.x, o = n + e.localRect.y, s = e.style, c = (e) => i >= 1 ? e : {
|
|
3067
3105
|
...e,
|
|
@@ -3072,7 +3110,7 @@ function Ln(e, t, n, r, i = 1) {
|
|
|
3072
3110
|
for (let n = 0; n < e.localRect.height; n++) for (let i = 0; i < e.localRect.width; i++) r(a + i, o + n, " ", t);
|
|
3073
3111
|
}
|
|
3074
3112
|
let l = [];
|
|
3075
|
-
|
|
3113
|
+
k(s, {
|
|
3076
3114
|
x: a,
|
|
3077
3115
|
y: o,
|
|
3078
3116
|
width: e.localRect.width,
|
|
@@ -3087,9 +3125,9 @@ function Ln(e, t, n, r, i = 1) {
|
|
|
3087
3125
|
for (let n = 0; n < t.length; n++) r(a + t.x + n, o + t.y, t.glyph, e);
|
|
3088
3126
|
}
|
|
3089
3127
|
if (!e.children.some((e) => !e.inlineBox && e.style.position !== "absolute" && e.style.position !== "fixed") && e.text) {
|
|
3090
|
-
let t = e.resolvedPadding, n = a + s.border.left + t.left, i = o + s.border.top + t.top, l = e.localRect.width - s.border.left - s.border.right - t.left - t.right, u = e.multicolGeometry, { spans: d, textY: f } = u ??
|
|
3128
|
+
let t = e.resolvedPadding, n = a + s.border.left + t.left, i = o + s.border.top + t.top, l = e.localRect.width - s.border.left - s.border.right - t.left - t.right, u = e.multicolGeometry, { spans: d, textY: f } = u ?? wn(e, l), p = u ? Math.max(1, u.columnWidth - s.tracking) : l, m = c(Gn(s)), h = e.inlineElements?.map((e) => c(Gn(e)));
|
|
3091
3129
|
for (let t = 0; t < d.length; t++) {
|
|
3092
|
-
let a = d[t], o = i + f[t], l = t === 0 ? s.textIndent : 0, g = s.whiteSpace !== "normal" && s.overflow === "clip" ?
|
|
3130
|
+
let a = d[t], o = i + f[t], l = t === 0 ? s.textIndent : 0, g = s.whiteSpace !== "normal" && s.overflow === "clip" ? qn(e.text, a, p - l, e.advances, s) : {
|
|
3093
3131
|
end: a.end,
|
|
3094
3132
|
ellipsis: !1
|
|
3095
3133
|
}, _ = P(a.start, a.end, e.advances, s.tracking), v = Math.max(0, p - l - _), y = s.textAlign === "end" ? v : s.textAlign === "center" ? Math.floor(v / 2) : 0, b = n + (u?.lineX[t] ?? 0) + y + l;
|
|
@@ -3098,14 +3136,14 @@ function Ln(e, t, n, r, i = 1) {
|
|
|
3098
3136
|
let n = e.charInline?.[t] ?? -1, i = n >= 0 ? e.inlineElements[n] : void 0, a = i?.insets, s = a ? a.left ?? (a.right === null ? 0 : -a.right) : 0, l = a ? a.top ?? (a.bottom === null ? 0 : -a.bottom) : 0;
|
|
3099
3137
|
e.text[t] === "" ? i?.backgroundColor && r(b + s, o + l, " ", c({ backgroundColor: i.backgroundColor })) : r(b + s, o + l, e.text[t], i ? h[n] : m);
|
|
3100
3138
|
}
|
|
3101
|
-
b +=
|
|
3139
|
+
b += ye(t, t + 1, e.advances);
|
|
3102
3140
|
}
|
|
3103
3141
|
g.ellipsis && r(b, o, "…", m);
|
|
3104
3142
|
}
|
|
3105
3143
|
}
|
|
3106
|
-
for (let t of
|
|
3144
|
+
for (let t of te(e)) Kn(t, a, o, r, i * t.style.opacity);
|
|
3107
3145
|
}
|
|
3108
|
-
function
|
|
3146
|
+
function qn(e, t, n, r, i) {
|
|
3109
3147
|
let { textOverflow: a, tracking: o } = i;
|
|
3110
3148
|
if (P(t.start, t.end, r, o) <= n) return {
|
|
3111
3149
|
end: t.end,
|
|
@@ -3120,61 +3158,61 @@ function Rn(e, t, n, r, i) {
|
|
|
3120
3158
|
}
|
|
3121
3159
|
//#endregion
|
|
3122
3160
|
//#region src/paint.ts
|
|
3123
|
-
var
|
|
3124
|
-
function
|
|
3125
|
-
return
|
|
3126
|
-
}
|
|
3127
|
-
function
|
|
3128
|
-
let r =
|
|
3129
|
-
if (
|
|
3130
|
-
let a =
|
|
3131
|
-
if (a &&
|
|
3132
|
-
|
|
3161
|
+
var Jn = /* @__PURE__ */ new WeakMap(), Yn = /* @__PURE__ */ new WeakMap();
|
|
3162
|
+
function Xn(e) {
|
|
3163
|
+
return $n(e, !0) !== null;
|
|
3164
|
+
}
|
|
3165
|
+
function Zn(e, t, n = !1) {
|
|
3166
|
+
let r = zn(e), i = ir(r);
|
|
3167
|
+
if (Jn.get(t) === i) return !0;
|
|
3168
|
+
let a = Yn.get(t);
|
|
3169
|
+
if (a && Qn(t, a.nodes, r)) {
|
|
3170
|
+
Jn.set(t, i);
|
|
3133
3171
|
for (let e = 0; e < r.length; e++) for (let t = 0; t < r[e].length; t++) {
|
|
3134
3172
|
let n = r[e][t];
|
|
3135
|
-
if (
|
|
3173
|
+
if (Un(n) || Vn(n, a.segments[e][t])) continue;
|
|
3136
3174
|
let i = a.nodes[e][t];
|
|
3137
|
-
i.style.cssText = "",
|
|
3175
|
+
i.style.cssText = "", Hn(n, i.style);
|
|
3138
3176
|
}
|
|
3139
3177
|
return a.segments = r, !0;
|
|
3140
3178
|
}
|
|
3141
|
-
if (n &&
|
|
3142
|
-
|
|
3179
|
+
if (n && Xn(t)) return !1;
|
|
3180
|
+
Jn.set(t, i);
|
|
3143
3181
|
let o = document.createDocumentFragment(), s = [];
|
|
3144
3182
|
for (let e = 0; e < r.length; e++) {
|
|
3145
3183
|
e > 0 && o.appendChild(document.createTextNode("\n"));
|
|
3146
3184
|
let t = [];
|
|
3147
3185
|
for (let n of r[e]) {
|
|
3148
|
-
if (
|
|
3186
|
+
if (Un(n)) {
|
|
3149
3187
|
let e = document.createTextNode(n.text);
|
|
3150
3188
|
t.push(e), o.appendChild(e);
|
|
3151
3189
|
continue;
|
|
3152
3190
|
}
|
|
3153
3191
|
let e = document.createElement("span");
|
|
3154
|
-
|
|
3192
|
+
Hn(n, e.style), e.textContent = n.text, t.push(e), o.appendChild(e);
|
|
3155
3193
|
}
|
|
3156
3194
|
s.push(t);
|
|
3157
3195
|
}
|
|
3158
|
-
|
|
3196
|
+
Yn.set(t, {
|
|
3159
3197
|
nodes: s,
|
|
3160
3198
|
segments: r
|
|
3161
3199
|
});
|
|
3162
|
-
let c =
|
|
3163
|
-
return t.replaceChildren(o), c &&
|
|
3200
|
+
let c = $n(t, !1);
|
|
3201
|
+
return t.replaceChildren(o), c && er(t, c), !0;
|
|
3164
3202
|
}
|
|
3165
|
-
function
|
|
3203
|
+
function Qn(e, t, n) {
|
|
3166
3204
|
if (t.length !== n.length) return !1;
|
|
3167
3205
|
for (let r = 0; r < n.length; r++) {
|
|
3168
3206
|
let i = t[r], a = n[r];
|
|
3169
3207
|
if (i.length !== a.length) return !1;
|
|
3170
3208
|
for (let t = 0; t < a.length; t++) {
|
|
3171
3209
|
let n = i[t];
|
|
3172
|
-
if (
|
|
3210
|
+
if (Un(a[t]) !== (n.nodeType === Node.TEXT_NODE) || n.textContent !== a[t].text || n.parentNode !== e) return !1;
|
|
3173
3211
|
}
|
|
3174
3212
|
}
|
|
3175
3213
|
return !0;
|
|
3176
3214
|
}
|
|
3177
|
-
function
|
|
3215
|
+
function $n(e, t) {
|
|
3178
3216
|
try {
|
|
3179
3217
|
let n = e.ownerDocument.getSelection();
|
|
3180
3218
|
if (!n) return null;
|
|
@@ -3190,7 +3228,7 @@ function Wn(e, t) {
|
|
|
3190
3228
|
if (!e || e.rangeCount === 0) return null;
|
|
3191
3229
|
i = e.getRangeAt(0);
|
|
3192
3230
|
}
|
|
3193
|
-
let a =
|
|
3231
|
+
let a = tr(e, i.startContainer, i.startOffset), o = tr(e, i.endContainer, i.endOffset);
|
|
3194
3232
|
return a === null || o === null || a === o && !t ? null : {
|
|
3195
3233
|
start: a,
|
|
3196
3234
|
end: o,
|
|
@@ -3200,32 +3238,32 @@ function Wn(e, t) {
|
|
|
3200
3238
|
return null;
|
|
3201
3239
|
}
|
|
3202
3240
|
}
|
|
3203
|
-
function
|
|
3241
|
+
function er(e, t) {
|
|
3204
3242
|
try {
|
|
3205
|
-
let n =
|
|
3243
|
+
let n = nr(e, t.start), r = nr(e, t.end);
|
|
3206
3244
|
if (!n || !r) return;
|
|
3207
3245
|
let i = e.getRootNode().getSelection?.() ?? e.ownerDocument.getSelection();
|
|
3208
3246
|
t.backward ? i?.setBaseAndExtent(r[0], r[1], n[0], n[1]) : i?.setBaseAndExtent(n[0], n[1], r[0], r[1]);
|
|
3209
3247
|
} catch {}
|
|
3210
3248
|
}
|
|
3211
|
-
function
|
|
3249
|
+
function tr(e, t, n) {
|
|
3212
3250
|
if (!e.contains(t)) return null;
|
|
3213
3251
|
let r = e.ownerDocument.createRange();
|
|
3214
3252
|
return r.selectNodeContents(e), r.setEnd(t, n), r.toString().length;
|
|
3215
3253
|
}
|
|
3216
|
-
function
|
|
3254
|
+
function nr(e, t) {
|
|
3217
3255
|
let n = t, r = null;
|
|
3218
|
-
for (let t of
|
|
3256
|
+
for (let t of rr(e)) {
|
|
3219
3257
|
if (n <= t.data.length) return [t, n];
|
|
3220
3258
|
n -= t.data.length, r = [t, t.data.length];
|
|
3221
3259
|
}
|
|
3222
3260
|
return r;
|
|
3223
3261
|
}
|
|
3224
|
-
function*
|
|
3262
|
+
function* rr(e) {
|
|
3225
3263
|
let t = e.ownerDocument.createTreeWalker(e, NodeFilter.SHOW_TEXT), n = t.nextNode();
|
|
3226
3264
|
for (; n;) yield n, n = t.nextNode();
|
|
3227
3265
|
}
|
|
3228
|
-
function
|
|
3266
|
+
function ir(e) {
|
|
3229
3267
|
let t = [];
|
|
3230
3268
|
for (let n of e) {
|
|
3231
3269
|
for (let e of n) t.push(e.text, e.color ?? "", e.backgroundColor ?? "", e.fontWeight ?? "", e.fontStyle ?? "", e.textDecorationLine ?? "", e.opacity ?? "");
|
|
@@ -3235,9 +3273,9 @@ function Yn(e) {
|
|
|
3235
3273
|
}
|
|
3236
3274
|
//#endregion
|
|
3237
3275
|
//#region src/render.ts
|
|
3238
|
-
function
|
|
3276
|
+
function ar(e) {
|
|
3239
3277
|
let t = /* @__PURE__ */ new Set();
|
|
3240
|
-
|
|
3278
|
+
or(e, !0, t);
|
|
3241
3279
|
for (let n of Array.from(e.source.querySelectorAll("[data-mw-inline-inset]"))) if (!t.has(n)) {
|
|
3242
3280
|
n.removeAttribute("data-mw-inline-inset");
|
|
3243
3281
|
let e = n.style;
|
|
@@ -3258,65 +3296,65 @@ function Z(e, t) {
|
|
|
3258
3296
|
function Q(e, t, n) {
|
|
3259
3297
|
e.hasAttribute(t) !== n && (n ? e.setAttribute(t, "") : e.removeAttribute(t));
|
|
3260
3298
|
}
|
|
3261
|
-
function
|
|
3299
|
+
function or(e, t, n) {
|
|
3262
3300
|
if (e.inlineElements) for (let { element: t, tracking: r, padLeft: i, padRight: a, insets: o } of e.inlineElements) {
|
|
3263
3301
|
let e = t;
|
|
3264
|
-
X(e, "--mw-ls", String(r)), i > 0 ? X(e, "--mw-ipl", String(i)) : Z(e, "--mw-ipl"), a > 0 ? X(e, "--mw-ipr", String(a)) : Z(e, "--mw-ipr"), o && (n.add(t),
|
|
3302
|
+
X(e, "--mw-ls", String(r)), i > 0 ? X(e, "--mw-ipl", String(i)) : Z(e, "--mw-ipl"), a > 0 ? X(e, "--mw-ipr", String(a)) : Z(e, "--mw-ipr"), o && (n.add(t), sr(e, o));
|
|
3265
3303
|
}
|
|
3266
|
-
if (t ||
|
|
3304
|
+
if (t || lr(e), !e.tableHidden) for (let t of te(e)) {
|
|
3267
3305
|
let r = t.source;
|
|
3268
|
-
t.style.zIndex !== null &&
|
|
3306
|
+
t.style.zIndex !== null && j(t, e) && !t.inlineBox ? X(r, "--mw-z", String(t.style.zIndex)) : Z(r, "--mw-z"), or(t, !1, n);
|
|
3269
3307
|
}
|
|
3270
3308
|
}
|
|
3271
|
-
function
|
|
3309
|
+
function sr(e, t) {
|
|
3272
3310
|
Q(e, "data-mw-inline-inset", !0);
|
|
3273
3311
|
let n = (t, n) => {
|
|
3274
3312
|
n === null ? Z(e, t) : X(e, t, String(n));
|
|
3275
3313
|
};
|
|
3276
3314
|
n("--mw-it", t.top), n("--mw-ir", t.right), n("--mw-ib", t.bottom), n("--mw-il", t.left);
|
|
3277
3315
|
}
|
|
3278
|
-
function
|
|
3316
|
+
function cr(e) {
|
|
3279
3317
|
let t = e.style;
|
|
3280
3318
|
if (t.textAlign !== "center" || !e.text || e.inlineBox || e.children.length > 0) return !1;
|
|
3281
|
-
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 ??
|
|
3319
|
+
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 ?? Tn(e, i);
|
|
3282
3320
|
return o.length !== 0 && o.every((n, r) => {
|
|
3283
3321
|
let i = r === 0 ? t.textIndent : 0, o = a - i - P(n.start, n.end, e.advances, t.tracking);
|
|
3284
3322
|
return o > 0 && o % 2 == 1;
|
|
3285
3323
|
});
|
|
3286
3324
|
}
|
|
3287
|
-
function
|
|
3325
|
+
function lr(e) {
|
|
3288
3326
|
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;
|
|
3289
3327
|
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);
|
|
3290
3328
|
let f = u ?? d;
|
|
3291
3329
|
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");
|
|
3292
3330
|
let p = u || d ? void 0 : e.multicolGeometry;
|
|
3293
|
-
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",
|
|
3331
|
+
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", cr(e)), Q(t, "data-mw-dropped-text", !!e.droppedText), Q(t, "data-mw-table-hidden", !!e.tableHidden);
|
|
3294
3332
|
}
|
|
3295
3333
|
//#endregion
|
|
3296
3334
|
//#region src/style.ts
|
|
3297
|
-
function
|
|
3298
|
-
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a =
|
|
3299
|
-
|
|
3300
|
-
let c = r.display ||
|
|
3335
|
+
function ur(e, t, n) {
|
|
3336
|
+
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a = wr(e) ? e.computedStyleMap() : null, o = e.getAttribute("class") ?? "", s = e.style;
|
|
3337
|
+
yr(e, o, s);
|
|
3338
|
+
let c = r.display || gr[e.tagName] || "", l = _r[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, f = Number.isFinite(d) ? Math.max(1, N(d, t)) : null, p = c === "flex" || c === "inline-flex" ? "flex" : c === "grid" || c === "inline-grid" ? "grid" : c === "table" || c === "inline-table" ? "table" : c === "none" || hr(r) ? "none" : u !== null || f !== null ? "multicol" : "block", m = { kind: "none" }, h = { kind: "none" }, g = [Ue()], _ = [Ue()], v = {
|
|
3301
3339
|
direction: "row",
|
|
3302
3340
|
dense: !1
|
|
3303
3341
|
}, y = null;
|
|
3304
3342
|
if (p === "grid") {
|
|
3305
|
-
if (a) m =
|
|
3343
|
+
if (a) m = Wr(a.get("grid-template-columns")?.toString() ?? "", t), h = Wr(a.get("grid-template-rows")?.toString() ?? "", t);
|
|
3306
3344
|
else {
|
|
3307
3345
|
e.setAttribute("data-mw-degrid", "");
|
|
3308
3346
|
try {
|
|
3309
|
-
m =
|
|
3347
|
+
m = Wr(r.getPropertyValue("grid-template-columns"), t), h = Wr(r.getPropertyValue("grid-template-rows"), t);
|
|
3310
3348
|
} finally {
|
|
3311
3349
|
e.removeAttribute("data-mw-degrid");
|
|
3312
3350
|
}
|
|
3313
3351
|
}
|
|
3314
|
-
g =
|
|
3352
|
+
g = Jr(r.getPropertyValue("grid-auto-columns"), t), _ = Jr(r.getPropertyValue("grid-auto-rows"), t), v = ei(r.getPropertyValue("grid-auto-flow")), y = qr(r.getPropertyValue("grid-template-areas"));
|
|
3315
3353
|
}
|
|
3316
3354
|
let b = "auto", x = !1, S = 0, C = 0;
|
|
3317
3355
|
if (p === "table" && (b = r.tableLayout === "fixed" ? "fixed" : "auto", x = r.borderCollapse === "collapse", !x)) {
|
|
3318
3356
|
let e = r.borderSpacing.split(" ");
|
|
3319
|
-
S =
|
|
3357
|
+
S = N(parseFloat(e[0] ?? "") || 0, t), C = N(parseFloat(e[1] ?? e[0] ?? "") || 0, t);
|
|
3320
3358
|
}
|
|
3321
3359
|
let w = {
|
|
3322
3360
|
display: p,
|
|
@@ -3326,61 +3364,61 @@ function tr(e, t, n) {
|
|
|
3326
3364
|
borderSpacingX: S,
|
|
3327
3365
|
borderSpacingY: C,
|
|
3328
3366
|
captionSide: r.captionSide === "bottom" ? "bottom" : "top",
|
|
3329
|
-
verticalAlign: l === "cell" || c.startsWith("inline-") ?
|
|
3367
|
+
verticalAlign: l === "cell" || c.startsWith("inline-") ? vr(e, r) : "start",
|
|
3330
3368
|
flexDirection: r.flexDirection.startsWith("column") ? "column" : "row",
|
|
3331
3369
|
flexReverse: r.flexDirection.endsWith("-reverse"),
|
|
3332
3370
|
flexWrap: r.flexWrap.startsWith("wrap") ? "wrap" : "nowrap",
|
|
3333
3371
|
wrapReverse: r.flexWrap === "wrap-reverse",
|
|
3334
3372
|
flexGrow: Number(r.flexGrow) || 0,
|
|
3335
3373
|
flexShrink: r.flexShrink === "" ? 1 : Number(r.flexShrink) || 0,
|
|
3336
|
-
flexBasis:
|
|
3374
|
+
flexBasis: Hr(r.flexBasis, t),
|
|
3337
3375
|
order: Number(r.order) || 0,
|
|
3338
|
-
justifyContent:
|
|
3339
|
-
alignContent:
|
|
3340
|
-
alignItems:
|
|
3341
|
-
alignSelf:
|
|
3342
|
-
justifyItems:
|
|
3343
|
-
justifySelf:
|
|
3376
|
+
justifyContent: Tr(r.justifyContent),
|
|
3377
|
+
alignContent: Tr(r.alignContent),
|
|
3378
|
+
alignItems: Er(r.alignItems),
|
|
3379
|
+
alignSelf: Dr(r.alignSelf),
|
|
3380
|
+
justifyItems: Er(r.justifyItems),
|
|
3381
|
+
justifySelf: Dr(r.justifySelf),
|
|
3344
3382
|
gridTemplateColumns: m,
|
|
3345
3383
|
gridTemplateRows: h,
|
|
3346
3384
|
gridAutoColumns: g,
|
|
3347
3385
|
gridAutoRows: _,
|
|
3348
3386
|
gridAutoFlow: v,
|
|
3349
3387
|
gridTemplateAreas: y,
|
|
3350
|
-
gridColumnStart:
|
|
3351
|
-
gridColumnEnd:
|
|
3352
|
-
gridRowStart:
|
|
3353
|
-
gridRowEnd:
|
|
3354
|
-
width:
|
|
3355
|
-
height:
|
|
3356
|
-
minWidth:
|
|
3357
|
-
minHeight:
|
|
3358
|
-
maxWidth:
|
|
3359
|
-
maxHeight:
|
|
3360
|
-
padding:
|
|
3361
|
-
margin:
|
|
3362
|
-
position:
|
|
3363
|
-
insets:
|
|
3388
|
+
gridColumnStart: $r(r.getPropertyValue("grid-column-start")),
|
|
3389
|
+
gridColumnEnd: $r(r.getPropertyValue("grid-column-end")),
|
|
3390
|
+
gridRowStart: $r(r.getPropertyValue("grid-row-start")),
|
|
3391
|
+
gridRowEnd: $r(r.getPropertyValue("grid-row-end")),
|
|
3392
|
+
width: Lr(a, r.width, "width", t, o, s, n),
|
|
3393
|
+
height: Lr(a, r.height, "height", t, o, s, n),
|
|
3394
|
+
minWidth: Vr(a, "min-width", r.minWidth, o, "min-w", s, n, t) ?? Pr(r.minWidth, t) ?? "auto",
|
|
3395
|
+
minHeight: Vr(a, "min-height", r.minHeight, o, "min-h", s, n, t) ?? Pr(r.minHeight, t) ?? "auto",
|
|
3396
|
+
maxWidth: Vr(a, "max-width", r.maxWidth, o, "max-w", s, n, t) ?? Pr(r.maxWidth, t),
|
|
3397
|
+
maxHeight: Vr(a, "max-height", r.maxHeight, o, "max-h", s, n, t) ?? Pr(r.maxHeight, t),
|
|
3398
|
+
padding: ni(r, t),
|
|
3399
|
+
margin: Or(r, a, o, s, t),
|
|
3400
|
+
position: jr(r.position),
|
|
3401
|
+
insets: Mr(r, a, o, s, t),
|
|
3364
3402
|
gapX: $(r.columnGap === "normal" || r.columnGap === "" ? p === "multicol" ? `${i}px` : "0px" : r.columnGap, t),
|
|
3365
3403
|
gapY: $(r.rowGap === "normal" ? "0px" : r.rowGap, t),
|
|
3366
|
-
border:
|
|
3404
|
+
border: ri(r),
|
|
3367
3405
|
borderStyle: {
|
|
3368
|
-
top:
|
|
3369
|
-
right:
|
|
3370
|
-
bottom:
|
|
3371
|
-
left:
|
|
3406
|
+
top: Nr(r.borderTopStyle),
|
|
3407
|
+
right: Nr(r.borderRightStyle),
|
|
3408
|
+
bottom: Nr(r.borderBottomStyle),
|
|
3409
|
+
left: Nr(r.borderLeftStyle)
|
|
3372
3410
|
},
|
|
3373
|
-
overflow:
|
|
3411
|
+
overflow: mr(r.overflow) || mr(r.overflowX) || mr(r.overflowY) ? "clip" : "visible",
|
|
3374
3412
|
whiteSpace: r.whiteSpace === "pre" ? "pre" : r.whiteSpace === "nowrap" ? "nowrap" : "normal",
|
|
3375
3413
|
tabSize: Math.max(1, Math.floor(parseFloat(r.tabSize)) || 8),
|
|
3376
|
-
lineGap:
|
|
3377
|
-
tracking:
|
|
3414
|
+
lineGap: Ar(r.lineHeight, i),
|
|
3415
|
+
tracking: kr(r.letterSpacing, i, n?.letterSpacing ?? 0),
|
|
3378
3416
|
textOverflow: r.textOverflow === "ellipsis" ? "ellipsis" : "clip",
|
|
3379
3417
|
color: r.color,
|
|
3380
3418
|
fontWeight: r.fontWeight,
|
|
3381
3419
|
fontStyle: r.fontStyle,
|
|
3382
3420
|
textDecorationLine: r.textDecorationLine,
|
|
3383
|
-
backgroundColor:
|
|
3421
|
+
backgroundColor: pr(e, r.backgroundColor, r),
|
|
3384
3422
|
backgroundClear: r.getPropertyValue("--mw-bg-clear").trim() === "1",
|
|
3385
3423
|
borderColor: {
|
|
3386
3424
|
top: r.borderTopColor,
|
|
@@ -3388,17 +3426,17 @@ function tr(e, t, n) {
|
|
|
3388
3426
|
bottom: r.borderBottomColor,
|
|
3389
3427
|
left: r.borderLeftColor
|
|
3390
3428
|
},
|
|
3391
|
-
textAlignBlocked:
|
|
3392
|
-
textAlign:
|
|
3393
|
-
textIndent:
|
|
3394
|
-
opacity:
|
|
3429
|
+
textAlignBlocked: Sr(e, r),
|
|
3430
|
+
textAlign: Cr(e, r),
|
|
3431
|
+
textIndent: Ir(r, t),
|
|
3432
|
+
opacity: Fr(r.opacity),
|
|
3395
3433
|
zIndex: r.zIndex === "auto" || r.zIndex === "" ? null : Number(r.zIndex) || 0,
|
|
3396
3434
|
latticeBorder: null,
|
|
3397
|
-
ruleX: p === "flex" || p === "grid" || p === "multicol" ?
|
|
3398
|
-
ruleY: p === "flex" || p === "grid" ?
|
|
3399
|
-
ruleBreak:
|
|
3400
|
-
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0,
|
|
3401
|
-
ruleVisibilityItems:
|
|
3435
|
+
ruleX: p === "flex" || p === "grid" || p === "multicol" ? xr(r, "x") : null,
|
|
3436
|
+
ruleY: p === "flex" || p === "grid" ? xr(r, "y") : null,
|
|
3437
|
+
ruleBreak: br(r, "--mw-rule-break", ["none", "intersection"], "normal"),
|
|
3438
|
+
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0, M(parseFloat(r.getPropertyValue("--mw-rule-inset")) || 0)),
|
|
3439
|
+
ruleVisibilityItems: br(r, "--mw-rule-visibility-items", [
|
|
3402
3440
|
"all",
|
|
3403
3441
|
"around",
|
|
3404
3442
|
"between"
|
|
@@ -3411,9 +3449,9 @@ function tr(e, t, n) {
|
|
|
3411
3449
|
breakAfterColumn: r.breakAfter === "column",
|
|
3412
3450
|
breakInsideAvoid: r.breakInside === "avoid" || r.breakInside === "avoid-column"
|
|
3413
3451
|
};
|
|
3414
|
-
return
|
|
3452
|
+
return dr(w, r), w;
|
|
3415
3453
|
}
|
|
3416
|
-
function
|
|
3454
|
+
function dr(e, t) {
|
|
3417
3455
|
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 = {
|
|
3418
3456
|
width: e.border,
|
|
3419
3457
|
style: e.borderStyle,
|
|
@@ -3426,24 +3464,24 @@ function nr(e, t) {
|
|
|
3426
3464
|
}
|
|
3427
3465
|
}, e.border = R(), e.display === "table" && (e.padding = R()));
|
|
3428
3466
|
}
|
|
3429
|
-
function
|
|
3467
|
+
function fr(e) {
|
|
3430
3468
|
if (!e) return !0;
|
|
3431
3469
|
let t = e.trim().toLowerCase();
|
|
3432
3470
|
return t === "" || t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "currentcolor";
|
|
3433
3471
|
}
|
|
3434
|
-
function
|
|
3435
|
-
let i = r(e,
|
|
3472
|
+
function pr(e, t, n) {
|
|
3473
|
+
let i = r(e, fr(t) ? "" : t, n);
|
|
3436
3474
|
return i === "" ? void 0 : i;
|
|
3437
3475
|
}
|
|
3438
|
-
function
|
|
3476
|
+
function mr(e) {
|
|
3439
3477
|
return e === "hidden" || e === "clip";
|
|
3440
3478
|
}
|
|
3441
|
-
function
|
|
3479
|
+
function hr(e) {
|
|
3442
3480
|
if (e.position !== "absolute" && e.position !== "fixed") return !1;
|
|
3443
3481
|
let t = e.clip.replace(/\s/g, "");
|
|
3444
|
-
return t === "rect(0px,0px,0px,0px)" || t === "rect(0,0,0,0)" || (
|
|
3482
|
+
return t === "rect(0px,0px,0px,0px)" || t === "rect(0,0,0,0)" || (mr(e.overflow) || mr(e.overflowX)) && parseFloat(e.width) <= 1 && parseFloat(e.height) <= 1;
|
|
3445
3483
|
}
|
|
3446
|
-
var
|
|
3484
|
+
var gr = {
|
|
3447
3485
|
TABLE: "table",
|
|
3448
3486
|
THEAD: "table-header-group",
|
|
3449
3487
|
TBODY: "table-row-group",
|
|
@@ -3454,7 +3492,7 @@ var sr = {
|
|
|
3454
3492
|
CAPTION: "table-caption",
|
|
3455
3493
|
COL: "table-column",
|
|
3456
3494
|
COLGROUP: "table-column-group"
|
|
3457
|
-
},
|
|
3495
|
+
}, _r = {
|
|
3458
3496
|
"table-header-group": "header-group",
|
|
3459
3497
|
"table-row-group": "row-group",
|
|
3460
3498
|
"table-footer-group": "footer-group",
|
|
@@ -3464,38 +3502,38 @@ var sr = {
|
|
|
3464
3502
|
"table-column": "column",
|
|
3465
3503
|
"table-column-group": "column-group"
|
|
3466
3504
|
};
|
|
3467
|
-
function
|
|
3505
|
+
function vr(e, t) {
|
|
3468
3506
|
let n = t.verticalAlign || e.getAttribute("valign")?.toLowerCase() || (e.tagName === "TD" || e.tagName === "TH" ? "middle" : "baseline");
|
|
3469
3507
|
return n === "top" ? "start" : n === "middle" ? "center" : n === "bottom" ? "end" : "start";
|
|
3470
3508
|
}
|
|
3471
|
-
function
|
|
3472
|
-
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") &&
|
|
3509
|
+
function yr(e, t, n) {
|
|
3510
|
+
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") && b(e, "font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.");
|
|
3473
3511
|
}
|
|
3474
|
-
function
|
|
3512
|
+
function br(e, t, n, r) {
|
|
3475
3513
|
let i = e.getPropertyValue(t).trim();
|
|
3476
3514
|
return n.includes(i) ? i : r;
|
|
3477
3515
|
}
|
|
3478
|
-
function
|
|
3479
|
-
let n =
|
|
3516
|
+
function xr(e, t) {
|
|
3517
|
+
let n = M(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`)) || 0);
|
|
3480
3518
|
if (n <= 0) return null;
|
|
3481
3519
|
let r = e.getPropertyValue(`--mw-rule-${t}-color`).trim();
|
|
3482
3520
|
return {
|
|
3483
3521
|
width: n,
|
|
3484
|
-
style:
|
|
3522
|
+
style: Nr(e.getPropertyValue(`--mw-rule-${t}-style`).trim()),
|
|
3485
3523
|
color: r && r !== "currentcolor" && r !== "currentColor" ? r : e.color
|
|
3486
3524
|
};
|
|
3487
3525
|
}
|
|
3488
|
-
function
|
|
3526
|
+
function Sr(e, t) {
|
|
3489
3527
|
return t.textAlign === "justify" || e.getAttribute("align")?.toLowerCase() === "justify";
|
|
3490
3528
|
}
|
|
3491
|
-
function
|
|
3529
|
+
function Cr(e, t) {
|
|
3492
3530
|
let n = t.textAlign || e.getAttribute("align")?.toLowerCase() || "";
|
|
3493
3531
|
return n === "right" || n === "end" ? "end" : n === "center" || n.endsWith("-center") ? "center" : "start";
|
|
3494
3532
|
}
|
|
3495
|
-
function
|
|
3533
|
+
function wr(e) {
|
|
3496
3534
|
return typeof e.computedStyleMap == "function";
|
|
3497
3535
|
}
|
|
3498
|
-
function
|
|
3536
|
+
function Tr(e) {
|
|
3499
3537
|
switch (e) {
|
|
3500
3538
|
case "center": return "center";
|
|
3501
3539
|
case "flex-end":
|
|
@@ -3510,7 +3548,7 @@ function gr(e) {
|
|
|
3510
3548
|
default: return "start";
|
|
3511
3549
|
}
|
|
3512
3550
|
}
|
|
3513
|
-
function
|
|
3551
|
+
function Er(e) {
|
|
3514
3552
|
switch (e) {
|
|
3515
3553
|
case "center": return "center";
|
|
3516
3554
|
case "flex-end":
|
|
@@ -3521,10 +3559,10 @@ function _r(e) {
|
|
|
3521
3559
|
default: return "start";
|
|
3522
3560
|
}
|
|
3523
3561
|
}
|
|
3524
|
-
function
|
|
3525
|
-
return e === "auto" || e === "" || e === "normal" ? "auto" :
|
|
3562
|
+
function Dr(e) {
|
|
3563
|
+
return e === "auto" || e === "" || e === "normal" ? "auto" : Er(e);
|
|
3526
3564
|
}
|
|
3527
|
-
function
|
|
3565
|
+
function Or(e, t, n, r, i) {
|
|
3528
3566
|
let a = (a, o, s) => {
|
|
3529
3567
|
if (t) {
|
|
3530
3568
|
let e = t.get(a)?.toString().trim();
|
|
@@ -3548,16 +3586,16 @@ function yr(e, t, n, r, i) {
|
|
|
3548
3586
|
left: a("margin-left", "margin-inline-start", /(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)
|
|
3549
3587
|
};
|
|
3550
3588
|
}
|
|
3551
|
-
function
|
|
3589
|
+
function kr(e, t, n) {
|
|
3552
3590
|
let r = (e === "normal" ? 0 : parseFloat(e) || 0) - n;
|
|
3553
3591
|
return r <= 0 ? 0 : Math.floor(r / (.025 * t) + 1e-6);
|
|
3554
3592
|
}
|
|
3555
|
-
function
|
|
3593
|
+
function Ar(e, t) {
|
|
3556
3594
|
if (!e || e === "normal" || t <= 0) return 0;
|
|
3557
3595
|
let n = parseFloat(e);
|
|
3558
3596
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n / t + 1e-6) - 1) : 0;
|
|
3559
3597
|
}
|
|
3560
|
-
function
|
|
3598
|
+
function jr(e) {
|
|
3561
3599
|
switch (e) {
|
|
3562
3600
|
case "relative":
|
|
3563
3601
|
case "absolute":
|
|
@@ -3566,7 +3604,7 @@ function Sr(e) {
|
|
|
3566
3604
|
default: return "static";
|
|
3567
3605
|
}
|
|
3568
3606
|
}
|
|
3569
|
-
function
|
|
3607
|
+
function Mr(e, t, n, r, i) {
|
|
3570
3608
|
let a = (a, o) => {
|
|
3571
3609
|
if (t) {
|
|
3572
3610
|
let e = t.get(a)?.toString().trim();
|
|
@@ -3585,7 +3623,7 @@ function Cr(e, t, n, r, i) {
|
|
|
3585
3623
|
left: a("left", /(?:^|[\s:.[!])-?(?:left|start|inset|inset-x)-/)
|
|
3586
3624
|
};
|
|
3587
3625
|
}
|
|
3588
|
-
function
|
|
3626
|
+
function Nr(e) {
|
|
3589
3627
|
switch (e) {
|
|
3590
3628
|
case "double": return "double";
|
|
3591
3629
|
case "dashed": return "dashed";
|
|
@@ -3593,7 +3631,7 @@ function wr(e) {
|
|
|
3593
3631
|
default: return "solid";
|
|
3594
3632
|
}
|
|
3595
3633
|
}
|
|
3596
|
-
function
|
|
3634
|
+
function Pr(e, t) {
|
|
3597
3635
|
if (!e || e === "none" || e === "auto") return;
|
|
3598
3636
|
if (e === "min-content" || e === "max-content" || e === "fit-content") return e;
|
|
3599
3637
|
if (e.endsWith("%")) {
|
|
@@ -3601,7 +3639,7 @@ function Tr(e, t) {
|
|
|
3601
3639
|
return Number.isFinite(t) ? { percent: t } : void 0;
|
|
3602
3640
|
}
|
|
3603
3641
|
let n = parseFloat(e);
|
|
3604
|
-
return Number.isFinite(n) ?
|
|
3642
|
+
return Number.isFinite(n) ? N(n, t) : void 0;
|
|
3605
3643
|
}
|
|
3606
3644
|
function $(e, t) {
|
|
3607
3645
|
if (!e || e === "auto" || e === "none") return 0;
|
|
@@ -3610,30 +3648,30 @@ function $(e, t) {
|
|
|
3610
3648
|
return Number.isFinite(t) && t !== 0 ? { percent: t } : 0;
|
|
3611
3649
|
}
|
|
3612
3650
|
let n = parseFloat(e);
|
|
3613
|
-
return Number.isFinite(n) ?
|
|
3651
|
+
return Number.isFinite(n) ? N(n, t) : 0;
|
|
3614
3652
|
}
|
|
3615
|
-
function
|
|
3653
|
+
function Fr(e) {
|
|
3616
3654
|
let t = parseFloat(e);
|
|
3617
3655
|
return Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : 1;
|
|
3618
3656
|
}
|
|
3619
|
-
function
|
|
3657
|
+
function Ir(e, t) {
|
|
3620
3658
|
let n = e.textIndent;
|
|
3621
3659
|
if (!n || n.endsWith("%")) return 0;
|
|
3622
3660
|
let r = parseFloat(n);
|
|
3623
|
-
return Number.isFinite(r) ? Math.max(0,
|
|
3661
|
+
return Number.isFinite(r) ? Math.max(0, N(r, t)) : 0;
|
|
3624
3662
|
}
|
|
3625
|
-
function
|
|
3626
|
-
let s =
|
|
3663
|
+
function Lr(e, t, n, r, i, a, o) {
|
|
3664
|
+
let s = Rr(n === "width" ? a.width : a.height);
|
|
3627
3665
|
if (s !== null) return {
|
|
3628
3666
|
kind: "cells",
|
|
3629
|
-
value:
|
|
3667
|
+
value: Br(s, n, o, r)
|
|
3630
3668
|
};
|
|
3631
|
-
let c =
|
|
3669
|
+
let c = zr(i, n === "width" ? "w" : "h");
|
|
3632
3670
|
if (c !== null) {
|
|
3633
3671
|
let i = parseFloat(e ? String(e.get(n) ?? "") : t), a = Number.isFinite(i) && Math.abs(i - c) <= c * .3;
|
|
3634
3672
|
if (a || !Number.isFinite(i)) return {
|
|
3635
3673
|
kind: "cells",
|
|
3636
|
-
value:
|
|
3674
|
+
value: Br(a ? i : c, n, o, r)
|
|
3637
3675
|
};
|
|
3638
3676
|
}
|
|
3639
3677
|
if (e) {
|
|
@@ -3641,7 +3679,7 @@ function Or(e, t, n, r, i, a, o) {
|
|
|
3641
3679
|
if (t == null) return;
|
|
3642
3680
|
let i = t.toString().trim();
|
|
3643
3681
|
if (i === "auto") return { kind: "auto" };
|
|
3644
|
-
let a =
|
|
3682
|
+
let a = Ur(i);
|
|
3645
3683
|
if (a) return a;
|
|
3646
3684
|
if (i.endsWith("%")) return {
|
|
3647
3685
|
kind: "percent",
|
|
@@ -3649,22 +3687,22 @@ function Or(e, t, n, r, i, a, o) {
|
|
|
3649
3687
|
};
|
|
3650
3688
|
if (i.endsWith("px")) return {
|
|
3651
3689
|
kind: "cells",
|
|
3652
|
-
value:
|
|
3690
|
+
value: N(parseFloat(i), r)
|
|
3653
3691
|
};
|
|
3654
3692
|
if (i.endsWith("rem")) return {
|
|
3655
3693
|
kind: "cells",
|
|
3656
|
-
value:
|
|
3694
|
+
value: M(parseFloat(i) / .25)
|
|
3657
3695
|
};
|
|
3658
|
-
let s =
|
|
3696
|
+
let s = Rr(i);
|
|
3659
3697
|
if (s !== null) return {
|
|
3660
3698
|
kind: "cells",
|
|
3661
|
-
value:
|
|
3699
|
+
value: Br(s, n, o, r)
|
|
3662
3700
|
};
|
|
3663
3701
|
}
|
|
3664
3702
|
let l = n === "width" ? a.width : a.height;
|
|
3665
3703
|
if (l) {
|
|
3666
3704
|
if (l === "auto") return { kind: "auto" };
|
|
3667
|
-
let e =
|
|
3705
|
+
let e = Ur(l);
|
|
3668
3706
|
if (e) return e;
|
|
3669
3707
|
if (l.endsWith("%")) return {
|
|
3670
3708
|
kind: "percent",
|
|
@@ -3673,7 +3711,7 @@ function Or(e, t, n, r, i, a, o) {
|
|
|
3673
3711
|
let t = parseFloat(l);
|
|
3674
3712
|
if (Number.isFinite(t)) return {
|
|
3675
3713
|
kind: "cells",
|
|
3676
|
-
value:
|
|
3714
|
+
value: N(t, r)
|
|
3677
3715
|
};
|
|
3678
3716
|
}
|
|
3679
3717
|
let u = n === "width" ? "w" : "h";
|
|
@@ -3697,9 +3735,9 @@ function Or(e, t, n, r, i, a, o) {
|
|
|
3697
3735
|
let p = RegExp(`(?:^|[\\s:.[!])${u}-(\\d+(?:\\.\\d+)?)(?![\\w-/])`).exec(i);
|
|
3698
3736
|
if (p) return {
|
|
3699
3737
|
kind: "cells",
|
|
3700
|
-
value:
|
|
3738
|
+
value: M(Number(p[1]))
|
|
3701
3739
|
};
|
|
3702
|
-
if (!
|
|
3740
|
+
if (!ti(i, u) || t === "auto") return { kind: "auto" };
|
|
3703
3741
|
if (t.endsWith("%")) return {
|
|
3704
3742
|
kind: "percent",
|
|
3705
3743
|
value: parseFloat(t)
|
|
@@ -3707,10 +3745,10 @@ function Or(e, t, n, r, i, a, o) {
|
|
|
3707
3745
|
let m = parseFloat(t);
|
|
3708
3746
|
if (Number.isFinite(m)) return {
|
|
3709
3747
|
kind: "cells",
|
|
3710
|
-
value:
|
|
3748
|
+
value: N(m, r)
|
|
3711
3749
|
};
|
|
3712
3750
|
}
|
|
3713
|
-
function
|
|
3751
|
+
function Rr(e) {
|
|
3714
3752
|
let t = /^(-?[\d.]+)((?:[dsl]?v)(?:h|w|min|max)|vi|vb)$/.exec(e.trim());
|
|
3715
3753
|
if (!t || typeof window > "u") return null;
|
|
3716
3754
|
let n = parseFloat(t[1]);
|
|
@@ -3718,7 +3756,7 @@ function kr(e) {
|
|
|
3718
3756
|
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;
|
|
3719
3757
|
return n / 100 * o;
|
|
3720
3758
|
}
|
|
3721
|
-
function
|
|
3759
|
+
function zr(e, t) {
|
|
3722
3760
|
if (typeof window > "u") return null;
|
|
3723
3761
|
let n = RegExp(`(?:^|[\\s:.[!])${t}-(screen|[dsl]v[hw])(?![\\w-])`).exec(e);
|
|
3724
3762
|
if (n) {
|
|
@@ -3726,23 +3764,23 @@ function Ar(e, t) {
|
|
|
3726
3764
|
return e === "screen" ? t.includes("h") ? window.innerHeight : window.innerWidth : e.endsWith("h") ? window.innerHeight : window.innerWidth;
|
|
3727
3765
|
}
|
|
3728
3766
|
let r = RegExp(`(?:^|[\\s:.[!])${t}-\\[(-?[\\d.]+(?:[dsl]?v(?:h|w|min|max)|vi|vb))\\]`).exec(e);
|
|
3729
|
-
return r ?
|
|
3767
|
+
return r ? Rr(r[1]) : null;
|
|
3730
3768
|
}
|
|
3731
|
-
function
|
|
3769
|
+
function Br(e, t, n, r) {
|
|
3732
3770
|
let i = t === "width" ? n?.width : n?.height;
|
|
3733
|
-
return i && i > 0 ? Math.max(0, Math.floor(e / i)) :
|
|
3771
|
+
return i && i > 0 ? Math.max(0, Math.floor(e / i)) : N(e, r);
|
|
3734
3772
|
}
|
|
3735
|
-
function
|
|
3736
|
-
let c = t.endsWith("width") ? "width" : "height", l =
|
|
3737
|
-
if (l !== null) return
|
|
3738
|
-
let u =
|
|
3773
|
+
function Vr(e, t, n, r, i, a, o, s) {
|
|
3774
|
+
let c = t.endsWith("width") ? "width" : "height", l = Rr(a.getPropertyValue(t)) ?? Rr(e?.get(t)?.toString().trim() ?? "");
|
|
3775
|
+
if (l !== null) return Br(l, c, o, s);
|
|
3776
|
+
let u = zr(r, i);
|
|
3739
3777
|
if (u === null) return;
|
|
3740
3778
|
let d = parseFloat(e ? String(e.get(t) ?? "") : n), f = Number.isFinite(d) && Math.abs(d - u) <= u * .3;
|
|
3741
|
-
if (!(!f && Number.isFinite(d))) return
|
|
3779
|
+
if (!(!f && Number.isFinite(d))) return Br(f ? d : u, c, o, s);
|
|
3742
3780
|
}
|
|
3743
|
-
function
|
|
3781
|
+
function Hr(e, t) {
|
|
3744
3782
|
if (!e || e === "auto" || e === "content") return;
|
|
3745
|
-
let n =
|
|
3783
|
+
let n = Ur(e);
|
|
3746
3784
|
if (n) return n;
|
|
3747
3785
|
if (e.endsWith("%")) {
|
|
3748
3786
|
let t = parseFloat(e);
|
|
@@ -3754,30 +3792,30 @@ function Nr(e, t) {
|
|
|
3754
3792
|
let r = parseFloat(e);
|
|
3755
3793
|
return Number.isFinite(r) ? {
|
|
3756
3794
|
kind: "cells",
|
|
3757
|
-
value:
|
|
3795
|
+
value: N(r, t)
|
|
3758
3796
|
} : void 0;
|
|
3759
3797
|
}
|
|
3760
|
-
function
|
|
3798
|
+
function Ur(e) {
|
|
3761
3799
|
if (e === "min-content") return { kind: "min-content" };
|
|
3762
3800
|
if (e === "max-content") return { kind: "max-content" };
|
|
3763
3801
|
if (e === "fit-content") return { kind: "fit-content" };
|
|
3764
3802
|
}
|
|
3765
|
-
function
|
|
3803
|
+
function Wr(e, t) {
|
|
3766
3804
|
let n = e.trim();
|
|
3767
3805
|
if (!n || n === "none") return { kind: "none" };
|
|
3768
3806
|
if (n === "subgrid" || n.startsWith("subgrid ")) return { kind: "subgrid" };
|
|
3769
3807
|
let r = [], i = [], a = [], o = (e) => {
|
|
3770
3808
|
i.push(a), a = [], r.push(e);
|
|
3771
3809
|
}, s;
|
|
3772
|
-
for (let e of
|
|
3773
|
-
let n =
|
|
3810
|
+
for (let e of Qr(n)) {
|
|
3811
|
+
let n = Kr(e);
|
|
3774
3812
|
if (n) {
|
|
3775
3813
|
a.push(...n);
|
|
3776
3814
|
continue;
|
|
3777
3815
|
}
|
|
3778
3816
|
let i = e.match(/^repeat\(\s*([^,]+?)\s*,(.*)\)$/s);
|
|
3779
3817
|
if (i) {
|
|
3780
|
-
let e =
|
|
3818
|
+
let e = Gr(i[2].trim(), t);
|
|
3781
3819
|
if (e.tracks.length === 0) continue;
|
|
3782
3820
|
let n = i[1];
|
|
3783
3821
|
if (n === "auto-fill" || n === "auto-fit") {
|
|
@@ -3795,7 +3833,7 @@ function Fr(e, t) {
|
|
|
3795
3833
|
}
|
|
3796
3834
|
continue;
|
|
3797
3835
|
}
|
|
3798
|
-
o(
|
|
3836
|
+
o(Yr(e, t));
|
|
3799
3837
|
}
|
|
3800
3838
|
if (i.push(a), r.length === 0 && !s) return { kind: "none" };
|
|
3801
3839
|
let c = {
|
|
@@ -3804,26 +3842,26 @@ function Fr(e, t) {
|
|
|
3804
3842
|
};
|
|
3805
3843
|
return i.some((e) => e.length > 0) && (c.lineNames = i), s && (c.autoRepeat = s), c;
|
|
3806
3844
|
}
|
|
3807
|
-
function
|
|
3845
|
+
function Gr(e, t) {
|
|
3808
3846
|
let n = [], r = [], i = [];
|
|
3809
|
-
for (let a of
|
|
3810
|
-
let e =
|
|
3847
|
+
for (let a of Qr(e)) {
|
|
3848
|
+
let e = Kr(a);
|
|
3811
3849
|
if (e) {
|
|
3812
3850
|
i.push(...e);
|
|
3813
3851
|
continue;
|
|
3814
3852
|
}
|
|
3815
|
-
r.push(i), i = [], n.push(
|
|
3853
|
+
r.push(i), i = [], n.push(Yr(a, t));
|
|
3816
3854
|
}
|
|
3817
3855
|
return r.push(i), {
|
|
3818
3856
|
tracks: n,
|
|
3819
3857
|
lineNames: r
|
|
3820
3858
|
};
|
|
3821
3859
|
}
|
|
3822
|
-
function
|
|
3860
|
+
function Kr(e) {
|
|
3823
3861
|
let t = e.match(/^\[(.*)\]$/s);
|
|
3824
3862
|
return t ? t[1].split(/\s+/).filter((e) => e !== "") : null;
|
|
3825
3863
|
}
|
|
3826
|
-
function
|
|
3864
|
+
function qr(e) {
|
|
3827
3865
|
let t = [];
|
|
3828
3866
|
for (let n of e.matchAll(/"([^"]*)"|'([^']*)'/g)) {
|
|
3829
3867
|
let e = (n[1] ?? n[2] ?? "").trim().split(/\s+/).filter((e) => e !== "");
|
|
@@ -3853,23 +3891,23 @@ function Rr(e) {
|
|
|
3853
3891
|
areas: r
|
|
3854
3892
|
};
|
|
3855
3893
|
}
|
|
3856
|
-
function
|
|
3857
|
-
let n =
|
|
3858
|
-
return n.length > 0 ? n : [
|
|
3894
|
+
function Jr(e, t) {
|
|
3895
|
+
let n = Qr(e.trim()).filter((e) => e !== "" && !e.startsWith("[")).map((e) => Yr(e, t));
|
|
3896
|
+
return n.length > 0 ? n : [Ue()];
|
|
3859
3897
|
}
|
|
3860
|
-
function
|
|
3898
|
+
function Yr(e, t) {
|
|
3861
3899
|
let n = e.match(/^minmax\((.*)\)$/s);
|
|
3862
3900
|
if (n) {
|
|
3863
|
-
let e =
|
|
3901
|
+
let e = Zr(n[1]).map((e) => e.trim());
|
|
3864
3902
|
return e.length === 2 ? {
|
|
3865
|
-
min:
|
|
3866
|
-
max:
|
|
3903
|
+
min: Xr(e[0], t),
|
|
3904
|
+
max: Xr(e[1], t)
|
|
3867
3905
|
} : {
|
|
3868
3906
|
min: { kind: "auto" },
|
|
3869
3907
|
max: { kind: "auto" }
|
|
3870
3908
|
};
|
|
3871
3909
|
}
|
|
3872
|
-
let r =
|
|
3910
|
+
let r = Xr(e, t);
|
|
3873
3911
|
return r.kind === "fr" ? {
|
|
3874
3912
|
min: { kind: "auto" },
|
|
3875
3913
|
max: r
|
|
@@ -3878,13 +3916,13 @@ function Br(e, t) {
|
|
|
3878
3916
|
max: r
|
|
3879
3917
|
};
|
|
3880
3918
|
}
|
|
3881
|
-
function
|
|
3919
|
+
function Xr(e, t) {
|
|
3882
3920
|
if (e === "auto" || e.startsWith("fit-content")) return { kind: "auto" };
|
|
3883
3921
|
if (e === "min-content") return { kind: "min-content" };
|
|
3884
3922
|
if (e === "max-content") return { kind: "max-content" };
|
|
3885
3923
|
let n = e.match(/^(min|max)\((.*)\)$/s);
|
|
3886
3924
|
if (n) {
|
|
3887
|
-
let e =
|
|
3925
|
+
let e = Zr(n[2]).map((e) => Xr(e.trim(), t)), r = e.every((e) => e.kind === "cells" || e.kind === "percent" || e.kind === "math");
|
|
3888
3926
|
return e.length > 0 && r ? {
|
|
3889
3927
|
kind: "math",
|
|
3890
3928
|
fn: n[1],
|
|
@@ -3908,10 +3946,10 @@ function Vr(e, t) {
|
|
|
3908
3946
|
let r = parseFloat(e);
|
|
3909
3947
|
return Number.isFinite(r) ? {
|
|
3910
3948
|
kind: "cells",
|
|
3911
|
-
value: e.endsWith("rem") ?
|
|
3949
|
+
value: e.endsWith("rem") ? M(r / .25) : N(r, t)
|
|
3912
3950
|
} : { kind: "auto" };
|
|
3913
3951
|
}
|
|
3914
|
-
function
|
|
3952
|
+
function Zr(e) {
|
|
3915
3953
|
let t = [], n = 0, r = 0;
|
|
3916
3954
|
for (let i = 0; i < e.length; i++) {
|
|
3917
3955
|
let a = e[i];
|
|
@@ -3919,7 +3957,7 @@ function Hr(e) {
|
|
|
3919
3957
|
}
|
|
3920
3958
|
return t.push(e.slice(r)), t.filter((e) => e.trim() !== "");
|
|
3921
3959
|
}
|
|
3922
|
-
function
|
|
3960
|
+
function Qr(e) {
|
|
3923
3961
|
let t = [], n = 0, r = -1;
|
|
3924
3962
|
for (let i = 0; i < e.length; i++) {
|
|
3925
3963
|
let a = e[i];
|
|
@@ -3927,7 +3965,7 @@ function Ur(e) {
|
|
|
3927
3965
|
}
|
|
3928
3966
|
return r !== -1 && t.push(e.slice(r)), t;
|
|
3929
3967
|
}
|
|
3930
|
-
function
|
|
3968
|
+
function $r(e) {
|
|
3931
3969
|
let t = e.trim();
|
|
3932
3970
|
if (!t || t === "auto") return { kind: "auto" };
|
|
3933
3971
|
let n = !1, r, i;
|
|
@@ -3955,16 +3993,16 @@ function Wr(e) {
|
|
|
3955
3993
|
nth: r
|
|
3956
3994
|
};
|
|
3957
3995
|
}
|
|
3958
|
-
function
|
|
3996
|
+
function ei(e) {
|
|
3959
3997
|
return {
|
|
3960
3998
|
direction: e.includes("column") ? "column" : "row",
|
|
3961
3999
|
dense: e.includes("dense")
|
|
3962
4000
|
};
|
|
3963
4001
|
}
|
|
3964
|
-
function
|
|
4002
|
+
function ti(e, t) {
|
|
3965
4003
|
return (t === "w" ? /(?:^|[\s:.[!])w-/ : /(?:^|[\s:.[!])h-/).test(e);
|
|
3966
4004
|
}
|
|
3967
|
-
function
|
|
4005
|
+
function ni(e, t) {
|
|
3968
4006
|
return {
|
|
3969
4007
|
top: $(e.getPropertyValue("padding-top"), t),
|
|
3970
4008
|
right: $(e.getPropertyValue("padding-right"), t),
|
|
@@ -3972,8 +4010,8 @@ function qr(e, t) {
|
|
|
3972
4010
|
left: $(e.getPropertyValue("padding-left"), t)
|
|
3973
4011
|
};
|
|
3974
4012
|
}
|
|
3975
|
-
function
|
|
3976
|
-
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 :
|
|
4013
|
+
function ri(e) {
|
|
4014
|
+
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 : M(parseFloat(e.getPropertyValue(t)) || 0);
|
|
3977
4015
|
return {
|
|
3978
4016
|
top: t("border-top-width", "border-top-style"),
|
|
3979
4017
|
right: t("border-right-width", "border-right-style"),
|
|
@@ -3983,47 +4021,49 @@ function Jr(e) {
|
|
|
3983
4021
|
}
|
|
3984
4022
|
//#endregion
|
|
3985
4023
|
//#region src/tree.ts
|
|
3986
|
-
function
|
|
3987
|
-
let i =
|
|
4024
|
+
function ii(e, t, n, r) {
|
|
4025
|
+
let i = ur(e, t, n);
|
|
3988
4026
|
if (i.display === "none") return null;
|
|
3989
|
-
let a =
|
|
3990
|
-
if (
|
|
3991
|
-
|
|
4027
|
+
let a = T(e.tagName);
|
|
4028
|
+
if (a) return ai(e, i, a);
|
|
4029
|
+
let o = Array.from(e.children), s = o.map(ui), c = e.tagName, l = xi(c);
|
|
4030
|
+
if (!s.includes("block") || l) {
|
|
4031
|
+
let a = di(e, i.tracking, {
|
|
3992
4032
|
rootFontSizePx: t,
|
|
3993
4033
|
rootLetterSpacingPx: n?.letterSpacing ?? 0,
|
|
3994
4034
|
cellMetrics: n,
|
|
3995
4035
|
textareaWidths: r,
|
|
3996
4036
|
preserve: i.whiteSpace === "pre",
|
|
3997
4037
|
tabSize: i.tabSize
|
|
3998
|
-
}), u =
|
|
3999
|
-
if (
|
|
4000
|
-
let e =
|
|
4001
|
-
|
|
4002
|
-
|
|
4038
|
+
}), u = a.chars.join("");
|
|
4039
|
+
if (a.boxes.length > 0) {
|
|
4040
|
+
let e = bn();
|
|
4041
|
+
Se(a.chars, (t, n) => {
|
|
4042
|
+
a.advances[t] = Math.max(1, J(a.boxes[n], e));
|
|
4003
4043
|
});
|
|
4004
4044
|
}
|
|
4005
|
-
let d =
|
|
4006
|
-
if (
|
|
4007
|
-
if (
|
|
4008
|
-
else if (
|
|
4045
|
+
let d = gi(u, a.advances, i.tracking);
|
|
4046
|
+
if (l && d === 0) {
|
|
4047
|
+
if (c === "INPUT") d = Number(e.size) || 20;
|
|
4048
|
+
else if (c === "TEXTAREA") d = Number(e.cols) || 20;
|
|
4009
4049
|
else {
|
|
4010
4050
|
let t = e, n = (e) => e?.label || e?.textContent || "", r = getComputedStyle(e).getPropertyValue("field-sizing") === "content" ? [n(t.selectedOptions[0])] : Array.from(t.options, n);
|
|
4011
4051
|
d = Math.max(1, ...r.map((e) => e.trim().length));
|
|
4012
4052
|
}
|
|
4013
4053
|
}
|
|
4014
|
-
let f = u.length > 0 ?
|
|
4015
|
-
if (
|
|
4016
|
-
let t = e, n = t.value ?? "", a = r?.get(t), o = +!!n.endsWith("\n"), s = a !== void 0 && a > 0 ?
|
|
4054
|
+
let f = u.length > 0 ? _i(u) : 0, p;
|
|
4055
|
+
if (c === "TEXTAREA") {
|
|
4056
|
+
let t = e, n = t.value ?? "", a = r?.get(t), o = +!!n.endsWith("\n"), s = a !== void 0 && a > 0 ? he(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);
|
|
4017
4057
|
p = l + Math.max(0, l - 1) * i.lineGap;
|
|
4018
|
-
} else p =
|
|
4058
|
+
} else p = l ? Math.max(1, f) : f;
|
|
4019
4059
|
let m = /* @__PURE__ */ new Map(), h = [];
|
|
4020
|
-
for (let t of
|
|
4060
|
+
for (let t of a.boxes) t.source.parentElement === e ? m.set(t.source, t) : h.push(t);
|
|
4021
4061
|
let g = [];
|
|
4022
|
-
for (let e = 0; e <
|
|
4023
|
-
let i =
|
|
4024
|
-
if (
|
|
4025
|
-
else if (
|
|
4026
|
-
let e =
|
|
4062
|
+
for (let e = 0; e < o.length; e++) {
|
|
4063
|
+
let i = o[e], a = m.get(i);
|
|
4064
|
+
if (a) g.push(a);
|
|
4065
|
+
else if (s[e] === "out-of-flow") {
|
|
4066
|
+
let e = ii(i, t, n, r);
|
|
4027
4067
|
e && g.push(e);
|
|
4028
4068
|
}
|
|
4029
4069
|
}
|
|
@@ -4044,18 +4084,18 @@ function Yr(e, t, n, r) {
|
|
|
4044
4084
|
unclampedHeight: 0,
|
|
4045
4085
|
resolvedPadding: R()
|
|
4046
4086
|
};
|
|
4047
|
-
return (
|
|
4087
|
+
return (a.advances.some((e) => e !== 1) || a.boxes.length > 0) && (_.advances = a.advances), a.inlineElements.length > 0 && (_.inlineElements = a.inlineElements, _.charInline = a.chars.map((e, t) => a.inlineIndex[t] ?? -1)), _;
|
|
4048
4088
|
}
|
|
4049
|
-
let
|
|
4050
|
-
for (let e = 0; e <
|
|
4051
|
-
if (
|
|
4052
|
-
let i =
|
|
4053
|
-
i &&
|
|
4089
|
+
let u = [];
|
|
4090
|
+
for (let e = 0; e < o.length; e++) {
|
|
4091
|
+
if (s[e] === "none") continue;
|
|
4092
|
+
let i = ii(o[e], t, n, r);
|
|
4093
|
+
i && u.push(i);
|
|
4054
4094
|
}
|
|
4055
|
-
let
|
|
4095
|
+
let d = {
|
|
4056
4096
|
source: e,
|
|
4057
4097
|
style: i,
|
|
4058
|
-
children:
|
|
4098
|
+
children: u,
|
|
4059
4099
|
text: "",
|
|
4060
4100
|
intrinsicWidth: 0,
|
|
4061
4101
|
intrinsicHeight: 0,
|
|
@@ -4068,25 +4108,68 @@ function Yr(e, t, n, r) {
|
|
|
4068
4108
|
unclampedHeight: 0,
|
|
4069
4109
|
resolvedPadding: R()
|
|
4070
4110
|
};
|
|
4071
|
-
return
|
|
4111
|
+
return Si(e, d), d;
|
|
4072
4112
|
}
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4113
|
+
function ai(e, t, n) {
|
|
4114
|
+
let r = ee(n, e), i = r?.lines ?? [], a = i.join("\n");
|
|
4115
|
+
t.whiteSpace = "pre";
|
|
4116
|
+
let o = gi(a, Array.from({ length: a.length }, () => 1), t.tracking), s = i.length, c = {
|
|
4117
|
+
source: e,
|
|
4118
|
+
style: t,
|
|
4119
|
+
children: [],
|
|
4120
|
+
text: a,
|
|
4121
|
+
intrinsicWidth: o,
|
|
4122
|
+
intrinsicHeight: s,
|
|
4123
|
+
localRect: {
|
|
4124
|
+
x: 0,
|
|
4125
|
+
y: 0,
|
|
4126
|
+
width: o,
|
|
4127
|
+
height: s
|
|
4128
|
+
},
|
|
4129
|
+
unclampedHeight: 0,
|
|
4130
|
+
resolvedPadding: R()
|
|
4131
|
+
}, l = r?.runs ?? [];
|
|
4132
|
+
if (l.length > 0 && a.length > 0) {
|
|
4133
|
+
let t = [0];
|
|
4134
|
+
for (let e of i) t.push(t[t.length - 1] + e.length + 1);
|
|
4135
|
+
let n = Array.from({ length: a.length }, () => -1);
|
|
4136
|
+
c.inlineElements = l.map((t) => ({
|
|
4137
|
+
element: e,
|
|
4138
|
+
tracking: 0,
|
|
4139
|
+
padLeft: 0,
|
|
4140
|
+
padRight: 0,
|
|
4141
|
+
insets: null,
|
|
4142
|
+
color: t.paint.color,
|
|
4143
|
+
backgroundColor: t.paint.backgroundColor,
|
|
4144
|
+
fontWeight: t.paint.fontWeight ?? "",
|
|
4145
|
+
fontStyle: t.paint.fontStyle ?? "",
|
|
4146
|
+
textDecorationLine: t.paint.textDecorationLine ?? ""
|
|
4147
|
+
})), l.forEach((e, r) => {
|
|
4148
|
+
let a = i[e.line];
|
|
4149
|
+
if (a === void 0) return;
|
|
4150
|
+
let o = Math.max(0, e.start), s = Math.min(a.length, e.end);
|
|
4151
|
+
for (let i = o; i < s; i++) n[t[e.line] + i] = r;
|
|
4152
|
+
}), c.charInline = n;
|
|
4153
|
+
}
|
|
4154
|
+
return c;
|
|
4155
|
+
}
|
|
4156
|
+
var oi = /* @__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("."));
|
|
4157
|
+
function si(e, t) {
|
|
4158
|
+
return t || (oi.has(e.tagName) ? "inline" : "block");
|
|
4076
4159
|
}
|
|
4077
|
-
function
|
|
4078
|
-
let n =
|
|
4160
|
+
function ci(e, t) {
|
|
4161
|
+
let n = si(e, t);
|
|
4079
4162
|
return n === "inline" || n === "contents";
|
|
4080
4163
|
}
|
|
4081
|
-
function
|
|
4082
|
-
let n =
|
|
4164
|
+
function li(e, t) {
|
|
4165
|
+
let n = si(e, t);
|
|
4083
4166
|
return n.startsWith("inline") && n !== "inline";
|
|
4084
4167
|
}
|
|
4085
|
-
function
|
|
4168
|
+
function ui(e) {
|
|
4086
4169
|
let t = getComputedStyle(e);
|
|
4087
|
-
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" :
|
|
4170
|
+
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" : T(e.tagName) ? "block" : ci(e, t.display) || li(e, t.display) ? "inline" : "block";
|
|
4088
4171
|
}
|
|
4089
|
-
function
|
|
4172
|
+
function di(e, t, n) {
|
|
4090
4173
|
let r = {
|
|
4091
4174
|
chars: [],
|
|
4092
4175
|
advances: [],
|
|
@@ -4094,15 +4177,15 @@ function ti(e, t, n) {
|
|
|
4094
4177
|
inlineElements: [],
|
|
4095
4178
|
boxes: []
|
|
4096
4179
|
};
|
|
4097
|
-
return
|
|
4180
|
+
return fi(e, t, n, r), n.preserve ? r : hi(r);
|
|
4098
4181
|
}
|
|
4099
|
-
function
|
|
4182
|
+
function fi(e, t, n, r) {
|
|
4100
4183
|
let i = () => {
|
|
4101
4184
|
let e = 0;
|
|
4102
4185
|
for (let t = r.chars.length - 1; t >= 0 && r.chars[t] !== "\n"; t--) e += r.advances[t];
|
|
4103
4186
|
return e;
|
|
4104
4187
|
};
|
|
4105
|
-
if (!
|
|
4188
|
+
if (!xi(e.tagName)) {
|
|
4106
4189
|
for (let a of Array.from(e.childNodes)) if (a.nodeType === Node.TEXT_NODE) {
|
|
4107
4190
|
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);
|
|
4108
4191
|
else if (e === " ") {
|
|
@@ -4118,24 +4201,24 @@ function ni(e, t, n, r) {
|
|
|
4118
4201
|
}
|
|
4119
4202
|
let t = getComputedStyle(e);
|
|
4120
4203
|
if (t.display === "none" || t.position === "absolute" || t.position === "fixed") continue;
|
|
4121
|
-
if (
|
|
4122
|
-
let t =
|
|
4204
|
+
if (li(e, t.display)) {
|
|
4205
|
+
let t = ii(e, n.rootFontSizePx, n.cellMetrics, n.textareaWidths);
|
|
4123
4206
|
t && (t.inlineBox = !0, r.chars.push(""), r.advances.push(1), r.boxes.push(t));
|
|
4124
4207
|
continue;
|
|
4125
4208
|
}
|
|
4126
|
-
if (!
|
|
4127
|
-
|
|
4209
|
+
if (!ci(e, t.display)) {
|
|
4210
|
+
vi(e);
|
|
4128
4211
|
continue;
|
|
4129
4212
|
}
|
|
4130
|
-
let i =
|
|
4213
|
+
let i = kr(t.letterSpacing, parseFloat(t.fontSize) || n.rootFontSizePx, n.rootLetterSpacingPx), o = pi(t.paddingLeft, n.rootFontSizePx), s = pi(t.paddingRight, n.rootFontSizePx);
|
|
4131
4214
|
r.inlineElements.push({
|
|
4132
4215
|
element: e,
|
|
4133
4216
|
tracking: i,
|
|
4134
4217
|
padLeft: o,
|
|
4135
4218
|
padRight: s,
|
|
4136
|
-
insets: t.position === "static" ? null :
|
|
4219
|
+
insets: t.position === "static" ? null : mi(t, n.rootFontSizePx),
|
|
4137
4220
|
color: t.color,
|
|
4138
|
-
backgroundColor:
|
|
4221
|
+
backgroundColor: fr(t.backgroundColor) ? void 0 : t.backgroundColor,
|
|
4139
4222
|
fontWeight: t.fontWeight,
|
|
4140
4223
|
fontStyle: t.fontStyle,
|
|
4141
4224
|
textDecorationLine: t.textDecorationLine
|
|
@@ -4143,22 +4226,22 @@ function ni(e, t, n, r) {
|
|
|
4143
4226
|
let c = r.inlineElements.length - 1;
|
|
4144
4227
|
for (let e = 0; e < o; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
4145
4228
|
let l = r.chars.length;
|
|
4146
|
-
|
|
4229
|
+
fi(e, i, n, r);
|
|
4147
4230
|
for (let e = l; e < r.chars.length; e++) r.inlineIndex[e] === void 0 && (r.inlineIndex[e] = c);
|
|
4148
4231
|
for (let e = 0; e < s; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
4149
4232
|
}
|
|
4150
4233
|
}
|
|
4151
4234
|
}
|
|
4152
|
-
function
|
|
4235
|
+
function pi(e, t) {
|
|
4153
4236
|
if (!e || e.endsWith("%")) return 0;
|
|
4154
4237
|
let n = parseFloat(e);
|
|
4155
|
-
return Number.isFinite(n) ? Math.max(0,
|
|
4238
|
+
return Number.isFinite(n) ? Math.max(0, N(n, t)) : 0;
|
|
4156
4239
|
}
|
|
4157
|
-
function
|
|
4240
|
+
function mi(e, t) {
|
|
4158
4241
|
let n = (e) => {
|
|
4159
4242
|
if (!e || e === "auto" || e.endsWith("%")) return null;
|
|
4160
4243
|
let n = parseFloat(e);
|
|
4161
|
-
return Number.isFinite(n) ?
|
|
4244
|
+
return Number.isFinite(n) ? N(n, t) : null;
|
|
4162
4245
|
};
|
|
4163
4246
|
return {
|
|
4164
4247
|
top: n(e.top),
|
|
@@ -4167,7 +4250,7 @@ function ii(e, t) {
|
|
|
4167
4250
|
left: n(e.left)
|
|
4168
4251
|
};
|
|
4169
4252
|
}
|
|
4170
|
-
function
|
|
4253
|
+
function hi(e) {
|
|
4171
4254
|
let t = [], n = [], r = [], i = () => {
|
|
4172
4255
|
let e = t.length;
|
|
4173
4256
|
for (; e > 0 && t[e - 1] !== "\n";) e--;
|
|
@@ -4192,30 +4275,30 @@ function ai(e) {
|
|
|
4192
4275
|
boxes: e.boxes
|
|
4193
4276
|
};
|
|
4194
4277
|
}
|
|
4195
|
-
function
|
|
4278
|
+
function gi(e, t, n) {
|
|
4196
4279
|
let r = 0, i = 0;
|
|
4197
4280
|
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r, P(i, a, t, n)), i = a + 1);
|
|
4198
4281
|
return r;
|
|
4199
4282
|
}
|
|
4200
|
-
function
|
|
4201
|
-
return
|
|
4283
|
+
function _i(e) {
|
|
4284
|
+
return _e(e).length;
|
|
4202
4285
|
}
|
|
4203
|
-
function
|
|
4204
|
-
|
|
4286
|
+
function vi(e) {
|
|
4287
|
+
b(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.");
|
|
4205
4288
|
}
|
|
4206
|
-
function
|
|
4289
|
+
function yi(e) {
|
|
4207
4290
|
return Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? ""));
|
|
4208
4291
|
}
|
|
4209
|
-
var
|
|
4210
|
-
function
|
|
4292
|
+
var bi = "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>).";
|
|
4293
|
+
function xi(e) {
|
|
4211
4294
|
return e === "INPUT" || e === "SELECT" || e === "TEXTAREA";
|
|
4212
4295
|
}
|
|
4213
|
-
function
|
|
4214
|
-
|
|
4296
|
+
function Si(e, t) {
|
|
4297
|
+
yi(e) && (t.droppedText = !0, b(e, bi));
|
|
4215
4298
|
}
|
|
4216
4299
|
//#endregion
|
|
4217
4300
|
//#region src/element.ts
|
|
4218
|
-
var
|
|
4301
|
+
var Ci = "\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", wi = "grid", Ti = [
|
|
4219
4302
|
"pointerover",
|
|
4220
4303
|
"pointerleave",
|
|
4221
4304
|
"pointerdown",
|
|
@@ -4227,12 +4310,12 @@ var pi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4227
4310
|
"focusout",
|
|
4228
4311
|
"input",
|
|
4229
4312
|
"change"
|
|
4230
|
-
],
|
|
4313
|
+
], Ei = /^(color|opacity|border-(top|right|bottom|left)-color|border-color)$/, Di = 3e4, Oi = typeof HTMLElement > "u" ? class {} : HTMLElement, ki = class e extends Oi {
|
|
4231
4314
|
static observedAttributes = ["select"];
|
|
4232
4315
|
static #e = /* @__PURE__ */ new Set();
|
|
4233
4316
|
static #t = null;
|
|
4234
4317
|
static #n = () => {
|
|
4235
|
-
for (let t of e.#e) t.#
|
|
4318
|
+
for (let t of e.#e) t.#W();
|
|
4236
4319
|
};
|
|
4237
4320
|
static #r(t) {
|
|
4238
4321
|
t instanceof HTMLLinkElement && t.rel === "stylesheet" && !t.sheet && t.addEventListener("load", e.#n, { once: !0 });
|
|
@@ -4261,11 +4344,9 @@ var pi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4261
4344
|
#d = !1;
|
|
4262
4345
|
#f = null;
|
|
4263
4346
|
#p = null;
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
connectedCallback() {
|
|
4268
|
-
this.hasAttribute("select") || this.setAttribute("select", mi), this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#H()), this.#l.observe(this), this.#l.observe(this.#c), window.addEventListener("resize", this.#R), this.#u = new MutationObserver(() => this.#H()), this.#u.observe(this, {
|
|
4347
|
+
#m = null;
|
|
4348
|
+
#h() {
|
|
4349
|
+
this.#u?.observe(this, {
|
|
4269
4350
|
childList: !0,
|
|
4270
4351
|
subtree: !0,
|
|
4271
4352
|
characterData: !0,
|
|
@@ -4275,81 +4356,90 @@ var pi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4275
4356
|
"style",
|
|
4276
4357
|
"colspan",
|
|
4277
4358
|
"rowspan",
|
|
4278
|
-
"span"
|
|
4359
|
+
"span",
|
|
4360
|
+
...E()
|
|
4279
4361
|
]
|
|
4280
|
-
})
|
|
4362
|
+
});
|
|
4363
|
+
}
|
|
4364
|
+
constructor() {
|
|
4365
|
+
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML = Ci, 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);
|
|
4366
|
+
}
|
|
4367
|
+
connectedCallback() {
|
|
4368
|
+
this.hasAttribute("select") || this.setAttribute("select", wi), this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#W()), this.#l.observe(this), this.#l.observe(this.#c), window.addEventListener("resize", this.#B), this.#u = new MutationObserver(() => this.#W()), this.#h(), this.#m = D(() => {
|
|
4369
|
+
this.#h(), this.#W();
|
|
4370
|
+
}), document.fonts?.ready.then(this.#V).catch((e) => {
|
|
4281
4371
|
console.warn("[monowind] document.fonts.ready failed:", e);
|
|
4282
|
-
}), document.fonts?.addEventListener("loadingdone", this.#
|
|
4283
|
-
for (let e of
|
|
4284
|
-
this.addEventListener("transitionrun", this.#
|
|
4372
|
+
}), document.fonts?.addEventListener("loadingdone", this.#V);
|
|
4373
|
+
for (let e of Ti) this.addEventListener(e, this.#z);
|
|
4374
|
+
this.addEventListener("transitionrun", this.#I), this.addEventListener("transitionend", this.#L), this.addEventListener("transitioncancel", this.#L), this.addEventListener("pointermove", this.#E), this.addEventListener("pointerleave", this.#D), this.addEventListener("pointerdown", this.#O), window.addEventListener("pointerup", this.#k), window.addEventListener("pointercancel", this.#k), document.addEventListener("scroll", this.#A, {
|
|
4285
4375
|
capture: !0,
|
|
4286
4376
|
passive: !0
|
|
4287
|
-
}), e.#i(this), this.#
|
|
4377
|
+
}), e.#i(this), this.#W();
|
|
4288
4378
|
}
|
|
4289
4379
|
disconnectedCallback() {
|
|
4290
|
-
window.removeEventListener("resize", this.#
|
|
4291
|
-
for (let e of
|
|
4292
|
-
this.removeEventListener("transitionrun", this.#
|
|
4293
|
-
}
|
|
4294
|
-
#
|
|
4295
|
-
#
|
|
4296
|
-
#
|
|
4297
|
-
#
|
|
4298
|
-
#
|
|
4299
|
-
#
|
|
4300
|
-
#
|
|
4301
|
-
#
|
|
4302
|
-
#
|
|
4303
|
-
static #
|
|
4304
|
-
#
|
|
4380
|
+
window.removeEventListener("resize", this.#B), this.#l?.disconnect(), this.#u?.disconnect(), this.#l = null, this.#u = null, this.#m?.(), this.#m = null, document.fonts?.removeEventListener("loadingdone", this.#V);
|
|
4381
|
+
for (let e of Ti) this.removeEventListener(e, this.#z);
|
|
4382
|
+
this.removeEventListener("transitionrun", this.#I), this.removeEventListener("transitionend", this.#L), this.removeEventListener("transitioncancel", this.#L), this.#N = 0, this.removeEventListener("pointermove", this.#E), this.removeEventListener("pointerleave", this.#D), this.removeEventListener("pointerdown", this.#O), window.removeEventListener("pointerup", this.#k), window.removeEventListener("pointercancel", this.#k), document.removeEventListener("scroll", this.#A, { capture: !0 }), this.#x = null, this.#v = null, this.#y = !1, this.#b = !1, this.#j(), e.#a(this);
|
|
4383
|
+
}
|
|
4384
|
+
#g = /* @__PURE__ */ new Set();
|
|
4385
|
+
#_ = /* @__PURE__ */ new Set();
|
|
4386
|
+
#v = null;
|
|
4387
|
+
#y = !1;
|
|
4388
|
+
#b = !1;
|
|
4389
|
+
#x = null;
|
|
4390
|
+
#S = NaN;
|
|
4391
|
+
#C = NaN;
|
|
4392
|
+
#w = null;
|
|
4393
|
+
static #T = typeof matchMedia > "u" ? null : matchMedia("(hover: hover)");
|
|
4394
|
+
#E = (e) => {
|
|
4305
4395
|
let { clientX: t, clientY: n } = e;
|
|
4306
|
-
this.#
|
|
4396
|
+
this.#x = {
|
|
4307
4397
|
x: t,
|
|
4308
4398
|
y: n
|
|
4309
4399
|
};
|
|
4310
|
-
let r = this.#
|
|
4400
|
+
let r = this.#w, i = this.#f;
|
|
4311
4401
|
if (r && i) {
|
|
4312
4402
|
let e = Math.floor((t - r.left) / i.width), a = Math.floor((n - r.top) / i.height);
|
|
4313
|
-
if (e === this.#
|
|
4403
|
+
if (e === this.#S && a === this.#C) return;
|
|
4314
4404
|
}
|
|
4315
|
-
this.#
|
|
4405
|
+
this.#j();
|
|
4316
4406
|
};
|
|
4317
|
-
#
|
|
4318
|
-
this.#
|
|
4407
|
+
#D = () => {
|
|
4408
|
+
this.#x = null, this.#j();
|
|
4319
4409
|
};
|
|
4320
|
-
#
|
|
4410
|
+
#O = (e) => {
|
|
4321
4411
|
let t = e;
|
|
4322
|
-
!t.isPrimary || t.button !== 0 || (this.#
|
|
4412
|
+
!t.isPrimary || t.button !== 0 || (this.#x = {
|
|
4323
4413
|
x: t.clientX,
|
|
4324
4414
|
y: t.clientY
|
|
4325
|
-
}, this.#
|
|
4415
|
+
}, this.#y = !0, this.#j(!0));
|
|
4326
4416
|
};
|
|
4327
|
-
#
|
|
4328
|
-
e.isPrimary && (!this.#
|
|
4417
|
+
#k = (e) => {
|
|
4418
|
+
e.isPrimary && (!this.#y && !this.#v || (this.#y = !1, this.#v = null, this.#j(), this.#b && this.#W()));
|
|
4329
4419
|
};
|
|
4330
|
-
#
|
|
4331
|
-
this.#
|
|
4420
|
+
#A = () => {
|
|
4421
|
+
this.#x && (this.#w = null, this.#j());
|
|
4332
4422
|
};
|
|
4333
|
-
#
|
|
4423
|
+
#j(t = !1) {
|
|
4334
4424
|
let n = this.#p, r = this.#f, i = [];
|
|
4335
|
-
if (this.#
|
|
4336
|
-
if (!this.#
|
|
4425
|
+
if (this.#x && n && r && this.isConnected && this.getAttribute("select") === "grid" && (this.#y || e.#T?.matches)) {
|
|
4426
|
+
if (!this.#w) {
|
|
4337
4427
|
let e = this.#s.getBoundingClientRect();
|
|
4338
|
-
this.#
|
|
4428
|
+
this.#w = {
|
|
4339
4429
|
left: e.left,
|
|
4340
4430
|
top: e.top
|
|
4341
4431
|
};
|
|
4342
4432
|
}
|
|
4343
|
-
this.#
|
|
4344
|
-
} else this.#
|
|
4433
|
+
this.#S = Math.floor((this.#x.x - this.#w.left) / r.width), this.#C = Math.floor((this.#x.y - this.#w.top) / r.height), i = ue(n, this.#S, this.#C);
|
|
4434
|
+
} else this.#S = NaN, this.#C = NaN;
|
|
4345
4435
|
let a = i.at(-1) ?? null;
|
|
4346
|
-
t && (this.#
|
|
4347
|
-
let o = e.#
|
|
4348
|
-
l = this.#
|
|
4436
|
+
t && (this.#v = a);
|
|
4437
|
+
let o = e.#T?.matches ? i : [], s = this.#v ? i.indexOf(this.#v) : -1, c = s >= 0 ? i.slice(0, s + 1) : [], l = this.#M("data-mw-hover", this.#g, o);
|
|
4438
|
+
l = this.#M("data-mw-active", this.#_, c) || l;
|
|
4349
4439
|
let u = a ? getComputedStyle(a).cursor : "";
|
|
4350
|
-
this.#s.style.cursor = u === "auto" ? "" : u, l && this.isConnected && this.#
|
|
4440
|
+
this.#s.style.cursor = u === "auto" ? "" : u, l && this.isConnected && this.#W();
|
|
4351
4441
|
}
|
|
4352
|
-
#
|
|
4442
|
+
#M(e, t, n) {
|
|
4353
4443
|
let r = !1, i = new Set(n);
|
|
4354
4444
|
for (let n of t) i.has(n) || (n.removeAttribute(e), r = !0);
|
|
4355
4445
|
for (let n of i) t.has(n) || (n.setAttribute(e, ""), r = !0);
|
|
@@ -4357,51 +4447,51 @@ var pi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4357
4447
|
for (let e of i) t.add(e);
|
|
4358
4448
|
return r;
|
|
4359
4449
|
}
|
|
4360
|
-
#j = 0;
|
|
4361
|
-
#M = !1;
|
|
4362
4450
|
#N = 0;
|
|
4363
|
-
#P =
|
|
4364
|
-
|
|
4451
|
+
#P = !1;
|
|
4452
|
+
#F = 0;
|
|
4453
|
+
#I = (e) => {
|
|
4454
|
+
Ei.test(e.propertyName) && (this.#N++, this.#F = performance.now(), this.#R());
|
|
4365
4455
|
};
|
|
4366
|
-
#
|
|
4367
|
-
|
|
4456
|
+
#L = (e) => {
|
|
4457
|
+
Ei.test(e.propertyName) && (this.#N = Math.max(0, this.#N - 1));
|
|
4368
4458
|
};
|
|
4369
|
-
#
|
|
4370
|
-
if (this.#
|
|
4371
|
-
this.#
|
|
4459
|
+
#R() {
|
|
4460
|
+
if (this.#P) return;
|
|
4461
|
+
this.#P = !0;
|
|
4372
4462
|
let e = () => {
|
|
4373
|
-
if (!this.isConnected || this.#
|
|
4374
|
-
this.#
|
|
4463
|
+
if (!this.isConnected || this.#N === 0 && !a() || performance.now() - this.#F > Di) {
|
|
4464
|
+
this.#P = !1, this.#N = 0, this.#W();
|
|
4375
4465
|
return;
|
|
4376
4466
|
}
|
|
4377
|
-
this.#
|
|
4467
|
+
this.#U(), requestAnimationFrame(e);
|
|
4378
4468
|
};
|
|
4379
4469
|
requestAnimationFrame(e);
|
|
4380
4470
|
}
|
|
4381
|
-
#
|
|
4471
|
+
#z = (e) => {
|
|
4382
4472
|
if ((e.type === "focusin" || e.type === "focusout") && e.target instanceof HTMLSelectElement) {
|
|
4383
|
-
this.#
|
|
4473
|
+
this.#U();
|
|
4384
4474
|
return;
|
|
4385
4475
|
}
|
|
4386
|
-
this.#
|
|
4476
|
+
this.#W();
|
|
4387
4477
|
};
|
|
4388
4478
|
attributeChangedCallback(e, t, n) {
|
|
4389
4479
|
if (e === "select" && n !== "text" && n !== "grid") {
|
|
4390
|
-
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`, this), this.setAttribute("select",
|
|
4480
|
+
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`, this), this.setAttribute("select", wi);
|
|
4391
4481
|
return;
|
|
4392
4482
|
}
|
|
4393
|
-
e === "select" && this.#
|
|
4483
|
+
e === "select" && this.#j(), this.#W();
|
|
4394
4484
|
}
|
|
4395
4485
|
toPlainText() {
|
|
4396
|
-
return this.#d && this.#
|
|
4486
|
+
return this.#d && this.#G(), this.#p ? Rn(this.#p) : "";
|
|
4397
4487
|
}
|
|
4398
|
-
#
|
|
4399
|
-
this.#
|
|
4488
|
+
#B = () => {
|
|
4489
|
+
this.#W();
|
|
4400
4490
|
};
|
|
4401
|
-
#
|
|
4402
|
-
requestAnimationFrame(() => this.#
|
|
4491
|
+
#V = () => {
|
|
4492
|
+
requestAnimationFrame(() => this.#W());
|
|
4403
4493
|
};
|
|
4404
|
-
#
|
|
4494
|
+
#H() {
|
|
4405
4495
|
let e = document.activeElement;
|
|
4406
4496
|
if (!(e instanceof HTMLSelectElement) || !this.contains(e)) return !1;
|
|
4407
4497
|
try {
|
|
@@ -4410,23 +4500,23 @@ var pi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4410
4500
|
return !1;
|
|
4411
4501
|
}
|
|
4412
4502
|
}
|
|
4413
|
-
#
|
|
4503
|
+
#U() {
|
|
4414
4504
|
try {
|
|
4415
|
-
this.#
|
|
4505
|
+
this.#G();
|
|
4416
4506
|
} catch (e) {
|
|
4417
4507
|
console.error("[monowind] layout failed:", e);
|
|
4418
4508
|
}
|
|
4419
4509
|
}
|
|
4420
|
-
#
|
|
4510
|
+
#W() {
|
|
4421
4511
|
this.#d || (this.#d = !0, requestAnimationFrame(() => {
|
|
4422
|
-
if (this.#d = !1, this.#
|
|
4423
|
-
this.#
|
|
4512
|
+
if (this.#d = !1, this.#H()) {
|
|
4513
|
+
this.#W();
|
|
4424
4514
|
return;
|
|
4425
4515
|
}
|
|
4426
|
-
this.#
|
|
4516
|
+
this.#U();
|
|
4427
4517
|
}));
|
|
4428
4518
|
}
|
|
4429
|
-
#
|
|
4519
|
+
#G() {
|
|
4430
4520
|
if (!this.isConnected) return;
|
|
4431
4521
|
let e = /* @__PURE__ */ new Map(), t = getComputedStyle(this).getPropertyValue("--mw-cw").trim(), n = parseFloat(t);
|
|
4432
4522
|
if (Number.isFinite(n) && n > 0) for (let t of this.querySelectorAll("textarea")) {
|
|
@@ -4436,23 +4526,23 @@ var pi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4436
4526
|
this.setAttribute("measuring", "");
|
|
4437
4527
|
try {
|
|
4438
4528
|
this.#c.parentNode !== this && this.appendChild(this.#c);
|
|
4439
|
-
let t =
|
|
4529
|
+
let t = fe(this, this.#c), n = this.#f;
|
|
4440
4530
|
(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;
|
|
4441
4531
|
let r = getComputedStyle(this), i = (parseFloat(r.paddingLeft) || 0) + (parseFloat(r.paddingRight) || 0), a = Math.max(0, Math.floor((this.clientWidth - i) / t.width));
|
|
4442
4532
|
if (a === 0) return;
|
|
4443
|
-
let o =
|
|
4533
|
+
let o = pe(), s = [];
|
|
4444
4534
|
for (let n of Array.from(this.children)) {
|
|
4445
4535
|
if (n === this.#c) continue;
|
|
4446
|
-
let r =
|
|
4536
|
+
let r = ii(n, o, t, e);
|
|
4447
4537
|
r && s.push(r);
|
|
4448
4538
|
}
|
|
4449
|
-
if (
|
|
4539
|
+
if (yi(this) ? (this.hasAttribute("data-mw-dropped-text") || console.warn(`[monowind] ${bi}`, this), this.setAttribute("data-mw-dropped-text", "")) : this.removeAttribute("data-mw-dropped-text"), s.length === 0) {
|
|
4450
4540
|
this.#s.replaceChildren(), this.#p = null, this.setAttribute("data-mw-ready", "");
|
|
4451
4541
|
return;
|
|
4452
4542
|
}
|
|
4453
4543
|
let c = {
|
|
4454
4544
|
source: this,
|
|
4455
|
-
style:
|
|
4545
|
+
style: He(),
|
|
4456
4546
|
children: s,
|
|
4457
4547
|
text: "",
|
|
4458
4548
|
intrinsicWidth: 0,
|
|
@@ -4465,19 +4555,19 @@ var pi = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4465
4555
|
},
|
|
4466
4556
|
unclampedHeight: 0,
|
|
4467
4557
|
resolvedPadding: R()
|
|
4468
|
-
}, { height: l } =
|
|
4469
|
-
|
|
4558
|
+
}, { height: l } = vn(c, a);
|
|
4559
|
+
ar(c), this.#b = !Zn(c, this.#s, this.#y), this.#p = c;
|
|
4470
4560
|
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`;
|
|
4471
4561
|
this.style.height !== d && (this.style.height = d), this.hasAttribute("data-mw-ready") || this.setAttribute("data-mw-ready", "");
|
|
4472
4562
|
} finally {
|
|
4473
|
-
this.setAttribute("settling", ""), this.removeAttribute("measuring"), getComputedStyle(this).transitionProperty, this.removeAttribute("settling"), this.#u?.takeRecords(), i(this) && (a() ? (this.#
|
|
4563
|
+
this.setAttribute("settling", ""), this.removeAttribute("measuring"), getComputedStyle(this).transitionProperty, this.removeAttribute("settling"), this.#u?.takeRecords(), i(this) && (a() ? (this.#F = performance.now(), this.#R()) : this.#W()), this.#w = null, this.#x && this.#j();
|
|
4474
4564
|
}
|
|
4475
4565
|
}
|
|
4476
4566
|
};
|
|
4477
|
-
function
|
|
4478
|
-
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind",
|
|
4567
|
+
function Ai() {
|
|
4568
|
+
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind", ki);
|
|
4479
4569
|
}
|
|
4480
4570
|
//#endregion
|
|
4481
|
-
export {
|
|
4571
|
+
export { ki as MonoWindElement, Ai as defineMonoWind, w as invalidateLeaves, Mt as multicolLines, C as registerLeafRenderer, Rn as renderPlainText, me as wrapLines };
|
|
4482
4572
|
|
|
4483
4573
|
//# sourceMappingURL=index.js.map
|