monowind 0.1.2 → 0.1.4
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 +49 -9
- package/dist/borders.d.ts.map +1 -1
- package/dist/cdn.d.ts +2 -1
- package/dist/cdn.d.ts.map +1 -1
- package/dist/cdn.js +37 -26
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts +8 -0
- 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.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1802 -860
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts +9 -0
- package/dist/layout.d.ts.map +1 -1
- package/dist/plain-text.d.ts +31 -0
- package/dist/plain-text.d.ts.map +1 -0
- package/dist/style.d.ts.map +1 -1
- package/dist/table.d.ts +82 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/tree.d.ts.map +1 -1
- package/dist/types.d.ts +99 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/warn.d.ts +2 -0
- package/dist/warn.d.ts.map +1 -0
- package/dist/wrap.d.ts +7 -6
- package/dist/wrap.d.ts.map +1 -1
- package/package.json +5 -3
- package/src/styles.css +40 -2
- package/dist/ascii.d.ts +0 -16
- package/dist/ascii.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,219 @@
|
|
|
1
|
+
//#region src/borders.ts
|
|
2
|
+
function e(e, n, r) {
|
|
3
|
+
let i = e.border;
|
|
4
|
+
if (i.top === 0 && i.right === 0 && i.bottom === 0 && i.left === 0) return;
|
|
5
|
+
let a = Math.max(i.top, i.right, i.bottom, i.left);
|
|
6
|
+
for (let o = 0; o < a; o++) {
|
|
7
|
+
let a = {
|
|
8
|
+
top: o < i.top,
|
|
9
|
+
right: o < i.right,
|
|
10
|
+
bottom: o < i.bottom,
|
|
11
|
+
left: o < i.left
|
|
12
|
+
}, s = {
|
|
13
|
+
x: n.x + (a.left ? o : 0),
|
|
14
|
+
y: n.y + (a.top ? o : 0),
|
|
15
|
+
width: n.width - (a.left ? o : 0) - (a.right ? o : 0),
|
|
16
|
+
height: n.height - (a.top ? o : 0) - (a.bottom ? o : 0)
|
|
17
|
+
};
|
|
18
|
+
s.width <= 0 || s.height <= 0 || t(r, e.borderStyle, e.borderColor, s, a);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function t(e, t, n, r, i) {
|
|
22
|
+
let a = l(t.top), o = l(t.right), s = l(t.bottom), c = l(t.left), u = (e, t, n) => n(l(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
|
+
if (i.top && _ > g && e.push({
|
|
24
|
+
glyph: a.h,
|
|
25
|
+
x: g,
|
|
26
|
+
y: f,
|
|
27
|
+
length: _ - g,
|
|
28
|
+
color: n.top
|
|
29
|
+
}), i.bottom && m > +!!i.top && _ > g && e.push({
|
|
30
|
+
glyph: s.h,
|
|
31
|
+
x: g,
|
|
32
|
+
y: f + m - 1,
|
|
33
|
+
length: _ - g,
|
|
34
|
+
color: n.bottom
|
|
35
|
+
}), i.left) for (let t = v; t < y; t++) e.push({
|
|
36
|
+
glyph: c.v,
|
|
37
|
+
x: d,
|
|
38
|
+
y: t,
|
|
39
|
+
length: 1,
|
|
40
|
+
color: n.left
|
|
41
|
+
});
|
|
42
|
+
if (i.right && p > +!!i.left) for (let t = v; t < y; t++) e.push({
|
|
43
|
+
glyph: o.v,
|
|
44
|
+
x: d + p - 1,
|
|
45
|
+
y: t,
|
|
46
|
+
length: 1,
|
|
47
|
+
color: n.right
|
|
48
|
+
});
|
|
49
|
+
h && (i.top && i.left && e.push({
|
|
50
|
+
glyph: u(t.top, t.left, (e) => e.tl),
|
|
51
|
+
x: d,
|
|
52
|
+
y: f,
|
|
53
|
+
length: 1,
|
|
54
|
+
color: n.top
|
|
55
|
+
}), i.top && i.right && e.push({
|
|
56
|
+
glyph: u(t.top, t.right, (e) => e.tr),
|
|
57
|
+
x: d + p - 1,
|
|
58
|
+
y: f,
|
|
59
|
+
length: 1,
|
|
60
|
+
color: n.top
|
|
61
|
+
}), i.bottom && i.left && e.push({
|
|
62
|
+
glyph: u(t.bottom, t.left, (e) => e.bl),
|
|
63
|
+
x: d,
|
|
64
|
+
y: f + m - 1,
|
|
65
|
+
length: 1,
|
|
66
|
+
color: n.bottom
|
|
67
|
+
}), i.bottom && i.right && e.push({
|
|
68
|
+
glyph: u(t.bottom, t.right, (e) => e.br),
|
|
69
|
+
x: d + p - 1,
|
|
70
|
+
y: f + m - 1,
|
|
71
|
+
length: 1,
|
|
72
|
+
color: n.bottom
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
function n(e, t) {
|
|
76
|
+
return e.style.position !== "static" || t.style.display === "flex" || t.style.display === "grid";
|
|
77
|
+
}
|
|
78
|
+
function r(e, t) {
|
|
79
|
+
return n(e, t) ? e.style.zIndex ?? 0 : 0;
|
|
80
|
+
}
|
|
81
|
+
function i(e) {
|
|
82
|
+
return [...e.children].sort((t, n) => r(t, e) - r(n, e));
|
|
83
|
+
}
|
|
84
|
+
function a(e, t) {
|
|
85
|
+
let n = l(e);
|
|
86
|
+
return t === "h" ? n.h : n.v;
|
|
87
|
+
}
|
|
88
|
+
function o(e, t, n, r, i) {
|
|
89
|
+
return (e === "double" ? c : s)[(t ? 8 : 0) | (n ? 4 : 0) | (r ? 2 : 0) | !!i];
|
|
90
|
+
}
|
|
91
|
+
var s = [
|
|
92
|
+
" ",
|
|
93
|
+
"─",
|
|
94
|
+
"─",
|
|
95
|
+
"─",
|
|
96
|
+
"│",
|
|
97
|
+
"┌",
|
|
98
|
+
"┐",
|
|
99
|
+
"┬",
|
|
100
|
+
"│",
|
|
101
|
+
"└",
|
|
102
|
+
"┘",
|
|
103
|
+
"┴",
|
|
104
|
+
"│",
|
|
105
|
+
"├",
|
|
106
|
+
"┤",
|
|
107
|
+
"┼"
|
|
108
|
+
], c = [
|
|
109
|
+
" ",
|
|
110
|
+
"═",
|
|
111
|
+
"═",
|
|
112
|
+
"═",
|
|
113
|
+
"║",
|
|
114
|
+
"╔",
|
|
115
|
+
"╗",
|
|
116
|
+
"╦",
|
|
117
|
+
"║",
|
|
118
|
+
"╚",
|
|
119
|
+
"╝",
|
|
120
|
+
"╩",
|
|
121
|
+
"║",
|
|
122
|
+
"╠",
|
|
123
|
+
"╣",
|
|
124
|
+
"╬"
|
|
125
|
+
];
|
|
126
|
+
function l(e) {
|
|
127
|
+
let t = (t, n, r, i) => o(e, t, n, r, i), n = {
|
|
128
|
+
h: t(!1, !1, !0, !0),
|
|
129
|
+
v: t(!0, !0, !1, !1),
|
|
130
|
+
tl: t(!1, !0, !1, !0),
|
|
131
|
+
tr: t(!1, !0, !0, !1),
|
|
132
|
+
bl: t(!0, !1, !1, !0),
|
|
133
|
+
br: t(!0, !1, !0, !1)
|
|
134
|
+
};
|
|
135
|
+
return e === "dashed" ? {
|
|
136
|
+
...n,
|
|
137
|
+
h: "╌",
|
|
138
|
+
v: "╎"
|
|
139
|
+
} : e === "dotted" ? {
|
|
140
|
+
...n,
|
|
141
|
+
h: "┄",
|
|
142
|
+
v: "┊"
|
|
143
|
+
} : n;
|
|
144
|
+
}
|
|
145
|
+
function u(e) {
|
|
146
|
+
let t = [], n = e.border.left + e.padding.left, r = e.border.top + e.padding.top, i = (e, t) => ({
|
|
147
|
+
line: t.bandStart + Math.floor((t.bandSize - e.width) / 2),
|
|
148
|
+
start: t.start,
|
|
149
|
+
end: t.end
|
|
150
|
+
}), s = e.ruleX ? e.vertical.map((t) => i(e.ruleX, t)) : [], c = e.ruleY ? e.horizontal.map((t) => i(e.ruleY, t)) : [], l = e.ruleX?.width ?? 0, u = e.ruleY?.width ?? 0, f = (e, t) => s.some((n) => e >= n.line && e < n.line + l && t >= n.start && t < n.end), p = (e) => c.some((t) => e >= t.line && e < t.line + u);
|
|
151
|
+
if (e.ruleX) {
|
|
152
|
+
let i = a(e.ruleX.style, "v");
|
|
153
|
+
for (let a of s) {
|
|
154
|
+
for (let o = 0; o < l; o++) for (let s = a.start; s < a.end; s++) p(s) || t.push({
|
|
155
|
+
glyph: i,
|
|
156
|
+
x: n + a.line + o,
|
|
157
|
+
y: r + s,
|
|
158
|
+
length: 1,
|
|
159
|
+
color: e.ruleX.color
|
|
160
|
+
});
|
|
161
|
+
d(e, t, "x", a.line, a.start, a.end);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (e.ruleY) {
|
|
165
|
+
let i = e.ruleY.style === "double" && e.ruleX?.style === "double";
|
|
166
|
+
for (let s of c) {
|
|
167
|
+
for (let c = 0; c < u; c++) {
|
|
168
|
+
let l = s.line + c;
|
|
169
|
+
for (let c = s.start; c < s.end; c++) {
|
|
170
|
+
let u = f(c, l), d = u || f(c, l - 1), p = u || f(c, l + 1);
|
|
171
|
+
t.push({
|
|
172
|
+
glyph: d || p ? o(i ? "double" : "solid", d, p, c > s.start, c < s.end - 1) : a(e.ruleY.style, "h"),
|
|
173
|
+
x: n + c,
|
|
174
|
+
y: r + l,
|
|
175
|
+
length: 1,
|
|
176
|
+
color: e.ruleY.color
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
d(e, t, "y", s.line, s.start, s.end);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return t;
|
|
184
|
+
}
|
|
185
|
+
function d(e, t, n, r, i, a) {
|
|
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, a, c, l, u) => {
|
|
187
|
+
let d = s.style === "double" && r === "double" ? "double" : "solid";
|
|
188
|
+
t.push({
|
|
189
|
+
glyph: o(d, a, c, l, u),
|
|
190
|
+
x: e,
|
|
191
|
+
y: n,
|
|
192
|
+
length: 1,
|
|
193
|
+
color: i
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
if (n === "x") for (let t = 0; t < s.width; t++) {
|
|
197
|
+
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), a >= 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
|
+
}
|
|
200
|
+
else for (let t = 0; t < s.width; t++) {
|
|
201
|
+
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), a >= 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
|
+
}
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
1
206
|
//#region src/metrics.ts
|
|
2
|
-
function
|
|
207
|
+
function f(e) {
|
|
3
208
|
return (e >= 0 ? Math.floor(e + .5) : -Math.floor(-e + .5)) || 0;
|
|
4
209
|
}
|
|
5
|
-
function
|
|
6
|
-
return
|
|
210
|
+
function p(e, t) {
|
|
211
|
+
return t <= 0 ? 0 : f(e / (.25 * t));
|
|
7
212
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
213
|
+
function m(e, t) {
|
|
214
|
+
return f(t * e / 100);
|
|
10
215
|
}
|
|
11
|
-
function
|
|
216
|
+
function h(e, t) {
|
|
12
217
|
let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).letterSpacing) || 0;
|
|
13
218
|
return {
|
|
14
219
|
width: n.width / 100,
|
|
@@ -16,12 +221,15 @@ function r(e, t) {
|
|
|
16
221
|
letterSpacing: r
|
|
17
222
|
};
|
|
18
223
|
}
|
|
19
|
-
function
|
|
224
|
+
function g() {
|
|
20
225
|
return parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
21
226
|
}
|
|
22
227
|
//#endregion
|
|
23
228
|
//#region src/wrap.ts
|
|
24
|
-
function
|
|
229
|
+
function _(e, t, n = {}) {
|
|
230
|
+
return y(e, t, n).map((t) => e.slice(t.start, t.end));
|
|
231
|
+
}
|
|
232
|
+
function v(e) {
|
|
25
233
|
let t = [], n = 0;
|
|
26
234
|
for (let r = 0; r <= e.length; r++) (r === e.length || e[r] === "\n") && (t.push({
|
|
27
235
|
start: n,
|
|
@@ -29,34 +237,34 @@ function a(e) {
|
|
|
29
237
|
}), n = r + 1);
|
|
30
238
|
return t;
|
|
31
239
|
}
|
|
32
|
-
function
|
|
240
|
+
function y(e, t, n = {}) {
|
|
33
241
|
if (!/[^ \t\r\n\f]/.test(e)) return [];
|
|
34
242
|
let r = [], i = 0;
|
|
35
|
-
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r.push(...
|
|
243
|
+
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r.push(...O(e, i, a, t, n)), i = a + 1);
|
|
36
244
|
return r;
|
|
37
245
|
}
|
|
38
|
-
function
|
|
246
|
+
function b(e, t, n) {
|
|
39
247
|
if (!n) return t - e;
|
|
40
248
|
let r = 0;
|
|
41
249
|
for (let i = e; i < t; i++) r += n[i] ?? 1;
|
|
42
250
|
return r;
|
|
43
251
|
}
|
|
44
|
-
function
|
|
45
|
-
return t <= e ? 0 :
|
|
252
|
+
function x(e, t, n, r = 0) {
|
|
253
|
+
return t <= e ? 0 : b(e, t, n) - Math.min(r, S(t - 1, n));
|
|
46
254
|
}
|
|
47
|
-
function
|
|
255
|
+
function S(e, t) {
|
|
48
256
|
return t ? (t[e] ?? 1) - 1 : 0;
|
|
49
257
|
}
|
|
50
|
-
function
|
|
258
|
+
function C(e, t = {}) {
|
|
51
259
|
let { advances: n, tracking: r = 0 } = t, i = 0;
|
|
52
|
-
for (let t of
|
|
260
|
+
for (let t of D(e, 0, e.length)) for (let a of T(e, t.start, t.end)) i = Math.max(i, x(a.start, a.end, n, r));
|
|
53
261
|
return i;
|
|
54
262
|
}
|
|
55
|
-
function
|
|
263
|
+
function w(e, t) {
|
|
56
264
|
let n = 0;
|
|
57
265
|
for (let r = 0; r < e.length; r++) e[r] === "" && (t(r, n), n++);
|
|
58
266
|
}
|
|
59
|
-
function
|
|
267
|
+
function T(e, t, n) {
|
|
60
268
|
let r = [], i = t;
|
|
61
269
|
for (let a = t; a < n; a++) {
|
|
62
270
|
if (e[a] === "") {
|
|
@@ -70,26 +278,27 @@ function f(e, t, n) {
|
|
|
70
278
|
continue;
|
|
71
279
|
}
|
|
72
280
|
if (e[a] !== "-") continue;
|
|
281
|
+
let o = a === t;
|
|
73
282
|
for (; a + 1 < n && e[a + 1] === "-";) a++;
|
|
74
|
-
let
|
|
75
|
-
|
|
283
|
+
let s = a + 1;
|
|
284
|
+
!o && s < n && (r.push({
|
|
76
285
|
start: i,
|
|
77
|
-
end:
|
|
78
|
-
}), i =
|
|
286
|
+
end: s
|
|
287
|
+
}), i = s);
|
|
79
288
|
}
|
|
80
289
|
return r.push({
|
|
81
290
|
start: i,
|
|
82
291
|
end: n
|
|
83
292
|
}), r;
|
|
84
293
|
}
|
|
85
|
-
var
|
|
86
|
-
function
|
|
294
|
+
var E = /[ \t\r\n\f]/;
|
|
295
|
+
function D(e, t, n) {
|
|
87
296
|
let r = [], i = t;
|
|
88
297
|
for (; i < n;) {
|
|
89
|
-
for (; i < n &&
|
|
298
|
+
for (; i < n && E.test(e[i]);) i++;
|
|
90
299
|
if (i >= n) break;
|
|
91
300
|
let t = i;
|
|
92
|
-
for (; i < n && !
|
|
301
|
+
for (; i < n && !E.test(e[i]);) i++;
|
|
93
302
|
r.push({
|
|
94
303
|
start: t,
|
|
95
304
|
end: i
|
|
@@ -97,8 +306,8 @@ function m(e, t, n) {
|
|
|
97
306
|
}
|
|
98
307
|
return r;
|
|
99
308
|
}
|
|
100
|
-
function
|
|
101
|
-
let o =
|
|
309
|
+
function O(e, t, n, r, { advances: i, tracking: a = 0 }) {
|
|
310
|
+
let o = D(e, t, n);
|
|
102
311
|
if (o.length === 0) return [{
|
|
103
312
|
start: t,
|
|
104
313
|
end: t
|
|
@@ -107,108 +316,144 @@ function h(e, t, n, r, { advances: i, tracking: a = 0 }) {
|
|
|
107
316
|
start: o[0].start,
|
|
108
317
|
end: o[o.length - 1].end
|
|
109
318
|
}];
|
|
110
|
-
let
|
|
319
|
+
let s = [], c = null, l = 0;
|
|
111
320
|
for (let t of o) {
|
|
112
321
|
let n = !1;
|
|
113
|
-
for (let o of
|
|
114
|
-
let e = o.start, t = o.end,
|
|
115
|
-
if (
|
|
322
|
+
for (let o of T(e, t.start, t.end)) {
|
|
323
|
+
let e = o.start, t = o.end, u = c !== null && !n ? e - 1 : e, d = l + b(u, t, i), f = Math.min(a, S(t - 1, i));
|
|
324
|
+
if (c !== null && d - f <= r) c.end = t, l = d;
|
|
116
325
|
else {
|
|
117
|
-
for (
|
|
326
|
+
for (c !== null && s.push(c);;) {
|
|
118
327
|
let n = e;
|
|
119
|
-
for (; n < t &&
|
|
328
|
+
for (; n < t && x(e, n + 1, i, a) <= r;) n++;
|
|
120
329
|
if (n === t || n === e) break;
|
|
121
|
-
|
|
330
|
+
s.push({
|
|
122
331
|
start: e,
|
|
123
332
|
end: n
|
|
124
333
|
}), e = n;
|
|
125
334
|
}
|
|
126
|
-
|
|
335
|
+
c = {
|
|
127
336
|
start: e,
|
|
128
337
|
end: t
|
|
129
|
-
},
|
|
338
|
+
}, l = b(e, t, i);
|
|
130
339
|
}
|
|
131
340
|
n = !0;
|
|
132
341
|
}
|
|
133
342
|
}
|
|
134
|
-
return
|
|
343
|
+
return c !== null && s.push(c), s;
|
|
135
344
|
}
|
|
136
345
|
//#endregion
|
|
137
346
|
//#region src/flex.ts
|
|
138
|
-
function
|
|
139
|
-
let s =
|
|
140
|
-
let n =
|
|
347
|
+
function k(e, t, n, r, i, a, o) {
|
|
348
|
+
let s = Ct(e.style, "x", t), c = Ct(e.style, "y", n), l = ne(e).map((e) => {
|
|
349
|
+
let n = q(e.style.margin, t);
|
|
141
350
|
return {
|
|
142
351
|
node: e,
|
|
143
|
-
base:
|
|
352
|
+
base: te(e, t, o),
|
|
144
353
|
grow: e.style.flexGrow,
|
|
145
354
|
shrink: e.style.flexShrink,
|
|
146
|
-
min:
|
|
147
|
-
max:
|
|
355
|
+
min: ae(e, t, o),
|
|
356
|
+
max: Y(e.style.maxWidth, t),
|
|
148
357
|
margin: n
|
|
149
358
|
};
|
|
150
|
-
}),
|
|
359
|
+
}), d = [];
|
|
151
360
|
if (e.style.flexWrap === "wrap") {
|
|
152
361
|
let n = [], r = 0;
|
|
153
362
|
for (let e of l) {
|
|
154
|
-
let i = Math.max(0,
|
|
155
|
-
n.length > 0 && a > t && (
|
|
156
|
-
}
|
|
157
|
-
n.length > 0 &&
|
|
158
|
-
} else
|
|
159
|
-
let
|
|
160
|
-
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,
|
|
161
|
-
for (let n = 0; n < e.length; n++)
|
|
363
|
+
let i = Math.max(0, G(e.base, e.min, e.max)) + (e.margin.left ?? 0) + (e.margin.right ?? 0), a = n.length === 0 ? i : r + s + i;
|
|
364
|
+
n.length > 0 && a > t && (d.push(n), n = [], r = 0), n.push(e), r = n.length === 1 ? i : r + s + i;
|
|
365
|
+
}
|
|
366
|
+
n.length > 0 && d.push(n), e.style.wrapReverse && d.reverse();
|
|
367
|
+
} else d.push(l);
|
|
368
|
+
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, G(e.base, e.min, e.max))) : ee(e, a);
|
|
370
|
+
for (let n = 0; n < e.length; n++) W(e[n].node, t, r, 0, 0, "fill", o, { width: u[n] });
|
|
162
371
|
return {
|
|
163
372
|
row: e,
|
|
164
373
|
widths: u,
|
|
165
374
|
availableForItems: a,
|
|
166
375
|
height: e.reduce((e, t) => Math.max(e, t.node.localRect.height), 0)
|
|
167
376
|
};
|
|
168
|
-
}),
|
|
169
|
-
if (e.style.flexWrap === "nowrap") Number.isFinite(n) && (
|
|
377
|
+
}), h = m.map((e) => e.height), g = c * Math.max(0, m.length - 1), _;
|
|
378
|
+
if (e.style.flexWrap === "nowrap") Number.isFinite(n) && (h[0] = Math.max(n, h[0] ?? 0)), _ = [0];
|
|
170
379
|
else {
|
|
171
|
-
let t =
|
|
380
|
+
let t = h.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - g) : 0, i = re(e.style);
|
|
172
381
|
if (i === "stretch" && r > 0) {
|
|
173
|
-
let e =
|
|
174
|
-
for (let t = 0; t <
|
|
175
|
-
|
|
176
|
-
} else
|
|
382
|
+
let e = F(Array.from({ length: m.length }, () => 1), r);
|
|
383
|
+
for (let t = 0; t < h.length; t++) h[t] += e[t];
|
|
384
|
+
_ = P("start", h, 0);
|
|
385
|
+
} else _ = P(i === "stretch" ? "start" : i, h, r);
|
|
177
386
|
}
|
|
178
|
-
for (let i = 0; i <
|
|
179
|
-
let { row: a, widths: l, availableForItems: u } =
|
|
387
|
+
for (let i = 0; i < m.length; i++) {
|
|
388
|
+
let { row: a, widths: l, availableForItems: u } = m[i], d = h[i], g = _[i] + i * c;
|
|
180
389
|
for (let i = 0; i < a.length; i++) {
|
|
181
|
-
let s = a[i].node, c =
|
|
182
|
-
if (c === "stretch" && !
|
|
183
|
-
let e = u.top ?? 0, a = u.bottom ?? 0, c = Number.isFinite(n) ? n : void 0,
|
|
184
|
-
if (
|
|
185
|
-
|
|
390
|
+
let s = a[i].node, c = I(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
|
+
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 = G(Math.max(0, d - e - a), Y(s.style.minHeight, c) ?? 0, Y(s.style.maxHeight, c));
|
|
393
|
+
if (f === s.localRect.height) continue;
|
|
394
|
+
W(s, t, r, 0, 0, "fill", o, {
|
|
186
395
|
width: l[i],
|
|
187
|
-
height:
|
|
396
|
+
height: f
|
|
188
397
|
});
|
|
189
398
|
}
|
|
190
399
|
}
|
|
191
|
-
let v = l.reduce((e, t) => e + t, 0),
|
|
192
|
-
if (
|
|
193
|
-
let e =
|
|
194
|
-
for (let n = 0; n < a.length; n++) a[n].margin.left === null && (
|
|
195
|
-
|
|
196
|
-
} else
|
|
197
|
-
let
|
|
400
|
+
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
|
+
if (b > 0 && y > 0) {
|
|
402
|
+
let e = F(Array.from({ length: b }, () => 1), y), t = 0;
|
|
403
|
+
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 = P("start", l, 0);
|
|
405
|
+
} else C = P(ie(e.style), l, y);
|
|
406
|
+
let w = 0;
|
|
198
407
|
for (let t = 0; t < a.length; t++) {
|
|
199
408
|
let n = a[t], r = n.node, i = n.margin.left ?? 0, o = n.margin.right ?? 0;
|
|
200
|
-
|
|
409
|
+
w += x[t] + i, r.localRect = {
|
|
201
410
|
...r.localRect,
|
|
202
|
-
x:
|
|
203
|
-
y:
|
|
204
|
-
},
|
|
411
|
+
x: f + C[t] + t * s + w,
|
|
412
|
+
y: p + g + M(r, e.style.alignItems, d, n.margin)
|
|
413
|
+
}, w += S[t] + o;
|
|
205
414
|
}
|
|
206
415
|
}
|
|
207
|
-
let v =
|
|
208
|
-
|
|
416
|
+
let v = h.reduce((e, t) => e + t, 0) + g, y = Number.isFinite(n) ? Math.max(n, v) : v;
|
|
417
|
+
if (e.style.ruleX || e.style.ruleY) {
|
|
418
|
+
let n = [], r = [];
|
|
419
|
+
for (let e = 0; e < m.length; e++) {
|
|
420
|
+
let i = _[e] + e * c, a = m[e].row.map((e) => e.node.localRect).sort((e, t) => e.x - t.x);
|
|
421
|
+
for (let t = 1; t < a.length; t++) {
|
|
422
|
+
let r = a[t - 1].x + a[t - 1].width - f, o = a[t].x - f - r;
|
|
423
|
+
o > 0 && n.push({
|
|
424
|
+
bandStart: r,
|
|
425
|
+
bandSize: o,
|
|
426
|
+
start: i,
|
|
427
|
+
end: i + h[e]
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
if (e > 0) {
|
|
431
|
+
let n = _[e - 1] + (e - 1) * c + h[e - 1];
|
|
432
|
+
i > n && r.push({
|
|
433
|
+
bandStart: n,
|
|
434
|
+
bandSize: i - n,
|
|
435
|
+
start: 0,
|
|
436
|
+
end: t
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
e.decorationRuns = u({
|
|
441
|
+
ruleX: e.style.ruleX,
|
|
442
|
+
ruleY: e.style.ruleY,
|
|
443
|
+
vertical: n,
|
|
444
|
+
horizontal: r,
|
|
445
|
+
contentWidth: t,
|
|
446
|
+
contentHeight: y,
|
|
447
|
+
border: i,
|
|
448
|
+
borderStyle: e.style.borderStyle,
|
|
449
|
+
borderColor: e.style.borderColor,
|
|
450
|
+
padding: a
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
return A(e, i, a, t, y), y;
|
|
209
454
|
}
|
|
210
|
-
function
|
|
211
|
-
for (let a of e.children)
|
|
455
|
+
function A(e, t, n, r, i) {
|
|
456
|
+
for (let a of e.children) U(a.style) && (a.staticSlot = {
|
|
212
457
|
kind: "flex",
|
|
213
458
|
direction: e.style.flexDirection,
|
|
214
459
|
originX: t.left + n.left,
|
|
@@ -217,52 +462,76 @@ function _(e, t, n, r, i) {
|
|
|
217
462
|
innerHeight: i
|
|
218
463
|
});
|
|
219
464
|
}
|
|
220
|
-
function
|
|
221
|
-
let
|
|
222
|
-
let
|
|
223
|
-
|
|
224
|
-
let
|
|
465
|
+
function j(e, t, n, r, i, a, o) {
|
|
466
|
+
let s = Ct(e.style, "y", n), c = ne(e).map((i) => {
|
|
467
|
+
let a = q(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c = I(i, e) === "stretch";
|
|
468
|
+
W(i, s, r && Number.isFinite(n) ? n : void 0, 0, 0, c ? "fill" : "shrink", o);
|
|
469
|
+
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;
|
|
225
470
|
return {
|
|
226
|
-
node:
|
|
227
|
-
base:
|
|
228
|
-
grow:
|
|
229
|
-
shrink:
|
|
230
|
-
min:
|
|
231
|
-
max:
|
|
232
|
-
margin:
|
|
471
|
+
node: i,
|
|
472
|
+
base: d,
|
|
473
|
+
grow: i.style.flexGrow,
|
|
474
|
+
shrink: i.style.flexShrink,
|
|
475
|
+
min: f ?? Y(i.style.minHeight, l) ?? 0,
|
|
476
|
+
max: Y(i.style.maxHeight, l),
|
|
477
|
+
margin: a
|
|
233
478
|
};
|
|
234
|
-
}),
|
|
235
|
-
for (let n = 0; n <
|
|
236
|
-
let r =
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
let y = v.reduce((e, t) => e + t, 0),
|
|
240
|
-
if (
|
|
241
|
-
let e =
|
|
242
|
-
for (let n = 0; n <
|
|
243
|
-
|
|
244
|
-
} else
|
|
245
|
-
let
|
|
246
|
-
for (let n = 0; n <
|
|
247
|
-
let r =
|
|
248
|
-
|
|
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) ? ee(c, g) : c.map((e) => Math.max(0, G(e.base, e.min, e.max)));
|
|
480
|
+
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 = I(r.node, e) === "stretch";
|
|
482
|
+
W(r.node, i, v[n], 0, 0, a ? "fill" : "shrink", o, { height: v[n] });
|
|
483
|
+
}
|
|
484
|
+
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
|
+
if (x > 0 && b > 0) {
|
|
486
|
+
let e = F(Array.from({ length: x }, () => 1), b), t = 0;
|
|
487
|
+
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 = P("start", v, 0);
|
|
489
|
+
} else w = P(ie(e.style), v, b);
|
|
490
|
+
let T = i.left + a.left, E = i.top + a.top, D = 0;
|
|
491
|
+
for (let n = 0; n < c.length; n++) {
|
|
492
|
+
let r = c[n], i = r.node, a = r.margin.top ?? 0, o = r.margin.bottom ?? 0;
|
|
493
|
+
D += S[n] + a, i.localRect = {
|
|
249
494
|
...i.localRect,
|
|
250
|
-
x:
|
|
251
|
-
y:
|
|
252
|
-
},
|
|
495
|
+
x: T + N(i, e.style.alignItems, t, r.margin),
|
|
496
|
+
y: E + w[n] + n * s + D
|
|
497
|
+
}, D += C[n] + o;
|
|
498
|
+
}
|
|
499
|
+
let O = y + l + d, k = f ? Math.max(n, O) : O;
|
|
500
|
+
if (e.style.ruleY && c.length > 1) {
|
|
501
|
+
let n = [], r = c.map((e) => e.node.localRect).slice().sort((e, t) => e.y - t.y);
|
|
502
|
+
for (let e = 1; e < r.length; e++) {
|
|
503
|
+
let i = r[e - 1].y + r[e - 1].height - E, a = r[e].y - E - i;
|
|
504
|
+
a > 0 && n.push({
|
|
505
|
+
bandStart: i,
|
|
506
|
+
bandSize: a,
|
|
507
|
+
start: 0,
|
|
508
|
+
end: t
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
e.decorationRuns = u({
|
|
512
|
+
ruleX: null,
|
|
513
|
+
ruleY: e.style.ruleY,
|
|
514
|
+
vertical: [],
|
|
515
|
+
horizontal: n,
|
|
516
|
+
contentWidth: t,
|
|
517
|
+
contentHeight: k,
|
|
518
|
+
border: i,
|
|
519
|
+
borderStyle: e.style.borderStyle,
|
|
520
|
+
borderColor: e.style.borderColor,
|
|
521
|
+
padding: a
|
|
522
|
+
});
|
|
253
523
|
}
|
|
254
|
-
|
|
255
|
-
return _(e, a, o, t, I), I;
|
|
524
|
+
return A(e, i, a, t, k), k;
|
|
256
525
|
}
|
|
257
|
-
function
|
|
526
|
+
function M(e, t, n, r) {
|
|
258
527
|
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;
|
|
259
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
528
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + L(i, n, e.localRect.height);
|
|
260
529
|
}
|
|
261
|
-
function
|
|
530
|
+
function N(e, t, n, r) {
|
|
262
531
|
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;
|
|
263
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
532
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + L(i, n, e.localRect.width);
|
|
264
533
|
}
|
|
265
|
-
function
|
|
534
|
+
function P(e, t, n) {
|
|
266
535
|
let r = t.length;
|
|
267
536
|
if (r === 0) return [];
|
|
268
537
|
let i = [], a = 0;
|
|
@@ -272,7 +541,7 @@ function x(e, t, n) {
|
|
|
272
541
|
return i;
|
|
273
542
|
}
|
|
274
543
|
if ((e === "space-around" || e === "space-evenly") && n > 0) {
|
|
275
|
-
let o =
|
|
544
|
+
let o = F(Array.from({ length: r + 1 }, (t, n) => e === "space-evenly" || n === 0 || n === r ? 1 : 2), n);
|
|
276
545
|
for (let e = 0; e < r; e++) a += o[e], i.push(a), a += t[e];
|
|
277
546
|
return i;
|
|
278
547
|
}
|
|
@@ -280,8 +549,8 @@ function x(e, t, n) {
|
|
|
280
549
|
for (let e = 0; e < r; e++) i.push(a), a += t[e];
|
|
281
550
|
return i;
|
|
282
551
|
}
|
|
283
|
-
function
|
|
284
|
-
let n = e.length, r = (t, n) => Math.max(0,
|
|
552
|
+
function ee(e, t) {
|
|
553
|
+
let n = e.length, r = (t, n) => Math.max(0, G(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);
|
|
285
554
|
for (let t = 0; t < n; t++) {
|
|
286
555
|
let n = r(i[t], t);
|
|
287
556
|
((a ? e[t].grow : e[t].shrink) === 0 || a && i[t] > n || !a && i[t] < n) && (o[t] = n, s[t] = !0);
|
|
@@ -290,7 +559,7 @@ function S(e, t) {
|
|
|
290
559
|
let c = [];
|
|
291
560
|
for (let e = 0; e < n; e++) s[e] || c.push(e);
|
|
292
561
|
if (c.length === 0) break;
|
|
293
|
-
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 =
|
|
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 = F(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);
|
|
294
563
|
if (g === 0) {
|
|
295
564
|
for (let e = 0; e < c.length; e++) o[c[e]] = h[e];
|
|
296
565
|
break;
|
|
@@ -302,7 +571,7 @@ function S(e, t) {
|
|
|
302
571
|
}
|
|
303
572
|
return o;
|
|
304
573
|
}
|
|
305
|
-
function
|
|
574
|
+
function F(e, t) {
|
|
306
575
|
let n = e.reduce((e, t) => e + t, 0);
|
|
307
576
|
if (n === 0 || t <= 0) return e.map(() => 0);
|
|
308
577
|
let r = e.map((e) => e / n * t), i = r.map(Math.floor), a = t - i.reduce((e, t) => e + t, 0);
|
|
@@ -315,33 +584,33 @@ function C(e, t) {
|
|
|
315
584
|
}
|
|
316
585
|
return i;
|
|
317
586
|
}
|
|
318
|
-
function
|
|
587
|
+
function I(e, t) {
|
|
319
588
|
return e.style.alignSelf === "auto" ? t.style.alignItems : e.style.alignSelf;
|
|
320
589
|
}
|
|
321
|
-
function
|
|
590
|
+
function L(e, t, n) {
|
|
322
591
|
return e === "center" ? Math.max(0, Math.floor((t - n) / 2)) : e === "end" ? Math.max(0, t - n) : 0;
|
|
323
592
|
}
|
|
324
|
-
function
|
|
593
|
+
function te(e, t, n) {
|
|
325
594
|
let r = e.style.flexBasis, i = e.style.width;
|
|
326
|
-
return r !== void 0 && r.kind !== "auto" ?
|
|
595
|
+
return r !== void 0 && r.kind !== "auto" ? X(r, t, e, n) : i !== void 0 && i.kind !== "auto" ? X(i, t, e, n) : Z(e, n);
|
|
327
596
|
}
|
|
328
|
-
function
|
|
329
|
-
let t = e.children.filter((e) => !
|
|
597
|
+
function ne(e) {
|
|
598
|
+
let t = e.children.filter((e) => !U(e.style)).sort((e, t) => e.style.order - t.style.order);
|
|
330
599
|
return e.style.flexReverse && t.reverse(), t;
|
|
331
600
|
}
|
|
332
|
-
function
|
|
601
|
+
function re(e) {
|
|
333
602
|
return e.wrapReverse ? e.alignContent === "start" ? "end" : e.alignContent === "end" ? "start" : e.alignContent : e.alignContent;
|
|
334
603
|
}
|
|
335
|
-
function
|
|
604
|
+
function ie(e) {
|
|
336
605
|
let t = e.justifyContent === "stretch" ? "start" : e.justifyContent;
|
|
337
606
|
return e.flexReverse ? t === "start" ? "end" : t === "end" ? "start" : t : t;
|
|
338
607
|
}
|
|
339
|
-
function
|
|
340
|
-
return e.style.minWidth === "auto" ? e.style.overflow === "visible" ?
|
|
608
|
+
function ae(e, t, n) {
|
|
609
|
+
return e.style.minWidth === "auto" ? e.style.overflow === "visible" ? Q(e, n) : 0 : Y(e.style.minWidth, t) ?? 0;
|
|
341
610
|
}
|
|
342
611
|
//#endregion
|
|
343
612
|
//#region src/types.ts
|
|
344
|
-
function
|
|
613
|
+
function oe() {
|
|
345
614
|
return {
|
|
346
615
|
display: "block",
|
|
347
616
|
flexDirection: "row",
|
|
@@ -360,8 +629,8 @@ function j() {
|
|
|
360
629
|
justifySelf: "auto",
|
|
361
630
|
gridTemplateColumns: { kind: "none" },
|
|
362
631
|
gridTemplateRows: { kind: "none" },
|
|
363
|
-
gridAutoColumns: [
|
|
364
|
-
gridAutoRows: [
|
|
632
|
+
gridAutoColumns: [z()],
|
|
633
|
+
gridAutoRows: [z()],
|
|
365
634
|
gridAutoFlow: {
|
|
366
635
|
direction: "row",
|
|
367
636
|
dense: !1
|
|
@@ -377,7 +646,7 @@ function j() {
|
|
|
377
646
|
minHeight: "auto",
|
|
378
647
|
maxWidth: void 0,
|
|
379
648
|
maxHeight: void 0,
|
|
380
|
-
padding:
|
|
649
|
+
padding: R(),
|
|
381
650
|
margin: {
|
|
382
651
|
top: 0,
|
|
383
652
|
right: 0,
|
|
@@ -393,7 +662,7 @@ function j() {
|
|
|
393
662
|
},
|
|
394
663
|
gapX: 0,
|
|
395
664
|
gapY: 0,
|
|
396
|
-
border:
|
|
665
|
+
border: R(),
|
|
397
666
|
borderStyle: {
|
|
398
667
|
top: "solid",
|
|
399
668
|
right: "solid",
|
|
@@ -408,16 +677,31 @@ function j() {
|
|
|
408
677
|
textOverflow: "clip",
|
|
409
678
|
color: void 0,
|
|
410
679
|
backgroundColor: void 0,
|
|
680
|
+
fontWeight: "400",
|
|
681
|
+
fontStyle: "normal",
|
|
682
|
+
textDecorationLine: "none",
|
|
411
683
|
borderColor: {
|
|
412
684
|
top: void 0,
|
|
413
685
|
right: void 0,
|
|
414
686
|
bottom: void 0,
|
|
415
687
|
left: void 0
|
|
416
688
|
},
|
|
417
|
-
textAlignBlocked: !1
|
|
689
|
+
textAlignBlocked: !1,
|
|
690
|
+
textAlign: "start",
|
|
691
|
+
tableRole: "none",
|
|
692
|
+
tableLayout: "auto",
|
|
693
|
+
borderCollapse: !1,
|
|
694
|
+
borderSpacingX: 0,
|
|
695
|
+
borderSpacingY: 0,
|
|
696
|
+
captionSide: "top",
|
|
697
|
+
verticalAlign: "start",
|
|
698
|
+
zIndex: null,
|
|
699
|
+
latticeBorder: null,
|
|
700
|
+
ruleX: null,
|
|
701
|
+
ruleY: null
|
|
418
702
|
};
|
|
419
703
|
}
|
|
420
|
-
function
|
|
704
|
+
function R() {
|
|
421
705
|
return {
|
|
422
706
|
top: 0,
|
|
423
707
|
right: 0,
|
|
@@ -425,7 +709,7 @@ function M() {
|
|
|
425
709
|
left: 0
|
|
426
710
|
};
|
|
427
711
|
}
|
|
428
|
-
function
|
|
712
|
+
function z() {
|
|
429
713
|
return {
|
|
430
714
|
min: { kind: "auto" },
|
|
431
715
|
max: { kind: "auto" }
|
|
@@ -433,15 +717,15 @@ function N() {
|
|
|
433
717
|
}
|
|
434
718
|
//#endregion
|
|
435
719
|
//#region src/grid.ts
|
|
436
|
-
function
|
|
437
|
-
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows,
|
|
720
|
+
function se(e, t, n, r, i, a) {
|
|
721
|
+
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, d = c ? c.gap : Ct(o, "x", t), f = l ? l.gap : Ct(o, "y", s), p = _e(e, t, s, d, f, e.subgrid ? {
|
|
438
722
|
col: e.subgrid.colSpan,
|
|
439
723
|
row: e.subgrid.rowSpan
|
|
440
|
-
} : void 0), { children:
|
|
441
|
-
for (let e = 0; e <
|
|
442
|
-
let t =
|
|
724
|
+
} : void 0), { children: m, placed: h, colLines: g, rowLines: _, colTracks: v, rowTracks: y, colCollapsed: b, rowCollapsed: x } = p, S = m.map((e) => q(e.style.margin, t)), C = m.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), w = m.map(ce), T = c ? ue(c) : Me(v, b, de(p, w, S, a), t, d, o.justifyContent === "stretch"), E = c ? c.positions : Ne(T, t, o.justifyContent), D = [];
|
|
725
|
+
for (let e = 0; e < m.length; e++) {
|
|
726
|
+
let t = m[e], n = h.items[e], r = Fe(E, T.sizes, n.col.start, n.col.span), i = S[e], o = Math.max(0, r - B(i)), s = w[e];
|
|
443
727
|
if (s.cols || s.rows) {
|
|
444
|
-
let e = s.cols ?
|
|
728
|
+
let e = s.cols ? le(E, T, d, n.col.start, n.col.span, pe(t, "cols", i, r)) : void 0;
|
|
445
729
|
t.subgrid = {
|
|
446
730
|
colSpan: n.col.span,
|
|
447
731
|
rowSpan: n.row.span,
|
|
@@ -449,32 +733,68 @@ function P(e, t, n, r, i, a) {
|
|
|
449
733
|
rows: void 0
|
|
450
734
|
};
|
|
451
735
|
} else t.subgrid = void 0;
|
|
452
|
-
let c =
|
|
453
|
-
s.cols ?
|
|
736
|
+
let c = C[e], l = i.left === null || i.right === null, u = t.style.width !== void 0 && t.style.width.kind !== "auto";
|
|
737
|
+
s.cols ? W(t, r, void 0, 0, 0, "fill", a, { width: o }) : c === "stretch" && !l && !u ? W(t, r, void 0, 0, 0, "fill", a, { width: G(o, t.style.minWidth === "auto" ? t.style.overflow === "visible" ? Q(t, a) : 0 : Y(t.style.minWidth, r) ?? 0, wt(t.style.maxWidth, r, t, a)) }) : W(t, o, void 0, 0, 0, "shrink", a), D.push(t.localRect.width);
|
|
454
738
|
}
|
|
455
|
-
let O = l ?
|
|
456
|
-
for (let t = 0; t <
|
|
457
|
-
let n =
|
|
458
|
-
if (
|
|
739
|
+
let O = l ? ue(l) : Me(y, x, fe(p, w, S), s ?? "max-content", f, o.alignContent === "stretch"), k = Pe(O), A = l ? l.positions : Ne(O, s ?? k, o.alignContent), j = r.left + i.left, M = r.top + i.top;
|
|
740
|
+
for (let t = 0; t < m.length; t++) {
|
|
741
|
+
let n = m[t], r = h.items[t], i = S[t], o = Fe(E, T.sizes, r.col.start, r.col.span), s = Fe(A, O.sizes, r.row.start, r.row.span), c = Math.max(0, s - xe(i)), l = I(n, e), u = i.top === null || i.bottom === null, d = n.style.height !== void 0 && n.style.height.kind !== "auto";
|
|
742
|
+
if (w[t].rows) n.subgrid.rows = le(A, O, f, r.row.start, r.row.span, pe(n, "rows", i, o)), W(n, o, s, 0, 0, "fill", a, {
|
|
459
743
|
width: D[t],
|
|
460
744
|
height: c
|
|
461
745
|
});
|
|
462
|
-
else if (l === "stretch" && !u && !
|
|
463
|
-
let e =
|
|
464
|
-
e !== n.localRect.height &&
|
|
746
|
+
else if (l === "stretch" && !u && !d) {
|
|
747
|
+
let e = G(c, n.style.minHeight === "auto" ? n.style.overflow === "visible" ? n.localRect.height : 0 : Y(n.style.minHeight, s) ?? 0, Y(n.style.maxHeight, s));
|
|
748
|
+
e !== n.localRect.height && W(n, o, s, 0, 0, "fill", a, {
|
|
465
749
|
width: D[t],
|
|
466
750
|
height: e
|
|
467
751
|
});
|
|
468
|
-
} else n.style.height?.kind === "percent" &&
|
|
752
|
+
} else n.style.height?.kind === "percent" && W(n, o, s, 0, 0, "fill", a, { width: D[t] });
|
|
469
753
|
n.localRect = {
|
|
470
754
|
...n.localRect,
|
|
471
|
-
x: j + E[r.col.start] +
|
|
472
|
-
y: M + A[r.row.start] +
|
|
755
|
+
x: j + E[r.col.start] + Ie(C[t], i.left, i.right, o, n.localRect.width),
|
|
756
|
+
y: M + A[r.row.start] + Ie(l, i.top, i.bottom, s, n.localRect.height)
|
|
473
757
|
};
|
|
474
758
|
}
|
|
475
|
-
let N = Number.isFinite(n) ? Math.max(n, k) : k
|
|
759
|
+
let N = Number.isFinite(n) ? Math.max(n, k) : k;
|
|
760
|
+
if (o.ruleX || o.ruleY) {
|
|
761
|
+
let n = (e, t) => {
|
|
762
|
+
let n = [];
|
|
763
|
+
for (let r = 1; r < e.length; r++) {
|
|
764
|
+
let i = e[r - 1] + t[r - 1], a = e[r] - i;
|
|
765
|
+
a > 0 && n.push({
|
|
766
|
+
bandStart: i,
|
|
767
|
+
bandSize: a,
|
|
768
|
+
start: 0,
|
|
769
|
+
end: 0
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
return n;
|
|
773
|
+
}, a = (e, t) => e.length === 0 ? [0, 0] : [e[0], e[e.length - 1] + t[t.length - 1]], [s, c] = a(A, O.sizes), [l, d] = a(E, T.sizes), f = n(E, T.sizes).map((e) => ({
|
|
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
|
+
}));
|
|
782
|
+
e.decorationRuns = u({
|
|
783
|
+
ruleX: o.ruleX,
|
|
784
|
+
ruleY: o.ruleY,
|
|
785
|
+
vertical: f,
|
|
786
|
+
horizontal: p,
|
|
787
|
+
contentWidth: t,
|
|
788
|
+
contentHeight: N,
|
|
789
|
+
border: r,
|
|
790
|
+
borderStyle: o.borderStyle,
|
|
791
|
+
borderColor: o.borderColor,
|
|
792
|
+
padding: i
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
let P = e.children.filter((e) => U(e.style));
|
|
476
796
|
if (P.length > 0) {
|
|
477
|
-
let e =
|
|
797
|
+
let e = U(o) ? {
|
|
478
798
|
x: r.left,
|
|
479
799
|
y: r.top,
|
|
480
800
|
width: i.left + t + i.right,
|
|
@@ -486,7 +806,7 @@ function P(e, t, n, r, i, a) {
|
|
|
486
806
|
height: N
|
|
487
807
|
};
|
|
488
808
|
for (let n of P) {
|
|
489
|
-
let r =
|
|
809
|
+
let r = he(n.style.gridColumnStart, n.style.gridColumnEnd, g, h.colOrigin, E, T.sizes, -i.left, t + i.right), a = he(n.style.gridRowStart, n.style.gridRowEnd, _, h.rowOrigin, A, O.sizes, -i.top, N + i.bottom);
|
|
490
810
|
n.staticSlot = {
|
|
491
811
|
kind: "grid",
|
|
492
812
|
area: {
|
|
@@ -501,14 +821,14 @@ function P(e, t, n, r, i, a) {
|
|
|
501
821
|
}
|
|
502
822
|
return N;
|
|
503
823
|
}
|
|
504
|
-
function
|
|
824
|
+
function ce(e) {
|
|
505
825
|
let t = e.style.display === "grid";
|
|
506
826
|
return {
|
|
507
827
|
cols: t && e.style.gridTemplateColumns.kind === "subgrid",
|
|
508
828
|
rows: t && e.style.gridTemplateRows.kind === "subgrid"
|
|
509
829
|
};
|
|
510
830
|
}
|
|
511
|
-
function
|
|
831
|
+
function le(e, t, n, r, i, a) {
|
|
512
832
|
let o = e[r] + a.start, s = t.sizes.slice(r, r + i);
|
|
513
833
|
return s[0] = Math.max(0, s[0] - a.start), s[i - 1] = Math.max(0, s[i - 1] - a.end), {
|
|
514
834
|
positions: Array.from({ length: i }, (t, n) => n === 0 ? 0 : e[r + n] - o),
|
|
@@ -517,20 +837,20 @@ function I(e, t, n, r, i, a) {
|
|
|
517
837
|
gap: n
|
|
518
838
|
};
|
|
519
839
|
}
|
|
520
|
-
function
|
|
840
|
+
function ue(e) {
|
|
521
841
|
return {
|
|
522
842
|
sizes: e.sizes,
|
|
523
843
|
gapBefore: e.gapBefore,
|
|
524
844
|
limits: e.sizes
|
|
525
845
|
};
|
|
526
846
|
}
|
|
527
|
-
function
|
|
847
|
+
function de(e, t, n, r) {
|
|
528
848
|
let i = [];
|
|
529
849
|
return e.children.forEach((a, o) => {
|
|
530
850
|
let s = e.placed.items[o], c = n[o];
|
|
531
851
|
if (t[o].cols) {
|
|
532
|
-
let e =
|
|
533
|
-
for (let t of
|
|
852
|
+
let e = pe(a, "cols", c, 0);
|
|
853
|
+
for (let t of me(a, "cols", s, e, r)) i.push({
|
|
534
854
|
...t,
|
|
535
855
|
start: t.start + s.col.start
|
|
536
856
|
});
|
|
@@ -539,24 +859,24 @@ function te(e, t, n, r) {
|
|
|
539
859
|
i.push({
|
|
540
860
|
start: s.col.start,
|
|
541
861
|
span: s.col.span,
|
|
542
|
-
min:
|
|
543
|
-
max:
|
|
862
|
+
min: Se(a, "min", r) + B(c),
|
|
863
|
+
max: Se(a, "max", r) + B(c)
|
|
544
864
|
});
|
|
545
865
|
}), i;
|
|
546
866
|
}
|
|
547
|
-
function
|
|
867
|
+
function fe(e, t, n) {
|
|
548
868
|
let r = [];
|
|
549
869
|
return e.children.forEach((i, a) => {
|
|
550
870
|
let o = e.placed.items[a], s = n[a];
|
|
551
871
|
if (t[a].rows) {
|
|
552
|
-
let e =
|
|
553
|
-
for (let t of
|
|
872
|
+
let e = pe(i, "rows", s, 0);
|
|
873
|
+
for (let t of me(i, "rows", o, e)) r.push({
|
|
554
874
|
...t,
|
|
555
875
|
start: t.start + o.row.start
|
|
556
876
|
});
|
|
557
877
|
return;
|
|
558
878
|
}
|
|
559
|
-
let c = i.localRect.height +
|
|
879
|
+
let c = i.localRect.height + xe(s);
|
|
560
880
|
r.push({
|
|
561
881
|
start: o.row.start,
|
|
562
882
|
span: o.row.span,
|
|
@@ -565,25 +885,25 @@ function ne(e, t, n) {
|
|
|
565
885
|
});
|
|
566
886
|
}), r;
|
|
567
887
|
}
|
|
568
|
-
function
|
|
888
|
+
function pe(e, t, n, r) {
|
|
569
889
|
let { border: i, padding: a } = e.style;
|
|
570
890
|
return t === "cols" ? {
|
|
571
|
-
start: (n.left ?? 0) + i.left +
|
|
572
|
-
end: (n.right ?? 0) + i.right +
|
|
891
|
+
start: (n.left ?? 0) + i.left + K(a.left, r),
|
|
892
|
+
end: (n.right ?? 0) + i.right + K(a.right, r)
|
|
573
893
|
} : {
|
|
574
|
-
start: (n.top ?? 0) + i.top +
|
|
575
|
-
end: (n.bottom ?? 0) + i.bottom +
|
|
894
|
+
start: (n.top ?? 0) + i.top + K(a.top, r),
|
|
895
|
+
end: (n.bottom ?? 0) + i.bottom + K(a.bottom, r)
|
|
576
896
|
};
|
|
577
897
|
}
|
|
578
|
-
function
|
|
579
|
-
let a = t === "cols" ? n.col.span : n.row.span, o =
|
|
898
|
+
function me(e, t, n, r, i) {
|
|
899
|
+
let a = t === "cols" ? n.col.span : n.row.span, o = _e(e, void 0, void 0, 0, 0, {
|
|
580
900
|
col: n.col.span,
|
|
581
901
|
row: n.row.span
|
|
582
902
|
}), s = [];
|
|
583
903
|
if (o.children.forEach((e, n) => {
|
|
584
|
-
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 =
|
|
585
|
-
if (
|
|
586
|
-
let 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 = q(e.style.margin, 0);
|
|
905
|
+
if (ce(e)[t]) {
|
|
906
|
+
let n = pe(e, t, p, 0), a = me(e, t, c, {
|
|
587
907
|
start: n.start + (u ? r.start : 0),
|
|
588
908
|
end: n.end + (d ? r.end : 0)
|
|
589
909
|
}, i);
|
|
@@ -596,11 +916,11 @@ function re(e, t, n, r, i) {
|
|
|
596
916
|
if (t === "cols") s.push({
|
|
597
917
|
start: l.start,
|
|
598
918
|
span: l.span,
|
|
599
|
-
min:
|
|
600
|
-
max:
|
|
919
|
+
min: Se(e, "min", i) + B(p) + f,
|
|
920
|
+
max: Se(e, "max", i) + B(p) + f
|
|
601
921
|
});
|
|
602
922
|
else {
|
|
603
|
-
let t = e.localRect.height +
|
|
923
|
+
let t = e.localRect.height + xe(p) + f;
|
|
604
924
|
s.push({
|
|
605
925
|
start: l.start,
|
|
606
926
|
span: l.span,
|
|
@@ -619,9 +939,9 @@ function re(e, t, n, r, i) {
|
|
|
619
939
|
}
|
|
620
940
|
return s;
|
|
621
941
|
}
|
|
622
|
-
function
|
|
623
|
-
let c =
|
|
624
|
-
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l =
|
|
942
|
+
function he(e, t, n, r, i, a, o, s) {
|
|
943
|
+
let c = Oe(e, "start", n), l = Oe(t, "end", n);
|
|
944
|
+
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l = ke(c, t, 1, n) : l !== null && e.kind === "span" && (c = ke(l, e, -1, n));
|
|
625
945
|
let u = i.length, d = (e) => {
|
|
626
946
|
if (e === null) return;
|
|
627
947
|
let t = e - r;
|
|
@@ -632,22 +952,22 @@ function ie(e, t, n, r, i, a, o, s) {
|
|
|
632
952
|
end: h === void 0 ? s : p(h)
|
|
633
953
|
};
|
|
634
954
|
}
|
|
635
|
-
function
|
|
955
|
+
function ge(e, t) {
|
|
636
956
|
let n = t.gridIntrinsic.get(e);
|
|
637
957
|
if (n !== void 0) return n;
|
|
638
|
-
let r = e.style, i = typeof r.gapX == "number" ? r.gapX : 0, a =
|
|
958
|
+
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a = _e(e, void 0, void 0, i, 0, e.subgrid ? {
|
|
639
959
|
col: e.subgrid.colSpan,
|
|
640
960
|
row: e.subgrid.rowSpan
|
|
641
|
-
} : void 0), o = a.children.map(
|
|
961
|
+
} : void 0), o = a.children.map(ce), s = a.children.map((e) => q(e.style.margin, 0)), c = Me(a.colTracks, a.colCollapsed, de(a, o, s, t), "min-content", i, !1), l = c.gapBefore.reduce((e, t) => e + t, 0), u = {
|
|
642
962
|
min: c.sizes.reduce((e, t) => e + t, 0) + l,
|
|
643
963
|
max: c.limits.reduce((e, t) => e + t, 0) + l
|
|
644
964
|
};
|
|
645
965
|
return t.gridIntrinsic.set(e, u), u;
|
|
646
966
|
}
|
|
647
|
-
function
|
|
648
|
-
let o = e.style, s =
|
|
967
|
+
function _e(e, t, n, r, i, a) {
|
|
968
|
+
let o = e.style, s = be(e), c = o.gridTemplateColumns.kind === "subgrid" && a !== void 0, l = o.gridTemplateRows.kind === "subgrid" && a !== void 0, u = c ? ve(a.col) : Ce(o.gridTemplateColumns, t, r), d = l ? ve(a.row) : Ce(o.gridTemplateRows, n, i), f = o.gridTemplateAreas, p = [...u.tracks], m = [...d.tracks];
|
|
649
969
|
if (f) {
|
|
650
|
-
c ||
|
|
970
|
+
c || Te(p, u.lineNames, f.columns, o.gridAutoColumns), l || Te(m, d.lineNames, f.rows, o.gridAutoRows);
|
|
651
971
|
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`);
|
|
652
972
|
}
|
|
653
973
|
let h = {
|
|
@@ -656,28 +976,28 @@ function oe(e, t, n, r, i, a) {
|
|
|
656
976
|
}, g = {
|
|
657
977
|
explicitCount: m.length,
|
|
658
978
|
names: d.lineNames
|
|
659
|
-
}, _ =
|
|
660
|
-
col:
|
|
661
|
-
row:
|
|
979
|
+
}, _ = je(s.map((e) => ({
|
|
980
|
+
col: Ae(e.style.gridColumnStart, e.style.gridColumnEnd, h),
|
|
981
|
+
row: Ae(e.style.gridRowStart, e.style.gridRowEnd, g)
|
|
662
982
|
})), p.length, m.length, o.gridAutoFlow);
|
|
663
|
-
return c &&
|
|
983
|
+
return c && ye(_, "col", p.length), l && ye(_, "row", m.length), {
|
|
664
984
|
children: s,
|
|
665
985
|
placed: _,
|
|
666
986
|
colLines: h,
|
|
667
987
|
rowLines: g,
|
|
668
|
-
colTracks:
|
|
669
|
-
rowTracks:
|
|
670
|
-
colCollapsed:
|
|
671
|
-
rowCollapsed:
|
|
988
|
+
colTracks: Ee(p, _.colOrigin, _.colCount, o.gridAutoColumns),
|
|
989
|
+
rowTracks: Ee(m, _.rowOrigin, _.rowCount, o.gridAutoRows),
|
|
990
|
+
colCollapsed: De(u, _.colOrigin, _.colCount, _.items.map((e) => e.col)),
|
|
991
|
+
rowCollapsed: De(d, _.rowOrigin, _.rowCount, _.items.map((e) => e.row))
|
|
672
992
|
};
|
|
673
993
|
}
|
|
674
|
-
function
|
|
994
|
+
function ve(e) {
|
|
675
995
|
return {
|
|
676
|
-
tracks: Array.from({ length: e }, () =>
|
|
996
|
+
tracks: Array.from({ length: e }, () => z()),
|
|
677
997
|
lineNames: Array.from({ length: e + 1 }, () => [])
|
|
678
998
|
};
|
|
679
999
|
}
|
|
680
|
-
function
|
|
1000
|
+
function ye(e, t, n) {
|
|
681
1001
|
let r = t === "col" ? e.colOrigin : e.rowOrigin;
|
|
682
1002
|
for (let i of e.items) {
|
|
683
1003
|
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);
|
|
@@ -685,22 +1005,22 @@ function ce(e, t, n) {
|
|
|
685
1005
|
}
|
|
686
1006
|
t === "col" ? (e.colOrigin = 0, e.colCount = n) : (e.rowOrigin = 0, e.rowCount = n);
|
|
687
1007
|
}
|
|
688
|
-
function
|
|
689
|
-
return e.children.filter((e) => !
|
|
1008
|
+
function be(e) {
|
|
1009
|
+
return e.children.filter((e) => !U(e.style) && !e.inlineBox).sort((e, t) => e.style.order - t.style.order);
|
|
690
1010
|
}
|
|
691
|
-
function
|
|
1011
|
+
function B(e) {
|
|
692
1012
|
return (e.left ?? 0) + (e.right ?? 0);
|
|
693
1013
|
}
|
|
694
|
-
function
|
|
1014
|
+
function xe(e) {
|
|
695
1015
|
return (e.top ?? 0) + (e.bottom ?? 0);
|
|
696
1016
|
}
|
|
697
|
-
function
|
|
1017
|
+
function Se(e, t, n) {
|
|
698
1018
|
let r = e.style, i;
|
|
699
|
-
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i =
|
|
1019
|
+
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = X(r.width, 0, e, n)), i === void 0 && (i = t === "min" ? Q(e, n) : Z(e, n));
|
|
700
1020
|
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
701
|
-
return Math.max(0,
|
|
1021
|
+
return Math.max(0, G(i, a, o));
|
|
702
1022
|
}
|
|
703
|
-
function
|
|
1023
|
+
function Ce(e, t, n) {
|
|
704
1024
|
if (e.kind !== "tracks") return {
|
|
705
1025
|
tracks: [],
|
|
706
1026
|
lineNames: [[]]
|
|
@@ -713,7 +1033,7 @@ function de(e, t, n) {
|
|
|
713
1033
|
let { index: i, tracks: a, mode: o } = e.autoRepeat, s = 1;
|
|
714
1034
|
if (t !== void 0) {
|
|
715
1035
|
let e = a.reduce((e, n) => {
|
|
716
|
-
let r =
|
|
1036
|
+
let r = we(n.min, t) ?? we(n.max, t) ?? 1;
|
|
717
1037
|
return e + Math.max(1, r);
|
|
718
1038
|
}, 0);
|
|
719
1039
|
s = Math.max(1, Math.floor((t + n) / (e + n * a.length)));
|
|
@@ -741,23 +1061,23 @@ function de(e, t, n) {
|
|
|
741
1061
|
lineNames: d
|
|
742
1062
|
};
|
|
743
1063
|
}
|
|
744
|
-
function
|
|
1064
|
+
function we(e, t) {
|
|
745
1065
|
if (e.kind === "cells") return e.value;
|
|
746
|
-
if (e.kind === "percent" && t !== void 0) return
|
|
1066
|
+
if (e.kind === "percent" && t !== void 0) return m(e.value, t);
|
|
747
1067
|
if (e.kind === "math") {
|
|
748
1068
|
let n = [];
|
|
749
1069
|
for (let r of e.args) {
|
|
750
|
-
let e =
|
|
1070
|
+
let e = we(r, t);
|
|
751
1071
|
if (e === void 0) return;
|
|
752
1072
|
n.push(e);
|
|
753
1073
|
}
|
|
754
1074
|
return e.fn === "min" ? Math.min(...n) : Math.max(...n);
|
|
755
1075
|
}
|
|
756
1076
|
}
|
|
757
|
-
function
|
|
1077
|
+
function Te(e, t, n, r) {
|
|
758
1078
|
for (let i = e.length; i < n; i++) e.push(r[(i - e.length) % r.length]), t.push([]);
|
|
759
1079
|
}
|
|
760
|
-
function
|
|
1080
|
+
function Ee(e, t, n, r) {
|
|
761
1081
|
let i = [];
|
|
762
1082
|
for (let a = 0; a < n; a++) {
|
|
763
1083
|
let n = a + t;
|
|
@@ -769,7 +1089,7 @@ function pe(e, t, n, r) {
|
|
|
769
1089
|
}
|
|
770
1090
|
return i;
|
|
771
1091
|
}
|
|
772
|
-
function
|
|
1092
|
+
function De(e, t, n, r) {
|
|
773
1093
|
let i = Array.from({ length: n }, () => !1);
|
|
774
1094
|
if (!e.autoFit) return i;
|
|
775
1095
|
for (let a = e.autoFit.start; a < e.autoFit.end; a++) {
|
|
@@ -778,7 +1098,7 @@ function me(e, t, n, r) {
|
|
|
778
1098
|
}
|
|
779
1099
|
return i;
|
|
780
1100
|
}
|
|
781
|
-
function
|
|
1101
|
+
function Oe(e, t, n) {
|
|
782
1102
|
if (e.kind === "line") return e.value > 0 ? e.value - 1 : n.explicitCount + 1 + e.value;
|
|
783
1103
|
if (e.kind !== "name") return null;
|
|
784
1104
|
if (e.nth === void 0) {
|
|
@@ -793,14 +1113,14 @@ function he(e, t, n) {
|
|
|
793
1113
|
for (let t = i; t >= 0; t--) if (n.names[t].includes(e.name) && ++a === -r) return t;
|
|
794
1114
|
return -(-r - a);
|
|
795
1115
|
}
|
|
796
|
-
function
|
|
1116
|
+
function ke(e, t, n, r) {
|
|
797
1117
|
if (t.name === void 0) return e + n * t.value;
|
|
798
1118
|
let i = t.value, a = e;
|
|
799
1119
|
for (; i > 0;) a += n, (!(a >= 0 && a <= r.explicitCount) || r.names[a].includes(t.name)) && i--;
|
|
800
1120
|
return a;
|
|
801
1121
|
}
|
|
802
|
-
function
|
|
803
|
-
let r =
|
|
1122
|
+
function Ae(e, t, n) {
|
|
1123
|
+
let r = Oe(e, "start", n), i = Oe(t, "end", n);
|
|
804
1124
|
if (r !== null && i !== null) return r === i ? {
|
|
805
1125
|
start: r,
|
|
806
1126
|
span: 1
|
|
@@ -810,10 +1130,10 @@ function _e(e, t, n) {
|
|
|
810
1130
|
};
|
|
811
1131
|
if (r !== null) return {
|
|
812
1132
|
start: r,
|
|
813
|
-
span: (t.kind === "span" ?
|
|
1133
|
+
span: (t.kind === "span" ? ke(r, t, 1, n) : r + 1) - r
|
|
814
1134
|
};
|
|
815
1135
|
if (i !== null) {
|
|
816
|
-
let t = e.kind === "span" ?
|
|
1136
|
+
let t = e.kind === "span" ? ke(i, e, -1, n) : i - 1;
|
|
817
1137
|
return {
|
|
818
1138
|
start: t,
|
|
819
1139
|
span: i - t
|
|
@@ -824,7 +1144,7 @@ function _e(e, t, n) {
|
|
|
824
1144
|
span: e.kind === "span" ? e.value : t.kind === "span" ? t.value : 1
|
|
825
1145
|
};
|
|
826
1146
|
}
|
|
827
|
-
function
|
|
1147
|
+
function je(e, t, n, r) {
|
|
828
1148
|
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);
|
|
829
1149
|
for (let t = 0; t < e.length; t++) {
|
|
830
1150
|
let e = o[t];
|
|
@@ -921,9 +1241,9 @@ function ve(e, t, n, r) {
|
|
|
921
1241
|
rowCount: S
|
|
922
1242
|
};
|
|
923
1243
|
}
|
|
924
|
-
function
|
|
925
|
-
let
|
|
926
|
-
if (n
|
|
1244
|
+
function Me(e, t, n, r, i, a) {
|
|
1245
|
+
let o = typeof r == "number" ? r : void 0, s = e.map((e, n) => {
|
|
1246
|
+
if (t[n]) return {
|
|
927
1247
|
base: 0,
|
|
928
1248
|
limit: 0,
|
|
929
1249
|
baseIntrinsic: !1,
|
|
@@ -931,21 +1251,21 @@ function ye(t, n, r, i, a, o) {
|
|
|
931
1251
|
frFactor: 0,
|
|
932
1252
|
collapsed: !0
|
|
933
1253
|
};
|
|
934
|
-
let r =
|
|
935
|
-
if (
|
|
1254
|
+
let r = we(e.min, o), i = r ?? 0, a = r === void 0, s = e.max;
|
|
1255
|
+
if (s.kind === "fr") return {
|
|
936
1256
|
base: i,
|
|
937
1257
|
limit: null,
|
|
938
1258
|
baseIntrinsic: a,
|
|
939
1259
|
limitKind: "fr",
|
|
940
|
-
frFactor:
|
|
1260
|
+
frFactor: s.value,
|
|
941
1261
|
collapsed: !1
|
|
942
1262
|
};
|
|
943
|
-
let c =
|
|
1263
|
+
let c = we(s, o);
|
|
944
1264
|
return c === void 0 ? {
|
|
945
1265
|
base: i,
|
|
946
1266
|
limit: null,
|
|
947
1267
|
baseIntrinsic: a,
|
|
948
|
-
limitKind:
|
|
1268
|
+
limitKind: s.kind === "min-content" ? "intrinsic-min" : "intrinsic-max",
|
|
949
1269
|
frFactor: 0,
|
|
950
1270
|
collapsed: !1
|
|
951
1271
|
} : {
|
|
@@ -956,25 +1276,25 @@ function ye(t, n, r, i, a, o) {
|
|
|
956
1276
|
frFactor: 0,
|
|
957
1277
|
collapsed: !1
|
|
958
1278
|
};
|
|
959
|
-
}),
|
|
1279
|
+
}), c = s.map((e, t) => t === 0 || e.collapsed ? 0 : s.slice(0, t).some((e) => !e.collapsed) ? i : 0), l = (e, t) => {
|
|
960
1280
|
let n = 0;
|
|
961
|
-
for (let r = e + 1; r < e + t; r++) n +=
|
|
1281
|
+
for (let r = e + 1; r < e + t; r++) n += c[r];
|
|
962
1282
|
return n;
|
|
963
|
-
},
|
|
964
|
-
for (let e of
|
|
1283
|
+
}, u = (e) => e.collapsed ? 0 : e.limitKind === "fixed" ? e.limit : Math.max(e.base, e.limit ?? e.base), d = [...n].sort((e, t) => e.span - t.span);
|
|
1284
|
+
for (let e of d) {
|
|
965
1285
|
let t = [], n = !1;
|
|
966
1286
|
for (let r = e.start; r < e.start + e.span; r++) {
|
|
967
|
-
let e =
|
|
1287
|
+
let e = s[r];
|
|
968
1288
|
e !== void 0 && (e.limitKind === "fr" && (n = !0), t.push(e));
|
|
969
1289
|
}
|
|
970
1290
|
if (t.length === 0) continue;
|
|
971
|
-
let r =
|
|
1291
|
+
let r = l(e.start, e.span);
|
|
972
1292
|
if (n) {
|
|
973
1293
|
let n = t.filter((e) => e.limitKind === "fr" && e.baseIntrinsic && !e.collapsed);
|
|
974
1294
|
if (n.length === 0) continue;
|
|
975
1295
|
let i = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - i;
|
|
976
1296
|
if (a > 0) {
|
|
977
|
-
let e = n.reduce((e, t) => e + t.frFactor, 0), t =
|
|
1297
|
+
let e = n.reduce((e, t) => e + t.frFactor, 0), t = F(n.map((t) => e > 0 ? t.frFactor : 1), a);
|
|
978
1298
|
n.forEach((e, n) => {
|
|
979
1299
|
e.base += t[n];
|
|
980
1300
|
});
|
|
@@ -985,7 +1305,7 @@ function ye(t, n, r, i, a, o) {
|
|
|
985
1305
|
if (i.length > 0) {
|
|
986
1306
|
let n = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - n;
|
|
987
1307
|
if (a > 0) {
|
|
988
|
-
let e =
|
|
1308
|
+
let e = F(i.map(() => 1), a);
|
|
989
1309
|
i.forEach((t, n) => {
|
|
990
1310
|
t.base += e[n];
|
|
991
1311
|
});
|
|
@@ -994,51 +1314,51 @@ function ye(t, n, r, i, a, o) {
|
|
|
994
1314
|
for (let [n, i] of [["intrinsic-min", e.min], ["intrinsic-max", e.max]]) {
|
|
995
1315
|
let e = t.filter((e) => e.limitKind === n && !e.collapsed);
|
|
996
1316
|
if (e.length === 0) continue;
|
|
997
|
-
let a = i - (t.reduce((e, t) => e +
|
|
1317
|
+
let a = i - (t.reduce((e, t) => e + u(t), 0) + r);
|
|
998
1318
|
if (a > 0) {
|
|
999
|
-
let t =
|
|
1319
|
+
let t = F(e.map(() => 1), a);
|
|
1000
1320
|
e.forEach((e, n) => {
|
|
1001
|
-
e.limit =
|
|
1321
|
+
e.limit = u(e) + t[n];
|
|
1002
1322
|
});
|
|
1003
1323
|
}
|
|
1004
1324
|
}
|
|
1005
1325
|
}
|
|
1006
|
-
for (let e of
|
|
1007
|
-
if (
|
|
1008
|
-
let
|
|
1009
|
-
if (
|
|
1010
|
-
let
|
|
1011
|
-
for (let
|
|
1012
|
-
for (let e of
|
|
1013
|
-
let
|
|
1014
|
-
for (let
|
|
1015
|
-
let e =
|
|
1016
|
-
e === void 0 || e.collapsed || (e.limitKind === "fr" ?
|
|
1326
|
+
for (let e of s) e.collapsed || (e.limitKind === "fixed" ? e.base = Math.min(e.base, e.limit) : e.limitKind !== "fr" && (e.limit = Math.max(e.base, e.limit ?? e.base)));
|
|
1327
|
+
if (o === void 0) {
|
|
1328
|
+
let e = s.filter((e) => e.limitKind === "fr" && !e.collapsed);
|
|
1329
|
+
if (e.length > 0) {
|
|
1330
|
+
let t = 0;
|
|
1331
|
+
for (let n of e) n.frFactor > 0 && (t = Math.max(t, n.base / n.frFactor));
|
|
1332
|
+
for (let e of n) {
|
|
1333
|
+
let n = 0, r = l(e.start, e.span);
|
|
1334
|
+
for (let t = e.start; t < e.start + e.span; t++) {
|
|
1335
|
+
let e = s[t];
|
|
1336
|
+
e === void 0 || e.collapsed || (e.limitKind === "fr" ? n += e.frFactor : r += u(e));
|
|
1017
1337
|
}
|
|
1018
|
-
|
|
1338
|
+
n <= 0 || (t = Math.max(t, (e.max - r) / Math.max(n, 1)));
|
|
1019
1339
|
}
|
|
1020
|
-
for (let
|
|
1021
|
-
let
|
|
1022
|
-
|
|
1340
|
+
for (let n of e) {
|
|
1341
|
+
let e = Math.max(n.base, f(n.frFactor * t));
|
|
1342
|
+
n.limit = e, r === "max-content" && (n.base = e);
|
|
1023
1343
|
}
|
|
1024
1344
|
}
|
|
1025
|
-
if (
|
|
1345
|
+
if (r === "max-content") for (let e of s) !e.collapsed && e.limitKind !== "fr" && (e.base = u(e));
|
|
1026
1346
|
} else {
|
|
1027
|
-
let e =
|
|
1347
|
+
let e = c.reduce((e, t) => e + t, 0), t = o - e - s.reduce((e, t) => e + t.base, 0);
|
|
1028
1348
|
for (; !(t <= 0);) {
|
|
1029
|
-
let e =
|
|
1349
|
+
let e = s.filter((e) => !e.collapsed && e.limitKind !== "fr" && e.base < u(e));
|
|
1030
1350
|
if (e.length === 0) break;
|
|
1031
|
-
let n =
|
|
1351
|
+
let n = F(e.map(() => 1), t), r = 0;
|
|
1032
1352
|
if (e.forEach((e, t) => {
|
|
1033
|
-
let i = Math.min(n[t],
|
|
1353
|
+
let i = Math.min(n[t], u(e) - e.base);
|
|
1034
1354
|
e.base += i, r += i;
|
|
1035
1355
|
}), t -= r, r === 0) break;
|
|
1036
1356
|
}
|
|
1037
|
-
let n =
|
|
1357
|
+
let n = s.filter((e) => e.limitKind === "fr");
|
|
1038
1358
|
if (n.length > 0) {
|
|
1039
|
-
let t = Math.max(0,
|
|
1359
|
+
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);
|
|
1040
1360
|
for (a < 1 && (i = Math.floor(i * a));;) {
|
|
1041
|
-
let e =
|
|
1361
|
+
let e = F(r.map((e) => e.frFactor), i), t = r.filter((t, n) => e[n] < t.base);
|
|
1042
1362
|
if (t.length === 0) {
|
|
1043
1363
|
r.forEach((t, n) => {
|
|
1044
1364
|
t.base = Math.max(t.base, e[n]);
|
|
@@ -1049,10 +1369,10 @@ function ye(t, n, r, i, a, o) {
|
|
|
1049
1369
|
if (i = Math.max(0, i), r = r.filter((e) => !t.includes(e)), r.length === 0) break;
|
|
1050
1370
|
}
|
|
1051
1371
|
}
|
|
1052
|
-
if (
|
|
1053
|
-
let t =
|
|
1372
|
+
if (a) {
|
|
1373
|
+
let t = o - e - s.reduce((e, t) => e + t.base, 0), n = s.filter((e) => !e.collapsed && e.limitKind === "intrinsic-max");
|
|
1054
1374
|
if (t > 0 && n.length > 0) {
|
|
1055
|
-
let e =
|
|
1375
|
+
let e = F(n.map(() => 1), t);
|
|
1056
1376
|
n.forEach((t, n) => {
|
|
1057
1377
|
t.base += e[n];
|
|
1058
1378
|
});
|
|
@@ -1060,53 +1380,574 @@ function ye(t, n, r, i, a, o) {
|
|
|
1060
1380
|
}
|
|
1061
1381
|
}
|
|
1062
1382
|
return {
|
|
1063
|
-
sizes:
|
|
1064
|
-
gapBefore:
|
|
1065
|
-
limits:
|
|
1383
|
+
sizes: s.map((e) => e.base),
|
|
1384
|
+
gapBefore: c,
|
|
1385
|
+
limits: s.map((e) => u(e))
|
|
1066
1386
|
};
|
|
1067
1387
|
}
|
|
1068
|
-
function
|
|
1069
|
-
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t -
|
|
1388
|
+
function Ne(e, t, n) {
|
|
1389
|
+
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t - Pe(e)), o = P(n === "stretch" ? "start" : n, r, a), s = [], c = 0;
|
|
1070
1390
|
for (let e = 0; e < r.length; e++) c += i[e], s.push(o[e] + c);
|
|
1071
1391
|
return s;
|
|
1072
1392
|
}
|
|
1073
|
-
function
|
|
1393
|
+
function Pe(e) {
|
|
1074
1394
|
return e.sizes.reduce((e, t) => e + t, 0) + e.gapBefore.reduce((e, t) => e + t, 0);
|
|
1075
1395
|
}
|
|
1076
|
-
function
|
|
1396
|
+
function Fe(e, t, n, r) {
|
|
1077
1397
|
let i = n + r - 1;
|
|
1078
1398
|
return e[n] === void 0 || e[i] === void 0 ? 0 : e[i] + t[i] - e[n];
|
|
1079
1399
|
}
|
|
1080
|
-
function
|
|
1400
|
+
function Ie(e, t, n, r, i) {
|
|
1081
1401
|
let a = t ?? 0, o = n ?? 0, s = r - i;
|
|
1082
|
-
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a +
|
|
1402
|
+
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a + L(e, r, i + a + o);
|
|
1403
|
+
}
|
|
1404
|
+
//#endregion
|
|
1405
|
+
//#region src/warn.ts
|
|
1406
|
+
var Le = /* @__PURE__ */ new WeakMap();
|
|
1407
|
+
function V(e, t) {
|
|
1408
|
+
let n = Le.get(e);
|
|
1409
|
+
n || Le.set(e, n = /* @__PURE__ */ new Set()), !n.has(t) && (n.add(t), console.warn(`[monowind] ${t}`, e));
|
|
1410
|
+
}
|
|
1411
|
+
//#endregion
|
|
1412
|
+
//#region src/table.ts
|
|
1413
|
+
function H(e, t) {
|
|
1414
|
+
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" && V(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
|
+
}
|
|
1416
|
+
function Re(e, t) {
|
|
1417
|
+
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
1418
|
+
return Number.isNaN(n) ? 1 : t === "colspan" ? Math.min(1e3, Math.max(1, n)) : Math.min(65534, Math.max(0, n));
|
|
1419
|
+
}
|
|
1420
|
+
function ze(e, t, n) {
|
|
1421
|
+
let r = (t, r) => {
|
|
1422
|
+
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ? X(i, 0, t, n) : void 0, o = i && i.kind === "percent" ? i.value : void 0;
|
|
1423
|
+
for (let t = 0; t < r; t++) e.colFixed.push(a), e.colPercent.push(o);
|
|
1424
|
+
};
|
|
1425
|
+
if (t.style.tableRole === "column") {
|
|
1426
|
+
r(t, Be(t.source));
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
let i = t.children.filter((e) => e.style.tableRole === "column");
|
|
1430
|
+
if (i.length === 0) r(t, Be(t.source));
|
|
1431
|
+
else for (let e of i) r(e, Be(e.source));
|
|
1432
|
+
for (let n of t.children) n.style.tableRole !== "column" && H(e, n);
|
|
1433
|
+
}
|
|
1434
|
+
function Be(e) {
|
|
1435
|
+
let t = Number.parseInt(e.getAttribute("span") ?? "", 10);
|
|
1436
|
+
return Number.isNaN(t) ? 1 : Math.min(1e3, Math.max(1, t));
|
|
1437
|
+
}
|
|
1438
|
+
function Ve(e, t) {
|
|
1439
|
+
let n = {
|
|
1440
|
+
caption: null,
|
|
1441
|
+
rows: [],
|
|
1442
|
+
rowGroups: [],
|
|
1443
|
+
groupEnds: [],
|
|
1444
|
+
cells: [],
|
|
1445
|
+
columnCount: 0,
|
|
1446
|
+
colFixed: [],
|
|
1447
|
+
colPercent: [],
|
|
1448
|
+
hidden: []
|
|
1449
|
+
}, r = [], i = [], a = [];
|
|
1450
|
+
for (let o of e.children) {
|
|
1451
|
+
if (U(o.style)) continue;
|
|
1452
|
+
let e = o.style.tableRole;
|
|
1453
|
+
if (e === "row") i.push({
|
|
1454
|
+
row: o,
|
|
1455
|
+
group: null
|
|
1456
|
+
});
|
|
1457
|
+
else if (e === "header-group" || e === "row-group" || e === "footer-group") {
|
|
1458
|
+
let t = e === "header-group" ? r : e === "footer-group" ? a : i;
|
|
1459
|
+
for (let e of o.children) U(e.style) || (e.style.tableRole === "row" ? t.push({
|
|
1460
|
+
row: e,
|
|
1461
|
+
group: o
|
|
1462
|
+
}) : H(n, e));
|
|
1463
|
+
} else e === "caption" ? n.caption === null ? n.caption = o : H(n, o) : e === "column" || e === "column-group" ? (ze(n, o, t), n.hidden.push(o)) : H(n, o);
|
|
1464
|
+
}
|
|
1465
|
+
let o = [
|
|
1466
|
+
...r,
|
|
1467
|
+
...i,
|
|
1468
|
+
...a
|
|
1469
|
+
], s = 0;
|
|
1470
|
+
for (let e = 0; e < o.length; e++) {
|
|
1471
|
+
n.rows.push(o[e].row), n.rowGroups.push(o[e].group);
|
|
1472
|
+
let t = o[e + 1]?.group;
|
|
1473
|
+
if (!(e + 1 < o.length && (o[e].group === t || o[e].group === null && t === null))) {
|
|
1474
|
+
for (let t = s; t <= e; t++) n.groupEnds.push(e + 1);
|
|
1475
|
+
s = e + 1;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
return He(n), n;
|
|
1479
|
+
}
|
|
1480
|
+
function He(e) {
|
|
1481
|
+
let t = [];
|
|
1482
|
+
for (let n = 0; n < e.rows.length; n++) {
|
|
1483
|
+
let r = e.rows[n], i = 0;
|
|
1484
|
+
for (let a of r.children) {
|
|
1485
|
+
if (U(a.style)) continue;
|
|
1486
|
+
if (a.style.tableRole !== "cell") {
|
|
1487
|
+
H(e, a);
|
|
1488
|
+
continue;
|
|
1489
|
+
}
|
|
1490
|
+
for (; (t[i] ?? 0) > n;) i++;
|
|
1491
|
+
let o = Re(a.source, "colspan"), s = Re(a.source, "rowspan"), c = e.groupEnds[n], l = Math.max(1, Math.min(s === 0 ? c - n : s, c - n));
|
|
1492
|
+
for (let e = i; e < i + o; e++) t[e] = Math.max(t[e] ?? 0, n + l);
|
|
1493
|
+
e.cells.push({
|
|
1494
|
+
node: a,
|
|
1495
|
+
rowNode: r,
|
|
1496
|
+
row: n,
|
|
1497
|
+
col: i,
|
|
1498
|
+
rowSpan: l,
|
|
1499
|
+
colSpan: o
|
|
1500
|
+
}), i += o;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
e.columnCount = Math.max(t.length, e.colFixed.length);
|
|
1504
|
+
}
|
|
1505
|
+
function Ue(e, t, n) {
|
|
1506
|
+
let r = e.style, i = Q(e, n), a;
|
|
1507
|
+
if (t === "min") a = i;
|
|
1508
|
+
else {
|
|
1509
|
+
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ? X(r.width, 0, e, n) : void 0;
|
|
1510
|
+
a = t === void 0 ? Z(e, n) : Math.max(i, t);
|
|
1511
|
+
}
|
|
1512
|
+
let o = typeof r.minWidth == "number" ? r.minWidth : 0, s = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
1513
|
+
return Math.max(0, G(a, o, s));
|
|
1514
|
+
}
|
|
1515
|
+
function We(e) {
|
|
1516
|
+
let t = e.style.width;
|
|
1517
|
+
return t && t.kind === "percent" ? t.value : void 0;
|
|
1518
|
+
}
|
|
1519
|
+
function Ge(e, t, n) {
|
|
1520
|
+
let r = e.columnCount, i = Array.from({ length: r }, () => 0), a = Array.from({ length: r }, () => 0), o = Array.from({ length: r }, () => void 0);
|
|
1521
|
+
for (let t = 0; t < r; t++) e.colFixed[t] !== void 0 && (a[t] = e.colFixed[t]), o[t] = e.colPercent[t];
|
|
1522
|
+
let s = [];
|
|
1523
|
+
for (let t of e.cells) {
|
|
1524
|
+
if (t.colSpan > 1) {
|
|
1525
|
+
s.push(t);
|
|
1526
|
+
continue;
|
|
1527
|
+
}
|
|
1528
|
+
i[t.col] = Math.max(i[t.col], Ue(t.node, "min", n)), a[t.col] = Math.max(a[t.col], Ue(t.node, "max", n));
|
|
1529
|
+
let e = We(t.node);
|
|
1530
|
+
e !== void 0 && (o[t.col] = Math.max(o[t.col] ?? 0, e));
|
|
1531
|
+
}
|
|
1532
|
+
s.sort((e, t) => e.colSpan - t.colSpan);
|
|
1533
|
+
for (let e of s) {
|
|
1534
|
+
let r = e.col, o = e.col + e.colSpan, s = Qe(t, r, o), c = a.slice(r, o);
|
|
1535
|
+
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 = Ue(e.node, t, n) - u;
|
|
1537
|
+
if (d <= 0) continue;
|
|
1538
|
+
let f = F(c.some((e) => e > 0) ? c : c.map(() => 1), d);
|
|
1539
|
+
for (let e = r; e < o; e++) l[e] += f[e - r];
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
for (let e = 0; e < r; e++) a[e] = Math.max(a[e], i[e]);
|
|
1543
|
+
return {
|
|
1544
|
+
min: i,
|
|
1545
|
+
max: a,
|
|
1546
|
+
percent: o
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
function Ke(e, t) {
|
|
1550
|
+
let n = e.min.length, r = e.min.slice(), i = [], a = [];
|
|
1551
|
+
for (let t = 0; t < n; t++) (e.percent[t] === void 0 ? a : i).push(t);
|
|
1552
|
+
if (i.length > 0) {
|
|
1553
|
+
let n = i.reduce((t, n) => t + e.percent[n], 0), o = Math.max(100, n);
|
|
1554
|
+
for (let n of i) {
|
|
1555
|
+
let i = Math.round(t * e.percent[n] / o);
|
|
1556
|
+
r[n] = Math.max(e.min[n], i);
|
|
1557
|
+
}
|
|
1558
|
+
let s = a.reduce((t, n) => t + e.min[n], 0), c = i.reduce((e, t) => e + r[t], 0) - (t - s);
|
|
1559
|
+
if (c > 0) {
|
|
1560
|
+
let t = i.map((t) => r[t] - e.min[t]), n = F(t, Math.min(c, t.reduce((e, t) => e + t, 0)));
|
|
1561
|
+
i.forEach((e, t) => r[e] -= n[t]);
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
let o = t - r.reduce((e, t) => e + t, 0);
|
|
1565
|
+
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 = F(t, Math.min(o, n));
|
|
1567
|
+
a.forEach((e, t) => r[e] += i[t]), o -= Math.min(o, n);
|
|
1568
|
+
}
|
|
1569
|
+
if (o > 0) {
|
|
1570
|
+
let t = a.length > 0 ? a : i;
|
|
1571
|
+
if (t.length > 0) {
|
|
1572
|
+
let n = t.map((t) => e.max[t]), i = F(n.some((e) => e > 0) ? n : n.map(() => 1), o);
|
|
1573
|
+
t.forEach((e, t) => r[e] += i[t]);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
return r;
|
|
1577
|
+
}
|
|
1578
|
+
function qe(e, t, n) {
|
|
1579
|
+
let r = e.columnCount, i = Array.from({ length: r }, () => void 0);
|
|
1580
|
+
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
|
+
for (let r of e.cells) {
|
|
1582
|
+
if (r.row !== 0) continue;
|
|
1583
|
+
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 = X(e.width, 0, r.node, n)), a === void 0) continue;
|
|
1585
|
+
let o = F(Array.from({ length: r.colSpan }, () => 1), a);
|
|
1586
|
+
for (let e = 0; e < r.colSpan; e++) {
|
|
1587
|
+
let t = r.col + e;
|
|
1588
|
+
i[t] === void 0 && (i[t] = o[e]);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
let a = i.reduce((e, t) => e + (t ?? 0), 0), o = i.filter((e) => e === void 0).length;
|
|
1592
|
+
if (o > 0) {
|
|
1593
|
+
let e = F(Array.from({ length: o }, () => 1), Math.max(0, t - a)), n = 0;
|
|
1594
|
+
for (let t = 0; t < r; t++) i[t] === void 0 && (i[t] = e[n++]);
|
|
1595
|
+
}
|
|
1596
|
+
return i.map((e) => e ?? 0);
|
|
1597
|
+
}
|
|
1598
|
+
var Je = {
|
|
1599
|
+
double: 3,
|
|
1600
|
+
solid: 2,
|
|
1601
|
+
dashed: 1,
|
|
1602
|
+
dotted: 0
|
|
1603
|
+
};
|
|
1604
|
+
function Ye(e) {
|
|
1605
|
+
for (let { border: t, side: n } of e) if (t?.hidden[n]) return null;
|
|
1606
|
+
let t = null;
|
|
1607
|
+
for (let { border: n, side: r } of e) {
|
|
1608
|
+
if (!n) continue;
|
|
1609
|
+
let e = n.width[r];
|
|
1610
|
+
if (e <= 0) continue;
|
|
1611
|
+
let i = n.style[r];
|
|
1612
|
+
(t === null || e > t.width || e === t.width && Je[i] > Je[t.style]) && (t = {
|
|
1613
|
+
width: e,
|
|
1614
|
+
style: i,
|
|
1615
|
+
color: n.color[r]
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
return t;
|
|
1619
|
+
}
|
|
1620
|
+
function Xe(e, t) {
|
|
1621
|
+
let n = t.columnCount, r = t.rows.length, i = e.style.borderCollapse, a = {
|
|
1622
|
+
collapsed: i,
|
|
1623
|
+
vLines: Array.from({ length: n + 1 }, () => 0),
|
|
1624
|
+
hLines: Array.from({ length: r + 1 }, () => 0),
|
|
1625
|
+
spacingX: i ? 0 : e.style.borderSpacingX,
|
|
1626
|
+
spacingY: i ? 0 : e.style.borderSpacingY,
|
|
1627
|
+
vSegments: [],
|
|
1628
|
+
hSegments: []
|
|
1629
|
+
};
|
|
1630
|
+
if (!i || n === 0 || r === 0) return a;
|
|
1631
|
+
let o = Array.from({ length: r }, () => Array.from({ length: n }, () => void 0));
|
|
1632
|
+
for (let e of t.cells) for (let t = e.row; t < e.row + e.rowSpan; t++) for (let n = e.col; n < e.col + e.colSpan; n++) o[t][n] = e;
|
|
1633
|
+
let s = e.style.latticeBorder;
|
|
1634
|
+
for (let e = 0; e <= n; e++) {
|
|
1635
|
+
let i = [];
|
|
1636
|
+
for (let a = 0; a < r; a++) {
|
|
1637
|
+
let r = e > 0 ? o[a][e - 1] : void 0, c = e < n ? o[a][e] : void 0;
|
|
1638
|
+
if (r !== void 0 && r === c) {
|
|
1639
|
+
i.push(null);
|
|
1640
|
+
continue;
|
|
1641
|
+
}
|
|
1642
|
+
let l = [];
|
|
1643
|
+
r && r.col + r.colSpan === e && l.push({
|
|
1644
|
+
border: r.node.style.latticeBorder,
|
|
1645
|
+
side: "right"
|
|
1646
|
+
}), c && c.col === e && l.push({
|
|
1647
|
+
border: c.node.style.latticeBorder,
|
|
1648
|
+
side: "left"
|
|
1649
|
+
});
|
|
1650
|
+
let u = e === 0 ? "left" : e === n ? "right" : null;
|
|
1651
|
+
if (u) {
|
|
1652
|
+
l.push({
|
|
1653
|
+
border: t.rows[a].style.latticeBorder,
|
|
1654
|
+
side: u
|
|
1655
|
+
});
|
|
1656
|
+
let e = t.rowGroups[a];
|
|
1657
|
+
e && l.push({
|
|
1658
|
+
border: e.style.latticeBorder,
|
|
1659
|
+
side: u
|
|
1660
|
+
}), l.push({
|
|
1661
|
+
border: s,
|
|
1662
|
+
side: u
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
i.push(Ye(l));
|
|
1666
|
+
}
|
|
1667
|
+
a.vSegments.push(i), a.vLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
1668
|
+
}
|
|
1669
|
+
for (let e = 0; e <= r; e++) {
|
|
1670
|
+
let i = [];
|
|
1671
|
+
for (let a = 0; a < n; a++) {
|
|
1672
|
+
let n = e > 0 ? o[e - 1][a] : void 0, c = e < r ? o[e][a] : void 0;
|
|
1673
|
+
if (n !== void 0 && n === c) {
|
|
1674
|
+
i.push(null);
|
|
1675
|
+
continue;
|
|
1676
|
+
}
|
|
1677
|
+
let l = [];
|
|
1678
|
+
n && n.row + n.rowSpan === e && l.push({
|
|
1679
|
+
border: n.node.style.latticeBorder,
|
|
1680
|
+
side: "bottom"
|
|
1681
|
+
}), c && c.row === e && l.push({
|
|
1682
|
+
border: c.node.style.latticeBorder,
|
|
1683
|
+
side: "top"
|
|
1684
|
+
}), e > 0 && l.push({
|
|
1685
|
+
border: t.rows[e - 1].style.latticeBorder,
|
|
1686
|
+
side: "bottom"
|
|
1687
|
+
}), e < r && l.push({
|
|
1688
|
+
border: t.rows[e].style.latticeBorder,
|
|
1689
|
+
side: "top"
|
|
1690
|
+
});
|
|
1691
|
+
let u = e > 0 ? t.rowGroups[e - 1] : null, d = e < r ? t.rowGroups[e] : null;
|
|
1692
|
+
u && u !== d && l.push({
|
|
1693
|
+
border: u.style.latticeBorder,
|
|
1694
|
+
side: "bottom"
|
|
1695
|
+
}), d && d !== u && l.push({
|
|
1696
|
+
border: d.style.latticeBorder,
|
|
1697
|
+
side: "top"
|
|
1698
|
+
}), e === 0 && l.push({
|
|
1699
|
+
border: s,
|
|
1700
|
+
side: "top"
|
|
1701
|
+
}), e === r && l.push({
|
|
1702
|
+
border: s,
|
|
1703
|
+
side: "bottom"
|
|
1704
|
+
}), i.push(Ye(l));
|
|
1705
|
+
}
|
|
1706
|
+
a.hSegments.push(i), a.hLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
1707
|
+
}
|
|
1708
|
+
return a;
|
|
1709
|
+
}
|
|
1710
|
+
function Ze(e, t) {
|
|
1711
|
+
return e.collapsed ? e.vLines.reduce((e, t) => e + t, 0) : (t + 1) * e.spacingX;
|
|
1712
|
+
}
|
|
1713
|
+
function Qe(e, t, n) {
|
|
1714
|
+
if (!e.collapsed) return e.spacingX * (n - t - 1);
|
|
1715
|
+
let r = 0;
|
|
1716
|
+
for (let i = t + 1; i < n; i++) r += e.vLines[i];
|
|
1717
|
+
return r;
|
|
1718
|
+
}
|
|
1719
|
+
function $e(e, t, n) {
|
|
1720
|
+
if (!e.collapsed) return e.spacingY * (n - t - 1);
|
|
1721
|
+
let r = 0;
|
|
1722
|
+
for (let i = t + 1; i < n; i++) r += e.hLines[i];
|
|
1723
|
+
return r;
|
|
1724
|
+
}
|
|
1725
|
+
function et(e, t) {
|
|
1726
|
+
let n = t.tableData.get(e);
|
|
1727
|
+
if (n) return n;
|
|
1728
|
+
let r = Ve(e, t), i = Xe(e, r), a = {
|
|
1729
|
+
structure: r,
|
|
1730
|
+
chrome: i,
|
|
1731
|
+
bounds: Ge(r, i, t),
|
|
1732
|
+
chromeX: Ze(i, r.columnCount)
|
|
1733
|
+
};
|
|
1734
|
+
return t.tableData.set(e, a), a;
|
|
1735
|
+
}
|
|
1736
|
+
function tt(e, t) {
|
|
1737
|
+
let { structure: n, bounds: r, chromeX: i } = et(e, t), a = r.min.reduce((e, t) => e + t, 0) + i, o = r.max.reduce((e, t) => e + t, 0) + i;
|
|
1738
|
+
return n.caption && (a = Math.max(a, Q(n.caption, t)), o = Math.max(o, Z(n.caption, t))), {
|
|
1739
|
+
min: a,
|
|
1740
|
+
max: o
|
|
1741
|
+
};
|
|
1742
|
+
}
|
|
1743
|
+
function nt(e, t, n) {
|
|
1744
|
+
let r = e.style, { bounds: i, chromeX: a } = et(e, n), { min: o, max: s } = tt(e, n), c = r.border.left + r.border.right + K(r.padding.left, t) + K(r.padding.right, t), l = i.max.reduce((e, t) => e + t, 0), u = 0, d = 0;
|
|
1745
|
+
for (let e = 0; e < i.max.length; e++) {
|
|
1746
|
+
let t = i.percent[e];
|
|
1747
|
+
t === void 0 ? d += i.max[e] : u += t;
|
|
1748
|
+
}
|
|
1749
|
+
if (u >= 100) l = Infinity;
|
|
1750
|
+
else if (u > 0) {
|
|
1751
|
+
for (let e = 0; e < i.max.length; e++) {
|
|
1752
|
+
let t = i.percent[e];
|
|
1753
|
+
t !== void 0 && t > 0 && (l = Math.max(l, Math.ceil(i.max[e] * 100 / t)));
|
|
1754
|
+
}
|
|
1755
|
+
l = Math.max(l, Math.ceil(d * 100 / (100 - u)));
|
|
1756
|
+
}
|
|
1757
|
+
let f = Math.max(l + a, s) + c;
|
|
1758
|
+
return Math.max(o + c, Math.min(f, t));
|
|
1759
|
+
}
|
|
1760
|
+
function rt(e, t, n, r, i, a) {
|
|
1761
|
+
let { structure: o, chrome: s, bounds: c } = et(e, a), l = o.columnCount, u = o.rows.length, d = r.left + i.left, f = r.top + i.top;
|
|
1762
|
+
for (let e of o.hidden) e.tableHidden = !0, e.localRect = {
|
|
1763
|
+
x: 0,
|
|
1764
|
+
y: 0,
|
|
1765
|
+
width: 0,
|
|
1766
|
+
height: 0
|
|
1767
|
+
}, e.resolvedPadding = {
|
|
1768
|
+
top: 0,
|
|
1769
|
+
right: 0,
|
|
1770
|
+
bottom: 0,
|
|
1771
|
+
left: 0
|
|
1772
|
+
}, e.unclampedHeight = 0;
|
|
1773
|
+
let p = Math.max(0, t - Ze(s, l)), h = e.style, g = h.tableLayout === "fixed" && h.width !== void 0 && h.width.kind !== "auto" ? qe(o, p, a) : Ke(c, p), _ = [], v = 0;
|
|
1774
|
+
for (let e = 0; e < l; e++) v += s.collapsed ? s.vLines[e] : s.spacingX, _.push(v), v += g[e];
|
|
1775
|
+
let y = v + (s.collapsed ? s.vLines[l] ?? 0 : s.spacingX), b = 0;
|
|
1776
|
+
o.caption && (W(o.caption, t, void 0, d, f, "fill", a), b = o.caption.localRect.height);
|
|
1777
|
+
let x = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
|
|
1778
|
+
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) + Qe(s, e.col, t);
|
|
1780
|
+
S.set(e, n), W(e.node, n, void 0, 0, 0, "fill", a, { width: n }), x.set(e, e.node.localRect.height);
|
|
1781
|
+
}
|
|
1782
|
+
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
|
+
for (let e = 0; e < u; e++) {
|
|
1784
|
+
let t = o.rows[e].style.height;
|
|
1785
|
+
t !== void 0 && t.kind === "cells" && (E[e] = t.value);
|
|
1786
|
+
let n = T(t);
|
|
1787
|
+
n > 0 && (E[e] = Math.max(E[e], n), D[e] = !0);
|
|
1788
|
+
}
|
|
1789
|
+
for (let e of o.cells) if (e.rowSpan === 1) {
|
|
1790
|
+
let t = T(e.node.style.height);
|
|
1791
|
+
t > 0 && (D[e.row] = !0), E[e.row] = Math.max(E[e.row], x.get(e), t);
|
|
1792
|
+
}
|
|
1793
|
+
let O = o.cells.filter((e) => e.rowSpan > 1).sort((e, t) => e.rowSpan - t.rowSpan);
|
|
1794
|
+
for (let e of O) {
|
|
1795
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + $e(s, e.row, t), r = x.get(e) - n;
|
|
1796
|
+
if (r <= 0) continue;
|
|
1797
|
+
let i = F(Array.from({ length: e.rowSpan }, () => 1), r);
|
|
1798
|
+
for (let n = e.row; n < t; n++) E[n] += i[n - e.row];
|
|
1799
|
+
}
|
|
1800
|
+
if (n !== void 0 && u > 0) {
|
|
1801
|
+
let e = n - b - C - E.reduce((e, t) => e + t, 0);
|
|
1802
|
+
if (e > 0) {
|
|
1803
|
+
let t = [];
|
|
1804
|
+
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 = F(n.map(() => 1), e);
|
|
1806
|
+
n.forEach((e, t) => E[e] += r[t]);
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
let k = o.caption && e.style.captionSide === "top" ? b : 0, A = [], j = k;
|
|
1810
|
+
for (let e = 0; e < u; e++) j += s.collapsed ? s.hLines[e] : s.spacingY, A.push(j), j += E[e];
|
|
1811
|
+
let M = u > 0 ? j + (s.collapsed ? s.hLines[u] ?? 0 : s.spacingY) : k, N = /* @__PURE__ */ new Map();
|
|
1812
|
+
for (let e = 0; e < u; e++) {
|
|
1813
|
+
let t = o.rowGroups[e];
|
|
1814
|
+
t && !N.has(t) && N.set(t, A[e]);
|
|
1815
|
+
}
|
|
1816
|
+
for (let [e, t] of N) {
|
|
1817
|
+
let n = t;
|
|
1818
|
+
for (let t = 0; t < u; t++) o.rowGroups[t] === e && (n = A[t] + E[t]);
|
|
1819
|
+
e.localRect = {
|
|
1820
|
+
x: d,
|
|
1821
|
+
y: f + t,
|
|
1822
|
+
width: y,
|
|
1823
|
+
height: n - t
|
|
1824
|
+
}, e.resolvedPadding = {
|
|
1825
|
+
top: 0,
|
|
1826
|
+
right: 0,
|
|
1827
|
+
bottom: 0,
|
|
1828
|
+
left: 0
|
|
1829
|
+
}, e.unclampedHeight = n - t;
|
|
1830
|
+
}
|
|
1831
|
+
for (let e = 0; e < u; e++) {
|
|
1832
|
+
let t = o.rows[e], n = o.rowGroups[e], r = n ? N.get(n) : void 0;
|
|
1833
|
+
t.localRect = {
|
|
1834
|
+
x: r === void 0 ? d : 0,
|
|
1835
|
+
y: r === void 0 ? f + A[e] : A[e] - r,
|
|
1836
|
+
width: y,
|
|
1837
|
+
height: E[e]
|
|
1838
|
+
}, t.resolvedPadding = {
|
|
1839
|
+
top: 0,
|
|
1840
|
+
right: 0,
|
|
1841
|
+
bottom: 0,
|
|
1842
|
+
left: 0
|
|
1843
|
+
}, t.unclampedHeight = E[e];
|
|
1844
|
+
}
|
|
1845
|
+
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) + $e(s, e.row, t);
|
|
1847
|
+
e.node.children.some((e) => !U(e.style) && e.style.height?.kind === "percent") && n !== x.get(e) && W(e.node, S.get(e), n, 0, 0, "fill", a, {
|
|
1848
|
+
width: S.get(e),
|
|
1849
|
+
height: n
|
|
1850
|
+
}), it(e.node, n - (e.node.naturalContentHeight ?? e.node.localRect.height)), e.node.localRect = {
|
|
1851
|
+
x: _[e.col],
|
|
1852
|
+
y: 0,
|
|
1853
|
+
width: e.node.localRect.width,
|
|
1854
|
+
height: n
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
for (let t of e.children) U(t.style) && (t.staticSlot = {
|
|
1858
|
+
kind: "block",
|
|
1859
|
+
x: d,
|
|
1860
|
+
y: f
|
|
1861
|
+
});
|
|
1862
|
+
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + M), s.collapsed && l > 0 && u > 0 && (e.decorationRuns = at(s, o, g, E, _, A, d, f)), e.style.captionSide === "bottom" ? M + b : M;
|
|
1863
|
+
}
|
|
1864
|
+
function it(e, t) {
|
|
1865
|
+
if (t <= 0) return;
|
|
1866
|
+
let n = e.style.verticalAlign, r = n === "center" ? Math.floor(t / 2) : n === "end" ? t : 0;
|
|
1867
|
+
if (!e.children.some((e) => !U(e.style) && !e.inlineBox)) {
|
|
1868
|
+
e.resolvedPadding.top += r, e.resolvedPadding.bottom += t - r;
|
|
1869
|
+
return;
|
|
1870
|
+
}
|
|
1871
|
+
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (U(t.style) ? t.staticSlot?.kind === "block" && (t.staticSlot.y += r) : t.localRect.y += r);
|
|
1872
|
+
}
|
|
1873
|
+
function at(e, t, n, r, i, s, c, l) {
|
|
1874
|
+
let u = t.columnCount, d = t.rows.length, f = [], p = (t) => t < u ? i[t] - e.vLines[t] : i[u - 1] + n[u - 1], m = (t) => t < d ? s[t] - e.hLines[t] : s[d - 1] + r[d - 1];
|
|
1875
|
+
for (let t = 0; t <= u; t++) {
|
|
1876
|
+
let n = e.vSegments[t];
|
|
1877
|
+
for (let e = 0; e < d; e++) {
|
|
1878
|
+
let i = n[e];
|
|
1879
|
+
if (!i) continue;
|
|
1880
|
+
let o = a(i.style, "v");
|
|
1881
|
+
for (let n = 0; n < i.width; n++) for (let a = s[e]; a < s[e] + r[e]; a++) f.push({
|
|
1882
|
+
glyph: o,
|
|
1883
|
+
x: c + p(t) + n,
|
|
1884
|
+
y: l + a,
|
|
1885
|
+
length: 1,
|
|
1886
|
+
color: i.color
|
|
1887
|
+
});
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
for (let t = 0; t <= d; t++) {
|
|
1891
|
+
let r = e.hSegments[t];
|
|
1892
|
+
for (let e = 0; e < u; e++) {
|
|
1893
|
+
let o = r[e];
|
|
1894
|
+
if (!o) continue;
|
|
1895
|
+
let s = a(o.style, "h");
|
|
1896
|
+
for (let r = 0; r < o.width; r++) f.push({
|
|
1897
|
+
glyph: s,
|
|
1898
|
+
x: c + i[e],
|
|
1899
|
+
y: l + m(t) + r,
|
|
1900
|
+
length: n[e],
|
|
1901
|
+
color: o.color
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
for (let t = 0; t <= u; t++) if (!(e.vLines[t] <= 0)) for (let n = 0; n <= d; n++) {
|
|
1906
|
+
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, a = t > 0 ? e.hSegments[n][t - 1] : null, s = t < u ? e.hSegments[n][t] : null, h = [
|
|
1908
|
+
r,
|
|
1909
|
+
i,
|
|
1910
|
+
a,
|
|
1911
|
+
s
|
|
1912
|
+
].filter((e) => e !== null);
|
|
1913
|
+
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 && Je[t.style] > Je[e.style] ? t : e), v = o(g, r !== null, i !== null, a !== null, s !== null);
|
|
1915
|
+
for (let r = 0; r < e.vLines[t]; r++) for (let i = 0; i < e.hLines[n]; i++) f.push({
|
|
1916
|
+
glyph: v,
|
|
1917
|
+
x: c + p(t) + r,
|
|
1918
|
+
y: l + m(n) + i,
|
|
1919
|
+
length: 1,
|
|
1920
|
+
color: _.color
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
return f;
|
|
1083
1924
|
}
|
|
1084
1925
|
//#endregion
|
|
1085
1926
|
//#region src/positioning.ts
|
|
1086
|
-
function
|
|
1927
|
+
function ot(e) {
|
|
1087
1928
|
return e.position === "absolute" || e.position === "fixed" ? "absolute" : e.position === "relative" || e.position === "sticky" ? "relative" : "static";
|
|
1088
1929
|
}
|
|
1089
|
-
function
|
|
1930
|
+
function st(e, t, n, r, i) {
|
|
1090
1931
|
for (let a of e.children) {
|
|
1091
|
-
let o =
|
|
1932
|
+
let o = ot(a.style);
|
|
1092
1933
|
if (o === "relative") {
|
|
1093
1934
|
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;
|
|
1094
|
-
a.localRect.x +=
|
|
1095
|
-
} else o === "absolute" &&
|
|
1096
|
-
|
|
1935
|
+
a.localRect.x += ct(a.style.insets.left, a.style.insets.right, t), a.localRect.y += ct(a.style.insets.top, a.style.insets.bottom, n);
|
|
1936
|
+
} else o === "absolute" && ut(a, e, t, n, r, i);
|
|
1937
|
+
st(a, t + a.localRect.x, n + a.localRect.y, [...r, {
|
|
1097
1938
|
node: a,
|
|
1098
1939
|
absX: t + a.localRect.x,
|
|
1099
1940
|
absY: n + a.localRect.y
|
|
1100
1941
|
}], i);
|
|
1101
1942
|
}
|
|
1102
1943
|
}
|
|
1103
|
-
function
|
|
1104
|
-
return e === null ? t === null ? 0 : -
|
|
1944
|
+
function ct(e, t, n) {
|
|
1945
|
+
return e === null ? t === null ? 0 : -K(t, n) : K(e, n);
|
|
1105
1946
|
}
|
|
1106
|
-
function
|
|
1947
|
+
function lt(e, t) {
|
|
1107
1948
|
if (!t) for (let t = e.length - 1; t > 0; t--) {
|
|
1108
1949
|
let n = e[t];
|
|
1109
|
-
if (!
|
|
1950
|
+
if (!vt(n.node.style)) continue;
|
|
1110
1951
|
let r = n.node.style.border;
|
|
1111
1952
|
return {
|
|
1112
1953
|
x: n.absX + r.left,
|
|
@@ -1123,44 +1964,44 @@ function De(e, t) {
|
|
|
1123
1964
|
height: n.node.localRect.height
|
|
1124
1965
|
};
|
|
1125
1966
|
}
|
|
1126
|
-
function
|
|
1127
|
-
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s &&
|
|
1967
|
+
function ut(e, t, n, r, i, a) {
|
|
1968
|
+
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s && vt(t.style) ? {
|
|
1128
1969
|
x: n + c.area.x,
|
|
1129
1970
|
y: r + c.area.y,
|
|
1130
1971
|
width: c.area.width,
|
|
1131
1972
|
height: c.area.height
|
|
1132
|
-
} :
|
|
1133
|
-
if (!y) C.width =
|
|
1134
|
-
else if (u !== null && d !== null) C.width =
|
|
1973
|
+
} : lt(i, s), u = o.insets.left === null ? null : K(o.insets.left, l.width), d = o.insets.right === null ? null : K(o.insets.right, l.width), f = o.insets.top === null ? null : K(o.insets.top, l.height), p = o.insets.bottom === null ? null : K(o.insets.bottom, l.height), m = q(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 = wt(o.minWidth, l.width, e, a) ?? 0, S = wt(o.maxWidth, l.width, e, a), C = {};
|
|
1974
|
+
if (!y) C.width = G(X(o.width, l.width, e, a), x, S);
|
|
1975
|
+
else if (u !== null && d !== null) C.width = G(Math.max(0, l.width - u - d - h - g), x, S);
|
|
1135
1976
|
else {
|
|
1136
1977
|
let t = Math.max(0, l.width - (u ?? 0) - (d ?? 0) - h - g);
|
|
1137
|
-
C.width =
|
|
1978
|
+
C.width = G(Math.min(Z(e, a), Math.max(Q(e, a), t)), x, S);
|
|
1138
1979
|
}
|
|
1139
|
-
f !== null && p !== null && b && (C.height =
|
|
1980
|
+
f !== null && p !== null && b && (C.height = G(Math.max(0, l.height - f - p - _ - v), Y(o.minHeight, l.height) ?? 0, Y(o.maxHeight, l.height))), W(e, l.width, l.height, 0, 0, "shrink", a, C);
|
|
1140
1981
|
let w = e.localRect.width, T = e.localRect.height, E;
|
|
1141
1982
|
if (u !== null && d !== null) {
|
|
1142
1983
|
let e = Math.max(0, l.width - u - d - w - h - g), t = m.left === null && m.right === null;
|
|
1143
1984
|
E = l.x + u + h + (t ? Math.floor(e / 2) : m.left === null ? e : 0);
|
|
1144
|
-
} else E = u === null ? d === null ?
|
|
1985
|
+
} else E = u === null ? d === null ? ht(e, t, n, w) : l.x + l.width - d - w - g : l.x + u + h;
|
|
1145
1986
|
let D;
|
|
1146
1987
|
if (f !== null && p !== null) {
|
|
1147
1988
|
let e = Math.max(0, l.height - f - p - T - _ - v), t = m.top === null && m.bottom === null;
|
|
1148
1989
|
D = l.y + f + _ + (t ? Math.floor(e / 2) : m.top === null ? e : 0);
|
|
1149
|
-
} else D = f === null ? p === null ?
|
|
1990
|
+
} else D = f === null ? p === null ? gt(e, t, r, T) : l.y + l.height - p - T - v : l.y + f + _;
|
|
1150
1991
|
e.localRect = {
|
|
1151
1992
|
...e.localRect,
|
|
1152
1993
|
x: E - n,
|
|
1153
1994
|
y: D - r
|
|
1154
1995
|
};
|
|
1155
1996
|
}
|
|
1156
|
-
function
|
|
1157
|
-
return
|
|
1997
|
+
function dt(e, t, n) {
|
|
1998
|
+
return P(e, [n], Math.max(0, t - n))[0];
|
|
1158
1999
|
}
|
|
1159
|
-
function
|
|
1160
|
-
return
|
|
2000
|
+
function ft(e, t, n, r) {
|
|
2001
|
+
return L(I(e, t), n, r);
|
|
1161
2002
|
}
|
|
1162
|
-
function
|
|
1163
|
-
let a =
|
|
2003
|
+
function pt(e, t, n, r, i) {
|
|
2004
|
+
let a = q(e.style.margin, n.innerWidth), [o, s, c, l] = r === "x" ? [
|
|
1164
2005
|
a.left ?? 0,
|
|
1165
2006
|
a.right ?? 0,
|
|
1166
2007
|
n.innerWidth,
|
|
@@ -1171,10 +2012,10 @@ function je(e, t, n, r, i) {
|
|
|
1171
2012
|
n.innerHeight,
|
|
1172
2013
|
n.direction === "column"
|
|
1173
2014
|
], u = i + o + s;
|
|
1174
|
-
return (l ?
|
|
2015
|
+
return (l ? dt(ie(t.style), c, u) : ft(e, t, c, u)) + o;
|
|
1175
2016
|
}
|
|
1176
|
-
function
|
|
1177
|
-
let a =
|
|
2017
|
+
function mt(e, t, n, r, i) {
|
|
2018
|
+
let a = q(e.style.margin, n.width), o = e.style.justifySelf === "auto" ? t.style.justifyItems : e.style.justifySelf, [s, c, l, u] = r === "x" ? [
|
|
1178
2019
|
a.left ?? 0,
|
|
1179
2020
|
a.right ?? 0,
|
|
1180
2021
|
n.width,
|
|
@@ -1183,134 +2024,146 @@ function Me(e, t, n, r, i) {
|
|
|
1183
2024
|
a.top ?? 0,
|
|
1184
2025
|
a.bottom ?? 0,
|
|
1185
2026
|
n.height,
|
|
1186
|
-
|
|
2027
|
+
I(e, t)
|
|
1187
2028
|
];
|
|
1188
|
-
return
|
|
2029
|
+
return L(u, l, i + s + c) + s;
|
|
1189
2030
|
}
|
|
1190
|
-
function
|
|
2031
|
+
function ht(e, t, n, r) {
|
|
1191
2032
|
let i = e.staticSlot;
|
|
1192
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x +
|
|
2033
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x + mt(e, t, i.staticArea, "x", r) : n + i.originX + pt(e, t, i, "x", r);
|
|
1193
2034
|
}
|
|
1194
|
-
function
|
|
2035
|
+
function gt(e, t, n, r) {
|
|
1195
2036
|
let i = e.staticSlot;
|
|
1196
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y +
|
|
2037
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y + mt(e, t, i.staticArea, "y", r) : n + i.originY + pt(e, t, i, "y", r);
|
|
1197
2038
|
}
|
|
1198
2039
|
//#endregion
|
|
1199
2040
|
//#region src/layout.ts
|
|
1200
|
-
function
|
|
1201
|
-
let n =
|
|
1202
|
-
return
|
|
2041
|
+
function _t(e, t) {
|
|
2042
|
+
let n = yt();
|
|
2043
|
+
return W(e, t, void 0, 0, 0, "fill", n), st(e, 0, 0, [{
|
|
1203
2044
|
node: e,
|
|
1204
2045
|
absX: 0,
|
|
1205
2046
|
absY: 0
|
|
1206
2047
|
}], n), { height: e.localRect.height };
|
|
1207
2048
|
}
|
|
1208
|
-
function
|
|
2049
|
+
function U(e) {
|
|
1209
2050
|
return e.position === "absolute" || e.position === "fixed";
|
|
1210
2051
|
}
|
|
1211
|
-
function
|
|
2052
|
+
function vt(e) {
|
|
1212
2053
|
return e.position !== "static";
|
|
1213
2054
|
}
|
|
1214
|
-
function
|
|
2055
|
+
function yt() {
|
|
1215
2056
|
return {
|
|
1216
2057
|
maxContent: /* @__PURE__ */ new WeakMap(),
|
|
1217
2058
|
minContent: /* @__PURE__ */ new WeakMap(),
|
|
1218
|
-
gridIntrinsic: /* @__PURE__ */ new WeakMap()
|
|
2059
|
+
gridIntrinsic: /* @__PURE__ */ new WeakMap(),
|
|
2060
|
+
tableData: /* @__PURE__ */ new WeakMap()
|
|
1219
2061
|
};
|
|
1220
2062
|
}
|
|
1221
|
-
function
|
|
1222
|
-
let
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
2063
|
+
function W(e, t, n, r, i, a, o, s) {
|
|
2064
|
+
let c = e.style, l = s?.height;
|
|
2065
|
+
delete e.decorationRuns;
|
|
2066
|
+
let u = wt(c.minWidth, t, e, o) ?? 0, d = wt(c.maxWidth, t, e, o), f = Y(c.minHeight, n) ?? 0, p = Y(c.maxHeight, n), m = {
|
|
2067
|
+
top: K(c.padding.top, t),
|
|
2068
|
+
right: K(c.padding.right, t),
|
|
2069
|
+
bottom: K(c.padding.bottom, t),
|
|
2070
|
+
left: K(c.padding.left, t)
|
|
1227
2071
|
};
|
|
1228
|
-
e.resolvedPadding =
|
|
1229
|
-
let
|
|
1230
|
-
if (
|
|
2072
|
+
e.resolvedPadding = m;
|
|
2073
|
+
let h = s?.width ?? G(Dt(c, t, a, e, o), u, d), g = kt(c, n), _ = Mt(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, x;
|
|
2074
|
+
if (bt(e)) {
|
|
1231
2075
|
if (e.text) {
|
|
1232
2076
|
let t = e.children.filter((e) => e.inlineBox);
|
|
1233
|
-
|
|
2077
|
+
w(e.text, (n, r) => {
|
|
1234
2078
|
let i = t[r];
|
|
1235
|
-
|
|
2079
|
+
W(i, _.width, void 0, 0, 0, "shrink", o), e.advances[n] = Math.max(1, i.localRect.width);
|
|
1236
2080
|
});
|
|
1237
|
-
let n =
|
|
1238
|
-
if (
|
|
2081
|
+
let n = St(e, _.width);
|
|
2082
|
+
if (x = n.totalRows, xt(e, n, _.width, _.height, m), t.length > 0) {
|
|
1239
2083
|
let r = (e) => n.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
1240
|
-
|
|
2084
|
+
w(e.text, (i, a) => {
|
|
1241
2085
|
let o = r(i);
|
|
1242
2086
|
if (o === -1) return;
|
|
1243
|
-
let
|
|
2087
|
+
let s = n.spans[o];
|
|
1244
2088
|
t[a].localRect = {
|
|
1245
2089
|
...t[a].localRect,
|
|
1246
|
-
x:
|
|
1247
|
-
y:
|
|
2090
|
+
x: c.border.left + m.left + b(s.start, i, e.advances),
|
|
2091
|
+
y: c.border.top + m.top + n.lineY[o]
|
|
1248
2092
|
};
|
|
1249
2093
|
});
|
|
1250
2094
|
}
|
|
1251
|
-
} else
|
|
2095
|
+
} else x = e.intrinsicHeight;
|
|
1252
2096
|
for (let t of e.children) {
|
|
1253
2097
|
if (t.inlineBox) continue;
|
|
1254
|
-
let e =
|
|
2098
|
+
let e = q(t.style.margin, _.width);
|
|
1255
2099
|
t.staticSlot = {
|
|
1256
2100
|
kind: "block",
|
|
1257
|
-
x:
|
|
1258
|
-
y:
|
|
2101
|
+
x: c.border.left + m.left + (e.left ?? 0),
|
|
2102
|
+
y: c.border.top + m.top + (e.top ?? 0)
|
|
1259
2103
|
};
|
|
1260
2104
|
}
|
|
1261
|
-
} else
|
|
1262
|
-
let
|
|
1263
|
-
e.unclampedHeight =
|
|
2105
|
+
} else x = c.display === "flex" && c.flexDirection === "row" ? k(e, _.width, _.height, y, c.border, m, o) : c.display === "flex" && c.flexDirection === "column" ? j(e, _.width, _.height, v, c.border, m, o) : c.display === "grid" ? se(e, _.width, _.height, c.border, m, o) : c.display === "table" ? rt(e, _.width, y, c.border, m, o) : Tt(e, _.width, y, c.border, m, o);
|
|
2106
|
+
let S = x + c.border.top + c.border.bottom + m.top + m.bottom, C = l ?? g ?? S;
|
|
2107
|
+
e.unclampedHeight = C, e.naturalContentHeight = S, e.localRect = {
|
|
1264
2108
|
x: r,
|
|
1265
2109
|
y: i,
|
|
1266
|
-
width:
|
|
1267
|
-
height:
|
|
2110
|
+
width: h,
|
|
2111
|
+
height: G(C, f, p)
|
|
1268
2112
|
};
|
|
1269
2113
|
}
|
|
1270
|
-
function
|
|
1271
|
-
return e.children.some((e) => !
|
|
2114
|
+
function bt(e) {
|
|
2115
|
+
return e.children.some((e) => !U(e.style) && !e.inlineBox) ? !1 : e.text !== "" || e.style.display !== "flex" && e.style.display !== "grid";
|
|
1272
2116
|
}
|
|
1273
|
-
function
|
|
2117
|
+
function G(e, t, n) {
|
|
1274
2118
|
return Math.max(t, n === void 0 ? e : Math.min(e, n));
|
|
1275
2119
|
}
|
|
1276
|
-
function
|
|
2120
|
+
function xt(e, t, n, r, i) {
|
|
1277
2121
|
let a = e.style;
|
|
1278
2122
|
if (a.display !== "flex" && a.display !== "grid" || t.spans.length === 0) return;
|
|
1279
|
-
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t,
|
|
1280
|
-
if (
|
|
1281
|
-
let e = a.display === "grid" ?
|
|
1282
|
-
e > 0 && (i.left += e, i.right +=
|
|
2123
|
+
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t, x(n.start, n.end, e.advances, a.tracking)), 0), c = Math.max(0, n - s);
|
|
2124
|
+
if (c > 0) {
|
|
2125
|
+
let e = a.display === "grid" ? L(a.justifyItems, n, s) : o ? L(a.alignItems, n, s) : P(ie(a), [s], c)[0];
|
|
2126
|
+
e > 0 && (i.left += e, i.right += c - e);
|
|
1283
2127
|
}
|
|
1284
2128
|
if (Number.isFinite(r)) {
|
|
1285
2129
|
let e = Math.max(0, r - t.totalRows);
|
|
1286
2130
|
if (e > 0) {
|
|
1287
|
-
let n = a.display === "grid" || !o ?
|
|
2131
|
+
let n = a.display === "grid" || !o ? L(a.alignItems, r, t.totalRows) : P(ie(a), [t.totalRows], e)[0];
|
|
1288
2132
|
n > 0 && (i.top += n, i.bottom += e - n);
|
|
1289
2133
|
}
|
|
1290
2134
|
}
|
|
1291
2135
|
}
|
|
1292
|
-
function
|
|
1293
|
-
let n = e.style.whiteSpace === "normal" ?
|
|
2136
|
+
function St(e, t) {
|
|
2137
|
+
let n = e.style.whiteSpace === "normal" ? y(e.text, t, {
|
|
1294
2138
|
advances: e.advances,
|
|
1295
2139
|
tracking: e.style.tracking
|
|
1296
|
-
}) :
|
|
2140
|
+
}) : v(e.text), r = e.children.filter((e) => e.inlineBox), i = [], a = [], o = 0, s = 0;
|
|
1297
2141
|
for (let t = 0; t < n.length; t++) {
|
|
1298
|
-
i.push(
|
|
1299
|
-
let
|
|
1300
|
-
for (let t =
|
|
1301
|
-
|
|
2142
|
+
i.push(o);
|
|
2143
|
+
let c = n[t], l = 1, u = 0;
|
|
2144
|
+
for (let t = c.start; t < c.end; t++) {
|
|
2145
|
+
if (e.text[t] !== "") continue;
|
|
2146
|
+
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" && V(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
|
+
}
|
|
2149
|
+
a.push(o + Math.min(u, l - 1)), o += l + (t < n.length - 1 ? e.style.lineGap : 0);
|
|
1302
2150
|
}
|
|
1303
2151
|
return {
|
|
1304
2152
|
spans: n,
|
|
1305
2153
|
lineY: i,
|
|
1306
|
-
|
|
2154
|
+
textY: a,
|
|
2155
|
+
totalRows: o
|
|
1307
2156
|
};
|
|
1308
2157
|
}
|
|
1309
|
-
function
|
|
1310
|
-
|
|
2158
|
+
function Ct(e, t, n) {
|
|
2159
|
+
let r = K(t === "x" ? e.gapX : e.gapY, n), i = t === "x" ? e.ruleX : e.ruleY;
|
|
2160
|
+
return Math.max(r, i?.width ?? 0);
|
|
1311
2161
|
}
|
|
1312
|
-
function
|
|
1313
|
-
|
|
2162
|
+
function K(e, t) {
|
|
2163
|
+
return typeof e == "number" ? e : t === void 0 || !Number.isFinite(t) ? 0 : m(e.percent, t);
|
|
2164
|
+
}
|
|
2165
|
+
function q(e, t) {
|
|
2166
|
+
let n = (e) => e === null ? null : K(e, t);
|
|
1314
2167
|
return {
|
|
1315
2168
|
top: n(e.top),
|
|
1316
2169
|
right: n(e.right),
|
|
@@ -1318,32 +2171,32 @@ function G(e, t) {
|
|
|
1318
2171
|
left: n(e.left)
|
|
1319
2172
|
};
|
|
1320
2173
|
}
|
|
1321
|
-
function
|
|
2174
|
+
function J(e) {
|
|
1322
2175
|
return typeof e == "number" ? e : 0;
|
|
1323
2176
|
}
|
|
1324
|
-
function
|
|
1325
|
-
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 :
|
|
2177
|
+
function Y(e, t) {
|
|
2178
|
+
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 : m(e.percent, t);
|
|
1326
2179
|
}
|
|
1327
|
-
function
|
|
1328
|
-
return e === "min-content" || e === "max-content" || e === "fit-content" ?
|
|
2180
|
+
function wt(e, t, n, r) {
|
|
2181
|
+
return e === "min-content" || e === "max-content" || e === "fit-content" ? X({ kind: e }, t, n, r) : Y(e, t);
|
|
1329
2182
|
}
|
|
1330
|
-
function
|
|
2183
|
+
function Tt(e, t, n, r, i, a) {
|
|
1331
2184
|
let o = r.left + i.left, s = r.top + i.top, c = s, l = null;
|
|
1332
2185
|
for (let r of e.children) {
|
|
1333
|
-
let e =
|
|
1334
|
-
if (
|
|
2186
|
+
let e = q(r.style.margin, t), i = e.top ?? 0, s = e.bottom ?? 0, u = e.left ?? 0, d = e.right ?? 0;
|
|
2187
|
+
if (U(r.style)) {
|
|
1335
2188
|
r.staticSlot = {
|
|
1336
2189
|
kind: "block",
|
|
1337
2190
|
x: o + u,
|
|
1338
|
-
y: c + (l === null ? i :
|
|
2191
|
+
y: c + (l === null ? i : Et(l, i))
|
|
1339
2192
|
};
|
|
1340
2193
|
continue;
|
|
1341
2194
|
}
|
|
1342
|
-
|
|
2195
|
+
W(r, Math.max(0, t - u - d), n, 0, 0, "fill", a);
|
|
1343
2196
|
let f = t - r.localRect.width, p = e.left === null && e.right === null, m = e.left === null && e.right !== null;
|
|
1344
2197
|
e.right === null && e.left;
|
|
1345
2198
|
let h;
|
|
1346
|
-
h = p ? Math.floor(f / 2) : m ? f - d : u, c += l === null ? i :
|
|
2199
|
+
h = p ? Math.floor(f / 2) : m ? f - d : u, c += l === null ? i : Et(l, i), r.localRect = {
|
|
1347
2200
|
...r.localRect,
|
|
1348
2201
|
x: o + h,
|
|
1349
2202
|
y: c
|
|
@@ -1351,184 +2204,171 @@ function Ve(e, t, n, r, i, a) {
|
|
|
1351
2204
|
}
|
|
1352
2205
|
return l !== null && (c += l), c - s;
|
|
1353
2206
|
}
|
|
1354
|
-
function
|
|
2207
|
+
function Et(e, t) {
|
|
1355
2208
|
return e >= 0 && t >= 0 ? Math.max(e, t) : e <= 0 && t <= 0 ? Math.min(e, t) : e + t;
|
|
1356
2209
|
}
|
|
1357
|
-
function
|
|
2210
|
+
function Dt(e, t, n, r, i) {
|
|
1358
2211
|
let a = e.width;
|
|
1359
|
-
|
|
2212
|
+
if (e.display === "table") {
|
|
2213
|
+
if (!r.children.some((e) => !U(e.style) && !e.inlineBox)) return a !== void 0 && a.kind !== "auto" ? X(a, t, r, i) : Math.min(t, Z(r, i));
|
|
2214
|
+
if (a !== void 0 && a.kind !== "auto") {
|
|
2215
|
+
let e = X(a, t, r, i);
|
|
2216
|
+
return Math.max(e, Ot(r, t, i));
|
|
2217
|
+
}
|
|
2218
|
+
return nt(r, t, i);
|
|
2219
|
+
}
|
|
2220
|
+
return a !== void 0 && a.kind !== "auto" ? X(a, t, r, i) : n === "shrink" ? Math.min(t, Z(r, i)) : t;
|
|
2221
|
+
}
|
|
2222
|
+
function Ot(e, t, n) {
|
|
2223
|
+
let r = e.style;
|
|
2224
|
+
return tt(e, n).min + r.border.left + r.border.right + K(r.padding.left, t) + K(r.padding.right, t);
|
|
1360
2225
|
}
|
|
1361
|
-
function
|
|
2226
|
+
function kt(e, t) {
|
|
1362
2227
|
if (e.height?.kind === "cells") return e.height.value;
|
|
1363
|
-
if (e.height?.kind === "percent" && t != null) return
|
|
2228
|
+
if (e.height?.kind === "percent" && t != null) return m(e.height.value, t);
|
|
1364
2229
|
}
|
|
1365
|
-
function
|
|
2230
|
+
function X(e, t, n, r) {
|
|
1366
2231
|
switch (e.kind) {
|
|
1367
2232
|
case "cells": return e.value;
|
|
1368
|
-
case "percent": return
|
|
1369
|
-
case "min-content": return
|
|
1370
|
-
case "max-content": return
|
|
1371
|
-
case "fit-content": return Math.min(
|
|
1372
|
-
case "auto": return
|
|
2233
|
+
case "percent": return m(e.value, t);
|
|
2234
|
+
case "min-content": return Q(n, r);
|
|
2235
|
+
case "max-content": return Z(n, r);
|
|
2236
|
+
case "fit-content": return Math.min(Z(n, r), Math.max(Q(n, r), t));
|
|
2237
|
+
case "auto": return Z(n, r);
|
|
1373
2238
|
}
|
|
1374
2239
|
}
|
|
1375
|
-
function
|
|
2240
|
+
function Z(e, t) {
|
|
1376
2241
|
let n = t.maxContent.get(e);
|
|
1377
2242
|
if (n !== void 0) return n;
|
|
1378
|
-
let r = e.style, i =
|
|
2243
|
+
let r = e.style, i = At(e, t) + r.border.left + r.border.right + J(r.padding.left) + J(r.padding.right);
|
|
1379
2244
|
return t.maxContent.set(e, i), i;
|
|
1380
2245
|
}
|
|
1381
|
-
function
|
|
1382
|
-
let n = e.children.filter((e) => !
|
|
2246
|
+
function At(e, t) {
|
|
2247
|
+
let n = e.children.filter((e) => !U(e.style) && !e.inlineBox);
|
|
1383
2248
|
if (n.length === 0) return e.intrinsicWidth;
|
|
1384
|
-
if (e.style.display === "grid") return
|
|
2249
|
+
if (e.style.display === "grid") return ge(e, t).max;
|
|
2250
|
+
if (e.style.display === "table") return tt(e, t).max;
|
|
1385
2251
|
if (e.style.display === "flex" && e.style.flexDirection === "row") {
|
|
1386
|
-
let r =
|
|
1387
|
-
return n.reduce((e, n) => e +
|
|
2252
|
+
let r = Math.max(J(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
2253
|
+
return n.reduce((e, n) => e + Z(n, t), 0) + r;
|
|
1388
2254
|
}
|
|
1389
|
-
return n.reduce((e, n) => Math.max(e,
|
|
2255
|
+
return n.reduce((e, n) => Math.max(e, Z(n, t)), 0);
|
|
1390
2256
|
}
|
|
1391
|
-
function
|
|
2257
|
+
function Q(e, t) {
|
|
1392
2258
|
let n = t.minContent.get(e);
|
|
1393
2259
|
if (n !== void 0) return n;
|
|
1394
|
-
let r = e.style, i =
|
|
2260
|
+
let r = e.style, i = jt(e, t) + r.border.left + r.border.right + J(r.padding.left) + J(r.padding.right);
|
|
1395
2261
|
return t.minContent.set(e, i), i;
|
|
1396
2262
|
}
|
|
1397
|
-
function
|
|
1398
|
-
let n = e.children.filter((e) => !
|
|
1399
|
-
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth :
|
|
2263
|
+
function jt(e, t) {
|
|
2264
|
+
let n = e.children.filter((e) => !U(e.style) && !e.inlineBox);
|
|
2265
|
+
if (n.length === 0) return !e.text || e.style.whiteSpace !== "normal" ? e.intrinsicWidth : C(e.text, {
|
|
1400
2266
|
advances: e.advances,
|
|
1401
2267
|
tracking: e.style.tracking
|
|
1402
2268
|
});
|
|
1403
|
-
if (e.style.display === "grid") return
|
|
2269
|
+
if (e.style.display === "grid") return ge(e, t).min;
|
|
2270
|
+
if (e.style.display === "table") return tt(e, t).min;
|
|
1404
2271
|
if (e.style.display === "flex" && e.style.flexDirection === "row" && e.style.flexWrap === "nowrap") {
|
|
1405
|
-
let r =
|
|
1406
|
-
return n.reduce((e, n) => e +
|
|
2272
|
+
let r = Math.max(J(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
2273
|
+
return n.reduce((e, n) => e + Q(n, t), 0) + r;
|
|
1407
2274
|
}
|
|
1408
|
-
return n.reduce((e, n) => Math.max(e,
|
|
2275
|
+
return n.reduce((e, n) => Math.max(e, Q(n, t)), 0);
|
|
1409
2276
|
}
|
|
1410
|
-
function
|
|
2277
|
+
function Mt(e, t, n, r) {
|
|
1411
2278
|
return {
|
|
1412
2279
|
width: Math.max(0, e - n.left - n.right - r.left - r.right),
|
|
1413
2280
|
height: Math.max(0, t - n.top - n.bottom - r.top - r.bottom)
|
|
1414
2281
|
};
|
|
1415
2282
|
}
|
|
1416
2283
|
//#endregion
|
|
1417
|
-
//#region src/
|
|
1418
|
-
function
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
};
|
|
1434
|
-
o.width <= 0 || o.height <= 0 || Ye(n, e.borderStyle, e.borderColor, o, i);
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1437
|
-
function Ye(e, t, n, r, i) {
|
|
1438
|
-
let a = Q(t.top), o = Q(t.right), s = Q(t.bottom), c = Q(t.left), l = (e, t, n) => n(Q(e === t ? e : "solid")), { x: u, y: d, width: f, height: p } = r, m = f >= 2 && p >= 2, h = u + +!!i.left, g = u + f - +!!i.right, _ = d + +!!i.top, v = d + p - +!!i.bottom;
|
|
1439
|
-
if (i.top && g > h && e.push({
|
|
1440
|
-
glyph: a.h,
|
|
1441
|
-
x: h,
|
|
1442
|
-
y: d,
|
|
1443
|
-
length: g - h,
|
|
1444
|
-
color: n.top
|
|
1445
|
-
}), i.bottom && p > +!!i.top && g > h && e.push({
|
|
1446
|
-
glyph: s.h,
|
|
1447
|
-
x: h,
|
|
1448
|
-
y: d + p - 1,
|
|
1449
|
-
length: g - h,
|
|
1450
|
-
color: n.bottom
|
|
1451
|
-
}), i.left) for (let t = _; t < v; t++) e.push({
|
|
1452
|
-
glyph: c.v,
|
|
1453
|
-
x: u,
|
|
1454
|
-
y: t,
|
|
1455
|
-
length: 1,
|
|
1456
|
-
color: n.left
|
|
1457
|
-
});
|
|
1458
|
-
if (i.right && f > +!!i.left) for (let t = _; t < v; t++) e.push({
|
|
1459
|
-
glyph: o.v,
|
|
1460
|
-
x: u + f - 1,
|
|
1461
|
-
y: t,
|
|
1462
|
-
length: 1,
|
|
1463
|
-
color: n.right
|
|
2284
|
+
//#region src/plain-text.ts
|
|
2285
|
+
function Nt(e) {
|
|
2286
|
+
return It(e).grid.map((e) => e.join("").trimEnd()).join("\n");
|
|
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;
|
|
1464
2300
|
});
|
|
1465
|
-
m && (i.top && i.left && e.push({
|
|
1466
|
-
glyph: l(t.top, t.left, (e) => e.tl),
|
|
1467
|
-
x: u,
|
|
1468
|
-
y: d,
|
|
1469
|
-
length: 1,
|
|
1470
|
-
color: n.top
|
|
1471
|
-
}), i.top && i.right && e.push({
|
|
1472
|
-
glyph: l(t.top, t.right, (e) => e.tr),
|
|
1473
|
-
x: u + f - 1,
|
|
1474
|
-
y: d,
|
|
1475
|
-
length: 1,
|
|
1476
|
-
color: n.top
|
|
1477
|
-
}), i.bottom && i.left && e.push({
|
|
1478
|
-
glyph: l(t.bottom, t.left, (e) => e.bl),
|
|
1479
|
-
x: u,
|
|
1480
|
-
y: d + p - 1,
|
|
1481
|
-
length: 1,
|
|
1482
|
-
color: n.bottom
|
|
1483
|
-
}), i.bottom && i.right && e.push({
|
|
1484
|
-
glyph: l(t.bottom, t.right, (e) => e.br),
|
|
1485
|
-
x: u + f - 1,
|
|
1486
|
-
y: d + p - 1,
|
|
1487
|
-
length: 1,
|
|
1488
|
-
color: n.bottom
|
|
1489
|
-
}));
|
|
1490
2301
|
}
|
|
1491
|
-
function
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
2302
|
+
function Ft(e, t) {
|
|
2303
|
+
return e.color === t?.color && e.fontWeight === t?.fontWeight && e.fontStyle === t?.fontStyle && e.textDecorationLine === t?.textDecorationLine;
|
|
2304
|
+
}
|
|
2305
|
+
function It(e) {
|
|
2306
|
+
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 Rt(e, 0, 0, (e, a, o, s) => {
|
|
2308
|
+
e >= 0 && e < t && a >= 0 && a < n && (r[a][e] = o, i[a][e] = s);
|
|
2309
|
+
}), {
|
|
2310
|
+
grid: r,
|
|
2311
|
+
paints: i
|
|
2312
|
+
};
|
|
2313
|
+
}
|
|
2314
|
+
function Lt(e) {
|
|
2315
|
+
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;
|
|
2317
|
+
}
|
|
2318
|
+
function Rt(t, n, r, a) {
|
|
2319
|
+
if (t.tableHidden) return;
|
|
2320
|
+
let o = n + t.localRect.x, s = r + t.localRect.y, c = t.style, l = [];
|
|
2321
|
+
e(c, {
|
|
2322
|
+
x: o,
|
|
2323
|
+
y: s,
|
|
2324
|
+
width: t.localRect.width,
|
|
2325
|
+
height: t.localRect.height
|
|
2326
|
+
}, l);
|
|
2327
|
+
for (let e of l) {
|
|
2328
|
+
let t = e.color === void 0 ? void 0 : { color: e.color };
|
|
2329
|
+
for (let n = 0; n < e.length; n++) a(e.x + n, e.y, e.glyph, t);
|
|
2330
|
+
}
|
|
2331
|
+
if (t.decorationRuns) for (let e of t.decorationRuns) {
|
|
2332
|
+
let t = e.color === void 0 ? void 0 : { color: e.color };
|
|
2333
|
+
for (let n = 0; n < e.length; n++) a(o + e.x + n, s + e.y, e.glyph, t);
|
|
2334
|
+
}
|
|
2335
|
+
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 } = St(t, i), d = Lt(c), f = t.inlineElements?.map((e) => Lt(e));
|
|
2337
|
+
for (let e = 0; e < l.length; e++) {
|
|
2338
|
+
let o = l[e], s = r + u[e], p = c.whiteSpace !== "normal" && c.overflow === "clip" ? zt(t.text, o, i, t.advances, c) : {
|
|
2339
|
+
end: o.end,
|
|
2340
|
+
ellipsis: !1
|
|
2341
|
+
}, m = x(o.start, o.end, t.advances, c.tracking), h = n + (c.textAlign === "end" ? Math.max(0, i - m) : 0);
|
|
2342
|
+
for (let e = o.start; e < p.end; e++) {
|
|
2343
|
+
if (t.text[e] !== "" && t.text[e] !== "") {
|
|
2344
|
+
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(h + o, s + c, t.text[e], r ? f[n] : d);
|
|
2346
|
+
}
|
|
2347
|
+
h += b(e, e + 1, t.advances);
|
|
2348
|
+
}
|
|
2349
|
+
p.ellipsis && a(h, s, "…", d);
|
|
2350
|
+
}
|
|
1525
2351
|
}
|
|
2352
|
+
for (let e of i(t)) Rt(e, o, s, a);
|
|
2353
|
+
}
|
|
2354
|
+
function zt(e, t, n, r, i) {
|
|
2355
|
+
let { textOverflow: a, tracking: o } = i;
|
|
2356
|
+
if (x(t.start, t.end, r, o) <= n) return {
|
|
2357
|
+
end: t.end,
|
|
2358
|
+
ellipsis: !1
|
|
2359
|
+
};
|
|
2360
|
+
let s = a === "ellipsis" ? n - 1 : n, c = t.start;
|
|
2361
|
+
for (; c < t.end && x(t.start, c + 1, r, o) <= s;) c++;
|
|
2362
|
+
return {
|
|
2363
|
+
end: c,
|
|
2364
|
+
ellipsis: a === "ellipsis" && n > 0
|
|
2365
|
+
};
|
|
1526
2366
|
}
|
|
1527
2367
|
//#endregion
|
|
1528
2368
|
//#region src/render.ts
|
|
1529
|
-
function
|
|
2369
|
+
function Bt(e, t) {
|
|
1530
2370
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
1531
|
-
|
|
2371
|
+
Vt(e, 0, 0, n, !0, r), Wt(t, n);
|
|
1532
2372
|
for (let t of Array.from(e.source.querySelectorAll("[data-mw-inline-inset]"))) if (!r.has(t)) {
|
|
1533
2373
|
t.removeAttribute("data-mw-inline-inset");
|
|
1534
2374
|
let e = t.style;
|
|
@@ -1540,109 +2380,144 @@ function Xe(e, t) {
|
|
|
1540
2380
|
]) e.removeProperty(t);
|
|
1541
2381
|
}
|
|
1542
2382
|
}
|
|
1543
|
-
function
|
|
1544
|
-
let
|
|
1545
|
-
if (
|
|
1546
|
-
let
|
|
1547
|
-
|
|
2383
|
+
function Vt(t, r, a, o, s, c) {
|
|
2384
|
+
let l = r + t.localRect.x, u = a + t.localRect.y;
|
|
2385
|
+
if (t.inlineElements) for (let { element: e, tracking: n, padLeft: r, padRight: i, insets: a } of t.inlineElements) {
|
|
2386
|
+
let t = e;
|
|
2387
|
+
t.style.setProperty("--mw-ls", String(n)), r > 0 ? t.style.setProperty("--mw-ipl", String(r)) : t.style.removeProperty("--mw-ipl"), i > 0 ? t.style.setProperty("--mw-ipr", String(i)) : t.style.removeProperty("--mw-ipr"), a && (c.add(e), Ht(t, a));
|
|
2388
|
+
}
|
|
2389
|
+
if (s || Ut(t), !t.tableHidden) {
|
|
2390
|
+
if (e(t.style, {
|
|
2391
|
+
x: l,
|
|
2392
|
+
y: u,
|
|
2393
|
+
width: t.localRect.width,
|
|
2394
|
+
height: t.localRect.height
|
|
2395
|
+
}, o), t.decorationRuns) for (let e of t.decorationRuns) o.push({
|
|
2396
|
+
...e,
|
|
2397
|
+
x: l + e.x,
|
|
2398
|
+
y: u + e.y
|
|
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
|
+
}
|
|
1548
2404
|
}
|
|
1549
|
-
i || $e(e), Je(e.style, {
|
|
1550
|
-
x: o,
|
|
1551
|
-
y: s,
|
|
1552
|
-
width: e.localRect.width,
|
|
1553
|
-
height: e.localRect.height
|
|
1554
|
-
}, r);
|
|
1555
|
-
for (let t of e.children) Ze(t, o, s, r, !1, a);
|
|
1556
2405
|
}
|
|
1557
|
-
function
|
|
2406
|
+
function Ht(e, t) {
|
|
1558
2407
|
e.setAttribute("data-mw-inline-inset", "");
|
|
1559
2408
|
let n = (t, n) => {
|
|
1560
2409
|
n === null ? e.style.removeProperty(t) : e.style.setProperty(t, String(n));
|
|
1561
2410
|
};
|
|
1562
2411
|
n("--mw-it", t.top), n("--mw-ir", t.right), n("--mw-ib", t.bottom), n("--mw-il", t.left);
|
|
1563
2412
|
}
|
|
1564
|
-
function
|
|
2413
|
+
function Ut(e) {
|
|
1565
2414
|
let t = e.source, n = e.localRect, r = e.resolvedPadding, { border: i, textAlignBlocked: a, overflow: o, whiteSpace: s, tracking: c, lineGap: l } = e.style;
|
|
1566
|
-
t.setAttribute(e.inlineBox ? "data-mw-inline-box" : "data-mw-laid-out", ""), t.removeAttribute(e.inlineBox ? "data-mw-laid-out" : "data-mw-inline-box"), t.style.setProperty("--mw-ls", String(c)), t.style.setProperty("--mw-lh", String(l + 1)), t.style.setProperty("--mw-lhs", String(-l / 2)), s === "normal" ? t.removeAttribute("data-mw-nowrap") : t.setAttribute("data-mw-nowrap", ""), s === "pre" ? t.setAttribute("data-mw-pre", "") : t.removeAttribute("data-mw-pre"), t.style.setProperty("--mw-x", String(n.x)), t.style.setProperty("--mw-y", String(n.y)), t.style.setProperty("--mw-w", String(n.width)), t.style.setProperty("--mw-h", String(n.height)), o === "clip" ? t.setAttribute("data-mw-clip", "") : t.removeAttribute("data-mw-clip"), t.style.setProperty("--mw-pt", String(r.top)), t.style.setProperty("--mw-pr", String(r.right)), t.style.setProperty("--mw-pb", String(r.bottom)), t.style.setProperty("--mw-pl", String(r.left)), t.style.setProperty("--mw-bt", String(i.top)), t.style.setProperty("--mw-br", String(i.right)), t.style.setProperty("--mw-bb", String(i.bottom)), t.style.setProperty("--mw-bl", String(i.left)), a ? t.setAttribute("data-mw-text-align-blocked", "") : t.removeAttribute("data-mw-text-align-blocked"), e.droppedText ? t.setAttribute("data-mw-dropped-text", "") : t.removeAttribute("data-mw-dropped-text");
|
|
2415
|
+
t.setAttribute(e.inlineBox ? "data-mw-inline-box" : "data-mw-laid-out", ""), t.removeAttribute(e.inlineBox ? "data-mw-laid-out" : "data-mw-inline-box"), e.inlineBox && e.style.verticalAlign === "end" ? t.setAttribute("data-mw-vbottom", "") : t.removeAttribute("data-mw-vbottom"), t.style.setProperty("--mw-ls", String(c)), t.style.setProperty("--mw-lh", String(l + 1)), t.style.setProperty("--mw-lhs", String(-l / 2)), s === "normal" ? t.removeAttribute("data-mw-nowrap") : t.setAttribute("data-mw-nowrap", ""), s === "pre" ? t.setAttribute("data-mw-pre", "") : t.removeAttribute("data-mw-pre"), t.style.setProperty("--mw-x", String(n.x)), t.style.setProperty("--mw-y", String(n.y)), t.style.setProperty("--mw-w", String(n.width)), t.style.setProperty("--mw-h", String(n.height)), o === "clip" ? t.setAttribute("data-mw-clip", "") : t.removeAttribute("data-mw-clip"), t.style.setProperty("--mw-pt", String(r.top)), t.style.setProperty("--mw-pr", String(r.right)), t.style.setProperty("--mw-pb", String(r.bottom)), t.style.setProperty("--mw-pl", String(r.left)), t.style.setProperty("--mw-bt", String(i.top)), t.style.setProperty("--mw-br", String(i.right)), t.style.setProperty("--mw-bb", String(i.bottom)), t.style.setProperty("--mw-bl", String(i.left)), a ? t.setAttribute("data-mw-text-align-blocked", "") : t.removeAttribute("data-mw-text-align-blocked"), e.droppedText ? t.setAttribute("data-mw-dropped-text", "") : t.removeAttribute("data-mw-dropped-text"), e.tableHidden ? t.setAttribute("data-mw-table-hidden", "") : t.removeAttribute("data-mw-table-hidden");
|
|
1567
2416
|
}
|
|
1568
|
-
function
|
|
2417
|
+
function Wt(e, t) {
|
|
1569
2418
|
e.replaceChildren();
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
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);
|
|
1573
2431
|
}
|
|
1574
2432
|
}
|
|
1575
2433
|
//#endregion
|
|
1576
2434
|
//#region src/style.ts
|
|
1577
|
-
function
|
|
1578
|
-
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a =
|
|
2435
|
+
function Gt(e, t, n) {
|
|
2436
|
+
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a = en(e) ? e.computedStyleMap() : null, o = e.getAttribute("class") ?? "", s = e.style;
|
|
2437
|
+
Zt(e, o, s);
|
|
2438
|
+
let c = r.display || Jt[e.tagName] || "", l = Yt[c] ?? "none", u = c === "flex" || c === "inline-flex" ? "flex" : c === "grid" || c === "inline-grid" ? "grid" : c === "table" || c === "inline-table" ? "table" : c === "none" ? "none" : "block", d = { kind: "none" }, f = { kind: "none" }, m = [z()], h = [z()], g = {
|
|
1579
2439
|
direction: "row",
|
|
1580
2440
|
dense: !1
|
|
1581
|
-
},
|
|
1582
|
-
if (
|
|
1583
|
-
if (a)
|
|
2441
|
+
}, _ = null;
|
|
2442
|
+
if (u === "grid") {
|
|
2443
|
+
if (a) d = hn(a.get("grid-template-columns")?.toString() ?? "", t), f = hn(a.get("grid-template-rows")?.toString() ?? "", t);
|
|
1584
2444
|
else {
|
|
1585
2445
|
e.setAttribute("data-mw-degrid", "");
|
|
1586
2446
|
try {
|
|
1587
|
-
|
|
2447
|
+
d = hn(r.getPropertyValue("grid-template-columns"), t), f = hn(r.getPropertyValue("grid-template-rows"), t);
|
|
1588
2448
|
} finally {
|
|
1589
2449
|
e.removeAttribute("data-mw-degrid");
|
|
1590
2450
|
}
|
|
1591
2451
|
}
|
|
1592
|
-
|
|
1593
|
-
}
|
|
1594
|
-
|
|
1595
|
-
|
|
2452
|
+
m = yn(r.getPropertyValue("grid-auto-columns"), t), h = yn(r.getPropertyValue("grid-auto-rows"), t), g = Tn(r.getPropertyValue("grid-auto-flow")), _ = vn(r.getPropertyValue("grid-template-areas"));
|
|
2453
|
+
}
|
|
2454
|
+
let v = "auto", y = !1, b = 0, x = 0;
|
|
2455
|
+
if (u === "table" && (v = r.tableLayout === "fixed" ? "fixed" : "auto", y = r.borderCollapse === "collapse", !y)) {
|
|
2456
|
+
let e = r.borderSpacing.split(" ");
|
|
2457
|
+
b = p(parseFloat(e[0] ?? "") || 0, t), x = p(parseFloat(e[1] ?? e[0] ?? "") || 0, t);
|
|
2458
|
+
}
|
|
2459
|
+
let S = {
|
|
2460
|
+
display: u,
|
|
2461
|
+
tableRole: l,
|
|
2462
|
+
tableLayout: v,
|
|
2463
|
+
borderCollapse: y,
|
|
2464
|
+
borderSpacingX: b,
|
|
2465
|
+
borderSpacingY: x,
|
|
2466
|
+
captionSide: r.captionSide === "bottom" ? "bottom" : "top",
|
|
2467
|
+
verticalAlign: l === "cell" || c.startsWith("inline-") ? Xt(e, r) : "start",
|
|
1596
2468
|
flexDirection: r.flexDirection.startsWith("column") ? "column" : "row",
|
|
1597
2469
|
flexReverse: r.flexDirection.endsWith("-reverse"),
|
|
1598
2470
|
flexWrap: r.flexWrap.startsWith("wrap") ? "wrap" : "nowrap",
|
|
1599
2471
|
wrapReverse: r.flexWrap === "wrap-reverse",
|
|
1600
2472
|
flexGrow: Number(r.flexGrow) || 0,
|
|
1601
2473
|
flexShrink: r.flexShrink === "" ? 1 : Number(r.flexShrink) || 0,
|
|
1602
|
-
flexBasis:
|
|
2474
|
+
flexBasis: pn(r.flexBasis, t),
|
|
1603
2475
|
order: Number(r.order) || 0,
|
|
1604
|
-
justifyContent:
|
|
1605
|
-
alignContent:
|
|
1606
|
-
alignItems:
|
|
1607
|
-
alignSelf:
|
|
1608
|
-
justifyItems:
|
|
1609
|
-
justifySelf:
|
|
1610
|
-
gridTemplateColumns:
|
|
1611
|
-
gridTemplateRows:
|
|
1612
|
-
gridAutoColumns:
|
|
1613
|
-
gridAutoRows:
|
|
1614
|
-
gridAutoFlow:
|
|
1615
|
-
gridTemplateAreas:
|
|
1616
|
-
gridColumnStart:
|
|
1617
|
-
gridColumnEnd:
|
|
1618
|
-
gridRowStart:
|
|
1619
|
-
gridRowEnd:
|
|
1620
|
-
width:
|
|
1621
|
-
height:
|
|
1622
|
-
minWidth:
|
|
1623
|
-
minHeight:
|
|
1624
|
-
maxWidth:
|
|
1625
|
-
maxHeight:
|
|
1626
|
-
padding:
|
|
1627
|
-
margin:
|
|
1628
|
-
position:
|
|
1629
|
-
insets:
|
|
2476
|
+
justifyContent: tn(r.justifyContent),
|
|
2477
|
+
alignContent: tn(r.alignContent),
|
|
2478
|
+
alignItems: nn(r.alignItems),
|
|
2479
|
+
alignSelf: rn(r.alignSelf),
|
|
2480
|
+
justifyItems: nn(r.justifyItems),
|
|
2481
|
+
justifySelf: rn(r.justifySelf),
|
|
2482
|
+
gridTemplateColumns: d,
|
|
2483
|
+
gridTemplateRows: f,
|
|
2484
|
+
gridAutoColumns: m,
|
|
2485
|
+
gridAutoRows: h,
|
|
2486
|
+
gridAutoFlow: g,
|
|
2487
|
+
gridTemplateAreas: _,
|
|
2488
|
+
gridColumnStart: wn(r.getPropertyValue("grid-column-start")),
|
|
2489
|
+
gridColumnEnd: wn(r.getPropertyValue("grid-column-end")),
|
|
2490
|
+
gridRowStart: wn(r.getPropertyValue("grid-row-start")),
|
|
2491
|
+
gridRowEnd: wn(r.getPropertyValue("grid-row-end")),
|
|
2492
|
+
width: fn(a, r.width, "width", t, o, s),
|
|
2493
|
+
height: fn(a, r.height, "height", t, o, s),
|
|
2494
|
+
minWidth: dn(r.minWidth, t) ?? "auto",
|
|
2495
|
+
minHeight: dn(r.minHeight, t) ?? "auto",
|
|
2496
|
+
maxWidth: dn(r.maxWidth, t),
|
|
2497
|
+
maxHeight: dn(r.maxHeight, t),
|
|
2498
|
+
padding: Dn(r, t),
|
|
2499
|
+
margin: an(r, a, o, s, t),
|
|
2500
|
+
position: cn(r.position),
|
|
2501
|
+
insets: ln(r, a, o, s, t),
|
|
1630
2502
|
gapX: $(r.columnGap === "normal" ? "0px" : r.columnGap, t),
|
|
1631
2503
|
gapY: $(r.rowGap === "normal" ? "0px" : r.rowGap, t),
|
|
1632
|
-
border:
|
|
2504
|
+
border: On(r),
|
|
1633
2505
|
borderStyle: {
|
|
1634
|
-
top:
|
|
1635
|
-
right:
|
|
1636
|
-
bottom:
|
|
1637
|
-
left:
|
|
2506
|
+
top: un(r.borderTopStyle),
|
|
2507
|
+
right: un(r.borderRightStyle),
|
|
2508
|
+
bottom: un(r.borderBottomStyle),
|
|
2509
|
+
left: un(r.borderLeftStyle)
|
|
1638
2510
|
},
|
|
1639
|
-
overflow:
|
|
2511
|
+
overflow: qt(r.overflow) || qt(r.overflowX) || qt(r.overflowY) ? "clip" : "visible",
|
|
1640
2512
|
whiteSpace: r.whiteSpace === "pre" ? "pre" : r.whiteSpace === "nowrap" ? "nowrap" : "normal",
|
|
1641
2513
|
tabSize: Math.max(1, Math.floor(parseFloat(r.tabSize)) || 8),
|
|
1642
|
-
lineGap:
|
|
1643
|
-
tracking:
|
|
2514
|
+
lineGap: sn(r.lineHeight, n?.height ?? i),
|
|
2515
|
+
tracking: on(r.letterSpacing, i, n?.letterSpacing ?? 0),
|
|
1644
2516
|
textOverflow: r.textOverflow === "ellipsis" ? "ellipsis" : "clip",
|
|
1645
2517
|
color: r.color,
|
|
2518
|
+
fontWeight: r.fontWeight,
|
|
2519
|
+
fontStyle: r.fontStyle,
|
|
2520
|
+
textDecorationLine: r.textDecorationLine,
|
|
1646
2521
|
backgroundColor: r.backgroundColor === "rgba(0, 0, 0, 0)" ? void 0 : r.backgroundColor,
|
|
1647
2522
|
borderColor: {
|
|
1648
2523
|
top: r.borderTopColor,
|
|
@@ -1650,21 +2525,78 @@ function tt(e, t, n) {
|
|
|
1650
2525
|
bottom: r.borderBottomColor,
|
|
1651
2526
|
left: r.borderLeftColor
|
|
1652
2527
|
},
|
|
1653
|
-
textAlignBlocked:
|
|
2528
|
+
textAlignBlocked: $t(e, r),
|
|
2529
|
+
textAlign: r.textAlign === "right" || r.textAlign === "end" ? "end" : "start",
|
|
2530
|
+
zIndex: r.zIndex === "auto" || r.zIndex === "" ? null : Number(r.zIndex) || 0,
|
|
2531
|
+
latticeBorder: null,
|
|
2532
|
+
ruleX: u === "flex" || u === "grid" ? Qt(r, "x") : null,
|
|
2533
|
+
ruleY: u === "flex" || u === "grid" ? Qt(r, "y") : null
|
|
1654
2534
|
};
|
|
2535
|
+
return Kt(S, r), S;
|
|
2536
|
+
}
|
|
2537
|
+
function Kt(e, t) {
|
|
2538
|
+
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
|
+
width: e.border,
|
|
2540
|
+
style: e.borderStyle,
|
|
2541
|
+
color: e.borderColor,
|
|
2542
|
+
hidden: {
|
|
2543
|
+
top: t.borderTopStyle === "hidden",
|
|
2544
|
+
right: t.borderRightStyle === "hidden",
|
|
2545
|
+
bottom: t.borderBottomStyle === "hidden",
|
|
2546
|
+
left: t.borderLeftStyle === "hidden"
|
|
2547
|
+
}
|
|
2548
|
+
}, e.border = R(), e.display === "table" && (e.padding = R()));
|
|
1655
2549
|
}
|
|
1656
|
-
function
|
|
2550
|
+
function qt(e) {
|
|
1657
2551
|
return e === "hidden" || e === "clip";
|
|
1658
2552
|
}
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
2553
|
+
var Jt = {
|
|
2554
|
+
TABLE: "table",
|
|
2555
|
+
THEAD: "table-header-group",
|
|
2556
|
+
TBODY: "table-row-group",
|
|
2557
|
+
TFOOT: "table-footer-group",
|
|
2558
|
+
TR: "table-row",
|
|
2559
|
+
TD: "table-cell",
|
|
2560
|
+
TH: "table-cell",
|
|
2561
|
+
CAPTION: "table-caption",
|
|
2562
|
+
COL: "table-column",
|
|
2563
|
+
COLGROUP: "table-column-group"
|
|
2564
|
+
}, Yt = {
|
|
2565
|
+
"table-header-group": "header-group",
|
|
2566
|
+
"table-row-group": "row-group",
|
|
2567
|
+
"table-footer-group": "footer-group",
|
|
2568
|
+
"table-row": "row",
|
|
2569
|
+
"table-cell": "cell",
|
|
2570
|
+
"table-caption": "caption",
|
|
2571
|
+
"table-column": "column",
|
|
2572
|
+
"table-column-group": "column-group"
|
|
2573
|
+
};
|
|
2574
|
+
function Xt(e, t) {
|
|
2575
|
+
let n = t.verticalAlign || e.getAttribute("valign")?.toLowerCase() || (e.tagName === "TD" || e.tagName === "TH" ? "middle" : "baseline");
|
|
2576
|
+
return n === "top" ? "start" : n === "middle" ? "center" : n === "bottom" ? "end" : "start";
|
|
2577
|
+
}
|
|
2578
|
+
function Zt(e, t, n) {
|
|
2579
|
+
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") && V(e, "font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.");
|
|
2580
|
+
}
|
|
2581
|
+
function Qt(e, t) {
|
|
2582
|
+
let n = f(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`)) || 0);
|
|
2583
|
+
if (n <= 0) return null;
|
|
2584
|
+
let r = e.getPropertyValue(`--mw-rule-${t}-color`).trim();
|
|
2585
|
+
return {
|
|
2586
|
+
width: n,
|
|
2587
|
+
style: un(e.getPropertyValue(`--mw-rule-${t}-style`).trim()),
|
|
2588
|
+
color: r && r !== "currentcolor" && r !== "currentColor" ? r : e.color
|
|
2589
|
+
};
|
|
2590
|
+
}
|
|
2591
|
+
function $t(e, t) {
|
|
2592
|
+
if (/center|justify/.test(t.textAlign)) return !0;
|
|
2593
|
+
let n = e.getAttribute("align")?.toLowerCase();
|
|
1662
2594
|
return n === "center" || n === "justify";
|
|
1663
2595
|
}
|
|
1664
|
-
function
|
|
2596
|
+
function en(e) {
|
|
1665
2597
|
return typeof e.computedStyleMap == "function";
|
|
1666
2598
|
}
|
|
1667
|
-
function
|
|
2599
|
+
function tn(e) {
|
|
1668
2600
|
switch (e) {
|
|
1669
2601
|
case "center": return "center";
|
|
1670
2602
|
case "flex-end":
|
|
@@ -1679,7 +2611,7 @@ function at(e) {
|
|
|
1679
2611
|
default: return "start";
|
|
1680
2612
|
}
|
|
1681
2613
|
}
|
|
1682
|
-
function
|
|
2614
|
+
function nn(e) {
|
|
1683
2615
|
switch (e) {
|
|
1684
2616
|
case "center": return "center";
|
|
1685
2617
|
case "flex-end":
|
|
@@ -1690,43 +2622,43 @@ function ot(e) {
|
|
|
1690
2622
|
default: return "start";
|
|
1691
2623
|
}
|
|
1692
2624
|
}
|
|
1693
|
-
function
|
|
1694
|
-
return e === "auto" || e === "" || e === "normal" ? "auto" :
|
|
2625
|
+
function rn(e) {
|
|
2626
|
+
return e === "auto" || e === "" || e === "normal" ? "auto" : nn(e);
|
|
1695
2627
|
}
|
|
1696
|
-
function
|
|
1697
|
-
let
|
|
2628
|
+
function an(e, t, n, r, i) {
|
|
2629
|
+
let a = (a, o, s) => {
|
|
1698
2630
|
if (t) {
|
|
1699
|
-
let e = t.get(
|
|
1700
|
-
if (e === "auto" || t.get(
|
|
2631
|
+
let e = t.get(a)?.toString().trim();
|
|
2632
|
+
if (e === "auto" || t.get(o)?.toString().trim() === "auto") return null;
|
|
1701
2633
|
if (e?.endsWith("%")) {
|
|
1702
2634
|
let t = parseFloat(e);
|
|
1703
2635
|
if (Number.isFinite(t) && t !== 0) return { percent: t };
|
|
1704
2636
|
}
|
|
1705
|
-
} else if (
|
|
1706
|
-
let
|
|
1707
|
-
if (
|
|
1708
|
-
let
|
|
1709
|
-
if (
|
|
1710
|
-
let
|
|
1711
|
-
return
|
|
2637
|
+
} else if (s.test(n) || r.getPropertyValue(a) === "auto") return null;
|
|
2638
|
+
let c = e.getPropertyValue(a);
|
|
2639
|
+
if (c === "auto") return null;
|
|
2640
|
+
let l = $(c, i);
|
|
2641
|
+
if (l !== 0) return l;
|
|
2642
|
+
let u = e.getPropertyValue(o);
|
|
2643
|
+
return u === "auto" ? null : $(u, i);
|
|
1712
2644
|
};
|
|
1713
2645
|
return {
|
|
1714
|
-
top:
|
|
1715
|
-
right:
|
|
1716
|
-
bottom:
|
|
1717
|
-
left:
|
|
2646
|
+
top: a("margin-top", "margin-block-start", /(?:^|[\s:.[!])(?:m|my|mt)-auto\b/),
|
|
2647
|
+
right: a("margin-right", "margin-inline-end", /(?:^|[\s:.[!])(?:m|mx|mr|me)-auto\b/),
|
|
2648
|
+
bottom: a("margin-bottom", "margin-block-end", /(?:^|[\s:.[!])(?:m|my|mb)-auto\b/),
|
|
2649
|
+
left: a("margin-left", "margin-inline-start", /(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)
|
|
1718
2650
|
};
|
|
1719
2651
|
}
|
|
1720
|
-
function
|
|
2652
|
+
function on(e, t, n) {
|
|
1721
2653
|
let r = (e === "normal" ? 0 : parseFloat(e) || 0) - n;
|
|
1722
2654
|
return r <= 0 ? 0 : Math.floor(r / (.025 * t) + 1e-6);
|
|
1723
2655
|
}
|
|
1724
|
-
function
|
|
2656
|
+
function sn(e, t) {
|
|
1725
2657
|
if (!e || e === "normal" || t <= 0) return 0;
|
|
1726
2658
|
let n = parseFloat(e);
|
|
1727
2659
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n / t + 1e-6) - 1) : 0;
|
|
1728
2660
|
}
|
|
1729
|
-
function
|
|
2661
|
+
function cn(e) {
|
|
1730
2662
|
switch (e) {
|
|
1731
2663
|
case "relative":
|
|
1732
2664
|
case "absolute":
|
|
@@ -1735,7 +2667,7 @@ function dt(e) {
|
|
|
1735
2667
|
default: return "static";
|
|
1736
2668
|
}
|
|
1737
2669
|
}
|
|
1738
|
-
function
|
|
2670
|
+
function ln(e, t, n, r, i) {
|
|
1739
2671
|
let a = (a, o) => {
|
|
1740
2672
|
if (t) {
|
|
1741
2673
|
let e = t.get(a)?.toString().trim();
|
|
@@ -1754,7 +2686,7 @@ function ft(e, t, n, r, i) {
|
|
|
1754
2686
|
left: a("left", /(?:^|[\s:.[!])-?(?:left|start|inset|inset-x)-/)
|
|
1755
2687
|
};
|
|
1756
2688
|
}
|
|
1757
|
-
function
|
|
2689
|
+
function un(e) {
|
|
1758
2690
|
switch (e) {
|
|
1759
2691
|
case "double": return "double";
|
|
1760
2692
|
case "dashed": return "dashed";
|
|
@@ -1762,80 +2694,94 @@ function pt(e) {
|
|
|
1762
2694
|
default: return "solid";
|
|
1763
2695
|
}
|
|
1764
2696
|
}
|
|
1765
|
-
function
|
|
2697
|
+
function dn(e, t) {
|
|
1766
2698
|
if (!e || e === "none" || e === "auto") return;
|
|
1767
2699
|
if (e === "min-content" || e === "max-content" || e === "fit-content") return e;
|
|
1768
2700
|
if (e.endsWith("%")) {
|
|
1769
2701
|
let t = parseFloat(e);
|
|
1770
2702
|
return Number.isFinite(t) ? { percent: t } : void 0;
|
|
1771
2703
|
}
|
|
1772
|
-
let
|
|
1773
|
-
return Number.isFinite(
|
|
2704
|
+
let n = parseFloat(e);
|
|
2705
|
+
return Number.isFinite(n) ? p(n, t) : void 0;
|
|
1774
2706
|
}
|
|
1775
|
-
function $(e,
|
|
2707
|
+
function $(e, t) {
|
|
1776
2708
|
if (!e || e === "auto" || e === "none") return 0;
|
|
1777
2709
|
if (e.endsWith("%")) {
|
|
1778
2710
|
let t = parseFloat(e);
|
|
1779
2711
|
return Number.isFinite(t) && t !== 0 ? { percent: t } : 0;
|
|
1780
2712
|
}
|
|
1781
|
-
let
|
|
1782
|
-
return Number.isFinite(
|
|
1783
|
-
}
|
|
1784
|
-
function
|
|
1785
|
-
if (
|
|
1786
|
-
let
|
|
1787
|
-
if (
|
|
1788
|
-
let
|
|
1789
|
-
if (
|
|
1790
|
-
let
|
|
1791
|
-
if (
|
|
1792
|
-
if (
|
|
2713
|
+
let n = parseFloat(e);
|
|
2714
|
+
return Number.isFinite(n) ? p(n, t) : 0;
|
|
2715
|
+
}
|
|
2716
|
+
function fn(e, t, n, r, i, a) {
|
|
2717
|
+
if (e) {
|
|
2718
|
+
let t = e.get(n);
|
|
2719
|
+
if (t == null) return;
|
|
2720
|
+
let i = t.toString().trim();
|
|
2721
|
+
if (i === "auto") return { kind: "auto" };
|
|
2722
|
+
let a = mn(i);
|
|
2723
|
+
if (a) return a;
|
|
2724
|
+
if (i.endsWith("%")) return {
|
|
1793
2725
|
kind: "percent",
|
|
1794
|
-
value: parseFloat(
|
|
2726
|
+
value: parseFloat(i)
|
|
1795
2727
|
};
|
|
1796
|
-
if (
|
|
2728
|
+
if (i.endsWith("px")) return {
|
|
1797
2729
|
kind: "cells",
|
|
1798
|
-
value:
|
|
2730
|
+
value: p(parseFloat(i), r)
|
|
1799
2731
|
};
|
|
1800
|
-
if (
|
|
2732
|
+
if (i.endsWith("rem")) return {
|
|
1801
2733
|
kind: "cells",
|
|
1802
|
-
value:
|
|
2734
|
+
value: f(parseFloat(i) / .25)
|
|
1803
2735
|
};
|
|
1804
2736
|
}
|
|
1805
|
-
let
|
|
1806
|
-
if (
|
|
1807
|
-
if (
|
|
1808
|
-
let e =
|
|
2737
|
+
let o = n === "width" ? a.width : a.height;
|
|
2738
|
+
if (o) {
|
|
2739
|
+
if (o === "auto") return { kind: "auto" };
|
|
2740
|
+
let e = mn(o);
|
|
1809
2741
|
if (e) return e;
|
|
1810
|
-
if (
|
|
2742
|
+
if (o.endsWith("%")) return {
|
|
1811
2743
|
kind: "percent",
|
|
1812
|
-
value: parseFloat(
|
|
2744
|
+
value: parseFloat(o)
|
|
1813
2745
|
};
|
|
1814
|
-
let
|
|
1815
|
-
if (Number.isFinite(
|
|
2746
|
+
let t = parseFloat(o);
|
|
2747
|
+
if (Number.isFinite(t)) return {
|
|
1816
2748
|
kind: "cells",
|
|
1817
|
-
value: t
|
|
2749
|
+
value: p(t, r)
|
|
1818
2750
|
};
|
|
1819
2751
|
}
|
|
1820
|
-
let
|
|
1821
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
1822
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
1823
|
-
if (RegExp(`(?:^|[\\s:.[!])${
|
|
1824
|
-
|
|
1825
|
-
if (
|
|
2752
|
+
let s = n === "width" ? "w" : "h";
|
|
2753
|
+
if (RegExp(`(?:^|[\\s:.[!])${s}-min\\b`).test(i)) return { kind: "min-content" };
|
|
2754
|
+
if (RegExp(`(?:^|[\\s:.[!])${s}-max\\b`).test(i)) return { kind: "max-content" };
|
|
2755
|
+
if (RegExp(`(?:^|[\\s:.[!])${s}-fit\\b`).test(i)) return { kind: "fit-content" };
|
|
2756
|
+
let c = RegExp(`(?:^|[\\s:.[!])${s}-(\\d+)/(\\d+)(?![\\w./])`).exec(i);
|
|
2757
|
+
if (c) return {
|
|
1826
2758
|
kind: "percent",
|
|
1827
|
-
value:
|
|
2759
|
+
value: 100 * Number(c[1]) / Number(c[2])
|
|
1828
2760
|
};
|
|
1829
|
-
|
|
2761
|
+
if (RegExp(`(?:^|[\\s:.[!])${s}-full(?![\\w-])`).test(i)) return {
|
|
2762
|
+
kind: "percent",
|
|
2763
|
+
value: 100
|
|
2764
|
+
};
|
|
2765
|
+
let l = RegExp(`(?:^|[\\s:.[!])${s}-\\[(\\d+(?:\\.\\d+)?)%\\]`).exec(i);
|
|
2766
|
+
if (l) return {
|
|
2767
|
+
kind: "percent",
|
|
2768
|
+
value: Number(l[1])
|
|
2769
|
+
};
|
|
2770
|
+
if (!En(i, s) || t === "auto") return { kind: "auto" };
|
|
2771
|
+
if (t.endsWith("%")) return {
|
|
2772
|
+
kind: "percent",
|
|
2773
|
+
value: parseFloat(t)
|
|
2774
|
+
};
|
|
2775
|
+
let u = parseFloat(t);
|
|
1830
2776
|
if (Number.isFinite(u)) return {
|
|
1831
2777
|
kind: "cells",
|
|
1832
|
-
value:
|
|
2778
|
+
value: p(u, r)
|
|
1833
2779
|
};
|
|
1834
2780
|
}
|
|
1835
|
-
function
|
|
2781
|
+
function pn(e, t) {
|
|
1836
2782
|
if (!e || e === "auto" || e === "content") return;
|
|
1837
|
-
let
|
|
1838
|
-
if (
|
|
2783
|
+
let n = mn(e);
|
|
2784
|
+
if (n) return n;
|
|
1839
2785
|
if (e.endsWith("%")) {
|
|
1840
2786
|
let t = parseFloat(e);
|
|
1841
2787
|
return Number.isFinite(t) ? {
|
|
@@ -1843,33 +2789,33 @@ function gt(e, n) {
|
|
|
1843
2789
|
value: t
|
|
1844
2790
|
} : void 0;
|
|
1845
2791
|
}
|
|
1846
|
-
let
|
|
1847
|
-
return Number.isFinite(
|
|
2792
|
+
let r = parseFloat(e);
|
|
2793
|
+
return Number.isFinite(r) ? {
|
|
1848
2794
|
kind: "cells",
|
|
1849
|
-
value:
|
|
2795
|
+
value: p(r, t)
|
|
1850
2796
|
} : void 0;
|
|
1851
2797
|
}
|
|
1852
|
-
function
|
|
2798
|
+
function mn(e) {
|
|
1853
2799
|
if (e === "min-content") return { kind: "min-content" };
|
|
1854
2800
|
if (e === "max-content") return { kind: "max-content" };
|
|
1855
2801
|
if (e === "fit-content") return { kind: "fit-content" };
|
|
1856
2802
|
}
|
|
1857
|
-
function
|
|
2803
|
+
function hn(e, t) {
|
|
1858
2804
|
let n = e.trim();
|
|
1859
2805
|
if (!n || n === "none") return { kind: "none" };
|
|
1860
2806
|
if (n === "subgrid" || n.startsWith("subgrid ")) return { kind: "subgrid" };
|
|
1861
2807
|
let r = [], i = [], a = [], o = (e) => {
|
|
1862
2808
|
i.push(a), a = [], r.push(e);
|
|
1863
2809
|
}, s;
|
|
1864
|
-
for (let e of
|
|
1865
|
-
let n =
|
|
2810
|
+
for (let e of Cn(n)) {
|
|
2811
|
+
let n = _n(e);
|
|
1866
2812
|
if (n) {
|
|
1867
2813
|
a.push(...n);
|
|
1868
2814
|
continue;
|
|
1869
2815
|
}
|
|
1870
2816
|
let i = e.match(/^repeat\(\s*([^,]+?)\s*,(.*)\)$/s);
|
|
1871
2817
|
if (i) {
|
|
1872
|
-
let e =
|
|
2818
|
+
let e = gn(i[2].trim(), t);
|
|
1873
2819
|
if (e.tracks.length === 0) continue;
|
|
1874
2820
|
let n = i[1];
|
|
1875
2821
|
if (n === "auto-fill" || n === "auto-fit") {
|
|
@@ -1887,7 +2833,7 @@ function vt(e, t) {
|
|
|
1887
2833
|
}
|
|
1888
2834
|
continue;
|
|
1889
2835
|
}
|
|
1890
|
-
o(
|
|
2836
|
+
o(bn(e, t));
|
|
1891
2837
|
}
|
|
1892
2838
|
if (i.push(a), r.length === 0 && !s) return { kind: "none" };
|
|
1893
2839
|
let c = {
|
|
@@ -1896,26 +2842,26 @@ function vt(e, t) {
|
|
|
1896
2842
|
};
|
|
1897
2843
|
return i.some((e) => e.length > 0) && (c.lineNames = i), s && (c.autoRepeat = s), c;
|
|
1898
2844
|
}
|
|
1899
|
-
function
|
|
2845
|
+
function gn(e, t) {
|
|
1900
2846
|
let n = [], r = [], i = [];
|
|
1901
|
-
for (let a of
|
|
1902
|
-
let e =
|
|
2847
|
+
for (let a of Cn(e)) {
|
|
2848
|
+
let e = _n(a);
|
|
1903
2849
|
if (e) {
|
|
1904
2850
|
i.push(...e);
|
|
1905
2851
|
continue;
|
|
1906
2852
|
}
|
|
1907
|
-
r.push(i), i = [], n.push(
|
|
2853
|
+
r.push(i), i = [], n.push(bn(a, t));
|
|
1908
2854
|
}
|
|
1909
2855
|
return r.push(i), {
|
|
1910
2856
|
tracks: n,
|
|
1911
2857
|
lineNames: r
|
|
1912
2858
|
};
|
|
1913
2859
|
}
|
|
1914
|
-
function
|
|
2860
|
+
function _n(e) {
|
|
1915
2861
|
let t = e.match(/^\[(.*)\]$/s);
|
|
1916
2862
|
return t ? t[1].split(/\s+/).filter((e) => e !== "") : null;
|
|
1917
2863
|
}
|
|
1918
|
-
function
|
|
2864
|
+
function vn(e) {
|
|
1919
2865
|
let t = [];
|
|
1920
2866
|
for (let n of e.matchAll(/"([^"]*)"|'([^']*)'/g)) {
|
|
1921
2867
|
let e = (n[1] ?? n[2] ?? "").trim().split(/\s+/).filter((e) => e !== "");
|
|
@@ -1945,23 +2891,23 @@ function xt(e) {
|
|
|
1945
2891
|
areas: r
|
|
1946
2892
|
};
|
|
1947
2893
|
}
|
|
1948
|
-
function
|
|
1949
|
-
let n =
|
|
1950
|
-
return n.length > 0 ? n : [
|
|
2894
|
+
function yn(e, t) {
|
|
2895
|
+
let n = Cn(e.trim()).filter((e) => e !== "" && !e.startsWith("[")).map((e) => bn(e, t));
|
|
2896
|
+
return n.length > 0 ? n : [z()];
|
|
1951
2897
|
}
|
|
1952
|
-
function
|
|
2898
|
+
function bn(e, t) {
|
|
1953
2899
|
let n = e.match(/^minmax\((.*)\)$/s);
|
|
1954
2900
|
if (n) {
|
|
1955
|
-
let e =
|
|
2901
|
+
let e = Sn(n[1]).map((e) => e.trim());
|
|
1956
2902
|
return e.length === 2 ? {
|
|
1957
|
-
min:
|
|
1958
|
-
max:
|
|
2903
|
+
min: xn(e[0], t),
|
|
2904
|
+
max: xn(e[1], t)
|
|
1959
2905
|
} : {
|
|
1960
2906
|
min: { kind: "auto" },
|
|
1961
2907
|
max: { kind: "auto" }
|
|
1962
2908
|
};
|
|
1963
2909
|
}
|
|
1964
|
-
let r =
|
|
2910
|
+
let r = xn(e, t);
|
|
1965
2911
|
return r.kind === "fr" ? {
|
|
1966
2912
|
min: { kind: "auto" },
|
|
1967
2913
|
max: r
|
|
@@ -1970,40 +2916,40 @@ function Ct(e, t) {
|
|
|
1970
2916
|
max: r
|
|
1971
2917
|
};
|
|
1972
2918
|
}
|
|
1973
|
-
function
|
|
1974
|
-
if (
|
|
1975
|
-
if (
|
|
1976
|
-
if (
|
|
1977
|
-
let
|
|
1978
|
-
if (
|
|
1979
|
-
let e =
|
|
1980
|
-
return e.length > 0 &&
|
|
2919
|
+
function xn(e, t) {
|
|
2920
|
+
if (e === "auto" || e.startsWith("fit-content")) return { kind: "auto" };
|
|
2921
|
+
if (e === "min-content") return { kind: "min-content" };
|
|
2922
|
+
if (e === "max-content") return { kind: "max-content" };
|
|
2923
|
+
let n = e.match(/^(min|max)\((.*)\)$/s);
|
|
2924
|
+
if (n) {
|
|
2925
|
+
let e = Sn(n[2]).map((e) => xn(e.trim(), t)), r = e.every((e) => e.kind === "cells" || e.kind === "percent" || e.kind === "math");
|
|
2926
|
+
return e.length > 0 && r ? {
|
|
1981
2927
|
kind: "math",
|
|
1982
|
-
fn:
|
|
2928
|
+
fn: n[1],
|
|
1983
2929
|
args: e
|
|
1984
2930
|
} : { kind: "auto" };
|
|
1985
2931
|
}
|
|
1986
|
-
if (
|
|
1987
|
-
let
|
|
1988
|
-
return Number.isFinite(
|
|
2932
|
+
if (e.endsWith("fr")) {
|
|
2933
|
+
let t = parseFloat(e);
|
|
2934
|
+
return Number.isFinite(t) && t >= 0 ? {
|
|
1989
2935
|
kind: "fr",
|
|
1990
|
-
value:
|
|
2936
|
+
value: t
|
|
1991
2937
|
} : { kind: "auto" };
|
|
1992
2938
|
}
|
|
1993
|
-
if (
|
|
1994
|
-
let
|
|
1995
|
-
return Number.isFinite(
|
|
2939
|
+
if (e.endsWith("%")) {
|
|
2940
|
+
let t = parseFloat(e);
|
|
2941
|
+
return Number.isFinite(t) ? {
|
|
1996
2942
|
kind: "percent",
|
|
1997
|
-
value:
|
|
2943
|
+
value: t
|
|
1998
2944
|
} : { kind: "auto" };
|
|
1999
2945
|
}
|
|
2000
|
-
let
|
|
2001
|
-
return Number.isFinite(
|
|
2946
|
+
let r = parseFloat(e);
|
|
2947
|
+
return Number.isFinite(r) ? {
|
|
2002
2948
|
kind: "cells",
|
|
2003
|
-
value:
|
|
2949
|
+
value: e.endsWith("rem") ? f(r / .25) : p(r, t)
|
|
2004
2950
|
} : { kind: "auto" };
|
|
2005
2951
|
}
|
|
2006
|
-
function
|
|
2952
|
+
function Sn(e) {
|
|
2007
2953
|
let t = [], n = 0, r = 0;
|
|
2008
2954
|
for (let i = 0; i < e.length; i++) {
|
|
2009
2955
|
let a = e[i];
|
|
@@ -2011,7 +2957,7 @@ function Tt(e) {
|
|
|
2011
2957
|
}
|
|
2012
2958
|
return t.push(e.slice(r)), t.filter((e) => e.trim() !== "");
|
|
2013
2959
|
}
|
|
2014
|
-
function
|
|
2960
|
+
function Cn(e) {
|
|
2015
2961
|
let t = [], n = 0, r = -1;
|
|
2016
2962
|
for (let i = 0; i < e.length; i++) {
|
|
2017
2963
|
let a = e[i];
|
|
@@ -2019,7 +2965,7 @@ function Et(e) {
|
|
|
2019
2965
|
}
|
|
2020
2966
|
return r !== -1 && t.push(e.slice(r)), t;
|
|
2021
2967
|
}
|
|
2022
|
-
function
|
|
2968
|
+
function wn(e) {
|
|
2023
2969
|
let t = e.trim();
|
|
2024
2970
|
if (!t || t === "auto") return { kind: "auto" };
|
|
2025
2971
|
let n = !1, r, i;
|
|
@@ -2047,16 +2993,16 @@ function Dt(e) {
|
|
|
2047
2993
|
nth: r
|
|
2048
2994
|
};
|
|
2049
2995
|
}
|
|
2050
|
-
function
|
|
2996
|
+
function Tn(e) {
|
|
2051
2997
|
return {
|
|
2052
2998
|
direction: e.includes("column") ? "column" : "row",
|
|
2053
2999
|
dense: e.includes("dense")
|
|
2054
3000
|
};
|
|
2055
3001
|
}
|
|
2056
|
-
function
|
|
3002
|
+
function En(e, t) {
|
|
2057
3003
|
return (t === "w" ? /(?:^|[\s:.[!])w-/ : /(?:^|[\s:.[!])h-/).test(e);
|
|
2058
3004
|
}
|
|
2059
|
-
function
|
|
3005
|
+
function Dn(e, t) {
|
|
2060
3006
|
return {
|
|
2061
3007
|
top: $(e.getPropertyValue("padding-top"), t),
|
|
2062
3008
|
right: $(e.getPropertyValue("padding-right"), t),
|
|
@@ -2064,23 +3010,23 @@ function At(e, t) {
|
|
|
2064
3010
|
left: $(e.getPropertyValue("padding-left"), t)
|
|
2065
3011
|
};
|
|
2066
3012
|
}
|
|
2067
|
-
function
|
|
2068
|
-
let
|
|
3013
|
+
function On(e) {
|
|
3014
|
+
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 : f(parseFloat(e.getPropertyValue(t)) || 0);
|
|
2069
3015
|
return {
|
|
2070
|
-
top:
|
|
2071
|
-
right:
|
|
2072
|
-
bottom:
|
|
2073
|
-
left:
|
|
3016
|
+
top: t("border-top-width", "border-top-style"),
|
|
3017
|
+
right: t("border-right-width", "border-right-style"),
|
|
3018
|
+
bottom: t("border-bottom-width", "border-bottom-style"),
|
|
3019
|
+
left: t("border-left-width", "border-left-style")
|
|
2074
3020
|
};
|
|
2075
3021
|
}
|
|
2076
3022
|
//#endregion
|
|
2077
3023
|
//#region src/tree.ts
|
|
2078
|
-
function
|
|
2079
|
-
let r =
|
|
3024
|
+
function kn(e, t, n) {
|
|
3025
|
+
let r = Gt(e, t, n);
|
|
2080
3026
|
if (r.display === "none") return null;
|
|
2081
|
-
let i = Array.from(e.children), a = i.map(
|
|
3027
|
+
let i = Array.from(e.children), a = i.map(Pn);
|
|
2082
3028
|
if (!a.includes("block")) {
|
|
2083
|
-
let o =
|
|
3029
|
+
let o = Fn(e, r.tracking, {
|
|
2084
3030
|
rootFontSizePx: t,
|
|
2085
3031
|
rootLetterSpacingPx: n?.letterSpacing ?? 0,
|
|
2086
3032
|
cellMetrics: n,
|
|
@@ -2088,18 +3034,18 @@ function Mt(e, t, n) {
|
|
|
2088
3034
|
tabSize: r.tabSize
|
|
2089
3035
|
}), s = o.chars.join("");
|
|
2090
3036
|
if (o.boxes.length > 0) {
|
|
2091
|
-
let e =
|
|
2092
|
-
|
|
2093
|
-
o.advances[t] = Math.max(1,
|
|
3037
|
+
let e = yt();
|
|
3038
|
+
w(o.chars, (t, n) => {
|
|
3039
|
+
o.advances[t] = Math.max(1, Z(o.boxes[n], e));
|
|
2094
3040
|
});
|
|
2095
3041
|
}
|
|
2096
|
-
let c =
|
|
3042
|
+
let c = Bn(s, o.advances, r.tracking), l = s.length > 0 ? Vn(s) : 0, u = [...o.boxes];
|
|
2097
3043
|
for (let e = 0; e < i.length; e++) {
|
|
2098
3044
|
if (a[e] !== "out-of-flow") continue;
|
|
2099
|
-
let r =
|
|
3045
|
+
let r = kn(i[e], t, n);
|
|
2100
3046
|
r && u.push(r);
|
|
2101
3047
|
}
|
|
2102
|
-
let
|
|
3048
|
+
let d = {
|
|
2103
3049
|
source: e,
|
|
2104
3050
|
style: r,
|
|
2105
3051
|
children: u,
|
|
@@ -2113,14 +3059,14 @@ function Mt(e, t, n) {
|
|
|
2113
3059
|
height: l
|
|
2114
3060
|
},
|
|
2115
3061
|
unclampedHeight: 0,
|
|
2116
|
-
resolvedPadding:
|
|
3062
|
+
resolvedPadding: R()
|
|
2117
3063
|
};
|
|
2118
|
-
return (o.advances.some((e) => e !== 1) || o.boxes.length > 0) && (
|
|
3064
|
+
return (o.advances.some((e) => e !== 1) || o.boxes.length > 0) && (d.advances = o.advances), o.inlineElements.length > 0 && (d.inlineElements = o.inlineElements, d.charInline = o.chars.map((e, t) => o.inlineIndex[t] ?? -1)), d;
|
|
2119
3065
|
}
|
|
2120
3066
|
let o = [];
|
|
2121
3067
|
for (let e = 0; e < i.length; e++) {
|
|
2122
3068
|
if (a[e] === "none") continue;
|
|
2123
|
-
let r =
|
|
3069
|
+
let r = kn(i[e], t, n);
|
|
2124
3070
|
r && o.push(r);
|
|
2125
3071
|
}
|
|
2126
3072
|
let s = {
|
|
@@ -2137,36 +3083,37 @@ function Mt(e, t, n) {
|
|
|
2137
3083
|
height: 0
|
|
2138
3084
|
},
|
|
2139
3085
|
unclampedHeight: 0,
|
|
2140
|
-
resolvedPadding:
|
|
3086
|
+
resolvedPadding: R()
|
|
2141
3087
|
};
|
|
2142
|
-
return
|
|
3088
|
+
return Un(e, s), s;
|
|
2143
3089
|
}
|
|
2144
|
-
var
|
|
2145
|
-
function
|
|
2146
|
-
return t || (
|
|
3090
|
+
var An = /* @__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("."));
|
|
3091
|
+
function jn(e, t) {
|
|
3092
|
+
return t || (An.has(e.tagName) ? "inline" : "block");
|
|
2147
3093
|
}
|
|
2148
|
-
function
|
|
2149
|
-
let n =
|
|
3094
|
+
function Mn(e, t) {
|
|
3095
|
+
let n = jn(e, t);
|
|
2150
3096
|
return n === "inline" || n === "contents";
|
|
2151
3097
|
}
|
|
2152
|
-
function
|
|
2153
|
-
let n =
|
|
3098
|
+
function Nn(e, t) {
|
|
3099
|
+
let n = jn(e, t);
|
|
2154
3100
|
return n.startsWith("inline") && n !== "inline";
|
|
2155
3101
|
}
|
|
2156
|
-
function
|
|
3102
|
+
function Pn(e) {
|
|
2157
3103
|
let t = getComputedStyle(e);
|
|
2158
|
-
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" :
|
|
3104
|
+
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" : Mn(e, t.display) || Nn(e, t.display) ? "inline" : "block";
|
|
2159
3105
|
}
|
|
2160
|
-
function
|
|
3106
|
+
function Fn(e, t, n) {
|
|
2161
3107
|
let r = {
|
|
2162
3108
|
chars: [],
|
|
2163
3109
|
advances: [],
|
|
3110
|
+
inlineIndex: [],
|
|
2164
3111
|
inlineElements: [],
|
|
2165
3112
|
boxes: []
|
|
2166
3113
|
};
|
|
2167
|
-
return
|
|
3114
|
+
return In(e, t, n, r), n.preserve ? (r.chars[r.chars.length - 1] === "\n" && (r.chars.pop(), r.advances.pop(), r.inlineIndex.pop()), r) : zn(r);
|
|
2168
3115
|
}
|
|
2169
|
-
function
|
|
3116
|
+
function In(e, t, n, r) {
|
|
2170
3117
|
let i = () => {
|
|
2171
3118
|
let e = 0;
|
|
2172
3119
|
for (let t = r.chars.length - 1; t >= 0 && r.chars[t] !== "\n"; t--) e += r.advances[t];
|
|
@@ -2187,148 +3134,188 @@ function zt(e, t, n, r) {
|
|
|
2187
3134
|
}
|
|
2188
3135
|
let t = getComputedStyle(e);
|
|
2189
3136
|
if (t.display === "none" || t.position === "absolute" || t.position === "fixed") continue;
|
|
2190
|
-
if (
|
|
2191
|
-
let t =
|
|
3137
|
+
if (Nn(e, t.display)) {
|
|
3138
|
+
let t = kn(e, n.rootFontSizePx, n.cellMetrics);
|
|
2192
3139
|
t && (t.inlineBox = !0, r.chars.push(""), r.advances.push(1), r.boxes.push(t));
|
|
2193
3140
|
continue;
|
|
2194
3141
|
}
|
|
2195
|
-
if (!
|
|
2196
|
-
|
|
3142
|
+
if (!Mn(e, t.display)) {
|
|
3143
|
+
Hn(e);
|
|
2197
3144
|
continue;
|
|
2198
3145
|
}
|
|
2199
|
-
let i =
|
|
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);
|
|
2200
3147
|
r.inlineElements.push({
|
|
2201
3148
|
element: e,
|
|
2202
3149
|
tracking: i,
|
|
2203
3150
|
padLeft: o,
|
|
2204
3151
|
padRight: s,
|
|
2205
|
-
insets: t.position === "static" ? null :
|
|
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
|
|
2206
3157
|
});
|
|
3158
|
+
let c = r.inlineElements.length - 1;
|
|
2207
3159
|
for (let e = 0; e < o; e++) r.chars.push(""), r.advances.push(1);
|
|
2208
|
-
|
|
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);
|
|
2209
3163
|
for (let e = 0; e < s; e++) r.chars.push(""), r.advances.push(1);
|
|
2210
3164
|
}
|
|
2211
3165
|
}
|
|
2212
|
-
function
|
|
3166
|
+
function Ln(e, t) {
|
|
2213
3167
|
if (!e || e.endsWith("%")) return 0;
|
|
2214
|
-
let
|
|
2215
|
-
return Number.isFinite(
|
|
3168
|
+
let n = parseFloat(e);
|
|
3169
|
+
return Number.isFinite(n) ? Math.max(0, p(n, t)) : 0;
|
|
2216
3170
|
}
|
|
2217
|
-
function
|
|
2218
|
-
let
|
|
3171
|
+
function Rn(e, t) {
|
|
3172
|
+
let n = (e) => {
|
|
2219
3173
|
if (!e || e === "auto" || e.endsWith("%")) return null;
|
|
2220
|
-
let
|
|
2221
|
-
return Number.isFinite(
|
|
3174
|
+
let n = parseFloat(e);
|
|
3175
|
+
return Number.isFinite(n) ? p(n, t) : null;
|
|
2222
3176
|
};
|
|
2223
3177
|
return {
|
|
2224
|
-
top:
|
|
2225
|
-
right:
|
|
2226
|
-
bottom:
|
|
2227
|
-
left:
|
|
3178
|
+
top: n(e.top),
|
|
3179
|
+
right: n(e.right),
|
|
3180
|
+
bottom: n(e.bottom),
|
|
3181
|
+
left: n(e.left)
|
|
2228
3182
|
};
|
|
2229
3183
|
}
|
|
2230
|
-
function
|
|
2231
|
-
let t = [], n = [], r = () => {
|
|
3184
|
+
function zn(e) {
|
|
3185
|
+
let t = [], n = [], r = [], i = () => {
|
|
2232
3186
|
let e = t.length;
|
|
2233
3187
|
for (; e > 0 && t[e - 1] !== "\n";) e--;
|
|
2234
3188
|
return e;
|
|
2235
|
-
},
|
|
2236
|
-
for (; t.length >
|
|
3189
|
+
}, a = () => {
|
|
3190
|
+
for (; t.length > i() && t[t.length - 1] === " ";) t.pop(), n.pop(), r.pop();
|
|
2237
3191
|
};
|
|
2238
|
-
for (let
|
|
2239
|
-
let
|
|
2240
|
-
if (
|
|
3192
|
+
for (let i = 0; i < e.chars.length; i++) {
|
|
3193
|
+
let o = e.chars[i];
|
|
3194
|
+
if (o === " ") {
|
|
2241
3195
|
let e = t.length - 1;
|
|
2242
3196
|
for (; e >= 0 && t[e] === "";) e--;
|
|
2243
3197
|
if (e < 0 || t[e] === "\n" || t[e] === " ") continue;
|
|
2244
|
-
} else
|
|
2245
|
-
t.push(
|
|
3198
|
+
} else o === "\n" && a();
|
|
3199
|
+
t.push(o), n.push(e.advances[i]), r.push(e.inlineIndex[i] ?? -1);
|
|
2246
3200
|
}
|
|
2247
|
-
for (
|
|
2248
|
-
for (; t[t.length - 1] === "\n";) t.pop(), n.pop();
|
|
3201
|
+
for (a(); t[0] === "\n";) t.shift(), n.shift(), r.shift();
|
|
3202
|
+
for (; t[t.length - 1] === "\n";) t.pop(), n.pop(), r.pop();
|
|
2249
3203
|
return {
|
|
2250
3204
|
chars: t,
|
|
2251
3205
|
advances: n,
|
|
3206
|
+
inlineIndex: r,
|
|
2252
3207
|
inlineElements: e.inlineElements,
|
|
2253
3208
|
boxes: e.boxes
|
|
2254
3209
|
};
|
|
2255
3210
|
}
|
|
2256
|
-
function
|
|
3211
|
+
function Bn(e, t, n) {
|
|
2257
3212
|
let r = 0, i = 0;
|
|
2258
|
-
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r,
|
|
3213
|
+
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r, x(i, a, t, n)), i = a + 1);
|
|
2259
3214
|
return r;
|
|
2260
3215
|
}
|
|
2261
|
-
function
|
|
3216
|
+
function Vn(e) {
|
|
2262
3217
|
return e.split("\n").length;
|
|
2263
3218
|
}
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
Kt.has(e) || (Kt.add(e), console.warn("[monowind] 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.", e));
|
|
3219
|
+
function Hn(e) {
|
|
3220
|
+
V(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.");
|
|
2267
3221
|
}
|
|
2268
|
-
function
|
|
2269
|
-
Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? "")) && (t.droppedText = !0,
|
|
3222
|
+
function Un(e, t) {
|
|
3223
|
+
Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? "")) && (t.droppedText = !0, V(e, "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>)."));
|
|
2270
3224
|
}
|
|
2271
3225
|
//#endregion
|
|
2272
3226
|
//#region src/element.ts
|
|
2273
|
-
var
|
|
3227
|
+
var Wn = "\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 decoration layer must not sink with it. Scoped to\n * that state so an authored 'invisible' on the host stays intact. */\n :host([data-mw-dropped-text]) #viewport { visibility: visible; }\n #decorations { position: absolute; inset: 0; pointer-events: none; user-select: none; white-space: pre; }\n /* Plain-text mode (the plain-text attribute): a selectable text mirror of the\n * whole render replaces the layered output — the slotted content keeps\n * driving layout invisibly underneath (and stays inert), decorations\n * hide, and one selection copies the art, whitespace included. */\n #plain-text { display: none; position: absolute; inset: 0; margin: 0; font: inherit; line-height: inherit; letter-spacing: inherit; white-space: pre; }\n :host([plain-text]) #plain-text { display: block; }\n :host([plain-text]) #decorations { display: none; }\n :host([plain-text]) slot { visibility: hidden; }\n</style>\n<div id=\"viewport\">\n <div id=\"decorations\" aria-hidden=\"true\"></div>\n <pre id=\"plain-text\"></pre>\n <slot></slot>\n</div>\n", Gn = typeof HTMLElement > "u" ? class {} : HTMLElement, Kn = class extends Gn {
|
|
3228
|
+
static observedAttributes = ["plain-text"];
|
|
2274
3229
|
#e;
|
|
2275
3230
|
#t;
|
|
2276
3231
|
#n;
|
|
2277
|
-
#r
|
|
3232
|
+
#r;
|
|
2278
3233
|
#i = null;
|
|
2279
|
-
#a =
|
|
2280
|
-
#o =
|
|
3234
|
+
#a = null;
|
|
3235
|
+
#o = !1;
|
|
3236
|
+
#s = null;
|
|
3237
|
+
#c = null;
|
|
2281
3238
|
constructor() {
|
|
2282
|
-
super(), this.#e = this.attachShadow({ mode: "open" }), this.#e.innerHTML =
|
|
3239
|
+
super(), this.#e = this.attachShadow({ mode: "open" }), this.#e.innerHTML = Wn, this.#t = this.#e.getElementById("decorations"), this.#n = this.#e.getElementById("plain-text"), this.#r = document.createElement("span"), this.#r.setAttribute("aria-hidden", "true"), this.#r.setAttribute("data-mw-probe", ""), this.#r.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.#r.textContent = "M".repeat(100);
|
|
2283
3240
|
}
|
|
2284
3241
|
connectedCallback() {
|
|
2285
|
-
this.#
|
|
3242
|
+
this.#r.parentNode !== this && this.appendChild(this.#r), this.#i = new ResizeObserver(() => this.#d()), this.#i.observe(this), this.#a = new MutationObserver(() => this.#d()), this.#a.observe(this, {
|
|
2286
3243
|
childList: !0,
|
|
2287
3244
|
subtree: !0,
|
|
2288
3245
|
characterData: !0,
|
|
2289
3246
|
attributes: !0,
|
|
2290
|
-
attributeFilter: [
|
|
2291
|
-
|
|
3247
|
+
attributeFilter: [
|
|
3248
|
+
"class",
|
|
3249
|
+
"style",
|
|
3250
|
+
"colspan",
|
|
3251
|
+
"rowspan",
|
|
3252
|
+
"span"
|
|
3253
|
+
]
|
|
3254
|
+
}), document.fonts?.ready.then(this.#u).catch((e) => {
|
|
2292
3255
|
console.warn("[monowind] document.fonts.ready failed:", e);
|
|
2293
|
-
}), document.fonts?.addEventListener("loadingdone", this.#
|
|
3256
|
+
}), document.fonts?.addEventListener("loadingdone", this.#u), this.#d();
|
|
2294
3257
|
}
|
|
2295
3258
|
disconnectedCallback() {
|
|
2296
|
-
this.#
|
|
3259
|
+
this.#i?.disconnect(), this.#a?.disconnect(), this.#i = null, this.#a = null, document.fonts?.removeEventListener("loadingdone", this.#u);
|
|
2297
3260
|
}
|
|
2298
|
-
|
|
2299
|
-
|
|
3261
|
+
attributeChangedCallback() {
|
|
3262
|
+
this.#d();
|
|
3263
|
+
}
|
|
3264
|
+
toPlainText() {
|
|
3265
|
+
return this.#o && this.#f(), this.#c ? Nt(this.#c) : "";
|
|
3266
|
+
}
|
|
3267
|
+
#l(e) {
|
|
3268
|
+
if (!this.hasAttribute("plain-text")) {
|
|
3269
|
+
this.#n.textContent = "";
|
|
3270
|
+
return;
|
|
3271
|
+
}
|
|
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
|
+
}
|
|
3285
|
+
#u = () => {
|
|
3286
|
+
requestAnimationFrame(() => this.#d());
|
|
2300
3287
|
};
|
|
2301
|
-
#
|
|
2302
|
-
this.#
|
|
2303
|
-
this.#
|
|
3288
|
+
#d() {
|
|
3289
|
+
this.#o || (this.#o = !0, requestAnimationFrame(() => {
|
|
3290
|
+
this.#o = !1;
|
|
2304
3291
|
try {
|
|
2305
|
-
this.#
|
|
3292
|
+
this.#f();
|
|
2306
3293
|
} catch (e) {
|
|
2307
3294
|
console.error("[monowind] layout failed:", e);
|
|
2308
3295
|
}
|
|
2309
3296
|
}));
|
|
2310
3297
|
}
|
|
2311
|
-
#
|
|
3298
|
+
#f() {
|
|
2312
3299
|
this.setAttribute("measuring", "");
|
|
2313
3300
|
try {
|
|
2314
|
-
let e =
|
|
2315
|
-
(t === null || t.width !== e.width || t.height !== e.height || t.letterSpacing !== e.letterSpacing) && (this.style.setProperty("--mw-cw", `${e.width}px`), this.style.setProperty("--mw-ch", `${e.height}px`), this.style.setProperty("--mw-rls", `${e.letterSpacing}px`)), this.#
|
|
2316
|
-
let n = getComputedStyle(this),
|
|
2317
|
-
if (
|
|
2318
|
-
let
|
|
3301
|
+
let e = h(this, this.#r), t = this.#s;
|
|
3302
|
+
(t === null || t.width !== e.width || t.height !== e.height || t.letterSpacing !== e.letterSpacing) && (this.style.setProperty("--mw-cw", `${e.width}px`), this.style.setProperty("--mw-ch", `${e.height}px`), this.style.setProperty("--mw-rls", `${e.letterSpacing}px`)), this.#s = e;
|
|
3303
|
+
let n = getComputedStyle(this), r = (parseFloat(n.paddingLeft) || 0) + (parseFloat(n.paddingRight) || 0), i = Math.max(0, Math.floor((this.clientWidth - r) / e.width));
|
|
3304
|
+
if (i === 0) return;
|
|
3305
|
+
let a = g(), o = [];
|
|
2319
3306
|
for (let t of Array.from(this.children)) {
|
|
2320
|
-
if (t === this.#
|
|
2321
|
-
let n =
|
|
2322
|
-
n &&
|
|
3307
|
+
if (t === this.#r) continue;
|
|
3308
|
+
let n = kn(t, a, e);
|
|
3309
|
+
n && o.push(n);
|
|
2323
3310
|
}
|
|
2324
|
-
if (Array.from(this.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? "")) ? (this.hasAttribute("data-mw-dropped-text") || console.warn("[monowind] Direct text inside <mono-wind> can't be laid out and was hidden. Wrap each text segment in its own element (e.g. a <div>).", this), this.setAttribute("data-mw-dropped-text", "")) : this.removeAttribute("data-mw-dropped-text"),
|
|
2325
|
-
this.#t.replaceChildren(), this.setAttribute("data-mw-ready", "");
|
|
3311
|
+
if (Array.from(this.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? "")) ? (this.hasAttribute("data-mw-dropped-text") || console.warn("[monowind] Direct text inside <mono-wind> can't be laid out and was hidden. Wrap each text segment in its own element (e.g. a <div>).", this), this.setAttribute("data-mw-dropped-text", "")) : this.removeAttribute("data-mw-dropped-text"), o.length === 0) {
|
|
3312
|
+
this.#t.replaceChildren(), this.#n.textContent = "", this.#c = null, this.setAttribute("data-mw-ready", "");
|
|
2326
3313
|
return;
|
|
2327
3314
|
}
|
|
2328
|
-
let
|
|
3315
|
+
let s = {
|
|
2329
3316
|
source: this,
|
|
2330
|
-
style:
|
|
2331
|
-
children:
|
|
3317
|
+
style: oe(),
|
|
3318
|
+
children: o,
|
|
2332
3319
|
text: "",
|
|
2333
3320
|
intrinsicWidth: 0,
|
|
2334
3321
|
intrinsicHeight: 0,
|
|
@@ -2339,65 +3326,20 @@ var Yt = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
2339
3326
|
height: 0
|
|
2340
3327
|
},
|
|
2341
3328
|
unclampedHeight: 0,
|
|
2342
|
-
resolvedPadding:
|
|
2343
|
-
}, { height:
|
|
2344
|
-
|
|
2345
|
-
let
|
|
2346
|
-
this.style.height = `${
|
|
3329
|
+
resolvedPadding: R()
|
|
3330
|
+
}, { height: c } = _t(s, i);
|
|
3331
|
+
Bt(s, this.#t), this.#c = s, this.#l(s);
|
|
3332
|
+
let l = n.boxSizing === "border-box" ? (parseFloat(n.paddingTop) || 0) + (parseFloat(n.paddingBottom) || 0) + (parseFloat(n.borderTopWidth) || 0) + (parseFloat(n.borderBottomWidth) || 0) : 0;
|
|
3333
|
+
this.style.height = `${c * e.height + l}px`, this.setAttribute("data-mw-ready", "");
|
|
2347
3334
|
} finally {
|
|
2348
|
-
this.removeAttribute("measuring"), this.#
|
|
3335
|
+
this.removeAttribute("measuring"), this.#a?.takeRecords();
|
|
2349
3336
|
}
|
|
2350
3337
|
}
|
|
2351
3338
|
};
|
|
2352
|
-
function
|
|
2353
|
-
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind",
|
|
2354
|
-
}
|
|
2355
|
-
//#endregion
|
|
2356
|
-
//#region src/ascii.ts
|
|
2357
|
-
function $t(e) {
|
|
2358
|
-
let t = e.localRect.width, n = e.localRect.height;
|
|
2359
|
-
if (t <= 0 || n <= 0) return "";
|
|
2360
|
-
let r = Array.from({ length: n }, () => Array.from({ length: t }, () => " "));
|
|
2361
|
-
return en(e, 0, 0, (e, i, a) => {
|
|
2362
|
-
e >= 0 && e < t && i >= 0 && i < n && (r[i][e] = a);
|
|
2363
|
-
}), r.map((e) => e.join("").trimEnd()).join("\n");
|
|
2364
|
-
}
|
|
2365
|
-
function en(e, t, n, r) {
|
|
2366
|
-
let i = t + e.localRect.x, a = n + e.localRect.y, o = e.style, c = [];
|
|
2367
|
-
Je(o, {
|
|
2368
|
-
x: i,
|
|
2369
|
-
y: a,
|
|
2370
|
-
width: e.localRect.width,
|
|
2371
|
-
height: e.localRect.height
|
|
2372
|
-
}, c);
|
|
2373
|
-
for (let e of c) for (let t = 0; t < e.length; t++) r(e.x + t, e.y, e.glyph);
|
|
2374
|
-
if (!e.children.some((e) => !e.inlineBox && e.style.position !== "absolute" && e.style.position !== "fixed") && e.text) {
|
|
2375
|
-
let t = e.resolvedPadding, n = i + o.border.left + t.left, c = a + o.border.top + t.top, l = e.localRect.width - o.border.left - o.border.right - t.left - t.right, { spans: u, lineY: d } = Be(e, l);
|
|
2376
|
-
for (let t = 0; t < u.length; t++) {
|
|
2377
|
-
let i = u[t], a = c + d[t], f = o.whiteSpace !== "normal" && o.overflow === "clip" ? tn(e.text, i, l, e.advances, o) : {
|
|
2378
|
-
end: i.end,
|
|
2379
|
-
ellipsis: !1
|
|
2380
|
-
}, p = n;
|
|
2381
|
-
for (let t = i.start; t < f.end; t++) e.text[t] !== "" && e.text[t] !== "" && r(p, a, e.text[t]), p += s(t, t + 1, e.advances);
|
|
2382
|
-
f.ellipsis && r(p, a, "…");
|
|
2383
|
-
}
|
|
2384
|
-
}
|
|
2385
|
-
for (let t of e.children) en(t, i, a, r);
|
|
2386
|
-
}
|
|
2387
|
-
function tn(e, t, n, r, i) {
|
|
2388
|
-
let { textOverflow: a, tracking: o } = i;
|
|
2389
|
-
if (c(t.start, t.end, r, o) <= n) return {
|
|
2390
|
-
end: t.end,
|
|
2391
|
-
ellipsis: !1
|
|
2392
|
-
};
|
|
2393
|
-
let s = a === "ellipsis" ? n - 1 : n, l = t.start;
|
|
2394
|
-
for (; l < t.end && c(t.start, l + 1, r, o) <= s;) l++;
|
|
2395
|
-
return {
|
|
2396
|
-
end: l,
|
|
2397
|
-
ellipsis: a === "ellipsis" && n > 0
|
|
2398
|
-
};
|
|
3339
|
+
function qn() {
|
|
3340
|
+
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind", Kn);
|
|
2399
3341
|
}
|
|
2400
3342
|
//#endregion
|
|
2401
|
-
export {
|
|
3343
|
+
export { Kn as MonoWindElement, qn as defineMonoWind, Nt as renderPlainText, _ as wrapLines };
|
|
2402
3344
|
|
|
2403
3345
|
//# sourceMappingURL=index.js.map
|