@styleframe/transpiler 2.4.0 → 2.6.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,39 @@
1
1
  # @styleframe/transpiler
2
2
 
3
+ ## 2.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#96](https://github.com/styleframe-dev/styleframe/pull/96) [`8460f16`](https://github.com/styleframe-dev/styleframe/commit/8460f169cec1199810e9203b357dac9f2f128c56) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Rename `?recipe` imports to `?ts` and add named selector export support
8
+ - **Breaking:** Renamed import query parameter from `?recipe` to `?ts` for styleframe files
9
+ - Add support for exporting named selectors alongside recipes via `?ts` imports
10
+ - Add `_exportName` property to `Selector` and `Recipe` types for tracking named exports
11
+ - Replace `c12` with `chokidar` + `jiti` for simpler, more reliable config loading
12
+ - Add `onError` callback to `watchConfiguration` for error reporting during file watch
13
+ - Add file deletion detection with `unlink` handler in watch mode
14
+ - Simplify `loadConfiguration` API by merging `loadConfigurationFromPath`
15
+ - Add comprehensive unit tests for TypeScript selector consumer
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`8460f16`](https://github.com/styleframe-dev/styleframe/commit/8460f169cec1199810e9203b357dac9f2f128c56)]:
20
+ - @styleframe/core@2.6.0
21
+
22
+ ## 2.5.0
23
+
24
+ ### Minor Changes
25
+
26
+ - [#72](https://github.com/styleframe-dev/styleframe/pull/72) [`d98b650`](https://github.com/styleframe-dev/styleframe/commit/d98b65030170582ceacfabde3ba9ff7d92105389) Thanks [@alexgrozav](https://github.com/alexgrozav)! - feat: add support for .styleframe file imports
27
+
28
+ ### Patch Changes
29
+
30
+ - [#80](https://github.com/styleframe-dev/styleframe/pull/80) [`ff1a689`](https://github.com/styleframe-dev/styleframe/commit/ff1a689f36dc4294b2a7353949c6efd220451e9d) Thanks [@alexgrozav](https://github.com/alexgrozav)! - fix: Expand CSS selector escaping for arbitrary values
31
+
32
+ Consolidate escape logic into a single regex and extend escaping to cover additional special characters (#, (, ), %, ,) needed for arbitrary CSS value syntax like `[#1E3A8A]`, `[rgb(255,0,0)]`, and `[calc(100%-20px)]`.
33
+
34
+ - Updated dependencies [[`d98b650`](https://github.com/styleframe-dev/styleframe/commit/d98b65030170582ceacfabde3ba9ff7d92105389)]:
35
+ - @styleframe/core@2.5.0
36
+
3
37
  ## 2.4.0
4
38
 
5
39
  ### Minor Changes
@@ -1,166 +1,166 @@
1
- const Fe = " ", N = ["charset", "import", "namespace"], D = ["layer"], L = ({ name: e }) => `[data-theme="${e}"]`, I = ({
1
+ const Fe = " ", F = ["charset", "import", "namespace"], L = ["layer"], D = ({ name: e }) => `[data-theme="${e}"]`, x = ({
2
2
  name: e,
3
3
  value: t,
4
4
  modifiers: r
5
- }) => `._${[...r, e, ...t === "default" ? [] : [t]].filter(Boolean).join("\\:")}`, w = ({ name: e }) => e.replace(/^\.+|\.+$/g, "").replace(/\.+/g, "--");
6
- function U(e, t) {
5
+ }) => `._${[...r, e, ...t === "default" ? [] : [t]].filter(Boolean).join("\\:").replace(/[[\].#()%,]/g, "\\$&")}`, w = ({ name: e }) => e.replace(/^\.+|\.+$/g, "").replace(/\.+/g, "--");
6
+ function I(e, t) {
7
7
  return `@${e}${t ? " " : ""}${t}`;
8
8
  }
9
- const _ = /\d/, P = ["-", "_", "/", "."];
9
+ const U = /\d/, P = ["-", "_", "/", "."];
10
10
  function M(e = "") {
11
- if (!_.test(e))
11
+ if (!U.test(e))
12
12
  return e !== e.toLowerCase();
13
13
  }
14
- function $(e, t) {
14
+ function N(e, t) {
15
15
  const r = P, n = [];
16
16
  if (!e || typeof e != "string")
17
17
  return n;
18
- let o = "", s, i;
18
+ let o = "", s, u;
19
19
  for (const a of e) {
20
20
  const c = r.includes(a);
21
21
  if (c === !0) {
22
22
  n.push(o), o = "", s = void 0;
23
23
  continue;
24
24
  }
25
- const u = M(a);
26
- if (i === !1) {
27
- if (s === !1 && u === !0) {
28
- n.push(o), o = a, s = u;
25
+ const i = M(a);
26
+ if (u === !1) {
27
+ if (s === !1 && i === !0) {
28
+ n.push(o), o = a, s = i;
29
29
  continue;
30
30
  }
31
- if (s === !0 && u === !1 && o.length > 1) {
31
+ if (s === !0 && i === !1 && o.length > 1) {
32
32
  const f = o.at(-1);
33
- n.push(o.slice(0, Math.max(0, o.length - 1))), o = f + a, s = u;
33
+ n.push(o.slice(0, Math.max(0, o.length - 1))), o = f + a, s = i;
34
34
  continue;
35
35
  }
36
36
  }
37
- o += a, s = u, i = c;
37
+ o += a, s = i, u = c;
38
38
  }
39
39
  return n.push(o), n;
40
40
  }
41
41
  function k(e) {
42
42
  return e ? e[0].toUpperCase() + e.slice(1) : "";
43
43
  }
44
- function x(e) {
44
+ function V(e) {
45
45
  return e ? e[0].toLowerCase() + e.slice(1) : "";
46
46
  }
47
- function V(e, t) {
48
- return e ? (Array.isArray(e) ? e : $(e)).map((r) => k(r)).join("") : "";
49
- }
50
47
  function q(e, t) {
51
- return x(V(e || ""));
48
+ return e ? (Array.isArray(e) ? e : N(e)).map((r) => k(r)).join("") : "";
52
49
  }
53
50
  function K(e, t) {
54
- return e ? (Array.isArray(e) ? e : $(e)).map((r) => r.toLowerCase()).join("-") : "";
51
+ return V(q(e || ""));
55
52
  }
56
- function z(e) {
57
- return ` ${e}`;
53
+ function z(e, t) {
54
+ return e ? (Array.isArray(e) ? e : N(e)).map((r) => r.toLowerCase()).join("-") : "";
58
55
  }
59
56
  function H(e) {
57
+ return ` ${e}`;
58
+ }
59
+ function Q(e) {
60
60
  return e.split(`
61
- `).map((t) => z(t)).join(`
61
+ `).map((t) => H(t)).join(`
62
62
  `);
63
63
  }
64
- function Q(e) {
64
+ function J(e) {
65
65
  return e === e.toUpperCase();
66
66
  }
67
67
  function Z(e) {
68
- return q(e);
69
- }
70
- function J(e) {
71
68
  return K(e);
72
69
  }
73
70
  function W(e) {
74
- return J(e);
71
+ return z(e);
72
+ }
73
+ function G(e) {
74
+ return W(e);
75
75
  }
76
76
  function O(e, t) {
77
- return `${e.startsWith("--") ? e : W(e)}: ${t};`;
77
+ return `${e.startsWith("--") ? e : G(e)}: ${t};`;
78
78
  }
79
- function G(e) {
79
+ function Y(e) {
80
80
  return `{${e.length > 0 ? `
81
- ` : ""}${e.map((t) => `${H(`${t}`)}
81
+ ` : ""}${e.map((t) => `${Q(`${t}`)}
82
82
  `).join("")}}`;
83
83
  }
84
- function B(e) {
84
+ function E(e) {
85
85
  return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
86
86
  }
87
- function Y(e, t) {
88
- return O(B(e), t);
89
- }
90
87
  function X(e, t) {
91
- return `var(${B(e)}${t ? `, ${t}` : ""})`;
88
+ return O(E(e), t);
92
89
  }
93
- function v(e, t) {
94
- return `${e} ${G(t)}`;
90
+ function ee(e, t) {
91
+ return `var(${E(e)}${t ? `, ${t}` : ""})`;
95
92
  }
96
- function ee(e) {
93
+ function R(e, t) {
94
+ return `${e} ${Y(t)}`;
95
+ }
96
+ function te(e) {
97
97
  return function(r, n) {
98
98
  return Object.entries(r).map(([o, s]) => O(o, e(s, n)));
99
99
  };
100
100
  }
101
- function E(e) {
101
+ function B(e) {
102
102
  return function(r, n) {
103
103
  const s = (n.variables?.name ?? w)({ name: r.name });
104
- return Y(s, e(r.value, n));
104
+ return X(s, e(r.value, n));
105
105
  };
106
106
  }
107
- function C(e) {
108
- const t = E(e), r = ee(e);
109
- return function(o, s, i) {
110
- const { variables: a, declarations: c, children: u } = s, f = o === ":root", l = (a ?? []).map(
111
- (A) => t(A, i)
107
+ function S(e) {
108
+ const t = B(e), r = te(e);
109
+ return function(o, s, u) {
110
+ const { variables: a, declarations: c, children: i } = s, f = o === ":root", l = (a ?? []).map(
111
+ (A) => t(A, u)
112
112
  ), m = r(
113
113
  c ?? {},
114
- i
115
- ), y = (u ?? []).map(
116
- (A) => e(A, i)
117
- ), p = l.length > 0, b = m.length > 0, S = y.length > 0;
118
- return f ? `${p || b ? v(o, [
114
+ u
115
+ ), y = (i ?? []).map(
116
+ (A) => e(A, u)
117
+ ), p = l.length > 0, b = m.length > 0, C = y.length > 0;
118
+ return f ? `${p || b ? R(o, [
119
119
  ...l,
120
120
  ...p && b ? [""] : [],
121
121
  ...m
122
- ]) : ""}${S && (p || b) ? `
122
+ ]) : ""}${C && (p || b) ? `
123
123
 
124
124
  ` : ""}${y.join(`
125
125
 
126
- `)}` : v(o, [
126
+ `)}` : R(o, [
127
127
  ...l,
128
- ...p && (S || b) ? [""] : [],
128
+ ...p && (C || b) ? [""] : [],
129
129
  ...m,
130
- ...b && S ? [""] : [],
130
+ ...b && C ? [""] : [],
131
131
  ...y.flatMap(
132
- (A, F) => F === y.length - 1 ? [A] : [A, ""]
132
+ (A, _) => _ === y.length - 1 ? [A] : [A, ""]
133
133
  )
134
134
  ]);
135
135
  };
136
136
  }
137
- function te(e) {
138
- const t = C(e);
137
+ function re(e) {
138
+ const t = S(e);
139
139
  return function(n, o) {
140
- const s = N.includes(n.identifier), i = D.includes(
140
+ const s = F.includes(n.identifier), u = L.includes(
141
141
  n.identifier
142
- ), a = Object.keys(n.declarations).length > 0, c = n.variables.length > 0, u = n.children.length > 0, f = U(n.identifier, n.rule);
143
- return s || i && !(a || c || u) ? `${f};` : t(f, n, o);
142
+ ), a = Object.keys(n.declarations).length > 0, c = n.variables.length > 0, i = n.children.length > 0, f = I(n.identifier, n.rule);
143
+ return s || u && !(a || c || i) ? `${f};` : t(f, n, o);
144
144
  };
145
145
  }
146
- function re(e) {
146
+ function ne(e) {
147
147
  return function(r, n) {
148
148
  return r.value.map((o) => e(o, n)).join("").trim();
149
149
  };
150
150
  }
151
- function ne(e) {
151
+ function oe(e) {
152
152
  return typeof e == "object" && e !== null;
153
153
  }
154
154
  function h(e, t) {
155
- return ne(e) && "type" in e && e.type === t;
155
+ return oe(e) && "type" in e && e.type === t;
156
156
  }
157
- function oe(e) {
157
+ function ce(e) {
158
158
  return h(e, "variable");
159
159
  }
160
- function ce(e) {
160
+ function ue(e) {
161
161
  return h(e, "reference");
162
162
  }
163
- function ue(e) {
163
+ function v(e) {
164
164
  return h(e, "selector");
165
165
  }
166
166
  function ie(e) {
@@ -198,47 +198,47 @@ function pe(e) {
198
198
  if (e = e || {}, e.circular)
199
199
  return ye(e);
200
200
  const t = /* @__PURE__ */ new Map();
201
- if (t.set(Date, (i) => new Date(i)), t.set(
201
+ if (t.set(Date, (u) => new Date(u)), t.set(
202
202
  Map,
203
- (i, a) => new Map(n(Array.from(i), a))
203
+ (u, a) => new Map(n(Array.from(u), a))
204
204
  ), t.set(
205
205
  Set,
206
- (i, a) => new Set(n(Array.from(i), a))
206
+ (u, a) => new Set(n(Array.from(u), a))
207
207
  ), e.constructorHandlers)
208
- for (const i of e.constructorHandlers)
209
- t.set(i[0], i[1]);
208
+ for (const u of e.constructorHandlers)
209
+ t.set(u[0], u[1]);
210
210
  let r;
211
211
  return e.proto ? s : o;
212
- function n(i, a) {
213
- const c = Object.keys(i), u = Array.from({ length: c.length });
212
+ function n(u, a) {
213
+ const c = Object.keys(u), i = Array.from({ length: c.length });
214
214
  for (let f = 0; f < c.length; f++) {
215
- const l = c[f], m = i[l];
216
- 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] = g(m) : u[l] = a(m);
215
+ const l = c[f], m = u[l];
216
+ 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] = g(m) : i[l] = a(m);
217
217
  }
218
- return u;
218
+ return i;
219
219
  }
220
- function o(i) {
221
- if (typeof i != "object" || i === null) return i;
222
- if (Array.isArray(i)) return n(i, o);
223
- if (i.constructor !== Object && (r = t.get(i.constructor)))
224
- return r(i, o);
220
+ function o(u) {
221
+ if (typeof u != "object" || u === null) return u;
222
+ if (Array.isArray(u)) return n(u, o);
223
+ if (u.constructor !== Object && (r = t.get(u.constructor)))
224
+ return r(u, o);
225
225
  const a = {};
226
- for (const c in i) {
227
- if (Object.hasOwnProperty.call(i, c) === !1) continue;
228
- const u = i[c];
229
- typeof u != "object" || u === null ? a[c] = u : u.constructor !== Object && (r = t.get(u.constructor)) ? a[c] = r(u, o) : ArrayBuffer.isView(u) ? a[c] = g(u) : a[c] = o(u);
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, o) : ArrayBuffer.isView(i) ? a[c] = g(i) : a[c] = o(i);
230
230
  }
231
231
  return a;
232
232
  }
233
- function s(i) {
234
- if (typeof i != "object" || i === null) return i;
235
- if (Array.isArray(i)) return n(i, s);
236
- if (i.constructor !== Object && (r = t.get(i.constructor)))
237
- return r(i, s);
233
+ function s(u) {
234
+ if (typeof u != "object" || u === null) return u;
235
+ if (Array.isArray(u)) return n(u, s);
236
+ if (u.constructor !== Object && (r = t.get(u.constructor)))
237
+ return r(u, s);
238
238
  const a = {};
239
- for (const c in i) {
240
- const u = i[c];
241
- typeof u != "object" || u === null ? a[c] = u : u.constructor !== Object && (r = t.get(u.constructor)) ? a[c] = r(u, s) : ArrayBuffer.isView(u) ? a[c] = g(u) : a[c] = s(u);
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] = g(i) : a[c] = s(i);
242
242
  }
243
243
  return a;
244
244
  }
@@ -247,76 +247,76 @@ function ye(e) {
247
247
  const t = [], r = [], n = /* @__PURE__ */ new Map();
248
248
  if (n.set(Date, (c) => new Date(c)), n.set(
249
249
  Map,
250
- (c, u) => new Map(s(Array.from(c), u))
250
+ (c, i) => new Map(s(Array.from(c), i))
251
251
  ), n.set(
252
252
  Set,
253
- (c, u) => new Set(s(Array.from(c), u))
253
+ (c, i) => new Set(s(Array.from(c), i))
254
254
  ), e.constructorHandlers)
255
255
  for (const c of e.constructorHandlers)
256
256
  n.set(c[0], c[1]);
257
257
  let o;
258
- return e.proto ? a : i;
259
- function s(c, u) {
258
+ return e.proto ? a : u;
259
+ function s(c, i) {
260
260
  const f = Object.keys(c), l = Array.from({ length: f.length });
261
261
  for (let m = 0; m < f.length; m++) {
262
262
  const y = f[m], p = c[y];
263
263
  if (typeof p != "object" || p === null)
264
264
  l[y] = p;
265
265
  else if (p.constructor !== Object && (o = n.get(p.constructor)))
266
- l[y] = o(p, u);
266
+ l[y] = o(p, i);
267
267
  else if (ArrayBuffer.isView(p))
268
268
  l[y] = g(p);
269
269
  else {
270
270
  const b = t.indexOf(p);
271
- b !== -1 ? l[y] = r[b] : l[y] = u(p);
271
+ b !== -1 ? l[y] = r[b] : l[y] = i(p);
272
272
  }
273
273
  }
274
274
  return l;
275
275
  }
276
- function i(c) {
276
+ function u(c) {
277
277
  if (typeof c != "object" || c === null) return c;
278
- if (Array.isArray(c)) return s(c, i);
278
+ if (Array.isArray(c)) return s(c, u);
279
279
  if (c.constructor !== Object && (o = n.get(c.constructor)))
280
- return o(c, i);
281
- const u = {};
282
- t.push(c), r.push(u);
280
+ return o(c, u);
281
+ const i = {};
282
+ t.push(c), r.push(i);
283
283
  for (const f in c) {
284
284
  if (Object.hasOwnProperty.call(c, f) === !1) continue;
285
285
  const l = c[f];
286
286
  if (typeof l != "object" || l === null)
287
- u[f] = l;
287
+ i[f] = l;
288
288
  else if (l.constructor !== Object && (o = n.get(l.constructor)))
289
- u[f] = o(l, i);
289
+ i[f] = o(l, u);
290
290
  else if (ArrayBuffer.isView(l))
291
- u[f] = g(l);
291
+ i[f] = g(l);
292
292
  else {
293
293
  const m = t.indexOf(l);
294
- m !== -1 ? u[f] = r[m] : u[f] = i(l);
294
+ m !== -1 ? i[f] = r[m] : i[f] = u(l);
295
295
  }
296
296
  }
297
- return t.pop(), r.pop(), u;
297
+ return t.pop(), r.pop(), i;
298
298
  }
299
299
  function a(c) {
300
300
  if (typeof c != "object" || c === null) return c;
301
301
  if (Array.isArray(c)) return s(c, a);
302
302
  if (c.constructor !== Object && (o = n.get(c.constructor)))
303
303
  return o(c, a);
304
- const u = {};
305
- t.push(c), r.push(u);
304
+ const i = {};
305
+ t.push(c), r.push(i);
306
306
  for (const f in c) {
307
307
  const l = c[f];
308
308
  if (typeof l != "object" || l === null)
309
- u[f] = l;
309
+ i[f] = l;
310
310
  else if (l.constructor !== Object && (o = n.get(l.constructor)))
311
- u[f] = o(l, a);
311
+ i[f] = o(l, a);
312
312
  else if (ArrayBuffer.isView(l))
313
- u[f] = g(l);
313
+ i[f] = g(l);
314
314
  else {
315
315
  const m = t.indexOf(l);
316
- m !== -1 ? u[f] = r[m] : u[f] = a(l);
316
+ m !== -1 ? i[f] = r[m] : i[f] = a(l);
317
317
  }
318
318
  }
319
- return t.pop(), r.pop(), u;
319
+ return t.pop(), r.pop(), i;
320
320
  }
321
321
  }
322
322
  pe();
@@ -328,17 +328,17 @@ function de(e) {
328
328
  function he(e) {
329
329
  return function(r, n) {
330
330
  const s = (n.variables?.name ?? w)({ name: r.name });
331
- return X(
331
+ return ee(
332
332
  s,
333
333
  r.fallback ? e(r.fallback, n) : void 0
334
334
  );
335
335
  };
336
336
  }
337
337
  function be(e) {
338
- const t = C(e);
338
+ const t = S(e);
339
339
  return function(n, o) {
340
340
  return n.themes.reduce(
341
- (s, i) => (s.push(e(i, o)), s),
341
+ (s, u) => (s.push(e(u, o)), s),
342
342
  [t(":root", n, o)]
343
343
  // Default theme (root)
344
344
  ).join(`
@@ -347,22 +347,22 @@ function be(e) {
347
347
  };
348
348
  }
349
349
  function Ae(e) {
350
- const t = C(e);
350
+ const t = S(e);
351
351
  return function(n, o) {
352
352
  return t(n.query, n, o);
353
353
  };
354
354
  }
355
355
  function ge(e) {
356
- const t = C(e);
356
+ const t = S(e);
357
357
  return function(n, o) {
358
- const i = (o.themes?.selector ?? L)({ name: n.name });
359
- return t(i, n, o);
358
+ const u = (o.themes?.selector ?? D)({ name: n.name });
359
+ return t(u, n, o);
360
360
  };
361
361
  }
362
- function Ce(e) {
363
- const t = C(e);
362
+ function Se(e) {
363
+ const t = S(e);
364
364
  return function(n, o) {
365
- const s = [], a = (o.utilities?.selector ?? I)({
365
+ const s = [], a = (o.utilities?.selector ?? x)({
366
366
  name: n.name,
367
367
  value: n.value,
368
368
  modifiers: n.modifiers
@@ -373,9 +373,9 @@ function Ce(e) {
373
373
  };
374
374
  }
375
375
  function d(e, t) {
376
- const r = be(d), n = Ae(d), o = Ce(d), s = te(d), i = ge(d), a = E(d), c = he(d), u = re(d), f = de();
376
+ const r = be(d), n = Ae(d), o = Se(d), s = re(d), u = ge(d), a = B(d), c = he(d), i = ne(d), f = de();
377
377
  switch (!0) {
378
- case ue(e):
378
+ case v(e):
379
379
  return n(e, t);
380
380
  case se(e):
381
381
  return o(e, t);
@@ -384,24 +384,24 @@ function d(e, t) {
384
384
  case T(e):
385
385
  return r(e, t);
386
386
  case le(e):
387
- return i(e, t);
388
- case oe(e):
389
- return a(e, t);
387
+ return u(e, t);
390
388
  case ce(e):
389
+ return a(e, t);
390
+ case ue(e):
391
391
  return c(e, t);
392
392
  case ae(e):
393
- return u(e, t);
393
+ return i(e, t);
394
394
  default:
395
395
  return f(e, t);
396
396
  }
397
397
  }
398
- function Se(e) {
398
+ function Ce(e) {
399
399
  return function(r, n) {
400
- let o = Z(r.name);
401
- r.name[0] && Q(r.name[0]) && (o = me(o));
402
- const s = `${o}Recipe`, i = r._runtime ?? {};
400
+ let o = r._exportName;
401
+ o || (o = Z(r.name), r.name[0] && J(r.name[0]) && (o = me(o)));
402
+ const s = `${o}Recipe`, u = r._runtime ?? {};
403
403
  return `const ${s} = ${JSON.stringify(
404
- i,
404
+ u,
405
405
  null,
406
406
  4
407
407
  )} as const satisfies RecipeRuntime;
@@ -411,28 +411,45 @@ export const ${o} = createRecipe("${r.name}", ${s});
411
411
  };
412
412
  }
413
413
  function je(e) {
414
+ return e.filter(
415
+ (t) => v(t) && !!t._exportName
416
+ );
417
+ }
418
+ function ve(e) {
414
419
  return function(r, n) {
415
- return r.recipes.length > 0 ? `import { createRecipe } from '@styleframe/runtime';
420
+ const o = je(r.children), s = r.recipes.length > 0, u = o.length > 0;
421
+ if (!s && !u)
422
+ return "";
423
+ const a = [];
424
+ return s && (a.push(`import { createRecipe } from '@styleframe/runtime';
416
425
  import type { RecipeRuntime } from '@styleframe/runtime';
417
-
418
- ${e(r.recipes, n)}` : "";
426
+ `), a.push(e(r.recipes, n))), u && a.push(e(o, n)), a.join(`
427
+ `);
428
+ };
429
+ }
430
+ function Re(e) {
431
+ return function(r, n) {
432
+ return r._exportName ? `export const ${r._exportName} = ${JSON.stringify(r.query)};
433
+ ` : "";
419
434
  };
420
435
  }
421
436
  function j(e, t) {
422
- const r = je(j), n = Se();
437
+ const r = ve(j), n = Ce(), o = Re();
423
438
  switch (!0) {
424
439
  case Array.isArray(e):
425
- return e.map((o) => j(o, t)).join(`
440
+ return e.map((s) => j(s, t)).join(`
426
441
  `);
427
442
  case T(e):
428
443
  return r(e, t);
429
444
  case fe(e):
430
445
  return n(e, t);
446
+ case v(e):
447
+ return o(e, t);
431
448
  default:
432
449
  return "";
433
450
  }
434
451
  }
435
- const ve = `-----BEGIN PUBLIC KEY-----
452
+ const $e = `-----BEGIN PUBLIC KEY-----
436
453
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4
437
454
  qSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n
438
455
  BiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA
@@ -440,8 +457,8 @@ dQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj
440
457
  hC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn
441
458
  4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+
442
459
  GwIDAQAB
443
- -----END PUBLIC KEY-----`, Re = "__licenseRequired", we = "__licenseValidated";
444
- async function $e(e) {
460
+ -----END PUBLIC KEY-----`, we = "__licenseRequired", Ne = "__licenseValidated";
461
+ async function Oe(e) {
445
462
  const t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""), r = Uint8Array.from(atob(t), (n) => n.charCodeAt(0));
446
463
  return await crypto.subtle.importKey(
447
464
  "spki",
@@ -454,14 +471,14 @@ async function $e(e) {
454
471
  ["verify"]
455
472
  );
456
473
  }
457
- async function Oe({
474
+ async function Ee({
458
475
  payload: e,
459
476
  signature: t
460
477
  }) {
461
478
  const r = new TextEncoder().encode(e), n = Uint8Array.from(
462
479
  atob(t),
463
480
  (s) => s.charCodeAt(0)
464
- ), o = await $e(ve);
481
+ ), o = await Oe($e);
465
482
  if (!await crypto.subtle.verify(
466
483
  { name: "RSASSA-PKCS1-v1_5" },
467
484
  o,
@@ -474,12 +491,12 @@ async function Oe({
474
491
  return JSON.parse(e);
475
492
  }
476
493
  function Be(e) {
477
- return Object.prototype.hasOwnProperty.call(e, Re);
494
+ return Object.prototype.hasOwnProperty.call(e, we);
478
495
  }
479
- async function Ee(e) {
496
+ async function Te(e) {
480
497
  const t = Object.getOwnPropertyDescriptor(
481
498
  e,
482
- we
499
+ Ne
483
500
  );
484
501
  if (!t?.value)
485
502
  return {
@@ -497,7 +514,7 @@ async function Ee(e) {
497
514
  valid: !1
498
515
  };
499
516
  try {
500
- return await Oe(
517
+ return await Ee(
501
518
  r
502
519
  );
503
520
  } catch {
@@ -509,7 +526,7 @@ async function Ee(e) {
509
526
  };
510
527
  }
511
528
  }
512
- function Te(e) {
529
+ function _e(e) {
513
530
  const t = Math.floor(Math.random() * 100);
514
531
  e.root.children.push({
515
532
  type: "selector",
@@ -533,30 +550,30 @@ function Te(e) {
533
550
  }
534
551
  });
535
552
  }
536
- function R(e, t = "") {
553
+ function $(e, t = "") {
537
554
  return {
538
555
  name: e,
539
556
  content: t
540
557
  };
541
558
  }
542
- async function Ne(e, {
559
+ async function Le(e, {
543
560
  type: t = "all",
544
561
  consumers: r = { css: d, ts: j }
545
562
  } = {}) {
546
563
  const n = { files: [] }, o = e.options;
547
564
  if (Be(e)) {
548
- const s = await Ee(e);
549
- (!s.valid || s.instanceId !== e.id) && Te(e);
565
+ const s = await Te(e);
566
+ (!s.valid || s.instanceId !== e.id) && _e(e);
550
567
  }
551
568
  if (t === "all" || t === "css") {
552
- const s = R(
569
+ const s = $(
553
570
  "index.css",
554
571
  r.css(e.root, o)
555
572
  );
556
573
  n.files.push(s);
557
574
  }
558
575
  if (t === "all" || t === "ts") {
559
- const s = R(
576
+ const s = $(
560
577
  "index.ts",
561
578
  r.ts(e.root, o)
562
579
  );
@@ -566,18 +583,18 @@ async function Ne(e, {
566
583
  }
567
584
  export {
568
585
  Fe as DEFAULT_INDENT,
569
- N as STATEMENT_AT_RULES,
570
- D as STATEMENT_OR_BLOCK_AT_RULES,
571
- z as addIndentToLine,
586
+ F as STATEMENT_AT_RULES,
587
+ L as STATEMENT_OR_BLOCK_AT_RULES,
588
+ H as addIndentToLine,
572
589
  d as consumeCSS,
573
590
  j as consumeTS,
574
- R as createFile,
575
- L as defaultThemeSelectorFn,
576
- I as defaultUtilitySelectorFn,
591
+ $ as createFile,
592
+ D as defaultThemeSelectorFn,
593
+ x as defaultUtilitySelectorFn,
577
594
  w as defaultVariableNameFn,
578
- H as indentLines,
579
- Q as isUppercase,
595
+ Q as indentLines,
596
+ J as isUppercase,
580
597
  Z as toCamelCase,
581
- J as toKebabCase,
582
- Ne as transpile
598
+ W as toKebabCase,
599
+ Le as transpile
583
600
  };
@@ -1,23 +1,24 @@
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 w=["charset","import","namespace"],N=["layer"],O=({name:e})=>`[data-theme="${e}"]`,F=({name:e,value:t,modifiers:n})=>`._${[...n,e,...t==="default"?[]:[t]].filter(Boolean).join("\\:")}`,v=({name:e})=>e.replace(/^\.+|\.+$/g,"").replace(/\.+/g,"--");function K(e,t){return`@${e}${t?" ":""}${t}`}const q=/\d/,z=["-","_","/","."];function H(e=""){if(!q.test(e))return e!==e.toLowerCase()}function $(e,t){const n=z,r=[];if(!e||typeof e!="string")return r;let o="",a,i;for(const s of e){const c=n.includes(s);if(c===!0){r.push(o),o="",a=void 0;continue}const u=H(s);if(i===!1){if(a===!1&&u===!0){r.push(o),o=s,a=u;continue}if(a===!0&&u===!1&&o.length>1){const f=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=f+s,a=u;continue}}o+=s,a=u,i=c}return r.push(o),r}function Q(e){return e?e[0].toUpperCase()+e.slice(1):""}function Z(e){return e?e[0].toLowerCase()+e.slice(1):""}function x(e,t){return e?(Array.isArray(e)?e:$(e)).map(n=>Q(n)).join(""):""}function J(e,t){return Z(x(e||""))}function W(e,t){return e?(Array.isArray(e)?e:$(e)).map(n=>n.toLowerCase()).join("-"):""}function B(e){return` ${e}`}function L(e){return e.split(`
2
- `).map(t=>B(t)).join(`
3
- `)}function _(e){return e===e.toUpperCase()}function U(e){return J(e)}function D(e){return W(e)}function G(e){return D(e)}function I(e,t){return`${e.startsWith("--")?e:G(e)}: ${t};`}function Y(e){return`{${e.length>0?`
4
- `:""}${e.map(t=>`${L(`${t}`)}
5
- `).join("")}}`}function M(e){return`--${(e.startsWith("--")?e.slice(2):e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g,"-")||"unknown-variable"}`}function X(e,t){return I(M(e),t)}function ee(e,t){return`var(${M(e)}${t?`, ${t}`:""})`}function P(e,t){return`${e} ${Y(t)}`}function te(e){return function(n,r){return Object.entries(n).map(([o,a])=>I(o,e(a,r)))}}function k(e){return function(n,r){const a=(r.variables?.name??v)({name:n.name});return X(a,e(n.value,r))}}function C(e){const t=k(e),n=te(e);return function(o,a,i){const{variables:s,declarations:c,children:u}=a,f=o===":root",l=(s??[]).map(S=>t(S,i)),m=n(c??{},i),y=(u??[]).map(S=>e(S,i)),d=l.length>0,A=m.length>0,E=y.length>0;return f?`${d||A?P(o,[...l,...d&&A?[""]:[],...m]):""}${E&&(d||A)?`
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 _=["charset","import","namespace"],$=["layer"],w=({name:e})=>`[data-theme="${e}"]`,O=({name:e,value:t,modifiers:n})=>`._${[...n,e,...t==="default"?[]:[t]].filter(Boolean).join("\\:").replace(/[[\].#()%,]/g,"\\$&")}`,v=({name:e})=>e.replace(/^\.+|\.+$/g,"").replace(/\.+/g,"--");function q(e,t){return`@${e}${t?" ":""}${t}`}const x=/\d/,z=["-","_","/","."];function H(e=""){if(!x.test(e))return e!==e.toLowerCase()}function F(e,t){const n=z,r=[];if(!e||typeof e!="string")return r;let o="",a,u;for(const s of e){const c=n.includes(s);if(c===!0){r.push(o),o="",a=void 0;continue}const i=H(s);if(u===!1){if(a===!1&&i===!0){r.push(o),o=s,a=i;continue}if(a===!0&&i===!1&&o.length>1){const f=o.at(-1);r.push(o.slice(0,Math.max(0,o.length-1))),o=f+s,a=i;continue}}o+=s,a=i,u=c}return r.push(o),r}function Q(e){return e?e[0].toUpperCase()+e.slice(1):""}function J(e){return e?e[0].toLowerCase()+e.slice(1):""}function Z(e,t){return e?(Array.isArray(e)?e:F(e)).map(n=>Q(n)).join(""):""}function W(e,t){return J(Z(e||""))}function G(e,t){return e?(Array.isArray(e)?e:F(e)).map(n=>n.toLowerCase()).join("-"):""}function L(e){return` ${e}`}function B(e){return e.split(`
2
+ `).map(t=>L(t)).join(`
3
+ `)}function U(e){return e===e.toUpperCase()}function D(e){return W(e)}function I(e){return G(e)}function Y(e){return I(e)}function M(e,t){return`${e.startsWith("--")?e:Y(e)}: ${t};`}function X(e){return`{${e.length>0?`
4
+ `:""}${e.map(t=>`${B(`${t}`)}
5
+ `).join("")}}`}function P(e){return`--${(e.startsWith("--")?e.slice(2):e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g,"-")||"unknown-variable"}`}function ee(e,t){return M(P(e),t)}function te(e,t){return`var(${P(e)}${t?`, ${t}`:""})`}function k(e,t){return`${e} ${X(t)}`}function ne(e){return function(n,r){return Object.entries(n).map(([o,a])=>M(o,e(a,r)))}}function V(e){return function(n,r){const a=(r.variables?.name??v)({name:n.name});return ee(a,e(n.value,r))}}function C(e){const t=V(e),n=ne(e);return function(o,a,u){const{variables:s,declarations:c,children:i}=a,f=o===":root",l=(s??[]).map(g=>t(g,u)),m=n(c??{},u),y=(i??[]).map(g=>e(g,u)),d=l.length>0,A=m.length>0,N=y.length>0;return f?`${d||A?k(o,[...l,...d&&A?[""]:[],...m]):""}${N&&(d||A)?`
6
6
 
7
7
  `:""}${y.join(`
8
8
 
9
- `)}`:P(o,[...l,...d&&(E||A)?[""]:[],...m,...A&&E?[""]:[],...y.flatMap((S,Le)=>Le===y.length-1?[S]:[S,""])])}}function ne(e){const t=C(e);return function(r,o){const a=w.includes(r.identifier),i=N.includes(r.identifier),s=Object.keys(r.declarations).length>0,c=r.variables.length>0,u=r.children.length>0,f=K(r.identifier,r.rule);return a||i&&!(s||c||u)?`${f};`:t(f,r,o)}}function re(e){return function(n,r){return n.value.map(o=>e(o,r)).join("").trim()}}function oe(e){return typeof e=="object"&&e!==null}function h(e,t){return oe(e)&&"type"in e&&e.type===t}function ce(e){return h(e,"variable")}function ue(e){return h(e,"reference")}function ie(e){return h(e,"selector")}function ae(e){return h(e,"at-rule")}function se(e){return h(e,"utility")}function le(e){return h(e,"css")}function fe(e){return h(e,"theme")}function V(e){return h(e,"root")}function me(e){return h(e,"recipe")}function pe(e){return e.charAt(0).toUpperCase()+e.slice(1)}function g(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 de(e){if(e=e||{},e.circular)return ye(e);const t=new Map;if(t.set(Date,i=>new Date(i)),t.set(Map,(i,s)=>new Map(r(Array.from(i),s))),t.set(Set,(i,s)=>new Set(r(Array.from(i),s))),e.constructorHandlers)for(const i of e.constructorHandlers)t.set(i[0],i[1]);let n;return e.proto?a:o;function r(i,s){const c=Object.keys(i),u=Array.from({length:c.length});for(let f=0;f<c.length;f++){const l=c[f],m=i[l];typeof m!="object"||m===null?u[l]=m:m.constructor!==Object&&(n=t.get(m.constructor))?u[l]=n(m,s):ArrayBuffer.isView(m)?u[l]=g(m):u[l]=s(m)}return u}function o(i){if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return r(i,o);if(i.constructor!==Object&&(n=t.get(i.constructor)))return n(i,o);const s={};for(const c in i){if(Object.hasOwnProperty.call(i,c)===!1)continue;const u=i[c];typeof u!="object"||u===null?s[c]=u:u.constructor!==Object&&(n=t.get(u.constructor))?s[c]=n(u,o):ArrayBuffer.isView(u)?s[c]=g(u):s[c]=o(u)}return s}function a(i){if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return r(i,a);if(i.constructor!==Object&&(n=t.get(i.constructor)))return n(i,a);const s={};for(const c in i){const u=i[c];typeof u!="object"||u===null?s[c]=u:u.constructor!==Object&&(n=t.get(u.constructor))?s[c]=n(u,a):ArrayBuffer.isView(u)?s[c]=g(u):s[c]=a(u)}return s}}function ye(e){const t=[],n=[],r=new Map;if(r.set(Date,c=>new Date(c)),r.set(Map,(c,u)=>new Map(a(Array.from(c),u))),r.set(Set,(c,u)=>new Set(a(Array.from(c),u))),e.constructorHandlers)for(const c of e.constructorHandlers)r.set(c[0],c[1]);let o;return e.proto?s:i;function a(c,u){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&&(o=r.get(d.constructor)))l[y]=o(d,u);else if(ArrayBuffer.isView(d))l[y]=g(d);else{const A=t.indexOf(d);A!==-1?l[y]=n[A]:l[y]=u(d)}}return l}function i(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return a(c,i);if(c.constructor!==Object&&(o=r.get(c.constructor)))return o(c,i);const u={};t.push(c),n.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&&(o=r.get(l.constructor)))u[f]=o(l,i);else if(ArrayBuffer.isView(l))u[f]=g(l);else{const m=t.indexOf(l);m!==-1?u[f]=n[m]:u[f]=i(l)}}return t.pop(),n.pop(),u}function s(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return a(c,s);if(c.constructor!==Object&&(o=r.get(c.constructor)))return o(c,s);const u={};t.push(c),n.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&&(o=r.get(l.constructor)))u[f]=o(l,s);else if(ArrayBuffer.isView(l))u[f]=g(l);else{const m=t.indexOf(l);m!==-1?u[f]=n[m]:u[f]=s(l)}}return t.pop(),n.pop(),u}}de();function be(e){return function(n,r){return n!=null?`${n}`:""}}function he(e){return function(n,r){const a=(r.variables?.name??v)({name:n.name});return ee(a,n.fallback?e(n.fallback,r):void 0)}}function Ae(e){const t=C(e);return function(r,o){return r.themes.reduce((a,i)=>(a.push(e(i,o)),a),[t(":root",r,o)]).join(`
9
+ `)}`:k(o,[...l,...d&&(N||A)?[""]:[],...m,...A&&N?[""]:[],...y.flatMap((g,Ue)=>Ue===y.length-1?[g]:[g,""])])}}function re(e){const t=C(e);return function(r,o){const a=_.includes(r.identifier),u=$.includes(r.identifier),s=Object.keys(r.declarations).length>0,c=r.variables.length>0,i=r.children.length>0,f=q(r.identifier,r.rule);return a||u&&!(s||c||i)?`${f};`:t(f,r,o)}}function oe(e){return function(n,r){return n.value.map(o=>e(o,r)).join("").trim()}}function ce(e){return typeof e=="object"&&e!==null}function b(e,t){return ce(e)&&"type"in e&&e.type===t}function ue(e){return b(e,"variable")}function ie(e){return b(e,"reference")}function R(e){return b(e,"selector")}function ae(e){return b(e,"at-rule")}function se(e){return b(e,"utility")}function le(e){return b(e,"css")}function fe(e){return b(e,"theme")}function K(e){return b(e,"root")}function me(e){return b(e,"recipe")}function pe(e){return e.charAt(0).toUpperCase()+e.slice(1)}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 de(e){if(e=e||{},e.circular)return ye(e);const t=new Map;if(t.set(Date,u=>new Date(u)),t.set(Map,(u,s)=>new Map(r(Array.from(u),s))),t.set(Set,(u,s)=>new Set(r(Array.from(u),s))),e.constructorHandlers)for(const u of e.constructorHandlers)t.set(u[0],u[1]);let n;return e.proto?a:o;function r(u,s){const c=Object.keys(u),i=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?i[l]=m:m.constructor!==Object&&(n=t.get(m.constructor))?i[l]=n(m,s):ArrayBuffer.isView(m)?i[l]=S(m):i[l]=s(m)}return i}function o(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return r(u,o);if(u.constructor!==Object&&(n=t.get(u.constructor)))return n(u,o);const s={};for(const c in u){if(Object.hasOwnProperty.call(u,c)===!1)continue;const i=u[c];typeof i!="object"||i===null?s[c]=i:i.constructor!==Object&&(n=t.get(i.constructor))?s[c]=n(i,o):ArrayBuffer.isView(i)?s[c]=S(i):s[c]=o(i)}return s}function a(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return r(u,a);if(u.constructor!==Object&&(n=t.get(u.constructor)))return n(u,a);const s={};for(const c in u){const i=u[c];typeof i!="object"||i===null?s[c]=i:i.constructor!==Object&&(n=t.get(i.constructor))?s[c]=n(i,a):ArrayBuffer.isView(i)?s[c]=S(i):s[c]=a(i)}return s}}function ye(e){const t=[],n=[],r=new Map;if(r.set(Date,c=>new Date(c)),r.set(Map,(c,i)=>new Map(a(Array.from(c),i))),r.set(Set,(c,i)=>new Set(a(Array.from(c),i))),e.constructorHandlers)for(const c of e.constructorHandlers)r.set(c[0],c[1]);let o;return e.proto?s:u;function a(c,i){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&&(o=r.get(d.constructor)))l[y]=o(d,i);else if(ArrayBuffer.isView(d))l[y]=S(d);else{const A=t.indexOf(d);A!==-1?l[y]=n[A]:l[y]=i(d)}}return l}function u(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return a(c,u);if(c.constructor!==Object&&(o=r.get(c.constructor)))return o(c,u);const i={};t.push(c),n.push(i);for(const f in c){if(Object.hasOwnProperty.call(c,f)===!1)continue;const l=c[f];if(typeof l!="object"||l===null)i[f]=l;else if(l.constructor!==Object&&(o=r.get(l.constructor)))i[f]=o(l,u);else if(ArrayBuffer.isView(l))i[f]=S(l);else{const m=t.indexOf(l);m!==-1?i[f]=n[m]:i[f]=u(l)}}return t.pop(),n.pop(),i}function s(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return a(c,s);if(c.constructor!==Object&&(o=r.get(c.constructor)))return o(c,s);const i={};t.push(c),n.push(i);for(const f in c){const l=c[f];if(typeof l!="object"||l===null)i[f]=l;else if(l.constructor!==Object&&(o=r.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]=n[m]:i[f]=s(l)}}return t.pop(),n.pop(),i}}de();function he(e){return function(n,r){return n!=null?`${n}`:""}}function be(e){return function(n,r){const a=(r.variables?.name??v)({name:n.name});return te(a,n.fallback?e(n.fallback,r):void 0)}}function Ae(e){const t=C(e);return function(r,o){return r.themes.reduce((a,u)=>(a.push(e(u,o)),a),[t(":root",r,o)]).join(`
10
10
 
11
- `)}}function ge(e){const t=C(e);return function(r,o){return t(r.query,r,o)}}function Se(e){const t=C(e);return function(r,o){const i=(o.themes?.selector??O)({name:r.name});return t(i,r,o)}}function Ce(e){const t=C(e);return function(r,o){const a=[],s=(o.utilities?.selector??F)({name:r.name,value:r.value,modifiers:r.modifiers});return a.push(t(s,r,o)),a.join(`
11
+ `)}}function Se(e){const t=C(e);return function(r,o){return t(r.query,r,o)}}function ge(e){const t=C(e);return function(r,o){const u=(o.themes?.selector??w)({name:r.name});return t(u,r,o)}}function Ce(e){const t=C(e);return function(r,o){const a=[],s=(o.utilities?.selector??O)({name:r.name,value:r.value,modifiers:r.modifiers});return a.push(t(s,r,o)),a.join(`
12
12
 
13
- `)}}function b(e,t){const n=Ae(b),r=ge(b),o=Ce(b),a=ne(b),i=Se(b),s=k(b),c=he(b),u=re(b),f=be();switch(!0){case ie(e):return r(e,t);case se(e):return o(e,t);case ae(e):return a(e,t);case V(e):return n(e,t);case fe(e):return i(e,t);case ce(e):return s(e,t);case ue(e):return c(e,t);case le(e):return u(e,t);default:return f(e,t)}}function je(e){return function(n,r){let o=U(n.name);n.name[0]&&_(n.name[0])&&(o=pe(o));const a=`${o}Recipe`,i=n._runtime??{};return`const ${a} = ${JSON.stringify(i,null,4)} as const satisfies RecipeRuntime;
13
+ `)}}function h(e,t){const n=Ae(h),r=Se(h),o=Ce(h),a=re(h),u=ge(h),s=V(h),c=be(h),i=oe(h),f=he();switch(!0){case R(e):return r(e,t);case se(e):return o(e,t);case ae(e):return a(e,t);case K(e):return n(e,t);case fe(e):return u(e,t);case ue(e):return s(e,t);case ie(e):return c(e,t);case le(e):return i(e,t);default:return f(e,t)}}function je(e){return function(n,r){let o=n._exportName;o||(o=D(n.name),n.name[0]&&U(n.name[0])&&(o=pe(o)));const a=`${o}Recipe`,u=n._runtime??{};return`const ${a} = ${JSON.stringify(u,null,4)} as const satisfies RecipeRuntime;
14
14
 
15
15
  export const ${o} = createRecipe("${n.name}", ${a});
16
- `}}function Te(e){return function(n,r){return n.recipes.length>0?`import { createRecipe } from '@styleframe/runtime';
16
+ `}}function Te(e){return e.filter(t=>R(t)&&!!t._exportName)}function ve(e){return function(n,r){const o=Te(n.children),a=n.recipes.length>0,u=o.length>0;if(!a&&!u)return"";const s=[];return a&&(s.push(`import { createRecipe } from '@styleframe/runtime';
17
17
  import type { RecipeRuntime } from '@styleframe/runtime';
18
-
19
- ${e(n.recipes,r)}`:""}}function T(e,t){const n=Te(T),r=je();switch(!0){case Array.isArray(e):return e.map(o=>T(o,t)).join(`
20
- `);case V(e):return n(e,t);case me(e):return r(e,t);default:return""}}const ve=`-----BEGIN PUBLIC KEY-----
18
+ `),s.push(e(n.recipes,r))),u&&s.push(e(o,r)),s.join(`
19
+ `)}}function Re(e){return function(n,r){return n._exportName?`export const ${n._exportName} = ${JSON.stringify(n.query)};
20
+ `:""}}function T(e,t){const n=ve(T),r=je(),o=Re();switch(!0){case Array.isArray(e):return e.map(a=>T(a,t)).join(`
21
+ `);case K(e):return n(e,t);case me(e):return r(e,t);case R(e):return o(e,t);default:return""}}const Ee=`-----BEGIN PUBLIC KEY-----
21
22
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4
22
23
  qSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n
23
24
  BiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA
@@ -25,4 +26,4 @@ dQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj
25
26
  hC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn
26
27
  4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+
27
28
  GwIDAQAB
28
- -----END PUBLIC KEY-----`,Re="__licenseRequired",Ee="__licenseValidated";async function we(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),n=Uint8Array.from(atob(t),r=>r.charCodeAt(0));return await crypto.subtle.importKey("spki",n,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"])}async function Ne({payload:e,signature:t}){const n=new TextEncoder().encode(e),r=Uint8Array.from(atob(t),a=>a.charCodeAt(0)),o=await we(ve);if(!await crypto.subtle.verify({name:"RSASSA-PKCS1-v1_5"},o,r,n))throw new Error("License validation failed: Invalid signature detected. The license may have been modified or corrupted.");return JSON.parse(e)}function Oe(e){return Object.prototype.hasOwnProperty.call(e,Re)}async function Fe(e){const t=Object.getOwnPropertyDescriptor(e,Ee);if(!t?.value)return{key:"",instanceId:"",environment:"",valid:!1};const n=t.value;if(typeof n!="object"||n===null||!("payload"in n)||!("signature"in n)||typeof n.payload!="string"||typeof n.signature!="string")return{key:"",instanceId:"",environment:"",valid:!1};try{return await Ne(n)}catch{return{key:"",instanceId:"",environment:"",valid:!1}}}function $e(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 R(e,t=""){return{name:e,content:t}}async function Be(e,{type:t="all",consumers:n={css:b,ts:T}}={}){const r={files:[]},o=e.options;if(Oe(e)){const a=await Fe(e);(!a.valid||a.instanceId!==e.id)&&$e(e)}if(t==="all"||t==="css"){const a=R("index.css",n.css(e.root,o));r.files.push(a)}if(t==="all"||t==="ts"){const a=R("index.ts",n.ts(e.root,o));r.files.push(a)}return r}p.DEFAULT_INDENT=" ",p.STATEMENT_AT_RULES=w,p.STATEMENT_OR_BLOCK_AT_RULES=N,p.addIndentToLine=B,p.consumeCSS=b,p.consumeTS=T,p.createFile=R,p.defaultThemeSelectorFn=O,p.defaultUtilitySelectorFn=F,p.defaultVariableNameFn=v,p.indentLines=L,p.isUppercase=_,p.toCamelCase=U,p.toKebabCase=D,p.transpile=Be,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
29
+ -----END PUBLIC KEY-----`,Ne="__licenseRequired",_e="__licenseValidated";async function $e(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/,"").replace(/-----END PUBLIC KEY-----/,"").replace(/\s/g,""),n=Uint8Array.from(atob(t),r=>r.charCodeAt(0));return await crypto.subtle.importKey("spki",n,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!0,["verify"])}async function we({payload:e,signature:t}){const n=new TextEncoder().encode(e),r=Uint8Array.from(atob(t),a=>a.charCodeAt(0)),o=await $e(Ee);if(!await crypto.subtle.verify({name:"RSASSA-PKCS1-v1_5"},o,r,n))throw new Error("License validation failed: Invalid signature detected. The license may have been modified or corrupted.");return JSON.parse(e)}function Oe(e){return Object.prototype.hasOwnProperty.call(e,Ne)}async function Fe(e){const t=Object.getOwnPropertyDescriptor(e,_e);if(!t?.value)return{key:"",instanceId:"",environment:"",valid:!1};const n=t.value;if(typeof n!="object"||n===null||!("payload"in n)||!("signature"in n)||typeof n.payload!="string"||typeof n.signature!="string")return{key:"",instanceId:"",environment:"",valid:!1};try{return await we(n)}catch{return{key:"",instanceId:"",environment:"",valid:!1}}}function Le(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 E(e,t=""){return{name:e,content:t}}async function Be(e,{type:t="all",consumers:n={css:h,ts:T}}={}){const r={files:[]},o=e.options;if(Oe(e)){const a=await Fe(e);(!a.valid||a.instanceId!==e.id)&&Le(e)}if(t==="all"||t==="css"){const a=E("index.css",n.css(e.root,o));r.files.push(a)}if(t==="all"||t==="ts"){const a=E("index.ts",n.ts(e.root,o));r.files.push(a)}return r}p.DEFAULT_INDENT=" ",p.STATEMENT_AT_RULES=_,p.STATEMENT_OR_BLOCK_AT_RULES=$,p.addIndentToLine=L,p.consumeCSS=h,p.consumeTS=T,p.createFile=E,p.defaultThemeSelectorFn=w,p.defaultUtilitySelectorFn=O,p.defaultVariableNameFn=v,p.indentLines=B,p.isUppercase=U,p.toCamelCase=D,p.toKebabCase=I,p.transpile=Be,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@styleframe/transpiler",
3
- "version": "2.4.0",
3
+ "version": "2.6.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": "^2.4.0",
25
+ "@styleframe/core": "^2.6.0",
26
26
  "@styleframe/license": "^2.0.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@styleframe/config-typescript": "^2",
30
30
  "@styleframe/config-vite": "^2",
31
- "@styleframe/core": "^2.4.0",
31
+ "@styleframe/core": "^2.6.0",
32
32
  "@styleframe/license": "^2.0.0",
33
33
  "@vitest/coverage-v8": "^3.2.4",
34
34
  "typescript": "^5.8.3",