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