@styleframe/transpiler 3.1.0 → 3.3.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 CHANGED
@@ -1,5 +1,31 @@
1
1
  # @styleframe/transpiler
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#221](https://github.com/styleframe-dev/styleframe/pull/221) [`6d406c2`](https://github.com/styleframe-dev/styleframe/commit/6d406c289b39c666a3fb7468aa3ec08f5a6d316b) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Add `treeshake` option to remove unused variables from CSS output.
8
+
9
+ `root._usage` now tracks both `variables` and `utilities` referenced during config execution and scanner registration. The transpiler's new `treeshake: true` option filters `root.variables` and theme variables down to only those present in `_usage.variables`. The plugin enables treeshaking by default when generating global CSS.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`6d406c2`](https://github.com/styleframe-dev/styleframe/commit/6d406c289b39c666a3fb7468aa3ec08f5a6d316b)]:
14
+ - @styleframe/core@3.5.0
15
+
16
+ ## 3.2.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [#167](https://github.com/styleframe-dev/styleframe/pull/167) [`179c90d`](https://github.com/styleframe-dev/styleframe/commit/179c90d9f73dadbbeb9159ab9fbd7287ceba1f20) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Add boolean support for recipe variant props
21
+ - When a variant defines both `true` and `false` keys, the runtime now accepts boolean `true`/`false` values in addition to string `"true"`/`"false"`
22
+ - Generated `.d.ts` type declarations include `| boolean` in the type union for boolean variants
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [[`b506ea5`](https://github.com/styleframe-dev/styleframe/commit/b506ea5c3c36fa24fea19a69ee3fef7035397dda), [`efd99f7`](https://github.com/styleframe-dev/styleframe/commit/efd99f70a30f9a42c6e1793ed777b1565fb47a82)]:
27
+ - @styleframe/core@3.3.0
28
+
3
29
  ## 3.1.0
4
30
 
5
31
  ### Minor Changes
@@ -11,9 +11,9 @@ export declare function addIndentToLine(line: string): string;
11
11
  /**
12
12
  * Consumes any token instance and returns the CSS string representation
13
13
  */
14
- export declare function consumeCSS(instance: unknown, options: StyleframeOptions): string;
14
+ export declare function consumeCSS(instance: unknown, options: StyleframeOptions, context?: TranspileContext): string;
15
15
 
16
- export declare type ConsumeFunction = (instance: unknown, options: StyleframeOptions) => string;
16
+ export declare type ConsumeFunction = (instance: unknown, options: StyleframeOptions, context?: TranspileContext) => string;
17
17
 
18
18
  /**
19
19
  * Consumes any token instance and returns the TS string representation
@@ -51,10 +51,17 @@ export declare function toCamelCase<S extends string>(str: S): CamelCase<S>;
51
51
 
52
52
  export declare function toKebabCase<S extends string>(str: S): KebabCase<S>;
53
53
 
54
- export declare function transpile(instance: Styleframe, { type, consumers, }?: TranspileOptions): Promise<Output>;
54
+ export declare function transpile(instance: Styleframe, { type, treeshake, scanner, consumers, }?: TranspileOptions): Promise<Output>;
55
+
56
+ export declare type TranspileContext = {
57
+ treeshake?: boolean;
58
+ scanner?: boolean;
59
+ };
55
60
 
56
61
  export declare type TranspileOptions = {
57
62
  type?: "css" | "ts" | "dts" | "all";
63
+ treeshake?: boolean;
64
+ scanner?: boolean;
58
65
  consumers?: {
59
66
  css: ConsumeFunction;
60
67
  ts: ConsumeFunction;
@@ -1,38 +1,38 @@
1
- const ke = " ", U = ["charset", "import", "namespace"], I = ["layer"];
1
+ const Me = " ", L = ["charset", "import", "namespace"], I = ["layer"];
2
2
  function M(e) {
3
3
  return typeof e == "object" && e !== null;
4
4
  }
5
- function h(e, t) {
5
+ function g(e, t) {
6
6
  return M(e) && "type" in e && e.type === t;
7
7
  }
8
- function k(e) {
9
- return h(e, "variable");
10
- }
11
8
  function V(e) {
12
- return h(e, "reference");
13
- }
14
- function S(e) {
15
- return h(e, "selector");
9
+ return g(e, "variable");
16
10
  }
17
11
  function K(e) {
18
- return h(e, "at-rule");
12
+ return g(e, "reference");
13
+ }
14
+ function S(e) {
15
+ return g(e, "selector");
19
16
  }
20
17
  function q(e) {
21
- return h(e, "utility");
18
+ return g(e, "at-rule");
22
19
  }
23
20
  function z(e) {
24
- return h(e, "css");
21
+ return g(e, "utility");
25
22
  }
26
23
  function H(e) {
27
- return h(e, "theme");
24
+ return g(e, "css");
28
25
  }
29
- function N(e) {
30
- return h(e, "root");
26
+ function Q(e) {
27
+ return g(e, "theme");
31
28
  }
32
- function _(e) {
33
- return h(e, "recipe");
29
+ function O(e) {
30
+ return g(e, "root");
31
+ }
32
+ function w(e) {
33
+ return g(e, "recipe");
34
34
  }
35
- const Q = ({
35
+ const T = ({
36
36
  name: e,
37
37
  value: t,
38
38
  modifiers: r
@@ -41,7 +41,7 @@ const Q = ({
41
41
  e,
42
42
  ...t === "default" ? [] : [t]
43
43
  ].filter(Boolean).join(":")}`;
44
- function w(e) {
44
+ function $(e) {
45
45
  return e.charAt(0).toUpperCase() + e.slice(1);
46
46
  }
47
47
  function J(e) {
@@ -61,138 +61,138 @@ function Z(e) {
61
61
  if (e = e || {}, e.circular)
62
62
  return W(e);
63
63
  const t = /* @__PURE__ */ new Map();
64
- if (t.set(Date, (s) => new Date(s)), t.set(
64
+ if (t.set(Date, (c) => new Date(c)), t.set(
65
65
  Map,
66
- (s, a) => new Map(n(Array.from(s), a))
66
+ (c, a) => new Map(o(Array.from(c), a))
67
67
  ), t.set(
68
68
  Set,
69
- (s, a) => new Set(n(Array.from(s), a))
69
+ (c, a) => new Set(o(Array.from(c), a))
70
70
  ), e.constructorHandlers)
71
- for (const s of e.constructorHandlers)
72
- t.set(s[0], s[1]);
71
+ for (const c of e.constructorHandlers)
72
+ t.set(c[0], c[1]);
73
73
  let r;
74
- return e.proto ? c : o;
75
- function n(s, a) {
76
- const u = Object.keys(s), i = Array.from({ length: u.length });
77
- for (let f = 0; f < u.length; f++) {
78
- const l = u[f], m = s[l];
79
- typeof m != "object" || m === null ? i[l] = m : m.constructor !== Object && (r = t.get(m.constructor)) ? i[l] = r(m, a) : ArrayBuffer.isView(m) ? i[l] = A(m) : i[l] = a(m);
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
80
  }
81
- return i;
81
+ return u;
82
82
  }
83
- function o(s) {
84
- if (typeof s != "object" || s === null) return s;
85
- if (Array.isArray(s)) return n(s, o);
86
- if (s.constructor !== Object && (r = t.get(s.constructor)))
87
- return r(s, o);
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
88
  const a = {};
89
- for (const u in s) {
90
- if (Object.hasOwnProperty.call(s, u) === !1) continue;
91
- const i = s[u];
92
- typeof i != "object" || i === null ? a[u] = i : i.constructor !== Object && (r = t.get(i.constructor)) ? a[u] = r(i, o) : ArrayBuffer.isView(i) ? a[u] = A(i) : a[u] = o(i);
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
93
  }
94
94
  return a;
95
95
  }
96
- function c(s) {
97
- if (typeof s != "object" || s === null) return s;
98
- if (Array.isArray(s)) return n(s, c);
99
- if (s.constructor !== Object && (r = t.get(s.constructor)))
100
- return r(s, c);
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
101
  const a = {};
102
- for (const u in s) {
103
- const i = s[u];
104
- typeof i != "object" || i === null ? a[u] = i : i.constructor !== Object && (r = t.get(i.constructor)) ? a[u] = r(i, c) : ArrayBuffer.isView(i) ? a[u] = A(i) : a[u] = c(i);
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
105
  }
106
106
  return a;
107
107
  }
108
108
  }
109
109
  function W(e) {
110
- const t = [], r = [], n = /* @__PURE__ */ new Map();
111
- if (n.set(Date, (u) => new Date(u)), n.set(
110
+ const t = [], r = [], o = /* @__PURE__ */ new Map();
111
+ if (o.set(Date, (s) => new Date(s)), o.set(
112
112
  Map,
113
- (u, i) => new Map(c(Array.from(u), i))
114
- ), n.set(
113
+ (s, u) => new Map(i(Array.from(s), u))
114
+ ), o.set(
115
115
  Set,
116
- (u, i) => new Set(c(Array.from(u), i))
116
+ (s, u) => new Set(i(Array.from(s), u))
117
117
  ), e.constructorHandlers)
118
- for (const u of e.constructorHandlers)
119
- n.set(u[0], u[1]);
120
- let o;
121
- return e.proto ? a : s;
122
- function c(u, i) {
123
- const f = Object.keys(u), l = Array.from({ length: f.length });
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
124
  for (let m = 0; m < f.length; m++) {
125
- const d = f[m], p = u[d];
126
- if (typeof p != "object" || p === null)
127
- l[d] = p;
128
- else if (p.constructor !== Object && (o = n.get(p.constructor)))
129
- l[d] = o(p, i);
130
- else if (ArrayBuffer.isView(p))
131
- l[d] = A(p);
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
132
  else {
133
- const b = t.indexOf(p);
134
- b !== -1 ? l[d] = r[b] : l[d] = i(p);
133
+ const h = t.indexOf(d);
134
+ h !== -1 ? l[y] = r[h] : l[y] = u(d);
135
135
  }
136
136
  }
137
137
  return l;
138
138
  }
139
- function s(u) {
140
- if (typeof u != "object" || u === null) return u;
141
- if (Array.isArray(u)) return c(u, s);
142
- if (u.constructor !== Object && (o = n.get(u.constructor)))
143
- return o(u, s);
144
- const i = {};
145
- t.push(u), r.push(i);
146
- for (const f in u) {
147
- if (Object.hasOwnProperty.call(u, f) === !1) continue;
148
- const l = u[f];
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
149
  if (typeof l != "object" || l === null)
150
- i[f] = l;
151
- else if (l.constructor !== Object && (o = n.get(l.constructor)))
152
- i[f] = o(l, s);
150
+ u[f] = l;
151
+ else if (l.constructor !== Object && (n = o.get(l.constructor)))
152
+ u[f] = n(l, c);
153
153
  else if (ArrayBuffer.isView(l))
154
- i[f] = A(l);
154
+ u[f] = A(l);
155
155
  else {
156
156
  const m = t.indexOf(l);
157
- m !== -1 ? i[f] = r[m] : i[f] = s(l);
157
+ m !== -1 ? u[f] = r[m] : u[f] = c(l);
158
158
  }
159
159
  }
160
- return t.pop(), r.pop(), i;
160
+ return t.pop(), r.pop(), u;
161
161
  }
162
- function a(u) {
163
- if (typeof u != "object" || u === null) return u;
164
- if (Array.isArray(u)) return c(u, a);
165
- if (u.constructor !== Object && (o = n.get(u.constructor)))
166
- return o(u, a);
167
- const i = {};
168
- t.push(u), r.push(i);
169
- for (const f in u) {
170
- const l = u[f];
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
171
  if (typeof l != "object" || l === null)
172
- i[f] = l;
173
- else if (l.constructor !== Object && (o = n.get(l.constructor)))
174
- i[f] = o(l, a);
172
+ u[f] = l;
173
+ else if (l.constructor !== Object && (n = o.get(l.constructor)))
174
+ u[f] = n(l, a);
175
175
  else if (ArrayBuffer.isView(l))
176
- i[f] = A(l);
176
+ u[f] = A(l);
177
177
  else {
178
178
  const m = t.indexOf(l);
179
- m !== -1 ? i[f] = r[m] : i[f] = a(l);
179
+ m !== -1 ? u[f] = r[m] : u[f] = a(l);
180
180
  }
181
181
  }
182
- return t.pop(), r.pop(), i;
182
+ return t.pop(), r.pop(), u;
183
183
  }
184
184
  }
185
185
  Z();
186
186
  function G(e, t = 8) {
187
187
  const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
188
- let n = "";
189
- for (let o = 0; o < t; o++) {
190
- const c = Math.floor(Math.random() * r.length);
191
- n += r[c];
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
192
  }
193
- return e ? `${e}${n}` : n;
193
+ return e ? `${e}${o}` : o;
194
194
  }
195
- const Y = ({ name: e }) => `.${e}-theme, [data-theme="${e}"]`, x = ({ name: e }) => e.replace(/^\.+|\.+$/g, "").replace(/\.+/g, "--");
195
+ const Y = ({ name: e }) => `.${e}-theme, [data-theme="${e}"]`, B = ({ name: e }) => e.replace(/^\.+|\.+$/g, "").replace(/\.+/g, "--");
196
196
  function X(e, t) {
197
197
  return `@${e}${t ? " " : ""}${t}`;
198
198
  }
@@ -201,32 +201,32 @@ function re(e = "") {
201
201
  if (!ee.test(e))
202
202
  return e !== e.toLowerCase();
203
203
  }
204
- function T(e, t) {
205
- const r = te, n = [];
204
+ function E(e, t) {
205
+ const r = te, o = [];
206
206
  if (!e || typeof e != "string")
207
- return n;
208
- let o = "", c, s;
207
+ return o;
208
+ let n = "", i, c;
209
209
  for (const a of e) {
210
- const u = r.includes(a);
211
- if (u === !0) {
212
- n.push(o), o = "", c = void 0;
210
+ const s = r.includes(a);
211
+ if (s === !0) {
212
+ o.push(n), n = "", i = void 0;
213
213
  continue;
214
214
  }
215
- const i = re(a);
216
- if (s === !1) {
217
- if (c === !1 && i === !0) {
218
- n.push(o), o = a, c = i;
215
+ const u = re(a);
216
+ if (c === !1) {
217
+ if (i === !1 && u === !0) {
218
+ o.push(n), n = a, i = u;
219
219
  continue;
220
220
  }
221
- if (c === !0 && i === !1 && o.length > 1) {
222
- const f = o.at(-1);
223
- n.push(o.slice(0, Math.max(0, o.length - 1))), o = f + a, c = i;
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
224
  continue;
225
225
  }
226
226
  }
227
- o += a, c = i, s = u;
227
+ n += a, i = u, c = s;
228
228
  }
229
- return n.push(o), n;
229
+ return o.push(n), o;
230
230
  }
231
231
  function ne(e) {
232
232
  return e ? e[0].toUpperCase() + e.slice(1) : "";
@@ -234,14 +234,14 @@ function ne(e) {
234
234
  function oe(e) {
235
235
  return e ? e[0].toLowerCase() + e.slice(1) : "";
236
236
  }
237
- function ue(e, t) {
238
- return e ? (Array.isArray(e) ? e : T(e)).map((r) => ne(r)).join("") : "";
237
+ function se(e, t) {
238
+ return e ? (Array.isArray(e) ? e : E(e)).map((r) => ne(r)).join("") : "";
239
239
  }
240
240
  function ce(e, t) {
241
- return oe(ue(e || ""));
241
+ return oe(se(e || ""));
242
242
  }
243
- function se(e, t) {
244
- return e ? (Array.isArray(e) ? e : T(e)).map((r) => r.toLowerCase()).join("-") : "";
243
+ function ue(e, t) {
244
+ return e ? (Array.isArray(e) ? e : E(e)).map((r) => r.toLowerCase()).join("-") : "";
245
245
  }
246
246
  function ie(e) {
247
247
  return ` ${e}`;
@@ -251,19 +251,19 @@ function ae(e) {
251
251
  `).map((t) => ie(t)).join(`
252
252
  `);
253
253
  }
254
- function B(e) {
254
+ function F(e) {
255
255
  return e === e.toUpperCase();
256
256
  }
257
- function E(e) {
257
+ function D(e) {
258
258
  return ce(e);
259
259
  }
260
260
  function le(e) {
261
- return se(e);
261
+ return ue(e);
262
262
  }
263
263
  function fe(e) {
264
264
  return le(e);
265
265
  }
266
- function D(e, t) {
266
+ function P(e, t) {
267
267
  return `${e.startsWith("--") ? e : fe(e)}: ${t};`;
268
268
  }
269
269
  function me(e) {
@@ -271,93 +271,100 @@ function me(e) {
271
271
  ` : ""}${e.map((t) => `${ae(`${t}`)}
272
272
  `).join("")}}`;
273
273
  }
274
- function F(e) {
274
+ function U(e) {
275
275
  return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
276
276
  }
277
277
  function pe(e, t) {
278
- return D(F(e), t);
278
+ return P(U(e), t);
279
279
  }
280
280
  function de(e, t) {
281
- return `var(${F(e)}${t ? `, ${t}` : ""})`;
281
+ return `var(${U(e)}${t ? `, ${t}` : ""})`;
282
282
  }
283
- function O(e, t) {
283
+ function _(e, t) {
284
284
  return `${e} ${me(t)}`;
285
285
  }
286
286
  function ye(e) {
287
- return function(r, n) {
288
- return Object.entries(r).map(([o, c]) => D(o, e(c, n)));
287
+ return function(r, o) {
288
+ return Object.entries(r).map(([n, i]) => P(n, e(i, o)));
289
289
  };
290
290
  }
291
- function L(e) {
292
- return function(r, n) {
293
- const c = (n.variables?.name ?? x)({ name: r.name });
294
- return pe(c, e(r.value, n));
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
295
  };
296
296
  }
297
297
  function C(e) {
298
- const t = L(e), r = ye(e);
299
- return function(o, c, s) {
300
- const { variables: a, declarations: u, children: i } = c, f = o === ":root", l = (a ?? []).map(
301
- (g) => t(g, s)
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
302
  ), m = r(
303
- u ?? {},
304
- s
305
- ), d = (i ?? []).map(
306
- (g) => e(g, s)
307
- ), p = l.length > 0, b = m.length > 0, v = d.length > 0;
308
- return f ? `${p || b ? O(o, [
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
309
  ...l,
310
- ...p && b ? [""] : [],
310
+ ...d && h ? [""] : [],
311
311
  ...m
312
- ]) : ""}${v && (p || b) ? `
312
+ ]) : ""}${v && (d || h) ? `
313
313
 
314
- ` : ""}${d.join(`
314
+ ` : ""}${y.join(`
315
315
 
316
- `)}` : O(o, [
316
+ `)}` : _(n, [
317
317
  ...l,
318
- ...p && (v || b) ? [""] : [],
318
+ ...d && (v || h) ? [""] : [],
319
319
  ...m,
320
- ...b && v ? [""] : [],
321
- ...d.flatMap(
322
- (g, P) => P === d.length - 1 ? [g] : [g, ""]
320
+ ...h && v ? [""] : [],
321
+ ...y.flatMap(
322
+ (p, j) => j === y.length - 1 ? [p] : [p, ""]
323
323
  )
324
324
  ]);
325
325
  };
326
326
  }
327
327
  function he(e) {
328
328
  const t = C(e);
329
- return function(n, o) {
330
- const c = U.includes(n.identifier), s = I.includes(
331
- n.identifier
332
- ), a = Object.keys(n.declarations).length > 0, u = n.variables.length > 0, i = n.children.length > 0, f = X(n.identifier, n.rule);
333
- return c || s && !(a || u || i) ? `${f};` : t(f, n, o);
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
334
  };
335
335
  }
336
336
  function be(e) {
337
- return function(r, n) {
338
- return r.value.map((o) => e(o, n)).join("").trim();
337
+ return function(r, o) {
338
+ return r.value.map((n) => e(n, o)).join("").trim();
339
339
  };
340
340
  }
341
341
  function ge(e) {
342
- return function(r, n) {
342
+ return function(r, o) {
343
343
  return r != null ? `${r}` : "";
344
344
  };
345
345
  }
346
346
  function Ae(e) {
347
- return function(r, n) {
348
- const c = (n.variables?.name ?? x)({ name: r.name });
347
+ return function(r, o) {
348
+ const i = (o.variables?.name ?? B)({ name: r.name });
349
349
  return de(
350
- c,
351
- r.fallback ? e(r.fallback, n) : void 0
350
+ i,
351
+ r.fallback ? e(r.fallback, o) : void 0
352
352
  );
353
353
  };
354
354
  }
355
355
  function Se(e) {
356
356
  const t = C(e);
357
- return function(n, o) {
358
- return n.themes.reduce(
359
- (c, s) => (c.push(e(s, o)), c),
360
- [t(":root", n, o)]
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)]
361
368
  // Default theme (root)
362
369
  ).join(`
363
370
 
@@ -366,65 +373,66 @@ function Se(e) {
366
373
  }
367
374
  function Ce(e) {
368
375
  const t = C(e);
369
- return function(n, o) {
370
- return t(n.query, n, o);
376
+ return function(o, n) {
377
+ return t(o.query, o, n);
371
378
  };
372
379
  }
373
380
  function ve(e) {
374
381
  const t = C(e);
375
- return function(n, o) {
376
- const s = (o.themes?.selector ?? Y)({ name: n.name });
377
- return t(s, n, o);
382
+ return function(o, n) {
383
+ const c = (n.themes?.selector ?? Y)({ name: o.name });
384
+ return t(c, o, n);
378
385
  };
379
386
  }
380
- function je(e) {
387
+ function $e(e) {
381
388
  const t = C(e);
382
- return function(n, o) {
383
- const c = [], a = (o.utilities?.selector ?? Q)({
384
- name: n.name,
385
- value: n.value,
386
- modifiers: n.modifiers
387
- }), u = J(a);
388
- return c.push(t(u, n, o)), c.join(`
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(`
389
396
 
390
397
  `);
391
398
  };
392
399
  }
393
- function y(e, t) {
394
- const r = Se(y), n = Ce(y), o = je(y), c = he(y), s = ve(y), a = L(y), u = Ae(y), i = be(y), f = ge();
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();
395
402
  switch (!0) {
396
403
  case S(e):
397
404
  return n(e, t);
405
+ case z(e):
406
+ return i(e, t);
398
407
  case q(e):
399
- return o(e, t);
400
- case K(e):
401
408
  return c(e, t);
402
- case N(e):
403
- return r(e, t);
404
- case H(e):
405
- return s(e, t);
406
- case k(e):
409
+ case O(e):
410
+ return o(e, t, r);
411
+ case Q(e):
407
412
  return a(e, t);
408
413
  case V(e):
414
+ return s(e, t);
415
+ case K(e):
409
416
  return u(e, t);
410
- case z(e):
411
- return i(e, t);
412
- default:
417
+ case H(e):
413
418
  return f(e, t);
419
+ default:
420
+ return l(e, t);
414
421
  }
415
422
  }
416
- function $e(e) {
417
- return function(r, n) {
418
- let o = r._exportName;
419
- o || (o = E(r.name), r.name[0] && B(r.name[0]) && (o = w(o)));
420
- const c = `${o}Recipe`, s = r._runtime ?? {};
421
- return `const ${c} = ${JSON.stringify(
422
- s,
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,
423
430
  null,
424
431
  4
425
432
  )} as const satisfies RecipeRuntime;
426
433
 
427
- export const ${o} = createRecipe("${r.name}", ${c});
434
+ export type ${a} = RecipeVariantProps<typeof ${i}>;
435
+ export const ${n} = createRecipe("${r.name}", ${i});
428
436
  `;
429
437
  };
430
438
  }
@@ -434,40 +442,40 @@ function Re(e) {
434
442
  );
435
443
  }
436
444
  function Ne(e) {
437
- return function(r, n) {
438
- const o = Re(r.children), c = r.recipes.length > 0, s = o.length > 0;
439
- if (!c && !s)
445
+ return function(r, o) {
446
+ const n = Re(r.children), i = r.recipes.length > 0, c = n.length > 0;
447
+ if (!i && !c)
440
448
  return "";
441
449
  const a = [];
442
- return c && (a.push(`import { createRecipe } from '@styleframe/runtime';
443
- import type { RecipeRuntime } from '@styleframe/runtime';
444
- `), a.push(e(r.recipes, n))), s && a.push(e(o, n)), a.join(`
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(`
445
453
  `);
446
454
  };
447
455
  }
448
- function Oe(e) {
449
- return function(r, n) {
456
+ function xe(e) {
457
+ return function(r, o) {
450
458
  return r._exportName ? `export const ${r._exportName} = ${JSON.stringify(r.query)};
451
459
  ` : "";
452
460
  };
453
461
  }
454
- function $(e, t) {
455
- const r = Ne($), n = $e(), o = Oe();
462
+ function N(e, t) {
463
+ const r = Ne(N), o = je(), n = xe();
456
464
  switch (!0) {
457
465
  case Array.isArray(e):
458
- return e.map((c) => $(c, t)).join(`
466
+ return e.map((i) => N(i, t)).join(`
459
467
  `);
460
- case N(e):
468
+ case O(e):
461
469
  return r(e, t);
462
- case _(e):
463
- return n(e, t);
464
- case S(e):
470
+ case w(e):
465
471
  return o(e, t);
472
+ case S(e):
473
+ return n(e, t);
466
474
  default:
467
475
  return "";
468
476
  }
469
477
  }
470
- const _e = `-----BEGIN PUBLIC KEY-----
478
+ const Oe = `-----BEGIN PUBLIC KEY-----
471
479
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4
472
480
  qSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n
473
481
  BiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA
@@ -475,9 +483,9 @@ dQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj
475
483
  hC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn
476
484
  4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+
477
485
  GwIDAQAB
478
- -----END PUBLIC KEY-----`, we = "__licenseRequired", xe = "__licenseValidated";
486
+ -----END PUBLIC KEY-----`, _e = "__licenseRequired", we = "__licenseValidated";
479
487
  async function Te(e) {
480
- const t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""), r = Uint8Array.from(atob(t), (n) => n.charCodeAt(0));
488
+ const t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""), r = Uint8Array.from(atob(t), (o) => o.charCodeAt(0));
481
489
  return await crypto.subtle.importKey(
482
490
  "spki",
483
491
  r,
@@ -493,14 +501,14 @@ async function Be({
493
501
  payload: e,
494
502
  signature: t
495
503
  }) {
496
- const r = new TextEncoder().encode(e), n = Uint8Array.from(
504
+ const r = new TextEncoder().encode(e), o = Uint8Array.from(
497
505
  atob(t),
498
- (c) => c.charCodeAt(0)
499
- ), o = await Te(_e);
506
+ (i) => i.charCodeAt(0)
507
+ ), n = await Te(Oe);
500
508
  if (!await crypto.subtle.verify(
501
509
  { name: "RSASSA-PKCS1-v1_5" },
502
- o,
503
510
  n,
511
+ o,
504
512
  r
505
513
  ))
506
514
  throw new Error(
@@ -509,12 +517,12 @@ async function Be({
509
517
  return JSON.parse(e);
510
518
  }
511
519
  function Ee(e) {
512
- return Object.prototype.hasOwnProperty.call(e, we);
520
+ return Object.prototype.hasOwnProperty.call(e, _e);
513
521
  }
514
- async function De(e) {
522
+ async function Fe(e) {
515
523
  const t = Object.getOwnPropertyDescriptor(
516
524
  e,
517
- xe
525
+ we
518
526
  );
519
527
  if (!t?.value)
520
528
  return {
@@ -544,37 +552,38 @@ async function De(e) {
544
552
  };
545
553
  }
546
554
  }
547
- function Fe(e) {
555
+ function De(e) {
548
556
  const t = e?.variants;
549
557
  if (!t || Object.keys(t).length === 0)
550
558
  return "Record<string, never>";
551
559
  const r = [];
552
- for (const [n, o] of Object.entries(t)) {
553
- if (!o) continue;
554
- const c = Object.keys(o);
555
- if (c.length > 0) {
556
- const s = c.map((a) => `"${a}"`).join(" | ");
557
- r.push(`${n}?: ${s}`);
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}`);
558
566
  }
559
567
  }
560
568
  return r.length === 0 ? "Record<string, never>" : `{ ${r.join("; ")} }`;
561
569
  }
562
- function Le(e) {
563
- return function(r, n) {
564
- let o = r._exportName;
565
- o || (o = E(r.name), r.name[0] && B(r.name[0]) && (o = w(o)));
566
- const c = Fe(r._runtime);
567
- return ` export const ${o}: (props?: ${c}) => string;`;
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;`;
568
577
  };
569
578
  }
570
- function Pe(e) {
579
+ function Ue(e) {
571
580
  return e.filter(
572
581
  (t) => S(t) && !!t._exportName
573
582
  );
574
583
  }
575
- function Ue(e) {
576
- return function(r, n) {
577
- const o = Pe(r.children), c = r.recipes.length > 0, s = o.length > 0, a = [
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 = [
578
587
  "// Auto-generated by @styleframe/plugin - DO NOT EDIT",
579
588
  "",
580
589
  'declare module "virtual:styleframe" {',
@@ -583,42 +592,42 @@ function Ue(e) {
583
592
  " /** Returns the global styleframe instance from styleframe.config.ts */",
584
593
  " export function styleframe(): Styleframe;"
585
594
  ];
586
- if (c) {
595
+ if (i) {
587
596
  a.push("");
588
- const u = r.recipes.map((i) => e(i, n)).filter(Boolean);
589
- a.push(...u);
597
+ const s = r.recipes.map((u) => e(u, o)).filter(Boolean);
598
+ a.push(...s);
590
599
  }
591
- if (s) {
600
+ if (c) {
592
601
  a.push("");
593
- const u = o.map((i) => e(i, n)).filter(Boolean);
594
- a.push(...u);
602
+ const s = n.map((u) => e(u, o)).filter(Boolean);
603
+ a.push(...s);
595
604
  }
596
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(`
597
606
  `);
598
607
  };
599
608
  }
600
- function Ie(e) {
601
- return function(r, n) {
609
+ function Le(e) {
610
+ return function(r, o) {
602
611
  return r._exportName ? ` export const ${r._exportName}: string;` : "";
603
612
  };
604
613
  }
605
- function R(e, t) {
606
- const r = Ue(R), n = Le(), o = Ie();
614
+ function x(e, t) {
615
+ const r = ke(x), o = Pe(), n = Le();
607
616
  switch (!0) {
608
617
  case Array.isArray(e):
609
- return e.map((c) => R(c, t)).join(`
618
+ return e.map((i) => x(i, t)).join(`
610
619
  `);
611
- case N(e):
620
+ case O(e):
612
621
  return r(e, t);
613
- case _(e):
614
- return n(e, t);
615
- case S(e):
622
+ case w(e):
616
623
  return o(e, t);
624
+ case S(e):
625
+ return n(e, t);
617
626
  default:
618
627
  return "";
619
628
  }
620
629
  }
621
- function Me(e) {
630
+ function Ie(e) {
622
631
  const t = Math.floor(Math.random() * 100);
623
632
  e.root.children.push({
624
633
  type: "selector",
@@ -643,7 +652,7 @@ function Me(e) {
643
652
  }
644
653
  });
645
654
  }
646
- function j(e, t = "") {
655
+ function R(e, t = "") {
647
656
  return {
648
657
  name: e,
649
658
  content: t
@@ -651,50 +660,52 @@ function j(e, t = "") {
651
660
  }
652
661
  async function Ve(e, {
653
662
  type: t = "all",
654
- consumers: r = { css: y, ts: $, dts: R }
663
+ treeshake: r = !1,
664
+ scanner: o = !1,
665
+ consumers: n = { css: b, ts: N, dts: x }
655
666
  } = {}) {
656
- const n = { files: [] }, o = e.options;
667
+ const i = { files: [] }, c = e.options, a = { treeshake: r, scanner: o };
657
668
  if (Ee(e)) {
658
- const c = await De(e);
659
- (!c.valid || c.instanceId !== e.id) && Me(e);
669
+ const s = await Fe(e);
670
+ (!s.valid || s.instanceId !== e.id) && Ie(e);
660
671
  }
661
672
  if (t === "all" || t === "css") {
662
- const c = j(
673
+ const s = R(
663
674
  "index.css",
664
- r.css(e.root, o)
675
+ n.css(e.root, c, a)
665
676
  );
666
- n.files.push(c);
677
+ i.files.push(s);
667
678
  }
668
679
  if (t === "all" || t === "ts") {
669
- const c = j(
680
+ const s = R(
670
681
  "index.ts",
671
- r.ts(e.root, o)
682
+ n.ts(e.root, c)
672
683
  );
673
- n.files.push(c);
684
+ i.files.push(s);
674
685
  }
675
686
  if (t === "dts") {
676
- const c = j(
687
+ const s = R(
677
688
  "index.d.ts",
678
- r.dts(e.root, o)
689
+ n.dts(e.root, c)
679
690
  );
680
- n.files.push(c);
691
+ i.files.push(s);
681
692
  }
682
- return n;
693
+ return i;
683
694
  }
684
695
  export {
685
- ke as DEFAULT_INDENT,
686
- U as STATEMENT_AT_RULES,
696
+ Me as DEFAULT_INDENT,
697
+ L as STATEMENT_AT_RULES,
687
698
  I as STATEMENT_OR_BLOCK_AT_RULES,
688
699
  ie as addIndentToLine,
689
- y as consumeCSS,
690
- $ as consumeTS,
691
- j as createFile,
700
+ b as consumeCSS,
701
+ N as consumeTS,
702
+ R as createFile,
692
703
  Y as defaultThemeSelectorFn,
693
- Q as defaultUtilitySelectorFn,
694
- x as defaultVariableNameFn,
704
+ T as defaultUtilitySelectorFn,
705
+ B as defaultVariableNameFn,
695
706
  ae as indentLines,
696
- B as isUppercase,
697
- E as toCamelCase,
707
+ F as isUppercase,
708
+ D as toCamelCase,
698
709
  le as toKebabCase,
699
710
  Ve as transpile
700
711
  };
@@ -1,24 +1,25 @@
1
- (function(p,j){typeof exports=="object"&&typeof module<"u"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(p=typeof globalThis<"u"?globalThis:p||self,j(p.transpiler={}))})(this,(function(p){"use strict";const F=["charset","import","namespace"],B=["layer"];function H(e){return typeof e=="object"&&e!==null}function b(e,t){return H(e)&&"type"in e&&e.type===t}function Q(e){return b(e,"variable")}function J(e){return b(e,"reference")}function C(e){return b(e,"selector")}function Z(e){return b(e,"at-rule")}function W(e){return b(e,"utility")}function G(e){return b(e,"css")}function Y(e){return b(e,"theme")}function T(e){return b(e,"root")}function D(e){return b(e,"recipe")}const L=({name:e,value:t,modifiers:r})=>`_${[...r,e,...t==="default"?[]:[t]].filter(Boolean).join(":")}`;function U(e){return e.charAt(0).toUpperCase()+e.slice(1)}function X(e){return`.${e.replace(/[[\].#()%,:/]/g,"\\$&")}`}function A(e){if(e instanceof Buffer)return Buffer.from(e);const t=e.constructor;return new t(e.buffer.slice(0),e.byteOffset,e.byteLength/e.BYTES_PER_ELEMENT||1)}function ee(e){if(e=e||{},e.circular)return te(e);const t=new Map;if(t.set(Date,s=>new Date(s)),t.set(Map,(s,a)=>new Map(n(Array.from(s),a))),t.set(Set,(s,a)=>new Set(n(Array.from(s),a))),e.constructorHandlers)for(const s of e.constructorHandlers)t.set(s[0],s[1]);let r;return e.proto?c:o;function n(s,a){const u=Object.keys(s),i=Array.from({length:u.length});for(let f=0;f<u.length;f++){const l=u[f],m=s[l];typeof m!="object"||m===null?i[l]=m:m.constructor!==Object&&(r=t.get(m.constructor))?i[l]=r(m,a):ArrayBuffer.isView(m)?i[l]=A(m):i[l]=a(m)}return i}function o(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return n(s,o);if(s.constructor!==Object&&(r=t.get(s.constructor)))return r(s,o);const a={};for(const u in s){if(Object.hasOwnProperty.call(s,u)===!1)continue;const i=s[u];typeof i!="object"||i===null?a[u]=i:i.constructor!==Object&&(r=t.get(i.constructor))?a[u]=r(i,o):ArrayBuffer.isView(i)?a[u]=A(i):a[u]=o(i)}return a}function c(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return n(s,c);if(s.constructor!==Object&&(r=t.get(s.constructor)))return r(s,c);const a={};for(const u in s){const i=s[u];typeof i!="object"||i===null?a[u]=i:i.constructor!==Object&&(r=t.get(i.constructor))?a[u]=r(i,c):ArrayBuffer.isView(i)?a[u]=A(i):a[u]=c(i)}return a}}function te(e){const t=[],r=[],n=new Map;if(n.set(Date,u=>new Date(u)),n.set(Map,(u,i)=>new Map(c(Array.from(u),i))),n.set(Set,(u,i)=>new Set(c(Array.from(u),i))),e.constructorHandlers)for(const u of e.constructorHandlers)n.set(u[0],u[1]);let o;return e.proto?a:s;function c(u,i){const f=Object.keys(u),l=Array.from({length:f.length});for(let m=0;m<f.length;m++){const y=f[m],d=u[y];if(typeof d!="object"||d===null)l[y]=d;else if(d.constructor!==Object&&(o=n.get(d.constructor)))l[y]=o(d,i);else if(ArrayBuffer.isView(d))l[y]=A(d);else{const g=t.indexOf(d);g!==-1?l[y]=r[g]:l[y]=i(d)}}return l}function s(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return c(u,s);if(u.constructor!==Object&&(o=n.get(u.constructor)))return o(u,s);const i={};t.push(u),r.push(i);for(const f in u){if(Object.hasOwnProperty.call(u,f)===!1)continue;const l=u[f];if(typeof l!="object"||l===null)i[f]=l;else if(l.constructor!==Object&&(o=n.get(l.constructor)))i[f]=o(l,s);else if(ArrayBuffer.isView(l))i[f]=A(l);else{const m=t.indexOf(l);m!==-1?i[f]=r[m]:i[f]=s(l)}}return t.pop(),r.pop(),i}function a(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return c(u,a);if(u.constructor!==Object&&(o=n.get(u.constructor)))return o(u,a);const i={};t.push(u),r.push(i);for(const f in u){const l=u[f];if(typeof l!="object"||l===null)i[f]=l;else if(l.constructor!==Object&&(o=n.get(l.constructor)))i[f]=o(l,a);else if(ArrayBuffer.isView(l))i[f]=A(l);else{const m=t.indexOf(l);m!==-1?i[f]=r[m]:i[f]=a(l)}}return t.pop(),r.pop(),i}}ee();function re(e,t=8){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let n="";for(let o=0;o<t;o++){const c=Math.floor(Math.random()*r.length);n+=r[c]}return e?`${e}${n}`:n}const I=({name:e})=>`.${e}-theme, [data-theme="${e}"]`,N=({name:e})=>e.replace(/^\.+|\.+$/g,"").replace(/\.+/g,"--");function ne(e,t){return`@${e}${t?" ":""}${t}`}const oe=/\d/,ue=["-","_","/","."];function ce(e=""){if(!oe.test(e))return e!==e.toLowerCase()}function M(e,t){const r=ue,n=[];if(!e||typeof e!="string")return n;let o="",c,s;for(const a of e){const u=r.includes(a);if(u===!0){n.push(o),o="",c=void 0;continue}const i=ce(a);if(s===!1){if(c===!1&&i===!0){n.push(o),o=a,c=i;continue}if(c===!0&&i===!1&&o.length>1){const f=o.at(-1);n.push(o.slice(0,Math.max(0,o.length-1))),o=f+a,c=i;continue}}o+=a,c=i,s=u}return n.push(o),n}function se(e){return e?e[0].toUpperCase()+e.slice(1):""}function ie(e){return e?e[0].toLowerCase()+e.slice(1):""}function ae(e,t){return e?(Array.isArray(e)?e:M(e)).map(r=>se(r)).join(""):""}function le(e,t){return ie(ae(e||""))}function fe(e,t){return e?(Array.isArray(e)?e:M(e)).map(r=>r.toLowerCase()).join("-"):""}function P(e){return` ${e}`}function x(e){return e.split(`
2
- `).map(t=>P(t)).join(`
3
- `)}function _(e){return e===e.toUpperCase()}function O(e){return le(e)}function k(e){return fe(e)}function me(e){return k(e)}function V(e,t){return`${e.startsWith("--")?e:me(e)}: ${t};`}function pe(e){return`{${e.length>0?`
4
- `:""}${e.map(t=>`${x(`${t}`)}
5
- `).join("")}}`}function K(e){return`--${(e.startsWith("--")?e.slice(2):e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g,"-")||"unknown-variable"}`}function de(e,t){return V(K(e),t)}function ye(e,t){return`var(${K(e)}${t?`, ${t}`:""})`}function q(e,t){return`${e} ${pe(t)}`}function he(e){return function(r,n){return Object.entries(r).map(([o,c])=>V(o,e(c,n)))}}function z(e){return function(r,n){const c=(n.variables?.name??N)({name:r.name});return de(c,e(r.value,n))}}function v(e){const t=z(e),r=he(e);return function(o,c,s){const{variables:a,declarations:u,children:i}=c,f=o===":root",l=(a??[]).map(S=>t(S,s)),m=r(u??{},s),y=(i??[]).map(S=>e(S,s)),d=l.length>0,g=m.length>0,w=y.length>0;return f?`${d||g?q(o,[...l,...d&&g?[""]:[],...m]):""}${w&&(d||g)?`
1
+ (function(p,$){typeof exports=="object"&&typeof module<"u"?$(exports):typeof define=="function"&&define.amd?define(["exports"],$):(p=typeof globalThis<"u"?globalThis:p||self,$(p.transpiler={}))})(this,(function(p){"use strict";const L=["charset","import","namespace"],U=["layer"];function Q(e){return typeof e=="object"&&e!==null}function S(e,t){return Q(e)&&"type"in e&&e.type===t}function J(e){return S(e,"variable")}function Z(e){return S(e,"reference")}function C(e){return S(e,"selector")}function W(e){return S(e,"at-rule")}function G(e){return S(e,"utility")}function Y(e){return S(e,"css")}function X(e){return S(e,"theme")}function _(e){return S(e,"root")}function P(e){return S(e,"recipe")}const E=({name:e,value:t,modifiers:r})=>`_${[...r,e,...t==="default"?[]:[t]].filter(Boolean).join(":")}`;function j(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ee(e){return`.${e.replace(/[[\].#()%,:/]/g,"\\$&")}`}function A(e){if(e instanceof Buffer)return Buffer.from(e);const t=e.constructor;return new t(e.buffer.slice(0),e.byteOffset,e.byteLength/e.BYTES_PER_ELEMENT||1)}function te(e){if(e=e||{},e.circular)return re(e);const t=new Map;if(t.set(Date,s=>new Date(s)),t.set(Map,(s,a)=>new Map(o(Array.from(s),a))),t.set(Set,(s,a)=>new Set(o(Array.from(s),a))),e.constructorHandlers)for(const s of e.constructorHandlers)t.set(s[0],s[1]);let r;return e.proto?i:n;function o(s,a){const c=Object.keys(s),u=Array.from({length:c.length});for(let f=0;f<c.length;f++){const l=c[f],m=s[l];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)}return u}function n(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return o(s,n);if(s.constructor!==Object&&(r=t.get(s.constructor)))return r(s,n);const a={};for(const c in s){if(Object.hasOwnProperty.call(s,c)===!1)continue;const u=s[c];typeof u!="object"||u===null?a[c]=u:u.constructor!==Object&&(r=t.get(u.constructor))?a[c]=r(u,n):ArrayBuffer.isView(u)?a[c]=A(u):a[c]=n(u)}return a}function i(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return o(s,i);if(s.constructor!==Object&&(r=t.get(s.constructor)))return r(s,i);const a={};for(const c in s){const u=s[c];typeof u!="object"||u===null?a[c]=u:u.constructor!==Object&&(r=t.get(u.constructor))?a[c]=r(u,i):ArrayBuffer.isView(u)?a[c]=A(u):a[c]=i(u)}return a}}function re(e){const t=[],r=[],o=new Map;if(o.set(Date,c=>new Date(c)),o.set(Map,(c,u)=>new Map(i(Array.from(c),u))),o.set(Set,(c,u)=>new Set(i(Array.from(c),u))),e.constructorHandlers)for(const c of e.constructorHandlers)o.set(c[0],c[1]);let n;return e.proto?a:s;function i(c,u){const f=Object.keys(c),l=Array.from({length:f.length});for(let m=0;m<f.length;m++){const h=f[m],y=c[h];if(typeof y!="object"||y===null)l[h]=y;else if(y.constructor!==Object&&(n=o.get(y.constructor)))l[h]=n(y,u);else if(ArrayBuffer.isView(y))l[h]=A(y);else{const g=t.indexOf(y);g!==-1?l[h]=r[g]:l[h]=u(y)}}return l}function s(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return i(c,s);if(c.constructor!==Object&&(n=o.get(c.constructor)))return n(c,s);const u={};t.push(c),r.push(u);for(const f in c){if(Object.hasOwnProperty.call(c,f)===!1)continue;const l=c[f];if(typeof l!="object"||l===null)u[f]=l;else if(l.constructor!==Object&&(n=o.get(l.constructor)))u[f]=n(l,s);else if(ArrayBuffer.isView(l))u[f]=A(l);else{const m=t.indexOf(l);m!==-1?u[f]=r[m]:u[f]=s(l)}}return t.pop(),r.pop(),u}function a(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return i(c,a);if(c.constructor!==Object&&(n=o.get(c.constructor)))return n(c,a);const u={};t.push(c),r.push(u);for(const f in c){const l=c[f];if(typeof l!="object"||l===null)u[f]=l;else if(l.constructor!==Object&&(n=o.get(l.constructor)))u[f]=n(l,a);else if(ArrayBuffer.isView(l))u[f]=A(l);else{const m=t.indexOf(l);m!==-1?u[f]=r[m]:u[f]=a(l)}}return t.pop(),r.pop(),u}}te();function ne(e,t=8){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let o="";for(let n=0;n<t;n++){const i=Math.floor(Math.random()*r.length);o+=r[i]}return e?`${e}${o}`:o}const I=({name:e})=>`.${e}-theme, [data-theme="${e}"]`,O=({name:e})=>e.replace(/^\.+|\.+$/g,"").replace(/\.+/g,"--");function oe(e,t){return`@${e}${t?" ":""}${t}`}const ce=/\d/,se=["-","_","/","."];function ue(e=""){if(!ce.test(e))return e!==e.toLowerCase()}function k(e,t){const r=se,o=[];if(!e||typeof e!="string")return o;let n="",i,s;for(const a of e){const c=r.includes(a);if(c===!0){o.push(n),n="",i=void 0;continue}const u=ue(a);if(s===!1){if(i===!1&&u===!0){o.push(n),n=a,i=u;continue}if(i===!0&&u===!1&&n.length>1){const f=n.at(-1);o.push(n.slice(0,Math.max(0,n.length-1))),n=f+a,i=u;continue}}n+=a,i=u,s=c}return o.push(n),o}function ie(e){return e?e[0].toUpperCase()+e.slice(1):""}function ae(e){return e?e[0].toLowerCase()+e.slice(1):""}function le(e,t){return e?(Array.isArray(e)?e:k(e)).map(r=>ie(r)).join(""):""}function fe(e,t){return ae(le(e||""))}function me(e,t){return e?(Array.isArray(e)?e:k(e)).map(r=>r.toLowerCase()).join("-"):""}function x(e){return` ${e}`}function M(e){return e.split(`
2
+ `).map(t=>x(t)).join(`
3
+ `)}function F(e){return e===e.toUpperCase()}function w(e){return fe(e)}function V(e){return me(e)}function pe(e){return V(e)}function K(e,t){return`${e.startsWith("--")?e:pe(e)}: ${t};`}function de(e){return`{${e.length>0?`
4
+ `:""}${e.map(t=>`${M(`${t}`)}
5
+ `).join("")}}`}function q(e){return`--${(e.startsWith("--")?e.slice(2):e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g,"-")||"unknown-variable"}`}function ye(e,t){return K(q(e),t)}function he(e,t){return`var(${q(e)}${t?`, ${t}`:""})`}function z(e,t){return`${e} ${de(t)}`}function be(e){return function(r,o){return Object.entries(r).map(([n,i])=>K(n,e(i,o)))}}function H(e){return function(r,o){const i=(o.variables?.name??O)({name:r.name});return ye(i,e(r.value,o))}}function v(e){const t=H(e),r=be(e);return function(n,i,s){const{variables:a,declarations:c,children:u}=i,f=n===":root",l=(a??[]).map(d=>t(d,s)),m=r(c??{},s),h=(u??[]).map(d=>e(d,s)),y=l.length>0,g=m.length>0,N=h.length>0;return f?`${y||g?z(n,[...l,...y&&g?[""]:[],...m]):""}${N&&(y||g)?`
6
6
 
7
- `:""}${y.join(`
7
+ `:""}${h.join(`
8
8
 
9
- `)}`:q(o,[...l,...d&&(w||g)?[""]:[],...m,...g&&w?[""]:[],...y.flatMap((S,Ke)=>Ke===y.length-1?[S]:[S,""])])}}function be(e){const t=v(e);return function(n,o){const c=F.includes(n.identifier),s=B.includes(n.identifier),a=Object.keys(n.declarations).length>0,u=n.variables.length>0,i=n.children.length>0,f=ne(n.identifier,n.rule);return c||s&&!(a||u||i)?`${f};`:t(f,n,o)}}function ge(e){return function(r,n){return r.value.map(o=>e(o,n)).join("").trim()}}function Ae(e){return function(r,n){return r!=null?`${r}`:""}}function Se(e){return function(r,n){const c=(n.variables?.name??N)({name:r.name});return ye(c,r.fallback?e(r.fallback,n):void 0)}}function Ce(e){const t=v(e);return function(n,o){return n.themes.reduce((c,s)=>(c.push(e(s,o)),c),[t(":root",n,o)]).join(`
9
+ `)}`:z(n,[...l,...y&&(N||g)?[""]:[],...m,...g&&N?[""]:[],...h.flatMap((d,D)=>D===h.length-1?[d]:[d,""])])}}function ge(e){const t=v(e);return function(o,n){const i=L.includes(o.identifier),s=U.includes(o.identifier),a=Object.keys(o.declarations).length>0,c=o.variables.length>0,u=o.children.length>0,f=oe(o.identifier,o.rule);return i||s&&!(a||c||u)?`${f};`:t(f,o,n)}}function Se(e){return function(r,o){return r.value.map(n=>e(n,o)).join("").trim()}}function Ae(e){return function(r,o){return r!=null?`${r}`:""}}function Ce(e){return function(r,o){const i=(o.variables?.name??O)({name:r.name});return he(i,r.fallback?e(r.fallback,o):void 0)}}function ve(e){const t=v(e);return function(o,n,i){const s=i?.treeshake??!1,a=i?.scanner??!1,c=o._usage.variables,u=d=>!s||c.has(d.name),f=d=>s?{...d,variables:d.variables.filter(u)}:d,l=s&&a,m=o._usage.utilities,h=d=>d.type!=="utility"||!l?!0:m.has(E({name:d.name,value:d.value,modifiers:d.modifiers})),y=f(o),g=l?{...y,children:y.children.filter(h)}:y;return o.themes.map(f).reduce((d,D)=>(d.push(e(D,n)),d),[t(":root",g,n)]).join(`
10
10
 
11
- `)}}function ve(e){const t=v(e);return function(n,o){return t(n.query,n,o)}}function je(e){const t=v(e);return function(n,o){const s=(o.themes?.selector??I)({name:n.name});return t(s,n,o)}}function Re(e){const t=v(e);return function(n,o){const c=[],a=(o.utilities?.selector??L)({name:n.name,value:n.value,modifiers:n.modifiers}),u=X(a);return c.push(t(u,n,o)),c.join(`
11
+ `)}}function $e(e){const t=v(e);return function(o,n){return t(o.query,o,n)}}function je(e){const t=v(e);return function(o,n){const s=(n.themes?.selector??I)({name:o.name});return t(s,o,n)}}function Re(e){const t=v(e);return function(o,n){const i=[],a=(n.utilities?.selector??E)({name:o.name,value:o.value,modifiers:o.modifiers}),c=ee(a);return i.push(t(c,o,n)),i.join(`
12
12
 
13
- `)}}function h(e,t){const r=Ce(h),n=ve(h),o=Re(h),c=be(h),s=je(h),a=z(h),u=Se(h),i=ge(h),f=Ae();switch(!0){case C(e):return n(e,t);case W(e):return o(e,t);case Z(e):return c(e,t);case T(e):return r(e,t);case Y(e):return s(e,t);case Q(e):return a(e,t);case J(e):return u(e,t);case G(e):return i(e,t);default:return f(e,t)}}function $e(e){return function(r,n){let o=r._exportName;o||(o=O(r.name),r.name[0]&&_(r.name[0])&&(o=U(o)));const c=`${o}Recipe`,s=r._runtime??{};return`const ${c} = ${JSON.stringify(s,null,4)} as const satisfies RecipeRuntime;
13
+ `)}}function b(e,t,r){const o=ve(b),n=$e(b),i=Re(b),s=ge(b),a=je(b),c=H(b),u=Ce(b),f=Se(b),l=Ae();switch(!0){case C(e):return n(e,t);case G(e):return i(e,t);case W(e):return s(e,t);case _(e):return o(e,t,r);case X(e):return a(e,t);case J(e):return c(e,t);case Z(e):return u(e,t);case Y(e):return f(e,t);default:return l(e,t)}}function Te(e){return function(r,o){let n=r._exportName;n||(n=w(r.name),r.name[0]&&F(r.name[0])&&(n=j(n)));const i=`${n}Recipe`,s=r._runtime??{},a=`${j(n)}Props`;return`const ${i} = ${JSON.stringify(s,null,4)} as const satisfies RecipeRuntime;
14
14
 
15
- export const ${o} = createRecipe("${r.name}", ${c});
16
- `}}function Te(e){return e.filter(t=>C(t)&&!!t._exportName)}function Ne(e){return function(r,n){const o=Te(r.children),c=r.recipes.length>0,s=o.length>0;if(!c&&!s)return"";const a=[];return c&&(a.push(`import { createRecipe } from '@styleframe/runtime';
17
- import type { RecipeRuntime } from '@styleframe/runtime';
18
- `),a.push(e(r.recipes,n))),s&&a.push(e(o,n)),a.join(`
19
- `)}}function _e(e){return function(r,n){return r._exportName?`export const ${r._exportName} = ${JSON.stringify(r.query)};
20
- `:""}}function R(e,t){const r=Ne(R),n=$e(),o=_e();switch(!0){case Array.isArray(e):return e.map(c=>R(c,t)).join(`
21
- `);case T(e):return r(e,t);case D(e):return n(e,t);case C(e):return o(e,t);default:return""}}const Oe=`-----BEGIN PUBLIC KEY-----
15
+ export type ${a} = RecipeVariantProps<typeof ${i}>;
16
+ export const ${n} = createRecipe("${r.name}", ${i});
17
+ `}}function Ne(e){return e.filter(t=>C(t)&&!!t._exportName)}function _e(e){return function(r,o){const n=Ne(r.children),i=r.recipes.length>0,s=n.length>0;if(!i&&!s)return"";const a=[];return i&&(a.push(`import { createRecipe } from '@styleframe/runtime';
18
+ import type { RecipeRuntime, RecipeVariantProps } from '@styleframe/runtime';
19
+ `),a.push(e(r.recipes,o))),s&&a.push(e(n,o)),a.join(`
20
+ `)}}function Ee(e){return function(r,o){return r._exportName?`export const ${r._exportName} = ${JSON.stringify(r.query)};
21
+ `:""}}function R(e,t){const r=_e(R),o=Te(),n=Ee();switch(!0){case Array.isArray(e):return e.map(i=>R(i,t)).join(`
22
+ `);case _(e):return r(e,t);case P(e):return o(e,t);case C(e):return n(e,t);default:return""}}const Oe=`-----BEGIN PUBLIC KEY-----
22
23
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4
23
24
  qSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n
24
25
  BiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA
@@ -26,6 +27,7 @@ dQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj
26
27
  hC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn
27
28
  4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+
28
29
  GwIDAQAB
29
- -----END PUBLIC KEY-----`,Ee="__licenseRequired",we="__licenseValidated";async function Fe(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),r=Uint8Array.from(atob(t),n=>n.charCodeAt(0));return await crypto.subtle.importKey("spki",r,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"])}async function Be({payload:e,signature:t}){const r=new TextEncoder().encode(e),n=Uint8Array.from(atob(t),c=>c.charCodeAt(0)),o=await Fe(Oe);if(!await crypto.subtle.verify({name:"RSASSA-PKCS1-v1_5"},o,n,r))throw new Error("License validation failed: Invalid signature detected. The license may have been modified or corrupted.");return JSON.parse(e)}function De(e){return Object.prototype.hasOwnProperty.call(e,Ee)}async function Le(e){const t=Object.getOwnPropertyDescriptor(e,we);if(!t?.value)return{key:"",instanceId:"",environment:"",valid:!1};const r=t.value;if(typeof r!="object"||r===null||!("payload"in r)||!("signature"in r)||typeof r.payload!="string"||typeof r.signature!="string")return{key:"",instanceId:"",environment:"",valid:!1};try{return await Be(r)}catch{return{key:"",instanceId:"",environment:"",valid:!1}}}function Ue(e){const t=e?.variants;if(!t||Object.keys(t).length===0)return"Record<string, never>";const r=[];for(const[n,o]of Object.entries(t)){if(!o)continue;const c=Object.keys(o);if(c.length>0){const s=c.map(a=>`"${a}"`).join(" | ");r.push(`${n}?: ${s}`)}}return r.length===0?"Record<string, never>":`{ ${r.join("; ")} }`}function Ie(e){return function(r,n){let o=r._exportName;o||(o=O(r.name),r.name[0]&&_(r.name[0])&&(o=U(o)));const c=Ue(r._runtime);return` export const ${o}: (props?: ${c}) => string;`}}function Me(e){return e.filter(t=>C(t)&&!!t._exportName)}function Pe(e){return function(r,n){const o=Me(r.children),c=r.recipes.length>0,s=o.length>0,a=["// Auto-generated by @styleframe/plugin - DO NOT EDIT","",'declare module "virtual:styleframe" {',' import type { Styleframe } from "@styleframe/core";',""," /** Returns the global styleframe instance from styleframe.config.ts */"," export function styleframe(): Styleframe;"];if(c){a.push("");const u=r.recipes.map(i=>e(i,n)).filter(Boolean);a.push(...u)}if(s){a.push("");const u=o.map(i=>e(i,n)).filter(Boolean);a.push(...u)}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(`
30
- `)}}function xe(e){return function(r,n){return r._exportName?` export const ${r._exportName}: string;`:""}}function E(e,t){const r=Pe(E),n=Ie(),o=xe();switch(!0){case Array.isArray(e):return e.map(c=>E(c,t)).join(`
31
- `);case T(e):return r(e,t);case D(e):return n(e,t);case C(e):return o(e,t);default:return""}}function ke(e){const t=Math.floor(Math.random()*100);e.root.children.push({type:"selector",id:re("sel-"),query:`html:nth-of-type(${t}n+1)::after`,variables:[],children:[],declarations:{content:'"Styleframe Pro: Development Mode – License required for production use"',zIndex:99999,position:"fixed",display:"block !important",opacity:"1 !important",bottom:0,left:0,background:"rgba(0, 0, 0, 0.5)",color:"white",fontSize:"12px",lineHeight:"1",padding:"0.5rem",fontFamily:"sans-serif"}})}function $(e,t=""){return{name:e,content:t}}async function Ve(e,{type:t="all",consumers:r={css:h,ts:R,dts:E}}={}){const n={files:[]},o=e.options;if(De(e)){const c=await Le(e);(!c.valid||c.instanceId!==e.id)&&ke(e)}if(t==="all"||t==="css"){const c=$("index.css",r.css(e.root,o));n.files.push(c)}if(t==="all"||t==="ts"){const c=$("index.ts",r.ts(e.root,o));n.files.push(c)}if(t==="dts"){const c=$("index.d.ts",r.dts(e.root,o));n.files.push(c)}return n}p.DEFAULT_INDENT=" ",p.STATEMENT_AT_RULES=F,p.STATEMENT_OR_BLOCK_AT_RULES=B,p.addIndentToLine=P,p.consumeCSS=h,p.consumeTS=R,p.createFile=$,p.defaultThemeSelectorFn=I,p.defaultUtilitySelectorFn=L,p.defaultVariableNameFn=N,p.indentLines=x,p.isUppercase=_,p.toCamelCase=O,p.toKebabCase=k,p.transpile=Ve,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
30
+ -----END PUBLIC KEY-----`,Fe="__licenseRequired",we="__licenseValidated";async function Be(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),r=Uint8Array.from(atob(t),o=>o.charCodeAt(0));return await crypto.subtle.importKey("spki",r,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"])}async function De({payload:e,signature:t}){const r=new TextEncoder().encode(e),o=Uint8Array.from(atob(t),i=>i.charCodeAt(0)),n=await Be(Oe);if(!await crypto.subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,o,r))throw new Error("License validation failed: Invalid signature detected. The license may have been modified or corrupted.");return JSON.parse(e)}function Le(e){return Object.prototype.hasOwnProperty.call(e,Fe)}async function Ue(e){const t=Object.getOwnPropertyDescriptor(e,we);if(!t?.value)return{key:"",instanceId:"",environment:"",valid:!1};const r=t.value;if(typeof r!="object"||r===null||!("payload"in r)||!("signature"in r)||typeof r.payload!="string"||typeof r.signature!="string")return{key:"",instanceId:"",environment:"",valid:!1};try{return await De(r)}catch{return{key:"",instanceId:"",environment:"",valid:!1}}}function Pe(e){const t=e?.variants;if(!t||Object.keys(t).length===0)return"Record<string, never>";const r=[];for(const[o,n]of Object.entries(t)){if(!n)continue;const i=Object.keys(n);if(i.length>0){const s=i.map(u=>`"${u}"`).join(" | "),c=i.includes("true")&&i.includes("false")?`${s} | boolean`:s;r.push(`${o}?: ${c}`)}}return r.length===0?"Record<string, never>":`{ ${r.join("; ")} }`}function Ie(e){return function(r,o){let n=r._exportName;n||(n=w(r.name),r.name[0]&&F(r.name[0])&&(n=j(n)));const i=Pe(r._runtime),s=`${j(n)}Props`;return` export type ${s} = ${i};
31
+ export const ${n}: (props?: ${s}) => string;`}}function ke(e){return e.filter(t=>C(t)&&!!t._exportName)}function xe(e){return function(r,o){const n=ke(r.children),i=r.recipes.length>0,s=n.length>0,a=["// Auto-generated by @styleframe/plugin - DO NOT EDIT","",'declare module "virtual:styleframe" {',' import type { Styleframe } from "@styleframe/core";',""," /** Returns the global styleframe instance from styleframe.config.ts */"," export function styleframe(): Styleframe;"];if(i){a.push("");const c=r.recipes.map(u=>e(u,o)).filter(Boolean);a.push(...c)}if(s){a.push("");const c=n.map(u=>e(u,o)).filter(Boolean);a.push(...c)}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(`
32
+ `)}}function Me(e){return function(r,o){return r._exportName?` export const ${r._exportName}: string;`:""}}function B(e,t){const r=xe(B),o=Ie(),n=Me();switch(!0){case Array.isArray(e):return e.map(i=>B(i,t)).join(`
33
+ `);case _(e):return r(e,t);case P(e):return o(e,t);case C(e):return n(e,t);default:return""}}function Ve(e){const t=Math.floor(Math.random()*100);e.root.children.push({type:"selector",id:ne("sel-"),query:`html:nth-of-type(${t}n+1)::after`,variables:[],children:[],declarations:{content:'"Styleframe Pro: Development Mode – License required for production use"',zIndex:99999,position:"fixed",display:"block !important",opacity:"1 !important",bottom:0,left:0,background:"rgba(0, 0, 0, 0.5)",color:"white",fontSize:"12px",lineHeight:"1",padding:"0.5rem",fontFamily:"sans-serif"}})}function T(e,t=""){return{name:e,content:t}}async function Ke(e,{type:t="all",treeshake:r=!1,scanner:o=!1,consumers:n={css:b,ts:R,dts:B}}={}){const i={files:[]},s=e.options,a={treeshake:r,scanner:o};if(Le(e)){const c=await Ue(e);(!c.valid||c.instanceId!==e.id)&&Ve(e)}if(t==="all"||t==="css"){const c=T("index.css",n.css(e.root,s,a));i.files.push(c)}if(t==="all"||t==="ts"){const c=T("index.ts",n.ts(e.root,s));i.files.push(c)}if(t==="dts"){const c=T("index.d.ts",n.dts(e.root,s));i.files.push(c)}return i}p.DEFAULT_INDENT=" ",p.STATEMENT_AT_RULES=L,p.STATEMENT_OR_BLOCK_AT_RULES=U,p.addIndentToLine=x,p.consumeCSS=b,p.consumeTS=R,p.createFile=T,p.defaultThemeSelectorFn=I,p.defaultUtilitySelectorFn=E,p.defaultVariableNameFn=O,p.indentLines=M,p.isUppercase=F,p.toCamelCase=w,p.toKebabCase=V,p.transpile=Ke,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@styleframe/transpiler",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "type": "module",
5
5
  "types": "./dist/transpiler.d.ts",
6
6
  "module": "./dist/transpiler.js",
@@ -22,13 +22,13 @@
22
22
  "scule": "^1.3.0"
23
23
  },
24
24
  "peerDependencies": {
25
- "@styleframe/core": "^3.2.0",
25
+ "@styleframe/core": "^3.5.0",
26
26
  "@styleframe/license": "^2.0.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@styleframe/config-typescript": "^3.0.0",
30
30
  "@styleframe/config-vite": "^3.0.0",
31
- "@styleframe/core": "^3.2.0",
31
+ "@styleframe/core": "^3.5.0",
32
32
  "@styleframe/license": "^2.0.2",
33
33
  "@vitest/coverage-v8": "^3.2.4",
34
34
  "typescript": "^5.8.3",