uxml-preview 0.3.0 → 0.5.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 +144 -1
- package/README.md +113 -15
- package/dist/index.d.ts +19 -2
- package/dist/index.js +1490 -1003
- package/dist/model/types.d.ts +38 -1
- package/dist/template/expand.d.ts +26 -0
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,584 @@
|
|
|
1
|
-
import { loadYoga as
|
|
2
|
-
|
|
1
|
+
import { loadYoga as tt, PositionType as ne, Direction as be, Edge as q, BoxSizing as nt, FlexDirection as G, Wrap as Y, Justify as P, Align as W, Display as st, Overflow as rt } from "yoga-layout/load";
|
|
2
|
+
function J(e) {
|
|
3
|
+
const n = (t, s) => !Number.isInteger(t) || t < 0 || t > 1114111 || t >= 55296 && t <= 57343 ? s : String.fromCodePoint(t);
|
|
4
|
+
return e.replace(/&#x([0-9a-f]+);/gi, (t, s) => n(parseInt(s, 16), t)).replace(/&#(\d+);/g, (t, s) => n(Number(s), t)).replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
5
|
+
}
|
|
6
|
+
function ye(e) {
|
|
7
|
+
return e !== void 0 && /[A-Za-z0-9_.:-]/.test(e);
|
|
8
|
+
}
|
|
9
|
+
function xe(e) {
|
|
10
|
+
return e !== void 0 && /[A-Za-z_]/.test(e);
|
|
11
|
+
}
|
|
12
|
+
function it(e) {
|
|
13
|
+
return e === " " || e === " " || e === `
|
|
14
|
+
` || e === "\r";
|
|
15
|
+
}
|
|
16
|
+
function Re(e) {
|
|
17
|
+
const n = [];
|
|
18
|
+
let t = 0, s = 0;
|
|
19
|
+
const i = () => s++;
|
|
20
|
+
function r(a, f, l) {
|
|
21
|
+
n.push({
|
|
22
|
+
kind: "malformed",
|
|
23
|
+
message: a,
|
|
24
|
+
at: { in: "uxml", span: { start: f, end: l } }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function u() {
|
|
28
|
+
for (; it(e[t]); ) t++;
|
|
29
|
+
}
|
|
30
|
+
function c() {
|
|
31
|
+
for (; ; ) {
|
|
32
|
+
const a = e.indexOf("<", t);
|
|
33
|
+
if (a < 0) {
|
|
34
|
+
t = e.length;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const f = e[a + 1];
|
|
38
|
+
if (f === "!") {
|
|
39
|
+
if (e.startsWith("<!--", a)) {
|
|
40
|
+
const l = e.indexOf("-->", a + 4);
|
|
41
|
+
t = l < 0 ? e.length : l + 3;
|
|
42
|
+
} else if (e.startsWith("<![CDATA[", a)) {
|
|
43
|
+
const l = e.indexOf("]]>", a + 9);
|
|
44
|
+
t = l < 0 ? e.length : l + 3;
|
|
45
|
+
} else {
|
|
46
|
+
const l = e.indexOf(">", a);
|
|
47
|
+
t = l < 0 ? e.length : l + 1;
|
|
48
|
+
}
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (f === "?") {
|
|
52
|
+
const l = e.indexOf("?>", a + 2);
|
|
53
|
+
t = l < 0 ? e.length : l + 2;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
t = a;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function v() {
|
|
61
|
+
const a = t;
|
|
62
|
+
for (; ye(e[t]); ) t++;
|
|
63
|
+
const f = e.slice(a, t), l = f.indexOf(":");
|
|
64
|
+
return l < 0 ? { prefix: null, local: f } : { prefix: f.slice(0, l), local: f.slice(l + 1) };
|
|
65
|
+
}
|
|
66
|
+
function d() {
|
|
67
|
+
const a = t;
|
|
68
|
+
for (; ye(e[t]); ) t++;
|
|
69
|
+
if (t === a) return null;
|
|
70
|
+
const f = e.slice(a, t), l = t;
|
|
71
|
+
if (u(), e[t] !== "=")
|
|
72
|
+
return t = l, r(`attribute "${f}" has no value`, a, l), { name: f, value: "", span: { start: a, end: l } };
|
|
73
|
+
t++, u();
|
|
74
|
+
const h = e[t];
|
|
75
|
+
if (h !== '"' && h !== "'")
|
|
76
|
+
return r(`attribute "${f}" has an unquoted value`, a, t), { name: f, value: "", span: { start: a, end: t } };
|
|
77
|
+
t++;
|
|
78
|
+
const g = t, p = e.indexOf(h, t);
|
|
79
|
+
return p < 0 ? (r(`attribute "${f}" has an unterminated value`, a, e.length), t = e.length, { name: f, value: e.slice(g), span: { start: a, end: t } }) : (t = p + 1, { name: f, value: e.slice(g, p), span: { start: a, end: t } });
|
|
80
|
+
}
|
|
81
|
+
function o() {
|
|
82
|
+
const a = t;
|
|
83
|
+
t++;
|
|
84
|
+
const f = v(), l = [];
|
|
85
|
+
let h = !1;
|
|
86
|
+
for (; ; ) {
|
|
87
|
+
u();
|
|
88
|
+
const k = e[t];
|
|
89
|
+
if (k === void 0) {
|
|
90
|
+
r("unterminated open tag", a, e.length);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
if (k === ">") {
|
|
94
|
+
t++;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
if (k === "/" && e[t + 1] === ">") {
|
|
98
|
+
t += 2, h = !0;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
const x = d();
|
|
102
|
+
if (x === null) {
|
|
103
|
+
t++;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
l.push(x);
|
|
107
|
+
}
|
|
108
|
+
const g = { start: a, end: t };
|
|
109
|
+
if (h)
|
|
110
|
+
return {
|
|
111
|
+
id: i(),
|
|
112
|
+
name: f,
|
|
113
|
+
attributes: l,
|
|
114
|
+
children: [],
|
|
115
|
+
spans: { openTag: g, inner: { start: t, end: t }, closeTag: null },
|
|
116
|
+
tagDirty: !1,
|
|
117
|
+
childrenDirty: !1
|
|
118
|
+
};
|
|
119
|
+
const p = t, b = [];
|
|
120
|
+
for (; ; ) {
|
|
121
|
+
if (c(), t >= e.length) {
|
|
122
|
+
r(`unterminated element <${Ce(f)}>`, a, e.length);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
const k = e[t + 1];
|
|
126
|
+
if (k === "/") break;
|
|
127
|
+
if (!xe(k)) {
|
|
128
|
+
t++;
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
b.push(o());
|
|
132
|
+
}
|
|
133
|
+
const m = t;
|
|
134
|
+
let y = null;
|
|
135
|
+
if (e.startsWith("</", t)) {
|
|
136
|
+
const k = e.indexOf(">", t), x = k < 0 ? e.length : k + 1;
|
|
137
|
+
k < 0 && r("unterminated end tag", t, x), y = { start: t, end: x }, t = x;
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
id: i(),
|
|
141
|
+
name: f,
|
|
142
|
+
attributes: l,
|
|
143
|
+
children: b,
|
|
144
|
+
spans: { openTag: g, inner: { start: p, end: m }, closeTag: y },
|
|
145
|
+
tagDirty: !1,
|
|
146
|
+
childrenDirty: !1
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return c(), t < e.length && xe(e[t + 1]) ? { root: o(), warnings: n } : (r("no root element", 0, 0), {
|
|
150
|
+
root: {
|
|
151
|
+
id: i(),
|
|
152
|
+
name: { prefix: null, local: "" },
|
|
153
|
+
attributes: [],
|
|
154
|
+
children: [],
|
|
155
|
+
spans: { openTag: { start: 0, end: 0 }, inner: { start: 0, end: 0 }, closeTag: null },
|
|
156
|
+
tagDirty: !1,
|
|
157
|
+
childrenDirty: !1
|
|
158
|
+
},
|
|
159
|
+
warnings: n
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function Ce(e) {
|
|
163
|
+
return e.prefix === null ? e.local : `${e.prefix}:${e.local}`;
|
|
164
|
+
}
|
|
165
|
+
let Me;
|
|
166
|
+
function ot(e) {
|
|
167
|
+
Me = e;
|
|
168
|
+
}
|
|
169
|
+
const Ue = /* @__PURE__ */ new WeakMap();
|
|
170
|
+
function lt(e, n) {
|
|
171
|
+
Ue.set(e, n);
|
|
172
|
+
}
|
|
173
|
+
function bn(e) {
|
|
174
|
+
return Re(e).root.children.filter((t) => t.name.local === "Template").flatMap((t) => {
|
|
175
|
+
const s = Le(t, "src");
|
|
176
|
+
return s === void 0 || s.length === 0 ? [] : [J(s)];
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
const ke = 32;
|
|
180
|
+
function Le(e, n) {
|
|
181
|
+
var t;
|
|
182
|
+
return (t = e.attributes.find((s) => s.name === n)) == null ? void 0 : t.value;
|
|
183
|
+
}
|
|
184
|
+
function U(e, n) {
|
|
185
|
+
const t = Le(e, n);
|
|
186
|
+
return t === void 0 ? void 0 : J(t);
|
|
187
|
+
}
|
|
188
|
+
function We(e) {
|
|
189
|
+
const n = /* @__PURE__ */ new Map();
|
|
190
|
+
for (const t of e.root.children) {
|
|
191
|
+
if (t.name.local !== "Template") continue;
|
|
192
|
+
const s = U(t, "name"), i = U(t, "src");
|
|
193
|
+
s === void 0 || s.length === 0 || i === void 0 || i.length === 0 || n.set(s, { name: s, src: i, node: t });
|
|
194
|
+
}
|
|
195
|
+
return n;
|
|
196
|
+
}
|
|
197
|
+
function ze(e, n) {
|
|
198
|
+
return JSON.stringify([e, n]);
|
|
199
|
+
}
|
|
200
|
+
function at(e) {
|
|
201
|
+
return /(?:^|\/)Packages\//i.test(e) || /PackageCache/i.test(e);
|
|
202
|
+
}
|
|
203
|
+
function j(e, n, t, s, i) {
|
|
204
|
+
e.push({
|
|
205
|
+
kind: n,
|
|
206
|
+
message: t,
|
|
207
|
+
...s === void 0 ? {} : { node: s.id },
|
|
208
|
+
...i === void 0 ? {} : { sourceDocument: i }
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function ee(e, n = 0, t = void 0) {
|
|
212
|
+
return {
|
|
213
|
+
...e,
|
|
214
|
+
span: {
|
|
215
|
+
start: e.span.start + n,
|
|
216
|
+
end: e.span.end + n
|
|
217
|
+
},
|
|
218
|
+
...t === void 0 ? {} : { sourceDocument: t }
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function _e(e) {
|
|
222
|
+
return { prefix: e.prefix, local: e.local };
|
|
223
|
+
}
|
|
224
|
+
function Se() {
|
|
225
|
+
return { start: 0, end: 0 };
|
|
226
|
+
}
|
|
227
|
+
function se(e, n) {
|
|
228
|
+
return { start: e.start + n, end: e.end + n };
|
|
229
|
+
}
|
|
230
|
+
function ct(e, n, t, s, i) {
|
|
231
|
+
return {
|
|
232
|
+
id: e,
|
|
233
|
+
name: n,
|
|
234
|
+
attributes: t,
|
|
235
|
+
children: s,
|
|
236
|
+
spans: { openTag: Se(), inner: Se(), closeTag: null },
|
|
237
|
+
tagDirty: !1,
|
|
238
|
+
childrenDirty: !1,
|
|
239
|
+
...i === void 0 ? {} : { derived: { kind: "template-container", instance: i } }
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function ut(e, n, t) {
|
|
243
|
+
const s = e.items.map((i) => i.kind !== "import" || i.resolvedSheet === void 0 ? i.kind === "rule" ? {
|
|
244
|
+
...i,
|
|
245
|
+
rule: {
|
|
246
|
+
...i.rule,
|
|
247
|
+
selectors: i.rule.selectors.map((r) => ({
|
|
248
|
+
...r,
|
|
249
|
+
parts: r.parts.map((u) => ({ ...u, simple: [...u.simple] }))
|
|
250
|
+
})),
|
|
251
|
+
declarations: i.rule.declarations.map((r) => ({ ...r }))
|
|
252
|
+
}
|
|
253
|
+
} : { ...i } : { ...i, resolvedSheet: i.resolvedSheet + n });
|
|
254
|
+
return { ...e, items: s, sourceDocumentFrom: t };
|
|
255
|
+
}
|
|
256
|
+
function dt(e, n) {
|
|
257
|
+
const t = n.sheetOffsets.get(e.document);
|
|
258
|
+
if (t !== void 0) return t;
|
|
259
|
+
const s = n.sheets.length, i = e.document.sheets.map((u, c) => s + c), r = e.document.sheets.map(() => e.url);
|
|
260
|
+
return e.document.sheets.forEach((u, c) => {
|
|
261
|
+
for (const v of u.items)
|
|
262
|
+
v.kind === "import" && v.resolvedSheet !== void 0 && (r[v.resolvedSheet] = u.origin ?? e.url);
|
|
263
|
+
}), n.sheetOffsets.set(e.document, i), e.document.sheets.forEach(
|
|
264
|
+
(u, c) => n.sheets.push(ut(u, s, r[c]))
|
|
265
|
+
), i;
|
|
266
|
+
}
|
|
267
|
+
function je(e, n) {
|
|
268
|
+
const t = n.sourceOffsets.get(e);
|
|
269
|
+
if (t !== void 0) return t;
|
|
270
|
+
const s = n.sourceLength + 1;
|
|
271
|
+
return n.sourceOffsets.set(e, s), n.sources.push(`
|
|
272
|
+
${e.source}`), n.sourceLength += e.source.length + 1, s;
|
|
273
|
+
}
|
|
274
|
+
function ft(e, n, t, s, i) {
|
|
275
|
+
for (const r of e.document.styleRoots ?? []) {
|
|
276
|
+
const u = n[r.sheet];
|
|
277
|
+
if (u === void 0) continue;
|
|
278
|
+
const c = t.nodes.get(r.scope) ?? s.id;
|
|
279
|
+
i.styleRoots.push({ sheet: u, scope: c });
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function pt(e) {
|
|
283
|
+
return e.map((n) => {
|
|
284
|
+
const t = U(n, "name"), s = U(n, "slot");
|
|
285
|
+
return `<${n.name.local}${t === void 0 ? "" : ` name="${t}"`}${s === void 0 ? "" : ` slot="${s}"`}>`;
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function Fe(e, n) {
|
|
289
|
+
const t = U(e, "slot-name");
|
|
290
|
+
t !== void 0 && t.length > 0 && n.add(t);
|
|
291
|
+
for (const s of e.children) Fe(s, n);
|
|
292
|
+
}
|
|
293
|
+
function V(e, n, t, s, i) {
|
|
294
|
+
const r = /* @__PURE__ */ new Set();
|
|
295
|
+
t !== null && Fe(t.document.root, r), !(r.size === 0 && n.length === 0) && j(
|
|
296
|
+
i.warnings,
|
|
297
|
+
"template-slot-unsupported",
|
|
298
|
+
`Template slots are unsupported; defined slot names: ${t === null ? "(unavailable)" : r.size === 0 ? "(none)" : [...r].join(", ")}; children not placed: ${n.length === 0 ? "(none)" : pt(n).join(", ")}`,
|
|
299
|
+
e,
|
|
300
|
+
s
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
function pe(e, n) {
|
|
304
|
+
if (e.name.local !== "Style" && e.name.local !== "Template" && e.name.local !== "AttributeOverrides") {
|
|
305
|
+
const t = U(e, "name");
|
|
306
|
+
t !== void 0 && t.length > 0 && n.set(t, (n.get(t) ?? 0) + 1);
|
|
307
|
+
}
|
|
308
|
+
for (const t of e.children) pe(t, n);
|
|
309
|
+
}
|
|
310
|
+
function Pe(e, n, t) {
|
|
311
|
+
U(e, "name") === n && t.push(e);
|
|
312
|
+
for (const s of e.children) Pe(s, n, t);
|
|
313
|
+
}
|
|
314
|
+
function ht(e, n, t, s, i) {
|
|
315
|
+
if (n.length === 0) return;
|
|
316
|
+
const r = /* @__PURE__ */ new Map();
|
|
317
|
+
pe(e, r);
|
|
318
|
+
for (const u of n) {
|
|
319
|
+
const c = U(u, "element-name"), v = U(u, "style");
|
|
320
|
+
if (v !== void 0 && j(
|
|
321
|
+
i.warnings,
|
|
322
|
+
"override-style-ignored",
|
|
323
|
+
`AttributeOverrides style for element-name "${c ?? "(missing)"}" was ignored with value "${v}"; Unity ignores style AttributeOverrides, so this matches Unity and is not a preview limitation.`,
|
|
324
|
+
u,
|
|
325
|
+
s ?? void 0
|
|
326
|
+
), c === void 0 || c.length === 0) continue;
|
|
327
|
+
const d = [];
|
|
328
|
+
if (Pe(e, c, d), d.length === 0) {
|
|
329
|
+
const o = [...r.keys()];
|
|
330
|
+
j(
|
|
331
|
+
i.warnings,
|
|
332
|
+
"override-target-missing",
|
|
333
|
+
`AttributeOverrides target "${c}" matched no element; available names: ${o.length === 0 ? "(none)" : o.join(", ")}`,
|
|
334
|
+
u,
|
|
335
|
+
s ?? void 0
|
|
336
|
+
);
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
for (const o of d)
|
|
340
|
+
for (const a of u.attributes) {
|
|
341
|
+
if (a.name === "element-name" || a.name === "style") continue;
|
|
342
|
+
const f = o.attributes.find((l) => l.name === a.name);
|
|
343
|
+
f === void 0 ? o.attributes.push(ee(a, t, s)) : (f.value = a.value, f.sourceDocument = s);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function Be(e) {
|
|
348
|
+
return e.name.local === "Template" || e.name.local === "Instance" ? !0 : e.children.some(Be);
|
|
349
|
+
}
|
|
350
|
+
function mt(e, n) {
|
|
351
|
+
let t = 0;
|
|
352
|
+
const s = (i) => {
|
|
353
|
+
t = Math.max(t, Number(i.id) + 1);
|
|
354
|
+
for (const r of i.children) s(r);
|
|
355
|
+
};
|
|
356
|
+
return s(e.root), {
|
|
357
|
+
resolver: n,
|
|
358
|
+
warnings: [],
|
|
359
|
+
cache: /* @__PURE__ */ new Map(),
|
|
360
|
+
sheetOffsets: /* @__PURE__ */ new WeakMap(),
|
|
361
|
+
reportedWarnings: /* @__PURE__ */ new WeakSet(),
|
|
362
|
+
sourceOffsets: new WeakMap([[e, 0]]),
|
|
363
|
+
sources: [e.source],
|
|
364
|
+
sourceLength: e.source.length,
|
|
365
|
+
sheets: [...e.sheets],
|
|
366
|
+
styleRoots: [...e.styleRoots ?? []],
|
|
367
|
+
nextId: () => t++,
|
|
368
|
+
stack: []
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
function gt(e, n, t) {
|
|
372
|
+
var v;
|
|
373
|
+
const s = ze(e.src, n);
|
|
374
|
+
if (t.cache.has(s)) return t.cache.get(s) ?? null;
|
|
375
|
+
const i = ((v = t.resolver) == null ? void 0 : v.call(t, e.src, n)) ?? null;
|
|
376
|
+
if (i === null)
|
|
377
|
+
return t.cache.set(s, null), j(
|
|
378
|
+
t.warnings,
|
|
379
|
+
"template-src-unresolved",
|
|
380
|
+
`Template "${e.name}" src "${e.src}" could not be resolved from ${n === null ? "the entry UXML" : `"${n}"`}; attempted resolveImport("${e.src}", ${n === null ? "null" : `"${n}"`}); internal filesystem search paths: none`,
|
|
381
|
+
e.node,
|
|
382
|
+
n ?? void 0
|
|
383
|
+
), at(e.src) && j(
|
|
384
|
+
t.warnings,
|
|
385
|
+
"package-path-not-searched",
|
|
386
|
+
`Template src "${e.src}" was unresolved; the resolver returned no source and the core does not independently search Unity Packages/Library/PackageCache paths`,
|
|
387
|
+
e.node,
|
|
388
|
+
n ?? void 0
|
|
389
|
+
), null;
|
|
390
|
+
const r = Me;
|
|
391
|
+
if (r === void 0)
|
|
392
|
+
throw new Error("template parser is not registered; import parse from src/index before expansion");
|
|
393
|
+
const u = r(
|
|
394
|
+
i,
|
|
395
|
+
t.resolver === void 0 ? void 0 : (d, o) => t.resolver(d, o ?? e.src)
|
|
396
|
+
), c = {
|
|
397
|
+
url: e.src,
|
|
398
|
+
from: n,
|
|
399
|
+
document: u,
|
|
400
|
+
declarations: We(u)
|
|
401
|
+
};
|
|
402
|
+
return t.cache.set(s, c), c;
|
|
403
|
+
}
|
|
404
|
+
function wt(e, n, t) {
|
|
405
|
+
var s, i;
|
|
406
|
+
if (!t.reportedWarnings.has(e.document)) {
|
|
407
|
+
t.reportedWarnings.add(e.document);
|
|
408
|
+
for (const r of e.document.warnings)
|
|
409
|
+
((s = r.at) == null ? void 0 : s.in) === "uss" ? t.warnings.push({
|
|
410
|
+
...r,
|
|
411
|
+
at: { ...r.at, sheet: n[r.at.sheet] ?? r.at.sheet },
|
|
412
|
+
sourceDocument: ((i = e.document.sheets[r.at.sheet]) == null ? void 0 : i.origin) ?? e.url
|
|
413
|
+
}) : t.warnings.push({ ...r, sourceDocument: e.url });
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
function te(e, n, t, s, i, r) {
|
|
417
|
+
const u = i ? e.id : n.nextId(), c = s === null ? 0 : n.sourceOffsets.get(s.document) ?? 0, v = c === 0 || s === null ? void 0 : s.url, d = {
|
|
418
|
+
id: u,
|
|
419
|
+
name: _e(e.name),
|
|
420
|
+
attributes: e.attributes.map((o) => ee(o, c, v)),
|
|
421
|
+
children: [],
|
|
422
|
+
spans: {
|
|
423
|
+
openTag: se(e.spans.openTag, c),
|
|
424
|
+
inner: se(e.spans.inner, c),
|
|
425
|
+
closeTag: e.spans.closeTag === null ? null : se(e.spans.closeTag, c)
|
|
426
|
+
},
|
|
427
|
+
tagDirty: e.tagDirty,
|
|
428
|
+
childrenDirty: e.childrenDirty,
|
|
429
|
+
...c === 0 || s === null ? {} : {
|
|
430
|
+
sourceDocument: s.url,
|
|
431
|
+
sourceDocumentFrom: s.from,
|
|
432
|
+
sourceNode: e.id
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
t.nodes.set(e.id, d.id);
|
|
436
|
+
for (const o of e.children)
|
|
437
|
+
if (!(o.name.local === "Template" || o.name.local === "Style")) {
|
|
438
|
+
if (o.name.local === "Instance") {
|
|
439
|
+
d.children.push(he(o, n, s, t, r + 1));
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
o.name.local !== "AttributeOverrides" && U(o, "slot") === void 0 && d.children.push(te(o, n, t, s, i, r));
|
|
443
|
+
}
|
|
444
|
+
return d;
|
|
445
|
+
}
|
|
446
|
+
function vt(e, n, t, s) {
|
|
447
|
+
je(e.document, t);
|
|
448
|
+
const i = { nodes: /* @__PURE__ */ new Map([[e.document.root.id, n.id]]) };
|
|
449
|
+
for (const r of e.document.root.children)
|
|
450
|
+
if (!(r.name.local === "Template" || r.name.local === "Style")) {
|
|
451
|
+
if (r.name.local === "Instance") {
|
|
452
|
+
n.children.push(he(r, t, e, i, s + 1));
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
r.name.local !== "AttributeOverrides" && U(r, "slot") === void 0 && n.children.push(te(r, t, i, e, !1, s));
|
|
456
|
+
}
|
|
457
|
+
return i;
|
|
458
|
+
}
|
|
459
|
+
function he(e, n, t, s, i) {
|
|
460
|
+
const r = ct(
|
|
461
|
+
n.nextId(),
|
|
462
|
+
{ prefix: e.name.prefix, local: "TemplateContainer" },
|
|
463
|
+
e.attributes.filter((b) => b.name !== "template").map(
|
|
464
|
+
(b) => ee(
|
|
465
|
+
b,
|
|
466
|
+
t === null ? 0 : n.sourceOffsets.get(t.document) ?? 0,
|
|
467
|
+
t === null || t.url.length === 0 ? null : t.url
|
|
468
|
+
)
|
|
469
|
+
),
|
|
470
|
+
[],
|
|
471
|
+
e.id
|
|
472
|
+
);
|
|
473
|
+
t !== null && (r.sourceDocument = t.url.length > 0 ? t.url : null, r.sourceDocumentFrom = t.from), s.nodes.set(e.id, r.id);
|
|
474
|
+
const u = U(e, "template"), c = e.children.filter((b) => U(b, "slot") !== void 0), v = t === null || t.url.length === 0 ? void 0 : t.url, d = t == null ? void 0 : t.declarations.get(u ?? "");
|
|
475
|
+
if (d === void 0)
|
|
476
|
+
return V(e, c, null, v, n), j(
|
|
477
|
+
n.warnings,
|
|
478
|
+
"template-not-declared",
|
|
479
|
+
`Instance${u === void 0 ? "" : ` template "${u}"`} has no matching Template declaration`,
|
|
480
|
+
e,
|
|
481
|
+
v
|
|
482
|
+
), r;
|
|
483
|
+
const o = t === null || t.url.length === 0 ? null : t.url, a = {
|
|
484
|
+
key: JSON.stringify([d.name, d.src, o]),
|
|
485
|
+
label: `${d.name}@${d.src}`
|
|
486
|
+
}, f = n.stack.findIndex((b) => b.key === a.key);
|
|
487
|
+
if (f >= 0) {
|
|
488
|
+
const b = n.cache.get(ze(d.src, o)) ?? null;
|
|
489
|
+
V(e, c, b, v, n);
|
|
490
|
+
const m = [...n.stack.slice(f), a].map((y) => y.label).join(" -> ");
|
|
491
|
+
return j(
|
|
492
|
+
n.warnings,
|
|
493
|
+
"template-cycle",
|
|
494
|
+
`Template cycle detected: ${m}`,
|
|
495
|
+
e,
|
|
496
|
+
v
|
|
497
|
+
), r;
|
|
498
|
+
}
|
|
499
|
+
if (i >= ke)
|
|
500
|
+
return V(e, c, null, v, n), j(
|
|
501
|
+
n.warnings,
|
|
502
|
+
"template-depth-exceeded",
|
|
503
|
+
`Template expansion exceeded the depth limit ${ke}: ${[
|
|
504
|
+
...n.stack,
|
|
505
|
+
a
|
|
506
|
+
].map((b) => b.label).join(" -> ")}`,
|
|
507
|
+
e,
|
|
508
|
+
v
|
|
509
|
+
), r;
|
|
510
|
+
const l = gt(d, o, n);
|
|
511
|
+
if (l === null)
|
|
512
|
+
return V(e, c, null, v, n), r;
|
|
513
|
+
je(l.document, n), n.stack.push(a);
|
|
514
|
+
const h = vt(l, r, n, i);
|
|
515
|
+
n.stack.pop();
|
|
516
|
+
const g = dt(l, n);
|
|
517
|
+
wt(l, g, n), ft(l, g, h, r, n);
|
|
518
|
+
const p = e.children.filter((b) => b.name.local === "AttributeOverrides");
|
|
519
|
+
V(e, c, l, v, n), ht(
|
|
520
|
+
r,
|
|
521
|
+
p,
|
|
522
|
+
t === null ? 0 : n.sourceOffsets.get(t.document) ?? 0,
|
|
523
|
+
t === null || t.url.length === 0 ? null : t.url,
|
|
524
|
+
n
|
|
525
|
+
);
|
|
526
|
+
for (const b of e.children)
|
|
527
|
+
b.name.local === "AttributeOverrides" || b.name.local === "Style" || U(b, "slot") !== void 0 || r.children.push(te(b, n, s, t, !1, i));
|
|
528
|
+
return r;
|
|
529
|
+
}
|
|
530
|
+
function bt(e) {
|
|
531
|
+
if (!Be(e.root)) return { document: e, warnings: [] };
|
|
532
|
+
const n = mt(e, Ue.get(e)), t = n.styleRoots.length, s = {
|
|
533
|
+
url: "",
|
|
534
|
+
from: null,
|
|
535
|
+
document: e,
|
|
536
|
+
declarations: We(e)
|
|
537
|
+
}, i = { nodes: /* @__PURE__ */ new Map([[e.root.id, e.root.id]]) }, r = {
|
|
538
|
+
id: e.root.id,
|
|
539
|
+
name: _e(e.root.name),
|
|
540
|
+
attributes: e.root.attributes.map((c) => ee(c)),
|
|
541
|
+
children: [],
|
|
542
|
+
spans: {
|
|
543
|
+
openTag: { ...e.root.spans.openTag },
|
|
544
|
+
inner: { ...e.root.spans.inner },
|
|
545
|
+
closeTag: e.root.spans.closeTag === null ? null : { ...e.root.spans.closeTag }
|
|
546
|
+
},
|
|
547
|
+
tagDirty: e.root.tagDirty,
|
|
548
|
+
childrenDirty: e.root.childrenDirty
|
|
549
|
+
};
|
|
550
|
+
for (const c of e.root.children)
|
|
551
|
+
if (!(c.name.local === "Template" || c.name.local === "Style")) {
|
|
552
|
+
if (c.name.local === "Instance") {
|
|
553
|
+
r.children.push(he(c, n, s, i, 0));
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
c.name.local !== "AttributeOverrides" && U(c, "slot") === void 0 && r.children.push(te(c, n, i, s, !0, 0));
|
|
557
|
+
}
|
|
558
|
+
for (let c = 0; c < t; c++) {
|
|
559
|
+
const v = n.styleRoots[c], d = i.nodes.get(v.scope);
|
|
560
|
+
d !== void 0 && (n.styleRoots[c] = { ...v, scope: d });
|
|
561
|
+
}
|
|
562
|
+
const u = /* @__PURE__ */ new Map();
|
|
563
|
+
pe(r, u);
|
|
564
|
+
for (const [c, v] of u)
|
|
565
|
+
v > 1 && j(
|
|
566
|
+
n.warnings,
|
|
567
|
+
"duplicate-name-in-tree",
|
|
568
|
+
`name "${c}" occurs ${v} times after template expansion`
|
|
569
|
+
);
|
|
570
|
+
return {
|
|
571
|
+
document: {
|
|
572
|
+
...e,
|
|
573
|
+
root: r,
|
|
574
|
+
source: n.sources.join(""),
|
|
575
|
+
sheets: n.sheets,
|
|
576
|
+
styleRoots: n.styleRoots
|
|
577
|
+
},
|
|
578
|
+
warnings: n.warnings
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
const He = {
|
|
3
582
|
// VisualElement is the base class and carries no class of its own.
|
|
4
583
|
VisualElement: { hasText: !1, classes: [], parts: [] },
|
|
5
584
|
Label: { hasText: !0, classes: ["unity-label"], parts: [] },
|
|
@@ -37,24 +616,26 @@ const xe = {
|
|
|
37
616
|
{ name: "unity-content-container", style: { "flex-shrink": "0" } }
|
|
38
617
|
]
|
|
39
618
|
}
|
|
40
|
-
},
|
|
41
|
-
function
|
|
42
|
-
return
|
|
619
|
+
}, re = { hasText: !1, classes: [], parts: [] }, yt = "UXML", xt = /* @__PURE__ */ new Set(["Style"]);
|
|
620
|
+
function kt(e) {
|
|
621
|
+
return xt.has(e.name.local);
|
|
43
622
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
623
|
+
function H(e) {
|
|
624
|
+
var t;
|
|
625
|
+
if (((t = e.derived) == null ? void 0 : t.kind) === "template-container") return { spec: re, fallback: !1 };
|
|
626
|
+
const n = He[e.name.local];
|
|
627
|
+
return n !== void 0 ? { spec: n, fallback: !1 } : St(e) ? { spec: re, fallback: !1 } : { spec: re, fallback: !0 };
|
|
47
628
|
}
|
|
48
|
-
function
|
|
49
|
-
return e.name.local ===
|
|
629
|
+
function St(e) {
|
|
630
|
+
return e.name.local === yt;
|
|
50
631
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
632
|
+
function $t(e) {
|
|
633
|
+
return H(e).spec.classes;
|
|
53
634
|
}
|
|
54
|
-
function
|
|
55
|
-
return Object.keys(
|
|
635
|
+
function Tt() {
|
|
636
|
+
return Object.keys(He);
|
|
56
637
|
}
|
|
57
|
-
const
|
|
638
|
+
const Z = "6000.0.40f1", Ve = `:disabled {
|
|
58
639
|
opacity: 0.5;
|
|
59
640
|
}
|
|
60
641
|
|
|
@@ -62,11 +643,11 @@ const Y = "6000.0.40f1", ve = `:disabled {
|
|
|
62
643
|
margin: 1px 3px;
|
|
63
644
|
-unity-text-align: middle-center;
|
|
64
645
|
}
|
|
65
|
-
`,
|
|
66
|
-
function
|
|
67
|
-
return e ?
|
|
646
|
+
`, Ot = 13;
|
|
647
|
+
function Et(e) {
|
|
648
|
+
return e ? Ot : 0;
|
|
68
649
|
}
|
|
69
|
-
const
|
|
650
|
+
const Nt = /* @__PURE__ */ new Set([
|
|
70
651
|
"color",
|
|
71
652
|
"font-size",
|
|
72
653
|
"letter-spacing",
|
|
@@ -81,23 +662,23 @@ const Ve = /* @__PURE__ */ new Set([
|
|
|
81
662
|
"-unity-text-outline-color",
|
|
82
663
|
"-unity-text-outline-width"
|
|
83
664
|
]);
|
|
84
|
-
function
|
|
85
|
-
return e.startsWith("--") ||
|
|
665
|
+
function Dt(e) {
|
|
666
|
+
return e.startsWith("--") || Nt.has(e);
|
|
86
667
|
}
|
|
87
|
-
function
|
|
668
|
+
function $e(e) {
|
|
88
669
|
const n = [];
|
|
89
|
-
let t = 0,
|
|
90
|
-
for (let
|
|
91
|
-
const
|
|
92
|
-
|
|
670
|
+
let t = 0, s = -1;
|
|
671
|
+
for (let i = 0; i < e.length; i++) {
|
|
672
|
+
const r = e[i];
|
|
673
|
+
r === "(" ? t++ : r === ")" && (t = Math.max(0, t - 1)), t === 0 && /\s/.test(r) ? s >= 0 && (n.push(e.slice(s, i)), s = -1) : s < 0 && (s = i);
|
|
93
674
|
}
|
|
94
|
-
return
|
|
675
|
+
return s >= 0 && n.push(e.slice(s)), n;
|
|
95
676
|
}
|
|
96
|
-
function
|
|
97
|
-
const [n, t,
|
|
98
|
-
return n === void 0 ? null : t === void 0 ? [n, n, n, n] :
|
|
677
|
+
function At(e) {
|
|
678
|
+
const [n, t, s, i] = e;
|
|
679
|
+
return n === void 0 ? null : t === void 0 ? [n, n, n, n] : s === void 0 ? [n, t, n, t] : i === void 0 ? [n, t, s, t] : [n, t, s, i];
|
|
99
680
|
}
|
|
100
|
-
const
|
|
681
|
+
const It = {
|
|
101
682
|
margin: ["margin-top", "margin-right", "margin-bottom", "margin-left"],
|
|
102
683
|
padding: ["padding-top", "padding-right", "padding-bottom", "padding-left"],
|
|
103
684
|
"border-width": [
|
|
@@ -120,21 +701,21 @@ const Ge = {
|
|
|
120
701
|
"border-bottom-left-radius"
|
|
121
702
|
]
|
|
122
703
|
};
|
|
123
|
-
function
|
|
704
|
+
function Te(e) {
|
|
124
705
|
return /^-?(\d+\.?\d*|\.\d+)$/.test(e);
|
|
125
706
|
}
|
|
126
|
-
function
|
|
127
|
-
const [n, t,
|
|
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 ?
|
|
707
|
+
function Rt(e) {
|
|
708
|
+
const [n, t, s] = e;
|
|
709
|
+
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 ? Te(n) ? [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", "0"]] : [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", n]] : s === void 0 ? Te(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", s]];
|
|
129
710
|
}
|
|
130
|
-
function
|
|
131
|
-
if (e === "flex") return
|
|
132
|
-
const t =
|
|
711
|
+
function ie(e, n) {
|
|
712
|
+
if (e === "flex") return Rt($e(n));
|
|
713
|
+
const t = It[e];
|
|
133
714
|
if (t === void 0) return [[e, n]];
|
|
134
|
-
const
|
|
135
|
-
return
|
|
715
|
+
const s = At($e(n));
|
|
716
|
+
return s === null ? [[e, n]] : t.map((i, r) => [i, s[r]]);
|
|
136
717
|
}
|
|
137
|
-
const
|
|
718
|
+
const ae = {
|
|
138
719
|
"align-content": "flex-start",
|
|
139
720
|
"align-items": "stretch",
|
|
140
721
|
"align-self": "auto",
|
|
@@ -170,8 +751,8 @@ const ee = {
|
|
|
170
751
|
"padding-right": "0",
|
|
171
752
|
"padding-top": "0",
|
|
172
753
|
"font-size": "12px"
|
|
173
|
-
},
|
|
174
|
-
function
|
|
754
|
+
}, Ct = ["em", "rem", "vh", "vw", "vmin", "vmax", "pt", "cm", "in"];
|
|
755
|
+
function Q(e) {
|
|
175
756
|
const n = e.trim();
|
|
176
757
|
if (n === "") return { length: null, problem: "empty value" };
|
|
177
758
|
if (n === "auto") return { length: { kind: "auto" } };
|
|
@@ -181,245 +762,241 @@ function X(e) {
|
|
|
181
762
|
return { length: null, problem: "calc() is not supported in USS" };
|
|
182
763
|
const t = /^(-?(?:\d+\.?\d*|\.\d+))([a-z%]*)$/i.exec(n);
|
|
183
764
|
if (t === null) return { length: null, problem: `cannot read "${n}" as a length` };
|
|
184
|
-
const
|
|
185
|
-
return
|
|
765
|
+
const s = Number(t[1]), i = t[2].toLowerCase();
|
|
766
|
+
return i === "" || i === "px" ? { length: { kind: "px", value: s } } : i === "%" ? { length: { kind: "percent", value: s } } : Ct.includes(i) ? { length: null, problem: `"${i}" is not a USS unit` } : { length: null, problem: `unknown unit "${i}"` };
|
|
186
767
|
}
|
|
187
|
-
function
|
|
768
|
+
function Oe(e) {
|
|
188
769
|
const n = e.trim();
|
|
189
770
|
return /^-?(\d+\.?\d*|\.\d+)$/.test(n) ? Number(n) : null;
|
|
190
771
|
}
|
|
191
|
-
let
|
|
192
|
-
async function
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
197
|
-
}
|
|
198
|
-
let
|
|
199
|
-
function
|
|
200
|
-
return
|
|
201
|
-
}
|
|
202
|
-
const
|
|
203
|
-
auto:
|
|
204
|
-
"flex-start": L.FlexStart,
|
|
205
|
-
center: L.Center,
|
|
206
|
-
"flex-end": L.FlexEnd,
|
|
207
|
-
stretch: L.Stretch,
|
|
208
|
-
baseline: L.Baseline,
|
|
209
|
-
"space-between": L.SpaceBetween,
|
|
210
|
-
"space-around": L.SpaceAround,
|
|
211
|
-
"space-evenly": L.SpaceEvenly
|
|
212
|
-
}, Ze = {
|
|
772
|
+
let me = null;
|
|
773
|
+
async function yn() {
|
|
774
|
+
me ?? (me = await tt());
|
|
775
|
+
}
|
|
776
|
+
function xn() {
|
|
777
|
+
return me !== null;
|
|
778
|
+
}
|
|
779
|
+
let K = 0;
|
|
780
|
+
function kn() {
|
|
781
|
+
return K;
|
|
782
|
+
}
|
|
783
|
+
const oe = {
|
|
784
|
+
auto: W.Auto,
|
|
213
785
|
"flex-start": W.FlexStart,
|
|
214
786
|
center: W.Center,
|
|
215
787
|
"flex-end": W.FlexEnd,
|
|
788
|
+
stretch: W.Stretch,
|
|
789
|
+
baseline: W.Baseline,
|
|
216
790
|
"space-between": W.SpaceBetween,
|
|
217
791
|
"space-around": W.SpaceAround,
|
|
218
792
|
"space-evenly": W.SpaceEvenly
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
"
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
793
|
+
}, Mt = {
|
|
794
|
+
"flex-start": P.FlexStart,
|
|
795
|
+
center: P.Center,
|
|
796
|
+
"flex-end": P.FlexEnd,
|
|
797
|
+
"space-between": P.SpaceBetween,
|
|
798
|
+
"space-around": P.SpaceAround,
|
|
799
|
+
"space-evenly": P.SpaceEvenly
|
|
800
|
+
}, Ut = {
|
|
801
|
+
column: G.Column,
|
|
802
|
+
"column-reverse": G.ColumnReverse,
|
|
803
|
+
row: G.Row,
|
|
804
|
+
"row-reverse": G.RowReverse
|
|
805
|
+
}, Lt = {
|
|
806
|
+
nowrap: Y.NoWrap,
|
|
807
|
+
wrap: Y.Wrap,
|
|
808
|
+
"wrap-reverse": Y.WrapReverse
|
|
809
|
+
}, Wt = [
|
|
810
|
+
["left", q.Left],
|
|
811
|
+
["top", q.Top],
|
|
812
|
+
["right", q.Right],
|
|
813
|
+
["bottom", q.Bottom]
|
|
233
814
|
];
|
|
234
|
-
function
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
815
|
+
function zt(e, n, t, s) {
|
|
816
|
+
const i = me;
|
|
817
|
+
if (i === null)
|
|
237
818
|
throw new Error("loadLayoutEngine() must be awaited before rendering");
|
|
238
|
-
const
|
|
239
|
-
let a = 0,
|
|
240
|
-
const
|
|
819
|
+
const r = [], u = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), v = [], d = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
820
|
+
let a = 0, f = !1, l = !1;
|
|
821
|
+
const h = (w, S) => {
|
|
241
822
|
var T;
|
|
242
|
-
return ((T =
|
|
823
|
+
return ((T = w.get(S)) == null ? void 0 : T.value) ?? ae[S] ?? "";
|
|
243
824
|
};
|
|
244
|
-
function w
|
|
245
|
-
|
|
825
|
+
function g(w, S) {
|
|
826
|
+
r.push({ kind: "unsupported-property", message: w, node: S.id });
|
|
246
827
|
}
|
|
247
|
-
function
|
|
248
|
-
const N =
|
|
828
|
+
function p(w, S, T) {
|
|
829
|
+
const N = h(w, S);
|
|
249
830
|
if (N === "") return null;
|
|
250
|
-
const { length:
|
|
251
|
-
return A !== void 0 &&
|
|
831
|
+
const { length: D, problem: A } = Q(N);
|
|
832
|
+
return A !== void 0 && g(`${S}: ${A}`, T), D;
|
|
252
833
|
}
|
|
253
|
-
function
|
|
254
|
-
if (
|
|
255
|
-
switch (
|
|
834
|
+
function b(w) {
|
|
835
|
+
if (w !== null)
|
|
836
|
+
switch (w.kind) {
|
|
256
837
|
case "px":
|
|
257
|
-
return
|
|
838
|
+
return w.value;
|
|
258
839
|
case "percent":
|
|
259
|
-
return `${
|
|
840
|
+
return `${w.value}%`;
|
|
260
841
|
case "auto":
|
|
261
842
|
return "auto";
|
|
262
843
|
case "none":
|
|
263
844
|
return;
|
|
264
845
|
}
|
|
265
846
|
}
|
|
266
|
-
function
|
|
267
|
-
if (
|
|
268
|
-
if (
|
|
269
|
-
if (
|
|
847
|
+
function m(w) {
|
|
848
|
+
if (w !== null) {
|
|
849
|
+
if (w.kind === "px") return w.value;
|
|
850
|
+
if (w.kind === "percent") return `${w.value}%`;
|
|
270
851
|
}
|
|
271
852
|
}
|
|
272
|
-
function
|
|
273
|
-
|
|
274
|
-
const N =
|
|
275
|
-
(N === "fixed" || N === "sticky") &&
|
|
276
|
-
N === "absolute" ?
|
|
277
|
-
),
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
for (const [A, I] of
|
|
281
|
-
|
|
282
|
-
const _ =
|
|
283
|
-
|
|
853
|
+
function y(w, S, T) {
|
|
854
|
+
w.setBoxSizing(nt.BorderBox), w.setFlexDirection(Ut[h(S, "flex-direction")] ?? G.Column), w.setFlexWrap(Lt[h(S, "flex-wrap")] ?? Y.NoWrap), w.setJustifyContent(Mt[h(S, "justify-content")] ?? P.FlexStart), w.setAlignItems(oe[h(S, "align-items")] ?? W.Stretch), w.setAlignSelf(oe[h(S, "align-self")] ?? W.Auto), w.setAlignContent(oe[h(S, "align-content")] ?? W.FlexStart), w.setFlexGrow(Oe(h(S, "flex-grow")) ?? 0), w.setFlexShrink(Oe(h(S, "flex-shrink")) ?? 1), w.setFlexBasis(b(p(S, "flex-basis", T)));
|
|
855
|
+
const N = h(S, "position");
|
|
856
|
+
(N === "fixed" || N === "sticky") && g(`position: ${N} is not supported in USS; treated as relative`, T), w.setPositionType(
|
|
857
|
+
N === "absolute" ? ne.Absolute : ne.Relative
|
|
858
|
+
), h(S, "display") === "none" && w.setDisplay(st.None);
|
|
859
|
+
const D = h(S, "overflow");
|
|
860
|
+
D === "hidden" ? w.setOverflow(rt.Hidden) : (D === "auto" || D === "scroll") && g(`overflow: ${D} needs a ScrollView element in USS`, T), w.setWidth(b(p(S, "width", T))), w.setHeight(b(p(S, "height", T))), w.setMinWidth(m(p(S, "min-width", T))), w.setMinHeight(m(p(S, "min-height", T))), w.setMaxWidth(m(p(S, "max-width", T))), w.setMaxHeight(m(p(S, "max-height", T)));
|
|
861
|
+
for (const [A, I] of Wt) {
|
|
862
|
+
w.setMargin(I, m(p(S, `margin-${A}`, T))), w.setPadding(I, m(p(S, `padding-${A}`, T)));
|
|
863
|
+
const _ = m(p(S, `border-${A}-width`, T));
|
|
864
|
+
w.setBorder(I, typeof _ == "number" ? _ : void 0), w.setPosition(I, m(p(S, A, T)));
|
|
284
865
|
}
|
|
285
866
|
}
|
|
286
|
-
function
|
|
287
|
-
var
|
|
288
|
-
return (
|
|
867
|
+
function k(w) {
|
|
868
|
+
var S;
|
|
869
|
+
return (S = w.attributes.find((T) => T.name === "text")) == null ? void 0 : S.value;
|
|
289
870
|
}
|
|
290
|
-
const
|
|
291
|
-
function $(
|
|
292
|
-
return
|
|
293
|
-
(
|
|
871
|
+
const x = ["text", "label"];
|
|
872
|
+
function $(w) {
|
|
873
|
+
return x.filter(
|
|
874
|
+
(S) => w.attributes.some((T) => T.name === S && T.value.length > 0)
|
|
294
875
|
);
|
|
295
876
|
}
|
|
296
|
-
function O(
|
|
297
|
-
if (
|
|
298
|
-
const T = n.get(
|
|
299
|
-
a++,
|
|
300
|
-
const { spec:
|
|
877
|
+
function O(w, S) {
|
|
878
|
+
if (kt(w)) return;
|
|
879
|
+
const T = n.get(w.id) ?? /* @__PURE__ */ new Map(), N = i.Node.create();
|
|
880
|
+
a++, K++, d.set(w, N), v.push(w), y(N, T, w), S !== null && S.insertChild(N, S.getChildCount());
|
|
881
|
+
const { spec: D, fallback: A } = H(w), I = k(w), _ = D.hasText && I !== void 0 && I.length > 0;
|
|
301
882
|
if (A) {
|
|
302
|
-
const
|
|
303
|
-
|
|
883
|
+
const R = $(w);
|
|
884
|
+
r.push({
|
|
304
885
|
kind: "unsupported-control",
|
|
305
|
-
message: `<${
|
|
306
|
-
node:
|
|
886
|
+
message: `<${w.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`),
|
|
887
|
+
node: w.id
|
|
307
888
|
});
|
|
308
889
|
}
|
|
309
890
|
if (_) {
|
|
310
|
-
|
|
311
|
-
`<${
|
|
312
|
-
|
|
891
|
+
w.children.length > 0 && g(
|
|
892
|
+
`<${w.name.local}> has both a text attribute and children; children are not drawn`,
|
|
893
|
+
w
|
|
313
894
|
);
|
|
314
|
-
const
|
|
315
|
-
fontSize:
|
|
316
|
-
fontStyle:
|
|
317
|
-
whiteSpace:
|
|
895
|
+
const R = p(T, "font-size", w), z = {
|
|
896
|
+
fontSize: R !== null && R.kind === "px" ? R.value : 12,
|
|
897
|
+
fontStyle: h(T, "-unity-font-style") || "normal",
|
|
898
|
+
whiteSpace: h(T, "white-space") || "normal"
|
|
318
899
|
};
|
|
319
900
|
N.setMeasureFunc(
|
|
320
|
-
(
|
|
901
|
+
(M) => s.measureText(
|
|
321
902
|
I,
|
|
322
903
|
z,
|
|
323
|
-
Number.isFinite(
|
|
904
|
+
Number.isFinite(M) ? M : 0
|
|
324
905
|
)
|
|
325
906
|
);
|
|
326
907
|
return;
|
|
327
908
|
}
|
|
328
|
-
let
|
|
329
|
-
if (
|
|
330
|
-
|
|
909
|
+
let F = N;
|
|
910
|
+
if (D.parts.length > 0) {
|
|
911
|
+
l || (l = !0, r.push({
|
|
331
912
|
kind: "version-dependent",
|
|
332
|
-
message: `<${
|
|
333
|
-
node:
|
|
913
|
+
message: `<${w.name.local}> is drawn with the implicit child elements Unity builds for it, and their geometry was measured on Unity ${Z}. Other versions may differ; see src/controls/theme.ts.`,
|
|
914
|
+
node: w.id
|
|
334
915
|
}));
|
|
335
|
-
const
|
|
336
|
-
for (const
|
|
337
|
-
const
|
|
338
|
-
a++,
|
|
339
|
-
name:
|
|
340
|
-
owner:
|
|
916
|
+
const R = [], z = [], M = t.get(w.id);
|
|
917
|
+
for (const we of D.parts) {
|
|
918
|
+
const ve = (M == null ? void 0 : M.get(we.name)) ?? /* @__PURE__ */ new Map(), X = i.Node.create();
|
|
919
|
+
a++, K++, y(X, ve, w), F.insertChild(X, F.getChildCount()), F = X, z.push(X), R.push({
|
|
920
|
+
name: we.name,
|
|
921
|
+
owner: w.id,
|
|
341
922
|
box: { left: 0, top: 0, width: 0, height: 0 },
|
|
342
|
-
style:
|
|
923
|
+
style: ve
|
|
343
924
|
});
|
|
344
925
|
}
|
|
345
|
-
|
|
926
|
+
c.set(w.id, R), o.set(w.id, z);
|
|
346
927
|
}
|
|
347
|
-
for (const
|
|
928
|
+
for (const R of w.children) O(R, F);
|
|
348
929
|
}
|
|
349
930
|
O(e, null);
|
|
350
|
-
const E =
|
|
351
|
-
E.setWidth(
|
|
352
|
-
const
|
|
353
|
-
for (let
|
|
354
|
-
let
|
|
355
|
-
for (const [T, N] of
|
|
356
|
-
const
|
|
357
|
-
if (
|
|
358
|
-
const A = N.findIndex((
|
|
931
|
+
const E = d.get(e);
|
|
932
|
+
E.setWidth(s.size.width), E.setHeight(s.size.height), E.setPositionType(ne.Relative), E.calculateLayout(s.size.width, s.size.height, be.LTR);
|
|
933
|
+
const C = /* @__PURE__ */ new Map();
|
|
934
|
+
for (let w = 0; w < 3; w++) {
|
|
935
|
+
let S = !1;
|
|
936
|
+
for (const [T, N] of c) {
|
|
937
|
+
const D = o.get(T);
|
|
938
|
+
if (D === void 0) continue;
|
|
939
|
+
const A = N.findIndex((M) => M.name === "unity-content-viewport"), I = N.findIndex((M) => M.name === "unity-content-container");
|
|
359
940
|
if (A === -1 || I === -1) continue;
|
|
360
|
-
const _ =
|
|
361
|
-
(
|
|
941
|
+
const _ = D[A].getComputedLayout(), R = D[I].getComputedLayout().height > _.height + 0.01, z = Et(R);
|
|
942
|
+
(C.get(T) ?? 0) !== z && (C.set(T, z), D[A].setMargin(q.Right, z), S = !0);
|
|
362
943
|
}
|
|
363
|
-
if (!
|
|
364
|
-
E.calculateLayout(
|
|
944
|
+
if (!S) break;
|
|
945
|
+
E.calculateLayout(s.size.width, s.size.height, be.LTR);
|
|
365
946
|
}
|
|
366
|
-
function
|
|
367
|
-
const N =
|
|
947
|
+
function L(w, S, T) {
|
|
948
|
+
const N = d.get(w);
|
|
368
949
|
if (N === void 0) return;
|
|
369
|
-
const
|
|
370
|
-
let A =
|
|
371
|
-
|
|
372
|
-
const _ =
|
|
373
|
-
_ !== void 0 &&
|
|
374
|
-
const
|
|
375
|
-
A +=
|
|
950
|
+
const D = N.getComputedLayout();
|
|
951
|
+
let A = S + D.left, I = T + D.top;
|
|
952
|
+
u.set(w.id, { left: A, top: I, width: D.width, height: D.height });
|
|
953
|
+
const _ = c.get(w.id), F = o.get(w.id);
|
|
954
|
+
_ !== void 0 && F !== void 0 && _.forEach((R, z) => {
|
|
955
|
+
const M = F[z].getComputedLayout();
|
|
956
|
+
A += M.left, I += M.top, R.box = { left: A, top: I, width: M.width, height: M.height };
|
|
376
957
|
});
|
|
377
|
-
for (const
|
|
958
|
+
for (const R of w.children) L(R, A, I);
|
|
378
959
|
}
|
|
379
|
-
return
|
|
380
|
-
boxes:
|
|
381
|
-
parts:
|
|
960
|
+
return L(e, 0, 0), {
|
|
961
|
+
boxes: u,
|
|
962
|
+
parts: c,
|
|
382
963
|
painted: v,
|
|
383
|
-
warnings:
|
|
964
|
+
warnings: r,
|
|
384
965
|
dispose() {
|
|
385
|
-
|
|
966
|
+
f || (f = !0, E.freeRecursive(), K -= a, d.clear(), o.clear());
|
|
386
967
|
}
|
|
387
968
|
};
|
|
388
969
|
}
|
|
389
|
-
const
|
|
390
|
-
function
|
|
970
|
+
const _t = 1.2;
|
|
971
|
+
function jt(e) {
|
|
391
972
|
var t;
|
|
392
973
|
let n = null;
|
|
393
974
|
if (e !== void 0) {
|
|
394
|
-
const
|
|
395
|
-
n = ((t =
|
|
975
|
+
const s = e.createElement("canvas");
|
|
976
|
+
n = ((t = s.getContext) == null ? void 0 : t.call(s, "2d")) ?? null;
|
|
396
977
|
}
|
|
397
|
-
return (
|
|
398
|
-
const
|
|
978
|
+
return (s, i, r) => {
|
|
979
|
+
const u = i.fontSize * _t, c = (l) => {
|
|
399
980
|
if (n === null)
|
|
400
|
-
return
|
|
401
|
-
const
|
|
402
|
-
return n.font = `${
|
|
981
|
+
return l.length * i.fontSize * 0.5;
|
|
982
|
+
const h = i.fontStyle.includes("bold") ? "bold" : "normal", g = i.fontStyle.includes("italic") ? "italic" : "normal";
|
|
983
|
+
return n.font = `${g} ${h} ${i.fontSize}px sans-serif`, n.measureText(l).width;
|
|
403
984
|
};
|
|
404
|
-
if (!(
|
|
405
|
-
const
|
|
985
|
+
if (!(i.whiteSpace !== "nowrap" && i.whiteSpace !== "pre") || r <= 0) {
|
|
986
|
+
const l = s.split(`
|
|
406
987
|
`);
|
|
407
|
-
return { width:
|
|
988
|
+
return { width: l.reduce((g, p) => Math.max(g, c(p)), 0), height: l.length * u };
|
|
408
989
|
}
|
|
409
|
-
const
|
|
410
|
-
let
|
|
411
|
-
for (const
|
|
412
|
-
const
|
|
413
|
-
a > 0 && a +
|
|
990
|
+
const d = s.split(/\s+/).filter((l) => l.length > 0);
|
|
991
|
+
let o = 1, a = 0, f = 0;
|
|
992
|
+
for (const l of d) {
|
|
993
|
+
const h = c(l), g = a === 0 ? 0 : c(" ");
|
|
994
|
+
a > 0 && a + g + h > r ? (f = Math.max(f, a), o++, a = h) : a += g + h;
|
|
414
995
|
}
|
|
415
|
-
return
|
|
996
|
+
return f = Math.max(f, a), { width: f, height: o * u };
|
|
416
997
|
};
|
|
417
998
|
}
|
|
418
|
-
|
|
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
|
-
}
|
|
422
|
-
const it = /* @__PURE__ */ new Set([
|
|
999
|
+
const Ft = /* @__PURE__ */ new Set([
|
|
423
1000
|
"box-shadow",
|
|
424
1001
|
"filter",
|
|
425
1002
|
"backdrop-filter",
|
|
@@ -435,7 +1012,7 @@ const it = /* @__PURE__ */ new Set([
|
|
|
435
1012
|
"float",
|
|
436
1013
|
"clear",
|
|
437
1014
|
"border-style"
|
|
438
|
-
]),
|
|
1015
|
+
]), Pt = /* @__PURE__ */ new Set([
|
|
439
1016
|
"gap",
|
|
440
1017
|
"row-gap",
|
|
441
1018
|
"column-gap",
|
|
@@ -445,43 +1022,43 @@ const it = /* @__PURE__ */ new Set([
|
|
|
445
1022
|
"background-repeat",
|
|
446
1023
|
"overflow-wrap",
|
|
447
1024
|
"word-break"
|
|
448
|
-
]),
|
|
1025
|
+
]), Ee = ["top", "right", "bottom", "left"], Bt = {
|
|
449
1026
|
normal: { weight: "normal", style: "normal" },
|
|
450
1027
|
bold: { weight: "bold", style: "normal" },
|
|
451
1028
|
italic: { weight: "normal", style: "italic" },
|
|
452
1029
|
"bold-and-italic": { weight: "bold", style: "italic" }
|
|
453
|
-
},
|
|
1030
|
+
}, Ht = {
|
|
454
1031
|
upper: "flex-start",
|
|
455
1032
|
middle: "center",
|
|
456
1033
|
lower: "flex-end"
|
|
457
|
-
},
|
|
1034
|
+
}, Vt = {
|
|
458
1035
|
left: "flex-start",
|
|
459
1036
|
center: "center",
|
|
460
1037
|
right: "flex-end"
|
|
461
|
-
},
|
|
1038
|
+
}, le = {
|
|
462
1039
|
"stretch-to-fill": "100% 100%",
|
|
463
1040
|
"scale-and-crop": "cover",
|
|
464
1041
|
"scale-to-fit": "contain"
|
|
465
|
-
},
|
|
466
|
-
function
|
|
467
|
-
const n = /^(url|resource)\(\s*(["']?)(.*?)\2\s*\)$/.exec(e.trim());
|
|
1042
|
+
}, Ne = "stretch-to-fill";
|
|
1043
|
+
function qt(e) {
|
|
1044
|
+
const n = /^(url|resource)\(\s*(["']?)(.*?)\2\s*\)$/.exec(J(e).trim());
|
|
468
1045
|
return n === null ? null : { form: n[1], path: n[3] };
|
|
469
1046
|
}
|
|
470
|
-
function
|
|
471
|
-
var
|
|
472
|
-
const
|
|
473
|
-
var
|
|
474
|
-
return (
|
|
475
|
-
},
|
|
476
|
-
|
|
1047
|
+
function De(e, n, t = {}) {
|
|
1048
|
+
var g;
|
|
1049
|
+
const s = {}, i = [], r = (p) => {
|
|
1050
|
+
var b;
|
|
1051
|
+
return (b = e.get(p)) == null ? void 0 : b.value;
|
|
1052
|
+
}, u = (p, b) => {
|
|
1053
|
+
i.push({ kind: p, message: b, node: n });
|
|
477
1054
|
};
|
|
478
|
-
|
|
479
|
-
for (const [
|
|
480
|
-
|
|
1055
|
+
s["box-sizing"] = "border-box";
|
|
1056
|
+
for (const [p] of e)
|
|
1057
|
+
Ft.has(p) ? u("unsupported-property", `${p} does not exist in USS and is ignored`) : Pt.has(p) && u(
|
|
481
1058
|
"version-dependent",
|
|
482
|
-
`${
|
|
1059
|
+
`${p} depends on the Unity version; verify it in your project`
|
|
483
1060
|
);
|
|
484
|
-
const
|
|
1061
|
+
const c = [
|
|
485
1062
|
"background-color",
|
|
486
1063
|
"color",
|
|
487
1064
|
"opacity",
|
|
@@ -494,388 +1071,388 @@ function me(e, n, t = {}) {
|
|
|
494
1071
|
"font-size",
|
|
495
1072
|
"transform-origin"
|
|
496
1073
|
];
|
|
497
|
-
for (const
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
for (const
|
|
503
|
-
const
|
|
504
|
-
if (
|
|
505
|
-
const { length:
|
|
506
|
-
|
|
1074
|
+
for (const p of c) {
|
|
1075
|
+
const b = r(p);
|
|
1076
|
+
b !== void 0 && (s[p] = b);
|
|
1077
|
+
}
|
|
1078
|
+
r("display") === "none" && (s.display = "none"), r("overflow") === "hidden" && (s.overflow = "hidden");
|
|
1079
|
+
for (const p of Ee) {
|
|
1080
|
+
const b = r(`border-${p}-width`);
|
|
1081
|
+
if (b !== void 0 && b !== "0") {
|
|
1082
|
+
const { length: k, problem: x } = Q(b);
|
|
1083
|
+
k === null || k.kind !== "px" ? u(
|
|
507
1084
|
"unsupported-property",
|
|
508
|
-
`border-${
|
|
509
|
-
) : (
|
|
1085
|
+
`border-${p}-width: ${x ?? `"${b}" is not a pixel length`}; ignored`
|
|
1086
|
+
) : (s[`border-${p}-width`] = `${k.value}px`, s[`border-${p}-style`] = "solid");
|
|
510
1087
|
}
|
|
511
|
-
const
|
|
512
|
-
|
|
513
|
-
const
|
|
514
|
-
|
|
1088
|
+
const m = r(`border-${p}-color`);
|
|
1089
|
+
m !== void 0 && (s[`border-${p}-color`] = m);
|
|
1090
|
+
const y = r(`padding-${p}`);
|
|
1091
|
+
y !== void 0 && y !== "0" && (s[`padding-${p}`] = y);
|
|
515
1092
|
}
|
|
516
|
-
for (const
|
|
1093
|
+
for (const p of [
|
|
517
1094
|
"top-left",
|
|
518
1095
|
"top-right",
|
|
519
1096
|
"bottom-right",
|
|
520
1097
|
"bottom-left"
|
|
521
1098
|
]) {
|
|
522
|
-
const
|
|
523
|
-
|
|
1099
|
+
const b = r(`border-${p}-radius`);
|
|
1100
|
+
b !== void 0 && (s[`border-${p}-radius`] = b);
|
|
524
1101
|
}
|
|
525
|
-
const v =
|
|
1102
|
+
const v = r("-unity-font-style");
|
|
526
1103
|
if (v !== void 0) {
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
}
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
532
|
-
const [
|
|
533
|
-
|
|
534
|
-
}
|
|
535
|
-
const
|
|
536
|
-
a !== void 0 &&
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
543
|
-
const
|
|
544
|
-
if (
|
|
545
|
-
|
|
1104
|
+
const p = Bt[v];
|
|
1105
|
+
p === void 0 ? u("unsupported-property", `-unity-font-style: ${v} is not a USS value`) : (s["font-weight"] = p.weight, s["font-style"] = p.style);
|
|
1106
|
+
}
|
|
1107
|
+
const d = r("-unity-text-align");
|
|
1108
|
+
if (d !== void 0) {
|
|
1109
|
+
const [p, b] = d.split("-"), m = Ht[p ?? ""], y = Vt[b ?? ""];
|
|
1110
|
+
m === void 0 || y === void 0 ? u("unsupported-property", `-unity-text-align: ${d} is not a USS value`) : (s["align-items"] = m, s["justify-content"] = y);
|
|
1111
|
+
}
|
|
1112
|
+
const o = [], a = r("translate");
|
|
1113
|
+
a !== void 0 && o.push(`translate(${a.replace(/\s+/, ", ")})`);
|
|
1114
|
+
const f = r("rotate");
|
|
1115
|
+
f !== void 0 && o.push(`rotate(${f})`);
|
|
1116
|
+
const l = r("scale");
|
|
1117
|
+
l !== void 0 && o.push(`scale(${l.replace(/\s+/, ", ")})`), o.length > 0 && (s.transform = o.join(" "));
|
|
1118
|
+
const h = r("background-image");
|
|
1119
|
+
if (h !== void 0 && h !== "none") {
|
|
1120
|
+
const p = qt(h);
|
|
1121
|
+
if (p === null)
|
|
1122
|
+
u("asset-unresolved", `background-image: cannot read "${h}" as an asset path`);
|
|
546
1123
|
else {
|
|
547
|
-
const { form:
|
|
548
|
-
if (
|
|
549
|
-
|
|
1124
|
+
const { form: b, path: m } = p, y = ((g = t.resolveAsset) == null ? void 0 : g.call(t, m, b)) ?? null;
|
|
1125
|
+
if (y === null)
|
|
1126
|
+
s["background-image"] = "repeating-linear-gradient(45deg, rgba(255,0,255,0.35) 0 6px, rgba(0,0,0,0) 6px 12px)", u("asset-unresolved", `background-image: "${m}" was not resolved`);
|
|
550
1127
|
else {
|
|
551
|
-
|
|
552
|
-
const
|
|
553
|
-
$ === void 0 &&
|
|
1128
|
+
s["background-image"] = `url("${y}")`, s["background-repeat"] = r("background-repeat") ?? "no-repeat", s["background-position"] = r("background-position") ?? "center";
|
|
1129
|
+
const k = r("background-size"), x = r("-unity-background-scale-mode") ?? Ne, $ = le[x];
|
|
1130
|
+
$ === void 0 && u(
|
|
554
1131
|
"unsupported-property",
|
|
555
|
-
`-unity-background-scale-mode: ${
|
|
556
|
-
),
|
|
1132
|
+
`-unity-background-scale-mode: ${x} is not a USS value; expected one of ${Object.keys(le).join(", ")}`
|
|
1133
|
+
), s["background-size"] = k ?? $ ?? le[Ne];
|
|
557
1134
|
}
|
|
558
1135
|
}
|
|
559
1136
|
}
|
|
560
|
-
return
|
|
1137
|
+
return r("-unity-background-image-tint-color") !== void 0 && u(
|
|
561
1138
|
"unsupported-property",
|
|
562
1139
|
"-unity-background-image-tint-color has no CSS equivalent and is not drawn"
|
|
563
|
-
),
|
|
1140
|
+
), Ee.some((p) => r(`-unity-slice-${p}`) !== void 0) && u("unsupported-property", "-unity-slice-* (9-slice) is not drawn in this preview"), r("-unity-font-definition") !== void 0 && u(
|
|
564
1141
|
"unsupported-property",
|
|
565
1142
|
"-unity-font-definition names a Unity font asset; the browser default is used"
|
|
566
|
-
), { declarations:
|
|
1143
|
+
), { declarations: s, warnings: i };
|
|
567
1144
|
}
|
|
568
|
-
const
|
|
569
|
-
function
|
|
570
|
-
const
|
|
571
|
-
function v(
|
|
572
|
-
const
|
|
573
|
-
var
|
|
574
|
-
const
|
|
575
|
-
return
|
|
1145
|
+
const Gt = "data-uxml-node", Jt = "data-uxml-part", Xt = "data-uxml-part-owner";
|
|
1146
|
+
function Yt(e, n, t, s, i, r) {
|
|
1147
|
+
const u = [], c = /* @__PURE__ */ new Map();
|
|
1148
|
+
function v(f) {
|
|
1149
|
+
const l = s.get(f.id), h = (g) => {
|
|
1150
|
+
var m;
|
|
1151
|
+
const p = ((m = l == null ? void 0 : l.get(g)) == null ? void 0 : m.value) ?? ae[g] ?? "0", { length: b } = Q(p);
|
|
1152
|
+
return b !== null && b.kind === "px" ? b.value : 0;
|
|
576
1153
|
};
|
|
577
|
-
return { left:
|
|
1154
|
+
return { left: h("border-left-width"), top: h("border-top-width") };
|
|
578
1155
|
}
|
|
579
|
-
function
|
|
580
|
-
const
|
|
581
|
-
var
|
|
582
|
-
const
|
|
583
|
-
return
|
|
1156
|
+
function d(f) {
|
|
1157
|
+
const l = (h) => {
|
|
1158
|
+
var b;
|
|
1159
|
+
const g = ((b = f.style.get(h)) == null ? void 0 : b.value) ?? ae[h] ?? "0", { length: p } = Q(g);
|
|
1160
|
+
return p !== null && p.kind === "px" ? p.value : 0;
|
|
584
1161
|
};
|
|
585
|
-
return { left:
|
|
1162
|
+
return { left: l("border-left-width"), top: l("border-top-width") };
|
|
586
1163
|
}
|
|
587
|
-
function
|
|
1164
|
+
function o(f, l, h) {
|
|
588
1165
|
var E;
|
|
589
|
-
const
|
|
590
|
-
if (
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
const
|
|
594
|
-
|
|
595
|
-
const
|
|
1166
|
+
const g = n.get(f.id);
|
|
1167
|
+
if (g === void 0) return null;
|
|
1168
|
+
const p = r.document.createElement("div");
|
|
1169
|
+
p.setAttribute(Gt, String(f.id));
|
|
1170
|
+
const b = s.get(f.id) ?? /* @__PURE__ */ new Map(), m = De(b, f.id, r);
|
|
1171
|
+
u.push(...m.warnings);
|
|
1172
|
+
const y = l === null ? 0 : g.left - l.left - h.left, k = l === null ? 0 : g.top - l.top - h.top, x = {
|
|
596
1173
|
position: "absolute",
|
|
597
|
-
left: `${
|
|
598
|
-
top: `${
|
|
599
|
-
width: `${
|
|
600
|
-
height: `${
|
|
1174
|
+
left: `${y}px`,
|
|
1175
|
+
top: `${k}px`,
|
|
1176
|
+
width: `${g.width}px`,
|
|
1177
|
+
height: `${g.height}px`,
|
|
601
1178
|
margin: "0",
|
|
602
|
-
...
|
|
1179
|
+
...m.declarations
|
|
603
1180
|
};
|
|
604
|
-
for (const [
|
|
605
|
-
|
|
606
|
-
const { spec: $ } =
|
|
1181
|
+
for (const [C, L] of Object.entries(x))
|
|
1182
|
+
p.style.setProperty(C, L);
|
|
1183
|
+
const { spec: $ } = H(f), O = (E = f.attributes.find((C) => C.name === "text")) == null ? void 0 : E.value;
|
|
607
1184
|
if ($.hasText && O !== void 0 && O.length > 0)
|
|
608
|
-
|
|
1185
|
+
p.style.setProperty("display", m.declarations.display ?? "flex"), m.declarations["align-items"] === void 0 && p.style.setProperty("align-items", "flex-start"), m.declarations["justify-content"] === void 0 && p.style.setProperty("justify-content", "flex-start"), p.textContent = J(O);
|
|
609
1186
|
else {
|
|
610
|
-
let
|
|
611
|
-
for (const
|
|
612
|
-
const T =
|
|
613
|
-
T.setAttribute(
|
|
614
|
-
const N =
|
|
615
|
-
|
|
616
|
-
const
|
|
1187
|
+
let C = p, L = g, w = v(f);
|
|
1188
|
+
for (const S of t.get(f.id) ?? []) {
|
|
1189
|
+
const T = r.document.createElement("div");
|
|
1190
|
+
T.setAttribute(Jt, S.name), T.setAttribute(Xt, String(f.id));
|
|
1191
|
+
const N = De(S.style, f.id, r);
|
|
1192
|
+
u.push(...N.warnings);
|
|
1193
|
+
const D = {
|
|
617
1194
|
position: "absolute",
|
|
618
|
-
left: `${
|
|
619
|
-
top: `${
|
|
620
|
-
width: `${
|
|
621
|
-
height: `${
|
|
1195
|
+
left: `${S.box.left - L.left - w.left}px`,
|
|
1196
|
+
top: `${S.box.top - L.top - w.top}px`,
|
|
1197
|
+
width: `${S.box.width}px`,
|
|
1198
|
+
height: `${S.box.height}px`,
|
|
622
1199
|
margin: "0",
|
|
623
1200
|
...N.declarations
|
|
624
1201
|
};
|
|
625
|
-
for (const [A, I] of Object.entries(
|
|
1202
|
+
for (const [A, I] of Object.entries(D))
|
|
626
1203
|
T.style.setProperty(A, I);
|
|
627
|
-
|
|
1204
|
+
C.appendChild(T), C = T, L = S.box, w = d(S);
|
|
628
1205
|
}
|
|
629
|
-
for (const
|
|
630
|
-
const T =
|
|
631
|
-
T !== null &&
|
|
1206
|
+
for (const S of f.children) {
|
|
1207
|
+
const T = o(S, L, w);
|
|
1208
|
+
T !== null && C.appendChild(T);
|
|
632
1209
|
}
|
|
633
1210
|
}
|
|
634
|
-
return
|
|
1211
|
+
return c.set(f.id, p), p;
|
|
635
1212
|
}
|
|
636
|
-
|
|
637
|
-
const a =
|
|
638
|
-
return a !== null && (a.style.setProperty("position", "relative"),
|
|
1213
|
+
i.replaceChildren();
|
|
1214
|
+
const a = o(e, null, { left: 0, top: 0 });
|
|
1215
|
+
return a !== null && (a.style.setProperty("position", "relative"), i.appendChild(a)), { warnings: u, elements: c };
|
|
639
1216
|
}
|
|
640
|
-
const
|
|
1217
|
+
const Ae = /[A-Za-z0-9_-]/;
|
|
641
1218
|
function B(e) {
|
|
642
1219
|
return e === " " || e === " " || e === `
|
|
643
1220
|
` || e === "\r" || e === "\f";
|
|
644
1221
|
}
|
|
645
|
-
function
|
|
646
|
-
let
|
|
647
|
-
for (;
|
|
648
|
-
const
|
|
649
|
-
if (
|
|
650
|
-
const
|
|
651
|
-
|
|
1222
|
+
function ce(e, n, t) {
|
|
1223
|
+
let s = n, i = 0;
|
|
1224
|
+
for (; s < e.length; ) {
|
|
1225
|
+
const r = e[s];
|
|
1226
|
+
if (r === '"' || r === "'") {
|
|
1227
|
+
const u = e.indexOf(r, s + 1);
|
|
1228
|
+
s = u < 0 ? e.length : u + 1;
|
|
652
1229
|
continue;
|
|
653
1230
|
}
|
|
654
|
-
if (
|
|
655
|
-
const
|
|
656
|
-
|
|
1231
|
+
if (r === "/" && e[s + 1] === "*") {
|
|
1232
|
+
const u = e.indexOf("*/", s + 2);
|
|
1233
|
+
s = u < 0 ? e.length : u + 2;
|
|
657
1234
|
continue;
|
|
658
1235
|
}
|
|
659
|
-
if (
|
|
660
|
-
|
|
661
|
-
else if (
|
|
662
|
-
|
|
663
|
-
else if (
|
|
664
|
-
return
|
|
665
|
-
|
|
1236
|
+
if (r === "(" || r === "[")
|
|
1237
|
+
i++;
|
|
1238
|
+
else if (r === ")" || r === "]")
|
|
1239
|
+
i > 0 && i--;
|
|
1240
|
+
else if (i === 0 && t.includes(r))
|
|
1241
|
+
return s;
|
|
1242
|
+
s++;
|
|
666
1243
|
}
|
|
667
1244
|
return e.length;
|
|
668
1245
|
}
|
|
669
|
-
function
|
|
670
|
-
let
|
|
671
|
-
for (;
|
|
672
|
-
for (;
|
|
673
|
-
return { start:
|
|
674
|
-
}
|
|
675
|
-
function
|
|
676
|
-
const
|
|
677
|
-
let
|
|
678
|
-
for (;
|
|
679
|
-
for (;
|
|
680
|
-
if (e.startsWith("/*",
|
|
681
|
-
const
|
|
682
|
-
|
|
1246
|
+
function qe(e, n, t) {
|
|
1247
|
+
let s = n, i = t;
|
|
1248
|
+
for (; s < i && B(e[s]); ) s++;
|
|
1249
|
+
for (; i > s && B(e[i - 1]); ) i--;
|
|
1250
|
+
return { start: s, end: i };
|
|
1251
|
+
}
|
|
1252
|
+
function Ge(e, n, t, s) {
|
|
1253
|
+
const i = [];
|
|
1254
|
+
let r = n;
|
|
1255
|
+
for (; r < t; ) {
|
|
1256
|
+
for (; r < t && (B(e[r]) || e.startsWith("/*", r)); )
|
|
1257
|
+
if (e.startsWith("/*", r)) {
|
|
1258
|
+
const o = e.indexOf("*/", r + 2);
|
|
1259
|
+
r = o < 0 ? t : o + 2;
|
|
683
1260
|
} else
|
|
684
|
-
|
|
685
|
-
if (
|
|
686
|
-
if (e[
|
|
687
|
-
|
|
1261
|
+
r++;
|
|
1262
|
+
if (r >= t) break;
|
|
1263
|
+
if (e[r] === ";") {
|
|
1264
|
+
r++;
|
|
688
1265
|
continue;
|
|
689
1266
|
}
|
|
690
|
-
const
|
|
691
|
-
if (
|
|
692
|
-
const
|
|
693
|
-
|
|
1267
|
+
const u = r, c = ce(e, u, ":;}");
|
|
1268
|
+
if (c >= t || e[c] !== ":") {
|
|
1269
|
+
const o = Math.min(c, t);
|
|
1270
|
+
s == null || s("declaration without a value", u, o), r = o + 1;
|
|
694
1271
|
continue;
|
|
695
1272
|
}
|
|
696
|
-
const v = Math.min(
|
|
697
|
-
|
|
698
|
-
property: e.slice(
|
|
699
|
-
value: e.slice(
|
|
700
|
-
span: { start:
|
|
1273
|
+
const v = Math.min(ce(e, c + 1, ";}"), t), d = qe(e, c + 1, v);
|
|
1274
|
+
i.push({
|
|
1275
|
+
property: e.slice(u, c).trim(),
|
|
1276
|
+
value: e.slice(d.start, d.end),
|
|
1277
|
+
span: { start: u, end: d.end },
|
|
701
1278
|
dirty: !1
|
|
702
|
-
}),
|
|
1279
|
+
}), r = v + 1;
|
|
703
1280
|
}
|
|
704
|
-
return
|
|
1281
|
+
return i;
|
|
705
1282
|
}
|
|
706
|
-
function
|
|
1283
|
+
function Kt(e) {
|
|
707
1284
|
const n = e.span.end - 1 - e.value.length;
|
|
708
1285
|
return n < e.span.start ? null : n;
|
|
709
1286
|
}
|
|
710
|
-
function
|
|
711
|
-
const
|
|
712
|
-
let
|
|
713
|
-
function m
|
|
714
|
-
|
|
1287
|
+
function ge(e, n = null, t = 0) {
|
|
1288
|
+
const s = [], i = [];
|
|
1289
|
+
let r = 0;
|
|
1290
|
+
function u(m, y, k) {
|
|
1291
|
+
s.push({
|
|
715
1292
|
kind: "malformed",
|
|
716
|
-
message:
|
|
717
|
-
at: { in: "uss", sheet: t, span: { start:
|
|
1293
|
+
message: m,
|
|
1294
|
+
at: { in: "uss", sheet: t, span: { start: y, end: k } }
|
|
718
1295
|
});
|
|
719
1296
|
}
|
|
720
|
-
function
|
|
1297
|
+
function c() {
|
|
721
1298
|
for (; ; ) {
|
|
722
|
-
for (; B(e[
|
|
723
|
-
if (e.startsWith("/*",
|
|
724
|
-
const
|
|
725
|
-
|
|
1299
|
+
for (; B(e[r]); ) r++;
|
|
1300
|
+
if (e.startsWith("/*", r)) {
|
|
1301
|
+
const m = e.indexOf("*/", r + 2);
|
|
1302
|
+
r = m < 0 ? e.length : m + 2;
|
|
726
1303
|
continue;
|
|
727
1304
|
}
|
|
728
1305
|
return;
|
|
729
1306
|
}
|
|
730
1307
|
}
|
|
731
|
-
const v = (
|
|
732
|
-
function
|
|
733
|
-
let
|
|
734
|
-
for (;
|
|
735
|
-
const
|
|
736
|
-
if (
|
|
737
|
-
const $ = e.indexOf(
|
|
738
|
-
|
|
1308
|
+
const v = (m, y) => ce(e, m, y), d = (m, y) => qe(e, m, y);
|
|
1309
|
+
function o(m) {
|
|
1310
|
+
let y = m + 1, k = 1;
|
|
1311
|
+
for (; y < e.length; ) {
|
|
1312
|
+
const x = e[y];
|
|
1313
|
+
if (x === '"' || x === "'") {
|
|
1314
|
+
const $ = e.indexOf(x, y + 1);
|
|
1315
|
+
y = $ < 0 ? e.length : $ + 1;
|
|
739
1316
|
continue;
|
|
740
1317
|
}
|
|
741
|
-
if (
|
|
742
|
-
const $ = e.indexOf("*/",
|
|
743
|
-
|
|
1318
|
+
if (x === "/" && e[y + 1] === "*") {
|
|
1319
|
+
const $ = e.indexOf("*/", y + 2);
|
|
1320
|
+
y = $ < 0 ? e.length : $ + 2;
|
|
744
1321
|
continue;
|
|
745
1322
|
}
|
|
746
|
-
if (
|
|
747
|
-
else if (
|
|
748
|
-
|
|
1323
|
+
if (x === "{") k++;
|
|
1324
|
+
else if (x === "}" && --k === 0) return y + 1;
|
|
1325
|
+
y++;
|
|
749
1326
|
}
|
|
750
1327
|
return e.length;
|
|
751
1328
|
}
|
|
752
|
-
function a(
|
|
753
|
-
let
|
|
754
|
-
for (;
|
|
755
|
-
return
|
|
1329
|
+
function a(m) {
|
|
1330
|
+
let y = m;
|
|
1331
|
+
for (; y < e.length && Ae.test(e[y]); ) y++;
|
|
1332
|
+
return y;
|
|
756
1333
|
}
|
|
757
|
-
function
|
|
758
|
-
const
|
|
759
|
-
let
|
|
760
|
-
for (;
|
|
761
|
-
const O = e[
|
|
1334
|
+
function f(m) {
|
|
1335
|
+
const y = e[m], k = y === "(" ? ")" : "]";
|
|
1336
|
+
let x = m + 1, $ = 1;
|
|
1337
|
+
for (; x < e.length; ) {
|
|
1338
|
+
const O = e[x];
|
|
762
1339
|
if (O === '"' || O === "'") {
|
|
763
|
-
const E = e.indexOf(O,
|
|
764
|
-
|
|
1340
|
+
const E = e.indexOf(O, x + 1);
|
|
1341
|
+
x = E < 0 ? e.length : E + 1;
|
|
765
1342
|
continue;
|
|
766
1343
|
}
|
|
767
|
-
if (O ===
|
|
768
|
-
else if (O ===
|
|
769
|
-
|
|
1344
|
+
if (O === y) $++;
|
|
1345
|
+
else if (O === k && --$ === 0) return x + 1;
|
|
1346
|
+
x++;
|
|
770
1347
|
}
|
|
771
1348
|
return e.length;
|
|
772
1349
|
}
|
|
773
|
-
function
|
|
774
|
-
const
|
|
775
|
-
let
|
|
776
|
-
for (;
|
|
777
|
-
const $ = e[
|
|
1350
|
+
function l(m, y) {
|
|
1351
|
+
const k = [];
|
|
1352
|
+
let x = m;
|
|
1353
|
+
for (; x < y; ) {
|
|
1354
|
+
const $ = e[x];
|
|
778
1355
|
if (B($) || $ === ">" || $ === "+" || $ === "~" || $ === ",") break;
|
|
779
1356
|
if ($ === "*")
|
|
780
|
-
|
|
1357
|
+
k.push({ kind: "universal" }), x++;
|
|
781
1358
|
else if ($ === "." || $ === "#") {
|
|
782
|
-
const O = a(
|
|
783
|
-
|
|
784
|
-
$ === "." ? { kind: "class", name: e.slice(
|
|
785
|
-
),
|
|
1359
|
+
const O = a(x + 1);
|
|
1360
|
+
k.push(
|
|
1361
|
+
$ === "." ? { kind: "class", name: e.slice(x + 1, O) } : { kind: "name", name: e.slice(x + 1, O) }
|
|
1362
|
+
), x = O;
|
|
786
1363
|
} else if ($ === "[") {
|
|
787
|
-
const O = Math.min(
|
|
788
|
-
|
|
1364
|
+
const O = Math.min(f(x), y);
|
|
1365
|
+
k.push({ kind: "unknown", text: e.slice(x, O) }), x = O;
|
|
789
1366
|
} else if ($ === ":")
|
|
790
|
-
if (e[
|
|
791
|
-
const O = a(
|
|
792
|
-
|
|
1367
|
+
if (e[x + 1] === ":") {
|
|
1368
|
+
const O = a(x + 2);
|
|
1369
|
+
k.push({ kind: "unknown", text: e.slice(x, O) }), x = O;
|
|
793
1370
|
} else {
|
|
794
|
-
const O = a(
|
|
1371
|
+
const O = a(x + 1);
|
|
795
1372
|
if (e[O] === "(") {
|
|
796
|
-
const E = Math.min(
|
|
797
|
-
|
|
1373
|
+
const E = Math.min(f(O), y);
|
|
1374
|
+
k.push({ kind: "unknown", text: e.slice(x, E) }), x = E;
|
|
798
1375
|
} else
|
|
799
|
-
|
|
1376
|
+
k.push({ kind: "pseudo", name: e.slice(x + 1, O) }), x = O;
|
|
800
1377
|
}
|
|
801
|
-
else if (
|
|
802
|
-
const O = a(
|
|
803
|
-
|
|
1378
|
+
else if (Ae.test($)) {
|
|
1379
|
+
const O = a(x);
|
|
1380
|
+
k.push({ kind: "type", name: e.slice(x, O) }), x = O;
|
|
804
1381
|
} else
|
|
805
|
-
|
|
1382
|
+
k.push({ kind: "unknown", text: $ }), x++;
|
|
806
1383
|
}
|
|
807
|
-
return { simple:
|
|
808
|
-
}
|
|
809
|
-
function
|
|
810
|
-
const
|
|
811
|
-
let $ = "descendant", O = null, E =
|
|
812
|
-
for (; E <
|
|
813
|
-
const
|
|
814
|
-
if (B(
|
|
1384
|
+
return { simple: k, next: x };
|
|
1385
|
+
}
|
|
1386
|
+
function h(m, y) {
|
|
1387
|
+
const k = d(m, y), x = [];
|
|
1388
|
+
let $ = "descendant", O = null, E = k.start;
|
|
1389
|
+
for (; E < k.end; ) {
|
|
1390
|
+
const C = e[E];
|
|
1391
|
+
if (B(C)) {
|
|
815
1392
|
E++;
|
|
816
1393
|
continue;
|
|
817
1394
|
}
|
|
818
|
-
if (
|
|
1395
|
+
if (C === ">") {
|
|
819
1396
|
$ = "child", E++;
|
|
820
1397
|
continue;
|
|
821
1398
|
}
|
|
822
|
-
if (
|
|
823
|
-
O =
|
|
1399
|
+
if (C === "+" || C === "~") {
|
|
1400
|
+
O = C, E++;
|
|
824
1401
|
continue;
|
|
825
1402
|
}
|
|
826
|
-
const { simple:
|
|
827
|
-
if (
|
|
1403
|
+
const { simple: L, next: w } = l(E, k.end);
|
|
1404
|
+
if (w === E) {
|
|
828
1405
|
E++;
|
|
829
1406
|
continue;
|
|
830
1407
|
}
|
|
831
|
-
O !== null && (
|
|
1408
|
+
O !== null && (L.unshift({ kind: "unknown", text: O }), O = null), x.push({ combinator: $, simple: L }), $ = "descendant", E = w;
|
|
832
1409
|
}
|
|
833
|
-
return { parts:
|
|
1410
|
+
return { parts: x, span: k };
|
|
834
1411
|
}
|
|
835
|
-
function
|
|
836
|
-
const
|
|
837
|
-
let
|
|
1412
|
+
function g(m, y) {
|
|
1413
|
+
const k = [];
|
|
1414
|
+
let x = m;
|
|
838
1415
|
for (; ; ) {
|
|
839
|
-
const $ = Math.min(v(
|
|
840
|
-
if (
|
|
841
|
-
|
|
1416
|
+
const $ = Math.min(v(x, ","), y);
|
|
1417
|
+
if (k.push(h(x, $)), $ >= y) break;
|
|
1418
|
+
x = $ + 1;
|
|
842
1419
|
}
|
|
843
|
-
return
|
|
1420
|
+
return k;
|
|
844
1421
|
}
|
|
845
|
-
function
|
|
846
|
-
const
|
|
847
|
-
if (
|
|
848
|
-
const O =
|
|
849
|
-
return
|
|
1422
|
+
function p() {
|
|
1423
|
+
const m = r, y = a(r + 1), k = e.slice(r + 1, y), x = v(y, "{;");
|
|
1424
|
+
if (x < e.length && e[x] === "{") {
|
|
1425
|
+
const O = o(x);
|
|
1426
|
+
return r = O, { kind: "unknown", span: { start: m, end: O } };
|
|
850
1427
|
}
|
|
851
|
-
const $ =
|
|
852
|
-
if (
|
|
853
|
-
const O = e.slice(
|
|
854
|
-
return E === null ? (
|
|
1428
|
+
const $ = x < e.length ? x + 1 : e.length;
|
|
1429
|
+
if (r = $, k === "import") {
|
|
1430
|
+
const O = e.slice(y, $), E = /["']([^"']*)["']/.exec(O);
|
|
1431
|
+
return E === null ? (u("@import without a quoted path", m, $), { kind: "unknown", span: { start: m, end: $ } }) : { kind: "import", url: E[1], span: { start: m, end: $ } };
|
|
855
1432
|
}
|
|
856
|
-
return { kind: "unknown", span: { start:
|
|
857
|
-
}
|
|
858
|
-
function
|
|
859
|
-
const
|
|
860
|
-
if (
|
|
861
|
-
return
|
|
862
|
-
const
|
|
863
|
-
(
|
|
1433
|
+
return { kind: "unknown", span: { start: m, end: $ } };
|
|
1434
|
+
}
|
|
1435
|
+
function b() {
|
|
1436
|
+
const m = r, y = v(m, "{");
|
|
1437
|
+
if (y >= e.length)
|
|
1438
|
+
return u("rule without a block", m, e.length), r = e.length, { kind: "unknown", span: { start: m, end: e.length } };
|
|
1439
|
+
const k = d(m, y), x = o(y);
|
|
1440
|
+
(x > e.length || e[x - 1] !== "}") && u("unterminated rule block", m, x);
|
|
864
1441
|
const $ = {
|
|
865
|
-
selectors:
|
|
866
|
-
declarations:
|
|
867
|
-
span: { start:
|
|
868
|
-
selectorSpan:
|
|
1442
|
+
selectors: g(k.start, k.end),
|
|
1443
|
+
declarations: Ge(e, y + 1, x - 1, u),
|
|
1444
|
+
span: { start: k.start, end: x },
|
|
1445
|
+
selectorSpan: k,
|
|
869
1446
|
selectorDirty: !1,
|
|
870
1447
|
declarationsDirty: !1
|
|
871
1448
|
};
|
|
872
|
-
return
|
|
1449
|
+
return r = x, { kind: "rule", rule: $ };
|
|
873
1450
|
}
|
|
874
|
-
for (;
|
|
875
|
-
|
|
876
|
-
return { sheet: { source: e, origin: n, items:
|
|
1451
|
+
for (; c(), !(r >= e.length); )
|
|
1452
|
+
i.push(e[r] === "@" ? p() : b());
|
|
1453
|
+
return { sheet: { source: e, origin: n, items: i }, warnings: s };
|
|
877
1454
|
}
|
|
878
|
-
function
|
|
1455
|
+
function Zt(e, n, t) {
|
|
879
1456
|
switch (e.kind) {
|
|
880
1457
|
case "universal":
|
|
881
1458
|
return !0;
|
|
@@ -891,61 +1468,61 @@ function ht(e, n, t) {
|
|
|
891
1468
|
return !1;
|
|
892
1469
|
}
|
|
893
1470
|
}
|
|
894
|
-
function
|
|
895
|
-
return e.simple.every((
|
|
1471
|
+
function Qt(e, n, t) {
|
|
1472
|
+
return e.simple.every((s) => Zt(s, n, t));
|
|
896
1473
|
}
|
|
897
|
-
function
|
|
898
|
-
if (!
|
|
1474
|
+
function ue(e, n, t, s) {
|
|
1475
|
+
if (!Qt(e[n], t, s)) return !1;
|
|
899
1476
|
if (n === 0) return !0;
|
|
900
|
-
const
|
|
1477
|
+
const i = s.parentOf(t);
|
|
901
1478
|
if (e[n].combinator === "child")
|
|
902
|
-
return
|
|
903
|
-
for (let
|
|
904
|
-
if (
|
|
1479
|
+
return i !== null && ue(e, n - 1, i, s);
|
|
1480
|
+
for (let r = i; r !== null; r = s.parentOf(r))
|
|
1481
|
+
if (ue(e, n - 1, r, s)) return !0;
|
|
905
1482
|
return !1;
|
|
906
1483
|
}
|
|
907
|
-
function
|
|
908
|
-
return e.parts.length === 0 ? !1 :
|
|
1484
|
+
function Je(e, n, t) {
|
|
1485
|
+
return e.parts.length === 0 ? !1 : ue(e.parts, e.parts.length - 1, n, t);
|
|
909
1486
|
}
|
|
910
|
-
function
|
|
1487
|
+
function en(e) {
|
|
911
1488
|
const n = [];
|
|
912
1489
|
for (const t of e.parts)
|
|
913
|
-
for (const
|
|
914
|
-
|
|
1490
|
+
for (const s of t.simple)
|
|
1491
|
+
s.kind === "pseudo" && s.name !== "root" && !n.includes(s.name) && n.push(s.name);
|
|
915
1492
|
return n;
|
|
916
1493
|
}
|
|
917
|
-
function
|
|
1494
|
+
function tn(e) {
|
|
918
1495
|
const n = [];
|
|
919
1496
|
for (const t of e)
|
|
920
|
-
for (const
|
|
921
|
-
for (const
|
|
922
|
-
if (
|
|
923
|
-
const
|
|
924
|
-
n.includes(
|
|
1497
|
+
for (const s of t.parts)
|
|
1498
|
+
for (const i of s.simple) {
|
|
1499
|
+
if (i.kind !== "name" && i.kind !== "class" || !i.name.startsWith("unity-")) continue;
|
|
1500
|
+
const r = i.kind === "name" ? `#${i.name}` : `.${i.name}`;
|
|
1501
|
+
n.includes(r) || n.push(r);
|
|
925
1502
|
}
|
|
926
1503
|
return n;
|
|
927
1504
|
}
|
|
928
|
-
function
|
|
1505
|
+
function Xe(e) {
|
|
929
1506
|
for (const n of e)
|
|
930
1507
|
for (const t of n.parts)
|
|
931
|
-
for (const
|
|
932
|
-
if (
|
|
1508
|
+
for (const s of t.simple)
|
|
1509
|
+
if (s.kind === "unknown") return s.text;
|
|
933
1510
|
return null;
|
|
934
1511
|
}
|
|
935
|
-
function
|
|
1512
|
+
function nn(e) {
|
|
936
1513
|
const n = /* @__PURE__ */ new Map([[e, null]]), t = [e];
|
|
937
1514
|
for (; t.length > 0; ) {
|
|
938
|
-
const
|
|
939
|
-
for (const
|
|
940
|
-
n.set(
|
|
1515
|
+
const s = t.pop();
|
|
1516
|
+
for (const i of s.children)
|
|
1517
|
+
n.set(i, s), t.push(i);
|
|
941
1518
|
}
|
|
942
1519
|
return n;
|
|
943
1520
|
}
|
|
944
|
-
function
|
|
945
|
-
let n = 0, t = 0,
|
|
946
|
-
for (const
|
|
947
|
-
for (const
|
|
948
|
-
switch (
|
|
1521
|
+
function sn(e) {
|
|
1522
|
+
let n = 0, t = 0, s = 0;
|
|
1523
|
+
for (const i of e.parts)
|
|
1524
|
+
for (const r of i.simple)
|
|
1525
|
+
switch (r.kind) {
|
|
949
1526
|
case "name":
|
|
950
1527
|
n++;
|
|
951
1528
|
break;
|
|
@@ -954,78 +1531,93 @@ function xt(e) {
|
|
|
954
1531
|
t++;
|
|
955
1532
|
break;
|
|
956
1533
|
case "type":
|
|
957
|
-
|
|
1534
|
+
s++;
|
|
958
1535
|
break;
|
|
959
1536
|
}
|
|
960
|
-
return [n, t,
|
|
1537
|
+
return [n, t, s];
|
|
961
1538
|
}
|
|
962
|
-
function
|
|
1539
|
+
function Ye(e, n) {
|
|
963
1540
|
return e[0] - n[0] || e[1] - n[1] || e[2] - n[2];
|
|
964
1541
|
}
|
|
965
|
-
const
|
|
1542
|
+
const rn = [Number.MAX_SAFE_INTEGER, 0, 0], on = ge(Ve, null, -1).sheet.items.flatMap(
|
|
966
1543
|
(e, n) => e.kind === "rule" ? [{ rule: e.rule, sheet: -1, item: n, builtin: !0 }] : []
|
|
967
1544
|
);
|
|
968
|
-
function
|
|
969
|
-
return
|
|
1545
|
+
function ln(e) {
|
|
1546
|
+
return Ve.slice(e.selectorSpan.start, e.selectorSpan.end).trim();
|
|
970
1547
|
}
|
|
971
|
-
function
|
|
972
|
-
const
|
|
973
|
-
for (const [
|
|
974
|
-
const
|
|
975
|
-
if (
|
|
976
|
-
|
|
1548
|
+
function an(e, n, t, s) {
|
|
1549
|
+
const i = (t == null ? void 0 : t.activeStates) ?? /* @__PURE__ */ new Set(), r = Object.entries((t == null ? void 0 : t.states) ?? {}), u = [];
|
|
1550
|
+
for (const [o, a] of r) {
|
|
1551
|
+
const f = ge(`${o} {}`, null, -1).sheet.items.find((h) => h.kind === "rule"), l = f === void 0 ? o : Xe(f.rule.selectors);
|
|
1552
|
+
if (f === void 0 || l !== null) {
|
|
1553
|
+
s.push({
|
|
977
1554
|
kind: "unsupported-selector",
|
|
978
|
-
message: `states key "${
|
|
1555
|
+
message: `states key "${o}" is not a usable USS selector; it is ignored`
|
|
979
1556
|
});
|
|
980
1557
|
continue;
|
|
981
1558
|
}
|
|
982
|
-
|
|
983
|
-
}
|
|
984
|
-
const
|
|
985
|
-
const
|
|
986
|
-
|
|
987
|
-
for (const
|
|
988
|
-
if (
|
|
989
|
-
for (const
|
|
990
|
-
|
|
991
|
-
for (const
|
|
1559
|
+
u.push({ selectors: f.rule.selectors, states: a });
|
|
1560
|
+
}
|
|
1561
|
+
const c = /* @__PURE__ */ new Map(), v = (o) => o.attributes.some((a) => a.name === "enabled" && a.value === "false"), d = (o, a) => {
|
|
1562
|
+
const f = a || v(o), l = new Set(i);
|
|
1563
|
+
f && l.add("disabled");
|
|
1564
|
+
for (const h of u)
|
|
1565
|
+
if (h.selectors.some((g) => Je(g, { kind: "element", node: o }, n)))
|
|
1566
|
+
for (const g of h.states) l.add(g);
|
|
1567
|
+
c.set(o, l);
|
|
1568
|
+
for (const h of o.children) d(h, f);
|
|
992
1569
|
};
|
|
993
|
-
return
|
|
1570
|
+
return d(e.root, !1), c;
|
|
994
1571
|
}
|
|
995
|
-
function
|
|
1572
|
+
function cn(e) {
|
|
996
1573
|
const n = [], t = /* @__PURE__ */ new Map();
|
|
997
|
-
e.sheets.forEach((
|
|
998
|
-
|
|
999
|
-
}), n.push(...
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1574
|
+
e.sheets.forEach((u, c) => {
|
|
1575
|
+
u.origin !== null && !t.has(u.origin) && t.set(u.origin, c);
|
|
1576
|
+
}), n.push(...on);
|
|
1577
|
+
const s = /* @__PURE__ */ new Map(), i = (u, c) => {
|
|
1578
|
+
const v = s.get(c) ?? /* @__PURE__ */ new Set();
|
|
1579
|
+
if (v.has(u)) return;
|
|
1580
|
+
v.add(u), s.set(c, v);
|
|
1581
|
+
const d = e.sheets[u];
|
|
1582
|
+
d !== void 0 && d.items.forEach((o, a) => {
|
|
1583
|
+
if (o.kind === "rule")
|
|
1584
|
+
n.push({ rule: o.rule, sheet: u, item: a, scope: c });
|
|
1585
|
+
else if (o.kind === "import") {
|
|
1586
|
+
const f = o.resolvedSheet ?? t.get(o.url);
|
|
1587
|
+
f !== void 0 && i(f, c);
|
|
1010
1588
|
}
|
|
1011
1589
|
});
|
|
1012
|
-
};
|
|
1013
|
-
|
|
1590
|
+
}, r = e.styleRoots ?? (e.sheets.length === 0 ? [] : [{ sheet: 0, scope: e.root.id }]);
|
|
1591
|
+
for (const u of r) i(u.sheet, u.scope);
|
|
1592
|
+
return n;
|
|
1014
1593
|
}
|
|
1015
|
-
function
|
|
1594
|
+
function un(e, n, t) {
|
|
1595
|
+
let s = e;
|
|
1596
|
+
for (; s !== null; ) {
|
|
1597
|
+
if (s.kind === "element" && s.node.id === n) return !0;
|
|
1598
|
+
s = t.parentOf(s);
|
|
1599
|
+
}
|
|
1600
|
+
return !1;
|
|
1601
|
+
}
|
|
1602
|
+
function dn(e) {
|
|
1016
1603
|
return e.selectors.some(
|
|
1017
|
-
(n) => n.parts.some((t) => t.simple.some((
|
|
1604
|
+
(n) => n.parts.some((t) => t.simple.some((s) => s.kind === "pseudo" && s.name === "root"))
|
|
1018
1605
|
);
|
|
1019
1606
|
}
|
|
1020
|
-
function
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1607
|
+
function de(e, n) {
|
|
1608
|
+
var s;
|
|
1609
|
+
const t = (s = e.sheets[n]) == null ? void 0 : s.origin;
|
|
1610
|
+
return typeof t == "string" ? { sourceDocument: t } : {};
|
|
1611
|
+
}
|
|
1612
|
+
function Ke(e, n) {
|
|
1613
|
+
const t = nn(e.root), s = [], i = /* @__PURE__ */ new Set(), r = (l) => {
|
|
1614
|
+
var g;
|
|
1615
|
+
const h = (g = l.attributes.find((p) => p.name === "class")) == null ? void 0 : g.value;
|
|
1616
|
+
return h === void 0 ? [] : h.split(/\s+/).filter((p) => p.length > 0);
|
|
1617
|
+
}, u = (l, h) => {
|
|
1618
|
+
var g;
|
|
1619
|
+
return (g = l.attributes.find((p) => p.name === h)) == null ? void 0 : g.value;
|
|
1620
|
+
}, c = {
|
|
1029
1621
|
/**
|
|
1030
1622
|
* The rule the measurement forced.
|
|
1031
1623
|
*
|
|
@@ -1036,224 +1628,251 @@ function Ee(e, n) {
|
|
|
1036
1628
|
* owner. That is the hierarchy the dumps show, so descendant selectors like
|
|
1037
1629
|
* `.panel #unity-content-viewport` behave as they do in Unity.
|
|
1038
1630
|
*/
|
|
1039
|
-
parentOf: (
|
|
1040
|
-
if (
|
|
1041
|
-
const
|
|
1042
|
-
return
|
|
1631
|
+
parentOf: (l) => {
|
|
1632
|
+
if (l.kind === "element") {
|
|
1633
|
+
const p = t.get(l.node) ?? null;
|
|
1634
|
+
return p === null ? null : { kind: "element", node: p };
|
|
1043
1635
|
}
|
|
1044
|
-
if (
|
|
1045
|
-
const
|
|
1046
|
-
return { kind: "part", owner:
|
|
1636
|
+
if (l.depth === 0) return { kind: "element", node: l.owner };
|
|
1637
|
+
const g = H(l.owner).spec.parts[l.depth - 1];
|
|
1638
|
+
return { kind: "part", owner: l.owner, name: g.name, depth: l.depth - 1 };
|
|
1047
1639
|
},
|
|
1048
|
-
isRoot: (
|
|
1640
|
+
isRoot: (l) => l.kind === "element" && l.node === e.root,
|
|
1049
1641
|
// Unity's parts are VisualElements, so a `VisualElement` rule reaches them.
|
|
1050
1642
|
// Not measured — `part-type-selector` is the case that will settle it.
|
|
1051
|
-
typeNameOf: (
|
|
1052
|
-
idOf: (
|
|
1643
|
+
typeNameOf: (l) => l.kind === "element" ? l.node.name.local : "VisualElement",
|
|
1644
|
+
idOf: (l) => l.kind === "element" ? u(l.node, "name") : l.name,
|
|
1053
1645
|
// Implicit classes are as real as written ones for matching: in Unity the
|
|
1054
1646
|
// element genuinely carries them, which is why `.unity-button` in author USS
|
|
1055
1647
|
// hits a plain `<ui:Button />`. Parts carry classes too in Unity, but which
|
|
1056
1648
|
// ones is unmeasured, so none are claimed here.
|
|
1057
|
-
classesOf: (
|
|
1058
|
-
}, v = { ...
|
|
1059
|
-
...
|
|
1649
|
+
classesOf: (l) => l.kind === "element" ? [...r(l.node), ...$t(l.node)] : []
|
|
1650
|
+
}, v = { ...c, statesOf: () => i }, d = an(e, v, n, s), o = {
|
|
1651
|
+
...c,
|
|
1060
1652
|
// A part inherits its owner's states: `SetEnabled(false)` disables the whole
|
|
1061
1653
|
// subtree, and a part is inside it.
|
|
1062
|
-
statesOf: (
|
|
1654
|
+
statesOf: (l) => d.get(l.kind === "element" ? l.node : l.owner) ?? i
|
|
1063
1655
|
}, a = [];
|
|
1064
|
-
let
|
|
1065
|
-
for (const
|
|
1066
|
-
if (
|
|
1067
|
-
a.push(
|
|
1656
|
+
let f = !1;
|
|
1657
|
+
for (const l of cn(e)) {
|
|
1658
|
+
if (l.builtin === !0) {
|
|
1659
|
+
a.push(l);
|
|
1068
1660
|
continue;
|
|
1069
1661
|
}
|
|
1070
|
-
const
|
|
1071
|
-
if (
|
|
1072
|
-
|
|
1662
|
+
const h = Xe(l.rule.selectors);
|
|
1663
|
+
if (h !== null) {
|
|
1664
|
+
s.push({
|
|
1073
1665
|
kind: "unsupported-selector",
|
|
1074
|
-
message: `"${
|
|
1075
|
-
at: { in: "uss", sheet:
|
|
1666
|
+
message: `"${h}" is not supported in USS; the whole rule is ignored`,
|
|
1667
|
+
at: { in: "uss", sheet: l.sheet, span: l.rule.selectorSpan },
|
|
1668
|
+
...de(e, l.sheet)
|
|
1076
1669
|
});
|
|
1077
1670
|
continue;
|
|
1078
1671
|
}
|
|
1079
|
-
!
|
|
1672
|
+
!f && dn(l.rule) && (f = !0, s.push({
|
|
1080
1673
|
kind: "version-dependent",
|
|
1081
|
-
message: ":root in USS names the element the stylesheet was applied to, not the document root as in CSS.
|
|
1082
|
-
at: { in: "uss", sheet:
|
|
1083
|
-
|
|
1674
|
+
message: ":root in USS names the element the stylesheet was applied to, not the document root as in CSS. Template stylesheets therefore match their generated TemplateContainer.",
|
|
1675
|
+
at: { in: "uss", sheet: l.sheet, span: l.rule.selectorSpan },
|
|
1676
|
+
...de(e, l.sheet)
|
|
1677
|
+
})), a.push(l);
|
|
1084
1678
|
}
|
|
1085
|
-
return { ctx:
|
|
1679
|
+
return { ctx: o, usable: a, warnings: s };
|
|
1086
1680
|
}
|
|
1087
|
-
function
|
|
1088
|
-
const t = n.attributes.find((
|
|
1681
|
+
function fn(e, n) {
|
|
1682
|
+
const t = n.attributes.find((i) => i.name === "style");
|
|
1089
1683
|
if (t === void 0) return [];
|
|
1090
|
-
const
|
|
1091
|
-
return
|
|
1092
|
-
}
|
|
1093
|
-
function
|
|
1094
|
-
const
|
|
1095
|
-
let
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1684
|
+
const s = Kt(t);
|
|
1685
|
+
return s === null ? [] : Ge(e.source, s, s + t.value.length);
|
|
1686
|
+
}
|
|
1687
|
+
function Ze(e, n, t, s) {
|
|
1688
|
+
const i = [];
|
|
1689
|
+
let r = 0;
|
|
1690
|
+
const u = (c, v, d, o, a) => {
|
|
1691
|
+
i.push({ property: c, value: v, origin: d, rank: o, specificity: a, order: r++, winner: !1 });
|
|
1098
1692
|
};
|
|
1099
1693
|
if (n.kind === "part") {
|
|
1100
|
-
const
|
|
1101
|
-
for (const [v,
|
|
1102
|
-
for (const [
|
|
1103
|
-
|
|
1104
|
-
|
|
1694
|
+
const c = H(n.owner).spec.parts[n.depth];
|
|
1695
|
+
for (const [v, d] of Object.entries((c == null ? void 0 : c.style) ?? {}))
|
|
1696
|
+
for (const [o, a] of ie(v, d))
|
|
1697
|
+
u(
|
|
1698
|
+
o,
|
|
1105
1699
|
a,
|
|
1106
1700
|
{
|
|
1107
1701
|
kind: "builtin-theme",
|
|
1108
1702
|
selector: `#${n.name}`,
|
|
1109
|
-
property:
|
|
1110
|
-
unityVersion:
|
|
1703
|
+
property: o,
|
|
1704
|
+
unityVersion: Z
|
|
1111
1705
|
},
|
|
1112
1706
|
0,
|
|
1113
1707
|
[0, 0, 0]
|
|
1114
1708
|
);
|
|
1115
1709
|
}
|
|
1116
|
-
for (const
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1710
|
+
for (const c of t.usable) {
|
|
1711
|
+
if (c.scope !== void 0 && !un(n, c.scope, t.ctx)) continue;
|
|
1712
|
+
const v = c.scope === void 0 ? t.ctx : {
|
|
1713
|
+
...t.ctx,
|
|
1714
|
+
// Unity USS :root names the element this particular stylesheet is
|
|
1715
|
+
// attached to. Template sheets are attached to each generated
|
|
1716
|
+
// TemplateContainer, not to the entry document root.
|
|
1717
|
+
isRoot: (a) => a.kind === "element" && a.node.id === c.scope
|
|
1718
|
+
};
|
|
1719
|
+
let d = null, o = [];
|
|
1720
|
+
for (const a of c.rule.selectors) {
|
|
1721
|
+
if (!Je(a, n, v)) continue;
|
|
1722
|
+
const f = sn(a);
|
|
1723
|
+
(d === null || Ye(f, d) > 0) && (d = f, o = en(a));
|
|
1122
1724
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1725
|
+
d !== null && (s == null || s.add(c), c.rule.declarations.forEach((a, f) => {
|
|
1726
|
+
var l, h, g;
|
|
1727
|
+
for (const [p, b] of ie(a.property, a.value)) {
|
|
1728
|
+
const m = c.builtin === !0 ? {
|
|
1126
1729
|
kind: "builtin-theme",
|
|
1127
|
-
selector:
|
|
1128
|
-
property:
|
|
1129
|
-
unityVersion:
|
|
1730
|
+
selector: ln(c.rule),
|
|
1731
|
+
property: p,
|
|
1732
|
+
unityVersion: Z
|
|
1130
1733
|
} : {
|
|
1131
1734
|
kind: "rule",
|
|
1132
|
-
sheet:
|
|
1133
|
-
item:
|
|
1134
|
-
declIndex:
|
|
1735
|
+
sheet: c.sheet,
|
|
1736
|
+
item: c.item,
|
|
1737
|
+
declIndex: f,
|
|
1738
|
+
...((l = e.sheets[c.sheet]) == null ? void 0 : l.origin) === null || ((h = e.sheets[c.sheet]) == null ? void 0 : h.origin) === void 0 ? {} : { sourceDocument: e.sheets[c.sheet].origin },
|
|
1739
|
+
...((g = e.sheets[c.sheet]) == null ? void 0 : g.sourceDocumentFrom) === void 0 ? {} : { sourceDocumentFrom: e.sheets[c.sheet].sourceDocumentFrom },
|
|
1135
1740
|
// Omitted rather than set to [] when unconditional, so the
|
|
1136
1741
|
// common case stays the shape it has always been.
|
|
1137
|
-
...
|
|
1742
|
+
...o.length > 0 ? { states: o } : {}
|
|
1138
1743
|
};
|
|
1139
|
-
|
|
1744
|
+
u(p, b, m, c.builtin === !0 ? 0 : 1, d);
|
|
1140
1745
|
}
|
|
1141
1746
|
}));
|
|
1142
1747
|
}
|
|
1143
1748
|
if (n.kind === "element") {
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1749
|
+
const c = n.node;
|
|
1750
|
+
fn(e, c).forEach((v, d) => {
|
|
1751
|
+
var o;
|
|
1752
|
+
for (const [a, f] of ie(v.property, v.value))
|
|
1753
|
+
u(
|
|
1754
|
+
a,
|
|
1755
|
+
f,
|
|
1756
|
+
{
|
|
1757
|
+
kind: "inline",
|
|
1758
|
+
node: ((o = c.derived) == null ? void 0 : o.instance) ?? c.sourceNode ?? c.id,
|
|
1759
|
+
declIndex: d,
|
|
1760
|
+
...typeof c.sourceDocument == "string" ? { sourceDocument: c.sourceDocument } : {},
|
|
1761
|
+
...c.sourceDocumentFrom === void 0 ? {} : { sourceDocumentFrom: c.sourceDocumentFrom }
|
|
1762
|
+
},
|
|
1763
|
+
1,
|
|
1764
|
+
rn
|
|
1765
|
+
);
|
|
1148
1766
|
});
|
|
1149
1767
|
}
|
|
1150
|
-
return
|
|
1768
|
+
return i;
|
|
1151
1769
|
}
|
|
1152
|
-
function
|
|
1770
|
+
function Qe(e) {
|
|
1153
1771
|
const n = /* @__PURE__ */ new Map();
|
|
1154
1772
|
for (const t of e) {
|
|
1155
|
-
const
|
|
1156
|
-
if (
|
|
1773
|
+
const s = n.get(t.property);
|
|
1774
|
+
if (s === void 0) {
|
|
1157
1775
|
n.set(t.property, t);
|
|
1158
1776
|
continue;
|
|
1159
1777
|
}
|
|
1160
|
-
if (t.rank !==
|
|
1161
|
-
t.rank >
|
|
1778
|
+
if (t.rank !== s.rank) {
|
|
1779
|
+
t.rank > s.rank && n.set(t.property, t);
|
|
1162
1780
|
continue;
|
|
1163
1781
|
}
|
|
1164
|
-
const
|
|
1165
|
-
(
|
|
1782
|
+
const i = Ye(t.specificity, s.specificity);
|
|
1783
|
+
(i > 0 || i === 0 && t.order > s.order) && n.set(t.property, t);
|
|
1166
1784
|
}
|
|
1167
1785
|
for (const t of n.values()) t.winner = !0;
|
|
1168
1786
|
return n;
|
|
1169
1787
|
}
|
|
1170
|
-
const
|
|
1171
|
-
function
|
|
1172
|
-
var
|
|
1173
|
-
let
|
|
1174
|
-
for (let
|
|
1175
|
-
const
|
|
1176
|
-
if (
|
|
1177
|
-
const
|
|
1178
|
-
if (t.has(
|
|
1179
|
-
const
|
|
1788
|
+
const pn = /var\(\s*(--[^,)\s]+)\s*(?:,([^)]*))?\)/;
|
|
1789
|
+
function fe(e, n, t = /* @__PURE__ */ new Set()) {
|
|
1790
|
+
var i;
|
|
1791
|
+
let s = e;
|
|
1792
|
+
for (let r = 0; r < 32; r++) {
|
|
1793
|
+
const u = pn.exec(s);
|
|
1794
|
+
if (u === null) return s;
|
|
1795
|
+
const c = u[1], v = (i = u[2]) == null ? void 0 : i.trim();
|
|
1796
|
+
if (t.has(c)) return null;
|
|
1797
|
+
const d = /* @__PURE__ */ new Set([...t, c]), o = n.get(c), a = o !== void 0 ? fe(o, n, d) : v !== void 0 && v.length > 0 ? fe(v, n, d) : null;
|
|
1180
1798
|
if (a === null) return null;
|
|
1181
|
-
|
|
1799
|
+
s = s.slice(0, u.index) + a + s.slice(u.index + u[0].length);
|
|
1182
1800
|
}
|
|
1183
1801
|
return null;
|
|
1184
1802
|
}
|
|
1185
|
-
function
|
|
1186
|
-
const t =
|
|
1187
|
-
let
|
|
1188
|
-
const
|
|
1189
|
-
const
|
|
1190
|
-
!
|
|
1191
|
-
const
|
|
1192
|
-
for (const [
|
|
1193
|
-
|
|
1194
|
-
for (const [
|
|
1195
|
-
|
|
1196
|
-
const
|
|
1197
|
-
for (const [
|
|
1198
|
-
for (const [
|
|
1199
|
-
const
|
|
1200
|
-
if (
|
|
1201
|
-
|
|
1803
|
+
function hn(e, n) {
|
|
1804
|
+
const t = Ke(e, n), s = [...t.warnings], i = /* @__PURE__ */ new Map();
|
|
1805
|
+
let r = !1;
|
|
1806
|
+
const u = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), v = (o, a, f) => {
|
|
1807
|
+
const l = Ze(e, o, t, c);
|
|
1808
|
+
!r && l.some((m) => m.origin.kind === "builtin-theme") && (r = !0);
|
|
1809
|
+
const h = Qe(l), g = /* @__PURE__ */ new Map();
|
|
1810
|
+
for (const [m, y] of a)
|
|
1811
|
+
m.startsWith("--") && g.set(m, y.value);
|
|
1812
|
+
for (const [m, y] of h)
|
|
1813
|
+
m.startsWith("--") && g.set(m, y.value);
|
|
1814
|
+
const p = /* @__PURE__ */ new Map();
|
|
1815
|
+
for (const [m, y] of a) p.set(m, y);
|
|
1816
|
+
for (const [m, y] of h) {
|
|
1817
|
+
const k = fe(y.value, g);
|
|
1818
|
+
if (k === null) {
|
|
1819
|
+
s.push({
|
|
1202
1820
|
kind: "unsupported-property",
|
|
1203
|
-
message: `${
|
|
1204
|
-
node:
|
|
1821
|
+
message: `${m}: var() reference could not be resolved; declaration dropped`,
|
|
1822
|
+
node: f
|
|
1205
1823
|
});
|
|
1206
1824
|
continue;
|
|
1207
1825
|
}
|
|
1208
|
-
|
|
1826
|
+
p.set(m, { value: k, origin: y.origin });
|
|
1209
1827
|
}
|
|
1210
|
-
const
|
|
1211
|
-
for (const [
|
|
1212
|
-
|
|
1213
|
-
value:
|
|
1214
|
-
origin: { kind: "inherited", from:
|
|
1828
|
+
const b = /* @__PURE__ */ new Map();
|
|
1829
|
+
for (const [m, y] of p)
|
|
1830
|
+
Dt(m) && b.set(m, {
|
|
1831
|
+
value: y.value,
|
|
1832
|
+
origin: { kind: "inherited", from: f, origin: y.origin }
|
|
1215
1833
|
});
|
|
1216
|
-
return { computed:
|
|
1217
|
-
},
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1220
|
-
let
|
|
1221
|
-
const
|
|
1222
|
-
if (
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1225
|
-
const
|
|
1226
|
-
{ kind: "part", owner:
|
|
1227
|
-
|
|
1228
|
-
|
|
1834
|
+
return { computed: p, forChildren: b };
|
|
1835
|
+
}, d = (o, a) => {
|
|
1836
|
+
const f = v({ kind: "element", node: o }, a, o.id);
|
|
1837
|
+
i.set(o.id, f.computed);
|
|
1838
|
+
let l = f.forChildren;
|
|
1839
|
+
const h = H(o).spec.parts;
|
|
1840
|
+
if (h.length > 0) {
|
|
1841
|
+
const g = /* @__PURE__ */ new Map();
|
|
1842
|
+
h.forEach((p, b) => {
|
|
1843
|
+
const m = v(
|
|
1844
|
+
{ kind: "part", owner: o, name: p.name, depth: b },
|
|
1845
|
+
l,
|
|
1846
|
+
o.id
|
|
1229
1847
|
);
|
|
1230
|
-
|
|
1231
|
-
}),
|
|
1848
|
+
g.set(p.name, m.computed), l = m.forChildren;
|
|
1849
|
+
}), u.set(o.id, g);
|
|
1232
1850
|
}
|
|
1233
|
-
for (const
|
|
1851
|
+
for (const g of o.children) d(g, l);
|
|
1234
1852
|
};
|
|
1235
|
-
|
|
1853
|
+
d(e.root, /* @__PURE__ */ new Map()), r && s.push({
|
|
1236
1854
|
kind: "version-dependent",
|
|
1237
|
-
message: `Unity's control defaults were applied, as measured on ${
|
|
1855
|
+
message: `Unity's control defaults were applied, as measured on ${Z} (Unity ships these as a theme stylesheet). Other versions may use different values; see src/controls/theme.ts.`
|
|
1238
1856
|
});
|
|
1239
|
-
for (const
|
|
1240
|
-
if (
|
|
1241
|
-
const a =
|
|
1242
|
-
a.length !== 0 &&
|
|
1857
|
+
for (const o of t.usable) {
|
|
1858
|
+
if (o.builtin === !0 || c.has(o)) continue;
|
|
1859
|
+
const a = tn(o.rule.selectors);
|
|
1860
|
+
a.length !== 0 && s.push({
|
|
1243
1861
|
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:
|
|
1862
|
+
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 — ${Tt().join(", ")}. Anything else is drawn as a plain box and has no parts to style.`,
|
|
1863
|
+
at: { in: "uss", sheet: o.sheet, span: o.rule.selectorSpan },
|
|
1864
|
+
...de(e, o.sheet)
|
|
1246
1865
|
});
|
|
1247
1866
|
}
|
|
1248
|
-
return { styles:
|
|
1867
|
+
return { styles: i, partStyles: u, warnings: s };
|
|
1249
1868
|
}
|
|
1250
|
-
function
|
|
1251
|
-
const
|
|
1252
|
-
(
|
|
1869
|
+
function Sn(e, n, t, s) {
|
|
1870
|
+
const i = Ke(e, s), r = Ze(e, { kind: "element", node: n }, i).filter(
|
|
1871
|
+
(u) => u.property === t
|
|
1253
1872
|
);
|
|
1254
|
-
return
|
|
1873
|
+
return Qe(r), r;
|
|
1255
1874
|
}
|
|
1256
|
-
const
|
|
1875
|
+
const $n = [
|
|
1257
1876
|
{
|
|
1258
1877
|
id: "text-metrics",
|
|
1259
1878
|
kind: "unreproducible",
|
|
@@ -1273,358 +1892,226 @@ const _t = [
|
|
|
1273
1892
|
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
1893
|
}
|
|
1275
1894
|
];
|
|
1276
|
-
function
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
return e !== void 0 && /[A-Za-z_]/.test(e);
|
|
1281
|
-
}
|
|
1282
|
-
function Ct(e) {
|
|
1283
|
-
return e === " " || e === " " || e === `
|
|
1284
|
-
` || e === "\r";
|
|
1285
|
-
}
|
|
1286
|
-
function At(e) {
|
|
1287
|
-
const n = [];
|
|
1288
|
-
let t = 0, i = 0;
|
|
1289
|
-
const l = () => i++;
|
|
1290
|
-
function s(a, d, o) {
|
|
1291
|
-
n.push({
|
|
1292
|
-
kind: "malformed",
|
|
1293
|
-
message: a,
|
|
1294
|
-
at: { in: "uxml", span: { start: d, end: o } }
|
|
1295
|
-
});
|
|
1895
|
+
function mn(e, n) {
|
|
1896
|
+
const t = (d) => e.slice(d.start, d.end);
|
|
1897
|
+
function s(d) {
|
|
1898
|
+
return d.spans.closeTag !== null ? d.spans.closeTag.end : Math.max(d.spans.openTag.end, d.spans.inner.end);
|
|
1296
1899
|
}
|
|
1297
|
-
function
|
|
1298
|
-
|
|
1900
|
+
function i(d) {
|
|
1901
|
+
return d.includes('"') ? d.includes("'") ? `"${d.replace(/"/g, """)}"` : `'${d}'` : `"${d}"`;
|
|
1299
1902
|
}
|
|
1300
|
-
function
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
if (a < 0) {
|
|
1304
|
-
t = e.length;
|
|
1305
|
-
return;
|
|
1306
|
-
}
|
|
1307
|
-
const d = e[a + 1];
|
|
1308
|
-
if (d === "!") {
|
|
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;
|
|
1315
|
-
} else {
|
|
1316
|
-
const o = e.indexOf(">", a);
|
|
1317
|
-
t = o < 0 ? e.length : o + 1;
|
|
1318
|
-
}
|
|
1319
|
-
continue;
|
|
1320
|
-
}
|
|
1321
|
-
if (d === "?") {
|
|
1322
|
-
const o = e.indexOf("?>", a + 2);
|
|
1323
|
-
t = o < 0 ? e.length : o + 2;
|
|
1324
|
-
continue;
|
|
1325
|
-
}
|
|
1326
|
-
t = a;
|
|
1327
|
-
return;
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
function v() {
|
|
1331
|
-
const a = t;
|
|
1332
|
-
for (; we(e[t]); ) t++;
|
|
1333
|
-
const d = e.slice(a, t), o = d.indexOf(":");
|
|
1334
|
-
return o < 0 ? { prefix: null, local: d } : { prefix: d.slice(0, o), local: d.slice(o + 1) };
|
|
1335
|
-
}
|
|
1336
|
-
function u() {
|
|
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];
|
|
1345
|
-
if (f !== '"' && f !== "'")
|
|
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 } });
|
|
1903
|
+
function r(d) {
|
|
1904
|
+
const o = d.attributes.map((f) => ` ${f.name}=${i(f.value)}`).join(""), a = Ce(d.name);
|
|
1905
|
+
return d.spans.closeTag === null ? `<${a}${o} />` : `<${a}${o}>`;
|
|
1350
1906
|
}
|
|
1351
|
-
function
|
|
1352
|
-
|
|
1353
|
-
t
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
}
|
|
1363
|
-
if (y === ">") {
|
|
1364
|
-
t++;
|
|
1365
|
-
break;
|
|
1366
|
-
}
|
|
1367
|
-
if (y === "/" && e[t + 1] === ">") {
|
|
1368
|
-
t += 2, f = !0;
|
|
1369
|
-
break;
|
|
1370
|
-
}
|
|
1371
|
-
const b = u();
|
|
1372
|
-
if (b === null) {
|
|
1373
|
-
t++;
|
|
1374
|
-
continue;
|
|
1375
|
-
}
|
|
1376
|
-
o.push(b);
|
|
1377
|
-
}
|
|
1378
|
-
const w = { start: a, end: t };
|
|
1379
|
-
if (f)
|
|
1380
|
-
return {
|
|
1381
|
-
id: l(),
|
|
1382
|
-
name: d,
|
|
1383
|
-
attributes: o,
|
|
1384
|
-
children: [],
|
|
1385
|
-
spans: { openTag: w, inner: { start: t, end: t }, closeTag: null },
|
|
1386
|
-
tagDirty: !1,
|
|
1387
|
-
childrenDirty: !1
|
|
1388
|
-
};
|
|
1389
|
-
const c = t, S = [];
|
|
1390
|
-
for (; ; ) {
|
|
1391
|
-
if (g(), t >= e.length) {
|
|
1392
|
-
s(`unterminated element <${Ae(d)}>`, a, e.length);
|
|
1393
|
-
break;
|
|
1394
|
-
}
|
|
1395
|
-
const y = e[t + 1];
|
|
1396
|
-
if (y === "/") break;
|
|
1397
|
-
if (!be(y)) {
|
|
1398
|
-
t++;
|
|
1399
|
-
continue;
|
|
1400
|
-
}
|
|
1401
|
-
S.push(r());
|
|
1402
|
-
}
|
|
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;
|
|
1907
|
+
function u(d) {
|
|
1908
|
+
var l, h;
|
|
1909
|
+
const o = t(d.spans.inner), a = ((l = /^[ \t]*\r?\n[ \t]*/.exec(o)) == null ? void 0 : l[0]) ?? "", f = ((h = /\r?\n[ \t]*$/.exec(o)) == null ? void 0 : h[0]) ?? "";
|
|
1910
|
+
return { between: a, before: a, after: f };
|
|
1911
|
+
}
|
|
1912
|
+
function c(d) {
|
|
1913
|
+
const { inner: o } = d.spans;
|
|
1914
|
+
if (d.children.length === 0) return t(o);
|
|
1915
|
+
if (d.childrenDirty) {
|
|
1916
|
+
const { between: l, before: h, after: g } = u(d);
|
|
1917
|
+
return h + d.children.map(v).join(l) + g;
|
|
1408
1918
|
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
children: S,
|
|
1414
|
-
spans: { openTag: w, inner: { start: c, end: h }, closeTag: x },
|
|
1415
|
-
tagDirty: !1,
|
|
1416
|
-
childrenDirty: !1
|
|
1417
|
-
};
|
|
1919
|
+
let a = "", f = o.start;
|
|
1920
|
+
for (const l of d.children)
|
|
1921
|
+
a += e.slice(f, l.spans.openTag.start), a += v(l), f = s(l);
|
|
1922
|
+
return a + e.slice(f, o.end);
|
|
1418
1923
|
}
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
children: [],
|
|
1425
|
-
spans: { openTag: { start: 0, end: 0 }, inner: { start: 0, end: 0 }, closeTag: null },
|
|
1426
|
-
tagDirty: !1,
|
|
1427
|
-
childrenDirty: !1
|
|
1428
|
-
},
|
|
1429
|
-
warnings: n
|
|
1430
|
-
});
|
|
1431
|
-
}
|
|
1432
|
-
function Ae(e) {
|
|
1433
|
-
return e.prefix === null ? e.local : `${e.prefix}:${e.local}`;
|
|
1924
|
+
function v(d) {
|
|
1925
|
+
const o = d.tagDirty ? r(d) : t(d.spans.openTag), a = d.spans.closeTag === null ? "" : t(d.spans.closeTag);
|
|
1926
|
+
return o + c(d) + a;
|
|
1927
|
+
}
|
|
1928
|
+
return e.slice(0, n.spans.openTag.start) + v(n) + e.slice(s(n));
|
|
1434
1929
|
}
|
|
1435
|
-
function
|
|
1436
|
-
const t = (
|
|
1437
|
-
function
|
|
1438
|
-
return
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
return u.includes('"') ? u.includes("'") ? `"${u.replace(/"/g, """)}"` : `'${u}'` : `"${u}"`;
|
|
1442
|
-
}
|
|
1443
|
-
function s(u) {
|
|
1444
|
-
const r = u.attributes.map((d) => ` ${d.name}=${l(d.value)}`).join(""), a = Ae(u.name);
|
|
1445
|
-
return u.spans.closeTag === null ? `<${a}${r} />` : `<${a}${r}>`;
|
|
1446
|
-
}
|
|
1447
|
-
function m(u) {
|
|
1448
|
-
var o, f;
|
|
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]) ?? "";
|
|
1450
|
-
return { between: a, before: a, after: d };
|
|
1451
|
-
}
|
|
1452
|
-
function g(u) {
|
|
1453
|
-
const { inner: r } = u.spans;
|
|
1454
|
-
if (u.children.length === 0) return t(r);
|
|
1455
|
-
if (u.childrenDirty) {
|
|
1456
|
-
const { between: o, before: f, after: w } = m(u);
|
|
1457
|
-
return f + u.children.map(v).join(o) + w;
|
|
1458
|
-
}
|
|
1459
|
-
let a = "", d = r.start;
|
|
1460
|
-
for (const o of u.children)
|
|
1461
|
-
a += e.slice(d, o.spans.openTag.start), a += v(o), d = i(o);
|
|
1462
|
-
return a + e.slice(d, r.end);
|
|
1463
|
-
}
|
|
1464
|
-
function v(u) {
|
|
1465
|
-
const r = u.tagDirty ? s(u) : t(u.spans.openTag), a = u.spans.closeTag === null ? "" : t(u.spans.closeTag);
|
|
1466
|
-
return r + g(u) + a;
|
|
1467
|
-
}
|
|
1468
|
-
return e.slice(0, n.spans.openTag.start) + v(n) + e.slice(i(n));
|
|
1469
|
-
}
|
|
1470
|
-
function Mt(e) {
|
|
1471
|
-
const n = e.source, t = (r) => n.slice(r.start, r.end);
|
|
1472
|
-
function i(r) {
|
|
1473
|
-
return r.parts.map((a, d) => {
|
|
1474
|
-
const o = d === 0 ? "" : a.combinator === "child" ? " > " : " ", f = a.simple.map((w) => {
|
|
1475
|
-
switch (w.kind) {
|
|
1930
|
+
function gn(e) {
|
|
1931
|
+
const n = e.source, t = (o) => n.slice(o.start, o.end);
|
|
1932
|
+
function s(o) {
|
|
1933
|
+
return o.parts.map((a, f) => {
|
|
1934
|
+
const l = f === 0 ? "" : a.combinator === "child" ? " > " : " ", h = a.simple.map((g) => {
|
|
1935
|
+
switch (g.kind) {
|
|
1476
1936
|
case "universal":
|
|
1477
1937
|
return "*";
|
|
1478
1938
|
case "type":
|
|
1479
|
-
return
|
|
1939
|
+
return g.name;
|
|
1480
1940
|
case "class":
|
|
1481
|
-
return `.${
|
|
1941
|
+
return `.${g.name}`;
|
|
1482
1942
|
case "name":
|
|
1483
|
-
return `#${
|
|
1943
|
+
return `#${g.name}`;
|
|
1484
1944
|
case "pseudo":
|
|
1485
|
-
return `:${
|
|
1945
|
+
return `:${g.name}`;
|
|
1486
1946
|
case "unknown":
|
|
1487
|
-
return
|
|
1947
|
+
return g.text;
|
|
1488
1948
|
}
|
|
1489
1949
|
}).join("");
|
|
1490
|
-
return
|
|
1950
|
+
return l + h;
|
|
1491
1951
|
}).join("");
|
|
1492
1952
|
}
|
|
1493
|
-
function
|
|
1494
|
-
var
|
|
1495
|
-
const a =
|
|
1953
|
+
function i(o) {
|
|
1954
|
+
var p, b;
|
|
1955
|
+
const a = o.declarations[0];
|
|
1496
1956
|
if (a === void 0) return { between: "", before: "", after: "" };
|
|
1497
|
-
const
|
|
1498
|
-
`, a.span.start),
|
|
1499
|
-
return { between: `;${
|
|
1500
|
-
}
|
|
1501
|
-
function
|
|
1502
|
-
const a =
|
|
1503
|
-
if (
|
|
1504
|
-
return a + n.slice(
|
|
1505
|
-
const
|
|
1506
|
-
if (
|
|
1507
|
-
const { between:
|
|
1508
|
-
return `${a}${
|
|
1957
|
+
const f = n.lastIndexOf(`
|
|
1958
|
+
`, a.span.start), l = f < 0 ? "" : n.slice(f, a.span.start), h = n.slice(o.selectorSpan.end, o.span.end), g = ((b = (p = /\r?\n[ \t]*\}$/.exec(h)) == null ? void 0 : p[0]) == null ? void 0 : b.replace(/\}$/, "")) ?? "";
|
|
1959
|
+
return { between: `;${l}`, before: l, after: `;${g}` };
|
|
1960
|
+
}
|
|
1961
|
+
function r(o) {
|
|
1962
|
+
const a = o.selectorDirty ? o.selectors.map(s).join(", ") : t(o.selectorSpan);
|
|
1963
|
+
if (o.declarations.length === 0)
|
|
1964
|
+
return a + n.slice(o.selectorSpan.end, o.span.end);
|
|
1965
|
+
const f = n.slice(o.selectorSpan.end, o.declarations[0].span.start);
|
|
1966
|
+
if (o.declarationsDirty) {
|
|
1967
|
+
const { between: g, before: p, after: b } = i(o), m = f.slice(0, f.indexOf("{") + 1), y = o.declarations.map(u).join(g);
|
|
1968
|
+
return `${a}${m}${p}${y}${b}}`;
|
|
1509
1969
|
}
|
|
1510
|
-
let
|
|
1511
|
-
for (const
|
|
1512
|
-
|
|
1513
|
-
return
|
|
1970
|
+
let l = a, h = o.selectorSpan.end;
|
|
1971
|
+
for (const g of o.declarations)
|
|
1972
|
+
l += n.slice(h, g.span.start), l += u(g), h = g.span.end;
|
|
1973
|
+
return l + n.slice(h, o.span.end);
|
|
1514
1974
|
}
|
|
1515
|
-
function
|
|
1516
|
-
return
|
|
1975
|
+
function u(o) {
|
|
1976
|
+
return o.dirty ? `${o.property}: ${o.value}` : t(o.span);
|
|
1517
1977
|
}
|
|
1518
|
-
function
|
|
1519
|
-
return
|
|
1978
|
+
function c(o) {
|
|
1979
|
+
return o.kind === "rule" ? r(o.rule) : t(o.span);
|
|
1520
1980
|
}
|
|
1521
|
-
let v = "",
|
|
1522
|
-
for (const
|
|
1523
|
-
const a =
|
|
1524
|
-
v += n.slice(
|
|
1981
|
+
let v = "", d = 0;
|
|
1982
|
+
for (const o of e.items) {
|
|
1983
|
+
const a = o.kind === "rule" ? o.rule.span : o.span;
|
|
1984
|
+
v += n.slice(d, a.start), v += c(o), d = a.end;
|
|
1525
1985
|
}
|
|
1526
|
-
return v + n.slice(
|
|
1986
|
+
return v + n.slice(d);
|
|
1527
1987
|
}
|
|
1528
|
-
|
|
1988
|
+
ot(
|
|
1989
|
+
(e, n) => n === void 0 ? Ie(e) : Ie(e, void 0, { resolveImport: n })
|
|
1990
|
+
);
|
|
1991
|
+
function et(e, n = []) {
|
|
1529
1992
|
var t;
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1993
|
+
for (const s of e.children) {
|
|
1994
|
+
if (s.name.local === "Style") {
|
|
1995
|
+
const i = (t = s.attributes.find((r) => r.name === "src")) == null ? void 0 : t.value;
|
|
1996
|
+
i !== void 0 && i.length > 0 && n.push({ url: J(i), scope: e.id });
|
|
1997
|
+
}
|
|
1998
|
+
et(s, n);
|
|
1533
1999
|
}
|
|
1534
|
-
for (const i of e.children) Ie(i, n);
|
|
1535
2000
|
return n;
|
|
1536
2001
|
}
|
|
1537
|
-
function
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
2002
|
+
function wn(e) {
|
|
2003
|
+
return e.startsWith("project://") || e.startsWith("/");
|
|
2004
|
+
}
|
|
2005
|
+
function Ie(e, n, t) {
|
|
2006
|
+
var d, o;
|
|
2007
|
+
const s = Re(e), i = [...s.warnings], r = [], u = [], c = [];
|
|
2008
|
+
for (const { url: a, scope: f } of et(s.root)) {
|
|
2009
|
+
const l = ((d = t == null ? void 0 : t.resolveImport) == null ? void 0 : d.call(t, a, null)) ?? null;
|
|
2010
|
+
if (l === null) {
|
|
2011
|
+
i.push({
|
|
1544
2012
|
kind: "import-unresolved",
|
|
1545
|
-
message: (t == null ? void 0 : t.resolveImport) === void 0 ? `<Style src="${
|
|
1546
|
-
node:
|
|
2013
|
+
message: (t == null ? void 0 : t.resolveImport) === void 0 ? `<Style src="${a}"> was not loaded: pass resolveImport to read it, or pass the stylesheet text directly. Until then this document renders unstyled.` : `<Style src="${a}"> could not be resolved`,
|
|
2014
|
+
node: s.root.id
|
|
1547
2015
|
});
|
|
1548
2016
|
continue;
|
|
1549
2017
|
}
|
|
1550
|
-
|
|
1551
|
-
}
|
|
1552
|
-
if (n !== void 0 ||
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
2018
|
+
c.push({ text: l, origin: a, scope: f });
|
|
2019
|
+
}
|
|
2020
|
+
if (n !== void 0 || c.length > 0) {
|
|
2021
|
+
const a = /* @__PURE__ */ new Map(), f = [];
|
|
2022
|
+
let l = 0;
|
|
2023
|
+
for (const h of c) {
|
|
2024
|
+
const g = l++;
|
|
2025
|
+
f.push({ text: h.text, origin: h.origin, sheet: g }), u.push({ sheet: g, scope: h.scope });
|
|
2026
|
+
}
|
|
2027
|
+
if (n !== void 0) {
|
|
2028
|
+
const h = l++;
|
|
2029
|
+
f.push({ text: n, origin: null, sheet: h }), u.push({ sheet: h, scope: s.root.id });
|
|
2030
|
+
}
|
|
2031
|
+
for (; f.length > 0; ) {
|
|
2032
|
+
const h = f.shift(), g = h.sheet, p = ge(h.text, h.origin, g);
|
|
2033
|
+
r.push(p.sheet), i.push(...p.warnings);
|
|
2034
|
+
for (const b of p.sheet.items) {
|
|
2035
|
+
if (b.kind !== "import") continue;
|
|
2036
|
+
const m = wn(b.url) ? b.url : JSON.stringify([b.url, h.origin]);
|
|
2037
|
+
if (a.has(m)) {
|
|
2038
|
+
const x = a.get(m);
|
|
2039
|
+
x != null && (b.resolvedSheet = x);
|
|
2040
|
+
continue;
|
|
2041
|
+
}
|
|
2042
|
+
a.set(m, null);
|
|
2043
|
+
const y = ((o = t == null ? void 0 : t.resolveImport) == null ? void 0 : o.call(t, b.url, h.origin)) ?? null;
|
|
2044
|
+
if (y === null) {
|
|
2045
|
+
i.push({
|
|
1566
2046
|
kind: "import-unresolved",
|
|
1567
|
-
message: (t == null ? void 0 : t.resolveImport) === void 0 ? `@import "${
|
|
1568
|
-
at: { in: "uss", sheet:
|
|
2047
|
+
message: (t == null ? void 0 : t.resolveImport) === void 0 ? `@import "${b.url}" was not loaded: pass resolveImport to read it` : `@import "${b.url}" could not be resolved`,
|
|
2048
|
+
at: { in: "uss", sheet: g, span: b.span }
|
|
1569
2049
|
});
|
|
1570
2050
|
continue;
|
|
1571
2051
|
}
|
|
1572
|
-
|
|
2052
|
+
const k = l++;
|
|
2053
|
+
a.set(m, k), b.resolvedSheet = k, f.push({ text: y, origin: b.url, sheet: k });
|
|
1573
2054
|
}
|
|
1574
2055
|
}
|
|
1575
2056
|
}
|
|
1576
|
-
|
|
2057
|
+
const v = { source: e, root: s.root, sheets: r, styleRoots: u, warnings: i };
|
|
2058
|
+
return lt(v, t == null ? void 0 : t.resolveImport), v;
|
|
1577
2059
|
}
|
|
1578
|
-
function
|
|
2060
|
+
function Tn(e) {
|
|
1579
2061
|
const n = e.sheets[0];
|
|
1580
2062
|
return {
|
|
1581
|
-
uxml:
|
|
2063
|
+
uxml: mn(e.source, e.root),
|
|
1582
2064
|
// Only the sheet passed to `parse` round-trips. `@import`ed sheets (Phase 3)
|
|
1583
2065
|
// are separate files and are not this function's to write.
|
|
1584
|
-
uss: n === void 0 ? "" :
|
|
2066
|
+
uss: n === void 0 ? "" : gn(n)
|
|
1585
2067
|
};
|
|
1586
2068
|
}
|
|
1587
|
-
function
|
|
1588
|
-
const
|
|
2069
|
+
function On(e, n, t) {
|
|
2070
|
+
const s = n.ownerDocument, i = (t == null ? void 0 : t.size) ?? {
|
|
1589
2071
|
width: n.clientWidth,
|
|
1590
2072
|
height: n.clientHeight
|
|
1591
|
-
},
|
|
2073
|
+
}, r = bt(e), u = r.document, c = hn(u, {
|
|
1592
2074
|
...(t == null ? void 0 : t.activeStates) === void 0 ? {} : { activeStates: t.activeStates },
|
|
1593
2075
|
...(t == null ? void 0 : t.states) === void 0 ? {} : { states: t.states }
|
|
1594
|
-
}),
|
|
1595
|
-
|
|
2076
|
+
}), v = (t == null ? void 0 : t.measureText) ?? jt(s), d = zt(u.root, c.styles, c.partStyles, {
|
|
2077
|
+
size: i,
|
|
2078
|
+
measureText: v
|
|
2079
|
+
});
|
|
2080
|
+
let o;
|
|
1596
2081
|
try {
|
|
1597
|
-
|
|
1598
|
-
document:
|
|
2082
|
+
o = Yt(u.root, d.boxes, d.parts, c.styles, n, {
|
|
2083
|
+
document: s,
|
|
1599
2084
|
resolveAsset: t == null ? void 0 : t.resolveAsset
|
|
1600
2085
|
});
|
|
1601
|
-
} catch (
|
|
1602
|
-
throw
|
|
2086
|
+
} catch (f) {
|
|
2087
|
+
throw d.dispose(), f;
|
|
1603
2088
|
}
|
|
1604
|
-
let
|
|
2089
|
+
let a = !1;
|
|
1605
2090
|
return {
|
|
1606
|
-
warnings: [...
|
|
1607
|
-
elements:
|
|
1608
|
-
boxes:
|
|
2091
|
+
warnings: [...r.warnings, ...c.warnings, ...d.warnings, ...o.warnings],
|
|
2092
|
+
elements: o.elements,
|
|
2093
|
+
boxes: d.boxes,
|
|
1609
2094
|
dispose() {
|
|
1610
|
-
|
|
2095
|
+
a || (a = !0, d.dispose(), n.replaceChildren());
|
|
1611
2096
|
}
|
|
1612
2097
|
};
|
|
1613
2098
|
}
|
|
1614
2099
|
export {
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
2100
|
+
$n as KNOWN_DIVERGENCES,
|
|
2101
|
+
Gt as NODE_ATTRIBUTE,
|
|
2102
|
+
Jt as PART_ATTRIBUTE,
|
|
2103
|
+
Xt as PART_OWNER_ATTRIBUTE,
|
|
2104
|
+
bn as collectDependencies,
|
|
2105
|
+
jt as createDefaultMeasureText,
|
|
2106
|
+
bt as expandTemplates,
|
|
2107
|
+
Sn as explainProperty,
|
|
2108
|
+
Dt as isInherited,
|
|
2109
|
+
xn as isLayoutEngineReady,
|
|
2110
|
+
kn as liveNodeCount,
|
|
2111
|
+
yn as loadLayoutEngine,
|
|
2112
|
+
Ie as parse,
|
|
2113
|
+
On as render,
|
|
2114
|
+
hn as resolveStyles,
|
|
2115
|
+
Tn as serialize,
|
|
2116
|
+
Tt as supportedControlNames
|
|
1630
2117
|
};
|