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