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