@styleframe/transpiler 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/transpiler.d.ts +120 -0
  3. package/dist/transpiler.js +538 -0
  4. package/dist/transpiler.umd.cjs +22 -0
  5. package/package.json +11 -4
  6. package/.tsbuildinfo +0 -1
  7. package/src/constants.ts +0 -4
  8. package/src/consume/at-rule.test.ts +0 -339
  9. package/src/consume/at-rule.ts +0 -34
  10. package/src/consume/consume.test.ts +0 -259
  11. package/src/consume/consume.ts +0 -81
  12. package/src/consume/container.test.ts +0 -501
  13. package/src/consume/container.ts +0 -73
  14. package/src/consume/css.test.ts +0 -187
  15. package/src/consume/css.ts +0 -17
  16. package/src/consume/declarations.test.ts +0 -210
  17. package/src/consume/declarations.ts +0 -17
  18. package/src/consume/index.ts +0 -12
  19. package/src/consume/primitive.test.ts +0 -52
  20. package/src/consume/primitive.ts +0 -16
  21. package/src/consume/ref.test.ts +0 -84
  22. package/src/consume/ref.ts +0 -22
  23. package/src/consume/root.test.ts +0 -353
  24. package/src/consume/root.ts +0 -19
  25. package/src/consume/selector.test.ts +0 -441
  26. package/src/consume/selector.ts +0 -17
  27. package/src/consume/theme.test.ts +0 -215
  28. package/src/consume/theme.ts +0 -15
  29. package/src/consume/utility.test.ts +0 -696
  30. package/src/consume/utility.ts +0 -31
  31. package/src/consume/variable.test.ts +0 -197
  32. package/src/consume/variable.ts +0 -20
  33. package/src/defaults.ts +0 -21
  34. package/src/generator/genAtRuleQuery.test.ts +0 -148
  35. package/src/generator/genAtRuleQuery.ts +0 -3
  36. package/src/generator/genDeclaration.test.ts +0 -283
  37. package/src/generator/genDeclaration.ts +0 -9
  38. package/src/generator/genDeclarationsBlock.test.ts +0 -278
  39. package/src/generator/genDeclarationsBlock.ts +0 -7
  40. package/src/generator/genDeclareVariable.test.ts +0 -323
  41. package/src/generator/genDeclareVariable.ts +0 -6
  42. package/src/generator/genInlineAtRule.test.ts +0 -351
  43. package/src/generator/genInlineAtRule.ts +0 -5
  44. package/src/generator/genReferenceVariable.test.ts +0 -392
  45. package/src/generator/genReferenceVariable.ts +0 -5
  46. package/src/generator/genSafePropertyName.test.ts +0 -489
  47. package/src/generator/genSafePropertyName.ts +0 -5
  48. package/src/generator/genSafeVariableName.test.ts +0 -358
  49. package/src/generator/genSafeVariableName.ts +0 -21
  50. package/src/generator/genSelector.test.ts +0 -357
  51. package/src/generator/genSelector.ts +0 -5
  52. package/src/generator/index.ts +0 -9
  53. package/src/index.ts +0 -6
  54. package/src/transpile.test.ts +0 -829
  55. package/src/transpile.ts +0 -34
  56. package/src/types.ts +0 -23
  57. package/src/utils.ts +0 -18
  58. package/src/vite-env.d.ts +0 -1
  59. package/tsconfig.json +0 -7
  60. package/vite.config.ts +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @styleframe/transpiler
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#50](https://github.com/styleframe-dev/styleframe/pull/50) [`0593c52`](https://github.com/styleframe-dev/styleframe/commit/0593c52798b8846d3c49762621baeb66354e0356) Thanks [@alexgrozav](https://github.com/alexgrozav)! - feat: add license check integration
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`0593c52`](https://github.com/styleframe-dev/styleframe/commit/0593c52798b8846d3c49762621baeb66354e0356)]:
12
+ - @styleframe/core@1.1.0
13
+
14
+ ## 1.0.3
15
+
16
+ ### Patch Changes
17
+
18
+ - [#35](https://github.com/styleframe-dev/styleframe/pull/35) [`5d53569`](https://github.com/styleframe-dev/styleframe/commit/5d5356960af687884703f3de5d3d1638d8ee9d8a) Thanks [@alexgrozav](https://github.com/alexgrozav)! - fix: Update published files references in package.json
19
+
20
+ - Updated dependencies [[`5d53569`](https://github.com/styleframe-dev/styleframe/commit/5d5356960af687884703f3de5d3d1638d8ee9d8a)]:
21
+ - @styleframe/core@1.0.2
22
+
3
23
  ## 1.0.2
4
24
 
5
25
  ### Patch Changes
@@ -0,0 +1,120 @@
1
+ import { AtRule } from '@styleframe/core';
2
+ import { ContainerChild } from '@styleframe/core';
3
+ import { CSS as CSS_2 } from '@styleframe/core';
4
+ import { DeclarationsBlock } from '@styleframe/core';
5
+ import { KebabCase } from 'scule';
6
+ import { Reference } from '@styleframe/core';
7
+ import { Root } from '@styleframe/core';
8
+ import { Selector } from '@styleframe/core';
9
+ import { Styleframe } from '@styleframe/core';
10
+ import { StyleframeOptions } from '@styleframe/core';
11
+ import { Theme } from '@styleframe/core';
12
+ import { ThemeSelectorFn } from '@styleframe/core';
13
+ import { Utility } from '@styleframe/core';
14
+ import { UtilitySelectorFn } from '@styleframe/core';
15
+ import { Variable } from '@styleframe/core';
16
+ import { VariableNameFn } from '@styleframe/core';
17
+
18
+ export declare function addIndentToLine(line: string): string;
19
+
20
+ /**
21
+ * Consumes any token instance and returns the CSS string representation
22
+ */
23
+ export declare function consumeCSS(instance: unknown, options: StyleframeOptions): string;
24
+
25
+ export declare type ConsumeFunction = (instance: unknown, options: StyleframeOptions) => string;
26
+
27
+ /**
28
+ * Consumes any token instance and returns the TS string representation
29
+ */
30
+ export declare function consumeTS(instance: unknown, options: StyleframeOptions): string;
31
+
32
+ /**
33
+ * Consumes a generic at-rule instance, equivalent to setting a CSS at-rule
34
+ * such as @media, @supports, @keyframes, etc.
35
+ */
36
+ export declare function createAtRuleConsumer(consume: ConsumeFunction): (instance: AtRule, options: StyleframeOptions) => string;
37
+
38
+ /**
39
+ * Base function for consuming container-like structures (Selector, AtRule)
40
+ */
41
+ export declare function createContainerConsumer(consume: ConsumeFunction): (query: string, instance: {
42
+ variables?: Variable[];
43
+ declarations?: DeclarationsBlock;
44
+ children?: ContainerChild[];
45
+ }, options: StyleframeOptions) => string;
46
+
47
+ /**
48
+ * Consumes a CSS value, equivalent to the string body of a selector
49
+ */
50
+ export declare function createCSSTemplateLiteralConsumer(consume: ConsumeFunction): (instance: CSS_2, options: StyleframeOptions) => string;
51
+
52
+ /**
53
+ * Consumes a declarations block, equivalent to setting CSS properties
54
+ */
55
+ export declare function createDeclarationsConsumer(consume: ConsumeFunction): (instance: DeclarationsBlock, options: StyleframeOptions) => string[];
56
+
57
+ export declare function createFile(name: string, content?: string): OutputFile;
58
+
59
+ /**
60
+ * Consumes a primitive instance, equivalent to setting a CSS value
61
+ */
62
+ export declare function createPrimitiveConsumer(_consume: ConsumeFunction): (instance: unknown, _options: StyleframeOptions) => string;
63
+
64
+ /**
65
+ * Consumes a ref instance, equivalent to referencing a CSS variable with optional fallback
66
+ */
67
+ export declare function createRefConsumer(consume: ConsumeFunction): (instance: Reference, options: StyleframeOptions) => string;
68
+
69
+ export declare function createRootConsumer(consume: ConsumeFunction): (instance: Root, options: StyleframeOptions) => string;
70
+
71
+ /**
72
+ * Consumes a selector instance, equivalent to setting a CSS selector
73
+ */
74
+ export declare function createSelectorConsumer(consume: ConsumeFunction): (instance: Selector, options: StyleframeOptions) => string;
75
+
76
+ export declare function createThemeConsumer(consume: ConsumeFunction): (instance: Theme, options: StyleframeOptions) => string;
77
+
78
+ /**
79
+ * Consumes a utility instance, equivalent to setting a utility CSS selector
80
+ */
81
+ export declare function createUtilityConsumer(consume: ConsumeFunction): (instance: Utility, options: StyleframeOptions) => string;
82
+
83
+ export declare function createVariableConsumer(consume: ConsumeFunction): (instance: Variable, options: StyleframeOptions) => string;
84
+
85
+ export declare const DEFAULT_INDENT = "\t";
86
+
87
+ export declare const defaultThemeSelectorFn: ThemeSelectorFn;
88
+
89
+ export declare const defaultUtilitySelectorFn: UtilitySelectorFn;
90
+
91
+ export declare const defaultVariableNameFn: VariableNameFn;
92
+
93
+ export declare function indentLines(lines: string): string;
94
+
95
+ export declare type Output = {
96
+ files: OutputFile[];
97
+ };
98
+
99
+ export declare type OutputFile = {
100
+ name: string;
101
+ content: string;
102
+ };
103
+
104
+ export declare const STATEMENT_AT_RULES: string[];
105
+
106
+ export declare const STATEMENT_OR_BLOCK_AT_RULES: string[];
107
+
108
+ export declare function toKebabCase<S extends string>(str: S): KebabCase<S>;
109
+
110
+ export declare function transpile(instance: Styleframe, { type, consumers, }?: TranspileOptions): Promise<Output>;
111
+
112
+ export declare type TranspileOptions = {
113
+ type?: "css" | "ts" | "all";
114
+ consumers?: {
115
+ css: ConsumeFunction;
116
+ ts: ConsumeFunction;
117
+ };
118
+ };
119
+
120
+ export { }
@@ -0,0 +1,538 @@
1
+ const ve = " ", N = ["charset", "import", "namespace"], R = ["layer"], D = ({ name: e }) => `[data-theme="${e}"]`, I = ({
2
+ name: e,
3
+ value: t,
4
+ modifiers: r
5
+ }) => `._${[...r, e, t].filter(Boolean).join("\\:")}`, w = ({ name: e }) => e;
6
+ function L(e, t) {
7
+ return `@${e}${t ? " " : ""}${t}`;
8
+ }
9
+ const P = /\d/, M = ["-", "_", "/", "."];
10
+ function $(e = "") {
11
+ if (!P.test(e))
12
+ return e !== e.toLowerCase();
13
+ }
14
+ function U(e, t) {
15
+ const r = M, n = [];
16
+ if (!e || typeof e != "string")
17
+ return n;
18
+ let u = "", a, i;
19
+ for (const s of e) {
20
+ const o = r.includes(s);
21
+ if (o === !0) {
22
+ n.push(u), u = "", a = void 0;
23
+ continue;
24
+ }
25
+ const c = $(s);
26
+ if (i === !1) {
27
+ if (a === !1 && c === !0) {
28
+ n.push(u), u = s, a = c;
29
+ continue;
30
+ }
31
+ if (a === !0 && c === !1 && u.length > 1) {
32
+ const f = u.at(-1);
33
+ n.push(u.slice(0, Math.max(0, u.length - 1))), u = f + s, a = c;
34
+ continue;
35
+ }
36
+ }
37
+ u += s, a = c, i = o;
38
+ }
39
+ return n.push(u), n;
40
+ }
41
+ function _(e, t) {
42
+ return e ? (Array.isArray(e) ? e : U(e)).map((r) => r.toLowerCase()).join("-") : "";
43
+ }
44
+ function k(e) {
45
+ return ` ${e}`;
46
+ }
47
+ function V(e) {
48
+ return e.split(`
49
+ `).map((t) => k(t)).join(`
50
+ `);
51
+ }
52
+ function x(e) {
53
+ return _(e);
54
+ }
55
+ function K(e) {
56
+ return x(e);
57
+ }
58
+ function B(e, t) {
59
+ return `${e.startsWith("--") ? e : K(e)}: ${t};`;
60
+ }
61
+ function q(e) {
62
+ return `{${e.length > 0 ? `
63
+ ` : ""}${e.map((t) => `${V(`${t}`)}
64
+ `).join("")}}`;
65
+ }
66
+ function O(e) {
67
+ return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
68
+ }
69
+ function z(e, t) {
70
+ return B(O(e), t);
71
+ }
72
+ function H(e, t) {
73
+ return `var(${O(e)}${t ? `, ${t}` : ""})`;
74
+ }
75
+ function C(e, t) {
76
+ return `${e} ${q(t)}`;
77
+ }
78
+ function Q(e) {
79
+ return function(r, n) {
80
+ return Object.entries(r).map(([u, a]) => B(u, e(a, n)));
81
+ };
82
+ }
83
+ function E(e) {
84
+ return function(r, n) {
85
+ const a = (n.variables?.name ?? w)({ name: r.name });
86
+ return z(a, e(r.value, n));
87
+ };
88
+ }
89
+ function S(e) {
90
+ const t = E(e), r = Q(e);
91
+ return function(u, a, i) {
92
+ const { variables: s, declarations: o, children: c } = a, f = u === ":root", l = (s ?? []).map(
93
+ (A) => t(A, i)
94
+ ), m = r(
95
+ o ?? {},
96
+ i
97
+ ), y = (c ?? []).map(
98
+ (A) => e(A, i)
99
+ ), d = l.length > 0, h = m.length > 0, v = y.length > 0;
100
+ return f ? `${d || h ? C(u, [
101
+ ...l,
102
+ ...d && h ? [""] : [],
103
+ ...m
104
+ ]) : ""}${v && (d || h) ? `
105
+
106
+ ` : ""}${y.join(`
107
+
108
+ `)}` : C(u, [
109
+ ...l,
110
+ ...d && (v || h) ? [""] : [],
111
+ ...m,
112
+ ...h && v ? [""] : [],
113
+ ...y.flatMap(
114
+ (A, F) => F === y.length - 1 ? [A] : [A, ""]
115
+ )
116
+ ]);
117
+ };
118
+ }
119
+ function Z(e) {
120
+ const t = S(e);
121
+ return function(n, u) {
122
+ const a = N.includes(n.identifier), i = R.includes(
123
+ n.identifier
124
+ ), s = Object.keys(n.declarations).length > 0, o = n.variables.length > 0, c = n.children.length > 0, f = L(n.identifier, n.rule);
125
+ return a || i && !(s || o || c) ? `${f};` : t(f, n, u);
126
+ };
127
+ }
128
+ function W(e) {
129
+ return typeof e == "object" && e !== null;
130
+ }
131
+ function b(e, t) {
132
+ return W(e) && "type" in e && e.type === t;
133
+ }
134
+ function J(e) {
135
+ return b(e, "variable");
136
+ }
137
+ function G(e) {
138
+ return b(e, "reference");
139
+ }
140
+ function Y(e) {
141
+ return b(e, "selector");
142
+ }
143
+ function X(e) {
144
+ return b(e, "at-rule");
145
+ }
146
+ function ee(e) {
147
+ return b(e, "utility");
148
+ }
149
+ function te(e) {
150
+ return b(e, "css");
151
+ }
152
+ function ne(e) {
153
+ return b(e, "theme");
154
+ }
155
+ function re(e) {
156
+ return b(e, "root");
157
+ }
158
+ function g(e) {
159
+ if (e instanceof Buffer)
160
+ return Buffer.from(e);
161
+ const t = e.constructor;
162
+ return new t(
163
+ e.buffer.slice(0),
164
+ e.byteOffset,
165
+ e.byteLength / e.BYTES_PER_ELEMENT || 1
166
+ );
167
+ }
168
+ function oe(e) {
169
+ if (e = e || {}, e.circular)
170
+ return ce(e);
171
+ const t = /* @__PURE__ */ new Map();
172
+ if (t.set(Date, (i) => new Date(i)), t.set(
173
+ Map,
174
+ (i, s) => new Map(n(Array.from(i), s))
175
+ ), t.set(
176
+ Set,
177
+ (i, s) => new Set(n(Array.from(i), s))
178
+ ), e.constructorHandlers)
179
+ for (const i of e.constructorHandlers)
180
+ t.set(i[0], i[1]);
181
+ let r;
182
+ return e.proto ? a : u;
183
+ function n(i, s) {
184
+ const o = Object.keys(i), c = Array.from({ length: o.length });
185
+ for (let f = 0; f < o.length; f++) {
186
+ const l = o[f], m = i[l];
187
+ typeof m != "object" || m === null ? c[l] = m : m.constructor !== Object && (r = t.get(m.constructor)) ? c[l] = r(m, s) : ArrayBuffer.isView(m) ? c[l] = g(m) : c[l] = s(m);
188
+ }
189
+ return c;
190
+ }
191
+ function u(i) {
192
+ if (typeof i != "object" || i === null) return i;
193
+ if (Array.isArray(i)) return n(i, u);
194
+ if (i.constructor !== Object && (r = t.get(i.constructor)))
195
+ return r(i, u);
196
+ const s = {};
197
+ for (const o in i) {
198
+ if (Object.hasOwnProperty.call(i, o) === !1) continue;
199
+ const c = i[o];
200
+ typeof c != "object" || c === null ? s[o] = c : c.constructor !== Object && (r = t.get(c.constructor)) ? s[o] = r(c, u) : ArrayBuffer.isView(c) ? s[o] = g(c) : s[o] = u(c);
201
+ }
202
+ return s;
203
+ }
204
+ function a(i) {
205
+ if (typeof i != "object" || i === null) return i;
206
+ if (Array.isArray(i)) return n(i, a);
207
+ if (i.constructor !== Object && (r = t.get(i.constructor)))
208
+ return r(i, a);
209
+ const s = {};
210
+ for (const o in i) {
211
+ const c = i[o];
212
+ typeof c != "object" || c === null ? s[o] = c : c.constructor !== Object && (r = t.get(c.constructor)) ? s[o] = r(c, a) : ArrayBuffer.isView(c) ? s[o] = g(c) : s[o] = a(c);
213
+ }
214
+ return s;
215
+ }
216
+ }
217
+ function ce(e) {
218
+ const t = [], r = [], n = /* @__PURE__ */ new Map();
219
+ if (n.set(Date, (o) => new Date(o)), n.set(
220
+ Map,
221
+ (o, c) => new Map(a(Array.from(o), c))
222
+ ), n.set(
223
+ Set,
224
+ (o, c) => new Set(a(Array.from(o), c))
225
+ ), e.constructorHandlers)
226
+ for (const o of e.constructorHandlers)
227
+ n.set(o[0], o[1]);
228
+ let u;
229
+ return e.proto ? s : i;
230
+ function a(o, c) {
231
+ const f = Object.keys(o), l = Array.from({ length: f.length });
232
+ for (let m = 0; m < f.length; m++) {
233
+ const y = f[m], d = o[y];
234
+ if (typeof d != "object" || d === null)
235
+ l[y] = d;
236
+ else if (d.constructor !== Object && (u = n.get(d.constructor)))
237
+ l[y] = u(d, c);
238
+ else if (ArrayBuffer.isView(d))
239
+ l[y] = g(d);
240
+ else {
241
+ const h = t.indexOf(d);
242
+ h !== -1 ? l[y] = r[h] : l[y] = c(d);
243
+ }
244
+ }
245
+ return l;
246
+ }
247
+ function i(o) {
248
+ if (typeof o != "object" || o === null) return o;
249
+ if (Array.isArray(o)) return a(o, i);
250
+ if (o.constructor !== Object && (u = n.get(o.constructor)))
251
+ return u(o, i);
252
+ const c = {};
253
+ t.push(o), r.push(c);
254
+ for (const f in o) {
255
+ if (Object.hasOwnProperty.call(o, f) === !1) continue;
256
+ const l = o[f];
257
+ if (typeof l != "object" || l === null)
258
+ c[f] = l;
259
+ else if (l.constructor !== Object && (u = n.get(l.constructor)))
260
+ c[f] = u(l, i);
261
+ else if (ArrayBuffer.isView(l))
262
+ c[f] = g(l);
263
+ else {
264
+ const m = t.indexOf(l);
265
+ m !== -1 ? c[f] = r[m] : c[f] = i(l);
266
+ }
267
+ }
268
+ return t.pop(), r.pop(), c;
269
+ }
270
+ function s(o) {
271
+ if (typeof o != "object" || o === null) return o;
272
+ if (Array.isArray(o)) return a(o, s);
273
+ if (o.constructor !== Object && (u = n.get(o.constructor)))
274
+ return u(o, s);
275
+ const c = {};
276
+ t.push(o), r.push(c);
277
+ for (const f in o) {
278
+ const l = o[f];
279
+ if (typeof l != "object" || l === null)
280
+ c[f] = l;
281
+ else if (l.constructor !== Object && (u = n.get(l.constructor)))
282
+ c[f] = u(l, s);
283
+ else if (ArrayBuffer.isView(l))
284
+ c[f] = g(l);
285
+ else {
286
+ const m = t.indexOf(l);
287
+ m !== -1 ? c[f] = r[m] : c[f] = s(l);
288
+ }
289
+ }
290
+ return t.pop(), r.pop(), c;
291
+ }
292
+ }
293
+ oe();
294
+ function ue(e) {
295
+ return function(r, n) {
296
+ return r.value.map((u) => e(u, n)).join("").trim();
297
+ };
298
+ }
299
+ function ie(e) {
300
+ return function(r, n) {
301
+ return r != null ? `${r}` : "";
302
+ };
303
+ }
304
+ function se(e) {
305
+ return function(r, n) {
306
+ const a = (n.variables?.name ?? w)({ name: r.name });
307
+ return H(
308
+ a,
309
+ r.fallback ? e(r.fallback, n) : void 0
310
+ );
311
+ };
312
+ }
313
+ function ae(e) {
314
+ const t = S(e);
315
+ return function(n, u) {
316
+ return n.themes.reduce(
317
+ (a, i) => (a.push(e(i, u)), a),
318
+ [t(":root", n, u)]
319
+ // Default theme (root)
320
+ ).join(`
321
+
322
+ `);
323
+ };
324
+ }
325
+ function le(e) {
326
+ const t = S(e);
327
+ return function(n, u) {
328
+ return t(n.query, n, u);
329
+ };
330
+ }
331
+ function fe(e) {
332
+ const t = S(e);
333
+ return function(n, u) {
334
+ const i = (u.theme?.selector ?? D)({ name: n.name });
335
+ return t(i, n, u);
336
+ };
337
+ }
338
+ function me(e) {
339
+ const t = S(e);
340
+ return function(n, u) {
341
+ const a = [], s = (u.utilities?.selector ?? I)({
342
+ name: n.name,
343
+ value: n.value,
344
+ modifiers: n.modifiers
345
+ });
346
+ return a.push(t(s, n, u)), a.join(`
347
+
348
+ `);
349
+ };
350
+ }
351
+ function p(e, t) {
352
+ const r = ae(p), n = le(p), u = me(p), a = Z(p), i = fe(p), s = E(p), o = se(p), c = ue(p), f = ie();
353
+ switch (!0) {
354
+ case Y(e):
355
+ return n(e, t);
356
+ case ee(e):
357
+ return u(e, t);
358
+ case X(e):
359
+ return a(e, t);
360
+ case re(e):
361
+ return r(e, t);
362
+ case ne(e):
363
+ return i(e, t);
364
+ case J(e):
365
+ return s(e, t);
366
+ case G(e):
367
+ return o(e, t);
368
+ case te(e):
369
+ return c(e, t);
370
+ default:
371
+ return f(e, t);
372
+ }
373
+ }
374
+ function T(e, t) {
375
+ switch (!0) {
376
+ case Array.isArray(e):
377
+ return e.map((r) => T(r)).join(`
378
+ `);
379
+ // case isRecipe(instance):
380
+ // return consumeRecipe(instance, options);
381
+ // break;
382
+ default:
383
+ return "";
384
+ }
385
+ }
386
+ const de = `-----BEGIN PUBLIC KEY-----
387
+ MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4
388
+ qSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n
389
+ BiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA
390
+ dQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj
391
+ hC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn
392
+ 4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+
393
+ GwIDAQAB
394
+ -----END PUBLIC KEY-----`, ye = "__licenseRequired", pe = "__licenseValidated";
395
+ async function he(e) {
396
+ const t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""), r = Uint8Array.from(atob(t), (n) => n.charCodeAt(0));
397
+ return await crypto.subtle.importKey(
398
+ "spki",
399
+ r,
400
+ {
401
+ name: "RSASSA-PKCS1-v1_5",
402
+ hash: "SHA-256"
403
+ },
404
+ !0,
405
+ ["verify"]
406
+ );
407
+ }
408
+ async function be({
409
+ payload: e,
410
+ signature: t
411
+ }) {
412
+ const r = new TextEncoder().encode(e), n = Uint8Array.from(
413
+ atob(t),
414
+ (a) => a.charCodeAt(0)
415
+ ), u = await he(de);
416
+ if (!await crypto.subtle.verify(
417
+ { name: "RSASSA-PKCS1-v1_5" },
418
+ u,
419
+ n,
420
+ r
421
+ ))
422
+ throw new Error(
423
+ "License validation failed: Invalid signature detected. The license may have been modified or corrupted."
424
+ );
425
+ return JSON.parse(e);
426
+ }
427
+ function Ae(e) {
428
+ return Object.prototype.hasOwnProperty.call(e, ye);
429
+ }
430
+ async function ge(e) {
431
+ const t = Object.getOwnPropertyDescriptor(
432
+ e,
433
+ pe
434
+ );
435
+ if (!t?.value)
436
+ return {
437
+ key: "",
438
+ instanceId: "",
439
+ environment: "",
440
+ valid: !1
441
+ };
442
+ const r = t.value;
443
+ if (typeof r != "object" || r === null || !("payload" in r) || !("signature" in r) || typeof r.payload != "string" || typeof r.signature != "string")
444
+ return {
445
+ key: "",
446
+ instanceId: "",
447
+ environment: "",
448
+ valid: !1
449
+ };
450
+ try {
451
+ return await be(
452
+ r
453
+ );
454
+ } catch {
455
+ return {
456
+ key: "",
457
+ instanceId: "",
458
+ environment: "",
459
+ valid: !1
460
+ };
461
+ }
462
+ }
463
+ function Se(e) {
464
+ const t = Math.floor(Math.random() * 100);
465
+ e.root.children.push({
466
+ type: "selector",
467
+ query: `html:nth-of-type(${t}n+1)::after`,
468
+ variables: [],
469
+ children: [],
470
+ declarations: {
471
+ content: '"Styleframe Pro: Development Mode – License required for production use"',
472
+ zIndex: 99999,
473
+ position: "fixed",
474
+ display: "block !important",
475
+ opacity: "1 !important",
476
+ bottom: 0,
477
+ left: 0,
478
+ background: "rgba(0, 0, 0, 0.5)",
479
+ color: "white",
480
+ fontSize: "12px",
481
+ lineHeight: "1",
482
+ padding: "0.5rem",
483
+ fontFamily: "sans-serif"
484
+ }
485
+ });
486
+ }
487
+ function j(e, t = "") {
488
+ return {
489
+ name: e,
490
+ content: t
491
+ };
492
+ }
493
+ async function Ce(e, {
494
+ type: t = "all",
495
+ consumers: r = { css: p, ts: T }
496
+ } = {}) {
497
+ const n = { files: [] }, u = e.options;
498
+ if (Ae(e)) {
499
+ const s = await ge(e);
500
+ (!s.valid || s.instanceId !== e.id) && Se(e);
501
+ }
502
+ const { recipes: a, ...i } = e.root;
503
+ if (t === "all" || t === "css") {
504
+ const s = j("index.css", r.css(i, u));
505
+ n.files.push(s);
506
+ }
507
+ if (t === "all" || t === "ts") {
508
+ const s = j("index.ts", r.ts([], u));
509
+ n.files.push(s);
510
+ }
511
+ return console.log(n.files), n;
512
+ }
513
+ export {
514
+ ve as DEFAULT_INDENT,
515
+ N as STATEMENT_AT_RULES,
516
+ R as STATEMENT_OR_BLOCK_AT_RULES,
517
+ k as addIndentToLine,
518
+ p as consumeCSS,
519
+ T as consumeTS,
520
+ Z as createAtRuleConsumer,
521
+ ue as createCSSTemplateLiteralConsumer,
522
+ S as createContainerConsumer,
523
+ Q as createDeclarationsConsumer,
524
+ j as createFile,
525
+ ie as createPrimitiveConsumer,
526
+ se as createRefConsumer,
527
+ ae as createRootConsumer,
528
+ le as createSelectorConsumer,
529
+ fe as createThemeConsumer,
530
+ me as createUtilityConsumer,
531
+ E as createVariableConsumer,
532
+ D as defaultThemeSelectorFn,
533
+ I as defaultUtilitySelectorFn,
534
+ w as defaultVariableNameFn,
535
+ V as indentLines,
536
+ x as toKebabCase,
537
+ Ce as transpile
538
+ };