uxml-preview 0.2.0 → 0.3.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 +69 -0
- package/README.md +22 -18
- package/dist/index.d.ts +12 -2
- package/dist/index.js +554 -533
- package/dist/known-divergences.d.ts +36 -0
- package/dist/model/types.d.ts +6 -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 Me, PositionType as Z, Direction as le, Edge as P, BoxSizing as Re, FlexDirection as V, Wrap as q, Justify as W, Align as L, Display as Ue, Overflow as De } from "yoga-layout/load";
|
|
2
|
+
const xe = {
|
|
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
|
+
}, ce = { 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 = xe[e.name.local];
|
|
46
|
+
return n !== void 0 ? { spec: n, fallback: !1 } : je(e) ? { spec: ce, fallback: !1 } : { spec: ce, 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(xe);
|
|
56
56
|
}
|
|
57
|
-
const
|
|
57
|
+
const Y = "6000.0.40f1", ve = `: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 ue(e) {
|
|
88
88
|
const n = [];
|
|
89
|
-
let
|
|
90
|
-
for (let l = 0; l <
|
|
91
|
-
const s =
|
|
92
|
-
s === "(" ?
|
|
89
|
+
let t = 0, i = -1;
|
|
90
|
+
for (let l = 0; l < e.length; l++) {
|
|
91
|
+
const s = e[l];
|
|
92
|
+
s === "(" ? t++ : s === ")" && (t = Math.max(0, t - 1)), t === 0 && /\s/.test(s) ? 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 de(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 ? de(n) ? [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", "0"]] : [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", n]] : i === void 0 ? de(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 J(
|
|
131
|
-
if (
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
134
|
-
const i =
|
|
135
|
-
return i === null ? [[
|
|
130
|
+
function J(e, n) {
|
|
131
|
+
if (e === "flex") return Ye(ue(n));
|
|
132
|
+
const t = Ge[e];
|
|
133
|
+
if (t === void 0) return [[e, n]];
|
|
134
|
+
const i = qe(ue(n));
|
|
135
|
+
return i === null ? [[e, n]] : t.map((l, s) => [l, i[s]]);
|
|
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 fe(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 Ut() {
|
|
193
|
+
se ?? (se = await Me());
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
195
|
+
function Dt() {
|
|
196
|
+
return se !== null;
|
|
197
197
|
}
|
|
198
198
|
let G = 0;
|
|
199
|
-
function
|
|
199
|
+
function Lt() {
|
|
200
200
|
return G;
|
|
201
201
|
}
|
|
202
202
|
const K = {
|
|
@@ -209,37 +209,37 @@ const K = {
|
|
|
209
209
|
"space-between": L.SpaceBetween,
|
|
210
210
|
"space-around": L.SpaceAround,
|
|
211
211
|
"space-evenly": L.SpaceEvenly
|
|
212
|
-
},
|
|
212
|
+
}, Ze = {
|
|
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
|
+
}, Je = {
|
|
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
238
|
const s = [], m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), v = [], u = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
239
239
|
let a = 0, d = !1, o = !1;
|
|
240
240
|
const f = (p, k) => {
|
|
241
241
|
var T;
|
|
242
|
-
return ((T = p.get(k)) == null ? void 0 : T.value) ??
|
|
242
|
+
return ((T = p.get(k)) == null ? void 0 : T.value) ?? ee[k] ?? "";
|
|
243
243
|
};
|
|
244
244
|
function w(p, k) {
|
|
245
245
|
s.push({ kind: "unsupported-property", message: p, node: k.id });
|
|
@@ -247,8 +247,8 @@ function te(t, n, e, i) {
|
|
|
247
247
|
function c(p, k, T) {
|
|
248
248
|
const N = f(p, k);
|
|
249
249
|
if (N === "") return null;
|
|
250
|
-
const { length: C, problem:
|
|
251
|
-
return
|
|
250
|
+
const { length: C, problem: A } = X(N);
|
|
251
|
+
return A !== void 0 && w(`${k}: ${A}`, T), C;
|
|
252
252
|
}
|
|
253
253
|
function S(p) {
|
|
254
254
|
if (p !== null)
|
|
@@ -269,36 +269,36 @@ function te(t, n, e, i) {
|
|
|
269
269
|
if (p.kind === "percent") return `${p.value}%`;
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
p.setBoxSizing(
|
|
272
|
+
function x(p, k, T) {
|
|
273
|
+
p.setBoxSizing(Re.BorderBox), p.setFlexDirection(Je[f(k, "flex-direction")] ?? V.Column), p.setFlexWrap(Ke[f(k, "flex-wrap")] ?? q.NoWrap), p.setJustifyContent(Ze[f(k, "justify-content")] ?? W.FlexStart), p.setAlignItems(K[f(k, "align-items")] ?? L.Stretch), p.setAlignSelf(K[f(k, "align-self")] ?? L.Auto), p.setAlignContent(K[f(k, "align-content")] ?? L.FlexStart), p.setFlexGrow(fe(f(k, "flex-grow")) ?? 0), p.setFlexShrink(fe(f(k, "flex-shrink")) ?? 1), p.setFlexBasis(S(c(k, "flex-basis", T)));
|
|
274
274
|
const N = f(k, "position");
|
|
275
275
|
(N === "fixed" || N === "sticky") && w(`position: ${N} is not supported in USS; treated as relative`, T), p.setPositionType(
|
|
276
276
|
N === "absolute" ? Z.Absolute : Z.Relative
|
|
277
|
-
), f(k, "display") === "none" && p.setDisplay(
|
|
277
|
+
), f(k, "display") === "none" && p.setDisplay(Ue.None);
|
|
278
278
|
const C = f(k, "overflow");
|
|
279
|
-
C === "hidden" ? p.setOverflow(
|
|
280
|
-
for (const [
|
|
281
|
-
p.setMargin(
|
|
282
|
-
const
|
|
283
|
-
p.setBorder(
|
|
279
|
+
C === "hidden" ? p.setOverflow(De.Hidden) : (C === "auto" || C === "scroll") && w(`overflow: ${C} needs a ScrollView element in USS`, T), p.setWidth(S(c(k, "width", T))), p.setHeight(S(c(k, "height", T))), p.setMinWidth(h(c(k, "min-width", T))), p.setMinHeight(h(c(k, "min-height", T))), p.setMaxWidth(h(c(k, "max-width", T))), p.setMaxHeight(h(c(k, "max-height", T)));
|
|
280
|
+
for (const [A, I] of Qe) {
|
|
281
|
+
p.setMargin(I, h(c(k, `margin-${A}`, T))), p.setPadding(I, h(c(k, `padding-${A}`, T)));
|
|
282
|
+
const _ = h(c(k, `border-${A}-width`, T));
|
|
283
|
+
p.setBorder(I, typeof _ == "number" ? _ : void 0), p.setPosition(I, h(c(k, A, T)));
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
function y(p) {
|
|
287
287
|
var k;
|
|
288
288
|
return (k = p.attributes.find((T) => T.name === "text")) == null ? void 0 : k.value;
|
|
289
289
|
}
|
|
290
|
-
const
|
|
290
|
+
const b = ["text", "label"];
|
|
291
291
|
function $(p) {
|
|
292
|
-
return
|
|
292
|
+
return b.filter(
|
|
293
293
|
(k) => p.attributes.some((T) => T.name === k && T.value.length > 0)
|
|
294
294
|
);
|
|
295
295
|
}
|
|
296
296
|
function O(p, k) {
|
|
297
|
-
if (
|
|
297
|
+
if (_e(p)) return;
|
|
298
298
|
const T = n.get(p.id) ?? /* @__PURE__ */ new Map(), N = l.Node.create();
|
|
299
|
-
a++, G++, u.set(p, N), v.push(p),
|
|
300
|
-
const { spec: C, fallback:
|
|
301
|
-
if (
|
|
299
|
+
a++, G++, u.set(p, N), v.push(p), x(N, T, p), k !== null && k.insertChild(N, k.getChildCount());
|
|
300
|
+
const { spec: C, fallback: A } = F(p), I = y(p), _ = C.hasText && I !== void 0 && I.length > 0;
|
|
301
|
+
if (A) {
|
|
302
302
|
const M = $(p);
|
|
303
303
|
s.push({
|
|
304
304
|
kind: "unsupported-control",
|
|
@@ -306,20 +306,20 @@ function te(t, n, e, i) {
|
|
|
306
306
|
node: p.id
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
|
-
if (
|
|
309
|
+
if (_) {
|
|
310
310
|
p.children.length > 0 && w(
|
|
311
311
|
`<${p.name.local}> has both a text attribute and children; children are not drawn`,
|
|
312
312
|
p
|
|
313
313
|
);
|
|
314
|
-
const M = c(T, "font-size", p),
|
|
314
|
+
const M = c(T, "font-size", p), z = {
|
|
315
315
|
fontSize: M !== null && M.kind === "px" ? M.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
|
-
|
|
322
|
-
|
|
321
|
+
I,
|
|
322
|
+
z,
|
|
323
323
|
Number.isFinite(U) ? U : 0
|
|
324
324
|
)
|
|
325
325
|
);
|
|
@@ -329,54 +329,54 @@ function te(t, n, e, i) {
|
|
|
329
329
|
if (C.parts.length > 0) {
|
|
330
330
|
o || (o = !0, s.push({
|
|
331
331
|
kind: "version-dependent",
|
|
332
|
-
message: `<${p.name.local}> is drawn with the implicit child elements Unity builds for it, and their geometry was measured on Unity ${
|
|
332
|
+
message: `<${p.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
333
|
node: p.id
|
|
334
334
|
}));
|
|
335
|
-
const M = [],
|
|
336
|
-
for (const
|
|
337
|
-
const
|
|
338
|
-
a++, G++,
|
|
339
|
-
name:
|
|
335
|
+
const M = [], z = [], U = t.get(p.id);
|
|
336
|
+
for (const oe of C.parts) {
|
|
337
|
+
const ae = (U == null ? void 0 : U.get(oe.name)) ?? /* @__PURE__ */ new Map(), H = l.Node.create();
|
|
338
|
+
a++, G++, x(H, ae, p), j.insertChild(H, j.getChildCount()), j = H, z.push(H), M.push({
|
|
339
|
+
name: oe.name,
|
|
340
340
|
owner: p.id,
|
|
341
341
|
box: { left: 0, top: 0, width: 0, height: 0 },
|
|
342
|
-
style:
|
|
342
|
+
style: ae
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
|
-
g.set(p.id, M), r.set(p.id,
|
|
345
|
+
g.set(p.id, M), r.set(p.id, z);
|
|
346
346
|
}
|
|
347
347
|
for (const M of p.children) O(M, j);
|
|
348
348
|
}
|
|
349
|
-
O(
|
|
350
|
-
const E = u.get(
|
|
351
|
-
E.setWidth(i.size.width), E.setHeight(i.size.height), E.setPositionType(Z.Relative), E.calculateLayout(i.size.width, i.size.height,
|
|
349
|
+
O(e, null);
|
|
350
|
+
const E = u.get(e);
|
|
351
|
+
E.setWidth(i.size.width), E.setHeight(i.size.height), E.setPositionType(Z.Relative), E.calculateLayout(i.size.width, i.size.height, le.LTR);
|
|
352
352
|
const R = /* @__PURE__ */ new Map();
|
|
353
353
|
for (let p = 0; p < 3; p++) {
|
|
354
354
|
let k = !1;
|
|
355
355
|
for (const [T, N] of g) {
|
|
356
356
|
const C = r.get(T);
|
|
357
357
|
if (C === void 0) continue;
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
const
|
|
361
|
-
(R.get(T) ?? 0) !==
|
|
358
|
+
const A = N.findIndex((U) => U.name === "unity-content-viewport"), I = N.findIndex((U) => U.name === "unity-content-container");
|
|
359
|
+
if (A === -1 || I === -1) continue;
|
|
360
|
+
const _ = C[A].getComputedLayout(), M = C[I].getComputedLayout().height > _.height + 0.01, z = Pe(M);
|
|
361
|
+
(R.get(T) ?? 0) !== z && (R.set(T, z), C[A].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, le.LTR);
|
|
365
365
|
}
|
|
366
366
|
function D(p, k, T) {
|
|
367
367
|
const N = u.get(p);
|
|
368
368
|
if (N === void 0) return;
|
|
369
369
|
const C = N.getComputedLayout();
|
|
370
|
-
let
|
|
371
|
-
m.set(p.id, { left:
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
const U = j[
|
|
375
|
-
|
|
370
|
+
let A = k + C.left, I = T + C.top;
|
|
371
|
+
m.set(p.id, { left: A, top: I, width: C.width, height: C.height });
|
|
372
|
+
const _ = g.get(p.id), j = r.get(p.id);
|
|
373
|
+
_ !== void 0 && j !== void 0 && _.forEach((M, z) => {
|
|
374
|
+
const U = j[z].getComputedLayout();
|
|
375
|
+
A += U.left, I += U.top, M.box = { left: A, top: I, width: U.width, height: U.height };
|
|
376
376
|
});
|
|
377
|
-
for (const M of p.children) D(M,
|
|
377
|
+
for (const M of p.children) D(M, A, I);
|
|
378
378
|
}
|
|
379
|
-
return D(
|
|
379
|
+
return D(e, 0, 0), {
|
|
380
380
|
boxes: m,
|
|
381
381
|
parts: g,
|
|
382
382
|
painted: v,
|
|
@@ -386,16 +386,16 @@ function te(t, n, e, i) {
|
|
|
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
397
|
return (i, l, s) => {
|
|
398
|
-
const m = l.fontSize *
|
|
398
|
+
const m = l.fontSize * tt, g = (o) => {
|
|
399
399
|
if (n === null)
|
|
400
400
|
return o.length * l.fontSize * 0.5;
|
|
401
401
|
const f = l.fontStyle.includes("bold") ? "bold" : "normal", w = l.fontStyle.includes("italic") ? "italic" : "normal";
|
|
@@ -415,11 +415,11 @@ function ne(t) {
|
|
|
415
415
|
return d = Math.max(d, a), { width: d, height: r * m };
|
|
416
416
|
};
|
|
417
417
|
}
|
|
418
|
-
function
|
|
419
|
-
const n = (
|
|
420
|
-
return
|
|
418
|
+
function ye(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
|
+
]), pe = ["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[
|
|
465
|
+
}, he = "stretch-to-fill";
|
|
466
|
+
function lt(e) {
|
|
467
|
+
const n = /^(url|resource)\(\s*(["']?)(.*?)\2\s*\)$/.exec(e.trim());
|
|
468
|
+
return n === null ? null : { form: n[1], path: n[3] };
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function me(e, n, t = {}) {
|
|
471
471
|
var w;
|
|
472
472
|
const i = {}, l = [], s = (c) => {
|
|
473
473
|
var S;
|
|
474
|
-
return (S =
|
|
474
|
+
return (S = e.get(c)) == null ? void 0 : S.value;
|
|
475
475
|
}, m = (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) ? m("unsupported-property", `${c} does not exist in USS and is ignored`) : st.has(c) && m(
|
|
481
481
|
"version-dependent",
|
|
482
482
|
`${c} depends on the Unity version; verify it in your project`
|
|
483
483
|
);
|
|
@@ -499,19 +499,19 @@ function mt(t, n, e = {}) {
|
|
|
499
499
|
S !== void 0 && (i[c] = S);
|
|
500
500
|
}
|
|
501
501
|
s("display") === "none" && (i.display = "none"), s("overflow") === "hidden" && (i.overflow = "hidden");
|
|
502
|
-
for (const c of
|
|
502
|
+
for (const c of pe) {
|
|
503
503
|
const S = s(`border-${c}-width`);
|
|
504
504
|
if (S !== void 0 && S !== "0") {
|
|
505
|
-
const { length: y, problem:
|
|
505
|
+
const { length: y, problem: b } = X(S);
|
|
506
506
|
y === null || y.kind !== "px" ? m(
|
|
507
507
|
"unsupported-property",
|
|
508
|
-
`border-${c}-width: ${
|
|
508
|
+
`border-${c}-width: ${b ?? `"${S}" is not a pixel length`}; ignored`
|
|
509
509
|
) : (i[`border-${c}-width`] = `${y.value}px`, i[`border-${c}-style`] = "solid");
|
|
510
510
|
}
|
|
511
511
|
const h = s(`border-${c}-color`);
|
|
512
512
|
h !== void 0 && (i[`border-${c}-color`] = h);
|
|
513
|
-
const
|
|
514
|
-
|
|
513
|
+
const x = s(`padding-${c}`);
|
|
514
|
+
x !== void 0 && x !== "0" && (i[`padding-${c}`] = x);
|
|
515
515
|
}
|
|
516
516
|
for (const c of [
|
|
517
517
|
"top-left",
|
|
@@ -524,13 +524,13 @@ function mt(t, n, e = {}) {
|
|
|
524
524
|
}
|
|
525
525
|
const v = s("-unity-font-style");
|
|
526
526
|
if (v !== void 0) {
|
|
527
|
-
const c =
|
|
527
|
+
const c = rt[v];
|
|
528
528
|
c === void 0 ? m("unsupported-property", `-unity-font-style: ${v} is not a USS value`) : (i["font-weight"] = c.weight, i["font-style"] = c.style);
|
|
529
529
|
}
|
|
530
530
|
const u = s("-unity-text-align");
|
|
531
531
|
if (u !== void 0) {
|
|
532
|
-
const [c, S] = u.split("-"), h =
|
|
533
|
-
h === void 0 ||
|
|
532
|
+
const [c, S] = u.split("-"), h = ot[c ?? ""], x = at[S ?? ""];
|
|
533
|
+
h === void 0 || x === void 0 ? m("unsupported-property", `-unity-text-align: ${u} is not a USS value`) : (i["align-items"] = h, i["justify-content"] = x);
|
|
534
534
|
}
|
|
535
535
|
const r = [], a = s("translate");
|
|
536
536
|
a !== void 0 && r.push(`translate(${a.replace(/\s+/, ", ")})`);
|
|
@@ -540,38 +540,38 @@ function mt(t, n, e = {}) {
|
|
|
540
540
|
o !== void 0 && r.push(`scale(${o.replace(/\s+/, ", ")})`), r.length > 0 && (i.transform = r.join(" "));
|
|
541
541
|
const f = s("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
|
m("asset-unresolved", `background-image: cannot read "${f}" as an asset path`);
|
|
546
546
|
else {
|
|
547
|
-
const S = ((w =
|
|
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)", m("asset-unresolved", `background-image: "${
|
|
547
|
+
const { form: S, path: h } = c, x = ((w = t.resolveAsset) == null ? void 0 : w.call(t, h, S)) ?? null;
|
|
548
|
+
if (x === null)
|
|
549
|
+
i["background-image"] = "repeating-linear-gradient(45deg, rgba(255,0,255,0.35) 0 6px, rgba(0,0,0,0) 6px 12px)", m("asset-unresolved", `background-image: "${h}" was not resolved`);
|
|
550
550
|
else {
|
|
551
|
-
i["background-image"] = `url("${
|
|
552
|
-
const
|
|
553
|
-
|
|
551
|
+
i["background-image"] = `url("${x}")`, i["background-repeat"] = s("background-repeat") ?? "no-repeat", i["background-position"] = s("background-position") ?? "center";
|
|
552
|
+
const y = s("background-size"), b = s("-unity-background-scale-mode") ?? he, $ = Q[b];
|
|
553
|
+
$ === void 0 && m(
|
|
554
554
|
"unsupported-property",
|
|
555
555
|
`-unity-background-scale-mode: ${b} is not a USS value; expected one of ${Object.keys(Q).join(", ")}`
|
|
556
|
-
), i["background-size"] =
|
|
556
|
+
), i["background-size"] = y ?? $ ?? Q[he];
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
return s("-unity-background-image-tint-color") !== void 0 && m(
|
|
561
561
|
"unsupported-property",
|
|
562
562
|
"-unity-background-image-tint-color has no CSS equivalent and is not drawn"
|
|
563
|
-
),
|
|
563
|
+
), pe.some((c) => s(`-unity-slice-${c}`) !== void 0) && m("unsupported-property", "-unity-slice-* (9-slice) is not drawn in this preview"), s("-unity-font-definition") !== void 0 && m(
|
|
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
|
|
568
|
+
const ct = "data-uxml-node", ut = "data-uxml-part", dt = "data-uxml-part-owner";
|
|
569
|
+
function ft(e, n, t, i, l, s) {
|
|
570
570
|
const m = [], g = /* @__PURE__ */ new Map();
|
|
571
571
|
function v(d) {
|
|
572
572
|
const o = i.get(d.id), f = (w) => {
|
|
573
573
|
var h;
|
|
574
|
-
const c = ((h = o == null ? void 0 : o.get(w)) == null ? void 0 : h.value) ??
|
|
574
|
+
const c = ((h = o == null ? void 0 : o.get(w)) == null ? void 0 : h.value) ?? ee[w] ?? "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") };
|
|
@@ -579,7 +579,7 @@ function fe(t, n, e, i, l, s) {
|
|
|
579
579
|
function u(d) {
|
|
580
580
|
const o = (f) => {
|
|
581
581
|
var S;
|
|
582
|
-
const w = ((S = d.style.get(f)) == null ? void 0 : S.value) ??
|
|
582
|
+
const w = ((S = d.style.get(f)) == null ? void 0 : S.value) ?? ee[f] ?? "0", { length: c } = X(w);
|
|
583
583
|
return c !== null && c.kind === "px" ? c.value : 0;
|
|
584
584
|
};
|
|
585
585
|
return { left: o("border-left-width"), top: o("border-top-width") };
|
|
@@ -589,29 +589,29 @@ function fe(t, n, e, i, l, s) {
|
|
|
589
589
|
const w = n.get(d.id);
|
|
590
590
|
if (w === void 0) return null;
|
|
591
591
|
const c = s.document.createElement("div");
|
|
592
|
-
c.setAttribute(
|
|
593
|
-
const S = i.get(d.id) ?? /* @__PURE__ */ new Map(), h =
|
|
592
|
+
c.setAttribute(ct, String(d.id));
|
|
593
|
+
const S = i.get(d.id) ?? /* @__PURE__ */ new Map(), h = me(S, d.id, s);
|
|
594
594
|
m.push(...h.warnings);
|
|
595
|
-
const
|
|
595
|
+
const x = o === null ? 0 : w.left - o.left - f.left, y = o === null ? 0 : w.top - o.top - f.top, b = {
|
|
596
596
|
position: "absolute",
|
|
597
|
-
left: `${
|
|
597
|
+
left: `${x}px`,
|
|
598
598
|
top: `${y}px`,
|
|
599
599
|
width: `${w.width}px`,
|
|
600
600
|
height: `${w.height}px`,
|
|
601
601
|
margin: "0",
|
|
602
602
|
...h.declarations
|
|
603
603
|
};
|
|
604
|
-
for (const [R, D] of Object.entries(
|
|
604
|
+
for (const [R, D] of Object.entries(b))
|
|
605
605
|
c.style.setProperty(R, D);
|
|
606
606
|
const { spec: $ } = F(d), O = (E = d.attributes.find((R) => R.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 = ye(O);
|
|
609
609
|
else {
|
|
610
610
|
let R = c, D = w, p = v(d);
|
|
611
|
-
for (const k of
|
|
611
|
+
for (const k of t.get(d.id) ?? []) {
|
|
612
612
|
const T = s.document.createElement("div");
|
|
613
|
-
T.setAttribute(
|
|
614
|
-
const N =
|
|
613
|
+
T.setAttribute(ut, k.name), T.setAttribute(dt, String(d.id));
|
|
614
|
+
const N = me(k.style, d.id, s);
|
|
615
615
|
m.push(...N.warnings);
|
|
616
616
|
const C = {
|
|
617
617
|
position: "absolute",
|
|
@@ -622,8 +622,8 @@ function fe(t, n, e, i, l, s) {
|
|
|
622
622
|
margin: "0",
|
|
623
623
|
...N.declarations
|
|
624
624
|
};
|
|
625
|
-
for (const [
|
|
626
|
-
T.style.setProperty(
|
|
625
|
+
for (const [A, I] of Object.entries(C))
|
|
626
|
+
T.style.setProperty(A, I);
|
|
627
627
|
R.appendChild(T), R = T, D = k.box, p = u(k);
|
|
628
628
|
}
|
|
629
629
|
for (const k of d.children) {
|
|
@@ -634,183 +634,183 @@ function fe(t, n, e, i, l, s) {
|
|
|
634
634
|
return g.set(d.id, c), c;
|
|
635
635
|
}
|
|
636
636
|
l.replaceChildren();
|
|
637
|
-
const a = r(
|
|
637
|
+
const a = r(e, null, { left: 0, top: 0 });
|
|
638
638
|
return a !== null && (a.style.setProperty("position", "relative"), l.appendChild(a)), { warnings: m, elements: g };
|
|
639
639
|
}
|
|
640
|
-
const
|
|
641
|
-
function B(
|
|
642
|
-
return
|
|
643
|
-
` ||
|
|
640
|
+
const ge = /[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 s =
|
|
647
|
+
for (; i < e.length; ) {
|
|
648
|
+
const s = e[i];
|
|
649
649
|
if (s === '"' || s === "'") {
|
|
650
|
-
const m =
|
|
651
|
-
i = m < 0 ?
|
|
650
|
+
const m = e.indexOf(s, i + 1);
|
|
651
|
+
i = m < 0 ? e.length : m + 1;
|
|
652
652
|
continue;
|
|
653
653
|
}
|
|
654
|
-
if (s === "/" &&
|
|
655
|
-
const m =
|
|
656
|
-
i = m < 0 ?
|
|
654
|
+
if (s === "/" && e[i + 1] === "*") {
|
|
655
|
+
const m = e.indexOf("*/", i + 2);
|
|
656
|
+
i = m < 0 ? e.length : m + 2;
|
|
657
657
|
continue;
|
|
658
658
|
}
|
|
659
659
|
if (s === "(" || s === "[")
|
|
660
660
|
l++;
|
|
661
661
|
else if (s === ")" || s === "]")
|
|
662
662
|
l > 0 && l--;
|
|
663
|
-
else if (l === 0 &&
|
|
663
|
+
else if (l === 0 && t.includes(s))
|
|
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
677
|
let s = n;
|
|
678
|
-
for (; s <
|
|
679
|
-
for (; s <
|
|
680
|
-
if (
|
|
681
|
-
const r =
|
|
682
|
-
s = r < 0 ?
|
|
678
|
+
for (; s < t; ) {
|
|
679
|
+
for (; s < t && (B(e[s]) || e.startsWith("/*", s)); )
|
|
680
|
+
if (e.startsWith("/*", s)) {
|
|
681
|
+
const r = e.indexOf("*/", s + 2);
|
|
682
|
+
s = r < 0 ? t : r + 2;
|
|
683
683
|
} else
|
|
684
684
|
s++;
|
|
685
|
-
if (s >=
|
|
686
|
-
if (
|
|
685
|
+
if (s >= t) break;
|
|
686
|
+
if (e[s] === ";") {
|
|
687
687
|
s++;
|
|
688
688
|
continue;
|
|
689
689
|
}
|
|
690
|
-
const m = s, g =
|
|
691
|
-
if (g >=
|
|
692
|
-
const r = Math.min(g,
|
|
690
|
+
const m = s, g = te(e, m, ":;}");
|
|
691
|
+
if (g >= t || e[g] !== ":") {
|
|
692
|
+
const r = Math.min(g, t);
|
|
693
693
|
i == null || i("declaration without a value", m, r), s = r + 1;
|
|
694
694
|
continue;
|
|
695
695
|
}
|
|
696
|
-
const v = Math.min(
|
|
696
|
+
const v = Math.min(te(e, g + 1, ";}"), t), u = ke(e, g + 1, v);
|
|
697
697
|
l.push({
|
|
698
|
-
property:
|
|
699
|
-
value:
|
|
698
|
+
property: e.slice(m, g).trim(),
|
|
699
|
+
value: e.slice(u.start, u.end),
|
|
700
700
|
span: { start: m, end: u.end },
|
|
701
701
|
dirty: !1
|
|
702
702
|
}), s = 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 re(e, n = null, t = 0) {
|
|
711
711
|
const i = [], l = [];
|
|
712
712
|
let s = 0;
|
|
713
|
-
function m(h,
|
|
713
|
+
function m(h, x, 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: x, end: y } }
|
|
718
718
|
});
|
|
719
719
|
}
|
|
720
720
|
function g() {
|
|
721
721
|
for (; ; ) {
|
|
722
|
-
for (; B(
|
|
723
|
-
if (
|
|
724
|
-
const h =
|
|
725
|
-
s = h < 0 ?
|
|
722
|
+
for (; B(e[s]); ) s++;
|
|
723
|
+
if (e.startsWith("/*", s)) {
|
|
724
|
+
const h = e.indexOf("*/", s + 2);
|
|
725
|
+
s = h < 0 ? e.length : h + 2;
|
|
726
726
|
continue;
|
|
727
727
|
}
|
|
728
728
|
return;
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
|
-
const v = (h,
|
|
731
|
+
const v = (h, x) => te(e, h, x), u = (h, x) => ke(e, h, x);
|
|
732
732
|
function r(h) {
|
|
733
|
-
let
|
|
734
|
-
for (;
|
|
735
|
-
const
|
|
736
|
-
if (
|
|
737
|
-
const $ =
|
|
738
|
-
|
|
733
|
+
let x = h + 1, y = 1;
|
|
734
|
+
for (; x < e.length; ) {
|
|
735
|
+
const b = e[x];
|
|
736
|
+
if (b === '"' || b === "'") {
|
|
737
|
+
const $ = e.indexOf(b, x + 1);
|
|
738
|
+
x = $ < 0 ? e.length : $ + 1;
|
|
739
739
|
continue;
|
|
740
740
|
}
|
|
741
|
-
if (
|
|
742
|
-
const $ =
|
|
743
|
-
|
|
741
|
+
if (b === "/" && e[x + 1] === "*") {
|
|
742
|
+
const $ = e.indexOf("*/", x + 2);
|
|
743
|
+
x = $ < 0 ? e.length : $ + 2;
|
|
744
744
|
continue;
|
|
745
745
|
}
|
|
746
|
-
if (
|
|
747
|
-
else if (
|
|
748
|
-
|
|
746
|
+
if (b === "{") y++;
|
|
747
|
+
else if (b === "}" && --y === 0) return x + 1;
|
|
748
|
+
x++;
|
|
749
749
|
}
|
|
750
|
-
return
|
|
750
|
+
return e.length;
|
|
751
751
|
}
|
|
752
752
|
function a(h) {
|
|
753
|
-
let
|
|
754
|
-
for (;
|
|
755
|
-
return
|
|
753
|
+
let x = h;
|
|
754
|
+
for (; x < e.length && ge.test(e[x]); ) x++;
|
|
755
|
+
return x;
|
|
756
756
|
}
|
|
757
757
|
function d(h) {
|
|
758
|
-
const
|
|
759
|
-
let
|
|
760
|
-
for (;
|
|
761
|
-
const O =
|
|
758
|
+
const x = e[h], y = x === "(" ? ")" : "]";
|
|
759
|
+
let b = h + 1, $ = 1;
|
|
760
|
+
for (; b < e.length; ) {
|
|
761
|
+
const O = e[b];
|
|
762
762
|
if (O === '"' || O === "'") {
|
|
763
|
-
const E =
|
|
764
|
-
|
|
763
|
+
const E = e.indexOf(O, b + 1);
|
|
764
|
+
b = E < 0 ? e.length : E + 1;
|
|
765
765
|
continue;
|
|
766
766
|
}
|
|
767
|
-
if (O ===
|
|
768
|
-
else if (O === y && --$ === 0) return
|
|
769
|
-
|
|
767
|
+
if (O === x) $++;
|
|
768
|
+
else if (O === y && --$ === 0) return b + 1;
|
|
769
|
+
b++;
|
|
770
770
|
}
|
|
771
|
-
return
|
|
771
|
+
return e.length;
|
|
772
772
|
}
|
|
773
|
-
function o(h,
|
|
773
|
+
function o(h, x) {
|
|
774
774
|
const y = [];
|
|
775
|
-
let
|
|
776
|
-
for (;
|
|
777
|
-
const $ =
|
|
775
|
+
let b = h;
|
|
776
|
+
for (; b < x; ) {
|
|
777
|
+
const $ = e[b];
|
|
778
778
|
if (B($) || $ === ">" || $ === "+" || $ === "~" || $ === ",") break;
|
|
779
779
|
if ($ === "*")
|
|
780
|
-
y.push({ kind: "universal" }),
|
|
780
|
+
y.push({ kind: "universal" }), b++;
|
|
781
781
|
else if ($ === "." || $ === "#") {
|
|
782
|
-
const O = a(
|
|
782
|
+
const O = a(b + 1);
|
|
783
783
|
y.push(
|
|
784
|
-
$ === "." ? { kind: "class", name:
|
|
785
|
-
),
|
|
784
|
+
$ === "." ? { kind: "class", name: e.slice(b + 1, O) } : { kind: "name", name: e.slice(b + 1, O) }
|
|
785
|
+
), b = O;
|
|
786
786
|
} else if ($ === "[") {
|
|
787
|
-
const O = Math.min(d(
|
|
788
|
-
y.push({ kind: "unknown", text:
|
|
787
|
+
const O = Math.min(d(b), x);
|
|
788
|
+
y.push({ kind: "unknown", text: e.slice(b, O) }), b = O;
|
|
789
789
|
} else if ($ === ":")
|
|
790
|
-
if (
|
|
791
|
-
const O = a(
|
|
792
|
-
y.push({ kind: "unknown", text:
|
|
790
|
+
if (e[b + 1] === ":") {
|
|
791
|
+
const O = a(b + 2);
|
|
792
|
+
y.push({ kind: "unknown", text: e.slice(b, O) }), b = O;
|
|
793
793
|
} else {
|
|
794
|
-
const O = a(
|
|
795
|
-
if (
|
|
796
|
-
const E = Math.min(d(O),
|
|
797
|
-
y.push({ kind: "unknown", text:
|
|
794
|
+
const O = a(b + 1);
|
|
795
|
+
if (e[O] === "(") {
|
|
796
|
+
const E = Math.min(d(O), x);
|
|
797
|
+
y.push({ kind: "unknown", text: e.slice(b, E) }), b = E;
|
|
798
798
|
} else
|
|
799
|
-
y.push({ kind: "pseudo", name:
|
|
799
|
+
y.push({ kind: "pseudo", name: e.slice(b + 1, O) }), b = O;
|
|
800
800
|
}
|
|
801
|
-
else if (
|
|
802
|
-
const O = a(
|
|
803
|
-
y.push({ kind: "type", name:
|
|
801
|
+
else if (ge.test($)) {
|
|
802
|
+
const O = a(b);
|
|
803
|
+
y.push({ kind: "type", name: e.slice(b, O) }), b = O;
|
|
804
804
|
} else
|
|
805
|
-
y.push({ kind: "unknown", text: $ }),
|
|
805
|
+
y.push({ kind: "unknown", text: $ }), b++;
|
|
806
806
|
}
|
|
807
|
-
return { simple: y, next:
|
|
807
|
+
return { simple: y, next: b };
|
|
808
808
|
}
|
|
809
|
-
function f(h,
|
|
810
|
-
const y = u(h,
|
|
809
|
+
function f(h, x) {
|
|
810
|
+
const y = u(h, x), b = [];
|
|
811
811
|
let $ = "descendant", O = null, E = y.start;
|
|
812
812
|
for (; E < y.end; ) {
|
|
813
|
-
const R =
|
|
813
|
+
const R = e[E];
|
|
814
814
|
if (B(R)) {
|
|
815
815
|
E++;
|
|
816
816
|
continue;
|
|
@@ -828,96 +828,96 @@ function rt(t, n = null, e = 0) {
|
|
|
828
828
|
E++;
|
|
829
829
|
continue;
|
|
830
830
|
}
|
|
831
|
-
O !== null && (D.unshift({ kind: "unknown", text: O }), O = null),
|
|
831
|
+
O !== null && (D.unshift({ kind: "unknown", text: O }), O = null), b.push({ combinator: $, simple: D }), $ = "descendant", E = p;
|
|
832
832
|
}
|
|
833
|
-
return { parts:
|
|
833
|
+
return { parts: b, span: y };
|
|
834
834
|
}
|
|
835
|
-
function w(h,
|
|
835
|
+
function w(h, x) {
|
|
836
836
|
const y = [];
|
|
837
|
-
let
|
|
837
|
+
let b = h;
|
|
838
838
|
for (; ; ) {
|
|
839
|
-
const $ = Math.min(v(
|
|
840
|
-
if (y.push(f(
|
|
841
|
-
|
|
839
|
+
const $ = Math.min(v(b, ","), x);
|
|
840
|
+
if (y.push(f(b, $)), $ >= x) break;
|
|
841
|
+
b = $ + 1;
|
|
842
842
|
}
|
|
843
843
|
return y;
|
|
844
844
|
}
|
|
845
845
|
function c() {
|
|
846
|
-
const h = s,
|
|
847
|
-
if (
|
|
848
|
-
const O = r(
|
|
846
|
+
const h = s, x = a(s + 1), y = e.slice(s + 1, x), b = v(x, "{;");
|
|
847
|
+
if (b < e.length && e[b] === "{") {
|
|
848
|
+
const O = r(b);
|
|
849
849
|
return s = O, { kind: "unknown", span: { start: h, end: O } };
|
|
850
850
|
}
|
|
851
|
-
const $ =
|
|
851
|
+
const $ = b < e.length ? b + 1 : e.length;
|
|
852
852
|
if (s = $, y === "import") {
|
|
853
|
-
const O =
|
|
853
|
+
const O = e.slice(x, $), E = /["']([^"']*)["']/.exec(O);
|
|
854
854
|
return E === null ? (m("@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 = s,
|
|
860
|
-
if (
|
|
861
|
-
return m("rule without a block", h,
|
|
862
|
-
const y = u(h,
|
|
863
|
-
(
|
|
859
|
+
const h = s, x = v(h, "{");
|
|
860
|
+
if (x >= e.length)
|
|
861
|
+
return m("rule without a block", h, e.length), s = e.length, { kind: "unknown", span: { start: h, end: e.length } };
|
|
862
|
+
const y = u(h, x), b = r(x);
|
|
863
|
+
(b > e.length || e[b - 1] !== "}") && m("unterminated rule block", h, b);
|
|
864
864
|
const $ = {
|
|
865
865
|
selectors: w(y.start, y.end),
|
|
866
|
-
declarations:
|
|
867
|
-
span: { start: y.start, end:
|
|
866
|
+
declarations: Se(e, x + 1, b - 1, m),
|
|
867
|
+
span: { start: y.start, end: b },
|
|
868
868
|
selectorSpan: y,
|
|
869
869
|
selectorDirty: !1,
|
|
870
870
|
declarationsDirty: !1
|
|
871
871
|
};
|
|
872
|
-
return s =
|
|
872
|
+
return s = b, { kind: "rule", rule: $ };
|
|
873
873
|
}
|
|
874
|
-
for (; g(), !(s >=
|
|
875
|
-
l.push(
|
|
876
|
-
return { sheet: { source:
|
|
874
|
+
for (; g(), !(s >= e.length); )
|
|
875
|
+
l.push(e[s] === "@" ? 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 &&
|
|
900
|
+
const l = i.parentOf(t);
|
|
901
|
+
if (e[n].combinator === "child")
|
|
902
|
+
return l !== null && ne(e, n - 1, l, i);
|
|
903
903
|
for (let s = l; s !== null; s = i.parentOf(s))
|
|
904
|
-
if (
|
|
904
|
+
if (ne(e, n - 1, s, 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
923
|
const s = l.kind === "name" ? `#${l.name}` : `.${l.name}`;
|
|
@@ -925,25 +925,25 @@ function we(t) {
|
|
|
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
|
|
944
|
+
function xt(e) {
|
|
945
|
+
let n = 0, t = 0, i = 0;
|
|
946
|
+
for (const l of e.parts)
|
|
947
947
|
for (const s of l.simple)
|
|
948
948
|
switch (s.kind) {
|
|
949
949
|
case "name":
|
|
@@ -951,27 +951,27 @@ function xe(t) {
|
|
|
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 = re(ve, 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
|
|
968
|
+
function kt(e) {
|
|
969
|
+
return ve.slice(e.selectorSpan.start, e.selectorSpan.end).trim();
|
|
970
970
|
}
|
|
971
|
-
function
|
|
972
|
-
const l = (
|
|
971
|
+
function St(e, n, t, i) {
|
|
972
|
+
const l = (t == null ? void 0 : t.activeStates) ?? /* @__PURE__ */ new Set(), s = Object.entries((t == null ? void 0 : t.states) ?? {}), m = [];
|
|
973
973
|
for (const [r, a] of s) {
|
|
974
|
-
const d =
|
|
974
|
+
const d = re(`${r} {}`, null, -1).sheet.items.find((f) => f.kind === "rule"), o = d === void 0 ? r : Te(d.rule.selectors);
|
|
975
975
|
if (d === void 0 || o !== null) {
|
|
976
976
|
i.push({
|
|
977
977
|
kind: "unsupported-selector",
|
|
@@ -985,40 +985,40 @@ function Se(t, n, e, i) {
|
|
|
985
985
|
const d = a || v(r), o = new Set(l);
|
|
986
986
|
d && o.add("disabled");
|
|
987
987
|
for (const f of m)
|
|
988
|
-
if (f.selectors.some((w) => $
|
|
988
|
+
if (f.selectors.some((w) => $e(w, { kind: "element", node: r }, n)))
|
|
989
989
|
for (const w of f.states) o.add(w);
|
|
990
990
|
g.set(r, o);
|
|
991
991
|
for (const f of r.children) u(f, d);
|
|
992
992
|
};
|
|
993
|
-
return u(
|
|
993
|
+
return u(e.root, !1), g;
|
|
994
994
|
}
|
|
995
|
-
function $e
|
|
996
|
-
const n = [],
|
|
997
|
-
|
|
998
|
-
s.origin !== null && !
|
|
999
|
-
}), n.push(...
|
|
995
|
+
function $t(e) {
|
|
996
|
+
const n = [], t = /* @__PURE__ */ new Map();
|
|
997
|
+
e.sheets.forEach((s, m) => {
|
|
998
|
+
s.origin !== null && !t.has(s.origin) && t.set(s.origin, m);
|
|
999
|
+
}), n.push(...yt);
|
|
1000
1000
|
const i = /* @__PURE__ */ new Set(), l = (s) => {
|
|
1001
1001
|
if (i.has(s)) return;
|
|
1002
1002
|
i.add(s);
|
|
1003
|
-
const m =
|
|
1003
|
+
const m = e.sheets[s];
|
|
1004
1004
|
m !== void 0 && m.items.forEach((g, v) => {
|
|
1005
1005
|
if (g.kind === "rule")
|
|
1006
1006
|
n.push({ rule: g.rule, sheet: s, item: v });
|
|
1007
1007
|
else if (g.kind === "import") {
|
|
1008
|
-
const u =
|
|
1008
|
+
const u = t.get(g.url);
|
|
1009
1009
|
u !== void 0 && l(u);
|
|
1010
1010
|
}
|
|
1011
1011
|
});
|
|
1012
1012
|
};
|
|
1013
1013
|
return l(0), n;
|
|
1014
1014
|
}
|
|
1015
|
-
function
|
|
1016
|
-
return
|
|
1017
|
-
(n) => n.parts.some((
|
|
1015
|
+
function Tt(e) {
|
|
1016
|
+
return e.selectors.some(
|
|
1017
|
+
(n) => n.parts.some((t) => t.simple.some((i) => i.kind === "pseudo" && i.name === "root"))
|
|
1018
1018
|
);
|
|
1019
1019
|
}
|
|
1020
|
-
function
|
|
1021
|
-
const
|
|
1020
|
+
function Ee(e, n) {
|
|
1021
|
+
const t = bt(e.root), i = [], l = /* @__PURE__ */ new Set(), s = (o) => {
|
|
1022
1022
|
var w;
|
|
1023
1023
|
const f = (w = o.attributes.find((c) => c.name === "class")) == null ? void 0 : w.value;
|
|
1024
1024
|
return f === void 0 ? [] : f.split(/\s+/).filter((c) => c.length > 0);
|
|
@@ -1038,14 +1038,14 @@ function Et(t, n) {
|
|
|
1038
1038
|
*/
|
|
1039
1039
|
parentOf: (o) => {
|
|
1040
1040
|
if (o.kind === "element") {
|
|
1041
|
-
const c =
|
|
1041
|
+
const c = t.get(o.node) ?? null;
|
|
1042
1042
|
return c === null ? null : { kind: "element", node: c };
|
|
1043
1043
|
}
|
|
1044
1044
|
if (o.depth === 0) return { kind: "element", node: o.owner };
|
|
1045
1045
|
const w = F(o.owner).spec.parts[o.depth - 1];
|
|
1046
1046
|
return { kind: "part", owner: o.owner, name: w.name, depth: o.depth - 1 };
|
|
1047
1047
|
},
|
|
1048
|
-
isRoot: (o) => o.kind === "element" && o.node ===
|
|
1048
|
+
isRoot: (o) => o.kind === "element" && o.node === e.root,
|
|
1049
1049
|
// Unity's parts are VisualElements, so a `VisualElement` rule reaches them.
|
|
1050
1050
|
// Not measured — `part-type-selector` is the case that will settle it.
|
|
1051
1051
|
typeNameOf: (o) => o.kind === "element" ? o.node.name.local : "VisualElement",
|
|
@@ -1054,20 +1054,20 @@ function Et(t, n) {
|
|
|
1054
1054
|
// element genuinely carries them, which is why `.unity-button` in author USS
|
|
1055
1055
|
// hits a plain `<ui:Button />`. Parts carry classes too in Unity, but which
|
|
1056
1056
|
// ones is unmeasured, so none are claimed here.
|
|
1057
|
-
classesOf: (o) => o.kind === "element" ? [...s(o.node), ...
|
|
1058
|
-
}, v = { ...g, statesOf: () => l }, u =
|
|
1057
|
+
classesOf: (o) => o.kind === "element" ? [...s(o.node), ...We(o.node)] : []
|
|
1058
|
+
}, v = { ...g, statesOf: () => l }, u = St(e, v, n, i), r = {
|
|
1059
1059
|
...g,
|
|
1060
1060
|
// A part inherits its owner's states: `SetEnabled(false)` disables the whole
|
|
1061
1061
|
// subtree, and a part is inside it.
|
|
1062
1062
|
statesOf: (o) => u.get(o.kind === "element" ? o.node : o.owner) ?? l
|
|
1063
1063
|
}, a = [];
|
|
1064
1064
|
let d = !1;
|
|
1065
|
-
for (const o of $e
|
|
1065
|
+
for (const o of $t(e)) {
|
|
1066
1066
|
if (o.builtin === !0) {
|
|
1067
1067
|
a.push(o);
|
|
1068
1068
|
continue;
|
|
1069
1069
|
}
|
|
1070
|
-
const f =
|
|
1070
|
+
const f = Te(o.rule.selectors);
|
|
1071
1071
|
if (f !== null) {
|
|
1072
1072
|
i.push({
|
|
1073
1073
|
kind: "unsupported-selector",
|
|
@@ -1076,7 +1076,7 @@ function Et(t, n) {
|
|
|
1076
1076
|
});
|
|
1077
1077
|
continue;
|
|
1078
1078
|
}
|
|
1079
|
-
!d &&
|
|
1079
|
+
!d && Tt(o.rule) && (d = !0, i.push({
|
|
1080
1080
|
kind: "version-dependent",
|
|
1081
1081
|
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
1082
|
at: { in: "uss", sheet: o.sheet, span: o.rule.selectorSpan }
|
|
@@ -1084,13 +1084,13 @@ function Et(t, n) {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
return { ctx: r, usable: a, warnings: i };
|
|
1086
1086
|
}
|
|
1087
|
-
function
|
|
1088
|
-
const
|
|
1089
|
-
if (
|
|
1090
|
-
const i =
|
|
1091
|
-
return i === null ? [] :
|
|
1087
|
+
function Ot(e, n) {
|
|
1088
|
+
const t = n.attributes.find((l) => l.name === "style");
|
|
1089
|
+
if (t === void 0) return [];
|
|
1090
|
+
const i = pt(t);
|
|
1091
|
+
return i === null ? [] : Se(e.source, i, i + t.value.length);
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function Ne(e, n, t, i) {
|
|
1094
1094
|
const l = [];
|
|
1095
1095
|
let s = 0;
|
|
1096
1096
|
const m = (g, v, u, r, a) => {
|
|
@@ -1107,26 +1107,26 @@ function Nt(t, n, e, i) {
|
|
|
1107
1107
|
kind: "builtin-theme",
|
|
1108
1108
|
selector: `#${n.name}`,
|
|
1109
1109
|
property: r,
|
|
1110
|
-
unityVersion:
|
|
1110
|
+
unityVersion: Y
|
|
1111
1111
|
},
|
|
1112
1112
|
0,
|
|
1113
1113
|
[0, 0, 0]
|
|
1114
1114
|
);
|
|
1115
1115
|
}
|
|
1116
|
-
for (const g of
|
|
1116
|
+
for (const g of t.usable) {
|
|
1117
1117
|
let v = null, u = [];
|
|
1118
1118
|
for (const r of g.rule.selectors) {
|
|
1119
|
-
if (!$
|
|
1120
|
-
const a =
|
|
1121
|
-
(v === null ||
|
|
1119
|
+
if (!$e(r, n, t.ctx)) continue;
|
|
1120
|
+
const a = xt(r);
|
|
1121
|
+
(v === null || Oe(a, v) > 0) && (v = a, u = gt(r));
|
|
1122
1122
|
}
|
|
1123
1123
|
v !== null && (i == null || i.add(g), g.rule.declarations.forEach((r, a) => {
|
|
1124
1124
|
for (const [d, o] of J(r.property, r.value)) {
|
|
1125
1125
|
const f = g.builtin === !0 ? {
|
|
1126
1126
|
kind: "builtin-theme",
|
|
1127
|
-
selector:
|
|
1127
|
+
selector: kt(g.rule),
|
|
1128
1128
|
property: d,
|
|
1129
|
-
unityVersion:
|
|
1129
|
+
unityVersion: Y
|
|
1130
1130
|
} : {
|
|
1131
1131
|
kind: "rule",
|
|
1132
1132
|
sheet: g.sheet,
|
|
@@ -1142,61 +1142,61 @@ function Nt(t, n, e, i) {
|
|
|
1142
1142
|
}
|
|
1143
1143
|
if (n.kind === "element") {
|
|
1144
1144
|
const g = n.node;
|
|
1145
|
-
|
|
1145
|
+
Ot(e, g).forEach((v, u) => {
|
|
1146
1146
|
for (const [r, a] of J(v.property, v.value))
|
|
1147
|
-
m(r, a, { kind: "inline", node: g.id, declIndex: u }, 1,
|
|
1147
|
+
m(r, a, { kind: "inline", node: g.id, declIndex: u }, 1, vt);
|
|
1148
1148
|
});
|
|
1149
1149
|
}
|
|
1150
1150
|
return l;
|
|
1151
1151
|
}
|
|
1152
|
-
function
|
|
1152
|
+
function Ce(e) {
|
|
1153
1153
|
const n = /* @__PURE__ */ new Map();
|
|
1154
|
-
for (const
|
|
1155
|
-
const i = n.get(
|
|
1154
|
+
for (const t of e) {
|
|
1155
|
+
const i = n.get(t.property);
|
|
1156
1156
|
if (i === void 0) {
|
|
1157
|
-
n.set(
|
|
1157
|
+
n.set(t.property, t);
|
|
1158
1158
|
continue;
|
|
1159
1159
|
}
|
|
1160
|
-
if (
|
|
1161
|
-
|
|
1160
|
+
if (t.rank !== i.rank) {
|
|
1161
|
+
t.rank > i.rank && n.set(t.property, t);
|
|
1162
1162
|
continue;
|
|
1163
1163
|
}
|
|
1164
|
-
const l =
|
|
1165
|
-
(l > 0 || l === 0 &&
|
|
1164
|
+
const l = Oe(t.specificity, i.specificity);
|
|
1165
|
+
(l > 0 || l === 0 && t.order > i.order) && n.set(t.property, t);
|
|
1166
1166
|
}
|
|
1167
|
-
for (const
|
|
1167
|
+
for (const t of n.values()) t.winner = !0;
|
|
1168
1168
|
return n;
|
|
1169
1169
|
}
|
|
1170
|
-
const
|
|
1171
|
-
function
|
|
1170
|
+
const Et = /var\(\s*(--[^,)\s]+)\s*(?:,([^)]*))?\)/;
|
|
1171
|
+
function ie(e, n, t = /* @__PURE__ */ new Set()) {
|
|
1172
1172
|
var l;
|
|
1173
|
-
let i =
|
|
1173
|
+
let i = e;
|
|
1174
1174
|
for (let s = 0; s < 32; s++) {
|
|
1175
|
-
const m =
|
|
1175
|
+
const m = Et.exec(i);
|
|
1176
1176
|
if (m === null) return i;
|
|
1177
1177
|
const g = m[1], v = (l = m[2]) == null ? void 0 : l.trim();
|
|
1178
|
-
if (
|
|
1179
|
-
const u = /* @__PURE__ */ new Set([...
|
|
1178
|
+
if (t.has(g)) return null;
|
|
1179
|
+
const u = /* @__PURE__ */ new Set([...t, g]), r = n.get(g), a = r !== void 0 ? ie(r, n, u) : v !== void 0 && v.length > 0 ? ie(v, n, u) : null;
|
|
1180
1180
|
if (a === null) return null;
|
|
1181
1181
|
i = i.slice(0, m.index) + a + i.slice(m.index + m[0].length);
|
|
1182
1182
|
}
|
|
1183
1183
|
return null;
|
|
1184
1184
|
}
|
|
1185
|
-
function
|
|
1186
|
-
const
|
|
1185
|
+
function Nt(e, n) {
|
|
1186
|
+
const t = Ee(e, n), i = [...t.warnings], l = /* @__PURE__ */ new Map();
|
|
1187
1187
|
let s = !1;
|
|
1188
1188
|
const m = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set(), v = (r, a, d) => {
|
|
1189
|
-
const o =
|
|
1189
|
+
const o = Ne(e, r, t, g);
|
|
1190
1190
|
!s && o.some((h) => h.origin.kind === "builtin-theme") && (s = !0);
|
|
1191
|
-
const f =
|
|
1192
|
-
for (const [h,
|
|
1193
|
-
h.startsWith("--") && w.set(h,
|
|
1194
|
-
for (const [h,
|
|
1195
|
-
h.startsWith("--") && w.set(h,
|
|
1191
|
+
const f = Ce(o), w = /* @__PURE__ */ new Map();
|
|
1192
|
+
for (const [h, x] of a)
|
|
1193
|
+
h.startsWith("--") && w.set(h, x.value);
|
|
1194
|
+
for (const [h, x] of f)
|
|
1195
|
+
h.startsWith("--") && w.set(h, x.value);
|
|
1196
1196
|
const c = /* @__PURE__ */ new Map();
|
|
1197
|
-
for (const [h,
|
|
1198
|
-
for (const [h,
|
|
1199
|
-
const y =
|
|
1197
|
+
for (const [h, x] of a) c.set(h, x);
|
|
1198
|
+
for (const [h, x] of f) {
|
|
1199
|
+
const y = ie(x.value, w);
|
|
1200
1200
|
if (y === null) {
|
|
1201
1201
|
i.push({
|
|
1202
1202
|
kind: "unsupported-property",
|
|
@@ -1205,13 +1205,13 @@ function Ne(t, n) {
|
|
|
1205
1205
|
});
|
|
1206
1206
|
continue;
|
|
1207
1207
|
}
|
|
1208
|
-
c.set(h, { value: y, origin:
|
|
1208
|
+
c.set(h, { value: y, origin: x.origin });
|
|
1209
1209
|
}
|
|
1210
1210
|
const S = /* @__PURE__ */ new Map();
|
|
1211
|
-
for (const [h,
|
|
1212
|
-
|
|
1213
|
-
value:
|
|
1214
|
-
origin: { kind: "inherited", from: d, origin:
|
|
1211
|
+
for (const [h, x] of c)
|
|
1212
|
+
He(h) && S.set(h, {
|
|
1213
|
+
value: x.value,
|
|
1214
|
+
origin: { kind: "inherited", from: d, origin: x.origin }
|
|
1215
1215
|
});
|
|
1216
1216
|
return { computed: c, forChildren: S };
|
|
1217
1217
|
}, u = (r, a) => {
|
|
@@ -1232,40 +1232,60 @@ function Ne(t, n) {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
for (const w of r.children) u(w, o);
|
|
1234
1234
|
};
|
|
1235
|
-
u(
|
|
1235
|
+
u(e.root, /* @__PURE__ */ new Map()), s && i.push({
|
|
1236
1236
|
kind: "version-dependent",
|
|
1237
|
-
message: `Unity's control defaults were applied, as measured on ${
|
|
1237
|
+
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
1238
|
});
|
|
1239
|
-
for (const r of
|
|
1239
|
+
for (const r of t.usable) {
|
|
1240
1240
|
if (r.builtin === !0 || g.has(r)) continue;
|
|
1241
|
-
const a =
|
|
1241
|
+
const a = wt(r.rule.selectors);
|
|
1242
1242
|
a.length !== 0 && i.push({
|
|
1243
1243
|
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 — ${
|
|
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 — ${Be().join(", ")}. Anything else is drawn as a plain box and has no parts to style.`,
|
|
1245
1245
|
at: { in: "uss", sheet: r.sheet, span: r.rule.selectorSpan }
|
|
1246
1246
|
});
|
|
1247
1247
|
}
|
|
1248
1248
|
return { styles: l, partStyles: m, warnings: i };
|
|
1249
1249
|
}
|
|
1250
|
-
function
|
|
1251
|
-
const l =
|
|
1252
|
-
(m) => m.property ===
|
|
1250
|
+
function zt(e, n, t, i) {
|
|
1251
|
+
const l = Ee(e, i), s = Ne(e, { kind: "element", node: n }, l).filter(
|
|
1252
|
+
(m) => m.property === t
|
|
1253
1253
|
);
|
|
1254
|
-
return
|
|
1254
|
+
return Ce(s), s;
|
|
1255
1255
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1256
|
+
const _t = [
|
|
1257
|
+
{
|
|
1258
|
+
id: "text-metrics",
|
|
1259
|
+
kind: "unreproducible",
|
|
1260
|
+
summary: "Text-dependent layout can be a few pixels off Unity.",
|
|
1261
|
+
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."
|
|
1262
|
+
},
|
|
1263
|
+
{
|
|
1264
|
+
id: "wrap-container-height",
|
|
1265
|
+
kind: "unspecified",
|
|
1266
|
+
summary: "A wrapping container's height can differ from Unity.",
|
|
1267
|
+
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."
|
|
1268
|
+
},
|
|
1269
|
+
{
|
|
1270
|
+
id: "yoga-percent-without-parent-size",
|
|
1271
|
+
kind: "upstream",
|
|
1272
|
+
summary: "A main-axis percentage against an unsized parent can resolve differently.",
|
|
1273
|
+
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."
|
|
1274
|
+
}
|
|
1275
|
+
];
|
|
1276
|
+
function we(e) {
|
|
1277
|
+
return e !== void 0 && /[A-Za-z0-9_.:-]/.test(e);
|
|
1258
1278
|
}
|
|
1259
|
-
function
|
|
1260
|
-
return
|
|
1279
|
+
function be(e) {
|
|
1280
|
+
return e !== void 0 && /[A-Za-z_]/.test(e);
|
|
1261
1281
|
}
|
|
1262
|
-
function
|
|
1263
|
-
return
|
|
1264
|
-
` ||
|
|
1282
|
+
function Ct(e) {
|
|
1283
|
+
return e === " " || e === " " || e === `
|
|
1284
|
+
` || e === "\r";
|
|
1265
1285
|
}
|
|
1266
|
-
function
|
|
1286
|
+
function At(e) {
|
|
1267
1287
|
const n = [];
|
|
1268
|
-
let
|
|
1288
|
+
let t = 0, i = 0;
|
|
1269
1289
|
const l = () => i++;
|
|
1270
1290
|
function s(a, d, o) {
|
|
1271
1291
|
n.push({
|
|
@@ -1275,128 +1295,128 @@ function Ie(t) {
|
|
|
1275
1295
|
});
|
|
1276
1296
|
}
|
|
1277
1297
|
function m() {
|
|
1278
|
-
for (;
|
|
1298
|
+
for (; Ct(e[t]); ) t++;
|
|
1279
1299
|
}
|
|
1280
1300
|
function g() {
|
|
1281
1301
|
for (; ; ) {
|
|
1282
|
-
const a =
|
|
1302
|
+
const a = e.indexOf("<", t);
|
|
1283
1303
|
if (a < 0) {
|
|
1284
|
-
|
|
1304
|
+
t = e.length;
|
|
1285
1305
|
return;
|
|
1286
1306
|
}
|
|
1287
|
-
const d =
|
|
1307
|
+
const d = e[a + 1];
|
|
1288
1308
|
if (d === "!") {
|
|
1289
|
-
if (
|
|
1290
|
-
const o =
|
|
1291
|
-
|
|
1292
|
-
} else if (
|
|
1293
|
-
const o =
|
|
1294
|
-
|
|
1309
|
+
if (e.startsWith("<!--", a)) {
|
|
1310
|
+
const o = e.indexOf("-->", a + 4);
|
|
1311
|
+
t = o < 0 ? e.length : o + 3;
|
|
1312
|
+
} else if (e.startsWith("<![CDATA[", a)) {
|
|
1313
|
+
const o = e.indexOf("]]>", a + 9);
|
|
1314
|
+
t = o < 0 ? e.length : o + 3;
|
|
1295
1315
|
} else {
|
|
1296
|
-
const o =
|
|
1297
|
-
|
|
1316
|
+
const o = e.indexOf(">", a);
|
|
1317
|
+
t = o < 0 ? e.length : o + 1;
|
|
1298
1318
|
}
|
|
1299
1319
|
continue;
|
|
1300
1320
|
}
|
|
1301
1321
|
if (d === "?") {
|
|
1302
|
-
const o =
|
|
1303
|
-
|
|
1322
|
+
const o = e.indexOf("?>", a + 2);
|
|
1323
|
+
t = o < 0 ? e.length : o + 2;
|
|
1304
1324
|
continue;
|
|
1305
1325
|
}
|
|
1306
|
-
|
|
1326
|
+
t = a;
|
|
1307
1327
|
return;
|
|
1308
1328
|
}
|
|
1309
1329
|
}
|
|
1310
1330
|
function v() {
|
|
1311
|
-
const a =
|
|
1312
|
-
for (;
|
|
1313
|
-
const d =
|
|
1331
|
+
const a = t;
|
|
1332
|
+
for (; we(e[t]); ) t++;
|
|
1333
|
+
const d = e.slice(a, t), o = d.indexOf(":");
|
|
1314
1334
|
return o < 0 ? { prefix: null, local: d } : { prefix: d.slice(0, o), local: d.slice(o + 1) };
|
|
1315
1335
|
}
|
|
1316
1336
|
function u() {
|
|
1317
|
-
const a =
|
|
1318
|
-
for (;
|
|
1319
|
-
if (
|
|
1320
|
-
const d =
|
|
1321
|
-
if (m(), t
|
|
1322
|
-
return
|
|
1323
|
-
|
|
1324
|
-
const f = t
|
|
1337
|
+
const a = t;
|
|
1338
|
+
for (; we(e[t]); ) t++;
|
|
1339
|
+
if (t === a) return null;
|
|
1340
|
+
const d = e.slice(a, t), o = t;
|
|
1341
|
+
if (m(), e[t] !== "=")
|
|
1342
|
+
return t = o, s(`attribute "${d}" has no value`, a, o), { name: d, value: "", span: { start: a, end: o } };
|
|
1343
|
+
t++, m();
|
|
1344
|
+
const f = e[t];
|
|
1325
1345
|
if (f !== '"' && f !== "'")
|
|
1326
|
-
return s(`attribute "${d}" has an unquoted value`, a,
|
|
1327
|
-
|
|
1328
|
-
const w =
|
|
1329
|
-
return c < 0 ? (s(`attribute "${d}" has an unterminated value`, a,
|
|
1346
|
+
return s(`attribute "${d}" has an unquoted value`, a, t), { name: d, value: "", span: { start: a, end: t } };
|
|
1347
|
+
t++;
|
|
1348
|
+
const w = t, c = e.indexOf(f, t);
|
|
1349
|
+
return c < 0 ? (s(`attribute "${d}" has an unterminated value`, a, e.length), t = e.length, { name: d, value: e.slice(w), span: { start: a, end: t } }) : (t = c + 1, { name: d, value: e.slice(w, c), span: { start: a, end: t } });
|
|
1330
1350
|
}
|
|
1331
1351
|
function r() {
|
|
1332
|
-
const a =
|
|
1333
|
-
|
|
1352
|
+
const a = t;
|
|
1353
|
+
t++;
|
|
1334
1354
|
const d = v(), o = [];
|
|
1335
1355
|
let f = !1;
|
|
1336
1356
|
for (; ; ) {
|
|
1337
1357
|
m();
|
|
1338
|
-
const y = t
|
|
1358
|
+
const y = e[t];
|
|
1339
1359
|
if (y === void 0) {
|
|
1340
|
-
s("unterminated open tag", a,
|
|
1360
|
+
s("unterminated open tag", a, e.length);
|
|
1341
1361
|
break;
|
|
1342
1362
|
}
|
|
1343
1363
|
if (y === ">") {
|
|
1344
|
-
|
|
1364
|
+
t++;
|
|
1345
1365
|
break;
|
|
1346
1366
|
}
|
|
1347
|
-
if (y === "/" && t
|
|
1348
|
-
|
|
1367
|
+
if (y === "/" && e[t + 1] === ">") {
|
|
1368
|
+
t += 2, f = !0;
|
|
1349
1369
|
break;
|
|
1350
1370
|
}
|
|
1351
|
-
const
|
|
1352
|
-
if (
|
|
1353
|
-
|
|
1371
|
+
const b = u();
|
|
1372
|
+
if (b === null) {
|
|
1373
|
+
t++;
|
|
1354
1374
|
continue;
|
|
1355
1375
|
}
|
|
1356
|
-
o.push(
|
|
1376
|
+
o.push(b);
|
|
1357
1377
|
}
|
|
1358
|
-
const w = { start: a, end:
|
|
1378
|
+
const w = { start: a, end: t };
|
|
1359
1379
|
if (f)
|
|
1360
1380
|
return {
|
|
1361
1381
|
id: l(),
|
|
1362
1382
|
name: d,
|
|
1363
1383
|
attributes: o,
|
|
1364
1384
|
children: [],
|
|
1365
|
-
spans: { openTag: w, inner: { start:
|
|
1385
|
+
spans: { openTag: w, inner: { start: t, end: t }, closeTag: null },
|
|
1366
1386
|
tagDirty: !1,
|
|
1367
1387
|
childrenDirty: !1
|
|
1368
1388
|
};
|
|
1369
|
-
const c =
|
|
1389
|
+
const c = t, S = [];
|
|
1370
1390
|
for (; ; ) {
|
|
1371
|
-
if (g(),
|
|
1372
|
-
s(`unterminated element <${
|
|
1391
|
+
if (g(), t >= e.length) {
|
|
1392
|
+
s(`unterminated element <${Ae(d)}>`, a, e.length);
|
|
1373
1393
|
break;
|
|
1374
1394
|
}
|
|
1375
|
-
const y = t
|
|
1395
|
+
const y = e[t + 1];
|
|
1376
1396
|
if (y === "/") break;
|
|
1377
|
-
if (!
|
|
1378
|
-
|
|
1397
|
+
if (!be(y)) {
|
|
1398
|
+
t++;
|
|
1379
1399
|
continue;
|
|
1380
1400
|
}
|
|
1381
1401
|
S.push(r());
|
|
1382
1402
|
}
|
|
1383
|
-
const h =
|
|
1384
|
-
let
|
|
1385
|
-
if (
|
|
1386
|
-
const y =
|
|
1387
|
-
y < 0 && s("unterminated end tag",
|
|
1403
|
+
const h = t;
|
|
1404
|
+
let x = null;
|
|
1405
|
+
if (e.startsWith("</", t)) {
|
|
1406
|
+
const y = e.indexOf(">", t), b = y < 0 ? e.length : y + 1;
|
|
1407
|
+
y < 0 && s("unterminated end tag", t, b), x = { start: t, end: b }, t = b;
|
|
1388
1408
|
}
|
|
1389
1409
|
return {
|
|
1390
1410
|
id: l(),
|
|
1391
1411
|
name: d,
|
|
1392
1412
|
attributes: o,
|
|
1393
1413
|
children: S,
|
|
1394
|
-
spans: { openTag: w, inner: { start: c, end: h }, closeTag:
|
|
1414
|
+
spans: { openTag: w, inner: { start: c, end: h }, closeTag: x },
|
|
1395
1415
|
tagDirty: !1,
|
|
1396
1416
|
childrenDirty: !1
|
|
1397
1417
|
};
|
|
1398
1418
|
}
|
|
1399
|
-
return g(),
|
|
1419
|
+
return g(), t < e.length && be(e[t + 1]) ? { root: r(), warnings: n } : (s("no root element", 0, 0), {
|
|
1400
1420
|
root: {
|
|
1401
1421
|
id: l(),
|
|
1402
1422
|
name: { prefix: null, local: "" },
|
|
@@ -1409,11 +1429,11 @@ function Ie(t) {
|
|
|
1409
1429
|
warnings: n
|
|
1410
1430
|
});
|
|
1411
1431
|
}
|
|
1412
|
-
function
|
|
1413
|
-
return
|
|
1432
|
+
function Ae(e) {
|
|
1433
|
+
return e.prefix === null ? e.local : `${e.prefix}:${e.local}`;
|
|
1414
1434
|
}
|
|
1415
|
-
function
|
|
1416
|
-
const
|
|
1435
|
+
function It(e, n) {
|
|
1436
|
+
const t = (u) => e.slice(u.start, u.end);
|
|
1417
1437
|
function i(u) {
|
|
1418
1438
|
return u.spans.closeTag !== null ? u.spans.closeTag.end : Math.max(u.spans.openTag.end, u.spans.inner.end);
|
|
1419
1439
|
}
|
|
@@ -1421,34 +1441,34 @@ function Ae(t, n) {
|
|
|
1421
1441
|
return u.includes('"') ? u.includes("'") ? `"${u.replace(/"/g, """)}"` : `'${u}'` : `"${u}"`;
|
|
1422
1442
|
}
|
|
1423
1443
|
function s(u) {
|
|
1424
|
-
const r = u.attributes.map((d) => ` ${d.name}=${l(d.value)}`).join(""), a =
|
|
1444
|
+
const r = u.attributes.map((d) => ` ${d.name}=${l(d.value)}`).join(""), a = Ae(u.name);
|
|
1425
1445
|
return u.spans.closeTag === null ? `<${a}${r} />` : `<${a}${r}>`;
|
|
1426
1446
|
}
|
|
1427
1447
|
function m(u) {
|
|
1428
1448
|
var o, f;
|
|
1429
|
-
const r =
|
|
1449
|
+
const r = t(u.spans.inner), a = ((o = /^[ \t]*\r?\n[ \t]*/.exec(r)) == null ? void 0 : o[0]) ?? "", d = ((f = /\r?\n[ \t]*$/.exec(r)) == null ? void 0 : f[0]) ?? "";
|
|
1430
1450
|
return { between: a, before: a, after: d };
|
|
1431
1451
|
}
|
|
1432
1452
|
function g(u) {
|
|
1433
1453
|
const { inner: r } = u.spans;
|
|
1434
|
-
if (u.children.length === 0) return
|
|
1454
|
+
if (u.children.length === 0) return t(r);
|
|
1435
1455
|
if (u.childrenDirty) {
|
|
1436
1456
|
const { between: o, before: f, after: w } = m(u);
|
|
1437
1457
|
return f + u.children.map(v).join(o) + w;
|
|
1438
1458
|
}
|
|
1439
1459
|
let a = "", d = r.start;
|
|
1440
1460
|
for (const o of u.children)
|
|
1441
|
-
a +=
|
|
1442
|
-
return a +
|
|
1461
|
+
a += e.slice(d, o.spans.openTag.start), a += v(o), d = i(o);
|
|
1462
|
+
return a + e.slice(d, r.end);
|
|
1443
1463
|
}
|
|
1444
1464
|
function v(u) {
|
|
1445
|
-
const r = u.tagDirty ? s(u) :
|
|
1465
|
+
const r = u.tagDirty ? s(u) : t(u.spans.openTag), a = u.spans.closeTag === null ? "" : t(u.spans.closeTag);
|
|
1446
1466
|
return r + g(u) + a;
|
|
1447
1467
|
}
|
|
1448
|
-
return
|
|
1468
|
+
return e.slice(0, n.spans.openTag.start) + v(n) + e.slice(i(n));
|
|
1449
1469
|
}
|
|
1450
|
-
function
|
|
1451
|
-
const n =
|
|
1470
|
+
function Mt(e) {
|
|
1471
|
+
const n = e.source, t = (r) => n.slice(r.start, r.end);
|
|
1452
1472
|
function i(r) {
|
|
1453
1473
|
return r.parts.map((a, d) => {
|
|
1454
1474
|
const o = d === 0 ? "" : a.combinator === "child" ? " > " : " ", f = a.simple.map((w) => {
|
|
@@ -1479,13 +1499,13 @@ function Me(t) {
|
|
|
1479
1499
|
return { between: `;${o}`, before: o, after: `;${w}` };
|
|
1480
1500
|
}
|
|
1481
1501
|
function s(r) {
|
|
1482
|
-
const a = r.selectorDirty ? r.selectors.map(i).join(", ") :
|
|
1502
|
+
const a = r.selectorDirty ? r.selectors.map(i).join(", ") : t(r.selectorSpan);
|
|
1483
1503
|
if (r.declarations.length === 0)
|
|
1484
1504
|
return a + n.slice(r.selectorSpan.end, r.span.end);
|
|
1485
1505
|
const d = n.slice(r.selectorSpan.end, r.declarations[0].span.start);
|
|
1486
1506
|
if (r.declarationsDirty) {
|
|
1487
|
-
const { between: w, before: c, after: S } = l(r), h = d.slice(0, d.indexOf("{") + 1),
|
|
1488
|
-
return `${a}${h}${c}${
|
|
1507
|
+
const { between: w, before: c, after: S } = l(r), h = d.slice(0, d.indexOf("{") + 1), x = r.declarations.map(m).join(w);
|
|
1508
|
+
return `${a}${h}${c}${x}${S}}`;
|
|
1489
1509
|
}
|
|
1490
1510
|
let o = a, f = r.selectorSpan.end;
|
|
1491
1511
|
for (const w of r.declarations)
|
|
@@ -1493,36 +1513,36 @@ function Me(t) {
|
|
|
1493
1513
|
return o + n.slice(f, r.span.end);
|
|
1494
1514
|
}
|
|
1495
1515
|
function m(r) {
|
|
1496
|
-
return r.dirty ? `${r.property}: ${r.value}` :
|
|
1516
|
+
return r.dirty ? `${r.property}: ${r.value}` : t(r.span);
|
|
1497
1517
|
}
|
|
1498
1518
|
function g(r) {
|
|
1499
|
-
return r.kind === "rule" ? s(r.rule) :
|
|
1519
|
+
return r.kind === "rule" ? s(r.rule) : t(r.span);
|
|
1500
1520
|
}
|
|
1501
1521
|
let v = "", u = 0;
|
|
1502
|
-
for (const r of
|
|
1522
|
+
for (const r of e.items) {
|
|
1503
1523
|
const a = r.kind === "rule" ? r.rule.span : r.span;
|
|
1504
1524
|
v += n.slice(u, a.start), v += g(r), u = a.end;
|
|
1505
1525
|
}
|
|
1506
1526
|
return v + n.slice(u);
|
|
1507
1527
|
}
|
|
1508
|
-
function
|
|
1509
|
-
var
|
|
1510
|
-
if (
|
|
1511
|
-
const i = (
|
|
1512
|
-
i !== void 0 && i.length > 0 && n.push(
|
|
1528
|
+
function Ie(e, n = []) {
|
|
1529
|
+
var t;
|
|
1530
|
+
if (e.name.local === "Style") {
|
|
1531
|
+
const i = (t = e.attributes.find((l) => l.name === "src")) == null ? void 0 : t.value;
|
|
1532
|
+
i !== void 0 && i.length > 0 && n.push(ye(i));
|
|
1513
1533
|
}
|
|
1514
|
-
for (const i of
|
|
1534
|
+
for (const i of e.children) Ie(i, n);
|
|
1515
1535
|
return n;
|
|
1516
1536
|
}
|
|
1517
|
-
function
|
|
1537
|
+
function jt(e, n, t) {
|
|
1518
1538
|
var g, v;
|
|
1519
|
-
const i =
|
|
1520
|
-
for (const u of
|
|
1521
|
-
const r = ((g =
|
|
1539
|
+
const i = At(e), l = [...i.warnings], s = [], m = [];
|
|
1540
|
+
for (const u of Ie(i.root)) {
|
|
1541
|
+
const r = ((g = t == null ? void 0 : t.resolveImport) == null ? void 0 : g.call(t, u)) ?? null;
|
|
1522
1542
|
if (r === null) {
|
|
1523
1543
|
l.push({
|
|
1524
1544
|
kind: "import-unresolved",
|
|
1525
|
-
message: (
|
|
1545
|
+
message: (t == null ? void 0 : t.resolveImport) === void 0 ? `<Style src="${u}"> was not loaded: pass resolveImport to read it, or pass the stylesheet text directly. Until then this document renders unstyled.` : `<Style src="${u}"> could not be resolved`,
|
|
1526
1546
|
node: i.root.id
|
|
1527
1547
|
});
|
|
1528
1548
|
continue;
|
|
@@ -1535,16 +1555,16 @@ function ze(t, n, e) {
|
|
|
1535
1555
|
...n === void 0 ? [] : [{ text: n, origin: null }]
|
|
1536
1556
|
];
|
|
1537
1557
|
for (; r.length > 0; ) {
|
|
1538
|
-
const a = r.shift(), d = s.length, o =
|
|
1558
|
+
const a = r.shift(), d = s.length, o = re(a.text, a.origin, d);
|
|
1539
1559
|
s.push(o.sheet), l.push(...o.warnings);
|
|
1540
1560
|
for (const f of o.sheet.items) {
|
|
1541
1561
|
if (f.kind !== "import" || u.has(f.url)) continue;
|
|
1542
1562
|
u.add(f.url);
|
|
1543
|
-
const w = ((v =
|
|
1563
|
+
const w = ((v = t == null ? void 0 : t.resolveImport) == null ? void 0 : v.call(t, f.url)) ?? null;
|
|
1544
1564
|
if (w === null) {
|
|
1545
1565
|
l.push({
|
|
1546
1566
|
kind: "import-unresolved",
|
|
1547
|
-
message: (
|
|
1567
|
+
message: (t == null ? void 0 : t.resolveImport) === void 0 ? `@import "${f.url}" was not loaded: pass resolveImport to read it` : `@import "${f.url}" could not be resolved`,
|
|
1548
1568
|
at: { in: "uss", sheet: d, span: f.span }
|
|
1549
1569
|
});
|
|
1550
1570
|
continue;
|
|
@@ -1553,30 +1573,30 @@ function ze(t, n, e) {
|
|
|
1553
1573
|
}
|
|
1554
1574
|
}
|
|
1555
1575
|
}
|
|
1556
|
-
return { source:
|
|
1576
|
+
return { source: e, root: i.root, sheets: s, warnings: l };
|
|
1557
1577
|
}
|
|
1558
|
-
function
|
|
1559
|
-
const n =
|
|
1578
|
+
function Wt(e) {
|
|
1579
|
+
const n = e.sheets[0];
|
|
1560
1580
|
return {
|
|
1561
|
-
uxml:
|
|
1581
|
+
uxml: It(e.source, e.root),
|
|
1562
1582
|
// Only the sheet passed to `parse` round-trips. `@import`ed sheets (Phase 3)
|
|
1563
1583
|
// are separate files and are not this function's to write.
|
|
1564
|
-
uss: n === void 0 ? "" :
|
|
1584
|
+
uss: n === void 0 ? "" : Mt(n)
|
|
1565
1585
|
};
|
|
1566
1586
|
}
|
|
1567
|
-
function
|
|
1568
|
-
const i = n.ownerDocument, l = (
|
|
1587
|
+
function Bt(e, n, t) {
|
|
1588
|
+
const i = n.ownerDocument, l = (t == null ? void 0 : t.size) ?? {
|
|
1569
1589
|
width: n.clientWidth,
|
|
1570
1590
|
height: n.clientHeight
|
|
1571
|
-
}, s =
|
|
1572
|
-
...(
|
|
1573
|
-
...(
|
|
1574
|
-
}), m = (
|
|
1591
|
+
}, s = Nt(e, {
|
|
1592
|
+
...(t == null ? void 0 : t.activeStates) === void 0 ? {} : { activeStates: t.activeStates },
|
|
1593
|
+
...(t == null ? void 0 : t.states) === void 0 ? {} : { states: t.states }
|
|
1594
|
+
}), m = (t == null ? void 0 : t.measureText) ?? nt(i), g = et(e.root, s.styles, s.partStyles, { size: l, measureText: m });
|
|
1575
1595
|
let v;
|
|
1576
1596
|
try {
|
|
1577
|
-
v =
|
|
1597
|
+
v = ft(e.root, g.boxes, g.parts, s.styles, n, {
|
|
1578
1598
|
document: i,
|
|
1579
|
-
resolveAsset:
|
|
1599
|
+
resolveAsset: t == null ? void 0 : t.resolveAsset
|
|
1580
1600
|
});
|
|
1581
1601
|
} catch (r) {
|
|
1582
1602
|
throw g.dispose(), r;
|
|
@@ -1592,18 +1612,19 @@ function We(t, n, e) {
|
|
|
1592
1612
|
};
|
|
1593
1613
|
}
|
|
1594
1614
|
export {
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1615
|
+
_t as KNOWN_DIVERGENCES,
|
|
1616
|
+
ct as NODE_ATTRIBUTE,
|
|
1617
|
+
ut as PART_ATTRIBUTE,
|
|
1618
|
+
dt as PART_OWNER_ATTRIBUTE,
|
|
1619
|
+
nt as createDefaultMeasureText,
|
|
1620
|
+
zt as explainProperty,
|
|
1621
|
+
He as isInherited,
|
|
1622
|
+
Dt as isLayoutEngineReady,
|
|
1623
|
+
Lt as liveNodeCount,
|
|
1624
|
+
Ut as loadLayoutEngine,
|
|
1625
|
+
jt as parse,
|
|
1626
|
+
Bt as render,
|
|
1627
|
+
Nt as resolveStyles,
|
|
1628
|
+
Wt as serialize,
|
|
1629
|
+
Be as supportedControlNames
|
|
1609
1630
|
};
|