monowind 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/borders.d.ts +36 -7
- package/dist/borders.d.ts.map +1 -1
- package/dist/cdn.js +46 -43
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/flex.d.ts +2 -0
- package/dist/flex.d.ts.map +1 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1641 -949
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +32 -8
- package/dist/layout.d.ts.map +1 -1
- package/dist/metrics.d.ts.map +1 -1
- package/dist/multicol.d.ts +77 -0
- package/dist/multicol.d.ts.map +1 -0
- package/dist/paint.d.ts +3 -0
- package/dist/paint.d.ts.map +1 -0
- package/dist/plain-text.d.ts +19 -7
- package/dist/plain-text.d.ts.map +1 -1
- package/dist/render.d.ts +12 -5
- package/dist/render.d.ts.map +1 -1
- package/dist/sort.d.ts +2 -0
- package/dist/sort.d.ts.map +1 -0
- package/dist/sort.js +548 -0
- package/dist/sort.js.map +1 -0
- package/dist/style.d.ts +6 -0
- package/dist/style.d.ts.map +1 -1
- package/dist/tree.d.ts +16 -1
- package/dist/tree.d.ts.map +1 -1
- package/dist/types.d.ts +105 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/wrap.d.ts +4 -0
- package/dist/wrap.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/styles.css +236 -22
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ function e(e, n, r) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
function t(e, t, n, r, i) {
|
|
22
|
-
let a =
|
|
22
|
+
let a = c(t.top), o = c(t.right), s = c(t.bottom), l = c(t.left), u = (e, t, n) => n(c(e === t ? e : "solid")), { x: d, y: f, width: p, height: m } = r, h = p >= 2 && m >= 2, g = d + +!!i.left, _ = d + p - +!!i.right, v = f + +!!i.top, y = f + m - +!!i.bottom;
|
|
23
23
|
if (i.top && _ > g && e.push({
|
|
24
24
|
glyph: a.h,
|
|
25
25
|
x: g,
|
|
@@ -33,7 +33,7 @@ function t(e, t, n, r, i) {
|
|
|
33
33
|
length: _ - g,
|
|
34
34
|
color: n.bottom
|
|
35
35
|
}), i.left) for (let t = v; t < y; t++) e.push({
|
|
36
|
-
glyph:
|
|
36
|
+
glyph: l.v,
|
|
37
37
|
x: d,
|
|
38
38
|
y: t,
|
|
39
39
|
length: 1,
|
|
@@ -75,20 +75,24 @@ function t(e, t, n, r, i) {
|
|
|
75
75
|
function n(e, t) {
|
|
76
76
|
return e.style.position !== "static" || t.style.display === "flex" || t.style.display === "grid";
|
|
77
77
|
}
|
|
78
|
-
function r(e
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return
|
|
78
|
+
function r(e) {
|
|
79
|
+
if (e.children.length <= 1) return e.children;
|
|
80
|
+
let t = null, r = null, i = null;
|
|
81
|
+
for (let a of e.children) n(a, e) ? (i ??= []).push(a) : a.inlineBox ? (r ??= []).push(a) : (t ??= []).push(a);
|
|
82
|
+
return i && i.length > 1 && i.sort((e, t) => (e.style.zIndex ?? 0) - (t.style.zIndex ?? 0)), t && !r && !i ? t : !t && r && !i ? r : !t && !r && i ? i : [
|
|
83
|
+
...t ?? [],
|
|
84
|
+
...r ?? [],
|
|
85
|
+
...i ?? []
|
|
86
|
+
];
|
|
83
87
|
}
|
|
84
|
-
function
|
|
85
|
-
let n =
|
|
88
|
+
function i(e, t) {
|
|
89
|
+
let n = c(e);
|
|
86
90
|
return t === "h" ? n.h : n.v;
|
|
87
91
|
}
|
|
88
|
-
function
|
|
89
|
-
return (e === "double" ?
|
|
92
|
+
function a(e, t, n, r, i) {
|
|
93
|
+
return (e === "double" ? s : o)[(t ? 8 : 0) | (n ? 4 : 0) | (r ? 2 : 0) | !!i];
|
|
90
94
|
}
|
|
91
|
-
var
|
|
95
|
+
var o = [
|
|
92
96
|
" ",
|
|
93
97
|
"─",
|
|
94
98
|
"─",
|
|
@@ -105,7 +109,7 @@ var s = [
|
|
|
105
109
|
"├",
|
|
106
110
|
"┤",
|
|
107
111
|
"┼"
|
|
108
|
-
],
|
|
112
|
+
], s = [
|
|
109
113
|
" ",
|
|
110
114
|
"═",
|
|
111
115
|
"═",
|
|
@@ -123,8 +127,8 @@ var s = [
|
|
|
123
127
|
"╣",
|
|
124
128
|
"╬"
|
|
125
129
|
];
|
|
126
|
-
function
|
|
127
|
-
let t = (t, n, r, i) =>
|
|
130
|
+
function c(e) {
|
|
131
|
+
let t = (t, n, r, i) => a(e, t, n, r, i), n = {
|
|
128
132
|
h: t(!1, !1, !0, !0),
|
|
129
133
|
v: t(!0, !0, !1, !1),
|
|
130
134
|
tl: t(!1, !0, !1, !0),
|
|
@@ -142,51 +146,97 @@ function l(e) {
|
|
|
142
146
|
v: "┊"
|
|
143
147
|
} : n;
|
|
144
148
|
}
|
|
149
|
+
function l(e, t, n, r) {
|
|
150
|
+
let i = e.map((e) => e.spanned ? !1 : n === "between" ? e.beforeOccupied && e.afterOccupied : n !== "around" || e.beforeOccupied || e.afterOccupied), a = [];
|
|
151
|
+
for (let n = 0; n < e.length; n++) if (a.push({
|
|
152
|
+
start: e[n].start,
|
|
153
|
+
end: e[n].end,
|
|
154
|
+
covered: i[n]
|
|
155
|
+
}), n + 1 < e.length) {
|
|
156
|
+
let r = t === "intersection" ? !1 : t === "none" ? i[n] || i[n + 1] : i[n] && i[n + 1];
|
|
157
|
+
a.push({
|
|
158
|
+
start: e[n].end,
|
|
159
|
+
end: e[n + 1].start,
|
|
160
|
+
covered: r
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
let o = [];
|
|
164
|
+
for (let e of a) {
|
|
165
|
+
if (!e.covered) continue;
|
|
166
|
+
let t = o[o.length - 1];
|
|
167
|
+
t && t.end === e.start ? t.end = e.end : o.push({
|
|
168
|
+
start: e.start,
|
|
169
|
+
end: e.end
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (r === "overlap-join") {
|
|
173
|
+
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
174
|
+
for (let r = 0; r + 1 < e.length; r++) {
|
|
175
|
+
let i = e[r].end, a = e[r + 1].start - i;
|
|
176
|
+
a <= 0 || (n.set(i, i + Math.ceil(a / 2)), t.set(e[r + 1].start, i + Math.floor(a / 2)));
|
|
177
|
+
}
|
|
178
|
+
return o.map((e) => {
|
|
179
|
+
let r = t.get(e.start), i = n.get(e.end);
|
|
180
|
+
return {
|
|
181
|
+
start: r ?? e.start,
|
|
182
|
+
end: i ?? e.end,
|
|
183
|
+
startHalf: r !== void 0,
|
|
184
|
+
endHalf: i !== void 0
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return o.map((e) => ({
|
|
189
|
+
start: e.start + r,
|
|
190
|
+
end: e.end - r
|
|
191
|
+
})).filter((e) => e.end > e.start);
|
|
192
|
+
}
|
|
145
193
|
function u(e) {
|
|
146
|
-
let t = [], n = e.border.left + e.padding.left, r = e.border.top + e.padding.top,
|
|
194
|
+
let t = [], n = e.border.left + e.padding.left, r = e.border.top + e.padding.top, o = (e, t) => ({
|
|
147
195
|
line: t.bandStart + Math.floor((t.bandSize - e.width) / 2),
|
|
148
196
|
start: t.start,
|
|
149
|
-
end: t.end
|
|
150
|
-
|
|
197
|
+
end: t.end,
|
|
198
|
+
startHalf: t.startHalf === !0,
|
|
199
|
+
endHalf: t.endHalf === !0
|
|
200
|
+
}), s = e.ruleX ? e.vertical.map((t) => o(e.ruleX, t)) : [], c = e.ruleY ? e.horizontal.map((t) => o(e.ruleY, t)) : [], l = e.ruleX?.width ?? 0, u = e.ruleY?.width ?? 0, f = (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)), p = (e, t) => c.some((n) => t >= n.line && t < n.line + u && e >= n.start && e < n.end);
|
|
151
201
|
if (e.ruleX) {
|
|
152
|
-
let
|
|
153
|
-
for (let
|
|
154
|
-
for (let o = 0; o < l; o++) for (let s =
|
|
155
|
-
glyph:
|
|
156
|
-
x: n +
|
|
202
|
+
let a = i(e.ruleX.style, "v");
|
|
203
|
+
for (let i of s) {
|
|
204
|
+
for (let o = 0; o < l; o++) for (let s = i.start; s < i.end; s++) p(i.line + o, s) || t.push({
|
|
205
|
+
glyph: a,
|
|
206
|
+
x: n + i.line + o,
|
|
157
207
|
y: r + s,
|
|
158
208
|
length: 1,
|
|
159
209
|
color: e.ruleX.color
|
|
160
210
|
});
|
|
161
|
-
d(e, t, "x",
|
|
211
|
+
d(e, t, "x", i.line, i.start, i.end);
|
|
162
212
|
}
|
|
163
213
|
}
|
|
164
214
|
if (e.ruleY) {
|
|
165
|
-
let
|
|
166
|
-
for (let
|
|
167
|
-
for (let
|
|
168
|
-
let
|
|
169
|
-
for (let
|
|
170
|
-
let
|
|
215
|
+
let o = e.ruleY.style === "double" && e.ruleX?.style === "double";
|
|
216
|
+
for (let p of c) {
|
|
217
|
+
for (let d = 0; d < u; d++) {
|
|
218
|
+
let m = p.line + d;
|
|
219
|
+
for (let d = p.start; d < p.end; d++) {
|
|
220
|
+
let p = f(s, l, d, m), h = f(s, l, d, m + 1);
|
|
171
221
|
t.push({
|
|
172
|
-
glyph:
|
|
173
|
-
x: n +
|
|
174
|
-
y: r +
|
|
222
|
+
glyph: p || h ? a(o ? "double" : "solid", p, h, f(c, u, m, d), f(c, u, m, d + 1)) : i(e.ruleY.style, "h"),
|
|
223
|
+
x: n + d,
|
|
224
|
+
y: r + m,
|
|
175
225
|
length: 1,
|
|
176
226
|
color: e.ruleY.color
|
|
177
227
|
});
|
|
178
228
|
}
|
|
179
229
|
}
|
|
180
|
-
d(e, t, "y",
|
|
230
|
+
d(e, t, "y", p.line, p.start, p.end);
|
|
181
231
|
}
|
|
182
232
|
}
|
|
183
233
|
return t;
|
|
184
234
|
}
|
|
185
|
-
function d(e, t, n, r, i,
|
|
186
|
-
let s = n === "x" ? e.ruleX : e.ruleY, c = e.border.left + e.padding.left, l = e.border.top + e.padding.top, u = c + e.contentWidth + e.padding.right + e.border.right, d = l + e.contentHeight + e.padding.bottom + e.border.bottom, f = (e, n, r, i,
|
|
235
|
+
function d(e, t, n, r, i, o) {
|
|
236
|
+
let s = n === "x" ? e.ruleX : e.ruleY, c = e.border.left + e.padding.left, l = e.border.top + e.padding.top, u = c + e.contentWidth + e.padding.right + e.border.right, d = l + e.contentHeight + e.padding.bottom + e.border.bottom, f = (e, n, r, i, o, c, l, u) => {
|
|
187
237
|
let d = s.style === "double" && r === "double" ? "double" : "solid";
|
|
188
238
|
t.push({
|
|
189
|
-
glyph:
|
|
239
|
+
glyph: a(d, o, c, l, u),
|
|
190
240
|
x: e,
|
|
191
241
|
y: n,
|
|
192
242
|
length: 1,
|
|
@@ -195,11 +245,11 @@ function d(e, t, n, r, i, a) {
|
|
|
195
245
|
};
|
|
196
246
|
if (n === "x") for (let t = 0; t < s.width; t++) {
|
|
197
247
|
let n = c + r + t;
|
|
198
|
-
i <= 0 && e.padding.top === 0 && e.border.top > 0 && f(n, e.border.top - 1, e.borderStyle.top, e.borderColor.top, !1, !0, !0, !0),
|
|
248
|
+
i <= 0 && e.padding.top === 0 && e.border.top > 0 && f(n, e.border.top - 1, e.borderStyle.top, e.borderColor.top, !1, !0, !0, !0), o >= e.contentHeight && e.padding.bottom === 0 && e.border.bottom > 0 && f(n, d - e.border.bottom, e.borderStyle.bottom, e.borderColor.bottom, !0, !1, !0, !0);
|
|
199
249
|
}
|
|
200
250
|
else for (let t = 0; t < s.width; t++) {
|
|
201
251
|
let n = l + r + t;
|
|
202
|
-
i <= 0 && e.padding.left === 0 && e.border.left > 0 && f(e.border.left - 1, n, e.borderStyle.left, e.borderColor.left, !0, !0, !1, !0),
|
|
252
|
+
i <= 0 && e.padding.left === 0 && e.border.left > 0 && f(e.border.left - 1, n, e.borderStyle.left, e.borderColor.left, !0, !0, !1, !0), o >= e.contentWidth && e.padding.right === 0 && e.border.right > 0 && f(u - e.border.right, n, e.borderStyle.right, e.borderColor.right, !0, !0, !0, !1);
|
|
203
253
|
}
|
|
204
254
|
}
|
|
205
255
|
//#endregion
|
|
@@ -214,11 +264,14 @@ function m(e, t) {
|
|
|
214
264
|
return f(t * e / 100);
|
|
215
265
|
}
|
|
216
266
|
function h(e, t) {
|
|
217
|
-
let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).letterSpacing) || 0;
|
|
267
|
+
let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).letterSpacing) || 0, i = t.ownerDocument.createRange();
|
|
268
|
+
i.selectNodeContents(t);
|
|
269
|
+
let a = Math.max(0, i.getBoundingClientRect().height - n.height);
|
|
218
270
|
return {
|
|
219
271
|
width: n.width / 100,
|
|
220
272
|
height: n.height,
|
|
221
|
-
letterSpacing: r
|
|
273
|
+
letterSpacing: r,
|
|
274
|
+
inkOverhang: a
|
|
222
275
|
};
|
|
223
276
|
}
|
|
224
277
|
function g() {
|
|
@@ -227,44 +280,50 @@ function g() {
|
|
|
227
280
|
//#endregion
|
|
228
281
|
//#region src/wrap.ts
|
|
229
282
|
function _(e, t, n = {}) {
|
|
230
|
-
return
|
|
283
|
+
return x(e, t, n).map((t) => e.slice(t.start, t.end));
|
|
284
|
+
}
|
|
285
|
+
function v(e, t, n = {}) {
|
|
286
|
+
return x(e, t, n).length;
|
|
231
287
|
}
|
|
232
|
-
function
|
|
288
|
+
function y(e, t) {
|
|
289
|
+
return t.endsWith("\n") && e.pop(), e;
|
|
290
|
+
}
|
|
291
|
+
function b(e) {
|
|
233
292
|
let t = [], n = 0;
|
|
234
293
|
for (let r = 0; r <= e.length; r++) (r === e.length || e[r] === "\n") && (t.push({
|
|
235
294
|
start: n,
|
|
236
295
|
end: r
|
|
237
296
|
}), n = r + 1);
|
|
238
|
-
return t;
|
|
297
|
+
return y(t, e);
|
|
239
298
|
}
|
|
240
|
-
function
|
|
241
|
-
if (!/[^ \t\r\
|
|
242
|
-
let r = [], i = 0;
|
|
243
|
-
for (let
|
|
244
|
-
return r;
|
|
299
|
+
function x(e, t, n = {}) {
|
|
300
|
+
if (!/[^ \t\r\f]/.test(e)) return [];
|
|
301
|
+
let r = [], i = 0, a = n.firstLineIndent ?? 0;
|
|
302
|
+
for (let o = 0; o <= e.length; o++) (o === e.length || e[o] === "\n") && (r.push(...A(e, i, o, t, n, a)), a = 0, i = o + 1);
|
|
303
|
+
return y(r, e);
|
|
245
304
|
}
|
|
246
|
-
function
|
|
305
|
+
function S(e, t, n) {
|
|
247
306
|
if (!n) return t - e;
|
|
248
307
|
let r = 0;
|
|
249
308
|
for (let i = e; i < t; i++) r += n[i] ?? 1;
|
|
250
309
|
return r;
|
|
251
310
|
}
|
|
252
|
-
function
|
|
253
|
-
return t <= e ? 0 :
|
|
311
|
+
function C(e, t, n, r = 0) {
|
|
312
|
+
return t <= e ? 0 : S(e, t, n) - Math.min(r, w(t - 1, n));
|
|
254
313
|
}
|
|
255
|
-
function
|
|
314
|
+
function w(e, t) {
|
|
256
315
|
return t ? (t[e] ?? 1) - 1 : 0;
|
|
257
316
|
}
|
|
258
|
-
function
|
|
317
|
+
function T(e, t = {}) {
|
|
259
318
|
let { advances: n, tracking: r = 0 } = t, i = 0;
|
|
260
|
-
for (let t of
|
|
319
|
+
for (let t of k(e, 0, e.length)) for (let a of D(e, t.start, t.end)) i = Math.max(i, C(a.start, a.end, n, r));
|
|
261
320
|
return i;
|
|
262
321
|
}
|
|
263
|
-
function
|
|
322
|
+
function E(e, t) {
|
|
264
323
|
let n = 0;
|
|
265
324
|
for (let r = 0; r < e.length; r++) e[r] === "" && (t(r, n), n++);
|
|
266
325
|
}
|
|
267
|
-
function
|
|
326
|
+
function D(e, t, n) {
|
|
268
327
|
let r = [], i = t;
|
|
269
328
|
for (let a = t; a < n; a++) {
|
|
270
329
|
if (e[a] === "") {
|
|
@@ -291,14 +350,14 @@ function T(e, t, n) {
|
|
|
291
350
|
end: n
|
|
292
351
|
}), r;
|
|
293
352
|
}
|
|
294
|
-
var
|
|
295
|
-
function
|
|
353
|
+
var O = /[ \t\r\n\f]/;
|
|
354
|
+
function k(e, t, n) {
|
|
296
355
|
let r = [], i = t;
|
|
297
356
|
for (; i < n;) {
|
|
298
|
-
for (; i < n &&
|
|
357
|
+
for (; i < n && O.test(e[i]);) i++;
|
|
299
358
|
if (i >= n) break;
|
|
300
359
|
let t = i;
|
|
301
|
-
for (; i < n && !
|
|
360
|
+
for (; i < n && !O.test(e[i]);) i++;
|
|
302
361
|
r.push({
|
|
303
362
|
start: t,
|
|
304
363
|
end: i
|
|
@@ -306,68 +365,101 @@ function D(e, t, n) {
|
|
|
306
365
|
}
|
|
307
366
|
return r;
|
|
308
367
|
}
|
|
309
|
-
function
|
|
310
|
-
let
|
|
311
|
-
if (
|
|
368
|
+
function A(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
369
|
+
let s = k(e, t, n);
|
|
370
|
+
if (s.length === 0) return [{
|
|
312
371
|
start: t,
|
|
313
372
|
end: t
|
|
314
373
|
}];
|
|
315
374
|
if (r <= 0) return [{
|
|
316
|
-
start:
|
|
317
|
-
end:
|
|
375
|
+
start: s[0].start,
|
|
376
|
+
end: s[s.length - 1].end
|
|
318
377
|
}];
|
|
319
|
-
let
|
|
320
|
-
for (let t of
|
|
378
|
+
let c = [], l = null, u = 0, d = Math.max(0, o), f = () => r - d;
|
|
379
|
+
for (let t of s) {
|
|
321
380
|
let n = !1;
|
|
322
|
-
for (let
|
|
323
|
-
let e =
|
|
324
|
-
if (
|
|
381
|
+
for (let r of D(e, t.start, t.end)) {
|
|
382
|
+
let e = r.start, t = r.end, o = l !== null && !n ? e - 1 : e, s = u + S(o, t, i), p = Math.min(a, w(t - 1, i));
|
|
383
|
+
if (l !== null && s - p <= f()) l.end = t, u = s;
|
|
325
384
|
else {
|
|
326
|
-
for (
|
|
385
|
+
for (l !== null && (c.push(l), d = 0);;) {
|
|
327
386
|
let n = e;
|
|
328
|
-
for (; n < t &&
|
|
387
|
+
for (; n < t && C(e, n + 1, i, a) <= f();) n++;
|
|
329
388
|
if (n === t || n === e) break;
|
|
330
|
-
|
|
389
|
+
c.push({
|
|
331
390
|
start: e,
|
|
332
391
|
end: n
|
|
333
|
-
}), e = n;
|
|
392
|
+
}), d = 0, e = n;
|
|
334
393
|
}
|
|
335
|
-
|
|
394
|
+
l = {
|
|
336
395
|
start: e,
|
|
337
396
|
end: t
|
|
338
|
-
},
|
|
397
|
+
}, u = S(e, t, i);
|
|
339
398
|
}
|
|
340
399
|
n = !0;
|
|
341
400
|
}
|
|
342
401
|
}
|
|
343
|
-
return
|
|
402
|
+
return l !== null && c.push(l), c;
|
|
344
403
|
}
|
|
345
404
|
//#endregion
|
|
346
405
|
//#region src/flex.ts
|
|
347
|
-
function
|
|
348
|
-
let
|
|
349
|
-
|
|
406
|
+
function j(e, t) {
|
|
407
|
+
let n = e.row.map((e) => e.node.localRect).sort((e, t) => e.x - t.x), r = [];
|
|
408
|
+
for (let e = 1; e < n.length; e++) {
|
|
409
|
+
let i = n[e - 1].x + n[e - 1].width - t, a = n[e].x - t;
|
|
410
|
+
a > i && r.push({
|
|
411
|
+
start: i,
|
|
412
|
+
end: a
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
return r;
|
|
416
|
+
}
|
|
417
|
+
function M(e, t, n, r, i) {
|
|
418
|
+
if (e.style.ruleBreak !== "intersection") return [{
|
|
419
|
+
start: 0,
|
|
420
|
+
end: i
|
|
421
|
+
}];
|
|
422
|
+
let a = [t[n - 1], t[n]].flatMap((e) => j(e, r)).sort((e, t) => e.start - t.start), o = (e, t) => ({
|
|
423
|
+
start: e,
|
|
424
|
+
end: t,
|
|
425
|
+
spanned: !1,
|
|
426
|
+
beforeOccupied: !0,
|
|
427
|
+
afterOccupied: !0
|
|
428
|
+
}), s = [], c = 0;
|
|
429
|
+
for (let e of a) e.start > c && s.push(o(c, e.start)), c = Math.max(c, e.end);
|
|
430
|
+
return c < i && s.push(o(c, i)), l(s, "intersection", "all", e.style.ruleInset === "overlap-join" ? "overlap-join" : 0);
|
|
431
|
+
}
|
|
432
|
+
function N(e, t) {
|
|
433
|
+
return typeof t != "number" || t <= 0 ? e : e.map((e) => ({
|
|
434
|
+
...e,
|
|
435
|
+
start: e.start + t,
|
|
436
|
+
end: e.end - t
|
|
437
|
+
})).filter((e) => e.end > e.start);
|
|
438
|
+
}
|
|
439
|
+
function P(e, t, n, r, i, a, o) {
|
|
440
|
+
let s = U(e.style, "x", t), c = U(e.style, "y", n), l = se(e).map((e) => {
|
|
441
|
+
let n = G(e.style.margin, t);
|
|
350
442
|
return {
|
|
351
443
|
node: e,
|
|
352
|
-
base:
|
|
444
|
+
base: oe(e, t, o),
|
|
353
445
|
grow: e.style.flexGrow,
|
|
354
446
|
shrink: e.style.flexShrink,
|
|
355
|
-
min:
|
|
356
|
-
max:
|
|
447
|
+
min: ue(e, t, o),
|
|
448
|
+
max: K(e.style.maxWidth, t),
|
|
357
449
|
margin: n
|
|
358
450
|
};
|
|
359
451
|
}), d = [];
|
|
360
452
|
if (e.style.flexWrap === "wrap") {
|
|
361
453
|
let n = [], r = 0;
|
|
362
454
|
for (let e of l) {
|
|
363
|
-
let i = Math.max(0,
|
|
455
|
+
let i = Math.max(0, H(e.base, e.min, e.max)) + (e.margin.left ?? 0) + (e.margin.right ?? 0), a = n.length === 0 ? i : r + s + i;
|
|
364
456
|
n.length > 0 && a > t && (d.push(n), n = [], r = 0), n.push(e), r = n.length === 1 ? i : r + s + i;
|
|
365
457
|
}
|
|
366
458
|
n.length > 0 && d.push(n), e.style.wrapReverse && d.reverse();
|
|
367
459
|
} else d.push(l);
|
|
368
460
|
let f = i.left + a.left, p = i.top + a.top, m = d.map((e) => {
|
|
369
|
-
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,
|
|
370
|
-
for (let n = 0; n < e.length; n++)
|
|
461
|
+
let n = s * Math.max(0, e.length - 1), i = e.reduce((e, t) => e + (t.margin.left ?? 0) + (t.margin.right ?? 0), 0), a = Math.max(0, t - n - i), c = e.some((e) => e.margin.left === null || e.margin.right === null), l = e.reduce((e, t) => e + t.base, 0), u = c && l <= a ? e.map((e) => Math.max(0, H(e.base, e.min, e.max))) : ie(e, a);
|
|
462
|
+
for (let n = 0; n < e.length; n++) V(e[n].node, t, r, 0, 0, "fill", o, { width: u[n] });
|
|
371
463
|
return {
|
|
372
464
|
row: e,
|
|
373
465
|
widths: u,
|
|
@@ -377,21 +469,21 @@ function k(e, t, n, r, i, a, o) {
|
|
|
377
469
|
}), h = m.map((e) => e.height), g = c * Math.max(0, m.length - 1), _;
|
|
378
470
|
if (e.style.flexWrap === "nowrap") Number.isFinite(n) && (h[0] = Math.max(n, h[0] ?? 0)), _ = [0];
|
|
379
471
|
else {
|
|
380
|
-
let t = h.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - g) : 0, i =
|
|
472
|
+
let t = h.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - g) : 0, i = ce(e.style);
|
|
381
473
|
if (i === "stretch" && r > 0) {
|
|
382
|
-
let e =
|
|
474
|
+
let e = I(Array.from({ length: m.length }, () => 1), r);
|
|
383
475
|
for (let t = 0; t < h.length; t++) h[t] += e[t];
|
|
384
|
-
_ =
|
|
385
|
-
} else _ =
|
|
476
|
+
_ = F("start", h, 0);
|
|
477
|
+
} else _ = F(i === "stretch" ? "start" : i, h, r);
|
|
386
478
|
}
|
|
387
479
|
for (let i = 0; i < m.length; i++) {
|
|
388
480
|
let { row: a, widths: l, availableForItems: u } = m[i], d = h[i], g = _[i] + i * c;
|
|
389
481
|
for (let i = 0; i < a.length; i++) {
|
|
390
|
-
let s = a[i].node, c =
|
|
482
|
+
let s = a[i].node, c = ae(s, e), u = a[i].margin, f = u.top === null || u.bottom === null, p = s.style.height !== void 0 && s.style.height.kind !== "auto";
|
|
391
483
|
if (c === "stretch" && !f && !p && d > s.localRect.height) {
|
|
392
|
-
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, f =
|
|
484
|
+
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, f = H(Math.max(0, d - e - a), K(s.style.minHeight, c) ?? 0, K(s.style.maxHeight, c));
|
|
393
485
|
if (f === s.localRect.height) continue;
|
|
394
|
-
|
|
486
|
+
V(s, t, r, 0, 0, "fill", o, {
|
|
395
487
|
width: l[i],
|
|
396
488
|
height: f
|
|
397
489
|
});
|
|
@@ -399,49 +491,45 @@ function k(e, t, n, r, i, a, o) {
|
|
|
399
491
|
}
|
|
400
492
|
let v = l.reduce((e, t) => e + t, 0), y = Math.max(0, u - v), b = a.reduce((e, t) => e + +(t.margin.left === null) + +(t.margin.right === null), 0), x = Array.from({ length: a.length }, () => 0), S = Array.from({ length: a.length }, () => 0), C;
|
|
401
493
|
if (b > 0 && y > 0) {
|
|
402
|
-
let e =
|
|
494
|
+
let e = I(Array.from({ length: b }, () => 1), y), t = 0;
|
|
403
495
|
for (let n = 0; n < a.length; n++) a[n].margin.left === null && (x[n] = e[t++]), a[n].margin.right === null && (S[n] = e[t++]);
|
|
404
|
-
C =
|
|
405
|
-
} else C =
|
|
496
|
+
C = F("start", l, 0);
|
|
497
|
+
} else C = F(le(e.style), l, y);
|
|
406
498
|
let w = 0;
|
|
407
499
|
for (let t = 0; t < a.length; t++) {
|
|
408
500
|
let n = a[t], r = n.node, i = n.margin.left ?? 0, o = n.margin.right ?? 0;
|
|
409
501
|
w += x[t] + i, r.localRect = {
|
|
410
502
|
...r.localRect,
|
|
411
503
|
x: f + C[t] + t * s + w,
|
|
412
|
-
y: p + g +
|
|
504
|
+
y: p + g + ne(r, e.style.alignItems, d, n.margin)
|
|
413
505
|
}, w += S[t] + o;
|
|
414
506
|
}
|
|
415
507
|
}
|
|
416
508
|
let v = h.reduce((e, t) => e + t, 0) + g, y = Number.isFinite(n) ? Math.max(n, v) : v;
|
|
417
509
|
if (e.style.ruleX || e.style.ruleY) {
|
|
418
510
|
let n = [], r = [];
|
|
419
|
-
for (let
|
|
420
|
-
let
|
|
421
|
-
for (let
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
if (e > 0) {
|
|
431
|
-
let n = _[e - 1] + (e - 1) * c + h[e - 1];
|
|
432
|
-
i > n && r.push({
|
|
511
|
+
for (let i = 0; i < m.length; i++) {
|
|
512
|
+
let a = _[i] + i * c;
|
|
513
|
+
for (let e of j(m[i], f)) n.push({
|
|
514
|
+
bandStart: e.start,
|
|
515
|
+
bandSize: e.end - e.start,
|
|
516
|
+
start: a,
|
|
517
|
+
end: a + h[i]
|
|
518
|
+
});
|
|
519
|
+
if (i > 0) {
|
|
520
|
+
let n = _[i - 1] + (i - 1) * c + h[i - 1];
|
|
521
|
+
if (a > n) for (let o of M(e, m, i, f, t)) r.push({
|
|
433
522
|
bandStart: n,
|
|
434
|
-
bandSize:
|
|
435
|
-
|
|
436
|
-
end: t
|
|
523
|
+
bandSize: a - n,
|
|
524
|
+
...o
|
|
437
525
|
});
|
|
438
526
|
}
|
|
439
527
|
}
|
|
440
528
|
e.decorationRuns = u({
|
|
441
529
|
ruleX: e.style.ruleX,
|
|
442
530
|
ruleY: e.style.ruleY,
|
|
443
|
-
vertical: n,
|
|
444
|
-
horizontal: r,
|
|
531
|
+
vertical: N(n, e.style.ruleInset),
|
|
532
|
+
horizontal: N(r, e.style.ruleInset),
|
|
445
533
|
contentWidth: t,
|
|
446
534
|
contentHeight: y,
|
|
447
535
|
border: i,
|
|
@@ -450,10 +538,10 @@ function k(e, t, n, r, i, a, o) {
|
|
|
450
538
|
padding: a
|
|
451
539
|
});
|
|
452
540
|
}
|
|
453
|
-
return
|
|
541
|
+
return ee(e, i, a, t, y), y;
|
|
454
542
|
}
|
|
455
|
-
function
|
|
456
|
-
for (let a of e.children)
|
|
543
|
+
function ee(e, t, n, r, i) {
|
|
544
|
+
for (let a of e.children) B(a.style) && (a.staticSlot = {
|
|
457
545
|
kind: "flex",
|
|
458
546
|
direction: e.style.flexDirection,
|
|
459
547
|
originX: t.left + n.left,
|
|
@@ -462,37 +550,37 @@ function A(e, t, n, r, i) {
|
|
|
462
550
|
innerHeight: i
|
|
463
551
|
});
|
|
464
552
|
}
|
|
465
|
-
function
|
|
466
|
-
let s =
|
|
467
|
-
let a =
|
|
468
|
-
|
|
553
|
+
function te(e, t, n, r, i, a, o) {
|
|
554
|
+
let s = U(e.style, "y", n), c = se(e).map((i) => {
|
|
555
|
+
let a = G(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c = ae(i, e) === "stretch";
|
|
556
|
+
V(i, s, r && Number.isFinite(n) ? n : void 0, 0, 0, c ? "fill" : "shrink", o);
|
|
469
557
|
let l = Number.isFinite(n) ? n : void 0, u = i.style.flexBasis, d = u === void 0 || u.kind === "auto" ? i.unclampedHeight : u.kind === "cells" ? u.value : u.kind === "percent" && l !== void 0 ? m(u.value, l) : i.unclampedHeight, f = i.style.minHeight === "auto" ? i.style.overflow === "visible" ? i.localRect.height : 0 : void 0;
|
|
470
558
|
return {
|
|
471
559
|
node: i,
|
|
472
560
|
base: d,
|
|
473
561
|
grow: i.style.flexGrow,
|
|
474
562
|
shrink: i.style.flexShrink,
|
|
475
|
-
min: f ??
|
|
476
|
-
max:
|
|
563
|
+
min: f ?? K(i.style.minHeight, l) ?? 0,
|
|
564
|
+
max: K(i.style.maxHeight, l),
|
|
477
565
|
margin: a
|
|
478
566
|
};
|
|
479
|
-
}), l = s * Math.max(0, c.length - 1), d = c.reduce((e, t) => e + (t.margin.top ?? 0) + (t.margin.bottom ?? 0), 0), f = Number.isFinite(n), p = c.reduce((e, t) => e + t.base, 0), h = f ? Math.max(0, n - l - d) : p, g = r ? h : Math.max(h, p), _ = c.some((e) => e.margin.top === null || e.margin.bottom === null), v = f && !(f && _ && p <= g) ?
|
|
567
|
+
}), l = s * Math.max(0, c.length - 1), d = c.reduce((e, t) => e + (t.margin.top ?? 0) + (t.margin.bottom ?? 0), 0), f = Number.isFinite(n), p = c.reduce((e, t) => e + t.base, 0), h = f ? Math.max(0, n - l - d) : p, g = r ? h : Math.max(h, p), _ = c.some((e) => e.margin.top === null || e.margin.bottom === null), v = f && !(f && _ && p <= g) ? ie(c, g) : c.map((e) => Math.max(0, H(e.base, e.min, e.max)));
|
|
480
568
|
for (let n = 0; n < c.length; n++) if (v[n] !== c[n].node.localRect.height) {
|
|
481
|
-
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a =
|
|
482
|
-
|
|
569
|
+
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a = ae(r.node, e) === "stretch";
|
|
570
|
+
V(r.node, i, v[n], 0, 0, a ? "fill" : "shrink", o, { height: v[n] });
|
|
483
571
|
}
|
|
484
572
|
let y = v.reduce((e, t) => e + t, 0), b = Math.max(0, g - y), x = c.reduce((e, t) => e + +(t.margin.top === null) + +(t.margin.bottom === null), 0), S = Array.from({ length: c.length }, () => 0), C = Array.from({ length: c.length }, () => 0), w;
|
|
485
573
|
if (x > 0 && b > 0) {
|
|
486
|
-
let e =
|
|
574
|
+
let e = I(Array.from({ length: x }, () => 1), b), t = 0;
|
|
487
575
|
for (let n = 0; n < c.length; n++) c[n].margin.top === null && (S[n] = e[t++]), c[n].margin.bottom === null && (C[n] = e[t++]);
|
|
488
|
-
w =
|
|
489
|
-
} else w =
|
|
576
|
+
w = F("start", v, 0);
|
|
577
|
+
} else w = F(le(e.style), v, b);
|
|
490
578
|
let T = i.left + a.left, E = i.top + a.top, D = 0;
|
|
491
579
|
for (let n = 0; n < c.length; n++) {
|
|
492
580
|
let r = c[n], i = r.node, a = r.margin.top ?? 0, o = r.margin.bottom ?? 0;
|
|
493
581
|
D += S[n] + a, i.localRect = {
|
|
494
582
|
...i.localRect,
|
|
495
|
-
x: T +
|
|
583
|
+
x: T + re(i, e.style.alignItems, t, r.margin),
|
|
496
584
|
y: E + w[n] + n * s + D
|
|
497
585
|
}, D += C[n] + o;
|
|
498
586
|
}
|
|
@@ -512,7 +600,7 @@ function j(e, t, n, r, i, a, o) {
|
|
|
512
600
|
ruleX: null,
|
|
513
601
|
ruleY: e.style.ruleY,
|
|
514
602
|
vertical: [],
|
|
515
|
-
horizontal: n,
|
|
603
|
+
horizontal: N(n, e.style.ruleInset),
|
|
516
604
|
contentWidth: t,
|
|
517
605
|
contentHeight: k,
|
|
518
606
|
border: i,
|
|
@@ -521,17 +609,17 @@ function j(e, t, n, r, i, a, o) {
|
|
|
521
609
|
padding: a
|
|
522
610
|
});
|
|
523
611
|
}
|
|
524
|
-
return
|
|
612
|
+
return ee(e, i, a, t, k), k;
|
|
525
613
|
}
|
|
526
|
-
function
|
|
614
|
+
function ne(e, t, n, r) {
|
|
527
615
|
let i = e.style.alignSelf === "auto" ? t : e.style.alignSelf, a = r.top ?? 0, o = r.bottom ?? 0, s = n - e.localRect.height, c = r.top === null && r.bottom === null, l = r.top === null && r.bottom !== null, u = r.bottom === null && r.top !== null;
|
|
528
616
|
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + L(i, n, e.localRect.height);
|
|
529
617
|
}
|
|
530
|
-
function
|
|
618
|
+
function re(e, t, n, r) {
|
|
531
619
|
let i = e.style.alignSelf === "auto" ? t : e.style.alignSelf, a = r.left ?? 0, o = r.right ?? 0, s = n - e.localRect.width, c = r.left === null && r.right === null, l = r.left === null && r.right !== null, u = r.right === null && r.left !== null;
|
|
532
620
|
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + L(i, n, e.localRect.width);
|
|
533
621
|
}
|
|
534
|
-
function
|
|
622
|
+
function F(e, t, n) {
|
|
535
623
|
let r = t.length;
|
|
536
624
|
if (r === 0) return [];
|
|
537
625
|
let i = [], a = 0;
|
|
@@ -541,7 +629,7 @@ function P(e, t, n) {
|
|
|
541
629
|
return i;
|
|
542
630
|
}
|
|
543
631
|
if ((e === "space-around" || e === "space-evenly") && n > 0) {
|
|
544
|
-
let o =
|
|
632
|
+
let o = I(Array.from({ length: r + 1 }, (t, n) => e === "space-evenly" || n === 0 || n === r ? 1 : 2), n);
|
|
545
633
|
for (let e = 0; e < r; e++) a += o[e], i.push(a), a += t[e];
|
|
546
634
|
return i;
|
|
547
635
|
}
|
|
@@ -549,8 +637,8 @@ function P(e, t, n) {
|
|
|
549
637
|
for (let e = 0; e < r; e++) i.push(a), a += t[e];
|
|
550
638
|
return i;
|
|
551
639
|
}
|
|
552
|
-
function
|
|
553
|
-
let n = e.length, r = (t, n) => Math.max(0,
|
|
640
|
+
function ie(e, t) {
|
|
641
|
+
let n = e.length, r = (t, n) => Math.max(0, H(t, e[n].min ?? 0, e[n].max)), i = e.map((e) => e.base), a = t >= i.reduce((e, t, n) => e + r(t, n), 0), o = Array.from({ length: n }, () => 0), s = Array.from({ length: n }, () => !1);
|
|
554
642
|
for (let t = 0; t < n; t++) {
|
|
555
643
|
let n = r(i[t], t);
|
|
556
644
|
((a ? e[t].grow : e[t].shrink) === 0 || a && i[t] > n || !a && i[t] < n) && (o[t] = n, s[t] = !0);
|
|
@@ -559,7 +647,7 @@ function ee(e, t) {
|
|
|
559
647
|
let c = [];
|
|
560
648
|
for (let e = 0; e < n; e++) s[e] || c.push(e);
|
|
561
649
|
if (c.length === 0) break;
|
|
562
|
-
let l = o.reduce((e, t, n) => s[n] ? e + t : e, 0), u = c.reduce((e, t) => e + i[t], 0), d = t - l - u, f = a ? Math.max(0, d) : Math.max(0, -d), p =
|
|
650
|
+
let l = o.reduce((e, t, n) => s[n] ? e + t : e, 0), u = c.reduce((e, t) => e + i[t], 0), d = t - l - u, f = a ? Math.max(0, d) : Math.max(0, -d), p = I(c.map((t) => a ? e[t].grow : i[t] * e[t].shrink), f), m = c.map((e, t) => i[e] + (a ? p[t] : -p[t])), h = c.map((e, t) => r(m[t], e)), g = h.reduce((e, t, n) => e + (t - m[n]), 0);
|
|
563
651
|
if (g === 0) {
|
|
564
652
|
for (let e = 0; e < c.length; e++) o[c[e]] = h[e];
|
|
565
653
|
break;
|
|
@@ -571,7 +659,7 @@ function ee(e, t) {
|
|
|
571
659
|
}
|
|
572
660
|
return o;
|
|
573
661
|
}
|
|
574
|
-
function
|
|
662
|
+
function I(e, t) {
|
|
575
663
|
let n = e.reduce((e, t) => e + t, 0);
|
|
576
664
|
if (n === 0 || t <= 0) return e.map(() => 0);
|
|
577
665
|
let r = e.map((e) => e / n * t), i = r.map(Math.floor), a = t - i.reduce((e, t) => e + t, 0);
|
|
@@ -584,33 +672,33 @@ function F(e, t) {
|
|
|
584
672
|
}
|
|
585
673
|
return i;
|
|
586
674
|
}
|
|
587
|
-
function
|
|
675
|
+
function ae(e, t) {
|
|
588
676
|
return e.style.alignSelf === "auto" ? t.style.alignItems : e.style.alignSelf;
|
|
589
677
|
}
|
|
590
678
|
function L(e, t, n) {
|
|
591
679
|
return e === "center" ? Math.max(0, Math.floor((t - n) / 2)) : e === "end" ? Math.max(0, t - n) : 0;
|
|
592
680
|
}
|
|
593
|
-
function
|
|
681
|
+
function oe(e, t, n) {
|
|
594
682
|
let r = e.style.flexBasis, i = e.style.width;
|
|
595
|
-
return r !== void 0 && r.kind !== "auto" ?
|
|
683
|
+
return r !== void 0 && r.kind !== "auto" ? q(r, t, e, n) : i !== void 0 && i.kind !== "auto" ? q(i, t, e, n) : J(e, n);
|
|
596
684
|
}
|
|
597
|
-
function
|
|
598
|
-
let t = e.children.filter((e) => !
|
|
685
|
+
function se(e) {
|
|
686
|
+
let t = e.children.filter((e) => !B(e.style)).sort((e, t) => e.style.order - t.style.order);
|
|
599
687
|
return e.style.flexReverse && t.reverse(), t;
|
|
600
688
|
}
|
|
601
|
-
function
|
|
689
|
+
function ce(e) {
|
|
602
690
|
return e.wrapReverse ? e.alignContent === "start" ? "end" : e.alignContent === "end" ? "start" : e.alignContent : e.alignContent;
|
|
603
691
|
}
|
|
604
|
-
function
|
|
692
|
+
function le(e) {
|
|
605
693
|
let t = e.justifyContent === "stretch" ? "start" : e.justifyContent;
|
|
606
694
|
return e.flexReverse ? t === "start" ? "end" : t === "end" ? "start" : t : t;
|
|
607
695
|
}
|
|
608
|
-
function
|
|
609
|
-
return e.style.minWidth === "auto" ? e.style.overflow === "visible" ?
|
|
696
|
+
function ue(e, t, n) {
|
|
697
|
+
return e.style.minWidth === "auto" ? e.style.overflow === "visible" ? Y(e, n) : 0 : K(e.style.minWidth, t) ?? 0;
|
|
610
698
|
}
|
|
611
699
|
//#endregion
|
|
612
700
|
//#region src/types.ts
|
|
613
|
-
function
|
|
701
|
+
function de() {
|
|
614
702
|
return {
|
|
615
703
|
display: "block",
|
|
616
704
|
flexDirection: "row",
|
|
@@ -629,8 +717,8 @@ function oe() {
|
|
|
629
717
|
justifySelf: "auto",
|
|
630
718
|
gridTemplateColumns: { kind: "none" },
|
|
631
719
|
gridTemplateRows: { kind: "none" },
|
|
632
|
-
gridAutoColumns: [
|
|
633
|
-
gridAutoRows: [
|
|
720
|
+
gridAutoColumns: [fe()],
|
|
721
|
+
gridAutoRows: [fe()],
|
|
634
722
|
gridAutoFlow: {
|
|
635
723
|
direction: "row",
|
|
636
724
|
dense: !1
|
|
@@ -677,6 +765,7 @@ function oe() {
|
|
|
677
765
|
textOverflow: "clip",
|
|
678
766
|
color: void 0,
|
|
679
767
|
backgroundColor: void 0,
|
|
768
|
+
backgroundClear: !1,
|
|
680
769
|
fontWeight: "400",
|
|
681
770
|
fontStyle: "normal",
|
|
682
771
|
textDecorationLine: "none",
|
|
@@ -688,6 +777,7 @@ function oe() {
|
|
|
688
777
|
},
|
|
689
778
|
textAlignBlocked: !1,
|
|
690
779
|
textAlign: "start",
|
|
780
|
+
textIndent: 0,
|
|
691
781
|
tableRole: "none",
|
|
692
782
|
tableLayout: "auto",
|
|
693
783
|
borderCollapse: !1,
|
|
@@ -698,7 +788,17 @@ function oe() {
|
|
|
698
788
|
zIndex: null,
|
|
699
789
|
latticeBorder: null,
|
|
700
790
|
ruleX: null,
|
|
701
|
-
ruleY: null
|
|
791
|
+
ruleY: null,
|
|
792
|
+
ruleBreak: "normal",
|
|
793
|
+
ruleInset: 0,
|
|
794
|
+
ruleVisibilityItems: "normal",
|
|
795
|
+
columnCount: null,
|
|
796
|
+
columnWidth: null,
|
|
797
|
+
columnFill: "balance",
|
|
798
|
+
columnSpan: !1,
|
|
799
|
+
breakBeforeColumn: !1,
|
|
800
|
+
breakAfterColumn: !1,
|
|
801
|
+
breakInsideAvoid: !1
|
|
702
802
|
};
|
|
703
803
|
}
|
|
704
804
|
function R() {
|
|
@@ -709,7 +809,7 @@ function R() {
|
|
|
709
809
|
left: 0
|
|
710
810
|
};
|
|
711
811
|
}
|
|
712
|
-
function
|
|
812
|
+
function fe() {
|
|
713
813
|
return {
|
|
714
814
|
min: { kind: "auto" },
|
|
715
815
|
max: { kind: "auto" }
|
|
@@ -717,15 +817,15 @@ function z() {
|
|
|
717
817
|
}
|
|
718
818
|
//#endregion
|
|
719
819
|
//#region src/grid.ts
|
|
720
|
-
function
|
|
721
|
-
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols,
|
|
820
|
+
function pe(e, t, n, r, i, a) {
|
|
821
|
+
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, d = e.subgrid?.rows, f = c ? c.gap : U(o, "x", t), p = d ? d.gap : U(o, "y", s), m = Ce(e, t, s, f, p, e.subgrid ? {
|
|
722
822
|
col: e.subgrid.colSpan,
|
|
723
823
|
row: e.subgrid.rowSpan
|
|
724
|
-
} : void 0), { children:
|
|
725
|
-
for (let e = 0; e <
|
|
726
|
-
let t =
|
|
824
|
+
} : void 0), { children: h, placed: g, colLines: _, rowLines: v, colTracks: y, rowTracks: b, colCollapsed: x, rowCollapsed: S } = m, C = h.map((e) => G(e.style.margin, t)), w = h.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), T = h.map(me), E = c ? ge(c) : ze(y, x, _e(m, T, C, a), t, f, o.justifyContent === "stretch"), D = c ? c.positions : Be(E, t, o.justifyContent), O = [];
|
|
825
|
+
for (let e = 0; e < h.length; e++) {
|
|
826
|
+
let t = h[e], n = g.items[e], r = He(D, E.sizes, n.col.start, n.col.span), i = C[e], o = Math.max(0, r - De(i)), s = T[e];
|
|
727
827
|
if (s.cols || s.rows) {
|
|
728
|
-
let e = s.cols ?
|
|
828
|
+
let e = s.cols ? he(D, E, f, n.col.start, n.col.span, ye(t, "cols", i, r)) : void 0;
|
|
729
829
|
t.subgrid = {
|
|
730
830
|
colSpan: n.col.span,
|
|
731
831
|
rowSpan: n.row.span,
|
|
@@ -733,85 +833,84 @@ function se(e, t, n, r, i, a) {
|
|
|
733
833
|
rows: void 0
|
|
734
834
|
};
|
|
735
835
|
} else t.subgrid = void 0;
|
|
736
|
-
let c =
|
|
737
|
-
s.cols ?
|
|
738
|
-
}
|
|
739
|
-
let
|
|
740
|
-
for (let t = 0; t <
|
|
741
|
-
let n =
|
|
742
|
-
if (
|
|
743
|
-
width:
|
|
836
|
+
let c = w[e], l = i.left === null || i.right === null, u = t.style.width !== void 0 && t.style.width.kind !== "auto";
|
|
837
|
+
s.cols ? V(t, r, void 0, 0, 0, "fill", a, { width: o }) : c === "stretch" && !l && !u ? V(t, r, void 0, 0, 0, "fill", a, { width: H(o, t.style.minWidth === "auto" ? t.style.overflow === "visible" ? Y(t, a) : 0 : K(t.style.minWidth, r) ?? 0, Xt(t.style.maxWidth, r, t, a)) }) : V(t, o, void 0, 0, 0, "shrink", a), O.push(t.localRect.width);
|
|
838
|
+
}
|
|
839
|
+
let k = d ? ge(d) : ze(b, S, ve(m, T, C), s ?? "max-content", p, o.alignContent === "stretch"), A = Ve(k), j = d ? d.positions : Be(k, s ?? A, o.alignContent), M = r.left + i.left, N = r.top + i.top;
|
|
840
|
+
for (let t = 0; t < h.length; t++) {
|
|
841
|
+
let n = h[t], r = g.items[t], i = C[t], o = He(D, E.sizes, r.col.start, r.col.span), s = He(j, k.sizes, r.row.start, r.row.span), c = Math.max(0, s - Oe(i)), l = ae(n, e), u = i.top === null || i.bottom === null, d = n.style.height !== void 0 && n.style.height.kind !== "auto";
|
|
842
|
+
if (T[t].rows) n.subgrid.rows = he(j, k, p, r.row.start, r.row.span, ye(n, "rows", i, o)), V(n, o, s, 0, 0, "fill", a, {
|
|
843
|
+
width: O[t],
|
|
744
844
|
height: c
|
|
745
845
|
});
|
|
746
846
|
else if (l === "stretch" && !u && !d) {
|
|
747
|
-
let e =
|
|
748
|
-
e !== n.localRect.height &&
|
|
749
|
-
width:
|
|
847
|
+
let e = H(c, n.style.minHeight === "auto" ? n.style.overflow === "visible" ? n.localRect.height : 0 : K(n.style.minHeight, s) ?? 0, K(n.style.maxHeight, s));
|
|
848
|
+
e !== n.localRect.height && V(n, o, s, 0, 0, "fill", a, {
|
|
849
|
+
width: O[t],
|
|
750
850
|
height: e
|
|
751
851
|
});
|
|
752
|
-
} else n.style.height?.kind === "percent" &&
|
|
852
|
+
} else n.style.height?.kind === "percent" && V(n, o, s, 0, 0, "fill", a, { width: O[t] });
|
|
753
853
|
n.localRect = {
|
|
754
854
|
...n.localRect,
|
|
755
|
-
x:
|
|
756
|
-
y:
|
|
855
|
+
x: M + D[r.col.start] + Ue(w[t], i.left, i.right, o, n.localRect.width),
|
|
856
|
+
y: N + j[r.row.start] + Ue(l, i.top, i.bottom, s, n.localRect.height)
|
|
757
857
|
};
|
|
758
858
|
}
|
|
759
|
-
let
|
|
859
|
+
let P = Number.isFinite(n) ? Math.max(n, A) : A;
|
|
760
860
|
if (o.ruleX || o.ruleY) {
|
|
761
|
-
let n = (
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
861
|
+
let n = E.sizes.length, a = k.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)), d = Array.from({ length: Math.max(0, a - 1) }, () => Array.from({ length: n }, () => !1));
|
|
862
|
+
for (let e of g.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 && (d[r][t] = !0);
|
|
863
|
+
let f = (e, t, n, r, i, a) => t.map((t, o) => ({
|
|
864
|
+
start: t,
|
|
865
|
+
end: t + n[o],
|
|
866
|
+
spanned: r[e]?.[o] ?? !1,
|
|
867
|
+
beforeOccupied: i(o),
|
|
868
|
+
afterOccupied: a(o)
|
|
869
|
+
})), p = (e, t, n) => {
|
|
870
|
+
let r = [];
|
|
871
|
+
for (let i = 1; i < e.length; i++) {
|
|
872
|
+
let a = e[i - 1] + t[i - 1], s = e[i] - a;
|
|
873
|
+
if (!(s <= 0)) for (let e of l(n(i - 1), o.ruleBreak, o.ruleVisibilityItems, o.ruleInset)) r.push({
|
|
874
|
+
bandStart: a,
|
|
875
|
+
bandSize: s,
|
|
876
|
+
...e
|
|
770
877
|
});
|
|
771
878
|
}
|
|
772
|
-
return
|
|
773
|
-
},
|
|
774
|
-
...e,
|
|
775
|
-
start: s,
|
|
776
|
-
end: c
|
|
777
|
-
})), p = n(A, O.sizes).map((e) => ({
|
|
778
|
-
...e,
|
|
779
|
-
start: l,
|
|
780
|
-
end: d
|
|
781
|
-
}));
|
|
879
|
+
return r;
|
|
880
|
+
}, m = p(D, E.sizes, (e) => f(e, j, k.sizes, c, (t) => s[e]?.[t] ?? !1, (t) => s[e + 1]?.[t] ?? !1)), h = p(j, k.sizes, (e) => f(e, D, E.sizes, d, (t) => s[t]?.[e] ?? !1, (t) => s[t]?.[e + 1] ?? !1));
|
|
782
881
|
e.decorationRuns = u({
|
|
783
882
|
ruleX: o.ruleX,
|
|
784
883
|
ruleY: o.ruleY,
|
|
785
|
-
vertical:
|
|
786
|
-
horizontal:
|
|
884
|
+
vertical: m,
|
|
885
|
+
horizontal: h,
|
|
787
886
|
contentWidth: t,
|
|
788
|
-
contentHeight:
|
|
887
|
+
contentHeight: P,
|
|
789
888
|
border: r,
|
|
790
889
|
borderStyle: o.borderStyle,
|
|
791
890
|
borderColor: o.borderColor,
|
|
792
891
|
padding: i
|
|
793
892
|
});
|
|
794
893
|
}
|
|
795
|
-
let
|
|
796
|
-
if (
|
|
797
|
-
let e =
|
|
894
|
+
let ee = e.children.filter((e) => B(e.style));
|
|
895
|
+
if (ee.length > 0) {
|
|
896
|
+
let e = B(o) ? {
|
|
798
897
|
x: r.left,
|
|
799
898
|
y: r.top,
|
|
800
899
|
width: i.left + t + i.right,
|
|
801
|
-
height: i.top +
|
|
900
|
+
height: i.top + P + i.bottom
|
|
802
901
|
} : {
|
|
803
|
-
x:
|
|
804
|
-
y:
|
|
902
|
+
x: M,
|
|
903
|
+
y: N,
|
|
805
904
|
width: t,
|
|
806
|
-
height:
|
|
905
|
+
height: P
|
|
807
906
|
};
|
|
808
|
-
for (let n of
|
|
809
|
-
let r =
|
|
907
|
+
for (let n of ee) {
|
|
908
|
+
let r = xe(n.style.gridColumnStart, n.style.gridColumnEnd, _, g.colOrigin, D, E.sizes, -i.left, t + i.right), a = xe(n.style.gridRowStart, n.style.gridRowEnd, v, g.rowOrigin, j, k.sizes, -i.top, P + i.bottom);
|
|
810
909
|
n.staticSlot = {
|
|
811
910
|
kind: "grid",
|
|
812
911
|
area: {
|
|
813
|
-
x:
|
|
814
|
-
y:
|
|
912
|
+
x: M + r.start,
|
|
913
|
+
y: N + a.start,
|
|
815
914
|
width: Math.max(0, r.end - r.start),
|
|
816
915
|
height: Math.max(0, a.end - a.start)
|
|
817
916
|
},
|
|
@@ -819,16 +918,16 @@ function se(e, t, n, r, i, a) {
|
|
|
819
918
|
};
|
|
820
919
|
}
|
|
821
920
|
}
|
|
822
|
-
return
|
|
921
|
+
return P;
|
|
823
922
|
}
|
|
824
|
-
function
|
|
923
|
+
function me(e) {
|
|
825
924
|
let t = e.style.display === "grid";
|
|
826
925
|
return {
|
|
827
926
|
cols: t && e.style.gridTemplateColumns.kind === "subgrid",
|
|
828
927
|
rows: t && e.style.gridTemplateRows.kind === "subgrid"
|
|
829
928
|
};
|
|
830
929
|
}
|
|
831
|
-
function
|
|
930
|
+
function he(e, t, n, r, i, a) {
|
|
832
931
|
let o = e[r] + a.start, s = t.sizes.slice(r, r + i);
|
|
833
932
|
return s[0] = Math.max(0, s[0] - a.start), s[i - 1] = Math.max(0, s[i - 1] - a.end), {
|
|
834
933
|
positions: Array.from({ length: i }, (t, n) => n === 0 ? 0 : e[r + n] - o),
|
|
@@ -837,20 +936,20 @@ function le(e, t, n, r, i, a) {
|
|
|
837
936
|
gap: n
|
|
838
937
|
};
|
|
839
938
|
}
|
|
840
|
-
function
|
|
939
|
+
function ge(e) {
|
|
841
940
|
return {
|
|
842
941
|
sizes: e.sizes,
|
|
843
942
|
gapBefore: e.gapBefore,
|
|
844
943
|
limits: e.sizes
|
|
845
944
|
};
|
|
846
945
|
}
|
|
847
|
-
function
|
|
946
|
+
function _e(e, t, n, r) {
|
|
848
947
|
let i = [];
|
|
849
948
|
return e.children.forEach((a, o) => {
|
|
850
949
|
let s = e.placed.items[o], c = n[o];
|
|
851
950
|
if (t[o].cols) {
|
|
852
|
-
let e =
|
|
853
|
-
for (let t of
|
|
951
|
+
let e = ye(a, "cols", c, 0);
|
|
952
|
+
for (let t of be(a, "cols", s, e, r)) i.push({
|
|
854
953
|
...t,
|
|
855
954
|
start: t.start + s.col.start
|
|
856
955
|
});
|
|
@@ -859,24 +958,24 @@ function de(e, t, n, r) {
|
|
|
859
958
|
i.push({
|
|
860
959
|
start: s.col.start,
|
|
861
960
|
span: s.col.span,
|
|
862
|
-
min:
|
|
863
|
-
max:
|
|
961
|
+
min: ke(a, "min", r) + De(c),
|
|
962
|
+
max: ke(a, "max", r) + De(c)
|
|
864
963
|
});
|
|
865
964
|
}), i;
|
|
866
965
|
}
|
|
867
|
-
function
|
|
966
|
+
function ve(e, t, n) {
|
|
868
967
|
let r = [];
|
|
869
968
|
return e.children.forEach((i, a) => {
|
|
870
969
|
let o = e.placed.items[a], s = n[a];
|
|
871
970
|
if (t[a].rows) {
|
|
872
|
-
let e =
|
|
873
|
-
for (let t of
|
|
971
|
+
let e = ye(i, "rows", s, 0);
|
|
972
|
+
for (let t of be(i, "rows", o, e)) r.push({
|
|
874
973
|
...t,
|
|
875
974
|
start: t.start + o.row.start
|
|
876
975
|
});
|
|
877
976
|
return;
|
|
878
977
|
}
|
|
879
|
-
let c = i.localRect.height +
|
|
978
|
+
let c = i.localRect.height + Oe(s);
|
|
880
979
|
r.push({
|
|
881
980
|
start: o.row.start,
|
|
882
981
|
span: o.row.span,
|
|
@@ -885,25 +984,25 @@ function fe(e, t, n) {
|
|
|
885
984
|
});
|
|
886
985
|
}), r;
|
|
887
986
|
}
|
|
888
|
-
function
|
|
987
|
+
function ye(e, t, n, r) {
|
|
889
988
|
let { border: i, padding: a } = e.style;
|
|
890
989
|
return t === "cols" ? {
|
|
891
|
-
start: (n.left ?? 0) + i.left +
|
|
892
|
-
end: (n.right ?? 0) + i.right +
|
|
990
|
+
start: (n.left ?? 0) + i.left + W(a.left, r),
|
|
991
|
+
end: (n.right ?? 0) + i.right + W(a.right, r)
|
|
893
992
|
} : {
|
|
894
|
-
start: (n.top ?? 0) + i.top +
|
|
895
|
-
end: (n.bottom ?? 0) + i.bottom +
|
|
993
|
+
start: (n.top ?? 0) + i.top + W(a.top, r),
|
|
994
|
+
end: (n.bottom ?? 0) + i.bottom + W(a.bottom, r)
|
|
896
995
|
};
|
|
897
996
|
}
|
|
898
|
-
function
|
|
899
|
-
let a = t === "cols" ? n.col.span : n.row.span, o =
|
|
997
|
+
function be(e, t, n, r, i) {
|
|
998
|
+
let a = t === "cols" ? n.col.span : n.row.span, o = Ce(e, void 0, void 0, 0, 0, {
|
|
900
999
|
col: n.col.span,
|
|
901
1000
|
row: n.row.span
|
|
902
1001
|
}), s = [];
|
|
903
1002
|
if (o.children.forEach((e, n) => {
|
|
904
|
-
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 =
|
|
905
|
-
if (
|
|
906
|
-
let n =
|
|
1003
|
+
let c = o.placed.items[n], l = t === "cols" ? c.col : c.row, u = l.start === 0, d = l.start + l.span === a, f = (u ? r.start : 0) + (d ? r.end : 0), p = G(e.style.margin, 0);
|
|
1004
|
+
if (me(e)[t]) {
|
|
1005
|
+
let n = ye(e, t, p, 0), a = be(e, t, c, {
|
|
907
1006
|
start: n.start + (u ? r.start : 0),
|
|
908
1007
|
end: n.end + (d ? r.end : 0)
|
|
909
1008
|
}, i);
|
|
@@ -916,11 +1015,11 @@ function me(e, t, n, r, i) {
|
|
|
916
1015
|
if (t === "cols") s.push({
|
|
917
1016
|
start: l.start,
|
|
918
1017
|
span: l.span,
|
|
919
|
-
min:
|
|
920
|
-
max:
|
|
1018
|
+
min: ke(e, "min", i) + De(p) + f,
|
|
1019
|
+
max: ke(e, "max", i) + De(p) + f
|
|
921
1020
|
});
|
|
922
1021
|
else {
|
|
923
|
-
let t = e.localRect.height +
|
|
1022
|
+
let t = e.localRect.height + Oe(p) + f;
|
|
924
1023
|
s.push({
|
|
925
1024
|
start: l.start,
|
|
926
1025
|
span: l.span,
|
|
@@ -939,9 +1038,9 @@ function me(e, t, n, r, i) {
|
|
|
939
1038
|
}
|
|
940
1039
|
return s;
|
|
941
1040
|
}
|
|
942
|
-
function
|
|
943
|
-
let c =
|
|
944
|
-
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l =
|
|
1041
|
+
function xe(e, t, n, r, i, a, o, s) {
|
|
1042
|
+
let c = Fe(e, "start", n), l = Fe(t, "end", n);
|
|
1043
|
+
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l = Ie(c, t, 1, n) : l !== null && e.kind === "span" && (c = Ie(l, e, -1, n));
|
|
945
1044
|
let u = i.length, d = (e) => {
|
|
946
1045
|
if (e === null) return;
|
|
947
1046
|
let t = e - r;
|
|
@@ -952,22 +1051,22 @@ function he(e, t, n, r, i, a, o, s) {
|
|
|
952
1051
|
end: h === void 0 ? s : p(h)
|
|
953
1052
|
};
|
|
954
1053
|
}
|
|
955
|
-
function
|
|
1054
|
+
function Se(e, t) {
|
|
956
1055
|
let n = t.gridIntrinsic.get(e);
|
|
957
1056
|
if (n !== void 0) return n;
|
|
958
|
-
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a =
|
|
1057
|
+
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a = Ce(e, void 0, void 0, i, 0, e.subgrid ? {
|
|
959
1058
|
col: e.subgrid.colSpan,
|
|
960
1059
|
row: e.subgrid.rowSpan
|
|
961
|
-
} : void 0), o = a.children.map(
|
|
1060
|
+
} : void 0), o = a.children.map(me), s = a.children.map((e) => G(e.style.margin, 0)), c = ze(a.colTracks, a.colCollapsed, _e(a, o, s, t), "min-content", i, !1), l = c.gapBefore.reduce((e, t) => e + t, 0), u = {
|
|
962
1061
|
min: c.sizes.reduce((e, t) => e + t, 0) + l,
|
|
963
1062
|
max: c.limits.reduce((e, t) => e + t, 0) + l
|
|
964
1063
|
};
|
|
965
1064
|
return t.gridIntrinsic.set(e, u), u;
|
|
966
1065
|
}
|
|
967
|
-
function
|
|
968
|
-
let o = e.style, s =
|
|
1066
|
+
function Ce(e, t, n, r, i, a) {
|
|
1067
|
+
let o = e.style, s = Ee(e), c = o.gridTemplateColumns.kind === "subgrid" && a !== void 0, l = o.gridTemplateRows.kind === "subgrid" && a !== void 0, u = c ? we(a.col) : Ae(o.gridTemplateColumns, t, r), d = l ? we(a.row) : Ae(o.gridTemplateRows, n, i), f = o.gridTemplateAreas, p = [...u.tracks], m = [...d.tracks];
|
|
969
1068
|
if (f) {
|
|
970
|
-
c ||
|
|
1069
|
+
c || Me(p, u.lineNames, f.columns, o.gridAutoColumns), l || Me(m, d.lineNames, f.rows, o.gridAutoRows);
|
|
971
1070
|
for (let [e, t] of f.areas) u.lineNames[Math.min(t.colStart, p.length)].push(`${e}-start`), u.lineNames[Math.min(t.colEnd, p.length)].push(`${e}-end`), d.lineNames[Math.min(t.rowStart, m.length)].push(`${e}-start`), d.lineNames[Math.min(t.rowEnd, m.length)].push(`${e}-end`);
|
|
972
1071
|
}
|
|
973
1072
|
let h = {
|
|
@@ -976,28 +1075,28 @@ function _e(e, t, n, r, i, a) {
|
|
|
976
1075
|
}, g = {
|
|
977
1076
|
explicitCount: m.length,
|
|
978
1077
|
names: d.lineNames
|
|
979
|
-
}, _ =
|
|
980
|
-
col:
|
|
981
|
-
row:
|
|
1078
|
+
}, _ = Re(s.map((e) => ({
|
|
1079
|
+
col: Le(e.style.gridColumnStart, e.style.gridColumnEnd, h),
|
|
1080
|
+
row: Le(e.style.gridRowStart, e.style.gridRowEnd, g)
|
|
982
1081
|
})), p.length, m.length, o.gridAutoFlow);
|
|
983
|
-
return c &&
|
|
1082
|
+
return c && Te(_, "col", p.length), l && Te(_, "row", m.length), {
|
|
984
1083
|
children: s,
|
|
985
1084
|
placed: _,
|
|
986
1085
|
colLines: h,
|
|
987
1086
|
rowLines: g,
|
|
988
|
-
colTracks:
|
|
989
|
-
rowTracks:
|
|
990
|
-
colCollapsed:
|
|
991
|
-
rowCollapsed:
|
|
1087
|
+
colTracks: Ne(p, _.colOrigin, _.colCount, o.gridAutoColumns),
|
|
1088
|
+
rowTracks: Ne(m, _.rowOrigin, _.rowCount, o.gridAutoRows),
|
|
1089
|
+
colCollapsed: Pe(u, _.colOrigin, _.colCount, _.items.map((e) => e.col)),
|
|
1090
|
+
rowCollapsed: Pe(d, _.rowOrigin, _.rowCount, _.items.map((e) => e.row))
|
|
992
1091
|
};
|
|
993
1092
|
}
|
|
994
|
-
function
|
|
1093
|
+
function we(e) {
|
|
995
1094
|
return {
|
|
996
|
-
tracks: Array.from({ length: e }, () =>
|
|
1095
|
+
tracks: Array.from({ length: e }, () => fe()),
|
|
997
1096
|
lineNames: Array.from({ length: e + 1 }, () => [])
|
|
998
1097
|
};
|
|
999
1098
|
}
|
|
1000
|
-
function
|
|
1099
|
+
function Te(e, t, n) {
|
|
1001
1100
|
let r = t === "col" ? e.colOrigin : e.rowOrigin;
|
|
1002
1101
|
for (let i of e.items) {
|
|
1003
1102
|
let e = i[t], a = Math.min(Math.max(e.start + r, 0), n - 1), o = Math.min(Math.max(e.start + r + e.span, a + 1), n);
|
|
@@ -1005,22 +1104,22 @@ function ye(e, t, n) {
|
|
|
1005
1104
|
}
|
|
1006
1105
|
t === "col" ? (e.colOrigin = 0, e.colCount = n) : (e.rowOrigin = 0, e.rowCount = n);
|
|
1007
1106
|
}
|
|
1008
|
-
function
|
|
1009
|
-
return e.children.filter((e) => !
|
|
1107
|
+
function Ee(e) {
|
|
1108
|
+
return e.children.filter((e) => !B(e.style) && !e.inlineBox).sort((e, t) => e.style.order - t.style.order);
|
|
1010
1109
|
}
|
|
1011
|
-
function
|
|
1110
|
+
function De(e) {
|
|
1012
1111
|
return (e.left ?? 0) + (e.right ?? 0);
|
|
1013
1112
|
}
|
|
1014
|
-
function
|
|
1113
|
+
function Oe(e) {
|
|
1015
1114
|
return (e.top ?? 0) + (e.bottom ?? 0);
|
|
1016
1115
|
}
|
|
1017
|
-
function
|
|
1116
|
+
function ke(e, t, n) {
|
|
1018
1117
|
let r = e.style, i;
|
|
1019
|
-
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i =
|
|
1118
|
+
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = q(r.width, 0, e, n)), i === void 0 && (i = t === "min" ? Y(e, n) : J(e, n));
|
|
1020
1119
|
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
1021
|
-
return Math.max(0,
|
|
1120
|
+
return Math.max(0, H(i, a, o));
|
|
1022
1121
|
}
|
|
1023
|
-
function
|
|
1122
|
+
function Ae(e, t, n) {
|
|
1024
1123
|
if (e.kind !== "tracks") return {
|
|
1025
1124
|
tracks: [],
|
|
1026
1125
|
lineNames: [[]]
|
|
@@ -1033,7 +1132,7 @@ function Ce(e, t, n) {
|
|
|
1033
1132
|
let { index: i, tracks: a, mode: o } = e.autoRepeat, s = 1;
|
|
1034
1133
|
if (t !== void 0) {
|
|
1035
1134
|
let e = a.reduce((e, n) => {
|
|
1036
|
-
let r =
|
|
1135
|
+
let r = je(n.min, t) ?? je(n.max, t) ?? 1;
|
|
1037
1136
|
return e + Math.max(1, r);
|
|
1038
1137
|
}, 0);
|
|
1039
1138
|
s = Math.max(1, Math.floor((t + n) / (e + n * a.length)));
|
|
@@ -1061,23 +1160,23 @@ function Ce(e, t, n) {
|
|
|
1061
1160
|
lineNames: d
|
|
1062
1161
|
};
|
|
1063
1162
|
}
|
|
1064
|
-
function
|
|
1163
|
+
function je(e, t) {
|
|
1065
1164
|
if (e.kind === "cells") return e.value;
|
|
1066
1165
|
if (e.kind === "percent" && t !== void 0) return m(e.value, t);
|
|
1067
1166
|
if (e.kind === "math") {
|
|
1068
1167
|
let n = [];
|
|
1069
1168
|
for (let r of e.args) {
|
|
1070
|
-
let e =
|
|
1169
|
+
let e = je(r, t);
|
|
1071
1170
|
if (e === void 0) return;
|
|
1072
1171
|
n.push(e);
|
|
1073
1172
|
}
|
|
1074
1173
|
return e.fn === "min" ? Math.min(...n) : Math.max(...n);
|
|
1075
1174
|
}
|
|
1076
1175
|
}
|
|
1077
|
-
function
|
|
1176
|
+
function Me(e, t, n, r) {
|
|
1078
1177
|
for (let i = e.length; i < n; i++) e.push(r[(i - e.length) % r.length]), t.push([]);
|
|
1079
1178
|
}
|
|
1080
|
-
function
|
|
1179
|
+
function Ne(e, t, n, r) {
|
|
1081
1180
|
let i = [];
|
|
1082
1181
|
for (let a = 0; a < n; a++) {
|
|
1083
1182
|
let n = a + t;
|
|
@@ -1089,7 +1188,7 @@ function Ee(e, t, n, r) {
|
|
|
1089
1188
|
}
|
|
1090
1189
|
return i;
|
|
1091
1190
|
}
|
|
1092
|
-
function
|
|
1191
|
+
function Pe(e, t, n, r) {
|
|
1093
1192
|
let i = Array.from({ length: n }, () => !1);
|
|
1094
1193
|
if (!e.autoFit) return i;
|
|
1095
1194
|
for (let a = e.autoFit.start; a < e.autoFit.end; a++) {
|
|
@@ -1098,7 +1197,7 @@ function De(e, t, n, r) {
|
|
|
1098
1197
|
}
|
|
1099
1198
|
return i;
|
|
1100
1199
|
}
|
|
1101
|
-
function
|
|
1200
|
+
function Fe(e, t, n) {
|
|
1102
1201
|
if (e.kind === "line") return e.value > 0 ? e.value - 1 : n.explicitCount + 1 + e.value;
|
|
1103
1202
|
if (e.kind !== "name") return null;
|
|
1104
1203
|
if (e.nth === void 0) {
|
|
@@ -1113,14 +1212,14 @@ function Oe(e, t, n) {
|
|
|
1113
1212
|
for (let t = i; t >= 0; t--) if (n.names[t].includes(e.name) && ++a === -r) return t;
|
|
1114
1213
|
return -(-r - a);
|
|
1115
1214
|
}
|
|
1116
|
-
function
|
|
1215
|
+
function Ie(e, t, n, r) {
|
|
1117
1216
|
if (t.name === void 0) return e + n * t.value;
|
|
1118
1217
|
let i = t.value, a = e;
|
|
1119
1218
|
for (; i > 0;) a += n, (!(a >= 0 && a <= r.explicitCount) || r.names[a].includes(t.name)) && i--;
|
|
1120
1219
|
return a;
|
|
1121
1220
|
}
|
|
1122
|
-
function
|
|
1123
|
-
let r =
|
|
1221
|
+
function Le(e, t, n) {
|
|
1222
|
+
let r = Fe(e, "start", n), i = Fe(t, "end", n);
|
|
1124
1223
|
if (r !== null && i !== null) return r === i ? {
|
|
1125
1224
|
start: r,
|
|
1126
1225
|
span: 1
|
|
@@ -1130,10 +1229,10 @@ function Ae(e, t, n) {
|
|
|
1130
1229
|
};
|
|
1131
1230
|
if (r !== null) return {
|
|
1132
1231
|
start: r,
|
|
1133
|
-
span: (t.kind === "span" ?
|
|
1232
|
+
span: (t.kind === "span" ? Ie(r, t, 1, n) : r + 1) - r
|
|
1134
1233
|
};
|
|
1135
1234
|
if (i !== null) {
|
|
1136
|
-
let t = e.kind === "span" ?
|
|
1235
|
+
let t = e.kind === "span" ? Ie(i, e, -1, n) : i - 1;
|
|
1137
1236
|
return {
|
|
1138
1237
|
start: t,
|
|
1139
1238
|
span: i - t
|
|
@@ -1144,7 +1243,7 @@ function Ae(e, t, n) {
|
|
|
1144
1243
|
span: e.kind === "span" ? e.value : t.kind === "span" ? t.value : 1
|
|
1145
1244
|
};
|
|
1146
1245
|
}
|
|
1147
|
-
function
|
|
1246
|
+
function Re(e, t, n, r) {
|
|
1148
1247
|
let i = r.direction === "row", a = e.map((e) => i ? e.row : e.col), o = e.map((e) => i ? e.col : e.row), s = i ? t : n, c = i ? n : t, l = 0, u = Math.max(s, 1);
|
|
1149
1248
|
for (let t = 0; t < e.length; t++) {
|
|
1150
1249
|
let e = o[t];
|
|
@@ -1241,7 +1340,7 @@ function je(e, t, n, r) {
|
|
|
1241
1340
|
rowCount: S
|
|
1242
1341
|
};
|
|
1243
1342
|
}
|
|
1244
|
-
function
|
|
1343
|
+
function ze(e, t, n, r, i, a) {
|
|
1245
1344
|
let o = typeof r == "number" ? r : void 0, s = e.map((e, n) => {
|
|
1246
1345
|
if (t[n]) return {
|
|
1247
1346
|
base: 0,
|
|
@@ -1251,7 +1350,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1251
1350
|
frFactor: 0,
|
|
1252
1351
|
collapsed: !0
|
|
1253
1352
|
};
|
|
1254
|
-
let r =
|
|
1353
|
+
let r = je(e.min, o), i = r ?? 0, a = r === void 0, s = e.max;
|
|
1255
1354
|
if (s.kind === "fr") return {
|
|
1256
1355
|
base: i,
|
|
1257
1356
|
limit: null,
|
|
@@ -1260,7 +1359,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1260
1359
|
frFactor: s.value,
|
|
1261
1360
|
collapsed: !1
|
|
1262
1361
|
};
|
|
1263
|
-
let c =
|
|
1362
|
+
let c = je(s, o);
|
|
1264
1363
|
return c === void 0 ? {
|
|
1265
1364
|
base: i,
|
|
1266
1365
|
limit: null,
|
|
@@ -1294,7 +1393,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1294
1393
|
if (n.length === 0) continue;
|
|
1295
1394
|
let i = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - i;
|
|
1296
1395
|
if (a > 0) {
|
|
1297
|
-
let e = n.reduce((e, t) => e + t.frFactor, 0), t =
|
|
1396
|
+
let e = n.reduce((e, t) => e + t.frFactor, 0), t = I(n.map((t) => e > 0 ? t.frFactor : 1), a);
|
|
1298
1397
|
n.forEach((e, n) => {
|
|
1299
1398
|
e.base += t[n];
|
|
1300
1399
|
});
|
|
@@ -1305,7 +1404,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1305
1404
|
if (i.length > 0) {
|
|
1306
1405
|
let n = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - n;
|
|
1307
1406
|
if (a > 0) {
|
|
1308
|
-
let e =
|
|
1407
|
+
let e = I(i.map(() => 1), a);
|
|
1309
1408
|
i.forEach((t, n) => {
|
|
1310
1409
|
t.base += e[n];
|
|
1311
1410
|
});
|
|
@@ -1316,7 +1415,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1316
1415
|
if (e.length === 0) continue;
|
|
1317
1416
|
let a = i - (t.reduce((e, t) => e + u(t), 0) + r);
|
|
1318
1417
|
if (a > 0) {
|
|
1319
|
-
let t =
|
|
1418
|
+
let t = I(e.map(() => 1), a);
|
|
1320
1419
|
e.forEach((e, n) => {
|
|
1321
1420
|
e.limit = u(e) + t[n];
|
|
1322
1421
|
});
|
|
@@ -1348,7 +1447,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1348
1447
|
for (; !(t <= 0);) {
|
|
1349
1448
|
let e = s.filter((e) => !e.collapsed && e.limitKind !== "fr" && e.base < u(e));
|
|
1350
1449
|
if (e.length === 0) break;
|
|
1351
|
-
let n =
|
|
1450
|
+
let n = I(e.map(() => 1), t), r = 0;
|
|
1352
1451
|
if (e.forEach((e, t) => {
|
|
1353
1452
|
let i = Math.min(n[t], u(e) - e.base);
|
|
1354
1453
|
e.base += i, r += i;
|
|
@@ -1358,7 +1457,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1358
1457
|
if (n.length > 0) {
|
|
1359
1458
|
let t = Math.max(0, o - e - s.reduce((e, t) => e + (t.limitKind === "fr" ? 0 : t.base), 0)), r = n, i = t, a = n.reduce((e, t) => e + t.frFactor, 0);
|
|
1360
1459
|
for (a < 1 && (i = Math.floor(i * a));;) {
|
|
1361
|
-
let e =
|
|
1460
|
+
let e = I(r.map((e) => e.frFactor), i), t = r.filter((t, n) => e[n] < t.base);
|
|
1362
1461
|
if (t.length === 0) {
|
|
1363
1462
|
r.forEach((t, n) => {
|
|
1364
1463
|
t.base = Math.max(t.base, e[n]);
|
|
@@ -1372,7 +1471,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1372
1471
|
if (a) {
|
|
1373
1472
|
let t = o - e - s.reduce((e, t) => e + t.base, 0), n = s.filter((e) => !e.collapsed && e.limitKind === "intrinsic-max");
|
|
1374
1473
|
if (t > 0 && n.length > 0) {
|
|
1375
|
-
let e =
|
|
1474
|
+
let e = I(n.map(() => 1), t);
|
|
1376
1475
|
n.forEach((t, n) => {
|
|
1377
1476
|
t.base += e[n];
|
|
1378
1477
|
});
|
|
@@ -1385,57 +1484,406 @@ function Me(e, t, n, r, i, a) {
|
|
|
1385
1484
|
limits: s.map((e) => u(e))
|
|
1386
1485
|
};
|
|
1387
1486
|
}
|
|
1388
|
-
function
|
|
1389
|
-
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t -
|
|
1487
|
+
function Be(e, t, n) {
|
|
1488
|
+
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t - Ve(e)), o = F(n === "stretch" ? "start" : n, r, a), s = [], c = 0;
|
|
1390
1489
|
for (let e = 0; e < r.length; e++) c += i[e], s.push(o[e] + c);
|
|
1391
1490
|
return s;
|
|
1392
1491
|
}
|
|
1393
|
-
function
|
|
1492
|
+
function Ve(e) {
|
|
1394
1493
|
return e.sizes.reduce((e, t) => e + t, 0) + e.gapBefore.reduce((e, t) => e + t, 0);
|
|
1395
1494
|
}
|
|
1396
|
-
function
|
|
1495
|
+
function He(e, t, n, r) {
|
|
1397
1496
|
let i = n + r - 1;
|
|
1398
1497
|
return e[n] === void 0 || e[i] === void 0 ? 0 : e[i] + t[i] - e[n];
|
|
1399
1498
|
}
|
|
1400
|
-
function
|
|
1499
|
+
function Ue(e, t, n, r, i) {
|
|
1401
1500
|
let a = t ?? 0, o = n ?? 0, s = r - i;
|
|
1402
1501
|
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a + L(e, r, i + a + o);
|
|
1403
1502
|
}
|
|
1404
1503
|
//#endregion
|
|
1504
|
+
//#region src/multicol.ts
|
|
1505
|
+
function We(e, t, n) {
|
|
1506
|
+
let r = e.columnWidth === null ? null : Math.max(1, Math.floor((t + n) / (e.columnWidth + n)));
|
|
1507
|
+
return e.columnCount !== null && r !== null ? Math.max(1, Math.min(e.columnCount, r)) : r === null ? Math.max(1, e.columnCount ?? 1) : r;
|
|
1508
|
+
}
|
|
1509
|
+
function Ge(e, t, n) {
|
|
1510
|
+
let r = We(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r)), a = Math.max(0, t - (r * i + (r - 1) * n));
|
|
1511
|
+
return Array.from({ length: r }, (e, t) => i + +(t < a));
|
|
1512
|
+
}
|
|
1513
|
+
function Ke(e, t) {
|
|
1514
|
+
let n = Math.max(typeof e.gapX == "number" ? e.gapX : 0, e.ruleX?.width ?? 0);
|
|
1515
|
+
return e.columnCount === null ? Math.max(e.columnWidth ?? 1, t) : e.columnCount * t + (e.columnCount - 1) * n;
|
|
1516
|
+
}
|
|
1517
|
+
function qe(e, t) {
|
|
1518
|
+
return e === void 0 ? t : t === void 0 ? e : Math.min(e, t);
|
|
1519
|
+
}
|
|
1520
|
+
function Je(e, t, n) {
|
|
1521
|
+
for (; e < t;) {
|
|
1522
|
+
let r = e + t >> 1;
|
|
1523
|
+
n(r) ? t = r : e = r + 1;
|
|
1524
|
+
}
|
|
1525
|
+
return e;
|
|
1526
|
+
}
|
|
1527
|
+
function Ye(e, t, n) {
|
|
1528
|
+
let r = We(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r));
|
|
1529
|
+
return {
|
|
1530
|
+
count: r,
|
|
1531
|
+
width: i,
|
|
1532
|
+
leftover: Math.max(0, t - (r * i + (r - 1) * n))
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
function Xe(e, t, n) {
|
|
1536
|
+
return e === "all" ? !0 : e === "around" ? t || n : t && n;
|
|
1537
|
+
}
|
|
1538
|
+
function Ze(e, t, n, r) {
|
|
1539
|
+
let i = qt(e, Math.max(1, t.width - e.style.tracking)), { heights: a, textOffsets: o } = Jt(e, i), s = e.style.lineGap, c = Qe(a.map((e) => e + s)), l;
|
|
1540
|
+
if (e.style.columnFill === "auto" && r !== void 0) l = Math.max(1, r);
|
|
1541
|
+
else {
|
|
1542
|
+
let e = Je(c.reduce((e, t) => Math.max(e, t.rows - s), 1), Math.max(1, c.reduce((e, t) => e + t.rows, 0) - s), (e) => z(c, s, e).columns <= t.count);
|
|
1543
|
+
l = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
1544
|
+
}
|
|
1545
|
+
let u = z(c, s, l);
|
|
1546
|
+
return {
|
|
1547
|
+
spans: i,
|
|
1548
|
+
lineY: u.top,
|
|
1549
|
+
textY: u.top.map((e, t) => e + o[t]),
|
|
1550
|
+
lineX: u.column.map((e) => e * (t.width + n)),
|
|
1551
|
+
totalRows: u.maxUsed,
|
|
1552
|
+
columnCount: t.count,
|
|
1553
|
+
columnWidth: t.width,
|
|
1554
|
+
gap: n,
|
|
1555
|
+
columnsUsed: i.length > 0 ? u.columns : 0
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
function z(e, t, n) {
|
|
1559
|
+
let r = 0, i = 0, a = 0, o = [], s = [];
|
|
1560
|
+
for (let c = 0; c < e.length; c++) {
|
|
1561
|
+
let l = e[c], u = c === 0 || i > 0 ? l.pre : 0;
|
|
1562
|
+
i > 0 && (l.forced || i + u + l.rows - t > n) && (r += 1, i = 0, u = 0);
|
|
1563
|
+
let d = l.rows / l.lines;
|
|
1564
|
+
if (l.lines > 1 && l.rows - t > n) {
|
|
1565
|
+
for (let e = 0; e < l.lines; e++) i > 0 && i + u + d - t > n && (r += 1, i = 0, u = 0), o.push(r), s.push(i + u), i += u + d, u = 0, a = Math.max(a, i - t);
|
|
1566
|
+
continue;
|
|
1567
|
+
}
|
|
1568
|
+
for (let e = 0; e < l.lines; e++) o.push(r), s.push(i + u + e * d);
|
|
1569
|
+
i += u + l.rows, a = Math.max(a, i - t);
|
|
1570
|
+
}
|
|
1571
|
+
return {
|
|
1572
|
+
columns: r + 1,
|
|
1573
|
+
maxUsed: a,
|
|
1574
|
+
column: o,
|
|
1575
|
+
top: s
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
function Qe(e) {
|
|
1579
|
+
return e.map((e) => ({
|
|
1580
|
+
rows: e,
|
|
1581
|
+
pre: 0,
|
|
1582
|
+
forced: !1,
|
|
1583
|
+
lines: 1
|
|
1584
|
+
}));
|
|
1585
|
+
}
|
|
1586
|
+
function $e(e, t) {
|
|
1587
|
+
let { columnWidth: n, columnCount: r, tracking: i = 0, lineGap: a = 0, restrictingHeight: o } = t, s = i > 0 ? Array.from(e, () => 1 + i) : void 0, c = x(e, Math.max(1, n - i), {
|
|
1588
|
+
advances: s,
|
|
1589
|
+
tracking: i,
|
|
1590
|
+
firstLineIndent: t.firstLineIndent
|
|
1591
|
+
}), l = Qe(c.map(() => 1 + a)), u = z(l, a, o ?? Je(1, Math.max(1, c.length * (1 + a) - a), (e) => z(l, a, e).columns <= r));
|
|
1592
|
+
return c.map((t, n) => ({
|
|
1593
|
+
text: e.slice(t.start, t.end),
|
|
1594
|
+
column: u.column[n],
|
|
1595
|
+
top: u.top[n]
|
|
1596
|
+
}));
|
|
1597
|
+
}
|
|
1598
|
+
function et(e, t, n, r) {
|
|
1599
|
+
let i = e.style;
|
|
1600
|
+
if (!i.ruleX) return;
|
|
1601
|
+
let a = t.columnCount * t.columnWidth + (t.columnCount - 1) * t.gap, o = t.ruleSegments ?? [{
|
|
1602
|
+
start: 0,
|
|
1603
|
+
end: t.totalRows,
|
|
1604
|
+
columns: t.columnsUsed
|
|
1605
|
+
}], s = [];
|
|
1606
|
+
for (let e of o) {
|
|
1607
|
+
let n = Math.min(e.columns, t.columnCount);
|
|
1608
|
+
for (let r = 0; r < t.columnCount - 1; r++) Xe(i.ruleVisibilityItems, r < n, r + 1 < n) && s.push({
|
|
1609
|
+
bandStart: (r + 1) * t.columnWidth + r * t.gap,
|
|
1610
|
+
bandSize: t.gap,
|
|
1611
|
+
start: e.start,
|
|
1612
|
+
end: e.end
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
e.decorationRuns = u({
|
|
1616
|
+
ruleX: i.ruleX,
|
|
1617
|
+
ruleY: null,
|
|
1618
|
+
vertical: N(s, i.ruleInset),
|
|
1619
|
+
horizontal: [],
|
|
1620
|
+
contentWidth: a,
|
|
1621
|
+
contentHeight: t.totalRows,
|
|
1622
|
+
border: n,
|
|
1623
|
+
borderStyle: i.borderStyle,
|
|
1624
|
+
borderColor: i.borderColor,
|
|
1625
|
+
padding: r
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
function tt(e, t) {
|
|
1629
|
+
let n = e.style, r = n.padding;
|
|
1630
|
+
return e.text !== "" && e.children.length === 0 && n.display === "block" && n.position === "static" && !n.columnSpan && n.whiteSpace === "normal" && n.lineGap === t.lineGap && n.border.top === 0 && n.border.right === 0 && n.border.bottom === 0 && n.border.left === 0 && r.top === 0 && r.right === 0 && r.bottom === 0 && r.left === 0 && n.backgroundColor === void 0 && !n.backgroundClear && (n.width === void 0 || n.width.kind === "auto") && (n.height === void 0 || n.height.kind === "auto") && (n.minWidth === "auto" || n.minWidth === 0 || n.minWidth === void 0) && (n.minHeight === "auto" || n.minHeight === 0 || n.minHeight === void 0) && n.maxWidth === void 0 && n.maxHeight === void 0;
|
|
1631
|
+
}
|
|
1632
|
+
function nt(e, t, n, r, i, a, o) {
|
|
1633
|
+
let s = e.style, c = U(s, "x", n), l = Ye(s, n, c);
|
|
1634
|
+
a.right += l.leftover;
|
|
1635
|
+
let u = s.lineGap, d = i.left + a.left, f = i.top + a.top, p = n - l.leftover, m = [[]], h = [];
|
|
1636
|
+
for (let e of t) e.style.columnSpan ? (h[m.length - 1] = e, m.push([])) : m[m.length - 1].push(e);
|
|
1637
|
+
let g = m.length > 1, _ = [], v = 0, y = 0;
|
|
1638
|
+
for (let e = 0; e < m.length; e++) {
|
|
1639
|
+
let t = m[e];
|
|
1640
|
+
if (t.length > 0) {
|
|
1641
|
+
let n = t.map((e) => ({
|
|
1642
|
+
node: e,
|
|
1643
|
+
spans: qt(e, Math.max(1, l.width - e.style.tracking)),
|
|
1644
|
+
margin: G(e.style.margin, l.width)
|
|
1645
|
+
})), i = [], a = null, o = !1;
|
|
1646
|
+
for (let { node: e, spans: t, margin: r } of n) {
|
|
1647
|
+
let n = a === null ? r.top ?? 0 : $t(a, r.top ?? 0), s = o || e.style.breakBeforeColumn;
|
|
1648
|
+
if (e.style.breakInsideAvoid && t.length > 0) i.push({
|
|
1649
|
+
rows: t.length * (1 + u),
|
|
1650
|
+
pre: n,
|
|
1651
|
+
forced: s,
|
|
1652
|
+
lines: t.length
|
|
1653
|
+
});
|
|
1654
|
+
else for (let e = 0; e < t.length; e++) i.push({
|
|
1655
|
+
rows: 1 + u,
|
|
1656
|
+
pre: e > 0 ? 0 : n,
|
|
1657
|
+
forced: e === 0 && s,
|
|
1658
|
+
lines: 1
|
|
1659
|
+
});
|
|
1660
|
+
t.length > 0 && (a = r.bottom ?? 0), o = e.style.breakAfterColumn;
|
|
1661
|
+
}
|
|
1662
|
+
let h;
|
|
1663
|
+
if (s.columnFill === "auto" && r !== void 0) h = Math.max(1, r);
|
|
1664
|
+
else {
|
|
1665
|
+
let e = Je(1, Math.max(1, z(i, u, Infinity).maxUsed), (e) => z(i, u, e).columns <= l.count);
|
|
1666
|
+
h = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
1667
|
+
}
|
|
1668
|
+
let g = z(i, u, h);
|
|
1669
|
+
for (let e = 0, t = 0; e < n.length; e++) {
|
|
1670
|
+
let { node: r, spans: i, margin: a } = n[e], o = [], s = [];
|
|
1671
|
+
for (let e = 0; e < i.length; e++, t++) o.push(v + g.top[t]), s.push(g.column[t] * (l.width + c));
|
|
1672
|
+
delete r.decorationRuns, r.multicolGeometry = {
|
|
1673
|
+
spans: i,
|
|
1674
|
+
lineY: o,
|
|
1675
|
+
textY: o,
|
|
1676
|
+
lineX: s,
|
|
1677
|
+
totalRows: v + g.maxUsed,
|
|
1678
|
+
columnCount: l.count,
|
|
1679
|
+
columnWidth: l.width,
|
|
1680
|
+
gap: c,
|
|
1681
|
+
columnsUsed: g.columns
|
|
1682
|
+
}, r.multicolFlow = a, r.localRect = {
|
|
1683
|
+
x: d,
|
|
1684
|
+
y: f,
|
|
1685
|
+
width: p,
|
|
1686
|
+
height: g.maxUsed
|
|
1687
|
+
}, r.resolvedPadding = {
|
|
1688
|
+
top: 0,
|
|
1689
|
+
right: 0,
|
|
1690
|
+
bottom: 0,
|
|
1691
|
+
left: 0
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
i.length > 0 && (_.push({
|
|
1695
|
+
start: v,
|
|
1696
|
+
end: v + g.maxUsed,
|
|
1697
|
+
columns: g.columns
|
|
1698
|
+
}), y = Math.max(y, g.columns), v += g.maxUsed + (e < m.length - 1 ? u : 0));
|
|
1699
|
+
}
|
|
1700
|
+
let n = h[e];
|
|
1701
|
+
if (n) {
|
|
1702
|
+
let e = G(n.style.margin, p), t = (e.left ?? 0) + (e.right ?? 0);
|
|
1703
|
+
V(n, Math.max(0, p - t), void 0, 0, 0, "fill", o);
|
|
1704
|
+
let r = Qt(e, p, n.localRect.width);
|
|
1705
|
+
v += e.top ?? 0, n.localRect = {
|
|
1706
|
+
...n.localRect,
|
|
1707
|
+
x: d + r,
|
|
1708
|
+
y: f + v
|
|
1709
|
+
}, n.multicolFlowSpan = {
|
|
1710
|
+
top: e.top ?? 0,
|
|
1711
|
+
right: 0,
|
|
1712
|
+
bottom: e.bottom ?? 0,
|
|
1713
|
+
left: r
|
|
1714
|
+
}, v += n.localRect.height + (e.bottom ?? 0);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
let b = v;
|
|
1718
|
+
for (let t of e.children) {
|
|
1719
|
+
if (!B(t.style)) continue;
|
|
1720
|
+
let e = G(t.style.margin, n);
|
|
1721
|
+
t.staticSlot = {
|
|
1722
|
+
kind: "block",
|
|
1723
|
+
x: d + (e.left ?? 0),
|
|
1724
|
+
y: f + (e.top ?? 0)
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1727
|
+
return e.multicolGeometry = {
|
|
1728
|
+
spans: [],
|
|
1729
|
+
lineY: [],
|
|
1730
|
+
textY: [],
|
|
1731
|
+
lineX: [],
|
|
1732
|
+
totalRows: b,
|
|
1733
|
+
columnCount: l.count,
|
|
1734
|
+
columnWidth: l.width,
|
|
1735
|
+
gap: c,
|
|
1736
|
+
columnsUsed: y,
|
|
1737
|
+
...g ? {
|
|
1738
|
+
ruleSegments: _,
|
|
1739
|
+
nativeBalance: !0
|
|
1740
|
+
} : {}
|
|
1741
|
+
}, b;
|
|
1742
|
+
}
|
|
1743
|
+
function rt(e, t, n, r, i, a, o) {
|
|
1744
|
+
let s = e.style, c = qe(n, r), l = e.children.filter((e) => !B(e.style)), d = l.filter((e) => !e.style.columnSpan);
|
|
1745
|
+
if (d.length > 0 && d.every((e) => tt(e, s)) && (d.length === l.length || s.columnFill === "balance" && c === void 0 && d.every((e) => (e.style.margin.top === 0 || e.style.margin.top === null) && (e.style.margin.bottom === 0 || e.style.margin.bottom === null)))) return nt(e, l, t, c, i, a, o);
|
|
1746
|
+
let f = U(s, "x", t), p = Ge(s, t, f), m = p.length, h = [];
|
|
1747
|
+
{
|
|
1748
|
+
let e = 0;
|
|
1749
|
+
for (let t of p) h.push(e), e += t + f;
|
|
1750
|
+
}
|
|
1751
|
+
let g = (e) => e < m ? h[e] : h[m - 1] + (e - m + 1) * (p[m - 1] + f), _ = (e) => p[Math.min(e, m - 1)], v = p[m - 1], y = i.left + a.left, b = i.top + a.top, x = [], S = 0, C = [], w = [], T = !1, E = (e, t) => {
|
|
1752
|
+
let r = 0, i = 0, a = null, s = 0, c = (e) => {
|
|
1753
|
+
if (t) for (let t of w) {
|
|
1754
|
+
if (t.index !== e) continue;
|
|
1755
|
+
let n = a === null ? t.margin.top ?? 0 : $t(a, t.margin.top ?? 0);
|
|
1756
|
+
t.child.staticSlot = {
|
|
1757
|
+
kind: "block",
|
|
1758
|
+
x: y + g(r) + (t.margin.left ?? 0),
|
|
1759
|
+
y: b + S + i + n
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
};
|
|
1763
|
+
for (let l = 0; l < C.length; l++) {
|
|
1764
|
+
let u = C[l];
|
|
1765
|
+
c(l);
|
|
1766
|
+
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 : $t(a, u.margin.top ?? 0), f = u.node.localRect.height;
|
|
1767
|
+
if (a !== null && (u.breakBefore || i + d + f > e) && (r += 1, i = 0, a = null, d = 0), t) {
|
|
1768
|
+
let e = u.node, t = _(r);
|
|
1769
|
+
if (t !== v) {
|
|
1770
|
+
let r = (u.margin.left ?? 0) + (u.margin.right ?? 0);
|
|
1771
|
+
V(e, Math.max(0, t - r), n, 0, 0, "fill", o);
|
|
1772
|
+
}
|
|
1773
|
+
e.localRect = {
|
|
1774
|
+
...e.localRect,
|
|
1775
|
+
x: y + g(r) + Qt(u.margin, t, e.localRect.width),
|
|
1776
|
+
y: b + S + i + d
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
i += d + u.node.localRect.height, s = Math.max(s, i), a = u.margin.bottom ?? 0;
|
|
1780
|
+
}
|
|
1781
|
+
return c(C.length), {
|
|
1782
|
+
columns: r + 1,
|
|
1783
|
+
maxUsed: s
|
|
1784
|
+
};
|
|
1785
|
+
}, D = () => {
|
|
1786
|
+
if (C.length === 0) {
|
|
1787
|
+
for (let e of w) e.child.staticSlot = {
|
|
1788
|
+
kind: "block",
|
|
1789
|
+
x: y + (e.margin.left ?? 0),
|
|
1790
|
+
y: b + S + (e.margin.top ?? 0)
|
|
1791
|
+
};
|
|
1792
|
+
w = [];
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
let e = c === void 0 ? void 0 : Math.max(1, c - S), t = s.columnFill === "auto" && e !== void 0, r;
|
|
1796
|
+
if (t) r = e;
|
|
1797
|
+
else {
|
|
1798
|
+
let t = Je(1, E(Infinity, !1).maxUsed, (e) => E(e, !1).columns <= m);
|
|
1799
|
+
r = e === void 0 ? t : Math.min(t, e);
|
|
1800
|
+
}
|
|
1801
|
+
let i = E(r, !0), a = t && n !== void 0 ? Math.max(i.maxUsed, r) : i.maxUsed;
|
|
1802
|
+
if (s.ruleX) for (let e = 0; e < m - 1; e++) {
|
|
1803
|
+
let t = Math.min(i.columns, m);
|
|
1804
|
+
Xe(s.ruleVisibilityItems, e < t, e + 1 < t) && x.push({
|
|
1805
|
+
bandStart: h[e] + p[e],
|
|
1806
|
+
bandSize: f,
|
|
1807
|
+
start: S,
|
|
1808
|
+
end: S + a
|
|
1809
|
+
});
|
|
1810
|
+
}
|
|
1811
|
+
S += a, C = [], w = [];
|
|
1812
|
+
};
|
|
1813
|
+
for (let r of e.children) {
|
|
1814
|
+
if (B(r.style)) {
|
|
1815
|
+
w.push({
|
|
1816
|
+
child: r,
|
|
1817
|
+
margin: G(r.style.margin, t),
|
|
1818
|
+
index: C.length
|
|
1819
|
+
});
|
|
1820
|
+
continue;
|
|
1821
|
+
}
|
|
1822
|
+
if (r.style.columnSpan) {
|
|
1823
|
+
D(), T = !1;
|
|
1824
|
+
let e = G(r.style.margin, t), i = (e.left ?? 0) + (e.right ?? 0);
|
|
1825
|
+
V(r, Math.max(0, t - i), n, 0, 0, "fill", o), S += e.top ?? 0, r.localRect = {
|
|
1826
|
+
...r.localRect,
|
|
1827
|
+
x: y + Qt(e, t, r.localRect.width),
|
|
1828
|
+
y: b + S
|
|
1829
|
+
}, S += r.localRect.height + (e.bottom ?? 0);
|
|
1830
|
+
continue;
|
|
1831
|
+
}
|
|
1832
|
+
let e = G(r.style.margin, v), i = (e.left ?? 0) + (e.right ?? 0);
|
|
1833
|
+
V(r, Math.max(0, v - i), n, 0, 0, "fill", o), C.push({
|
|
1834
|
+
node: r,
|
|
1835
|
+
margin: e,
|
|
1836
|
+
breakBefore: T || r.style.breakBeforeColumn
|
|
1837
|
+
}), T = r.style.breakAfterColumn;
|
|
1838
|
+
}
|
|
1839
|
+
return D(), s.ruleX && x.length > 0 && (e.decorationRuns = u({
|
|
1840
|
+
ruleX: s.ruleX,
|
|
1841
|
+
ruleY: null,
|
|
1842
|
+
vertical: N(x, s.ruleInset),
|
|
1843
|
+
horizontal: [],
|
|
1844
|
+
contentWidth: t,
|
|
1845
|
+
contentHeight: S,
|
|
1846
|
+
border: i,
|
|
1847
|
+
borderStyle: s.borderStyle,
|
|
1848
|
+
borderColor: s.borderColor,
|
|
1849
|
+
padding: a
|
|
1850
|
+
})), S;
|
|
1851
|
+
}
|
|
1852
|
+
//#endregion
|
|
1405
1853
|
//#region src/warn.ts
|
|
1406
|
-
var
|
|
1407
|
-
function
|
|
1408
|
-
let n =
|
|
1409
|
-
n ||
|
|
1854
|
+
var it = /* @__PURE__ */ new WeakMap();
|
|
1855
|
+
function at(e, t) {
|
|
1856
|
+
let n = it.get(e);
|
|
1857
|
+
n || it.set(e, n = /* @__PURE__ */ new Set()), !n.has(t) && (n.add(t), console.warn(`[monowind] ${t}`, e));
|
|
1410
1858
|
}
|
|
1411
1859
|
//#endregion
|
|
1412
1860
|
//#region src/table.ts
|
|
1413
|
-
function
|
|
1414
|
-
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" &&
|
|
1861
|
+
function ot(e, t) {
|
|
1862
|
+
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" && at(t.source, "Table content outside the expected structure (rows in tables, cells in rows) can't be laid out and was hidden — no anonymous table boxes (specs/table.md).");
|
|
1415
1863
|
}
|
|
1416
|
-
function
|
|
1864
|
+
function st(e, t) {
|
|
1417
1865
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
1418
1866
|
return Number.isNaN(n) ? 1 : t === "colspan" ? Math.min(1e3, Math.max(1, n)) : Math.min(65534, Math.max(0, n));
|
|
1419
1867
|
}
|
|
1420
|
-
function
|
|
1868
|
+
function ct(e, t, n) {
|
|
1421
1869
|
let r = (t, r) => {
|
|
1422
|
-
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ?
|
|
1870
|
+
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ? q(i, 0, t, n) : void 0, o = i && i.kind === "percent" ? i.value : void 0;
|
|
1423
1871
|
for (let t = 0; t < r; t++) e.colFixed.push(a), e.colPercent.push(o);
|
|
1424
1872
|
};
|
|
1425
1873
|
if (t.style.tableRole === "column") {
|
|
1426
|
-
r(t,
|
|
1874
|
+
r(t, lt(t.source));
|
|
1427
1875
|
return;
|
|
1428
1876
|
}
|
|
1429
1877
|
let i = t.children.filter((e) => e.style.tableRole === "column");
|
|
1430
|
-
if (i.length === 0) r(t,
|
|
1431
|
-
else for (let e of i) r(e,
|
|
1432
|
-
for (let n of t.children) n.style.tableRole !== "column" &&
|
|
1878
|
+
if (i.length === 0) r(t, lt(t.source));
|
|
1879
|
+
else for (let e of i) r(e, lt(e.source));
|
|
1880
|
+
for (let n of t.children) n.style.tableRole !== "column" && ot(e, n);
|
|
1433
1881
|
}
|
|
1434
|
-
function
|
|
1882
|
+
function lt(e) {
|
|
1435
1883
|
let t = Number.parseInt(e.getAttribute("span") ?? "", 10);
|
|
1436
1884
|
return Number.isNaN(t) ? 1 : Math.min(1e3, Math.max(1, t));
|
|
1437
1885
|
}
|
|
1438
|
-
function
|
|
1886
|
+
function ut(e, t) {
|
|
1439
1887
|
let n = {
|
|
1440
1888
|
caption: null,
|
|
1441
1889
|
rows: [],
|
|
@@ -1448,7 +1896,7 @@ function Ve(e, t) {
|
|
|
1448
1896
|
hidden: []
|
|
1449
1897
|
}, r = [], i = [], a = [];
|
|
1450
1898
|
for (let o of e.children) {
|
|
1451
|
-
if (
|
|
1899
|
+
if (B(o.style)) continue;
|
|
1452
1900
|
let e = o.style.tableRole;
|
|
1453
1901
|
if (e === "row") i.push({
|
|
1454
1902
|
row: o,
|
|
@@ -1456,11 +1904,11 @@ function Ve(e, t) {
|
|
|
1456
1904
|
});
|
|
1457
1905
|
else if (e === "header-group" || e === "row-group" || e === "footer-group") {
|
|
1458
1906
|
let t = e === "header-group" ? r : e === "footer-group" ? a : i;
|
|
1459
|
-
for (let e of o.children)
|
|
1907
|
+
for (let e of o.children) B(e.style) || (e.style.tableRole === "row" ? t.push({
|
|
1460
1908
|
row: e,
|
|
1461
1909
|
group: o
|
|
1462
|
-
}) :
|
|
1463
|
-
} else e === "caption" ? n.caption === null ? n.caption = o :
|
|
1910
|
+
}) : ot(n, e));
|
|
1911
|
+
} else e === "caption" ? n.caption === null ? n.caption = o : ot(n, o) : e === "column" || e === "column-group" ? (ct(n, o, t), n.hidden.push(o)) : ot(n, o);
|
|
1464
1912
|
}
|
|
1465
1913
|
let o = [
|
|
1466
1914
|
...r,
|
|
@@ -1475,20 +1923,20 @@ function Ve(e, t) {
|
|
|
1475
1923
|
s = e + 1;
|
|
1476
1924
|
}
|
|
1477
1925
|
}
|
|
1478
|
-
return
|
|
1926
|
+
return dt(n), n;
|
|
1479
1927
|
}
|
|
1480
|
-
function
|
|
1928
|
+
function dt(e) {
|
|
1481
1929
|
let t = [];
|
|
1482
1930
|
for (let n = 0; n < e.rows.length; n++) {
|
|
1483
1931
|
let r = e.rows[n], i = 0;
|
|
1484
1932
|
for (let a of r.children) {
|
|
1485
|
-
if (
|
|
1933
|
+
if (B(a.style)) continue;
|
|
1486
1934
|
if (a.style.tableRole !== "cell") {
|
|
1487
|
-
|
|
1935
|
+
ot(e, a);
|
|
1488
1936
|
continue;
|
|
1489
1937
|
}
|
|
1490
1938
|
for (; (t[i] ?? 0) > n;) i++;
|
|
1491
|
-
let o =
|
|
1939
|
+
let o = st(a.source, "colspan"), s = st(a.source, "rowspan"), c = e.groupEnds[n], l = Math.max(1, Math.min(s === 0 ? c - n : s, c - n));
|
|
1492
1940
|
for (let e = i; e < i + o; e++) t[e] = Math.max(t[e] ?? 0, n + l);
|
|
1493
1941
|
e.cells.push({
|
|
1494
1942
|
node: a,
|
|
@@ -1502,21 +1950,21 @@ function He(e) {
|
|
|
1502
1950
|
}
|
|
1503
1951
|
e.columnCount = Math.max(t.length, e.colFixed.length);
|
|
1504
1952
|
}
|
|
1505
|
-
function
|
|
1506
|
-
let r = e.style, i =
|
|
1953
|
+
function ft(e, t, n) {
|
|
1954
|
+
let r = e.style, i = Y(e, n), a;
|
|
1507
1955
|
if (t === "min") a = i;
|
|
1508
1956
|
else {
|
|
1509
|
-
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ?
|
|
1510
|
-
a = t === void 0 ?
|
|
1957
|
+
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ? q(r.width, 0, e, n) : void 0;
|
|
1958
|
+
a = t === void 0 ? J(e, n) : Math.max(i, t);
|
|
1511
1959
|
}
|
|
1512
1960
|
let o = typeof r.minWidth == "number" ? r.minWidth : 0, s = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
1513
|
-
return Math.max(0,
|
|
1961
|
+
return Math.max(0, H(a, o, s));
|
|
1514
1962
|
}
|
|
1515
|
-
function
|
|
1963
|
+
function pt(e) {
|
|
1516
1964
|
let t = e.style.width;
|
|
1517
1965
|
return t && t.kind === "percent" ? t.value : void 0;
|
|
1518
1966
|
}
|
|
1519
|
-
function
|
|
1967
|
+
function mt(e, t, n) {
|
|
1520
1968
|
let r = e.columnCount, i = Array.from({ length: r }, () => 0), a = Array.from({ length: r }, () => 0), o = Array.from({ length: r }, () => void 0);
|
|
1521
1969
|
for (let t = 0; t < r; t++) e.colFixed[t] !== void 0 && (a[t] = e.colFixed[t]), o[t] = e.colPercent[t];
|
|
1522
1970
|
let s = [];
|
|
@@ -1525,17 +1973,17 @@ function Ge(e, t, n) {
|
|
|
1525
1973
|
s.push(t);
|
|
1526
1974
|
continue;
|
|
1527
1975
|
}
|
|
1528
|
-
i[t.col] = Math.max(i[t.col],
|
|
1529
|
-
let e =
|
|
1976
|
+
i[t.col] = Math.max(i[t.col], ft(t.node, "min", n)), a[t.col] = Math.max(a[t.col], ft(t.node, "max", n));
|
|
1977
|
+
let e = pt(t.node);
|
|
1530
1978
|
e !== void 0 && (o[t.col] = Math.max(o[t.col] ?? 0, e));
|
|
1531
1979
|
}
|
|
1532
1980
|
s.sort((e, t) => e.colSpan - t.colSpan);
|
|
1533
1981
|
for (let e of s) {
|
|
1534
|
-
let r = e.col, o = e.col + e.colSpan, s =
|
|
1982
|
+
let r = e.col, o = e.col + e.colSpan, s = xt(t, r, o), c = a.slice(r, o);
|
|
1535
1983
|
for (let t of ["min", "max"]) {
|
|
1536
|
-
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d =
|
|
1984
|
+
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d = ft(e.node, t, n) - u;
|
|
1537
1985
|
if (d <= 0) continue;
|
|
1538
|
-
let f =
|
|
1986
|
+
let f = I(c.some((e) => e > 0) ? c : c.map(() => 1), d);
|
|
1539
1987
|
for (let e = r; e < o; e++) l[e] += f[e - r];
|
|
1540
1988
|
}
|
|
1541
1989
|
}
|
|
@@ -1546,7 +1994,7 @@ function Ge(e, t, n) {
|
|
|
1546
1994
|
percent: o
|
|
1547
1995
|
};
|
|
1548
1996
|
}
|
|
1549
|
-
function
|
|
1997
|
+
function ht(e, t) {
|
|
1550
1998
|
let n = e.min.length, r = e.min.slice(), i = [], a = [];
|
|
1551
1999
|
for (let t = 0; t < n; t++) (e.percent[t] === void 0 ? a : i).push(t);
|
|
1552
2000
|
if (i.length > 0) {
|
|
@@ -1557,32 +2005,32 @@ function Ke(e, t) {
|
|
|
1557
2005
|
}
|
|
1558
2006
|
let s = a.reduce((t, n) => t + e.min[n], 0), c = i.reduce((e, t) => e + r[t], 0) - (t - s);
|
|
1559
2007
|
if (c > 0) {
|
|
1560
|
-
let t = i.map((t) => r[t] - e.min[t]), n =
|
|
2008
|
+
let t = i.map((t) => r[t] - e.min[t]), n = I(t, Math.min(c, t.reduce((e, t) => e + t, 0)));
|
|
1561
2009
|
i.forEach((e, t) => r[e] -= n[t]);
|
|
1562
2010
|
}
|
|
1563
2011
|
}
|
|
1564
2012
|
let o = t - r.reduce((e, t) => e + t, 0);
|
|
1565
2013
|
if (o > 0 && a.length > 0) {
|
|
1566
|
-
let t = a.map((t) => e.max[t] - e.min[t]), n = t.reduce((e, t) => e + t, 0), i =
|
|
2014
|
+
let t = a.map((t) => e.max[t] - e.min[t]), n = t.reduce((e, t) => e + t, 0), i = I(t, Math.min(o, n));
|
|
1567
2015
|
a.forEach((e, t) => r[e] += i[t]), o -= Math.min(o, n);
|
|
1568
2016
|
}
|
|
1569
2017
|
if (o > 0) {
|
|
1570
2018
|
let t = a.length > 0 ? a : i;
|
|
1571
2019
|
if (t.length > 0) {
|
|
1572
|
-
let n = t.map((t) => e.max[t]), i =
|
|
2020
|
+
let n = t.map((t) => e.max[t]), i = I(n.some((e) => e > 0) ? n : n.map(() => 1), o);
|
|
1573
2021
|
t.forEach((e, t) => r[e] += i[t]);
|
|
1574
2022
|
}
|
|
1575
2023
|
}
|
|
1576
2024
|
return r;
|
|
1577
2025
|
}
|
|
1578
|
-
function
|
|
2026
|
+
function gt(e, t, n) {
|
|
1579
2027
|
let r = e.columnCount, i = Array.from({ length: r }, () => void 0);
|
|
1580
2028
|
for (let n = 0; n < r; n++) e.colFixed[n] === void 0 ? e.colPercent[n] !== void 0 && (i[n] = Math.max(0, Math.round(t * e.colPercent[n] / 100))) : i[n] = e.colFixed[n];
|
|
1581
2029
|
for (let r of e.cells) {
|
|
1582
2030
|
if (r.row !== 0) continue;
|
|
1583
2031
|
let e = r.node.style, a;
|
|
1584
|
-
if (e.width && e.width.kind === "percent" ? a = Math.max(0, Math.round(t * e.width.value / 100)) : e.width && e.width.kind !== "auto" && (a =
|
|
1585
|
-
let o =
|
|
2032
|
+
if (e.width && e.width.kind === "percent" ? a = Math.max(0, Math.round(t * e.width.value / 100)) : e.width && e.width.kind !== "auto" && (a = q(e.width, 0, r.node, n)), a === void 0) continue;
|
|
2033
|
+
let o = I(Array.from({ length: r.colSpan }, () => 1), a);
|
|
1586
2034
|
for (let e = 0; e < r.colSpan; e++) {
|
|
1587
2035
|
let t = r.col + e;
|
|
1588
2036
|
i[t] === void 0 && (i[t] = o[e]);
|
|
@@ -1590,18 +2038,18 @@ function qe(e, t, n) {
|
|
|
1590
2038
|
}
|
|
1591
2039
|
let a = i.reduce((e, t) => e + (t ?? 0), 0), o = i.filter((e) => e === void 0).length;
|
|
1592
2040
|
if (o > 0) {
|
|
1593
|
-
let e =
|
|
2041
|
+
let e = I(Array.from({ length: o }, () => 1), Math.max(0, t - a)), n = 0;
|
|
1594
2042
|
for (let t = 0; t < r; t++) i[t] === void 0 && (i[t] = e[n++]);
|
|
1595
2043
|
}
|
|
1596
2044
|
return i.map((e) => e ?? 0);
|
|
1597
2045
|
}
|
|
1598
|
-
var
|
|
2046
|
+
var _t = {
|
|
1599
2047
|
double: 3,
|
|
1600
2048
|
solid: 2,
|
|
1601
2049
|
dashed: 1,
|
|
1602
2050
|
dotted: 0
|
|
1603
2051
|
};
|
|
1604
|
-
function
|
|
2052
|
+
function vt(e) {
|
|
1605
2053
|
for (let { border: t, side: n } of e) if (t?.hidden[n]) return null;
|
|
1606
2054
|
let t = null;
|
|
1607
2055
|
for (let { border: n, side: r } of e) {
|
|
@@ -1609,7 +2057,7 @@ function Ye(e) {
|
|
|
1609
2057
|
let e = n.width[r];
|
|
1610
2058
|
if (e <= 0) continue;
|
|
1611
2059
|
let i = n.style[r];
|
|
1612
|
-
(t === null || e > t.width || e === t.width &&
|
|
2060
|
+
(t === null || e > t.width || e === t.width && _t[i] > _t[t.style]) && (t = {
|
|
1613
2061
|
width: e,
|
|
1614
2062
|
style: i,
|
|
1615
2063
|
color: n.color[r]
|
|
@@ -1617,7 +2065,7 @@ function Ye(e) {
|
|
|
1617
2065
|
}
|
|
1618
2066
|
return t;
|
|
1619
2067
|
}
|
|
1620
|
-
function
|
|
2068
|
+
function yt(e, t) {
|
|
1621
2069
|
let n = t.columnCount, r = t.rows.length, i = e.style.borderCollapse, a = {
|
|
1622
2070
|
collapsed: i,
|
|
1623
2071
|
vLines: Array.from({ length: n + 1 }, () => 0),
|
|
@@ -1662,7 +2110,7 @@ function Xe(e, t) {
|
|
|
1662
2110
|
side: u
|
|
1663
2111
|
});
|
|
1664
2112
|
}
|
|
1665
|
-
i.push(
|
|
2113
|
+
i.push(vt(l));
|
|
1666
2114
|
}
|
|
1667
2115
|
a.vSegments.push(i), a.vLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
1668
2116
|
}
|
|
@@ -1701,47 +2149,47 @@ function Xe(e, t) {
|
|
|
1701
2149
|
}), e === r && l.push({
|
|
1702
2150
|
border: s,
|
|
1703
2151
|
side: "bottom"
|
|
1704
|
-
}), i.push(
|
|
2152
|
+
}), i.push(vt(l));
|
|
1705
2153
|
}
|
|
1706
2154
|
a.hSegments.push(i), a.hLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
1707
2155
|
}
|
|
1708
2156
|
return a;
|
|
1709
2157
|
}
|
|
1710
|
-
function
|
|
2158
|
+
function bt(e, t) {
|
|
1711
2159
|
return e.collapsed ? e.vLines.reduce((e, t) => e + t, 0) : (t + 1) * e.spacingX;
|
|
1712
2160
|
}
|
|
1713
|
-
function
|
|
2161
|
+
function xt(e, t, n) {
|
|
1714
2162
|
if (!e.collapsed) return e.spacingX * (n - t - 1);
|
|
1715
2163
|
let r = 0;
|
|
1716
2164
|
for (let i = t + 1; i < n; i++) r += e.vLines[i];
|
|
1717
2165
|
return r;
|
|
1718
2166
|
}
|
|
1719
|
-
function
|
|
2167
|
+
function St(e, t, n) {
|
|
1720
2168
|
if (!e.collapsed) return e.spacingY * (n - t - 1);
|
|
1721
2169
|
let r = 0;
|
|
1722
2170
|
for (let i = t + 1; i < n; i++) r += e.hLines[i];
|
|
1723
2171
|
return r;
|
|
1724
2172
|
}
|
|
1725
|
-
function
|
|
2173
|
+
function Ct(e, t) {
|
|
1726
2174
|
let n = t.tableData.get(e);
|
|
1727
2175
|
if (n) return n;
|
|
1728
|
-
let r =
|
|
2176
|
+
let r = ut(e, t), i = yt(e, r), a = {
|
|
1729
2177
|
structure: r,
|
|
1730
2178
|
chrome: i,
|
|
1731
|
-
bounds:
|
|
1732
|
-
chromeX:
|
|
2179
|
+
bounds: mt(r, i, t),
|
|
2180
|
+
chromeX: bt(i, r.columnCount)
|
|
1733
2181
|
};
|
|
1734
2182
|
return t.tableData.set(e, a), a;
|
|
1735
2183
|
}
|
|
1736
|
-
function
|
|
1737
|
-
let { structure: n, bounds: r, chromeX: i } =
|
|
1738
|
-
return n.caption && (a = Math.max(a,
|
|
2184
|
+
function wt(e, t) {
|
|
2185
|
+
let { structure: n, bounds: r, chromeX: i } = Ct(e, t), a = r.min.reduce((e, t) => e + t, 0) + i, o = r.max.reduce((e, t) => e + t, 0) + i;
|
|
2186
|
+
return n.caption && (a = Math.max(a, Y(n.caption, t)), o = Math.max(o, J(n.caption, t))), {
|
|
1739
2187
|
min: a,
|
|
1740
2188
|
max: o
|
|
1741
2189
|
};
|
|
1742
2190
|
}
|
|
1743
|
-
function
|
|
1744
|
-
let r = e.style, { bounds: i, chromeX: a } =
|
|
2191
|
+
function Tt(e, t, n) {
|
|
2192
|
+
let r = e.style, { bounds: i, chromeX: a } = Ct(e, n), { min: o, max: s } = wt(e, n), c = r.border.left + r.border.right + W(r.padding.left, t) + W(r.padding.right, t), l = i.max.reduce((e, t) => e + t, 0), u = 0, d = 0;
|
|
1745
2193
|
for (let e = 0; e < i.max.length; e++) {
|
|
1746
2194
|
let t = i.percent[e];
|
|
1747
2195
|
t === void 0 ? d += i.max[e] : u += t;
|
|
@@ -1757,8 +2205,8 @@ function nt(e, t, n) {
|
|
|
1757
2205
|
let f = Math.max(l + a, s) + c;
|
|
1758
2206
|
return Math.max(o + c, Math.min(f, t));
|
|
1759
2207
|
}
|
|
1760
|
-
function
|
|
1761
|
-
let { structure: o, chrome: s, bounds: c } =
|
|
2208
|
+
function Et(e, t, n, r, i, a) {
|
|
2209
|
+
let { structure: o, chrome: s, bounds: c } = Ct(e, a), l = o.columnCount, u = o.rows.length, d = r.left + i.left, f = r.top + i.top;
|
|
1762
2210
|
for (let e of o.hidden) e.tableHidden = !0, e.localRect = {
|
|
1763
2211
|
x: 0,
|
|
1764
2212
|
y: 0,
|
|
@@ -1770,14 +2218,14 @@ function rt(e, t, n, r, i, a) {
|
|
|
1770
2218
|
bottom: 0,
|
|
1771
2219
|
left: 0
|
|
1772
2220
|
}, e.unclampedHeight = 0;
|
|
1773
|
-
let p = Math.max(0, t -
|
|
2221
|
+
let p = Math.max(0, t - bt(s, l)), h = e.style, g = h.tableLayout === "fixed" && h.width !== void 0 && h.width.kind !== "auto" ? gt(o, p, a) : ht(c, p), _ = [], v = 0;
|
|
1774
2222
|
for (let e = 0; e < l; e++) v += s.collapsed ? s.vLines[e] : s.spacingX, _.push(v), v += g[e];
|
|
1775
2223
|
let y = v + (s.collapsed ? s.vLines[l] ?? 0 : s.spacingX), b = 0;
|
|
1776
|
-
o.caption && (
|
|
2224
|
+
o.caption && (V(o.caption, t, void 0, d, f, "fill", a), b = o.caption.localRect.height);
|
|
1777
2225
|
let x = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
|
|
1778
2226
|
for (let e of o.cells) {
|
|
1779
|
-
let t = e.col + e.colSpan, n = g.slice(e.col, t).reduce((e, t) => e + t, 0) +
|
|
1780
|
-
S.set(e, n),
|
|
2227
|
+
let t = e.col + e.colSpan, n = g.slice(e.col, t).reduce((e, t) => e + t, 0) + xt(s, e.col, t);
|
|
2228
|
+
S.set(e, n), V(e.node, n, void 0, 0, 0, "fill", a, { width: n }), x.set(e, e.node.localRect.height);
|
|
1781
2229
|
}
|
|
1782
2230
|
let C = s.collapsed ? s.hLines.reduce((e, t) => e + t, 0) : (u + 1) * s.spacingY, w = n === void 0 ? void 0 : Math.max(0, n - b - C), T = (e) => e !== void 0 && e.kind === "percent" && w !== void 0 ? m(e.value, w) : 0, E = Array.from({ length: u }, () => 0), D = Array.from({ length: u }, () => !1);
|
|
1783
2231
|
for (let e = 0; e < u; e++) {
|
|
@@ -1792,9 +2240,9 @@ function rt(e, t, n, r, i, a) {
|
|
|
1792
2240
|
}
|
|
1793
2241
|
let O = o.cells.filter((e) => e.rowSpan > 1).sort((e, t) => e.rowSpan - t.rowSpan);
|
|
1794
2242
|
for (let e of O) {
|
|
1795
|
-
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
2243
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + St(s, e.row, t), r = x.get(e) - n;
|
|
1796
2244
|
if (r <= 0) continue;
|
|
1797
|
-
let i =
|
|
2245
|
+
let i = I(Array.from({ length: e.rowSpan }, () => 1), r);
|
|
1798
2246
|
for (let n = e.row; n < t; n++) E[n] += i[n - e.row];
|
|
1799
2247
|
}
|
|
1800
2248
|
if (n !== void 0 && u > 0) {
|
|
@@ -1802,7 +2250,7 @@ function rt(e, t, n, r, i, a) {
|
|
|
1802
2250
|
if (e > 0) {
|
|
1803
2251
|
let t = [];
|
|
1804
2252
|
for (let e = 0; e < u; e++) D[e] || t.push(e);
|
|
1805
|
-
let n = t.length > 0 ? t : Array.from({ length: u }, (e, t) => t), r =
|
|
2253
|
+
let n = t.length > 0 ? t : Array.from({ length: u }, (e, t) => t), r = I(n.map(() => 1), e);
|
|
1806
2254
|
n.forEach((e, t) => E[e] += r[t]);
|
|
1807
2255
|
}
|
|
1808
2256
|
}
|
|
@@ -1843,75 +2291,75 @@ function rt(e, t, n, r, i, a) {
|
|
|
1843
2291
|
}, t.unclampedHeight = E[e];
|
|
1844
2292
|
}
|
|
1845
2293
|
for (let e of o.cells) {
|
|
1846
|
-
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
1847
|
-
e.node.children.some((e) => !
|
|
2294
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + St(s, e.row, t);
|
|
2295
|
+
e.node.children.some((e) => !B(e.style) && e.style.height?.kind === "percent") && n !== x.get(e) && V(e.node, S.get(e), n, 0, 0, "fill", a, {
|
|
1848
2296
|
width: S.get(e),
|
|
1849
2297
|
height: n
|
|
1850
|
-
}),
|
|
2298
|
+
}), Dt(e.node, n - (e.node.naturalContentHeight ?? e.node.localRect.height)), e.node.localRect = {
|
|
1851
2299
|
x: _[e.col],
|
|
1852
2300
|
y: 0,
|
|
1853
2301
|
width: e.node.localRect.width,
|
|
1854
2302
|
height: n
|
|
1855
2303
|
};
|
|
1856
2304
|
}
|
|
1857
|
-
for (let t of e.children)
|
|
2305
|
+
for (let t of e.children) B(t.style) && (t.staticSlot = {
|
|
1858
2306
|
kind: "block",
|
|
1859
2307
|
x: d,
|
|
1860
2308
|
y: f
|
|
1861
2309
|
});
|
|
1862
|
-
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + M), s.collapsed && l > 0 && u > 0 && (e.decorationRuns =
|
|
2310
|
+
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + M), s.collapsed && l > 0 && u > 0 && (e.decorationRuns = Ot(s, o, g, E, _, A, d, f)), e.style.captionSide === "bottom" ? M + b : M;
|
|
1863
2311
|
}
|
|
1864
|
-
function
|
|
2312
|
+
function Dt(e, t) {
|
|
1865
2313
|
if (t <= 0) return;
|
|
1866
2314
|
let n = e.style.verticalAlign, r = n === "center" ? Math.floor(t / 2) : n === "end" ? t : 0;
|
|
1867
|
-
if (!e.children.some((e) => !
|
|
2315
|
+
if (!e.children.some((e) => !B(e.style) && !e.inlineBox)) {
|
|
1868
2316
|
e.resolvedPadding.top += r, e.resolvedPadding.bottom += t - r;
|
|
1869
2317
|
return;
|
|
1870
2318
|
}
|
|
1871
|
-
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (
|
|
2319
|
+
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (B(t.style) ? t.staticSlot?.kind === "block" && (t.staticSlot.y += r) : t.localRect.y += r);
|
|
1872
2320
|
}
|
|
1873
|
-
function
|
|
1874
|
-
let u = t.columnCount, d = t.rows.length, f = [], p = (t) => t < u ?
|
|
2321
|
+
function Ot(e, t, n, r, o, s, c, l) {
|
|
2322
|
+
let u = t.columnCount, d = t.rows.length, f = [], p = (t) => t < u ? o[t] - e.vLines[t] : o[u - 1] + n[u - 1], m = (t) => t < d ? s[t] - e.hLines[t] : s[d - 1] + r[d - 1];
|
|
1875
2323
|
for (let t = 0; t <= u; t++) {
|
|
1876
2324
|
let n = e.vSegments[t];
|
|
1877
2325
|
for (let e = 0; e < d; e++) {
|
|
1878
|
-
let
|
|
1879
|
-
if (!
|
|
1880
|
-
let o = a
|
|
1881
|
-
for (let n = 0; n <
|
|
2326
|
+
let a = n[e];
|
|
2327
|
+
if (!a) continue;
|
|
2328
|
+
let o = i(a.style, "v");
|
|
2329
|
+
for (let n = 0; n < a.width; n++) for (let i = s[e]; i < s[e] + r[e]; i++) f.push({
|
|
1882
2330
|
glyph: o,
|
|
1883
2331
|
x: c + p(t) + n,
|
|
1884
|
-
y: l +
|
|
2332
|
+
y: l + i,
|
|
1885
2333
|
length: 1,
|
|
1886
|
-
color:
|
|
2334
|
+
color: a.color
|
|
1887
2335
|
});
|
|
1888
2336
|
}
|
|
1889
2337
|
}
|
|
1890
2338
|
for (let t = 0; t <= d; t++) {
|
|
1891
2339
|
let r = e.hSegments[t];
|
|
1892
2340
|
for (let e = 0; e < u; e++) {
|
|
1893
|
-
let
|
|
1894
|
-
if (!
|
|
1895
|
-
let s = a
|
|
1896
|
-
for (let r = 0; r <
|
|
2341
|
+
let a = r[e];
|
|
2342
|
+
if (!a) continue;
|
|
2343
|
+
let s = i(a.style, "h");
|
|
2344
|
+
for (let r = 0; r < a.width; r++) f.push({
|
|
1897
2345
|
glyph: s,
|
|
1898
|
-
x: c +
|
|
2346
|
+
x: c + o[e],
|
|
1899
2347
|
y: l + m(t) + r,
|
|
1900
2348
|
length: n[e],
|
|
1901
|
-
color:
|
|
2349
|
+
color: a.color
|
|
1902
2350
|
});
|
|
1903
2351
|
}
|
|
1904
2352
|
}
|
|
1905
2353
|
for (let t = 0; t <= u; t++) if (!(e.vLines[t] <= 0)) for (let n = 0; n <= d; n++) {
|
|
1906
2354
|
if (e.hLines[n] <= 0) continue;
|
|
1907
|
-
let r = n > 0 ? e.vSegments[t][n - 1] : null, i = n < d ? e.vSegments[t][n] : null,
|
|
2355
|
+
let r = n > 0 ? e.vSegments[t][n - 1] : null, i = n < d ? e.vSegments[t][n] : null, o = t > 0 ? e.hSegments[n][t - 1] : null, s = t < u ? e.hSegments[n][t] : null, h = [
|
|
1908
2356
|
r,
|
|
1909
2357
|
i,
|
|
1910
|
-
|
|
2358
|
+
o,
|
|
1911
2359
|
s
|
|
1912
2360
|
].filter((e) => e !== null);
|
|
1913
2361
|
if (h.length === 0) continue;
|
|
1914
|
-
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width &&
|
|
2362
|
+
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width && _t[t.style] > _t[e.style] ? t : e), v = a(g, r !== null, i !== null, o !== null, s !== null);
|
|
1915
2363
|
for (let r = 0; r < e.vLines[t]; r++) for (let i = 0; i < e.hLines[n]; i++) f.push({
|
|
1916
2364
|
glyph: v,
|
|
1917
2365
|
x: c + p(t) + r,
|
|
@@ -1924,30 +2372,30 @@ function at(e, t, n, r, i, s, c, l) {
|
|
|
1924
2372
|
}
|
|
1925
2373
|
//#endregion
|
|
1926
2374
|
//#region src/positioning.ts
|
|
1927
|
-
function
|
|
2375
|
+
function kt(e) {
|
|
1928
2376
|
return e.position === "absolute" || e.position === "fixed" ? "absolute" : e.position === "relative" || e.position === "sticky" ? "relative" : "static";
|
|
1929
2377
|
}
|
|
1930
|
-
function
|
|
2378
|
+
function At(e, t, n, r, i) {
|
|
1931
2379
|
for (let a of e.children) {
|
|
1932
|
-
let o =
|
|
2380
|
+
let o = kt(a.style);
|
|
1933
2381
|
if (o === "relative") {
|
|
1934
2382
|
let t = e.localRect.width - e.style.border.left - e.style.border.right - e.resolvedPadding.left - e.resolvedPadding.right, n = e.localRect.height - e.style.border.top - e.style.border.bottom - e.resolvedPadding.top - e.resolvedPadding.bottom;
|
|
1935
|
-
a.localRect.x +=
|
|
1936
|
-
} else o === "absolute" &&
|
|
1937
|
-
|
|
2383
|
+
a.localRect.x += jt(a.style.insets.left, a.style.insets.right, t), a.localRect.y += jt(a.style.insets.top, a.style.insets.bottom, n);
|
|
2384
|
+
} else o === "absolute" && Nt(a, e, t, n, r, i);
|
|
2385
|
+
At(a, t + a.localRect.x, n + a.localRect.y, [...r, {
|
|
1938
2386
|
node: a,
|
|
1939
2387
|
absX: t + a.localRect.x,
|
|
1940
2388
|
absY: n + a.localRect.y
|
|
1941
2389
|
}], i);
|
|
1942
2390
|
}
|
|
1943
2391
|
}
|
|
1944
|
-
function
|
|
1945
|
-
return e === null ? t === null ? 0 : -
|
|
2392
|
+
function jt(e, t, n) {
|
|
2393
|
+
return e === null ? t === null ? 0 : -W(t, n) : W(e, n);
|
|
1946
2394
|
}
|
|
1947
|
-
function
|
|
2395
|
+
function Mt(e, t) {
|
|
1948
2396
|
if (!t) for (let t = e.length - 1; t > 0; t--) {
|
|
1949
2397
|
let n = e[t];
|
|
1950
|
-
if (!
|
|
2398
|
+
if (!Vt(n.node.style)) continue;
|
|
1951
2399
|
let r = n.node.style.border;
|
|
1952
2400
|
return {
|
|
1953
2401
|
x: n.absX + r.left,
|
|
@@ -1964,44 +2412,44 @@ function lt(e, t) {
|
|
|
1964
2412
|
height: n.node.localRect.height
|
|
1965
2413
|
};
|
|
1966
2414
|
}
|
|
1967
|
-
function
|
|
1968
|
-
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s &&
|
|
2415
|
+
function Nt(e, t, n, r, i, a) {
|
|
2416
|
+
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s && Vt(t.style) ? {
|
|
1969
2417
|
x: n + c.area.x,
|
|
1970
2418
|
y: r + c.area.y,
|
|
1971
2419
|
width: c.area.width,
|
|
1972
2420
|
height: c.area.height
|
|
1973
|
-
} :
|
|
1974
|
-
if (!y) C.width =
|
|
1975
|
-
else if (u !== null && d !== null) C.width =
|
|
2421
|
+
} : Mt(i, s), u = o.insets.left === null ? null : W(o.insets.left, l.width), d = o.insets.right === null ? null : W(o.insets.right, l.width), f = o.insets.top === null ? null : W(o.insets.top, l.height), p = o.insets.bottom === null ? null : W(o.insets.bottom, l.height), m = G(o.margin, l.width), h = m.left ?? 0, g = m.right ?? 0, _ = m.top ?? 0, v = m.bottom ?? 0, y = o.width === void 0 || o.width.kind === "auto", b = o.height === void 0 || o.height.kind === "auto", x = Xt(o.minWidth, l.width, e, a) ?? 0, S = Xt(o.maxWidth, l.width, e, a), C = {};
|
|
2422
|
+
if (!y) C.width = H(q(o.width, l.width, e, a), x, S);
|
|
2423
|
+
else if (u !== null && d !== null) C.width = H(Math.max(0, l.width - u - d - h - g), x, S);
|
|
1976
2424
|
else {
|
|
1977
2425
|
let t = Math.max(0, l.width - (u ?? 0) - (d ?? 0) - h - g);
|
|
1978
|
-
C.width =
|
|
2426
|
+
C.width = H(Math.min(J(e, a), Math.max(Y(e, a), t)), x, S);
|
|
1979
2427
|
}
|
|
1980
|
-
f !== null && p !== null && b && (C.height =
|
|
2428
|
+
f !== null && p !== null && b && (C.height = H(Math.max(0, l.height - f - p - _ - v), K(o.minHeight, l.height) ?? 0, K(o.maxHeight, l.height))), V(e, l.width, l.height, 0, 0, "shrink", a, C);
|
|
1981
2429
|
let w = e.localRect.width, T = e.localRect.height, E;
|
|
1982
2430
|
if (u !== null && d !== null) {
|
|
1983
2431
|
let e = Math.max(0, l.width - u - d - w - h - g), t = m.left === null && m.right === null;
|
|
1984
2432
|
E = l.x + u + h + (t ? Math.floor(e / 2) : m.left === null ? e : 0);
|
|
1985
|
-
} else E = u === null ? d === null ?
|
|
2433
|
+
} else E = u === null ? d === null ? Rt(e, t, n, w) : l.x + l.width - d - w - g : l.x + u + h;
|
|
1986
2434
|
let D;
|
|
1987
2435
|
if (f !== null && p !== null) {
|
|
1988
2436
|
let e = Math.max(0, l.height - f - p - T - _ - v), t = m.top === null && m.bottom === null;
|
|
1989
2437
|
D = l.y + f + _ + (t ? Math.floor(e / 2) : m.top === null ? e : 0);
|
|
1990
|
-
} else D = f === null ? p === null ?
|
|
2438
|
+
} else D = f === null ? p === null ? zt(e, t, r, T) : l.y + l.height - p - T - v : l.y + f + _;
|
|
1991
2439
|
e.localRect = {
|
|
1992
2440
|
...e.localRect,
|
|
1993
2441
|
x: E - n,
|
|
1994
2442
|
y: D - r
|
|
1995
2443
|
};
|
|
1996
2444
|
}
|
|
1997
|
-
function
|
|
1998
|
-
return
|
|
2445
|
+
function Pt(e, t, n) {
|
|
2446
|
+
return F(e, [n], Math.max(0, t - n))[0];
|
|
1999
2447
|
}
|
|
2000
|
-
function
|
|
2001
|
-
return L(
|
|
2448
|
+
function Ft(e, t, n, r) {
|
|
2449
|
+
return L(ae(e, t), n, r);
|
|
2002
2450
|
}
|
|
2003
|
-
function
|
|
2004
|
-
let a =
|
|
2451
|
+
function It(e, t, n, r, i) {
|
|
2452
|
+
let a = G(e.style.margin, n.innerWidth), [o, s, c, l] = r === "x" ? [
|
|
2005
2453
|
a.left ?? 0,
|
|
2006
2454
|
a.right ?? 0,
|
|
2007
2455
|
n.innerWidth,
|
|
@@ -2012,10 +2460,10 @@ function pt(e, t, n, r, i) {
|
|
|
2012
2460
|
n.innerHeight,
|
|
2013
2461
|
n.direction === "column"
|
|
2014
2462
|
], u = i + o + s;
|
|
2015
|
-
return (l ?
|
|
2463
|
+
return (l ? Pt(le(t.style), c, u) : Ft(e, t, c, u)) + o;
|
|
2016
2464
|
}
|
|
2017
|
-
function
|
|
2018
|
-
let a =
|
|
2465
|
+
function Lt(e, t, n, r, i) {
|
|
2466
|
+
let a = G(e.style.margin, n.width), o = e.style.justifySelf === "auto" ? t.style.justifyItems : e.style.justifySelf, [s, c, l, u] = r === "x" ? [
|
|
2019
2467
|
a.left ?? 0,
|
|
2020
2468
|
a.right ?? 0,
|
|
2021
2469
|
n.width,
|
|
@@ -2024,35 +2472,35 @@ function mt(e, t, n, r, i) {
|
|
|
2024
2472
|
a.top ?? 0,
|
|
2025
2473
|
a.bottom ?? 0,
|
|
2026
2474
|
n.height,
|
|
2027
|
-
|
|
2475
|
+
ae(e, t)
|
|
2028
2476
|
];
|
|
2029
2477
|
return L(u, l, i + s + c) + s;
|
|
2030
2478
|
}
|
|
2031
|
-
function
|
|
2479
|
+
function Rt(e, t, n, r) {
|
|
2032
2480
|
let i = e.staticSlot;
|
|
2033
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x +
|
|
2481
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x + Lt(e, t, i.staticArea, "x", r) : n + i.originX + It(e, t, i, "x", r);
|
|
2034
2482
|
}
|
|
2035
|
-
function
|
|
2483
|
+
function zt(e, t, n, r) {
|
|
2036
2484
|
let i = e.staticSlot;
|
|
2037
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y +
|
|
2485
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y + Lt(e, t, i.staticArea, "y", r) : n + i.originY + It(e, t, i, "y", r);
|
|
2038
2486
|
}
|
|
2039
2487
|
//#endregion
|
|
2040
2488
|
//#region src/layout.ts
|
|
2041
|
-
function
|
|
2042
|
-
let n =
|
|
2043
|
-
return
|
|
2489
|
+
function Bt(e, t) {
|
|
2490
|
+
let n = Ht();
|
|
2491
|
+
return V(e, t, void 0, 0, 0, "fill", n), At(e, 0, 0, [{
|
|
2044
2492
|
node: e,
|
|
2045
2493
|
absX: 0,
|
|
2046
2494
|
absY: 0
|
|
2047
2495
|
}], n), { height: e.localRect.height };
|
|
2048
2496
|
}
|
|
2049
|
-
function
|
|
2497
|
+
function B(e) {
|
|
2050
2498
|
return e.position === "absolute" || e.position === "fixed";
|
|
2051
2499
|
}
|
|
2052
|
-
function
|
|
2500
|
+
function Vt(e) {
|
|
2053
2501
|
return e.position !== "static";
|
|
2054
2502
|
}
|
|
2055
|
-
function
|
|
2503
|
+
function Ht() {
|
|
2056
2504
|
return {
|
|
2057
2505
|
maxContent: /* @__PURE__ */ new WeakMap(),
|
|
2058
2506
|
minContent: /* @__PURE__ */ new WeakMap(),
|
|
@@ -2060,110 +2508,136 @@ function yt() {
|
|
|
2060
2508
|
tableData: /* @__PURE__ */ new WeakMap()
|
|
2061
2509
|
};
|
|
2062
2510
|
}
|
|
2063
|
-
function
|
|
2511
|
+
function V(e, t, n, r, i, a, o, s) {
|
|
2064
2512
|
let c = e.style, l = s?.height;
|
|
2065
|
-
delete e.decorationRuns;
|
|
2066
|
-
let u =
|
|
2067
|
-
top:
|
|
2068
|
-
right:
|
|
2069
|
-
bottom:
|
|
2070
|
-
left:
|
|
2513
|
+
delete e.decorationRuns, delete e.multicolGeometry, delete e.multicolFlow, delete e.multicolFlowSpan;
|
|
2514
|
+
let u = Xt(c.minWidth, t, e, o) ?? 0, d = Xt(c.maxWidth, t, e, o), f = K(c.minHeight, n) ?? 0, p = K(c.maxHeight, n), m = {
|
|
2515
|
+
top: W(c.padding.top, t),
|
|
2516
|
+
right: W(c.padding.right, t),
|
|
2517
|
+
bottom: W(c.padding.bottom, t),
|
|
2518
|
+
left: W(c.padding.left, t)
|
|
2071
2519
|
};
|
|
2072
2520
|
e.resolvedPadding = m;
|
|
2073
|
-
let h = s?.width ??
|
|
2074
|
-
|
|
2075
|
-
if (e.text) {
|
|
2076
|
-
let t = e.children.filter((e) => e.inlineBox);
|
|
2077
|
-
w(e.text, (n, r) => {
|
|
2078
|
-
let i = t[r];
|
|
2079
|
-
W(i, _.width, void 0, 0, 0, "shrink", o), e.advances[n] = Math.max(1, i.localRect.width);
|
|
2080
|
-
});
|
|
2081
|
-
let n = St(e, _.width);
|
|
2082
|
-
if (x = n.totalRows, xt(e, n, _.width, _.height, m), t.length > 0) {
|
|
2083
|
-
let r = (e) => n.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
2084
|
-
w(e.text, (i, a) => {
|
|
2085
|
-
let o = r(i);
|
|
2086
|
-
if (o === -1) return;
|
|
2087
|
-
let s = n.spans[o];
|
|
2088
|
-
t[a].localRect = {
|
|
2089
|
-
...t[a].localRect,
|
|
2090
|
-
x: c.border.left + m.left + b(s.start, i, e.advances),
|
|
2091
|
-
y: c.border.top + m.top + n.lineY[o]
|
|
2092
|
-
};
|
|
2093
|
-
});
|
|
2094
|
-
}
|
|
2095
|
-
} else x = e.intrinsicHeight;
|
|
2096
|
-
for (let t of e.children) {
|
|
2097
|
-
if (t.inlineBox) continue;
|
|
2098
|
-
let e = q(t.style.margin, _.width);
|
|
2099
|
-
t.staticSlot = {
|
|
2100
|
-
kind: "block",
|
|
2101
|
-
x: c.border.left + m.left + (e.left ?? 0),
|
|
2102
|
-
y: c.border.top + m.top + (e.top ?? 0)
|
|
2103
|
-
};
|
|
2104
|
-
}
|
|
2105
|
-
} else x = c.display === "flex" && c.flexDirection === "row" ? k(e, _.width, _.height, y, c.border, m, o) : c.display === "flex" && c.flexDirection === "column" ? j(e, _.width, _.height, v, c.border, m, o) : c.display === "grid" ? se(e, _.width, _.height, c.border, m, o) : c.display === "table" ? rt(e, _.width, y, c.border, m, o) : Tt(e, _.width, y, c.border, m, o);
|
|
2521
|
+
let h = s?.width ?? H(en(c, t, a, e, o), u, d), g = nn(c, n), _ = on(h, l ?? g ?? (f > 0 ? f : void 0) ?? Infinity, c.border, m), v = l !== void 0 || g !== void 0, y = v && Number.isFinite(_.height) ? _.height : void 0, b = p === void 0 ? void 0 : Math.max(0, p - c.border.top - c.border.bottom - m.top - m.bottom), x;
|
|
2522
|
+
x = Wt(e) ? Ut(e, _.width, _.height, y, b, m, o) : c.display === "flex" && c.flexDirection === "row" ? P(e, _.width, _.height, y, c.border, m, o) : c.display === "flex" && c.flexDirection === "column" ? te(e, _.width, _.height, v, c.border, m, o) : c.display === "grid" ? pe(e, _.width, _.height, c.border, m, o) : c.display === "table" ? Et(e, _.width, y, c.border, m, o) : c.display === "multicol" ? rt(e, _.width, y, b, c.border, m, o) : Zt(e, _.width, y, c.border, m, o);
|
|
2106
2523
|
let S = x + c.border.top + c.border.bottom + m.top + m.bottom, C = l ?? g ?? S;
|
|
2107
|
-
e.unclampedHeight = C, e.naturalContentHeight = S
|
|
2524
|
+
e.unclampedHeight = C, e.naturalContentHeight = S;
|
|
2525
|
+
let w = H(C, f, p), T = e.multicolGeometry;
|
|
2526
|
+
if (T) {
|
|
2527
|
+
let t = w - c.border.top - c.border.bottom - m.top - m.bottom;
|
|
2528
|
+
t > T.totalRows && (m.bottom += t - T.totalRows), et(e, T, c.border, m);
|
|
2529
|
+
}
|
|
2530
|
+
e.localRect = {
|
|
2108
2531
|
x: r,
|
|
2109
2532
|
y: i,
|
|
2110
2533
|
width: h,
|
|
2111
|
-
height:
|
|
2534
|
+
height: w
|
|
2112
2535
|
};
|
|
2113
2536
|
}
|
|
2114
|
-
function
|
|
2115
|
-
|
|
2537
|
+
function Ut(e, t, n, r, i, a, o) {
|
|
2538
|
+
let s = e.style, c;
|
|
2539
|
+
if (e.text) {
|
|
2540
|
+
let l = e.children.filter((e) => e.inlineBox);
|
|
2541
|
+
E(e.text, (n, r) => {
|
|
2542
|
+
let i = l[r];
|
|
2543
|
+
V(i, t, void 0, 0, 0, "shrink", o), e.advances[n] = Math.max(1, i.localRect.width);
|
|
2544
|
+
});
|
|
2545
|
+
let u, d;
|
|
2546
|
+
if (s.display === "multicol") {
|
|
2547
|
+
let n = U(s, "x", t), o = Ye(s, t, n);
|
|
2548
|
+
a.right += o.leftover;
|
|
2549
|
+
let c = Ze(e, o, n, qe(r, i));
|
|
2550
|
+
e.multicolGeometry = c, u = c, d = c.lineX;
|
|
2551
|
+
} else u = Kt(e, t);
|
|
2552
|
+
if (c = u.totalRows, Gt(e, u, t, n, a), l.length > 0) {
|
|
2553
|
+
let t = (e) => u.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
2554
|
+
E(e.text, (n, r) => {
|
|
2555
|
+
let i = t(n);
|
|
2556
|
+
if (i === -1) return;
|
|
2557
|
+
let o = u.spans[i];
|
|
2558
|
+
l[r].localRect = {
|
|
2559
|
+
...l[r].localRect,
|
|
2560
|
+
x: s.border.left + a.left + (d?.[i] ?? 0) + S(o.start, n, e.advances),
|
|
2561
|
+
y: s.border.top + a.top + u.lineY[i]
|
|
2562
|
+
};
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
} else c = e.intrinsicHeight;
|
|
2566
|
+
for (let n of e.children) {
|
|
2567
|
+
if (n.inlineBox) continue;
|
|
2568
|
+
let e = G(n.style.margin, t);
|
|
2569
|
+
n.staticSlot = {
|
|
2570
|
+
kind: "block",
|
|
2571
|
+
x: s.border.left + a.left + (e.left ?? 0),
|
|
2572
|
+
y: s.border.top + a.top + (e.top ?? 0)
|
|
2573
|
+
};
|
|
2574
|
+
}
|
|
2575
|
+
return c;
|
|
2576
|
+
}
|
|
2577
|
+
function Wt(e) {
|
|
2578
|
+
return e.children.some((e) => !B(e.style) && !e.inlineBox) ? !1 : e.text !== "" || e.style.display !== "flex" && e.style.display !== "grid";
|
|
2116
2579
|
}
|
|
2117
|
-
function
|
|
2580
|
+
function H(e, t, n) {
|
|
2118
2581
|
return Math.max(t, n === void 0 ? e : Math.min(e, n));
|
|
2119
2582
|
}
|
|
2120
|
-
function
|
|
2583
|
+
function Gt(e, t, n, r, i) {
|
|
2121
2584
|
let a = e.style;
|
|
2122
2585
|
if (a.display !== "flex" && a.display !== "grid" || t.spans.length === 0) return;
|
|
2123
|
-
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t,
|
|
2586
|
+
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t, C(n.start, n.end, e.advances, a.tracking)), 0), c = Math.max(0, n - s);
|
|
2124
2587
|
if (c > 0) {
|
|
2125
|
-
let e = a.display === "grid" ? L(a.justifyItems, n, s) : o ? L(a.alignItems, n, s) :
|
|
2588
|
+
let e = a.display === "grid" ? L(a.justifyItems, n, s) : o ? L(a.alignItems, n, s) : F(le(a), [s], c)[0];
|
|
2126
2589
|
e > 0 && (i.left += e, i.right += c - e);
|
|
2127
2590
|
}
|
|
2128
2591
|
if (Number.isFinite(r)) {
|
|
2129
2592
|
let e = Math.max(0, r - t.totalRows);
|
|
2130
2593
|
if (e > 0) {
|
|
2131
|
-
let n = a.display === "grid" || !o ? L(a.alignItems, r, t.totalRows) :
|
|
2594
|
+
let n = a.display === "grid" || !o ? L(a.alignItems, r, t.totalRows) : F(le(a), [t.totalRows], e)[0];
|
|
2132
2595
|
n > 0 && (i.top += n, i.bottom += e - n);
|
|
2133
2596
|
}
|
|
2134
2597
|
}
|
|
2135
2598
|
}
|
|
2136
|
-
function
|
|
2137
|
-
let n = e
|
|
2599
|
+
function Kt(e, t) {
|
|
2600
|
+
let n = qt(e, t), { heights: r, textOffsets: i } = Jt(e, n), a = [], o = [], s = 0;
|
|
2601
|
+
for (let t = 0; t < n.length; t++) a.push(s), o.push(s + i[t]), s += r[t] + (t < n.length - 1 ? e.style.lineGap : 0);
|
|
2602
|
+
return {
|
|
2603
|
+
spans: n,
|
|
2604
|
+
lineY: a,
|
|
2605
|
+
textY: o,
|
|
2606
|
+
totalRows: s
|
|
2607
|
+
};
|
|
2608
|
+
}
|
|
2609
|
+
function qt(e, t) {
|
|
2610
|
+
return e.style.whiteSpace === "normal" ? x(e.text, t, {
|
|
2138
2611
|
advances: e.advances,
|
|
2139
|
-
tracking: e.style.tracking
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2612
|
+
tracking: e.style.tracking,
|
|
2613
|
+
firstLineIndent: e.style.textIndent
|
|
2614
|
+
}) : b(e.text);
|
|
2615
|
+
}
|
|
2616
|
+
function Jt(e, t) {
|
|
2617
|
+
let n = e.children.filter((e) => e.inlineBox), r = [], i = [], a = 0;
|
|
2618
|
+
for (let o of t) {
|
|
2619
|
+
let t = 1, s = 0;
|
|
2620
|
+
for (let r = o.start; r < o.end; r++) {
|
|
2621
|
+
if (e.text[r] !== "") continue;
|
|
2622
|
+
let i = n[a];
|
|
2623
|
+
t = Math.max(t, i.localRect.height), i.style.verticalAlign === "end" ? s = Math.max(s, i.localRect.height - 1) : i.style.verticalAlign === "center" && at(i.source, "vertical-align: middle on an inline box can't land on whole rows and behaves as top. Use align-top or align-bottom."), a++;
|
|
2148
2624
|
}
|
|
2149
|
-
|
|
2625
|
+
r.push(t), i.push(Math.min(s, t - 1));
|
|
2150
2626
|
}
|
|
2151
2627
|
return {
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
textY: a,
|
|
2155
|
-
totalRows: o
|
|
2628
|
+
heights: r,
|
|
2629
|
+
textOffsets: i
|
|
2156
2630
|
};
|
|
2157
2631
|
}
|
|
2158
|
-
function
|
|
2159
|
-
let r =
|
|
2632
|
+
function U(e, t, n) {
|
|
2633
|
+
let r = W(t === "x" ? e.gapX : e.gapY, n), i = t === "x" ? e.ruleX : e.ruleY;
|
|
2160
2634
|
return Math.max(r, i?.width ?? 0);
|
|
2161
2635
|
}
|
|
2162
|
-
function
|
|
2636
|
+
function W(e, t) {
|
|
2163
2637
|
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 : m(e.percent, t);
|
|
2164
2638
|
}
|
|
2165
|
-
function
|
|
2166
|
-
let n = (e) => e === null ? null :
|
|
2639
|
+
function G(e, t) {
|
|
2640
|
+
let n = (e) => e === null ? null : W(e, t);
|
|
2167
2641
|
return {
|
|
2168
2642
|
top: n(e.top),
|
|
2169
2643
|
right: n(e.right),
|
|
@@ -2171,110 +2645,113 @@ function q(e, t) {
|
|
|
2171
2645
|
left: n(e.left)
|
|
2172
2646
|
};
|
|
2173
2647
|
}
|
|
2174
|
-
function
|
|
2648
|
+
function Yt(e) {
|
|
2175
2649
|
return typeof e == "number" ? e : 0;
|
|
2176
2650
|
}
|
|
2177
|
-
function
|
|
2651
|
+
function K(e, t) {
|
|
2178
2652
|
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 : m(e.percent, t);
|
|
2179
2653
|
}
|
|
2180
|
-
function
|
|
2181
|
-
return e === "min-content" || e === "max-content" || e === "fit-content" ?
|
|
2654
|
+
function Xt(e, t, n, r) {
|
|
2655
|
+
return e === "min-content" || e === "max-content" || e === "fit-content" ? q({ kind: e }, t, n, r) : K(e, t);
|
|
2182
2656
|
}
|
|
2183
|
-
function
|
|
2657
|
+
function Zt(e, t, n, r, i, a) {
|
|
2184
2658
|
let o = r.left + i.left, s = r.top + i.top, c = s, l = null;
|
|
2185
2659
|
for (let r of e.children) {
|
|
2186
|
-
let e =
|
|
2187
|
-
if (
|
|
2660
|
+
let e = G(r.style.margin, t), i = e.top ?? 0, s = e.bottom ?? 0, u = e.left ?? 0, d = e.right ?? 0;
|
|
2661
|
+
if (B(r.style)) {
|
|
2188
2662
|
r.staticSlot = {
|
|
2189
2663
|
kind: "block",
|
|
2190
2664
|
x: o + u,
|
|
2191
|
-
y: c + (l === null ? i :
|
|
2665
|
+
y: c + (l === null ? i : $t(l, i))
|
|
2192
2666
|
};
|
|
2193
2667
|
continue;
|
|
2194
2668
|
}
|
|
2195
|
-
|
|
2196
|
-
let f = t
|
|
2197
|
-
|
|
2198
|
-
let h;
|
|
2199
|
-
h = p ? Math.floor(f / 2) : m ? f - d : u, c += l === null ? i : Et(l, i), r.localRect = {
|
|
2669
|
+
V(r, Math.max(0, t - u - d), n, 0, 0, "fill", a);
|
|
2670
|
+
let f = Qt(e, t, r.localRect.width);
|
|
2671
|
+
c += l === null ? i : $t(l, i), r.localRect = {
|
|
2200
2672
|
...r.localRect,
|
|
2201
|
-
x: o +
|
|
2673
|
+
x: o + f,
|
|
2202
2674
|
y: c
|
|
2203
2675
|
}, c += r.localRect.height, l = s;
|
|
2204
2676
|
}
|
|
2205
2677
|
return l !== null && (c += l), c - s;
|
|
2206
2678
|
}
|
|
2207
|
-
function
|
|
2679
|
+
function Qt(e, t, n) {
|
|
2680
|
+
let r = t - n;
|
|
2681
|
+
return e.left === null && e.right === null ? Math.floor(r / 2) : e.left === null ? r - (e.right ?? 0) : e.left;
|
|
2682
|
+
}
|
|
2683
|
+
function $t(e, t) {
|
|
2208
2684
|
return e >= 0 && t >= 0 ? Math.max(e, t) : e <= 0 && t <= 0 ? Math.min(e, t) : e + t;
|
|
2209
2685
|
}
|
|
2210
|
-
function
|
|
2686
|
+
function en(e, t, n, r, i) {
|
|
2211
2687
|
let a = e.width;
|
|
2212
2688
|
if (e.display === "table") {
|
|
2213
|
-
if (!r.children.some((e) => !
|
|
2689
|
+
if (!r.children.some((e) => !B(e.style) && !e.inlineBox)) return a !== void 0 && a.kind !== "auto" ? q(a, t, r, i) : Math.min(t, J(r, i));
|
|
2214
2690
|
if (a !== void 0 && a.kind !== "auto") {
|
|
2215
|
-
let e =
|
|
2216
|
-
return Math.max(e,
|
|
2691
|
+
let e = q(a, t, r, i);
|
|
2692
|
+
return Math.max(e, tn(r, t, i));
|
|
2217
2693
|
}
|
|
2218
|
-
return
|
|
2694
|
+
return Tt(r, t, i);
|
|
2219
2695
|
}
|
|
2220
|
-
return a !== void 0 && a.kind !== "auto" ?
|
|
2696
|
+
return a !== void 0 && a.kind !== "auto" ? q(a, t, r, i) : n === "shrink" ? Math.min(t, J(r, i)) : t;
|
|
2221
2697
|
}
|
|
2222
|
-
function
|
|
2698
|
+
function tn(e, t, n) {
|
|
2223
2699
|
let r = e.style;
|
|
2224
|
-
return
|
|
2700
|
+
return wt(e, n).min + r.border.left + r.border.right + W(r.padding.left, t) + W(r.padding.right, t);
|
|
2225
2701
|
}
|
|
2226
|
-
function
|
|
2702
|
+
function nn(e, t) {
|
|
2227
2703
|
if (e.height?.kind === "cells") return e.height.value;
|
|
2228
2704
|
if (e.height?.kind === "percent" && t != null) return m(e.height.value, t);
|
|
2229
2705
|
}
|
|
2230
|
-
function
|
|
2706
|
+
function q(e, t, n, r) {
|
|
2231
2707
|
switch (e.kind) {
|
|
2232
2708
|
case "cells": return e.value;
|
|
2233
2709
|
case "percent": return m(e.value, t);
|
|
2234
|
-
case "min-content": return
|
|
2235
|
-
case "max-content": return
|
|
2236
|
-
case "fit-content": return Math.min(
|
|
2237
|
-
case "auto": return
|
|
2710
|
+
case "min-content": return Y(n, r);
|
|
2711
|
+
case "max-content": return J(n, r);
|
|
2712
|
+
case "fit-content": return Math.min(J(n, r), Math.max(Y(n, r), t));
|
|
2713
|
+
case "auto": return J(n, r);
|
|
2238
2714
|
}
|
|
2239
2715
|
}
|
|
2240
|
-
function
|
|
2716
|
+
function J(e, t) {
|
|
2241
2717
|
let n = t.maxContent.get(e);
|
|
2242
2718
|
if (n !== void 0) return n;
|
|
2243
|
-
let r = e.style, i =
|
|
2719
|
+
let r = e.style, i = rn(e, t) + r.border.left + r.border.right + Yt(r.padding.left) + Yt(r.padding.right);
|
|
2244
2720
|
return t.maxContent.set(e, i), i;
|
|
2245
2721
|
}
|
|
2246
|
-
function
|
|
2247
|
-
let n = e.children.filter((e) => !
|
|
2248
|
-
if (n.length === 0) return e.intrinsicWidth;
|
|
2249
|
-
if (e.style.display === "grid") return
|
|
2250
|
-
if (e.style.display === "table") return
|
|
2722
|
+
function rn(e, t) {
|
|
2723
|
+
let n = e.children.filter((e) => !B(e.style) && !e.inlineBox);
|
|
2724
|
+
if (n.length === 0) return e.style.display === "multicol" ? Ke(e.style, e.intrinsicWidth) : e.intrinsicWidth;
|
|
2725
|
+
if (e.style.display === "grid") return Se(e, t).max;
|
|
2726
|
+
if (e.style.display === "table") return wt(e, t).max;
|
|
2251
2727
|
if (e.style.display === "flex" && e.style.flexDirection === "row") {
|
|
2252
|
-
let r = Math.max(
|
|
2253
|
-
return n.reduce((e, n) => e +
|
|
2728
|
+
let r = Math.max(Yt(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
2729
|
+
return n.reduce((e, n) => e + J(n, t), 0) + r;
|
|
2254
2730
|
}
|
|
2255
|
-
|
|
2731
|
+
let r = n.reduce((e, n) => Math.max(e, J(n, t)), 0);
|
|
2732
|
+
return e.style.display === "multicol" ? Ke(e.style, r) : r;
|
|
2256
2733
|
}
|
|
2257
|
-
function
|
|
2734
|
+
function Y(e, t) {
|
|
2258
2735
|
let n = t.minContent.get(e);
|
|
2259
2736
|
if (n !== void 0) return n;
|
|
2260
|
-
let r = e.style, i =
|
|
2737
|
+
let r = e.style, i = an(e, t) + r.border.left + r.border.right + Yt(r.padding.left) + Yt(r.padding.right);
|
|
2261
2738
|
return t.minContent.set(e, i), i;
|
|
2262
2739
|
}
|
|
2263
|
-
function
|
|
2264
|
-
let n = e.children.filter((e) => !
|
|
2265
|
-
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth :
|
|
2740
|
+
function an(e, t) {
|
|
2741
|
+
let n = e.children.filter((e) => !B(e.style) && !e.inlineBox);
|
|
2742
|
+
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth : T(e.text, {
|
|
2266
2743
|
advances: e.advances,
|
|
2267
2744
|
tracking: e.style.tracking
|
|
2268
2745
|
});
|
|
2269
|
-
if (e.style.display === "grid") return
|
|
2270
|
-
if (e.style.display === "table") return
|
|
2746
|
+
if (e.style.display === "grid") return Se(e, t).min;
|
|
2747
|
+
if (e.style.display === "table") return wt(e, t).min;
|
|
2271
2748
|
if (e.style.display === "flex" && e.style.flexDirection === "row" && e.style.flexWrap === "nowrap") {
|
|
2272
|
-
let r = Math.max(
|
|
2273
|
-
return n.reduce((e, n) => e +
|
|
2749
|
+
let r = Math.max(Yt(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
2750
|
+
return n.reduce((e, n) => e + Y(n, t), 0) + r;
|
|
2274
2751
|
}
|
|
2275
|
-
return n.reduce((e, n) => Math.max(e,
|
|
2752
|
+
return n.reduce((e, n) => Math.max(e, Y(n, t)), 0);
|
|
2276
2753
|
}
|
|
2277
|
-
function
|
|
2754
|
+
function on(e, t, n, r) {
|
|
2278
2755
|
return {
|
|
2279
2756
|
width: Math.max(0, e - n.left - n.right - r.left - r.right),
|
|
2280
2757
|
height: Math.max(0, t - n.top - n.bottom - r.top - r.bottom)
|
|
@@ -2282,42 +2759,63 @@ function Mt(e, t, n, r) {
|
|
|
2282
2759
|
}
|
|
2283
2760
|
//#endregion
|
|
2284
2761
|
//#region src/plain-text.ts
|
|
2285
|
-
function
|
|
2286
|
-
return
|
|
2287
|
-
}
|
|
2288
|
-
function
|
|
2289
|
-
let { grid: t, paints: n } =
|
|
2290
|
-
return t.map((e, t) =>
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2762
|
+
function sn(e) {
|
|
2763
|
+
return pn(e).grid.map((e) => e.join("").trimEnd()).join("\n");
|
|
2764
|
+
}
|
|
2765
|
+
function cn(e) {
|
|
2766
|
+
let { grid: t, paints: n } = pn(e);
|
|
2767
|
+
return t.map((e, t) => ln(e, n[t]));
|
|
2768
|
+
}
|
|
2769
|
+
function ln(e, t) {
|
|
2770
|
+
let n = e.length;
|
|
2771
|
+
for (; n > 0 && e[n - 1] === " " && t[n - 1]?.backgroundColor === void 0;) n--;
|
|
2772
|
+
let r = [];
|
|
2773
|
+
for (let i = 0; i < n; i++) {
|
|
2774
|
+
let n = t[i], a = r[r.length - 1];
|
|
2775
|
+
a && un(a, n) ? a.text += e[i] : r.push({
|
|
2776
|
+
text: e[i],
|
|
2777
|
+
...n
|
|
2778
|
+
});
|
|
2779
|
+
}
|
|
2780
|
+
return r;
|
|
2781
|
+
}
|
|
2782
|
+
function un(e, t) {
|
|
2783
|
+
return e.color === t?.color && e.backgroundColor === t?.backgroundColor && e.fontWeight === t?.fontWeight && e.fontStyle === t?.fontStyle && e.textDecorationLine === t?.textDecorationLine;
|
|
2784
|
+
}
|
|
2785
|
+
function dn(e, t) {
|
|
2786
|
+
e.color !== void 0 && (t.color = e.color), e.backgroundColor !== void 0 && (t.backgroundColor = e.backgroundColor), e.fontWeight !== void 0 && (t.fontWeight = e.fontWeight), e.fontStyle !== void 0 && (t.fontStyle = e.fontStyle), e.textDecorationLine !== void 0 && (t.textDecoration = e.textDecorationLine);
|
|
2301
2787
|
}
|
|
2302
|
-
function
|
|
2303
|
-
return e.color ===
|
|
2788
|
+
function fn(e) {
|
|
2789
|
+
return e.color === void 0 && e.backgroundColor === void 0 && e.fontWeight === void 0 && e.fontStyle === void 0 && e.textDecorationLine === void 0;
|
|
2304
2790
|
}
|
|
2305
|
-
function
|
|
2791
|
+
function pn(e) {
|
|
2306
2792
|
let t = Math.max(0, e.localRect.width), n = Math.max(0, e.localRect.height), r = Array.from({ length: n }, () => Array.from({ length: t }, () => " ")), i = Array.from({ length: n }, () => Array.from({ length: t }, () => void 0));
|
|
2307
|
-
return
|
|
2308
|
-
e >= 0 && e < t && a >= 0 && a < n
|
|
2793
|
+
return hn(e, 0, 0, (e, a, o, s) => {
|
|
2794
|
+
if (e >= 0 && e < t && a >= 0 && a < n) {
|
|
2795
|
+
r[a][e] = o;
|
|
2796
|
+
let t = i[a][e];
|
|
2797
|
+
i[a][e] = t ? {
|
|
2798
|
+
...t,
|
|
2799
|
+
...s
|
|
2800
|
+
} : s;
|
|
2801
|
+
}
|
|
2309
2802
|
}), {
|
|
2310
2803
|
grid: r,
|
|
2311
2804
|
paints: i
|
|
2312
2805
|
};
|
|
2313
2806
|
}
|
|
2314
|
-
function
|
|
2807
|
+
function mn(e) {
|
|
2315
2808
|
let t = {};
|
|
2316
|
-
return e.color && (t.color = e.color), 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;
|
|
2809
|
+
return e.color && (t.color = e.color), e.backgroundColor && (t.backgroundColor = e.backgroundColor), e.fontWeight !== "400" && e.fontWeight !== "normal" && e.fontWeight !== "" && (t.fontWeight = e.fontWeight), e.fontStyle !== "normal" && e.fontStyle !== "" && (t.fontStyle = e.fontStyle), e.textDecorationLine !== "none" && e.textDecorationLine !== "" && (t.textDecorationLine = e.textDecorationLine), t;
|
|
2317
2810
|
}
|
|
2318
|
-
function
|
|
2811
|
+
function hn(t, n, i, a) {
|
|
2319
2812
|
if (t.tableHidden) return;
|
|
2320
|
-
let o = n + t.localRect.x, s =
|
|
2813
|
+
let o = n + t.localRect.x, s = i + t.localRect.y, c = t.style;
|
|
2814
|
+
if (c.backgroundColor !== void 0 || c.backgroundClear) {
|
|
2815
|
+
let e = c.backgroundColor === void 0 ? void 0 : { backgroundColor: c.backgroundColor };
|
|
2816
|
+
for (let n = 0; n < t.localRect.height; n++) for (let r = 0; r < t.localRect.width; r++) a(o + r, s + n, " ", e);
|
|
2817
|
+
}
|
|
2818
|
+
let l = [];
|
|
2321
2819
|
e(c, {
|
|
2322
2820
|
x: o,
|
|
2323
2821
|
y: s,
|
|
@@ -2333,45 +2831,74 @@ function Rt(t, n, r, a) {
|
|
|
2333
2831
|
for (let n = 0; n < e.length; n++) a(o + e.x + n, s + e.y, e.glyph, t);
|
|
2334
2832
|
}
|
|
2335
2833
|
if (!t.children.some((e) => !e.inlineBox && e.style.position !== "absolute" && e.style.position !== "fixed") && t.text) {
|
|
2336
|
-
let e = t.resolvedPadding, n = o + c.border.left + e.left, r = s + c.border.top + e.top, i = t.localRect.width - c.border.left - c.border.right - e.left - e.right, { spans:
|
|
2337
|
-
for (let e = 0; e <
|
|
2338
|
-
let
|
|
2339
|
-
end:
|
|
2834
|
+
let e = t.resolvedPadding, n = o + c.border.left + e.left, r = s + c.border.top + e.top, i = t.localRect.width - c.border.left - c.border.right - e.left - e.right, l = t.multicolGeometry, { spans: u, textY: d } = l ?? Kt(t, i), f = l ? Math.max(1, l.columnWidth - c.tracking) : i, p = mn(c), m = t.inlineElements?.map((e) => mn(e));
|
|
2835
|
+
for (let e = 0; e < u.length; e++) {
|
|
2836
|
+
let i = u[e], o = r + d[e], s = e === 0 ? c.textIndent : 0, h = c.whiteSpace !== "normal" && c.overflow === "clip" ? gn(t.text, i, f - s, t.advances, c) : {
|
|
2837
|
+
end: i.end,
|
|
2340
2838
|
ellipsis: !1
|
|
2341
|
-
},
|
|
2342
|
-
for (let e =
|
|
2343
|
-
if (t.text[e] !== ""
|
|
2344
|
-
let n = t.charInline?.[e] ?? -1, r = n >= 0 ? t.inlineElements[n] : void 0, i = r?.insets,
|
|
2345
|
-
a(
|
|
2839
|
+
}, g = C(i.start, i.end, t.advances, c.tracking), _ = Math.max(0, f - s - g), v = c.textAlign === "end" ? _ : c.textAlign === "center" ? Math.floor(_ / 2) : 0, y = n + (l?.lineX[e] ?? 0) + v + s;
|
|
2840
|
+
for (let e = i.start; e < h.end; e++) {
|
|
2841
|
+
if (t.text[e] !== "") {
|
|
2842
|
+
let n = t.charInline?.[e] ?? -1, r = n >= 0 ? t.inlineElements[n] : void 0, i = r?.insets, s = i ? i.left ?? (i.right === null ? 0 : -i.right) : 0, c = i ? i.top ?? (i.bottom === null ? 0 : -i.bottom) : 0;
|
|
2843
|
+
t.text[e] === "" ? r?.backgroundColor && a(y + s, o + c, " ", { backgroundColor: r.backgroundColor }) : a(y + s, o + c, t.text[e], r ? m[n] : p);
|
|
2346
2844
|
}
|
|
2347
|
-
|
|
2845
|
+
y += S(e, e + 1, t.advances);
|
|
2348
2846
|
}
|
|
2349
|
-
|
|
2847
|
+
h.ellipsis && a(y, o, "…", p);
|
|
2350
2848
|
}
|
|
2351
2849
|
}
|
|
2352
|
-
for (let e of
|
|
2850
|
+
for (let e of r(t)) hn(e, o, s, a);
|
|
2353
2851
|
}
|
|
2354
|
-
function
|
|
2852
|
+
function gn(e, t, n, r, i) {
|
|
2355
2853
|
let { textOverflow: a, tracking: o } = i;
|
|
2356
|
-
if (
|
|
2854
|
+
if (C(t.start, t.end, r, o) <= n) return {
|
|
2357
2855
|
end: t.end,
|
|
2358
2856
|
ellipsis: !1
|
|
2359
2857
|
};
|
|
2360
2858
|
let s = a === "ellipsis" ? n - 1 : n, c = t.start;
|
|
2361
|
-
for (; c < t.end &&
|
|
2859
|
+
for (; c < t.end && C(t.start, c + 1, r, o) <= s;) c++;
|
|
2362
2860
|
return {
|
|
2363
2861
|
end: c,
|
|
2364
2862
|
ellipsis: a === "ellipsis" && n > 0
|
|
2365
2863
|
};
|
|
2366
2864
|
}
|
|
2367
2865
|
//#endregion
|
|
2866
|
+
//#region src/paint.ts
|
|
2867
|
+
var _n = /* @__PURE__ */ new WeakMap();
|
|
2868
|
+
function vn(e, t) {
|
|
2869
|
+
let n = cn(e), r = yn(n);
|
|
2870
|
+
if (_n.get(t) === r) return;
|
|
2871
|
+
_n.set(t, r);
|
|
2872
|
+
let i = document.createDocumentFragment();
|
|
2873
|
+
for (let e = 0; e < n.length; e++) {
|
|
2874
|
+
e > 0 && i.appendChild(document.createTextNode("\n"));
|
|
2875
|
+
for (let t of n[e]) {
|
|
2876
|
+
if (fn(t)) {
|
|
2877
|
+
i.appendChild(document.createTextNode(t.text));
|
|
2878
|
+
continue;
|
|
2879
|
+
}
|
|
2880
|
+
let e = document.createElement("span");
|
|
2881
|
+
dn(t, e.style), e.textContent = t.text, i.appendChild(e);
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
t.replaceChildren(i);
|
|
2885
|
+
}
|
|
2886
|
+
function yn(e) {
|
|
2887
|
+
let t = [];
|
|
2888
|
+
for (let n of e) {
|
|
2889
|
+
for (let e of n) t.push(e.text, e.color ?? "", e.backgroundColor ?? "", e.fontWeight ?? "", e.fontStyle ?? "", e.textDecorationLine ?? "");
|
|
2890
|
+
t.push("\n");
|
|
2891
|
+
}
|
|
2892
|
+
return t.join("");
|
|
2893
|
+
}
|
|
2894
|
+
//#endregion
|
|
2368
2895
|
//#region src/render.ts
|
|
2369
|
-
function
|
|
2370
|
-
let
|
|
2371
|
-
|
|
2372
|
-
for (let
|
|
2373
|
-
|
|
2374
|
-
let e =
|
|
2896
|
+
function bn(e) {
|
|
2897
|
+
let t = /* @__PURE__ */ new Set();
|
|
2898
|
+
xn(e, !0, t);
|
|
2899
|
+
for (let n of Array.from(e.source.querySelectorAll("[data-mw-inline-inset]"))) if (!t.has(n)) {
|
|
2900
|
+
n.removeAttribute("data-mw-inline-inset");
|
|
2901
|
+
let e = n.style;
|
|
2375
2902
|
for (let t of [
|
|
2376
2903
|
"--mw-it",
|
|
2377
2904
|
"--mw-ir",
|
|
@@ -2380,161 +2907,170 @@ function Bt(e, t) {
|
|
|
2380
2907
|
]) e.removeProperty(t);
|
|
2381
2908
|
}
|
|
2382
2909
|
}
|
|
2383
|
-
function
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
for (let e of i(t)) {
|
|
2401
|
-
let r = e.source;
|
|
2402
|
-
e.style.zIndex !== null && n(e, t) && !e.inlineBox ? r.style.setProperty("--mw-z", String(e.style.zIndex)) : r.style.removeProperty("--mw-z"), Vt(e, l, u, o, !1, c);
|
|
2403
|
-
}
|
|
2910
|
+
function X(e, t, n) {
|
|
2911
|
+
e.style.getPropertyValue(t) !== n && e.style.setProperty(t, n);
|
|
2912
|
+
}
|
|
2913
|
+
function Z(e, t) {
|
|
2914
|
+
e.style.getPropertyValue(t) !== "" && e.style.removeProperty(t);
|
|
2915
|
+
}
|
|
2916
|
+
function Q(e, t, n) {
|
|
2917
|
+
e.hasAttribute(t) !== n && (n ? e.setAttribute(t, "") : e.removeAttribute(t));
|
|
2918
|
+
}
|
|
2919
|
+
function xn(e, t, i) {
|
|
2920
|
+
if (e.inlineElements) for (let { element: t, tracking: n, padLeft: r, padRight: a, insets: o } of e.inlineElements) {
|
|
2921
|
+
let e = t;
|
|
2922
|
+
X(e, "--mw-ls", String(n)), r > 0 ? X(e, "--mw-ipl", String(r)) : Z(e, "--mw-ipl"), a > 0 ? X(e, "--mw-ipr", String(a)) : Z(e, "--mw-ipr"), o && (i.add(t), Sn(e, o));
|
|
2923
|
+
}
|
|
2924
|
+
if (t || wn(e), !e.tableHidden) for (let t of r(e)) {
|
|
2925
|
+
let r = t.source;
|
|
2926
|
+
t.style.zIndex !== null && n(t, e) && !t.inlineBox ? X(r, "--mw-z", String(t.style.zIndex)) : Z(r, "--mw-z"), xn(t, !1, i);
|
|
2404
2927
|
}
|
|
2405
2928
|
}
|
|
2406
|
-
function
|
|
2407
|
-
e
|
|
2929
|
+
function Sn(e, t) {
|
|
2930
|
+
Q(e, "data-mw-inline-inset", !0);
|
|
2408
2931
|
let n = (t, n) => {
|
|
2409
|
-
n === null ? e
|
|
2932
|
+
n === null ? Z(e, t) : X(e, t, String(n));
|
|
2410
2933
|
};
|
|
2411
2934
|
n("--mw-it", t.top), n("--mw-ir", t.right), n("--mw-ib", t.bottom), n("--mw-il", t.left);
|
|
2412
2935
|
}
|
|
2413
|
-
function
|
|
2414
|
-
let t = e.
|
|
2415
|
-
t.
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
let n = document.createElement("span");
|
|
2430
|
-
n.setAttribute("aria-hidden", "true"), n.style.position = "absolute", n.style.left = `calc(${t.x} * var(--mw-cw))`, n.style.top = `calc(${t.y} * var(--mw-ch))`, n.style.font = "inherit", n.style.lineHeight = "inherit", n.style.whiteSpace = "pre", n.style.pointerEvents = "none", n.style.userSelect = "none", t.color && (n.style.color = t.color), n.textContent = t.glyph, e.appendChild(n);
|
|
2431
|
-
}
|
|
2936
|
+
function Cn(e) {
|
|
2937
|
+
let t = e.style;
|
|
2938
|
+
if (t.textAlign !== "center" || !e.text || e.inlineBox || e.children.length > 0) return !1;
|
|
2939
|
+
let n = e.multicolGeometry, r = e.resolvedPadding, i = e.localRect.width - t.border.left - t.border.right - r.left - r.right, a = n ? Math.max(1, n.columnWidth - t.tracking) : i, o = n?.spans ?? qt(e, i);
|
|
2940
|
+
return o.length !== 0 && o.every((n, r) => {
|
|
2941
|
+
let i = r === 0 ? t.textIndent : 0, o = a - i - C(n.start, n.end, e.advances, t.tracking);
|
|
2942
|
+
return o > 0 && o % 2 == 1;
|
|
2943
|
+
});
|
|
2944
|
+
}
|
|
2945
|
+
function wn(e) {
|
|
2946
|
+
let t = e.source, n = e.localRect, r = e.resolvedPadding, { border: i, textAlignBlocked: a, overflow: o, whiteSpace: s, tracking: c, lineGap: l } = e.style, u = e.multicolFlow, d = e.multicolFlowSpan;
|
|
2947
|
+
Q(t, "data-mw-laid-out", !e.inlineBox && !u && !d), Q(t, "data-mw-inline-box", !!e.inlineBox), Q(t, "data-mw-multicol-flow", !!u), Q(t, "data-mw-multicol-flow-span", !!d);
|
|
2948
|
+
let f = u ?? d;
|
|
2949
|
+
f ? (X(t, "--mw-mt", String(f.top ?? 0)), X(t, "--mw-mr", String(f.right ?? 0)), X(t, "--mw-mb", String(f.bottom ?? 0)), X(t, "--mw-ml", String(f.left ?? 0))) : (Z(t, "--mw-mt"), Z(t, "--mw-mr"), Z(t, "--mw-mb"), Z(t, "--mw-ml")), Q(t, "data-mw-vbottom", !!e.inlineBox && e.style.verticalAlign === "end"), X(t, "--mw-ls", String(c)), X(t, "--mw-lh", String(l + 1)), X(t, "--mw-lhs", String(-l / 2)), Q(t, "data-mw-nowrap", s !== "normal");
|
|
2950
|
+
let p = u || d ? void 0 : e.multicolGeometry;
|
|
2951
|
+
Q(t, "data-mw-multicol", !!p), Q(t, "data-mw-multicol-balance", !!p?.nativeBalance), p ? (X(t, "--mw-colc", String(p.columnCount)), X(t, "--mw-colg", String(p.gap))) : (Z(t, "--mw-colc"), Z(t, "--mw-colg")), Q(t, "data-mw-pre", s === "pre"), X(t, "--mw-x", String(n.x)), X(t, "--mw-y", String(n.y)), X(t, "--mw-w", String(n.width)), X(t, "--mw-h", String(n.height)), Q(t, "data-mw-clip", o === "clip"), X(t, "--mw-pt", String(r.top)), X(t, "--mw-pr", String(r.right)), X(t, "--mw-pb", String(r.bottom)), X(t, "--mw-pl", String(r.left)), X(t, "--mw-bt", String(i.top)), X(t, "--mw-br", String(i.right)), X(t, "--mw-bb", String(i.bottom)), X(t, "--mw-bl", String(i.left)), X(t, "--mw-ti", String(e.style.textIndent)), Q(t, "data-mw-text-align-blocked", a), Q(t, "data-mw-center-nudge", Cn(e)), Q(t, "data-mw-dropped-text", !!e.droppedText), Q(t, "data-mw-table-hidden", !!e.tableHidden);
|
|
2432
2952
|
}
|
|
2433
2953
|
//#endregion
|
|
2434
2954
|
//#region src/style.ts
|
|
2435
|
-
function
|
|
2436
|
-
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a =
|
|
2437
|
-
|
|
2438
|
-
let c = r.display ||
|
|
2955
|
+
function Tn(e, t, n) {
|
|
2956
|
+
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a = Rn(e) ? e.computedStyleMap() : null, o = e.getAttribute("class") ?? "", s = e.style;
|
|
2957
|
+
Nn(e, o, s);
|
|
2958
|
+
let c = r.display || An[e.tagName] || "", l = jn[c] ?? "none", u = r.columnCount && r.columnCount !== "auto" ? Math.max(1, Math.floor(Number(r.columnCount) || 1)) : null, d = r.columnWidth && r.columnWidth !== "auto" ? parseFloat(r.columnWidth) : NaN, m = Number.isFinite(d) ? Math.max(1, p(d, t)) : null, h = c === "flex" || c === "inline-flex" ? "flex" : c === "grid" || c === "inline-grid" ? "grid" : c === "table" || c === "inline-table" ? "table" : c === "none" || kn(r) ? "none" : u !== null || m !== null ? "multicol" : "block", g = { kind: "none" }, _ = { kind: "none" }, v = [fe()], y = [fe()], b = {
|
|
2439
2959
|
direction: "row",
|
|
2440
2960
|
dense: !1
|
|
2441
|
-
},
|
|
2442
|
-
if (
|
|
2443
|
-
if (a)
|
|
2961
|
+
}, x = null;
|
|
2962
|
+
if (h === "grid") {
|
|
2963
|
+
if (a) g = rr(a.get("grid-template-columns")?.toString() ?? "", t), _ = rr(a.get("grid-template-rows")?.toString() ?? "", t);
|
|
2444
2964
|
else {
|
|
2445
2965
|
e.setAttribute("data-mw-degrid", "");
|
|
2446
2966
|
try {
|
|
2447
|
-
|
|
2967
|
+
g = rr(r.getPropertyValue("grid-template-columns"), t), _ = rr(r.getPropertyValue("grid-template-rows"), t);
|
|
2448
2968
|
} finally {
|
|
2449
2969
|
e.removeAttribute("data-mw-degrid");
|
|
2450
2970
|
}
|
|
2451
2971
|
}
|
|
2452
|
-
|
|
2972
|
+
v = sr(r.getPropertyValue("grid-auto-columns"), t), y = sr(r.getPropertyValue("grid-auto-rows"), t), b = pr(r.getPropertyValue("grid-auto-flow")), x = or(r.getPropertyValue("grid-template-areas"));
|
|
2453
2973
|
}
|
|
2454
|
-
let
|
|
2455
|
-
if (
|
|
2974
|
+
let S = "auto", C = !1, w = 0, T = 0;
|
|
2975
|
+
if (h === "table" && (S = r.tableLayout === "fixed" ? "fixed" : "auto", C = r.borderCollapse === "collapse", !C)) {
|
|
2456
2976
|
let e = r.borderSpacing.split(" ");
|
|
2457
|
-
|
|
2977
|
+
w = p(parseFloat(e[0] ?? "") || 0, t), T = p(parseFloat(e[1] ?? e[0] ?? "") || 0, t);
|
|
2458
2978
|
}
|
|
2459
|
-
let
|
|
2460
|
-
display:
|
|
2979
|
+
let E = {
|
|
2980
|
+
display: h,
|
|
2461
2981
|
tableRole: l,
|
|
2462
|
-
tableLayout:
|
|
2463
|
-
borderCollapse:
|
|
2464
|
-
borderSpacingX:
|
|
2465
|
-
borderSpacingY:
|
|
2982
|
+
tableLayout: S,
|
|
2983
|
+
borderCollapse: C,
|
|
2984
|
+
borderSpacingX: w,
|
|
2985
|
+
borderSpacingY: T,
|
|
2466
2986
|
captionSide: r.captionSide === "bottom" ? "bottom" : "top",
|
|
2467
|
-
verticalAlign: l === "cell" || c.startsWith("inline-") ?
|
|
2987
|
+
verticalAlign: l === "cell" || c.startsWith("inline-") ? Mn(e, r) : "start",
|
|
2468
2988
|
flexDirection: r.flexDirection.startsWith("column") ? "column" : "row",
|
|
2469
2989
|
flexReverse: r.flexDirection.endsWith("-reverse"),
|
|
2470
2990
|
flexWrap: r.flexWrap.startsWith("wrap") ? "wrap" : "nowrap",
|
|
2471
2991
|
wrapReverse: r.flexWrap === "wrap-reverse",
|
|
2472
2992
|
flexGrow: Number(r.flexGrow) || 0,
|
|
2473
2993
|
flexShrink: r.flexShrink === "" ? 1 : Number(r.flexShrink) || 0,
|
|
2474
|
-
flexBasis:
|
|
2994
|
+
flexBasis: tr(r.flexBasis, t),
|
|
2475
2995
|
order: Number(r.order) || 0,
|
|
2476
|
-
justifyContent:
|
|
2477
|
-
alignContent:
|
|
2478
|
-
alignItems:
|
|
2479
|
-
alignSelf:
|
|
2480
|
-
justifyItems:
|
|
2481
|
-
justifySelf:
|
|
2482
|
-
gridTemplateColumns:
|
|
2483
|
-
gridTemplateRows:
|
|
2484
|
-
gridAutoColumns:
|
|
2485
|
-
gridAutoRows:
|
|
2486
|
-
gridAutoFlow:
|
|
2487
|
-
gridTemplateAreas:
|
|
2488
|
-
gridColumnStart:
|
|
2489
|
-
gridColumnEnd:
|
|
2490
|
-
gridRowStart:
|
|
2491
|
-
gridRowEnd:
|
|
2492
|
-
width:
|
|
2493
|
-
height:
|
|
2494
|
-
minWidth:
|
|
2495
|
-
minHeight:
|
|
2496
|
-
maxWidth:
|
|
2497
|
-
maxHeight:
|
|
2498
|
-
padding:
|
|
2499
|
-
margin:
|
|
2500
|
-
position:
|
|
2501
|
-
insets:
|
|
2502
|
-
gapX: $(r.columnGap === "normal" ? "0px" : r.columnGap, t),
|
|
2996
|
+
justifyContent: zn(r.justifyContent),
|
|
2997
|
+
alignContent: zn(r.alignContent),
|
|
2998
|
+
alignItems: Bn(r.alignItems),
|
|
2999
|
+
alignSelf: Vn(r.alignSelf),
|
|
3000
|
+
justifyItems: Bn(r.justifyItems),
|
|
3001
|
+
justifySelf: Vn(r.justifySelf),
|
|
3002
|
+
gridTemplateColumns: g,
|
|
3003
|
+
gridTemplateRows: _,
|
|
3004
|
+
gridAutoColumns: v,
|
|
3005
|
+
gridAutoRows: y,
|
|
3006
|
+
gridAutoFlow: b,
|
|
3007
|
+
gridTemplateAreas: x,
|
|
3008
|
+
gridColumnStart: fr(r.getPropertyValue("grid-column-start")),
|
|
3009
|
+
gridColumnEnd: fr(r.getPropertyValue("grid-column-end")),
|
|
3010
|
+
gridRowStart: fr(r.getPropertyValue("grid-row-start")),
|
|
3011
|
+
gridRowEnd: fr(r.getPropertyValue("grid-row-end")),
|
|
3012
|
+
width: Xn(a, r.width, "width", t, o, s, n),
|
|
3013
|
+
height: Xn(a, r.height, "height", t, o, s, n),
|
|
3014
|
+
minWidth: er(a, "min-width", r.minWidth, o, "min-w", s, n, t) ?? Jn(r.minWidth, t) ?? "auto",
|
|
3015
|
+
minHeight: er(a, "min-height", r.minHeight, o, "min-h", s, n, t) ?? Jn(r.minHeight, t) ?? "auto",
|
|
3016
|
+
maxWidth: er(a, "max-width", r.maxWidth, o, "max-w", s, n, t) ?? Jn(r.maxWidth, t),
|
|
3017
|
+
maxHeight: er(a, "max-height", r.maxHeight, o, "max-h", s, n, t) ?? Jn(r.maxHeight, t),
|
|
3018
|
+
padding: hr(r, t),
|
|
3019
|
+
margin: Hn(r, a, o, s, t),
|
|
3020
|
+
position: Gn(r.position),
|
|
3021
|
+
insets: Kn(r, a, o, s, t),
|
|
3022
|
+
gapX: $(r.columnGap === "normal" || r.columnGap === "" ? h === "multicol" ? `${i}px` : "0px" : r.columnGap, t),
|
|
2503
3023
|
gapY: $(r.rowGap === "normal" ? "0px" : r.rowGap, t),
|
|
2504
|
-
border:
|
|
3024
|
+
border: gr(r),
|
|
2505
3025
|
borderStyle: {
|
|
2506
|
-
top:
|
|
2507
|
-
right:
|
|
2508
|
-
bottom:
|
|
2509
|
-
left:
|
|
3026
|
+
top: qn(r.borderTopStyle),
|
|
3027
|
+
right: qn(r.borderRightStyle),
|
|
3028
|
+
bottom: qn(r.borderBottomStyle),
|
|
3029
|
+
left: qn(r.borderLeftStyle)
|
|
2510
3030
|
},
|
|
2511
|
-
overflow:
|
|
3031
|
+
overflow: On(r.overflow) || On(r.overflowX) || On(r.overflowY) ? "clip" : "visible",
|
|
2512
3032
|
whiteSpace: r.whiteSpace === "pre" ? "pre" : r.whiteSpace === "nowrap" ? "nowrap" : "normal",
|
|
2513
3033
|
tabSize: Math.max(1, Math.floor(parseFloat(r.tabSize)) || 8),
|
|
2514
|
-
lineGap:
|
|
2515
|
-
tracking:
|
|
3034
|
+
lineGap: Wn(r.lineHeight, i),
|
|
3035
|
+
tracking: Un(r.letterSpacing, i, n?.letterSpacing ?? 0),
|
|
2516
3036
|
textOverflow: r.textOverflow === "ellipsis" ? "ellipsis" : "clip",
|
|
2517
3037
|
color: r.color,
|
|
2518
3038
|
fontWeight: r.fontWeight,
|
|
2519
3039
|
fontStyle: r.fontStyle,
|
|
2520
3040
|
textDecorationLine: r.textDecorationLine,
|
|
2521
|
-
backgroundColor: r.backgroundColor
|
|
3041
|
+
backgroundColor: Dn(r.backgroundColor) ? void 0 : r.backgroundColor,
|
|
3042
|
+
backgroundClear: r.getPropertyValue("--mw-bg-clear").trim() === "1",
|
|
2522
3043
|
borderColor: {
|
|
2523
3044
|
top: r.borderTopColor,
|
|
2524
3045
|
right: r.borderRightColor,
|
|
2525
3046
|
bottom: r.borderBottomColor,
|
|
2526
3047
|
left: r.borderLeftColor
|
|
2527
3048
|
},
|
|
2528
|
-
textAlignBlocked:
|
|
2529
|
-
textAlign:
|
|
3049
|
+
textAlignBlocked: In(e, r),
|
|
3050
|
+
textAlign: Ln(e, r),
|
|
3051
|
+
textIndent: Yn(r, t),
|
|
2530
3052
|
zIndex: r.zIndex === "auto" || r.zIndex === "" ? null : Number(r.zIndex) || 0,
|
|
2531
3053
|
latticeBorder: null,
|
|
2532
|
-
ruleX:
|
|
2533
|
-
ruleY:
|
|
2534
|
-
|
|
2535
|
-
|
|
3054
|
+
ruleX: h === "flex" || h === "grid" || h === "multicol" ? Fn(r, "x") : null,
|
|
3055
|
+
ruleY: h === "flex" || h === "grid" ? Fn(r, "y") : null,
|
|
3056
|
+
ruleBreak: Pn(r, "--mw-rule-break", ["none", "intersection"], "normal"),
|
|
3057
|
+
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0, f(parseFloat(r.getPropertyValue("--mw-rule-inset")) || 0)),
|
|
3058
|
+
ruleVisibilityItems: Pn(r, "--mw-rule-visibility-items", [
|
|
3059
|
+
"all",
|
|
3060
|
+
"around",
|
|
3061
|
+
"between"
|
|
3062
|
+
], "normal"),
|
|
3063
|
+
columnCount: u,
|
|
3064
|
+
columnWidth: m,
|
|
3065
|
+
columnFill: r.columnFill === "auto" ? "auto" : "balance",
|
|
3066
|
+
columnSpan: r.columnSpan === "all",
|
|
3067
|
+
breakBeforeColumn: r.breakBefore === "column",
|
|
3068
|
+
breakAfterColumn: r.breakAfter === "column",
|
|
3069
|
+
breakInsideAvoid: r.breakInside === "avoid" || r.breakInside === "avoid-column"
|
|
3070
|
+
};
|
|
3071
|
+
return En(E, r), E;
|
|
2536
3072
|
}
|
|
2537
|
-
function
|
|
3073
|
+
function En(e, t) {
|
|
2538
3074
|
t.borderCollapse === "collapse" && (e.display === "table" || e.tableRole === "cell" || e.tableRole === "row" || e.tableRole === "row-group" || e.tableRole === "header-group" || e.tableRole === "footer-group") && (e.latticeBorder = {
|
|
2539
3075
|
width: e.border,
|
|
2540
3076
|
style: e.borderStyle,
|
|
@@ -2547,10 +3083,20 @@ function Kt(e, t) {
|
|
|
2547
3083
|
}
|
|
2548
3084
|
}, e.border = R(), e.display === "table" && (e.padding = R()));
|
|
2549
3085
|
}
|
|
2550
|
-
function
|
|
3086
|
+
function Dn(e) {
|
|
3087
|
+
if (!e) return !0;
|
|
3088
|
+
let t = e.trim().toLowerCase();
|
|
3089
|
+
return t === "" || t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "currentcolor";
|
|
3090
|
+
}
|
|
3091
|
+
function On(e) {
|
|
2551
3092
|
return e === "hidden" || e === "clip";
|
|
2552
3093
|
}
|
|
2553
|
-
|
|
3094
|
+
function kn(e) {
|
|
3095
|
+
if (e.position !== "absolute" && e.position !== "fixed") return !1;
|
|
3096
|
+
let t = e.clip.replace(/\s/g, "");
|
|
3097
|
+
return t === "rect(0px,0px,0px,0px)" || t === "rect(0,0,0,0)" || (On(e.overflow) || On(e.overflowX)) && parseFloat(e.width) <= 1 && parseFloat(e.height) <= 1;
|
|
3098
|
+
}
|
|
3099
|
+
var An = {
|
|
2554
3100
|
TABLE: "table",
|
|
2555
3101
|
THEAD: "table-header-group",
|
|
2556
3102
|
TBODY: "table-row-group",
|
|
@@ -2561,7 +3107,7 @@ var Jt = {
|
|
|
2561
3107
|
CAPTION: "table-caption",
|
|
2562
3108
|
COL: "table-column",
|
|
2563
3109
|
COLGROUP: "table-column-group"
|
|
2564
|
-
},
|
|
3110
|
+
}, jn = {
|
|
2565
3111
|
"table-header-group": "header-group",
|
|
2566
3112
|
"table-row-group": "row-group",
|
|
2567
3113
|
"table-footer-group": "footer-group",
|
|
@@ -2571,32 +3117,38 @@ var Jt = {
|
|
|
2571
3117
|
"table-column": "column",
|
|
2572
3118
|
"table-column-group": "column-group"
|
|
2573
3119
|
};
|
|
2574
|
-
function
|
|
3120
|
+
function Mn(e, t) {
|
|
2575
3121
|
let n = t.verticalAlign || e.getAttribute("valign")?.toLowerCase() || (e.tagName === "TD" || e.tagName === "TH" ? "middle" : "baseline");
|
|
2576
3122
|
return n === "top" ? "start" : n === "middle" ? "center" : n === "bottom" ? "end" : "start";
|
|
2577
3123
|
}
|
|
2578
|
-
function
|
|
2579
|
-
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") &&
|
|
3124
|
+
function Nn(e, t, n) {
|
|
3125
|
+
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") && at(e, "font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.");
|
|
2580
3126
|
}
|
|
2581
|
-
function
|
|
3127
|
+
function Pn(e, t, n, r) {
|
|
3128
|
+
let i = e.getPropertyValue(t).trim();
|
|
3129
|
+
return n.includes(i) ? i : r;
|
|
3130
|
+
}
|
|
3131
|
+
function Fn(e, t) {
|
|
2582
3132
|
let n = f(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`)) || 0);
|
|
2583
3133
|
if (n <= 0) return null;
|
|
2584
3134
|
let r = e.getPropertyValue(`--mw-rule-${t}-color`).trim();
|
|
2585
3135
|
return {
|
|
2586
3136
|
width: n,
|
|
2587
|
-
style:
|
|
3137
|
+
style: qn(e.getPropertyValue(`--mw-rule-${t}-style`).trim()),
|
|
2588
3138
|
color: r && r !== "currentcolor" && r !== "currentColor" ? r : e.color
|
|
2589
3139
|
};
|
|
2590
3140
|
}
|
|
2591
|
-
function
|
|
2592
|
-
|
|
2593
|
-
let n = e.getAttribute("align")?.toLowerCase();
|
|
2594
|
-
return n === "center" || n === "justify";
|
|
3141
|
+
function In(e, t) {
|
|
3142
|
+
return t.textAlign === "justify" || e.getAttribute("align")?.toLowerCase() === "justify";
|
|
2595
3143
|
}
|
|
2596
|
-
function
|
|
3144
|
+
function Ln(e, t) {
|
|
3145
|
+
let n = t.textAlign || e.getAttribute("align")?.toLowerCase() || "";
|
|
3146
|
+
return n === "right" || n === "end" ? "end" : n === "center" || n.endsWith("-center") ? "center" : "start";
|
|
3147
|
+
}
|
|
3148
|
+
function Rn(e) {
|
|
2597
3149
|
return typeof e.computedStyleMap == "function";
|
|
2598
3150
|
}
|
|
2599
|
-
function
|
|
3151
|
+
function zn(e) {
|
|
2600
3152
|
switch (e) {
|
|
2601
3153
|
case "center": return "center";
|
|
2602
3154
|
case "flex-end":
|
|
@@ -2611,7 +3163,7 @@ function tn(e) {
|
|
|
2611
3163
|
default: return "start";
|
|
2612
3164
|
}
|
|
2613
3165
|
}
|
|
2614
|
-
function
|
|
3166
|
+
function Bn(e) {
|
|
2615
3167
|
switch (e) {
|
|
2616
3168
|
case "center": return "center";
|
|
2617
3169
|
case "flex-end":
|
|
@@ -2622,10 +3174,10 @@ function nn(e) {
|
|
|
2622
3174
|
default: return "start";
|
|
2623
3175
|
}
|
|
2624
3176
|
}
|
|
2625
|
-
function
|
|
2626
|
-
return e === "auto" || e === "" || e === "normal" ? "auto" :
|
|
3177
|
+
function Vn(e) {
|
|
3178
|
+
return e === "auto" || e === "" || e === "normal" ? "auto" : Bn(e);
|
|
2627
3179
|
}
|
|
2628
|
-
function
|
|
3180
|
+
function Hn(e, t, n, r, i) {
|
|
2629
3181
|
let a = (a, o, s) => {
|
|
2630
3182
|
if (t) {
|
|
2631
3183
|
let e = t.get(a)?.toString().trim();
|
|
@@ -2649,16 +3201,16 @@ function an(e, t, n, r, i) {
|
|
|
2649
3201
|
left: a("margin-left", "margin-inline-start", /(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)
|
|
2650
3202
|
};
|
|
2651
3203
|
}
|
|
2652
|
-
function
|
|
3204
|
+
function Un(e, t, n) {
|
|
2653
3205
|
let r = (e === "normal" ? 0 : parseFloat(e) || 0) - n;
|
|
2654
3206
|
return r <= 0 ? 0 : Math.floor(r / (.025 * t) + 1e-6);
|
|
2655
3207
|
}
|
|
2656
|
-
function
|
|
3208
|
+
function Wn(e, t) {
|
|
2657
3209
|
if (!e || e === "normal" || t <= 0) return 0;
|
|
2658
3210
|
let n = parseFloat(e);
|
|
2659
3211
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n / t + 1e-6) - 1) : 0;
|
|
2660
3212
|
}
|
|
2661
|
-
function
|
|
3213
|
+
function Gn(e) {
|
|
2662
3214
|
switch (e) {
|
|
2663
3215
|
case "relative":
|
|
2664
3216
|
case "absolute":
|
|
@@ -2667,7 +3219,7 @@ function cn(e) {
|
|
|
2667
3219
|
default: return "static";
|
|
2668
3220
|
}
|
|
2669
3221
|
}
|
|
2670
|
-
function
|
|
3222
|
+
function Kn(e, t, n, r, i) {
|
|
2671
3223
|
let a = (a, o) => {
|
|
2672
3224
|
if (t) {
|
|
2673
3225
|
let e = t.get(a)?.toString().trim();
|
|
@@ -2686,7 +3238,7 @@ function ln(e, t, n, r, i) {
|
|
|
2686
3238
|
left: a("left", /(?:^|[\s:.[!])-?(?:left|start|inset|inset-x)-/)
|
|
2687
3239
|
};
|
|
2688
3240
|
}
|
|
2689
|
-
function
|
|
3241
|
+
function qn(e) {
|
|
2690
3242
|
switch (e) {
|
|
2691
3243
|
case "double": return "double";
|
|
2692
3244
|
case "dashed": return "dashed";
|
|
@@ -2694,7 +3246,7 @@ function un(e) {
|
|
|
2694
3246
|
default: return "solid";
|
|
2695
3247
|
}
|
|
2696
3248
|
}
|
|
2697
|
-
function
|
|
3249
|
+
function Jn(e, t) {
|
|
2698
3250
|
if (!e || e === "none" || e === "auto") return;
|
|
2699
3251
|
if (e === "min-content" || e === "max-content" || e === "fit-content") return e;
|
|
2700
3252
|
if (e.endsWith("%")) {
|
|
@@ -2713,13 +3265,32 @@ function $(e, t) {
|
|
|
2713
3265
|
let n = parseFloat(e);
|
|
2714
3266
|
return Number.isFinite(n) ? p(n, t) : 0;
|
|
2715
3267
|
}
|
|
2716
|
-
function
|
|
3268
|
+
function Yn(e, t) {
|
|
3269
|
+
let n = e.textIndent;
|
|
3270
|
+
if (!n || n.endsWith("%")) return 0;
|
|
3271
|
+
let r = parseFloat(n);
|
|
3272
|
+
return Number.isFinite(r) ? Math.max(0, p(r, t)) : 0;
|
|
3273
|
+
}
|
|
3274
|
+
function Xn(e, t, n, r, i, a, o) {
|
|
3275
|
+
let s = Zn(n === "width" ? a.width : a.height);
|
|
3276
|
+
if (s !== null) return {
|
|
3277
|
+
kind: "cells",
|
|
3278
|
+
value: $n(s, n, o, r)
|
|
3279
|
+
};
|
|
3280
|
+
let c = Qn(i, n === "width" ? "w" : "h");
|
|
3281
|
+
if (c !== null) {
|
|
3282
|
+
let i = parseFloat(e ? String(e.get(n) ?? "") : t), a = Number.isFinite(i) && Math.abs(i - c) <= c * .3;
|
|
3283
|
+
if (a || !Number.isFinite(i)) return {
|
|
3284
|
+
kind: "cells",
|
|
3285
|
+
value: $n(a ? i : c, n, o, r)
|
|
3286
|
+
};
|
|
3287
|
+
}
|
|
2717
3288
|
if (e) {
|
|
2718
3289
|
let t = e.get(n);
|
|
2719
3290
|
if (t == null) return;
|
|
2720
3291
|
let i = t.toString().trim();
|
|
2721
3292
|
if (i === "auto") return { kind: "auto" };
|
|
2722
|
-
let a =
|
|
3293
|
+
let a = nr(i);
|
|
2723
3294
|
if (a) return a;
|
|
2724
3295
|
if (i.endsWith("%")) return {
|
|
2725
3296
|
kind: "percent",
|
|
@@ -2733,54 +3304,94 @@ function fn(e, t, n, r, i, a) {
|
|
|
2733
3304
|
kind: "cells",
|
|
2734
3305
|
value: f(parseFloat(i) / .25)
|
|
2735
3306
|
};
|
|
3307
|
+
let s = Zn(i);
|
|
3308
|
+
if (s !== null) return {
|
|
3309
|
+
kind: "cells",
|
|
3310
|
+
value: $n(s, n, o, r)
|
|
3311
|
+
};
|
|
2736
3312
|
}
|
|
2737
|
-
let
|
|
2738
|
-
if (
|
|
2739
|
-
if (
|
|
2740
|
-
let e =
|
|
3313
|
+
let l = n === "width" ? a.width : a.height;
|
|
3314
|
+
if (l) {
|
|
3315
|
+
if (l === "auto") return { kind: "auto" };
|
|
3316
|
+
let e = nr(l);
|
|
2741
3317
|
if (e) return e;
|
|
2742
|
-
if (
|
|
3318
|
+
if (l.endsWith("%")) return {
|
|
2743
3319
|
kind: "percent",
|
|
2744
|
-
value: parseFloat(
|
|
3320
|
+
value: parseFloat(l)
|
|
2745
3321
|
};
|
|
2746
|
-
let t = parseFloat(
|
|
3322
|
+
let t = parseFloat(l);
|
|
2747
3323
|
if (Number.isFinite(t)) return {
|
|
2748
3324
|
kind: "cells",
|
|
2749
3325
|
value: p(t, r)
|
|
2750
3326
|
};
|
|
2751
3327
|
}
|
|
2752
|
-
let
|
|
2753
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
2754
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
2755
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
2756
|
-
let
|
|
2757
|
-
if (
|
|
3328
|
+
let u = n === "width" ? "w" : "h";
|
|
3329
|
+
if (RegExp(`(?:^|[\\s:.[!])${u}-min\\b`).test(i)) return { kind: "min-content" };
|
|
3330
|
+
if (RegExp(`(?:^|[\\s:.[!])${u}-max\\b`).test(i)) return { kind: "max-content" };
|
|
3331
|
+
if (RegExp(`(?:^|[\\s:.[!])${u}-fit\\b`).test(i)) return { kind: "fit-content" };
|
|
3332
|
+
let d = RegExp(`(?:^|[\\s:.[!])${u}-(\\d+)/(\\d+)(?![\\w./])`).exec(i);
|
|
3333
|
+
if (d) return {
|
|
2758
3334
|
kind: "percent",
|
|
2759
|
-
value: 100 * Number(
|
|
3335
|
+
value: 100 * Number(d[1]) / Number(d[2])
|
|
2760
3336
|
};
|
|
2761
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
3337
|
+
if (RegExp(`(?:^|[\\s:.[!])${u}-full(?![\\w-])`).test(i)) return {
|
|
2762
3338
|
kind: "percent",
|
|
2763
3339
|
value: 100
|
|
2764
3340
|
};
|
|
2765
|
-
let
|
|
2766
|
-
if (
|
|
3341
|
+
let m = RegExp(`(?:^|[\\s:.[!])${u}-\\[(\\d+(?:\\.\\d+)?)%\\]`).exec(i);
|
|
3342
|
+
if (m) return {
|
|
2767
3343
|
kind: "percent",
|
|
2768
|
-
value: Number(
|
|
3344
|
+
value: Number(m[1])
|
|
3345
|
+
};
|
|
3346
|
+
let h = RegExp(`(?:^|[\\s:.[!])${u}-(\\d+(?:\\.\\d+)?)(?![\\w-/])`).exec(i);
|
|
3347
|
+
if (h) return {
|
|
3348
|
+
kind: "cells",
|
|
3349
|
+
value: f(Number(h[1]))
|
|
2769
3350
|
};
|
|
2770
|
-
if (!
|
|
3351
|
+
if (!mr(i, u) || t === "auto") return { kind: "auto" };
|
|
2771
3352
|
if (t.endsWith("%")) return {
|
|
2772
3353
|
kind: "percent",
|
|
2773
3354
|
value: parseFloat(t)
|
|
2774
3355
|
};
|
|
2775
|
-
let
|
|
2776
|
-
if (Number.isFinite(
|
|
3356
|
+
let g = parseFloat(t);
|
|
3357
|
+
if (Number.isFinite(g)) return {
|
|
2777
3358
|
kind: "cells",
|
|
2778
|
-
value: p(
|
|
3359
|
+
value: p(g, r)
|
|
2779
3360
|
};
|
|
2780
3361
|
}
|
|
2781
|
-
function
|
|
3362
|
+
function Zn(e) {
|
|
3363
|
+
let t = /^(-?[\d.]+)((?:[dsl]?v)(?:h|w|min|max)|vi|vb)$/.exec(e.trim());
|
|
3364
|
+
if (!t || typeof window > "u") return null;
|
|
3365
|
+
let n = parseFloat(t[1]);
|
|
3366
|
+
if (!Number.isFinite(n)) return null;
|
|
3367
|
+
let r = t[2], i = window.innerHeight, a = window.innerWidth, o = r.endsWith("h") ? i : r.endsWith("min") ? Math.min(a, i) : r.endsWith("max") ? Math.max(a, i) : r === "vb" ? i : a;
|
|
3368
|
+
return n / 100 * o;
|
|
3369
|
+
}
|
|
3370
|
+
function Qn(e, t) {
|
|
3371
|
+
if (typeof window > "u") return null;
|
|
3372
|
+
let n = RegExp(`(?:^|[\\s:.[!])${t}-(screen|[dsl]v[hw])(?![\\w-])`).exec(e);
|
|
3373
|
+
if (n) {
|
|
3374
|
+
let e = n[1];
|
|
3375
|
+
return e === "screen" ? t.includes("h") ? window.innerHeight : window.innerWidth : e.endsWith("h") ? window.innerHeight : window.innerWidth;
|
|
3376
|
+
}
|
|
3377
|
+
let r = RegExp(`(?:^|[\\s:.[!])${t}-\\[(-?[\\d.]+(?:[dsl]?v(?:h|w|min|max)|vi|vb))\\]`).exec(e);
|
|
3378
|
+
return r ? Zn(r[1]) : null;
|
|
3379
|
+
}
|
|
3380
|
+
function $n(e, t, n, r) {
|
|
3381
|
+
let i = t === "width" ? n?.width : n?.height;
|
|
3382
|
+
return i && i > 0 ? Math.max(0, Math.floor(e / i)) : p(e, r);
|
|
3383
|
+
}
|
|
3384
|
+
function er(e, t, n, r, i, a, o, s) {
|
|
3385
|
+
let c = t.endsWith("width") ? "width" : "height", l = Zn(a.getPropertyValue(t)) ?? Zn(e?.get(t)?.toString().trim() ?? "");
|
|
3386
|
+
if (l !== null) return $n(l, c, o, s);
|
|
3387
|
+
let u = Qn(r, i);
|
|
3388
|
+
if (u === null) return;
|
|
3389
|
+
let d = parseFloat(e ? String(e.get(t) ?? "") : n), f = Number.isFinite(d) && Math.abs(d - u) <= u * .3;
|
|
3390
|
+
if (!(!f && Number.isFinite(d))) return $n(f ? d : u, c, o, s);
|
|
3391
|
+
}
|
|
3392
|
+
function tr(e, t) {
|
|
2782
3393
|
if (!e || e === "auto" || e === "content") return;
|
|
2783
|
-
let n =
|
|
3394
|
+
let n = nr(e);
|
|
2784
3395
|
if (n) return n;
|
|
2785
3396
|
if (e.endsWith("%")) {
|
|
2786
3397
|
let t = parseFloat(e);
|
|
@@ -2795,27 +3406,27 @@ function pn(e, t) {
|
|
|
2795
3406
|
value: p(r, t)
|
|
2796
3407
|
} : void 0;
|
|
2797
3408
|
}
|
|
2798
|
-
function
|
|
3409
|
+
function nr(e) {
|
|
2799
3410
|
if (e === "min-content") return { kind: "min-content" };
|
|
2800
3411
|
if (e === "max-content") return { kind: "max-content" };
|
|
2801
3412
|
if (e === "fit-content") return { kind: "fit-content" };
|
|
2802
3413
|
}
|
|
2803
|
-
function
|
|
3414
|
+
function rr(e, t) {
|
|
2804
3415
|
let n = e.trim();
|
|
2805
3416
|
if (!n || n === "none") return { kind: "none" };
|
|
2806
3417
|
if (n === "subgrid" || n.startsWith("subgrid ")) return { kind: "subgrid" };
|
|
2807
3418
|
let r = [], i = [], a = [], o = (e) => {
|
|
2808
3419
|
i.push(a), a = [], r.push(e);
|
|
2809
3420
|
}, s;
|
|
2810
|
-
for (let e of
|
|
2811
|
-
let n =
|
|
3421
|
+
for (let e of dr(n)) {
|
|
3422
|
+
let n = ar(e);
|
|
2812
3423
|
if (n) {
|
|
2813
3424
|
a.push(...n);
|
|
2814
3425
|
continue;
|
|
2815
3426
|
}
|
|
2816
3427
|
let i = e.match(/^repeat\(\s*([^,]+?)\s*,(.*)\)$/s);
|
|
2817
3428
|
if (i) {
|
|
2818
|
-
let e =
|
|
3429
|
+
let e = ir(i[2].trim(), t);
|
|
2819
3430
|
if (e.tracks.length === 0) continue;
|
|
2820
3431
|
let n = i[1];
|
|
2821
3432
|
if (n === "auto-fill" || n === "auto-fit") {
|
|
@@ -2833,7 +3444,7 @@ function hn(e, t) {
|
|
|
2833
3444
|
}
|
|
2834
3445
|
continue;
|
|
2835
3446
|
}
|
|
2836
|
-
o(
|
|
3447
|
+
o(cr(e, t));
|
|
2837
3448
|
}
|
|
2838
3449
|
if (i.push(a), r.length === 0 && !s) return { kind: "none" };
|
|
2839
3450
|
let c = {
|
|
@@ -2842,26 +3453,26 @@ function hn(e, t) {
|
|
|
2842
3453
|
};
|
|
2843
3454
|
return i.some((e) => e.length > 0) && (c.lineNames = i), s && (c.autoRepeat = s), c;
|
|
2844
3455
|
}
|
|
2845
|
-
function
|
|
3456
|
+
function ir(e, t) {
|
|
2846
3457
|
let n = [], r = [], i = [];
|
|
2847
|
-
for (let a of
|
|
2848
|
-
let e =
|
|
3458
|
+
for (let a of dr(e)) {
|
|
3459
|
+
let e = ar(a);
|
|
2849
3460
|
if (e) {
|
|
2850
3461
|
i.push(...e);
|
|
2851
3462
|
continue;
|
|
2852
3463
|
}
|
|
2853
|
-
r.push(i), i = [], n.push(
|
|
3464
|
+
r.push(i), i = [], n.push(cr(a, t));
|
|
2854
3465
|
}
|
|
2855
3466
|
return r.push(i), {
|
|
2856
3467
|
tracks: n,
|
|
2857
3468
|
lineNames: r
|
|
2858
3469
|
};
|
|
2859
3470
|
}
|
|
2860
|
-
function
|
|
3471
|
+
function ar(e) {
|
|
2861
3472
|
let t = e.match(/^\[(.*)\]$/s);
|
|
2862
3473
|
return t ? t[1].split(/\s+/).filter((e) => e !== "") : null;
|
|
2863
3474
|
}
|
|
2864
|
-
function
|
|
3475
|
+
function or(e) {
|
|
2865
3476
|
let t = [];
|
|
2866
3477
|
for (let n of e.matchAll(/"([^"]*)"|'([^']*)'/g)) {
|
|
2867
3478
|
let e = (n[1] ?? n[2] ?? "").trim().split(/\s+/).filter((e) => e !== "");
|
|
@@ -2891,23 +3502,23 @@ function vn(e) {
|
|
|
2891
3502
|
areas: r
|
|
2892
3503
|
};
|
|
2893
3504
|
}
|
|
2894
|
-
function
|
|
2895
|
-
let n =
|
|
2896
|
-
return n.length > 0 ? n : [
|
|
3505
|
+
function sr(e, t) {
|
|
3506
|
+
let n = dr(e.trim()).filter((e) => e !== "" && !e.startsWith("[")).map((e) => cr(e, t));
|
|
3507
|
+
return n.length > 0 ? n : [fe()];
|
|
2897
3508
|
}
|
|
2898
|
-
function
|
|
3509
|
+
function cr(e, t) {
|
|
2899
3510
|
let n = e.match(/^minmax\((.*)\)$/s);
|
|
2900
3511
|
if (n) {
|
|
2901
|
-
let e =
|
|
3512
|
+
let e = ur(n[1]).map((e) => e.trim());
|
|
2902
3513
|
return e.length === 2 ? {
|
|
2903
|
-
min:
|
|
2904
|
-
max:
|
|
3514
|
+
min: lr(e[0], t),
|
|
3515
|
+
max: lr(e[1], t)
|
|
2905
3516
|
} : {
|
|
2906
3517
|
min: { kind: "auto" },
|
|
2907
3518
|
max: { kind: "auto" }
|
|
2908
3519
|
};
|
|
2909
3520
|
}
|
|
2910
|
-
let r =
|
|
3521
|
+
let r = lr(e, t);
|
|
2911
3522
|
return r.kind === "fr" ? {
|
|
2912
3523
|
min: { kind: "auto" },
|
|
2913
3524
|
max: r
|
|
@@ -2916,13 +3527,13 @@ function bn(e, t) {
|
|
|
2916
3527
|
max: r
|
|
2917
3528
|
};
|
|
2918
3529
|
}
|
|
2919
|
-
function
|
|
3530
|
+
function lr(e, t) {
|
|
2920
3531
|
if (e === "auto" || e.startsWith("fit-content")) return { kind: "auto" };
|
|
2921
3532
|
if (e === "min-content") return { kind: "min-content" };
|
|
2922
3533
|
if (e === "max-content") return { kind: "max-content" };
|
|
2923
3534
|
let n = e.match(/^(min|max)\((.*)\)$/s);
|
|
2924
3535
|
if (n) {
|
|
2925
|
-
let e =
|
|
3536
|
+
let e = ur(n[2]).map((e) => lr(e.trim(), t)), r = e.every((e) => e.kind === "cells" || e.kind === "percent" || e.kind === "math");
|
|
2926
3537
|
return e.length > 0 && r ? {
|
|
2927
3538
|
kind: "math",
|
|
2928
3539
|
fn: n[1],
|
|
@@ -2949,7 +3560,7 @@ function xn(e, t) {
|
|
|
2949
3560
|
value: e.endsWith("rem") ? f(r / .25) : p(r, t)
|
|
2950
3561
|
} : { kind: "auto" };
|
|
2951
3562
|
}
|
|
2952
|
-
function
|
|
3563
|
+
function ur(e) {
|
|
2953
3564
|
let t = [], n = 0, r = 0;
|
|
2954
3565
|
for (let i = 0; i < e.length; i++) {
|
|
2955
3566
|
let a = e[i];
|
|
@@ -2957,7 +3568,7 @@ function Sn(e) {
|
|
|
2957
3568
|
}
|
|
2958
3569
|
return t.push(e.slice(r)), t.filter((e) => e.trim() !== "");
|
|
2959
3570
|
}
|
|
2960
|
-
function
|
|
3571
|
+
function dr(e) {
|
|
2961
3572
|
let t = [], n = 0, r = -1;
|
|
2962
3573
|
for (let i = 0; i < e.length; i++) {
|
|
2963
3574
|
let a = e[i];
|
|
@@ -2965,7 +3576,7 @@ function Cn(e) {
|
|
|
2965
3576
|
}
|
|
2966
3577
|
return r !== -1 && t.push(e.slice(r)), t;
|
|
2967
3578
|
}
|
|
2968
|
-
function
|
|
3579
|
+
function fr(e) {
|
|
2969
3580
|
let t = e.trim();
|
|
2970
3581
|
if (!t || t === "auto") return { kind: "auto" };
|
|
2971
3582
|
let n = !1, r, i;
|
|
@@ -2993,16 +3604,16 @@ function wn(e) {
|
|
|
2993
3604
|
nth: r
|
|
2994
3605
|
};
|
|
2995
3606
|
}
|
|
2996
|
-
function
|
|
3607
|
+
function pr(e) {
|
|
2997
3608
|
return {
|
|
2998
3609
|
direction: e.includes("column") ? "column" : "row",
|
|
2999
3610
|
dense: e.includes("dense")
|
|
3000
3611
|
};
|
|
3001
3612
|
}
|
|
3002
|
-
function
|
|
3613
|
+
function mr(e, t) {
|
|
3003
3614
|
return (t === "w" ? /(?:^|[\s:.[!])w-/ : /(?:^|[\s:.[!])h-/).test(e);
|
|
3004
3615
|
}
|
|
3005
|
-
function
|
|
3616
|
+
function hr(e, t) {
|
|
3006
3617
|
return {
|
|
3007
3618
|
top: $(e.getPropertyValue("padding-top"), t),
|
|
3008
3619
|
right: $(e.getPropertyValue("padding-right"), t),
|
|
@@ -3010,7 +3621,7 @@ function Dn(e, t) {
|
|
|
3010
3621
|
left: $(e.getPropertyValue("padding-left"), t)
|
|
3011
3622
|
};
|
|
3012
3623
|
}
|
|
3013
|
-
function
|
|
3624
|
+
function gr(e) {
|
|
3014
3625
|
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 : f(parseFloat(e.getPropertyValue(t)) || 0);
|
|
3015
3626
|
return {
|
|
3016
3627
|
top: t("border-top-width", "border-top-style"),
|
|
@@ -3021,58 +3632,79 @@ function On(e) {
|
|
|
3021
3632
|
}
|
|
3022
3633
|
//#endregion
|
|
3023
3634
|
//#region src/tree.ts
|
|
3024
|
-
function
|
|
3025
|
-
let
|
|
3026
|
-
if (
|
|
3027
|
-
let
|
|
3028
|
-
if (!
|
|
3029
|
-
let
|
|
3635
|
+
function _r(e, t, n, r) {
|
|
3636
|
+
let i = Tn(e, t, n);
|
|
3637
|
+
if (i.display === "none") return null;
|
|
3638
|
+
let a = Array.from(e.children), o = a.map(Sr), s = e.tagName, c = Nr(s);
|
|
3639
|
+
if (!o.includes("block") || c) {
|
|
3640
|
+
let l = Cr(e, i.tracking, {
|
|
3030
3641
|
rootFontSizePx: t,
|
|
3031
3642
|
rootLetterSpacingPx: n?.letterSpacing ?? 0,
|
|
3032
3643
|
cellMetrics: n,
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3644
|
+
textareaWidths: r,
|
|
3645
|
+
preserve: i.whiteSpace === "pre",
|
|
3646
|
+
tabSize: i.tabSize
|
|
3647
|
+
}), u = l.chars.join("");
|
|
3648
|
+
if (l.boxes.length > 0) {
|
|
3649
|
+
let e = Ht();
|
|
3650
|
+
E(l.chars, (t, n) => {
|
|
3651
|
+
l.advances[t] = Math.max(1, J(l.boxes[n], e));
|
|
3040
3652
|
});
|
|
3041
3653
|
}
|
|
3042
|
-
let
|
|
3043
|
-
|
|
3044
|
-
if (
|
|
3045
|
-
|
|
3046
|
-
|
|
3654
|
+
let d = Or(u, l.advances, i.tracking);
|
|
3655
|
+
if (c && d === 0) {
|
|
3656
|
+
if (s === "INPUT") d = Number(e.size) || 20;
|
|
3657
|
+
else if (s === "TEXTAREA") d = Number(e.cols) || 20;
|
|
3658
|
+
else {
|
|
3659
|
+
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);
|
|
3660
|
+
d = Math.max(1, ...r.map((e) => e.trim().length));
|
|
3661
|
+
}
|
|
3047
3662
|
}
|
|
3048
|
-
let
|
|
3663
|
+
let f = u.length > 0 ? kr(u) : 0, p;
|
|
3664
|
+
if (s === "TEXTAREA") {
|
|
3665
|
+
let t = e, n = t.value ?? "", a = r?.get(t), o = +!!n.endsWith("\n"), s = a !== void 0 && a > 0 ? v(n, a) + o : n === "" ? 0 : n.split(/\r\n?|\n/).length, c = getComputedStyle(e).getPropertyValue("field-sizing") === "content" ? 1 : Number(t.rows) || 2, l = Math.max(c, s);
|
|
3666
|
+
p = l + Math.max(0, l - 1) * i.lineGap;
|
|
3667
|
+
} else p = c ? Math.max(1, f) : f;
|
|
3668
|
+
let m = /* @__PURE__ */ new Map(), h = [];
|
|
3669
|
+
for (let t of l.boxes) t.source.parentElement === e ? m.set(t.source, t) : h.push(t);
|
|
3670
|
+
let g = [];
|
|
3671
|
+
for (let e = 0; e < a.length; e++) {
|
|
3672
|
+
let i = a[e], s = m.get(i);
|
|
3673
|
+
if (s) g.push(s);
|
|
3674
|
+
else if (o[e] === "out-of-flow") {
|
|
3675
|
+
let e = _r(i, t, n, r);
|
|
3676
|
+
e && g.push(e);
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3679
|
+
g.push(...h);
|
|
3680
|
+
let _ = {
|
|
3049
3681
|
source: e,
|
|
3050
|
-
style:
|
|
3051
|
-
children:
|
|
3052
|
-
text:
|
|
3053
|
-
intrinsicWidth:
|
|
3054
|
-
intrinsicHeight:
|
|
3682
|
+
style: i,
|
|
3683
|
+
children: g,
|
|
3684
|
+
text: u,
|
|
3685
|
+
intrinsicWidth: d,
|
|
3686
|
+
intrinsicHeight: p,
|
|
3055
3687
|
localRect: {
|
|
3056
3688
|
x: 0,
|
|
3057
3689
|
y: 0,
|
|
3058
|
-
width:
|
|
3059
|
-
height:
|
|
3690
|
+
width: d,
|
|
3691
|
+
height: p
|
|
3060
3692
|
},
|
|
3061
3693
|
unclampedHeight: 0,
|
|
3062
3694
|
resolvedPadding: R()
|
|
3063
3695
|
};
|
|
3064
|
-
return (
|
|
3696
|
+
return (l.advances.some((e) => e !== 1) || l.boxes.length > 0) && (_.advances = l.advances), l.inlineElements.length > 0 && (_.inlineElements = l.inlineElements, _.charInline = l.chars.map((e, t) => l.inlineIndex[t] ?? -1)), _;
|
|
3065
3697
|
}
|
|
3066
|
-
let
|
|
3067
|
-
for (let e = 0; e <
|
|
3068
|
-
if (
|
|
3069
|
-
let
|
|
3070
|
-
|
|
3698
|
+
let l = [];
|
|
3699
|
+
for (let e = 0; e < a.length; e++) {
|
|
3700
|
+
if (o[e] === "none") continue;
|
|
3701
|
+
let i = _r(a[e], t, n, r);
|
|
3702
|
+
i && l.push(i);
|
|
3071
3703
|
}
|
|
3072
|
-
let
|
|
3704
|
+
let u = {
|
|
3073
3705
|
source: e,
|
|
3074
|
-
style:
|
|
3075
|
-
children:
|
|
3706
|
+
style: i,
|
|
3707
|
+
children: l,
|
|
3076
3708
|
text: "",
|
|
3077
3709
|
intrinsicWidth: 0,
|
|
3078
3710
|
intrinsicHeight: 0,
|
|
@@ -3085,25 +3717,25 @@ function kn(e, t, n) {
|
|
|
3085
3717
|
unclampedHeight: 0,
|
|
3086
3718
|
resolvedPadding: R()
|
|
3087
3719
|
};
|
|
3088
|
-
return
|
|
3720
|
+
return Pr(e, u), u;
|
|
3089
3721
|
}
|
|
3090
|
-
var
|
|
3091
|
-
function
|
|
3092
|
-
return t || (
|
|
3722
|
+
var vr = /* @__PURE__ */ new Set(/* @__PURE__ */ "A.ABBR.B.BDI.BDO.BR.CITE.CODE.DATA.DFN.EM.I.KBD.MARK.Q.S.SAMP.SMALL.SPAN.STRONG.SUB.SUP.TIME.U.VAR.WBR".split("."));
|
|
3723
|
+
function yr(e, t) {
|
|
3724
|
+
return t || (vr.has(e.tagName) ? "inline" : "block");
|
|
3093
3725
|
}
|
|
3094
|
-
function
|
|
3095
|
-
let n =
|
|
3726
|
+
function br(e, t) {
|
|
3727
|
+
let n = yr(e, t);
|
|
3096
3728
|
return n === "inline" || n === "contents";
|
|
3097
3729
|
}
|
|
3098
|
-
function
|
|
3099
|
-
let n =
|
|
3730
|
+
function xr(e, t) {
|
|
3731
|
+
let n = yr(e, t);
|
|
3100
3732
|
return n.startsWith("inline") && n !== "inline";
|
|
3101
3733
|
}
|
|
3102
|
-
function
|
|
3734
|
+
function Sr(e) {
|
|
3103
3735
|
let t = getComputedStyle(e);
|
|
3104
|
-
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" :
|
|
3736
|
+
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" : br(e, t.display) || xr(e, t.display) ? "inline" : "block";
|
|
3105
3737
|
}
|
|
3106
|
-
function
|
|
3738
|
+
function Cr(e, t, n) {
|
|
3107
3739
|
let r = {
|
|
3108
3740
|
chars: [],
|
|
3109
3741
|
advances: [],
|
|
@@ -3111,64 +3743,67 @@ function Fn(e, t, n) {
|
|
|
3111
3743
|
inlineElements: [],
|
|
3112
3744
|
boxes: []
|
|
3113
3745
|
};
|
|
3114
|
-
return
|
|
3746
|
+
return wr(e, t, n, r), n.preserve ? r : Dr(r);
|
|
3115
3747
|
}
|
|
3116
|
-
function
|
|
3748
|
+
function wr(e, t, n, r) {
|
|
3117
3749
|
let i = () => {
|
|
3118
3750
|
let e = 0;
|
|
3119
3751
|
for (let t = r.chars.length - 1; t >= 0 && r.chars[t] !== "\n"; t--) e += r.advances[t];
|
|
3120
3752
|
return e;
|
|
3121
3753
|
};
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3754
|
+
if (!Nr(e.tagName)) {
|
|
3755
|
+
for (let a of Array.from(e.childNodes)) if (a.nodeType === Node.TEXT_NODE) {
|
|
3756
|
+
if (n.preserve) for (let e of (a.textContent ?? "").replace(/\r\n?/g, "\n")) if (e === "\n") r.chars.push("\n"), r.advances.push(0);
|
|
3757
|
+
else if (e === " ") {
|
|
3758
|
+
let e = (Math.floor(i() / n.tabSize) + 1) * n.tabSize;
|
|
3759
|
+
for (let t = i(); t < e; t++) r.chars.push(" "), r.advances.push(1);
|
|
3760
|
+
} else r.chars.push(e), r.advances.push(1 + t);
|
|
3761
|
+
else for (let e of (a.textContent ?? "").replace(/[ \t\r\n\f]+/g, " ")) r.chars.push(e), r.advances.push(1 + t);
|
|
3762
|
+
} else if (a.nodeType === Node.ELEMENT_NODE) {
|
|
3763
|
+
let e = a;
|
|
3764
|
+
if (e.tagName === "BR") {
|
|
3765
|
+
r.chars.push("\n"), r.advances.push(0);
|
|
3766
|
+
continue;
|
|
3767
|
+
}
|
|
3768
|
+
let t = getComputedStyle(e);
|
|
3769
|
+
if (t.display === "none" || t.position === "absolute" || t.position === "fixed") continue;
|
|
3770
|
+
if (xr(e, t.display)) {
|
|
3771
|
+
let t = _r(e, n.rootFontSizePx, n.cellMetrics, n.textareaWidths);
|
|
3772
|
+
t && (t.inlineBox = !0, r.chars.push(""), r.advances.push(1), r.boxes.push(t));
|
|
3773
|
+
continue;
|
|
3774
|
+
}
|
|
3775
|
+
if (!br(e, t.display)) {
|
|
3776
|
+
Ar(e);
|
|
3777
|
+
continue;
|
|
3778
|
+
}
|
|
3779
|
+
let i = Un(t.letterSpacing, parseFloat(t.fontSize) || n.rootFontSizePx, n.rootLetterSpacingPx), o = Tr(t.paddingLeft, n.rootFontSizePx), s = Tr(t.paddingRight, n.rootFontSizePx);
|
|
3780
|
+
r.inlineElements.push({
|
|
3781
|
+
element: e,
|
|
3782
|
+
tracking: i,
|
|
3783
|
+
padLeft: o,
|
|
3784
|
+
padRight: s,
|
|
3785
|
+
insets: t.position === "static" ? null : Er(t, n.rootFontSizePx),
|
|
3786
|
+
color: t.color,
|
|
3787
|
+
backgroundColor: Dn(t.backgroundColor) ? void 0 : t.backgroundColor,
|
|
3788
|
+
fontWeight: t.fontWeight,
|
|
3789
|
+
fontStyle: t.fontStyle,
|
|
3790
|
+
textDecorationLine: t.textDecorationLine
|
|
3791
|
+
});
|
|
3792
|
+
let c = r.inlineElements.length - 1;
|
|
3793
|
+
for (let e = 0; e < o; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
3794
|
+
let l = r.chars.length;
|
|
3795
|
+
wr(e, i, n, r);
|
|
3796
|
+
for (let e = l; e < r.chars.length; e++) r.inlineIndex[e] === void 0 && (r.inlineIndex[e] = c);
|
|
3797
|
+
for (let e = 0; e < s; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
3145
3798
|
}
|
|
3146
|
-
let i = on(t.letterSpacing, parseFloat(t.fontSize) || n.rootFontSizePx, n.rootLetterSpacingPx), o = Ln(t.paddingLeft, n.rootFontSizePx), s = Ln(t.paddingRight, n.rootFontSizePx);
|
|
3147
|
-
r.inlineElements.push({
|
|
3148
|
-
element: e,
|
|
3149
|
-
tracking: i,
|
|
3150
|
-
padLeft: o,
|
|
3151
|
-
padRight: s,
|
|
3152
|
-
insets: t.position === "static" ? null : Rn(t, n.rootFontSizePx),
|
|
3153
|
-
color: t.color,
|
|
3154
|
-
fontWeight: t.fontWeight,
|
|
3155
|
-
fontStyle: t.fontStyle,
|
|
3156
|
-
textDecorationLine: t.textDecorationLine
|
|
3157
|
-
});
|
|
3158
|
-
let c = r.inlineElements.length - 1;
|
|
3159
|
-
for (let e = 0; e < o; e++) r.chars.push(""), r.advances.push(1);
|
|
3160
|
-
let l = r.chars.length;
|
|
3161
|
-
In(e, i, n, r);
|
|
3162
|
-
for (let e = l; e < r.chars.length; e++) r.inlineIndex[e] === void 0 && (r.inlineIndex[e] = c);
|
|
3163
|
-
for (let e = 0; e < s; e++) r.chars.push(""), r.advances.push(1);
|
|
3164
3799
|
}
|
|
3165
3800
|
}
|
|
3166
|
-
function
|
|
3801
|
+
function Tr(e, t) {
|
|
3167
3802
|
if (!e || e.endsWith("%")) return 0;
|
|
3168
3803
|
let n = parseFloat(e);
|
|
3169
3804
|
return Number.isFinite(n) ? Math.max(0, p(n, t)) : 0;
|
|
3170
3805
|
}
|
|
3171
|
-
function
|
|
3806
|
+
function Er(e, t) {
|
|
3172
3807
|
let n = (e) => {
|
|
3173
3808
|
if (!e || e === "auto" || e.endsWith("%")) return null;
|
|
3174
3809
|
let n = parseFloat(e);
|
|
@@ -3181,7 +3816,7 @@ function Rn(e, t) {
|
|
|
3181
3816
|
left: n(e.left)
|
|
3182
3817
|
};
|
|
3183
3818
|
}
|
|
3184
|
-
function
|
|
3819
|
+
function Dr(e) {
|
|
3185
3820
|
let t = [], n = [], r = [], i = () => {
|
|
3186
3821
|
let e = t.length;
|
|
3187
3822
|
for (; e > 0 && t[e - 1] !== "\n";) e--;
|
|
@@ -3198,9 +3833,7 @@ function zn(e) {
|
|
|
3198
3833
|
} else o === "\n" && a();
|
|
3199
3834
|
t.push(o), n.push(e.advances[i]), r.push(e.inlineIndex[i] ?? -1);
|
|
3200
3835
|
}
|
|
3201
|
-
|
|
3202
|
-
for (; t[t.length - 1] === "\n";) t.pop(), n.pop(), r.pop();
|
|
3203
|
-
return {
|
|
3836
|
+
return a(), {
|
|
3204
3837
|
chars: t,
|
|
3205
3838
|
advances: n,
|
|
3206
3839
|
inlineIndex: r,
|
|
@@ -3208,38 +3841,75 @@ function zn(e) {
|
|
|
3208
3841
|
boxes: e.boxes
|
|
3209
3842
|
};
|
|
3210
3843
|
}
|
|
3211
|
-
function
|
|
3844
|
+
function Or(e, t, n) {
|
|
3212
3845
|
let r = 0, i = 0;
|
|
3213
|
-
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r,
|
|
3846
|
+
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r, C(i, a, t, n)), i = a + 1);
|
|
3214
3847
|
return r;
|
|
3215
3848
|
}
|
|
3216
|
-
function
|
|
3217
|
-
return e
|
|
3849
|
+
function kr(e) {
|
|
3850
|
+
return b(e).length;
|
|
3218
3851
|
}
|
|
3219
|
-
function
|
|
3220
|
-
|
|
3852
|
+
function Ar(e) {
|
|
3853
|
+
at(e, "A block-level element nested inside a text run can't be laid out and was skipped. Give it its own place in the layout instead.");
|
|
3221
3854
|
}
|
|
3222
|
-
function
|
|
3223
|
-
Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? ""))
|
|
3855
|
+
function jr(e) {
|
|
3856
|
+
return Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? ""));
|
|
3857
|
+
}
|
|
3858
|
+
var Mr = "Direct text next to block-level children can't be laid out and was hidden. Wrap each text segment in its own element (e.g. a <div>).";
|
|
3859
|
+
function Nr(e) {
|
|
3860
|
+
return e === "INPUT" || e === "SELECT" || e === "TEXTAREA";
|
|
3861
|
+
}
|
|
3862
|
+
function Pr(e, t) {
|
|
3863
|
+
jr(e) && (t.droppedText = !0, at(e, Mr));
|
|
3224
3864
|
}
|
|
3225
3865
|
//#endregion
|
|
3226
3866
|
//#region src/element.ts
|
|
3227
|
-
var
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
#
|
|
3237
|
-
#
|
|
3867
|
+
var Fr = "\n<style>\n :host { display: block; position: relative; contain: layout style; }\n #viewport { position: relative; width: 100%; height: 100%; }\n /* When the host hides its own dropped direct text (visibility, see\n * styles.css), the render layer must not sink with it. Scoped to that\n * state so an authored 'invisible' on the host stays intact. */\n :host([data-mw-dropped-text]) #viewport { visibility: visible; }\n /* The unified grid: one <pre> with same-paint-run spans, cell-precise\n * (one monospace character = one cell). In select=\"grid\" (the\n * default, reflected onto the attribute — see DEFAULT_SELECT) the\n * grid catches drags for native selection of the ASCII; interactive\n * elements opt back into pointer-events via styles.css so clicks\n * still work. In select=\"text\" the grid is inert to events and drag\n * selects the light DOM natively. */\n #grid { position: absolute; inset: 0; margin: 0; font: inherit; line-height: inherit; letter-spacing: inherit; white-space: pre; pointer-events: none; user-select: none; -webkit-user-select: none; }\n :host([select=\"grid\"]) #grid { pointer-events: auto; user-select: text; -webkit-user-select: text; }\n :host([select=\"grid\"]) slot { pointer-events: none; user-select: none; -webkit-user-select: none; }\n /* Full invert on selection (TUI-native, matches focus-visible).\n * Both fields spelled out — setting only color makes some engines\n * drop the OS default background. */\n ::selection { color: var(--mw-bg, canvas); background: var(--mw-fg, canvastext); }\n</style>\n<div id=\"viewport\">\n <pre id=\"grid\" aria-hidden=\"true\"></pre>\n <slot></slot>\n</div>\n", Ir = "grid", Lr = [
|
|
3868
|
+
"pointerover",
|
|
3869
|
+
"pointerleave",
|
|
3870
|
+
"focusin",
|
|
3871
|
+
"focusout",
|
|
3872
|
+
"input",
|
|
3873
|
+
"change"
|
|
3874
|
+
], Rr = typeof HTMLElement > "u" ? class {} : HTMLElement, zr = class e extends Rr {
|
|
3875
|
+
static observedAttributes = ["select"];
|
|
3876
|
+
static #e = /* @__PURE__ */ new Set();
|
|
3877
|
+
static #t = null;
|
|
3878
|
+
static #n = () => {
|
|
3879
|
+
for (let t of e.#e) t.#y();
|
|
3880
|
+
};
|
|
3881
|
+
static #r(t) {
|
|
3882
|
+
t instanceof HTMLLinkElement && t.rel === "stylesheet" && !t.sheet && t.addEventListener("load", e.#n, { once: !0 });
|
|
3883
|
+
}
|
|
3884
|
+
static #i(t) {
|
|
3885
|
+
if (e.#e.add(t), e.#t) return;
|
|
3886
|
+
for (let t of document.querySelectorAll("link[rel=stylesheet]")) e.#r(t);
|
|
3887
|
+
let n = new MutationObserver((t) => {
|
|
3888
|
+
for (let n of t) for (let t of n.addedNodes) e.#r(t);
|
|
3889
|
+
e.#n();
|
|
3890
|
+
});
|
|
3891
|
+
n.observe(document.head, {
|
|
3892
|
+
childList: !0,
|
|
3893
|
+
subtree: !0,
|
|
3894
|
+
characterData: !0
|
|
3895
|
+
}), e.#t = n;
|
|
3896
|
+
}
|
|
3897
|
+
static #a(t) {
|
|
3898
|
+
e.#e.delete(t), e.#e.size === 0 && (e.#t?.disconnect(), e.#t = null);
|
|
3899
|
+
}
|
|
3900
|
+
#o;
|
|
3901
|
+
#s;
|
|
3902
|
+
#c;
|
|
3903
|
+
#l = null;
|
|
3904
|
+
#u = null;
|
|
3905
|
+
#d = !1;
|
|
3906
|
+
#f = null;
|
|
3907
|
+
#p = null;
|
|
3238
3908
|
constructor() {
|
|
3239
|
-
super(), this.#
|
|
3909
|
+
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML = Fr, this.#s = this.#o.getElementById("grid"), this.#c = document.createElement("span"), this.#c.setAttribute("aria-hidden", "true"), this.#c.setAttribute("data-mw-probe", ""), this.#c.style.cssText = "position:absolute!important;top:0!important;left:0!important;visibility:hidden!important;pointer-events:none!important;user-select:none!important;white-space:pre!important;overflow-wrap:normal!important;padding:0!important;margin:0!important;border:0!important;", this.#c.textContent = "M".repeat(100);
|
|
3240
3910
|
}
|
|
3241
3911
|
connectedCallback() {
|
|
3242
|
-
this.#
|
|
3912
|
+
this.hasAttribute("select") || this.setAttribute("select", Ir), this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#y()), this.#l.observe(this), this.#l.observe(this.#c), window.addEventListener("resize", this.#h), this.#u = new MutationObserver(() => this.#y()), this.#u.observe(this, {
|
|
3243
3913
|
childList: !0,
|
|
3244
3914
|
subtree: !0,
|
|
3245
3915
|
characterData: !0,
|
|
@@ -3251,71 +3921,93 @@ var Wn = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
3251
3921
|
"rowspan",
|
|
3252
3922
|
"span"
|
|
3253
3923
|
]
|
|
3254
|
-
}), document.fonts?.ready.then(this.#
|
|
3924
|
+
}), document.fonts?.ready.then(this.#g).catch((e) => {
|
|
3255
3925
|
console.warn("[monowind] document.fonts.ready failed:", e);
|
|
3256
|
-
}), document.fonts?.addEventListener("loadingdone", this.#
|
|
3926
|
+
}), document.fonts?.addEventListener("loadingdone", this.#g);
|
|
3927
|
+
for (let e of Lr) this.addEventListener(e, this.#m);
|
|
3928
|
+
e.#i(this), this.#y();
|
|
3257
3929
|
}
|
|
3258
3930
|
disconnectedCallback() {
|
|
3259
|
-
this.#
|
|
3931
|
+
window.removeEventListener("resize", this.#h), this.#l?.disconnect(), this.#u?.disconnect(), this.#l = null, this.#u = null, document.fonts?.removeEventListener("loadingdone", this.#g);
|
|
3932
|
+
for (let e of Lr) this.removeEventListener(e, this.#m);
|
|
3933
|
+
e.#a(this);
|
|
3260
3934
|
}
|
|
3261
|
-
|
|
3262
|
-
|
|
3935
|
+
#m = (e) => {
|
|
3936
|
+
if ((e.type === "focusin" || e.type === "focusout") && e.target instanceof HTMLSelectElement) {
|
|
3937
|
+
this.#v();
|
|
3938
|
+
return;
|
|
3939
|
+
}
|
|
3940
|
+
this.#y();
|
|
3941
|
+
};
|
|
3942
|
+
attributeChangedCallback(e, t, n) {
|
|
3943
|
+
if (e === "select" && n !== "text" && n !== "grid") {
|
|
3944
|
+
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`, this), this.setAttribute("select", Ir);
|
|
3945
|
+
return;
|
|
3946
|
+
}
|
|
3947
|
+
this.#y();
|
|
3263
3948
|
}
|
|
3264
3949
|
toPlainText() {
|
|
3265
|
-
return this.#
|
|
3950
|
+
return this.#d && this.#b(), this.#p ? sn(this.#p) : "";
|
|
3266
3951
|
}
|
|
3267
|
-
#
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3952
|
+
#h = () => {
|
|
3953
|
+
this.#y();
|
|
3954
|
+
};
|
|
3955
|
+
#g = () => {
|
|
3956
|
+
requestAnimationFrame(() => this.#y());
|
|
3957
|
+
};
|
|
3958
|
+
#_() {
|
|
3959
|
+
let e = document.activeElement;
|
|
3960
|
+
if (!(e instanceof HTMLSelectElement) || !this.contains(e)) return !1;
|
|
3961
|
+
try {
|
|
3962
|
+
return e.matches(":open");
|
|
3963
|
+
} catch {
|
|
3964
|
+
return !1;
|
|
3271
3965
|
}
|
|
3272
|
-
let t = Pt(e), n = document.createDocumentFragment();
|
|
3273
|
-
t.forEach((e, t) => {
|
|
3274
|
-
t > 0 && n.appendChild(document.createTextNode("\n"));
|
|
3275
|
-
for (let t of e) {
|
|
3276
|
-
if (t.color === void 0 && t.fontWeight === void 0 && t.fontStyle === void 0 && t.textDecorationLine === void 0) {
|
|
3277
|
-
n.appendChild(document.createTextNode(t.text));
|
|
3278
|
-
continue;
|
|
3279
|
-
}
|
|
3280
|
-
let e = document.createElement("span");
|
|
3281
|
-
t.color !== void 0 && (e.style.color = t.color), t.fontWeight !== void 0 && (e.style.fontWeight = t.fontWeight), t.fontStyle !== void 0 && (e.style.fontStyle = t.fontStyle), t.textDecorationLine !== void 0 && (e.style.textDecoration = t.textDecorationLine), e.textContent = t.text, n.appendChild(e);
|
|
3282
|
-
}
|
|
3283
|
-
}), this.#n.replaceChildren(n);
|
|
3284
3966
|
}
|
|
3285
|
-
#
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3967
|
+
#v() {
|
|
3968
|
+
try {
|
|
3969
|
+
this.#b();
|
|
3970
|
+
} catch (e) {
|
|
3971
|
+
console.error("[monowind] layout failed:", e);
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
#y() {
|
|
3975
|
+
this.#d || (this.#d = !0, requestAnimationFrame(() => {
|
|
3976
|
+
if (this.#d = !1, this.#_()) {
|
|
3977
|
+
this.#y();
|
|
3978
|
+
return;
|
|
3295
3979
|
}
|
|
3980
|
+
this.#v();
|
|
3296
3981
|
}));
|
|
3297
3982
|
}
|
|
3298
|
-
#
|
|
3983
|
+
#b() {
|
|
3984
|
+
if (!this.isConnected) return;
|
|
3985
|
+
let e = /* @__PURE__ */ new Map(), t = getComputedStyle(this).getPropertyValue("--mw-cw").trim(), n = parseFloat(t);
|
|
3986
|
+
if (Number.isFinite(n) && n > 0) for (let t of this.querySelectorAll("textarea")) {
|
|
3987
|
+
let r = getComputedStyle(t), i = t.clientWidth - (parseFloat(r.paddingLeft) || 0) - (parseFloat(r.paddingRight) || 0);
|
|
3988
|
+
e.set(t, Math.max(0, Math.round(i / n)));
|
|
3989
|
+
}
|
|
3299
3990
|
this.setAttribute("measuring", "");
|
|
3300
3991
|
try {
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3992
|
+
this.#c.parentNode !== this && this.appendChild(this.#c);
|
|
3993
|
+
let t = h(this, this.#c), n = this.#f;
|
|
3994
|
+
(n === null || n.width !== t.width || n.height !== t.height || n.letterSpacing !== t.letterSpacing || n.inkOverhang !== t.inkOverhang) && (this.style.setProperty("--mw-cw", `${t.width}px`), this.style.setProperty("--mw-ch", `${t.height}px`), this.style.setProperty("--mw-rls", `${t.letterSpacing}px`), this.style.setProperty("--mw-ink", `${t.inkOverhang ?? 0}px`)), this.#f = t;
|
|
3995
|
+
let r = getComputedStyle(this), i = (parseFloat(r.paddingLeft) || 0) + (parseFloat(r.paddingRight) || 0), a = Math.max(0, Math.floor((this.clientWidth - i) / t.width));
|
|
3996
|
+
if (a === 0) return;
|
|
3997
|
+
let o = g(), s = [];
|
|
3998
|
+
for (let n of Array.from(this.children)) {
|
|
3999
|
+
if (n === this.#c) continue;
|
|
4000
|
+
let r = _r(n, o, t, e);
|
|
4001
|
+
r && s.push(r);
|
|
3310
4002
|
}
|
|
3311
|
-
if (
|
|
3312
|
-
this.#
|
|
4003
|
+
if (jr(this) ? (this.hasAttribute("data-mw-dropped-text") || console.warn(`[monowind] ${Mr}`, this), this.setAttribute("data-mw-dropped-text", "")) : this.removeAttribute("data-mw-dropped-text"), s.length === 0) {
|
|
4004
|
+
this.#s.replaceChildren(), this.#p = null, this.setAttribute("data-mw-ready", "");
|
|
3313
4005
|
return;
|
|
3314
4006
|
}
|
|
3315
|
-
let
|
|
4007
|
+
let c = {
|
|
3316
4008
|
source: this,
|
|
3317
|
-
style:
|
|
3318
|
-
children:
|
|
4009
|
+
style: de(),
|
|
4010
|
+
children: s,
|
|
3319
4011
|
text: "",
|
|
3320
4012
|
intrinsicWidth: 0,
|
|
3321
4013
|
intrinsicHeight: 0,
|
|
@@ -3327,19 +4019,19 @@ var Wn = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
3327
4019
|
},
|
|
3328
4020
|
unclampedHeight: 0,
|
|
3329
4021
|
resolvedPadding: R()
|
|
3330
|
-
}, { height:
|
|
3331
|
-
|
|
3332
|
-
let
|
|
3333
|
-
this.style.height
|
|
4022
|
+
}, { height: l } = Bt(c, a);
|
|
4023
|
+
bn(c), vn(c, this.#s), this.#p = c;
|
|
4024
|
+
let u = r.boxSizing === "border-box" ? (parseFloat(r.paddingTop) || 0) + (parseFloat(r.paddingBottom) || 0) + (parseFloat(r.borderTopWidth) || 0) + (parseFloat(r.borderBottomWidth) || 0) : 0, d = `${l * t.height + u}px`;
|
|
4025
|
+
this.style.height !== d && (this.style.height = d), this.hasAttribute("data-mw-ready") || this.setAttribute("data-mw-ready", "");
|
|
3334
4026
|
} finally {
|
|
3335
|
-
this.removeAttribute("measuring"), this.#
|
|
4027
|
+
this.removeAttribute("measuring"), this.#u?.takeRecords();
|
|
3336
4028
|
}
|
|
3337
4029
|
}
|
|
3338
4030
|
};
|
|
3339
|
-
function
|
|
3340
|
-
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind",
|
|
4031
|
+
function Br() {
|
|
4032
|
+
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind", zr);
|
|
3341
4033
|
}
|
|
3342
4034
|
//#endregion
|
|
3343
|
-
export {
|
|
4035
|
+
export { zr as MonoWindElement, Br as defineMonoWind, $e as multicolLines, sn as renderPlainText, _ as wrapLines };
|
|
3344
4036
|
|
|
3345
4037
|
//# sourceMappingURL=index.js.map
|