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