@styleframe/loader 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +578 -457
- package/dist/index.js +577 -455
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,164 +1,165 @@
|
|
|
1
1
|
import { stat, rm, mkdir, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { validateInstanceLicense, getLicenseKeyFromEnv } from "@styleframe/license";
|
|
3
4
|
import { loadConfig, watchConfig } from "c12";
|
|
4
|
-
const N
|
|
5
|
+
const N = ["charset", "import", "namespace"], R$1 = ["layer"], D$1 = ({ name: e }) => `[data-theme="${e}"]`, I = ({
|
|
5
6
|
name: e,
|
|
6
7
|
value: t,
|
|
7
|
-
modifiers:
|
|
8
|
-
}) => `._${[...
|
|
9
|
-
function
|
|
8
|
+
modifiers: r
|
|
9
|
+
}) => `._${[...r, e, t].filter(Boolean).join("\\:")}`, w = ({ name: e }) => e;
|
|
10
|
+
function L(e, t) {
|
|
10
11
|
return `@${e}${t ? " " : ""}${t}`;
|
|
11
12
|
}
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
if (!
|
|
13
|
+
const P$1 = /\d/, M$1 = ["-", "_", "/", "."];
|
|
14
|
+
function $$1(e = "") {
|
|
15
|
+
if (!P$1.test(e))
|
|
15
16
|
return e !== e.toLowerCase();
|
|
16
17
|
}
|
|
17
|
-
function U(e, t) {
|
|
18
|
-
const
|
|
18
|
+
function U$1(e, t) {
|
|
19
|
+
const r = M$1, n = [];
|
|
19
20
|
if (!e || typeof e != "string")
|
|
20
|
-
return
|
|
21
|
-
let
|
|
22
|
-
for (const
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
|
|
21
|
+
return n;
|
|
22
|
+
let u = "", a, i;
|
|
23
|
+
for (const s of e) {
|
|
24
|
+
const o = r.includes(s);
|
|
25
|
+
if (o === true) {
|
|
26
|
+
n.push(u), u = "", a = void 0;
|
|
26
27
|
continue;
|
|
27
28
|
}
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
if (
|
|
31
|
-
|
|
29
|
+
const c = $$1(s);
|
|
30
|
+
if (i === false) {
|
|
31
|
+
if (a === false && c === true) {
|
|
32
|
+
n.push(u), u = s, a = c;
|
|
32
33
|
continue;
|
|
33
34
|
}
|
|
34
|
-
if (
|
|
35
|
-
const f =
|
|
36
|
-
|
|
35
|
+
if (a === true && c === false && u.length > 1) {
|
|
36
|
+
const f = u.at(-1);
|
|
37
|
+
n.push(u.slice(0, Math.max(0, u.length - 1))), u = f + s, a = c;
|
|
37
38
|
continue;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
u += s, a = c, i = o;
|
|
41
42
|
}
|
|
42
|
-
return
|
|
43
|
+
return n.push(u), n;
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
return e ? (Array.isArray(e) ? e : U(e)).map((
|
|
45
|
+
function _$1(e, t) {
|
|
46
|
+
return e ? (Array.isArray(e) ? e : U$1(e)).map((r) => r.toLowerCase()).join("-") : "";
|
|
46
47
|
}
|
|
47
48
|
function k$1(e) {
|
|
48
49
|
return ` ${e}`;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function V(e) {
|
|
51
52
|
return e.split(`
|
|
52
53
|
`).map((t) => k$1(t)).join(`
|
|
53
54
|
`);
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
-
return
|
|
56
|
+
function x(e) {
|
|
57
|
+
return _$1(e);
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
-
return
|
|
59
|
+
function K$1(e) {
|
|
60
|
+
return x(e);
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
return `${e.startsWith("--") ? e :
|
|
62
|
+
function B$1(e, t) {
|
|
63
|
+
return `${e.startsWith("--") ? e : K$1(e)}: ${t};`;
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function q$1(e) {
|
|
65
66
|
return `{${e.length > 0 ? `
|
|
66
|
-
` : ""}${e.map((t) => `${
|
|
67
|
+
` : ""}${e.map((t) => `${V(`${t}`)}
|
|
67
68
|
`).join("")}}`;
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function O$1(e) {
|
|
70
71
|
return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
-
return
|
|
73
|
+
function z$1(e, t) {
|
|
74
|
+
return B$1(O$1(e), t);
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
-
return `var(${
|
|
76
|
+
function H$1(e, t) {
|
|
77
|
+
return `var(${O$1(e)}${t ? `, ${t}` : ""})`;
|
|
77
78
|
}
|
|
78
79
|
function C$1(e, t) {
|
|
79
|
-
return `${e} ${
|
|
80
|
+
return `${e} ${q$1(t)}`;
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
-
return function(
|
|
83
|
-
return Object.entries(
|
|
82
|
+
function Q$1(e) {
|
|
83
|
+
return function(r, n) {
|
|
84
|
+
return Object.entries(r).map(([u, a]) => B$1(u, e(a, n)));
|
|
84
85
|
};
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
-
return function(
|
|
88
|
-
const
|
|
89
|
-
return
|
|
87
|
+
function E$1(e) {
|
|
88
|
+
return function(r, n) {
|
|
89
|
+
const a = (n.variables?.name ?? w)({ name: r.name });
|
|
90
|
+
return z$1(a, e(r.value, n));
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
-
const t =
|
|
94
|
-
return function(
|
|
95
|
-
const { variables:
|
|
96
|
-
(
|
|
97
|
-
), m2 =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
),
|
|
101
|
-
(
|
|
102
|
-
),
|
|
103
|
-
return f ? `${
|
|
104
|
-
...
|
|
105
|
-
...
|
|
93
|
+
function S$1(e) {
|
|
94
|
+
const t = E$1(e), r = Q$1(e);
|
|
95
|
+
return function(u, a, i) {
|
|
96
|
+
const { variables: s, declarations: o, children: c } = a, f = u === ":root", l = (s ?? []).map(
|
|
97
|
+
(A2) => t(A2, i)
|
|
98
|
+
), m2 = r(
|
|
99
|
+
o ?? {},
|
|
100
|
+
i
|
|
101
|
+
), y = (c ?? []).map(
|
|
102
|
+
(A2) => e(A2, i)
|
|
103
|
+
), d = l.length > 0, h = m2.length > 0, v = y.length > 0;
|
|
104
|
+
return f ? `${d || h ? C$1(u, [
|
|
105
|
+
...l,
|
|
106
|
+
...d && h ? [""] : [],
|
|
106
107
|
...m2
|
|
107
|
-
]) : ""}${
|
|
108
|
+
]) : ""}${v && (d || h) ? `
|
|
108
109
|
|
|
109
|
-
` : ""}${
|
|
110
|
+
` : ""}${y.join(`
|
|
110
111
|
|
|
111
|
-
`)}` : C$1(
|
|
112
|
-
...
|
|
113
|
-
...
|
|
112
|
+
`)}` : C$1(u, [
|
|
113
|
+
...l,
|
|
114
|
+
...d && (v || h) ? [""] : [],
|
|
114
115
|
...m2,
|
|
115
|
-
...h &&
|
|
116
|
-
...
|
|
117
|
-
(
|
|
116
|
+
...h && v ? [""] : [],
|
|
117
|
+
...y.flatMap(
|
|
118
|
+
(A2, F2) => F2 === y.length - 1 ? [A2] : [A2, ""]
|
|
118
119
|
)
|
|
119
120
|
]);
|
|
120
121
|
};
|
|
121
122
|
}
|
|
122
123
|
function Z(e) {
|
|
123
|
-
const t =
|
|
124
|
-
return function(
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
),
|
|
128
|
-
return
|
|
124
|
+
const t = S$1(e);
|
|
125
|
+
return function(n, u) {
|
|
126
|
+
const a = N.includes(n.identifier), i = R$1.includes(
|
|
127
|
+
n.identifier
|
|
128
|
+
), s = Object.keys(n.declarations).length > 0, o = n.variables.length > 0, c = n.children.length > 0, f = L(n.identifier, n.rule);
|
|
129
|
+
return a || i && !(s || o || c) ? `${f};` : t(f, n, u);
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
|
-
function
|
|
132
|
+
function W$1(e) {
|
|
132
133
|
return typeof e == "object" && e !== null;
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
-
return
|
|
135
|
+
function b$1(e, t) {
|
|
136
|
+
return W$1(e) && "type" in e && e.type === t;
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
-
return
|
|
138
|
+
function J$1(e) {
|
|
139
|
+
return b$1(e, "variable");
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
-
return
|
|
141
|
+
function G$1(e) {
|
|
142
|
+
return b$1(e, "reference");
|
|
142
143
|
}
|
|
143
144
|
function Y$1(e) {
|
|
144
|
-
return
|
|
145
|
+
return b$1(e, "selector");
|
|
145
146
|
}
|
|
146
|
-
function X(e) {
|
|
147
|
-
return
|
|
147
|
+
function X$1(e) {
|
|
148
|
+
return b$1(e, "at-rule");
|
|
148
149
|
}
|
|
149
150
|
function ee(e) {
|
|
150
|
-
return
|
|
151
|
+
return b$1(e, "utility");
|
|
151
152
|
}
|
|
152
153
|
function te(e) {
|
|
153
|
-
return
|
|
154
|
-
}
|
|
155
|
-
function re(e) {
|
|
156
|
-
return d(e, "theme");
|
|
154
|
+
return b$1(e, "css");
|
|
157
155
|
}
|
|
158
156
|
function ne(e) {
|
|
159
|
-
return
|
|
157
|
+
return b$1(e, "theme");
|
|
160
158
|
}
|
|
161
|
-
function
|
|
159
|
+
function re(e) {
|
|
160
|
+
return b$1(e, "root");
|
|
161
|
+
}
|
|
162
|
+
function g$1(e) {
|
|
162
163
|
if (e instanceof Buffer)
|
|
163
164
|
return Buffer.from(e);
|
|
164
165
|
const t = e.constructor;
|
|
@@ -168,157 +169,157 @@ function j$1(e) {
|
|
|
168
169
|
e.byteLength / e.BYTES_PER_ELEMENT || 1
|
|
169
170
|
);
|
|
170
171
|
}
|
|
171
|
-
function oe
|
|
172
|
+
function oe(e) {
|
|
172
173
|
if (e = e || {}, e.circular)
|
|
173
|
-
return
|
|
174
|
+
return ce(e);
|
|
174
175
|
const t = /* @__PURE__ */ new Map();
|
|
175
|
-
if (t.set(Date, (
|
|
176
|
+
if (t.set(Date, (i) => new Date(i)), t.set(
|
|
176
177
|
Map,
|
|
177
|
-
(
|
|
178
|
+
(i, s) => new Map(n(Array.from(i), s))
|
|
178
179
|
), t.set(
|
|
179
180
|
Set,
|
|
180
|
-
(
|
|
181
|
+
(i, s) => new Set(n(Array.from(i), s))
|
|
181
182
|
), e.constructorHandlers)
|
|
182
|
-
for (const
|
|
183
|
-
t.set(
|
|
184
|
-
let
|
|
185
|
-
return e.proto ?
|
|
186
|
-
function
|
|
187
|
-
const
|
|
188
|
-
for (let f = 0; f <
|
|
189
|
-
const
|
|
190
|
-
typeof m2 != "object" || m2 === null ?
|
|
183
|
+
for (const i of e.constructorHandlers)
|
|
184
|
+
t.set(i[0], i[1]);
|
|
185
|
+
let r;
|
|
186
|
+
return e.proto ? a : u;
|
|
187
|
+
function n(i, s) {
|
|
188
|
+
const o = Object.keys(i), c = Array.from({ length: o.length });
|
|
189
|
+
for (let f = 0; f < o.length; f++) {
|
|
190
|
+
const l = o[f], m2 = i[l];
|
|
191
|
+
typeof m2 != "object" || m2 === null ? c[l] = m2 : m2.constructor !== Object && (r = t.get(m2.constructor)) ? c[l] = r(m2, s) : ArrayBuffer.isView(m2) ? c[l] = g$1(m2) : c[l] = s(m2);
|
|
191
192
|
}
|
|
192
|
-
return
|
|
193
|
+
return c;
|
|
193
194
|
}
|
|
194
|
-
function
|
|
195
|
-
if (typeof
|
|
196
|
-
if (Array.isArray(
|
|
197
|
-
if (
|
|
198
|
-
return
|
|
199
|
-
const
|
|
200
|
-
for (const
|
|
201
|
-
if (Object.hasOwnProperty.call(
|
|
202
|
-
const
|
|
203
|
-
typeof
|
|
195
|
+
function u(i) {
|
|
196
|
+
if (typeof i != "object" || i === null) return i;
|
|
197
|
+
if (Array.isArray(i)) return n(i, u);
|
|
198
|
+
if (i.constructor !== Object && (r = t.get(i.constructor)))
|
|
199
|
+
return r(i, u);
|
|
200
|
+
const s = {};
|
|
201
|
+
for (const o in i) {
|
|
202
|
+
if (Object.hasOwnProperty.call(i, o) === false) continue;
|
|
203
|
+
const c = i[o];
|
|
204
|
+
typeof c != "object" || c === null ? s[o] = c : c.constructor !== Object && (r = t.get(c.constructor)) ? s[o] = r(c, u) : ArrayBuffer.isView(c) ? s[o] = g$1(c) : s[o] = u(c);
|
|
204
205
|
}
|
|
205
|
-
return
|
|
206
|
+
return s;
|
|
206
207
|
}
|
|
207
|
-
function
|
|
208
|
-
if (typeof
|
|
209
|
-
if (Array.isArray(
|
|
210
|
-
if (
|
|
211
|
-
return
|
|
212
|
-
const
|
|
213
|
-
for (const
|
|
214
|
-
const
|
|
215
|
-
typeof
|
|
208
|
+
function a(i) {
|
|
209
|
+
if (typeof i != "object" || i === null) return i;
|
|
210
|
+
if (Array.isArray(i)) return n(i, a);
|
|
211
|
+
if (i.constructor !== Object && (r = t.get(i.constructor)))
|
|
212
|
+
return r(i, a);
|
|
213
|
+
const s = {};
|
|
214
|
+
for (const o in i) {
|
|
215
|
+
const c = i[o];
|
|
216
|
+
typeof c != "object" || c === null ? s[o] = c : c.constructor !== Object && (r = t.get(c.constructor)) ? s[o] = r(c, a) : ArrayBuffer.isView(c) ? s[o] = g$1(c) : s[o] = a(c);
|
|
216
217
|
}
|
|
217
|
-
return
|
|
218
|
+
return s;
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
|
-
function
|
|
221
|
-
const t = [],
|
|
222
|
-
if (
|
|
221
|
+
function ce(e) {
|
|
222
|
+
const t = [], r = [], n = /* @__PURE__ */ new Map();
|
|
223
|
+
if (n.set(Date, (o) => new Date(o)), n.set(
|
|
223
224
|
Map,
|
|
224
|
-
(
|
|
225
|
-
),
|
|
225
|
+
(o, c) => new Map(a(Array.from(o), c))
|
|
226
|
+
), n.set(
|
|
226
227
|
Set,
|
|
227
|
-
(
|
|
228
|
+
(o, c) => new Set(a(Array.from(o), c))
|
|
228
229
|
), e.constructorHandlers)
|
|
229
|
-
for (const
|
|
230
|
-
|
|
231
|
-
let
|
|
232
|
-
return e.proto ?
|
|
233
|
-
function
|
|
234
|
-
const f = Object.keys(
|
|
230
|
+
for (const o of e.constructorHandlers)
|
|
231
|
+
n.set(o[0], o[1]);
|
|
232
|
+
let u;
|
|
233
|
+
return e.proto ? s : i;
|
|
234
|
+
function a(o, c) {
|
|
235
|
+
const f = Object.keys(o), l = Array.from({ length: f.length });
|
|
235
236
|
for (let m2 = 0; m2 < f.length; m2++) {
|
|
236
|
-
const
|
|
237
|
-
if (typeof
|
|
238
|
-
|
|
239
|
-
else if (
|
|
240
|
-
|
|
241
|
-
else if (ArrayBuffer.isView(
|
|
242
|
-
|
|
237
|
+
const y = f[m2], d = o[y];
|
|
238
|
+
if (typeof d != "object" || d === null)
|
|
239
|
+
l[y] = d;
|
|
240
|
+
else if (d.constructor !== Object && (u = n.get(d.constructor)))
|
|
241
|
+
l[y] = u(d, c);
|
|
242
|
+
else if (ArrayBuffer.isView(d))
|
|
243
|
+
l[y] = g$1(d);
|
|
243
244
|
else {
|
|
244
|
-
const h = t.indexOf(
|
|
245
|
-
h !== -1 ?
|
|
245
|
+
const h = t.indexOf(d);
|
|
246
|
+
h !== -1 ? l[y] = r[h] : l[y] = c(d);
|
|
246
247
|
}
|
|
247
248
|
}
|
|
248
|
-
return
|
|
249
|
+
return l;
|
|
249
250
|
}
|
|
250
|
-
function
|
|
251
|
-
if (typeof
|
|
252
|
-
if (Array.isArray(
|
|
253
|
-
if (
|
|
254
|
-
return
|
|
255
|
-
const
|
|
256
|
-
t.push(
|
|
257
|
-
for (const f in
|
|
258
|
-
if (Object.hasOwnProperty.call(
|
|
259
|
-
const
|
|
260
|
-
if (typeof
|
|
261
|
-
|
|
262
|
-
else if (
|
|
263
|
-
|
|
264
|
-
else if (ArrayBuffer.isView(
|
|
265
|
-
|
|
251
|
+
function i(o) {
|
|
252
|
+
if (typeof o != "object" || o === null) return o;
|
|
253
|
+
if (Array.isArray(o)) return a(o, i);
|
|
254
|
+
if (o.constructor !== Object && (u = n.get(o.constructor)))
|
|
255
|
+
return u(o, i);
|
|
256
|
+
const c = {};
|
|
257
|
+
t.push(o), r.push(c);
|
|
258
|
+
for (const f in o) {
|
|
259
|
+
if (Object.hasOwnProperty.call(o, f) === false) continue;
|
|
260
|
+
const l = o[f];
|
|
261
|
+
if (typeof l != "object" || l === null)
|
|
262
|
+
c[f] = l;
|
|
263
|
+
else if (l.constructor !== Object && (u = n.get(l.constructor)))
|
|
264
|
+
c[f] = u(l, i);
|
|
265
|
+
else if (ArrayBuffer.isView(l))
|
|
266
|
+
c[f] = g$1(l);
|
|
266
267
|
else {
|
|
267
|
-
const m2 = t.indexOf(
|
|
268
|
-
m2 !== -1 ?
|
|
268
|
+
const m2 = t.indexOf(l);
|
|
269
|
+
m2 !== -1 ? c[f] = r[m2] : c[f] = i(l);
|
|
269
270
|
}
|
|
270
271
|
}
|
|
271
|
-
return t.pop(),
|
|
272
|
+
return t.pop(), r.pop(), c;
|
|
272
273
|
}
|
|
273
|
-
function
|
|
274
|
-
if (typeof
|
|
275
|
-
if (Array.isArray(
|
|
276
|
-
if (
|
|
277
|
-
return
|
|
278
|
-
const
|
|
279
|
-
t.push(
|
|
280
|
-
for (const f in
|
|
281
|
-
const
|
|
282
|
-
if (typeof
|
|
283
|
-
|
|
284
|
-
else if (
|
|
285
|
-
|
|
286
|
-
else if (ArrayBuffer.isView(
|
|
287
|
-
|
|
274
|
+
function s(o) {
|
|
275
|
+
if (typeof o != "object" || o === null) return o;
|
|
276
|
+
if (Array.isArray(o)) return a(o, s);
|
|
277
|
+
if (o.constructor !== Object && (u = n.get(o.constructor)))
|
|
278
|
+
return u(o, s);
|
|
279
|
+
const c = {};
|
|
280
|
+
t.push(o), r.push(c);
|
|
281
|
+
for (const f in o) {
|
|
282
|
+
const l = o[f];
|
|
283
|
+
if (typeof l != "object" || l === null)
|
|
284
|
+
c[f] = l;
|
|
285
|
+
else if (l.constructor !== Object && (u = n.get(l.constructor)))
|
|
286
|
+
c[f] = u(l, s);
|
|
287
|
+
else if (ArrayBuffer.isView(l))
|
|
288
|
+
c[f] = g$1(l);
|
|
288
289
|
else {
|
|
289
|
-
const m2 = t.indexOf(
|
|
290
|
-
m2 !== -1 ?
|
|
290
|
+
const m2 = t.indexOf(l);
|
|
291
|
+
m2 !== -1 ? c[f] = r[m2] : c[f] = s(l);
|
|
291
292
|
}
|
|
292
293
|
}
|
|
293
|
-
return t.pop(),
|
|
294
|
+
return t.pop(), r.pop(), c;
|
|
294
295
|
}
|
|
295
296
|
}
|
|
296
|
-
oe
|
|
297
|
-
function
|
|
298
|
-
return function(
|
|
299
|
-
return
|
|
297
|
+
oe();
|
|
298
|
+
function ue$1(e) {
|
|
299
|
+
return function(r, n) {
|
|
300
|
+
return r.value.map((u) => e(u, n)).join("").trim();
|
|
300
301
|
};
|
|
301
302
|
}
|
|
302
|
-
function
|
|
303
|
-
return function(
|
|
304
|
-
return
|
|
303
|
+
function ie(e) {
|
|
304
|
+
return function(r, n) {
|
|
305
|
+
return r != null ? `${r}` : "";
|
|
305
306
|
};
|
|
306
307
|
}
|
|
307
|
-
function
|
|
308
|
-
return function(
|
|
309
|
-
const
|
|
310
|
-
return
|
|
311
|
-
|
|
312
|
-
|
|
308
|
+
function se(e) {
|
|
309
|
+
return function(r, n) {
|
|
310
|
+
const a = (n.variables?.name ?? w)({ name: r.name });
|
|
311
|
+
return H$1(
|
|
312
|
+
a,
|
|
313
|
+
r.fallback ? e(r.fallback, n) : void 0
|
|
313
314
|
);
|
|
314
315
|
};
|
|
315
316
|
}
|
|
316
317
|
function ae(e) {
|
|
317
|
-
const t =
|
|
318
|
-
return function(
|
|
319
|
-
return
|
|
320
|
-
(
|
|
321
|
-
[t(":root",
|
|
318
|
+
const t = S$1(e);
|
|
319
|
+
return function(n, u) {
|
|
320
|
+
return n.themes.reduce(
|
|
321
|
+
(a, i) => (a.push(e(i, u)), a),
|
|
322
|
+
[t(":root", n, u)]
|
|
322
323
|
// Default theme (root)
|
|
323
324
|
).join(`
|
|
324
325
|
|
|
@@ -326,58 +327,58 @@ function ae(e) {
|
|
|
326
327
|
};
|
|
327
328
|
}
|
|
328
329
|
function le(e) {
|
|
329
|
-
const t =
|
|
330
|
-
return function(
|
|
331
|
-
return t(
|
|
330
|
+
const t = S$1(e);
|
|
331
|
+
return function(n, u) {
|
|
332
|
+
return t(n.query, n, u);
|
|
332
333
|
};
|
|
333
334
|
}
|
|
334
335
|
function fe(e) {
|
|
335
|
-
const t =
|
|
336
|
-
return function(
|
|
337
|
-
const
|
|
338
|
-
return t(
|
|
336
|
+
const t = S$1(e);
|
|
337
|
+
return function(n, u) {
|
|
338
|
+
const i = (u.theme?.selector ?? D$1)({ name: n.name });
|
|
339
|
+
return t(i, n, u);
|
|
339
340
|
};
|
|
340
341
|
}
|
|
341
342
|
function me(e) {
|
|
342
|
-
const t =
|
|
343
|
-
return function(
|
|
344
|
-
const
|
|
345
|
-
name:
|
|
346
|
-
value:
|
|
347
|
-
modifiers:
|
|
343
|
+
const t = S$1(e);
|
|
344
|
+
return function(n, u) {
|
|
345
|
+
const a = [], s = (u.utilities?.selector ?? I)({
|
|
346
|
+
name: n.name,
|
|
347
|
+
value: n.value,
|
|
348
|
+
modifiers: n.modifiers
|
|
348
349
|
});
|
|
349
|
-
return
|
|
350
|
+
return a.push(t(s, n, u)), a.join(`
|
|
350
351
|
|
|
351
352
|
`);
|
|
352
353
|
};
|
|
353
354
|
}
|
|
354
|
-
function
|
|
355
|
-
const
|
|
355
|
+
function p$1(e, t) {
|
|
356
|
+
const r = ae(p$1), n = le(p$1), u = me(p$1), a = Z(p$1), i = fe(p$1), s = E$1(p$1), o = se(p$1), c = ue$1(p$1), f = ie();
|
|
356
357
|
switch (true) {
|
|
357
358
|
case Y$1(e):
|
|
358
|
-
return
|
|
359
|
+
return n(e, t);
|
|
359
360
|
case ee(e):
|
|
360
|
-
return c(e, t);
|
|
361
|
-
case X(e):
|
|
362
|
-
return l(e, t);
|
|
363
|
-
case ne(e):
|
|
364
|
-
return s(e, t);
|
|
365
|
-
case re(e):
|
|
366
361
|
return u(e, t);
|
|
367
|
-
case
|
|
362
|
+
case X$1(e):
|
|
363
|
+
return a(e, t);
|
|
364
|
+
case re(e):
|
|
365
|
+
return r(e, t);
|
|
366
|
+
case ne(e):
|
|
368
367
|
return i(e, t);
|
|
369
|
-
case J(e):
|
|
370
|
-
return
|
|
371
|
-
case
|
|
368
|
+
case J$1(e):
|
|
369
|
+
return s(e, t);
|
|
370
|
+
case G$1(e):
|
|
372
371
|
return o(e, t);
|
|
372
|
+
case te(e):
|
|
373
|
+
return c(e, t);
|
|
373
374
|
default:
|
|
374
375
|
return f(e, t);
|
|
375
376
|
}
|
|
376
377
|
}
|
|
377
|
-
function
|
|
378
|
+
function T$1(e, t) {
|
|
378
379
|
switch (true) {
|
|
379
380
|
case Array.isArray(e):
|
|
380
|
-
return e.map((
|
|
381
|
+
return e.map((r) => T$1(r)).join(`
|
|
381
382
|
`);
|
|
382
383
|
// case isRecipe(instance):
|
|
383
384
|
// return consumeRecipe(instance, options);
|
|
@@ -386,26 +387,132 @@ function R$1(e, t) {
|
|
|
386
387
|
return "";
|
|
387
388
|
}
|
|
388
389
|
}
|
|
389
|
-
|
|
390
|
+
const de = `-----BEGIN PUBLIC KEY-----
|
|
391
|
+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4
|
|
392
|
+
qSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n
|
|
393
|
+
BiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA
|
|
394
|
+
dQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj
|
|
395
|
+
hC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn
|
|
396
|
+
4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+
|
|
397
|
+
GwIDAQAB
|
|
398
|
+
-----END PUBLIC KEY-----`, ye = "__licenseRequired", pe = "__licenseValidated";
|
|
399
|
+
async function he(e) {
|
|
400
|
+
const t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""), r = Uint8Array.from(atob(t), (n) => n.charCodeAt(0));
|
|
401
|
+
return await crypto.subtle.importKey(
|
|
402
|
+
"spki",
|
|
403
|
+
r,
|
|
404
|
+
{
|
|
405
|
+
name: "RSASSA-PKCS1-v1_5",
|
|
406
|
+
hash: "SHA-256"
|
|
407
|
+
},
|
|
408
|
+
true,
|
|
409
|
+
["verify"]
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
async function be({
|
|
413
|
+
payload: e,
|
|
414
|
+
signature: t
|
|
415
|
+
}) {
|
|
416
|
+
const r = new TextEncoder().encode(e), n = Uint8Array.from(
|
|
417
|
+
atob(t),
|
|
418
|
+
(a) => a.charCodeAt(0)
|
|
419
|
+
), u = await he(de);
|
|
420
|
+
if (!await crypto.subtle.verify(
|
|
421
|
+
{ name: "RSASSA-PKCS1-v1_5" },
|
|
422
|
+
u,
|
|
423
|
+
n,
|
|
424
|
+
r
|
|
425
|
+
))
|
|
426
|
+
throw new Error(
|
|
427
|
+
"License validation failed: Invalid signature detected. The license may have been modified or corrupted."
|
|
428
|
+
);
|
|
429
|
+
return JSON.parse(e);
|
|
430
|
+
}
|
|
431
|
+
function Ae(e) {
|
|
432
|
+
return Object.prototype.hasOwnProperty.call(e, ye);
|
|
433
|
+
}
|
|
434
|
+
async function ge(e) {
|
|
435
|
+
const t = Object.getOwnPropertyDescriptor(
|
|
436
|
+
e,
|
|
437
|
+
pe
|
|
438
|
+
);
|
|
439
|
+
if (!t?.value)
|
|
440
|
+
return {
|
|
441
|
+
key: "",
|
|
442
|
+
instanceId: "",
|
|
443
|
+
environment: "",
|
|
444
|
+
valid: false
|
|
445
|
+
};
|
|
446
|
+
const r = t.value;
|
|
447
|
+
if (typeof r != "object" || r === null || !("payload" in r) || !("signature" in r) || typeof r.payload != "string" || typeof r.signature != "string")
|
|
448
|
+
return {
|
|
449
|
+
key: "",
|
|
450
|
+
instanceId: "",
|
|
451
|
+
environment: "",
|
|
452
|
+
valid: false
|
|
453
|
+
};
|
|
454
|
+
try {
|
|
455
|
+
return await be(
|
|
456
|
+
r
|
|
457
|
+
);
|
|
458
|
+
} catch {
|
|
459
|
+
return {
|
|
460
|
+
key: "",
|
|
461
|
+
instanceId: "",
|
|
462
|
+
environment: "",
|
|
463
|
+
valid: false
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
function Se(e) {
|
|
468
|
+
const t = Math.floor(Math.random() * 100);
|
|
469
|
+
e.root.children.push({
|
|
470
|
+
type: "selector",
|
|
471
|
+
query: `html:nth-of-type(${t}n+1)::after`,
|
|
472
|
+
variables: [],
|
|
473
|
+
children: [],
|
|
474
|
+
declarations: {
|
|
475
|
+
content: '"Styleframe Pro: Development Mode – License required for production use"',
|
|
476
|
+
zIndex: 99999,
|
|
477
|
+
position: "fixed",
|
|
478
|
+
display: "block !important",
|
|
479
|
+
opacity: "1 !important",
|
|
480
|
+
bottom: 0,
|
|
481
|
+
left: 0,
|
|
482
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
483
|
+
color: "white",
|
|
484
|
+
fontSize: "12px",
|
|
485
|
+
lineHeight: "1",
|
|
486
|
+
padding: "0.5rem",
|
|
487
|
+
fontFamily: "sans-serif"
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
function j(e, t = "") {
|
|
390
492
|
return {
|
|
391
493
|
name: e,
|
|
392
494
|
content: t
|
|
393
495
|
};
|
|
394
496
|
}
|
|
395
|
-
function
|
|
497
|
+
async function Ce(e, {
|
|
396
498
|
type: t = "all",
|
|
397
|
-
consumers:
|
|
499
|
+
consumers: r = { css: p$1, ts: T$1 }
|
|
398
500
|
} = {}) {
|
|
399
|
-
const
|
|
501
|
+
const n = { files: [] }, u = e.options;
|
|
502
|
+
if (Ae(e)) {
|
|
503
|
+
const s = await ge(e);
|
|
504
|
+
(!s.valid || s.instanceId !== e.id) && Se(e);
|
|
505
|
+
}
|
|
506
|
+
const { recipes: a, ...i } = e.root;
|
|
400
507
|
if (t === "all" || t === "css") {
|
|
401
|
-
const
|
|
402
|
-
|
|
508
|
+
const s = j("index.css", r.css(i, u));
|
|
509
|
+
n.files.push(s);
|
|
403
510
|
}
|
|
404
511
|
if (t === "all" || t === "ts") {
|
|
405
|
-
const
|
|
406
|
-
|
|
512
|
+
const s = j("index.ts", r.ts([], u));
|
|
513
|
+
n.files.push(s);
|
|
407
514
|
}
|
|
408
|
-
return
|
|
515
|
+
return console.log(n.files), n;
|
|
409
516
|
}
|
|
410
517
|
async function directoryExists(path2) {
|
|
411
518
|
try {
|
|
@@ -416,7 +523,12 @@ async function directoryExists(path2) {
|
|
|
416
523
|
}
|
|
417
524
|
}
|
|
418
525
|
async function build(instance, { clean = true, outputDir = "./styleframe", transpiler } = {}) {
|
|
419
|
-
|
|
526
|
+
await validateInstanceLicense(instance, {
|
|
527
|
+
licenseKey: getLicenseKeyFromEnv() || "",
|
|
528
|
+
environment: process.env.NODE_ENV || "development",
|
|
529
|
+
isBuild: true
|
|
530
|
+
});
|
|
531
|
+
const output = await Ce(instance, transpiler);
|
|
420
532
|
const outputDirExists = await directoryExists(outputDir);
|
|
421
533
|
if (clean && outputDirExists) {
|
|
422
534
|
await rm(outputDir, { recursive: true });
|
|
@@ -431,310 +543,319 @@ async function build(instance, { clean = true, outputDir = "./styleframe", trans
|
|
|
431
543
|
await writeFile(filePath, file.content);
|
|
432
544
|
}
|
|
433
545
|
}
|
|
434
|
-
function
|
|
435
|
-
return function(
|
|
546
|
+
function k(e, r) {
|
|
547
|
+
return function(t, ...i) {
|
|
436
548
|
return {
|
|
437
549
|
type: "css",
|
|
438
|
-
value:
|
|
550
|
+
value: t.reduce((o, u, c) => (o.push(u), c < i.length && o.push(i[c]), o), [])
|
|
439
551
|
};
|
|
440
552
|
};
|
|
441
553
|
}
|
|
442
|
-
function
|
|
554
|
+
function M(e) {
|
|
443
555
|
return typeof e == "object" && e !== null;
|
|
444
556
|
}
|
|
445
|
-
function p(e,
|
|
446
|
-
return
|
|
557
|
+
function p(e, r) {
|
|
558
|
+
return M(e) && "type" in e && e.type === r;
|
|
447
559
|
}
|
|
448
|
-
function
|
|
560
|
+
function B(e) {
|
|
449
561
|
return p(e, "variable");
|
|
450
562
|
}
|
|
451
|
-
function
|
|
563
|
+
function F(e) {
|
|
452
564
|
return p(e, "reference");
|
|
453
565
|
}
|
|
454
|
-
function
|
|
566
|
+
function T(e) {
|
|
455
567
|
return p(e, "css");
|
|
456
568
|
}
|
|
457
|
-
function
|
|
569
|
+
function _(e) {
|
|
458
570
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
459
571
|
}
|
|
460
|
-
function
|
|
461
|
-
return
|
|
572
|
+
function O(e) {
|
|
573
|
+
return _(e) || F(e) || T(e) || Array.isArray(e) && e.every(O);
|
|
462
574
|
}
|
|
463
|
-
function
|
|
464
|
-
return
|
|
575
|
+
function C(e) {
|
|
576
|
+
return M(e) && "children" in e && "declarations" in e && "variables" in e;
|
|
465
577
|
}
|
|
466
|
-
function
|
|
467
|
-
return function(
|
|
468
|
-
const
|
|
578
|
+
function R(e, r) {
|
|
579
|
+
return function(t, i, s) {
|
|
580
|
+
const o = {
|
|
469
581
|
type: "at-rule",
|
|
470
|
-
identifier:
|
|
471
|
-
rule:
|
|
582
|
+
identifier: t,
|
|
583
|
+
rule: i,
|
|
472
584
|
declarations: {},
|
|
473
585
|
variables: [],
|
|
474
586
|
children: []
|
|
475
|
-
}, u = b(
|
|
476
|
-
return typeof s == "function" ?
|
|
587
|
+
}, u = b(o, r);
|
|
588
|
+
return typeof s == "function" ? o.declarations = s(u) ?? {} : s && (o.declarations = s), g(o.declarations, u), e.children.push(o), o;
|
|
477
589
|
};
|
|
478
590
|
}
|
|
479
|
-
function
|
|
480
|
-
const
|
|
481
|
-
return function(
|
|
482
|
-
return
|
|
591
|
+
function S(e, r) {
|
|
592
|
+
const n = R(e, r);
|
|
593
|
+
return function(i, s) {
|
|
594
|
+
return n("media", i, s);
|
|
483
595
|
};
|
|
484
596
|
}
|
|
485
|
-
function
|
|
486
|
-
const
|
|
487
|
-
return function(
|
|
488
|
-
return
|
|
597
|
+
function E(e, r) {
|
|
598
|
+
const n = R(e, r);
|
|
599
|
+
return function(i, s) {
|
|
600
|
+
return n("keyframes", i, s);
|
|
489
601
|
};
|
|
490
602
|
}
|
|
491
|
-
function
|
|
492
|
-
return function(
|
|
493
|
-
return
|
|
603
|
+
function P(e, r) {
|
|
604
|
+
return function(t, i) {
|
|
605
|
+
return B(t) ? {
|
|
494
606
|
type: "reference",
|
|
495
|
-
name:
|
|
496
|
-
fallback:
|
|
607
|
+
name: t.name,
|
|
608
|
+
fallback: i
|
|
497
609
|
} : {
|
|
498
610
|
type: "reference",
|
|
499
|
-
name:
|
|
500
|
-
fallback:
|
|
611
|
+
name: t,
|
|
612
|
+
fallback: i
|
|
501
613
|
};
|
|
502
614
|
};
|
|
503
615
|
}
|
|
504
|
-
function
|
|
505
|
-
return function(
|
|
616
|
+
function D(e, r) {
|
|
617
|
+
return function(t, i) {
|
|
506
618
|
const s = {
|
|
507
619
|
type: "selector",
|
|
508
|
-
query:
|
|
620
|
+
query: t,
|
|
509
621
|
declarations: {},
|
|
510
622
|
variables: [],
|
|
511
623
|
children: []
|
|
512
|
-
},
|
|
513
|
-
return typeof
|
|
624
|
+
}, o = b(s, r);
|
|
625
|
+
return typeof i == "function" ? s.declarations = i(o) ?? {} : C(i) ? (s.variables = i.variables, s.declarations = i.declarations, s.children = i.children) : s.declarations = i, g(s.declarations, o), e.children.push(s), s;
|
|
514
626
|
};
|
|
515
627
|
}
|
|
516
|
-
function
|
|
517
|
-
return function(
|
|
628
|
+
function H(e, r) {
|
|
629
|
+
return function(t, i, s = {
|
|
518
630
|
default: false
|
|
519
631
|
}) {
|
|
520
|
-
const
|
|
521
|
-
(f) => f.name ===
|
|
632
|
+
const o = typeof t == "string" ? t : t.name, u = e.variables.find(
|
|
633
|
+
(f) => f.name === o
|
|
522
634
|
);
|
|
523
635
|
if (s.default && u)
|
|
524
636
|
return u;
|
|
525
637
|
if (u)
|
|
526
|
-
return u.value =
|
|
638
|
+
return u.value = i, u;
|
|
527
639
|
const c = {
|
|
528
640
|
type: "variable",
|
|
529
|
-
name:
|
|
530
|
-
value:
|
|
641
|
+
name: o,
|
|
642
|
+
value: i
|
|
531
643
|
};
|
|
532
644
|
return e.variables.push(c), c;
|
|
533
645
|
};
|
|
534
646
|
}
|
|
535
|
-
function b(e,
|
|
536
|
-
const
|
|
647
|
+
function b(e, r) {
|
|
648
|
+
const n = H(e), t = D(e, r), i = R(e, r), s = E(r, r), o = S(e, r), u = P(), c = k();
|
|
537
649
|
return {
|
|
538
|
-
variable:
|
|
539
|
-
selector:
|
|
650
|
+
variable: n,
|
|
651
|
+
selector: t,
|
|
540
652
|
keyframes: s,
|
|
541
|
-
atRule:
|
|
542
|
-
media:
|
|
653
|
+
atRule: i,
|
|
654
|
+
media: o,
|
|
543
655
|
ref: u,
|
|
544
656
|
css: c
|
|
545
657
|
};
|
|
546
658
|
}
|
|
547
|
-
function g(e,
|
|
548
|
-
for (const
|
|
549
|
-
if (
|
|
550
|
-
const
|
|
551
|
-
if (typeof
|
|
552
|
-
const
|
|
553
|
-
|
|
659
|
+
function g(e, r) {
|
|
660
|
+
for (const n in e)
|
|
661
|
+
if (n.startsWith("@")) {
|
|
662
|
+
const t = e[n];
|
|
663
|
+
if (typeof t == "object" && t !== null && !O(t)) {
|
|
664
|
+
const i = n.replace(/^@(\w+).*/, "$1"), s = n.replace(`@${i}`, "").trim();
|
|
665
|
+
r.atRule(i, s, t), delete e[n];
|
|
554
666
|
}
|
|
555
|
-
} else if (/^[.&:]/.test(
|
|
556
|
-
const
|
|
557
|
-
typeof
|
|
667
|
+
} else if (/^[.&:]/.test(n)) {
|
|
668
|
+
const t = e[n];
|
|
669
|
+
typeof t == "object" && (r.selector(n, t), delete e[n]);
|
|
558
670
|
}
|
|
559
671
|
return e;
|
|
560
672
|
}
|
|
561
673
|
function m(e) {
|
|
562
674
|
if (e instanceof Buffer)
|
|
563
675
|
return Buffer.from(e);
|
|
564
|
-
const
|
|
565
|
-
return new
|
|
676
|
+
const r = e.constructor;
|
|
677
|
+
return new r(
|
|
566
678
|
e.buffer.slice(0),
|
|
567
679
|
e.byteOffset,
|
|
568
680
|
e.byteLength / e.BYTES_PER_ELEMENT || 1
|
|
569
681
|
);
|
|
570
682
|
}
|
|
571
|
-
function
|
|
683
|
+
function K(e) {
|
|
572
684
|
if (e = e || {}, e.circular)
|
|
573
|
-
return
|
|
574
|
-
const
|
|
575
|
-
if (
|
|
685
|
+
return U(e);
|
|
686
|
+
const r = /* @__PURE__ */ new Map();
|
|
687
|
+
if (r.set(Date, (o) => new Date(o)), r.set(
|
|
576
688
|
Map,
|
|
577
|
-
(
|
|
578
|
-
),
|
|
689
|
+
(o, u) => new Map(t(Array.from(o), u))
|
|
690
|
+
), r.set(
|
|
579
691
|
Set,
|
|
580
|
-
(
|
|
692
|
+
(o, u) => new Set(t(Array.from(o), u))
|
|
581
693
|
), e.constructorHandlers)
|
|
582
|
-
for (const
|
|
583
|
-
|
|
584
|
-
let
|
|
585
|
-
return e.proto ? s :
|
|
586
|
-
function
|
|
587
|
-
const c = Object.keys(
|
|
694
|
+
for (const o of e.constructorHandlers)
|
|
695
|
+
r.set(o[0], o[1]);
|
|
696
|
+
let n;
|
|
697
|
+
return e.proto ? s : i;
|
|
698
|
+
function t(o, u) {
|
|
699
|
+
const c = Object.keys(o), f = Array.from({ length: c.length });
|
|
588
700
|
for (let a = 0; a < c.length; a++) {
|
|
589
|
-
const l = c[a],
|
|
590
|
-
typeof
|
|
701
|
+
const l = c[a], y = o[l];
|
|
702
|
+
typeof y != "object" || y === null ? f[l] = y : y.constructor !== Object && (n = r.get(y.constructor)) ? f[l] = n(y, u) : ArrayBuffer.isView(y) ? f[l] = m(y) : f[l] = u(y);
|
|
591
703
|
}
|
|
592
704
|
return f;
|
|
593
705
|
}
|
|
594
|
-
function o
|
|
595
|
-
if (typeof
|
|
596
|
-
if (Array.isArray(
|
|
597
|
-
if (
|
|
598
|
-
return
|
|
706
|
+
function i(o) {
|
|
707
|
+
if (typeof o != "object" || o === null) return o;
|
|
708
|
+
if (Array.isArray(o)) return t(o, i);
|
|
709
|
+
if (o.constructor !== Object && (n = r.get(o.constructor)))
|
|
710
|
+
return n(o, i);
|
|
599
711
|
const u = {};
|
|
600
|
-
for (const c in
|
|
601
|
-
if (Object.hasOwnProperty.call(
|
|
602
|
-
const f =
|
|
603
|
-
typeof f != "object" || f === null ? u[c] = f : f.constructor !== Object && (
|
|
712
|
+
for (const c in o) {
|
|
713
|
+
if (Object.hasOwnProperty.call(o, c) === false) continue;
|
|
714
|
+
const f = o[c];
|
|
715
|
+
typeof f != "object" || f === null ? u[c] = f : f.constructor !== Object && (n = r.get(f.constructor)) ? u[c] = n(f, i) : ArrayBuffer.isView(f) ? u[c] = m(f) : u[c] = i(f);
|
|
604
716
|
}
|
|
605
717
|
return u;
|
|
606
718
|
}
|
|
607
|
-
function s(
|
|
608
|
-
if (typeof
|
|
609
|
-
if (Array.isArray(
|
|
610
|
-
if (
|
|
611
|
-
return
|
|
719
|
+
function s(o) {
|
|
720
|
+
if (typeof o != "object" || o === null) return o;
|
|
721
|
+
if (Array.isArray(o)) return t(o, s);
|
|
722
|
+
if (o.constructor !== Object && (n = r.get(o.constructor)))
|
|
723
|
+
return n(o, s);
|
|
612
724
|
const u = {};
|
|
613
|
-
for (const c in
|
|
614
|
-
const f =
|
|
615
|
-
typeof f != "object" || f === null ? u[c] = f : f.constructor !== Object && (
|
|
725
|
+
for (const c in o) {
|
|
726
|
+
const f = o[c];
|
|
727
|
+
typeof f != "object" || f === null ? u[c] = f : f.constructor !== Object && (n = r.get(f.constructor)) ? u[c] = n(f, s) : ArrayBuffer.isView(f) ? u[c] = m(f) : u[c] = s(f);
|
|
616
728
|
}
|
|
617
729
|
return u;
|
|
618
730
|
}
|
|
619
731
|
}
|
|
620
|
-
function
|
|
621
|
-
const
|
|
622
|
-
if (
|
|
732
|
+
function U(e) {
|
|
733
|
+
const r = [], n = [], t = /* @__PURE__ */ new Map();
|
|
734
|
+
if (t.set(Date, (c) => new Date(c)), t.set(
|
|
623
735
|
Map,
|
|
624
736
|
(c, f) => new Map(s(Array.from(c), f))
|
|
625
|
-
),
|
|
737
|
+
), t.set(
|
|
626
738
|
Set,
|
|
627
739
|
(c, f) => new Set(s(Array.from(c), f))
|
|
628
740
|
), e.constructorHandlers)
|
|
629
741
|
for (const c of e.constructorHandlers)
|
|
630
|
-
|
|
631
|
-
let
|
|
632
|
-
return e.proto ? u :
|
|
742
|
+
t.set(c[0], c[1]);
|
|
743
|
+
let i;
|
|
744
|
+
return e.proto ? u : o;
|
|
633
745
|
function s(c, f) {
|
|
634
746
|
const a = Object.keys(c), l = Array.from({ length: a.length });
|
|
635
|
-
for (let
|
|
636
|
-
const h = a[
|
|
637
|
-
if (typeof
|
|
638
|
-
l[h] =
|
|
639
|
-
else if (
|
|
640
|
-
l[h] =
|
|
641
|
-
else if (ArrayBuffer.isView(
|
|
642
|
-
l[h] = m(
|
|
747
|
+
for (let y = 0; y < a.length; y++) {
|
|
748
|
+
const h = a[y], d = c[h];
|
|
749
|
+
if (typeof d != "object" || d === null)
|
|
750
|
+
l[h] = d;
|
|
751
|
+
else if (d.constructor !== Object && (i = t.get(d.constructor)))
|
|
752
|
+
l[h] = i(d, f);
|
|
753
|
+
else if (ArrayBuffer.isView(d))
|
|
754
|
+
l[h] = m(d);
|
|
643
755
|
else {
|
|
644
|
-
const
|
|
645
|
-
|
|
756
|
+
const v = r.indexOf(d);
|
|
757
|
+
v !== -1 ? l[h] = n[v] : l[h] = f(d);
|
|
646
758
|
}
|
|
647
759
|
}
|
|
648
760
|
return l;
|
|
649
761
|
}
|
|
650
|
-
function
|
|
762
|
+
function o(c) {
|
|
651
763
|
if (typeof c != "object" || c === null) return c;
|
|
652
|
-
if (Array.isArray(c)) return s(c,
|
|
653
|
-
if (c.constructor !== Object && (
|
|
654
|
-
return
|
|
764
|
+
if (Array.isArray(c)) return s(c, o);
|
|
765
|
+
if (c.constructor !== Object && (i = t.get(c.constructor)))
|
|
766
|
+
return i(c, o);
|
|
655
767
|
const f = {};
|
|
656
|
-
|
|
768
|
+
r.push(c), n.push(f);
|
|
657
769
|
for (const a in c) {
|
|
658
770
|
if (Object.hasOwnProperty.call(c, a) === false) continue;
|
|
659
771
|
const l = c[a];
|
|
660
772
|
if (typeof l != "object" || l === null)
|
|
661
773
|
f[a] = l;
|
|
662
|
-
else if (l.constructor !== Object && (
|
|
663
|
-
f[a] =
|
|
774
|
+
else if (l.constructor !== Object && (i = t.get(l.constructor)))
|
|
775
|
+
f[a] = i(l, o);
|
|
664
776
|
else if (ArrayBuffer.isView(l))
|
|
665
777
|
f[a] = m(l);
|
|
666
778
|
else {
|
|
667
|
-
const
|
|
668
|
-
|
|
779
|
+
const y = r.indexOf(l);
|
|
780
|
+
y !== -1 ? f[a] = n[y] : f[a] = o(l);
|
|
669
781
|
}
|
|
670
782
|
}
|
|
671
|
-
return
|
|
783
|
+
return r.pop(), n.pop(), f;
|
|
672
784
|
}
|
|
673
785
|
function u(c) {
|
|
674
786
|
if (typeof c != "object" || c === null) return c;
|
|
675
787
|
if (Array.isArray(c)) return s(c, u);
|
|
676
|
-
if (c.constructor !== Object && (
|
|
677
|
-
return
|
|
788
|
+
if (c.constructor !== Object && (i = t.get(c.constructor)))
|
|
789
|
+
return i(c, u);
|
|
678
790
|
const f = {};
|
|
679
|
-
|
|
791
|
+
r.push(c), n.push(f);
|
|
680
792
|
for (const a in c) {
|
|
681
793
|
const l = c[a];
|
|
682
794
|
if (typeof l != "object" || l === null)
|
|
683
795
|
f[a] = l;
|
|
684
|
-
else if (l.constructor !== Object && (
|
|
685
|
-
f[a] =
|
|
796
|
+
else if (l.constructor !== Object && (i = t.get(l.constructor)))
|
|
797
|
+
f[a] = i(l, u);
|
|
686
798
|
else if (ArrayBuffer.isView(l))
|
|
687
799
|
f[a] = m(l);
|
|
688
800
|
else {
|
|
689
|
-
const
|
|
690
|
-
|
|
801
|
+
const y = r.indexOf(l);
|
|
802
|
+
y !== -1 ? f[a] = n[y] : f[a] = u(l);
|
|
691
803
|
}
|
|
692
804
|
}
|
|
693
|
-
return
|
|
805
|
+
return r.pop(), n.pop(), f;
|
|
694
806
|
}
|
|
695
807
|
}
|
|
696
|
-
const
|
|
697
|
-
function $(e) {
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
808
|
+
const A = K();
|
|
809
|
+
function $(e, r = 8) {
|
|
810
|
+
const n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
811
|
+
let t = "";
|
|
812
|
+
for (let i = 0; i < r; i++) {
|
|
813
|
+
const s = Math.floor(Math.random() * n.length);
|
|
814
|
+
t += n[s];
|
|
815
|
+
}
|
|
816
|
+
return e ? `${e}${t}` : t;
|
|
817
|
+
}
|
|
818
|
+
function q(e) {
|
|
819
|
+
const r = [];
|
|
820
|
+
function n(t, i) {
|
|
821
|
+
i.length > 0 && r.push([...i].sort());
|
|
822
|
+
for (let s = t; s < e.length; s++) {
|
|
823
|
+
const o = e[s];
|
|
824
|
+
if (o)
|
|
825
|
+
if (o.length === 1 && o[0])
|
|
826
|
+
n(s + 1, [...i, o[0]]);
|
|
706
827
|
else
|
|
707
|
-
for (const u of
|
|
708
|
-
|
|
828
|
+
for (const u of o)
|
|
829
|
+
n(s + 1, [...i, u]);
|
|
709
830
|
}
|
|
710
831
|
}
|
|
711
|
-
return
|
|
832
|
+
return n(0, []), r.sort((t, i) => t.length !== i.length ? t.length - i.length : t.join(",").localeCompare(i.join(",")));
|
|
712
833
|
}
|
|
713
|
-
function
|
|
714
|
-
const
|
|
834
|
+
function z(e, r, n) {
|
|
835
|
+
const t = {
|
|
715
836
|
...e,
|
|
716
|
-
modifiers: [...
|
|
717
|
-
},
|
|
718
|
-
for (const s of
|
|
837
|
+
modifiers: [...n.keys()]
|
|
838
|
+
}, i = b(t, r);
|
|
839
|
+
for (const s of n.values())
|
|
719
840
|
s.factory({
|
|
720
|
-
...
|
|
721
|
-
declarations:
|
|
722
|
-
variables:
|
|
723
|
-
children:
|
|
724
|
-
}), g(
|
|
725
|
-
return
|
|
726
|
-
}
|
|
727
|
-
function
|
|
728
|
-
return function(
|
|
841
|
+
...i,
|
|
842
|
+
declarations: A(t.declarations),
|
|
843
|
+
variables: A(t.variables),
|
|
844
|
+
children: A(t.children)
|
|
845
|
+
}), g(t.declarations, i);
|
|
846
|
+
return t;
|
|
847
|
+
}
|
|
848
|
+
function W(e, r) {
|
|
849
|
+
return function(t, i) {
|
|
729
850
|
const s = {
|
|
730
851
|
type: "modifier",
|
|
731
|
-
key: Array.isArray(
|
|
732
|
-
factory:
|
|
852
|
+
key: Array.isArray(t) ? t : [t],
|
|
853
|
+
factory: i
|
|
733
854
|
};
|
|
734
|
-
return
|
|
855
|
+
return r.modifiers.push(s), s;
|
|
735
856
|
};
|
|
736
857
|
}
|
|
737
|
-
function
|
|
858
|
+
function Y() {
|
|
738
859
|
return {
|
|
739
860
|
type: "root",
|
|
740
861
|
declarations: {},
|
|
@@ -746,31 +867,31 @@ function z() {
|
|
|
746
867
|
themes: []
|
|
747
868
|
};
|
|
748
869
|
}
|
|
749
|
-
function
|
|
750
|
-
const
|
|
751
|
-
return
|
|
752
|
-
const
|
|
870
|
+
function G(e, r, n) {
|
|
871
|
+
const t = r.map((s) => s.key);
|
|
872
|
+
return q(t).map((s) => {
|
|
873
|
+
const o = /* @__PURE__ */ new Map();
|
|
753
874
|
for (const u of s) {
|
|
754
|
-
const c =
|
|
875
|
+
const c = r.find(
|
|
755
876
|
(f) => f.key.includes(u)
|
|
756
877
|
);
|
|
757
|
-
c &&
|
|
878
|
+
c && o.set(u, c);
|
|
758
879
|
}
|
|
759
|
-
return
|
|
880
|
+
return z(e, n, o);
|
|
760
881
|
});
|
|
761
882
|
}
|
|
762
|
-
function
|
|
763
|
-
return function(
|
|
883
|
+
function J(e, r) {
|
|
884
|
+
return function(t, i) {
|
|
764
885
|
const s = {
|
|
765
886
|
type: "utility",
|
|
766
|
-
name:
|
|
767
|
-
factory:
|
|
887
|
+
name: t,
|
|
888
|
+
factory: i
|
|
768
889
|
};
|
|
769
|
-
return
|
|
770
|
-
for (const [c, f] of Object.entries(
|
|
890
|
+
return r.utilities.push(s), (o, u = []) => {
|
|
891
|
+
for (const [c, f] of Object.entries(o)) {
|
|
771
892
|
const a = {
|
|
772
893
|
type: "utility",
|
|
773
|
-
name:
|
|
894
|
+
name: t,
|
|
774
895
|
value: c,
|
|
775
896
|
declarations: {},
|
|
776
897
|
variables: [],
|
|
@@ -778,60 +899,61 @@ function W(e, t) {
|
|
|
778
899
|
modifiers: []
|
|
779
900
|
}, l = b(
|
|
780
901
|
a,
|
|
781
|
-
|
|
902
|
+
r
|
|
782
903
|
);
|
|
783
|
-
a.declarations =
|
|
904
|
+
a.declarations = i({
|
|
784
905
|
...l,
|
|
785
906
|
value: f
|
|
786
907
|
}) ?? {}, g(a.declarations, l), e.children.push(a), u.length > 0 && e.children.push(
|
|
787
|
-
...
|
|
908
|
+
...G(a, u, r)
|
|
788
909
|
);
|
|
789
910
|
}
|
|
790
911
|
};
|
|
791
912
|
};
|
|
792
913
|
}
|
|
793
|
-
function
|
|
794
|
-
return function(
|
|
795
|
-
const s =
|
|
914
|
+
function Q(e, r) {
|
|
915
|
+
return function(t, i) {
|
|
916
|
+
const s = r.themes.find((c) => c.name === t), o = s ?? {
|
|
796
917
|
type: "theme",
|
|
797
|
-
name:
|
|
918
|
+
name: t,
|
|
798
919
|
declarations: {},
|
|
799
920
|
variables: [],
|
|
800
921
|
children: []
|
|
801
922
|
};
|
|
802
|
-
s ||
|
|
803
|
-
const u = b(
|
|
804
|
-
return
|
|
923
|
+
s || r.themes.push(o);
|
|
924
|
+
const u = b(o, r);
|
|
925
|
+
return i && i(u), o;
|
|
805
926
|
};
|
|
806
927
|
}
|
|
807
|
-
function
|
|
808
|
-
return function(
|
|
928
|
+
function X(e, r) {
|
|
929
|
+
return function(t, i, s, o) {
|
|
809
930
|
const u = {
|
|
810
931
|
type: "recipe",
|
|
811
|
-
name:
|
|
812
|
-
defaults:
|
|
932
|
+
name: t,
|
|
933
|
+
defaults: i,
|
|
813
934
|
variants: s,
|
|
814
|
-
...
|
|
935
|
+
...o
|
|
815
936
|
};
|
|
816
|
-
return
|
|
937
|
+
return r.recipes.push(u), u;
|
|
817
938
|
};
|
|
818
939
|
}
|
|
819
|
-
function
|
|
820
|
-
const
|
|
940
|
+
function ue(e) {
|
|
941
|
+
const r = $("sf-"), n = Y(), t = { ...e }, i = J(n, n), s = W(n, n), o = X(n, n), u = Q(n, n), { variable: c, selector: f, atRule: a, keyframes: l, media: y, ref: h, css: d } = b(n, n);
|
|
821
942
|
return {
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
943
|
+
id: r,
|
|
944
|
+
root: n,
|
|
945
|
+
variable: c,
|
|
946
|
+
selector: f,
|
|
947
|
+
utility: i,
|
|
948
|
+
modifier: s,
|
|
949
|
+
recipe: o,
|
|
950
|
+
theme: u,
|
|
951
|
+
atRule: a,
|
|
952
|
+
keyframes: l,
|
|
953
|
+
media: y,
|
|
954
|
+
ref: h,
|
|
955
|
+
css: d,
|
|
956
|
+
options: t
|
|
835
957
|
};
|
|
836
958
|
}
|
|
837
959
|
async function loadConfiguration({
|
|
@@ -841,7 +963,7 @@ async function loadConfiguration({
|
|
|
841
963
|
const { config } = await loadConfig({
|
|
842
964
|
cwd,
|
|
843
965
|
name,
|
|
844
|
-
defaults:
|
|
966
|
+
defaults: ue()
|
|
845
967
|
});
|
|
846
968
|
return config;
|
|
847
969
|
}
|