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