monowind 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/borders.d.ts +36 -7
- package/dist/borders.d.ts.map +1 -1
- package/dist/cdn.js +43 -41
- 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.map +1 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/index.js +1171 -900
- package/dist/index.js.map +1 -1
- 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/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 +29 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/wrap.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/styles.css +126 -19
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
|
|
@@ -227,44 +277,50 @@ function g() {
|
|
|
227
277
|
//#endregion
|
|
228
278
|
//#region src/wrap.ts
|
|
229
279
|
function _(e, t, n = {}) {
|
|
230
|
-
return
|
|
280
|
+
return x(e, t, n).map((t) => e.slice(t.start, t.end));
|
|
231
281
|
}
|
|
232
|
-
function v(e) {
|
|
282
|
+
function v(e, t, n = {}) {
|
|
283
|
+
return x(e, t, n).length;
|
|
284
|
+
}
|
|
285
|
+
function y(e, t) {
|
|
286
|
+
return t.endsWith("\n") && e.pop(), e;
|
|
287
|
+
}
|
|
288
|
+
function b(e) {
|
|
233
289
|
let t = [], n = 0;
|
|
234
290
|
for (let r = 0; r <= e.length; r++) (r === e.length || e[r] === "\n") && (t.push({
|
|
235
291
|
start: n,
|
|
236
292
|
end: r
|
|
237
293
|
}), n = r + 1);
|
|
238
|
-
return t;
|
|
294
|
+
return y(t, e);
|
|
239
295
|
}
|
|
240
|
-
function
|
|
241
|
-
if (!/[^ \t\r\
|
|
296
|
+
function x(e, t, n = {}) {
|
|
297
|
+
if (!/[^ \t\r\f]/.test(e)) return [];
|
|
242
298
|
let r = [], i = 0;
|
|
243
|
-
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r.push(...
|
|
244
|
-
return r;
|
|
299
|
+
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r.push(...A(e, i, a, t, n)), i = a + 1);
|
|
300
|
+
return y(r, e);
|
|
245
301
|
}
|
|
246
|
-
function
|
|
302
|
+
function S(e, t, n) {
|
|
247
303
|
if (!n) return t - e;
|
|
248
304
|
let r = 0;
|
|
249
305
|
for (let i = e; i < t; i++) r += n[i] ?? 1;
|
|
250
306
|
return r;
|
|
251
307
|
}
|
|
252
|
-
function
|
|
253
|
-
return t <= e ? 0 :
|
|
308
|
+
function C(e, t, n, r = 0) {
|
|
309
|
+
return t <= e ? 0 : S(e, t, n) - Math.min(r, w(t - 1, n));
|
|
254
310
|
}
|
|
255
|
-
function
|
|
311
|
+
function w(e, t) {
|
|
256
312
|
return t ? (t[e] ?? 1) - 1 : 0;
|
|
257
313
|
}
|
|
258
|
-
function
|
|
314
|
+
function T(e, t = {}) {
|
|
259
315
|
let { advances: n, tracking: r = 0 } = t, i = 0;
|
|
260
|
-
for (let t of
|
|
316
|
+
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
317
|
return i;
|
|
262
318
|
}
|
|
263
|
-
function
|
|
319
|
+
function E(e, t) {
|
|
264
320
|
let n = 0;
|
|
265
321
|
for (let r = 0; r < e.length; r++) e[r] === "" && (t(r, n), n++);
|
|
266
322
|
}
|
|
267
|
-
function
|
|
323
|
+
function D(e, t, n) {
|
|
268
324
|
let r = [], i = t;
|
|
269
325
|
for (let a = t; a < n; a++) {
|
|
270
326
|
if (e[a] === "") {
|
|
@@ -291,14 +347,14 @@ function T(e, t, n) {
|
|
|
291
347
|
end: n
|
|
292
348
|
}), r;
|
|
293
349
|
}
|
|
294
|
-
var
|
|
295
|
-
function
|
|
350
|
+
var O = /[ \t\r\n\f]/;
|
|
351
|
+
function k(e, t, n) {
|
|
296
352
|
let r = [], i = t;
|
|
297
353
|
for (; i < n;) {
|
|
298
|
-
for (; i < n &&
|
|
354
|
+
for (; i < n && O.test(e[i]);) i++;
|
|
299
355
|
if (i >= n) break;
|
|
300
356
|
let t = i;
|
|
301
|
-
for (; i < n && !
|
|
357
|
+
for (; i < n && !O.test(e[i]);) i++;
|
|
302
358
|
r.push({
|
|
303
359
|
start: t,
|
|
304
360
|
end: i
|
|
@@ -306,8 +362,8 @@ function D(e, t, n) {
|
|
|
306
362
|
}
|
|
307
363
|
return r;
|
|
308
364
|
}
|
|
309
|
-
function
|
|
310
|
-
let o =
|
|
365
|
+
function A(e, t, n, r, { advances: i, tracking: a = 0 }) {
|
|
366
|
+
let o = k(e, t, n);
|
|
311
367
|
if (o.length === 0) return [{
|
|
312
368
|
start: t,
|
|
313
369
|
end: t
|
|
@@ -319,13 +375,13 @@ function O(e, t, n, r, { advances: i, tracking: a = 0 }) {
|
|
|
319
375
|
let s = [], c = null, l = 0;
|
|
320
376
|
for (let t of o) {
|
|
321
377
|
let n = !1;
|
|
322
|
-
for (let o of
|
|
323
|
-
let e = o.start, t = o.end, u = c !== null && !n ? e - 1 : e, d = l +
|
|
378
|
+
for (let o of D(e, t.start, t.end)) {
|
|
379
|
+
let e = o.start, t = o.end, u = c !== null && !n ? e - 1 : e, d = l + S(u, t, i), f = Math.min(a, w(t - 1, i));
|
|
324
380
|
if (c !== null && d - f <= r) c.end = t, l = d;
|
|
325
381
|
else {
|
|
326
382
|
for (c !== null && s.push(c);;) {
|
|
327
383
|
let n = e;
|
|
328
|
-
for (; n < t &&
|
|
384
|
+
for (; n < t && C(e, n + 1, i, a) <= r;) n++;
|
|
329
385
|
if (n === t || n === e) break;
|
|
330
386
|
s.push({
|
|
331
387
|
start: e,
|
|
@@ -335,7 +391,7 @@ function O(e, t, n, r, { advances: i, tracking: a = 0 }) {
|
|
|
335
391
|
c = {
|
|
336
392
|
start: e,
|
|
337
393
|
end: t
|
|
338
|
-
}, l =
|
|
394
|
+
}, l = S(e, t, i);
|
|
339
395
|
}
|
|
340
396
|
n = !0;
|
|
341
397
|
}
|
|
@@ -344,30 +400,63 @@ function O(e, t, n, r, { advances: i, tracking: a = 0 }) {
|
|
|
344
400
|
}
|
|
345
401
|
//#endregion
|
|
346
402
|
//#region src/flex.ts
|
|
347
|
-
function
|
|
348
|
-
let
|
|
349
|
-
|
|
403
|
+
function j(e, t) {
|
|
404
|
+
let n = e.row.map((e) => e.node.localRect).sort((e, t) => e.x - t.x), r = [];
|
|
405
|
+
for (let e = 1; e < n.length; e++) {
|
|
406
|
+
let i = n[e - 1].x + n[e - 1].width - t, a = n[e].x - t;
|
|
407
|
+
a > i && r.push({
|
|
408
|
+
start: i,
|
|
409
|
+
end: a
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
return r;
|
|
413
|
+
}
|
|
414
|
+
function M(e, t, n, r, i) {
|
|
415
|
+
if (e.style.ruleBreak !== "intersection") return [{
|
|
416
|
+
start: 0,
|
|
417
|
+
end: i
|
|
418
|
+
}];
|
|
419
|
+
let a = [t[n - 1], t[n]].flatMap((e) => j(e, r)).sort((e, t) => e.start - t.start), o = (e, t) => ({
|
|
420
|
+
start: e,
|
|
421
|
+
end: t,
|
|
422
|
+
spanned: !1,
|
|
423
|
+
beforeOccupied: !0,
|
|
424
|
+
afterOccupied: !0
|
|
425
|
+
}), s = [], c = 0;
|
|
426
|
+
for (let e of a) e.start > c && s.push(o(c, e.start)), c = Math.max(c, e.end);
|
|
427
|
+
return c < i && s.push(o(c, i)), l(s, "intersection", "all", e.style.ruleInset === "overlap-join" ? "overlap-join" : 0);
|
|
428
|
+
}
|
|
429
|
+
function N(e, t) {
|
|
430
|
+
return typeof t != "number" || t <= 0 ? e : e.map((e) => ({
|
|
431
|
+
...e,
|
|
432
|
+
start: e.start + t,
|
|
433
|
+
end: e.end - t
|
|
434
|
+
})).filter((e) => e.end > e.start);
|
|
435
|
+
}
|
|
436
|
+
function P(e, t, n, r, i, a, o) {
|
|
437
|
+
let s = At(e.style, "x", t), c = At(e.style, "y", n), l = oe(e).map((e) => {
|
|
438
|
+
let n = G(e.style.margin, t);
|
|
350
439
|
return {
|
|
351
440
|
node: e,
|
|
352
|
-
base:
|
|
441
|
+
base: ae(e, t, o),
|
|
353
442
|
grow: e.style.flexGrow,
|
|
354
443
|
shrink: e.style.flexShrink,
|
|
355
|
-
min:
|
|
356
|
-
max:
|
|
444
|
+
min: le(e, t, o),
|
|
445
|
+
max: q(e.style.maxWidth, t),
|
|
357
446
|
margin: n
|
|
358
447
|
};
|
|
359
448
|
}), d = [];
|
|
360
449
|
if (e.style.flexWrap === "wrap") {
|
|
361
450
|
let n = [], r = 0;
|
|
362
451
|
for (let e of l) {
|
|
363
|
-
let i = Math.max(0,
|
|
452
|
+
let i = Math.max(0, U(e.base, e.min, e.max)) + (e.margin.left ?? 0) + (e.margin.right ?? 0), a = n.length === 0 ? i : r + s + i;
|
|
364
453
|
n.length > 0 && a > t && (d.push(n), n = [], r = 0), n.push(e), r = n.length === 1 ? i : r + s + i;
|
|
365
454
|
}
|
|
366
455
|
n.length > 0 && d.push(n), e.style.wrapReverse && d.reverse();
|
|
367
456
|
} else d.push(l);
|
|
368
457
|
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++)
|
|
458
|
+
let n = s * Math.max(0, e.length - 1), i = e.reduce((e, t) => e + (t.margin.left ?? 0) + (t.margin.right ?? 0), 0), a = Math.max(0, t - n - i), c = e.some((e) => e.margin.left === null || e.margin.right === null), l = e.reduce((e, t) => e + t.base, 0), u = c && l <= a ? e.map((e) => Math.max(0, U(e.base, e.min, e.max))) : ie(e, a);
|
|
459
|
+
for (let n = 0; n < e.length; n++) H(e[n].node, t, r, 0, 0, "fill", o, { width: u[n] });
|
|
371
460
|
return {
|
|
372
461
|
row: e,
|
|
373
462
|
widths: u,
|
|
@@ -377,21 +466,21 @@ function k(e, t, n, r, i, a, o) {
|
|
|
377
466
|
}), h = m.map((e) => e.height), g = c * Math.max(0, m.length - 1), _;
|
|
378
467
|
if (e.style.flexWrap === "nowrap") Number.isFinite(n) && (h[0] = Math.max(n, h[0] ?? 0)), _ = [0];
|
|
379
468
|
else {
|
|
380
|
-
let t = h.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - g) : 0, i =
|
|
469
|
+
let t = h.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - g) : 0, i = se(e.style);
|
|
381
470
|
if (i === "stretch" && r > 0) {
|
|
382
|
-
let e =
|
|
471
|
+
let e = I(Array.from({ length: m.length }, () => 1), r);
|
|
383
472
|
for (let t = 0; t < h.length; t++) h[t] += e[t];
|
|
384
|
-
_ =
|
|
385
|
-
} else _ =
|
|
473
|
+
_ = F("start", h, 0);
|
|
474
|
+
} else _ = F(i === "stretch" ? "start" : i, h, r);
|
|
386
475
|
}
|
|
387
476
|
for (let i = 0; i < m.length; i++) {
|
|
388
477
|
let { row: a, widths: l, availableForItems: u } = m[i], d = h[i], g = _[i] + i * c;
|
|
389
478
|
for (let i = 0; i < a.length; i++) {
|
|
390
|
-
let s = a[i].node, c =
|
|
479
|
+
let s = a[i].node, c = L(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
480
|
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 =
|
|
481
|
+
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0, f = U(Math.max(0, d - e - a), q(s.style.minHeight, c) ?? 0, q(s.style.maxHeight, c));
|
|
393
482
|
if (f === s.localRect.height) continue;
|
|
394
|
-
|
|
483
|
+
H(s, t, r, 0, 0, "fill", o, {
|
|
395
484
|
width: l[i],
|
|
396
485
|
height: f
|
|
397
486
|
});
|
|
@@ -399,49 +488,45 @@ function k(e, t, n, r, i, a, o) {
|
|
|
399
488
|
}
|
|
400
489
|
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
490
|
if (b > 0 && y > 0) {
|
|
402
|
-
let e =
|
|
491
|
+
let e = I(Array.from({ length: b }, () => 1), y), t = 0;
|
|
403
492
|
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 =
|
|
493
|
+
C = F("start", l, 0);
|
|
494
|
+
} else C = F(ce(e.style), l, y);
|
|
406
495
|
let w = 0;
|
|
407
496
|
for (let t = 0; t < a.length; t++) {
|
|
408
497
|
let n = a[t], r = n.node, i = n.margin.left ?? 0, o = n.margin.right ?? 0;
|
|
409
498
|
w += x[t] + i, r.localRect = {
|
|
410
499
|
...r.localRect,
|
|
411
500
|
x: f + C[t] + t * s + w,
|
|
412
|
-
y: p + g +
|
|
501
|
+
y: p + g + ne(r, e.style.alignItems, d, n.margin)
|
|
413
502
|
}, w += S[t] + o;
|
|
414
503
|
}
|
|
415
504
|
}
|
|
416
505
|
let v = h.reduce((e, t) => e + t, 0) + g, y = Number.isFinite(n) ? Math.max(n, v) : v;
|
|
417
506
|
if (e.style.ruleX || e.style.ruleY) {
|
|
418
507
|
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({
|
|
508
|
+
for (let i = 0; i < m.length; i++) {
|
|
509
|
+
let a = _[i] + i * c;
|
|
510
|
+
for (let e of j(m[i], f)) n.push({
|
|
511
|
+
bandStart: e.start,
|
|
512
|
+
bandSize: e.end - e.start,
|
|
513
|
+
start: a,
|
|
514
|
+
end: a + h[i]
|
|
515
|
+
});
|
|
516
|
+
if (i > 0) {
|
|
517
|
+
let n = _[i - 1] + (i - 1) * c + h[i - 1];
|
|
518
|
+
if (a > n) for (let o of M(e, m, i, f, t)) r.push({
|
|
433
519
|
bandStart: n,
|
|
434
|
-
bandSize:
|
|
435
|
-
|
|
436
|
-
end: t
|
|
520
|
+
bandSize: a - n,
|
|
521
|
+
...o
|
|
437
522
|
});
|
|
438
523
|
}
|
|
439
524
|
}
|
|
440
525
|
e.decorationRuns = u({
|
|
441
526
|
ruleX: e.style.ruleX,
|
|
442
527
|
ruleY: e.style.ruleY,
|
|
443
|
-
vertical: n,
|
|
444
|
-
horizontal: r,
|
|
528
|
+
vertical: N(n, e.style.ruleInset),
|
|
529
|
+
horizontal: N(r, e.style.ruleInset),
|
|
445
530
|
contentWidth: t,
|
|
446
531
|
contentHeight: y,
|
|
447
532
|
border: i,
|
|
@@ -450,10 +535,10 @@ function k(e, t, n, r, i, a, o) {
|
|
|
450
535
|
padding: a
|
|
451
536
|
});
|
|
452
537
|
}
|
|
453
|
-
return
|
|
538
|
+
return ee(e, i, a, t, y), y;
|
|
454
539
|
}
|
|
455
|
-
function
|
|
456
|
-
for (let a of e.children)
|
|
540
|
+
function ee(e, t, n, r, i) {
|
|
541
|
+
for (let a of e.children) V(a.style) && (a.staticSlot = {
|
|
457
542
|
kind: "flex",
|
|
458
543
|
direction: e.style.flexDirection,
|
|
459
544
|
originX: t.left + n.left,
|
|
@@ -462,37 +547,37 @@ function A(e, t, n, r, i) {
|
|
|
462
547
|
innerHeight: i
|
|
463
548
|
});
|
|
464
549
|
}
|
|
465
|
-
function
|
|
466
|
-
let s =
|
|
467
|
-
let a =
|
|
468
|
-
|
|
550
|
+
function te(e, t, n, r, i, a, o) {
|
|
551
|
+
let s = At(e.style, "y", n), c = oe(e).map((i) => {
|
|
552
|
+
let a = G(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c = L(i, e) === "stretch";
|
|
553
|
+
H(i, s, r && Number.isFinite(n) ? n : void 0, 0, 0, c ? "fill" : "shrink", o);
|
|
469
554
|
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
555
|
return {
|
|
471
556
|
node: i,
|
|
472
557
|
base: d,
|
|
473
558
|
grow: i.style.flexGrow,
|
|
474
559
|
shrink: i.style.flexShrink,
|
|
475
|
-
min: f ??
|
|
476
|
-
max:
|
|
560
|
+
min: f ?? q(i.style.minHeight, l) ?? 0,
|
|
561
|
+
max: q(i.style.maxHeight, l),
|
|
477
562
|
margin: a
|
|
478
563
|
};
|
|
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) ?
|
|
564
|
+
}), l = s * Math.max(0, c.length - 1), d = c.reduce((e, t) => e + (t.margin.top ?? 0) + (t.margin.bottom ?? 0), 0), f = Number.isFinite(n), p = c.reduce((e, t) => e + t.base, 0), h = f ? Math.max(0, n - l - d) : p, g = r ? h : Math.max(h, p), _ = c.some((e) => e.margin.top === null || e.margin.bottom === null), v = f && !(f && _ && p <= g) ? ie(c, g) : c.map((e) => Math.max(0, U(e.base, e.min, e.max)));
|
|
480
565
|
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
|
-
|
|
566
|
+
let r = c[n], i = Math.max(0, t - (r.margin.left ?? 0) - (r.margin.right ?? 0)), a = L(r.node, e) === "stretch";
|
|
567
|
+
H(r.node, i, v[n], 0, 0, a ? "fill" : "shrink", o, { height: v[n] });
|
|
483
568
|
}
|
|
484
569
|
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
570
|
if (x > 0 && b > 0) {
|
|
486
|
-
let e =
|
|
571
|
+
let e = I(Array.from({ length: x }, () => 1), b), t = 0;
|
|
487
572
|
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 =
|
|
573
|
+
w = F("start", v, 0);
|
|
574
|
+
} else w = F(ce(e.style), v, b);
|
|
490
575
|
let T = i.left + a.left, E = i.top + a.top, D = 0;
|
|
491
576
|
for (let n = 0; n < c.length; n++) {
|
|
492
577
|
let r = c[n], i = r.node, a = r.margin.top ?? 0, o = r.margin.bottom ?? 0;
|
|
493
578
|
D += S[n] + a, i.localRect = {
|
|
494
579
|
...i.localRect,
|
|
495
|
-
x: T +
|
|
580
|
+
x: T + re(i, e.style.alignItems, t, r.margin),
|
|
496
581
|
y: E + w[n] + n * s + D
|
|
497
582
|
}, D += C[n] + o;
|
|
498
583
|
}
|
|
@@ -512,7 +597,7 @@ function j(e, t, n, r, i, a, o) {
|
|
|
512
597
|
ruleX: null,
|
|
513
598
|
ruleY: e.style.ruleY,
|
|
514
599
|
vertical: [],
|
|
515
|
-
horizontal: n,
|
|
600
|
+
horizontal: N(n, e.style.ruleInset),
|
|
516
601
|
contentWidth: t,
|
|
517
602
|
contentHeight: k,
|
|
518
603
|
border: i,
|
|
@@ -521,17 +606,17 @@ function j(e, t, n, r, i, a, o) {
|
|
|
521
606
|
padding: a
|
|
522
607
|
});
|
|
523
608
|
}
|
|
524
|
-
return
|
|
609
|
+
return ee(e, i, a, t, k), k;
|
|
525
610
|
}
|
|
526
|
-
function
|
|
611
|
+
function ne(e, t, n, r) {
|
|
527
612
|
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
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
613
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + R(i, n, e.localRect.height);
|
|
529
614
|
}
|
|
530
|
-
function
|
|
615
|
+
function re(e, t, n, r) {
|
|
531
616
|
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
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
617
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + R(i, n, e.localRect.width);
|
|
533
618
|
}
|
|
534
|
-
function
|
|
619
|
+
function F(e, t, n) {
|
|
535
620
|
let r = t.length;
|
|
536
621
|
if (r === 0) return [];
|
|
537
622
|
let i = [], a = 0;
|
|
@@ -541,7 +626,7 @@ function P(e, t, n) {
|
|
|
541
626
|
return i;
|
|
542
627
|
}
|
|
543
628
|
if ((e === "space-around" || e === "space-evenly") && n > 0) {
|
|
544
|
-
let o =
|
|
629
|
+
let o = I(Array.from({ length: r + 1 }, (t, n) => e === "space-evenly" || n === 0 || n === r ? 1 : 2), n);
|
|
545
630
|
for (let e = 0; e < r; e++) a += o[e], i.push(a), a += t[e];
|
|
546
631
|
return i;
|
|
547
632
|
}
|
|
@@ -549,8 +634,8 @@ function P(e, t, n) {
|
|
|
549
634
|
for (let e = 0; e < r; e++) i.push(a), a += t[e];
|
|
550
635
|
return i;
|
|
551
636
|
}
|
|
552
|
-
function
|
|
553
|
-
let n = e.length, r = (t, n) => Math.max(0,
|
|
637
|
+
function ie(e, t) {
|
|
638
|
+
let n = e.length, r = (t, n) => Math.max(0, U(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
639
|
for (let t = 0; t < n; t++) {
|
|
555
640
|
let n = r(i[t], t);
|
|
556
641
|
((a ? e[t].grow : e[t].shrink) === 0 || a && i[t] > n || !a && i[t] < n) && (o[t] = n, s[t] = !0);
|
|
@@ -559,7 +644,7 @@ function ee(e, t) {
|
|
|
559
644
|
let c = [];
|
|
560
645
|
for (let e = 0; e < n; e++) s[e] || c.push(e);
|
|
561
646
|
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 =
|
|
647
|
+
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
648
|
if (g === 0) {
|
|
564
649
|
for (let e = 0; e < c.length; e++) o[c[e]] = h[e];
|
|
565
650
|
break;
|
|
@@ -571,7 +656,7 @@ function ee(e, t) {
|
|
|
571
656
|
}
|
|
572
657
|
return o;
|
|
573
658
|
}
|
|
574
|
-
function
|
|
659
|
+
function I(e, t) {
|
|
575
660
|
let n = e.reduce((e, t) => e + t, 0);
|
|
576
661
|
if (n === 0 || t <= 0) return e.map(() => 0);
|
|
577
662
|
let r = e.map((e) => e / n * t), i = r.map(Math.floor), a = t - i.reduce((e, t) => e + t, 0);
|
|
@@ -584,33 +669,33 @@ function F(e, t) {
|
|
|
584
669
|
}
|
|
585
670
|
return i;
|
|
586
671
|
}
|
|
587
|
-
function
|
|
672
|
+
function L(e, t) {
|
|
588
673
|
return e.style.alignSelf === "auto" ? t.style.alignItems : e.style.alignSelf;
|
|
589
674
|
}
|
|
590
|
-
function
|
|
675
|
+
function R(e, t, n) {
|
|
591
676
|
return e === "center" ? Math.max(0, Math.floor((t - n) / 2)) : e === "end" ? Math.max(0, t - n) : 0;
|
|
592
677
|
}
|
|
593
|
-
function
|
|
678
|
+
function ae(e, t, n) {
|
|
594
679
|
let r = e.style.flexBasis, i = e.style.width;
|
|
595
|
-
return r !== void 0 && r.kind !== "auto" ?
|
|
680
|
+
return r !== void 0 && r.kind !== "auto" ? J(r, t, e, n) : i !== void 0 && i.kind !== "auto" ? J(i, t, e, n) : Y(e, n);
|
|
596
681
|
}
|
|
597
|
-
function
|
|
598
|
-
let t = e.children.filter((e) => !
|
|
682
|
+
function oe(e) {
|
|
683
|
+
let t = e.children.filter((e) => !V(e.style)).sort((e, t) => e.style.order - t.style.order);
|
|
599
684
|
return e.style.flexReverse && t.reverse(), t;
|
|
600
685
|
}
|
|
601
|
-
function
|
|
686
|
+
function se(e) {
|
|
602
687
|
return e.wrapReverse ? e.alignContent === "start" ? "end" : e.alignContent === "end" ? "start" : e.alignContent : e.alignContent;
|
|
603
688
|
}
|
|
604
|
-
function
|
|
689
|
+
function ce(e) {
|
|
605
690
|
let t = e.justifyContent === "stretch" ? "start" : e.justifyContent;
|
|
606
691
|
return e.flexReverse ? t === "start" ? "end" : t === "end" ? "start" : t : t;
|
|
607
692
|
}
|
|
608
|
-
function
|
|
609
|
-
return e.style.minWidth === "auto" ? e.style.overflow === "visible" ?
|
|
693
|
+
function le(e, t, n) {
|
|
694
|
+
return e.style.minWidth === "auto" ? e.style.overflow === "visible" ? X(e, n) : 0 : q(e.style.minWidth, t) ?? 0;
|
|
610
695
|
}
|
|
611
696
|
//#endregion
|
|
612
697
|
//#region src/types.ts
|
|
613
|
-
function
|
|
698
|
+
function ue() {
|
|
614
699
|
return {
|
|
615
700
|
display: "block",
|
|
616
701
|
flexDirection: "row",
|
|
@@ -629,8 +714,8 @@ function oe() {
|
|
|
629
714
|
justifySelf: "auto",
|
|
630
715
|
gridTemplateColumns: { kind: "none" },
|
|
631
716
|
gridTemplateRows: { kind: "none" },
|
|
632
|
-
gridAutoColumns: [
|
|
633
|
-
gridAutoRows: [
|
|
717
|
+
gridAutoColumns: [B()],
|
|
718
|
+
gridAutoRows: [B()],
|
|
634
719
|
gridAutoFlow: {
|
|
635
720
|
direction: "row",
|
|
636
721
|
dense: !1
|
|
@@ -646,7 +731,7 @@ function oe() {
|
|
|
646
731
|
minHeight: "auto",
|
|
647
732
|
maxWidth: void 0,
|
|
648
733
|
maxHeight: void 0,
|
|
649
|
-
padding:
|
|
734
|
+
padding: z(),
|
|
650
735
|
margin: {
|
|
651
736
|
top: 0,
|
|
652
737
|
right: 0,
|
|
@@ -662,7 +747,7 @@ function oe() {
|
|
|
662
747
|
},
|
|
663
748
|
gapX: 0,
|
|
664
749
|
gapY: 0,
|
|
665
|
-
border:
|
|
750
|
+
border: z(),
|
|
666
751
|
borderStyle: {
|
|
667
752
|
top: "solid",
|
|
668
753
|
right: "solid",
|
|
@@ -677,6 +762,7 @@ function oe() {
|
|
|
677
762
|
textOverflow: "clip",
|
|
678
763
|
color: void 0,
|
|
679
764
|
backgroundColor: void 0,
|
|
765
|
+
backgroundClear: !1,
|
|
680
766
|
fontWeight: "400",
|
|
681
767
|
fontStyle: "normal",
|
|
682
768
|
textDecorationLine: "none",
|
|
@@ -698,10 +784,13 @@ function oe() {
|
|
|
698
784
|
zIndex: null,
|
|
699
785
|
latticeBorder: null,
|
|
700
786
|
ruleX: null,
|
|
701
|
-
ruleY: null
|
|
787
|
+
ruleY: null,
|
|
788
|
+
ruleBreak: "normal",
|
|
789
|
+
ruleInset: 0,
|
|
790
|
+
ruleVisibilityItems: "normal"
|
|
702
791
|
};
|
|
703
792
|
}
|
|
704
|
-
function
|
|
793
|
+
function z() {
|
|
705
794
|
return {
|
|
706
795
|
top: 0,
|
|
707
796
|
right: 0,
|
|
@@ -709,7 +798,7 @@ function R() {
|
|
|
709
798
|
left: 0
|
|
710
799
|
};
|
|
711
800
|
}
|
|
712
|
-
function
|
|
801
|
+
function B() {
|
|
713
802
|
return {
|
|
714
803
|
min: { kind: "auto" },
|
|
715
804
|
max: { kind: "auto" }
|
|
@@ -717,15 +806,15 @@ function z() {
|
|
|
717
806
|
}
|
|
718
807
|
//#endregion
|
|
719
808
|
//#region src/grid.ts
|
|
720
|
-
function
|
|
721
|
-
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols,
|
|
809
|
+
function de(e, t, n, r, i, a) {
|
|
810
|
+
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, d = e.subgrid?.rows, f = c ? c.gap : At(o, "x", t), p = d ? d.gap : At(o, "y", s), m = xe(e, t, s, f, p, e.subgrid ? {
|
|
722
811
|
col: e.subgrid.colSpan,
|
|
723
812
|
row: e.subgrid.rowSpan
|
|
724
|
-
} : void 0), { children:
|
|
725
|
-
for (let e = 0; e <
|
|
726
|
-
let t =
|
|
813
|
+
} : void 0), { children: h, placed: g, colLines: _, rowLines: v, colTracks: y, rowTracks: b, colCollapsed: x, rowCollapsed: S } = m, C = h.map((e) => G(e.style.margin, t)), w = h.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), T = h.map(fe), E = c ? me(c) : Le(y, x, he(m, T, C, a), t, f, o.justifyContent === "stretch"), D = c ? c.positions : Re(E, t, o.justifyContent), O = [];
|
|
814
|
+
for (let e = 0; e < h.length; e++) {
|
|
815
|
+
let t = h[e], n = g.items[e], r = Be(D, E.sizes, n.col.start, n.col.span), i = C[e], o = Math.max(0, r - Te(i)), s = T[e];
|
|
727
816
|
if (s.cols || s.rows) {
|
|
728
|
-
let e = s.cols ?
|
|
817
|
+
let e = s.cols ? pe(D, E, f, n.col.start, n.col.span, _e(t, "cols", i, r)) : void 0;
|
|
729
818
|
t.subgrid = {
|
|
730
819
|
colSpan: n.col.span,
|
|
731
820
|
rowSpan: n.row.span,
|
|
@@ -733,85 +822,84 @@ function se(e, t, n, r, i, a) {
|
|
|
733
822
|
rows: void 0
|
|
734
823
|
};
|
|
735
824
|
} 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:
|
|
825
|
+
let c = w[e], l = i.left === null || i.right === null, u = t.style.width !== void 0 && t.style.width.kind !== "auto";
|
|
826
|
+
s.cols ? H(t, r, void 0, 0, 0, "fill", a, { width: o }) : c === "stretch" && !l && !u ? H(t, r, void 0, 0, 0, "fill", a, { width: U(o, t.style.minWidth === "auto" ? t.style.overflow === "visible" ? X(t, a) : 0 : q(t.style.minWidth, r) ?? 0, jt(t.style.maxWidth, r, t, a)) }) : H(t, o, void 0, 0, 0, "shrink", a), O.push(t.localRect.width);
|
|
827
|
+
}
|
|
828
|
+
let k = d ? me(d) : Le(b, S, ge(m, T, C), s ?? "max-content", p, o.alignContent === "stretch"), A = ze(k), j = d ? d.positions : Re(k, s ?? A, o.alignContent), M = r.left + i.left, N = r.top + i.top;
|
|
829
|
+
for (let t = 0; t < h.length; t++) {
|
|
830
|
+
let n = h[t], r = g.items[t], i = C[t], o = Be(D, E.sizes, r.col.start, r.col.span), s = Be(j, k.sizes, r.row.start, r.row.span), c = Math.max(0, s - Ee(i)), l = L(n, e), u = i.top === null || i.bottom === null, d = n.style.height !== void 0 && n.style.height.kind !== "auto";
|
|
831
|
+
if (T[t].rows) n.subgrid.rows = pe(j, k, p, r.row.start, r.row.span, _e(n, "rows", i, o)), H(n, o, s, 0, 0, "fill", a, {
|
|
832
|
+
width: O[t],
|
|
744
833
|
height: c
|
|
745
834
|
});
|
|
746
835
|
else if (l === "stretch" && !u && !d) {
|
|
747
|
-
let e =
|
|
748
|
-
e !== n.localRect.height &&
|
|
749
|
-
width:
|
|
836
|
+
let e = U(c, n.style.minHeight === "auto" ? n.style.overflow === "visible" ? n.localRect.height : 0 : q(n.style.minHeight, s) ?? 0, q(n.style.maxHeight, s));
|
|
837
|
+
e !== n.localRect.height && H(n, o, s, 0, 0, "fill", a, {
|
|
838
|
+
width: O[t],
|
|
750
839
|
height: e
|
|
751
840
|
});
|
|
752
|
-
} else n.style.height?.kind === "percent" &&
|
|
841
|
+
} else n.style.height?.kind === "percent" && H(n, o, s, 0, 0, "fill", a, { width: O[t] });
|
|
753
842
|
n.localRect = {
|
|
754
843
|
...n.localRect,
|
|
755
|
-
x:
|
|
756
|
-
y:
|
|
844
|
+
x: M + D[r.col.start] + Ve(w[t], i.left, i.right, o, n.localRect.width),
|
|
845
|
+
y: N + j[r.row.start] + Ve(l, i.top, i.bottom, s, n.localRect.height)
|
|
757
846
|
};
|
|
758
847
|
}
|
|
759
|
-
let
|
|
848
|
+
let P = Number.isFinite(n) ? Math.max(n, A) : A;
|
|
760
849
|
if (o.ruleX || o.ruleY) {
|
|
761
|
-
let n = (
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
850
|
+
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));
|
|
851
|
+
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);
|
|
852
|
+
let f = (e, t, n, r, i, a) => t.map((t, o) => ({
|
|
853
|
+
start: t,
|
|
854
|
+
end: t + n[o],
|
|
855
|
+
spanned: r[e]?.[o] ?? !1,
|
|
856
|
+
beforeOccupied: i(o),
|
|
857
|
+
afterOccupied: a(o)
|
|
858
|
+
})), p = (e, t, n) => {
|
|
859
|
+
let r = [];
|
|
860
|
+
for (let i = 1; i < e.length; i++) {
|
|
861
|
+
let a = e[i - 1] + t[i - 1], s = e[i] - a;
|
|
862
|
+
if (!(s <= 0)) for (let e of l(n(i - 1), o.ruleBreak, o.ruleVisibilityItems, o.ruleInset)) r.push({
|
|
863
|
+
bandStart: a,
|
|
864
|
+
bandSize: s,
|
|
865
|
+
...e
|
|
770
866
|
});
|
|
771
867
|
}
|
|
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
|
-
}));
|
|
868
|
+
return r;
|
|
869
|
+
}, 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
870
|
e.decorationRuns = u({
|
|
783
871
|
ruleX: o.ruleX,
|
|
784
872
|
ruleY: o.ruleY,
|
|
785
|
-
vertical:
|
|
786
|
-
horizontal:
|
|
873
|
+
vertical: m,
|
|
874
|
+
horizontal: h,
|
|
787
875
|
contentWidth: t,
|
|
788
|
-
contentHeight:
|
|
876
|
+
contentHeight: P,
|
|
789
877
|
border: r,
|
|
790
878
|
borderStyle: o.borderStyle,
|
|
791
879
|
borderColor: o.borderColor,
|
|
792
880
|
padding: i
|
|
793
881
|
});
|
|
794
882
|
}
|
|
795
|
-
let
|
|
796
|
-
if (
|
|
797
|
-
let e =
|
|
883
|
+
let ee = e.children.filter((e) => V(e.style));
|
|
884
|
+
if (ee.length > 0) {
|
|
885
|
+
let e = V(o) ? {
|
|
798
886
|
x: r.left,
|
|
799
887
|
y: r.top,
|
|
800
888
|
width: i.left + t + i.right,
|
|
801
|
-
height: i.top +
|
|
889
|
+
height: i.top + P + i.bottom
|
|
802
890
|
} : {
|
|
803
|
-
x:
|
|
804
|
-
y:
|
|
891
|
+
x: M,
|
|
892
|
+
y: N,
|
|
805
893
|
width: t,
|
|
806
|
-
height:
|
|
894
|
+
height: P
|
|
807
895
|
};
|
|
808
|
-
for (let n of
|
|
809
|
-
let r =
|
|
896
|
+
for (let n of ee) {
|
|
897
|
+
let r = ye(n.style.gridColumnStart, n.style.gridColumnEnd, _, g.colOrigin, D, E.sizes, -i.left, t + i.right), a = ye(n.style.gridRowStart, n.style.gridRowEnd, v, g.rowOrigin, j, k.sizes, -i.top, P + i.bottom);
|
|
810
898
|
n.staticSlot = {
|
|
811
899
|
kind: "grid",
|
|
812
900
|
area: {
|
|
813
|
-
x:
|
|
814
|
-
y:
|
|
901
|
+
x: M + r.start,
|
|
902
|
+
y: N + a.start,
|
|
815
903
|
width: Math.max(0, r.end - r.start),
|
|
816
904
|
height: Math.max(0, a.end - a.start)
|
|
817
905
|
},
|
|
@@ -819,16 +907,16 @@ function se(e, t, n, r, i, a) {
|
|
|
819
907
|
};
|
|
820
908
|
}
|
|
821
909
|
}
|
|
822
|
-
return
|
|
910
|
+
return P;
|
|
823
911
|
}
|
|
824
|
-
function
|
|
912
|
+
function fe(e) {
|
|
825
913
|
let t = e.style.display === "grid";
|
|
826
914
|
return {
|
|
827
915
|
cols: t && e.style.gridTemplateColumns.kind === "subgrid",
|
|
828
916
|
rows: t && e.style.gridTemplateRows.kind === "subgrid"
|
|
829
917
|
};
|
|
830
918
|
}
|
|
831
|
-
function
|
|
919
|
+
function pe(e, t, n, r, i, a) {
|
|
832
920
|
let o = e[r] + a.start, s = t.sizes.slice(r, r + i);
|
|
833
921
|
return s[0] = Math.max(0, s[0] - a.start), s[i - 1] = Math.max(0, s[i - 1] - a.end), {
|
|
834
922
|
positions: Array.from({ length: i }, (t, n) => n === 0 ? 0 : e[r + n] - o),
|
|
@@ -837,20 +925,20 @@ function le(e, t, n, r, i, a) {
|
|
|
837
925
|
gap: n
|
|
838
926
|
};
|
|
839
927
|
}
|
|
840
|
-
function
|
|
928
|
+
function me(e) {
|
|
841
929
|
return {
|
|
842
930
|
sizes: e.sizes,
|
|
843
931
|
gapBefore: e.gapBefore,
|
|
844
932
|
limits: e.sizes
|
|
845
933
|
};
|
|
846
934
|
}
|
|
847
|
-
function
|
|
935
|
+
function he(e, t, n, r) {
|
|
848
936
|
let i = [];
|
|
849
937
|
return e.children.forEach((a, o) => {
|
|
850
938
|
let s = e.placed.items[o], c = n[o];
|
|
851
939
|
if (t[o].cols) {
|
|
852
|
-
let e =
|
|
853
|
-
for (let t of
|
|
940
|
+
let e = _e(a, "cols", c, 0);
|
|
941
|
+
for (let t of ve(a, "cols", s, e, r)) i.push({
|
|
854
942
|
...t,
|
|
855
943
|
start: t.start + s.col.start
|
|
856
944
|
});
|
|
@@ -859,24 +947,24 @@ function de(e, t, n, r) {
|
|
|
859
947
|
i.push({
|
|
860
948
|
start: s.col.start,
|
|
861
949
|
span: s.col.span,
|
|
862
|
-
min:
|
|
863
|
-
max:
|
|
950
|
+
min: De(a, "min", r) + Te(c),
|
|
951
|
+
max: De(a, "max", r) + Te(c)
|
|
864
952
|
});
|
|
865
953
|
}), i;
|
|
866
954
|
}
|
|
867
|
-
function
|
|
955
|
+
function ge(e, t, n) {
|
|
868
956
|
let r = [];
|
|
869
957
|
return e.children.forEach((i, a) => {
|
|
870
958
|
let o = e.placed.items[a], s = n[a];
|
|
871
959
|
if (t[a].rows) {
|
|
872
|
-
let e =
|
|
873
|
-
for (let t of
|
|
960
|
+
let e = _e(i, "rows", s, 0);
|
|
961
|
+
for (let t of ve(i, "rows", o, e)) r.push({
|
|
874
962
|
...t,
|
|
875
963
|
start: t.start + o.row.start
|
|
876
964
|
});
|
|
877
965
|
return;
|
|
878
966
|
}
|
|
879
|
-
let c = i.localRect.height +
|
|
967
|
+
let c = i.localRect.height + Ee(s);
|
|
880
968
|
r.push({
|
|
881
969
|
start: o.row.start,
|
|
882
970
|
span: o.row.span,
|
|
@@ -885,25 +973,25 @@ function fe(e, t, n) {
|
|
|
885
973
|
});
|
|
886
974
|
}), r;
|
|
887
975
|
}
|
|
888
|
-
function
|
|
976
|
+
function _e(e, t, n, r) {
|
|
889
977
|
let { border: i, padding: a } = e.style;
|
|
890
978
|
return t === "cols" ? {
|
|
891
|
-
start: (n.left ?? 0) + i.left +
|
|
892
|
-
end: (n.right ?? 0) + i.right +
|
|
979
|
+
start: (n.left ?? 0) + i.left + W(a.left, r),
|
|
980
|
+
end: (n.right ?? 0) + i.right + W(a.right, r)
|
|
893
981
|
} : {
|
|
894
|
-
start: (n.top ?? 0) + i.top +
|
|
895
|
-
end: (n.bottom ?? 0) + i.bottom +
|
|
982
|
+
start: (n.top ?? 0) + i.top + W(a.top, r),
|
|
983
|
+
end: (n.bottom ?? 0) + i.bottom + W(a.bottom, r)
|
|
896
984
|
};
|
|
897
985
|
}
|
|
898
|
-
function
|
|
899
|
-
let a = t === "cols" ? n.col.span : n.row.span, o =
|
|
986
|
+
function ve(e, t, n, r, i) {
|
|
987
|
+
let a = t === "cols" ? n.col.span : n.row.span, o = xe(e, void 0, void 0, 0, 0, {
|
|
900
988
|
col: n.col.span,
|
|
901
989
|
row: n.row.span
|
|
902
990
|
}), s = [];
|
|
903
991
|
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 =
|
|
992
|
+
let c = o.placed.items[n], l = t === "cols" ? c.col : c.row, u = l.start === 0, d = l.start + l.span === a, f = (u ? r.start : 0) + (d ? r.end : 0), p = G(e.style.margin, 0);
|
|
993
|
+
if (fe(e)[t]) {
|
|
994
|
+
let n = _e(e, t, p, 0), a = ve(e, t, c, {
|
|
907
995
|
start: n.start + (u ? r.start : 0),
|
|
908
996
|
end: n.end + (d ? r.end : 0)
|
|
909
997
|
}, i);
|
|
@@ -916,11 +1004,11 @@ function me(e, t, n, r, i) {
|
|
|
916
1004
|
if (t === "cols") s.push({
|
|
917
1005
|
start: l.start,
|
|
918
1006
|
span: l.span,
|
|
919
|
-
min:
|
|
920
|
-
max:
|
|
1007
|
+
min: De(e, "min", i) + Te(p) + f,
|
|
1008
|
+
max: De(e, "max", i) + Te(p) + f
|
|
921
1009
|
});
|
|
922
1010
|
else {
|
|
923
|
-
let t = e.localRect.height +
|
|
1011
|
+
let t = e.localRect.height + Ee(p) + f;
|
|
924
1012
|
s.push({
|
|
925
1013
|
start: l.start,
|
|
926
1014
|
span: l.span,
|
|
@@ -939,9 +1027,9 @@ function me(e, t, n, r, i) {
|
|
|
939
1027
|
}
|
|
940
1028
|
return s;
|
|
941
1029
|
}
|
|
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 =
|
|
1030
|
+
function ye(e, t, n, r, i, a, o, s) {
|
|
1031
|
+
let c = Ne(e, "start", n), l = Ne(t, "end", n);
|
|
1032
|
+
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l = Pe(c, t, 1, n) : l !== null && e.kind === "span" && (c = Pe(l, e, -1, n));
|
|
945
1033
|
let u = i.length, d = (e) => {
|
|
946
1034
|
if (e === null) return;
|
|
947
1035
|
let t = e - r;
|
|
@@ -952,22 +1040,22 @@ function he(e, t, n, r, i, a, o, s) {
|
|
|
952
1040
|
end: h === void 0 ? s : p(h)
|
|
953
1041
|
};
|
|
954
1042
|
}
|
|
955
|
-
function
|
|
1043
|
+
function be(e, t) {
|
|
956
1044
|
let n = t.gridIntrinsic.get(e);
|
|
957
1045
|
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 =
|
|
1046
|
+
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a = xe(e, void 0, void 0, i, 0, e.subgrid ? {
|
|
959
1047
|
col: e.subgrid.colSpan,
|
|
960
1048
|
row: e.subgrid.rowSpan
|
|
961
|
-
} : void 0), o = a.children.map(
|
|
1049
|
+
} : void 0), o = a.children.map(fe), s = a.children.map((e) => G(e.style.margin, 0)), c = Le(a.colTracks, a.colCollapsed, he(a, o, s, t), "min-content", i, !1), l = c.gapBefore.reduce((e, t) => e + t, 0), u = {
|
|
962
1050
|
min: c.sizes.reduce((e, t) => e + t, 0) + l,
|
|
963
1051
|
max: c.limits.reduce((e, t) => e + t, 0) + l
|
|
964
1052
|
};
|
|
965
1053
|
return t.gridIntrinsic.set(e, u), u;
|
|
966
1054
|
}
|
|
967
|
-
function
|
|
968
|
-
let o = e.style, s =
|
|
1055
|
+
function xe(e, t, n, r, i, a) {
|
|
1056
|
+
let o = e.style, s = we(e), c = o.gridTemplateColumns.kind === "subgrid" && a !== void 0, l = o.gridTemplateRows.kind === "subgrid" && a !== void 0, u = c ? Se(a.col) : Oe(o.gridTemplateColumns, t, r), d = l ? Se(a.row) : Oe(o.gridTemplateRows, n, i), f = o.gridTemplateAreas, p = [...u.tracks], m = [...d.tracks];
|
|
969
1057
|
if (f) {
|
|
970
|
-
c ||
|
|
1058
|
+
c || Ae(p, u.lineNames, f.columns, o.gridAutoColumns), l || Ae(m, d.lineNames, f.rows, o.gridAutoRows);
|
|
971
1059
|
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
1060
|
}
|
|
973
1061
|
let h = {
|
|
@@ -976,28 +1064,28 @@ function _e(e, t, n, r, i, a) {
|
|
|
976
1064
|
}, g = {
|
|
977
1065
|
explicitCount: m.length,
|
|
978
1066
|
names: d.lineNames
|
|
979
|
-
}, _ =
|
|
980
|
-
col:
|
|
981
|
-
row:
|
|
1067
|
+
}, _ = Ie(s.map((e) => ({
|
|
1068
|
+
col: Fe(e.style.gridColumnStart, e.style.gridColumnEnd, h),
|
|
1069
|
+
row: Fe(e.style.gridRowStart, e.style.gridRowEnd, g)
|
|
982
1070
|
})), p.length, m.length, o.gridAutoFlow);
|
|
983
|
-
return c &&
|
|
1071
|
+
return c && Ce(_, "col", p.length), l && Ce(_, "row", m.length), {
|
|
984
1072
|
children: s,
|
|
985
1073
|
placed: _,
|
|
986
1074
|
colLines: h,
|
|
987
1075
|
rowLines: g,
|
|
988
|
-
colTracks:
|
|
989
|
-
rowTracks:
|
|
990
|
-
colCollapsed:
|
|
991
|
-
rowCollapsed:
|
|
1076
|
+
colTracks: je(p, _.colOrigin, _.colCount, o.gridAutoColumns),
|
|
1077
|
+
rowTracks: je(m, _.rowOrigin, _.rowCount, o.gridAutoRows),
|
|
1078
|
+
colCollapsed: Me(u, _.colOrigin, _.colCount, _.items.map((e) => e.col)),
|
|
1079
|
+
rowCollapsed: Me(d, _.rowOrigin, _.rowCount, _.items.map((e) => e.row))
|
|
992
1080
|
};
|
|
993
1081
|
}
|
|
994
|
-
function
|
|
1082
|
+
function Se(e) {
|
|
995
1083
|
return {
|
|
996
|
-
tracks: Array.from({ length: e }, () =>
|
|
1084
|
+
tracks: Array.from({ length: e }, () => B()),
|
|
997
1085
|
lineNames: Array.from({ length: e + 1 }, () => [])
|
|
998
1086
|
};
|
|
999
1087
|
}
|
|
1000
|
-
function
|
|
1088
|
+
function Ce(e, t, n) {
|
|
1001
1089
|
let r = t === "col" ? e.colOrigin : e.rowOrigin;
|
|
1002
1090
|
for (let i of e.items) {
|
|
1003
1091
|
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 +1093,22 @@ function ye(e, t, n) {
|
|
|
1005
1093
|
}
|
|
1006
1094
|
t === "col" ? (e.colOrigin = 0, e.colCount = n) : (e.rowOrigin = 0, e.rowCount = n);
|
|
1007
1095
|
}
|
|
1008
|
-
function
|
|
1009
|
-
return e.children.filter((e) => !
|
|
1096
|
+
function we(e) {
|
|
1097
|
+
return e.children.filter((e) => !V(e.style) && !e.inlineBox).sort((e, t) => e.style.order - t.style.order);
|
|
1010
1098
|
}
|
|
1011
|
-
function
|
|
1099
|
+
function Te(e) {
|
|
1012
1100
|
return (e.left ?? 0) + (e.right ?? 0);
|
|
1013
1101
|
}
|
|
1014
|
-
function
|
|
1102
|
+
function Ee(e) {
|
|
1015
1103
|
return (e.top ?? 0) + (e.bottom ?? 0);
|
|
1016
1104
|
}
|
|
1017
|
-
function
|
|
1105
|
+
function De(e, t, n) {
|
|
1018
1106
|
let r = e.style, i;
|
|
1019
|
-
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i =
|
|
1107
|
+
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = J(r.width, 0, e, n)), i === void 0 && (i = t === "min" ? X(e, n) : Y(e, n));
|
|
1020
1108
|
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
1021
|
-
return Math.max(0,
|
|
1109
|
+
return Math.max(0, U(i, a, o));
|
|
1022
1110
|
}
|
|
1023
|
-
function
|
|
1111
|
+
function Oe(e, t, n) {
|
|
1024
1112
|
if (e.kind !== "tracks") return {
|
|
1025
1113
|
tracks: [],
|
|
1026
1114
|
lineNames: [[]]
|
|
@@ -1033,7 +1121,7 @@ function Ce(e, t, n) {
|
|
|
1033
1121
|
let { index: i, tracks: a, mode: o } = e.autoRepeat, s = 1;
|
|
1034
1122
|
if (t !== void 0) {
|
|
1035
1123
|
let e = a.reduce((e, n) => {
|
|
1036
|
-
let r =
|
|
1124
|
+
let r = ke(n.min, t) ?? ke(n.max, t) ?? 1;
|
|
1037
1125
|
return e + Math.max(1, r);
|
|
1038
1126
|
}, 0);
|
|
1039
1127
|
s = Math.max(1, Math.floor((t + n) / (e + n * a.length)));
|
|
@@ -1061,23 +1149,23 @@ function Ce(e, t, n) {
|
|
|
1061
1149
|
lineNames: d
|
|
1062
1150
|
};
|
|
1063
1151
|
}
|
|
1064
|
-
function
|
|
1152
|
+
function ke(e, t) {
|
|
1065
1153
|
if (e.kind === "cells") return e.value;
|
|
1066
1154
|
if (e.kind === "percent" && t !== void 0) return m(e.value, t);
|
|
1067
1155
|
if (e.kind === "math") {
|
|
1068
1156
|
let n = [];
|
|
1069
1157
|
for (let r of e.args) {
|
|
1070
|
-
let e =
|
|
1158
|
+
let e = ke(r, t);
|
|
1071
1159
|
if (e === void 0) return;
|
|
1072
1160
|
n.push(e);
|
|
1073
1161
|
}
|
|
1074
1162
|
return e.fn === "min" ? Math.min(...n) : Math.max(...n);
|
|
1075
1163
|
}
|
|
1076
1164
|
}
|
|
1077
|
-
function
|
|
1165
|
+
function Ae(e, t, n, r) {
|
|
1078
1166
|
for (let i = e.length; i < n; i++) e.push(r[(i - e.length) % r.length]), t.push([]);
|
|
1079
1167
|
}
|
|
1080
|
-
function
|
|
1168
|
+
function je(e, t, n, r) {
|
|
1081
1169
|
let i = [];
|
|
1082
1170
|
for (let a = 0; a < n; a++) {
|
|
1083
1171
|
let n = a + t;
|
|
@@ -1089,7 +1177,7 @@ function Ee(e, t, n, r) {
|
|
|
1089
1177
|
}
|
|
1090
1178
|
return i;
|
|
1091
1179
|
}
|
|
1092
|
-
function
|
|
1180
|
+
function Me(e, t, n, r) {
|
|
1093
1181
|
let i = Array.from({ length: n }, () => !1);
|
|
1094
1182
|
if (!e.autoFit) return i;
|
|
1095
1183
|
for (let a = e.autoFit.start; a < e.autoFit.end; a++) {
|
|
@@ -1098,7 +1186,7 @@ function De(e, t, n, r) {
|
|
|
1098
1186
|
}
|
|
1099
1187
|
return i;
|
|
1100
1188
|
}
|
|
1101
|
-
function
|
|
1189
|
+
function Ne(e, t, n) {
|
|
1102
1190
|
if (e.kind === "line") return e.value > 0 ? e.value - 1 : n.explicitCount + 1 + e.value;
|
|
1103
1191
|
if (e.kind !== "name") return null;
|
|
1104
1192
|
if (e.nth === void 0) {
|
|
@@ -1113,14 +1201,14 @@ function Oe(e, t, n) {
|
|
|
1113
1201
|
for (let t = i; t >= 0; t--) if (n.names[t].includes(e.name) && ++a === -r) return t;
|
|
1114
1202
|
return -(-r - a);
|
|
1115
1203
|
}
|
|
1116
|
-
function
|
|
1204
|
+
function Pe(e, t, n, r) {
|
|
1117
1205
|
if (t.name === void 0) return e + n * t.value;
|
|
1118
1206
|
let i = t.value, a = e;
|
|
1119
1207
|
for (; i > 0;) a += n, (!(a >= 0 && a <= r.explicitCount) || r.names[a].includes(t.name)) && i--;
|
|
1120
1208
|
return a;
|
|
1121
1209
|
}
|
|
1122
|
-
function
|
|
1123
|
-
let r =
|
|
1210
|
+
function Fe(e, t, n) {
|
|
1211
|
+
let r = Ne(e, "start", n), i = Ne(t, "end", n);
|
|
1124
1212
|
if (r !== null && i !== null) return r === i ? {
|
|
1125
1213
|
start: r,
|
|
1126
1214
|
span: 1
|
|
@@ -1130,10 +1218,10 @@ function Ae(e, t, n) {
|
|
|
1130
1218
|
};
|
|
1131
1219
|
if (r !== null) return {
|
|
1132
1220
|
start: r,
|
|
1133
|
-
span: (t.kind === "span" ?
|
|
1221
|
+
span: (t.kind === "span" ? Pe(r, t, 1, n) : r + 1) - r
|
|
1134
1222
|
};
|
|
1135
1223
|
if (i !== null) {
|
|
1136
|
-
let t = e.kind === "span" ?
|
|
1224
|
+
let t = e.kind === "span" ? Pe(i, e, -1, n) : i - 1;
|
|
1137
1225
|
return {
|
|
1138
1226
|
start: t,
|
|
1139
1227
|
span: i - t
|
|
@@ -1144,7 +1232,7 @@ function Ae(e, t, n) {
|
|
|
1144
1232
|
span: e.kind === "span" ? e.value : t.kind === "span" ? t.value : 1
|
|
1145
1233
|
};
|
|
1146
1234
|
}
|
|
1147
|
-
function
|
|
1235
|
+
function Ie(e, t, n, r) {
|
|
1148
1236
|
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
1237
|
for (let t = 0; t < e.length; t++) {
|
|
1150
1238
|
let e = o[t];
|
|
@@ -1241,7 +1329,7 @@ function je(e, t, n, r) {
|
|
|
1241
1329
|
rowCount: S
|
|
1242
1330
|
};
|
|
1243
1331
|
}
|
|
1244
|
-
function
|
|
1332
|
+
function Le(e, t, n, r, i, a) {
|
|
1245
1333
|
let o = typeof r == "number" ? r : void 0, s = e.map((e, n) => {
|
|
1246
1334
|
if (t[n]) return {
|
|
1247
1335
|
base: 0,
|
|
@@ -1251,7 +1339,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1251
1339
|
frFactor: 0,
|
|
1252
1340
|
collapsed: !0
|
|
1253
1341
|
};
|
|
1254
|
-
let r =
|
|
1342
|
+
let r = ke(e.min, o), i = r ?? 0, a = r === void 0, s = e.max;
|
|
1255
1343
|
if (s.kind === "fr") return {
|
|
1256
1344
|
base: i,
|
|
1257
1345
|
limit: null,
|
|
@@ -1260,7 +1348,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1260
1348
|
frFactor: s.value,
|
|
1261
1349
|
collapsed: !1
|
|
1262
1350
|
};
|
|
1263
|
-
let c =
|
|
1351
|
+
let c = ke(s, o);
|
|
1264
1352
|
return c === void 0 ? {
|
|
1265
1353
|
base: i,
|
|
1266
1354
|
limit: null,
|
|
@@ -1294,7 +1382,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1294
1382
|
if (n.length === 0) continue;
|
|
1295
1383
|
let i = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - i;
|
|
1296
1384
|
if (a > 0) {
|
|
1297
|
-
let e = n.reduce((e, t) => e + t.frFactor, 0), t =
|
|
1385
|
+
let e = n.reduce((e, t) => e + t.frFactor, 0), t = I(n.map((t) => e > 0 ? t.frFactor : 1), a);
|
|
1298
1386
|
n.forEach((e, n) => {
|
|
1299
1387
|
e.base += t[n];
|
|
1300
1388
|
});
|
|
@@ -1305,7 +1393,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1305
1393
|
if (i.length > 0) {
|
|
1306
1394
|
let n = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - n;
|
|
1307
1395
|
if (a > 0) {
|
|
1308
|
-
let e =
|
|
1396
|
+
let e = I(i.map(() => 1), a);
|
|
1309
1397
|
i.forEach((t, n) => {
|
|
1310
1398
|
t.base += e[n];
|
|
1311
1399
|
});
|
|
@@ -1316,7 +1404,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1316
1404
|
if (e.length === 0) continue;
|
|
1317
1405
|
let a = i - (t.reduce((e, t) => e + u(t), 0) + r);
|
|
1318
1406
|
if (a > 0) {
|
|
1319
|
-
let t =
|
|
1407
|
+
let t = I(e.map(() => 1), a);
|
|
1320
1408
|
e.forEach((e, n) => {
|
|
1321
1409
|
e.limit = u(e) + t[n];
|
|
1322
1410
|
});
|
|
@@ -1348,7 +1436,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1348
1436
|
for (; !(t <= 0);) {
|
|
1349
1437
|
let e = s.filter((e) => !e.collapsed && e.limitKind !== "fr" && e.base < u(e));
|
|
1350
1438
|
if (e.length === 0) break;
|
|
1351
|
-
let n =
|
|
1439
|
+
let n = I(e.map(() => 1), t), r = 0;
|
|
1352
1440
|
if (e.forEach((e, t) => {
|
|
1353
1441
|
let i = Math.min(n[t], u(e) - e.base);
|
|
1354
1442
|
e.base += i, r += i;
|
|
@@ -1358,7 +1446,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1358
1446
|
if (n.length > 0) {
|
|
1359
1447
|
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
1448
|
for (a < 1 && (i = Math.floor(i * a));;) {
|
|
1361
|
-
let e =
|
|
1449
|
+
let e = I(r.map((e) => e.frFactor), i), t = r.filter((t, n) => e[n] < t.base);
|
|
1362
1450
|
if (t.length === 0) {
|
|
1363
1451
|
r.forEach((t, n) => {
|
|
1364
1452
|
t.base = Math.max(t.base, e[n]);
|
|
@@ -1372,7 +1460,7 @@ function Me(e, t, n, r, i, a) {
|
|
|
1372
1460
|
if (a) {
|
|
1373
1461
|
let t = o - e - s.reduce((e, t) => e + t.base, 0), n = s.filter((e) => !e.collapsed && e.limitKind === "intrinsic-max");
|
|
1374
1462
|
if (t > 0 && n.length > 0) {
|
|
1375
|
-
let e =
|
|
1463
|
+
let e = I(n.map(() => 1), t);
|
|
1376
1464
|
n.forEach((t, n) => {
|
|
1377
1465
|
t.base += e[n];
|
|
1378
1466
|
});
|
|
@@ -1385,57 +1473,57 @@ function Me(e, t, n, r, i, a) {
|
|
|
1385
1473
|
limits: s.map((e) => u(e))
|
|
1386
1474
|
};
|
|
1387
1475
|
}
|
|
1388
|
-
function
|
|
1389
|
-
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t -
|
|
1476
|
+
function Re(e, t, n) {
|
|
1477
|
+
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t - ze(e)), o = F(n === "stretch" ? "start" : n, r, a), s = [], c = 0;
|
|
1390
1478
|
for (let e = 0; e < r.length; e++) c += i[e], s.push(o[e] + c);
|
|
1391
1479
|
return s;
|
|
1392
1480
|
}
|
|
1393
|
-
function
|
|
1481
|
+
function ze(e) {
|
|
1394
1482
|
return e.sizes.reduce((e, t) => e + t, 0) + e.gapBefore.reduce((e, t) => e + t, 0);
|
|
1395
1483
|
}
|
|
1396
|
-
function
|
|
1484
|
+
function Be(e, t, n, r) {
|
|
1397
1485
|
let i = n + r - 1;
|
|
1398
1486
|
return e[n] === void 0 || e[i] === void 0 ? 0 : e[i] + t[i] - e[n];
|
|
1399
1487
|
}
|
|
1400
|
-
function
|
|
1488
|
+
function Ve(e, t, n, r, i) {
|
|
1401
1489
|
let a = t ?? 0, o = n ?? 0, s = r - i;
|
|
1402
|
-
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a +
|
|
1490
|
+
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a + R(e, r, i + a + o);
|
|
1403
1491
|
}
|
|
1404
1492
|
//#endregion
|
|
1405
1493
|
//#region src/warn.ts
|
|
1406
|
-
var
|
|
1407
|
-
function
|
|
1408
|
-
let n =
|
|
1409
|
-
n ||
|
|
1494
|
+
var He = /* @__PURE__ */ new WeakMap();
|
|
1495
|
+
function Ue(e, t) {
|
|
1496
|
+
let n = He.get(e);
|
|
1497
|
+
n || He.set(e, n = /* @__PURE__ */ new Set()), !n.has(t) && (n.add(t), console.warn(`[monowind] ${t}`, e));
|
|
1410
1498
|
}
|
|
1411
1499
|
//#endregion
|
|
1412
1500
|
//#region src/table.ts
|
|
1413
|
-
function
|
|
1414
|
-
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" &&
|
|
1501
|
+
function We(e, t) {
|
|
1502
|
+
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" && Ue(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
1503
|
}
|
|
1416
|
-
function
|
|
1504
|
+
function Ge(e, t) {
|
|
1417
1505
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
1418
1506
|
return Number.isNaN(n) ? 1 : t === "colspan" ? Math.min(1e3, Math.max(1, n)) : Math.min(65534, Math.max(0, n));
|
|
1419
1507
|
}
|
|
1420
|
-
function
|
|
1508
|
+
function Ke(e, t, n) {
|
|
1421
1509
|
let r = (t, r) => {
|
|
1422
|
-
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ?
|
|
1510
|
+
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ? J(i, 0, t, n) : void 0, o = i && i.kind === "percent" ? i.value : void 0;
|
|
1423
1511
|
for (let t = 0; t < r; t++) e.colFixed.push(a), e.colPercent.push(o);
|
|
1424
1512
|
};
|
|
1425
1513
|
if (t.style.tableRole === "column") {
|
|
1426
|
-
r(t,
|
|
1514
|
+
r(t, qe(t.source));
|
|
1427
1515
|
return;
|
|
1428
1516
|
}
|
|
1429
1517
|
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" &&
|
|
1518
|
+
if (i.length === 0) r(t, qe(t.source));
|
|
1519
|
+
else for (let e of i) r(e, qe(e.source));
|
|
1520
|
+
for (let n of t.children) n.style.tableRole !== "column" && We(e, n);
|
|
1433
1521
|
}
|
|
1434
|
-
function
|
|
1522
|
+
function qe(e) {
|
|
1435
1523
|
let t = Number.parseInt(e.getAttribute("span") ?? "", 10);
|
|
1436
1524
|
return Number.isNaN(t) ? 1 : Math.min(1e3, Math.max(1, t));
|
|
1437
1525
|
}
|
|
1438
|
-
function
|
|
1526
|
+
function Je(e, t) {
|
|
1439
1527
|
let n = {
|
|
1440
1528
|
caption: null,
|
|
1441
1529
|
rows: [],
|
|
@@ -1448,7 +1536,7 @@ function Ve(e, t) {
|
|
|
1448
1536
|
hidden: []
|
|
1449
1537
|
}, r = [], i = [], a = [];
|
|
1450
1538
|
for (let o of e.children) {
|
|
1451
|
-
if (
|
|
1539
|
+
if (V(o.style)) continue;
|
|
1452
1540
|
let e = o.style.tableRole;
|
|
1453
1541
|
if (e === "row") i.push({
|
|
1454
1542
|
row: o,
|
|
@@ -1456,11 +1544,11 @@ function Ve(e, t) {
|
|
|
1456
1544
|
});
|
|
1457
1545
|
else if (e === "header-group" || e === "row-group" || e === "footer-group") {
|
|
1458
1546
|
let t = e === "header-group" ? r : e === "footer-group" ? a : i;
|
|
1459
|
-
for (let e of o.children)
|
|
1547
|
+
for (let e of o.children) V(e.style) || (e.style.tableRole === "row" ? t.push({
|
|
1460
1548
|
row: e,
|
|
1461
1549
|
group: o
|
|
1462
|
-
}) :
|
|
1463
|
-
} else e === "caption" ? n.caption === null ? n.caption = o :
|
|
1550
|
+
}) : We(n, e));
|
|
1551
|
+
} else e === "caption" ? n.caption === null ? n.caption = o : We(n, o) : e === "column" || e === "column-group" ? (Ke(n, o, t), n.hidden.push(o)) : We(n, o);
|
|
1464
1552
|
}
|
|
1465
1553
|
let o = [
|
|
1466
1554
|
...r,
|
|
@@ -1475,20 +1563,20 @@ function Ve(e, t) {
|
|
|
1475
1563
|
s = e + 1;
|
|
1476
1564
|
}
|
|
1477
1565
|
}
|
|
1478
|
-
return
|
|
1566
|
+
return Ye(n), n;
|
|
1479
1567
|
}
|
|
1480
|
-
function
|
|
1568
|
+
function Ye(e) {
|
|
1481
1569
|
let t = [];
|
|
1482
1570
|
for (let n = 0; n < e.rows.length; n++) {
|
|
1483
1571
|
let r = e.rows[n], i = 0;
|
|
1484
1572
|
for (let a of r.children) {
|
|
1485
|
-
if (
|
|
1573
|
+
if (V(a.style)) continue;
|
|
1486
1574
|
if (a.style.tableRole !== "cell") {
|
|
1487
|
-
|
|
1575
|
+
We(e, a);
|
|
1488
1576
|
continue;
|
|
1489
1577
|
}
|
|
1490
1578
|
for (; (t[i] ?? 0) > n;) i++;
|
|
1491
|
-
let o =
|
|
1579
|
+
let o = Ge(a.source, "colspan"), s = Ge(a.source, "rowspan"), c = e.groupEnds[n], l = Math.max(1, Math.min(s === 0 ? c - n : s, c - n));
|
|
1492
1580
|
for (let e = i; e < i + o; e++) t[e] = Math.max(t[e] ?? 0, n + l);
|
|
1493
1581
|
e.cells.push({
|
|
1494
1582
|
node: a,
|
|
@@ -1502,21 +1590,21 @@ function He(e) {
|
|
|
1502
1590
|
}
|
|
1503
1591
|
e.columnCount = Math.max(t.length, e.colFixed.length);
|
|
1504
1592
|
}
|
|
1505
|
-
function
|
|
1506
|
-
let r = e.style, i =
|
|
1593
|
+
function Xe(e, t, n) {
|
|
1594
|
+
let r = e.style, i = X(e, n), a;
|
|
1507
1595
|
if (t === "min") a = i;
|
|
1508
1596
|
else {
|
|
1509
|
-
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ?
|
|
1510
|
-
a = t === void 0 ?
|
|
1597
|
+
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ? J(r.width, 0, e, n) : void 0;
|
|
1598
|
+
a = t === void 0 ? Y(e, n) : Math.max(i, t);
|
|
1511
1599
|
}
|
|
1512
1600
|
let o = typeof r.minWidth == "number" ? r.minWidth : 0, s = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
1513
|
-
return Math.max(0,
|
|
1601
|
+
return Math.max(0, U(a, o, s));
|
|
1514
1602
|
}
|
|
1515
|
-
function
|
|
1603
|
+
function Ze(e) {
|
|
1516
1604
|
let t = e.style.width;
|
|
1517
1605
|
return t && t.kind === "percent" ? t.value : void 0;
|
|
1518
1606
|
}
|
|
1519
|
-
function
|
|
1607
|
+
function Qe(e, t, n) {
|
|
1520
1608
|
let r = e.columnCount, i = Array.from({ length: r }, () => 0), a = Array.from({ length: r }, () => 0), o = Array.from({ length: r }, () => void 0);
|
|
1521
1609
|
for (let t = 0; t < r; t++) e.colFixed[t] !== void 0 && (a[t] = e.colFixed[t]), o[t] = e.colPercent[t];
|
|
1522
1610
|
let s = [];
|
|
@@ -1525,17 +1613,17 @@ function Ge(e, t, n) {
|
|
|
1525
1613
|
s.push(t);
|
|
1526
1614
|
continue;
|
|
1527
1615
|
}
|
|
1528
|
-
i[t.col] = Math.max(i[t.col],
|
|
1529
|
-
let e =
|
|
1616
|
+
i[t.col] = Math.max(i[t.col], Xe(t.node, "min", n)), a[t.col] = Math.max(a[t.col], Xe(t.node, "max", n));
|
|
1617
|
+
let e = Ze(t.node);
|
|
1530
1618
|
e !== void 0 && (o[t.col] = Math.max(o[t.col] ?? 0, e));
|
|
1531
1619
|
}
|
|
1532
1620
|
s.sort((e, t) => e.colSpan - t.colSpan);
|
|
1533
1621
|
for (let e of s) {
|
|
1534
|
-
let r = e.col, o = e.col + e.colSpan, s =
|
|
1622
|
+
let r = e.col, o = e.col + e.colSpan, s = at(t, r, o), c = a.slice(r, o);
|
|
1535
1623
|
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 =
|
|
1624
|
+
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d = Xe(e.node, t, n) - u;
|
|
1537
1625
|
if (d <= 0) continue;
|
|
1538
|
-
let f =
|
|
1626
|
+
let f = I(c.some((e) => e > 0) ? c : c.map(() => 1), d);
|
|
1539
1627
|
for (let e = r; e < o; e++) l[e] += f[e - r];
|
|
1540
1628
|
}
|
|
1541
1629
|
}
|
|
@@ -1546,7 +1634,7 @@ function Ge(e, t, n) {
|
|
|
1546
1634
|
percent: o
|
|
1547
1635
|
};
|
|
1548
1636
|
}
|
|
1549
|
-
function
|
|
1637
|
+
function $e(e, t) {
|
|
1550
1638
|
let n = e.min.length, r = e.min.slice(), i = [], a = [];
|
|
1551
1639
|
for (let t = 0; t < n; t++) (e.percent[t] === void 0 ? a : i).push(t);
|
|
1552
1640
|
if (i.length > 0) {
|
|
@@ -1557,32 +1645,32 @@ function Ke(e, t) {
|
|
|
1557
1645
|
}
|
|
1558
1646
|
let s = a.reduce((t, n) => t + e.min[n], 0), c = i.reduce((e, t) => e + r[t], 0) - (t - s);
|
|
1559
1647
|
if (c > 0) {
|
|
1560
|
-
let t = i.map((t) => r[t] - e.min[t]), n =
|
|
1648
|
+
let t = i.map((t) => r[t] - e.min[t]), n = I(t, Math.min(c, t.reduce((e, t) => e + t, 0)));
|
|
1561
1649
|
i.forEach((e, t) => r[e] -= n[t]);
|
|
1562
1650
|
}
|
|
1563
1651
|
}
|
|
1564
1652
|
let o = t - r.reduce((e, t) => e + t, 0);
|
|
1565
1653
|
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 =
|
|
1654
|
+
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
1655
|
a.forEach((e, t) => r[e] += i[t]), o -= Math.min(o, n);
|
|
1568
1656
|
}
|
|
1569
1657
|
if (o > 0) {
|
|
1570
1658
|
let t = a.length > 0 ? a : i;
|
|
1571
1659
|
if (t.length > 0) {
|
|
1572
|
-
let n = t.map((t) => e.max[t]), i =
|
|
1660
|
+
let n = t.map((t) => e.max[t]), i = I(n.some((e) => e > 0) ? n : n.map(() => 1), o);
|
|
1573
1661
|
t.forEach((e, t) => r[e] += i[t]);
|
|
1574
1662
|
}
|
|
1575
1663
|
}
|
|
1576
1664
|
return r;
|
|
1577
1665
|
}
|
|
1578
|
-
function
|
|
1666
|
+
function et(e, t, n) {
|
|
1579
1667
|
let r = e.columnCount, i = Array.from({ length: r }, () => void 0);
|
|
1580
1668
|
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
1669
|
for (let r of e.cells) {
|
|
1582
1670
|
if (r.row !== 0) continue;
|
|
1583
1671
|
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 =
|
|
1672
|
+
if (e.width && e.width.kind === "percent" ? a = Math.max(0, Math.round(t * e.width.value / 100)) : e.width && e.width.kind !== "auto" && (a = J(e.width, 0, r.node, n)), a === void 0) continue;
|
|
1673
|
+
let o = I(Array.from({ length: r.colSpan }, () => 1), a);
|
|
1586
1674
|
for (let e = 0; e < r.colSpan; e++) {
|
|
1587
1675
|
let t = r.col + e;
|
|
1588
1676
|
i[t] === void 0 && (i[t] = o[e]);
|
|
@@ -1590,18 +1678,18 @@ function qe(e, t, n) {
|
|
|
1590
1678
|
}
|
|
1591
1679
|
let a = i.reduce((e, t) => e + (t ?? 0), 0), o = i.filter((e) => e === void 0).length;
|
|
1592
1680
|
if (o > 0) {
|
|
1593
|
-
let e =
|
|
1681
|
+
let e = I(Array.from({ length: o }, () => 1), Math.max(0, t - a)), n = 0;
|
|
1594
1682
|
for (let t = 0; t < r; t++) i[t] === void 0 && (i[t] = e[n++]);
|
|
1595
1683
|
}
|
|
1596
1684
|
return i.map((e) => e ?? 0);
|
|
1597
1685
|
}
|
|
1598
|
-
var
|
|
1686
|
+
var tt = {
|
|
1599
1687
|
double: 3,
|
|
1600
1688
|
solid: 2,
|
|
1601
1689
|
dashed: 1,
|
|
1602
1690
|
dotted: 0
|
|
1603
1691
|
};
|
|
1604
|
-
function
|
|
1692
|
+
function nt(e) {
|
|
1605
1693
|
for (let { border: t, side: n } of e) if (t?.hidden[n]) return null;
|
|
1606
1694
|
let t = null;
|
|
1607
1695
|
for (let { border: n, side: r } of e) {
|
|
@@ -1609,7 +1697,7 @@ function Ye(e) {
|
|
|
1609
1697
|
let e = n.width[r];
|
|
1610
1698
|
if (e <= 0) continue;
|
|
1611
1699
|
let i = n.style[r];
|
|
1612
|
-
(t === null || e > t.width || e === t.width &&
|
|
1700
|
+
(t === null || e > t.width || e === t.width && tt[i] > tt[t.style]) && (t = {
|
|
1613
1701
|
width: e,
|
|
1614
1702
|
style: i,
|
|
1615
1703
|
color: n.color[r]
|
|
@@ -1617,7 +1705,7 @@ function Ye(e) {
|
|
|
1617
1705
|
}
|
|
1618
1706
|
return t;
|
|
1619
1707
|
}
|
|
1620
|
-
function
|
|
1708
|
+
function rt(e, t) {
|
|
1621
1709
|
let n = t.columnCount, r = t.rows.length, i = e.style.borderCollapse, a = {
|
|
1622
1710
|
collapsed: i,
|
|
1623
1711
|
vLines: Array.from({ length: n + 1 }, () => 0),
|
|
@@ -1662,7 +1750,7 @@ function Xe(e, t) {
|
|
|
1662
1750
|
side: u
|
|
1663
1751
|
});
|
|
1664
1752
|
}
|
|
1665
|
-
i.push(
|
|
1753
|
+
i.push(nt(l));
|
|
1666
1754
|
}
|
|
1667
1755
|
a.vSegments.push(i), a.vLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
1668
1756
|
}
|
|
@@ -1701,47 +1789,47 @@ function Xe(e, t) {
|
|
|
1701
1789
|
}), e === r && l.push({
|
|
1702
1790
|
border: s,
|
|
1703
1791
|
side: "bottom"
|
|
1704
|
-
}), i.push(
|
|
1792
|
+
}), i.push(nt(l));
|
|
1705
1793
|
}
|
|
1706
1794
|
a.hSegments.push(i), a.hLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
1707
1795
|
}
|
|
1708
1796
|
return a;
|
|
1709
1797
|
}
|
|
1710
|
-
function
|
|
1798
|
+
function it(e, t) {
|
|
1711
1799
|
return e.collapsed ? e.vLines.reduce((e, t) => e + t, 0) : (t + 1) * e.spacingX;
|
|
1712
1800
|
}
|
|
1713
|
-
function
|
|
1801
|
+
function at(e, t, n) {
|
|
1714
1802
|
if (!e.collapsed) return e.spacingX * (n - t - 1);
|
|
1715
1803
|
let r = 0;
|
|
1716
1804
|
for (let i = t + 1; i < n; i++) r += e.vLines[i];
|
|
1717
1805
|
return r;
|
|
1718
1806
|
}
|
|
1719
|
-
function
|
|
1807
|
+
function ot(e, t, n) {
|
|
1720
1808
|
if (!e.collapsed) return e.spacingY * (n - t - 1);
|
|
1721
1809
|
let r = 0;
|
|
1722
1810
|
for (let i = t + 1; i < n; i++) r += e.hLines[i];
|
|
1723
1811
|
return r;
|
|
1724
1812
|
}
|
|
1725
|
-
function
|
|
1813
|
+
function st(e, t) {
|
|
1726
1814
|
let n = t.tableData.get(e);
|
|
1727
1815
|
if (n) return n;
|
|
1728
|
-
let r =
|
|
1816
|
+
let r = Je(e, t), i = rt(e, r), a = {
|
|
1729
1817
|
structure: r,
|
|
1730
1818
|
chrome: i,
|
|
1731
|
-
bounds:
|
|
1732
|
-
chromeX:
|
|
1819
|
+
bounds: Qe(r, i, t),
|
|
1820
|
+
chromeX: it(i, r.columnCount)
|
|
1733
1821
|
};
|
|
1734
1822
|
return t.tableData.set(e, a), a;
|
|
1735
1823
|
}
|
|
1736
|
-
function
|
|
1737
|
-
let { structure: n, bounds: r, chromeX: i } =
|
|
1738
|
-
return n.caption && (a = Math.max(a,
|
|
1824
|
+
function ct(e, t) {
|
|
1825
|
+
let { structure: n, bounds: r, chromeX: i } = st(e, t), a = r.min.reduce((e, t) => e + t, 0) + i, o = r.max.reduce((e, t) => e + t, 0) + i;
|
|
1826
|
+
return n.caption && (a = Math.max(a, X(n.caption, t)), o = Math.max(o, Y(n.caption, t))), {
|
|
1739
1827
|
min: a,
|
|
1740
1828
|
max: o
|
|
1741
1829
|
};
|
|
1742
1830
|
}
|
|
1743
|
-
function
|
|
1744
|
-
let r = e.style, { bounds: i, chromeX: a } =
|
|
1831
|
+
function lt(e, t, n) {
|
|
1832
|
+
let r = e.style, { bounds: i, chromeX: a } = st(e, n), { min: o, max: s } = ct(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
1833
|
for (let e = 0; e < i.max.length; e++) {
|
|
1746
1834
|
let t = i.percent[e];
|
|
1747
1835
|
t === void 0 ? d += i.max[e] : u += t;
|
|
@@ -1757,8 +1845,8 @@ function nt(e, t, n) {
|
|
|
1757
1845
|
let f = Math.max(l + a, s) + c;
|
|
1758
1846
|
return Math.max(o + c, Math.min(f, t));
|
|
1759
1847
|
}
|
|
1760
|
-
function
|
|
1761
|
-
let { structure: o, chrome: s, bounds: c } =
|
|
1848
|
+
function ut(e, t, n, r, i, a) {
|
|
1849
|
+
let { structure: o, chrome: s, bounds: c } = st(e, a), l = o.columnCount, u = o.rows.length, d = r.left + i.left, f = r.top + i.top;
|
|
1762
1850
|
for (let e of o.hidden) e.tableHidden = !0, e.localRect = {
|
|
1763
1851
|
x: 0,
|
|
1764
1852
|
y: 0,
|
|
@@ -1770,14 +1858,14 @@ function rt(e, t, n, r, i, a) {
|
|
|
1770
1858
|
bottom: 0,
|
|
1771
1859
|
left: 0
|
|
1772
1860
|
}, e.unclampedHeight = 0;
|
|
1773
|
-
let p = Math.max(0, t -
|
|
1861
|
+
let p = Math.max(0, t - it(s, l)), h = e.style, g = h.tableLayout === "fixed" && h.width !== void 0 && h.width.kind !== "auto" ? et(o, p, a) : $e(c, p), _ = [], v = 0;
|
|
1774
1862
|
for (let e = 0; e < l; e++) v += s.collapsed ? s.vLines[e] : s.spacingX, _.push(v), v += g[e];
|
|
1775
1863
|
let y = v + (s.collapsed ? s.vLines[l] ?? 0 : s.spacingX), b = 0;
|
|
1776
|
-
o.caption && (
|
|
1864
|
+
o.caption && (H(o.caption, t, void 0, d, f, "fill", a), b = o.caption.localRect.height);
|
|
1777
1865
|
let x = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
|
|
1778
1866
|
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),
|
|
1867
|
+
let t = e.col + e.colSpan, n = g.slice(e.col, t).reduce((e, t) => e + t, 0) + at(s, e.col, t);
|
|
1868
|
+
S.set(e, n), H(e.node, n, void 0, 0, 0, "fill", a, { width: n }), x.set(e, e.node.localRect.height);
|
|
1781
1869
|
}
|
|
1782
1870
|
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
1871
|
for (let e = 0; e < u; e++) {
|
|
@@ -1792,9 +1880,9 @@ function rt(e, t, n, r, i, a) {
|
|
|
1792
1880
|
}
|
|
1793
1881
|
let O = o.cells.filter((e) => e.rowSpan > 1).sort((e, t) => e.rowSpan - t.rowSpan);
|
|
1794
1882
|
for (let e of O) {
|
|
1795
|
-
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
1883
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + ot(s, e.row, t), r = x.get(e) - n;
|
|
1796
1884
|
if (r <= 0) continue;
|
|
1797
|
-
let i =
|
|
1885
|
+
let i = I(Array.from({ length: e.rowSpan }, () => 1), r);
|
|
1798
1886
|
for (let n = e.row; n < t; n++) E[n] += i[n - e.row];
|
|
1799
1887
|
}
|
|
1800
1888
|
if (n !== void 0 && u > 0) {
|
|
@@ -1802,7 +1890,7 @@ function rt(e, t, n, r, i, a) {
|
|
|
1802
1890
|
if (e > 0) {
|
|
1803
1891
|
let t = [];
|
|
1804
1892
|
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 =
|
|
1893
|
+
let n = t.length > 0 ? t : Array.from({ length: u }, (e, t) => t), r = I(n.map(() => 1), e);
|
|
1806
1894
|
n.forEach((e, t) => E[e] += r[t]);
|
|
1807
1895
|
}
|
|
1808
1896
|
}
|
|
@@ -1843,75 +1931,75 @@ function rt(e, t, n, r, i, a) {
|
|
|
1843
1931
|
}, t.unclampedHeight = E[e];
|
|
1844
1932
|
}
|
|
1845
1933
|
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) => !
|
|
1934
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + ot(s, e.row, t);
|
|
1935
|
+
e.node.children.some((e) => !V(e.style) && e.style.height?.kind === "percent") && n !== x.get(e) && H(e.node, S.get(e), n, 0, 0, "fill", a, {
|
|
1848
1936
|
width: S.get(e),
|
|
1849
1937
|
height: n
|
|
1850
|
-
}),
|
|
1938
|
+
}), dt(e.node, n - (e.node.naturalContentHeight ?? e.node.localRect.height)), e.node.localRect = {
|
|
1851
1939
|
x: _[e.col],
|
|
1852
1940
|
y: 0,
|
|
1853
1941
|
width: e.node.localRect.width,
|
|
1854
1942
|
height: n
|
|
1855
1943
|
};
|
|
1856
1944
|
}
|
|
1857
|
-
for (let t of e.children)
|
|
1945
|
+
for (let t of e.children) V(t.style) && (t.staticSlot = {
|
|
1858
1946
|
kind: "block",
|
|
1859
1947
|
x: d,
|
|
1860
1948
|
y: f
|
|
1861
1949
|
});
|
|
1862
|
-
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + M), s.collapsed && l > 0 && u > 0 && (e.decorationRuns =
|
|
1950
|
+
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + M), s.collapsed && l > 0 && u > 0 && (e.decorationRuns = ft(s, o, g, E, _, A, d, f)), e.style.captionSide === "bottom" ? M + b : M;
|
|
1863
1951
|
}
|
|
1864
|
-
function
|
|
1952
|
+
function dt(e, t) {
|
|
1865
1953
|
if (t <= 0) return;
|
|
1866
1954
|
let n = e.style.verticalAlign, r = n === "center" ? Math.floor(t / 2) : n === "end" ? t : 0;
|
|
1867
|
-
if (!e.children.some((e) => !
|
|
1955
|
+
if (!e.children.some((e) => !V(e.style) && !e.inlineBox)) {
|
|
1868
1956
|
e.resolvedPadding.top += r, e.resolvedPadding.bottom += t - r;
|
|
1869
1957
|
return;
|
|
1870
1958
|
}
|
|
1871
|
-
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (
|
|
1959
|
+
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (V(t.style) ? t.staticSlot?.kind === "block" && (t.staticSlot.y += r) : t.localRect.y += r);
|
|
1872
1960
|
}
|
|
1873
|
-
function
|
|
1874
|
-
let u = t.columnCount, d = t.rows.length, f = [], p = (t) => t < u ?
|
|
1961
|
+
function ft(e, t, n, r, o, s, c, l) {
|
|
1962
|
+
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
1963
|
for (let t = 0; t <= u; t++) {
|
|
1876
1964
|
let n = e.vSegments[t];
|
|
1877
1965
|
for (let e = 0; e < d; e++) {
|
|
1878
|
-
let
|
|
1879
|
-
if (!
|
|
1880
|
-
let o = a
|
|
1881
|
-
for (let n = 0; n <
|
|
1966
|
+
let a = n[e];
|
|
1967
|
+
if (!a) continue;
|
|
1968
|
+
let o = i(a.style, "v");
|
|
1969
|
+
for (let n = 0; n < a.width; n++) for (let i = s[e]; i < s[e] + r[e]; i++) f.push({
|
|
1882
1970
|
glyph: o,
|
|
1883
1971
|
x: c + p(t) + n,
|
|
1884
|
-
y: l +
|
|
1972
|
+
y: l + i,
|
|
1885
1973
|
length: 1,
|
|
1886
|
-
color:
|
|
1974
|
+
color: a.color
|
|
1887
1975
|
});
|
|
1888
1976
|
}
|
|
1889
1977
|
}
|
|
1890
1978
|
for (let t = 0; t <= d; t++) {
|
|
1891
1979
|
let r = e.hSegments[t];
|
|
1892
1980
|
for (let e = 0; e < u; e++) {
|
|
1893
|
-
let
|
|
1894
|
-
if (!
|
|
1895
|
-
let s = a
|
|
1896
|
-
for (let r = 0; r <
|
|
1981
|
+
let a = r[e];
|
|
1982
|
+
if (!a) continue;
|
|
1983
|
+
let s = i(a.style, "h");
|
|
1984
|
+
for (let r = 0; r < a.width; r++) f.push({
|
|
1897
1985
|
glyph: s,
|
|
1898
|
-
x: c +
|
|
1986
|
+
x: c + o[e],
|
|
1899
1987
|
y: l + m(t) + r,
|
|
1900
1988
|
length: n[e],
|
|
1901
|
-
color:
|
|
1989
|
+
color: a.color
|
|
1902
1990
|
});
|
|
1903
1991
|
}
|
|
1904
1992
|
}
|
|
1905
1993
|
for (let t = 0; t <= u; t++) if (!(e.vLines[t] <= 0)) for (let n = 0; n <= d; n++) {
|
|
1906
1994
|
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,
|
|
1995
|
+
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
1996
|
r,
|
|
1909
1997
|
i,
|
|
1910
|
-
|
|
1998
|
+
o,
|
|
1911
1999
|
s
|
|
1912
2000
|
].filter((e) => e !== null);
|
|
1913
2001
|
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 &&
|
|
2002
|
+
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width && tt[t.style] > tt[e.style] ? t : e), v = a(g, r !== null, i !== null, o !== null, s !== null);
|
|
1915
2003
|
for (let r = 0; r < e.vLines[t]; r++) for (let i = 0; i < e.hLines[n]; i++) f.push({
|
|
1916
2004
|
glyph: v,
|
|
1917
2005
|
x: c + p(t) + r,
|
|
@@ -1924,30 +2012,30 @@ function at(e, t, n, r, i, s, c, l) {
|
|
|
1924
2012
|
}
|
|
1925
2013
|
//#endregion
|
|
1926
2014
|
//#region src/positioning.ts
|
|
1927
|
-
function
|
|
2015
|
+
function pt(e) {
|
|
1928
2016
|
return e.position === "absolute" || e.position === "fixed" ? "absolute" : e.position === "relative" || e.position === "sticky" ? "relative" : "static";
|
|
1929
2017
|
}
|
|
1930
|
-
function
|
|
2018
|
+
function mt(e, t, n, r, i) {
|
|
1931
2019
|
for (let a of e.children) {
|
|
1932
|
-
let o =
|
|
2020
|
+
let o = pt(a.style);
|
|
1933
2021
|
if (o === "relative") {
|
|
1934
2022
|
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
|
-
|
|
2023
|
+
a.localRect.x += ht(a.style.insets.left, a.style.insets.right, t), a.localRect.y += ht(a.style.insets.top, a.style.insets.bottom, n);
|
|
2024
|
+
} else o === "absolute" && _t(a, e, t, n, r, i);
|
|
2025
|
+
mt(a, t + a.localRect.x, n + a.localRect.y, [...r, {
|
|
1938
2026
|
node: a,
|
|
1939
2027
|
absX: t + a.localRect.x,
|
|
1940
2028
|
absY: n + a.localRect.y
|
|
1941
2029
|
}], i);
|
|
1942
2030
|
}
|
|
1943
2031
|
}
|
|
1944
|
-
function
|
|
1945
|
-
return e === null ? t === null ? 0 : -
|
|
2032
|
+
function ht(e, t, n) {
|
|
2033
|
+
return e === null ? t === null ? 0 : -W(t, n) : W(e, n);
|
|
1946
2034
|
}
|
|
1947
|
-
function
|
|
2035
|
+
function gt(e, t) {
|
|
1948
2036
|
if (!t) for (let t = e.length - 1; t > 0; t--) {
|
|
1949
2037
|
let n = e[t];
|
|
1950
|
-
if (!
|
|
2038
|
+
if (!Tt(n.node.style)) continue;
|
|
1951
2039
|
let r = n.node.style.border;
|
|
1952
2040
|
return {
|
|
1953
2041
|
x: n.absX + r.left,
|
|
@@ -1964,44 +2052,44 @@ function lt(e, t) {
|
|
|
1964
2052
|
height: n.node.localRect.height
|
|
1965
2053
|
};
|
|
1966
2054
|
}
|
|
1967
|
-
function
|
|
1968
|
-
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s &&
|
|
2055
|
+
function _t(e, t, n, r, i, a) {
|
|
2056
|
+
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s && Tt(t.style) ? {
|
|
1969
2057
|
x: n + c.area.x,
|
|
1970
2058
|
y: r + c.area.y,
|
|
1971
2059
|
width: c.area.width,
|
|
1972
2060
|
height: c.area.height
|
|
1973
|
-
} :
|
|
1974
|
-
if (!y) C.width =
|
|
1975
|
-
else if (u !== null && d !== null) C.width =
|
|
2061
|
+
} : gt(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 = jt(o.minWidth, l.width, e, a) ?? 0, S = jt(o.maxWidth, l.width, e, a), C = {};
|
|
2062
|
+
if (!y) C.width = U(J(o.width, l.width, e, a), x, S);
|
|
2063
|
+
else if (u !== null && d !== null) C.width = U(Math.max(0, l.width - u - d - h - g), x, S);
|
|
1976
2064
|
else {
|
|
1977
2065
|
let t = Math.max(0, l.width - (u ?? 0) - (d ?? 0) - h - g);
|
|
1978
|
-
C.width =
|
|
2066
|
+
C.width = U(Math.min(Y(e, a), Math.max(X(e, a), t)), x, S);
|
|
1979
2067
|
}
|
|
1980
|
-
f !== null && p !== null && b && (C.height =
|
|
2068
|
+
f !== null && p !== null && b && (C.height = U(Math.max(0, l.height - f - p - _ - v), q(o.minHeight, l.height) ?? 0, q(o.maxHeight, l.height))), H(e, l.width, l.height, 0, 0, "shrink", a, C);
|
|
1981
2069
|
let w = e.localRect.width, T = e.localRect.height, E;
|
|
1982
2070
|
if (u !== null && d !== null) {
|
|
1983
2071
|
let e = Math.max(0, l.width - u - d - w - h - g), t = m.left === null && m.right === null;
|
|
1984
2072
|
E = l.x + u + h + (t ? Math.floor(e / 2) : m.left === null ? e : 0);
|
|
1985
|
-
} else E = u === null ? d === null ?
|
|
2073
|
+
} else E = u === null ? d === null ? St(e, t, n, w) : l.x + l.width - d - w - g : l.x + u + h;
|
|
1986
2074
|
let D;
|
|
1987
2075
|
if (f !== null && p !== null) {
|
|
1988
2076
|
let e = Math.max(0, l.height - f - p - T - _ - v), t = m.top === null && m.bottom === null;
|
|
1989
2077
|
D = l.y + f + _ + (t ? Math.floor(e / 2) : m.top === null ? e : 0);
|
|
1990
|
-
} else D = f === null ? p === null ?
|
|
2078
|
+
} else D = f === null ? p === null ? Ct(e, t, r, T) : l.y + l.height - p - T - v : l.y + f + _;
|
|
1991
2079
|
e.localRect = {
|
|
1992
2080
|
...e.localRect,
|
|
1993
2081
|
x: E - n,
|
|
1994
2082
|
y: D - r
|
|
1995
2083
|
};
|
|
1996
2084
|
}
|
|
1997
|
-
function
|
|
1998
|
-
return
|
|
2085
|
+
function vt(e, t, n) {
|
|
2086
|
+
return F(e, [n], Math.max(0, t - n))[0];
|
|
1999
2087
|
}
|
|
2000
|
-
function
|
|
2001
|
-
return L(
|
|
2088
|
+
function yt(e, t, n, r) {
|
|
2089
|
+
return R(L(e, t), n, r);
|
|
2002
2090
|
}
|
|
2003
|
-
function
|
|
2004
|
-
let a =
|
|
2091
|
+
function bt(e, t, n, r, i) {
|
|
2092
|
+
let a = G(e.style.margin, n.innerWidth), [o, s, c, l] = r === "x" ? [
|
|
2005
2093
|
a.left ?? 0,
|
|
2006
2094
|
a.right ?? 0,
|
|
2007
2095
|
n.innerWidth,
|
|
@@ -2012,10 +2100,10 @@ function pt(e, t, n, r, i) {
|
|
|
2012
2100
|
n.innerHeight,
|
|
2013
2101
|
n.direction === "column"
|
|
2014
2102
|
], u = i + o + s;
|
|
2015
|
-
return (l ?
|
|
2103
|
+
return (l ? vt(ce(t.style), c, u) : yt(e, t, c, u)) + o;
|
|
2016
2104
|
}
|
|
2017
|
-
function
|
|
2018
|
-
let a =
|
|
2105
|
+
function xt(e, t, n, r, i) {
|
|
2106
|
+
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
2107
|
a.left ?? 0,
|
|
2020
2108
|
a.right ?? 0,
|
|
2021
2109
|
n.width,
|
|
@@ -2024,35 +2112,35 @@ function mt(e, t, n, r, i) {
|
|
|
2024
2112
|
a.top ?? 0,
|
|
2025
2113
|
a.bottom ?? 0,
|
|
2026
2114
|
n.height,
|
|
2027
|
-
|
|
2115
|
+
L(e, t)
|
|
2028
2116
|
];
|
|
2029
|
-
return
|
|
2117
|
+
return R(u, l, i + s + c) + s;
|
|
2030
2118
|
}
|
|
2031
|
-
function
|
|
2119
|
+
function St(e, t, n, r) {
|
|
2032
2120
|
let i = e.staticSlot;
|
|
2033
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x +
|
|
2121
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x + xt(e, t, i.staticArea, "x", r) : n + i.originX + bt(e, t, i, "x", r);
|
|
2034
2122
|
}
|
|
2035
|
-
function
|
|
2123
|
+
function Ct(e, t, n, r) {
|
|
2036
2124
|
let i = e.staticSlot;
|
|
2037
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y +
|
|
2125
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y + xt(e, t, i.staticArea, "y", r) : n + i.originY + bt(e, t, i, "y", r);
|
|
2038
2126
|
}
|
|
2039
2127
|
//#endregion
|
|
2040
2128
|
//#region src/layout.ts
|
|
2041
|
-
function
|
|
2042
|
-
let n =
|
|
2043
|
-
return
|
|
2129
|
+
function wt(e, t) {
|
|
2130
|
+
let n = Et();
|
|
2131
|
+
return H(e, t, void 0, 0, 0, "fill", n), mt(e, 0, 0, [{
|
|
2044
2132
|
node: e,
|
|
2045
2133
|
absX: 0,
|
|
2046
2134
|
absY: 0
|
|
2047
2135
|
}], n), { height: e.localRect.height };
|
|
2048
2136
|
}
|
|
2049
|
-
function
|
|
2137
|
+
function V(e) {
|
|
2050
2138
|
return e.position === "absolute" || e.position === "fixed";
|
|
2051
2139
|
}
|
|
2052
|
-
function
|
|
2140
|
+
function Tt(e) {
|
|
2053
2141
|
return e.position !== "static";
|
|
2054
2142
|
}
|
|
2055
|
-
function
|
|
2143
|
+
function Et() {
|
|
2056
2144
|
return {
|
|
2057
2145
|
maxContent: /* @__PURE__ */ new WeakMap(),
|
|
2058
2146
|
minContent: /* @__PURE__ */ new WeakMap(),
|
|
@@ -2060,91 +2148,91 @@ function yt() {
|
|
|
2060
2148
|
tableData: /* @__PURE__ */ new WeakMap()
|
|
2061
2149
|
};
|
|
2062
2150
|
}
|
|
2063
|
-
function
|
|
2151
|
+
function H(e, t, n, r, i, a, o, s) {
|
|
2064
2152
|
let c = e.style, l = s?.height;
|
|
2065
2153
|
delete e.decorationRuns;
|
|
2066
|
-
let u =
|
|
2067
|
-
top:
|
|
2068
|
-
right:
|
|
2069
|
-
bottom:
|
|
2070
|
-
left:
|
|
2154
|
+
let u = jt(c.minWidth, t, e, o) ?? 0, d = jt(c.maxWidth, t, e, o), f = q(c.minHeight, n) ?? 0, p = q(c.maxHeight, n), m = {
|
|
2155
|
+
top: W(c.padding.top, t),
|
|
2156
|
+
right: W(c.padding.right, t),
|
|
2157
|
+
bottom: W(c.padding.bottom, t),
|
|
2158
|
+
left: W(c.padding.left, t)
|
|
2071
2159
|
};
|
|
2072
2160
|
e.resolvedPadding = m;
|
|
2073
|
-
let h = s?.width ??
|
|
2074
|
-
if (
|
|
2161
|
+
let h = s?.width ?? U(Pt(c, t, a, e, o), u, d), g = It(c, n), _ = zt(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;
|
|
2162
|
+
if (Dt(e)) {
|
|
2075
2163
|
if (e.text) {
|
|
2076
2164
|
let t = e.children.filter((e) => e.inlineBox);
|
|
2077
|
-
|
|
2165
|
+
E(e.text, (n, r) => {
|
|
2078
2166
|
let i = t[r];
|
|
2079
|
-
|
|
2167
|
+
H(i, _.width, void 0, 0, 0, "shrink", o), e.advances[n] = Math.max(1, i.localRect.width);
|
|
2080
2168
|
});
|
|
2081
|
-
let n =
|
|
2082
|
-
if (
|
|
2169
|
+
let n = kt(e, _.width);
|
|
2170
|
+
if (b = n.totalRows, Ot(e, n, _.width, _.height, m), t.length > 0) {
|
|
2083
2171
|
let r = (e) => n.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
2084
|
-
|
|
2172
|
+
E(e.text, (i, a) => {
|
|
2085
2173
|
let o = r(i);
|
|
2086
2174
|
if (o === -1) return;
|
|
2087
2175
|
let s = n.spans[o];
|
|
2088
2176
|
t[a].localRect = {
|
|
2089
2177
|
...t[a].localRect,
|
|
2090
|
-
x: c.border.left + m.left +
|
|
2178
|
+
x: c.border.left + m.left + S(s.start, i, e.advances),
|
|
2091
2179
|
y: c.border.top + m.top + n.lineY[o]
|
|
2092
2180
|
};
|
|
2093
2181
|
});
|
|
2094
2182
|
}
|
|
2095
|
-
} else
|
|
2183
|
+
} else b = e.intrinsicHeight;
|
|
2096
2184
|
for (let t of e.children) {
|
|
2097
2185
|
if (t.inlineBox) continue;
|
|
2098
|
-
let e =
|
|
2186
|
+
let e = G(t.style.margin, _.width);
|
|
2099
2187
|
t.staticSlot = {
|
|
2100
2188
|
kind: "block",
|
|
2101
2189
|
x: c.border.left + m.left + (e.left ?? 0),
|
|
2102
2190
|
y: c.border.top + m.top + (e.top ?? 0)
|
|
2103
2191
|
};
|
|
2104
2192
|
}
|
|
2105
|
-
} else
|
|
2106
|
-
let
|
|
2107
|
-
e.unclampedHeight = C, e.naturalContentHeight =
|
|
2193
|
+
} else b = c.display === "flex" && c.flexDirection === "row" ? P(e, _.width, _.height, y, c.border, m, o) : c.display === "flex" && c.flexDirection === "column" ? te(e, _.width, _.height, v, c.border, m, o) : c.display === "grid" ? de(e, _.width, _.height, c.border, m, o) : c.display === "table" ? ut(e, _.width, y, c.border, m, o) : Mt(e, _.width, y, c.border, m, o);
|
|
2194
|
+
let x = b + c.border.top + c.border.bottom + m.top + m.bottom, C = l ?? g ?? x;
|
|
2195
|
+
e.unclampedHeight = C, e.naturalContentHeight = x, e.localRect = {
|
|
2108
2196
|
x: r,
|
|
2109
2197
|
y: i,
|
|
2110
2198
|
width: h,
|
|
2111
|
-
height:
|
|
2199
|
+
height: U(C, f, p)
|
|
2112
2200
|
};
|
|
2113
2201
|
}
|
|
2114
|
-
function
|
|
2115
|
-
return e.children.some((e) => !
|
|
2202
|
+
function Dt(e) {
|
|
2203
|
+
return e.children.some((e) => !V(e.style) && !e.inlineBox) ? !1 : e.text !== "" || e.style.display !== "flex" && e.style.display !== "grid";
|
|
2116
2204
|
}
|
|
2117
|
-
function
|
|
2205
|
+
function U(e, t, n) {
|
|
2118
2206
|
return Math.max(t, n === void 0 ? e : Math.min(e, n));
|
|
2119
2207
|
}
|
|
2120
|
-
function
|
|
2208
|
+
function Ot(e, t, n, r, i) {
|
|
2121
2209
|
let a = e.style;
|
|
2122
2210
|
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,
|
|
2211
|
+
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
2212
|
if (c > 0) {
|
|
2125
|
-
let e = a.display === "grid" ?
|
|
2213
|
+
let e = a.display === "grid" ? R(a.justifyItems, n, s) : o ? R(a.alignItems, n, s) : F(ce(a), [s], c)[0];
|
|
2126
2214
|
e > 0 && (i.left += e, i.right += c - e);
|
|
2127
2215
|
}
|
|
2128
2216
|
if (Number.isFinite(r)) {
|
|
2129
2217
|
let e = Math.max(0, r - t.totalRows);
|
|
2130
2218
|
if (e > 0) {
|
|
2131
|
-
let n = a.display === "grid" || !o ?
|
|
2219
|
+
let n = a.display === "grid" || !o ? R(a.alignItems, r, t.totalRows) : F(ce(a), [t.totalRows], e)[0];
|
|
2132
2220
|
n > 0 && (i.top += n, i.bottom += e - n);
|
|
2133
2221
|
}
|
|
2134
2222
|
}
|
|
2135
2223
|
}
|
|
2136
|
-
function
|
|
2137
|
-
let n = e.style.whiteSpace === "normal" ?
|
|
2224
|
+
function kt(e, t) {
|
|
2225
|
+
let n = e.style.whiteSpace === "normal" ? x(e.text, t, {
|
|
2138
2226
|
advances: e.advances,
|
|
2139
2227
|
tracking: e.style.tracking
|
|
2140
|
-
}) :
|
|
2228
|
+
}) : b(e.text), r = e.children.filter((e) => e.inlineBox), i = [], a = [], o = 0, s = 0;
|
|
2141
2229
|
for (let t = 0; t < n.length; t++) {
|
|
2142
2230
|
i.push(o);
|
|
2143
2231
|
let c = n[t], l = 1, u = 0;
|
|
2144
2232
|
for (let t = c.start; t < c.end; t++) {
|
|
2145
2233
|
if (e.text[t] !== "") continue;
|
|
2146
2234
|
let n = r[s];
|
|
2147
|
-
l = Math.max(l, n.localRect.height), n.style.verticalAlign === "end" ? u = Math.max(u, n.localRect.height - 1) : n.style.verticalAlign === "center" &&
|
|
2235
|
+
l = Math.max(l, n.localRect.height), n.style.verticalAlign === "end" ? u = Math.max(u, n.localRect.height - 1) : n.style.verticalAlign === "center" && Ue(n.source, "vertical-align: middle on an inline box can't land on whole rows and behaves as top. Use align-top or align-bottom."), s++;
|
|
2148
2236
|
}
|
|
2149
2237
|
a.push(o + Math.min(u, l - 1)), o += l + (t < n.length - 1 ? e.style.lineGap : 0);
|
|
2150
2238
|
}
|
|
@@ -2155,15 +2243,15 @@ function St(e, t) {
|
|
|
2155
2243
|
totalRows: o
|
|
2156
2244
|
};
|
|
2157
2245
|
}
|
|
2158
|
-
function
|
|
2159
|
-
let r =
|
|
2246
|
+
function At(e, t, n) {
|
|
2247
|
+
let r = W(t === "x" ? e.gapX : e.gapY, n), i = t === "x" ? e.ruleX : e.ruleY;
|
|
2160
2248
|
return Math.max(r, i?.width ?? 0);
|
|
2161
2249
|
}
|
|
2162
|
-
function
|
|
2250
|
+
function W(e, t) {
|
|
2163
2251
|
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 : m(e.percent, t);
|
|
2164
2252
|
}
|
|
2165
|
-
function
|
|
2166
|
-
let n = (e) => e === null ? null :
|
|
2253
|
+
function G(e, t) {
|
|
2254
|
+
let n = (e) => e === null ? null : W(e, t);
|
|
2167
2255
|
return {
|
|
2168
2256
|
top: n(e.top),
|
|
2169
2257
|
right: n(e.right),
|
|
@@ -2171,32 +2259,32 @@ function q(e, t) {
|
|
|
2171
2259
|
left: n(e.left)
|
|
2172
2260
|
};
|
|
2173
2261
|
}
|
|
2174
|
-
function
|
|
2262
|
+
function K(e) {
|
|
2175
2263
|
return typeof e == "number" ? e : 0;
|
|
2176
2264
|
}
|
|
2177
|
-
function
|
|
2265
|
+
function q(e, t) {
|
|
2178
2266
|
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 : m(e.percent, t);
|
|
2179
2267
|
}
|
|
2180
|
-
function
|
|
2181
|
-
return e === "min-content" || e === "max-content" || e === "fit-content" ?
|
|
2268
|
+
function jt(e, t, n, r) {
|
|
2269
|
+
return e === "min-content" || e === "max-content" || e === "fit-content" ? J({ kind: e }, t, n, r) : q(e, t);
|
|
2182
2270
|
}
|
|
2183
|
-
function
|
|
2271
|
+
function Mt(e, t, n, r, i, a) {
|
|
2184
2272
|
let o = r.left + i.left, s = r.top + i.top, c = s, l = null;
|
|
2185
2273
|
for (let r of e.children) {
|
|
2186
|
-
let e =
|
|
2187
|
-
if (
|
|
2274
|
+
let e = G(r.style.margin, t), i = e.top ?? 0, s = e.bottom ?? 0, u = e.left ?? 0, d = e.right ?? 0;
|
|
2275
|
+
if (V(r.style)) {
|
|
2188
2276
|
r.staticSlot = {
|
|
2189
2277
|
kind: "block",
|
|
2190
2278
|
x: o + u,
|
|
2191
|
-
y: c + (l === null ? i :
|
|
2279
|
+
y: c + (l === null ? i : Nt(l, i))
|
|
2192
2280
|
};
|
|
2193
2281
|
continue;
|
|
2194
2282
|
}
|
|
2195
|
-
|
|
2283
|
+
H(r, Math.max(0, t - u - d), n, 0, 0, "fill", a);
|
|
2196
2284
|
let f = t - r.localRect.width, p = e.left === null && e.right === null, m = e.left === null && e.right !== null;
|
|
2197
2285
|
e.right === null && e.left;
|
|
2198
2286
|
let h;
|
|
2199
|
-
h = p ? Math.floor(f / 2) : m ? f - d : u, c += l === null ? i :
|
|
2287
|
+
h = p ? Math.floor(f / 2) : m ? f - d : u, c += l === null ? i : Nt(l, i), r.localRect = {
|
|
2200
2288
|
...r.localRect,
|
|
2201
2289
|
x: o + h,
|
|
2202
2290
|
y: c
|
|
@@ -2204,77 +2292,77 @@ function Tt(e, t, n, r, i, a) {
|
|
|
2204
2292
|
}
|
|
2205
2293
|
return l !== null && (c += l), c - s;
|
|
2206
2294
|
}
|
|
2207
|
-
function
|
|
2295
|
+
function Nt(e, t) {
|
|
2208
2296
|
return e >= 0 && t >= 0 ? Math.max(e, t) : e <= 0 && t <= 0 ? Math.min(e, t) : e + t;
|
|
2209
2297
|
}
|
|
2210
|
-
function
|
|
2298
|
+
function Pt(e, t, n, r, i) {
|
|
2211
2299
|
let a = e.width;
|
|
2212
2300
|
if (e.display === "table") {
|
|
2213
|
-
if (!r.children.some((e) => !
|
|
2301
|
+
if (!r.children.some((e) => !V(e.style) && !e.inlineBox)) return a !== void 0 && a.kind !== "auto" ? J(a, t, r, i) : Math.min(t, Y(r, i));
|
|
2214
2302
|
if (a !== void 0 && a.kind !== "auto") {
|
|
2215
|
-
let e =
|
|
2216
|
-
return Math.max(e,
|
|
2303
|
+
let e = J(a, t, r, i);
|
|
2304
|
+
return Math.max(e, Ft(r, t, i));
|
|
2217
2305
|
}
|
|
2218
|
-
return
|
|
2306
|
+
return lt(r, t, i);
|
|
2219
2307
|
}
|
|
2220
|
-
return a !== void 0 && a.kind !== "auto" ?
|
|
2308
|
+
return a !== void 0 && a.kind !== "auto" ? J(a, t, r, i) : n === "shrink" ? Math.min(t, Y(r, i)) : t;
|
|
2221
2309
|
}
|
|
2222
|
-
function
|
|
2310
|
+
function Ft(e, t, n) {
|
|
2223
2311
|
let r = e.style;
|
|
2224
|
-
return
|
|
2312
|
+
return ct(e, n).min + r.border.left + r.border.right + W(r.padding.left, t) + W(r.padding.right, t);
|
|
2225
2313
|
}
|
|
2226
|
-
function
|
|
2314
|
+
function It(e, t) {
|
|
2227
2315
|
if (e.height?.kind === "cells") return e.height.value;
|
|
2228
2316
|
if (e.height?.kind === "percent" && t != null) return m(e.height.value, t);
|
|
2229
2317
|
}
|
|
2230
|
-
function
|
|
2318
|
+
function J(e, t, n, r) {
|
|
2231
2319
|
switch (e.kind) {
|
|
2232
2320
|
case "cells": return e.value;
|
|
2233
2321
|
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
|
|
2322
|
+
case "min-content": return X(n, r);
|
|
2323
|
+
case "max-content": return Y(n, r);
|
|
2324
|
+
case "fit-content": return Math.min(Y(n, r), Math.max(X(n, r), t));
|
|
2325
|
+
case "auto": return Y(n, r);
|
|
2238
2326
|
}
|
|
2239
2327
|
}
|
|
2240
|
-
function
|
|
2328
|
+
function Y(e, t) {
|
|
2241
2329
|
let n = t.maxContent.get(e);
|
|
2242
2330
|
if (n !== void 0) return n;
|
|
2243
|
-
let r = e.style, i =
|
|
2331
|
+
let r = e.style, i = Lt(e, t) + r.border.left + r.border.right + K(r.padding.left) + K(r.padding.right);
|
|
2244
2332
|
return t.maxContent.set(e, i), i;
|
|
2245
2333
|
}
|
|
2246
|
-
function
|
|
2247
|
-
let n = e.children.filter((e) => !
|
|
2334
|
+
function Lt(e, t) {
|
|
2335
|
+
let n = e.children.filter((e) => !V(e.style) && !e.inlineBox);
|
|
2248
2336
|
if (n.length === 0) return e.intrinsicWidth;
|
|
2249
|
-
if (e.style.display === "grid") return
|
|
2250
|
-
if (e.style.display === "table") return
|
|
2337
|
+
if (e.style.display === "grid") return be(e, t).max;
|
|
2338
|
+
if (e.style.display === "table") return ct(e, t).max;
|
|
2251
2339
|
if (e.style.display === "flex" && e.style.flexDirection === "row") {
|
|
2252
|
-
let r = Math.max(
|
|
2253
|
-
return n.reduce((e, n) => e +
|
|
2340
|
+
let r = Math.max(K(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
2341
|
+
return n.reduce((e, n) => e + Y(n, t), 0) + r;
|
|
2254
2342
|
}
|
|
2255
|
-
return n.reduce((e, n) => Math.max(e,
|
|
2343
|
+
return n.reduce((e, n) => Math.max(e, Y(n, t)), 0);
|
|
2256
2344
|
}
|
|
2257
|
-
function
|
|
2345
|
+
function X(e, t) {
|
|
2258
2346
|
let n = t.minContent.get(e);
|
|
2259
2347
|
if (n !== void 0) return n;
|
|
2260
|
-
let r = e.style, i =
|
|
2348
|
+
let r = e.style, i = Rt(e, t) + r.border.left + r.border.right + K(r.padding.left) + K(r.padding.right);
|
|
2261
2349
|
return t.minContent.set(e, i), i;
|
|
2262
2350
|
}
|
|
2263
|
-
function
|
|
2264
|
-
let n = e.children.filter((e) => !
|
|
2265
|
-
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth :
|
|
2351
|
+
function Rt(e, t) {
|
|
2352
|
+
let n = e.children.filter((e) => !V(e.style) && !e.inlineBox);
|
|
2353
|
+
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth : T(e.text, {
|
|
2266
2354
|
advances: e.advances,
|
|
2267
2355
|
tracking: e.style.tracking
|
|
2268
2356
|
});
|
|
2269
|
-
if (e.style.display === "grid") return
|
|
2270
|
-
if (e.style.display === "table") return
|
|
2357
|
+
if (e.style.display === "grid") return be(e, t).min;
|
|
2358
|
+
if (e.style.display === "table") return ct(e, t).min;
|
|
2271
2359
|
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 +
|
|
2360
|
+
let r = Math.max(K(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
2361
|
+
return n.reduce((e, n) => e + X(n, t), 0) + r;
|
|
2274
2362
|
}
|
|
2275
|
-
return n.reduce((e, n) => Math.max(e,
|
|
2363
|
+
return n.reduce((e, n) => Math.max(e, X(n, t)), 0);
|
|
2276
2364
|
}
|
|
2277
|
-
function
|
|
2365
|
+
function zt(e, t, n, r) {
|
|
2278
2366
|
return {
|
|
2279
2367
|
width: Math.max(0, e - n.left - n.right - r.left - r.right),
|
|
2280
2368
|
height: Math.max(0, t - n.top - n.bottom - r.top - r.bottom)
|
|
@@ -2282,42 +2370,63 @@ function Mt(e, t, n, r) {
|
|
|
2282
2370
|
}
|
|
2283
2371
|
//#endregion
|
|
2284
2372
|
//#region src/plain-text.ts
|
|
2285
|
-
function
|
|
2286
|
-
return
|
|
2287
|
-
}
|
|
2288
|
-
function Pt(e) {
|
|
2289
|
-
let { grid: t, paints: n } = It(e);
|
|
2290
|
-
return t.map((e, t) => {
|
|
2291
|
-
let r = e.join("").trimEnd(), i = [];
|
|
2292
|
-
for (let e = 0; e < r.length; e++) {
|
|
2293
|
-
let a = n[t][e], o = i[i.length - 1];
|
|
2294
|
-
o && Ft(o, a) ? o.text += r[e] : i.push({
|
|
2295
|
-
text: r[e],
|
|
2296
|
-
...a
|
|
2297
|
-
});
|
|
2298
|
-
}
|
|
2299
|
-
return i;
|
|
2300
|
-
});
|
|
2373
|
+
function Bt(e) {
|
|
2374
|
+
return Kt(e).grid.map((e) => e.join("").trimEnd()).join("\n");
|
|
2301
2375
|
}
|
|
2302
|
-
function
|
|
2303
|
-
|
|
2376
|
+
function Vt(e) {
|
|
2377
|
+
let { grid: t, paints: n } = Kt(e);
|
|
2378
|
+
return t.map((e, t) => Ht(e, n[t]));
|
|
2304
2379
|
}
|
|
2305
|
-
function
|
|
2380
|
+
function Ht(e, t) {
|
|
2381
|
+
let n = e.length;
|
|
2382
|
+
for (; n > 0 && e[n - 1] === " " && t[n - 1]?.backgroundColor === void 0;) n--;
|
|
2383
|
+
let r = [];
|
|
2384
|
+
for (let i = 0; i < n; i++) {
|
|
2385
|
+
let n = t[i], a = r[r.length - 1];
|
|
2386
|
+
a && Ut(a, n) ? a.text += e[i] : r.push({
|
|
2387
|
+
text: e[i],
|
|
2388
|
+
...n
|
|
2389
|
+
});
|
|
2390
|
+
}
|
|
2391
|
+
return r;
|
|
2392
|
+
}
|
|
2393
|
+
function Ut(e, t) {
|
|
2394
|
+
return e.color === t?.color && e.backgroundColor === t?.backgroundColor && e.fontWeight === t?.fontWeight && e.fontStyle === t?.fontStyle && e.textDecorationLine === t?.textDecorationLine;
|
|
2395
|
+
}
|
|
2396
|
+
function Wt(e, t) {
|
|
2397
|
+
e.color !== void 0 && (t.color = e.color), e.backgroundColor !== void 0 && (t.backgroundColor = e.backgroundColor), e.fontWeight !== void 0 && (t.fontWeight = e.fontWeight), e.fontStyle !== void 0 && (t.fontStyle = e.fontStyle), e.textDecorationLine !== void 0 && (t.textDecoration = e.textDecorationLine);
|
|
2398
|
+
}
|
|
2399
|
+
function Gt(e) {
|
|
2400
|
+
return e.color === void 0 && e.backgroundColor === void 0 && e.fontWeight === void 0 && e.fontStyle === void 0 && e.textDecorationLine === void 0;
|
|
2401
|
+
}
|
|
2402
|
+
function Kt(e) {
|
|
2306
2403
|
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
|
|
2404
|
+
return Jt(e, 0, 0, (e, a, o, s) => {
|
|
2405
|
+
if (e >= 0 && e < t && a >= 0 && a < n) {
|
|
2406
|
+
r[a][e] = o;
|
|
2407
|
+
let t = i[a][e];
|
|
2408
|
+
i[a][e] = t ? {
|
|
2409
|
+
...t,
|
|
2410
|
+
...s
|
|
2411
|
+
} : s;
|
|
2412
|
+
}
|
|
2309
2413
|
}), {
|
|
2310
2414
|
grid: r,
|
|
2311
2415
|
paints: i
|
|
2312
2416
|
};
|
|
2313
2417
|
}
|
|
2314
|
-
function
|
|
2418
|
+
function qt(e) {
|
|
2315
2419
|
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;
|
|
2420
|
+
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
2421
|
}
|
|
2318
|
-
function
|
|
2422
|
+
function Jt(t, n, i, a) {
|
|
2319
2423
|
if (t.tableHidden) return;
|
|
2320
|
-
let o = n + t.localRect.x, s =
|
|
2424
|
+
let o = n + t.localRect.x, s = i + t.localRect.y, c = t.style;
|
|
2425
|
+
if (c.backgroundColor !== void 0 || c.backgroundClear) {
|
|
2426
|
+
let e = c.backgroundColor === void 0 ? void 0 : { backgroundColor: c.backgroundColor };
|
|
2427
|
+
for (let n = 0; n < t.localRect.height; n++) for (let r = 0; r < t.localRect.width; r++) a(o + r, s + n, " ", e);
|
|
2428
|
+
}
|
|
2429
|
+
let l = [];
|
|
2321
2430
|
e(c, {
|
|
2322
2431
|
x: o,
|
|
2323
2432
|
y: s,
|
|
@@ -2333,45 +2442,74 @@ function Rt(t, n, r, a) {
|
|
|
2333
2442
|
for (let n = 0; n < e.length; n++) a(o + e.x + n, s + e.y, e.glyph, t);
|
|
2334
2443
|
}
|
|
2335
2444
|
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: l, textY: u } =
|
|
2445
|
+
let e = t.resolvedPadding, n = o + c.border.left + e.left, r = s + c.border.top + e.top, i = t.localRect.width - c.border.left - c.border.right - e.left - e.right, { spans: l, textY: u } = kt(t, i), d = qt(c), f = t.inlineElements?.map((e) => qt(e));
|
|
2337
2446
|
for (let e = 0; e < l.length; e++) {
|
|
2338
|
-
let o = l[e], s = r + u[e], p = c.whiteSpace !== "normal" && c.overflow === "clip" ?
|
|
2447
|
+
let o = l[e], s = r + u[e], p = c.whiteSpace !== "normal" && c.overflow === "clip" ? Yt(t.text, o, i, t.advances, c) : {
|
|
2339
2448
|
end: o.end,
|
|
2340
2449
|
ellipsis: !1
|
|
2341
|
-
}, m =
|
|
2450
|
+
}, m = C(o.start, o.end, t.advances, c.tracking), h = Math.max(0, i - m), g = n + (c.textAlign === "end" ? h : c.textAlign === "center" ? Math.floor(h / 2) : 0);
|
|
2342
2451
|
for (let e = o.start; e < p.end; e++) {
|
|
2343
|
-
if (t.text[e] !== ""
|
|
2452
|
+
if (t.text[e] !== "") {
|
|
2344
2453
|
let n = t.charInline?.[e] ?? -1, r = n >= 0 ? t.inlineElements[n] : void 0, i = r?.insets, o = i ? i.left ?? (i.right === null ? 0 : -i.right) : 0, c = i ? i.top ?? (i.bottom === null ? 0 : -i.bottom) : 0;
|
|
2345
|
-
a(
|
|
2454
|
+
t.text[e] === "" ? r?.backgroundColor && a(g + o, s + c, " ", { backgroundColor: r.backgroundColor }) : a(g + o, s + c, t.text[e], r ? f[n] : d);
|
|
2346
2455
|
}
|
|
2347
|
-
|
|
2456
|
+
g += S(e, e + 1, t.advances);
|
|
2348
2457
|
}
|
|
2349
|
-
p.ellipsis && a(
|
|
2458
|
+
p.ellipsis && a(g, s, "…", d);
|
|
2350
2459
|
}
|
|
2351
2460
|
}
|
|
2352
|
-
for (let e of
|
|
2461
|
+
for (let e of r(t)) Jt(e, o, s, a);
|
|
2353
2462
|
}
|
|
2354
|
-
function
|
|
2463
|
+
function Yt(e, t, n, r, i) {
|
|
2355
2464
|
let { textOverflow: a, tracking: o } = i;
|
|
2356
|
-
if (
|
|
2465
|
+
if (C(t.start, t.end, r, o) <= n) return {
|
|
2357
2466
|
end: t.end,
|
|
2358
2467
|
ellipsis: !1
|
|
2359
2468
|
};
|
|
2360
2469
|
let s = a === "ellipsis" ? n - 1 : n, c = t.start;
|
|
2361
|
-
for (; c < t.end &&
|
|
2470
|
+
for (; c < t.end && C(t.start, c + 1, r, o) <= s;) c++;
|
|
2362
2471
|
return {
|
|
2363
2472
|
end: c,
|
|
2364
2473
|
ellipsis: a === "ellipsis" && n > 0
|
|
2365
2474
|
};
|
|
2366
2475
|
}
|
|
2367
2476
|
//#endregion
|
|
2477
|
+
//#region src/paint.ts
|
|
2478
|
+
var Xt = /* @__PURE__ */ new WeakMap();
|
|
2479
|
+
function Zt(e, t) {
|
|
2480
|
+
let n = Vt(e), r = Qt(n);
|
|
2481
|
+
if (Xt.get(t) === r) return;
|
|
2482
|
+
Xt.set(t, r);
|
|
2483
|
+
let i = document.createDocumentFragment();
|
|
2484
|
+
for (let e = 0; e < n.length; e++) {
|
|
2485
|
+
e > 0 && i.appendChild(document.createTextNode("\n"));
|
|
2486
|
+
for (let t of n[e]) {
|
|
2487
|
+
if (Gt(t)) {
|
|
2488
|
+
i.appendChild(document.createTextNode(t.text));
|
|
2489
|
+
continue;
|
|
2490
|
+
}
|
|
2491
|
+
let e = document.createElement("span");
|
|
2492
|
+
Wt(t, e.style), e.textContent = t.text, i.appendChild(e);
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
t.replaceChildren(i);
|
|
2496
|
+
}
|
|
2497
|
+
function Qt(e) {
|
|
2498
|
+
let t = [];
|
|
2499
|
+
for (let n of e) {
|
|
2500
|
+
for (let e of n) t.push(e.text, e.color ?? "", e.backgroundColor ?? "", e.fontWeight ?? "", e.fontStyle ?? "", e.textDecorationLine ?? "");
|
|
2501
|
+
t.push("\n");
|
|
2502
|
+
}
|
|
2503
|
+
return t.join("");
|
|
2504
|
+
}
|
|
2505
|
+
//#endregion
|
|
2368
2506
|
//#region src/render.ts
|
|
2369
|
-
function
|
|
2370
|
-
let
|
|
2371
|
-
|
|
2372
|
-
for (let
|
|
2373
|
-
|
|
2374
|
-
let e =
|
|
2507
|
+
function $t(e) {
|
|
2508
|
+
let t = /* @__PURE__ */ new Set();
|
|
2509
|
+
tn(e, !0, t);
|
|
2510
|
+
for (let n of Array.from(e.source.querySelectorAll("[data-mw-inline-inset]"))) if (!t.has(n)) {
|
|
2511
|
+
n.removeAttribute("data-mw-inline-inset");
|
|
2512
|
+
let e = n.style;
|
|
2375
2513
|
for (let t of [
|
|
2376
2514
|
"--mw-it",
|
|
2377
2515
|
"--mw-ir",
|
|
@@ -2380,161 +2518,149 @@ function Bt(e, t) {
|
|
|
2380
2518
|
]) e.removeProperty(t);
|
|
2381
2519
|
}
|
|
2382
2520
|
}
|
|
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
|
-
}
|
|
2521
|
+
function Z(e, t, n) {
|
|
2522
|
+
e.style.getPropertyValue(t) !== n && e.style.setProperty(t, n);
|
|
2523
|
+
}
|
|
2524
|
+
function en(e, t) {
|
|
2525
|
+
e.style.getPropertyValue(t) !== "" && e.style.removeProperty(t);
|
|
2526
|
+
}
|
|
2527
|
+
function Q(e, t, n) {
|
|
2528
|
+
e.hasAttribute(t) !== n && (n ? e.setAttribute(t, "") : e.removeAttribute(t));
|
|
2529
|
+
}
|
|
2530
|
+
function tn(e, t, i) {
|
|
2531
|
+
if (e.inlineElements) for (let { element: t, tracking: n, padLeft: r, padRight: a, insets: o } of e.inlineElements) {
|
|
2532
|
+
let e = t;
|
|
2533
|
+
Z(e, "--mw-ls", String(n)), r > 0 ? Z(e, "--mw-ipl", String(r)) : en(e, "--mw-ipl"), a > 0 ? Z(e, "--mw-ipr", String(a)) : en(e, "--mw-ipr"), o && (i.add(t), nn(e, o));
|
|
2534
|
+
}
|
|
2535
|
+
if (t || rn(e), !e.tableHidden) for (let t of r(e)) {
|
|
2536
|
+
let r = t.source;
|
|
2537
|
+
t.style.zIndex !== null && n(t, e) && !t.inlineBox ? Z(r, "--mw-z", String(t.style.zIndex)) : en(r, "--mw-z"), tn(t, !1, i);
|
|
2404
2538
|
}
|
|
2405
2539
|
}
|
|
2406
|
-
function
|
|
2407
|
-
e
|
|
2540
|
+
function nn(e, t) {
|
|
2541
|
+
Q(e, "data-mw-inline-inset", !0);
|
|
2408
2542
|
let n = (t, n) => {
|
|
2409
|
-
n === null ? e
|
|
2543
|
+
n === null ? en(e, t) : Z(e, t, String(n));
|
|
2410
2544
|
};
|
|
2411
2545
|
n("--mw-it", t.top), n("--mw-ir", t.right), n("--mw-ib", t.bottom), n("--mw-il", t.left);
|
|
2412
2546
|
}
|
|
2413
|
-
function
|
|
2547
|
+
function rn(e) {
|
|
2414
2548
|
let t = e.source, n = e.localRect, r = e.resolvedPadding, { border: i, textAlignBlocked: a, overflow: o, whiteSpace: s, tracking: c, lineGap: l } = e.style;
|
|
2415
|
-
t
|
|
2416
|
-
}
|
|
2417
|
-
function Wt(e, t) {
|
|
2418
|
-
e.replaceChildren();
|
|
2419
|
-
let n = /* @__PURE__ */ new Map();
|
|
2420
|
-
for (let e of t) for (let t = 0; t < e.length; t++) {
|
|
2421
|
-
let r = e.x + t, i = {
|
|
2422
|
-
x: r,
|
|
2423
|
-
y: e.y,
|
|
2424
|
-
glyph: e.glyph
|
|
2425
|
-
};
|
|
2426
|
-
e.color && (i.color = e.color), n.set(`${r},${e.y}`, i);
|
|
2427
|
-
}
|
|
2428
|
-
for (let t of n.values()) {
|
|
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
|
-
}
|
|
2549
|
+
Q(t, e.inlineBox ? "data-mw-inline-box" : "data-mw-laid-out", !0), Q(t, e.inlineBox ? "data-mw-laid-out" : "data-mw-inline-box", !1), Q(t, "data-mw-vbottom", !!e.inlineBox && e.style.verticalAlign === "end"), Z(t, "--mw-ls", String(c)), Z(t, "--mw-lh", String(l + 1)), Z(t, "--mw-lhs", String(-l / 2)), Q(t, "data-mw-nowrap", s !== "normal"), Q(t, "data-mw-pre", s === "pre"), Z(t, "--mw-x", String(n.x)), Z(t, "--mw-y", String(n.y)), Z(t, "--mw-w", String(n.width)), Z(t, "--mw-h", String(n.height)), Q(t, "data-mw-clip", o === "clip"), Z(t, "--mw-pt", String(r.top)), Z(t, "--mw-pr", String(r.right)), Z(t, "--mw-pb", String(r.bottom)), Z(t, "--mw-pl", String(r.left)), Z(t, "--mw-bt", String(i.top)), Z(t, "--mw-br", String(i.right)), Z(t, "--mw-bb", String(i.bottom)), Z(t, "--mw-bl", String(i.left)), Q(t, "data-mw-text-align-blocked", a), Q(t, "data-mw-dropped-text", !!e.droppedText), Q(t, "data-mw-table-hidden", !!e.tableHidden);
|
|
2432
2550
|
}
|
|
2433
2551
|
//#endregion
|
|
2434
2552
|
//#region src/style.ts
|
|
2435
|
-
function
|
|
2436
|
-
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a =
|
|
2437
|
-
|
|
2438
|
-
let c = r.display ||
|
|
2553
|
+
function an(e, t, n) {
|
|
2554
|
+
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a = vn(e) ? e.computedStyleMap() : null, o = e.getAttribute("class") ?? "", s = e.style;
|
|
2555
|
+
pn(e, o, s);
|
|
2556
|
+
let c = r.display || un[e.tagName] || "", l = dn[c] ?? "none", u = c === "flex" || c === "inline-flex" ? "flex" : c === "grid" || c === "inline-grid" ? "grid" : c === "table" || c === "inline-table" ? "table" : c === "none" || ln(r) ? "none" : "block", d = { kind: "none" }, m = { kind: "none" }, h = [B()], g = [B()], _ = {
|
|
2439
2557
|
direction: "row",
|
|
2440
2558
|
dense: !1
|
|
2441
|
-
},
|
|
2559
|
+
}, v = null;
|
|
2442
2560
|
if (u === "grid") {
|
|
2443
|
-
if (a) d =
|
|
2561
|
+
if (a) d = In(a.get("grid-template-columns")?.toString() ?? "", t), m = In(a.get("grid-template-rows")?.toString() ?? "", t);
|
|
2444
2562
|
else {
|
|
2445
2563
|
e.setAttribute("data-mw-degrid", "");
|
|
2446
2564
|
try {
|
|
2447
|
-
d =
|
|
2565
|
+
d = In(r.getPropertyValue("grid-template-columns"), t), m = In(r.getPropertyValue("grid-template-rows"), t);
|
|
2448
2566
|
} finally {
|
|
2449
2567
|
e.removeAttribute("data-mw-degrid");
|
|
2450
2568
|
}
|
|
2451
2569
|
}
|
|
2452
|
-
|
|
2570
|
+
h = Bn(r.getPropertyValue("grid-auto-columns"), t), g = Bn(r.getPropertyValue("grid-auto-rows"), t), _ = Kn(r.getPropertyValue("grid-auto-flow")), v = zn(r.getPropertyValue("grid-template-areas"));
|
|
2453
2571
|
}
|
|
2454
|
-
let
|
|
2455
|
-
if (u === "table" && (
|
|
2572
|
+
let y = "auto", b = !1, x = 0, S = 0;
|
|
2573
|
+
if (u === "table" && (y = r.tableLayout === "fixed" ? "fixed" : "auto", b = r.borderCollapse === "collapse", !b)) {
|
|
2456
2574
|
let e = r.borderSpacing.split(" ");
|
|
2457
|
-
|
|
2575
|
+
x = p(parseFloat(e[0] ?? "") || 0, t), S = p(parseFloat(e[1] ?? e[0] ?? "") || 0, t);
|
|
2458
2576
|
}
|
|
2459
|
-
let
|
|
2577
|
+
let C = {
|
|
2460
2578
|
display: u,
|
|
2461
2579
|
tableRole: l,
|
|
2462
|
-
tableLayout:
|
|
2463
|
-
borderCollapse:
|
|
2464
|
-
borderSpacingX:
|
|
2465
|
-
borderSpacingY:
|
|
2580
|
+
tableLayout: y,
|
|
2581
|
+
borderCollapse: b,
|
|
2582
|
+
borderSpacingX: x,
|
|
2583
|
+
borderSpacingY: S,
|
|
2466
2584
|
captionSide: r.captionSide === "bottom" ? "bottom" : "top",
|
|
2467
|
-
verticalAlign: l === "cell" || c.startsWith("inline-") ?
|
|
2585
|
+
verticalAlign: l === "cell" || c.startsWith("inline-") ? fn(e, r) : "start",
|
|
2468
2586
|
flexDirection: r.flexDirection.startsWith("column") ? "column" : "row",
|
|
2469
2587
|
flexReverse: r.flexDirection.endsWith("-reverse"),
|
|
2470
2588
|
flexWrap: r.flexWrap.startsWith("wrap") ? "wrap" : "nowrap",
|
|
2471
2589
|
wrapReverse: r.flexWrap === "wrap-reverse",
|
|
2472
2590
|
flexGrow: Number(r.flexGrow) || 0,
|
|
2473
2591
|
flexShrink: r.flexShrink === "" ? 1 : Number(r.flexShrink) || 0,
|
|
2474
|
-
flexBasis:
|
|
2592
|
+
flexBasis: Pn(r.flexBasis, t),
|
|
2475
2593
|
order: Number(r.order) || 0,
|
|
2476
|
-
justifyContent:
|
|
2477
|
-
alignContent:
|
|
2478
|
-
alignItems:
|
|
2479
|
-
alignSelf:
|
|
2480
|
-
justifyItems:
|
|
2481
|
-
justifySelf:
|
|
2594
|
+
justifyContent: yn(r.justifyContent),
|
|
2595
|
+
alignContent: yn(r.alignContent),
|
|
2596
|
+
alignItems: bn(r.alignItems),
|
|
2597
|
+
alignSelf: xn(r.alignSelf),
|
|
2598
|
+
justifyItems: bn(r.justifyItems),
|
|
2599
|
+
justifySelf: xn(r.justifySelf),
|
|
2482
2600
|
gridTemplateColumns: d,
|
|
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:
|
|
2601
|
+
gridTemplateRows: m,
|
|
2602
|
+
gridAutoColumns: h,
|
|
2603
|
+
gridAutoRows: g,
|
|
2604
|
+
gridAutoFlow: _,
|
|
2605
|
+
gridTemplateAreas: v,
|
|
2606
|
+
gridColumnStart: Gn(r.getPropertyValue("grid-column-start")),
|
|
2607
|
+
gridColumnEnd: Gn(r.getPropertyValue("grid-column-end")),
|
|
2608
|
+
gridRowStart: Gn(r.getPropertyValue("grid-row-start")),
|
|
2609
|
+
gridRowEnd: Gn(r.getPropertyValue("grid-row-end")),
|
|
2610
|
+
width: kn(a, r.width, "width", t, o, s, n),
|
|
2611
|
+
height: kn(a, r.height, "height", t, o, s, n),
|
|
2612
|
+
minWidth: Nn(a, "min-width", r.minWidth, o, "min-w", s, n, t) ?? On(r.minWidth, t) ?? "auto",
|
|
2613
|
+
minHeight: Nn(a, "min-height", r.minHeight, o, "min-h", s, n, t) ?? On(r.minHeight, t) ?? "auto",
|
|
2614
|
+
maxWidth: Nn(a, "max-width", r.maxWidth, o, "max-w", s, n, t) ?? On(r.maxWidth, t),
|
|
2615
|
+
maxHeight: Nn(a, "max-height", r.maxHeight, o, "max-h", s, n, t) ?? On(r.maxHeight, t),
|
|
2616
|
+
padding: Jn(r, t),
|
|
2617
|
+
margin: Sn(r, a, o, s, t),
|
|
2618
|
+
position: Tn(r.position),
|
|
2619
|
+
insets: En(r, a, o, s, t),
|
|
2502
2620
|
gapX: $(r.columnGap === "normal" ? "0px" : r.columnGap, t),
|
|
2503
2621
|
gapY: $(r.rowGap === "normal" ? "0px" : r.rowGap, t),
|
|
2504
|
-
border:
|
|
2622
|
+
border: Yn(r),
|
|
2505
2623
|
borderStyle: {
|
|
2506
|
-
top:
|
|
2507
|
-
right:
|
|
2508
|
-
bottom:
|
|
2509
|
-
left:
|
|
2624
|
+
top: Dn(r.borderTopStyle),
|
|
2625
|
+
right: Dn(r.borderRightStyle),
|
|
2626
|
+
bottom: Dn(r.borderBottomStyle),
|
|
2627
|
+
left: Dn(r.borderLeftStyle)
|
|
2510
2628
|
},
|
|
2511
|
-
overflow:
|
|
2629
|
+
overflow: cn(r.overflow) || cn(r.overflowX) || cn(r.overflowY) ? "clip" : "visible",
|
|
2512
2630
|
whiteSpace: r.whiteSpace === "pre" ? "pre" : r.whiteSpace === "nowrap" ? "nowrap" : "normal",
|
|
2513
2631
|
tabSize: Math.max(1, Math.floor(parseFloat(r.tabSize)) || 8),
|
|
2514
|
-
lineGap:
|
|
2515
|
-
tracking:
|
|
2632
|
+
lineGap: wn(r.lineHeight, i),
|
|
2633
|
+
tracking: Cn(r.letterSpacing, i, n?.letterSpacing ?? 0),
|
|
2516
2634
|
textOverflow: r.textOverflow === "ellipsis" ? "ellipsis" : "clip",
|
|
2517
2635
|
color: r.color,
|
|
2518
2636
|
fontWeight: r.fontWeight,
|
|
2519
2637
|
fontStyle: r.fontStyle,
|
|
2520
2638
|
textDecorationLine: r.textDecorationLine,
|
|
2521
|
-
backgroundColor: r.backgroundColor
|
|
2639
|
+
backgroundColor: sn(r.backgroundColor) ? void 0 : r.backgroundColor,
|
|
2640
|
+
backgroundClear: r.getPropertyValue("--mw-bg-clear").trim() === "1",
|
|
2522
2641
|
borderColor: {
|
|
2523
2642
|
top: r.borderTopColor,
|
|
2524
2643
|
right: r.borderRightColor,
|
|
2525
2644
|
bottom: r.borderBottomColor,
|
|
2526
2645
|
left: r.borderLeftColor
|
|
2527
2646
|
},
|
|
2528
|
-
textAlignBlocked:
|
|
2529
|
-
textAlign:
|
|
2647
|
+
textAlignBlocked: gn(e, r),
|
|
2648
|
+
textAlign: _n(e, r),
|
|
2530
2649
|
zIndex: r.zIndex === "auto" || r.zIndex === "" ? null : Number(r.zIndex) || 0,
|
|
2531
2650
|
latticeBorder: null,
|
|
2532
|
-
ruleX: u === "flex" || u === "grid" ?
|
|
2533
|
-
ruleY: u === "flex" || u === "grid" ?
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2651
|
+
ruleX: u === "flex" || u === "grid" ? hn(r, "x") : null,
|
|
2652
|
+
ruleY: u === "flex" || u === "grid" ? hn(r, "y") : null,
|
|
2653
|
+
ruleBreak: mn(r, "--mw-rule-break", ["none", "intersection"], "normal"),
|
|
2654
|
+
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0, f(parseFloat(r.getPropertyValue("--mw-rule-inset")) || 0)),
|
|
2655
|
+
ruleVisibilityItems: mn(r, "--mw-rule-visibility-items", [
|
|
2656
|
+
"all",
|
|
2657
|
+
"around",
|
|
2658
|
+
"between"
|
|
2659
|
+
], "normal")
|
|
2660
|
+
};
|
|
2661
|
+
return on(C, r), C;
|
|
2662
|
+
}
|
|
2663
|
+
function on(e, t) {
|
|
2538
2664
|
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
2665
|
width: e.border,
|
|
2540
2666
|
style: e.borderStyle,
|
|
@@ -2545,12 +2671,22 @@ function Kt(e, t) {
|
|
|
2545
2671
|
bottom: t.borderBottomStyle === "hidden",
|
|
2546
2672
|
left: t.borderLeftStyle === "hidden"
|
|
2547
2673
|
}
|
|
2548
|
-
}, e.border =
|
|
2674
|
+
}, e.border = z(), e.display === "table" && (e.padding = z()));
|
|
2549
2675
|
}
|
|
2550
|
-
function
|
|
2676
|
+
function sn(e) {
|
|
2677
|
+
if (!e) return !0;
|
|
2678
|
+
let t = e.trim().toLowerCase();
|
|
2679
|
+
return t === "" || t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "currentcolor";
|
|
2680
|
+
}
|
|
2681
|
+
function cn(e) {
|
|
2551
2682
|
return e === "hidden" || e === "clip";
|
|
2552
2683
|
}
|
|
2553
|
-
|
|
2684
|
+
function ln(e) {
|
|
2685
|
+
if (e.position !== "absolute" && e.position !== "fixed") return !1;
|
|
2686
|
+
let t = e.clip.replace(/\s/g, "");
|
|
2687
|
+
return t === "rect(0px,0px,0px,0px)" || t === "rect(0,0,0,0)" || (cn(e.overflow) || cn(e.overflowX)) && parseFloat(e.width) <= 1 && parseFloat(e.height) <= 1;
|
|
2688
|
+
}
|
|
2689
|
+
var un = {
|
|
2554
2690
|
TABLE: "table",
|
|
2555
2691
|
THEAD: "table-header-group",
|
|
2556
2692
|
TBODY: "table-row-group",
|
|
@@ -2561,7 +2697,7 @@ var Jt = {
|
|
|
2561
2697
|
CAPTION: "table-caption",
|
|
2562
2698
|
COL: "table-column",
|
|
2563
2699
|
COLGROUP: "table-column-group"
|
|
2564
|
-
},
|
|
2700
|
+
}, dn = {
|
|
2565
2701
|
"table-header-group": "header-group",
|
|
2566
2702
|
"table-row-group": "row-group",
|
|
2567
2703
|
"table-footer-group": "footer-group",
|
|
@@ -2571,32 +2707,38 @@ var Jt = {
|
|
|
2571
2707
|
"table-column": "column",
|
|
2572
2708
|
"table-column-group": "column-group"
|
|
2573
2709
|
};
|
|
2574
|
-
function
|
|
2710
|
+
function fn(e, t) {
|
|
2575
2711
|
let n = t.verticalAlign || e.getAttribute("valign")?.toLowerCase() || (e.tagName === "TD" || e.tagName === "TH" ? "middle" : "baseline");
|
|
2576
2712
|
return n === "top" ? "start" : n === "middle" ? "center" : n === "bottom" ? "end" : "start";
|
|
2577
2713
|
}
|
|
2578
|
-
function
|
|
2579
|
-
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") &&
|
|
2714
|
+
function pn(e, t, n) {
|
|
2715
|
+
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") && Ue(e, "font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.");
|
|
2716
|
+
}
|
|
2717
|
+
function mn(e, t, n, r) {
|
|
2718
|
+
let i = e.getPropertyValue(t).trim();
|
|
2719
|
+
return n.includes(i) ? i : r;
|
|
2580
2720
|
}
|
|
2581
|
-
function
|
|
2721
|
+
function hn(e, t) {
|
|
2582
2722
|
let n = f(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`)) || 0);
|
|
2583
2723
|
if (n <= 0) return null;
|
|
2584
2724
|
let r = e.getPropertyValue(`--mw-rule-${t}-color`).trim();
|
|
2585
2725
|
return {
|
|
2586
2726
|
width: n,
|
|
2587
|
-
style:
|
|
2727
|
+
style: Dn(e.getPropertyValue(`--mw-rule-${t}-style`).trim()),
|
|
2588
2728
|
color: r && r !== "currentcolor" && r !== "currentColor" ? r : e.color
|
|
2589
2729
|
};
|
|
2590
2730
|
}
|
|
2591
|
-
function
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2731
|
+
function gn(e, t) {
|
|
2732
|
+
return t.textAlign === "justify" || e.getAttribute("align")?.toLowerCase() === "justify";
|
|
2733
|
+
}
|
|
2734
|
+
function _n(e, t) {
|
|
2735
|
+
let n = t.textAlign || e.getAttribute("align")?.toLowerCase() || "";
|
|
2736
|
+
return n === "right" || n === "end" ? "end" : n === "center" || n.endsWith("-center") ? "center" : "start";
|
|
2595
2737
|
}
|
|
2596
|
-
function
|
|
2738
|
+
function vn(e) {
|
|
2597
2739
|
return typeof e.computedStyleMap == "function";
|
|
2598
2740
|
}
|
|
2599
|
-
function
|
|
2741
|
+
function yn(e) {
|
|
2600
2742
|
switch (e) {
|
|
2601
2743
|
case "center": return "center";
|
|
2602
2744
|
case "flex-end":
|
|
@@ -2611,7 +2753,7 @@ function tn(e) {
|
|
|
2611
2753
|
default: return "start";
|
|
2612
2754
|
}
|
|
2613
2755
|
}
|
|
2614
|
-
function
|
|
2756
|
+
function bn(e) {
|
|
2615
2757
|
switch (e) {
|
|
2616
2758
|
case "center": return "center";
|
|
2617
2759
|
case "flex-end":
|
|
@@ -2622,10 +2764,10 @@ function nn(e) {
|
|
|
2622
2764
|
default: return "start";
|
|
2623
2765
|
}
|
|
2624
2766
|
}
|
|
2625
|
-
function
|
|
2626
|
-
return e === "auto" || e === "" || e === "normal" ? "auto" :
|
|
2767
|
+
function xn(e) {
|
|
2768
|
+
return e === "auto" || e === "" || e === "normal" ? "auto" : bn(e);
|
|
2627
2769
|
}
|
|
2628
|
-
function
|
|
2770
|
+
function Sn(e, t, n, r, i) {
|
|
2629
2771
|
let a = (a, o, s) => {
|
|
2630
2772
|
if (t) {
|
|
2631
2773
|
let e = t.get(a)?.toString().trim();
|
|
@@ -2649,16 +2791,16 @@ function an(e, t, n, r, i) {
|
|
|
2649
2791
|
left: a("margin-left", "margin-inline-start", /(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)
|
|
2650
2792
|
};
|
|
2651
2793
|
}
|
|
2652
|
-
function
|
|
2794
|
+
function Cn(e, t, n) {
|
|
2653
2795
|
let r = (e === "normal" ? 0 : parseFloat(e) || 0) - n;
|
|
2654
2796
|
return r <= 0 ? 0 : Math.floor(r / (.025 * t) + 1e-6);
|
|
2655
2797
|
}
|
|
2656
|
-
function
|
|
2798
|
+
function wn(e, t) {
|
|
2657
2799
|
if (!e || e === "normal" || t <= 0) return 0;
|
|
2658
2800
|
let n = parseFloat(e);
|
|
2659
2801
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n / t + 1e-6) - 1) : 0;
|
|
2660
2802
|
}
|
|
2661
|
-
function
|
|
2803
|
+
function Tn(e) {
|
|
2662
2804
|
switch (e) {
|
|
2663
2805
|
case "relative":
|
|
2664
2806
|
case "absolute":
|
|
@@ -2667,7 +2809,7 @@ function cn(e) {
|
|
|
2667
2809
|
default: return "static";
|
|
2668
2810
|
}
|
|
2669
2811
|
}
|
|
2670
|
-
function
|
|
2812
|
+
function En(e, t, n, r, i) {
|
|
2671
2813
|
let a = (a, o) => {
|
|
2672
2814
|
if (t) {
|
|
2673
2815
|
let e = t.get(a)?.toString().trim();
|
|
@@ -2686,7 +2828,7 @@ function ln(e, t, n, r, i) {
|
|
|
2686
2828
|
left: a("left", /(?:^|[\s:.[!])-?(?:left|start|inset|inset-x)-/)
|
|
2687
2829
|
};
|
|
2688
2830
|
}
|
|
2689
|
-
function
|
|
2831
|
+
function Dn(e) {
|
|
2690
2832
|
switch (e) {
|
|
2691
2833
|
case "double": return "double";
|
|
2692
2834
|
case "dashed": return "dashed";
|
|
@@ -2694,7 +2836,7 @@ function un(e) {
|
|
|
2694
2836
|
default: return "solid";
|
|
2695
2837
|
}
|
|
2696
2838
|
}
|
|
2697
|
-
function
|
|
2839
|
+
function On(e, t) {
|
|
2698
2840
|
if (!e || e === "none" || e === "auto") return;
|
|
2699
2841
|
if (e === "min-content" || e === "max-content" || e === "fit-content") return e;
|
|
2700
2842
|
if (e.endsWith("%")) {
|
|
@@ -2713,13 +2855,26 @@ function $(e, t) {
|
|
|
2713
2855
|
let n = parseFloat(e);
|
|
2714
2856
|
return Number.isFinite(n) ? p(n, t) : 0;
|
|
2715
2857
|
}
|
|
2716
|
-
function
|
|
2858
|
+
function kn(e, t, n, r, i, a, o) {
|
|
2859
|
+
let s = An(n === "width" ? a.width : a.height);
|
|
2860
|
+
if (s !== null) return {
|
|
2861
|
+
kind: "cells",
|
|
2862
|
+
value: Mn(s, n, o, r)
|
|
2863
|
+
};
|
|
2864
|
+
let c = jn(i, n === "width" ? "w" : "h");
|
|
2865
|
+
if (c !== null) {
|
|
2866
|
+
let i = parseFloat(e ? String(e.get(n) ?? "") : t), a = Number.isFinite(i) && Math.abs(i - c) <= c * .3;
|
|
2867
|
+
if (a || !Number.isFinite(i)) return {
|
|
2868
|
+
kind: "cells",
|
|
2869
|
+
value: Mn(a ? i : c, n, o, r)
|
|
2870
|
+
};
|
|
2871
|
+
}
|
|
2717
2872
|
if (e) {
|
|
2718
2873
|
let t = e.get(n);
|
|
2719
2874
|
if (t == null) return;
|
|
2720
2875
|
let i = t.toString().trim();
|
|
2721
2876
|
if (i === "auto") return { kind: "auto" };
|
|
2722
|
-
let a =
|
|
2877
|
+
let a = Fn(i);
|
|
2723
2878
|
if (a) return a;
|
|
2724
2879
|
if (i.endsWith("%")) return {
|
|
2725
2880
|
kind: "percent",
|
|
@@ -2733,54 +2888,94 @@ function fn(e, t, n, r, i, a) {
|
|
|
2733
2888
|
kind: "cells",
|
|
2734
2889
|
value: f(parseFloat(i) / .25)
|
|
2735
2890
|
};
|
|
2891
|
+
let s = An(i);
|
|
2892
|
+
if (s !== null) return {
|
|
2893
|
+
kind: "cells",
|
|
2894
|
+
value: Mn(s, n, o, r)
|
|
2895
|
+
};
|
|
2736
2896
|
}
|
|
2737
|
-
let
|
|
2738
|
-
if (
|
|
2739
|
-
if (
|
|
2740
|
-
let e =
|
|
2897
|
+
let l = n === "width" ? a.width : a.height;
|
|
2898
|
+
if (l) {
|
|
2899
|
+
if (l === "auto") return { kind: "auto" };
|
|
2900
|
+
let e = Fn(l);
|
|
2741
2901
|
if (e) return e;
|
|
2742
|
-
if (
|
|
2902
|
+
if (l.endsWith("%")) return {
|
|
2743
2903
|
kind: "percent",
|
|
2744
|
-
value: parseFloat(
|
|
2904
|
+
value: parseFloat(l)
|
|
2745
2905
|
};
|
|
2746
|
-
let t = parseFloat(
|
|
2906
|
+
let t = parseFloat(l);
|
|
2747
2907
|
if (Number.isFinite(t)) return {
|
|
2748
2908
|
kind: "cells",
|
|
2749
2909
|
value: p(t, r)
|
|
2750
2910
|
};
|
|
2751
2911
|
}
|
|
2752
|
-
let
|
|
2753
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
2754
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
2755
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
2756
|
-
let
|
|
2757
|
-
if (
|
|
2912
|
+
let u = n === "width" ? "w" : "h";
|
|
2913
|
+
if (RegExp(`(?:^|[\\s:.[!])${u}-min\\b`).test(i)) return { kind: "min-content" };
|
|
2914
|
+
if (RegExp(`(?:^|[\\s:.[!])${u}-max\\b`).test(i)) return { kind: "max-content" };
|
|
2915
|
+
if (RegExp(`(?:^|[\\s:.[!])${u}-fit\\b`).test(i)) return { kind: "fit-content" };
|
|
2916
|
+
let d = RegExp(`(?:^|[\\s:.[!])${u}-(\\d+)/(\\d+)(?![\\w./])`).exec(i);
|
|
2917
|
+
if (d) return {
|
|
2758
2918
|
kind: "percent",
|
|
2759
|
-
value: 100 * Number(
|
|
2919
|
+
value: 100 * Number(d[1]) / Number(d[2])
|
|
2760
2920
|
};
|
|
2761
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
2921
|
+
if (RegExp(`(?:^|[\\s:.[!])${u}-full(?![\\w-])`).test(i)) return {
|
|
2762
2922
|
kind: "percent",
|
|
2763
2923
|
value: 100
|
|
2764
2924
|
};
|
|
2765
|
-
let
|
|
2766
|
-
if (
|
|
2925
|
+
let m = RegExp(`(?:^|[\\s:.[!])${u}-\\[(\\d+(?:\\.\\d+)?)%\\]`).exec(i);
|
|
2926
|
+
if (m) return {
|
|
2767
2927
|
kind: "percent",
|
|
2768
|
-
value: Number(
|
|
2928
|
+
value: Number(m[1])
|
|
2929
|
+
};
|
|
2930
|
+
let h = RegExp(`(?:^|[\\s:.[!])${u}-(\\d+(?:\\.\\d+)?)(?![\\w-/])`).exec(i);
|
|
2931
|
+
if (h) return {
|
|
2932
|
+
kind: "cells",
|
|
2933
|
+
value: f(Number(h[1]))
|
|
2769
2934
|
};
|
|
2770
|
-
if (!
|
|
2935
|
+
if (!qn(i, u) || t === "auto") return { kind: "auto" };
|
|
2771
2936
|
if (t.endsWith("%")) return {
|
|
2772
2937
|
kind: "percent",
|
|
2773
2938
|
value: parseFloat(t)
|
|
2774
2939
|
};
|
|
2775
|
-
let
|
|
2776
|
-
if (Number.isFinite(
|
|
2940
|
+
let g = parseFloat(t);
|
|
2941
|
+
if (Number.isFinite(g)) return {
|
|
2777
2942
|
kind: "cells",
|
|
2778
|
-
value: p(
|
|
2943
|
+
value: p(g, r)
|
|
2779
2944
|
};
|
|
2780
2945
|
}
|
|
2781
|
-
function
|
|
2946
|
+
function An(e) {
|
|
2947
|
+
let t = /^(-?[\d.]+)((?:[dsl]?v)(?:h|w|min|max)|vi|vb)$/.exec(e.trim());
|
|
2948
|
+
if (!t || typeof window > "u") return null;
|
|
2949
|
+
let n = parseFloat(t[1]);
|
|
2950
|
+
if (!Number.isFinite(n)) return null;
|
|
2951
|
+
let r = t[2], i = window.innerHeight, a = window.innerWidth, o = r.endsWith("h") ? i : r.endsWith("min") ? Math.min(a, i) : r.endsWith("max") ? Math.max(a, i) : r === "vb" ? i : a;
|
|
2952
|
+
return n / 100 * o;
|
|
2953
|
+
}
|
|
2954
|
+
function jn(e, t) {
|
|
2955
|
+
if (typeof window > "u") return null;
|
|
2956
|
+
let n = RegExp(`(?:^|[\\s:.[!])${t}-(screen|[dsl]v[hw])(?![\\w-])`).exec(e);
|
|
2957
|
+
if (n) {
|
|
2958
|
+
let e = n[1];
|
|
2959
|
+
return e === "screen" ? t.includes("h") ? window.innerHeight : window.innerWidth : e.endsWith("h") ? window.innerHeight : window.innerWidth;
|
|
2960
|
+
}
|
|
2961
|
+
let r = RegExp(`(?:^|[\\s:.[!])${t}-\\[(-?[\\d.]+(?:[dsl]?v(?:h|w|min|max)|vi|vb))\\]`).exec(e);
|
|
2962
|
+
return r ? An(r[1]) : null;
|
|
2963
|
+
}
|
|
2964
|
+
function Mn(e, t, n, r) {
|
|
2965
|
+
let i = t === "width" ? n?.width : n?.height;
|
|
2966
|
+
return i && i > 0 ? Math.max(0, Math.floor(e / i)) : p(e, r);
|
|
2967
|
+
}
|
|
2968
|
+
function Nn(e, t, n, r, i, a, o, s) {
|
|
2969
|
+
let c = t.endsWith("width") ? "width" : "height", l = An(a.getPropertyValue(t)) ?? An(e?.get(t)?.toString().trim() ?? "");
|
|
2970
|
+
if (l !== null) return Mn(l, c, o, s);
|
|
2971
|
+
let u = jn(r, i);
|
|
2972
|
+
if (u === null) return;
|
|
2973
|
+
let d = parseFloat(e ? String(e.get(t) ?? "") : n), f = Number.isFinite(d) && Math.abs(d - u) <= u * .3;
|
|
2974
|
+
if (!(!f && Number.isFinite(d))) return Mn(f ? d : u, c, o, s);
|
|
2975
|
+
}
|
|
2976
|
+
function Pn(e, t) {
|
|
2782
2977
|
if (!e || e === "auto" || e === "content") return;
|
|
2783
|
-
let n =
|
|
2978
|
+
let n = Fn(e);
|
|
2784
2979
|
if (n) return n;
|
|
2785
2980
|
if (e.endsWith("%")) {
|
|
2786
2981
|
let t = parseFloat(e);
|
|
@@ -2795,27 +2990,27 @@ function pn(e, t) {
|
|
|
2795
2990
|
value: p(r, t)
|
|
2796
2991
|
} : void 0;
|
|
2797
2992
|
}
|
|
2798
|
-
function
|
|
2993
|
+
function Fn(e) {
|
|
2799
2994
|
if (e === "min-content") return { kind: "min-content" };
|
|
2800
2995
|
if (e === "max-content") return { kind: "max-content" };
|
|
2801
2996
|
if (e === "fit-content") return { kind: "fit-content" };
|
|
2802
2997
|
}
|
|
2803
|
-
function
|
|
2998
|
+
function In(e, t) {
|
|
2804
2999
|
let n = e.trim();
|
|
2805
3000
|
if (!n || n === "none") return { kind: "none" };
|
|
2806
3001
|
if (n === "subgrid" || n.startsWith("subgrid ")) return { kind: "subgrid" };
|
|
2807
3002
|
let r = [], i = [], a = [], o = (e) => {
|
|
2808
3003
|
i.push(a), a = [], r.push(e);
|
|
2809
3004
|
}, s;
|
|
2810
|
-
for (let e of
|
|
2811
|
-
let n =
|
|
3005
|
+
for (let e of Wn(n)) {
|
|
3006
|
+
let n = Rn(e);
|
|
2812
3007
|
if (n) {
|
|
2813
3008
|
a.push(...n);
|
|
2814
3009
|
continue;
|
|
2815
3010
|
}
|
|
2816
3011
|
let i = e.match(/^repeat\(\s*([^,]+?)\s*,(.*)\)$/s);
|
|
2817
3012
|
if (i) {
|
|
2818
|
-
let e =
|
|
3013
|
+
let e = Ln(i[2].trim(), t);
|
|
2819
3014
|
if (e.tracks.length === 0) continue;
|
|
2820
3015
|
let n = i[1];
|
|
2821
3016
|
if (n === "auto-fill" || n === "auto-fit") {
|
|
@@ -2833,7 +3028,7 @@ function hn(e, t) {
|
|
|
2833
3028
|
}
|
|
2834
3029
|
continue;
|
|
2835
3030
|
}
|
|
2836
|
-
o(
|
|
3031
|
+
o(Vn(e, t));
|
|
2837
3032
|
}
|
|
2838
3033
|
if (i.push(a), r.length === 0 && !s) return { kind: "none" };
|
|
2839
3034
|
let c = {
|
|
@@ -2842,26 +3037,26 @@ function hn(e, t) {
|
|
|
2842
3037
|
};
|
|
2843
3038
|
return i.some((e) => e.length > 0) && (c.lineNames = i), s && (c.autoRepeat = s), c;
|
|
2844
3039
|
}
|
|
2845
|
-
function
|
|
3040
|
+
function Ln(e, t) {
|
|
2846
3041
|
let n = [], r = [], i = [];
|
|
2847
|
-
for (let a of
|
|
2848
|
-
let e =
|
|
3042
|
+
for (let a of Wn(e)) {
|
|
3043
|
+
let e = Rn(a);
|
|
2849
3044
|
if (e) {
|
|
2850
3045
|
i.push(...e);
|
|
2851
3046
|
continue;
|
|
2852
3047
|
}
|
|
2853
|
-
r.push(i), i = [], n.push(
|
|
3048
|
+
r.push(i), i = [], n.push(Vn(a, t));
|
|
2854
3049
|
}
|
|
2855
3050
|
return r.push(i), {
|
|
2856
3051
|
tracks: n,
|
|
2857
3052
|
lineNames: r
|
|
2858
3053
|
};
|
|
2859
3054
|
}
|
|
2860
|
-
function
|
|
3055
|
+
function Rn(e) {
|
|
2861
3056
|
let t = e.match(/^\[(.*)\]$/s);
|
|
2862
3057
|
return t ? t[1].split(/\s+/).filter((e) => e !== "") : null;
|
|
2863
3058
|
}
|
|
2864
|
-
function
|
|
3059
|
+
function zn(e) {
|
|
2865
3060
|
let t = [];
|
|
2866
3061
|
for (let n of e.matchAll(/"([^"]*)"|'([^']*)'/g)) {
|
|
2867
3062
|
let e = (n[1] ?? n[2] ?? "").trim().split(/\s+/).filter((e) => e !== "");
|
|
@@ -2891,23 +3086,23 @@ function vn(e) {
|
|
|
2891
3086
|
areas: r
|
|
2892
3087
|
};
|
|
2893
3088
|
}
|
|
2894
|
-
function
|
|
2895
|
-
let n =
|
|
2896
|
-
return n.length > 0 ? n : [
|
|
3089
|
+
function Bn(e, t) {
|
|
3090
|
+
let n = Wn(e.trim()).filter((e) => e !== "" && !e.startsWith("[")).map((e) => Vn(e, t));
|
|
3091
|
+
return n.length > 0 ? n : [B()];
|
|
2897
3092
|
}
|
|
2898
|
-
function
|
|
3093
|
+
function Vn(e, t) {
|
|
2899
3094
|
let n = e.match(/^minmax\((.*)\)$/s);
|
|
2900
3095
|
if (n) {
|
|
2901
|
-
let e =
|
|
3096
|
+
let e = Un(n[1]).map((e) => e.trim());
|
|
2902
3097
|
return e.length === 2 ? {
|
|
2903
|
-
min:
|
|
2904
|
-
max:
|
|
3098
|
+
min: Hn(e[0], t),
|
|
3099
|
+
max: Hn(e[1], t)
|
|
2905
3100
|
} : {
|
|
2906
3101
|
min: { kind: "auto" },
|
|
2907
3102
|
max: { kind: "auto" }
|
|
2908
3103
|
};
|
|
2909
3104
|
}
|
|
2910
|
-
let r =
|
|
3105
|
+
let r = Hn(e, t);
|
|
2911
3106
|
return r.kind === "fr" ? {
|
|
2912
3107
|
min: { kind: "auto" },
|
|
2913
3108
|
max: r
|
|
@@ -2916,13 +3111,13 @@ function bn(e, t) {
|
|
|
2916
3111
|
max: r
|
|
2917
3112
|
};
|
|
2918
3113
|
}
|
|
2919
|
-
function
|
|
3114
|
+
function Hn(e, t) {
|
|
2920
3115
|
if (e === "auto" || e.startsWith("fit-content")) return { kind: "auto" };
|
|
2921
3116
|
if (e === "min-content") return { kind: "min-content" };
|
|
2922
3117
|
if (e === "max-content") return { kind: "max-content" };
|
|
2923
3118
|
let n = e.match(/^(min|max)\((.*)\)$/s);
|
|
2924
3119
|
if (n) {
|
|
2925
|
-
let e =
|
|
3120
|
+
let e = Un(n[2]).map((e) => Hn(e.trim(), t)), r = e.every((e) => e.kind === "cells" || e.kind === "percent" || e.kind === "math");
|
|
2926
3121
|
return e.length > 0 && r ? {
|
|
2927
3122
|
kind: "math",
|
|
2928
3123
|
fn: n[1],
|
|
@@ -2949,7 +3144,7 @@ function xn(e, t) {
|
|
|
2949
3144
|
value: e.endsWith("rem") ? f(r / .25) : p(r, t)
|
|
2950
3145
|
} : { kind: "auto" };
|
|
2951
3146
|
}
|
|
2952
|
-
function
|
|
3147
|
+
function Un(e) {
|
|
2953
3148
|
let t = [], n = 0, r = 0;
|
|
2954
3149
|
for (let i = 0; i < e.length; i++) {
|
|
2955
3150
|
let a = e[i];
|
|
@@ -2957,7 +3152,7 @@ function Sn(e) {
|
|
|
2957
3152
|
}
|
|
2958
3153
|
return t.push(e.slice(r)), t.filter((e) => e.trim() !== "");
|
|
2959
3154
|
}
|
|
2960
|
-
function
|
|
3155
|
+
function Wn(e) {
|
|
2961
3156
|
let t = [], n = 0, r = -1;
|
|
2962
3157
|
for (let i = 0; i < e.length; i++) {
|
|
2963
3158
|
let a = e[i];
|
|
@@ -2965,7 +3160,7 @@ function Cn(e) {
|
|
|
2965
3160
|
}
|
|
2966
3161
|
return r !== -1 && t.push(e.slice(r)), t;
|
|
2967
3162
|
}
|
|
2968
|
-
function
|
|
3163
|
+
function Gn(e) {
|
|
2969
3164
|
let t = e.trim();
|
|
2970
3165
|
if (!t || t === "auto") return { kind: "auto" };
|
|
2971
3166
|
let n = !1, r, i;
|
|
@@ -2993,16 +3188,16 @@ function wn(e) {
|
|
|
2993
3188
|
nth: r
|
|
2994
3189
|
};
|
|
2995
3190
|
}
|
|
2996
|
-
function
|
|
3191
|
+
function Kn(e) {
|
|
2997
3192
|
return {
|
|
2998
3193
|
direction: e.includes("column") ? "column" : "row",
|
|
2999
3194
|
dense: e.includes("dense")
|
|
3000
3195
|
};
|
|
3001
3196
|
}
|
|
3002
|
-
function
|
|
3197
|
+
function qn(e, t) {
|
|
3003
3198
|
return (t === "w" ? /(?:^|[\s:.[!])w-/ : /(?:^|[\s:.[!])h-/).test(e);
|
|
3004
3199
|
}
|
|
3005
|
-
function
|
|
3200
|
+
function Jn(e, t) {
|
|
3006
3201
|
return {
|
|
3007
3202
|
top: $(e.getPropertyValue("padding-top"), t),
|
|
3008
3203
|
right: $(e.getPropertyValue("padding-right"), t),
|
|
@@ -3010,7 +3205,7 @@ function Dn(e, t) {
|
|
|
3010
3205
|
left: $(e.getPropertyValue("padding-left"), t)
|
|
3011
3206
|
};
|
|
3012
3207
|
}
|
|
3013
|
-
function
|
|
3208
|
+
function Yn(e) {
|
|
3014
3209
|
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 : f(parseFloat(e.getPropertyValue(t)) || 0);
|
|
3015
3210
|
return {
|
|
3016
3211
|
top: t("border-top-width", "border-top-style"),
|
|
@@ -3021,58 +3216,79 @@ function On(e) {
|
|
|
3021
3216
|
}
|
|
3022
3217
|
//#endregion
|
|
3023
3218
|
//#region src/tree.ts
|
|
3024
|
-
function
|
|
3025
|
-
let
|
|
3026
|
-
if (
|
|
3027
|
-
let
|
|
3028
|
-
if (!
|
|
3029
|
-
let
|
|
3219
|
+
function Xn(e, t, n, r) {
|
|
3220
|
+
let i = an(e, t, n);
|
|
3221
|
+
if (i.display === "none") return null;
|
|
3222
|
+
let a = Array.from(e.children), o = a.map(tr), s = e.tagName, c = fr(s);
|
|
3223
|
+
if (!o.includes("block") || c) {
|
|
3224
|
+
let l = nr(e, i.tracking, {
|
|
3030
3225
|
rootFontSizePx: t,
|
|
3031
3226
|
rootLetterSpacingPx: n?.letterSpacing ?? 0,
|
|
3032
3227
|
cellMetrics: n,
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3228
|
+
textareaWidths: r,
|
|
3229
|
+
preserve: i.whiteSpace === "pre",
|
|
3230
|
+
tabSize: i.tabSize
|
|
3231
|
+
}), u = l.chars.join("");
|
|
3232
|
+
if (l.boxes.length > 0) {
|
|
3233
|
+
let e = Et();
|
|
3234
|
+
E(l.chars, (t, n) => {
|
|
3235
|
+
l.advances[t] = Math.max(1, Y(l.boxes[n], e));
|
|
3040
3236
|
});
|
|
3041
3237
|
}
|
|
3042
|
-
let
|
|
3043
|
-
|
|
3044
|
-
if (
|
|
3045
|
-
|
|
3046
|
-
|
|
3238
|
+
let d = sr(u, l.advances, i.tracking);
|
|
3239
|
+
if (c && d === 0) {
|
|
3240
|
+
if (s === "INPUT") d = Number(e.size) || 20;
|
|
3241
|
+
else if (s === "TEXTAREA") d = Number(e.cols) || 20;
|
|
3242
|
+
else {
|
|
3243
|
+
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);
|
|
3244
|
+
d = Math.max(1, ...r.map((e) => e.trim().length));
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
let f = u.length > 0 ? cr(u) : 0, p;
|
|
3248
|
+
if (s === "TEXTAREA") {
|
|
3249
|
+
let t = e, n = t.value ?? "", a = r?.get(t), o = +!!n.endsWith("\n"), s = a !== void 0 && a > 0 ? v(n, a) + o : n === "" ? 0 : n.split(/\r\n?|\n/).length, c = getComputedStyle(e).getPropertyValue("field-sizing") === "content" ? 1 : Number(t.rows) || 2, l = Math.max(c, s);
|
|
3250
|
+
p = l + Math.max(0, l - 1) * i.lineGap;
|
|
3251
|
+
} else p = c ? Math.max(1, f) : f;
|
|
3252
|
+
let m = /* @__PURE__ */ new Map(), h = [];
|
|
3253
|
+
for (let t of l.boxes) t.source.parentElement === e ? m.set(t.source, t) : h.push(t);
|
|
3254
|
+
let g = [];
|
|
3255
|
+
for (let e = 0; e < a.length; e++) {
|
|
3256
|
+
let i = a[e], s = m.get(i);
|
|
3257
|
+
if (s) g.push(s);
|
|
3258
|
+
else if (o[e] === "out-of-flow") {
|
|
3259
|
+
let e = Xn(i, t, n, r);
|
|
3260
|
+
e && g.push(e);
|
|
3261
|
+
}
|
|
3047
3262
|
}
|
|
3048
|
-
|
|
3263
|
+
g.push(...h);
|
|
3264
|
+
let _ = {
|
|
3049
3265
|
source: e,
|
|
3050
|
-
style:
|
|
3051
|
-
children:
|
|
3052
|
-
text:
|
|
3053
|
-
intrinsicWidth:
|
|
3054
|
-
intrinsicHeight:
|
|
3266
|
+
style: i,
|
|
3267
|
+
children: g,
|
|
3268
|
+
text: u,
|
|
3269
|
+
intrinsicWidth: d,
|
|
3270
|
+
intrinsicHeight: p,
|
|
3055
3271
|
localRect: {
|
|
3056
3272
|
x: 0,
|
|
3057
3273
|
y: 0,
|
|
3058
|
-
width:
|
|
3059
|
-
height:
|
|
3274
|
+
width: d,
|
|
3275
|
+
height: p
|
|
3060
3276
|
},
|
|
3061
3277
|
unclampedHeight: 0,
|
|
3062
|
-
resolvedPadding:
|
|
3278
|
+
resolvedPadding: z()
|
|
3063
3279
|
};
|
|
3064
|
-
return (
|
|
3280
|
+
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
3281
|
}
|
|
3066
|
-
let
|
|
3067
|
-
for (let e = 0; e <
|
|
3068
|
-
if (
|
|
3069
|
-
let
|
|
3070
|
-
|
|
3282
|
+
let l = [];
|
|
3283
|
+
for (let e = 0; e < a.length; e++) {
|
|
3284
|
+
if (o[e] === "none") continue;
|
|
3285
|
+
let i = Xn(a[e], t, n, r);
|
|
3286
|
+
i && l.push(i);
|
|
3071
3287
|
}
|
|
3072
|
-
let
|
|
3288
|
+
let u = {
|
|
3073
3289
|
source: e,
|
|
3074
|
-
style:
|
|
3075
|
-
children:
|
|
3290
|
+
style: i,
|
|
3291
|
+
children: l,
|
|
3076
3292
|
text: "",
|
|
3077
3293
|
intrinsicWidth: 0,
|
|
3078
3294
|
intrinsicHeight: 0,
|
|
@@ -3083,27 +3299,27 @@ function kn(e, t, n) {
|
|
|
3083
3299
|
height: 0
|
|
3084
3300
|
},
|
|
3085
3301
|
unclampedHeight: 0,
|
|
3086
|
-
resolvedPadding:
|
|
3302
|
+
resolvedPadding: z()
|
|
3087
3303
|
};
|
|
3088
|
-
return
|
|
3304
|
+
return pr(e, u), u;
|
|
3089
3305
|
}
|
|
3090
|
-
var
|
|
3091
|
-
function
|
|
3092
|
-
return t || (
|
|
3306
|
+
var Zn = /* @__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("."));
|
|
3307
|
+
function Qn(e, t) {
|
|
3308
|
+
return t || (Zn.has(e.tagName) ? "inline" : "block");
|
|
3093
3309
|
}
|
|
3094
|
-
function
|
|
3095
|
-
let n =
|
|
3310
|
+
function $n(e, t) {
|
|
3311
|
+
let n = Qn(e, t);
|
|
3096
3312
|
return n === "inline" || n === "contents";
|
|
3097
3313
|
}
|
|
3098
|
-
function
|
|
3099
|
-
let n =
|
|
3314
|
+
function er(e, t) {
|
|
3315
|
+
let n = Qn(e, t);
|
|
3100
3316
|
return n.startsWith("inline") && n !== "inline";
|
|
3101
3317
|
}
|
|
3102
|
-
function
|
|
3318
|
+
function tr(e) {
|
|
3103
3319
|
let t = getComputedStyle(e);
|
|
3104
|
-
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" :
|
|
3320
|
+
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" : $n(e, t.display) || er(e, t.display) ? "inline" : "block";
|
|
3105
3321
|
}
|
|
3106
|
-
function
|
|
3322
|
+
function nr(e, t, n) {
|
|
3107
3323
|
let r = {
|
|
3108
3324
|
chars: [],
|
|
3109
3325
|
advances: [],
|
|
@@ -3111,64 +3327,67 @@ function Fn(e, t, n) {
|
|
|
3111
3327
|
inlineElements: [],
|
|
3112
3328
|
boxes: []
|
|
3113
3329
|
};
|
|
3114
|
-
return
|
|
3330
|
+
return rr(e, t, n, r), n.preserve ? r : or(r);
|
|
3115
3331
|
}
|
|
3116
|
-
function
|
|
3332
|
+
function rr(e, t, n, r) {
|
|
3117
3333
|
let i = () => {
|
|
3118
3334
|
let e = 0;
|
|
3119
3335
|
for (let t = r.chars.length - 1; t >= 0 && r.chars[t] !== "\n"; t--) e += r.advances[t];
|
|
3120
3336
|
return e;
|
|
3121
3337
|
};
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3338
|
+
if (!fr(e.tagName)) {
|
|
3339
|
+
for (let a of Array.from(e.childNodes)) if (a.nodeType === Node.TEXT_NODE) {
|
|
3340
|
+
if (n.preserve) for (let e of (a.textContent ?? "").replace(/\r\n?/g, "\n")) if (e === "\n") r.chars.push("\n"), r.advances.push(0);
|
|
3341
|
+
else if (e === " ") {
|
|
3342
|
+
let e = (Math.floor(i() / n.tabSize) + 1) * n.tabSize;
|
|
3343
|
+
for (let t = i(); t < e; t++) r.chars.push(" "), r.advances.push(1);
|
|
3344
|
+
} else r.chars.push(e), r.advances.push(1 + t);
|
|
3345
|
+
else for (let e of (a.textContent ?? "").replace(/[ \t\r\n\f]+/g, " ")) r.chars.push(e), r.advances.push(1 + t);
|
|
3346
|
+
} else if (a.nodeType === Node.ELEMENT_NODE) {
|
|
3347
|
+
let e = a;
|
|
3348
|
+
if (e.tagName === "BR") {
|
|
3349
|
+
r.chars.push("\n"), r.advances.push(0);
|
|
3350
|
+
continue;
|
|
3351
|
+
}
|
|
3352
|
+
let t = getComputedStyle(e);
|
|
3353
|
+
if (t.display === "none" || t.position === "absolute" || t.position === "fixed") continue;
|
|
3354
|
+
if (er(e, t.display)) {
|
|
3355
|
+
let t = Xn(e, n.rootFontSizePx, n.cellMetrics, n.textareaWidths);
|
|
3356
|
+
t && (t.inlineBox = !0, r.chars.push(""), r.advances.push(1), r.boxes.push(t));
|
|
3357
|
+
continue;
|
|
3358
|
+
}
|
|
3359
|
+
if (!$n(e, t.display)) {
|
|
3360
|
+
lr(e);
|
|
3361
|
+
continue;
|
|
3362
|
+
}
|
|
3363
|
+
let i = Cn(t.letterSpacing, parseFloat(t.fontSize) || n.rootFontSizePx, n.rootLetterSpacingPx), o = ir(t.paddingLeft, n.rootFontSizePx), s = ir(t.paddingRight, n.rootFontSizePx);
|
|
3364
|
+
r.inlineElements.push({
|
|
3365
|
+
element: e,
|
|
3366
|
+
tracking: i,
|
|
3367
|
+
padLeft: o,
|
|
3368
|
+
padRight: s,
|
|
3369
|
+
insets: t.position === "static" ? null : ar(t, n.rootFontSizePx),
|
|
3370
|
+
color: t.color,
|
|
3371
|
+
backgroundColor: sn(t.backgroundColor) ? void 0 : t.backgroundColor,
|
|
3372
|
+
fontWeight: t.fontWeight,
|
|
3373
|
+
fontStyle: t.fontStyle,
|
|
3374
|
+
textDecorationLine: t.textDecorationLine
|
|
3375
|
+
});
|
|
3376
|
+
let c = r.inlineElements.length - 1;
|
|
3377
|
+
for (let e = 0; e < o; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
3378
|
+
let l = r.chars.length;
|
|
3379
|
+
rr(e, i, n, r);
|
|
3380
|
+
for (let e = l; e < r.chars.length; e++) r.inlineIndex[e] === void 0 && (r.inlineIndex[e] = c);
|
|
3381
|
+
for (let e = 0; e < s; e++) r.inlineIndex[r.chars.length] = c, r.chars.push(""), r.advances.push(1);
|
|
3145
3382
|
}
|
|
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
3383
|
}
|
|
3165
3384
|
}
|
|
3166
|
-
function
|
|
3385
|
+
function ir(e, t) {
|
|
3167
3386
|
if (!e || e.endsWith("%")) return 0;
|
|
3168
3387
|
let n = parseFloat(e);
|
|
3169
3388
|
return Number.isFinite(n) ? Math.max(0, p(n, t)) : 0;
|
|
3170
3389
|
}
|
|
3171
|
-
function
|
|
3390
|
+
function ar(e, t) {
|
|
3172
3391
|
let n = (e) => {
|
|
3173
3392
|
if (!e || e === "auto" || e.endsWith("%")) return null;
|
|
3174
3393
|
let n = parseFloat(e);
|
|
@@ -3181,7 +3400,7 @@ function Rn(e, t) {
|
|
|
3181
3400
|
left: n(e.left)
|
|
3182
3401
|
};
|
|
3183
3402
|
}
|
|
3184
|
-
function
|
|
3403
|
+
function or(e) {
|
|
3185
3404
|
let t = [], n = [], r = [], i = () => {
|
|
3186
3405
|
let e = t.length;
|
|
3187
3406
|
for (; e > 0 && t[e - 1] !== "\n";) e--;
|
|
@@ -3198,9 +3417,7 @@ function zn(e) {
|
|
|
3198
3417
|
} else o === "\n" && a();
|
|
3199
3418
|
t.push(o), n.push(e.advances[i]), r.push(e.inlineIndex[i] ?? -1);
|
|
3200
3419
|
}
|
|
3201
|
-
|
|
3202
|
-
for (; t[t.length - 1] === "\n";) t.pop(), n.pop(), r.pop();
|
|
3203
|
-
return {
|
|
3420
|
+
return a(), {
|
|
3204
3421
|
chars: t,
|
|
3205
3422
|
advances: n,
|
|
3206
3423
|
inlineIndex: r,
|
|
@@ -3208,38 +3425,75 @@ function zn(e) {
|
|
|
3208
3425
|
boxes: e.boxes
|
|
3209
3426
|
};
|
|
3210
3427
|
}
|
|
3211
|
-
function
|
|
3428
|
+
function sr(e, t, n) {
|
|
3212
3429
|
let r = 0, i = 0;
|
|
3213
|
-
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r,
|
|
3430
|
+
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
3431
|
return r;
|
|
3215
3432
|
}
|
|
3216
|
-
function
|
|
3217
|
-
return e
|
|
3433
|
+
function cr(e) {
|
|
3434
|
+
return b(e).length;
|
|
3435
|
+
}
|
|
3436
|
+
function lr(e) {
|
|
3437
|
+
Ue(e, "A block-level element nested inside a text run can't be laid out and was skipped. Give it its own place in the layout instead.");
|
|
3438
|
+
}
|
|
3439
|
+
function ur(e) {
|
|
3440
|
+
return Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? ""));
|
|
3218
3441
|
}
|
|
3219
|
-
|
|
3220
|
-
|
|
3442
|
+
var dr = "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>).";
|
|
3443
|
+
function fr(e) {
|
|
3444
|
+
return e === "INPUT" || e === "SELECT" || e === "TEXTAREA";
|
|
3221
3445
|
}
|
|
3222
|
-
function
|
|
3223
|
-
|
|
3446
|
+
function pr(e, t) {
|
|
3447
|
+
ur(e) && (t.droppedText = !0, Ue(e, dr));
|
|
3224
3448
|
}
|
|
3225
3449
|
//#endregion
|
|
3226
3450
|
//#region src/element.ts
|
|
3227
|
-
var
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
#
|
|
3237
|
-
#
|
|
3451
|
+
var mr = "\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 grid\n * 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 default select=\"text\" the grid is inert to events\n * and drag 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", hr = [
|
|
3452
|
+
"pointerover",
|
|
3453
|
+
"pointerleave",
|
|
3454
|
+
"focusin",
|
|
3455
|
+
"focusout",
|
|
3456
|
+
"input",
|
|
3457
|
+
"change"
|
|
3458
|
+
], gr = typeof HTMLElement > "u" ? class {} : HTMLElement, _r = class e extends gr {
|
|
3459
|
+
static observedAttributes = ["select"];
|
|
3460
|
+
static #e = /* @__PURE__ */ new Set();
|
|
3461
|
+
static #t = null;
|
|
3462
|
+
static #n = () => {
|
|
3463
|
+
for (let t of e.#e) t.#y();
|
|
3464
|
+
};
|
|
3465
|
+
static #r(t) {
|
|
3466
|
+
t instanceof HTMLLinkElement && t.rel === "stylesheet" && !t.sheet && t.addEventListener("load", e.#n, { once: !0 });
|
|
3467
|
+
}
|
|
3468
|
+
static #i(t) {
|
|
3469
|
+
if (e.#e.add(t), e.#t) return;
|
|
3470
|
+
for (let t of document.querySelectorAll("link[rel=stylesheet]")) e.#r(t);
|
|
3471
|
+
let n = new MutationObserver((t) => {
|
|
3472
|
+
for (let n of t) for (let t of n.addedNodes) e.#r(t);
|
|
3473
|
+
e.#n();
|
|
3474
|
+
});
|
|
3475
|
+
n.observe(document.head, {
|
|
3476
|
+
childList: !0,
|
|
3477
|
+
subtree: !0,
|
|
3478
|
+
characterData: !0
|
|
3479
|
+
}), e.#t = n;
|
|
3480
|
+
}
|
|
3481
|
+
static #a(t) {
|
|
3482
|
+
e.#e.delete(t), e.#e.size === 0 && (e.#t?.disconnect(), e.#t = null);
|
|
3483
|
+
}
|
|
3484
|
+
#o;
|
|
3485
|
+
#s;
|
|
3486
|
+
#c;
|
|
3487
|
+
#l = null;
|
|
3488
|
+
#u = null;
|
|
3489
|
+
#d = !1;
|
|
3490
|
+
#f = null;
|
|
3491
|
+
#p = null;
|
|
3238
3492
|
constructor() {
|
|
3239
|
-
super(), this.#
|
|
3493
|
+
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML = mr, 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
3494
|
}
|
|
3241
3495
|
connectedCallback() {
|
|
3242
|
-
this.#
|
|
3496
|
+
this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#y()), this.#l.observe(this), window.addEventListener("resize", this.#h), this.#u = new MutationObserver(() => this.#y()), this.#u.observe(this, {
|
|
3243
3497
|
childList: !0,
|
|
3244
3498
|
subtree: !0,
|
|
3245
3499
|
characterData: !0,
|
|
@@ -3251,71 +3505,88 @@ var Wn = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
3251
3505
|
"rowspan",
|
|
3252
3506
|
"span"
|
|
3253
3507
|
]
|
|
3254
|
-
}), document.fonts?.ready.then(this.#
|
|
3508
|
+
}), document.fonts?.ready.then(this.#g).catch((e) => {
|
|
3255
3509
|
console.warn("[monowind] document.fonts.ready failed:", e);
|
|
3256
|
-
}), document.fonts?.addEventListener("loadingdone", this.#
|
|
3510
|
+
}), document.fonts?.addEventListener("loadingdone", this.#g);
|
|
3511
|
+
for (let e of hr) this.addEventListener(e, this.#m);
|
|
3512
|
+
e.#i(this), this.#y();
|
|
3257
3513
|
}
|
|
3258
3514
|
disconnectedCallback() {
|
|
3259
|
-
this.#
|
|
3515
|
+
window.removeEventListener("resize", this.#h), this.#l?.disconnect(), this.#u?.disconnect(), this.#l = null, this.#u = null, document.fonts?.removeEventListener("loadingdone", this.#g);
|
|
3516
|
+
for (let e of hr) this.removeEventListener(e, this.#m);
|
|
3517
|
+
e.#a(this);
|
|
3260
3518
|
}
|
|
3261
|
-
|
|
3262
|
-
|
|
3519
|
+
#m = (e) => {
|
|
3520
|
+
if ((e.type === "focusin" || e.type === "focusout") && e.target instanceof HTMLSelectElement) {
|
|
3521
|
+
this.#v();
|
|
3522
|
+
return;
|
|
3523
|
+
}
|
|
3524
|
+
this.#y();
|
|
3525
|
+
};
|
|
3526
|
+
attributeChangedCallback(e, t, n) {
|
|
3527
|
+
e === "select" && n !== null && n !== "text" && n !== "grid" && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "text" (default) or "grid".`, this), this.#y();
|
|
3263
3528
|
}
|
|
3264
3529
|
toPlainText() {
|
|
3265
|
-
return this.#
|
|
3530
|
+
return this.#d && this.#b(), this.#p ? Bt(this.#p) : "";
|
|
3266
3531
|
}
|
|
3267
|
-
#
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3532
|
+
#h = () => {
|
|
3533
|
+
this.#y();
|
|
3534
|
+
};
|
|
3535
|
+
#g = () => {
|
|
3536
|
+
requestAnimationFrame(() => this.#y());
|
|
3537
|
+
};
|
|
3538
|
+
#_() {
|
|
3539
|
+
let e = document.activeElement;
|
|
3540
|
+
if (!(e instanceof HTMLSelectElement) || !this.contains(e)) return !1;
|
|
3541
|
+
try {
|
|
3542
|
+
return e.matches(":open");
|
|
3543
|
+
} catch {
|
|
3544
|
+
return !1;
|
|
3271
3545
|
}
|
|
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
3546
|
}
|
|
3285
|
-
#
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3547
|
+
#v() {
|
|
3548
|
+
try {
|
|
3549
|
+
this.#b();
|
|
3550
|
+
} catch (e) {
|
|
3551
|
+
console.error("[monowind] layout failed:", e);
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3554
|
+
#y() {
|
|
3555
|
+
this.#d || (this.#d = !0, requestAnimationFrame(() => {
|
|
3556
|
+
if (this.#d = !1, this.#_()) {
|
|
3557
|
+
this.#y();
|
|
3558
|
+
return;
|
|
3295
3559
|
}
|
|
3560
|
+
this.#v();
|
|
3296
3561
|
}));
|
|
3297
3562
|
}
|
|
3298
|
-
#
|
|
3563
|
+
#b() {
|
|
3564
|
+
if (!this.isConnected) return;
|
|
3565
|
+
let e = /* @__PURE__ */ new Map(), t = getComputedStyle(this).getPropertyValue("--mw-cw").trim(), n = parseFloat(t);
|
|
3566
|
+
if (Number.isFinite(n) && n > 0) for (let t of this.querySelectorAll("textarea")) {
|
|
3567
|
+
let r = getComputedStyle(t), i = t.clientWidth - (parseFloat(r.paddingLeft) || 0) - (parseFloat(r.paddingRight) || 0);
|
|
3568
|
+
e.set(t, Math.max(0, Math.round(i / n)));
|
|
3569
|
+
}
|
|
3299
3570
|
this.setAttribute("measuring", "");
|
|
3300
3571
|
try {
|
|
3301
|
-
let
|
|
3302
|
-
(
|
|
3303
|
-
let
|
|
3304
|
-
if (
|
|
3305
|
-
let
|
|
3306
|
-
for (let
|
|
3307
|
-
if (
|
|
3308
|
-
let
|
|
3309
|
-
|
|
3572
|
+
let t = h(this, this.#c), n = this.#f;
|
|
3573
|
+
(n === null || n.width !== t.width || n.height !== t.height || n.letterSpacing !== t.letterSpacing) && (this.style.setProperty("--mw-cw", `${t.width}px`), this.style.setProperty("--mw-ch", `${t.height}px`), this.style.setProperty("--mw-rls", `${t.letterSpacing}px`)), this.#f = t;
|
|
3574
|
+
let r = getComputedStyle(this), i = (parseFloat(r.paddingLeft) || 0) + (parseFloat(r.paddingRight) || 0), a = Math.max(0, Math.floor((this.clientWidth - i) / t.width));
|
|
3575
|
+
if (a === 0) return;
|
|
3576
|
+
let o = g(), s = [];
|
|
3577
|
+
for (let n of Array.from(this.children)) {
|
|
3578
|
+
if (n === this.#c) continue;
|
|
3579
|
+
let r = Xn(n, o, t, e);
|
|
3580
|
+
r && s.push(r);
|
|
3310
3581
|
}
|
|
3311
|
-
if (
|
|
3312
|
-
this.#
|
|
3582
|
+
if (ur(this) ? (this.hasAttribute("data-mw-dropped-text") || console.warn(`[monowind] ${dr}`, this), this.setAttribute("data-mw-dropped-text", "")) : this.removeAttribute("data-mw-dropped-text"), s.length === 0) {
|
|
3583
|
+
this.#s.replaceChildren(), this.#p = null, this.setAttribute("data-mw-ready", "");
|
|
3313
3584
|
return;
|
|
3314
3585
|
}
|
|
3315
|
-
let
|
|
3586
|
+
let c = {
|
|
3316
3587
|
source: this,
|
|
3317
|
-
style:
|
|
3318
|
-
children:
|
|
3588
|
+
style: ue(),
|
|
3589
|
+
children: s,
|
|
3319
3590
|
text: "",
|
|
3320
3591
|
intrinsicWidth: 0,
|
|
3321
3592
|
intrinsicHeight: 0,
|
|
@@ -3326,20 +3597,20 @@ var Wn = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
3326
3597
|
height: 0
|
|
3327
3598
|
},
|
|
3328
3599
|
unclampedHeight: 0,
|
|
3329
|
-
resolvedPadding:
|
|
3330
|
-
}, { height:
|
|
3331
|
-
|
|
3332
|
-
let
|
|
3333
|
-
this.style.height
|
|
3600
|
+
resolvedPadding: z()
|
|
3601
|
+
}, { height: l } = wt(c, a);
|
|
3602
|
+
$t(c), Zt(c, this.#s), this.#p = c;
|
|
3603
|
+
let u = r.boxSizing === "border-box" ? (parseFloat(r.paddingTop) || 0) + (parseFloat(r.paddingBottom) || 0) + (parseFloat(r.borderTopWidth) || 0) + (parseFloat(r.borderBottomWidth) || 0) : 0, d = `${l * t.height + u}px`;
|
|
3604
|
+
this.style.height !== d && (this.style.height = d), this.hasAttribute("data-mw-ready") || this.setAttribute("data-mw-ready", "");
|
|
3334
3605
|
} finally {
|
|
3335
|
-
this.removeAttribute("measuring"), this.#
|
|
3606
|
+
this.removeAttribute("measuring"), this.#u?.takeRecords();
|
|
3336
3607
|
}
|
|
3337
3608
|
}
|
|
3338
3609
|
};
|
|
3339
|
-
function
|
|
3340
|
-
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind",
|
|
3610
|
+
function vr() {
|
|
3611
|
+
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind", _r);
|
|
3341
3612
|
}
|
|
3342
3613
|
//#endregion
|
|
3343
|
-
export {
|
|
3614
|
+
export { _r as MonoWindElement, vr as defineMonoWind, Bt as renderPlainText, _ as wrapLines };
|
|
3344
3615
|
|
|
3345
3616
|
//# sourceMappingURL=index.js.map
|