@styleframe/transpiler 1.0.3 → 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.
- package/CHANGELOG.md +11 -0
- package/dist/transpiler.d.ts +1 -1
- package/dist/transpiler.js +361 -255
- package/dist/transpiler.umd.cjs +17 -9
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
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
|
+
|
|
3
14
|
## 1.0.3
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/transpiler.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ export declare const STATEMENT_OR_BLOCK_AT_RULES: string[];
|
|
|
107
107
|
|
|
108
108
|
export declare function toKebabCase<S extends string>(str: S): KebabCase<S>;
|
|
109
109
|
|
|
110
|
-
export declare function transpile(instance: Styleframe, { type, consumers, }?: TranspileOptions): Output
|
|
110
|
+
export declare function transpile(instance: Styleframe, { type, consumers, }?: TranspileOptions): Promise<Output>;
|
|
111
111
|
|
|
112
112
|
export declare type TranspileOptions = {
|
|
113
113
|
type?: "css" | "ts" | "all";
|
package/dist/transpiler.js
CHANGED
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ve = " ", N = ["charset", "import", "namespace"], R = ["layer"], D = ({ name: e }) => `[data-theme="${e}"]`, I = ({
|
|
2
2
|
name: e,
|
|
3
3
|
value: t,
|
|
4
|
-
modifiers:
|
|
5
|
-
}) => `._${[...
|
|
6
|
-
function
|
|
4
|
+
modifiers: r
|
|
5
|
+
}) => `._${[...r, e, t].filter(Boolean).join("\\:")}`, w = ({ name: e }) => e;
|
|
6
|
+
function L(e, t) {
|
|
7
7
|
return `@${e}${t ? " " : ""}${t}`;
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
if (!
|
|
9
|
+
const P = /\d/, M = ["-", "_", "/", "."];
|
|
10
|
+
function $(e = "") {
|
|
11
|
+
if (!P.test(e))
|
|
12
12
|
return e !== e.toLowerCase();
|
|
13
13
|
}
|
|
14
14
|
function U(e, t) {
|
|
15
|
-
const
|
|
15
|
+
const r = M, n = [];
|
|
16
16
|
if (!e || typeof e != "string")
|
|
17
|
-
return
|
|
18
|
-
let
|
|
19
|
-
for (const
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
|
|
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
23
|
continue;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
28
|
-
|
|
25
|
+
const c = $(s);
|
|
26
|
+
if (i === !1) {
|
|
27
|
+
if (a === !1 && c === !0) {
|
|
28
|
+
n.push(u), u = s, a = c;
|
|
29
29
|
continue;
|
|
30
30
|
}
|
|
31
|
-
if (
|
|
32
|
-
const f =
|
|
33
|
-
|
|
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
34
|
continue;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
u += s, a = c, i = o;
|
|
38
38
|
}
|
|
39
|
-
return
|
|
39
|
+
return n.push(u), n;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
return e ? (Array.isArray(e) ? e : U(e)).map((
|
|
41
|
+
function _(e, t) {
|
|
42
|
+
return e ? (Array.isArray(e) ? e : U(e)).map((r) => r.toLowerCase()).join("-") : "";
|
|
43
43
|
}
|
|
44
44
|
function k(e) {
|
|
45
45
|
return ` ${e}`;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function V(e) {
|
|
48
48
|
return e.split(`
|
|
49
49
|
`).map((t) => k(t)).join(`
|
|
50
50
|
`);
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
52
|
+
function x(e) {
|
|
53
|
+
return _(e);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
return
|
|
55
|
+
function K(e) {
|
|
56
|
+
return x(e);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
return `${e.startsWith("--") ? e :
|
|
58
|
+
function B(e, t) {
|
|
59
|
+
return `${e.startsWith("--") ? e : K(e)}: ${t};`;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function q(e) {
|
|
62
62
|
return `{${e.length > 0 ? `
|
|
63
|
-
` : ""}${e.map((t) => `${
|
|
63
|
+
` : ""}${e.map((t) => `${V(`${t}`)}
|
|
64
64
|
`).join("")}}`;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function O(e) {
|
|
67
67
|
return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
69
|
+
function z(e, t) {
|
|
70
|
+
return B(O(e), t);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
return `var(${
|
|
72
|
+
function H(e, t) {
|
|
73
|
+
return `var(${O(e)}${t ? `, ${t}` : ""})`;
|
|
74
74
|
}
|
|
75
75
|
function C(e, t) {
|
|
76
|
-
return `${e} ${
|
|
76
|
+
return `${e} ${q(t)}`;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return function(
|
|
80
|
-
return Object.entries(
|
|
78
|
+
function Q(e) {
|
|
79
|
+
return function(r, n) {
|
|
80
|
+
return Object.entries(r).map(([u, a]) => B(u, e(a, n)));
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
return function(
|
|
85
|
-
const
|
|
86
|
-
return
|
|
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
87
|
};
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
const t =
|
|
91
|
-
return function(
|
|
92
|
-
const { variables:
|
|
93
|
-
(
|
|
94
|
-
), m =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
),
|
|
98
|
-
(
|
|
99
|
-
),
|
|
100
|
-
return f ? `${
|
|
101
|
-
...
|
|
102
|
-
...
|
|
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
103
|
...m
|
|
104
|
-
]) : ""}${
|
|
104
|
+
]) : ""}${v && (d || h) ? `
|
|
105
105
|
|
|
106
|
-
` : ""}${
|
|
106
|
+
` : ""}${y.join(`
|
|
107
107
|
|
|
108
|
-
`)}` : C(
|
|
109
|
-
...
|
|
110
|
-
...
|
|
108
|
+
`)}` : C(u, [
|
|
109
|
+
...l,
|
|
110
|
+
...d && (v || h) ? [""] : [],
|
|
111
111
|
...m,
|
|
112
|
-
...h &&
|
|
113
|
-
...
|
|
114
|
-
(
|
|
112
|
+
...h && v ? [""] : [],
|
|
113
|
+
...y.flatMap(
|
|
114
|
+
(A, F) => F === y.length - 1 ? [A] : [A, ""]
|
|
115
115
|
)
|
|
116
116
|
]);
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
function Z(e) {
|
|
120
|
-
const t =
|
|
121
|
-
return function(
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
),
|
|
125
|
-
return
|
|
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
126
|
};
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function W(e) {
|
|
129
129
|
return typeof e == "object" && e !== null;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
return
|
|
133
|
-
}
|
|
134
|
-
function G(e) {
|
|
135
|
-
return d(e, "variable");
|
|
131
|
+
function b(e, t) {
|
|
132
|
+
return W(e) && "type" in e && e.type === t;
|
|
136
133
|
}
|
|
137
134
|
function J(e) {
|
|
138
|
-
return
|
|
135
|
+
return b(e, "variable");
|
|
136
|
+
}
|
|
137
|
+
function G(e) {
|
|
138
|
+
return b(e, "reference");
|
|
139
139
|
}
|
|
140
140
|
function Y(e) {
|
|
141
|
-
return
|
|
141
|
+
return b(e, "selector");
|
|
142
142
|
}
|
|
143
143
|
function X(e) {
|
|
144
|
-
return
|
|
144
|
+
return b(e, "at-rule");
|
|
145
145
|
}
|
|
146
146
|
function ee(e) {
|
|
147
|
-
return
|
|
147
|
+
return b(e, "utility");
|
|
148
148
|
}
|
|
149
149
|
function te(e) {
|
|
150
|
-
return
|
|
151
|
-
}
|
|
152
|
-
function re(e) {
|
|
153
|
-
return d(e, "theme");
|
|
150
|
+
return b(e, "css");
|
|
154
151
|
}
|
|
155
152
|
function ne(e) {
|
|
156
|
-
return
|
|
153
|
+
return b(e, "theme");
|
|
157
154
|
}
|
|
158
|
-
function
|
|
155
|
+
function re(e) {
|
|
156
|
+
return b(e, "root");
|
|
157
|
+
}
|
|
158
|
+
function g(e) {
|
|
159
159
|
if (e instanceof Buffer)
|
|
160
160
|
return Buffer.from(e);
|
|
161
161
|
const t = e.constructor;
|
|
@@ -167,155 +167,155 @@ function j(e) {
|
|
|
167
167
|
}
|
|
168
168
|
function oe(e) {
|
|
169
169
|
if (e = e || {}, e.circular)
|
|
170
|
-
return
|
|
170
|
+
return ce(e);
|
|
171
171
|
const t = /* @__PURE__ */ new Map();
|
|
172
|
-
if (t.set(Date, (
|
|
172
|
+
if (t.set(Date, (i) => new Date(i)), t.set(
|
|
173
173
|
Map,
|
|
174
|
-
(
|
|
174
|
+
(i, s) => new Map(n(Array.from(i), s))
|
|
175
175
|
), t.set(
|
|
176
176
|
Set,
|
|
177
|
-
(
|
|
177
|
+
(i, s) => new Set(n(Array.from(i), s))
|
|
178
178
|
), e.constructorHandlers)
|
|
179
|
-
for (const
|
|
180
|
-
t.set(
|
|
181
|
-
let
|
|
182
|
-
return e.proto ?
|
|
183
|
-
function
|
|
184
|
-
const
|
|
185
|
-
for (let f = 0; f <
|
|
186
|
-
const
|
|
187
|
-
typeof m != "object" || m === null ?
|
|
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
188
|
}
|
|
189
|
-
return
|
|
189
|
+
return c;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
if (typeof
|
|
193
|
-
if (Array.isArray(
|
|
194
|
-
if (
|
|
195
|
-
return
|
|
196
|
-
const
|
|
197
|
-
for (const
|
|
198
|
-
if (Object.hasOwnProperty.call(
|
|
199
|
-
const
|
|
200
|
-
typeof
|
|
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
201
|
}
|
|
202
|
-
return
|
|
202
|
+
return s;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
if (typeof
|
|
206
|
-
if (Array.isArray(
|
|
207
|
-
if (
|
|
208
|
-
return
|
|
209
|
-
const
|
|
210
|
-
for (const
|
|
211
|
-
const
|
|
212
|
-
typeof
|
|
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
213
|
}
|
|
214
|
-
return
|
|
214
|
+
return s;
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
const t = [],
|
|
219
|
-
if (
|
|
217
|
+
function ce(e) {
|
|
218
|
+
const t = [], r = [], n = /* @__PURE__ */ new Map();
|
|
219
|
+
if (n.set(Date, (o) => new Date(o)), n.set(
|
|
220
220
|
Map,
|
|
221
|
-
(
|
|
222
|
-
),
|
|
221
|
+
(o, c) => new Map(a(Array.from(o), c))
|
|
222
|
+
), n.set(
|
|
223
223
|
Set,
|
|
224
|
-
(
|
|
224
|
+
(o, c) => new Set(a(Array.from(o), c))
|
|
225
225
|
), e.constructorHandlers)
|
|
226
|
-
for (const
|
|
227
|
-
|
|
228
|
-
let
|
|
229
|
-
return e.proto ?
|
|
230
|
-
function
|
|
231
|
-
const f = Object.keys(
|
|
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
232
|
for (let m = 0; m < f.length; m++) {
|
|
233
|
-
const
|
|
234
|
-
if (typeof
|
|
235
|
-
|
|
236
|
-
else if (
|
|
237
|
-
|
|
238
|
-
else if (ArrayBuffer.isView(
|
|
239
|
-
|
|
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
240
|
else {
|
|
241
|
-
const h = t.indexOf(
|
|
242
|
-
h !== -1 ?
|
|
241
|
+
const h = t.indexOf(d);
|
|
242
|
+
h !== -1 ? l[y] = r[h] : l[y] = c(d);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
return
|
|
245
|
+
return l;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
if (typeof
|
|
249
|
-
if (Array.isArray(
|
|
250
|
-
if (
|
|
251
|
-
return
|
|
252
|
-
const
|
|
253
|
-
t.push(
|
|
254
|
-
for (const f in
|
|
255
|
-
if (Object.hasOwnProperty.call(
|
|
256
|
-
const
|
|
257
|
-
if (typeof
|
|
258
|
-
|
|
259
|
-
else if (
|
|
260
|
-
|
|
261
|
-
else if (ArrayBuffer.isView(
|
|
262
|
-
|
|
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
263
|
else {
|
|
264
|
-
const m = t.indexOf(
|
|
265
|
-
m !== -1 ?
|
|
264
|
+
const m = t.indexOf(l);
|
|
265
|
+
m !== -1 ? c[f] = r[m] : c[f] = i(l);
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
return t.pop(),
|
|
268
|
+
return t.pop(), r.pop(), c;
|
|
269
269
|
}
|
|
270
|
-
function
|
|
271
|
-
if (typeof
|
|
272
|
-
if (Array.isArray(
|
|
273
|
-
if (
|
|
274
|
-
return
|
|
275
|
-
const
|
|
276
|
-
t.push(
|
|
277
|
-
for (const f in
|
|
278
|
-
const
|
|
279
|
-
if (typeof
|
|
280
|
-
|
|
281
|
-
else if (
|
|
282
|
-
|
|
283
|
-
else if (ArrayBuffer.isView(
|
|
284
|
-
|
|
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
285
|
else {
|
|
286
|
-
const m = t.indexOf(
|
|
287
|
-
m !== -1 ?
|
|
286
|
+
const m = t.indexOf(l);
|
|
287
|
+
m !== -1 ? c[f] = r[m] : c[f] = s(l);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
return t.pop(),
|
|
290
|
+
return t.pop(), r.pop(), c;
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
oe();
|
|
294
|
-
function
|
|
295
|
-
return function(
|
|
296
|
-
return
|
|
294
|
+
function ue(e) {
|
|
295
|
+
return function(r, n) {
|
|
296
|
+
return r.value.map((u) => e(u, n)).join("").trim();
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
function
|
|
300
|
-
return function(
|
|
301
|
-
return
|
|
299
|
+
function ie(e) {
|
|
300
|
+
return function(r, n) {
|
|
301
|
+
return r != null ? `${r}` : "";
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
return function(
|
|
306
|
-
const
|
|
307
|
-
return
|
|
308
|
-
|
|
309
|
-
|
|
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
310
|
);
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
313
|
function ae(e) {
|
|
314
|
-
const t =
|
|
315
|
-
return function(
|
|
316
|
-
return
|
|
317
|
-
(
|
|
318
|
-
[t(":root",
|
|
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
319
|
// Default theme (root)
|
|
320
320
|
).join(`
|
|
321
321
|
|
|
@@ -323,58 +323,58 @@ function ae(e) {
|
|
|
323
323
|
};
|
|
324
324
|
}
|
|
325
325
|
function le(e) {
|
|
326
|
-
const t =
|
|
327
|
-
return function(
|
|
328
|
-
return t(
|
|
326
|
+
const t = S(e);
|
|
327
|
+
return function(n, u) {
|
|
328
|
+
return t(n.query, n, u);
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
331
|
function fe(e) {
|
|
332
|
-
const t =
|
|
333
|
-
return function(
|
|
334
|
-
const
|
|
335
|
-
return t(
|
|
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
336
|
};
|
|
337
337
|
}
|
|
338
338
|
function me(e) {
|
|
339
|
-
const t =
|
|
340
|
-
return function(
|
|
341
|
-
const
|
|
342
|
-
name:
|
|
343
|
-
value:
|
|
344
|
-
modifiers:
|
|
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
345
|
});
|
|
346
|
-
return
|
|
346
|
+
return a.push(t(s, n, u)), a.join(`
|
|
347
347
|
|
|
348
348
|
`);
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
const
|
|
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
353
|
switch (!0) {
|
|
354
354
|
case Y(e):
|
|
355
|
-
return
|
|
355
|
+
return n(e, t);
|
|
356
356
|
case ee(e):
|
|
357
|
-
return
|
|
357
|
+
return u(e, t);
|
|
358
358
|
case X(e):
|
|
359
|
-
return
|
|
360
|
-
case ne(e):
|
|
361
|
-
return s(e, t);
|
|
359
|
+
return a(e, t);
|
|
362
360
|
case re(e):
|
|
363
|
-
return
|
|
364
|
-
case
|
|
361
|
+
return r(e, t);
|
|
362
|
+
case ne(e):
|
|
365
363
|
return i(e, t);
|
|
366
364
|
case J(e):
|
|
367
|
-
return
|
|
368
|
-
case
|
|
365
|
+
return s(e, t);
|
|
366
|
+
case G(e):
|
|
369
367
|
return o(e, t);
|
|
368
|
+
case te(e):
|
|
369
|
+
return c(e, t);
|
|
370
370
|
default:
|
|
371
371
|
return f(e, t);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function T(e, t) {
|
|
375
375
|
switch (!0) {
|
|
376
376
|
case Array.isArray(e):
|
|
377
|
-
return e.map((
|
|
377
|
+
return e.map((r) => T(r)).join(`
|
|
378
378
|
`);
|
|
379
379
|
// case isRecipe(instance):
|
|
380
380
|
// return consumeRecipe(instance, options);
|
|
@@ -383,50 +383,156 @@ function R(e, t) {
|
|
|
383
383
|
return "";
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
|
|
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 = "") {
|
|
387
488
|
return {
|
|
388
489
|
name: e,
|
|
389
490
|
content: t
|
|
390
491
|
};
|
|
391
492
|
}
|
|
392
|
-
function
|
|
493
|
+
async function Ce(e, {
|
|
393
494
|
type: t = "all",
|
|
394
|
-
consumers:
|
|
495
|
+
consumers: r = { css: p, ts: T }
|
|
395
496
|
} = {}) {
|
|
396
|
-
const
|
|
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;
|
|
397
503
|
if (t === "all" || t === "css") {
|
|
398
|
-
const
|
|
399
|
-
|
|
504
|
+
const s = j("index.css", r.css(i, u));
|
|
505
|
+
n.files.push(s);
|
|
400
506
|
}
|
|
401
507
|
if (t === "all" || t === "ts") {
|
|
402
|
-
const
|
|
403
|
-
|
|
508
|
+
const s = j("index.ts", r.ts([], u));
|
|
509
|
+
n.files.push(s);
|
|
404
510
|
}
|
|
405
|
-
return
|
|
511
|
+
return console.log(n.files), n;
|
|
406
512
|
}
|
|
407
513
|
export {
|
|
408
|
-
|
|
514
|
+
ve as DEFAULT_INDENT,
|
|
409
515
|
N as STATEMENT_AT_RULES,
|
|
410
|
-
|
|
516
|
+
R as STATEMENT_OR_BLOCK_AT_RULES,
|
|
411
517
|
k as addIndentToLine,
|
|
412
|
-
|
|
413
|
-
|
|
518
|
+
p as consumeCSS,
|
|
519
|
+
T as consumeTS,
|
|
414
520
|
Z as createAtRuleConsumer,
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
521
|
+
ue as createCSSTemplateLiteralConsumer,
|
|
522
|
+
S as createContainerConsumer,
|
|
523
|
+
Q as createDeclarationsConsumer,
|
|
524
|
+
j as createFile,
|
|
525
|
+
ie as createPrimitiveConsumer,
|
|
526
|
+
se as createRefConsumer,
|
|
421
527
|
ae as createRootConsumer,
|
|
422
528
|
le as createSelectorConsumer,
|
|
423
529
|
fe as createThemeConsumer,
|
|
424
530
|
me as createUtilityConsumer,
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
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
|
|
432
538
|
};
|
package/dist/transpiler.umd.cjs
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
(function(m,
|
|
2
|
-
`).map(t=>
|
|
3
|
-
`)}function
|
|
1
|
+
(function(m,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(m=typeof globalThis<"u"?globalThis:m||self,T(m.transpiler={}))})(this,(function(m){"use strict";const F=["charset","import","namespace"],O=["layer"],B=({name:e})=>`[data-theme="${e}"]`,R=({name:e,value:t,modifiers:r})=>`._${[...r,e,t].filter(Boolean).join("\\:")}`,v=({name:e})=>e;function Z(e,t){return`@${e}${t?" ":""}${t}`}const W=/\d/,J=["-","_","/","."];function G(e=""){if(!W.test(e))return e!==e.toLowerCase()}function Y(e,t){const r=J,n=[];if(!e||typeof e!="string")return n;let c="",s,i;for(const a of e){const o=r.includes(a);if(o===!0){n.push(c),c="",s=void 0;continue}const u=G(a);if(i===!1){if(s===!1&&u===!0){n.push(c),c=a,s=u;continue}if(s===!0&&u===!1&&c.length>1){const f=c.at(-1);n.push(c.slice(0,Math.max(0,c.length-1))),c=f+a,s=u;continue}}c+=a,s=u,i=o}return n.push(c),n}function X(e,t){return e?(Array.isArray(e)?e:Y(e)).map(r=>r.toLowerCase()).join("-"):""}function L(e){return` ${e}`}function D(e){return e.split(`
|
|
2
|
+
`).map(t=>L(t)).join(`
|
|
3
|
+
`)}function _(e){return X(e)}function x(e){return _(e)}function I(e,t){return`${e.startsWith("--")?e:x(e)}: ${t};`}function ee(e){return`{${e.length>0?`
|
|
4
4
|
`:""}${e.map(t=>`${D(`${t}`)}
|
|
5
|
-
`).join("")}}`}function U(e){return`--${(e.startsWith("--")?e.slice(2):e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g,"-")||"unknown-variable"}`}function te(e,t){return
|
|
5
|
+
`).join("")}}`}function U(e){return`--${(e.startsWith("--")?e.slice(2):e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g,"-")||"unknown-variable"}`}function te(e,t){return I(U(e),t)}function ne(e,t){return`var(${U(e)}${t?`, ${t}`:""})`}function M(e,t){return`${e} ${ee(t)}`}function P(e){return function(r,n){return Object.entries(r).map(([c,s])=>I(c,e(s,n)))}}function j(e){return function(r,n){const s=(n.variables?.name??v)({name:r.name});return te(s,e(r.value,n))}}function S(e){const t=j(e),r=P(e);return function(c,s,i){const{variables:a,declarations:o,children:u}=s,f=c===":root",l=(a??[]).map(g=>t(g,i)),d=r(o??{},i),b=(u??[]).map(g=>e(g,i)),y=l.length>0,A=d.length>0,w=b.length>0;return f?`${y||A?M(c,[...l,...y&&A?[""]:[],...d]):""}${w&&(y||A)?`
|
|
6
6
|
|
|
7
|
-
`:""}${
|
|
7
|
+
`:""}${b.join(`
|
|
8
8
|
|
|
9
|
-
`)}`:
|
|
9
|
+
`)}`:M(c,[...l,...y&&(w||A)?[""]:[],...d,...A&&w?[""]:[],...b.flatMap((g,ve)=>ve===b.length-1?[g]:[g,""])])}}function $(e){const t=S(e);return function(n,c){const s=F.includes(n.identifier),i=O.includes(n.identifier),a=Object.keys(n.declarations).length>0,o=n.variables.length>0,u=n.children.length>0,f=Z(n.identifier,n.rule);return s||i&&!(a||o||u)?`${f};`:t(f,n,c)}}function re(e){return typeof e=="object"&&e!==null}function p(e,t){return re(e)&&"type"in e&&e.type===t}function oe(e){return p(e,"variable")}function ue(e){return p(e,"reference")}function ce(e){return p(e,"selector")}function ie(e){return p(e,"at-rule")}function ae(e){return p(e,"utility")}function se(e){return p(e,"css")}function le(e){return p(e,"theme")}function fe(e){return p(e,"root")}function C(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 me(e){if(e=e||{},e.circular)return de(e);const t=new Map;if(t.set(Date,i=>new Date(i)),t.set(Map,(i,a)=>new Map(n(Array.from(i),a))),t.set(Set,(i,a)=>new Set(n(Array.from(i),a))),e.constructorHandlers)for(const i of e.constructorHandlers)t.set(i[0],i[1]);let r;return e.proto?s:c;function n(i,a){const o=Object.keys(i),u=Array.from({length:o.length});for(let f=0;f<o.length;f++){const l=o[f],d=i[l];typeof d!="object"||d===null?u[l]=d:d.constructor!==Object&&(r=t.get(d.constructor))?u[l]=r(d,a):ArrayBuffer.isView(d)?u[l]=C(d):u[l]=a(d)}return u}function c(i){if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return n(i,c);if(i.constructor!==Object&&(r=t.get(i.constructor)))return r(i,c);const a={};for(const o in i){if(Object.hasOwnProperty.call(i,o)===!1)continue;const u=i[o];typeof u!="object"||u===null?a[o]=u:u.constructor!==Object&&(r=t.get(u.constructor))?a[o]=r(u,c):ArrayBuffer.isView(u)?a[o]=C(u):a[o]=c(u)}return a}function s(i){if(typeof i!="object"||i===null)return i;if(Array.isArray(i))return n(i,s);if(i.constructor!==Object&&(r=t.get(i.constructor)))return r(i,s);const a={};for(const o in i){const u=i[o];typeof u!="object"||u===null?a[o]=u:u.constructor!==Object&&(r=t.get(u.constructor))?a[o]=r(u,s):ArrayBuffer.isView(u)?a[o]=C(u):a[o]=s(u)}return a}}function de(e){const t=[],r=[],n=new Map;if(n.set(Date,o=>new Date(o)),n.set(Map,(o,u)=>new Map(s(Array.from(o),u))),n.set(Set,(o,u)=>new Set(s(Array.from(o),u))),e.constructorHandlers)for(const o of e.constructorHandlers)n.set(o[0],o[1]);let c;return e.proto?a:i;function s(o,u){const f=Object.keys(o),l=Array.from({length:f.length});for(let d=0;d<f.length;d++){const b=f[d],y=o[b];if(typeof y!="object"||y===null)l[b]=y;else if(y.constructor!==Object&&(c=n.get(y.constructor)))l[b]=c(y,u);else if(ArrayBuffer.isView(y))l[b]=C(y);else{const A=t.indexOf(y);A!==-1?l[b]=r[A]:l[b]=u(y)}}return l}function i(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return s(o,i);if(o.constructor!==Object&&(c=n.get(o.constructor)))return c(o,i);const u={};t.push(o),r.push(u);for(const f in o){if(Object.hasOwnProperty.call(o,f)===!1)continue;const l=o[f];if(typeof l!="object"||l===null)u[f]=l;else if(l.constructor!==Object&&(c=n.get(l.constructor)))u[f]=c(l,i);else if(ArrayBuffer.isView(l))u[f]=C(l);else{const d=t.indexOf(l);d!==-1?u[f]=r[d]:u[f]=i(l)}}return t.pop(),r.pop(),u}function a(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return s(o,a);if(o.constructor!==Object&&(c=n.get(o.constructor)))return c(o,a);const u={};t.push(o),r.push(u);for(const f in o){const l=o[f];if(typeof l!="object"||l===null)u[f]=l;else if(l.constructor!==Object&&(c=n.get(l.constructor)))u[f]=c(l,a);else if(ArrayBuffer.isView(l))u[f]=C(l);else{const d=t.indexOf(l);d!==-1?u[f]=r[d]:u[f]=a(l)}}return t.pop(),r.pop(),u}}me();function k(e){return function(r,n){return r.value.map(c=>e(c,n)).join("").trim()}}function V(e){return function(r,n){return r!=null?`${r}`:""}}function K(e){return function(r,n){const s=(n.variables?.name??v)({name:r.name});return ne(s,r.fallback?e(r.fallback,n):void 0)}}function q(e){const t=S(e);return function(n,c){return n.themes.reduce((s,i)=>(s.push(e(i,c)),s),[t(":root",n,c)]).join(`
|
|
10
10
|
|
|
11
|
-
`)}}function
|
|
11
|
+
`)}}function z(e){const t=S(e);return function(n,c){return t(n.query,n,c)}}function H(e){const t=S(e);return function(n,c){const i=(c.theme?.selector??B)({name:n.name});return t(i,n,c)}}function Q(e){const t=S(e);return function(n,c){const s=[],a=(c.utilities?.selector??R)({name:n.name,value:n.value,modifiers:n.modifiers});return s.push(t(a,n,c)),s.join(`
|
|
12
12
|
|
|
13
|
-
`)}}function h(e,t){const
|
|
14
|
-
`);default:return""}}
|
|
13
|
+
`)}}function h(e,t){const r=q(h),n=z(h),c=Q(h),s=$(h),i=H(h),a=j(h),o=K(h),u=k(h),f=V();switch(!0){case ce(e):return n(e,t);case ae(e):return c(e,t);case ie(e):return s(e,t);case fe(e):return r(e,t);case le(e):return i(e,t);case oe(e):return a(e,t);case ue(e):return o(e,t);case se(e):return u(e,t);default:return f(e,t)}}function E(e,t){switch(!0){case Array.isArray(e):return e.map(r=>E(r)).join(`
|
|
14
|
+
`);default:return""}}const ye=`-----BEGIN PUBLIC KEY-----
|
|
15
|
+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7zAFssgxOMPeo80iig4
|
|
16
|
+
qSSshgNOLnW1gd4tPUrsezndaUrAKlsAys6XD8kuF+bBEIR0uFNSgKlqINLjWM1n
|
|
17
|
+
BiTUzCctodyRaq6/tyFSoPLD35iblkwtfxKPM42lAJZsyTu9qoBr8MJyXmhDLuqA
|
|
18
|
+
dQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj
|
|
19
|
+
hC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn
|
|
20
|
+
4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+
|
|
21
|
+
GwIDAQAB
|
|
22
|
+
-----END PUBLIC KEY-----`,be="__licenseRequired",he="__licenseValidated";async function pe(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 Ae({payload:e,signature:t}){const r=new TextEncoder().encode(e),n=Uint8Array.from(atob(t),s=>s.charCodeAt(0)),c=await pe(ye);if(!await crypto.subtle.verify({name:"RSASSA-PKCS1-v1_5"},c,n,r))throw new Error("License validation failed: Invalid signature detected. The license may have been modified or corrupted.");return JSON.parse(e)}function Se(e){return Object.prototype.hasOwnProperty.call(e,be)}async function Ce(e){const t=Object.getOwnPropertyDescriptor(e,he);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 Ae(r)}catch{return{key:"",instanceId:"",environment:"",valid:!1}}}function ge(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 N(e,t=""){return{name:e,content:t}}async function Te(e,{type:t="all",consumers:r={css:h,ts:E}}={}){const n={files:[]},c=e.options;if(Se(e)){const a=await Ce(e);(!a.valid||a.instanceId!==e.id)&&ge(e)}const{recipes:s,...i}=e.root;if(t==="all"||t==="css"){const a=N("index.css",r.css(i,c));n.files.push(a)}if(t==="all"||t==="ts"){const a=N("index.ts",r.ts([],c));n.files.push(a)}return console.log(n.files),n}m.DEFAULT_INDENT=" ",m.STATEMENT_AT_RULES=F,m.STATEMENT_OR_BLOCK_AT_RULES=O,m.addIndentToLine=L,m.consumeCSS=h,m.consumeTS=E,m.createAtRuleConsumer=$,m.createCSSTemplateLiteralConsumer=k,m.createContainerConsumer=S,m.createDeclarationsConsumer=P,m.createFile=N,m.createPrimitiveConsumer=V,m.createRefConsumer=K,m.createRootConsumer=q,m.createSelectorConsumer=z,m.createThemeConsumer=H,m.createUtilityConsumer=Q,m.createVariableConsumer=j,m.defaultThemeSelectorFn=B,m.defaultUtilitySelectorFn=R,m.defaultVariableNameFn=v,m.indentLines=D,m.toKebabCase=_,m.transpile=Te,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@styleframe/transpiler",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/transpiler.d.ts",
|
|
6
6
|
"module": "./dist/transpiler.js",
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"README.md"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@styleframe/license": "^1.1.0",
|
|
22
23
|
"scule": "^1.3.0",
|
|
23
|
-
"@styleframe/core": "^1.0
|
|
24
|
+
"@styleframe/core": "^1.1.0"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@vitest/coverage-v8": "^3.2.4",
|
|
@@ -28,8 +29,8 @@
|
|
|
28
29
|
"vite": "^7.0.6",
|
|
29
30
|
"vite-plugin-dts": "^4.5.4",
|
|
30
31
|
"vitest": "^3.2.4",
|
|
31
|
-
"@styleframe/config-typescript": "^1.0
|
|
32
|
-
"@styleframe/config-vite": "^1.0
|
|
32
|
+
"@styleframe/config-typescript": "^1.1.0",
|
|
33
|
+
"@styleframe/config-vite": "^1.1.0"
|
|
33
34
|
},
|
|
34
35
|
"homepage": "https://github.com/styleframe-dev/styleframe#readme",
|
|
35
36
|
"bugs": {
|