@styleframe/transpiler 3.3.0 → 3.4.1

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.
@@ -1,711 +1,822 @@
1
- const Me = " ", L = ["charset", "import", "namespace"], I = ["layer"];
2
- function M(e) {
3
- return typeof e == "object" && e !== null;
1
+ //#region src/constants.ts
2
+ var e = " ", t = [
3
+ "charset",
4
+ "import",
5
+ "namespace"
6
+ ], n = ["layer"];
7
+ //#endregion
8
+ //#region ../core/dist/styleframe.js
9
+ function r(e) {
10
+ return typeof e == "object" && !!e;
4
11
  }
5
- function g(e, t) {
6
- return M(e) && "type" in e && e.type === t;
12
+ function i(e, t) {
13
+ return r(e) && "type" in e && e.type === t;
7
14
  }
8
- function V(e) {
9
- return g(e, "variable");
15
+ function a(e) {
16
+ return i(e, "variable");
10
17
  }
11
- function K(e) {
12
- return g(e, "reference");
18
+ function o(e) {
19
+ return i(e, "reference");
13
20
  }
14
- function S(e) {
15
- return g(e, "selector");
21
+ function s(e) {
22
+ return i(e, "selector");
16
23
  }
17
- function q(e) {
18
- return g(e, "at-rule");
24
+ function c(e) {
25
+ return i(e, "at-rule");
19
26
  }
20
- function z(e) {
21
- return g(e, "utility");
27
+ function l(e) {
28
+ return i(e, "utility");
22
29
  }
23
- function H(e) {
24
- return g(e, "css");
30
+ function u(e) {
31
+ return i(e, "css");
25
32
  }
26
- function Q(e) {
27
- return g(e, "theme");
33
+ function d(e) {
34
+ return i(e, "theme");
28
35
  }
29
- function O(e) {
30
- return g(e, "root");
36
+ function f(e) {
37
+ return i(e, "root");
31
38
  }
32
- function w(e) {
33
- return g(e, "recipe");
34
- }
35
- const T = ({
36
- name: e,
37
- value: t,
38
- modifiers: r
39
- }) => `_${[
40
- ...r,
41
- e,
42
- ...t === "default" ? [] : [t]
43
- ].filter(Boolean).join(":")}`;
44
- function $(e) {
45
- return e.charAt(0).toUpperCase() + e.slice(1);
39
+ function p(e) {
40
+ return i(e, "recipe");
46
41
  }
47
- function J(e) {
48
- return `.${e.replace(/[[\].#()%,:/]/g, "\\$&")}`;
42
+ function m(e) {
43
+ let t = 5381;
44
+ for (let n = 0; n < e.length; n++) t = (t << 5) + t + e.charCodeAt(n) & 4294967295;
45
+ return (t >>> 0).toString(16).padStart(7, "0").slice(0, 7);
49
46
  }
50
- function A(e) {
51
- if (e instanceof Buffer)
52
- return Buffer.from(e);
53
- const t = e.constructor;
54
- return new t(
55
- e.buffer.slice(0),
56
- e.byteOffset,
57
- e.byteLength / e.BYTES_PER_ELEMENT || 1
58
- );
59
- }
60
- function Z(e) {
61
- if (e = e || {}, e.circular)
62
- return W(e);
63
- const t = /* @__PURE__ */ new Map();
64
- if (t.set(Date, (c) => new Date(c)), t.set(
65
- Map,
66
- (c, a) => new Map(o(Array.from(c), a))
67
- ), t.set(
68
- Set,
69
- (c, a) => new Set(o(Array.from(c), a))
70
- ), e.constructorHandlers)
71
- for (const c of e.constructorHandlers)
72
- t.set(c[0], c[1]);
73
- let r;
74
- return e.proto ? i : n;
75
- function o(c, a) {
76
- const s = Object.keys(c), u = Array.from({ length: s.length });
77
- for (let f = 0; f < s.length; f++) {
78
- const l = s[f], m = c[l];
79
- typeof m != "object" || m === null ? u[l] = m : m.constructor !== Object && (r = t.get(m.constructor)) ? u[l] = r(m, a) : ArrayBuffer.isView(m) ? u[l] = A(m) : u[l] = a(m);
80
- }
81
- return u;
82
- }
83
- function n(c) {
84
- if (typeof c != "object" || c === null) return c;
85
- if (Array.isArray(c)) return o(c, n);
86
- if (c.constructor !== Object && (r = t.get(c.constructor)))
87
- return r(c, n);
88
- const a = {};
89
- for (const s in c) {
90
- if (Object.hasOwnProperty.call(c, s) === !1) continue;
91
- const u = c[s];
92
- typeof u != "object" || u === null ? a[s] = u : u.constructor !== Object && (r = t.get(u.constructor)) ? a[s] = r(u, n) : ArrayBuffer.isView(u) ? a[s] = A(u) : a[s] = n(u);
93
- }
94
- return a;
95
- }
96
- function i(c) {
97
- if (typeof c != "object" || c === null) return c;
98
- if (Array.isArray(c)) return o(c, i);
99
- if (c.constructor !== Object && (r = t.get(c.constructor)))
100
- return r(c, i);
101
- const a = {};
102
- for (const s in c) {
103
- const u = c[s];
104
- typeof u != "object" || u === null ? a[s] = u : u.constructor !== Object && (r = t.get(u.constructor)) ? a[s] = r(u, i) : ArrayBuffer.isView(u) ? a[s] = A(u) : a[s] = i(u);
105
- }
106
- return a;
107
- }
108
- }
109
- function W(e) {
110
- const t = [], r = [], o = /* @__PURE__ */ new Map();
111
- if (o.set(Date, (s) => new Date(s)), o.set(
112
- Map,
113
- (s, u) => new Map(i(Array.from(s), u))
114
- ), o.set(
115
- Set,
116
- (s, u) => new Set(i(Array.from(s), u))
117
- ), e.constructorHandlers)
118
- for (const s of e.constructorHandlers)
119
- o.set(s[0], s[1]);
120
- let n;
121
- return e.proto ? a : c;
122
- function i(s, u) {
123
- const f = Object.keys(s), l = Array.from({ length: f.length });
124
- for (let m = 0; m < f.length; m++) {
125
- const y = f[m], d = s[y];
126
- if (typeof d != "object" || d === null)
127
- l[y] = d;
128
- else if (d.constructor !== Object && (n = o.get(d.constructor)))
129
- l[y] = n(d, u);
130
- else if (ArrayBuffer.isView(d))
131
- l[y] = A(d);
132
- else {
133
- const h = t.indexOf(d);
134
- h !== -1 ? l[y] = r[h] : l[y] = u(d);
135
- }
136
- }
137
- return l;
138
- }
139
- function c(s) {
140
- if (typeof s != "object" || s === null) return s;
141
- if (Array.isArray(s)) return i(s, c);
142
- if (s.constructor !== Object && (n = o.get(s.constructor)))
143
- return n(s, c);
144
- const u = {};
145
- t.push(s), r.push(u);
146
- for (const f in s) {
147
- if (Object.hasOwnProperty.call(s, f) === !1) continue;
148
- const l = s[f];
149
- if (typeof l != "object" || l === null)
150
- u[f] = l;
151
- else if (l.constructor !== Object && (n = o.get(l.constructor)))
152
- u[f] = n(l, c);
153
- else if (ArrayBuffer.isView(l))
154
- u[f] = A(l);
155
- else {
156
- const m = t.indexOf(l);
157
- m !== -1 ? u[f] = r[m] : u[f] = c(l);
158
- }
159
- }
160
- return t.pop(), r.pop(), u;
161
- }
162
- function a(s) {
163
- if (typeof s != "object" || s === null) return s;
164
- if (Array.isArray(s)) return i(s, a);
165
- if (s.constructor !== Object && (n = o.get(s.constructor)))
166
- return n(s, a);
167
- const u = {};
168
- t.push(s), r.push(u);
169
- for (const f in s) {
170
- const l = s[f];
171
- if (typeof l != "object" || l === null)
172
- u[f] = l;
173
- else if (l.constructor !== Object && (n = o.get(l.constructor)))
174
- u[f] = n(l, a);
175
- else if (ArrayBuffer.isView(l))
176
- u[f] = A(l);
177
- else {
178
- const m = t.indexOf(l);
179
- m !== -1 ? u[f] = r[m] : u[f] = a(l);
180
- }
181
- }
182
- return t.pop(), r.pop(), u;
183
- }
184
- }
185
- Z();
186
- function G(e, t = 8) {
187
- const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
188
- let o = "";
189
- for (let n = 0; n < t; n++) {
190
- const i = Math.floor(Math.random() * r.length);
191
- o += r[i];
192
- }
193
- return e ? `${e}${o}` : o;
194
- }
195
- const Y = ({ name: e }) => `.${e}-theme, [data-theme="${e}"]`, B = ({ name: e }) => e.replace(/^\.+|\.+$/g, "").replace(/\.+/g, "--");
196
- function X(e, t) {
197
- return `@${e}${t ? " " : ""}${t}`;
198
- }
199
- const ee = /\d/, te = ["-", "_", "/", "."];
200
- function re(e = "") {
201
- if (!ee.test(e))
202
- return e !== e.toLowerCase();
203
- }
204
- function E(e, t) {
205
- const r = te, o = [];
206
- if (!e || typeof e != "string")
207
- return o;
208
- let n = "", i, c;
209
- for (const a of e) {
210
- const s = r.includes(a);
211
- if (s === !0) {
212
- o.push(n), n = "", i = void 0;
213
- continue;
214
- }
215
- const u = re(a);
216
- if (c === !1) {
217
- if (i === !1 && u === !0) {
218
- o.push(n), n = a, i = u;
219
- continue;
220
- }
221
- if (i === !0 && u === !1 && n.length > 1) {
222
- const f = n.at(-1);
223
- o.push(n.slice(0, Math.max(0, n.length - 1))), n = f + a, i = u;
224
- continue;
225
- }
226
- }
227
- n += a, i = u, c = s;
228
- }
229
- return o.push(n), o;
230
- }
231
- function ne(e) {
232
- return e ? e[0].toUpperCase() + e.slice(1) : "";
47
+ var h = ({ name: e, value: t, modifiers: n }) => `_${[
48
+ ...n,
49
+ e,
50
+ ...t === "default" ? [] : [t]
51
+ ].filter(Boolean).join(":")}`;
52
+ function g(e) {
53
+ return e.charAt(0).toUpperCase() + e.slice(1);
54
+ }
55
+ function _(e) {
56
+ return `.${e.replace(/[[\].#()%,:/]/g, "\\$&")}`;
57
+ }
58
+ function v(e) {
59
+ if (e instanceof Buffer) return Buffer.from(e);
60
+ let t = e.constructor;
61
+ return new t(e.buffer.slice(0), e.byteOffset, e.byteLength / e.BYTES_PER_ELEMENT || 1);
62
+ }
63
+ function y(e) {
64
+ if (e ||= {}, e.circular) return ee(e);
65
+ let t = /* @__PURE__ */ new Map();
66
+ if (t.set(Date, (e) => new Date(e)), t.set(Map, (e, t) => new Map(r(Array.from(e), t))), t.set(Set, (e, t) => new Set(r(Array.from(e), t))), e.constructorHandlers) for (let n of e.constructorHandlers) t.set(n[0], n[1]);
67
+ let n;
68
+ return e.proto ? a : i;
69
+ function r(e, r) {
70
+ let i = Object.keys(e), a = Array.from({ length: i.length });
71
+ for (let o = 0; o < i.length; o++) {
72
+ let s = i[o], c = e[s];
73
+ typeof c != "object" || !c ? a[s] = c : c.constructor !== Object && (n = t.get(c.constructor)) ? a[s] = n(c, r) : ArrayBuffer.isView(c) ? a[s] = v(c) : a[s] = r(c);
74
+ }
75
+ return a;
76
+ }
77
+ function i(e) {
78
+ if (typeof e != "object" || !e) return e;
79
+ if (Array.isArray(e)) return r(e, i);
80
+ if (e.constructor !== Object && (n = t.get(e.constructor))) return n(e, i);
81
+ let a = {};
82
+ for (let r in e) {
83
+ if (Object.hasOwnProperty.call(e, r) === !1) continue;
84
+ let o = e[r];
85
+ typeof o != "object" || !o ? a[r] = o : o.constructor !== Object && (n = t.get(o.constructor)) ? a[r] = n(o, i) : ArrayBuffer.isView(o) ? a[r] = v(o) : a[r] = i(o);
86
+ }
87
+ return a;
88
+ }
89
+ function a(e) {
90
+ if (typeof e != "object" || !e) return e;
91
+ if (Array.isArray(e)) return r(e, a);
92
+ if (e.constructor !== Object && (n = t.get(e.constructor))) return n(e, a);
93
+ let i = {};
94
+ for (let r in e) {
95
+ let o = e[r];
96
+ typeof o != "object" || !o ? i[r] = o : o.constructor !== Object && (n = t.get(o.constructor)) ? i[r] = n(o, a) : ArrayBuffer.isView(o) ? i[r] = v(o) : i[r] = a(o);
97
+ }
98
+ return i;
99
+ }
100
+ }
101
+ function ee(e) {
102
+ let t = [], n = [], r = /* @__PURE__ */ new Map();
103
+ if (r.set(Date, (e) => new Date(e)), r.set(Map, (e, t) => new Map(a(Array.from(e), t))), r.set(Set, (e, t) => new Set(a(Array.from(e), t))), e.constructorHandlers) for (let t of e.constructorHandlers) r.set(t[0], t[1]);
104
+ let i;
105
+ return e.proto ? s : o;
106
+ function a(e, a) {
107
+ let o = Object.keys(e), s = Array.from({ length: o.length });
108
+ for (let c = 0; c < o.length; c++) {
109
+ let l = o[c], u = e[l];
110
+ if (typeof u != "object" || !u) s[l] = u;
111
+ else if (u.constructor !== Object && (i = r.get(u.constructor))) s[l] = i(u, a);
112
+ else if (ArrayBuffer.isView(u)) s[l] = v(u);
113
+ else {
114
+ let e = t.indexOf(u);
115
+ e === -1 ? s[l] = a(u) : s[l] = n[e];
116
+ }
117
+ }
118
+ return s;
119
+ }
120
+ function o(e) {
121
+ if (typeof e != "object" || !e) return e;
122
+ if (Array.isArray(e)) return a(e, o);
123
+ if (e.constructor !== Object && (i = r.get(e.constructor))) return i(e, o);
124
+ let s = {};
125
+ t.push(e), n.push(s);
126
+ for (let a in e) {
127
+ if (Object.hasOwnProperty.call(e, a) === !1) continue;
128
+ let c = e[a];
129
+ if (typeof c != "object" || !c) s[a] = c;
130
+ else if (c.constructor !== Object && (i = r.get(c.constructor))) s[a] = i(c, o);
131
+ else if (ArrayBuffer.isView(c)) s[a] = v(c);
132
+ else {
133
+ let e = t.indexOf(c);
134
+ e === -1 ? s[a] = o(c) : s[a] = n[e];
135
+ }
136
+ }
137
+ return t.pop(), n.pop(), s;
138
+ }
139
+ function s(e) {
140
+ if (typeof e != "object" || !e) return e;
141
+ if (Array.isArray(e)) return a(e, s);
142
+ if (e.constructor !== Object && (i = r.get(e.constructor))) return i(e, s);
143
+ let o = {};
144
+ t.push(e), n.push(o);
145
+ for (let a in e) {
146
+ let c = e[a];
147
+ if (typeof c != "object" || !c) o[a] = c;
148
+ else if (c.constructor !== Object && (i = r.get(c.constructor))) o[a] = i(c, s);
149
+ else if (ArrayBuffer.isView(c)) o[a] = v(c);
150
+ else {
151
+ let e = t.indexOf(c);
152
+ e === -1 ? o[a] = s(c) : o[a] = n[e];
153
+ }
154
+ }
155
+ return t.pop(), n.pop(), o;
156
+ }
157
+ }
158
+ y();
159
+ function b(e, t = 8) {
160
+ let n = "";
161
+ for (let e = 0; e < t; e++) {
162
+ let e = Math.floor(Math.random() * 62);
163
+ n += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[e];
164
+ }
165
+ return e ? `${e}${n}` : n;
166
+ }
167
+ //#endregion
168
+ //#region src/defaults.ts
169
+ var x = ({ name: e }) => `.${e}-theme, [data-theme="${e}"]`, S = ({ name: e }) => e.replace(/^\.+|\.+$/g, "").replace(/\.+/g, "--");
170
+ //#endregion
171
+ //#region src/generator/genAtRuleQuery.ts
172
+ function te(e, t) {
173
+ return `@${e}${t ? " " : ""}${t}`;
174
+ }
175
+ //#endregion
176
+ //#region ../../node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs
177
+ var ne = /\d/, re = [
178
+ "-",
179
+ "_",
180
+ "/",
181
+ "."
182
+ ];
183
+ function ie(e = "") {
184
+ if (!ne.test(e)) return e !== e.toLowerCase();
185
+ }
186
+ function C(e, t) {
187
+ let n = t ?? re, r = [];
188
+ if (!e || typeof e != "string") return r;
189
+ let i = "", a, o;
190
+ for (let t of e) {
191
+ let e = n.includes(t);
192
+ if (e === !0) {
193
+ r.push(i), i = "", a = void 0;
194
+ continue;
195
+ }
196
+ let s = ie(t);
197
+ if (o === !1) {
198
+ if (a === !1 && s === !0) {
199
+ r.push(i), i = t, a = s;
200
+ continue;
201
+ }
202
+ if (a === !0 && s === !1 && i.length > 1) {
203
+ let e = i.at(-1);
204
+ r.push(i.slice(0, Math.max(0, i.length - 1))), i = e + t, a = s;
205
+ continue;
206
+ }
207
+ }
208
+ i += t, a = s, o = e;
209
+ }
210
+ return r.push(i), r;
211
+ }
212
+ function ae(e) {
213
+ return e ? e[0].toUpperCase() + e.slice(1) : "";
233
214
  }
234
215
  function oe(e) {
235
- return e ? e[0].toLowerCase() + e.slice(1) : "";
216
+ return e ? e[0].toLowerCase() + e.slice(1) : "";
236
217
  }
237
218
  function se(e, t) {
238
- return e ? (Array.isArray(e) ? e : E(e)).map((r) => ne(r)).join("") : "";
219
+ return e ? (Array.isArray(e) ? e : C(e)).map((e) => ae(t?.normalize ? e.toLowerCase() : e)).join("") : "";
239
220
  }
240
221
  function ce(e, t) {
241
- return oe(se(e || ""));
222
+ return oe(se(e || "", t));
242
223
  }
243
- function ue(e, t) {
244
- return e ? (Array.isArray(e) ? e : E(e)).map((r) => r.toLowerCase()).join("-") : "";
224
+ function le(e, t) {
225
+ return e ? (Array.isArray(e) ? e : C(e)).map((e) => e.toLowerCase()).join(t ?? "-") : "";
245
226
  }
246
- function ie(e) {
247
- return ` ${e}`;
227
+ //#endregion
228
+ //#region src/utils.ts
229
+ function w(e) {
230
+ return ` ${e}`;
248
231
  }
249
- function ae(e) {
250
- return e.split(`
251
- `).map((t) => ie(t)).join(`
252
- `);
232
+ function T(e) {
233
+ return e.split("\n").map((e) => w(e)).join("\n");
253
234
  }
254
- function F(e) {
255
- return e === e.toUpperCase();
235
+ function E(e) {
236
+ return e === e.toUpperCase();
256
237
  }
257
238
  function D(e) {
258
- return ce(e);
239
+ return ce(e);
259
240
  }
260
- function le(e) {
261
- return ue(e);
241
+ function O(e) {
242
+ return le(e);
262
243
  }
263
- function fe(e) {
264
- return le(e);
244
+ //#endregion
245
+ //#region src/generator/genSafePropertyName.ts
246
+ function ue(e) {
247
+ return O(e);
265
248
  }
266
- function P(e, t) {
267
- return `${e.startsWith("--") ? e : fe(e)}: ${t};`;
249
+ //#endregion
250
+ //#region src/generator/genDeclaration.ts
251
+ function k(e, t) {
252
+ return `${e.startsWith("--") ? e : ue(e)}: ${t};`;
268
253
  }
269
- function me(e) {
270
- return `{${e.length > 0 ? `
271
- ` : ""}${e.map((t) => `${ae(`${t}`)}
272
- `).join("")}}`;
254
+ //#endregion
255
+ //#region src/generator/genDeclarationsBlock.ts
256
+ function de(e) {
257
+ return `{${e.length > 0 ? "\n" : ""}${e.map((e) => `${T(`${e}`)}\n`).join("")}}`;
258
+ }
259
+ //#endregion
260
+ //#region src/generator/genSafeVariableName.ts
261
+ function A(e) {
262
+ return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
273
263
  }
274
- function U(e) {
275
- return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
264
+ //#endregion
265
+ //#region src/generator/genDeclareVariable.ts
266
+ function fe(e, t) {
267
+ return k(A(e), t);
276
268
  }
269
+ //#endregion
270
+ //#region src/generator/genReferenceVariable.ts
277
271
  function pe(e, t) {
278
- return P(U(e), t);
272
+ return `var(${A(e)}${t ? `, ${t}` : ""})`;
279
273
  }
280
- function de(e, t) {
281
- return `var(${U(e)}${t ? `, ${t}` : ""})`;
274
+ //#endregion
275
+ //#region src/generator/genSelector.ts
276
+ function j(e, t) {
277
+ return `${e} ${de(t)}`;
282
278
  }
283
- function _(e, t) {
284
- return `${e} ${me(t)}`;
279
+ //#endregion
280
+ //#region src/consume/css/declarations.ts
281
+ function me(e) {
282
+ return function(t, n) {
283
+ return Object.entries(t).map(([t, r]) => k(t, e(r, n)));
284
+ };
285
285
  }
286
- function ye(e) {
287
- return function(r, o) {
288
- return Object.entries(r).map(([n, i]) => P(n, e(i, o)));
289
- };
290
- }
291
- function k(e) {
292
- return function(r, o) {
293
- const i = (o.variables?.name ?? B)({ name: r.name });
294
- return pe(i, e(r.value, o));
295
- };
296
- }
297
- function C(e) {
298
- const t = k(e), r = ye(e);
299
- return function(n, i, c) {
300
- const { variables: a, declarations: s, children: u } = i, f = n === ":root", l = (a ?? []).map(
301
- (p) => t(p, c)
302
- ), m = r(
303
- s ?? {},
304
- c
305
- ), y = (u ?? []).map(
306
- (p) => e(p, c)
307
- ), d = l.length > 0, h = m.length > 0, v = y.length > 0;
308
- return f ? `${d || h ? _(n, [
309
- ...l,
310
- ...d && h ? [""] : [],
311
- ...m
312
- ]) : ""}${v && (d || h) ? `
313
-
314
- ` : ""}${y.join(`
315
-
316
- `)}` : _(n, [
317
- ...l,
318
- ...d && (v || h) ? [""] : [],
319
- ...m,
320
- ...h && v ? [""] : [],
321
- ...y.flatMap(
322
- (p, j) => j === y.length - 1 ? [p] : [p, ""]
323
- )
324
- ]);
325
- };
286
+ //#endregion
287
+ //#region src/consume/css/variable.ts
288
+ function M(e) {
289
+ return function(t, n) {
290
+ return fe((n.variables?.name ?? S)({ name: t.name }), e(t.value, n));
291
+ };
292
+ }
293
+ //#endregion
294
+ //#region src/consume/css/container.ts
295
+ function N(e) {
296
+ let t = M(e), n = me(e);
297
+ return function(r, i, a) {
298
+ let { variables: o, declarations: s, children: c } = i, l = r === ":root", u = (o ?? []).map((e) => t(e, a)), d = n(s ?? {}, a), f = (c ?? []).map((t) => e(t, a)), p = u.length > 0, m = d.length > 0, h = f.length > 0;
299
+ return l ? `${p || m ? j(r, [
300
+ ...u,
301
+ ...p && m ? [""] : [],
302
+ ...d
303
+ ]) : ""}${h && (p || m) ? "\n\n" : ""}${f.join("\n\n")}` : j(r, [
304
+ ...u,
305
+ ...p && (h || m) ? [""] : [],
306
+ ...d,
307
+ ...m && h ? [""] : [],
308
+ ...f.flatMap((e, t) => t === f.length - 1 ? [e] : [e, ""])
309
+ ]);
310
+ };
311
+ }
312
+ //#endregion
313
+ //#region src/consume/css/at-rule.ts
314
+ function P(e) {
315
+ let r = N(e);
316
+ return function(e, i) {
317
+ let a = t.includes(e.identifier), o = n.includes(e.identifier), s = Object.keys(e.declarations).length > 0, c = e.variables.length > 0, l = e.children.length > 0, u = te(e.identifier, e.rule);
318
+ return a || o && !(s || c || l) ? `${u};` : r(u, e, i);
319
+ };
320
+ }
321
+ //#endregion
322
+ //#region src/consume/css/css.ts
323
+ function F(e) {
324
+ return function(t, n) {
325
+ return t.value.map((t) => e(t, n)).join("").trim();
326
+ };
327
+ }
328
+ //#endregion
329
+ //#region src/consume/css/primitive.ts
330
+ function I(e) {
331
+ return function(e, t) {
332
+ return e == null ? "" : `${e}`;
333
+ };
334
+ }
335
+ //#endregion
336
+ //#region src/consume/css/ref.ts
337
+ function L(e) {
338
+ return function(t, n) {
339
+ return pe((n.variables?.name ?? S)({ name: t.name }), t.fallback ? e(t.fallback, n) : void 0);
340
+ };
341
+ }
342
+ //#endregion
343
+ //#region src/consume/css/root.ts
344
+ function R(e) {
345
+ let t = N(e);
346
+ return function(n, r, i) {
347
+ let a = i?.treeshake ?? !1, o = i?.scanner ?? !1, s = n._usage.variables, c = (e) => !a || s.has(e.name), l = (e) => a ? {
348
+ ...e,
349
+ variables: e.variables.filter(c)
350
+ } : e, u = a && o, d = n._usage.utilities, f = (e) => e.type !== "utility" || !u ? !0 : d.has(h({
351
+ name: e.name,
352
+ value: e.value,
353
+ modifiers: e.modifiers
354
+ })), p = l(n), m = u ? {
355
+ ...p,
356
+ children: p.children.filter(f)
357
+ } : p;
358
+ return n.themes.map(l).reduce((t, n) => (t.push(e(n, r)), t), [t(":root", m, r)]).join("\n\n");
359
+ };
360
+ }
361
+ //#endregion
362
+ //#region src/consume/css/selector.ts
363
+ function z(e) {
364
+ let t = N(e);
365
+ return function(e, n) {
366
+ return t(e.query, e, n);
367
+ };
326
368
  }
369
+ //#endregion
370
+ //#region src/consume/css/theme.ts
327
371
  function he(e) {
328
- const t = C(e);
329
- return function(o, n) {
330
- const i = L.includes(o.identifier), c = I.includes(
331
- o.identifier
332
- ), a = Object.keys(o.declarations).length > 0, s = o.variables.length > 0, u = o.children.length > 0, f = X(o.identifier, o.rule);
333
- return i || c && !(a || s || u) ? `${f};` : t(f, o, n);
334
- };
335
- }
336
- function be(e) {
337
- return function(r, o) {
338
- return r.value.map((n) => e(n, o)).join("").trim();
339
- };
372
+ let t = N(e);
373
+ return function(e, n) {
374
+ return t((n.themes?.selector ?? x)({ name: e.name }), e, n);
375
+ };
340
376
  }
377
+ //#endregion
378
+ //#region src/consume/css/utility.ts
341
379
  function ge(e) {
342
- return function(r, o) {
343
- return r != null ? `${r}` : "";
344
- };
345
- }
346
- function Ae(e) {
347
- return function(r, o) {
348
- const i = (o.variables?.name ?? B)({ name: r.name });
349
- return de(
350
- i,
351
- r.fallback ? e(r.fallback, o) : void 0
352
- );
353
- };
354
- }
355
- function Se(e) {
356
- const t = C(e);
357
- return function(o, n, i) {
358
- const c = i?.treeshake ?? !1, a = i?.scanner ?? !1, s = o._usage.variables, u = (p) => !c || s.has(p.name), f = (p) => c ? { ...p, variables: p.variables.filter(u) } : p, l = c && a, m = o._usage.utilities, y = (p) => p.type !== "utility" || !l ? !0 : m.has(
359
- T({
360
- name: p.name,
361
- value: p.value,
362
- modifiers: p.modifiers
363
- })
364
- ), d = f(o), h = l ? { ...d, children: d.children.filter(y) } : d;
365
- return o.themes.map(f).reduce(
366
- (p, j) => (p.push(e(j, n)), p),
367
- [t(":root", h, n)]
368
- // Default theme (root)
369
- ).join(`
380
+ let t = N(e);
381
+ return function(e, n) {
382
+ let r = [], i = _((n.utilities?.selector ?? h)({
383
+ name: e.name,
384
+ value: e.value,
385
+ modifiers: e.modifiers
386
+ }));
387
+ return r.push(t(i, e, n)), r.join("\n\n");
388
+ };
389
+ }
390
+ //#endregion
391
+ //#region src/consume/css/consume.ts
392
+ function B(e, t, n) {
393
+ let r = R(B), i = z(B), p = ge(B), m = P(B), h = he(B), g = M(B), _ = L(B), v = F(B), y = I(B);
394
+ switch (!0) {
395
+ case s(e): return i(e, t);
396
+ case l(e): return p(e, t);
397
+ case c(e): return m(e, t);
398
+ case f(e): return r(e, t, n);
399
+ case d(e): return h(e, t);
400
+ case a(e): return g(e, t);
401
+ case o(e): return _(e, t);
402
+ case u(e): return v(e, t);
403
+ default: return y(e, t);
404
+ }
405
+ }
406
+ //#endregion
407
+ //#region src/consume/ts/recipe.ts
408
+ function _e(e) {
409
+ return function(e, t, n) {
410
+ let r = e._exportName;
411
+ r || (r = D(e.name), e.name[0] && E(e.name[0]) && (r = g(r)));
412
+ let i = `${r}Recipe`, a = e._runtime ?? {}, o = n?.shortMap ? ", __shortMap" : "", s = `${g(r)}Props`;
413
+ return `const ${i} = ${JSON.stringify(a, null, 4)} as const satisfies RecipeRuntime;
370
414
 
371
- `);
372
- };
373
- }
374
- function Ce(e) {
375
- const t = C(e);
376
- return function(o, n) {
377
- return t(o.query, o, n);
378
- };
415
+ export type ${s} = RecipeVariantProps<typeof ${i}>;
416
+ export const ${r} = createRecipe("${e.name}", ${i}${o});
417
+ `;
418
+ };
379
419
  }
420
+ //#endregion
421
+ //#region src/consume/ts/root.ts
380
422
  function ve(e) {
381
- const t = C(e);
382
- return function(o, n) {
383
- const c = (n.themes?.selector ?? Y)({ name: o.name });
384
- return t(c, o, n);
385
- };
386
- }
387
- function $e(e) {
388
- const t = C(e);
389
- return function(o, n) {
390
- const i = [], a = (n.utilities?.selector ?? T)({
391
- name: o.name,
392
- value: o.value,
393
- modifiers: o.modifiers
394
- }), s = J(a);
395
- return i.push(t(s, o, n)), i.join(`
396
-
397
- `);
398
- };
399
- }
400
- function b(e, t, r) {
401
- const o = Se(b), n = Ce(b), i = $e(b), c = he(b), a = ve(b), s = k(b), u = Ae(b), f = be(b), l = ge();
402
- switch (!0) {
403
- case S(e):
404
- return n(e, t);
405
- case z(e):
406
- return i(e, t);
407
- case q(e):
408
- return c(e, t);
409
- case O(e):
410
- return o(e, t, r);
411
- case Q(e):
412
- return a(e, t);
413
- case V(e):
414
- return s(e, t);
415
- case K(e):
416
- return u(e, t);
417
- case H(e):
418
- return f(e, t);
419
- default:
420
- return l(e, t);
421
- }
422
- }
423
- function je(e) {
424
- return function(r, o) {
425
- let n = r._exportName;
426
- n || (n = D(r.name), r.name[0] && F(r.name[0]) && (n = $(n)));
427
- const i = `${n}Recipe`, c = r._runtime ?? {}, a = `${$(n)}Props`;
428
- return `const ${i} = ${JSON.stringify(
429
- c,
430
- null,
431
- 4
432
- )} as const satisfies RecipeRuntime;
433
-
434
- export type ${a} = RecipeVariantProps<typeof ${i}>;
435
- export const ${n} = createRecipe("${r.name}", ${i});
436
- `;
437
- };
423
+ return e.filter((e) => s(e) && !!e._exportName);
438
424
  }
439
- function Re(e) {
440
- return e.filter(
441
- (t) => S(t) && !!t._exportName
442
- );
443
- }
444
- function Ne(e) {
445
- return function(r, o) {
446
- const n = Re(r.children), i = r.recipes.length > 0, c = n.length > 0;
447
- if (!i && !c)
448
- return "";
449
- const a = [];
450
- return i && (a.push(`import { createRecipe } from '@styleframe/runtime';
451
- import type { RecipeRuntime, RecipeVariantProps } from '@styleframe/runtime';
452
- `), a.push(e(r.recipes, o))), c && a.push(e(n, o)), a.join(`
453
- `);
454
- };
455
- }
456
- function xe(e) {
457
- return function(r, o) {
458
- return r._exportName ? `export const ${r._exportName} = ${JSON.stringify(r.query)};
425
+ function ye(e) {
426
+ return function(t, n, r) {
427
+ let i = ve(t.children), a = t._usage?.recipes, o = a && a.size > 0 ? t.recipes.filter((e) => a.has(e.name)) : t.recipes, s = o.length > 0, c = i.length > 0;
428
+ if (!s && !c) return "";
429
+ let l = [];
430
+ if (s) {
431
+ let t = ["import { createRecipe } from '@styleframe/runtime';", "import type { RecipeRuntime, RecipeVariantProps } from '@styleframe/runtime';"];
432
+ r?.shortMap && t.push("import type { ShorteningMap } from '@styleframe/runtime';"), l.push(`${t.join("\n")}\n`), r?.shortMap && l.push(`const __shortMap: ShorteningMap = ${JSON.stringify(r.shortMap)} as const;\n`), l.push(e(o, n, r));
433
+ }
434
+ return c && l.push(e(i, n)), l.join("\n");
435
+ };
436
+ }
437
+ //#endregion
438
+ //#region src/consume/ts/selector.ts
439
+ function be(e) {
440
+ return function(e, t) {
441
+ return e._exportName ? `export const ${e._exportName} = ${JSON.stringify(e.query)};
459
442
  ` : "";
460
- };
461
- }
462
- function N(e, t) {
463
- const r = Ne(N), o = je(), n = xe();
464
- switch (!0) {
465
- case Array.isArray(e):
466
- return e.map((i) => N(i, t)).join(`
467
- `);
468
- case O(e):
469
- return r(e, t);
470
- case w(e):
471
- return o(e, t);
472
- case S(e):
473
- return n(e, t);
474
- default:
475
- return "";
476
- }
477
- }
478
- const Oe = `-----BEGIN PUBLIC KEY-----
479
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4
480
- qSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n
481
- BiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA
482
- dQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj
483
- hC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn
484
- 4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+
485
- GwIDAQAB
486
- -----END PUBLIC KEY-----`, _e = "__licenseRequired", we = "__licenseValidated";
487
- async function Te(e) {
488
- const t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""), r = Uint8Array.from(atob(t), (o) => o.charCodeAt(0));
489
- return await crypto.subtle.importKey(
490
- "spki",
491
- r,
492
- {
493
- name: "RSASSA-PKCS1-v1_5",
494
- hash: "SHA-256"
495
- },
496
- !0,
497
- ["verify"]
498
- );
499
- }
500
- async function Be({
501
- payload: e,
502
- signature: t
503
- }) {
504
- const r = new TextEncoder().encode(e), o = Uint8Array.from(
505
- atob(t),
506
- (i) => i.charCodeAt(0)
507
- ), n = await Te(Oe);
508
- if (!await crypto.subtle.verify(
509
- { name: "RSASSA-PKCS1-v1_5" },
510
- n,
511
- o,
512
- r
513
- ))
514
- throw new Error(
515
- "License validation failed: Invalid signature detected. The license may have been modified or corrupted."
516
- );
517
- return JSON.parse(e);
518
- }
443
+ };
444
+ }
445
+ //#endregion
446
+ //#region src/consume/ts/consume.ts
447
+ function V(e, t, n) {
448
+ let r = ye(V), i = _e(V), a = be(V);
449
+ switch (!0) {
450
+ case Array.isArray(e): return e.map((e) => V(e, t, n)).join("\n");
451
+ case f(e): return r(e, t, n);
452
+ case p(e): return i(e, t, n);
453
+ case s(e): return a(e, t);
454
+ default: return "";
455
+ }
456
+ }
457
+ //#endregion
458
+ //#region src/consume/dts/constants.ts
459
+ var H = "// Auto-generated by @styleframe/plugin - DO NOT EDIT", U = "styleframe.d.ts", W = "shims.d.ts", xe = "virtual:styleframe", Se = "virtual:styleframe.css";
460
+ //#endregion
461
+ //#region src/consume/dts/recipe.ts
462
+ function Ce(e) {
463
+ let t = e?.variants;
464
+ if (!t || Object.keys(t).length === 0) return "Record<string, never>";
465
+ let n = [];
466
+ for (let [e, r] of Object.entries(t)) {
467
+ if (!r) continue;
468
+ let t = Object.keys(r);
469
+ if (t.length > 0) {
470
+ let r = t.map((e) => `"${e}"`).join(" | "), i = t.includes("true") && t.includes("false") ? `${r} | boolean` : r;
471
+ n.push(`${e}?: ${i}`);
472
+ }
473
+ }
474
+ return n.length === 0 ? "Record<string, never>" : `{ ${n.join("; ")} }`;
475
+ }
476
+ function G(e) {
477
+ return function(e, t) {
478
+ let n = e._exportName;
479
+ n || (n = D(e.name), e.name[0] && E(e.name[0]) && (n = g(n)));
480
+ let r = Ce(e._runtime), i = `${g(n)}Props`;
481
+ return `export type ${i} = ${r};
482
+ export const ${n}: (props?: ${i}) => string;`;
483
+ };
484
+ }
485
+ //#endregion
486
+ //#region src/consume/dts/root.ts
487
+ function we(e) {
488
+ return e.filter((e) => s(e) && !!e._exportName);
489
+ }
490
+ function Te(e) {
491
+ return function(t, n) {
492
+ let r = we(t.children), i = t._usage?.recipes, a = i && i.size > 0 ? t.recipes.filter((e) => i.has(e.name)) : t.recipes, o = a.length > 0, s = r.length > 0, c = [
493
+ H,
494
+ "import type { Styleframe } from \"@styleframe/core\";",
495
+ "",
496
+ "export function styleframe(): Styleframe;"
497
+ ];
498
+ if (o) {
499
+ c.push("");
500
+ let t = a.map((t) => e(t, n)).filter(Boolean);
501
+ c.push(...t);
502
+ }
503
+ if (s) {
504
+ c.push("");
505
+ let t = r.map((t) => e(t, n)).filter(Boolean);
506
+ c.push(...t);
507
+ }
508
+ return c.push(""), c.join("\n");
509
+ };
510
+ }
511
+ //#endregion
512
+ //#region src/consume/dts/selector.ts
519
513
  function Ee(e) {
520
- return Object.prototype.hasOwnProperty.call(e, _e);
521
- }
522
- async function Fe(e) {
523
- const t = Object.getOwnPropertyDescriptor(
524
- e,
525
- we
526
- );
527
- if (!t?.value)
528
- return {
529
- key: "",
530
- instanceId: "",
531
- environment: "",
532
- valid: !1
533
- };
534
- const r = t.value;
535
- if (typeof r != "object" || r === null || !("payload" in r) || !("signature" in r) || typeof r.payload != "string" || typeof r.signature != "string")
536
- return {
537
- key: "",
538
- instanceId: "",
539
- environment: "",
540
- valid: !1
541
- };
542
- try {
543
- return await Be(
544
- r
545
- );
546
- } catch {
547
- return {
548
- key: "",
549
- instanceId: "",
550
- environment: "",
551
- valid: !1
552
- };
553
- }
554
- }
514
+ return function(e, t) {
515
+ return e._exportName ? `export const ${e._exportName}: string;` : "";
516
+ };
517
+ }
518
+ //#endregion
519
+ //#region src/consume/dts/consume.ts
520
+ function K(e, t) {
521
+ let n = Te(K), r = G(K), i = Ee(K);
522
+ switch (!0) {
523
+ case Array.isArray(e): return e.map((e) => K(e, t)).join("\n");
524
+ case f(e): return n(e, t);
525
+ case p(e): return r(e, t);
526
+ case s(e): return i(e, t);
527
+ default: return "";
528
+ }
529
+ }
530
+ //#endregion
531
+ //#region src/consume/dts/shims.ts
555
532
  function De(e) {
556
- const t = e?.variants;
557
- if (!t || Object.keys(t).length === 0)
558
- return "Record<string, never>";
559
- const r = [];
560
- for (const [o, n] of Object.entries(t)) {
561
- if (!n) continue;
562
- const i = Object.keys(n);
563
- if (i.length > 0) {
564
- const c = i.map((u) => `"${u}"`).join(" | "), s = i.includes("true") && i.includes("false") ? `${c} | boolean` : c;
565
- r.push(`${o}?: ${s}`);
566
- }
567
- }
568
- return r.length === 0 ? "Record<string, never>" : `{ ${r.join("; ")} }`;
569
- }
570
- function Pe(e) {
571
- return function(r, o) {
572
- let n = r._exportName;
573
- n || (n = D(r.name), r.name[0] && F(r.name[0]) && (n = $(n)));
574
- const i = De(r._runtime), c = `${$(n)}Props`;
575
- return ` export type ${c} = ${i};
576
- export const ${n}: (props?: ${c}) => string;`;
577
- };
578
- }
579
- function Ue(e) {
580
- return e.filter(
581
- (t) => S(t) && !!t._exportName
582
- );
583
- }
584
- function ke(e) {
585
- return function(r, o) {
586
- const n = Ue(r.children), i = r.recipes.length > 0, c = n.length > 0, a = [
587
- "// Auto-generated by @styleframe/plugin - DO NOT EDIT",
588
- "",
589
- 'declare module "virtual:styleframe" {',
590
- ' import type { Styleframe } from "@styleframe/core";',
591
- "",
592
- " /** Returns the global styleframe instance from styleframe.config.ts */",
593
- " export function styleframe(): Styleframe;"
594
- ];
595
- if (i) {
596
- a.push("");
597
- const s = r.recipes.map((u) => e(u, o)).filter(Boolean);
598
- a.push(...s);
599
- }
600
- if (c) {
601
- a.push("");
602
- const s = n.map((u) => e(u, o)).filter(Boolean);
603
- a.push(...s);
604
- }
605
- 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(`
606
- `);
607
- };
608
- }
609
- function Le(e) {
610
- return function(r, o) {
611
- return r._exportName ? ` export const ${r._exportName}: string;` : "";
612
- };
613
- }
614
- function x(e, t) {
615
- const r = ke(x), o = Pe(), n = Le();
616
- switch (!0) {
617
- case Array.isArray(e):
618
- return e.map((i) => x(i, t)).join(`
619
- `);
620
- case O(e):
621
- return r(e, t);
622
- case w(e):
623
- return o(e, t);
624
- case S(e):
625
- return n(e, t);
626
- default:
627
- return "";
628
- }
533
+ let t = e.split("\n").filter((e, t) => !(t === 0 && e === "// Auto-generated by @styleframe/plugin - DO NOT EDIT")).map((e) => e.length > 0 ? ` ${e}` : e).join("\n").replace(/\n+$/, "");
534
+ return [
535
+ `declare module "${xe}" {`,
536
+ t,
537
+ "}"
538
+ ].join("\n");
539
+ }
540
+ function Oe(e) {
541
+ return `${[
542
+ H,
543
+ De(e),
544
+ "",
545
+ `declare module "${Se}" {`,
546
+ " const css: string;",
547
+ " export default css;",
548
+ "}"
549
+ ].join("\n")}\n`;
550
+ }
551
+ //#endregion
552
+ //#region src/minify/defaults.ts
553
+ var q = {
554
+ display: "d",
555
+ position: "pos",
556
+ overflow: "ov",
557
+ "overflow-x": "ovx",
558
+ "overflow-y": "ovy",
559
+ visibility: "vis",
560
+ "z-index": "z",
561
+ float: "fl",
562
+ clear: "cl",
563
+ margin: "m",
564
+ "margin-top": "mt",
565
+ "margin-right": "mr",
566
+ "margin-bottom": "mb",
567
+ "margin-left": "ml",
568
+ "margin-inline": "mx",
569
+ "margin-block": "my",
570
+ padding: "p",
571
+ "padding-top": "pt",
572
+ "padding-right": "pr",
573
+ "padding-bottom": "pb",
574
+ "padding-left": "pl",
575
+ "padding-inline": "px",
576
+ "padding-block": "py",
577
+ gap: "g",
578
+ width: "w",
579
+ "min-width": "miw",
580
+ "max-width": "maw",
581
+ height: "h",
582
+ "min-height": "mih",
583
+ "max-height": "mah",
584
+ color: "c",
585
+ "font-size": "fs",
586
+ "font-weight": "fw",
587
+ "font-family": "ff",
588
+ "font-style": "fst",
589
+ "line-height": "lh",
590
+ "letter-spacing": "ls",
591
+ "text-align": "ta",
592
+ "text-transform": "tt",
593
+ "text-decoration": "td",
594
+ "white-space": "ws",
595
+ background: "bg",
596
+ "background-color": "bgc",
597
+ "border-color": "bc",
598
+ "border-width": "bw",
599
+ "border-style": "bs",
600
+ "border-radius": "br",
601
+ "flex-direction": "fd",
602
+ "flex-wrap": "fwr",
603
+ "align-items": "ai",
604
+ "align-content": "ac",
605
+ "align-self": "as",
606
+ "justify-content": "jc",
607
+ "justify-items": "ji",
608
+ "justify-self": "js",
609
+ opacity: "op",
610
+ "box-shadow": "bsh",
611
+ cursor: "cur",
612
+ "pointer-events": "pe",
613
+ transition: "tr",
614
+ transform: "tf",
615
+ animation: "an"
616
+ }, J = {
617
+ hover: "h",
618
+ focus: "f",
619
+ active: "a",
620
+ disabled: "dis",
621
+ "focus-within": "fw",
622
+ "focus-visible": "fv",
623
+ first: "fi",
624
+ last: "la",
625
+ dark: "dk"
626
+ };
627
+ //#endregion
628
+ //#region src/minify/generate-map.ts
629
+ function Y(e, t = 0) {
630
+ let n = e.split(/[-.]/);
631
+ return n.map((e, r) => {
632
+ let i = r === n.length - 1 ? 1 + t : 1;
633
+ return e.slice(0, i);
634
+ }).join("");
635
+ }
636
+ function ke(e, t = 0) {
637
+ if (e.length <= 2) return e;
638
+ if (e.startsWith("[")) {
639
+ let t = `[${m(e.slice(1, -1))}]`;
640
+ return t.length < e.length ? t : e;
641
+ }
642
+ if (e.startsWith("#")) {
643
+ let t = `[${m(e)}]`;
644
+ return t.length < e.length ? t : e;
645
+ }
646
+ return e.includes("-") || e.includes(".") ? Y(e, t) : e.slice(0, 1 + t);
647
+ }
648
+ function X(e, t, n) {
649
+ let r = [...e].sort(), i = {}, a = /* @__PURE__ */ new Set();
650
+ if (n) for (let e of r) {
651
+ let t = n[e];
652
+ t && (i[e] = t, a.add(t));
653
+ }
654
+ for (let e of r) {
655
+ if (i[e]) continue;
656
+ let n = 0, r = t(e, n);
657
+ if (r !== e) {
658
+ for (; a.has(r);) {
659
+ n++;
660
+ let i = t(e, n);
661
+ if (i === r || i.length >= e.length) break;
662
+ r = i;
663
+ }
664
+ !a.has(r) && r !== e && (i[e] = r, a.add(r));
665
+ }
666
+ }
667
+ return i;
668
+ }
669
+ function Z(e, t) {
670
+ let n = e.utilities.map((e) => e.name), r = e.modifiers.flatMap((e) => e.key), i = /* @__PURE__ */ new Set();
671
+ for (let t of e.utilities) for (let e of t.values) i.add(e.key);
672
+ let a = t?.properties ?? q, o = t?.modifiers ?? J, s = t?.values;
673
+ return {
674
+ p: X(n, Y, a),
675
+ v: X([...i], ke, s),
676
+ m: X(r, Y, o)
677
+ };
678
+ }
679
+ //#endregion
680
+ //#region src/minify/shorten.ts
681
+ function Q(e, t) {
682
+ return {
683
+ name: t.p[e.name] ?? e.name,
684
+ value: e.value === "default" ? e.value : t.v[e.value] ?? e.value,
685
+ modifiers: e.modifiers.map((e) => t.m[e] ?? e)
686
+ };
687
+ }
688
+ function Ae(e, t, n = h) {
689
+ let r = {}, i = (e) => {
690
+ for (let i of e) {
691
+ if (i.type !== "utility") continue;
692
+ let e = {
693
+ name: i.name,
694
+ value: i.value,
695
+ modifiers: i.modifiers
696
+ }, a = n(e), o = n(Q(e, t));
697
+ a !== o && (r[a] = o);
698
+ }
699
+ };
700
+ i(e.children);
701
+ for (let t of e.themes) i(t.children);
702
+ return r;
703
+ }
704
+ //#endregion
705
+ //#region ../../node_modules/.pnpm/@styleframe+license@2.0.2/node_modules/@styleframe/license/dist/license.js
706
+ var je = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4\nqSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n\nBiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA\ndQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj\nhC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn\n4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+\nGwIDAQAB\n-----END PUBLIC KEY-----", Me = "__licenseRequired", Ne = "__licenseValidated";
707
+ async function Pe(e) {
708
+ let t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""), n = Uint8Array.from(atob(t), (e) => e.charCodeAt(0));
709
+ return await crypto.subtle.importKey("spki", n, {
710
+ name: "RSASSA-PKCS1-v1_5",
711
+ hash: "SHA-256"
712
+ }, !0, ["verify"]);
713
+ }
714
+ async function Fe({ payload: e, signature: t }) {
715
+ let n = new TextEncoder().encode(e), r = Uint8Array.from(atob(t), (e) => e.charCodeAt(0)), i = await Pe(je);
716
+ if (!await crypto.subtle.verify({ name: "RSASSA-PKCS1-v1_5" }, i, r, n)) throw Error("License validation failed: Invalid signature detected. The license may have been modified or corrupted.");
717
+ return JSON.parse(e);
629
718
  }
630
719
  function Ie(e) {
631
- const t = Math.floor(Math.random() * 100);
632
- e.root.children.push({
633
- type: "selector",
634
- id: G("sel-"),
635
- query: `html:nth-of-type(${t}n+1)::after`,
636
- variables: [],
637
- children: [],
638
- declarations: {
639
- content: '"Styleframe Pro: Development Mode – License required for production use"',
640
- zIndex: 99999,
641
- position: "fixed",
642
- display: "block !important",
643
- opacity: "1 !important",
644
- bottom: 0,
645
- left: 0,
646
- background: "rgba(0, 0, 0, 0.5)",
647
- color: "white",
648
- fontSize: "12px",
649
- lineHeight: "1",
650
- padding: "0.5rem",
651
- fontFamily: "sans-serif"
652
- }
653
- });
654
- }
655
- function R(e, t = "") {
656
- return {
657
- name: e,
658
- content: t
659
- };
660
- }
661
- async function Ve(e, {
662
- type: t = "all",
663
- treeshake: r = !1,
664
- scanner: o = !1,
665
- consumers: n = { css: b, ts: N, dts: x }
666
- } = {}) {
667
- const i = { files: [] }, c = e.options, a = { treeshake: r, scanner: o };
668
- if (Ee(e)) {
669
- const s = await Fe(e);
670
- (!s.valid || s.instanceId !== e.id) && Ie(e);
671
- }
672
- if (t === "all" || t === "css") {
673
- const s = R(
674
- "index.css",
675
- n.css(e.root, c, a)
676
- );
677
- i.files.push(s);
678
- }
679
- if (t === "all" || t === "ts") {
680
- const s = R(
681
- "index.ts",
682
- n.ts(e.root, c)
683
- );
684
- i.files.push(s);
685
- }
686
- if (t === "dts") {
687
- const s = R(
688
- "index.d.ts",
689
- n.dts(e.root, c)
690
- );
691
- i.files.push(s);
692
- }
693
- return i;
694
- }
695
- export {
696
- Me as DEFAULT_INDENT,
697
- L as STATEMENT_AT_RULES,
698
- I as STATEMENT_OR_BLOCK_AT_RULES,
699
- ie as addIndentToLine,
700
- b as consumeCSS,
701
- N as consumeTS,
702
- R as createFile,
703
- Y as defaultThemeSelectorFn,
704
- T as defaultUtilitySelectorFn,
705
- B as defaultVariableNameFn,
706
- ae as indentLines,
707
- F as isUppercase,
708
- D as toCamelCase,
709
- le as toKebabCase,
710
- Ve as transpile
711
- };
720
+ return Object.prototype.hasOwnProperty.call(e, Me);
721
+ }
722
+ async function Le(e) {
723
+ let t = Object.getOwnPropertyDescriptor(e, Ne);
724
+ if (!t?.value) return {
725
+ key: "",
726
+ instanceId: "",
727
+ environment: "",
728
+ valid: !1
729
+ };
730
+ let n = t.value;
731
+ if (typeof n != "object" || !n || !("payload" in n) || !("signature" in n) || typeof n.payload != "string" || typeof n.signature != "string") return {
732
+ key: "",
733
+ instanceId: "",
734
+ environment: "",
735
+ valid: !1
736
+ };
737
+ try {
738
+ return await Fe(n);
739
+ } catch {
740
+ return {
741
+ key: "",
742
+ instanceId: "",
743
+ environment: "",
744
+ valid: !1
745
+ };
746
+ }
747
+ }
748
+ //#endregion
749
+ //#region src/license.ts
750
+ function Re(e) {
751
+ let t = Math.floor(Math.random() * 100);
752
+ e.root.children.push({
753
+ type: "selector",
754
+ id: b("sel-"),
755
+ query: `html:nth-of-type(${t}n+1)::after`,
756
+ variables: [],
757
+ children: [],
758
+ declarations: {
759
+ content: "\"Styleframe Pro: Development Mode License required for production use\"",
760
+ zIndex: 99999,
761
+ position: "fixed",
762
+ display: "block !important",
763
+ opacity: "1 !important",
764
+ bottom: 0,
765
+ left: 0,
766
+ background: "rgba(0, 0, 0, 0.5)",
767
+ color: "white",
768
+ fontSize: "12px",
769
+ lineHeight: "1",
770
+ padding: "0.5rem",
771
+ fontFamily: "sans-serif"
772
+ }
773
+ });
774
+ }
775
+ //#endregion
776
+ //#region src/transpile.ts
777
+ function $(e, t = "") {
778
+ return {
779
+ name: e,
780
+ content: t
781
+ };
782
+ }
783
+ async function ze(e, { type: t = "all", treeshake: n = !1, scanner: r = !1, minify: i = !1, minifyOptions: a, consumers: o = {
784
+ css: B,
785
+ ts: V,
786
+ dts: K
787
+ } } = {}) {
788
+ let s = { files: [] }, c = e.options, l = {
789
+ treeshake: n,
790
+ scanner: r
791
+ };
792
+ if (i && (l.shortMap = Z(e.root, a)), Ie(e)) {
793
+ let t = await Le(e);
794
+ (!t.valid || t.instanceId !== e.id) && Re(e);
795
+ }
796
+ if (t === "all" || t === "css") {
797
+ let t = Be(c, l), n = $("index.css", o.css(e.root, t, l));
798
+ s.files.push(n);
799
+ }
800
+ if (t === "all" || t === "ts") {
801
+ let t = $("index.ts", o.ts(e.root, c, l));
802
+ s.files.push(t);
803
+ }
804
+ if (t === "dts") {
805
+ let t = o.dts(e.root, c);
806
+ s.files.push($(U, t), $(W, Oe(t)));
807
+ }
808
+ return s;
809
+ }
810
+ function Be(e, t) {
811
+ if (!t.shortMap) return e;
812
+ let n = e.utilities?.selector ?? h;
813
+ return {
814
+ ...e,
815
+ utilities: {
816
+ ...e.utilities,
817
+ selector: (e) => n(Q(e, t.shortMap))
818
+ }
819
+ };
820
+ }
821
+ //#endregion
822
+ export { e as DEFAULT_INDENT, W as DTS_SHIMS_FILENAME, U as DTS_TYPES_FILENAME, t as STATEMENT_AT_RULES, n as STATEMENT_OR_BLOCK_AT_RULES, w as addIndentToLine, Ae as buildClassNameLookup, B as consumeCSS, V as consumeTS, $ as createFile, J as defaultModifierShortNames, q as defaultPropertyShortNames, x as defaultThemeSelectorFn, h as defaultUtilitySelectorFn, S as defaultVariableNameFn, Z as generateShorteningMap, T as indentLines, E as isUppercase, Q as shortenUtilityOptions, D as toCamelCase, O as toKebabCase, ze as transpile };