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