uxml-preview 0.2.0 → 0.4.0
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/CHANGELOG.md +142 -0
- package/README.md +22 -18
- package/dist/index.d.ts +28 -3
- package/dist/index.js +876 -826
- package/dist/known-divergences.d.ts +36 -0
- package/dist/model/types.d.ts +12 -1
- package/dist/render/css-map.d.ts +10 -1
- package/dist/unity-project/index.d.ts +14 -0
- package/dist/unity-project/index.js +41 -0
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { loadYoga as
|
|
2
|
-
const
|
|
1
|
+
import { loadYoga as Re, PositionType as J, Direction as ce, Edge as P, BoxSizing as Me, FlexDirection as V, Wrap as q, Justify as W, Align as L, Display as Ue, Overflow as De } from "yoga-layout/load";
|
|
2
|
+
const ve = {
|
|
3
3
|
// VisualElement is the base class and carries no class of its own.
|
|
4
4
|
VisualElement: { hasText: !1, classes: [], parts: [] },
|
|
5
5
|
Label: { hasText: !0, classes: ["unity-label"], parts: [] },
|
|
@@ -37,24 +37,24 @@ const xt = {
|
|
|
37
37
|
{ name: "unity-content-container", style: { "flex-shrink": "0" } }
|
|
38
38
|
]
|
|
39
39
|
}
|
|
40
|
-
},
|
|
41
|
-
function
|
|
42
|
-
return
|
|
40
|
+
}, ue = { hasText: !1, classes: [], parts: [] }, Le = "UXML", ze = /* @__PURE__ */ new Set(["Style"]);
|
|
41
|
+
function _e(e) {
|
|
42
|
+
return ze.has(e.name.local);
|
|
43
43
|
}
|
|
44
|
-
function F(
|
|
45
|
-
const n =
|
|
46
|
-
return n !== void 0 ? { spec: n, fallback: !1 } :
|
|
44
|
+
function F(e) {
|
|
45
|
+
const n = ve[e.name.local];
|
|
46
|
+
return n !== void 0 ? { spec: n, fallback: !1 } : je(e) ? { spec: ue, fallback: !1 } : { spec: ue, fallback: !0 };
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
48
|
+
function je(e) {
|
|
49
|
+
return e.name.local === Le;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return F(
|
|
51
|
+
function We(e) {
|
|
52
|
+
return F(e).spec.classes;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
return Object.keys(
|
|
54
|
+
function Be() {
|
|
55
|
+
return Object.keys(ve);
|
|
56
56
|
}
|
|
57
|
-
const
|
|
57
|
+
const Y = "6000.0.40f1", ye = `:disabled {
|
|
58
58
|
opacity: 0.5;
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -62,11 +62,11 @@ const X = "6000.0.40f1", vt = `:disabled {
|
|
|
62
62
|
margin: 1px 3px;
|
|
63
63
|
-unity-text-align: middle-center;
|
|
64
64
|
}
|
|
65
|
-
`,
|
|
66
|
-
function
|
|
67
|
-
return
|
|
65
|
+
`, Fe = 13;
|
|
66
|
+
function Pe(e) {
|
|
67
|
+
return e ? Fe : 0;
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const Ve = /* @__PURE__ */ new Set([
|
|
70
70
|
"color",
|
|
71
71
|
"font-size",
|
|
72
72
|
"letter-spacing",
|
|
@@ -81,23 +81,23 @@ const Ht = /* @__PURE__ */ new Set([
|
|
|
81
81
|
"-unity-text-outline-color",
|
|
82
82
|
"-unity-text-outline-width"
|
|
83
83
|
]);
|
|
84
|
-
function
|
|
85
|
-
return
|
|
84
|
+
function He(e) {
|
|
85
|
+
return e.startsWith("--") || Ve.has(e);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function de(e) {
|
|
88
88
|
const n = [];
|
|
89
|
-
let
|
|
90
|
-
for (let l = 0; l <
|
|
91
|
-
const
|
|
92
|
-
|
|
89
|
+
let t = 0, i = -1;
|
|
90
|
+
for (let l = 0; l < e.length; l++) {
|
|
91
|
+
const o = e[l];
|
|
92
|
+
o === "(" ? t++ : o === ")" && (t = Math.max(0, t - 1)), t === 0 && /\s/.test(o) ? i >= 0 && (n.push(e.slice(i, l)), i = -1) : i < 0 && (i = l);
|
|
93
93
|
}
|
|
94
|
-
return i >= 0 && n.push(
|
|
94
|
+
return i >= 0 && n.push(e.slice(i)), n;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
const [n,
|
|
98
|
-
return n === void 0 ? null :
|
|
96
|
+
function qe(e) {
|
|
97
|
+
const [n, t, i, l] = e;
|
|
98
|
+
return n === void 0 ? null : t === void 0 ? [n, n, n, n] : i === void 0 ? [n, t, n, t] : l === void 0 ? [n, t, i, t] : [n, t, i, l];
|
|
99
99
|
}
|
|
100
|
-
const
|
|
100
|
+
const Ge = {
|
|
101
101
|
margin: ["margin-top", "margin-right", "margin-bottom", "margin-left"],
|
|
102
102
|
padding: ["padding-top", "padding-right", "padding-bottom", "padding-left"],
|
|
103
103
|
"border-width": [
|
|
@@ -120,21 +120,21 @@ const Gt = {
|
|
|
120
120
|
"border-bottom-left-radius"
|
|
121
121
|
]
|
|
122
122
|
};
|
|
123
|
-
function
|
|
124
|
-
return /^-?(\d+\.?\d*|\.\d+)$/.test(
|
|
123
|
+
function fe(e) {
|
|
124
|
+
return /^-?(\d+\.?\d*|\.\d+)$/.test(e);
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
const [n,
|
|
128
|
-
return n === void 0 ? [] : n === "none" ? [["flex-grow", "0"], ["flex-shrink", "0"], ["flex-basis", "auto"]] : n === "auto" ? [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", "auto"]] :
|
|
126
|
+
function Ye(e) {
|
|
127
|
+
const [n, t, i] = e;
|
|
128
|
+
return n === void 0 ? [] : n === "none" ? [["flex-grow", "0"], ["flex-shrink", "0"], ["flex-basis", "auto"]] : n === "auto" ? [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", "auto"]] : t === void 0 ? fe(n) ? [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", "0"]] : [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", n]] : i === void 0 ? fe(t) ? [["flex-grow", n], ["flex-shrink", t], ["flex-basis", "0"]] : [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", t]] : [["flex-grow", n], ["flex-shrink", t], ["flex-basis", i]];
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
if (
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
134
|
-
const i =
|
|
135
|
-
return i === null ? [[
|
|
130
|
+
function Z(e, n) {
|
|
131
|
+
if (e === "flex") return Ye(de(n));
|
|
132
|
+
const t = Ge[e];
|
|
133
|
+
if (t === void 0) return [[e, n]];
|
|
134
|
+
const i = qe(de(n));
|
|
135
|
+
return i === null ? [[e, n]] : t.map((l, o) => [l, i[o]]);
|
|
136
136
|
}
|
|
137
|
-
const
|
|
137
|
+
const ee = {
|
|
138
138
|
"align-content": "flex-start",
|
|
139
139
|
"align-items": "stretch",
|
|
140
140
|
"align-self": "auto",
|
|
@@ -170,33 +170,33 @@ const tt = {
|
|
|
170
170
|
"padding-right": "0",
|
|
171
171
|
"padding-top": "0",
|
|
172
172
|
"font-size": "12px"
|
|
173
|
-
},
|
|
174
|
-
function
|
|
175
|
-
const n =
|
|
173
|
+
}, Xe = ["em", "rem", "vh", "vw", "vmin", "vmax", "pt", "cm", "in"];
|
|
174
|
+
function X(e) {
|
|
175
|
+
const n = e.trim();
|
|
176
176
|
if (n === "") return { length: null, problem: "empty value" };
|
|
177
177
|
if (n === "auto") return { length: { kind: "auto" } };
|
|
178
178
|
if (n === "none") return { length: { kind: "none" } };
|
|
179
179
|
if (n === "initial") return { length: { kind: "auto" } };
|
|
180
180
|
if (n.startsWith("calc("))
|
|
181
181
|
return { length: null, problem: "calc() is not supported in USS" };
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
184
|
-
const i = Number(
|
|
185
|
-
return l === "" || l === "px" ? { length: { kind: "px", value: i } } : l === "%" ? { length: { kind: "percent", value: i } } :
|
|
182
|
+
const t = /^(-?(?:\d+\.?\d*|\.\d+))([a-z%]*)$/i.exec(n);
|
|
183
|
+
if (t === null) return { length: null, problem: `cannot read "${n}" as a length` };
|
|
184
|
+
const i = Number(t[1]), l = t[2].toLowerCase();
|
|
185
|
+
return l === "" || l === "px" ? { length: { kind: "px", value: i } } : l === "%" ? { length: { kind: "percent", value: i } } : Xe.includes(l) ? { length: null, problem: `"${l}" is not a USS unit` } : { length: null, problem: `unknown unit "${l}"` };
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
const n =
|
|
187
|
+
function pe(e) {
|
|
188
|
+
const n = e.trim();
|
|
189
189
|
return /^-?(\d+\.?\d*|\.\d+)$/.test(n) ? Number(n) : null;
|
|
190
190
|
}
|
|
191
|
-
let
|
|
192
|
-
async function
|
|
193
|
-
|
|
191
|
+
let se = null;
|
|
192
|
+
async function Lt() {
|
|
193
|
+
se ?? (se = await Re());
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
195
|
+
function zt() {
|
|
196
|
+
return se !== null;
|
|
197
197
|
}
|
|
198
198
|
let G = 0;
|
|
199
|
-
function
|
|
199
|
+
function _t() {
|
|
200
200
|
return G;
|
|
201
201
|
}
|
|
202
202
|
const K = {
|
|
@@ -209,217 +209,217 @@ const K = {
|
|
|
209
209
|
"space-between": L.SpaceBetween,
|
|
210
210
|
"space-around": L.SpaceAround,
|
|
211
211
|
"space-evenly": L.SpaceEvenly
|
|
212
|
-
},
|
|
212
|
+
}, Je = {
|
|
213
213
|
"flex-start": W.FlexStart,
|
|
214
214
|
center: W.Center,
|
|
215
215
|
"flex-end": W.FlexEnd,
|
|
216
216
|
"space-between": W.SpaceBetween,
|
|
217
217
|
"space-around": W.SpaceAround,
|
|
218
218
|
"space-evenly": W.SpaceEvenly
|
|
219
|
-
},
|
|
220
|
-
column:
|
|
221
|
-
"column-reverse":
|
|
222
|
-
row:
|
|
223
|
-
"row-reverse":
|
|
224
|
-
},
|
|
219
|
+
}, Ze = {
|
|
220
|
+
column: V.Column,
|
|
221
|
+
"column-reverse": V.ColumnReverse,
|
|
222
|
+
row: V.Row,
|
|
223
|
+
"row-reverse": V.RowReverse
|
|
224
|
+
}, Ke = {
|
|
225
225
|
nowrap: q.NoWrap,
|
|
226
226
|
wrap: q.Wrap,
|
|
227
227
|
"wrap-reverse": q.WrapReverse
|
|
228
|
-
},
|
|
228
|
+
}, Qe = [
|
|
229
229
|
["left", P.Left],
|
|
230
230
|
["top", P.Top],
|
|
231
231
|
["right", P.Right],
|
|
232
232
|
["bottom", P.Bottom]
|
|
233
233
|
];
|
|
234
|
-
function
|
|
235
|
-
const l =
|
|
234
|
+
function et(e, n, t, i) {
|
|
235
|
+
const l = se;
|
|
236
236
|
if (l === null)
|
|
237
237
|
throw new Error("loadLayoutEngine() must be awaited before rendering");
|
|
238
|
-
const
|
|
239
|
-
let a = 0,
|
|
240
|
-
const f = (
|
|
238
|
+
const o = [], p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), v = [], d = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
239
|
+
let a = 0, u = !1, r = !1;
|
|
240
|
+
const f = (m, k) => {
|
|
241
241
|
var T;
|
|
242
|
-
return ((T =
|
|
242
|
+
return ((T = m.get(k)) == null ? void 0 : T.value) ?? ee[k] ?? "";
|
|
243
243
|
};
|
|
244
|
-
function
|
|
245
|
-
|
|
244
|
+
function b(m, k) {
|
|
245
|
+
o.push({ kind: "unsupported-property", message: m, node: k.id });
|
|
246
246
|
}
|
|
247
|
-
function c(
|
|
248
|
-
const N = f(
|
|
247
|
+
function c(m, k, T) {
|
|
248
|
+
const N = f(m, k);
|
|
249
249
|
if (N === "") return null;
|
|
250
|
-
const { length:
|
|
251
|
-
return
|
|
250
|
+
const { length: I, problem: C } = X(N);
|
|
251
|
+
return C !== void 0 && b(`${k}: ${C}`, T), I;
|
|
252
252
|
}
|
|
253
|
-
function S(
|
|
254
|
-
if (
|
|
255
|
-
switch (
|
|
253
|
+
function S(m) {
|
|
254
|
+
if (m !== null)
|
|
255
|
+
switch (m.kind) {
|
|
256
256
|
case "px":
|
|
257
|
-
return
|
|
257
|
+
return m.value;
|
|
258
258
|
case "percent":
|
|
259
|
-
return `${
|
|
259
|
+
return `${m.value}%`;
|
|
260
260
|
case "auto":
|
|
261
261
|
return "auto";
|
|
262
262
|
case "none":
|
|
263
263
|
return;
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
function h(
|
|
267
|
-
if (
|
|
268
|
-
if (
|
|
269
|
-
if (
|
|
266
|
+
function h(m) {
|
|
267
|
+
if (m !== null) {
|
|
268
|
+
if (m.kind === "px") return m.value;
|
|
269
|
+
if (m.kind === "percent") return `${m.value}%`;
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
|
|
272
|
+
function w(m, k, T) {
|
|
273
|
+
m.setBoxSizing(Me.BorderBox), m.setFlexDirection(Ze[f(k, "flex-direction")] ?? V.Column), m.setFlexWrap(Ke[f(k, "flex-wrap")] ?? q.NoWrap), m.setJustifyContent(Je[f(k, "justify-content")] ?? W.FlexStart), m.setAlignItems(K[f(k, "align-items")] ?? L.Stretch), m.setAlignSelf(K[f(k, "align-self")] ?? L.Auto), m.setAlignContent(K[f(k, "align-content")] ?? L.FlexStart), m.setFlexGrow(pe(f(k, "flex-grow")) ?? 0), m.setFlexShrink(pe(f(k, "flex-shrink")) ?? 1), m.setFlexBasis(S(c(k, "flex-basis", T)));
|
|
274
274
|
const N = f(k, "position");
|
|
275
|
-
(N === "fixed" || N === "sticky") &&
|
|
276
|
-
N === "absolute" ?
|
|
277
|
-
), f(k, "display") === "none" &&
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
for (const [
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
|
|
275
|
+
(N === "fixed" || N === "sticky") && b(`position: ${N} is not supported in USS; treated as relative`, T), m.setPositionType(
|
|
276
|
+
N === "absolute" ? J.Absolute : J.Relative
|
|
277
|
+
), f(k, "display") === "none" && m.setDisplay(Ue.None);
|
|
278
|
+
const I = f(k, "overflow");
|
|
279
|
+
I === "hidden" ? m.setOverflow(De.Hidden) : (I === "auto" || I === "scroll") && b(`overflow: ${I} needs a ScrollView element in USS`, T), m.setWidth(S(c(k, "width", T))), m.setHeight(S(c(k, "height", T))), m.setMinWidth(h(c(k, "min-width", T))), m.setMinHeight(h(c(k, "min-height", T))), m.setMaxWidth(h(c(k, "max-width", T))), m.setMaxHeight(h(c(k, "max-height", T)));
|
|
280
|
+
for (const [C, A] of Qe) {
|
|
281
|
+
m.setMargin(A, h(c(k, `margin-${C}`, T))), m.setPadding(A, h(c(k, `padding-${C}`, T)));
|
|
282
|
+
const _ = h(c(k, `border-${C}-width`, T));
|
|
283
|
+
m.setBorder(A, typeof _ == "number" ? _ : void 0), m.setPosition(A, h(c(k, C, T)));
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
function y(
|
|
286
|
+
function y(m) {
|
|
287
287
|
var k;
|
|
288
|
-
return (k =
|
|
288
|
+
return (k = m.attributes.find((T) => T.name === "text")) == null ? void 0 : k.value;
|
|
289
289
|
}
|
|
290
290
|
const x = ["text", "label"];
|
|
291
|
-
function $(
|
|
291
|
+
function $(m) {
|
|
292
292
|
return x.filter(
|
|
293
|
-
(k) =>
|
|
293
|
+
(k) => m.attributes.some((T) => T.name === k && T.value.length > 0)
|
|
294
294
|
);
|
|
295
295
|
}
|
|
296
|
-
function O(
|
|
297
|
-
if (
|
|
298
|
-
const T = n.get(
|
|
299
|
-
a++, G++,
|
|
300
|
-
const { spec:
|
|
301
|
-
if (
|
|
302
|
-
const
|
|
303
|
-
|
|
296
|
+
function O(m, k) {
|
|
297
|
+
if (_e(m)) return;
|
|
298
|
+
const T = n.get(m.id) ?? /* @__PURE__ */ new Map(), N = l.Node.create();
|
|
299
|
+
a++, G++, d.set(m, N), v.push(m), w(N, T, m), k !== null && k.insertChild(N, k.getChildCount());
|
|
300
|
+
const { spec: I, fallback: C } = F(m), A = y(m), _ = I.hasText && A !== void 0 && A.length > 0;
|
|
301
|
+
if (C) {
|
|
302
|
+
const R = $(m);
|
|
303
|
+
o.push({
|
|
304
304
|
kind: "unsupported-control",
|
|
305
|
-
message: `<${
|
|
306
|
-
node:
|
|
305
|
+
message: `<${m.name.local}> has no renderer in this version and is drawn as a plain VisualElement` + (R.length === 0 ? "" : `; its ${R.join(" and ")} attribute${R.length > 1 ? "s are" : " is"} not drawn, because Unity draws that through a child element`),
|
|
306
|
+
node: m.id
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
|
-
if (
|
|
310
|
-
|
|
311
|
-
`<${
|
|
312
|
-
|
|
309
|
+
if (_) {
|
|
310
|
+
m.children.length > 0 && b(
|
|
311
|
+
`<${m.name.local}> has both a text attribute and children; children are not drawn`,
|
|
312
|
+
m
|
|
313
313
|
);
|
|
314
|
-
const
|
|
315
|
-
fontSize:
|
|
314
|
+
const R = c(T, "font-size", m), z = {
|
|
315
|
+
fontSize: R !== null && R.kind === "px" ? R.value : 12,
|
|
316
316
|
fontStyle: f(T, "-unity-font-style") || "normal",
|
|
317
317
|
whiteSpace: f(T, "white-space") || "normal"
|
|
318
318
|
};
|
|
319
319
|
N.setMeasureFunc(
|
|
320
320
|
(U) => i.measureText(
|
|
321
321
|
A,
|
|
322
|
-
|
|
322
|
+
z,
|
|
323
323
|
Number.isFinite(U) ? U : 0
|
|
324
324
|
)
|
|
325
325
|
);
|
|
326
326
|
return;
|
|
327
327
|
}
|
|
328
328
|
let j = N;
|
|
329
|
-
if (
|
|
330
|
-
|
|
329
|
+
if (I.parts.length > 0) {
|
|
330
|
+
r || (r = !0, o.push({
|
|
331
331
|
kind: "version-dependent",
|
|
332
|
-
message: `<${
|
|
333
|
-
node:
|
|
332
|
+
message: `<${m.name.local}> is drawn with the implicit child elements Unity builds for it, and their geometry was measured on Unity ${Y}. Other versions may differ; see src/controls/theme.ts.`,
|
|
333
|
+
node: m.id
|
|
334
334
|
}));
|
|
335
|
-
const
|
|
336
|
-
for (const
|
|
337
|
-
const
|
|
338
|
-
a++, G++,
|
|
339
|
-
name:
|
|
340
|
-
owner:
|
|
335
|
+
const R = [], z = [], U = t.get(m.id);
|
|
336
|
+
for (const ae of I.parts) {
|
|
337
|
+
const le = (U == null ? void 0 : U.get(ae.name)) ?? /* @__PURE__ */ new Map(), H = l.Node.create();
|
|
338
|
+
a++, G++, w(H, le, m), j.insertChild(H, j.getChildCount()), j = H, z.push(H), R.push({
|
|
339
|
+
name: ae.name,
|
|
340
|
+
owner: m.id,
|
|
341
341
|
box: { left: 0, top: 0, width: 0, height: 0 },
|
|
342
|
-
style:
|
|
342
|
+
style: le
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
|
-
g.set(
|
|
345
|
+
g.set(m.id, R), s.set(m.id, z);
|
|
346
346
|
}
|
|
347
|
-
for (const
|
|
347
|
+
for (const R of m.children) O(R, j);
|
|
348
348
|
}
|
|
349
|
-
O(
|
|
350
|
-
const E =
|
|
351
|
-
E.setWidth(i.size.width), E.setHeight(i.size.height), E.setPositionType(
|
|
352
|
-
const
|
|
353
|
-
for (let
|
|
349
|
+
O(e, null);
|
|
350
|
+
const E = d.get(e);
|
|
351
|
+
E.setWidth(i.size.width), E.setHeight(i.size.height), E.setPositionType(J.Relative), E.calculateLayout(i.size.width, i.size.height, ce.LTR);
|
|
352
|
+
const M = /* @__PURE__ */ new Map();
|
|
353
|
+
for (let m = 0; m < 3; m++) {
|
|
354
354
|
let k = !1;
|
|
355
355
|
for (const [T, N] of g) {
|
|
356
|
-
const
|
|
357
|
-
if (
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
const
|
|
361
|
-
(
|
|
356
|
+
const I = s.get(T);
|
|
357
|
+
if (I === void 0) continue;
|
|
358
|
+
const C = N.findIndex((U) => U.name === "unity-content-viewport"), A = N.findIndex((U) => U.name === "unity-content-container");
|
|
359
|
+
if (C === -1 || A === -1) continue;
|
|
360
|
+
const _ = I[C].getComputedLayout(), R = I[A].getComputedLayout().height > _.height + 0.01, z = Pe(R);
|
|
361
|
+
(M.get(T) ?? 0) !== z && (M.set(T, z), I[C].setMargin(P.Right, z), k = !0);
|
|
362
362
|
}
|
|
363
363
|
if (!k) break;
|
|
364
|
-
E.calculateLayout(i.size.width, i.size.height,
|
|
364
|
+
E.calculateLayout(i.size.width, i.size.height, ce.LTR);
|
|
365
365
|
}
|
|
366
|
-
function D(
|
|
367
|
-
const N =
|
|
366
|
+
function D(m, k, T) {
|
|
367
|
+
const N = d.get(m);
|
|
368
368
|
if (N === void 0) return;
|
|
369
|
-
const
|
|
370
|
-
let
|
|
371
|
-
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
const U = j[
|
|
375
|
-
|
|
369
|
+
const I = N.getComputedLayout();
|
|
370
|
+
let C = k + I.left, A = T + I.top;
|
|
371
|
+
p.set(m.id, { left: C, top: A, width: I.width, height: I.height });
|
|
372
|
+
const _ = g.get(m.id), j = s.get(m.id);
|
|
373
|
+
_ !== void 0 && j !== void 0 && _.forEach((R, z) => {
|
|
374
|
+
const U = j[z].getComputedLayout();
|
|
375
|
+
C += U.left, A += U.top, R.box = { left: C, top: A, width: U.width, height: U.height };
|
|
376
376
|
});
|
|
377
|
-
for (const
|
|
377
|
+
for (const R of m.children) D(R, C, A);
|
|
378
378
|
}
|
|
379
|
-
return D(
|
|
380
|
-
boxes:
|
|
379
|
+
return D(e, 0, 0), {
|
|
380
|
+
boxes: p,
|
|
381
381
|
parts: g,
|
|
382
382
|
painted: v,
|
|
383
|
-
warnings:
|
|
383
|
+
warnings: o,
|
|
384
384
|
dispose() {
|
|
385
|
-
|
|
385
|
+
u || (u = !0, E.freeRecursive(), G -= a, d.clear(), s.clear());
|
|
386
386
|
}
|
|
387
387
|
};
|
|
388
388
|
}
|
|
389
|
-
const
|
|
390
|
-
function
|
|
391
|
-
var
|
|
389
|
+
const tt = 1.2;
|
|
390
|
+
function nt(e) {
|
|
391
|
+
var t;
|
|
392
392
|
let n = null;
|
|
393
|
-
if (
|
|
394
|
-
const i =
|
|
395
|
-
n = ((
|
|
393
|
+
if (e !== void 0) {
|
|
394
|
+
const i = e.createElement("canvas");
|
|
395
|
+
n = ((t = i.getContext) == null ? void 0 : t.call(i, "2d")) ?? null;
|
|
396
396
|
}
|
|
397
|
-
return (i, l,
|
|
398
|
-
const
|
|
397
|
+
return (i, l, o) => {
|
|
398
|
+
const p = l.fontSize * tt, g = (r) => {
|
|
399
399
|
if (n === null)
|
|
400
|
-
return
|
|
401
|
-
const f = l.fontStyle.includes("bold") ? "bold" : "normal",
|
|
402
|
-
return n.font = `${
|
|
400
|
+
return r.length * l.fontSize * 0.5;
|
|
401
|
+
const f = l.fontStyle.includes("bold") ? "bold" : "normal", b = l.fontStyle.includes("italic") ? "italic" : "normal";
|
|
402
|
+
return n.font = `${b} ${f} ${l.fontSize}px sans-serif`, n.measureText(r).width;
|
|
403
403
|
};
|
|
404
|
-
if (!(l.whiteSpace !== "nowrap" && l.whiteSpace !== "pre") ||
|
|
405
|
-
const
|
|
404
|
+
if (!(l.whiteSpace !== "nowrap" && l.whiteSpace !== "pre") || o <= 0) {
|
|
405
|
+
const r = i.split(`
|
|
406
406
|
`);
|
|
407
|
-
return { width:
|
|
407
|
+
return { width: r.reduce((b, c) => Math.max(b, g(c)), 0), height: r.length * p };
|
|
408
408
|
}
|
|
409
|
-
const
|
|
410
|
-
let
|
|
411
|
-
for (const
|
|
412
|
-
const f = g(
|
|
413
|
-
a > 0 && a +
|
|
409
|
+
const d = i.split(/\s+/).filter((r) => r.length > 0);
|
|
410
|
+
let s = 1, a = 0, u = 0;
|
|
411
|
+
for (const r of d) {
|
|
412
|
+
const f = g(r), b = a === 0 ? 0 : g(" ");
|
|
413
|
+
a > 0 && a + b + f > o ? (u = Math.max(u, a), s++, a = f) : a += b + f;
|
|
414
414
|
}
|
|
415
|
-
return
|
|
415
|
+
return u = Math.max(u, a), { width: u, height: s * p };
|
|
416
416
|
};
|
|
417
417
|
}
|
|
418
|
-
function
|
|
419
|
-
const n = (
|
|
420
|
-
return
|
|
418
|
+
function re(e) {
|
|
419
|
+
const n = (t, i) => !Number.isInteger(t) || t < 0 || t > 1114111 || t >= 55296 && t <= 57343 ? i : String.fromCodePoint(t);
|
|
420
|
+
return e.replace(/&#x([0-9a-f]+);/gi, (t, i) => n(parseInt(i, 16), t)).replace(/&#(\d+);/g, (t, i) => n(Number(i), t)).replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
421
421
|
}
|
|
422
|
-
const
|
|
422
|
+
const it = /* @__PURE__ */ new Set([
|
|
423
423
|
"box-shadow",
|
|
424
424
|
"filter",
|
|
425
425
|
"backdrop-filter",
|
|
@@ -435,7 +435,7 @@ const ie = /* @__PURE__ */ new Set([
|
|
|
435
435
|
"float",
|
|
436
436
|
"clear",
|
|
437
437
|
"border-style"
|
|
438
|
-
]),
|
|
438
|
+
]), st = /* @__PURE__ */ new Set([
|
|
439
439
|
"gap",
|
|
440
440
|
"row-gap",
|
|
441
441
|
"column-gap",
|
|
@@ -445,16 +445,16 @@ const ie = /* @__PURE__ */ new Set([
|
|
|
445
445
|
"background-repeat",
|
|
446
446
|
"overflow-wrap",
|
|
447
447
|
"word-break"
|
|
448
|
-
]),
|
|
448
|
+
]), he = ["top", "right", "bottom", "left"], rt = {
|
|
449
449
|
normal: { weight: "normal", style: "normal" },
|
|
450
450
|
bold: { weight: "bold", style: "normal" },
|
|
451
451
|
italic: { weight: "normal", style: "italic" },
|
|
452
452
|
"bold-and-italic": { weight: "bold", style: "italic" }
|
|
453
|
-
},
|
|
453
|
+
}, ot = {
|
|
454
454
|
upper: "flex-start",
|
|
455
455
|
middle: "center",
|
|
456
456
|
lower: "flex-end"
|
|
457
|
-
},
|
|
457
|
+
}, at = {
|
|
458
458
|
left: "flex-start",
|
|
459
459
|
center: "center",
|
|
460
460
|
right: "flex-end"
|
|
@@ -462,22 +462,22 @@ const ie = /* @__PURE__ */ new Set([
|
|
|
462
462
|
"stretch-to-fill": "100% 100%",
|
|
463
463
|
"scale-and-crop": "cover",
|
|
464
464
|
"scale-to-fit": "contain"
|
|
465
|
-
},
|
|
466
|
-
function
|
|
467
|
-
const n = /^(
|
|
468
|
-
return n === null ? null : n[
|
|
469
|
-
}
|
|
470
|
-
function
|
|
471
|
-
var
|
|
472
|
-
const i = {}, l = [],
|
|
465
|
+
}, me = "stretch-to-fill";
|
|
466
|
+
function lt(e) {
|
|
467
|
+
const n = /^(url|resource)\(\s*(["']?)(.*?)\2\s*\)$/.exec(re(e).trim());
|
|
468
|
+
return n === null ? null : { form: n[1], path: n[3] };
|
|
469
|
+
}
|
|
470
|
+
function ge(e, n, t = {}) {
|
|
471
|
+
var b;
|
|
472
|
+
const i = {}, l = [], o = (c) => {
|
|
473
473
|
var S;
|
|
474
|
-
return (S =
|
|
475
|
-
},
|
|
474
|
+
return (S = e.get(c)) == null ? void 0 : S.value;
|
|
475
|
+
}, p = (c, S) => {
|
|
476
476
|
l.push({ kind: c, message: S, node: n });
|
|
477
477
|
};
|
|
478
478
|
i["box-sizing"] = "border-box";
|
|
479
|
-
for (const [c] of
|
|
480
|
-
|
|
479
|
+
for (const [c] of e)
|
|
480
|
+
it.has(c) ? p("unsupported-property", `${c} does not exist in USS and is ignored`) : st.has(c) && p(
|
|
481
481
|
"version-dependent",
|
|
482
482
|
`${c} depends on the Unity version; verify it in your project`
|
|
483
483
|
);
|
|
@@ -495,23 +495,23 @@ function mt(t, n, e = {}) {
|
|
|
495
495
|
"transform-origin"
|
|
496
496
|
];
|
|
497
497
|
for (const c of g) {
|
|
498
|
-
const S =
|
|
498
|
+
const S = o(c);
|
|
499
499
|
S !== void 0 && (i[c] = S);
|
|
500
500
|
}
|
|
501
|
-
|
|
502
|
-
for (const c of
|
|
503
|
-
const S =
|
|
501
|
+
o("display") === "none" && (i.display = "none"), o("overflow") === "hidden" && (i.overflow = "hidden");
|
|
502
|
+
for (const c of he) {
|
|
503
|
+
const S = o(`border-${c}-width`);
|
|
504
504
|
if (S !== void 0 && S !== "0") {
|
|
505
|
-
const { length: y, problem: x } =
|
|
506
|
-
y === null || y.kind !== "px" ?
|
|
505
|
+
const { length: y, problem: x } = X(S);
|
|
506
|
+
y === null || y.kind !== "px" ? p(
|
|
507
507
|
"unsupported-property",
|
|
508
508
|
`border-${c}-width: ${x ?? `"${S}" is not a pixel length`}; ignored`
|
|
509
509
|
) : (i[`border-${c}-width`] = `${y.value}px`, i[`border-${c}-style`] = "solid");
|
|
510
510
|
}
|
|
511
|
-
const h =
|
|
511
|
+
const h = o(`border-${c}-color`);
|
|
512
512
|
h !== void 0 && (i[`border-${c}-color`] = h);
|
|
513
|
-
const
|
|
514
|
-
|
|
513
|
+
const w = o(`padding-${c}`);
|
|
514
|
+
w !== void 0 && w !== "0" && (i[`padding-${c}`] = w);
|
|
515
515
|
}
|
|
516
516
|
for (const c of [
|
|
517
517
|
"top-left",
|
|
@@ -519,512 +519,522 @@ function mt(t, n, e = {}) {
|
|
|
519
519
|
"bottom-right",
|
|
520
520
|
"bottom-left"
|
|
521
521
|
]) {
|
|
522
|
-
const S =
|
|
522
|
+
const S = o(`border-${c}-radius`);
|
|
523
523
|
S !== void 0 && (i[`border-${c}-radius`] = S);
|
|
524
524
|
}
|
|
525
|
-
const v =
|
|
525
|
+
const v = o("-unity-font-style");
|
|
526
526
|
if (v !== void 0) {
|
|
527
|
-
const c =
|
|
528
|
-
c === void 0 ?
|
|
529
|
-
}
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
532
|
-
const [c, S] =
|
|
533
|
-
h === void 0 ||
|
|
534
|
-
}
|
|
535
|
-
const
|
|
536
|
-
a !== void 0 &&
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
const f =
|
|
527
|
+
const c = rt[v];
|
|
528
|
+
c === void 0 ? p("unsupported-property", `-unity-font-style: ${v} is not a USS value`) : (i["font-weight"] = c.weight, i["font-style"] = c.style);
|
|
529
|
+
}
|
|
530
|
+
const d = o("-unity-text-align");
|
|
531
|
+
if (d !== void 0) {
|
|
532
|
+
const [c, S] = d.split("-"), h = ot[c ?? ""], w = at[S ?? ""];
|
|
533
|
+
h === void 0 || w === void 0 ? p("unsupported-property", `-unity-text-align: ${d} is not a USS value`) : (i["align-items"] = h, i["justify-content"] = w);
|
|
534
|
+
}
|
|
535
|
+
const s = [], a = o("translate");
|
|
536
|
+
a !== void 0 && s.push(`translate(${a.replace(/\s+/, ", ")})`);
|
|
537
|
+
const u = o("rotate");
|
|
538
|
+
u !== void 0 && s.push(`rotate(${u})`);
|
|
539
|
+
const r = o("scale");
|
|
540
|
+
r !== void 0 && s.push(`scale(${r.replace(/\s+/, ", ")})`), s.length > 0 && (i.transform = s.join(" "));
|
|
541
|
+
const f = o("background-image");
|
|
542
542
|
if (f !== void 0 && f !== "none") {
|
|
543
|
-
const c =
|
|
543
|
+
const c = lt(f);
|
|
544
544
|
if (c === null)
|
|
545
|
-
|
|
545
|
+
p("asset-unresolved", `background-image: cannot read "${f}" as an asset path`);
|
|
546
546
|
else {
|
|
547
|
-
const S = ((
|
|
548
|
-
if (
|
|
549
|
-
i["background-image"] = "repeating-linear-gradient(45deg, rgba(255,0,255,0.35) 0 6px, rgba(0,0,0,0) 6px 12px)",
|
|
547
|
+
const { form: S, path: h } = c, w = ((b = t.resolveAsset) == null ? void 0 : b.call(t, h, S)) ?? null;
|
|
548
|
+
if (w === null)
|
|
549
|
+
i["background-image"] = "repeating-linear-gradient(45deg, rgba(255,0,255,0.35) 0 6px, rgba(0,0,0,0) 6px 12px)", p("asset-unresolved", `background-image: "${h}" was not resolved`);
|
|
550
550
|
else {
|
|
551
|
-
i["background-image"] = `url("${
|
|
552
|
-
const
|
|
553
|
-
|
|
551
|
+
i["background-image"] = `url("${w}")`, i["background-repeat"] = o("background-repeat") ?? "no-repeat", i["background-position"] = o("background-position") ?? "center";
|
|
552
|
+
const y = o("background-size"), x = o("-unity-background-scale-mode") ?? me, $ = Q[x];
|
|
553
|
+
$ === void 0 && p(
|
|
554
554
|
"unsupported-property",
|
|
555
|
-
`-unity-background-scale-mode: ${
|
|
556
|
-
), i["background-size"] =
|
|
555
|
+
`-unity-background-scale-mode: ${x} is not a USS value; expected one of ${Object.keys(Q).join(", ")}`
|
|
556
|
+
), i["background-size"] = y ?? $ ?? Q[me];
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
return
|
|
560
|
+
return o("-unity-background-image-tint-color") !== void 0 && p(
|
|
561
561
|
"unsupported-property",
|
|
562
562
|
"-unity-background-image-tint-color has no CSS equivalent and is not drawn"
|
|
563
|
-
),
|
|
563
|
+
), he.some((c) => o(`-unity-slice-${c}`) !== void 0) && p("unsupported-property", "-unity-slice-* (9-slice) is not drawn in this preview"), o("-unity-font-definition") !== void 0 && p(
|
|
564
564
|
"unsupported-property",
|
|
565
565
|
"-unity-font-definition names a Unity font asset; the browser default is used"
|
|
566
566
|
), { declarations: i, warnings: l };
|
|
567
567
|
}
|
|
568
|
-
const
|
|
569
|
-
function
|
|
570
|
-
const
|
|
571
|
-
function v(
|
|
572
|
-
const
|
|
568
|
+
const ct = "data-uxml-node", ut = "data-uxml-part", dt = "data-uxml-part-owner";
|
|
569
|
+
function ft(e, n, t, i, l, o) {
|
|
570
|
+
const p = [], g = /* @__PURE__ */ new Map();
|
|
571
|
+
function v(u) {
|
|
572
|
+
const r = i.get(u.id), f = (b) => {
|
|
573
573
|
var h;
|
|
574
|
-
const c = ((h =
|
|
574
|
+
const c = ((h = r == null ? void 0 : r.get(b)) == null ? void 0 : h.value) ?? ee[b] ?? "0", { length: S } = X(c);
|
|
575
575
|
return S !== null && S.kind === "px" ? S.value : 0;
|
|
576
576
|
};
|
|
577
577
|
return { left: f("border-left-width"), top: f("border-top-width") };
|
|
578
578
|
}
|
|
579
|
-
function u
|
|
580
|
-
const
|
|
579
|
+
function d(u) {
|
|
580
|
+
const r = (f) => {
|
|
581
581
|
var S;
|
|
582
|
-
const
|
|
582
|
+
const b = ((S = u.style.get(f)) == null ? void 0 : S.value) ?? ee[f] ?? "0", { length: c } = X(b);
|
|
583
583
|
return c !== null && c.kind === "px" ? c.value : 0;
|
|
584
584
|
};
|
|
585
|
-
return { left:
|
|
585
|
+
return { left: r("border-left-width"), top: r("border-top-width") };
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function s(u, r, f) {
|
|
588
588
|
var E;
|
|
589
|
-
const
|
|
590
|
-
if (
|
|
591
|
-
const c =
|
|
592
|
-
c.setAttribute(
|
|
593
|
-
const S = i.get(
|
|
594
|
-
|
|
595
|
-
const
|
|
589
|
+
const b = n.get(u.id);
|
|
590
|
+
if (b === void 0) return null;
|
|
591
|
+
const c = o.document.createElement("div");
|
|
592
|
+
c.setAttribute(ct, String(u.id));
|
|
593
|
+
const S = i.get(u.id) ?? /* @__PURE__ */ new Map(), h = ge(S, u.id, o);
|
|
594
|
+
p.push(...h.warnings);
|
|
595
|
+
const w = r === null ? 0 : b.left - r.left - f.left, y = r === null ? 0 : b.top - r.top - f.top, x = {
|
|
596
596
|
position: "absolute",
|
|
597
|
-
left: `${
|
|
597
|
+
left: `${w}px`,
|
|
598
598
|
top: `${y}px`,
|
|
599
|
-
width: `${
|
|
600
|
-
height: `${
|
|
599
|
+
width: `${b.width}px`,
|
|
600
|
+
height: `${b.height}px`,
|
|
601
601
|
margin: "0",
|
|
602
602
|
...h.declarations
|
|
603
603
|
};
|
|
604
|
-
for (const [
|
|
605
|
-
c.style.setProperty(
|
|
606
|
-
const { spec: $ } = F(
|
|
604
|
+
for (const [M, D] of Object.entries(x))
|
|
605
|
+
c.style.setProperty(M, D);
|
|
606
|
+
const { spec: $ } = F(u), O = (E = u.attributes.find((M) => M.name === "text")) == null ? void 0 : E.value;
|
|
607
607
|
if ($.hasText && O !== void 0 && O.length > 0)
|
|
608
|
-
c.style.setProperty("display", h.declarations.display ?? "flex"), h.declarations["align-items"] === void 0 && c.style.setProperty("align-items", "flex-start"), h.declarations["justify-content"] === void 0 && c.style.setProperty("justify-content", "flex-start"), c.textContent =
|
|
608
|
+
c.style.setProperty("display", h.declarations.display ?? "flex"), h.declarations["align-items"] === void 0 && c.style.setProperty("align-items", "flex-start"), h.declarations["justify-content"] === void 0 && c.style.setProperty("justify-content", "flex-start"), c.textContent = re(O);
|
|
609
609
|
else {
|
|
610
|
-
let
|
|
611
|
-
for (const k of
|
|
612
|
-
const T =
|
|
613
|
-
T.setAttribute(
|
|
614
|
-
const N =
|
|
615
|
-
|
|
616
|
-
const
|
|
610
|
+
let M = c, D = b, m = v(u);
|
|
611
|
+
for (const k of t.get(u.id) ?? []) {
|
|
612
|
+
const T = o.document.createElement("div");
|
|
613
|
+
T.setAttribute(ut, k.name), T.setAttribute(dt, String(u.id));
|
|
614
|
+
const N = ge(k.style, u.id, o);
|
|
615
|
+
p.push(...N.warnings);
|
|
616
|
+
const I = {
|
|
617
617
|
position: "absolute",
|
|
618
|
-
left: `${k.box.left - D.left -
|
|
619
|
-
top: `${k.box.top - D.top -
|
|
618
|
+
left: `${k.box.left - D.left - m.left}px`,
|
|
619
|
+
top: `${k.box.top - D.top - m.top}px`,
|
|
620
620
|
width: `${k.box.width}px`,
|
|
621
621
|
height: `${k.box.height}px`,
|
|
622
622
|
margin: "0",
|
|
623
623
|
...N.declarations
|
|
624
624
|
};
|
|
625
|
-
for (const [
|
|
626
|
-
T.style.setProperty(
|
|
627
|
-
|
|
625
|
+
for (const [C, A] of Object.entries(I))
|
|
626
|
+
T.style.setProperty(C, A);
|
|
627
|
+
M.appendChild(T), M = T, D = k.box, m = d(k);
|
|
628
628
|
}
|
|
629
|
-
for (const k of
|
|
630
|
-
const T =
|
|
631
|
-
T !== null &&
|
|
629
|
+
for (const k of u.children) {
|
|
630
|
+
const T = s(k, D, m);
|
|
631
|
+
T !== null && M.appendChild(T);
|
|
632
632
|
}
|
|
633
633
|
}
|
|
634
|
-
return g.set(
|
|
634
|
+
return g.set(u.id, c), c;
|
|
635
635
|
}
|
|
636
636
|
l.replaceChildren();
|
|
637
|
-
const a =
|
|
638
|
-
return a !== null && (a.style.setProperty("position", "relative"), l.appendChild(a)), { warnings:
|
|
637
|
+
const a = s(e, null, { left: 0, top: 0 });
|
|
638
|
+
return a !== null && (a.style.setProperty("position", "relative"), l.appendChild(a)), { warnings: p, elements: g };
|
|
639
639
|
}
|
|
640
|
-
const
|
|
641
|
-
function B(
|
|
642
|
-
return
|
|
643
|
-
` ||
|
|
640
|
+
const we = /[A-Za-z0-9_-]/;
|
|
641
|
+
function B(e) {
|
|
642
|
+
return e === " " || e === " " || e === `
|
|
643
|
+
` || e === "\r" || e === "\f";
|
|
644
644
|
}
|
|
645
|
-
function
|
|
645
|
+
function te(e, n, t) {
|
|
646
646
|
let i = n, l = 0;
|
|
647
|
-
for (; i <
|
|
648
|
-
const
|
|
649
|
-
if (
|
|
650
|
-
const
|
|
651
|
-
i =
|
|
647
|
+
for (; i < e.length; ) {
|
|
648
|
+
const o = e[i];
|
|
649
|
+
if (o === '"' || o === "'") {
|
|
650
|
+
const p = e.indexOf(o, i + 1);
|
|
651
|
+
i = p < 0 ? e.length : p + 1;
|
|
652
652
|
continue;
|
|
653
653
|
}
|
|
654
|
-
if (
|
|
655
|
-
const
|
|
656
|
-
i =
|
|
654
|
+
if (o === "/" && e[i + 1] === "*") {
|
|
655
|
+
const p = e.indexOf("*/", i + 2);
|
|
656
|
+
i = p < 0 ? e.length : p + 2;
|
|
657
657
|
continue;
|
|
658
658
|
}
|
|
659
|
-
if (
|
|
659
|
+
if (o === "(" || o === "[")
|
|
660
660
|
l++;
|
|
661
|
-
else if (
|
|
661
|
+
else if (o === ")" || o === "]")
|
|
662
662
|
l > 0 && l--;
|
|
663
|
-
else if (l === 0 &&
|
|
663
|
+
else if (l === 0 && t.includes(o))
|
|
664
664
|
return i;
|
|
665
665
|
i++;
|
|
666
666
|
}
|
|
667
|
-
return
|
|
667
|
+
return e.length;
|
|
668
668
|
}
|
|
669
|
-
function
|
|
670
|
-
let i = n, l =
|
|
671
|
-
for (; i < l && B(
|
|
672
|
-
for (; l > i && B(
|
|
669
|
+
function ke(e, n, t) {
|
|
670
|
+
let i = n, l = t;
|
|
671
|
+
for (; i < l && B(e[i]); ) i++;
|
|
672
|
+
for (; l > i && B(e[l - 1]); ) l--;
|
|
673
673
|
return { start: i, end: l };
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function Se(e, n, t, i) {
|
|
676
676
|
const l = [];
|
|
677
|
-
let
|
|
678
|
-
for (;
|
|
679
|
-
for (;
|
|
680
|
-
if (
|
|
681
|
-
const
|
|
682
|
-
|
|
677
|
+
let o = n;
|
|
678
|
+
for (; o < t; ) {
|
|
679
|
+
for (; o < t && (B(e[o]) || e.startsWith("/*", o)); )
|
|
680
|
+
if (e.startsWith("/*", o)) {
|
|
681
|
+
const s = e.indexOf("*/", o + 2);
|
|
682
|
+
o = s < 0 ? t : s + 2;
|
|
683
683
|
} else
|
|
684
|
-
|
|
685
|
-
if (
|
|
686
|
-
if (
|
|
687
|
-
|
|
684
|
+
o++;
|
|
685
|
+
if (o >= t) break;
|
|
686
|
+
if (e[o] === ";") {
|
|
687
|
+
o++;
|
|
688
688
|
continue;
|
|
689
689
|
}
|
|
690
|
-
const
|
|
691
|
-
if (g >=
|
|
692
|
-
const
|
|
693
|
-
i == null || i("declaration without a value",
|
|
690
|
+
const p = o, g = te(e, p, ":;}");
|
|
691
|
+
if (g >= t || e[g] !== ":") {
|
|
692
|
+
const s = Math.min(g, t);
|
|
693
|
+
i == null || i("declaration without a value", p, s), o = s + 1;
|
|
694
694
|
continue;
|
|
695
695
|
}
|
|
696
|
-
const v = Math.min(
|
|
696
|
+
const v = Math.min(te(e, g + 1, ";}"), t), d = ke(e, g + 1, v);
|
|
697
697
|
l.push({
|
|
698
|
-
property:
|
|
699
|
-
value:
|
|
700
|
-
span: { start:
|
|
698
|
+
property: e.slice(p, g).trim(),
|
|
699
|
+
value: e.slice(d.start, d.end),
|
|
700
|
+
span: { start: p, end: d.end },
|
|
701
701
|
dirty: !1
|
|
702
|
-
}),
|
|
702
|
+
}), o = v + 1;
|
|
703
703
|
}
|
|
704
704
|
return l;
|
|
705
705
|
}
|
|
706
|
-
function
|
|
707
|
-
const n =
|
|
708
|
-
return n <
|
|
706
|
+
function pt(e) {
|
|
707
|
+
const n = e.span.end - 1 - e.value.length;
|
|
708
|
+
return n < e.span.start ? null : n;
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function oe(e, n = null, t = 0) {
|
|
711
711
|
const i = [], l = [];
|
|
712
|
-
let
|
|
713
|
-
function
|
|
712
|
+
let o = 0;
|
|
713
|
+
function p(h, w, y) {
|
|
714
714
|
i.push({
|
|
715
715
|
kind: "malformed",
|
|
716
716
|
message: h,
|
|
717
|
-
at: { in: "uss", sheet:
|
|
717
|
+
at: { in: "uss", sheet: t, span: { start: w, end: y } }
|
|
718
718
|
});
|
|
719
719
|
}
|
|
720
720
|
function g() {
|
|
721
721
|
for (; ; ) {
|
|
722
|
-
for (; B(
|
|
723
|
-
if (
|
|
724
|
-
const h =
|
|
725
|
-
|
|
722
|
+
for (; B(e[o]); ) o++;
|
|
723
|
+
if (e.startsWith("/*", o)) {
|
|
724
|
+
const h = e.indexOf("*/", o + 2);
|
|
725
|
+
o = h < 0 ? e.length : h + 2;
|
|
726
726
|
continue;
|
|
727
727
|
}
|
|
728
728
|
return;
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
|
-
const v = (h,
|
|
732
|
-
function
|
|
733
|
-
let
|
|
734
|
-
for (;
|
|
735
|
-
const x =
|
|
731
|
+
const v = (h, w) => te(e, h, w), d = (h, w) => ke(e, h, w);
|
|
732
|
+
function s(h) {
|
|
733
|
+
let w = h + 1, y = 1;
|
|
734
|
+
for (; w < e.length; ) {
|
|
735
|
+
const x = e[w];
|
|
736
736
|
if (x === '"' || x === "'") {
|
|
737
|
-
const $ =
|
|
738
|
-
|
|
737
|
+
const $ = e.indexOf(x, w + 1);
|
|
738
|
+
w = $ < 0 ? e.length : $ + 1;
|
|
739
739
|
continue;
|
|
740
740
|
}
|
|
741
|
-
if (x === "/" &&
|
|
742
|
-
const $ =
|
|
743
|
-
|
|
741
|
+
if (x === "/" && e[w + 1] === "*") {
|
|
742
|
+
const $ = e.indexOf("*/", w + 2);
|
|
743
|
+
w = $ < 0 ? e.length : $ + 2;
|
|
744
744
|
continue;
|
|
745
745
|
}
|
|
746
746
|
if (x === "{") y++;
|
|
747
|
-
else if (x === "}" && --y === 0) return
|
|
748
|
-
|
|
747
|
+
else if (x === "}" && --y === 0) return w + 1;
|
|
748
|
+
w++;
|
|
749
749
|
}
|
|
750
|
-
return
|
|
750
|
+
return e.length;
|
|
751
751
|
}
|
|
752
752
|
function a(h) {
|
|
753
|
-
let
|
|
754
|
-
for (;
|
|
755
|
-
return
|
|
753
|
+
let w = h;
|
|
754
|
+
for (; w < e.length && we.test(e[w]); ) w++;
|
|
755
|
+
return w;
|
|
756
756
|
}
|
|
757
|
-
function
|
|
758
|
-
const
|
|
757
|
+
function u(h) {
|
|
758
|
+
const w = e[h], y = w === "(" ? ")" : "]";
|
|
759
759
|
let x = h + 1, $ = 1;
|
|
760
|
-
for (; x <
|
|
761
|
-
const O =
|
|
760
|
+
for (; x < e.length; ) {
|
|
761
|
+
const O = e[x];
|
|
762
762
|
if (O === '"' || O === "'") {
|
|
763
|
-
const E =
|
|
764
|
-
x = E < 0 ?
|
|
763
|
+
const E = e.indexOf(O, x + 1);
|
|
764
|
+
x = E < 0 ? e.length : E + 1;
|
|
765
765
|
continue;
|
|
766
766
|
}
|
|
767
|
-
if (O ===
|
|
767
|
+
if (O === w) $++;
|
|
768
768
|
else if (O === y && --$ === 0) return x + 1;
|
|
769
769
|
x++;
|
|
770
770
|
}
|
|
771
|
-
return
|
|
771
|
+
return e.length;
|
|
772
772
|
}
|
|
773
|
-
function
|
|
773
|
+
function r(h, w) {
|
|
774
774
|
const y = [];
|
|
775
775
|
let x = h;
|
|
776
|
-
for (; x <
|
|
777
|
-
const $ =
|
|
776
|
+
for (; x < w; ) {
|
|
777
|
+
const $ = e[x];
|
|
778
778
|
if (B($) || $ === ">" || $ === "+" || $ === "~" || $ === ",") break;
|
|
779
779
|
if ($ === "*")
|
|
780
780
|
y.push({ kind: "universal" }), x++;
|
|
781
781
|
else if ($ === "." || $ === "#") {
|
|
782
782
|
const O = a(x + 1);
|
|
783
783
|
y.push(
|
|
784
|
-
$ === "." ? { kind: "class", name:
|
|
784
|
+
$ === "." ? { kind: "class", name: e.slice(x + 1, O) } : { kind: "name", name: e.slice(x + 1, O) }
|
|
785
785
|
), x = O;
|
|
786
786
|
} else if ($ === "[") {
|
|
787
|
-
const O = Math.min(
|
|
788
|
-
y.push({ kind: "unknown", text:
|
|
787
|
+
const O = Math.min(u(x), w);
|
|
788
|
+
y.push({ kind: "unknown", text: e.slice(x, O) }), x = O;
|
|
789
789
|
} else if ($ === ":")
|
|
790
|
-
if (
|
|
790
|
+
if (e[x + 1] === ":") {
|
|
791
791
|
const O = a(x + 2);
|
|
792
|
-
y.push({ kind: "unknown", text:
|
|
792
|
+
y.push({ kind: "unknown", text: e.slice(x, O) }), x = O;
|
|
793
793
|
} else {
|
|
794
794
|
const O = a(x + 1);
|
|
795
|
-
if (
|
|
796
|
-
const E = Math.min(
|
|
797
|
-
y.push({ kind: "unknown", text:
|
|
795
|
+
if (e[O] === "(") {
|
|
796
|
+
const E = Math.min(u(O), w);
|
|
797
|
+
y.push({ kind: "unknown", text: e.slice(x, E) }), x = E;
|
|
798
798
|
} else
|
|
799
|
-
y.push({ kind: "pseudo", name:
|
|
799
|
+
y.push({ kind: "pseudo", name: e.slice(x + 1, O) }), x = O;
|
|
800
800
|
}
|
|
801
|
-
else if (
|
|
801
|
+
else if (we.test($)) {
|
|
802
802
|
const O = a(x);
|
|
803
|
-
y.push({ kind: "type", name:
|
|
803
|
+
y.push({ kind: "type", name: e.slice(x, O) }), x = O;
|
|
804
804
|
} else
|
|
805
805
|
y.push({ kind: "unknown", text: $ }), x++;
|
|
806
806
|
}
|
|
807
807
|
return { simple: y, next: x };
|
|
808
808
|
}
|
|
809
|
-
function f(h,
|
|
810
|
-
const y =
|
|
809
|
+
function f(h, w) {
|
|
810
|
+
const y = d(h, w), x = [];
|
|
811
811
|
let $ = "descendant", O = null, E = y.start;
|
|
812
812
|
for (; E < y.end; ) {
|
|
813
|
-
const
|
|
814
|
-
if (B(
|
|
813
|
+
const M = e[E];
|
|
814
|
+
if (B(M)) {
|
|
815
815
|
E++;
|
|
816
816
|
continue;
|
|
817
817
|
}
|
|
818
|
-
if (
|
|
818
|
+
if (M === ">") {
|
|
819
819
|
$ = "child", E++;
|
|
820
820
|
continue;
|
|
821
821
|
}
|
|
822
|
-
if (
|
|
823
|
-
O =
|
|
822
|
+
if (M === "+" || M === "~") {
|
|
823
|
+
O = M, E++;
|
|
824
824
|
continue;
|
|
825
825
|
}
|
|
826
|
-
const { simple: D, next:
|
|
827
|
-
if (
|
|
826
|
+
const { simple: D, next: m } = r(E, y.end);
|
|
827
|
+
if (m === E) {
|
|
828
828
|
E++;
|
|
829
829
|
continue;
|
|
830
830
|
}
|
|
831
|
-
O !== null && (D.unshift({ kind: "unknown", text: O }), O = null), x.push({ combinator: $, simple: D }), $ = "descendant", E =
|
|
831
|
+
O !== null && (D.unshift({ kind: "unknown", text: O }), O = null), x.push({ combinator: $, simple: D }), $ = "descendant", E = m;
|
|
832
832
|
}
|
|
833
833
|
return { parts: x, span: y };
|
|
834
834
|
}
|
|
835
|
-
function
|
|
835
|
+
function b(h, w) {
|
|
836
836
|
const y = [];
|
|
837
837
|
let x = h;
|
|
838
838
|
for (; ; ) {
|
|
839
|
-
const $ = Math.min(v(x, ","),
|
|
840
|
-
if (y.push(f(x, $)), $ >=
|
|
839
|
+
const $ = Math.min(v(x, ","), w);
|
|
840
|
+
if (y.push(f(x, $)), $ >= w) break;
|
|
841
841
|
x = $ + 1;
|
|
842
842
|
}
|
|
843
843
|
return y;
|
|
844
844
|
}
|
|
845
845
|
function c() {
|
|
846
|
-
const h =
|
|
847
|
-
if (x <
|
|
848
|
-
const O =
|
|
849
|
-
return
|
|
846
|
+
const h = o, w = a(o + 1), y = e.slice(o + 1, w), x = v(w, "{;");
|
|
847
|
+
if (x < e.length && e[x] === "{") {
|
|
848
|
+
const O = s(x);
|
|
849
|
+
return o = O, { kind: "unknown", span: { start: h, end: O } };
|
|
850
850
|
}
|
|
851
|
-
const $ = x <
|
|
852
|
-
if (
|
|
853
|
-
const O =
|
|
854
|
-
return E === null ? (
|
|
851
|
+
const $ = x < e.length ? x + 1 : e.length;
|
|
852
|
+
if (o = $, y === "import") {
|
|
853
|
+
const O = e.slice(w, $), E = /["']([^"']*)["']/.exec(O);
|
|
854
|
+
return E === null ? (p("@import without a quoted path", h, $), { kind: "unknown", span: { start: h, end: $ } }) : { kind: "import", url: E[1], span: { start: h, end: $ } };
|
|
855
855
|
}
|
|
856
856
|
return { kind: "unknown", span: { start: h, end: $ } };
|
|
857
857
|
}
|
|
858
858
|
function S() {
|
|
859
|
-
const h =
|
|
860
|
-
if (
|
|
861
|
-
return
|
|
862
|
-
const y =
|
|
863
|
-
(x >
|
|
859
|
+
const h = o, w = v(h, "{");
|
|
860
|
+
if (w >= e.length)
|
|
861
|
+
return p("rule without a block", h, e.length), o = e.length, { kind: "unknown", span: { start: h, end: e.length } };
|
|
862
|
+
const y = d(h, w), x = s(w);
|
|
863
|
+
(x > e.length || e[x - 1] !== "}") && p("unterminated rule block", h, x);
|
|
864
864
|
const $ = {
|
|
865
|
-
selectors:
|
|
866
|
-
declarations:
|
|
865
|
+
selectors: b(y.start, y.end),
|
|
866
|
+
declarations: Se(e, w + 1, x - 1, p),
|
|
867
867
|
span: { start: y.start, end: x },
|
|
868
868
|
selectorSpan: y,
|
|
869
869
|
selectorDirty: !1,
|
|
870
870
|
declarationsDirty: !1
|
|
871
871
|
};
|
|
872
|
-
return
|
|
872
|
+
return o = x, { kind: "rule", rule: $ };
|
|
873
873
|
}
|
|
874
|
-
for (; g(), !(
|
|
875
|
-
l.push(
|
|
876
|
-
return { sheet: { source:
|
|
874
|
+
for (; g(), !(o >= e.length); )
|
|
875
|
+
l.push(e[o] === "@" ? c() : S());
|
|
876
|
+
return { sheet: { source: e, origin: n, items: l }, warnings: i };
|
|
877
877
|
}
|
|
878
|
-
function
|
|
879
|
-
switch (
|
|
878
|
+
function ht(e, n, t) {
|
|
879
|
+
switch (e.kind) {
|
|
880
880
|
case "universal":
|
|
881
881
|
return !0;
|
|
882
882
|
case "type":
|
|
883
|
-
return
|
|
883
|
+
return t.typeNameOf(n) === e.name;
|
|
884
884
|
case "class":
|
|
885
|
-
return
|
|
885
|
+
return t.classesOf(n).includes(e.name);
|
|
886
886
|
case "name":
|
|
887
|
-
return
|
|
887
|
+
return t.idOf(n) === e.name;
|
|
888
888
|
case "pseudo":
|
|
889
|
-
return
|
|
889
|
+
return e.name === "root" ? t.isRoot(n) : t.statesOf(n).has(e.name);
|
|
890
890
|
case "unknown":
|
|
891
891
|
return !1;
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
|
-
function
|
|
895
|
-
return
|
|
894
|
+
function mt(e, n, t) {
|
|
895
|
+
return e.simple.every((i) => ht(i, n, t));
|
|
896
896
|
}
|
|
897
|
-
function
|
|
898
|
-
if (!
|
|
897
|
+
function ne(e, n, t, i) {
|
|
898
|
+
if (!mt(e[n], t, i)) return !1;
|
|
899
899
|
if (n === 0) return !0;
|
|
900
|
-
const l = i.parentOf(
|
|
901
|
-
if (
|
|
902
|
-
return l !== null &&
|
|
903
|
-
for (let
|
|
904
|
-
if (
|
|
900
|
+
const l = i.parentOf(t);
|
|
901
|
+
if (e[n].combinator === "child")
|
|
902
|
+
return l !== null && ne(e, n - 1, l, i);
|
|
903
|
+
for (let o = l; o !== null; o = i.parentOf(o))
|
|
904
|
+
if (ne(e, n - 1, o, i)) return !0;
|
|
905
905
|
return !1;
|
|
906
906
|
}
|
|
907
|
-
function $
|
|
908
|
-
return
|
|
907
|
+
function $e(e, n, t) {
|
|
908
|
+
return e.parts.length === 0 ? !1 : ne(e.parts, e.parts.length - 1, n, t);
|
|
909
909
|
}
|
|
910
|
-
function
|
|
910
|
+
function gt(e) {
|
|
911
911
|
const n = [];
|
|
912
|
-
for (const
|
|
913
|
-
for (const i of
|
|
912
|
+
for (const t of e.parts)
|
|
913
|
+
for (const i of t.simple)
|
|
914
914
|
i.kind === "pseudo" && i.name !== "root" && !n.includes(i.name) && n.push(i.name);
|
|
915
915
|
return n;
|
|
916
916
|
}
|
|
917
|
-
function
|
|
917
|
+
function wt(e) {
|
|
918
918
|
const n = [];
|
|
919
|
-
for (const
|
|
920
|
-
for (const i of
|
|
919
|
+
for (const t of e)
|
|
920
|
+
for (const i of t.parts)
|
|
921
921
|
for (const l of i.simple) {
|
|
922
922
|
if (l.kind !== "name" && l.kind !== "class" || !l.name.startsWith("unity-")) continue;
|
|
923
|
-
const
|
|
924
|
-
n.includes(
|
|
923
|
+
const o = l.kind === "name" ? `#${l.name}` : `.${l.name}`;
|
|
924
|
+
n.includes(o) || n.push(o);
|
|
925
925
|
}
|
|
926
926
|
return n;
|
|
927
927
|
}
|
|
928
|
-
function
|
|
929
|
-
for (const n of
|
|
930
|
-
for (const
|
|
931
|
-
for (const i of
|
|
928
|
+
function Te(e) {
|
|
929
|
+
for (const n of e)
|
|
930
|
+
for (const t of n.parts)
|
|
931
|
+
for (const i of t.simple)
|
|
932
932
|
if (i.kind === "unknown") return i.text;
|
|
933
933
|
return null;
|
|
934
934
|
}
|
|
935
|
-
function
|
|
936
|
-
const n = /* @__PURE__ */ new Map([[
|
|
937
|
-
for (;
|
|
938
|
-
const i =
|
|
935
|
+
function bt(e) {
|
|
936
|
+
const n = /* @__PURE__ */ new Map([[e, null]]), t = [e];
|
|
937
|
+
for (; t.length > 0; ) {
|
|
938
|
+
const i = t.pop();
|
|
939
939
|
for (const l of i.children)
|
|
940
|
-
n.set(l, i),
|
|
940
|
+
n.set(l, i), t.push(l);
|
|
941
941
|
}
|
|
942
942
|
return n;
|
|
943
943
|
}
|
|
944
|
-
function
|
|
945
|
-
let n = 0,
|
|
946
|
-
for (const l of
|
|
947
|
-
for (const
|
|
948
|
-
switch (
|
|
944
|
+
function xt(e) {
|
|
945
|
+
let n = 0, t = 0, i = 0;
|
|
946
|
+
for (const l of e.parts)
|
|
947
|
+
for (const o of l.simple)
|
|
948
|
+
switch (o.kind) {
|
|
949
949
|
case "name":
|
|
950
950
|
n++;
|
|
951
951
|
break;
|
|
952
952
|
case "class":
|
|
953
953
|
case "pseudo":
|
|
954
|
-
|
|
954
|
+
t++;
|
|
955
955
|
break;
|
|
956
956
|
case "type":
|
|
957
957
|
i++;
|
|
958
958
|
break;
|
|
959
959
|
}
|
|
960
|
-
return [n,
|
|
960
|
+
return [n, t, i];
|
|
961
961
|
}
|
|
962
|
-
function
|
|
963
|
-
return
|
|
962
|
+
function Oe(e, n) {
|
|
963
|
+
return e[0] - n[0] || e[1] - n[1] || e[2] - n[2];
|
|
964
964
|
}
|
|
965
|
-
const
|
|
966
|
-
(
|
|
965
|
+
const vt = [Number.MAX_SAFE_INTEGER, 0, 0], yt = oe(ye, null, -1).sheet.items.flatMap(
|
|
966
|
+
(e, n) => e.kind === "rule" ? [{ rule: e.rule, sheet: -1, item: n, builtin: !0 }] : []
|
|
967
967
|
);
|
|
968
|
-
function
|
|
969
|
-
return
|
|
970
|
-
}
|
|
971
|
-
function
|
|
972
|
-
const l = (
|
|
973
|
-
for (const [
|
|
974
|
-
const
|
|
975
|
-
if (
|
|
968
|
+
function kt(e) {
|
|
969
|
+
return ye.slice(e.selectorSpan.start, e.selectorSpan.end).trim();
|
|
970
|
+
}
|
|
971
|
+
function St(e, n, t, i) {
|
|
972
|
+
const l = (t == null ? void 0 : t.activeStates) ?? /* @__PURE__ */ new Set(), o = Object.entries((t == null ? void 0 : t.states) ?? {}), p = [];
|
|
973
|
+
for (const [s, a] of o) {
|
|
974
|
+
const u = oe(`${s} {}`, null, -1).sheet.items.find((f) => f.kind === "rule"), r = u === void 0 ? s : Te(u.rule.selectors);
|
|
975
|
+
if (u === void 0 || r !== null) {
|
|
976
976
|
i.push({
|
|
977
977
|
kind: "unsupported-selector",
|
|
978
|
-
message: `states key "${
|
|
978
|
+
message: `states key "${s}" is not a usable USS selector; it is ignored`
|
|
979
979
|
});
|
|
980
980
|
continue;
|
|
981
981
|
}
|
|
982
|
-
|
|
983
|
-
}
|
|
984
|
-
const g = /* @__PURE__ */ new Map(), v = (
|
|
985
|
-
const
|
|
986
|
-
|
|
987
|
-
for (const f of
|
|
988
|
-
if (f.selectors.some((
|
|
989
|
-
for (const
|
|
990
|
-
g.set(
|
|
991
|
-
for (const f of
|
|
982
|
+
p.push({ selectors: u.rule.selectors, states: a });
|
|
983
|
+
}
|
|
984
|
+
const g = /* @__PURE__ */ new Map(), v = (s) => s.attributes.some((a) => a.name === "enabled" && a.value === "false"), d = (s, a) => {
|
|
985
|
+
const u = a || v(s), r = new Set(l);
|
|
986
|
+
u && r.add("disabled");
|
|
987
|
+
for (const f of p)
|
|
988
|
+
if (f.selectors.some((b) => $e(b, { kind: "element", node: s }, n)))
|
|
989
|
+
for (const b of f.states) r.add(b);
|
|
990
|
+
g.set(s, r);
|
|
991
|
+
for (const f of s.children) d(f, u);
|
|
992
992
|
};
|
|
993
|
-
return
|
|
994
|
-
}
|
|
995
|
-
function $e
|
|
996
|
-
const n = [],
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
}), n.push(...
|
|
1000
|
-
const i = /* @__PURE__ */ new
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
u
|
|
993
|
+
return d(e.root, !1), g;
|
|
994
|
+
}
|
|
995
|
+
function $t(e) {
|
|
996
|
+
const n = [], t = /* @__PURE__ */ new Map();
|
|
997
|
+
e.sheets.forEach((p, g) => {
|
|
998
|
+
p.origin !== null && !t.has(p.origin) && t.set(p.origin, g);
|
|
999
|
+
}), n.push(...yt);
|
|
1000
|
+
const i = /* @__PURE__ */ new Map(), l = (p, g) => {
|
|
1001
|
+
const v = i.get(g) ?? /* @__PURE__ */ new Set();
|
|
1002
|
+
if (v.has(p)) return;
|
|
1003
|
+
v.add(p), i.set(g, v);
|
|
1004
|
+
const d = e.sheets[p];
|
|
1005
|
+
d !== void 0 && d.items.forEach((s, a) => {
|
|
1006
|
+
if (s.kind === "rule")
|
|
1007
|
+
n.push({ rule: s.rule, sheet: p, item: a, scope: g });
|
|
1008
|
+
else if (s.kind === "import") {
|
|
1009
|
+
const u = s.resolvedSheet ?? t.get(s.url);
|
|
1010
|
+
u !== void 0 && l(u, g);
|
|
1010
1011
|
}
|
|
1011
1012
|
});
|
|
1012
|
-
};
|
|
1013
|
-
|
|
1013
|
+
}, o = e.styleRoots ?? (e.sheets.length === 0 ? [] : [{ sheet: 0, scope: e.root.id }]);
|
|
1014
|
+
for (const p of o) l(p.sheet, p.scope);
|
|
1015
|
+
return n;
|
|
1016
|
+
}
|
|
1017
|
+
function Tt(e, n, t) {
|
|
1018
|
+
let i = e;
|
|
1019
|
+
for (; i !== null; ) {
|
|
1020
|
+
if (i.kind === "element" && i.node.id === n) return !0;
|
|
1021
|
+
i = t.parentOf(i);
|
|
1022
|
+
}
|
|
1023
|
+
return !1;
|
|
1014
1024
|
}
|
|
1015
|
-
function
|
|
1016
|
-
return
|
|
1017
|
-
(n) => n.parts.some((
|
|
1025
|
+
function Ot(e) {
|
|
1026
|
+
return e.selectors.some(
|
|
1027
|
+
(n) => n.parts.some((t) => t.simple.some((i) => i.kind === "pseudo" && i.name === "root"))
|
|
1018
1028
|
);
|
|
1019
1029
|
}
|
|
1020
|
-
function
|
|
1021
|
-
const
|
|
1022
|
-
var
|
|
1023
|
-
const f = (
|
|
1030
|
+
function Ee(e, n) {
|
|
1031
|
+
const t = bt(e.root), i = [], l = /* @__PURE__ */ new Set(), o = (r) => {
|
|
1032
|
+
var b;
|
|
1033
|
+
const f = (b = r.attributes.find((c) => c.name === "class")) == null ? void 0 : b.value;
|
|
1024
1034
|
return f === void 0 ? [] : f.split(/\s+/).filter((c) => c.length > 0);
|
|
1025
|
-
},
|
|
1026
|
-
var
|
|
1027
|
-
return (
|
|
1035
|
+
}, p = (r, f) => {
|
|
1036
|
+
var b;
|
|
1037
|
+
return (b = r.attributes.find((c) => c.name === f)) == null ? void 0 : b.value;
|
|
1028
1038
|
}, g = {
|
|
1029
1039
|
/**
|
|
1030
1040
|
* The rule the measurement forced.
|
|
@@ -1036,97 +1046,98 @@ function Et(t, n) {
|
|
|
1036
1046
|
* owner. That is the hierarchy the dumps show, so descendant selectors like
|
|
1037
1047
|
* `.panel #unity-content-viewport` behave as they do in Unity.
|
|
1038
1048
|
*/
|
|
1039
|
-
parentOf: (
|
|
1040
|
-
if (
|
|
1041
|
-
const c =
|
|
1049
|
+
parentOf: (r) => {
|
|
1050
|
+
if (r.kind === "element") {
|
|
1051
|
+
const c = t.get(r.node) ?? null;
|
|
1042
1052
|
return c === null ? null : { kind: "element", node: c };
|
|
1043
1053
|
}
|
|
1044
|
-
if (
|
|
1045
|
-
const
|
|
1046
|
-
return { kind: "part", owner:
|
|
1054
|
+
if (r.depth === 0) return { kind: "element", node: r.owner };
|
|
1055
|
+
const b = F(r.owner).spec.parts[r.depth - 1];
|
|
1056
|
+
return { kind: "part", owner: r.owner, name: b.name, depth: r.depth - 1 };
|
|
1047
1057
|
},
|
|
1048
|
-
isRoot: (
|
|
1058
|
+
isRoot: (r) => r.kind === "element" && r.node === e.root,
|
|
1049
1059
|
// Unity's parts are VisualElements, so a `VisualElement` rule reaches them.
|
|
1050
1060
|
// Not measured — `part-type-selector` is the case that will settle it.
|
|
1051
|
-
typeNameOf: (
|
|
1052
|
-
idOf: (
|
|
1061
|
+
typeNameOf: (r) => r.kind === "element" ? r.node.name.local : "VisualElement",
|
|
1062
|
+
idOf: (r) => r.kind === "element" ? p(r.node, "name") : r.name,
|
|
1053
1063
|
// Implicit classes are as real as written ones for matching: in Unity the
|
|
1054
1064
|
// element genuinely carries them, which is why `.unity-button` in author USS
|
|
1055
1065
|
// hits a plain `<ui:Button />`. Parts carry classes too in Unity, but which
|
|
1056
1066
|
// ones is unmeasured, so none are claimed here.
|
|
1057
|
-
classesOf: (
|
|
1058
|
-
}, v = { ...g, statesOf: () => l },
|
|
1067
|
+
classesOf: (r) => r.kind === "element" ? [...o(r.node), ...We(r.node)] : []
|
|
1068
|
+
}, v = { ...g, statesOf: () => l }, d = St(e, v, n, i), s = {
|
|
1059
1069
|
...g,
|
|
1060
1070
|
// A part inherits its owner's states: `SetEnabled(false)` disables the whole
|
|
1061
1071
|
// subtree, and a part is inside it.
|
|
1062
|
-
statesOf: (
|
|
1072
|
+
statesOf: (r) => d.get(r.kind === "element" ? r.node : r.owner) ?? l
|
|
1063
1073
|
}, a = [];
|
|
1064
|
-
let
|
|
1065
|
-
for (const
|
|
1066
|
-
if (
|
|
1067
|
-
a.push(
|
|
1074
|
+
let u = !1;
|
|
1075
|
+
for (const r of $t(e)) {
|
|
1076
|
+
if (r.builtin === !0) {
|
|
1077
|
+
a.push(r);
|
|
1068
1078
|
continue;
|
|
1069
1079
|
}
|
|
1070
|
-
const f =
|
|
1080
|
+
const f = Te(r.rule.selectors);
|
|
1071
1081
|
if (f !== null) {
|
|
1072
1082
|
i.push({
|
|
1073
1083
|
kind: "unsupported-selector",
|
|
1074
1084
|
message: `"${f}" is not supported in USS; the whole rule is ignored`,
|
|
1075
|
-
at: { in: "uss", sheet:
|
|
1085
|
+
at: { in: "uss", sheet: r.sheet, span: r.rule.selectorSpan }
|
|
1076
1086
|
});
|
|
1077
1087
|
continue;
|
|
1078
1088
|
}
|
|
1079
|
-
!
|
|
1089
|
+
!u && Ot(r.rule) && (u = !0, i.push({
|
|
1080
1090
|
kind: "version-dependent",
|
|
1081
1091
|
message: ":root in USS names the element the stylesheet was applied to, not the document root as in CSS. This preview matches it against the <ui:UXML> element; verify against your Unity version.",
|
|
1082
|
-
at: { in: "uss", sheet:
|
|
1083
|
-
})), a.push(
|
|
1092
|
+
at: { in: "uss", sheet: r.sheet, span: r.rule.selectorSpan }
|
|
1093
|
+
})), a.push(r);
|
|
1084
1094
|
}
|
|
1085
|
-
return { ctx:
|
|
1095
|
+
return { ctx: s, usable: a, warnings: i };
|
|
1086
1096
|
}
|
|
1087
|
-
function
|
|
1088
|
-
const
|
|
1089
|
-
if (
|
|
1090
|
-
const i =
|
|
1091
|
-
return i === null ? [] :
|
|
1097
|
+
function Et(e, n) {
|
|
1098
|
+
const t = n.attributes.find((l) => l.name === "style");
|
|
1099
|
+
if (t === void 0) return [];
|
|
1100
|
+
const i = pt(t);
|
|
1101
|
+
return i === null ? [] : Se(e.source, i, i + t.value.length);
|
|
1092
1102
|
}
|
|
1093
|
-
function
|
|
1103
|
+
function Ne(e, n, t, i) {
|
|
1094
1104
|
const l = [];
|
|
1095
|
-
let
|
|
1096
|
-
const
|
|
1097
|
-
l.push({ property: g, value: v, origin:
|
|
1105
|
+
let o = 0;
|
|
1106
|
+
const p = (g, v, d, s, a) => {
|
|
1107
|
+
l.push({ property: g, value: v, origin: d, rank: s, specificity: a, order: o++, winner: !1 });
|
|
1098
1108
|
};
|
|
1099
1109
|
if (n.kind === "part") {
|
|
1100
1110
|
const g = F(n.owner).spec.parts[n.depth];
|
|
1101
|
-
for (const [v,
|
|
1102
|
-
for (const [
|
|
1103
|
-
|
|
1104
|
-
|
|
1111
|
+
for (const [v, d] of Object.entries((g == null ? void 0 : g.style) ?? {}))
|
|
1112
|
+
for (const [s, a] of Z(v, d))
|
|
1113
|
+
p(
|
|
1114
|
+
s,
|
|
1105
1115
|
a,
|
|
1106
1116
|
{
|
|
1107
1117
|
kind: "builtin-theme",
|
|
1108
1118
|
selector: `#${n.name}`,
|
|
1109
|
-
property:
|
|
1110
|
-
unityVersion:
|
|
1119
|
+
property: s,
|
|
1120
|
+
unityVersion: Y
|
|
1111
1121
|
},
|
|
1112
1122
|
0,
|
|
1113
1123
|
[0, 0, 0]
|
|
1114
1124
|
);
|
|
1115
1125
|
}
|
|
1116
|
-
for (const g of
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1126
|
+
for (const g of t.usable) {
|
|
1127
|
+
if (g.scope !== void 0 && !Tt(n, g.scope, t.ctx)) continue;
|
|
1128
|
+
let v = null, d = [];
|
|
1129
|
+
for (const s of g.rule.selectors) {
|
|
1130
|
+
if (!$e(s, n, t.ctx)) continue;
|
|
1131
|
+
const a = xt(s);
|
|
1132
|
+
(v === null || Oe(a, v) > 0) && (v = a, d = gt(s));
|
|
1122
1133
|
}
|
|
1123
|
-
v !== null && (i == null || i.add(g), g.rule.declarations.forEach((
|
|
1124
|
-
for (const [
|
|
1134
|
+
v !== null && (i == null || i.add(g), g.rule.declarations.forEach((s, a) => {
|
|
1135
|
+
for (const [u, r] of Z(s.property, s.value)) {
|
|
1125
1136
|
const f = g.builtin === !0 ? {
|
|
1126
1137
|
kind: "builtin-theme",
|
|
1127
|
-
selector:
|
|
1128
|
-
property:
|
|
1129
|
-
unityVersion:
|
|
1138
|
+
selector: kt(g.rule),
|
|
1139
|
+
property: u,
|
|
1140
|
+
unityVersion: Y
|
|
1130
1141
|
} : {
|
|
1131
1142
|
kind: "rule",
|
|
1132
1143
|
sheet: g.sheet,
|
|
@@ -1134,269 +1145,289 @@ function Nt(t, n, e, i) {
|
|
|
1134
1145
|
declIndex: a,
|
|
1135
1146
|
// Omitted rather than set to [] when unconditional, so the
|
|
1136
1147
|
// common case stays the shape it has always been.
|
|
1137
|
-
...
|
|
1148
|
+
...d.length > 0 ? { states: d } : {}
|
|
1138
1149
|
};
|
|
1139
|
-
|
|
1150
|
+
p(u, r, f, g.builtin === !0 ? 0 : 1, v);
|
|
1140
1151
|
}
|
|
1141
1152
|
}));
|
|
1142
1153
|
}
|
|
1143
1154
|
if (n.kind === "element") {
|
|
1144
1155
|
const g = n.node;
|
|
1145
|
-
|
|
1146
|
-
for (const [
|
|
1147
|
-
|
|
1156
|
+
Et(e, g).forEach((v, d) => {
|
|
1157
|
+
for (const [s, a] of Z(v.property, v.value))
|
|
1158
|
+
p(s, a, { kind: "inline", node: g.id, declIndex: d }, 1, vt);
|
|
1148
1159
|
});
|
|
1149
1160
|
}
|
|
1150
1161
|
return l;
|
|
1151
1162
|
}
|
|
1152
|
-
function
|
|
1163
|
+
function Ie(e) {
|
|
1153
1164
|
const n = /* @__PURE__ */ new Map();
|
|
1154
|
-
for (const
|
|
1155
|
-
const i = n.get(
|
|
1165
|
+
for (const t of e) {
|
|
1166
|
+
const i = n.get(t.property);
|
|
1156
1167
|
if (i === void 0) {
|
|
1157
|
-
n.set(
|
|
1168
|
+
n.set(t.property, t);
|
|
1158
1169
|
continue;
|
|
1159
1170
|
}
|
|
1160
|
-
if (
|
|
1161
|
-
|
|
1171
|
+
if (t.rank !== i.rank) {
|
|
1172
|
+
t.rank > i.rank && n.set(t.property, t);
|
|
1162
1173
|
continue;
|
|
1163
1174
|
}
|
|
1164
|
-
const l =
|
|
1165
|
-
(l > 0 || l === 0 &&
|
|
1175
|
+
const l = Oe(t.specificity, i.specificity);
|
|
1176
|
+
(l > 0 || l === 0 && t.order > i.order) && n.set(t.property, t);
|
|
1166
1177
|
}
|
|
1167
|
-
for (const
|
|
1178
|
+
for (const t of n.values()) t.winner = !0;
|
|
1168
1179
|
return n;
|
|
1169
1180
|
}
|
|
1170
|
-
const
|
|
1171
|
-
function
|
|
1181
|
+
const Nt = /var\(\s*(--[^,)\s]+)\s*(?:,([^)]*))?\)/;
|
|
1182
|
+
function ie(e, n, t = /* @__PURE__ */ new Set()) {
|
|
1172
1183
|
var l;
|
|
1173
|
-
let i =
|
|
1174
|
-
for (let
|
|
1175
|
-
const
|
|
1176
|
-
if (
|
|
1177
|
-
const g =
|
|
1178
|
-
if (
|
|
1179
|
-
const
|
|
1184
|
+
let i = e;
|
|
1185
|
+
for (let o = 0; o < 32; o++) {
|
|
1186
|
+
const p = Nt.exec(i);
|
|
1187
|
+
if (p === null) return i;
|
|
1188
|
+
const g = p[1], v = (l = p[2]) == null ? void 0 : l.trim();
|
|
1189
|
+
if (t.has(g)) return null;
|
|
1190
|
+
const d = /* @__PURE__ */ new Set([...t, g]), s = n.get(g), a = s !== void 0 ? ie(s, n, d) : v !== void 0 && v.length > 0 ? ie(v, n, d) : null;
|
|
1180
1191
|
if (a === null) return null;
|
|
1181
|
-
i = i.slice(0,
|
|
1192
|
+
i = i.slice(0, p.index) + a + i.slice(p.index + p[0].length);
|
|
1182
1193
|
}
|
|
1183
1194
|
return null;
|
|
1184
1195
|
}
|
|
1185
|
-
function
|
|
1186
|
-
const
|
|
1187
|
-
let
|
|
1188
|
-
const
|
|
1189
|
-
const
|
|
1190
|
-
!
|
|
1191
|
-
const f =
|
|
1192
|
-
for (const [h,
|
|
1193
|
-
h.startsWith("--") &&
|
|
1194
|
-
for (const [h,
|
|
1195
|
-
h.startsWith("--") &&
|
|
1196
|
+
function It(e, n) {
|
|
1197
|
+
const t = Ee(e, n), i = [...t.warnings], l = /* @__PURE__ */ new Map();
|
|
1198
|
+
let o = !1;
|
|
1199
|
+
const p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set(), v = (s, a, u) => {
|
|
1200
|
+
const r = Ne(e, s, t, g);
|
|
1201
|
+
!o && r.some((h) => h.origin.kind === "builtin-theme") && (o = !0);
|
|
1202
|
+
const f = Ie(r), b = /* @__PURE__ */ new Map();
|
|
1203
|
+
for (const [h, w] of a)
|
|
1204
|
+
h.startsWith("--") && b.set(h, w.value);
|
|
1205
|
+
for (const [h, w] of f)
|
|
1206
|
+
h.startsWith("--") && b.set(h, w.value);
|
|
1196
1207
|
const c = /* @__PURE__ */ new Map();
|
|
1197
|
-
for (const [h,
|
|
1198
|
-
for (const [h,
|
|
1199
|
-
const y =
|
|
1208
|
+
for (const [h, w] of a) c.set(h, w);
|
|
1209
|
+
for (const [h, w] of f) {
|
|
1210
|
+
const y = ie(w.value, b);
|
|
1200
1211
|
if (y === null) {
|
|
1201
1212
|
i.push({
|
|
1202
1213
|
kind: "unsupported-property",
|
|
1203
1214
|
message: `${h}: var() reference could not be resolved; declaration dropped`,
|
|
1204
|
-
node:
|
|
1215
|
+
node: u
|
|
1205
1216
|
});
|
|
1206
1217
|
continue;
|
|
1207
1218
|
}
|
|
1208
|
-
c.set(h, { value: y, origin:
|
|
1219
|
+
c.set(h, { value: y, origin: w.origin });
|
|
1209
1220
|
}
|
|
1210
1221
|
const S = /* @__PURE__ */ new Map();
|
|
1211
|
-
for (const [h,
|
|
1212
|
-
|
|
1213
|
-
value:
|
|
1214
|
-
origin: { kind: "inherited", from:
|
|
1222
|
+
for (const [h, w] of c)
|
|
1223
|
+
He(h) && S.set(h, {
|
|
1224
|
+
value: w.value,
|
|
1225
|
+
origin: { kind: "inherited", from: u, origin: w.origin }
|
|
1215
1226
|
});
|
|
1216
1227
|
return { computed: c, forChildren: S };
|
|
1217
|
-
},
|
|
1218
|
-
const
|
|
1219
|
-
l.set(
|
|
1220
|
-
let
|
|
1221
|
-
const f = F(
|
|
1228
|
+
}, d = (s, a) => {
|
|
1229
|
+
const u = v({ kind: "element", node: s }, a, s.id);
|
|
1230
|
+
l.set(s.id, u.computed);
|
|
1231
|
+
let r = u.forChildren;
|
|
1232
|
+
const f = F(s).spec.parts;
|
|
1222
1233
|
if (f.length > 0) {
|
|
1223
|
-
const
|
|
1234
|
+
const b = /* @__PURE__ */ new Map();
|
|
1224
1235
|
f.forEach((c, S) => {
|
|
1225
1236
|
const h = v(
|
|
1226
|
-
{ kind: "part", owner:
|
|
1227
|
-
|
|
1228
|
-
|
|
1237
|
+
{ kind: "part", owner: s, name: c.name, depth: S },
|
|
1238
|
+
r,
|
|
1239
|
+
s.id
|
|
1229
1240
|
);
|
|
1230
|
-
|
|
1231
|
-
}),
|
|
1241
|
+
b.set(c.name, h.computed), r = h.forChildren;
|
|
1242
|
+
}), p.set(s.id, b);
|
|
1232
1243
|
}
|
|
1233
|
-
for (const
|
|
1244
|
+
for (const b of s.children) d(b, r);
|
|
1234
1245
|
};
|
|
1235
|
-
|
|
1246
|
+
d(e.root, /* @__PURE__ */ new Map()), o && i.push({
|
|
1236
1247
|
kind: "version-dependent",
|
|
1237
|
-
message: `Unity's control defaults were applied, as measured on ${
|
|
1248
|
+
message: `Unity's control defaults were applied, as measured on ${Y} (Unity ships these as a theme stylesheet). Other versions may use different values; see src/controls/theme.ts.`
|
|
1238
1249
|
});
|
|
1239
|
-
for (const
|
|
1240
|
-
if (
|
|
1241
|
-
const a =
|
|
1250
|
+
for (const s of t.usable) {
|
|
1251
|
+
if (s.builtin === !0 || g.has(s)) continue;
|
|
1252
|
+
const a = wt(s.rule.selectors);
|
|
1242
1253
|
a.length !== 0 && i.push({
|
|
1243
1254
|
kind: "unsupported-selector",
|
|
1244
|
-
message: `${a.join(", ")} matched nothing. Those names belong to the elements a control builds for itself, and only controls with a renderer of their own have them — ${
|
|
1245
|
-
at: { in: "uss", sheet:
|
|
1255
|
+
message: `${a.join(", ")} matched nothing. Those names belong to the elements a control builds for itself, and only controls with a renderer of their own have them — ${Be().join(", ")}. Anything else is drawn as a plain box and has no parts to style.`,
|
|
1256
|
+
at: { in: "uss", sheet: s.sheet, span: s.rule.selectorSpan }
|
|
1246
1257
|
});
|
|
1247
1258
|
}
|
|
1248
|
-
return { styles: l, partStyles:
|
|
1259
|
+
return { styles: l, partStyles: p, warnings: i };
|
|
1249
1260
|
}
|
|
1250
|
-
function
|
|
1251
|
-
const l =
|
|
1252
|
-
(
|
|
1261
|
+
function jt(e, n, t, i) {
|
|
1262
|
+
const l = Ee(e, i), o = Ne(e, { kind: "element", node: n }, l).filter(
|
|
1263
|
+
(p) => p.property === t
|
|
1253
1264
|
);
|
|
1254
|
-
return
|
|
1265
|
+
return Ie(o), o;
|
|
1255
1266
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1267
|
+
const Wt = [
|
|
1268
|
+
{
|
|
1269
|
+
id: "text-metrics",
|
|
1270
|
+
kind: "unreproducible",
|
|
1271
|
+
summary: "Text-dependent layout can be a few pixels off Unity.",
|
|
1272
|
+
detail: "A browser measures text with its own font stack; Unity measures with its font asset. Both engines apply the same layout rule, so this is not a layout defect — it is measured in docs/accuracy.md at 10 of 16 known divergent values, all traced to this one cause."
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
id: "wrap-container-height",
|
|
1276
|
+
kind: "unspecified",
|
|
1277
|
+
summary: "A wrapping container's height can differ from Unity.",
|
|
1278
|
+
detail: "Unity's own rule for sizing a container whose children wrap is not yet identified, so there is no confirmed target to match. Tracked in docs/accuracy.md as the one unresolved divergence."
|
|
1279
|
+
},
|
|
1280
|
+
{
|
|
1281
|
+
id: "yoga-percent-without-parent-size",
|
|
1282
|
+
kind: "upstream",
|
|
1283
|
+
summary: "A main-axis percentage against an unsized parent can resolve differently.",
|
|
1284
|
+
detail: "The yoga-layout version this package depends on resolves a main-axis percentage against an indefinite parent differently from the Yoga vendored inside Unity 6000.0.40f1. Not configurable: no available setting reproduces Unity's answer without breaking cases that currently match. Fully deterministic and pinned to a case in docs/accuracy.md — this always reproduces the same way, it just cannot be fixed from inside this repository."
|
|
1285
|
+
}
|
|
1286
|
+
];
|
|
1287
|
+
function be(e) {
|
|
1288
|
+
return e !== void 0 && /[A-Za-z0-9_.:-]/.test(e);
|
|
1258
1289
|
}
|
|
1259
|
-
function
|
|
1260
|
-
return
|
|
1290
|
+
function xe(e) {
|
|
1291
|
+
return e !== void 0 && /[A-Za-z_]/.test(e);
|
|
1261
1292
|
}
|
|
1262
|
-
function
|
|
1263
|
-
return
|
|
1264
|
-
` ||
|
|
1293
|
+
function Ct(e) {
|
|
1294
|
+
return e === " " || e === " " || e === `
|
|
1295
|
+
` || e === "\r";
|
|
1265
1296
|
}
|
|
1266
|
-
function
|
|
1297
|
+
function At(e) {
|
|
1267
1298
|
const n = [];
|
|
1268
|
-
let
|
|
1299
|
+
let t = 0, i = 0;
|
|
1269
1300
|
const l = () => i++;
|
|
1270
|
-
function
|
|
1301
|
+
function o(a, u, r) {
|
|
1271
1302
|
n.push({
|
|
1272
1303
|
kind: "malformed",
|
|
1273
1304
|
message: a,
|
|
1274
|
-
at: { in: "uxml", span: { start:
|
|
1305
|
+
at: { in: "uxml", span: { start: u, end: r } }
|
|
1275
1306
|
});
|
|
1276
1307
|
}
|
|
1277
|
-
function
|
|
1278
|
-
for (;
|
|
1308
|
+
function p() {
|
|
1309
|
+
for (; Ct(e[t]); ) t++;
|
|
1279
1310
|
}
|
|
1280
1311
|
function g() {
|
|
1281
1312
|
for (; ; ) {
|
|
1282
|
-
const a =
|
|
1313
|
+
const a = e.indexOf("<", t);
|
|
1283
1314
|
if (a < 0) {
|
|
1284
|
-
|
|
1315
|
+
t = e.length;
|
|
1285
1316
|
return;
|
|
1286
1317
|
}
|
|
1287
|
-
const
|
|
1288
|
-
if (
|
|
1289
|
-
if (
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1292
|
-
} else if (
|
|
1293
|
-
const
|
|
1294
|
-
|
|
1318
|
+
const u = e[a + 1];
|
|
1319
|
+
if (u === "!") {
|
|
1320
|
+
if (e.startsWith("<!--", a)) {
|
|
1321
|
+
const r = e.indexOf("-->", a + 4);
|
|
1322
|
+
t = r < 0 ? e.length : r + 3;
|
|
1323
|
+
} else if (e.startsWith("<![CDATA[", a)) {
|
|
1324
|
+
const r = e.indexOf("]]>", a + 9);
|
|
1325
|
+
t = r < 0 ? e.length : r + 3;
|
|
1295
1326
|
} else {
|
|
1296
|
-
const
|
|
1297
|
-
|
|
1327
|
+
const r = e.indexOf(">", a);
|
|
1328
|
+
t = r < 0 ? e.length : r + 1;
|
|
1298
1329
|
}
|
|
1299
1330
|
continue;
|
|
1300
1331
|
}
|
|
1301
|
-
if (
|
|
1302
|
-
const
|
|
1303
|
-
|
|
1332
|
+
if (u === "?") {
|
|
1333
|
+
const r = e.indexOf("?>", a + 2);
|
|
1334
|
+
t = r < 0 ? e.length : r + 2;
|
|
1304
1335
|
continue;
|
|
1305
1336
|
}
|
|
1306
|
-
|
|
1337
|
+
t = a;
|
|
1307
1338
|
return;
|
|
1308
1339
|
}
|
|
1309
1340
|
}
|
|
1310
1341
|
function v() {
|
|
1311
|
-
const a =
|
|
1312
|
-
for (;
|
|
1313
|
-
const
|
|
1314
|
-
return
|
|
1315
|
-
}
|
|
1316
|
-
function
|
|
1317
|
-
const a =
|
|
1318
|
-
for (;
|
|
1319
|
-
if (
|
|
1320
|
-
const
|
|
1321
|
-
if (
|
|
1322
|
-
return
|
|
1323
|
-
|
|
1324
|
-
const f = t
|
|
1342
|
+
const a = t;
|
|
1343
|
+
for (; be(e[t]); ) t++;
|
|
1344
|
+
const u = e.slice(a, t), r = u.indexOf(":");
|
|
1345
|
+
return r < 0 ? { prefix: null, local: u } : { prefix: u.slice(0, r), local: u.slice(r + 1) };
|
|
1346
|
+
}
|
|
1347
|
+
function d() {
|
|
1348
|
+
const a = t;
|
|
1349
|
+
for (; be(e[t]); ) t++;
|
|
1350
|
+
if (t === a) return null;
|
|
1351
|
+
const u = e.slice(a, t), r = t;
|
|
1352
|
+
if (p(), e[t] !== "=")
|
|
1353
|
+
return t = r, o(`attribute "${u}" has no value`, a, r), { name: u, value: "", span: { start: a, end: r } };
|
|
1354
|
+
t++, p();
|
|
1355
|
+
const f = e[t];
|
|
1325
1356
|
if (f !== '"' && f !== "'")
|
|
1326
|
-
return
|
|
1327
|
-
|
|
1328
|
-
const
|
|
1329
|
-
return c < 0 ? (
|
|
1330
|
-
}
|
|
1331
|
-
function
|
|
1332
|
-
const a =
|
|
1333
|
-
|
|
1334
|
-
const
|
|
1357
|
+
return o(`attribute "${u}" has an unquoted value`, a, t), { name: u, value: "", span: { start: a, end: t } };
|
|
1358
|
+
t++;
|
|
1359
|
+
const b = t, c = e.indexOf(f, t);
|
|
1360
|
+
return c < 0 ? (o(`attribute "${u}" has an unterminated value`, a, e.length), t = e.length, { name: u, value: e.slice(b), span: { start: a, end: t } }) : (t = c + 1, { name: u, value: e.slice(b, c), span: { start: a, end: t } });
|
|
1361
|
+
}
|
|
1362
|
+
function s() {
|
|
1363
|
+
const a = t;
|
|
1364
|
+
t++;
|
|
1365
|
+
const u = v(), r = [];
|
|
1335
1366
|
let f = !1;
|
|
1336
1367
|
for (; ; ) {
|
|
1337
|
-
|
|
1338
|
-
const y = t
|
|
1368
|
+
p();
|
|
1369
|
+
const y = e[t];
|
|
1339
1370
|
if (y === void 0) {
|
|
1340
|
-
|
|
1371
|
+
o("unterminated open tag", a, e.length);
|
|
1341
1372
|
break;
|
|
1342
1373
|
}
|
|
1343
1374
|
if (y === ">") {
|
|
1344
|
-
|
|
1375
|
+
t++;
|
|
1345
1376
|
break;
|
|
1346
1377
|
}
|
|
1347
|
-
if (y === "/" && t
|
|
1348
|
-
|
|
1378
|
+
if (y === "/" && e[t + 1] === ">") {
|
|
1379
|
+
t += 2, f = !0;
|
|
1349
1380
|
break;
|
|
1350
1381
|
}
|
|
1351
|
-
const x =
|
|
1382
|
+
const x = d();
|
|
1352
1383
|
if (x === null) {
|
|
1353
|
-
|
|
1384
|
+
t++;
|
|
1354
1385
|
continue;
|
|
1355
1386
|
}
|
|
1356
|
-
|
|
1387
|
+
r.push(x);
|
|
1357
1388
|
}
|
|
1358
|
-
const
|
|
1389
|
+
const b = { start: a, end: t };
|
|
1359
1390
|
if (f)
|
|
1360
1391
|
return {
|
|
1361
1392
|
id: l(),
|
|
1362
|
-
name:
|
|
1363
|
-
attributes:
|
|
1393
|
+
name: u,
|
|
1394
|
+
attributes: r,
|
|
1364
1395
|
children: [],
|
|
1365
|
-
spans: { openTag:
|
|
1396
|
+
spans: { openTag: b, inner: { start: t, end: t }, closeTag: null },
|
|
1366
1397
|
tagDirty: !1,
|
|
1367
1398
|
childrenDirty: !1
|
|
1368
1399
|
};
|
|
1369
|
-
const c =
|
|
1400
|
+
const c = t, S = [];
|
|
1370
1401
|
for (; ; ) {
|
|
1371
|
-
if (g(),
|
|
1372
|
-
|
|
1402
|
+
if (g(), t >= e.length) {
|
|
1403
|
+
o(`unterminated element <${Ce(u)}>`, a, e.length);
|
|
1373
1404
|
break;
|
|
1374
1405
|
}
|
|
1375
|
-
const y = t
|
|
1406
|
+
const y = e[t + 1];
|
|
1376
1407
|
if (y === "/") break;
|
|
1377
|
-
if (!
|
|
1378
|
-
|
|
1408
|
+
if (!xe(y)) {
|
|
1409
|
+
t++;
|
|
1379
1410
|
continue;
|
|
1380
1411
|
}
|
|
1381
|
-
S.push(
|
|
1412
|
+
S.push(s());
|
|
1382
1413
|
}
|
|
1383
|
-
const h =
|
|
1384
|
-
let
|
|
1385
|
-
if (
|
|
1386
|
-
const y =
|
|
1387
|
-
y < 0 &&
|
|
1414
|
+
const h = t;
|
|
1415
|
+
let w = null;
|
|
1416
|
+
if (e.startsWith("</", t)) {
|
|
1417
|
+
const y = e.indexOf(">", t), x = y < 0 ? e.length : y + 1;
|
|
1418
|
+
y < 0 && o("unterminated end tag", t, x), w = { start: t, end: x }, t = x;
|
|
1388
1419
|
}
|
|
1389
1420
|
return {
|
|
1390
1421
|
id: l(),
|
|
1391
|
-
name:
|
|
1392
|
-
attributes:
|
|
1422
|
+
name: u,
|
|
1423
|
+
attributes: r,
|
|
1393
1424
|
children: S,
|
|
1394
|
-
spans: { openTag:
|
|
1425
|
+
spans: { openTag: b, inner: { start: c, end: h }, closeTag: w },
|
|
1395
1426
|
tagDirty: !1,
|
|
1396
1427
|
childrenDirty: !1
|
|
1397
1428
|
};
|
|
1398
1429
|
}
|
|
1399
|
-
return g(),
|
|
1430
|
+
return g(), t < e.length && xe(e[t + 1]) ? { root: s(), warnings: n } : (o("no root element", 0, 0), {
|
|
1400
1431
|
root: {
|
|
1401
1432
|
id: l(),
|
|
1402
1433
|
name: { prefix: null, local: "" },
|
|
@@ -1409,201 +1440,220 @@ function Ie(t) {
|
|
|
1409
1440
|
warnings: n
|
|
1410
1441
|
});
|
|
1411
1442
|
}
|
|
1412
|
-
function
|
|
1413
|
-
return
|
|
1443
|
+
function Ce(e) {
|
|
1444
|
+
return e.prefix === null ? e.local : `${e.prefix}:${e.local}`;
|
|
1414
1445
|
}
|
|
1415
|
-
function
|
|
1416
|
-
const
|
|
1417
|
-
function i(
|
|
1418
|
-
return
|
|
1419
|
-
}
|
|
1420
|
-
function l(
|
|
1421
|
-
return
|
|
1422
|
-
}
|
|
1423
|
-
function
|
|
1424
|
-
const
|
|
1425
|
-
return
|
|
1426
|
-
}
|
|
1427
|
-
function
|
|
1428
|
-
var
|
|
1429
|
-
const
|
|
1430
|
-
return { between: a, before: a, after:
|
|
1431
|
-
}
|
|
1432
|
-
function g(
|
|
1433
|
-
const { inner:
|
|
1434
|
-
if (
|
|
1435
|
-
if (
|
|
1436
|
-
const { between:
|
|
1437
|
-
return f +
|
|
1446
|
+
function Rt(e, n) {
|
|
1447
|
+
const t = (d) => e.slice(d.start, d.end);
|
|
1448
|
+
function i(d) {
|
|
1449
|
+
return d.spans.closeTag !== null ? d.spans.closeTag.end : Math.max(d.spans.openTag.end, d.spans.inner.end);
|
|
1450
|
+
}
|
|
1451
|
+
function l(d) {
|
|
1452
|
+
return d.includes('"') ? d.includes("'") ? `"${d.replace(/"/g, """)}"` : `'${d}'` : `"${d}"`;
|
|
1453
|
+
}
|
|
1454
|
+
function o(d) {
|
|
1455
|
+
const s = d.attributes.map((u) => ` ${u.name}=${l(u.value)}`).join(""), a = Ce(d.name);
|
|
1456
|
+
return d.spans.closeTag === null ? `<${a}${s} />` : `<${a}${s}>`;
|
|
1457
|
+
}
|
|
1458
|
+
function p(d) {
|
|
1459
|
+
var r, f;
|
|
1460
|
+
const s = t(d.spans.inner), a = ((r = /^[ \t]*\r?\n[ \t]*/.exec(s)) == null ? void 0 : r[0]) ?? "", u = ((f = /\r?\n[ \t]*$/.exec(s)) == null ? void 0 : f[0]) ?? "";
|
|
1461
|
+
return { between: a, before: a, after: u };
|
|
1462
|
+
}
|
|
1463
|
+
function g(d) {
|
|
1464
|
+
const { inner: s } = d.spans;
|
|
1465
|
+
if (d.children.length === 0) return t(s);
|
|
1466
|
+
if (d.childrenDirty) {
|
|
1467
|
+
const { between: r, before: f, after: b } = p(d);
|
|
1468
|
+
return f + d.children.map(v).join(r) + b;
|
|
1438
1469
|
}
|
|
1439
|
-
let a = "",
|
|
1440
|
-
for (const
|
|
1441
|
-
a +=
|
|
1442
|
-
return a +
|
|
1470
|
+
let a = "", u = s.start;
|
|
1471
|
+
for (const r of d.children)
|
|
1472
|
+
a += e.slice(u, r.spans.openTag.start), a += v(r), u = i(r);
|
|
1473
|
+
return a + e.slice(u, s.end);
|
|
1443
1474
|
}
|
|
1444
|
-
function v(
|
|
1445
|
-
const
|
|
1446
|
-
return
|
|
1475
|
+
function v(d) {
|
|
1476
|
+
const s = d.tagDirty ? o(d) : t(d.spans.openTag), a = d.spans.closeTag === null ? "" : t(d.spans.closeTag);
|
|
1477
|
+
return s + g(d) + a;
|
|
1447
1478
|
}
|
|
1448
|
-
return
|
|
1479
|
+
return e.slice(0, n.spans.openTag.start) + v(n) + e.slice(i(n));
|
|
1449
1480
|
}
|
|
1450
|
-
function
|
|
1451
|
-
const n =
|
|
1452
|
-
function i(
|
|
1453
|
-
return
|
|
1454
|
-
const
|
|
1455
|
-
switch (
|
|
1481
|
+
function Mt(e) {
|
|
1482
|
+
const n = e.source, t = (s) => n.slice(s.start, s.end);
|
|
1483
|
+
function i(s) {
|
|
1484
|
+
return s.parts.map((a, u) => {
|
|
1485
|
+
const r = u === 0 ? "" : a.combinator === "child" ? " > " : " ", f = a.simple.map((b) => {
|
|
1486
|
+
switch (b.kind) {
|
|
1456
1487
|
case "universal":
|
|
1457
1488
|
return "*";
|
|
1458
1489
|
case "type":
|
|
1459
|
-
return
|
|
1490
|
+
return b.name;
|
|
1460
1491
|
case "class":
|
|
1461
|
-
return `.${
|
|
1492
|
+
return `.${b.name}`;
|
|
1462
1493
|
case "name":
|
|
1463
|
-
return `#${
|
|
1494
|
+
return `#${b.name}`;
|
|
1464
1495
|
case "pseudo":
|
|
1465
|
-
return `:${
|
|
1496
|
+
return `:${b.name}`;
|
|
1466
1497
|
case "unknown":
|
|
1467
|
-
return
|
|
1498
|
+
return b.text;
|
|
1468
1499
|
}
|
|
1469
1500
|
}).join("");
|
|
1470
|
-
return
|
|
1501
|
+
return r + f;
|
|
1471
1502
|
}).join("");
|
|
1472
1503
|
}
|
|
1473
|
-
function l(
|
|
1504
|
+
function l(s) {
|
|
1474
1505
|
var c, S;
|
|
1475
|
-
const a =
|
|
1506
|
+
const a = s.declarations[0];
|
|
1476
1507
|
if (a === void 0) return { between: "", before: "", after: "" };
|
|
1477
|
-
const
|
|
1478
|
-
`, a.span.start),
|
|
1479
|
-
return { between: `;${
|
|
1480
|
-
}
|
|
1481
|
-
function s
|
|
1482
|
-
const a =
|
|
1483
|
-
if (
|
|
1484
|
-
return a + n.slice(
|
|
1485
|
-
const
|
|
1486
|
-
if (
|
|
1487
|
-
const { between:
|
|
1488
|
-
return `${a}${h}${c}${
|
|
1508
|
+
const u = n.lastIndexOf(`
|
|
1509
|
+
`, a.span.start), r = u < 0 ? "" : n.slice(u, a.span.start), f = n.slice(s.selectorSpan.end, s.span.end), b = ((S = (c = /\r?\n[ \t]*\}$/.exec(f)) == null ? void 0 : c[0]) == null ? void 0 : S.replace(/\}$/, "")) ?? "";
|
|
1510
|
+
return { between: `;${r}`, before: r, after: `;${b}` };
|
|
1511
|
+
}
|
|
1512
|
+
function o(s) {
|
|
1513
|
+
const a = s.selectorDirty ? s.selectors.map(i).join(", ") : t(s.selectorSpan);
|
|
1514
|
+
if (s.declarations.length === 0)
|
|
1515
|
+
return a + n.slice(s.selectorSpan.end, s.span.end);
|
|
1516
|
+
const u = n.slice(s.selectorSpan.end, s.declarations[0].span.start);
|
|
1517
|
+
if (s.declarationsDirty) {
|
|
1518
|
+
const { between: b, before: c, after: S } = l(s), h = u.slice(0, u.indexOf("{") + 1), w = s.declarations.map(p).join(b);
|
|
1519
|
+
return `${a}${h}${c}${w}${S}}`;
|
|
1489
1520
|
}
|
|
1490
|
-
let
|
|
1491
|
-
for (const
|
|
1492
|
-
|
|
1493
|
-
return
|
|
1521
|
+
let r = a, f = s.selectorSpan.end;
|
|
1522
|
+
for (const b of s.declarations)
|
|
1523
|
+
r += n.slice(f, b.span.start), r += p(b), f = b.span.end;
|
|
1524
|
+
return r + n.slice(f, s.span.end);
|
|
1494
1525
|
}
|
|
1495
|
-
function
|
|
1496
|
-
return
|
|
1526
|
+
function p(s) {
|
|
1527
|
+
return s.dirty ? `${s.property}: ${s.value}` : t(s.span);
|
|
1497
1528
|
}
|
|
1498
|
-
function g(
|
|
1499
|
-
return
|
|
1529
|
+
function g(s) {
|
|
1530
|
+
return s.kind === "rule" ? o(s.rule) : t(s.span);
|
|
1500
1531
|
}
|
|
1501
|
-
let v = "",
|
|
1502
|
-
for (const
|
|
1503
|
-
const a =
|
|
1504
|
-
v += n.slice(
|
|
1532
|
+
let v = "", d = 0;
|
|
1533
|
+
for (const s of e.items) {
|
|
1534
|
+
const a = s.kind === "rule" ? s.rule.span : s.span;
|
|
1535
|
+
v += n.slice(d, a.start), v += g(s), d = a.end;
|
|
1505
1536
|
}
|
|
1506
|
-
return v + n.slice(
|
|
1537
|
+
return v + n.slice(d);
|
|
1507
1538
|
}
|
|
1508
|
-
function
|
|
1509
|
-
var
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1539
|
+
function Ae(e, n = []) {
|
|
1540
|
+
var t;
|
|
1541
|
+
for (const i of e.children) {
|
|
1542
|
+
if (i.name.local === "Style") {
|
|
1543
|
+
const l = (t = i.attributes.find((o) => o.name === "src")) == null ? void 0 : t.value;
|
|
1544
|
+
l !== void 0 && l.length > 0 && n.push({ url: re(l), scope: e.id });
|
|
1545
|
+
}
|
|
1546
|
+
Ae(i, n);
|
|
1513
1547
|
}
|
|
1514
|
-
for (const i of t.children) At(i, n);
|
|
1515
1548
|
return n;
|
|
1516
1549
|
}
|
|
1517
|
-
function
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1550
|
+
function Ut(e) {
|
|
1551
|
+
return e.startsWith("project://") || e.startsWith("/");
|
|
1552
|
+
}
|
|
1553
|
+
function Bt(e, n, t) {
|
|
1554
|
+
var v, d;
|
|
1555
|
+
const i = At(e), l = [...i.warnings], o = [], p = [], g = [];
|
|
1556
|
+
for (const { url: s, scope: a } of Ae(i.root)) {
|
|
1557
|
+
const u = ((v = t == null ? void 0 : t.resolveImport) == null ? void 0 : v.call(t, s, null)) ?? null;
|
|
1558
|
+
if (u === null) {
|
|
1523
1559
|
l.push({
|
|
1524
1560
|
kind: "import-unresolved",
|
|
1525
|
-
message: (
|
|
1561
|
+
message: (t == null ? void 0 : t.resolveImport) === void 0 ? `<Style src="${s}"> was not loaded: pass resolveImport to read it, or pass the stylesheet text directly. Until then this document renders unstyled.` : `<Style src="${s}"> could not be resolved`,
|
|
1526
1562
|
node: i.root.id
|
|
1527
1563
|
});
|
|
1528
1564
|
continue;
|
|
1529
1565
|
}
|
|
1530
|
-
|
|
1531
|
-
}
|
|
1532
|
-
if (n !== void 0 ||
|
|
1533
|
-
const
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1566
|
+
g.push({ text: u, origin: s, scope: a });
|
|
1567
|
+
}
|
|
1568
|
+
if (n !== void 0 || g.length > 0) {
|
|
1569
|
+
const s = /* @__PURE__ */ new Map(), a = [];
|
|
1570
|
+
let u = 0;
|
|
1571
|
+
for (const r of g) {
|
|
1572
|
+
const f = u++;
|
|
1573
|
+
a.push({ text: r.text, origin: r.origin, sheet: f }), p.push({ sheet: f, scope: r.scope });
|
|
1574
|
+
}
|
|
1575
|
+
if (n !== void 0) {
|
|
1576
|
+
const r = u++;
|
|
1577
|
+
a.push({ text: n, origin: null, sheet: r }), p.push({ sheet: r, scope: i.root.id });
|
|
1578
|
+
}
|
|
1579
|
+
for (; a.length > 0; ) {
|
|
1580
|
+
const r = a.shift(), f = r.sheet, b = oe(r.text, r.origin, f);
|
|
1581
|
+
o.push(b.sheet), l.push(...b.warnings);
|
|
1582
|
+
for (const c of b.sheet.items) {
|
|
1583
|
+
if (c.kind !== "import") continue;
|
|
1584
|
+
const S = Ut(c.url) ? c.url : JSON.stringify([c.url, r.origin]);
|
|
1585
|
+
if (s.has(S)) {
|
|
1586
|
+
const y = s.get(S);
|
|
1587
|
+
y != null && (c.resolvedSheet = y);
|
|
1588
|
+
continue;
|
|
1589
|
+
}
|
|
1590
|
+
s.set(S, null);
|
|
1591
|
+
const h = ((d = t == null ? void 0 : t.resolveImport) == null ? void 0 : d.call(t, c.url, r.origin)) ?? null;
|
|
1592
|
+
if (h === null) {
|
|
1545
1593
|
l.push({
|
|
1546
1594
|
kind: "import-unresolved",
|
|
1547
|
-
message: (
|
|
1548
|
-
at: { in: "uss", sheet:
|
|
1595
|
+
message: (t == null ? void 0 : t.resolveImport) === void 0 ? `@import "${c.url}" was not loaded: pass resolveImport to read it` : `@import "${c.url}" could not be resolved`,
|
|
1596
|
+
at: { in: "uss", sheet: f, span: c.span }
|
|
1549
1597
|
});
|
|
1550
1598
|
continue;
|
|
1551
1599
|
}
|
|
1552
|
-
|
|
1600
|
+
const w = u++;
|
|
1601
|
+
s.set(S, w), c.resolvedSheet = w, a.push({ text: h, origin: c.url, sheet: w });
|
|
1553
1602
|
}
|
|
1554
1603
|
}
|
|
1555
1604
|
}
|
|
1556
|
-
return { source:
|
|
1605
|
+
return { source: e, root: i.root, sheets: o, styleRoots: p, warnings: l };
|
|
1557
1606
|
}
|
|
1558
|
-
function
|
|
1559
|
-
const n =
|
|
1607
|
+
function Ft(e) {
|
|
1608
|
+
const n = e.sheets[0];
|
|
1560
1609
|
return {
|
|
1561
|
-
uxml:
|
|
1610
|
+
uxml: Rt(e.source, e.root),
|
|
1562
1611
|
// Only the sheet passed to `parse` round-trips. `@import`ed sheets (Phase 3)
|
|
1563
1612
|
// are separate files and are not this function's to write.
|
|
1564
|
-
uss: n === void 0 ? "" :
|
|
1613
|
+
uss: n === void 0 ? "" : Mt(n)
|
|
1565
1614
|
};
|
|
1566
1615
|
}
|
|
1567
|
-
function
|
|
1568
|
-
const i = n.ownerDocument, l = (
|
|
1616
|
+
function Pt(e, n, t) {
|
|
1617
|
+
const i = n.ownerDocument, l = (t == null ? void 0 : t.size) ?? {
|
|
1569
1618
|
width: n.clientWidth,
|
|
1570
1619
|
height: n.clientHeight
|
|
1571
|
-
},
|
|
1572
|
-
...(
|
|
1573
|
-
...(
|
|
1574
|
-
}),
|
|
1620
|
+
}, o = It(e, {
|
|
1621
|
+
...(t == null ? void 0 : t.activeStates) === void 0 ? {} : { activeStates: t.activeStates },
|
|
1622
|
+
...(t == null ? void 0 : t.states) === void 0 ? {} : { states: t.states }
|
|
1623
|
+
}), p = (t == null ? void 0 : t.measureText) ?? nt(i), g = et(e.root, o.styles, o.partStyles, { size: l, measureText: p });
|
|
1575
1624
|
let v;
|
|
1576
1625
|
try {
|
|
1577
|
-
v =
|
|
1626
|
+
v = ft(e.root, g.boxes, g.parts, o.styles, n, {
|
|
1578
1627
|
document: i,
|
|
1579
|
-
resolveAsset:
|
|
1628
|
+
resolveAsset: t == null ? void 0 : t.resolveAsset
|
|
1580
1629
|
});
|
|
1581
|
-
} catch (
|
|
1582
|
-
throw g.dispose(),
|
|
1630
|
+
} catch (s) {
|
|
1631
|
+
throw g.dispose(), s;
|
|
1583
1632
|
}
|
|
1584
|
-
let
|
|
1633
|
+
let d = !1;
|
|
1585
1634
|
return {
|
|
1586
|
-
warnings: [...
|
|
1635
|
+
warnings: [...o.warnings, ...g.warnings, ...v.warnings],
|
|
1587
1636
|
elements: v.elements,
|
|
1588
1637
|
boxes: g.boxes,
|
|
1589
1638
|
dispose() {
|
|
1590
|
-
|
|
1639
|
+
d || (d = !0, g.dispose(), n.replaceChildren());
|
|
1591
1640
|
}
|
|
1592
1641
|
};
|
|
1593
1642
|
}
|
|
1594
1643
|
export {
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1644
|
+
Wt as KNOWN_DIVERGENCES,
|
|
1645
|
+
ct as NODE_ATTRIBUTE,
|
|
1646
|
+
ut as PART_ATTRIBUTE,
|
|
1647
|
+
dt as PART_OWNER_ATTRIBUTE,
|
|
1648
|
+
nt as createDefaultMeasureText,
|
|
1649
|
+
jt as explainProperty,
|
|
1650
|
+
He as isInherited,
|
|
1651
|
+
zt as isLayoutEngineReady,
|
|
1652
|
+
_t as liveNodeCount,
|
|
1653
|
+
Lt as loadLayoutEngine,
|
|
1654
|
+
Bt as parse,
|
|
1655
|
+
Pt as render,
|
|
1656
|
+
It as resolveStyles,
|
|
1657
|
+
Ft as serialize,
|
|
1658
|
+
Be as supportedControlNames
|
|
1609
1659
|
};
|