@styleframe/loader 2.2.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 +32 -0
- package/dist/index.cjs +776 -500
- package/dist/index.d.ts +11 -8
- package/dist/index.js +777 -499
- package/package.json +7 -6
package/dist/index.cjs
CHANGED
|
@@ -1,165 +1,194 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("node:fs/promises"), require("node:path"), require("@styleframe/license"), require("
|
|
3
|
-
})(this, (function(exports2, promises, path, license,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("node:fs/promises"), require("node:path"), require("@styleframe/license"), require("chokidar"), require("jiti"), require("node:fs")) : typeof define === "function" && define.amd ? define(["exports", "node:fs/promises", "node:path", "@styleframe/license", "chokidar", "jiti", "node:fs"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.loader = {}, global.promises, global.path, global.license, global.chokidar, global.jiti, global.node_fs));
|
|
3
|
+
})(this, (function(exports2, promises, path, license, chokidar, jiti, node_fs) {
|
|
4
4
|
"use strict";
|
|
5
|
-
const
|
|
5
|
+
const F$1 = ["charset", "import", "namespace"], L$1 = ["layer"], D = ({ name: e }) => `[data-theme="${e}"]`, x$1 = ({
|
|
6
6
|
name: e,
|
|
7
7
|
value: t,
|
|
8
|
-
modifiers:
|
|
9
|
-
}) => `._${[...
|
|
10
|
-
function
|
|
8
|
+
modifiers: r
|
|
9
|
+
}) => `._${[...r, e, ...t === "default" ? [] : [t]].filter(Boolean).join("\\:").replace(/[[\].#()%,]/g, "\\$&")}`, w = ({ name: e }) => e.replace(/^\.+|\.+$/g, "").replace(/\.+/g, "--");
|
|
10
|
+
function I$1(e, t) {
|
|
11
11
|
return `@${e}${t ? " " : ""}${t}`;
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
function
|
|
15
|
-
if (!
|
|
13
|
+
const U = /\d/, P$1 = ["-", "_", "/", "."];
|
|
14
|
+
function M(e = "") {
|
|
15
|
+
if (!U.test(e))
|
|
16
16
|
return e !== e.toLowerCase();
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
const
|
|
18
|
+
function N(e, t) {
|
|
19
|
+
const r = P$1, n = [];
|
|
20
20
|
if (!e || typeof e != "string")
|
|
21
|
-
return
|
|
22
|
-
let
|
|
23
|
-
for (const
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
|
|
21
|
+
return n;
|
|
22
|
+
let o = "", s, u;
|
|
23
|
+
for (const a of e) {
|
|
24
|
+
const c = r.includes(a);
|
|
25
|
+
if (c === true) {
|
|
26
|
+
n.push(o), o = "", s = void 0;
|
|
27
27
|
continue;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
if (
|
|
32
|
-
|
|
29
|
+
const i = M(a);
|
|
30
|
+
if (u === false) {
|
|
31
|
+
if (s === false && i === true) {
|
|
32
|
+
n.push(o), o = a, s = i;
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
|
-
if (
|
|
36
|
-
const f =
|
|
37
|
-
|
|
35
|
+
if (s === true && i === false && o.length > 1) {
|
|
36
|
+
const f = o.at(-1);
|
|
37
|
+
n.push(o.slice(0, Math.max(0, o.length - 1))), o = f + a, s = i;
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
o += a, s = i, u = c;
|
|
42
42
|
}
|
|
43
|
-
return
|
|
43
|
+
return n.push(o), n;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return e ?
|
|
45
|
+
function k(e) {
|
|
46
|
+
return e ? e[0].toUpperCase() + e.slice(1) : "";
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function V$1(e) {
|
|
49
|
+
return e ? e[0].toLowerCase() + e.slice(1) : "";
|
|
50
|
+
}
|
|
51
|
+
function q$1(e, t) {
|
|
52
|
+
return e ? (Array.isArray(e) ? e : N(e)).map((r) => k(r)).join("") : "";
|
|
53
|
+
}
|
|
54
|
+
function K(e, t) {
|
|
55
|
+
return V$1(q$1(e || ""));
|
|
56
|
+
}
|
|
57
|
+
function z$1(e, t) {
|
|
58
|
+
return e ? (Array.isArray(e) ? e : N(e)).map((r) => r.toLowerCase()).join("-") : "";
|
|
59
|
+
}
|
|
60
|
+
function H(e) {
|
|
49
61
|
return ` ${e}`;
|
|
50
62
|
}
|
|
51
|
-
function
|
|
63
|
+
function Q$1(e) {
|
|
52
64
|
return e.split(`
|
|
53
|
-
`).map((t) =>
|
|
65
|
+
`).map((t) => H(t)).join(`
|
|
54
66
|
`);
|
|
55
67
|
}
|
|
56
|
-
function
|
|
57
|
-
return
|
|
68
|
+
function J$1(e) {
|
|
69
|
+
return e === e.toUpperCase();
|
|
70
|
+
}
|
|
71
|
+
function Z$1(e) {
|
|
72
|
+
return K(e);
|
|
73
|
+
}
|
|
74
|
+
function W$1(e) {
|
|
75
|
+
return z$1(e);
|
|
58
76
|
}
|
|
59
|
-
function
|
|
60
|
-
return
|
|
77
|
+
function G$1(e) {
|
|
78
|
+
return W$1(e);
|
|
61
79
|
}
|
|
62
|
-
function
|
|
63
|
-
return `${e.startsWith("--") ? e :
|
|
80
|
+
function O(e, t) {
|
|
81
|
+
return `${e.startsWith("--") ? e : G$1(e)}: ${t};`;
|
|
64
82
|
}
|
|
65
|
-
function
|
|
83
|
+
function Y$1(e) {
|
|
66
84
|
return `{${e.length > 0 ? `
|
|
67
|
-
` : ""}${e.map((t) => `${
|
|
85
|
+
` : ""}${e.map((t) => `${Q$1(`${t}`)}
|
|
68
86
|
`).join("")}}`;
|
|
69
87
|
}
|
|
70
|
-
function
|
|
88
|
+
function E$1(e) {
|
|
71
89
|
return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
|
|
72
90
|
}
|
|
73
|
-
function
|
|
74
|
-
return
|
|
91
|
+
function X$1(e, t) {
|
|
92
|
+
return O(E$1(e), t);
|
|
75
93
|
}
|
|
76
|
-
function
|
|
77
|
-
return `var(${
|
|
94
|
+
function ee$1(e, t) {
|
|
95
|
+
return `var(${E$1(e)}${t ? `, ${t}` : ""})`;
|
|
78
96
|
}
|
|
79
|
-
function
|
|
80
|
-
return `${e} ${
|
|
97
|
+
function R$1(e, t) {
|
|
98
|
+
return `${e} ${Y$1(t)}`;
|
|
81
99
|
}
|
|
82
|
-
function
|
|
83
|
-
return function(
|
|
84
|
-
return Object.entries(
|
|
100
|
+
function te$1(e) {
|
|
101
|
+
return function(r, n) {
|
|
102
|
+
return Object.entries(r).map(([o, s]) => O(o, e(s, n)));
|
|
85
103
|
};
|
|
86
104
|
}
|
|
87
|
-
function
|
|
88
|
-
return function(
|
|
89
|
-
const
|
|
90
|
-
return
|
|
105
|
+
function B(e) {
|
|
106
|
+
return function(r, n) {
|
|
107
|
+
const s = (n.variables?.name ?? w)({ name: r.name });
|
|
108
|
+
return X$1(s, e(r.value, n));
|
|
91
109
|
};
|
|
92
110
|
}
|
|
93
111
|
function S$1(e) {
|
|
94
|
-
const t =
|
|
95
|
-
return function(
|
|
96
|
-
const { variables:
|
|
97
|
-
(A2) => t(A2,
|
|
98
|
-
),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
), y = (
|
|
102
|
-
(A2) => e(A2,
|
|
103
|
-
),
|
|
104
|
-
return f ? `${
|
|
112
|
+
const t = B(e), r = te$1(e);
|
|
113
|
+
return function(o, s, u) {
|
|
114
|
+
const { variables: a, declarations: c, children: i } = s, f = o === ":root", l = (a ?? []).map(
|
|
115
|
+
(A2) => t(A2, u)
|
|
116
|
+
), m = r(
|
|
117
|
+
c ?? {},
|
|
118
|
+
u
|
|
119
|
+
), y = (i ?? []).map(
|
|
120
|
+
(A2) => e(A2, u)
|
|
121
|
+
), p2 = l.length > 0, b = m.length > 0, C2 = y.length > 0;
|
|
122
|
+
return f ? `${p2 || b ? R$1(o, [
|
|
105
123
|
...l,
|
|
106
|
-
...
|
|
107
|
-
...
|
|
108
|
-
]) : ""}${
|
|
124
|
+
...p2 && b ? [""] : [],
|
|
125
|
+
...m
|
|
126
|
+
]) : ""}${C2 && (p2 || b) ? `
|
|
109
127
|
|
|
110
128
|
` : ""}${y.join(`
|
|
111
129
|
|
|
112
|
-
`)}` :
|
|
130
|
+
`)}` : R$1(o, [
|
|
113
131
|
...l,
|
|
114
|
-
...
|
|
115
|
-
...
|
|
116
|
-
...
|
|
132
|
+
...p2 && (C2 || b) ? [""] : [],
|
|
133
|
+
...m,
|
|
134
|
+
...b && C2 ? [""] : [],
|
|
117
135
|
...y.flatMap(
|
|
118
|
-
(A2,
|
|
136
|
+
(A2, _2) => _2 === y.length - 1 ? [A2] : [A2, ""]
|
|
119
137
|
)
|
|
120
138
|
]);
|
|
121
139
|
};
|
|
122
140
|
}
|
|
123
|
-
function
|
|
141
|
+
function re$1(e) {
|
|
124
142
|
const t = S$1(e);
|
|
125
|
-
return function(
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
),
|
|
129
|
-
return
|
|
143
|
+
return function(n, o) {
|
|
144
|
+
const s = F$1.includes(n.identifier), u = L$1.includes(
|
|
145
|
+
n.identifier
|
|
146
|
+
), a = Object.keys(n.declarations).length > 0, c = n.variables.length > 0, i = n.children.length > 0, f = I$1(n.identifier, n.rule);
|
|
147
|
+
return s || u && !(a || c || i) ? `${f};` : t(f, n, o);
|
|
130
148
|
};
|
|
131
149
|
}
|
|
132
|
-
function
|
|
150
|
+
function ne$1(e) {
|
|
151
|
+
return function(r, n) {
|
|
152
|
+
return r.value.map((o) => e(o, n)).join("").trim();
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function oe(e) {
|
|
133
156
|
return typeof e == "object" && e !== null;
|
|
134
157
|
}
|
|
135
|
-
function
|
|
136
|
-
return
|
|
158
|
+
function h(e, t) {
|
|
159
|
+
return oe(e) && "type" in e && e.type === t;
|
|
137
160
|
}
|
|
138
|
-
function
|
|
139
|
-
return
|
|
161
|
+
function ce$1(e) {
|
|
162
|
+
return h(e, "variable");
|
|
140
163
|
}
|
|
141
|
-
function
|
|
142
|
-
return
|
|
164
|
+
function ue$1(e) {
|
|
165
|
+
return h(e, "reference");
|
|
143
166
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
167
|
+
function v$1(e) {
|
|
168
|
+
return h(e, "selector");
|
|
146
169
|
}
|
|
147
|
-
function
|
|
148
|
-
return
|
|
170
|
+
function ie(e) {
|
|
171
|
+
return h(e, "at-rule");
|
|
149
172
|
}
|
|
150
|
-
function
|
|
151
|
-
return
|
|
173
|
+
function se(e) {
|
|
174
|
+
return h(e, "utility");
|
|
152
175
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
176
|
+
function ae$1(e) {
|
|
177
|
+
return h(e, "css");
|
|
178
|
+
}
|
|
179
|
+
function le$1(e) {
|
|
180
|
+
return h(e, "theme");
|
|
155
181
|
}
|
|
156
|
-
function
|
|
157
|
-
return
|
|
182
|
+
function T$1(e) {
|
|
183
|
+
return h(e, "root");
|
|
158
184
|
}
|
|
159
|
-
function
|
|
160
|
-
return
|
|
185
|
+
function fe$1(e) {
|
|
186
|
+
return h(e, "recipe");
|
|
161
187
|
}
|
|
162
|
-
function
|
|
188
|
+
function me$1(e) {
|
|
189
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
190
|
+
}
|
|
191
|
+
function g(e) {
|
|
163
192
|
if (e instanceof Buffer)
|
|
164
193
|
return Buffer.from(e);
|
|
165
194
|
const t = e.constructor;
|
|
@@ -169,225 +198,262 @@
|
|
|
169
198
|
e.byteLength / e.BYTES_PER_ELEMENT || 1
|
|
170
199
|
);
|
|
171
200
|
}
|
|
172
|
-
function
|
|
201
|
+
function pe$1(e) {
|
|
173
202
|
if (e = e || {}, e.circular)
|
|
174
|
-
return
|
|
203
|
+
return ye$1(e);
|
|
175
204
|
const t = /* @__PURE__ */ new Map();
|
|
176
|
-
if (t.set(Date, (
|
|
205
|
+
if (t.set(Date, (u) => new Date(u)), t.set(
|
|
177
206
|
Map,
|
|
178
|
-
(
|
|
207
|
+
(u, a) => new Map(n(Array.from(u), a))
|
|
179
208
|
), t.set(
|
|
180
209
|
Set,
|
|
181
|
-
(
|
|
210
|
+
(u, a) => new Set(n(Array.from(u), a))
|
|
182
211
|
), e.constructorHandlers)
|
|
183
|
-
for (const
|
|
184
|
-
t.set(
|
|
185
|
-
let
|
|
186
|
-
return e.proto ?
|
|
187
|
-
function
|
|
188
|
-
const
|
|
189
|
-
for (let f = 0; f <
|
|
190
|
-
const l =
|
|
191
|
-
typeof
|
|
212
|
+
for (const u of e.constructorHandlers)
|
|
213
|
+
t.set(u[0], u[1]);
|
|
214
|
+
let r;
|
|
215
|
+
return e.proto ? s : o;
|
|
216
|
+
function n(u, a) {
|
|
217
|
+
const c = Object.keys(u), i = Array.from({ length: c.length });
|
|
218
|
+
for (let f = 0; f < c.length; f++) {
|
|
219
|
+
const l = c[f], m = u[l];
|
|
220
|
+
typeof m != "object" || m === null ? i[l] = m : m.constructor !== Object && (r = t.get(m.constructor)) ? i[l] = r(m, a) : ArrayBuffer.isView(m) ? i[l] = g(m) : i[l] = a(m);
|
|
192
221
|
}
|
|
193
|
-
return
|
|
222
|
+
return i;
|
|
194
223
|
}
|
|
195
|
-
function
|
|
196
|
-
if (typeof
|
|
197
|
-
if (Array.isArray(
|
|
198
|
-
if (
|
|
199
|
-
return
|
|
200
|
-
const
|
|
201
|
-
for (const
|
|
202
|
-
if (Object.hasOwnProperty.call(
|
|
203
|
-
const
|
|
204
|
-
typeof
|
|
224
|
+
function o(u) {
|
|
225
|
+
if (typeof u != "object" || u === null) return u;
|
|
226
|
+
if (Array.isArray(u)) return n(u, o);
|
|
227
|
+
if (u.constructor !== Object && (r = t.get(u.constructor)))
|
|
228
|
+
return r(u, o);
|
|
229
|
+
const a = {};
|
|
230
|
+
for (const c in u) {
|
|
231
|
+
if (Object.hasOwnProperty.call(u, c) === false) continue;
|
|
232
|
+
const i = u[c];
|
|
233
|
+
typeof i != "object" || i === null ? a[c] = i : i.constructor !== Object && (r = t.get(i.constructor)) ? a[c] = r(i, o) : ArrayBuffer.isView(i) ? a[c] = g(i) : a[c] = o(i);
|
|
205
234
|
}
|
|
206
|
-
return
|
|
207
|
-
}
|
|
208
|
-
function
|
|
209
|
-
if (typeof
|
|
210
|
-
if (Array.isArray(
|
|
211
|
-
if (
|
|
212
|
-
return
|
|
213
|
-
const
|
|
214
|
-
for (const
|
|
215
|
-
const
|
|
216
|
-
typeof
|
|
235
|
+
return a;
|
|
236
|
+
}
|
|
237
|
+
function s(u) {
|
|
238
|
+
if (typeof u != "object" || u === null) return u;
|
|
239
|
+
if (Array.isArray(u)) return n(u, s);
|
|
240
|
+
if (u.constructor !== Object && (r = t.get(u.constructor)))
|
|
241
|
+
return r(u, s);
|
|
242
|
+
const a = {};
|
|
243
|
+
for (const c in u) {
|
|
244
|
+
const i = u[c];
|
|
245
|
+
typeof i != "object" || i === null ? a[c] = i : i.constructor !== Object && (r = t.get(i.constructor)) ? a[c] = r(i, s) : ArrayBuffer.isView(i) ? a[c] = g(i) : a[c] = s(i);
|
|
217
246
|
}
|
|
218
|
-
return
|
|
247
|
+
return a;
|
|
219
248
|
}
|
|
220
249
|
}
|
|
221
|
-
function
|
|
222
|
-
const t = [],
|
|
223
|
-
if (
|
|
250
|
+
function ye$1(e) {
|
|
251
|
+
const t = [], r = [], n = /* @__PURE__ */ new Map();
|
|
252
|
+
if (n.set(Date, (c) => new Date(c)), n.set(
|
|
224
253
|
Map,
|
|
225
|
-
(
|
|
226
|
-
),
|
|
254
|
+
(c, i) => new Map(s(Array.from(c), i))
|
|
255
|
+
), n.set(
|
|
227
256
|
Set,
|
|
228
|
-
(
|
|
257
|
+
(c, i) => new Set(s(Array.from(c), i))
|
|
229
258
|
), e.constructorHandlers)
|
|
230
|
-
for (const
|
|
231
|
-
|
|
232
|
-
let
|
|
233
|
-
return e.proto ?
|
|
234
|
-
function
|
|
235
|
-
const f = Object.keys(
|
|
236
|
-
for (let
|
|
237
|
-
const y = f[
|
|
238
|
-
if (typeof
|
|
239
|
-
l[y] =
|
|
240
|
-
else if (
|
|
241
|
-
l[y] =
|
|
242
|
-
else if (ArrayBuffer.isView(
|
|
243
|
-
l[y] = g
|
|
259
|
+
for (const c of e.constructorHandlers)
|
|
260
|
+
n.set(c[0], c[1]);
|
|
261
|
+
let o;
|
|
262
|
+
return e.proto ? a : u;
|
|
263
|
+
function s(c, i) {
|
|
264
|
+
const f = Object.keys(c), l = Array.from({ length: f.length });
|
|
265
|
+
for (let m = 0; m < f.length; m++) {
|
|
266
|
+
const y = f[m], p2 = c[y];
|
|
267
|
+
if (typeof p2 != "object" || p2 === null)
|
|
268
|
+
l[y] = p2;
|
|
269
|
+
else if (p2.constructor !== Object && (o = n.get(p2.constructor)))
|
|
270
|
+
l[y] = o(p2, i);
|
|
271
|
+
else if (ArrayBuffer.isView(p2))
|
|
272
|
+
l[y] = g(p2);
|
|
244
273
|
else {
|
|
245
|
-
const
|
|
246
|
-
|
|
274
|
+
const b = t.indexOf(p2);
|
|
275
|
+
b !== -1 ? l[y] = r[b] : l[y] = i(p2);
|
|
247
276
|
}
|
|
248
277
|
}
|
|
249
278
|
return l;
|
|
250
279
|
}
|
|
251
|
-
function
|
|
252
|
-
if (typeof
|
|
253
|
-
if (Array.isArray(
|
|
254
|
-
if (
|
|
255
|
-
return c
|
|
256
|
-
const
|
|
257
|
-
t.push(
|
|
258
|
-
for (const f in
|
|
259
|
-
if (Object.hasOwnProperty.call(
|
|
260
|
-
const l =
|
|
280
|
+
function u(c) {
|
|
281
|
+
if (typeof c != "object" || c === null) return c;
|
|
282
|
+
if (Array.isArray(c)) return s(c, u);
|
|
283
|
+
if (c.constructor !== Object && (o = n.get(c.constructor)))
|
|
284
|
+
return o(c, u);
|
|
285
|
+
const i = {};
|
|
286
|
+
t.push(c), r.push(i);
|
|
287
|
+
for (const f in c) {
|
|
288
|
+
if (Object.hasOwnProperty.call(c, f) === false) continue;
|
|
289
|
+
const l = c[f];
|
|
261
290
|
if (typeof l != "object" || l === null)
|
|
262
|
-
|
|
263
|
-
else if (l.constructor !== Object && (
|
|
264
|
-
|
|
291
|
+
i[f] = l;
|
|
292
|
+
else if (l.constructor !== Object && (o = n.get(l.constructor)))
|
|
293
|
+
i[f] = o(l, u);
|
|
265
294
|
else if (ArrayBuffer.isView(l))
|
|
266
|
-
|
|
295
|
+
i[f] = g(l);
|
|
267
296
|
else {
|
|
268
|
-
const
|
|
269
|
-
|
|
297
|
+
const m = t.indexOf(l);
|
|
298
|
+
m !== -1 ? i[f] = r[m] : i[f] = u(l);
|
|
270
299
|
}
|
|
271
300
|
}
|
|
272
|
-
return t.pop(),
|
|
301
|
+
return t.pop(), r.pop(), i;
|
|
273
302
|
}
|
|
274
|
-
function
|
|
275
|
-
if (typeof
|
|
276
|
-
if (Array.isArray(
|
|
277
|
-
if (
|
|
278
|
-
return c
|
|
279
|
-
const
|
|
280
|
-
t.push(
|
|
281
|
-
for (const f in
|
|
282
|
-
const l =
|
|
303
|
+
function a(c) {
|
|
304
|
+
if (typeof c != "object" || c === null) return c;
|
|
305
|
+
if (Array.isArray(c)) return s(c, a);
|
|
306
|
+
if (c.constructor !== Object && (o = n.get(c.constructor)))
|
|
307
|
+
return o(c, a);
|
|
308
|
+
const i = {};
|
|
309
|
+
t.push(c), r.push(i);
|
|
310
|
+
for (const f in c) {
|
|
311
|
+
const l = c[f];
|
|
283
312
|
if (typeof l != "object" || l === null)
|
|
284
|
-
|
|
285
|
-
else if (l.constructor !== Object && (
|
|
286
|
-
|
|
313
|
+
i[f] = l;
|
|
314
|
+
else if (l.constructor !== Object && (o = n.get(l.constructor)))
|
|
315
|
+
i[f] = o(l, a);
|
|
287
316
|
else if (ArrayBuffer.isView(l))
|
|
288
|
-
|
|
317
|
+
i[f] = g(l);
|
|
289
318
|
else {
|
|
290
|
-
const
|
|
291
|
-
|
|
319
|
+
const m = t.indexOf(l);
|
|
320
|
+
m !== -1 ? i[f] = r[m] : i[f] = a(l);
|
|
292
321
|
}
|
|
293
322
|
}
|
|
294
|
-
return t.pop(),
|
|
323
|
+
return t.pop(), r.pop(), i;
|
|
295
324
|
}
|
|
296
325
|
}
|
|
297
|
-
|
|
298
|
-
function
|
|
299
|
-
return function(
|
|
300
|
-
return
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
function ie(e) {
|
|
304
|
-
return function(n, r) {
|
|
305
|
-
return n != null ? `${n}` : "";
|
|
326
|
+
pe$1();
|
|
327
|
+
function de$1(e) {
|
|
328
|
+
return function(r, n) {
|
|
329
|
+
return r != null ? `${r}` : "";
|
|
306
330
|
};
|
|
307
331
|
}
|
|
308
|
-
function
|
|
309
|
-
return function(
|
|
310
|
-
const
|
|
311
|
-
return
|
|
312
|
-
|
|
313
|
-
|
|
332
|
+
function he(e) {
|
|
333
|
+
return function(r, n) {
|
|
334
|
+
const s = (n.variables?.name ?? w)({ name: r.name });
|
|
335
|
+
return ee$1(
|
|
336
|
+
s,
|
|
337
|
+
r.fallback ? e(r.fallback, n) : void 0
|
|
314
338
|
);
|
|
315
339
|
};
|
|
316
340
|
}
|
|
317
|
-
function
|
|
341
|
+
function be$1(e) {
|
|
318
342
|
const t = S$1(e);
|
|
319
|
-
return function(
|
|
320
|
-
return
|
|
321
|
-
(
|
|
322
|
-
[t(":root",
|
|
343
|
+
return function(n, o) {
|
|
344
|
+
return n.themes.reduce(
|
|
345
|
+
(s, u) => (s.push(e(u, o)), s),
|
|
346
|
+
[t(":root", n, o)]
|
|
323
347
|
// Default theme (root)
|
|
324
348
|
).join(`
|
|
325
349
|
|
|
326
350
|
`);
|
|
327
351
|
};
|
|
328
352
|
}
|
|
329
|
-
function
|
|
353
|
+
function Ae$1(e) {
|
|
330
354
|
const t = S$1(e);
|
|
331
|
-
return function(
|
|
332
|
-
return t(
|
|
355
|
+
return function(n, o) {
|
|
356
|
+
return t(n.query, n, o);
|
|
333
357
|
};
|
|
334
358
|
}
|
|
335
|
-
function
|
|
359
|
+
function ge(e) {
|
|
336
360
|
const t = S$1(e);
|
|
337
|
-
return function(
|
|
338
|
-
const
|
|
339
|
-
return t(
|
|
361
|
+
return function(n, o) {
|
|
362
|
+
const u = (o.themes?.selector ?? D)({ name: n.name });
|
|
363
|
+
return t(u, n, o);
|
|
340
364
|
};
|
|
341
365
|
}
|
|
342
|
-
function
|
|
366
|
+
function Se(e) {
|
|
343
367
|
const t = S$1(e);
|
|
344
|
-
return function(
|
|
345
|
-
const
|
|
346
|
-
name:
|
|
347
|
-
value:
|
|
348
|
-
modifiers:
|
|
368
|
+
return function(n, o) {
|
|
369
|
+
const s = [], a = (o.utilities?.selector ?? x$1)({
|
|
370
|
+
name: n.name,
|
|
371
|
+
value: n.value,
|
|
372
|
+
modifiers: n.modifiers
|
|
349
373
|
});
|
|
350
|
-
return
|
|
374
|
+
return s.push(t(a, n, o)), s.join(`
|
|
351
375
|
|
|
352
376
|
`);
|
|
353
377
|
};
|
|
354
378
|
}
|
|
355
|
-
function
|
|
356
|
-
const
|
|
379
|
+
function d(e, t) {
|
|
380
|
+
const r = be$1(d), n = Ae$1(d), o = Se(d), s = re$1(d), u = ge(d), a = B(d), c = he(d), i = ne$1(d), f = de$1();
|
|
357
381
|
switch (true) {
|
|
358
|
-
case
|
|
359
|
-
return r(e, t);
|
|
360
|
-
case ee(e):
|
|
361
|
-
return c(e, t);
|
|
362
|
-
case X$1(e):
|
|
363
|
-
return a(e, t);
|
|
364
|
-
case re(e):
|
|
382
|
+
case v$1(e):
|
|
365
383
|
return n(e, t);
|
|
366
|
-
case
|
|
367
|
-
return i(e, t);
|
|
368
|
-
case J$1(e):
|
|
369
|
-
return s(e, t);
|
|
370
|
-
case G$1(e):
|
|
384
|
+
case se(e):
|
|
371
385
|
return o(e, t);
|
|
372
|
-
case
|
|
386
|
+
case ie(e):
|
|
387
|
+
return s(e, t);
|
|
388
|
+
case T$1(e):
|
|
389
|
+
return r(e, t);
|
|
390
|
+
case le$1(e):
|
|
373
391
|
return u(e, t);
|
|
392
|
+
case ce$1(e):
|
|
393
|
+
return a(e, t);
|
|
394
|
+
case ue$1(e):
|
|
395
|
+
return c(e, t);
|
|
396
|
+
case ae$1(e):
|
|
397
|
+
return i(e, t);
|
|
374
398
|
default:
|
|
375
399
|
return f(e, t);
|
|
376
400
|
}
|
|
377
401
|
}
|
|
378
|
-
function
|
|
402
|
+
function Ce(e) {
|
|
403
|
+
return function(r, n) {
|
|
404
|
+
let o = r._exportName;
|
|
405
|
+
o || (o = Z$1(r.name), r.name[0] && J$1(r.name[0]) && (o = me$1(o)));
|
|
406
|
+
const s = `${o}Recipe`, u = r._runtime ?? {};
|
|
407
|
+
return `const ${s} = ${JSON.stringify(
|
|
408
|
+
u,
|
|
409
|
+
null,
|
|
410
|
+
4
|
|
411
|
+
)} as const satisfies RecipeRuntime;
|
|
412
|
+
|
|
413
|
+
export const ${o} = createRecipe("${r.name}", ${s});
|
|
414
|
+
`;
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function je(e) {
|
|
418
|
+
return e.filter(
|
|
419
|
+
(t) => v$1(t) && !!t._exportName
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
function ve(e) {
|
|
423
|
+
return function(r, n) {
|
|
424
|
+
const o = je(r.children), s = r.recipes.length > 0, u = o.length > 0;
|
|
425
|
+
if (!s && !u)
|
|
426
|
+
return "";
|
|
427
|
+
const a = [];
|
|
428
|
+
return s && (a.push(`import { createRecipe } from '@styleframe/runtime';
|
|
429
|
+
import type { RecipeRuntime } from '@styleframe/runtime';
|
|
430
|
+
`), a.push(e(r.recipes, n))), u && a.push(e(o, n)), a.join(`
|
|
431
|
+
`);
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function Re$1(e) {
|
|
435
|
+
return function(r, n) {
|
|
436
|
+
return r._exportName ? `export const ${r._exportName} = ${JSON.stringify(r.query)};
|
|
437
|
+
` : "";
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
function j$1(e, t) {
|
|
441
|
+
const r = ve(j$1), n = Ce(), o = Re$1();
|
|
379
442
|
switch (true) {
|
|
380
443
|
case Array.isArray(e):
|
|
381
|
-
return e.map((
|
|
444
|
+
return e.map((s) => j$1(s, t)).join(`
|
|
382
445
|
`);
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
446
|
+
case T$1(e):
|
|
447
|
+
return r(e, t);
|
|
448
|
+
case fe$1(e):
|
|
449
|
+
return n(e, t);
|
|
450
|
+
case v$1(e):
|
|
451
|
+
return o(e, t);
|
|
386
452
|
default:
|
|
387
453
|
return "";
|
|
388
454
|
}
|
|
389
455
|
}
|
|
390
|
-
const
|
|
456
|
+
const $e = `-----BEGIN PUBLIC KEY-----
|
|
391
457
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4
|
|
392
458
|
qSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n
|
|
393
459
|
BiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA
|
|
@@ -395,12 +461,12 @@ dQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj
|
|
|
395
461
|
hC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn
|
|
396
462
|
4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+
|
|
397
463
|
GwIDAQAB
|
|
398
|
-
-----END PUBLIC KEY-----`,
|
|
399
|
-
async function
|
|
400
|
-
const t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""),
|
|
464
|
+
-----END PUBLIC KEY-----`, we = "__licenseRequired", Ne = "__licenseValidated";
|
|
465
|
+
async function Oe(e) {
|
|
466
|
+
const t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""), r = Uint8Array.from(atob(t), (n) => n.charCodeAt(0));
|
|
401
467
|
return await crypto.subtle.importKey(
|
|
402
468
|
"spki",
|
|
403
|
-
|
|
469
|
+
r,
|
|
404
470
|
{
|
|
405
471
|
name: "RSASSA-PKCS1-v1_5",
|
|
406
472
|
hash: "SHA-256"
|
|
@@ -409,32 +475,32 @@ GwIDAQAB
|
|
|
409
475
|
["verify"]
|
|
410
476
|
);
|
|
411
477
|
}
|
|
412
|
-
async function
|
|
478
|
+
async function Ee({
|
|
413
479
|
payload: e,
|
|
414
480
|
signature: t
|
|
415
481
|
}) {
|
|
416
|
-
const
|
|
482
|
+
const r = new TextEncoder().encode(e), n = Uint8Array.from(
|
|
417
483
|
atob(t),
|
|
418
|
-
(
|
|
419
|
-
),
|
|
484
|
+
(s) => s.charCodeAt(0)
|
|
485
|
+
), o = await Oe($e);
|
|
420
486
|
if (!await crypto.subtle.verify(
|
|
421
487
|
{ name: "RSASSA-PKCS1-v1_5" },
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
488
|
+
o,
|
|
489
|
+
n,
|
|
490
|
+
r
|
|
425
491
|
))
|
|
426
492
|
throw new Error(
|
|
427
493
|
"License validation failed: Invalid signature detected. The license may have been modified or corrupted."
|
|
428
494
|
);
|
|
429
495
|
return JSON.parse(e);
|
|
430
496
|
}
|
|
431
|
-
function
|
|
432
|
-
return Object.prototype.hasOwnProperty.call(e,
|
|
497
|
+
function Be(e) {
|
|
498
|
+
return Object.prototype.hasOwnProperty.call(e, we);
|
|
433
499
|
}
|
|
434
|
-
async function
|
|
500
|
+
async function Te(e) {
|
|
435
501
|
const t = Object.getOwnPropertyDescriptor(
|
|
436
502
|
e,
|
|
437
|
-
|
|
503
|
+
Ne
|
|
438
504
|
);
|
|
439
505
|
if (!t?.value)
|
|
440
506
|
return {
|
|
@@ -443,8 +509,8 @@ GwIDAQAB
|
|
|
443
509
|
environment: "",
|
|
444
510
|
valid: false
|
|
445
511
|
};
|
|
446
|
-
const
|
|
447
|
-
if (typeof
|
|
512
|
+
const r = t.value;
|
|
513
|
+
if (typeof r != "object" || r === null || !("payload" in r) || !("signature" in r) || typeof r.payload != "string" || typeof r.signature != "string")
|
|
448
514
|
return {
|
|
449
515
|
key: "",
|
|
450
516
|
instanceId: "",
|
|
@@ -452,8 +518,8 @@ GwIDAQAB
|
|
|
452
518
|
valid: false
|
|
453
519
|
};
|
|
454
520
|
try {
|
|
455
|
-
return await
|
|
456
|
-
|
|
521
|
+
return await Ee(
|
|
522
|
+
r
|
|
457
523
|
);
|
|
458
524
|
} catch {
|
|
459
525
|
return {
|
|
@@ -464,7 +530,7 @@ GwIDAQAB
|
|
|
464
530
|
};
|
|
465
531
|
}
|
|
466
532
|
}
|
|
467
|
-
function
|
|
533
|
+
function _e(e) {
|
|
468
534
|
const t = Math.floor(Math.random() * 100);
|
|
469
535
|
e.root.children.push({
|
|
470
536
|
type: "selector",
|
|
@@ -488,31 +554,36 @@ GwIDAQAB
|
|
|
488
554
|
}
|
|
489
555
|
});
|
|
490
556
|
}
|
|
491
|
-
function
|
|
557
|
+
function $$1(e, t = "") {
|
|
492
558
|
return {
|
|
493
559
|
name: e,
|
|
494
560
|
content: t
|
|
495
561
|
};
|
|
496
562
|
}
|
|
497
|
-
async function
|
|
563
|
+
async function Le(e, {
|
|
498
564
|
type: t = "all",
|
|
499
|
-
consumers:
|
|
565
|
+
consumers: r = { css: d, ts: j$1 }
|
|
500
566
|
} = {}) {
|
|
501
|
-
const
|
|
502
|
-
if (
|
|
503
|
-
const s = await
|
|
504
|
-
(!s.valid || s.instanceId !== e.id) &&
|
|
567
|
+
const n = { files: [] }, o = e.options;
|
|
568
|
+
if (Be(e)) {
|
|
569
|
+
const s = await Te(e);
|
|
570
|
+
(!s.valid || s.instanceId !== e.id) && _e(e);
|
|
505
571
|
}
|
|
506
|
-
const { recipes: a, ...i } = e.root;
|
|
507
572
|
if (t === "all" || t === "css") {
|
|
508
|
-
const s =
|
|
509
|
-
|
|
573
|
+
const s = $$1(
|
|
574
|
+
"index.css",
|
|
575
|
+
r.css(e.root, o)
|
|
576
|
+
);
|
|
577
|
+
n.files.push(s);
|
|
510
578
|
}
|
|
511
579
|
if (t === "all" || t === "ts") {
|
|
512
|
-
const s =
|
|
513
|
-
|
|
580
|
+
const s = $$1(
|
|
581
|
+
"index.ts",
|
|
582
|
+
r.ts(e.root, o)
|
|
583
|
+
);
|
|
584
|
+
n.files.push(s);
|
|
514
585
|
}
|
|
515
|
-
return
|
|
586
|
+
return n;
|
|
516
587
|
}
|
|
517
588
|
async function directoryExists(path2) {
|
|
518
589
|
try {
|
|
@@ -528,7 +599,7 @@ GwIDAQAB
|
|
|
528
599
|
environment: process.env.NODE_ENV || "development",
|
|
529
600
|
isBuild: true
|
|
530
601
|
});
|
|
531
|
-
const output = await
|
|
602
|
+
const output = await Le(instance, transpiler);
|
|
532
603
|
const outputDirExists = await directoryExists(outputDir);
|
|
533
604
|
if (clean && outputDirExists) {
|
|
534
605
|
await promises.rm(outputDir, { recursive: true });
|
|
@@ -543,40 +614,64 @@ GwIDAQAB
|
|
|
543
614
|
await promises.writeFile(filePath, file.content);
|
|
544
615
|
}
|
|
545
616
|
}
|
|
546
|
-
function
|
|
547
|
-
return function(t, ...i) {
|
|
548
|
-
return {
|
|
549
|
-
type: "css",
|
|
550
|
-
value: t.reduce((o, u, c) => (o.push(u), c < i.length && o.push(i[c]), o), [])
|
|
551
|
-
};
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
function M(e) {
|
|
617
|
+
function S(e) {
|
|
555
618
|
return typeof e == "object" && e !== null;
|
|
556
619
|
}
|
|
557
620
|
function p(e, r) {
|
|
558
|
-
return
|
|
621
|
+
return S(e) && "type" in e && e.type === r;
|
|
559
622
|
}
|
|
560
|
-
function
|
|
623
|
+
function L(e) {
|
|
561
624
|
return p(e, "variable");
|
|
562
625
|
}
|
|
563
|
-
function
|
|
626
|
+
function A(e) {
|
|
564
627
|
return p(e, "reference");
|
|
565
628
|
}
|
|
566
|
-
function
|
|
629
|
+
function be(e) {
|
|
630
|
+
return p(e, "selector");
|
|
631
|
+
}
|
|
632
|
+
function q(e) {
|
|
633
|
+
return p(e, "modifier");
|
|
634
|
+
}
|
|
635
|
+
function E(e) {
|
|
567
636
|
return p(e, "css");
|
|
568
637
|
}
|
|
569
|
-
function
|
|
638
|
+
function Ae(e) {
|
|
639
|
+
return p(e, "recipe");
|
|
640
|
+
}
|
|
641
|
+
function G(e) {
|
|
570
642
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
571
643
|
}
|
|
572
|
-
function
|
|
573
|
-
return
|
|
644
|
+
function $(e) {
|
|
645
|
+
return G(e) || A(e) || E(e) || Array.isArray(e) && e.every($);
|
|
646
|
+
}
|
|
647
|
+
function I(e) {
|
|
648
|
+
return S(e) && "children" in e && "declarations" in e && "variables" in e;
|
|
649
|
+
}
|
|
650
|
+
function z(e = (r) => r) {
|
|
651
|
+
return (r) => {
|
|
652
|
+
let n = r, t;
|
|
653
|
+
if (typeof n == "string" && n[0] === "@") {
|
|
654
|
+
const i = n.slice(1);
|
|
655
|
+
t = e(i), n = {
|
|
656
|
+
type: "reference",
|
|
657
|
+
name: i
|
|
658
|
+
};
|
|
659
|
+
} else A(n) ? t = e(n.name) : t = `[${r}]`;
|
|
660
|
+
return {
|
|
661
|
+
[t]: n
|
|
662
|
+
};
|
|
663
|
+
};
|
|
574
664
|
}
|
|
575
|
-
function
|
|
576
|
-
return
|
|
665
|
+
function W(e, r) {
|
|
666
|
+
return function(t, ...i) {
|
|
667
|
+
return {
|
|
668
|
+
type: "css",
|
|
669
|
+
value: t.reduce((o, u, s) => (o.push(u), s < i.length && o.push(i[s]), o), [])
|
|
670
|
+
};
|
|
671
|
+
};
|
|
577
672
|
}
|
|
578
|
-
function
|
|
579
|
-
return function(t, i,
|
|
673
|
+
function C(e, r) {
|
|
674
|
+
return function(t, i, c) {
|
|
580
675
|
const o = {
|
|
581
676
|
type: "at-rule",
|
|
582
677
|
identifier: t,
|
|
@@ -584,25 +679,25 @@ GwIDAQAB
|
|
|
584
679
|
declarations: {},
|
|
585
680
|
variables: [],
|
|
586
681
|
children: []
|
|
587
|
-
}, u =
|
|
588
|
-
return typeof
|
|
682
|
+
}, u = v(o, r);
|
|
683
|
+
return typeof c == "function" ? o.declarations = c(u) ?? {} : c && (o.declarations = c), V(o.declarations, u), e.children.push(o), o;
|
|
589
684
|
};
|
|
590
685
|
}
|
|
591
|
-
function
|
|
592
|
-
const n =
|
|
593
|
-
return function(i,
|
|
594
|
-
return n("media", i,
|
|
686
|
+
function Y(e, r) {
|
|
687
|
+
const n = C(e, r);
|
|
688
|
+
return function(i, c) {
|
|
689
|
+
return n("media", i, c);
|
|
595
690
|
};
|
|
596
691
|
}
|
|
597
|
-
function
|
|
598
|
-
const n =
|
|
599
|
-
return function(i,
|
|
600
|
-
return n("keyframes", i,
|
|
692
|
+
function Z(e, r) {
|
|
693
|
+
const n = C(e, r);
|
|
694
|
+
return function(i, c) {
|
|
695
|
+
return n("keyframes", i, c);
|
|
601
696
|
};
|
|
602
697
|
}
|
|
603
|
-
function
|
|
698
|
+
function J(e, r) {
|
|
604
699
|
return function(t, i) {
|
|
605
|
-
return
|
|
700
|
+
return L(t) ? {
|
|
606
701
|
type: "reference",
|
|
607
702
|
name: t.name,
|
|
608
703
|
fallback: i
|
|
@@ -613,56 +708,56 @@ GwIDAQAB
|
|
|
613
708
|
};
|
|
614
709
|
};
|
|
615
710
|
}
|
|
616
|
-
function
|
|
711
|
+
function Q(e, r) {
|
|
617
712
|
return function(t, i) {
|
|
618
|
-
const
|
|
713
|
+
const c = {
|
|
619
714
|
type: "selector",
|
|
620
715
|
query: t,
|
|
621
716
|
declarations: {},
|
|
622
717
|
variables: [],
|
|
623
718
|
children: []
|
|
624
|
-
}, o =
|
|
625
|
-
return typeof i == "function" ?
|
|
719
|
+
}, o = v(c, r);
|
|
720
|
+
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;
|
|
626
721
|
};
|
|
627
722
|
}
|
|
628
|
-
function
|
|
629
|
-
return function(t, i,
|
|
723
|
+
function X(e, r) {
|
|
724
|
+
return function(t, i, c = {
|
|
630
725
|
default: false
|
|
631
726
|
}) {
|
|
632
727
|
const o = typeof t == "string" ? t : t.name, u = e.variables.find(
|
|
633
728
|
(f) => f.name === o
|
|
634
729
|
);
|
|
635
|
-
if (
|
|
730
|
+
if (c.default && u)
|
|
636
731
|
return u;
|
|
637
732
|
if (u)
|
|
638
733
|
return u.value = i, u;
|
|
639
|
-
const
|
|
734
|
+
const s = {
|
|
640
735
|
type: "variable",
|
|
641
736
|
name: o,
|
|
642
737
|
value: i
|
|
643
738
|
};
|
|
644
|
-
return e.variables.push(
|
|
739
|
+
return e.variables.push(s), s;
|
|
645
740
|
};
|
|
646
741
|
}
|
|
647
|
-
function
|
|
648
|
-
const n =
|
|
742
|
+
function v(e, r) {
|
|
743
|
+
const n = X(e), t = Q(e, r), i = C(e, r), c = Z(r, r), o = Y(e, r), u = J(), s = W();
|
|
649
744
|
return {
|
|
650
745
|
variable: n,
|
|
651
746
|
selector: t,
|
|
652
|
-
keyframes:
|
|
747
|
+
keyframes: c,
|
|
653
748
|
atRule: i,
|
|
654
749
|
media: o,
|
|
655
750
|
ref: u,
|
|
656
|
-
css:
|
|
751
|
+
css: s
|
|
657
752
|
};
|
|
658
753
|
}
|
|
659
|
-
function
|
|
754
|
+
function V(e, r) {
|
|
660
755
|
for (const n in e)
|
|
661
756
|
if (n.startsWith("@")) {
|
|
662
757
|
const t = e[n];
|
|
663
|
-
if (typeof t == "object" && t !== null &&
|
|
664
|
-
const i = n.replace(/^@(\w+).*/, "$1"),
|
|
665
|
-
r.atRule(i,
|
|
758
|
+
if (typeof t == "object" && t !== null && !$(t)) {
|
|
759
|
+
const i = n.replace(/^@(\w+).*/, "$1"), c = n.replace(`@${i}`, "").trim();
|
|
760
|
+
r.atRule(i, c, t), delete e[n];
|
|
666
761
|
}
|
|
667
762
|
} else if (/^[.&:]/.test(n)) {
|
|
668
763
|
const t = e[n];
|
|
@@ -670,7 +765,7 @@ GwIDAQAB
|
|
|
670
765
|
}
|
|
671
766
|
return e;
|
|
672
767
|
}
|
|
673
|
-
function
|
|
768
|
+
function j(e) {
|
|
674
769
|
if (e instanceof Buffer)
|
|
675
770
|
return Buffer.from(e);
|
|
676
771
|
const r = e.constructor;
|
|
@@ -680,9 +775,9 @@ GwIDAQAB
|
|
|
680
775
|
e.byteLength / e.BYTES_PER_ELEMENT || 1
|
|
681
776
|
);
|
|
682
777
|
}
|
|
683
|
-
function
|
|
778
|
+
function ee(e) {
|
|
684
779
|
if (e = e || {}, e.circular)
|
|
685
|
-
return
|
|
780
|
+
return te(e);
|
|
686
781
|
const r = /* @__PURE__ */ new Map();
|
|
687
782
|
if (r.set(Date, (o) => new Date(o)), r.set(
|
|
688
783
|
Map,
|
|
@@ -694,12 +789,12 @@ GwIDAQAB
|
|
|
694
789
|
for (const o of e.constructorHandlers)
|
|
695
790
|
r.set(o[0], o[1]);
|
|
696
791
|
let n;
|
|
697
|
-
return e.proto ?
|
|
792
|
+
return e.proto ? c : i;
|
|
698
793
|
function t(o, u) {
|
|
699
|
-
const
|
|
700
|
-
for (let
|
|
701
|
-
const
|
|
702
|
-
typeof y != "object" || y === null ? f[
|
|
794
|
+
const s = Object.keys(o), f = Array.from({ length: s.length });
|
|
795
|
+
for (let l = 0; l < s.length; l++) {
|
|
796
|
+
const a = s[l], y = o[a];
|
|
797
|
+
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);
|
|
703
798
|
}
|
|
704
799
|
return f;
|
|
705
800
|
}
|
|
@@ -709,153 +804,161 @@ GwIDAQAB
|
|
|
709
804
|
if (o.constructor !== Object && (n = r.get(o.constructor)))
|
|
710
805
|
return n(o, i);
|
|
711
806
|
const u = {};
|
|
712
|
-
for (const
|
|
713
|
-
if (Object.hasOwnProperty.call(o,
|
|
714
|
-
const f = o[
|
|
715
|
-
typeof f != "object" || f === null ? u[
|
|
807
|
+
for (const s in o) {
|
|
808
|
+
if (Object.hasOwnProperty.call(o, s) === false) continue;
|
|
809
|
+
const f = o[s];
|
|
810
|
+
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);
|
|
716
811
|
}
|
|
717
812
|
return u;
|
|
718
813
|
}
|
|
719
|
-
function
|
|
814
|
+
function c(o) {
|
|
720
815
|
if (typeof o != "object" || o === null) return o;
|
|
721
|
-
if (Array.isArray(o)) return t(o,
|
|
816
|
+
if (Array.isArray(o)) return t(o, c);
|
|
722
817
|
if (o.constructor !== Object && (n = r.get(o.constructor)))
|
|
723
|
-
return n(o,
|
|
818
|
+
return n(o, c);
|
|
724
819
|
const u = {};
|
|
725
|
-
for (const
|
|
726
|
-
const f = o[
|
|
727
|
-
typeof f != "object" || f === null ? u[
|
|
820
|
+
for (const s in o) {
|
|
821
|
+
const f = o[s];
|
|
822
|
+
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);
|
|
728
823
|
}
|
|
729
824
|
return u;
|
|
730
825
|
}
|
|
731
826
|
}
|
|
732
|
-
function
|
|
827
|
+
function te(e) {
|
|
733
828
|
const r = [], n = [], t = /* @__PURE__ */ new Map();
|
|
734
|
-
if (t.set(Date, (
|
|
829
|
+
if (t.set(Date, (s) => new Date(s)), t.set(
|
|
735
830
|
Map,
|
|
736
|
-
(
|
|
831
|
+
(s, f) => new Map(c(Array.from(s), f))
|
|
737
832
|
), t.set(
|
|
738
833
|
Set,
|
|
739
|
-
(
|
|
834
|
+
(s, f) => new Set(c(Array.from(s), f))
|
|
740
835
|
), e.constructorHandlers)
|
|
741
|
-
for (const
|
|
742
|
-
t.set(
|
|
836
|
+
for (const s of e.constructorHandlers)
|
|
837
|
+
t.set(s[0], s[1]);
|
|
743
838
|
let i;
|
|
744
839
|
return e.proto ? u : o;
|
|
745
|
-
function s
|
|
746
|
-
const
|
|
747
|
-
for (let y = 0; y <
|
|
748
|
-
const
|
|
749
|
-
if (typeof
|
|
750
|
-
|
|
751
|
-
else if (
|
|
752
|
-
|
|
753
|
-
else if (ArrayBuffer.isView(
|
|
754
|
-
|
|
840
|
+
function c(s, f) {
|
|
841
|
+
const l = Object.keys(s), a = Array.from({ length: l.length });
|
|
842
|
+
for (let y = 0; y < l.length; y++) {
|
|
843
|
+
const m = l[y], d2 = s[m];
|
|
844
|
+
if (typeof d2 != "object" || d2 === null)
|
|
845
|
+
a[m] = d2;
|
|
846
|
+
else if (d2.constructor !== Object && (i = t.get(d2.constructor)))
|
|
847
|
+
a[m] = i(d2, f);
|
|
848
|
+
else if (ArrayBuffer.isView(d2))
|
|
849
|
+
a[m] = j(d2);
|
|
755
850
|
else {
|
|
756
|
-
const
|
|
757
|
-
|
|
851
|
+
const h2 = r.indexOf(d2);
|
|
852
|
+
h2 !== -1 ? a[m] = n[h2] : a[m] = f(d2);
|
|
758
853
|
}
|
|
759
854
|
}
|
|
760
|
-
return
|
|
855
|
+
return a;
|
|
761
856
|
}
|
|
762
|
-
function o(
|
|
763
|
-
if (typeof
|
|
764
|
-
if (Array.isArray(
|
|
765
|
-
if (
|
|
766
|
-
return i(
|
|
857
|
+
function o(s) {
|
|
858
|
+
if (typeof s != "object" || s === null) return s;
|
|
859
|
+
if (Array.isArray(s)) return c(s, o);
|
|
860
|
+
if (s.constructor !== Object && (i = t.get(s.constructor)))
|
|
861
|
+
return i(s, o);
|
|
767
862
|
const f = {};
|
|
768
|
-
r.push(
|
|
769
|
-
for (const
|
|
770
|
-
if (Object.hasOwnProperty.call(
|
|
771
|
-
const
|
|
772
|
-
if (typeof
|
|
773
|
-
f[
|
|
774
|
-
else if (
|
|
775
|
-
f[
|
|
776
|
-
else if (ArrayBuffer.isView(
|
|
777
|
-
f[
|
|
863
|
+
r.push(s), n.push(f);
|
|
864
|
+
for (const l in s) {
|
|
865
|
+
if (Object.hasOwnProperty.call(s, l) === false) continue;
|
|
866
|
+
const a = s[l];
|
|
867
|
+
if (typeof a != "object" || a === null)
|
|
868
|
+
f[l] = a;
|
|
869
|
+
else if (a.constructor !== Object && (i = t.get(a.constructor)))
|
|
870
|
+
f[l] = i(a, o);
|
|
871
|
+
else if (ArrayBuffer.isView(a))
|
|
872
|
+
f[l] = j(a);
|
|
778
873
|
else {
|
|
779
|
-
const y = r.indexOf(
|
|
780
|
-
y !== -1 ? f[
|
|
874
|
+
const y = r.indexOf(a);
|
|
875
|
+
y !== -1 ? f[l] = n[y] : f[l] = o(a);
|
|
781
876
|
}
|
|
782
877
|
}
|
|
783
878
|
return r.pop(), n.pop(), f;
|
|
784
879
|
}
|
|
785
|
-
function u(
|
|
786
|
-
if (typeof
|
|
787
|
-
if (Array.isArray(
|
|
788
|
-
if (
|
|
789
|
-
return i(
|
|
880
|
+
function u(s) {
|
|
881
|
+
if (typeof s != "object" || s === null) return s;
|
|
882
|
+
if (Array.isArray(s)) return c(s, u);
|
|
883
|
+
if (s.constructor !== Object && (i = t.get(s.constructor)))
|
|
884
|
+
return i(s, u);
|
|
790
885
|
const f = {};
|
|
791
|
-
r.push(
|
|
792
|
-
for (const
|
|
793
|
-
const
|
|
794
|
-
if (typeof
|
|
795
|
-
f[
|
|
796
|
-
else if (
|
|
797
|
-
f[
|
|
798
|
-
else if (ArrayBuffer.isView(
|
|
799
|
-
f[
|
|
886
|
+
r.push(s), n.push(f);
|
|
887
|
+
for (const l in s) {
|
|
888
|
+
const a = s[l];
|
|
889
|
+
if (typeof a != "object" || a === null)
|
|
890
|
+
f[l] = a;
|
|
891
|
+
else if (a.constructor !== Object && (i = t.get(a.constructor)))
|
|
892
|
+
f[l] = i(a, u);
|
|
893
|
+
else if (ArrayBuffer.isView(a))
|
|
894
|
+
f[l] = j(a);
|
|
800
895
|
else {
|
|
801
|
-
const y = r.indexOf(
|
|
802
|
-
y !== -1 ? f[
|
|
896
|
+
const y = r.indexOf(a);
|
|
897
|
+
y !== -1 ? f[l] = n[y] : f[l] = u(a);
|
|
803
898
|
}
|
|
804
899
|
}
|
|
805
900
|
return r.pop(), n.pop(), f;
|
|
806
901
|
}
|
|
807
902
|
}
|
|
808
|
-
const
|
|
809
|
-
function
|
|
903
|
+
const R = ee();
|
|
904
|
+
function ne(e, r = 8) {
|
|
810
905
|
const n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
811
906
|
let t = "";
|
|
812
907
|
for (let i = 0; i < r; i++) {
|
|
813
|
-
const
|
|
814
|
-
t += n[
|
|
908
|
+
const c = Math.floor(Math.random() * n.length);
|
|
909
|
+
t += n[c];
|
|
815
910
|
}
|
|
816
911
|
return e ? `${e}${t}` : t;
|
|
817
912
|
}
|
|
818
|
-
function
|
|
913
|
+
function re(e, r) {
|
|
914
|
+
const n = e.modifiers.find(
|
|
915
|
+
(t) => t.key.includes(r)
|
|
916
|
+
);
|
|
917
|
+
if (!n)
|
|
918
|
+
throw new Error(`Modifier "${r}" not found`);
|
|
919
|
+
return n;
|
|
920
|
+
}
|
|
921
|
+
function ce(e) {
|
|
819
922
|
const r = [];
|
|
820
923
|
function n(t, i) {
|
|
821
924
|
i.length > 0 && r.push([...i].sort());
|
|
822
|
-
for (let
|
|
823
|
-
const o = e[
|
|
925
|
+
for (let c = t; c < e.length; c++) {
|
|
926
|
+
const o = e[c];
|
|
824
927
|
if (o)
|
|
825
928
|
if (o.length === 1 && o[0])
|
|
826
|
-
n(
|
|
929
|
+
n(c + 1, [...i, o[0]]);
|
|
827
930
|
else
|
|
828
931
|
for (const u of o)
|
|
829
|
-
n(
|
|
932
|
+
n(c + 1, [...i, u]);
|
|
830
933
|
}
|
|
831
934
|
}
|
|
832
935
|
return n(0, []), r.sort((t, i) => t.length !== i.length ? t.length - i.length : t.join(",").localeCompare(i.join(",")));
|
|
833
936
|
}
|
|
834
|
-
function
|
|
937
|
+
function fe(e, r, n) {
|
|
835
938
|
const t = {
|
|
836
939
|
...e,
|
|
837
940
|
modifiers: [...n.keys()]
|
|
838
|
-
}, i =
|
|
839
|
-
for (const
|
|
840
|
-
|
|
941
|
+
}, i = v(t, r);
|
|
942
|
+
for (const c of n.values())
|
|
943
|
+
c.factory({
|
|
841
944
|
...i,
|
|
842
|
-
declarations:
|
|
843
|
-
variables:
|
|
844
|
-
children:
|
|
845
|
-
}),
|
|
945
|
+
declarations: R(t.declarations),
|
|
946
|
+
variables: R(t.variables),
|
|
947
|
+
children: R(t.children)
|
|
948
|
+
}), V(t.declarations, i);
|
|
846
949
|
return t;
|
|
847
950
|
}
|
|
848
|
-
function
|
|
951
|
+
function ue(e, r) {
|
|
849
952
|
return function(t, i) {
|
|
850
|
-
const
|
|
953
|
+
const c = {
|
|
851
954
|
type: "modifier",
|
|
852
955
|
key: Array.isArray(t) ? t : [t],
|
|
853
956
|
factory: i
|
|
854
957
|
};
|
|
855
|
-
return r.modifiers.push(
|
|
958
|
+
return r.modifiers.push(c), c;
|
|
856
959
|
};
|
|
857
960
|
}
|
|
858
|
-
function
|
|
961
|
+
function ae() {
|
|
859
962
|
return {
|
|
860
963
|
type: "root",
|
|
861
964
|
declarations: {},
|
|
@@ -867,130 +970,303 @@ GwIDAQAB
|
|
|
867
970
|
themes: []
|
|
868
971
|
};
|
|
869
972
|
}
|
|
870
|
-
function
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
const o = /* @__PURE__ */ new Map();
|
|
874
|
-
for (const u of s) {
|
|
875
|
-
const c = r.find(
|
|
876
|
-
(f) => f.key.includes(u)
|
|
877
|
-
);
|
|
878
|
-
c && o.set(u, c);
|
|
879
|
-
}
|
|
880
|
-
return z(e, n, o);
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
function J(e, r) {
|
|
884
|
-
return function(t, i) {
|
|
885
|
-
const s = {
|
|
973
|
+
function le(e, r) {
|
|
974
|
+
return function(t, i, c = {}) {
|
|
975
|
+
const o = {
|
|
886
976
|
type: "utility",
|
|
887
977
|
name: t,
|
|
888
|
-
factory: i
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
)
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
978
|
+
factory: i,
|
|
979
|
+
values: [],
|
|
980
|
+
autogenerate: c.autogenerate ?? z(),
|
|
981
|
+
create: (u, s = []) => {
|
|
982
|
+
let f = u;
|
|
983
|
+
if (Array.isArray(u)) {
|
|
984
|
+
f = {};
|
|
985
|
+
for (const l of u) {
|
|
986
|
+
const a = o.autogenerate(l);
|
|
987
|
+
f = {
|
|
988
|
+
...f,
|
|
989
|
+
...a
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
for (const [l, a] of Object.entries(f)) {
|
|
994
|
+
const y = o.values.find(
|
|
995
|
+
(h2) => h2.key === l && h2.modifiers.length === 0
|
|
996
|
+
), m = {
|
|
997
|
+
type: "utility",
|
|
998
|
+
name: t,
|
|
999
|
+
value: l,
|
|
1000
|
+
declarations: {},
|
|
1001
|
+
variables: [],
|
|
1002
|
+
children: [],
|
|
1003
|
+
modifiers: []
|
|
1004
|
+
}, d2 = v(
|
|
1005
|
+
m,
|
|
1006
|
+
r
|
|
1007
|
+
);
|
|
1008
|
+
if (m.declarations = i({
|
|
1009
|
+
...d2,
|
|
1010
|
+
value: a
|
|
1011
|
+
}) ?? {}, V(m.declarations, d2), y || (o.values.push({
|
|
1012
|
+
key: l,
|
|
1013
|
+
value: a,
|
|
1014
|
+
modifiers: []
|
|
1015
|
+
}), e.children.push(m)), s && s.length > 0) {
|
|
1016
|
+
const h2 = s.map((b) => b.key), H2 = ce(h2).filter((b) => !o.values.find(
|
|
1017
|
+
(g2) => g2.key === l && g2.modifiers.length === b.length && g2.modifiers.every((w2) => b.includes(w2))
|
|
1018
|
+
)).reduce((b, g2) => {
|
|
1019
|
+
const w2 = /* @__PURE__ */ new Map();
|
|
1020
|
+
for (const K2 of g2) {
|
|
1021
|
+
const k2 = s.find(
|
|
1022
|
+
(N2) => N2.key.includes(K2)
|
|
1023
|
+
);
|
|
1024
|
+
k2 && q(k2) && w2.set(K2, k2);
|
|
1025
|
+
}
|
|
1026
|
+
return o.values.push({
|
|
1027
|
+
key: l,
|
|
1028
|
+
value: a,
|
|
1029
|
+
modifiers: g2
|
|
1030
|
+
}), b.push(fe(m, r, w2)), b;
|
|
1031
|
+
}, []);
|
|
1032
|
+
e.children.push(...H2);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
910
1035
|
}
|
|
911
1036
|
};
|
|
1037
|
+
return r.utilities.push(o), o.create;
|
|
912
1038
|
};
|
|
913
1039
|
}
|
|
914
|
-
function
|
|
1040
|
+
function ye(e, r) {
|
|
915
1041
|
return function(t, i) {
|
|
916
|
-
const
|
|
1042
|
+
const c = r.themes.find((s) => s.name === t), o = c ?? {
|
|
917
1043
|
type: "theme",
|
|
918
1044
|
name: t,
|
|
919
1045
|
declarations: {},
|
|
920
1046
|
variables: [],
|
|
921
1047
|
children: []
|
|
922
1048
|
};
|
|
923
|
-
|
|
924
|
-
const u =
|
|
1049
|
+
c || r.themes.push(o);
|
|
1050
|
+
const u = v(o, r);
|
|
925
1051
|
return i && i(u), o;
|
|
926
1052
|
};
|
|
927
1053
|
}
|
|
928
|
-
function
|
|
929
|
-
return function(t
|
|
930
|
-
const
|
|
1054
|
+
function de(e, r) {
|
|
1055
|
+
return function(t) {
|
|
1056
|
+
const i = {
|
|
931
1057
|
type: "recipe",
|
|
932
|
-
|
|
933
|
-
defaults: i,
|
|
934
|
-
variants: s,
|
|
935
|
-
...o
|
|
1058
|
+
...t
|
|
936
1059
|
};
|
|
937
|
-
return r.recipes.push(
|
|
1060
|
+
return i._runtime = me(i, r), pe(i, r), r.recipes.push(i), i;
|
|
938
1061
|
};
|
|
939
1062
|
}
|
|
940
|
-
function
|
|
941
|
-
const
|
|
1063
|
+
function _(e, r) {
|
|
1064
|
+
const n = e.autogenerate(r);
|
|
1065
|
+
return Object.keys(n)[0] ?? "default";
|
|
1066
|
+
}
|
|
1067
|
+
function F(e, r) {
|
|
1068
|
+
const n = {};
|
|
1069
|
+
for (const [t, i] of Object.entries(e))
|
|
1070
|
+
if (P(i)) {
|
|
1071
|
+
const c = {};
|
|
1072
|
+
for (const [o, u] of Object.entries(i)) {
|
|
1073
|
+
const s = T(r, o);
|
|
1074
|
+
s && (c[o] = _(
|
|
1075
|
+
s,
|
|
1076
|
+
u
|
|
1077
|
+
));
|
|
1078
|
+
}
|
|
1079
|
+
n[t] = c;
|
|
1080
|
+
} else if (typeof i == "boolean")
|
|
1081
|
+
n[t] = i;
|
|
1082
|
+
else {
|
|
1083
|
+
const c = T(r, t);
|
|
1084
|
+
c && (n[t] = _(c, i));
|
|
1085
|
+
}
|
|
1086
|
+
return n;
|
|
1087
|
+
}
|
|
1088
|
+
function me(e, r) {
|
|
1089
|
+
const n = {};
|
|
1090
|
+
if (e.base && (n.base = F(e.base, r)), e.variants) {
|
|
1091
|
+
const t = {};
|
|
1092
|
+
for (const [i, c] of Object.entries(e.variants)) {
|
|
1093
|
+
const o = {};
|
|
1094
|
+
for (const [u, s] of Object.entries(
|
|
1095
|
+
c
|
|
1096
|
+
))
|
|
1097
|
+
s == null ? o[u] = null : o[u] = F(
|
|
1098
|
+
s,
|
|
1099
|
+
r
|
|
1100
|
+
);
|
|
1101
|
+
t[i] = o;
|
|
1102
|
+
}
|
|
1103
|
+
n.variants = t;
|
|
1104
|
+
}
|
|
1105
|
+
return e.defaultVariants && (n.defaultVariants = { ...e.defaultVariants }), e.compoundVariants && (n.compoundVariants = e.compoundVariants.map((t) => ({
|
|
1106
|
+
match: { ...t.match },
|
|
1107
|
+
css: F(t.css, r)
|
|
1108
|
+
}))), n;
|
|
1109
|
+
}
|
|
1110
|
+
function P(e) {
|
|
1111
|
+
return !A(e) && typeof e == "object" && e !== null;
|
|
1112
|
+
}
|
|
1113
|
+
function x(e, r) {
|
|
1114
|
+
const n = (t, i, c) => {
|
|
1115
|
+
let o = r.get(t);
|
|
1116
|
+
o || (o = [], r.set(t, o)), o.push({ value: i, modifiers: c });
|
|
1117
|
+
};
|
|
1118
|
+
for (const [t, i] of Object.entries(e))
|
|
1119
|
+
if (P(i)) {
|
|
1120
|
+
const c = t.split(":");
|
|
1121
|
+
for (const [o, u] of Object.entries(i))
|
|
1122
|
+
n(o, u, c);
|
|
1123
|
+
} else
|
|
1124
|
+
n(t, i, []);
|
|
1125
|
+
}
|
|
1126
|
+
function T(e, r) {
|
|
1127
|
+
const n = e.utilities.find((i) => i.name === r);
|
|
1128
|
+
if (n)
|
|
1129
|
+
return n;
|
|
1130
|
+
const t = r.replace(/[A-Z]/g, (i) => `-${i.toLowerCase()}`);
|
|
1131
|
+
return e.utilities.find((i) => i.name === t);
|
|
1132
|
+
}
|
|
1133
|
+
function pe(e, r) {
|
|
1134
|
+
const n = /* @__PURE__ */ new Map();
|
|
1135
|
+
if (e.base && x(e.base, n), e.variants)
|
|
1136
|
+
for (const i of Object.values(e.variants))
|
|
1137
|
+
for (const c of Object.values(i))
|
|
1138
|
+
x(
|
|
1139
|
+
c,
|
|
1140
|
+
n
|
|
1141
|
+
);
|
|
1142
|
+
if (e.compoundVariants)
|
|
1143
|
+
for (const i of e.compoundVariants)
|
|
1144
|
+
i.css && x(i.css, n);
|
|
1145
|
+
const t = /* @__PURE__ */ new Map();
|
|
1146
|
+
for (const [i, c] of n) {
|
|
1147
|
+
const o = T(r, i);
|
|
1148
|
+
if (!o) {
|
|
1149
|
+
console.warn(
|
|
1150
|
+
`[styleframe] Utility "${i}" not found in registry. Skipping.`
|
|
1151
|
+
);
|
|
1152
|
+
continue;
|
|
1153
|
+
}
|
|
1154
|
+
for (const u of c) {
|
|
1155
|
+
const s = [];
|
|
1156
|
+
for (const f of u.modifiers) {
|
|
1157
|
+
if (!t.has(f))
|
|
1158
|
+
try {
|
|
1159
|
+
t.set(f, re(r, f));
|
|
1160
|
+
} catch {
|
|
1161
|
+
console.warn(
|
|
1162
|
+
`[styleframe] Modifier "${f}" not found in registry. Skipping modifier for utility "${i}".`
|
|
1163
|
+
), t.set(f, null);
|
|
1164
|
+
}
|
|
1165
|
+
const l = t.get(f);
|
|
1166
|
+
l && s.push(l);
|
|
1167
|
+
}
|
|
1168
|
+
o.create(
|
|
1169
|
+
[u.value],
|
|
1170
|
+
s.length > 0 ? s : void 0
|
|
1171
|
+
);
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
function Re(e) {
|
|
1176
|
+
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: d2 } = v(n, n);
|
|
942
1177
|
return {
|
|
943
1178
|
id: r,
|
|
944
1179
|
root: n,
|
|
945
|
-
variable:
|
|
1180
|
+
variable: s,
|
|
946
1181
|
selector: f,
|
|
947
1182
|
utility: i,
|
|
948
|
-
modifier:
|
|
1183
|
+
modifier: c,
|
|
949
1184
|
recipe: o,
|
|
950
1185
|
theme: u,
|
|
951
|
-
atRule:
|
|
952
|
-
keyframes:
|
|
1186
|
+
atRule: l,
|
|
1187
|
+
keyframes: a,
|
|
953
1188
|
media: y,
|
|
954
|
-
ref:
|
|
955
|
-
css:
|
|
1189
|
+
ref: m,
|
|
1190
|
+
css: d2,
|
|
956
1191
|
options: t
|
|
957
1192
|
};
|
|
958
1193
|
}
|
|
1194
|
+
const SUPPORTED_EXTENSIONS = [".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"];
|
|
1195
|
+
function hasKnownExtension(filePath) {
|
|
1196
|
+
return SUPPORTED_EXTENSIONS.some((ext) => filePath.endsWith(ext));
|
|
1197
|
+
}
|
|
1198
|
+
function resolveConfigFile(cwd, entry) {
|
|
1199
|
+
const basePath = path.isAbsolute(entry) ? entry : path.join(cwd, entry);
|
|
1200
|
+
if (hasKnownExtension(basePath)) {
|
|
1201
|
+
return node_fs.existsSync(basePath) ? basePath : void 0;
|
|
1202
|
+
}
|
|
1203
|
+
for (const ext of SUPPORTED_EXTENSIONS) {
|
|
1204
|
+
const filePath = `${basePath}${ext}`;
|
|
1205
|
+
if (node_fs.existsSync(filePath)) {
|
|
1206
|
+
return filePath;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
return void 0;
|
|
1210
|
+
}
|
|
1211
|
+
function trackNamedExports(module2) {
|
|
1212
|
+
for (const [exportName, exportValue] of Object.entries(module2)) {
|
|
1213
|
+
if (exportName === "default") continue;
|
|
1214
|
+
if (Ae(exportValue)) {
|
|
1215
|
+
exportValue._exportName = exportName;
|
|
1216
|
+
} else if (be(exportValue)) {
|
|
1217
|
+
exportValue._exportName = exportName;
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
959
1221
|
async function loadConfiguration({
|
|
960
1222
|
cwd = process.cwd(),
|
|
961
|
-
|
|
1223
|
+
entry = "styleframe.config"
|
|
962
1224
|
} = {}) {
|
|
963
|
-
const
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
});
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1225
|
+
const resolvedPath = resolveConfigFile(cwd, entry);
|
|
1226
|
+
if (!resolvedPath) {
|
|
1227
|
+
return Re();
|
|
1228
|
+
}
|
|
1229
|
+
const jiti$1 = jiti.createJiti(path.dirname(resolvedPath), { cache: false });
|
|
1230
|
+
const module2 = await jiti$1.import(resolvedPath);
|
|
1231
|
+
if (!module2.default) {
|
|
1232
|
+
throw new Error(
|
|
1233
|
+
`Missing default export in ${resolvedPath}. Expected a Styleframe instance.`
|
|
1234
|
+
);
|
|
1235
|
+
}
|
|
1236
|
+
trackNamedExports(module2);
|
|
1237
|
+
return module2.default;
|
|
975
1238
|
}
|
|
976
1239
|
async function watchConfiguration({
|
|
977
|
-
cwd = process.cwd()
|
|
1240
|
+
cwd = process.cwd(),
|
|
1241
|
+
entry = "styleframe.config",
|
|
1242
|
+
onUpdate,
|
|
1243
|
+
onError
|
|
978
1244
|
} = {}) {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
}
|
|
1245
|
+
const resolvedPath = resolveConfigFile(cwd, entry);
|
|
1246
|
+
if (!resolvedPath) {
|
|
1247
|
+
throw new Error(`Config file not found: ${entry}`);
|
|
1248
|
+
}
|
|
1249
|
+
const watcher = chokidar.watch(resolvedPath, { ignoreInitial: true });
|
|
1250
|
+
watcher.on("change", async () => {
|
|
1251
|
+
try {
|
|
1252
|
+
const config = await loadConfiguration({ entry: resolvedPath });
|
|
1253
|
+
onUpdate?.(config);
|
|
1254
|
+
} catch (error) {
|
|
1255
|
+
onError?.(error instanceof Error ? error : new Error(String(error)));
|
|
987
1256
|
}
|
|
988
1257
|
});
|
|
1258
|
+
watcher.on("unlink", () => {
|
|
1259
|
+
onError?.(new Error(`Config file was deleted: ${resolvedPath}`));
|
|
1260
|
+
});
|
|
1261
|
+
return {
|
|
1262
|
+
config: await loadConfiguration({ entry: resolvedPath }),
|
|
1263
|
+
configFile: resolvedPath,
|
|
1264
|
+
unwatch: () => watcher.close()
|
|
1265
|
+
};
|
|
989
1266
|
}
|
|
990
1267
|
exports2.build = build;
|
|
991
1268
|
exports2.directoryExists = directoryExists;
|
|
992
1269
|
exports2.loadConfiguration = loadConfiguration;
|
|
993
|
-
exports2.loadConfigurationFromPath = loadConfigurationFromPath;
|
|
994
1270
|
exports2.watchConfiguration = watchConfiguration;
|
|
995
1271
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
996
1272
|
}));
|