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