uxml-preview 0.4.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 +70 -0
- package/README.md +104 -6
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1451 -993
- package/dist/model/types.d.ts +32 -1
- package/dist/template/expand.d.ts +26 -0
- package/package.json +4 -2
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 ve = {
|
|
|
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", ye = `: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
|
-
}, Je = {
|
|
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
|
|
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
|
|
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 w
|
|
273
|
-
|
|
274
|
-
const N =
|
|
275
|
-
(N === "fixed" || N === "sticky") &&
|
|
276
|
-
N === "absolute" ?
|
|
277
|
-
),
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
for (const [
|
|
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
871
|
const x = ["text", "label"];
|
|
291
|
-
function $(
|
|
872
|
+
function $(w) {
|
|
292
873
|
return x.filter(
|
|
293
|
-
(
|
|
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:
|
|
301
|
-
if (
|
|
302
|
-
const R = $(
|
|
303
|
-
|
|
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;
|
|
882
|
+
if (A) {
|
|
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 R =
|
|
895
|
+
const R = p(T, "font-size", w), z = {
|
|
315
896
|
fontSize: R !== null && R.kind === "px" ? R.value : 12,
|
|
316
|
-
fontStyle:
|
|
317
|
-
whiteSpace:
|
|
897
|
+
fontStyle: h(T, "-unity-font-style") || "normal",
|
|
898
|
+
whiteSpace: h(T, "white-space") || "normal"
|
|
318
899
|
};
|
|
319
900
|
N.setMeasureFunc(
|
|
320
|
-
(
|
|
321
|
-
|
|
901
|
+
(M) => s.measureText(
|
|
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 R = [], z = [],
|
|
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 R of
|
|
928
|
+
for (const R of w.children) O(R, F);
|
|
348
929
|
}
|
|
349
930
|
O(e, null);
|
|
350
931
|
const E = d.get(e);
|
|
351
|
-
E.setWidth(
|
|
352
|
-
const
|
|
353
|
-
for (let
|
|
354
|
-
let
|
|
355
|
-
for (const [T, N] of
|
|
356
|
-
const
|
|
357
|
-
if (
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
const _ =
|
|
361
|
-
(
|
|
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");
|
|
940
|
+
if (A === -1 || I === -1) continue;
|
|
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 = d.get(
|
|
947
|
+
function L(w, S, T) {
|
|
948
|
+
const N = d.get(w);
|
|
368
949
|
if (N === void 0) return;
|
|
369
|
-
const
|
|
370
|
-
let
|
|
371
|
-
|
|
372
|
-
const _ =
|
|
373
|
-
_ !== void 0 &&
|
|
374
|
-
const
|
|
375
|
-
|
|
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 R of
|
|
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 d =
|
|
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(
|
|
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,269 +1071,269 @@ function ge(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
|
-
|
|
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);
|
|
529
1106
|
}
|
|
530
|
-
const d =
|
|
1107
|
+
const d = r("-unity-text-align");
|
|
531
1108
|
if (d !== void 0) {
|
|
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
|
-
|
|
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: ${x} is not a USS value; expected one of ${Object.keys(
|
|
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:
|
|
567
|
-
}
|
|
568
|
-
const
|
|
569
|
-
function
|
|
570
|
-
const
|
|
571
|
-
function v(
|
|
572
|
-
const
|
|
573
|
-
var
|
|
574
|
-
const
|
|
575
|
-
return
|
|
1143
|
+
), { declarations: s, warnings: i };
|
|
1144
|
+
}
|
|
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 d(
|
|
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 [
|
|
626
|
-
T.style.setProperty(
|
|
627
|
-
|
|
1202
|
+
for (const [A, I] of Object.entries(D))
|
|
1203
|
+
T.style.setProperty(A, I);
|
|
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(
|
|
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(),
|
|
699
1276
|
value: e.slice(d.start, d.end),
|
|
700
|
-
span: { start:
|
|
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
|
|
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 x = e[
|
|
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];
|
|
736
1313
|
if (x === '"' || x === "'") {
|
|
737
|
-
const $ = e.indexOf(x,
|
|
738
|
-
|
|
1314
|
+
const $ = e.indexOf(x, y + 1);
|
|
1315
|
+
y = $ < 0 ? e.length : $ + 1;
|
|
739
1316
|
continue;
|
|
740
1317
|
}
|
|
741
|
-
if (x === "/" && e[
|
|
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 (x === "{")
|
|
747
|
-
else if (x === "}" && --
|
|
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 x =
|
|
1334
|
+
function f(m) {
|
|
1335
|
+
const y = e[m], k = y === "(" ? ")" : "]";
|
|
1336
|
+
let x = m + 1, $ = 1;
|
|
760
1337
|
for (; x < e.length; ) {
|
|
761
1338
|
const O = e[x];
|
|
762
1339
|
if (O === '"' || O === "'") {
|
|
@@ -764,118 +1341,118 @@ function oe(e, n = null, t = 0) {
|
|
|
764
1341
|
x = E < 0 ? e.length : E + 1;
|
|
765
1342
|
continue;
|
|
766
1343
|
}
|
|
767
|
-
if (O ===
|
|
768
|
-
else if (O ===
|
|
1344
|
+
if (O === y) $++;
|
|
1345
|
+
else if (O === k && --$ === 0) return x + 1;
|
|
769
1346
|
x++;
|
|
770
1347
|
}
|
|
771
1348
|
return e.length;
|
|
772
1349
|
}
|
|
773
|
-
function
|
|
774
|
-
const
|
|
775
|
-
let x =
|
|
776
|
-
for (; x <
|
|
1350
|
+
function l(m, y) {
|
|
1351
|
+
const k = [];
|
|
1352
|
+
let x = m;
|
|
1353
|
+
for (; x < y; ) {
|
|
777
1354
|
const $ = e[x];
|
|
778
1355
|
if (B($) || $ === ">" || $ === "+" || $ === "~" || $ === ",") break;
|
|
779
1356
|
if ($ === "*")
|
|
780
|
-
|
|
1357
|
+
k.push({ kind: "universal" }), x++;
|
|
781
1358
|
else if ($ === "." || $ === "#") {
|
|
782
1359
|
const O = a(x + 1);
|
|
783
|
-
|
|
1360
|
+
k.push(
|
|
784
1361
|
$ === "." ? { kind: "class", name: e.slice(x + 1, O) } : { kind: "name", name: e.slice(x + 1, O) }
|
|
785
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
1367
|
if (e[x + 1] === ":") {
|
|
791
1368
|
const O = a(x + 2);
|
|
792
|
-
|
|
1369
|
+
k.push({ kind: "unknown", text: e.slice(x, O) }), x = O;
|
|
793
1370
|
} else {
|
|
794
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 (
|
|
1378
|
+
else if (Ae.test($)) {
|
|
802
1379
|
const O = a(x);
|
|
803
|
-
|
|
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: x, span:
|
|
1410
|
+
return { parts: x, span: k };
|
|
834
1411
|
}
|
|
835
|
-
function
|
|
836
|
-
const
|
|
837
|
-
let x =
|
|
1412
|
+
function g(m, y) {
|
|
1413
|
+
const k = [];
|
|
1414
|
+
let x = m;
|
|
838
1415
|
for (; ; ) {
|
|
839
|
-
const $ = Math.min(v(x, ","),
|
|
840
|
-
if (
|
|
1416
|
+
const $ = Math.min(v(x, ","), y);
|
|
1417
|
+
if (k.push(h(x, $)), $ >= y) break;
|
|
841
1418
|
x = $ + 1;
|
|
842
1419
|
}
|
|
843
|
-
return
|
|
1420
|
+
return k;
|
|
844
1421
|
}
|
|
845
|
-
function
|
|
846
|
-
const
|
|
1422
|
+
function p() {
|
|
1423
|
+
const m = r, y = a(r + 1), k = e.slice(r + 1, y), x = v(y, "{;");
|
|
847
1424
|
if (x < e.length && e[x] === "{") {
|
|
848
|
-
const O =
|
|
849
|
-
return
|
|
1425
|
+
const O = o(x);
|
|
1426
|
+
return r = O, { kind: "unknown", span: { start: m, end: O } };
|
|
850
1427
|
}
|
|
851
1428
|
const $ = x < e.length ? x + 1 : e.length;
|
|
852
|
-
if (
|
|
853
|
-
const O = e.slice(
|
|
854
|
-
return E === null ? (
|
|
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
|
-
(x > e.length || e[x - 1] !== "}") &&
|
|
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,88 +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
|
|
970
|
-
}
|
|
971
|
-
function
|
|
972
|
-
const
|
|
973
|
-
for (const [
|
|
974
|
-
const
|
|
975
|
-
if (
|
|
976
|
-
|
|
1545
|
+
function ln(e) {
|
|
1546
|
+
return Ve.slice(e.selectorSpan.start, e.selectorSpan.end).trim();
|
|
1547
|
+
}
|
|
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 d(e.root, !1),
|
|
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
|
-
const v =
|
|
1002
|
-
if (v.has(
|
|
1003
|
-
v.add(
|
|
1004
|
-
const d = e.sheets[
|
|
1005
|
-
d !== void 0 && d.items.forEach((
|
|
1006
|
-
if (
|
|
1007
|
-
n.push({ rule:
|
|
1008
|
-
else if (
|
|
1009
|
-
const
|
|
1010
|
-
|
|
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);
|
|
1011
1588
|
}
|
|
1012
1589
|
});
|
|
1013
|
-
},
|
|
1014
|
-
for (const
|
|
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);
|
|
1015
1592
|
return n;
|
|
1016
1593
|
}
|
|
1017
|
-
function
|
|
1018
|
-
let
|
|
1019
|
-
for (;
|
|
1020
|
-
if (
|
|
1021
|
-
|
|
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);
|
|
1022
1599
|
}
|
|
1023
1600
|
return !1;
|
|
1024
1601
|
}
|
|
1025
|
-
function
|
|
1602
|
+
function dn(e) {
|
|
1026
1603
|
return e.selectors.some(
|
|
1027
|
-
(n) => n.parts.some((t) => t.simple.some((
|
|
1604
|
+
(n) => n.parts.some((t) => t.simple.some((s) => s.kind === "pseudo" && s.name === "root"))
|
|
1028
1605
|
);
|
|
1029
1606
|
}
|
|
1030
|
-
function
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
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 = {
|
|
1039
1621
|
/**
|
|
1040
1622
|
* The rule the measurement forced.
|
|
1041
1623
|
*
|
|
@@ -1046,225 +1628,251 @@ function Ee(e, n) {
|
|
|
1046
1628
|
* owner. That is the hierarchy the dumps show, so descendant selectors like
|
|
1047
1629
|
* `.panel #unity-content-viewport` behave as they do in Unity.
|
|
1048
1630
|
*/
|
|
1049
|
-
parentOf: (
|
|
1050
|
-
if (
|
|
1051
|
-
const
|
|
1052
|
-
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 };
|
|
1053
1635
|
}
|
|
1054
|
-
if (
|
|
1055
|
-
const
|
|
1056
|
-
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 };
|
|
1057
1639
|
},
|
|
1058
|
-
isRoot: (
|
|
1640
|
+
isRoot: (l) => l.kind === "element" && l.node === e.root,
|
|
1059
1641
|
// Unity's parts are VisualElements, so a `VisualElement` rule reaches them.
|
|
1060
1642
|
// Not measured — `part-type-selector` is the case that will settle it.
|
|
1061
|
-
typeNameOf: (
|
|
1062
|
-
idOf: (
|
|
1643
|
+
typeNameOf: (l) => l.kind === "element" ? l.node.name.local : "VisualElement",
|
|
1644
|
+
idOf: (l) => l.kind === "element" ? u(l.node, "name") : l.name,
|
|
1063
1645
|
// Implicit classes are as real as written ones for matching: in Unity the
|
|
1064
1646
|
// element genuinely carries them, which is why `.unity-button` in author USS
|
|
1065
1647
|
// hits a plain `<ui:Button />`. Parts carry classes too in Unity, but which
|
|
1066
1648
|
// ones is unmeasured, so none are claimed here.
|
|
1067
|
-
classesOf: (
|
|
1068
|
-
}, v = { ...
|
|
1069
|
-
...
|
|
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,
|
|
1070
1652
|
// A part inherits its owner's states: `SetEnabled(false)` disables the whole
|
|
1071
1653
|
// subtree, and a part is inside it.
|
|
1072
|
-
statesOf: (
|
|
1654
|
+
statesOf: (l) => d.get(l.kind === "element" ? l.node : l.owner) ?? i
|
|
1073
1655
|
}, a = [];
|
|
1074
|
-
let
|
|
1075
|
-
for (const
|
|
1076
|
-
if (
|
|
1077
|
-
a.push(
|
|
1656
|
+
let f = !1;
|
|
1657
|
+
for (const l of cn(e)) {
|
|
1658
|
+
if (l.builtin === !0) {
|
|
1659
|
+
a.push(l);
|
|
1078
1660
|
continue;
|
|
1079
1661
|
}
|
|
1080
|
-
const
|
|
1081
|
-
if (
|
|
1082
|
-
|
|
1662
|
+
const h = Xe(l.rule.selectors);
|
|
1663
|
+
if (h !== null) {
|
|
1664
|
+
s.push({
|
|
1083
1665
|
kind: "unsupported-selector",
|
|
1084
|
-
message: `"${
|
|
1085
|
-
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)
|
|
1086
1669
|
});
|
|
1087
1670
|
continue;
|
|
1088
1671
|
}
|
|
1089
|
-
!
|
|
1672
|
+
!f && dn(l.rule) && (f = !0, s.push({
|
|
1090
1673
|
kind: "version-dependent",
|
|
1091
|
-
message: ":root in USS names the element the stylesheet was applied to, not the document root as in CSS.
|
|
1092
|
-
at: { in: "uss", sheet:
|
|
1093
|
-
|
|
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);
|
|
1094
1678
|
}
|
|
1095
|
-
return { ctx:
|
|
1679
|
+
return { ctx: o, usable: a, warnings: s };
|
|
1096
1680
|
}
|
|
1097
|
-
function
|
|
1098
|
-
const t = n.attributes.find((
|
|
1681
|
+
function fn(e, n) {
|
|
1682
|
+
const t = n.attributes.find((i) => i.name === "style");
|
|
1099
1683
|
if (t === void 0) return [];
|
|
1100
|
-
const
|
|
1101
|
-
return
|
|
1102
|
-
}
|
|
1103
|
-
function
|
|
1104
|
-
const
|
|
1105
|
-
let
|
|
1106
|
-
const
|
|
1107
|
-
|
|
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 });
|
|
1108
1692
|
};
|
|
1109
1693
|
if (n.kind === "part") {
|
|
1110
|
-
const
|
|
1111
|
-
for (const [v, d] of Object.entries((
|
|
1112
|
-
for (const [
|
|
1113
|
-
|
|
1114
|
-
|
|
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,
|
|
1115
1699
|
a,
|
|
1116
1700
|
{
|
|
1117
1701
|
kind: "builtin-theme",
|
|
1118
1702
|
selector: `#${n.name}`,
|
|
1119
|
-
property:
|
|
1120
|
-
unityVersion:
|
|
1703
|
+
property: o,
|
|
1704
|
+
unityVersion: Z
|
|
1121
1705
|
},
|
|
1122
1706
|
0,
|
|
1123
1707
|
[0, 0, 0]
|
|
1124
1708
|
);
|
|
1125
1709
|
}
|
|
1126
|
-
for (const
|
|
1127
|
-
if (
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
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));
|
|
1133
1724
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
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 ? {
|
|
1137
1729
|
kind: "builtin-theme",
|
|
1138
|
-
selector:
|
|
1139
|
-
property:
|
|
1140
|
-
unityVersion:
|
|
1730
|
+
selector: ln(c.rule),
|
|
1731
|
+
property: p,
|
|
1732
|
+
unityVersion: Z
|
|
1141
1733
|
} : {
|
|
1142
1734
|
kind: "rule",
|
|
1143
|
-
sheet:
|
|
1144
|
-
item:
|
|
1145
|
-
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 },
|
|
1146
1740
|
// Omitted rather than set to [] when unconditional, so the
|
|
1147
1741
|
// common case stays the shape it has always been.
|
|
1148
|
-
...
|
|
1742
|
+
...o.length > 0 ? { states: o } : {}
|
|
1149
1743
|
};
|
|
1150
|
-
p
|
|
1744
|
+
u(p, b, m, c.builtin === !0 ? 0 : 1, d);
|
|
1151
1745
|
}
|
|
1152
1746
|
}));
|
|
1153
1747
|
}
|
|
1154
1748
|
if (n.kind === "element") {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
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
|
+
);
|
|
1159
1766
|
});
|
|
1160
1767
|
}
|
|
1161
|
-
return
|
|
1768
|
+
return i;
|
|
1162
1769
|
}
|
|
1163
|
-
function
|
|
1770
|
+
function Qe(e) {
|
|
1164
1771
|
const n = /* @__PURE__ */ new Map();
|
|
1165
1772
|
for (const t of e) {
|
|
1166
|
-
const
|
|
1167
|
-
if (
|
|
1773
|
+
const s = n.get(t.property);
|
|
1774
|
+
if (s === void 0) {
|
|
1168
1775
|
n.set(t.property, t);
|
|
1169
1776
|
continue;
|
|
1170
1777
|
}
|
|
1171
|
-
if (t.rank !==
|
|
1172
|
-
t.rank >
|
|
1778
|
+
if (t.rank !== s.rank) {
|
|
1779
|
+
t.rank > s.rank && n.set(t.property, t);
|
|
1173
1780
|
continue;
|
|
1174
1781
|
}
|
|
1175
|
-
const
|
|
1176
|
-
(
|
|
1782
|
+
const i = Ye(t.specificity, s.specificity);
|
|
1783
|
+
(i > 0 || i === 0 && t.order > s.order) && n.set(t.property, t);
|
|
1177
1784
|
}
|
|
1178
1785
|
for (const t of n.values()) t.winner = !0;
|
|
1179
1786
|
return n;
|
|
1180
1787
|
}
|
|
1181
|
-
const
|
|
1182
|
-
function
|
|
1183
|
-
var
|
|
1184
|
-
let
|
|
1185
|
-
for (let
|
|
1186
|
-
const
|
|
1187
|
-
if (
|
|
1188
|
-
const
|
|
1189
|
-
if (t.has(
|
|
1190
|
-
const d = /* @__PURE__ */ new Set([...t,
|
|
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;
|
|
1191
1798
|
if (a === null) return null;
|
|
1192
|
-
|
|
1799
|
+
s = s.slice(0, u.index) + a + s.slice(u.index + u[0].length);
|
|
1193
1800
|
}
|
|
1194
1801
|
return null;
|
|
1195
1802
|
}
|
|
1196
|
-
function
|
|
1197
|
-
const t =
|
|
1198
|
-
let
|
|
1199
|
-
const
|
|
1200
|
-
const
|
|
1201
|
-
!
|
|
1202
|
-
const
|
|
1203
|
-
for (const [
|
|
1204
|
-
|
|
1205
|
-
for (const [
|
|
1206
|
-
|
|
1207
|
-
const
|
|
1208
|
-
for (const [
|
|
1209
|
-
for (const [
|
|
1210
|
-
const
|
|
1211
|
-
if (
|
|
1212
|
-
|
|
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({
|
|
1213
1820
|
kind: "unsupported-property",
|
|
1214
|
-
message: `${
|
|
1215
|
-
node:
|
|
1821
|
+
message: `${m}: var() reference could not be resolved; declaration dropped`,
|
|
1822
|
+
node: f
|
|
1216
1823
|
});
|
|
1217
1824
|
continue;
|
|
1218
1825
|
}
|
|
1219
|
-
|
|
1826
|
+
p.set(m, { value: k, origin: y.origin });
|
|
1220
1827
|
}
|
|
1221
|
-
const
|
|
1222
|
-
for (const [
|
|
1223
|
-
|
|
1224
|
-
value:
|
|
1225
|
-
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 }
|
|
1226
1833
|
});
|
|
1227
|
-
return { computed:
|
|
1228
|
-
}, d = (
|
|
1229
|
-
const
|
|
1230
|
-
|
|
1231
|
-
let
|
|
1232
|
-
const
|
|
1233
|
-
if (
|
|
1234
|
-
const
|
|
1235
|
-
|
|
1236
|
-
const
|
|
1237
|
-
{ kind: "part", owner:
|
|
1238
|
-
|
|
1239
|
-
|
|
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
|
|
1240
1847
|
);
|
|
1241
|
-
|
|
1242
|
-
}),
|
|
1848
|
+
g.set(p.name, m.computed), l = m.forChildren;
|
|
1849
|
+
}), u.set(o.id, g);
|
|
1243
1850
|
}
|
|
1244
|
-
for (const
|
|
1851
|
+
for (const g of o.children) d(g, l);
|
|
1245
1852
|
};
|
|
1246
|
-
d(e.root, /* @__PURE__ */ new Map()),
|
|
1853
|
+
d(e.root, /* @__PURE__ */ new Map()), r && s.push({
|
|
1247
1854
|
kind: "version-dependent",
|
|
1248
|
-
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.`
|
|
1249
1856
|
});
|
|
1250
|
-
for (const
|
|
1251
|
-
if (
|
|
1252
|
-
const a =
|
|
1253
|
-
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({
|
|
1254
1861
|
kind: "unsupported-selector",
|
|
1255
|
-
message: `${a.join(", ")} matched nothing. Those names belong to the elements a control builds for itself, and only controls with a renderer of their own have them — ${
|
|
1256
|
-
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)
|
|
1257
1865
|
});
|
|
1258
1866
|
}
|
|
1259
|
-
return { styles:
|
|
1867
|
+
return { styles: i, partStyles: u, warnings: s };
|
|
1260
1868
|
}
|
|
1261
|
-
function
|
|
1262
|
-
const
|
|
1263
|
-
(
|
|
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
|
|
1264
1872
|
);
|
|
1265
|
-
return
|
|
1873
|
+
return Qe(r), r;
|
|
1266
1874
|
}
|
|
1267
|
-
const
|
|
1875
|
+
const $n = [
|
|
1268
1876
|
{
|
|
1269
1877
|
id: "text-metrics",
|
|
1270
1878
|
kind: "unreproducible",
|
|
@@ -1284,376 +1892,226 @@ const Wt = [
|
|
|
1284
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."
|
|
1285
1893
|
}
|
|
1286
1894
|
];
|
|
1287
|
-
function
|
|
1288
|
-
return e !== void 0 && /[A-Za-z0-9_.:-]/.test(e);
|
|
1289
|
-
}
|
|
1290
|
-
function xe(e) {
|
|
1291
|
-
return e !== void 0 && /[A-Za-z_]/.test(e);
|
|
1292
|
-
}
|
|
1293
|
-
function Ct(e) {
|
|
1294
|
-
return e === " " || e === " " || e === `
|
|
1295
|
-
` || e === "\r";
|
|
1296
|
-
}
|
|
1297
|
-
function At(e) {
|
|
1298
|
-
const n = [];
|
|
1299
|
-
let t = 0, i = 0;
|
|
1300
|
-
const l = () => i++;
|
|
1301
|
-
function o(a, u, r) {
|
|
1302
|
-
n.push({
|
|
1303
|
-
kind: "malformed",
|
|
1304
|
-
message: a,
|
|
1305
|
-
at: { in: "uxml", span: { start: u, end: r } }
|
|
1306
|
-
});
|
|
1307
|
-
}
|
|
1308
|
-
function p() {
|
|
1309
|
-
for (; Ct(e[t]); ) t++;
|
|
1310
|
-
}
|
|
1311
|
-
function g() {
|
|
1312
|
-
for (; ; ) {
|
|
1313
|
-
const a = e.indexOf("<", t);
|
|
1314
|
-
if (a < 0) {
|
|
1315
|
-
t = e.length;
|
|
1316
|
-
return;
|
|
1317
|
-
}
|
|
1318
|
-
const u = e[a + 1];
|
|
1319
|
-
if (u === "!") {
|
|
1320
|
-
if (e.startsWith("<!--", a)) {
|
|
1321
|
-
const r = e.indexOf("-->", a + 4);
|
|
1322
|
-
t = r < 0 ? e.length : r + 3;
|
|
1323
|
-
} else if (e.startsWith("<![CDATA[", a)) {
|
|
1324
|
-
const r = e.indexOf("]]>", a + 9);
|
|
1325
|
-
t = r < 0 ? e.length : r + 3;
|
|
1326
|
-
} else {
|
|
1327
|
-
const r = e.indexOf(">", a);
|
|
1328
|
-
t = r < 0 ? e.length : r + 1;
|
|
1329
|
-
}
|
|
1330
|
-
continue;
|
|
1331
|
-
}
|
|
1332
|
-
if (u === "?") {
|
|
1333
|
-
const r = e.indexOf("?>", a + 2);
|
|
1334
|
-
t = r < 0 ? e.length : r + 2;
|
|
1335
|
-
continue;
|
|
1336
|
-
}
|
|
1337
|
-
t = a;
|
|
1338
|
-
return;
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
function v() {
|
|
1342
|
-
const a = t;
|
|
1343
|
-
for (; be(e[t]); ) t++;
|
|
1344
|
-
const u = e.slice(a, t), r = u.indexOf(":");
|
|
1345
|
-
return r < 0 ? { prefix: null, local: u } : { prefix: u.slice(0, r), local: u.slice(r + 1) };
|
|
1346
|
-
}
|
|
1347
|
-
function d() {
|
|
1348
|
-
const a = t;
|
|
1349
|
-
for (; be(e[t]); ) t++;
|
|
1350
|
-
if (t === a) return null;
|
|
1351
|
-
const u = e.slice(a, t), r = t;
|
|
1352
|
-
if (p(), e[t] !== "=")
|
|
1353
|
-
return t = r, o(`attribute "${u}" has no value`, a, r), { name: u, value: "", span: { start: a, end: r } };
|
|
1354
|
-
t++, p();
|
|
1355
|
-
const f = e[t];
|
|
1356
|
-
if (f !== '"' && f !== "'")
|
|
1357
|
-
return o(`attribute "${u}" has an unquoted value`, a, t), { name: u, value: "", span: { start: a, end: t } };
|
|
1358
|
-
t++;
|
|
1359
|
-
const b = t, c = e.indexOf(f, t);
|
|
1360
|
-
return c < 0 ? (o(`attribute "${u}" has an unterminated value`, a, e.length), t = e.length, { name: u, value: e.slice(b), span: { start: a, end: t } }) : (t = c + 1, { name: u, value: e.slice(b, c), span: { start: a, end: t } });
|
|
1361
|
-
}
|
|
1362
|
-
function s() {
|
|
1363
|
-
const a = t;
|
|
1364
|
-
t++;
|
|
1365
|
-
const u = v(), r = [];
|
|
1366
|
-
let f = !1;
|
|
1367
|
-
for (; ; ) {
|
|
1368
|
-
p();
|
|
1369
|
-
const y = e[t];
|
|
1370
|
-
if (y === void 0) {
|
|
1371
|
-
o("unterminated open tag", a, e.length);
|
|
1372
|
-
break;
|
|
1373
|
-
}
|
|
1374
|
-
if (y === ">") {
|
|
1375
|
-
t++;
|
|
1376
|
-
break;
|
|
1377
|
-
}
|
|
1378
|
-
if (y === "/" && e[t + 1] === ">") {
|
|
1379
|
-
t += 2, f = !0;
|
|
1380
|
-
break;
|
|
1381
|
-
}
|
|
1382
|
-
const x = d();
|
|
1383
|
-
if (x === null) {
|
|
1384
|
-
t++;
|
|
1385
|
-
continue;
|
|
1386
|
-
}
|
|
1387
|
-
r.push(x);
|
|
1388
|
-
}
|
|
1389
|
-
const b = { start: a, end: t };
|
|
1390
|
-
if (f)
|
|
1391
|
-
return {
|
|
1392
|
-
id: l(),
|
|
1393
|
-
name: u,
|
|
1394
|
-
attributes: r,
|
|
1395
|
-
children: [],
|
|
1396
|
-
spans: { openTag: b, inner: { start: t, end: t }, closeTag: null },
|
|
1397
|
-
tagDirty: !1,
|
|
1398
|
-
childrenDirty: !1
|
|
1399
|
-
};
|
|
1400
|
-
const c = t, S = [];
|
|
1401
|
-
for (; ; ) {
|
|
1402
|
-
if (g(), t >= e.length) {
|
|
1403
|
-
o(`unterminated element <${Ce(u)}>`, a, e.length);
|
|
1404
|
-
break;
|
|
1405
|
-
}
|
|
1406
|
-
const y = e[t + 1];
|
|
1407
|
-
if (y === "/") break;
|
|
1408
|
-
if (!xe(y)) {
|
|
1409
|
-
t++;
|
|
1410
|
-
continue;
|
|
1411
|
-
}
|
|
1412
|
-
S.push(s());
|
|
1413
|
-
}
|
|
1414
|
-
const h = t;
|
|
1415
|
-
let w = null;
|
|
1416
|
-
if (e.startsWith("</", t)) {
|
|
1417
|
-
const y = e.indexOf(">", t), x = y < 0 ? e.length : y + 1;
|
|
1418
|
-
y < 0 && o("unterminated end tag", t, x), w = { start: t, end: x }, t = x;
|
|
1419
|
-
}
|
|
1420
|
-
return {
|
|
1421
|
-
id: l(),
|
|
1422
|
-
name: u,
|
|
1423
|
-
attributes: r,
|
|
1424
|
-
children: S,
|
|
1425
|
-
spans: { openTag: b, inner: { start: c, end: h }, closeTag: w },
|
|
1426
|
-
tagDirty: !1,
|
|
1427
|
-
childrenDirty: !1
|
|
1428
|
-
};
|
|
1429
|
-
}
|
|
1430
|
-
return g(), t < e.length && xe(e[t + 1]) ? { root: s(), warnings: n } : (o("no root element", 0, 0), {
|
|
1431
|
-
root: {
|
|
1432
|
-
id: l(),
|
|
1433
|
-
name: { prefix: null, local: "" },
|
|
1434
|
-
attributes: [],
|
|
1435
|
-
children: [],
|
|
1436
|
-
spans: { openTag: { start: 0, end: 0 }, inner: { start: 0, end: 0 }, closeTag: null },
|
|
1437
|
-
tagDirty: !1,
|
|
1438
|
-
childrenDirty: !1
|
|
1439
|
-
},
|
|
1440
|
-
warnings: n
|
|
1441
|
-
});
|
|
1442
|
-
}
|
|
1443
|
-
function Ce(e) {
|
|
1444
|
-
return e.prefix === null ? e.local : `${e.prefix}:${e.local}`;
|
|
1445
|
-
}
|
|
1446
|
-
function Rt(e, n) {
|
|
1895
|
+
function mn(e, n) {
|
|
1447
1896
|
const t = (d) => e.slice(d.start, d.end);
|
|
1448
|
-
function
|
|
1897
|
+
function s(d) {
|
|
1449
1898
|
return d.spans.closeTag !== null ? d.spans.closeTag.end : Math.max(d.spans.openTag.end, d.spans.inner.end);
|
|
1450
1899
|
}
|
|
1451
|
-
function
|
|
1900
|
+
function i(d) {
|
|
1452
1901
|
return d.includes('"') ? d.includes("'") ? `"${d.replace(/"/g, """)}"` : `'${d}'` : `"${d}"`;
|
|
1453
1902
|
}
|
|
1454
|
-
function
|
|
1455
|
-
const
|
|
1456
|
-
return d.spans.closeTag === null ? `<${a}${
|
|
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}>`;
|
|
1457
1906
|
}
|
|
1458
|
-
function
|
|
1459
|
-
var
|
|
1460
|
-
const
|
|
1461
|
-
return { between: a, before: a, after:
|
|
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 };
|
|
1462
1911
|
}
|
|
1463
|
-
function
|
|
1464
|
-
const { inner:
|
|
1465
|
-
if (d.children.length === 0) return t(
|
|
1912
|
+
function c(d) {
|
|
1913
|
+
const { inner: o } = d.spans;
|
|
1914
|
+
if (d.children.length === 0) return t(o);
|
|
1466
1915
|
if (d.childrenDirty) {
|
|
1467
|
-
const { between:
|
|
1468
|
-
return
|
|
1916
|
+
const { between: l, before: h, after: g } = u(d);
|
|
1917
|
+
return h + d.children.map(v).join(l) + g;
|
|
1469
1918
|
}
|
|
1470
|
-
let a = "",
|
|
1471
|
-
for (const
|
|
1472
|
-
a += e.slice(
|
|
1473
|
-
return a + e.slice(
|
|
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);
|
|
1474
1923
|
}
|
|
1475
1924
|
function v(d) {
|
|
1476
|
-
const
|
|
1477
|
-
return
|
|
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;
|
|
1478
1927
|
}
|
|
1479
|
-
return e.slice(0, n.spans.openTag.start) + v(n) + e.slice(
|
|
1928
|
+
return e.slice(0, n.spans.openTag.start) + v(n) + e.slice(s(n));
|
|
1480
1929
|
}
|
|
1481
|
-
function
|
|
1482
|
-
const n = e.source, t = (
|
|
1483
|
-
function
|
|
1484
|
-
return
|
|
1485
|
-
const
|
|
1486
|
-
switch (
|
|
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) {
|
|
1487
1936
|
case "universal":
|
|
1488
1937
|
return "*";
|
|
1489
1938
|
case "type":
|
|
1490
|
-
return
|
|
1939
|
+
return g.name;
|
|
1491
1940
|
case "class":
|
|
1492
|
-
return `.${
|
|
1941
|
+
return `.${g.name}`;
|
|
1493
1942
|
case "name":
|
|
1494
|
-
return `#${
|
|
1943
|
+
return `#${g.name}`;
|
|
1495
1944
|
case "pseudo":
|
|
1496
|
-
return `:${
|
|
1945
|
+
return `:${g.name}`;
|
|
1497
1946
|
case "unknown":
|
|
1498
|
-
return
|
|
1947
|
+
return g.text;
|
|
1499
1948
|
}
|
|
1500
1949
|
}).join("");
|
|
1501
|
-
return
|
|
1950
|
+
return l + h;
|
|
1502
1951
|
}).join("");
|
|
1503
1952
|
}
|
|
1504
|
-
function
|
|
1505
|
-
var
|
|
1506
|
-
const a =
|
|
1953
|
+
function i(o) {
|
|
1954
|
+
var p, b;
|
|
1955
|
+
const a = o.declarations[0];
|
|
1507
1956
|
if (a === void 0) return { between: "", before: "", after: "" };
|
|
1508
|
-
const
|
|
1509
|
-
`, a.span.start),
|
|
1510
|
-
return { between: `;${
|
|
1511
|
-
}
|
|
1512
|
-
function o
|
|
1513
|
-
const a =
|
|
1514
|
-
if (
|
|
1515
|
-
return a + n.slice(
|
|
1516
|
-
const
|
|
1517
|
-
if (
|
|
1518
|
-
const { between:
|
|
1519
|
-
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}}`;
|
|
1520
1969
|
}
|
|
1521
|
-
let
|
|
1522
|
-
for (const
|
|
1523
|
-
|
|
1524
|
-
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);
|
|
1525
1974
|
}
|
|
1526
|
-
function
|
|
1527
|
-
return
|
|
1975
|
+
function u(o) {
|
|
1976
|
+
return o.dirty ? `${o.property}: ${o.value}` : t(o.span);
|
|
1528
1977
|
}
|
|
1529
|
-
function
|
|
1530
|
-
return
|
|
1978
|
+
function c(o) {
|
|
1979
|
+
return o.kind === "rule" ? r(o.rule) : t(o.span);
|
|
1531
1980
|
}
|
|
1532
1981
|
let v = "", d = 0;
|
|
1533
|
-
for (const
|
|
1534
|
-
const a =
|
|
1535
|
-
v += n.slice(d, a.start), v +=
|
|
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;
|
|
1536
1985
|
}
|
|
1537
1986
|
return v + n.slice(d);
|
|
1538
1987
|
}
|
|
1539
|
-
|
|
1988
|
+
ot(
|
|
1989
|
+
(e, n) => n === void 0 ? Ie(e) : Ie(e, void 0, { resolveImport: n })
|
|
1990
|
+
);
|
|
1991
|
+
function et(e, n = []) {
|
|
1540
1992
|
var t;
|
|
1541
|
-
for (const
|
|
1542
|
-
if (
|
|
1543
|
-
const
|
|
1544
|
-
|
|
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 });
|
|
1545
1997
|
}
|
|
1546
|
-
|
|
1998
|
+
et(s, n);
|
|
1547
1999
|
}
|
|
1548
2000
|
return n;
|
|
1549
2001
|
}
|
|
1550
|
-
function
|
|
2002
|
+
function wn(e) {
|
|
1551
2003
|
return e.startsWith("project://") || e.startsWith("/");
|
|
1552
2004
|
}
|
|
1553
|
-
function
|
|
1554
|
-
var
|
|
1555
|
-
const
|
|
1556
|
-
for (const { url:
|
|
1557
|
-
const
|
|
1558
|
-
if (
|
|
1559
|
-
|
|
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({
|
|
1560
2012
|
kind: "import-unresolved",
|
|
1561
|
-
message: (t == null ? void 0 : t.resolveImport) === void 0 ? `<Style src="${
|
|
1562
|
-
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
|
|
1563
2015
|
});
|
|
1564
2016
|
continue;
|
|
1565
2017
|
}
|
|
1566
|
-
|
|
1567
|
-
}
|
|
1568
|
-
if (n !== void 0 ||
|
|
1569
|
-
const
|
|
1570
|
-
let
|
|
1571
|
-
for (const
|
|
1572
|
-
const
|
|
1573
|
-
|
|
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 });
|
|
1574
2026
|
}
|
|
1575
2027
|
if (n !== void 0) {
|
|
1576
|
-
const
|
|
1577
|
-
|
|
2028
|
+
const h = l++;
|
|
2029
|
+
f.push({ text: n, origin: null, sheet: h }), u.push({ sheet: h, scope: s.root.id });
|
|
1578
2030
|
}
|
|
1579
|
-
for (;
|
|
1580
|
-
const
|
|
1581
|
-
|
|
1582
|
-
for (const
|
|
1583
|
-
if (
|
|
1584
|
-
const
|
|
1585
|
-
if (
|
|
1586
|
-
const
|
|
1587
|
-
|
|
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);
|
|
1588
2040
|
continue;
|
|
1589
2041
|
}
|
|
1590
|
-
|
|
1591
|
-
const
|
|
1592
|
-
if (
|
|
1593
|
-
|
|
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({
|
|
1594
2046
|
kind: "import-unresolved",
|
|
1595
|
-
message: (t == null ? void 0 : t.resolveImport) === void 0 ? `@import "${
|
|
1596
|
-
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 }
|
|
1597
2049
|
});
|
|
1598
2050
|
continue;
|
|
1599
2051
|
}
|
|
1600
|
-
const
|
|
1601
|
-
|
|
2052
|
+
const k = l++;
|
|
2053
|
+
a.set(m, k), b.resolvedSheet = k, f.push({ text: y, origin: b.url, sheet: k });
|
|
1602
2054
|
}
|
|
1603
2055
|
}
|
|
1604
2056
|
}
|
|
1605
|
-
|
|
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;
|
|
1606
2059
|
}
|
|
1607
|
-
function
|
|
2060
|
+
function Tn(e) {
|
|
1608
2061
|
const n = e.sheets[0];
|
|
1609
2062
|
return {
|
|
1610
|
-
uxml:
|
|
2063
|
+
uxml: mn(e.source, e.root),
|
|
1611
2064
|
// Only the sheet passed to `parse` round-trips. `@import`ed sheets (Phase 3)
|
|
1612
2065
|
// are separate files and are not this function's to write.
|
|
1613
|
-
uss: n === void 0 ? "" :
|
|
2066
|
+
uss: n === void 0 ? "" : gn(n)
|
|
1614
2067
|
};
|
|
1615
2068
|
}
|
|
1616
|
-
function
|
|
1617
|
-
const
|
|
2069
|
+
function On(e, n, t) {
|
|
2070
|
+
const s = n.ownerDocument, i = (t == null ? void 0 : t.size) ?? {
|
|
1618
2071
|
width: n.clientWidth,
|
|
1619
2072
|
height: n.clientHeight
|
|
1620
|
-
},
|
|
2073
|
+
}, r = bt(e), u = r.document, c = hn(u, {
|
|
1621
2074
|
...(t == null ? void 0 : t.activeStates) === void 0 ? {} : { activeStates: t.activeStates },
|
|
1622
2075
|
...(t == null ? void 0 : t.states) === void 0 ? {} : { states: t.states }
|
|
1623
|
-
}),
|
|
1624
|
-
|
|
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;
|
|
1625
2081
|
try {
|
|
1626
|
-
|
|
1627
|
-
document:
|
|
2082
|
+
o = Yt(u.root, d.boxes, d.parts, c.styles, n, {
|
|
2083
|
+
document: s,
|
|
1628
2084
|
resolveAsset: t == null ? void 0 : t.resolveAsset
|
|
1629
2085
|
});
|
|
1630
|
-
} catch (
|
|
1631
|
-
throw
|
|
2086
|
+
} catch (f) {
|
|
2087
|
+
throw d.dispose(), f;
|
|
1632
2088
|
}
|
|
1633
|
-
let
|
|
2089
|
+
let a = !1;
|
|
1634
2090
|
return {
|
|
1635
|
-
warnings: [...
|
|
1636
|
-
elements:
|
|
1637
|
-
boxes:
|
|
2091
|
+
warnings: [...r.warnings, ...c.warnings, ...d.warnings, ...o.warnings],
|
|
2092
|
+
elements: o.elements,
|
|
2093
|
+
boxes: d.boxes,
|
|
1638
2094
|
dispose() {
|
|
1639
|
-
|
|
2095
|
+
a || (a = !0, d.dispose(), n.replaceChildren());
|
|
1640
2096
|
}
|
|
1641
2097
|
};
|
|
1642
2098
|
}
|
|
1643
2099
|
export {
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
jt as
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
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
|
|
1659
2117
|
};
|