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