@styleframe/core 3.5.0 → 3.6.1
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 +24 -0
- package/dist/{styleframe.d.ts → index.d.cts} +19 -0
- package/dist/index.d.mts +665 -0
- package/dist/index.d.ts +665 -0
- package/dist/styleframe.js +815 -988
- package/dist/styleframe.umd.cjs +1 -1
- package/package.json +16 -13
package/dist/styleframe.js
CHANGED
|
@@ -1,1016 +1,843 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/typeGuards.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return typeof e == "object" && !!e;
|
|
3
4
|
}
|
|
4
|
-
function
|
|
5
|
-
|
|
5
|
+
function t(t, n) {
|
|
6
|
+
return e(t) && "type" in t && t.type === n;
|
|
6
7
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
8
|
+
function n(e) {
|
|
9
|
+
return t(e, "variable");
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
11
|
+
function r(e) {
|
|
12
|
+
return t(e, "reference");
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
14
|
+
function i(e) {
|
|
15
|
+
return t(e, "selector");
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
17
|
+
function a(e) {
|
|
18
|
+
return t(e, "at-rule");
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
20
|
+
function o(e) {
|
|
21
|
+
return t(e, "utility");
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
23
|
+
function s(e) {
|
|
24
|
+
return t(e, "modifier");
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
26
|
+
function c(e) {
|
|
27
|
+
return t(e, "css");
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
29
|
+
function l(e) {
|
|
30
|
+
return t(e, "theme");
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
32
|
+
function u(e) {
|
|
33
|
+
return t(e, "root");
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
35
|
+
function d(e) {
|
|
36
|
+
return t(e, "recipe");
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
38
|
+
function f(e) {
|
|
39
|
+
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
41
|
+
function p(e) {
|
|
42
|
+
return f(e) || r(e) || c(e) || Array.isArray(e) && e.every(p);
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
44
|
+
function m(t) {
|
|
45
|
+
return e(t) && "id" in t && "children" in t && "declarations" in t && "variables" in t;
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
47
|
+
function h(t) {
|
|
48
|
+
return e(t) && "children" in t && "declarations" in t && "variables" in t;
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
name: e,
|
|
93
|
-
value: t,
|
|
94
|
-
modifiers: r
|
|
95
|
-
}) => `_${[
|
|
96
|
-
...r,
|
|
97
|
-
e,
|
|
98
|
-
...t === "default" ? [] : [t]
|
|
50
|
+
function g(e) {
|
|
51
|
+
return typeof e == "string" && e.startsWith("@");
|
|
52
|
+
}
|
|
53
|
+
function ee(t) {
|
|
54
|
+
return e(t) && "id" in t && "root" in t && "variable" in t && "selector" in t && "recipe" in t && typeof t.id == "string" && u(t.root);
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/utils/hash.ts
|
|
58
|
+
function _(e) {
|
|
59
|
+
let t = 5381;
|
|
60
|
+
for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n) & 4294967295;
|
|
61
|
+
return (t >>> 0).toString(16).padStart(7, "0").slice(0, 7);
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/defaults.ts
|
|
65
|
+
function v(e) {
|
|
66
|
+
let { replacer: t = (e) => e, namespace: n } = typeof e == "function" ? { replacer: e } : e ?? {}, i = Array.isArray(n) ? n : n ? [n] : [];
|
|
67
|
+
return (e) => {
|
|
68
|
+
let n = e, a;
|
|
69
|
+
if (typeof n == "string" && n[0] === "@") {
|
|
70
|
+
let e = n.slice(1), r = i.find((t) => e === t || e.startsWith(`${t}.`)), o, s;
|
|
71
|
+
r ? (o = e, s = e.startsWith(`${r}.`) ? e.slice(r.length + 1) : e) : i.length > 0 ? (o = `${i[0]}.${e}`, s = e) : (o = e, s = e), a = t(s), n = {
|
|
72
|
+
type: "reference",
|
|
73
|
+
name: o
|
|
74
|
+
};
|
|
75
|
+
} else if (r(n)) {
|
|
76
|
+
let e = n.name;
|
|
77
|
+
for (let t of i) if (e.startsWith(`${t}.`)) {
|
|
78
|
+
e = e.slice(t.length + 1);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
a = t(e);
|
|
82
|
+
} else {
|
|
83
|
+
let t = String(e).trim();
|
|
84
|
+
a = /\s/.test(t) ? _(t) : `[${t}]`;
|
|
85
|
+
}
|
|
86
|
+
return { [a]: n };
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
var te = ({ name: e, value: t, modifiers: n }) => `_${[
|
|
90
|
+
...n,
|
|
91
|
+
e,
|
|
92
|
+
...t === "default" ? [] : [t]
|
|
99
93
|
].filter(Boolean).join(":")}`;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (!ae(e, t, r))
|
|
134
|
-
throw new Error(
|
|
135
|
-
`[styleframe] Variable "${e}" is not defined. Check that the variable exists before referencing it with "@${e}".`
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
function C(e, t) {
|
|
139
|
-
return function(n) {
|
|
140
|
-
if (typeof n != "string" || !n.includes("@"))
|
|
141
|
-
return n;
|
|
142
|
-
if (ie(n) && /^@[\w.-]+$/.test(n)) {
|
|
143
|
-
const i = n.slice(1);
|
|
144
|
-
return fe(i, e, t), t._usage.variables.add(i), { type: "reference", name: i };
|
|
145
|
-
}
|
|
146
|
-
const s = z(n);
|
|
147
|
-
if (s.some((i) => g(i))) {
|
|
148
|
-
for (const i of s)
|
|
149
|
-
g(i) && t._usage.variables.add(i.name);
|
|
150
|
-
return { type: "css", value: s };
|
|
151
|
-
}
|
|
152
|
-
return n;
|
|
153
|
-
};
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/tokens/resolve.ts
|
|
96
|
+
function y(e, t) {
|
|
97
|
+
if (r(t)) {
|
|
98
|
+
e._usage.variables.add(t.name);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (c(t)) for (let n of t.value) r(n) && e._usage.variables.add(n.name);
|
|
102
|
+
}
|
|
103
|
+
var b = /@([\w.-]+)/g;
|
|
104
|
+
function x(e) {
|
|
105
|
+
let t = [], n = 0, r;
|
|
106
|
+
for (b.lastIndex = 0; (r = b.exec(e)) !== null;) {
|
|
107
|
+
let i = e.slice(n, r.index);
|
|
108
|
+
i !== "" && t.push(i), t.push({
|
|
109
|
+
type: "reference",
|
|
110
|
+
name: r[1]
|
|
111
|
+
}), n = b.lastIndex;
|
|
112
|
+
}
|
|
113
|
+
let i = e.slice(n);
|
|
114
|
+
return i !== "" && t.push(i), t;
|
|
115
|
+
}
|
|
116
|
+
function S(e, t, n) {
|
|
117
|
+
let r = t;
|
|
118
|
+
for (; r;) {
|
|
119
|
+
if (r.variables.some((t) => t.name === e)) return !0;
|
|
120
|
+
if (r.parentId) r = n._registry.get(r.parentId);
|
|
121
|
+
else break;
|
|
122
|
+
}
|
|
123
|
+
return !1;
|
|
124
|
+
}
|
|
125
|
+
function C(e, t, n) {
|
|
126
|
+
if (!S(e, t, n)) throw Error(`[styleframe] Variable "${e}" is not defined. Check that the variable exists before referencing it with "@${e}".`);
|
|
154
127
|
}
|
|
155
|
-
function
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
128
|
+
function w(e, t) {
|
|
129
|
+
return function(n) {
|
|
130
|
+
if (typeof n != "string" || !n.includes("@")) return n;
|
|
131
|
+
if (g(n) && /^@[\w.-]+$/.test(n)) {
|
|
132
|
+
let r = n.slice(1);
|
|
133
|
+
return C(r, e, t), t._usage.variables.add(r), {
|
|
134
|
+
type: "reference",
|
|
135
|
+
name: r
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
let i = x(n);
|
|
139
|
+
if (i.some((e) => r(e))) {
|
|
140
|
+
for (let e of i) r(e) && t._usage.variables.add(e.name);
|
|
141
|
+
return {
|
|
142
|
+
type: "css",
|
|
143
|
+
value: i
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
return n;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/tokens/ref.ts
|
|
151
|
+
function T(e, t) {
|
|
152
|
+
return function(r, i) {
|
|
153
|
+
let a = w(e, t), o = i == null ? i : a(i);
|
|
154
|
+
if (n(r)) return t._usage.variables.add(r.name), {
|
|
155
|
+
type: "reference",
|
|
156
|
+
name: r.name,
|
|
157
|
+
fallback: o
|
|
158
|
+
};
|
|
159
|
+
if (r == null) throw Error(`[styleframe] ref() received ${String(r)}. This usually means you're referencing a variable that doesn't exist.`);
|
|
160
|
+
return t._usage.variables.add(r), {
|
|
161
|
+
type: "reference",
|
|
162
|
+
name: r,
|
|
163
|
+
fallback: o
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/tokens/css.ts
|
|
169
|
+
function ne(e, t) {
|
|
170
|
+
let i = T(e, t), o = (e) => {
|
|
171
|
+
let n = x(e);
|
|
172
|
+
for (let e of n) r(e) && t._usage.variables.add(e.name);
|
|
173
|
+
return n;
|
|
174
|
+
};
|
|
175
|
+
return function(e, ...t) {
|
|
176
|
+
return {
|
|
177
|
+
type: "css",
|
|
178
|
+
value: e.reduce((e, r, s) => {
|
|
179
|
+
if (e.push(...o(r)), s < t.length) {
|
|
180
|
+
let r = t[s];
|
|
181
|
+
n(r) ? e.push(i(r)) : a(r) ? e.push(r.rule) : typeof r == "string" && r.includes("@") ? e.push(...o(r)) : e.push(r);
|
|
182
|
+
}
|
|
183
|
+
return e;
|
|
184
|
+
}, [])
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/utils/capitalizeFirst.ts
|
|
190
|
+
function re(e) {
|
|
191
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
200
192
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
);
|
|
362
|
-
if (!r)
|
|
363
|
-
throw new Error(`Modifier "${t}" not found`);
|
|
364
|
-
return r;
|
|
365
|
-
}
|
|
366
|
-
function O(e, t) {
|
|
367
|
-
if (e === t) return !0;
|
|
368
|
-
if (typeof e != typeof t) return !1;
|
|
369
|
-
if (e === null || t === null) return e === t;
|
|
370
|
-
if (typeof e != "object" || typeof t != "object") return !1;
|
|
371
|
-
if (Array.isArray(e) && Array.isArray(t))
|
|
372
|
-
return e.length !== t.length ? !1 : e.every((r, n) => O(r, t[n]));
|
|
373
|
-
if ("type" in e && "type" in t) {
|
|
374
|
-
if (e.type !== t.type) return !1;
|
|
375
|
-
if (g(e) && g(t))
|
|
376
|
-
return e.name === t.name && O(e.fallback, t.fallback);
|
|
377
|
-
if ($(e) && $(t))
|
|
378
|
-
return O(e.value, t.value);
|
|
379
|
-
}
|
|
380
|
-
return !1;
|
|
381
|
-
}
|
|
382
|
-
const X = "__licenseRequired";
|
|
383
|
-
function me(e) {
|
|
384
|
-
P(e) || Object.defineProperty(e, X, {
|
|
385
|
-
value: !0,
|
|
386
|
-
writable: !1,
|
|
387
|
-
configurable: !1,
|
|
388
|
-
enumerable: !0
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
function P(e) {
|
|
392
|
-
return Object.prototype.hasOwnProperty.call(e, X);
|
|
393
|
-
}
|
|
394
|
-
function pe(e, t) {
|
|
395
|
-
const r = [...e];
|
|
396
|
-
for (const n of t) {
|
|
397
|
-
const s = r.find(
|
|
398
|
-
(c) => c.name === n.name
|
|
399
|
-
);
|
|
400
|
-
s ? s.value = n.value : r.push(n);
|
|
401
|
-
}
|
|
402
|
-
return r;
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/utils/cssSelector.ts
|
|
195
|
+
function ie(e) {
|
|
196
|
+
return `.${e.replace(/[[\].#()%,:/]/g, "\\$&")}`;
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/utils/deepClone.ts
|
|
200
|
+
function E(e) {
|
|
201
|
+
if (e instanceof Buffer) return Buffer.from(e);
|
|
202
|
+
let t = e.constructor;
|
|
203
|
+
return new t(e.buffer.slice(0), e.byteOffset, e.byteLength / e.BYTES_PER_ELEMENT || 1);
|
|
204
|
+
}
|
|
205
|
+
function ae(e) {
|
|
206
|
+
if (e ||= {}, e.circular) return oe(e);
|
|
207
|
+
let t = /* @__PURE__ */ new Map();
|
|
208
|
+
if (t.set(Date, (e) => new Date(e)), t.set(Map, (e, t) => new Map(r(Array.from(e), t))), t.set(Set, (e, t) => new Set(r(Array.from(e), t))), e.constructorHandlers) for (let n of e.constructorHandlers) t.set(n[0], n[1]);
|
|
209
|
+
let n;
|
|
210
|
+
return e.proto ? a : i;
|
|
211
|
+
function r(e, r) {
|
|
212
|
+
let i = Object.keys(e), a = Array.from({ length: i.length });
|
|
213
|
+
for (let o = 0; o < i.length; o++) {
|
|
214
|
+
let s = i[o], c = e[s];
|
|
215
|
+
typeof c != "object" || !c ? a[s] = c : c.constructor !== Object && (n = t.get(c.constructor)) ? a[s] = n(c, r) : ArrayBuffer.isView(c) ? a[s] = E(c) : a[s] = r(c);
|
|
216
|
+
}
|
|
217
|
+
return a;
|
|
218
|
+
}
|
|
219
|
+
function i(e) {
|
|
220
|
+
if (typeof e != "object" || !e) return e;
|
|
221
|
+
if (Array.isArray(e)) return r(e, i);
|
|
222
|
+
if (e.constructor !== Object && (n = t.get(e.constructor))) return n(e, i);
|
|
223
|
+
let a = {};
|
|
224
|
+
for (let r in e) {
|
|
225
|
+
if (Object.hasOwnProperty.call(e, r) === !1) continue;
|
|
226
|
+
let o = e[r];
|
|
227
|
+
typeof o != "object" || !o ? a[r] = o : o.constructor !== Object && (n = t.get(o.constructor)) ? a[r] = n(o, i) : ArrayBuffer.isView(o) ? a[r] = E(o) : a[r] = i(o);
|
|
228
|
+
}
|
|
229
|
+
return a;
|
|
230
|
+
}
|
|
231
|
+
function a(e) {
|
|
232
|
+
if (typeof e != "object" || !e) return e;
|
|
233
|
+
if (Array.isArray(e)) return r(e, a);
|
|
234
|
+
if (e.constructor !== Object && (n = t.get(e.constructor))) return n(e, a);
|
|
235
|
+
let i = {};
|
|
236
|
+
for (let r in e) {
|
|
237
|
+
let o = e[r];
|
|
238
|
+
typeof o != "object" || !o ? i[r] = o : o.constructor !== Object && (n = t.get(o.constructor)) ? i[r] = n(o, a) : ArrayBuffer.isView(o) ? i[r] = E(o) : i[r] = a(o);
|
|
239
|
+
}
|
|
240
|
+
return i;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function oe(e) {
|
|
244
|
+
let t = [], n = [], r = /* @__PURE__ */ new Map();
|
|
245
|
+
if (r.set(Date, (e) => new Date(e)), r.set(Map, (e, t) => new Map(a(Array.from(e), t))), r.set(Set, (e, t) => new Set(a(Array.from(e), t))), e.constructorHandlers) for (let t of e.constructorHandlers) r.set(t[0], t[1]);
|
|
246
|
+
let i;
|
|
247
|
+
return e.proto ? s : o;
|
|
248
|
+
function a(e, a) {
|
|
249
|
+
let o = Object.keys(e), s = Array.from({ length: o.length });
|
|
250
|
+
for (let c = 0; c < o.length; c++) {
|
|
251
|
+
let l = o[c], u = e[l];
|
|
252
|
+
if (typeof u != "object" || !u) s[l] = u;
|
|
253
|
+
else if (u.constructor !== Object && (i = r.get(u.constructor))) s[l] = i(u, a);
|
|
254
|
+
else if (ArrayBuffer.isView(u)) s[l] = E(u);
|
|
255
|
+
else {
|
|
256
|
+
let e = t.indexOf(u);
|
|
257
|
+
e === -1 ? s[l] = a(u) : s[l] = n[e];
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return s;
|
|
261
|
+
}
|
|
262
|
+
function o(e) {
|
|
263
|
+
if (typeof e != "object" || !e) return e;
|
|
264
|
+
if (Array.isArray(e)) return a(e, o);
|
|
265
|
+
if (e.constructor !== Object && (i = r.get(e.constructor))) return i(e, o);
|
|
266
|
+
let s = {};
|
|
267
|
+
t.push(e), n.push(s);
|
|
268
|
+
for (let a in e) {
|
|
269
|
+
if (Object.hasOwnProperty.call(e, a) === !1) continue;
|
|
270
|
+
let c = e[a];
|
|
271
|
+
if (typeof c != "object" || !c) s[a] = c;
|
|
272
|
+
else if (c.constructor !== Object && (i = r.get(c.constructor))) s[a] = i(c, o);
|
|
273
|
+
else if (ArrayBuffer.isView(c)) s[a] = E(c);
|
|
274
|
+
else {
|
|
275
|
+
let e = t.indexOf(c);
|
|
276
|
+
e === -1 ? s[a] = o(c) : s[a] = n[e];
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return t.pop(), n.pop(), s;
|
|
280
|
+
}
|
|
281
|
+
function s(e) {
|
|
282
|
+
if (typeof e != "object" || !e) return e;
|
|
283
|
+
if (Array.isArray(e)) return a(e, s);
|
|
284
|
+
if (e.constructor !== Object && (i = r.get(e.constructor))) return i(e, s);
|
|
285
|
+
let o = {};
|
|
286
|
+
t.push(e), n.push(o);
|
|
287
|
+
for (let a in e) {
|
|
288
|
+
let c = e[a];
|
|
289
|
+
if (typeof c != "object" || !c) o[a] = c;
|
|
290
|
+
else if (c.constructor !== Object && (i = r.get(c.constructor))) o[a] = i(c, s);
|
|
291
|
+
else if (ArrayBuffer.isView(c)) o[a] = E(c);
|
|
292
|
+
else {
|
|
293
|
+
let e = t.indexOf(c);
|
|
294
|
+
e === -1 ? o[a] = s(c) : o[a] = n[e];
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return t.pop(), n.pop(), o;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
var D = ae();
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/utils/generateRandomId.ts
|
|
303
|
+
function O(e, t = 8) {
|
|
304
|
+
let n = "";
|
|
305
|
+
for (let e = 0; e < t; e++) {
|
|
306
|
+
let e = Math.floor(Math.random() * 62);
|
|
307
|
+
n += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[e];
|
|
308
|
+
}
|
|
309
|
+
return e ? `${e}${n}` : n;
|
|
310
|
+
}
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region src/utils/getters.ts
|
|
313
|
+
function se(e, t) {
|
|
314
|
+
let n = e.variables.find((e) => e.name === t);
|
|
315
|
+
if (!n) throw Error(`Variable "${t}" not found`);
|
|
316
|
+
return n;
|
|
317
|
+
}
|
|
318
|
+
function ce(e, t) {
|
|
319
|
+
let n = e.utilities.find((e) => e.name === t);
|
|
320
|
+
if (!n) throw Error(`Utility "${t}" not found`);
|
|
321
|
+
return n;
|
|
322
|
+
}
|
|
323
|
+
function k(e, t) {
|
|
324
|
+
let n = e.modifiers.find((e) => e.key.includes(t));
|
|
325
|
+
if (!n) throw Error(`Modifier "${t}" not found`);
|
|
326
|
+
return n;
|
|
327
|
+
}
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region src/utils/isTokenEqual.ts
|
|
330
|
+
function A(e, t) {
|
|
331
|
+
if (e === t) return !0;
|
|
332
|
+
if (typeof e != typeof t) return !1;
|
|
333
|
+
if (e === null || t === null) return e === t;
|
|
334
|
+
if (typeof e != "object" || typeof t != "object") return !1;
|
|
335
|
+
if (Array.isArray(e) && Array.isArray(t)) return e.length === t.length ? e.every((e, n) => A(e, t[n])) : !1;
|
|
336
|
+
if ("type" in e && "type" in t) {
|
|
337
|
+
if (e.type !== t.type) return !1;
|
|
338
|
+
if (r(e) && r(t)) return e.name === t.name && A(e.fallback, t.fallback);
|
|
339
|
+
if (c(e) && c(t)) return A(e.value, t.value);
|
|
340
|
+
}
|
|
341
|
+
return !1;
|
|
342
|
+
}
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region ../../node_modules/.pnpm/@styleframe+license@2.0.2/node_modules/@styleframe/license/dist/license.js
|
|
345
|
+
var le = "__licenseRequired";
|
|
346
|
+
function ue(e) {
|
|
347
|
+
j(e) || Object.defineProperty(e, "__licenseRequired", {
|
|
348
|
+
value: !0,
|
|
349
|
+
writable: !1,
|
|
350
|
+
configurable: !1,
|
|
351
|
+
enumerable: !0
|
|
352
|
+
});
|
|
403
353
|
}
|
|
404
|
-
function
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
354
|
+
function j(e) {
|
|
355
|
+
return Object.prototype.hasOwnProperty.call(e, le);
|
|
356
|
+
}
|
|
357
|
+
//#endregion
|
|
358
|
+
//#region src/utils/merge.ts
|
|
359
|
+
function M(e, t) {
|
|
360
|
+
let n = [...e];
|
|
361
|
+
for (let e of t) {
|
|
362
|
+
let t = n.find((t) => t.name === e.name);
|
|
363
|
+
t ? t.value = e.value : n.push(e);
|
|
364
|
+
}
|
|
365
|
+
return n;
|
|
366
|
+
}
|
|
367
|
+
function N(e, t) {
|
|
368
|
+
let n = [...e];
|
|
369
|
+
for (let e of t) {
|
|
370
|
+
let t = n.find((t) => t.name === e.name);
|
|
371
|
+
t ? Object.assign(t, P(t, e)) : n.push(e);
|
|
372
|
+
}
|
|
373
|
+
return n;
|
|
374
|
+
}
|
|
375
|
+
function P(e, t) {
|
|
376
|
+
return Object.keys(e).reduce((n, r) => (r === "variables" ? n.variables = M(e.variables, t.variables) : r === "declarations" ? n.declarations = {
|
|
377
|
+
...e.declarations,
|
|
378
|
+
...t.declarations
|
|
379
|
+
} : r === "themes" && u(n) && u(e) && u(t) ? n.themes = N(e.themes, t.themes) : Array.isArray(e[r]) && (n[r] = e[r].concat(t[r])), n), {
|
|
380
|
+
...e,
|
|
381
|
+
...t
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
function F(e, t) {
|
|
385
|
+
for (let n of e) "id" in n && typeof n.id == "string" && (t._registry.set(n.id, n), "children" in n && F(n.children, t));
|
|
386
|
+
}
|
|
387
|
+
function I(e) {
|
|
388
|
+
e._registry = /* @__PURE__ */ new Map(), e._registry.set(e.id, e), F(e.children, e);
|
|
389
|
+
for (let t of e.themes) e._registry.set(t.id, t), F(t.children, e);
|
|
390
|
+
}
|
|
391
|
+
function de(e, ...t) {
|
|
392
|
+
return t.reduce((e, t) => {
|
|
393
|
+
let n = {
|
|
394
|
+
...e,
|
|
395
|
+
root: P(e.root, t.root)
|
|
396
|
+
};
|
|
397
|
+
return I(n.root), (j(e) || j(t)) && ue(n), n;
|
|
398
|
+
}, e);
|
|
399
|
+
}
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/tokens/atRule.ts
|
|
402
|
+
function L(e, t) {
|
|
403
|
+
return function(n, r, i) {
|
|
404
|
+
let a = {
|
|
405
|
+
type: "at-rule",
|
|
406
|
+
id: O("ar-"),
|
|
407
|
+
parentId: e.id,
|
|
408
|
+
identifier: n,
|
|
409
|
+
rule: r,
|
|
410
|
+
declarations: {},
|
|
411
|
+
variables: [],
|
|
412
|
+
children: []
|
|
413
|
+
};
|
|
414
|
+
t._registry.set(a.id, a);
|
|
415
|
+
let o = H(a, t);
|
|
416
|
+
return typeof i == "function" ? a.declarations = i(o) ?? {} : h(i) ? (a.variables = i.variables, a.declarations = i.declarations, a.children = i.children) : i && (a.declarations = i), U(a.declarations, o, a, t), e.children.push(a), a;
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function R(e, t) {
|
|
420
|
+
let n = L(e, t);
|
|
421
|
+
return function(e, t) {
|
|
422
|
+
return n("media", e, t);
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function z(e, t) {
|
|
426
|
+
let n = L(e, t);
|
|
427
|
+
return function(e, t) {
|
|
428
|
+
return n("keyframes", e, t);
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/tokens/selector.ts
|
|
433
|
+
function B(e, t) {
|
|
434
|
+
return function(n, r) {
|
|
435
|
+
let i = {
|
|
436
|
+
type: "selector",
|
|
437
|
+
id: O("sel-"),
|
|
438
|
+
parentId: e.id,
|
|
439
|
+
query: n,
|
|
440
|
+
declarations: {},
|
|
441
|
+
variables: [],
|
|
442
|
+
children: []
|
|
443
|
+
};
|
|
444
|
+
t._registry.set(i.id, i);
|
|
445
|
+
let a = H(i, t);
|
|
446
|
+
return typeof r == "function" ? i.declarations = r(a) ?? {} : h(r) ? (i.variables = r.variables, i.declarations = r.declarations, i.children = r.children) : i.declarations = r, U(i.declarations, a, i, t), e.children.push(i), i;
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
//#endregion
|
|
450
|
+
//#region src/tokens/variable.ts
|
|
451
|
+
function V(e, t) {
|
|
452
|
+
return function(n, r, i = { default: !1 }) {
|
|
453
|
+
let a = typeof n == "string" ? n : n.name, o = w(e, t)(r), s = e.variables.find((e) => e.name === a);
|
|
454
|
+
if (i.default && s) return s;
|
|
455
|
+
if (s) return s.value = o, s;
|
|
456
|
+
let c = {
|
|
457
|
+
type: "variable",
|
|
458
|
+
id: O("var-"),
|
|
459
|
+
parentId: e.id,
|
|
460
|
+
name: a,
|
|
461
|
+
value: o
|
|
462
|
+
};
|
|
463
|
+
return e.variables.push(c), c;
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region src/tokens/declarations.ts
|
|
468
|
+
function H(e, t) {
|
|
469
|
+
let n = V(e, t), r = B(e, t), i = L(e, t);
|
|
470
|
+
return {
|
|
471
|
+
variable: n,
|
|
472
|
+
selector: r,
|
|
473
|
+
keyframes: z(t, t),
|
|
474
|
+
atRule: i,
|
|
475
|
+
media: R(e, t),
|
|
476
|
+
ref: T(t, t),
|
|
477
|
+
css: ne(t, t)
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function U(e, t, n, r) {
|
|
481
|
+
for (let n in e) if (n.startsWith("@")) {
|
|
482
|
+
let r = e[n];
|
|
483
|
+
if (typeof r == "object" && r && !p(r)) {
|
|
484
|
+
let i = n.replace(/^@(\w+).*/, "$1"), a = n.replace(`@${i}`, "").trim();
|
|
485
|
+
t.atRule(i, a, r), delete e[n];
|
|
486
|
+
}
|
|
487
|
+
} else if (/^[.&:]/.test(n) || /^(\d+%|from|to)(\s*,\s*(\d+%|from|to))*$/.test(n)) {
|
|
488
|
+
let r = e[n];
|
|
489
|
+
typeof r == "object" && (t.selector(n, r), delete e[n]);
|
|
490
|
+
}
|
|
491
|
+
let i = w(n, r);
|
|
492
|
+
for (let t in e) {
|
|
493
|
+
let n = e[t];
|
|
494
|
+
if (p(n)) {
|
|
495
|
+
let r = i(n);
|
|
496
|
+
r !== n && (e[t] = r);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
return e;
|
|
500
|
+
}
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region src/tokens/modifier.ts
|
|
503
|
+
function W(e, t, n) {
|
|
504
|
+
let r = {
|
|
505
|
+
...e,
|
|
506
|
+
id: O("ut-"),
|
|
507
|
+
parentId: e.parentId,
|
|
508
|
+
declarations: { ...e.declarations },
|
|
509
|
+
variables: [...e.variables],
|
|
510
|
+
children: [...e.children],
|
|
511
|
+
modifiers: [...n.keys()]
|
|
512
|
+
};
|
|
513
|
+
if (t._registry.set(r.id, r), n.size > 0) {
|
|
514
|
+
let i = [...n.values()], a = D(e.declarations);
|
|
515
|
+
r.declarations = {}, r.variables = [], r.children = [];
|
|
516
|
+
for (let n = i.length - 1; n >= 0; n--) {
|
|
517
|
+
let o = H(r, t), s = i[n]?.factory({
|
|
518
|
+
...o,
|
|
519
|
+
declarations: D(a),
|
|
520
|
+
variables: D(e.variables),
|
|
521
|
+
children: D(e.children)
|
|
522
|
+
});
|
|
523
|
+
s && (a = s);
|
|
524
|
+
}
|
|
525
|
+
r.declarations = a;
|
|
526
|
+
let o = H(r, t);
|
|
527
|
+
U(r.declarations, o, r, t);
|
|
528
|
+
}
|
|
529
|
+
return r;
|
|
530
|
+
}
|
|
531
|
+
function G(e, t) {
|
|
532
|
+
return function(e, n) {
|
|
533
|
+
let r = {
|
|
534
|
+
type: "modifier",
|
|
535
|
+
key: Array.isArray(e) ? e : [e],
|
|
536
|
+
factory: n
|
|
537
|
+
};
|
|
538
|
+
return t.modifiers.push(r), r;
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region src/tokens/root.ts
|
|
543
|
+
function K() {
|
|
544
|
+
let e = {
|
|
545
|
+
type: "root",
|
|
546
|
+
id: O("rt-"),
|
|
547
|
+
declarations: {},
|
|
548
|
+
utilities: [],
|
|
549
|
+
modifiers: [],
|
|
550
|
+
recipes: [],
|
|
551
|
+
variables: [],
|
|
552
|
+
children: [],
|
|
553
|
+
themes: [],
|
|
554
|
+
_registry: /* @__PURE__ */ new Map(),
|
|
555
|
+
_usage: {
|
|
556
|
+
variables: /* @__PURE__ */ new Set(),
|
|
557
|
+
utilities: /* @__PURE__ */ new Set(),
|
|
558
|
+
recipes: /* @__PURE__ */ new Set(),
|
|
559
|
+
recipeUtilities: /* @__PURE__ */ new Map()
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
return e._registry.set(e.id, e), e;
|
|
563
|
+
}
|
|
564
|
+
//#endregion
|
|
565
|
+
//#region src/tokens/utility.ts
|
|
566
|
+
function fe(e, t) {
|
|
567
|
+
let n = v({ namespace: e });
|
|
568
|
+
return (r) => {
|
|
569
|
+
if (typeof r == "string" && r[0] === "@") {
|
|
570
|
+
let i = r.slice(1), a = e.find((e) => i === e || i.startsWith(`${e}.`));
|
|
571
|
+
if (a) {
|
|
572
|
+
let e = i.slice(a.length + 1) || i;
|
|
573
|
+
if (t.variables.some((e) => e.name === i)) return t._usage.variables.add(i), { [e]: {
|
|
574
|
+
type: "reference",
|
|
575
|
+
name: i
|
|
576
|
+
} };
|
|
577
|
+
} else {
|
|
578
|
+
for (let n of e) {
|
|
579
|
+
let e = `${n}.${i}`;
|
|
580
|
+
if (t.variables.some((t) => t.name === e)) return t._usage.variables.add(e), { [i]: {
|
|
581
|
+
type: "reference",
|
|
582
|
+
name: e
|
|
583
|
+
} };
|
|
584
|
+
}
|
|
585
|
+
if (t.variables.some((e) => e.name === i)) return t._usage.variables.add(i), { [i]: {
|
|
586
|
+
type: "reference",
|
|
587
|
+
name: i
|
|
588
|
+
} };
|
|
589
|
+
}
|
|
590
|
+
return n(r);
|
|
591
|
+
}
|
|
592
|
+
return n(r);
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
function pe(e) {
|
|
596
|
+
let t = [/* @__PURE__ */ new Map()];
|
|
597
|
+
for (let n of e) {
|
|
598
|
+
if (!s(n)) continue;
|
|
599
|
+
let e = [];
|
|
600
|
+
for (let r of n.key) for (let i of t) {
|
|
601
|
+
let t = new Map(i);
|
|
602
|
+
t.set(r, n), e.push(t);
|
|
603
|
+
}
|
|
604
|
+
t = e;
|
|
605
|
+
}
|
|
606
|
+
return t.filter((e) => e.size > 0);
|
|
416
607
|
}
|
|
608
|
+
function q(e, t) {
|
|
609
|
+
return function(n, i, a = {}) {
|
|
610
|
+
let o = t.utilities.find((e) => e.name === n);
|
|
611
|
+
if (o) return o.create;
|
|
612
|
+
let s = {
|
|
613
|
+
type: "utility",
|
|
614
|
+
name: n,
|
|
615
|
+
factory: i,
|
|
616
|
+
values: [],
|
|
617
|
+
autogenerate: a.autogenerate ?? (Array.isArray(a.namespace) ? fe(a.namespace, t) : v(a.namespace ? { namespace: a.namespace } : void 0)),
|
|
618
|
+
namespace: a.namespace,
|
|
619
|
+
create: (a, o = []) => {
|
|
620
|
+
let c = a;
|
|
621
|
+
if (Array.isArray(a)) {
|
|
622
|
+
c = {};
|
|
623
|
+
for (let e of a) {
|
|
624
|
+
let n = s.autogenerate(e);
|
|
625
|
+
for (let e of Object.values(n)) y(t, e);
|
|
626
|
+
c = {
|
|
627
|
+
...c,
|
|
628
|
+
...n
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
for (let [a, l] of Object.entries(c)) {
|
|
633
|
+
let u = l;
|
|
634
|
+
if (typeof l == "string" && l[0] === "@") {
|
|
635
|
+
let e = l.slice(1);
|
|
636
|
+
!Array.isArray(c) && e in c && (u = c[e]);
|
|
637
|
+
}
|
|
638
|
+
if (s.namespace && r(l)) if (t.variables.some((e) => e.name === l.name)) u = l, t._usage.variables.add(l.name);
|
|
639
|
+
else {
|
|
640
|
+
let e = Array.isArray(s.namespace) ? s.namespace : [s.namespace], n = !1;
|
|
641
|
+
for (let r of e) {
|
|
642
|
+
let e = `${r}.${a}`;
|
|
643
|
+
if (e !== l.name && t.variables.some((t) => t.name === e)) {
|
|
644
|
+
u = {
|
|
645
|
+
type: "reference",
|
|
646
|
+
name: e
|
|
647
|
+
}, t._usage.variables.add(e), n = !0;
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
n || (t.variables.some((e) => e.name === a) ? (u = {
|
|
652
|
+
type: "reference",
|
|
653
|
+
name: a
|
|
654
|
+
}, t._usage.variables.add(a)) : u = a);
|
|
655
|
+
}
|
|
656
|
+
let d = s.values.find((e) => e.key === a && e.modifiers.length === 0), f = {
|
|
657
|
+
type: "utility",
|
|
658
|
+
id: O("ut-"),
|
|
659
|
+
parentId: e.id,
|
|
660
|
+
name: n,
|
|
661
|
+
value: a,
|
|
662
|
+
declarations: {},
|
|
663
|
+
variables: [],
|
|
664
|
+
children: [],
|
|
665
|
+
modifiers: []
|
|
666
|
+
};
|
|
667
|
+
t._registry.set(f.id, f);
|
|
668
|
+
let p = H(f, t);
|
|
669
|
+
if (f.declarations = i({
|
|
670
|
+
...p,
|
|
671
|
+
value: u
|
|
672
|
+
}) ?? {}, U(f.declarations, p, f, t), d || (s.values.push({
|
|
673
|
+
key: a,
|
|
674
|
+
value: u,
|
|
675
|
+
modifiers: []
|
|
676
|
+
}), e.children.push(f)), o && o.length > 0) for (let n of o) {
|
|
677
|
+
let r = pe(Array.isArray(n) ? n : [n]);
|
|
678
|
+
for (let n of r) {
|
|
679
|
+
let r = [...n.keys()];
|
|
680
|
+
s.values.find((e) => e.key === a && e.modifiers.length === r.length && e.modifiers.every((e, t) => e === r[t])) || (s.values.push({
|
|
681
|
+
key: a,
|
|
682
|
+
value: u,
|
|
683
|
+
modifiers: r
|
|
684
|
+
}), e.children.push(W(f, t, n)));
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
return t.utilities.push(s), s.create;
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/tokens/theme.ts
|
|
695
|
+
function J(e, t) {
|
|
696
|
+
return function(e, n) {
|
|
697
|
+
let r = t.themes.find((t) => t.name === e), i = r ?? {
|
|
698
|
+
type: "theme",
|
|
699
|
+
id: O("th-"),
|
|
700
|
+
parentId: t.id,
|
|
701
|
+
name: e,
|
|
702
|
+
declarations: {},
|
|
703
|
+
variables: [],
|
|
704
|
+
children: []
|
|
705
|
+
};
|
|
706
|
+
r || (t._registry.set(i.id, i), t.themes.push(i));
|
|
707
|
+
let a = H(i, t);
|
|
708
|
+
return n && n(a), i;
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
//#endregion
|
|
712
|
+
//#region src/tokens/recipe.ts
|
|
417
713
|
function Y(e, t) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
714
|
+
return function(e) {
|
|
715
|
+
let n = {
|
|
716
|
+
type: "recipe",
|
|
717
|
+
...e
|
|
718
|
+
};
|
|
719
|
+
return n._runtime = he(n, t), _e(n, t), t.recipes.push(n), n;
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
function me(e, t) {
|
|
723
|
+
let n = e.autogenerate(t);
|
|
724
|
+
return Object.keys(n)[0] ?? "default";
|
|
725
|
+
}
|
|
726
|
+
function X(e, t) {
|
|
727
|
+
let n = {};
|
|
728
|
+
for (let [r, i] of Object.entries(e)) if (Z(i)) {
|
|
729
|
+
let e = {};
|
|
730
|
+
for (let [n, r] of Object.entries(i)) {
|
|
731
|
+
let i = $(t, n);
|
|
732
|
+
if (!i) throw Error(`[styleframe] Utility "${n}" not found in registry. Make sure the utility is registered before using it in a recipe.`);
|
|
733
|
+
e[n] = me(i, r);
|
|
734
|
+
}
|
|
735
|
+
n[ge(r)] = e;
|
|
736
|
+
} else if (typeof i == "boolean") n[r] = i;
|
|
737
|
+
else {
|
|
738
|
+
let e = $(t, r);
|
|
739
|
+
if (!e) throw Error(`[styleframe] Utility "${r}" not found in registry. Make sure the utility is registered before using it in a recipe.`);
|
|
740
|
+
n[r] = me(e, i);
|
|
741
|
+
}
|
|
742
|
+
return n;
|
|
431
743
|
}
|
|
432
|
-
function
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
const i = {
|
|
449
|
-
type: "at-rule",
|
|
450
|
-
id: v("ar-"),
|
|
451
|
-
parentId: e.id,
|
|
452
|
-
identifier: n,
|
|
453
|
-
rule: s,
|
|
454
|
-
declarations: {},
|
|
455
|
-
variables: [],
|
|
456
|
-
children: []
|
|
457
|
-
};
|
|
458
|
-
t._registry.set(i.id, i);
|
|
459
|
-
const a = w(i, t);
|
|
460
|
-
return typeof c == "function" ? i.declarations = c(a) ?? {} : L(c) ? (i.variables = c.variables, i.declarations = c.declarations, i.children = c.children) : c && (i.declarations = c), E(
|
|
461
|
-
i.declarations,
|
|
462
|
-
a,
|
|
463
|
-
i,
|
|
464
|
-
t
|
|
465
|
-
), e.children.push(i), i;
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
function be(e, t) {
|
|
469
|
-
const r = I(e, t);
|
|
470
|
-
return function(s, c) {
|
|
471
|
-
return r("media", s, c);
|
|
472
|
-
};
|
|
744
|
+
function he(e, t) {
|
|
745
|
+
let n = {};
|
|
746
|
+
if (e.base && (n.base = X(e.base, t)), e.variants) {
|
|
747
|
+
let r = {};
|
|
748
|
+
for (let [n, i] of Object.entries(e.variants)) {
|
|
749
|
+
let e = {};
|
|
750
|
+
for (let [n, r] of Object.entries(i)) r == null ? e[n] = null : e[n] = X(r, t);
|
|
751
|
+
r[n] = e;
|
|
752
|
+
}
|
|
753
|
+
n.variants = r;
|
|
754
|
+
}
|
|
755
|
+
return e.defaultVariants && (n.defaultVariants = { ...e.defaultVariants }), e.compoundVariants && (n.compoundVariants = e.compoundVariants.map((e) => ({
|
|
756
|
+
match: { ...e.match },
|
|
757
|
+
...e.css ? { css: X(e.css, t) } : {},
|
|
758
|
+
...e.className ? { className: e.className } : {}
|
|
759
|
+
}))), n;
|
|
473
760
|
}
|
|
474
|
-
function
|
|
475
|
-
|
|
476
|
-
return function(s, c) {
|
|
477
|
-
return r("keyframes", s, c);
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
function Ae(e, t) {
|
|
481
|
-
return function(n, s) {
|
|
482
|
-
const c = {
|
|
483
|
-
type: "selector",
|
|
484
|
-
id: v("sel-"),
|
|
485
|
-
parentId: e.id,
|
|
486
|
-
query: n,
|
|
487
|
-
declarations: {},
|
|
488
|
-
variables: [],
|
|
489
|
-
children: []
|
|
490
|
-
};
|
|
491
|
-
t._registry.set(c.id, c);
|
|
492
|
-
const i = w(c, t);
|
|
493
|
-
return typeof s == "function" ? c.declarations = s(i) ?? {} : L(s) ? (c.variables = s.variables, c.declarations = s.declarations, c.children = s.children) : c.declarations = s, E(
|
|
494
|
-
c.declarations,
|
|
495
|
-
i,
|
|
496
|
-
c,
|
|
497
|
-
t
|
|
498
|
-
), e.children.push(c), c;
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
function we(e, t) {
|
|
502
|
-
return function(n, s, c = {
|
|
503
|
-
default: !1
|
|
504
|
-
}) {
|
|
505
|
-
const i = typeof n == "string" ? n : n.name, o = C(e, t)(s), f = e.variables.find(
|
|
506
|
-
(u) => u.name === i
|
|
507
|
-
);
|
|
508
|
-
if (c.default && f)
|
|
509
|
-
return f;
|
|
510
|
-
if (f)
|
|
511
|
-
return f.value = o, f;
|
|
512
|
-
const l = {
|
|
513
|
-
type: "variable",
|
|
514
|
-
id: v("var-"),
|
|
515
|
-
parentId: e.id,
|
|
516
|
-
name: i,
|
|
517
|
-
value: o
|
|
518
|
-
};
|
|
519
|
-
return e.variables.push(l), l;
|
|
520
|
-
};
|
|
761
|
+
function Z(e) {
|
|
762
|
+
return !r(e) && typeof e == "object" && !!e;
|
|
521
763
|
}
|
|
522
|
-
function
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
const i = e[c];
|
|
544
|
-
typeof i == "object" && (t.selector(c, i), delete e[c]);
|
|
545
|
-
}
|
|
546
|
-
const s = C(r, n);
|
|
547
|
-
for (const c in e) {
|
|
548
|
-
const i = e[c];
|
|
549
|
-
if (B(i)) {
|
|
550
|
-
const a = s(i);
|
|
551
|
-
a !== i && (e[c] = a);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
return e;
|
|
555
|
-
}
|
|
556
|
-
function je(e, t, r) {
|
|
557
|
-
const n = {
|
|
558
|
-
...e,
|
|
559
|
-
id: v("ut-"),
|
|
560
|
-
parentId: e.parentId,
|
|
561
|
-
declarations: { ...e.declarations },
|
|
562
|
-
variables: [...e.variables],
|
|
563
|
-
children: [...e.children],
|
|
564
|
-
modifiers: [...r.keys()]
|
|
565
|
-
};
|
|
566
|
-
if (t._registry.set(n.id, n), r.size > 0) {
|
|
567
|
-
const s = [...r.values()];
|
|
568
|
-
let c = R(e.declarations);
|
|
569
|
-
n.declarations = {}, n.variables = [], n.children = [];
|
|
570
|
-
for (let a = s.length - 1; a >= 0; a--) {
|
|
571
|
-
const o = w(n, t), f = s[a]?.factory({
|
|
572
|
-
...o,
|
|
573
|
-
declarations: R(c),
|
|
574
|
-
variables: R(e.variables),
|
|
575
|
-
children: R(e.children)
|
|
576
|
-
});
|
|
577
|
-
f && (c = f);
|
|
578
|
-
}
|
|
579
|
-
n.declarations = c;
|
|
580
|
-
const i = w(n, t);
|
|
581
|
-
E(
|
|
582
|
-
n.declarations,
|
|
583
|
-
i,
|
|
584
|
-
n,
|
|
585
|
-
t
|
|
586
|
-
);
|
|
587
|
-
}
|
|
588
|
-
return n;
|
|
589
|
-
}
|
|
590
|
-
function Ve(e, t) {
|
|
591
|
-
return function(n, s) {
|
|
592
|
-
const c = {
|
|
593
|
-
type: "modifier",
|
|
594
|
-
key: Array.isArray(n) ? n : [n],
|
|
595
|
-
factory: s
|
|
596
|
-
};
|
|
597
|
-
return t.modifiers.push(c), c;
|
|
598
|
-
};
|
|
599
|
-
}
|
|
600
|
-
function ke() {
|
|
601
|
-
const e = {
|
|
602
|
-
type: "root",
|
|
603
|
-
id: v("rt-"),
|
|
604
|
-
declarations: {},
|
|
605
|
-
utilities: [],
|
|
606
|
-
modifiers: [],
|
|
607
|
-
recipes: [],
|
|
608
|
-
variables: [],
|
|
609
|
-
children: [],
|
|
610
|
-
themes: [],
|
|
611
|
-
_registry: /* @__PURE__ */ new Map(),
|
|
612
|
-
_usage: {
|
|
613
|
-
variables: /* @__PURE__ */ new Set(),
|
|
614
|
-
utilities: /* @__PURE__ */ new Set()
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
return e._registry.set(e.id, e), e;
|
|
764
|
+
function ge(e) {
|
|
765
|
+
return e.startsWith("&::") ? e.slice(3) : e.startsWith("&:") ? e.slice(2) : e;
|
|
766
|
+
}
|
|
767
|
+
function Q(e, t) {
|
|
768
|
+
let n = (e, n, r) => {
|
|
769
|
+
let i = t.get(e);
|
|
770
|
+
i || (i = [], t.set(e, i)), i.push({
|
|
771
|
+
value: n,
|
|
772
|
+
modifiers: r
|
|
773
|
+
});
|
|
774
|
+
};
|
|
775
|
+
for (let [t, r] of Object.entries(e)) if (Z(r)) {
|
|
776
|
+
let e = ge(t).split(":");
|
|
777
|
+
for (let [t, i] of Object.entries(r)) n(t, i, e);
|
|
778
|
+
} else n(t, r, []);
|
|
779
|
+
}
|
|
780
|
+
function $(e, t) {
|
|
781
|
+
let n = e.utilities.find((e) => e.name === t);
|
|
782
|
+
if (n) return n;
|
|
783
|
+
let r = t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
784
|
+
return e.utilities.find((e) => e.name === r);
|
|
618
785
|
}
|
|
619
786
|
function _e(e, t) {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
name: s
|
|
651
|
-
}
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
return r(n);
|
|
655
|
-
}
|
|
656
|
-
return r(n);
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
function Re(e) {
|
|
660
|
-
let t = [/* @__PURE__ */ new Map()];
|
|
661
|
-
for (const r of e) {
|
|
662
|
-
if (!ne(r)) continue;
|
|
663
|
-
const n = [];
|
|
664
|
-
for (const s of r.key)
|
|
665
|
-
for (const c of t) {
|
|
666
|
-
const i = new Map(c);
|
|
667
|
-
i.set(s, r), n.push(i);
|
|
668
|
-
}
|
|
669
|
-
t = n;
|
|
670
|
-
}
|
|
671
|
-
return t.filter((r) => r.size > 0);
|
|
672
|
-
}
|
|
673
|
-
function Me(e, t) {
|
|
674
|
-
return function(n, s, c = {}) {
|
|
675
|
-
const i = t.utilities.find((o) => o.name === n);
|
|
676
|
-
if (i)
|
|
677
|
-
return i.create;
|
|
678
|
-
const a = {
|
|
679
|
-
type: "utility",
|
|
680
|
-
name: n,
|
|
681
|
-
factory: s,
|
|
682
|
-
values: [],
|
|
683
|
-
autogenerate: c.autogenerate ?? (Array.isArray(c.namespace) ? _e(c.namespace, t) : G(
|
|
684
|
-
c.namespace ? { namespace: c.namespace } : void 0
|
|
685
|
-
)),
|
|
686
|
-
namespace: c.namespace,
|
|
687
|
-
create: (o, f = []) => {
|
|
688
|
-
let l = o;
|
|
689
|
-
if (Array.isArray(o)) {
|
|
690
|
-
l = {};
|
|
691
|
-
for (const u of o) {
|
|
692
|
-
const d = a.autogenerate(u);
|
|
693
|
-
for (const y of Object.values(d))
|
|
694
|
-
oe(t, y);
|
|
695
|
-
l = {
|
|
696
|
-
...l,
|
|
697
|
-
...d
|
|
698
|
-
};
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
for (const [u, d] of Object.entries(l)) {
|
|
702
|
-
let y = d;
|
|
703
|
-
if (typeof d == "string" && d[0] === "@") {
|
|
704
|
-
const p = d.slice(1);
|
|
705
|
-
!Array.isArray(l) && p in l && (y = l[p]);
|
|
706
|
-
}
|
|
707
|
-
if (a.namespace && g(d))
|
|
708
|
-
if (t.variables.some((p) => p.name === d.name))
|
|
709
|
-
y = d, t._usage.variables.add(d.name);
|
|
710
|
-
else {
|
|
711
|
-
const p = Array.isArray(a.namespace) ? a.namespace : [a.namespace];
|
|
712
|
-
let _ = !1;
|
|
713
|
-
for (const V of p) {
|
|
714
|
-
const A = `${V}.${u}`;
|
|
715
|
-
if (A !== d.name && t.variables.some((k) => k.name === A)) {
|
|
716
|
-
y = {
|
|
717
|
-
type: "reference",
|
|
718
|
-
name: A
|
|
719
|
-
}, t._usage.variables.add(A), _ = !0;
|
|
720
|
-
break;
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
_ || (t.variables.some((V) => V.name === u) ? (y = {
|
|
724
|
-
type: "reference",
|
|
725
|
-
name: u
|
|
726
|
-
}, t._usage.variables.add(u)) : y = u);
|
|
727
|
-
}
|
|
728
|
-
const m = a.values.find(
|
|
729
|
-
(p) => p.key === u && p.modifiers.length === 0
|
|
730
|
-
), h = {
|
|
731
|
-
type: "utility",
|
|
732
|
-
id: v("ut-"),
|
|
733
|
-
parentId: e.id,
|
|
734
|
-
name: n,
|
|
735
|
-
value: u,
|
|
736
|
-
declarations: {},
|
|
737
|
-
variables: [],
|
|
738
|
-
children: [],
|
|
739
|
-
modifiers: []
|
|
740
|
-
};
|
|
741
|
-
t._registry.set(h.id, h);
|
|
742
|
-
const K = w(
|
|
743
|
-
h,
|
|
744
|
-
t
|
|
745
|
-
);
|
|
746
|
-
if (h.declarations = s({
|
|
747
|
-
...K,
|
|
748
|
-
value: y
|
|
749
|
-
}) ?? {}, E(
|
|
750
|
-
h.declarations,
|
|
751
|
-
K,
|
|
752
|
-
h,
|
|
753
|
-
t
|
|
754
|
-
), m || (a.values.push({
|
|
755
|
-
key: u,
|
|
756
|
-
value: y,
|
|
757
|
-
modifiers: []
|
|
758
|
-
}), e.children.push(h)), f && f.length > 0)
|
|
759
|
-
for (const p of f) {
|
|
760
|
-
const _ = Array.isArray(p) ? p : [p], V = Re(_);
|
|
761
|
-
for (const A of V) {
|
|
762
|
-
const k = [...A.keys()];
|
|
763
|
-
a.values.find(
|
|
764
|
-
(F) => F.key === u && F.modifiers.length === k.length && F.modifiers.every(
|
|
765
|
-
(Q, ee) => Q === k[ee]
|
|
766
|
-
)
|
|
767
|
-
) || (a.values.push({
|
|
768
|
-
key: u,
|
|
769
|
-
value: y,
|
|
770
|
-
modifiers: k
|
|
771
|
-
}), e.children.push(
|
|
772
|
-
je(h, t, A)
|
|
773
|
-
));
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
};
|
|
779
|
-
return t.utilities.push(a), a.create;
|
|
780
|
-
};
|
|
781
|
-
}
|
|
782
|
-
function $e(e, t) {
|
|
783
|
-
return function(n, s) {
|
|
784
|
-
const c = t.themes.find((o) => o.name === n), i = c ?? {
|
|
785
|
-
type: "theme",
|
|
786
|
-
id: v("th-"),
|
|
787
|
-
parentId: t.id,
|
|
788
|
-
name: n,
|
|
789
|
-
declarations: {},
|
|
790
|
-
variables: [],
|
|
791
|
-
children: []
|
|
792
|
-
};
|
|
793
|
-
c || (t._registry.set(i.id, i), t.themes.push(i));
|
|
794
|
-
const a = w(i, t);
|
|
795
|
-
return s && s(a), i;
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
function xe(e, t) {
|
|
799
|
-
return function(n) {
|
|
800
|
-
const s = {
|
|
801
|
-
type: "recipe",
|
|
802
|
-
...n
|
|
803
|
-
};
|
|
804
|
-
return s._runtime = Ee(s, t), Fe(s, t), t.recipes.push(s), s;
|
|
805
|
-
};
|
|
806
|
-
}
|
|
807
|
-
function W(e, t) {
|
|
808
|
-
const r = e.autogenerate(t);
|
|
809
|
-
return Object.keys(r)[0] ?? "default";
|
|
810
|
-
}
|
|
811
|
-
function S(e, t) {
|
|
812
|
-
const r = {};
|
|
813
|
-
for (const [n, s] of Object.entries(e))
|
|
814
|
-
if (Z(s)) {
|
|
815
|
-
const c = {};
|
|
816
|
-
for (const [i, a] of Object.entries(s)) {
|
|
817
|
-
const o = D(t, i);
|
|
818
|
-
if (!o)
|
|
819
|
-
throw new Error(
|
|
820
|
-
`[styleframe] Utility "${i}" not found in registry. Make sure the utility is registered before using it in a recipe.`
|
|
821
|
-
);
|
|
822
|
-
c[i] = W(
|
|
823
|
-
o,
|
|
824
|
-
a
|
|
825
|
-
);
|
|
826
|
-
}
|
|
827
|
-
r[J(n)] = c;
|
|
828
|
-
} else if (typeof s == "boolean")
|
|
829
|
-
r[n] = s;
|
|
830
|
-
else {
|
|
831
|
-
const c = D(t, n);
|
|
832
|
-
if (!c)
|
|
833
|
-
throw new Error(
|
|
834
|
-
`[styleframe] Utility "${n}" not found in registry. Make sure the utility is registered before using it in a recipe.`
|
|
835
|
-
);
|
|
836
|
-
r[n] = W(c, s);
|
|
837
|
-
}
|
|
838
|
-
return r;
|
|
839
|
-
}
|
|
840
|
-
function Ee(e, t) {
|
|
841
|
-
const r = {};
|
|
842
|
-
if (e.base && (r.base = S(e.base, t)), e.variants) {
|
|
843
|
-
const n = {};
|
|
844
|
-
for (const [s, c] of Object.entries(e.variants)) {
|
|
845
|
-
const i = {};
|
|
846
|
-
for (const [a, o] of Object.entries(
|
|
847
|
-
c
|
|
848
|
-
))
|
|
849
|
-
o == null ? i[a] = null : i[a] = S(
|
|
850
|
-
o,
|
|
851
|
-
t
|
|
852
|
-
);
|
|
853
|
-
n[s] = i;
|
|
854
|
-
}
|
|
855
|
-
r.variants = n;
|
|
856
|
-
}
|
|
857
|
-
return e.defaultVariants && (r.defaultVariants = { ...e.defaultVariants }), e.compoundVariants && (r.compoundVariants = e.compoundVariants.map((n) => ({
|
|
858
|
-
match: { ...n.match },
|
|
859
|
-
...n.css ? { css: S(n.css, t) } : {},
|
|
860
|
-
...n.className ? { className: n.className } : {}
|
|
861
|
-
}))), r;
|
|
862
|
-
}
|
|
863
|
-
function Z(e) {
|
|
864
|
-
return !g(e) && typeof e == "object" && e !== null;
|
|
787
|
+
let n = /* @__PURE__ */ new Map();
|
|
788
|
+
if (e.base && Q(e.base, n), e.variants) for (let t of Object.values(e.variants)) for (let e of Object.values(t)) Q(e, n);
|
|
789
|
+
if (e.compoundVariants) for (let t of e.compoundVariants) t.css && Q(t.css, n);
|
|
790
|
+
let r = /* @__PURE__ */ new Map();
|
|
791
|
+
for (let [i, a] of n) {
|
|
792
|
+
let n = $(t, i);
|
|
793
|
+
if (!n) throw Error(`[styleframe] Utility "${i}" not found in registry. Make sure the utility is registered before using it in a recipe.`);
|
|
794
|
+
for (let i of a) {
|
|
795
|
+
let a = [];
|
|
796
|
+
for (let e of i.modifiers) {
|
|
797
|
+
if (!r.has(e)) try {
|
|
798
|
+
r.set(e, k(t, e));
|
|
799
|
+
} catch {
|
|
800
|
+
throw Error(`[styleframe] Modifier "${e}" not found in registry. Make sure the modifier is registered before using it in a recipe.`);
|
|
801
|
+
}
|
|
802
|
+
let n = r.get(e);
|
|
803
|
+
n && a.push(n);
|
|
804
|
+
}
|
|
805
|
+
let o = n.autogenerate(i.value);
|
|
806
|
+
for (let r of Object.keys(o)) {
|
|
807
|
+
let a = te({
|
|
808
|
+
name: n.name,
|
|
809
|
+
value: r,
|
|
810
|
+
modifiers: i.modifiers
|
|
811
|
+
}), o = t._usage.recipeUtilities.get(e.name);
|
|
812
|
+
o || (o = /* @__PURE__ */ new Set(), t._usage.recipeUtilities.set(e.name, o)), o.add(a);
|
|
813
|
+
}
|
|
814
|
+
n.create([i.value], a.length > 0 ? a.length > 1 ? [a] : a : void 0);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
865
817
|
}
|
|
866
|
-
function
|
|
867
|
-
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
for (const s of Object.values(e.variants))
|
|
893
|
-
for (const c of Object.values(s))
|
|
894
|
-
T(
|
|
895
|
-
c,
|
|
896
|
-
r
|
|
897
|
-
);
|
|
898
|
-
if (e.compoundVariants)
|
|
899
|
-
for (const s of e.compoundVariants)
|
|
900
|
-
s.css && T(s.css, r);
|
|
901
|
-
const n = /* @__PURE__ */ new Map();
|
|
902
|
-
for (const [s, c] of r) {
|
|
903
|
-
const i = D(t, s);
|
|
904
|
-
if (!i)
|
|
905
|
-
throw new Error(
|
|
906
|
-
`[styleframe] Utility "${s}" not found in registry. Make sure the utility is registered before using it in a recipe.`
|
|
907
|
-
);
|
|
908
|
-
for (const a of c) {
|
|
909
|
-
const o = [];
|
|
910
|
-
for (const l of a.modifiers) {
|
|
911
|
-
if (!n.has(l))
|
|
912
|
-
try {
|
|
913
|
-
n.set(l, ye(t, l));
|
|
914
|
-
} catch {
|
|
915
|
-
throw new Error(
|
|
916
|
-
`[styleframe] Modifier "${l}" not found in registry. Make sure the modifier is registered before using it in a recipe.`
|
|
917
|
-
);
|
|
918
|
-
}
|
|
919
|
-
const u = n.get(l);
|
|
920
|
-
u && o.push(u);
|
|
921
|
-
}
|
|
922
|
-
const f = i.autogenerate(a.value);
|
|
923
|
-
for (const l of Object.keys(f))
|
|
924
|
-
t._usage.utilities.add(
|
|
925
|
-
ce({
|
|
926
|
-
name: i.name,
|
|
927
|
-
value: l,
|
|
928
|
-
modifiers: a.modifiers
|
|
929
|
-
})
|
|
930
|
-
);
|
|
931
|
-
i.create(
|
|
932
|
-
[a.value],
|
|
933
|
-
o.length > 0 ? o.length > 1 ? [o] : o : void 0
|
|
934
|
-
);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
function He(e) {
|
|
939
|
-
const t = v("sf-"), r = ke(), n = { ...e }, s = Me(r, r), c = Ve(r, r), i = xe(r, r), a = $e(r, r), { variable: o, selector: f, atRule: l, keyframes: u, media: d, ref: y, css: m } = w(r, r);
|
|
940
|
-
return {
|
|
941
|
-
id: t,
|
|
942
|
-
root: r,
|
|
943
|
-
variable: o,
|
|
944
|
-
selector: f,
|
|
945
|
-
utility: s,
|
|
946
|
-
modifier: c,
|
|
947
|
-
recipe: i,
|
|
948
|
-
theme: a,
|
|
949
|
-
atRule: l,
|
|
950
|
-
keyframes: u,
|
|
951
|
-
media: d,
|
|
952
|
-
ref: y,
|
|
953
|
-
css: m,
|
|
954
|
-
options: n
|
|
955
|
-
};
|
|
956
|
-
}
|
|
957
|
-
export {
|
|
958
|
-
je as applyModifiers,
|
|
959
|
-
De as capitalizeFirst,
|
|
960
|
-
Ce as classNameToCssSelector,
|
|
961
|
-
I as createAtRuleFunction,
|
|
962
|
-
ue as createCssFunction,
|
|
963
|
-
w as createDeclarationsCallbackContext,
|
|
964
|
-
ve as createKeyframesFunction,
|
|
965
|
-
be as createMediaFunction,
|
|
966
|
-
Ve as createModifierFunction,
|
|
967
|
-
C as createPropertyValueResolver,
|
|
968
|
-
xe as createRecipeFunction,
|
|
969
|
-
q as createRefFunction,
|
|
970
|
-
ke as createRoot,
|
|
971
|
-
Ae as createSelectorFunction,
|
|
972
|
-
$e as createThemeFunction,
|
|
973
|
-
Me as createUtilityFunction,
|
|
974
|
-
we as createVariableFunction,
|
|
975
|
-
R as deepClone,
|
|
976
|
-
ce as defaultUtilitySelectorFn,
|
|
977
|
-
ae as findVariableInScope,
|
|
978
|
-
v as generateRandomId,
|
|
979
|
-
Ee as generateRecipeRuntime,
|
|
980
|
-
ye as getModifier,
|
|
981
|
-
Ke as getUtility,
|
|
982
|
-
Ie as getVariable,
|
|
983
|
-
se as hashValue,
|
|
984
|
-
te as isAtRule,
|
|
985
|
-
$ as isCSS,
|
|
986
|
-
Pe as isContainer,
|
|
987
|
-
L as isContainerInput,
|
|
988
|
-
ie as isKeyReferenceValue,
|
|
989
|
-
ne as isModifier,
|
|
990
|
-
x as isObject,
|
|
991
|
-
re as isPrimitiveTokenValue,
|
|
992
|
-
Be as isRecipe,
|
|
993
|
-
g as isRef,
|
|
994
|
-
M as isRoot,
|
|
995
|
-
Oe as isSelector,
|
|
996
|
-
Ue as isStyleframe,
|
|
997
|
-
Te as isTheme,
|
|
998
|
-
b as isToken,
|
|
999
|
-
O as isTokenEqual,
|
|
1000
|
-
B as isTokenValue,
|
|
1001
|
-
Se as isUtility,
|
|
1002
|
-
H as isVariable,
|
|
1003
|
-
We as merge,
|
|
1004
|
-
Y as mergeContainers,
|
|
1005
|
-
he as mergeThemesArray,
|
|
1006
|
-
pe as mergeVariablesArray,
|
|
1007
|
-
z as parseAtReferences,
|
|
1008
|
-
E as parseDeclarationsBlock,
|
|
1009
|
-
Fe as processRecipeUtilities,
|
|
1010
|
-
ge as rebuildRegistry,
|
|
1011
|
-
le as rfdc,
|
|
1012
|
-
He as styleframe,
|
|
1013
|
-
oe as trackReferenceUsage,
|
|
1014
|
-
G as transformUtilityKey,
|
|
1015
|
-
fe as validateReference
|
|
1016
|
-
};
|
|
818
|
+
function ve(e, t) {
|
|
819
|
+
for (let [n, r] of e._usage.recipeUtilities) if (!t || t.has(n)) for (let t of r) e._usage.utilities.add(t);
|
|
820
|
+
}
|
|
821
|
+
//#endregion
|
|
822
|
+
//#region src/styleframe.ts
|
|
823
|
+
function ye(e) {
|
|
824
|
+
let t = O("sf-"), n = K(), r = { ...e }, i = q(n, n), a = G(n, n), o = Y(n, n), s = J(n, n), { variable: c, selector: l, atRule: u, keyframes: d, media: f, ref: p, css: m } = H(n, n);
|
|
825
|
+
return {
|
|
826
|
+
id: t,
|
|
827
|
+
root: n,
|
|
828
|
+
variable: c,
|
|
829
|
+
selector: l,
|
|
830
|
+
utility: i,
|
|
831
|
+
modifier: a,
|
|
832
|
+
recipe: o,
|
|
833
|
+
theme: s,
|
|
834
|
+
atRule: u,
|
|
835
|
+
keyframes: d,
|
|
836
|
+
media: f,
|
|
837
|
+
ref: p,
|
|
838
|
+
css: m,
|
|
839
|
+
options: r
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
//#endregion
|
|
843
|
+
export { W as applyModifiers, re as capitalizeFirst, ie as classNameToCssSelector, L as createAtRuleFunction, ne as createCssFunction, H as createDeclarationsCallbackContext, z as createKeyframesFunction, R as createMediaFunction, G as createModifierFunction, w as createPropertyValueResolver, Y as createRecipeFunction, T as createRefFunction, K as createRoot, B as createSelectorFunction, J as createThemeFunction, q as createUtilityFunction, V as createVariableFunction, D as deepClone, te as defaultUtilitySelectorFn, S as findVariableInScope, O as generateRandomId, he as generateRecipeRuntime, k as getModifier, ce as getUtility, se as getVariable, _ as hashValue, a as isAtRule, c as isCSS, m as isContainer, h as isContainerInput, g as isKeyReferenceValue, s as isModifier, e as isObject, f as isPrimitiveTokenValue, d as isRecipe, r as isRef, u as isRoot, i as isSelector, ee as isStyleframe, l as isTheme, t as isToken, A as isTokenEqual, p as isTokenValue, o as isUtility, n as isVariable, de as merge, P as mergeContainers, N as mergeThemesArray, M as mergeVariablesArray, x as parseAtReferences, U as parseDeclarationsBlock, _e as processRecipeUtilities, I as rebuildRegistry, ve as registerRecipeUtilities, ae as rfdc, ye as styleframe, y as trackReferenceUsage, v as transformUtilityKey, C as validateReference };
|