@styleframe/core 2.3.0 → 2.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 +12 -0
- package/dist/styleframe.d.ts +259 -15
- package/dist/styleframe.js +431 -261
- package/dist/styleframe.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/styleframe.js
CHANGED
|
@@ -1,55 +1,73 @@
|
|
|
1
|
-
function
|
|
2
|
-
return function(t, ...i) {
|
|
3
|
-
return {
|
|
4
|
-
type: "css",
|
|
5
|
-
value: t.reduce((o, u, c) => (o.push(u), c < i.length && o.push(i[c]), o), [])
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
function M(e) {
|
|
1
|
+
function S(e) {
|
|
10
2
|
return typeof e == "object" && e !== null;
|
|
11
3
|
}
|
|
12
4
|
function p(e, r) {
|
|
13
|
-
return
|
|
5
|
+
return S(e) && "type" in e && e.type === r;
|
|
14
6
|
}
|
|
15
|
-
function
|
|
7
|
+
function L(e) {
|
|
16
8
|
return p(e, "variable");
|
|
17
9
|
}
|
|
18
|
-
function
|
|
10
|
+
function A(e) {
|
|
19
11
|
return p(e, "reference");
|
|
20
12
|
}
|
|
21
|
-
function
|
|
13
|
+
function be(e) {
|
|
22
14
|
return p(e, "selector");
|
|
23
15
|
}
|
|
24
|
-
function
|
|
16
|
+
function ge(e) {
|
|
25
17
|
return p(e, "at-rule");
|
|
26
18
|
}
|
|
27
|
-
function
|
|
19
|
+
function je(e) {
|
|
28
20
|
return p(e, "utility");
|
|
29
21
|
}
|
|
30
|
-
function
|
|
22
|
+
function q(e) {
|
|
31
23
|
return p(e, "modifier");
|
|
32
24
|
}
|
|
33
|
-
function
|
|
25
|
+
function E(e) {
|
|
34
26
|
return p(e, "css");
|
|
35
27
|
}
|
|
36
|
-
function
|
|
28
|
+
function ve(e) {
|
|
37
29
|
return p(e, "theme");
|
|
38
30
|
}
|
|
39
|
-
function
|
|
31
|
+
function O(e) {
|
|
40
32
|
return p(e, "root");
|
|
41
33
|
}
|
|
42
|
-
function
|
|
34
|
+
function Ae(e) {
|
|
35
|
+
return p(e, "recipe");
|
|
36
|
+
}
|
|
37
|
+
function G(e) {
|
|
43
38
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
44
39
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
40
|
+
function $(e) {
|
|
41
|
+
return G(e) || A(e) || E(e) || Array.isArray(e) && e.every($);
|
|
47
42
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
43
|
+
function I(e) {
|
|
44
|
+
return S(e) && "children" in e && "declarations" in e && "variables" in e;
|
|
45
|
+
}
|
|
46
|
+
function z(e = (r) => r) {
|
|
47
|
+
return (r) => {
|
|
48
|
+
let n = r, t;
|
|
49
|
+
if (typeof n == "string" && n[0] === "@") {
|
|
50
|
+
const i = n.slice(1);
|
|
51
|
+
t = e(i), n = {
|
|
52
|
+
type: "reference",
|
|
53
|
+
name: i
|
|
54
|
+
};
|
|
55
|
+
} else A(n) ? t = e(n.name) : t = `[${r}]`;
|
|
56
|
+
return {
|
|
57
|
+
[t]: n
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function W(e, r) {
|
|
62
|
+
return function(t, ...i) {
|
|
63
|
+
return {
|
|
64
|
+
type: "css",
|
|
65
|
+
value: t.reduce((o, u, s) => (o.push(u), s < i.length && o.push(i[s]), o), [])
|
|
66
|
+
};
|
|
67
|
+
};
|
|
50
68
|
}
|
|
51
|
-
function
|
|
52
|
-
return function(t, i,
|
|
69
|
+
function C(e, r) {
|
|
70
|
+
return function(t, i, c) {
|
|
53
71
|
const o = {
|
|
54
72
|
type: "at-rule",
|
|
55
73
|
identifier: t,
|
|
@@ -57,25 +75,25 @@ function R(e, r) {
|
|
|
57
75
|
declarations: {},
|
|
58
76
|
variables: [],
|
|
59
77
|
children: []
|
|
60
|
-
}, u =
|
|
61
|
-
return typeof
|
|
78
|
+
}, u = v(o, r);
|
|
79
|
+
return typeof c == "function" ? o.declarations = c(u) ?? {} : c && (o.declarations = c), V(o.declarations, u), e.children.push(o), o;
|
|
62
80
|
};
|
|
63
81
|
}
|
|
64
|
-
function
|
|
65
|
-
const n =
|
|
66
|
-
return function(i,
|
|
67
|
-
return n("media", i,
|
|
82
|
+
function Y(e, r) {
|
|
83
|
+
const n = C(e, r);
|
|
84
|
+
return function(i, c) {
|
|
85
|
+
return n("media", i, c);
|
|
68
86
|
};
|
|
69
87
|
}
|
|
70
|
-
function
|
|
71
|
-
const n =
|
|
72
|
-
return function(i,
|
|
73
|
-
return n("keyframes", i,
|
|
88
|
+
function Z(e, r) {
|
|
89
|
+
const n = C(e, r);
|
|
90
|
+
return function(i, c) {
|
|
91
|
+
return n("keyframes", i, c);
|
|
74
92
|
};
|
|
75
93
|
}
|
|
76
|
-
function
|
|
94
|
+
function J(e, r) {
|
|
77
95
|
return function(t, i) {
|
|
78
|
-
return
|
|
96
|
+
return L(t) ? {
|
|
79
97
|
type: "reference",
|
|
80
98
|
name: t.name,
|
|
81
99
|
fallback: i
|
|
@@ -86,56 +104,56 @@ function P(e, r) {
|
|
|
86
104
|
};
|
|
87
105
|
};
|
|
88
106
|
}
|
|
89
|
-
function
|
|
107
|
+
function Q(e, r) {
|
|
90
108
|
return function(t, i) {
|
|
91
|
-
const
|
|
109
|
+
const c = {
|
|
92
110
|
type: "selector",
|
|
93
111
|
query: t,
|
|
94
112
|
declarations: {},
|
|
95
113
|
variables: [],
|
|
96
114
|
children: []
|
|
97
|
-
}, o =
|
|
98
|
-
return typeof i == "function" ?
|
|
115
|
+
}, o = v(c, r);
|
|
116
|
+
return typeof i == "function" ? c.declarations = i(o) ?? {} : I(i) ? (c.variables = i.variables, c.declarations = i.declarations, c.children = i.children) : c.declarations = i, V(c.declarations, o), e.children.push(c), c;
|
|
99
117
|
};
|
|
100
118
|
}
|
|
101
|
-
function
|
|
102
|
-
return function(t, i,
|
|
119
|
+
function X(e, r) {
|
|
120
|
+
return function(t, i, c = {
|
|
103
121
|
default: !1
|
|
104
122
|
}) {
|
|
105
123
|
const o = typeof t == "string" ? t : t.name, u = e.variables.find(
|
|
106
124
|
(f) => f.name === o
|
|
107
125
|
);
|
|
108
|
-
if (
|
|
126
|
+
if (c.default && u)
|
|
109
127
|
return u;
|
|
110
128
|
if (u)
|
|
111
129
|
return u.value = i, u;
|
|
112
|
-
const
|
|
130
|
+
const s = {
|
|
113
131
|
type: "variable",
|
|
114
132
|
name: o,
|
|
115
133
|
value: i
|
|
116
134
|
};
|
|
117
|
-
return e.variables.push(
|
|
135
|
+
return e.variables.push(s), s;
|
|
118
136
|
};
|
|
119
137
|
}
|
|
120
|
-
function
|
|
121
|
-
const n =
|
|
138
|
+
function v(e, r) {
|
|
139
|
+
const n = X(e), t = Q(e, r), i = C(e, r), c = Z(r, r), o = Y(e, r), u = J(), s = W();
|
|
122
140
|
return {
|
|
123
141
|
variable: n,
|
|
124
142
|
selector: t,
|
|
125
|
-
keyframes:
|
|
143
|
+
keyframes: c,
|
|
126
144
|
atRule: i,
|
|
127
145
|
media: o,
|
|
128
146
|
ref: u,
|
|
129
|
-
css:
|
|
147
|
+
css: s
|
|
130
148
|
};
|
|
131
149
|
}
|
|
132
|
-
function
|
|
150
|
+
function V(e, r) {
|
|
133
151
|
for (const n in e)
|
|
134
152
|
if (n.startsWith("@")) {
|
|
135
153
|
const t = e[n];
|
|
136
|
-
if (typeof t == "object" && t !== null &&
|
|
137
|
-
const i = n.replace(/^@(\w+).*/, "$1"),
|
|
138
|
-
r.atRule(i,
|
|
154
|
+
if (typeof t == "object" && t !== null && !$(t)) {
|
|
155
|
+
const i = n.replace(/^@(\w+).*/, "$1"), c = n.replace(`@${i}`, "").trim();
|
|
156
|
+
r.atRule(i, c, t), delete e[n];
|
|
139
157
|
}
|
|
140
158
|
} else if (/^[.&:]/.test(n)) {
|
|
141
159
|
const t = e[n];
|
|
@@ -143,10 +161,10 @@ function g(e, r) {
|
|
|
143
161
|
}
|
|
144
162
|
return e;
|
|
145
163
|
}
|
|
146
|
-
function
|
|
164
|
+
function we(e) {
|
|
147
165
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
148
166
|
}
|
|
149
|
-
function
|
|
167
|
+
function j(e) {
|
|
150
168
|
if (e instanceof Buffer)
|
|
151
169
|
return Buffer.from(e);
|
|
152
170
|
const r = e.constructor;
|
|
@@ -156,9 +174,9 @@ function m(e) {
|
|
|
156
174
|
e.byteLength / e.BYTES_PER_ELEMENT || 1
|
|
157
175
|
);
|
|
158
176
|
}
|
|
159
|
-
function
|
|
177
|
+
function ee(e) {
|
|
160
178
|
if (e = e || {}, e.circular)
|
|
161
|
-
return
|
|
179
|
+
return te(e);
|
|
162
180
|
const r = /* @__PURE__ */ new Map();
|
|
163
181
|
if (r.set(Date, (o) => new Date(o)), r.set(
|
|
164
182
|
Map,
|
|
@@ -170,12 +188,12 @@ function K(e) {
|
|
|
170
188
|
for (const o of e.constructorHandlers)
|
|
171
189
|
r.set(o[0], o[1]);
|
|
172
190
|
let n;
|
|
173
|
-
return e.proto ?
|
|
191
|
+
return e.proto ? c : i;
|
|
174
192
|
function t(o, u) {
|
|
175
|
-
const
|
|
176
|
-
for (let
|
|
177
|
-
const
|
|
178
|
-
typeof y != "object" || y === null ? f[
|
|
193
|
+
const s = Object.keys(o), f = Array.from({ length: s.length });
|
|
194
|
+
for (let l = 0; l < s.length; l++) {
|
|
195
|
+
const a = s[l], y = o[a];
|
|
196
|
+
typeof y != "object" || y === null ? f[a] = y : y.constructor !== Object && (n = r.get(y.constructor)) ? f[a] = n(y, u) : ArrayBuffer.isView(y) ? f[a] = j(y) : f[a] = u(y);
|
|
179
197
|
}
|
|
180
198
|
return f;
|
|
181
199
|
}
|
|
@@ -185,125 +203,125 @@ function K(e) {
|
|
|
185
203
|
if (o.constructor !== Object && (n = r.get(o.constructor)))
|
|
186
204
|
return n(o, i);
|
|
187
205
|
const u = {};
|
|
188
|
-
for (const
|
|
189
|
-
if (Object.hasOwnProperty.call(o,
|
|
190
|
-
const f = o[
|
|
191
|
-
typeof f != "object" || f === null ? u[
|
|
206
|
+
for (const s in o) {
|
|
207
|
+
if (Object.hasOwnProperty.call(o, s) === !1) continue;
|
|
208
|
+
const f = o[s];
|
|
209
|
+
typeof f != "object" || f === null ? u[s] = f : f.constructor !== Object && (n = r.get(f.constructor)) ? u[s] = n(f, i) : ArrayBuffer.isView(f) ? u[s] = j(f) : u[s] = i(f);
|
|
192
210
|
}
|
|
193
211
|
return u;
|
|
194
212
|
}
|
|
195
|
-
function
|
|
213
|
+
function c(o) {
|
|
196
214
|
if (typeof o != "object" || o === null) return o;
|
|
197
|
-
if (Array.isArray(o)) return t(o,
|
|
215
|
+
if (Array.isArray(o)) return t(o, c);
|
|
198
216
|
if (o.constructor !== Object && (n = r.get(o.constructor)))
|
|
199
|
-
return n(o,
|
|
217
|
+
return n(o, c);
|
|
200
218
|
const u = {};
|
|
201
|
-
for (const
|
|
202
|
-
const f = o[
|
|
203
|
-
typeof f != "object" || f === null ? u[
|
|
219
|
+
for (const s in o) {
|
|
220
|
+
const f = o[s];
|
|
221
|
+
typeof f != "object" || f === null ? u[s] = f : f.constructor !== Object && (n = r.get(f.constructor)) ? u[s] = n(f, c) : ArrayBuffer.isView(f) ? u[s] = j(f) : u[s] = c(f);
|
|
204
222
|
}
|
|
205
223
|
return u;
|
|
206
224
|
}
|
|
207
225
|
}
|
|
208
|
-
function
|
|
226
|
+
function te(e) {
|
|
209
227
|
const r = [], n = [], t = /* @__PURE__ */ new Map();
|
|
210
|
-
if (t.set(Date, (
|
|
228
|
+
if (t.set(Date, (s) => new Date(s)), t.set(
|
|
211
229
|
Map,
|
|
212
|
-
(
|
|
230
|
+
(s, f) => new Map(c(Array.from(s), f))
|
|
213
231
|
), t.set(
|
|
214
232
|
Set,
|
|
215
|
-
(
|
|
233
|
+
(s, f) => new Set(c(Array.from(s), f))
|
|
216
234
|
), e.constructorHandlers)
|
|
217
|
-
for (const
|
|
218
|
-
t.set(
|
|
235
|
+
for (const s of e.constructorHandlers)
|
|
236
|
+
t.set(s[0], s[1]);
|
|
219
237
|
let i;
|
|
220
238
|
return e.proto ? u : o;
|
|
221
|
-
function s
|
|
222
|
-
const
|
|
223
|
-
for (let y = 0; y <
|
|
224
|
-
const
|
|
239
|
+
function c(s, f) {
|
|
240
|
+
const l = Object.keys(s), a = Array.from({ length: l.length });
|
|
241
|
+
for (let y = 0; y < l.length; y++) {
|
|
242
|
+
const m = l[y], d = s[m];
|
|
225
243
|
if (typeof d != "object" || d === null)
|
|
226
|
-
|
|
244
|
+
a[m] = d;
|
|
227
245
|
else if (d.constructor !== Object && (i = t.get(d.constructor)))
|
|
228
|
-
|
|
246
|
+
a[m] = i(d, f);
|
|
229
247
|
else if (ArrayBuffer.isView(d))
|
|
230
|
-
|
|
248
|
+
a[m] = j(d);
|
|
231
249
|
else {
|
|
232
|
-
const
|
|
233
|
-
|
|
250
|
+
const h = r.indexOf(d);
|
|
251
|
+
h !== -1 ? a[m] = n[h] : a[m] = f(d);
|
|
234
252
|
}
|
|
235
253
|
}
|
|
236
|
-
return
|
|
254
|
+
return a;
|
|
237
255
|
}
|
|
238
|
-
function o(
|
|
239
|
-
if (typeof
|
|
240
|
-
if (Array.isArray(
|
|
241
|
-
if (
|
|
242
|
-
return i(
|
|
256
|
+
function o(s) {
|
|
257
|
+
if (typeof s != "object" || s === null) return s;
|
|
258
|
+
if (Array.isArray(s)) return c(s, o);
|
|
259
|
+
if (s.constructor !== Object && (i = t.get(s.constructor)))
|
|
260
|
+
return i(s, o);
|
|
243
261
|
const f = {};
|
|
244
|
-
r.push(
|
|
245
|
-
for (const
|
|
246
|
-
if (Object.hasOwnProperty.call(
|
|
247
|
-
const
|
|
248
|
-
if (typeof
|
|
249
|
-
f[
|
|
250
|
-
else if (
|
|
251
|
-
f[
|
|
252
|
-
else if (ArrayBuffer.isView(
|
|
253
|
-
f[
|
|
262
|
+
r.push(s), n.push(f);
|
|
263
|
+
for (const l in s) {
|
|
264
|
+
if (Object.hasOwnProperty.call(s, l) === !1) continue;
|
|
265
|
+
const a = s[l];
|
|
266
|
+
if (typeof a != "object" || a === null)
|
|
267
|
+
f[l] = a;
|
|
268
|
+
else if (a.constructor !== Object && (i = t.get(a.constructor)))
|
|
269
|
+
f[l] = i(a, o);
|
|
270
|
+
else if (ArrayBuffer.isView(a))
|
|
271
|
+
f[l] = j(a);
|
|
254
272
|
else {
|
|
255
|
-
const y = r.indexOf(
|
|
256
|
-
y !== -1 ? f[
|
|
273
|
+
const y = r.indexOf(a);
|
|
274
|
+
y !== -1 ? f[l] = n[y] : f[l] = o(a);
|
|
257
275
|
}
|
|
258
276
|
}
|
|
259
277
|
return r.pop(), n.pop(), f;
|
|
260
278
|
}
|
|
261
|
-
function u(
|
|
262
|
-
if (typeof
|
|
263
|
-
if (Array.isArray(
|
|
264
|
-
if (
|
|
265
|
-
return i(
|
|
279
|
+
function u(s) {
|
|
280
|
+
if (typeof s != "object" || s === null) return s;
|
|
281
|
+
if (Array.isArray(s)) return c(s, u);
|
|
282
|
+
if (s.constructor !== Object && (i = t.get(s.constructor)))
|
|
283
|
+
return i(s, u);
|
|
266
284
|
const f = {};
|
|
267
|
-
r.push(
|
|
268
|
-
for (const
|
|
269
|
-
const
|
|
270
|
-
if (typeof
|
|
271
|
-
f[
|
|
272
|
-
else if (
|
|
273
|
-
f[
|
|
274
|
-
else if (ArrayBuffer.isView(
|
|
275
|
-
f[
|
|
285
|
+
r.push(s), n.push(f);
|
|
286
|
+
for (const l in s) {
|
|
287
|
+
const a = s[l];
|
|
288
|
+
if (typeof a != "object" || a === null)
|
|
289
|
+
f[l] = a;
|
|
290
|
+
else if (a.constructor !== Object && (i = t.get(a.constructor)))
|
|
291
|
+
f[l] = i(a, u);
|
|
292
|
+
else if (ArrayBuffer.isView(a))
|
|
293
|
+
f[l] = j(a);
|
|
276
294
|
else {
|
|
277
|
-
const y = r.indexOf(
|
|
278
|
-
y !== -1 ? f[
|
|
295
|
+
const y = r.indexOf(a);
|
|
296
|
+
y !== -1 ? f[l] = n[y] : f[l] = u(a);
|
|
279
297
|
}
|
|
280
298
|
}
|
|
281
299
|
return r.pop(), n.pop(), f;
|
|
282
300
|
}
|
|
283
301
|
}
|
|
284
|
-
const
|
|
285
|
-
function
|
|
302
|
+
const R = ee();
|
|
303
|
+
function ne(e, r = 8) {
|
|
286
304
|
const n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
287
305
|
let t = "";
|
|
288
306
|
for (let i = 0; i < r; i++) {
|
|
289
|
-
const
|
|
290
|
-
t += n[
|
|
307
|
+
const c = Math.floor(Math.random() * n.length);
|
|
308
|
+
t += n[c];
|
|
291
309
|
}
|
|
292
310
|
return e ? `${e}${t}` : t;
|
|
293
311
|
}
|
|
294
|
-
function
|
|
312
|
+
function Ve(e, r) {
|
|
295
313
|
const n = e.variables.find((t) => t.name === r);
|
|
296
314
|
if (!n)
|
|
297
315
|
throw new Error(`Variable "${r}" not found`);
|
|
298
316
|
return n;
|
|
299
317
|
}
|
|
300
|
-
function
|
|
318
|
+
function ke(e, r) {
|
|
301
319
|
const n = e.utilities.find((t) => t.name === r);
|
|
302
320
|
if (!n)
|
|
303
321
|
throw new Error(`Utility "${r}" not found`);
|
|
304
322
|
return n;
|
|
305
323
|
}
|
|
306
|
-
function
|
|
324
|
+
function re(e, r) {
|
|
307
325
|
const n = e.modifiers.find(
|
|
308
326
|
(t) => t.key.includes(r)
|
|
309
327
|
);
|
|
@@ -311,44 +329,60 @@ function se(e, r) {
|
|
|
311
329
|
throw new Error(`Modifier "${r}" not found`);
|
|
312
330
|
return n;
|
|
313
331
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
332
|
+
function M(e, r) {
|
|
333
|
+
if (e === r) return !0;
|
|
334
|
+
if (typeof e != typeof r) return !1;
|
|
335
|
+
if (e === null || r === null) return e === r;
|
|
336
|
+
if (typeof e != "object" || typeof r != "object") return !1;
|
|
337
|
+
if (Array.isArray(e) && Array.isArray(r))
|
|
338
|
+
return e.length !== r.length ? !1 : e.every((n, t) => M(n, r[t]));
|
|
339
|
+
if ("type" in e && "type" in r) {
|
|
340
|
+
if (e.type !== r.type) return !1;
|
|
341
|
+
if (A(e) && A(r))
|
|
342
|
+
return e.name === r.name && M(e.fallback, r.fallback);
|
|
343
|
+
if (E(e) && E(r))
|
|
344
|
+
return M(e.value, r.value);
|
|
345
|
+
}
|
|
346
|
+
return !1;
|
|
347
|
+
}
|
|
348
|
+
const D = "__licenseRequired";
|
|
349
|
+
function ie(e) {
|
|
350
|
+
B(e) || Object.defineProperty(e, D, {
|
|
317
351
|
value: !0,
|
|
318
352
|
writable: !1,
|
|
319
353
|
configurable: !1,
|
|
320
354
|
enumerable: !0
|
|
321
355
|
});
|
|
322
356
|
}
|
|
323
|
-
function
|
|
324
|
-
return Object.prototype.hasOwnProperty.call(e,
|
|
357
|
+
function B(e) {
|
|
358
|
+
return Object.prototype.hasOwnProperty.call(e, D);
|
|
325
359
|
}
|
|
326
|
-
function
|
|
360
|
+
function oe(e, r) {
|
|
327
361
|
const n = [...e];
|
|
328
362
|
for (const t of r) {
|
|
329
363
|
const i = n.find(
|
|
330
|
-
(
|
|
364
|
+
(c) => c.name === t.name
|
|
331
365
|
);
|
|
332
366
|
i ? i.value = t.value : n.push(t);
|
|
333
367
|
}
|
|
334
368
|
return n;
|
|
335
369
|
}
|
|
336
|
-
function
|
|
370
|
+
function se(e, r) {
|
|
337
371
|
const n = [...e];
|
|
338
372
|
for (const t of r) {
|
|
339
373
|
const i = n.find(
|
|
340
|
-
(
|
|
374
|
+
(c) => c.name === t.name
|
|
341
375
|
);
|
|
342
376
|
i ? Object.assign(
|
|
343
377
|
i,
|
|
344
|
-
|
|
378
|
+
U(i, t)
|
|
345
379
|
) : n.push(t);
|
|
346
380
|
}
|
|
347
381
|
return n;
|
|
348
382
|
}
|
|
349
|
-
function
|
|
383
|
+
function U(e, r) {
|
|
350
384
|
return Object.keys(e).reduce(
|
|
351
|
-
(n, t) => (t === "variables" ? n.variables =
|
|
385
|
+
(n, t) => (t === "variables" ? n.variables = oe(e.variables, r.variables) : t === "declarations" ? n.declarations = { ...e.declarations, ...r.declarations } : t === "themes" && O(n) && O(e) && O(r) ? n.themes = se(e.themes, r.themes) : Array.isArray(e[t]) && (n[t] = e[t].concat(
|
|
352
386
|
r[t]
|
|
353
387
|
)), n),
|
|
354
388
|
{
|
|
@@ -357,56 +391,56 @@ function x(e, r) {
|
|
|
357
391
|
}
|
|
358
392
|
);
|
|
359
393
|
}
|
|
360
|
-
function
|
|
394
|
+
function Oe(e, ...r) {
|
|
361
395
|
return r.reduce((n, t) => {
|
|
362
396
|
const i = {
|
|
363
397
|
...n,
|
|
364
|
-
root:
|
|
398
|
+
root: U(n.root, t.root)
|
|
365
399
|
};
|
|
366
|
-
return (
|
|
400
|
+
return (B(n) || B(t)) && ie(i), i;
|
|
367
401
|
}, e);
|
|
368
402
|
}
|
|
369
|
-
function
|
|
403
|
+
function ce(e) {
|
|
370
404
|
const r = [];
|
|
371
405
|
function n(t, i) {
|
|
372
406
|
i.length > 0 && r.push([...i].sort());
|
|
373
|
-
for (let
|
|
374
|
-
const o = e[
|
|
407
|
+
for (let c = t; c < e.length; c++) {
|
|
408
|
+
const o = e[c];
|
|
375
409
|
if (o)
|
|
376
410
|
if (o.length === 1 && o[0])
|
|
377
|
-
n(
|
|
411
|
+
n(c + 1, [...i, o[0]]);
|
|
378
412
|
else
|
|
379
413
|
for (const u of o)
|
|
380
|
-
n(
|
|
414
|
+
n(c + 1, [...i, u]);
|
|
381
415
|
}
|
|
382
416
|
}
|
|
383
417
|
return n(0, []), r.sort((t, i) => t.length !== i.length ? t.length - i.length : t.join(",").localeCompare(i.join(",")));
|
|
384
418
|
}
|
|
385
|
-
function
|
|
419
|
+
function fe(e, r, n) {
|
|
386
420
|
const t = {
|
|
387
421
|
...e,
|
|
388
422
|
modifiers: [...n.keys()]
|
|
389
|
-
}, i =
|
|
390
|
-
for (const
|
|
391
|
-
|
|
423
|
+
}, i = v(t, r);
|
|
424
|
+
for (const c of n.values())
|
|
425
|
+
c.factory({
|
|
392
426
|
...i,
|
|
393
|
-
declarations:
|
|
394
|
-
variables:
|
|
395
|
-
children:
|
|
396
|
-
}),
|
|
427
|
+
declarations: R(t.declarations),
|
|
428
|
+
variables: R(t.variables),
|
|
429
|
+
children: R(t.children)
|
|
430
|
+
}), V(t.declarations, i);
|
|
397
431
|
return t;
|
|
398
432
|
}
|
|
399
|
-
function
|
|
433
|
+
function ue(e, r) {
|
|
400
434
|
return function(t, i) {
|
|
401
|
-
const
|
|
435
|
+
const c = {
|
|
402
436
|
type: "modifier",
|
|
403
437
|
key: Array.isArray(t) ? t : [t],
|
|
404
438
|
factory: i
|
|
405
439
|
};
|
|
406
|
-
return r.modifiers.push(
|
|
440
|
+
return r.modifiers.push(c), c;
|
|
407
441
|
};
|
|
408
442
|
}
|
|
409
|
-
function
|
|
443
|
+
function ae() {
|
|
410
444
|
return {
|
|
411
445
|
type: "root",
|
|
412
446
|
declarations: {},
|
|
@@ -418,137 +452,273 @@ function Y() {
|
|
|
418
452
|
themes: []
|
|
419
453
|
};
|
|
420
454
|
}
|
|
421
|
-
function
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
const o = /* @__PURE__ */ new Map();
|
|
425
|
-
for (const u of s) {
|
|
426
|
-
const c = r.find(
|
|
427
|
-
(f) => f.key.includes(u)
|
|
428
|
-
);
|
|
429
|
-
c && o.set(u, c);
|
|
430
|
-
}
|
|
431
|
-
return z(e, n, o);
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
function J(e, r) {
|
|
435
|
-
return function(t, i) {
|
|
436
|
-
const s = {
|
|
455
|
+
function le(e, r) {
|
|
456
|
+
return function(t, i, c = {}) {
|
|
457
|
+
const o = {
|
|
437
458
|
type: "utility",
|
|
438
459
|
name: t,
|
|
439
|
-
factory: i
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
)
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
460
|
+
factory: i,
|
|
461
|
+
values: [],
|
|
462
|
+
autogenerate: c.autogenerate ?? z(),
|
|
463
|
+
create: (u, s = []) => {
|
|
464
|
+
let f = u;
|
|
465
|
+
if (Array.isArray(u)) {
|
|
466
|
+
f = {};
|
|
467
|
+
for (const l of u) {
|
|
468
|
+
const a = o.autogenerate(l);
|
|
469
|
+
f = {
|
|
470
|
+
...f,
|
|
471
|
+
...a
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
for (const [l, a] of Object.entries(f)) {
|
|
476
|
+
const y = o.values.find(
|
|
477
|
+
(h) => h.key === l && h.modifiers.length === 0
|
|
478
|
+
), m = {
|
|
479
|
+
type: "utility",
|
|
480
|
+
name: t,
|
|
481
|
+
value: l,
|
|
482
|
+
declarations: {},
|
|
483
|
+
variables: [],
|
|
484
|
+
children: [],
|
|
485
|
+
modifiers: []
|
|
486
|
+
}, d = v(
|
|
487
|
+
m,
|
|
488
|
+
r
|
|
489
|
+
);
|
|
490
|
+
if (m.declarations = i({
|
|
491
|
+
...d,
|
|
492
|
+
value: a
|
|
493
|
+
}) ?? {}, V(m.declarations, d), y || (o.values.push({
|
|
494
|
+
key: l,
|
|
495
|
+
value: a,
|
|
496
|
+
modifiers: []
|
|
497
|
+
}), e.children.push(m)), s && s.length > 0) {
|
|
498
|
+
const h = s.map((b) => b.key), H = ce(h).filter((b) => !o.values.find(
|
|
499
|
+
(g) => g.key === l && g.modifiers.length === b.length && g.modifiers.every((w) => b.includes(w))
|
|
500
|
+
)).reduce((b, g) => {
|
|
501
|
+
const w = /* @__PURE__ */ new Map();
|
|
502
|
+
for (const K of g) {
|
|
503
|
+
const k = s.find(
|
|
504
|
+
(N) => N.key.includes(K)
|
|
505
|
+
);
|
|
506
|
+
k && q(k) && w.set(K, k);
|
|
507
|
+
}
|
|
508
|
+
return o.values.push({
|
|
509
|
+
key: l,
|
|
510
|
+
value: a,
|
|
511
|
+
modifiers: g
|
|
512
|
+
}), b.push(fe(m, r, w)), b;
|
|
513
|
+
}, []);
|
|
514
|
+
e.children.push(...H);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
461
517
|
}
|
|
462
518
|
};
|
|
519
|
+
return r.utilities.push(o), o.create;
|
|
463
520
|
};
|
|
464
521
|
}
|
|
465
|
-
function
|
|
522
|
+
function ye(e, r) {
|
|
466
523
|
return function(t, i) {
|
|
467
|
-
const
|
|
524
|
+
const c = r.themes.find((s) => s.name === t), o = c ?? {
|
|
468
525
|
type: "theme",
|
|
469
526
|
name: t,
|
|
470
527
|
declarations: {},
|
|
471
528
|
variables: [],
|
|
472
529
|
children: []
|
|
473
530
|
};
|
|
474
|
-
|
|
475
|
-
const u =
|
|
531
|
+
c || r.themes.push(o);
|
|
532
|
+
const u = v(o, r);
|
|
476
533
|
return i && i(u), o;
|
|
477
534
|
};
|
|
478
535
|
}
|
|
479
|
-
function
|
|
480
|
-
return function(t
|
|
481
|
-
const
|
|
536
|
+
function de(e, r) {
|
|
537
|
+
return function(t) {
|
|
538
|
+
const i = {
|
|
482
539
|
type: "recipe",
|
|
483
|
-
|
|
484
|
-
defaults: i,
|
|
485
|
-
variants: s,
|
|
486
|
-
...o
|
|
540
|
+
...t
|
|
487
541
|
};
|
|
488
|
-
return r.recipes.push(
|
|
542
|
+
return i._runtime = me(i, r), pe(i, r), r.recipes.push(i), i;
|
|
489
543
|
};
|
|
490
544
|
}
|
|
491
|
-
function
|
|
492
|
-
const
|
|
545
|
+
function _(e, r) {
|
|
546
|
+
const n = e.autogenerate(r);
|
|
547
|
+
return Object.keys(n)[0] ?? "default";
|
|
548
|
+
}
|
|
549
|
+
function F(e, r) {
|
|
550
|
+
const n = {};
|
|
551
|
+
for (const [t, i] of Object.entries(e))
|
|
552
|
+
if (P(i)) {
|
|
553
|
+
const c = {};
|
|
554
|
+
for (const [o, u] of Object.entries(i)) {
|
|
555
|
+
const s = T(r, o);
|
|
556
|
+
s && (c[o] = _(
|
|
557
|
+
s,
|
|
558
|
+
u
|
|
559
|
+
));
|
|
560
|
+
}
|
|
561
|
+
n[t] = c;
|
|
562
|
+
} else if (typeof i == "boolean")
|
|
563
|
+
n[t] = i;
|
|
564
|
+
else {
|
|
565
|
+
const c = T(r, t);
|
|
566
|
+
c && (n[t] = _(c, i));
|
|
567
|
+
}
|
|
568
|
+
return n;
|
|
569
|
+
}
|
|
570
|
+
function me(e, r) {
|
|
571
|
+
const n = {};
|
|
572
|
+
if (e.base && (n.base = F(e.base, r)), e.variants) {
|
|
573
|
+
const t = {};
|
|
574
|
+
for (const [i, c] of Object.entries(e.variants)) {
|
|
575
|
+
const o = {};
|
|
576
|
+
for (const [u, s] of Object.entries(
|
|
577
|
+
c
|
|
578
|
+
))
|
|
579
|
+
s == null ? o[u] = null : o[u] = F(
|
|
580
|
+
s,
|
|
581
|
+
r
|
|
582
|
+
);
|
|
583
|
+
t[i] = o;
|
|
584
|
+
}
|
|
585
|
+
n.variants = t;
|
|
586
|
+
}
|
|
587
|
+
return e.defaultVariants && (n.defaultVariants = { ...e.defaultVariants }), e.compoundVariants && (n.compoundVariants = e.compoundVariants.map((t) => ({
|
|
588
|
+
match: { ...t.match },
|
|
589
|
+
css: F(t.css, r)
|
|
590
|
+
}))), n;
|
|
591
|
+
}
|
|
592
|
+
function P(e) {
|
|
593
|
+
return !A(e) && typeof e == "object" && e !== null;
|
|
594
|
+
}
|
|
595
|
+
function x(e, r) {
|
|
596
|
+
const n = (t, i, c) => {
|
|
597
|
+
let o = r.get(t);
|
|
598
|
+
o || (o = [], r.set(t, o)), o.push({ value: i, modifiers: c });
|
|
599
|
+
};
|
|
600
|
+
for (const [t, i] of Object.entries(e))
|
|
601
|
+
if (P(i)) {
|
|
602
|
+
const c = t.split(":");
|
|
603
|
+
for (const [o, u] of Object.entries(i))
|
|
604
|
+
n(o, u, c);
|
|
605
|
+
} else
|
|
606
|
+
n(t, i, []);
|
|
607
|
+
}
|
|
608
|
+
function T(e, r) {
|
|
609
|
+
const n = e.utilities.find((i) => i.name === r);
|
|
610
|
+
if (n)
|
|
611
|
+
return n;
|
|
612
|
+
const t = r.replace(/[A-Z]/g, (i) => `-${i.toLowerCase()}`);
|
|
613
|
+
return e.utilities.find((i) => i.name === t);
|
|
614
|
+
}
|
|
615
|
+
function pe(e, r) {
|
|
616
|
+
const n = /* @__PURE__ */ new Map();
|
|
617
|
+
if (e.base && x(e.base, n), e.variants)
|
|
618
|
+
for (const i of Object.values(e.variants))
|
|
619
|
+
for (const c of Object.values(i))
|
|
620
|
+
x(
|
|
621
|
+
c,
|
|
622
|
+
n
|
|
623
|
+
);
|
|
624
|
+
if (e.compoundVariants)
|
|
625
|
+
for (const i of e.compoundVariants)
|
|
626
|
+
i.css && x(i.css, n);
|
|
627
|
+
const t = /* @__PURE__ */ new Map();
|
|
628
|
+
for (const [i, c] of n) {
|
|
629
|
+
const o = T(r, i);
|
|
630
|
+
if (!o) {
|
|
631
|
+
console.warn(
|
|
632
|
+
`[styleframe] Utility "${i}" not found in registry. Skipping.`
|
|
633
|
+
);
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
636
|
+
for (const u of c) {
|
|
637
|
+
const s = [];
|
|
638
|
+
for (const f of u.modifiers) {
|
|
639
|
+
if (!t.has(f))
|
|
640
|
+
try {
|
|
641
|
+
t.set(f, re(r, f));
|
|
642
|
+
} catch {
|
|
643
|
+
console.warn(
|
|
644
|
+
`[styleframe] Modifier "${f}" not found in registry. Skipping modifier for utility "${i}".`
|
|
645
|
+
), t.set(f, null);
|
|
646
|
+
}
|
|
647
|
+
const l = t.get(f);
|
|
648
|
+
l && s.push(l);
|
|
649
|
+
}
|
|
650
|
+
o.create(
|
|
651
|
+
[u.value],
|
|
652
|
+
s.length > 0 ? s : void 0
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
function Re(e) {
|
|
658
|
+
const r = ne("sf-"), n = ae(), t = { ...e }, i = le(n, n), c = ue(n, n), o = de(n, n), u = ye(n, n), { variable: s, selector: f, atRule: l, keyframes: a, media: y, ref: m, css: d } = v(n, n);
|
|
493
659
|
return {
|
|
494
660
|
id: r,
|
|
495
661
|
root: n,
|
|
496
|
-
variable:
|
|
662
|
+
variable: s,
|
|
497
663
|
selector: f,
|
|
498
664
|
utility: i,
|
|
499
|
-
modifier:
|
|
665
|
+
modifier: c,
|
|
500
666
|
recipe: o,
|
|
501
667
|
theme: u,
|
|
502
|
-
atRule:
|
|
503
|
-
keyframes:
|
|
668
|
+
atRule: l,
|
|
669
|
+
keyframes: a,
|
|
504
670
|
media: y,
|
|
505
|
-
ref:
|
|
671
|
+
ref: m,
|
|
506
672
|
css: d,
|
|
507
673
|
options: t
|
|
508
674
|
};
|
|
509
675
|
}
|
|
510
676
|
export {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
677
|
+
fe as applyModifiers,
|
|
678
|
+
we as capitalizeFirst,
|
|
679
|
+
ce as combineKeys,
|
|
680
|
+
C as createAtRuleFunction,
|
|
681
|
+
W as createCssFunction,
|
|
682
|
+
v as createDeclarationsCallbackContext,
|
|
683
|
+
Z as createKeyframesFunction,
|
|
684
|
+
Y as createMediaFunction,
|
|
685
|
+
ue as createModifierFunction,
|
|
686
|
+
de as createRecipeFunction,
|
|
687
|
+
J as createRefFunction,
|
|
688
|
+
ae as createRoot,
|
|
689
|
+
Q as createSelectorFunction,
|
|
690
|
+
ye as createThemeFunction,
|
|
691
|
+
le as createUtilityFunction,
|
|
692
|
+
X as createVariableFunction,
|
|
693
|
+
R as deepClone,
|
|
694
|
+
ne as generateRandomId,
|
|
695
|
+
me as generateRecipeRuntime,
|
|
696
|
+
re as getModifier,
|
|
697
|
+
ke as getUtility,
|
|
698
|
+
Ve as getVariable,
|
|
699
|
+
ge as isAtRule,
|
|
700
|
+
E as isCSS,
|
|
701
|
+
I as isContainer,
|
|
702
|
+
q as isModifier,
|
|
703
|
+
S as isObject,
|
|
704
|
+
G as isPrimitiveTokenValue,
|
|
705
|
+
Ae as isRecipe,
|
|
706
|
+
A as isRef,
|
|
707
|
+
O as isRoot,
|
|
708
|
+
be as isSelector,
|
|
709
|
+
ve as isTheme,
|
|
543
710
|
p as isToken,
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
711
|
+
M as isTokenEqual,
|
|
712
|
+
$ as isTokenValue,
|
|
713
|
+
je as isUtility,
|
|
714
|
+
L as isVariable,
|
|
715
|
+
Oe as merge,
|
|
716
|
+
U as mergeContainers,
|
|
717
|
+
se as mergeThemesArray,
|
|
718
|
+
oe as mergeVariablesArray,
|
|
719
|
+
V as parseDeclarationsBlock,
|
|
720
|
+
pe as processRecipeUtilities,
|
|
721
|
+
ee as rfdc,
|
|
722
|
+
Re as styleframe,
|
|
723
|
+
z as transformUtilityKey
|
|
554
724
|
};
|