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