@styleframe/transpiler 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/transpiler.js +106 -106
- package/dist/transpiler.umd.cjs +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @styleframe/transpiler
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#68](https://github.com/styleframe-dev/styleframe/pull/68) [`653d1fc`](https://github.com/styleframe-dev/styleframe/commit/653d1fc4e8fb80f8c3371e728ffc962cf1fb1cec) Thanks [@alexgrozav](https://github.com/alexgrozav)! - feat: add support for dot notation in variable names
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#65](https://github.com/styleframe-dev/styleframe/pull/65) [`7d32059`](https://github.com/styleframe-dev/styleframe/commit/7d320590a311ace8882a5a29db3a911c24b53710) Thanks [@alexgrozav](https://github.com/alexgrozav)! - fix: do not generate default keyword for utilities
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`653d1fc`](https://github.com/styleframe-dev/styleframe/commit/653d1fc4e8fb80f8c3371e728ffc962cf1fb1cec)]:
|
|
14
|
+
- @styleframe/core@2.3.0
|
|
15
|
+
|
|
16
|
+
## 2.2.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- [`628e650`](https://github.com/styleframe-dev/styleframe/commit/628e65039bae5e21ab9a66e16037e7e2791f8c8b) Thanks [@alexgrozav](https://github.com/alexgrozav)! - chore: update dependencies
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [[`628e650`](https://github.com/styleframe-dev/styleframe/commit/628e65039bae5e21ab9a66e16037e7e2791f8c8b)]:
|
|
25
|
+
- @styleframe/core@2.2.0
|
|
26
|
+
|
|
3
27
|
## 2.1.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
package/dist/transpiler.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Ce = " ", N = ["charset", "import", "namespace"], R = ["layer"], D = ({ name: e }) => `[data-theme="${e}"]`, I = ({
|
|
2
2
|
name: e,
|
|
3
3
|
value: t,
|
|
4
4
|
modifiers: n
|
|
5
|
-
}) => `._${[...n, e, t].filter(Boolean).join("\\:")}`, w = ({ name: e }) => e;
|
|
5
|
+
}) => `._${[...n, e, ...t === "default" ? [] : [t]].filter(Boolean).join("\\:")}`, w = ({ name: e }) => e.replace(/^\.+|\.+$/g, "").replace(/\.+/g, "--");
|
|
6
6
|
function L(e, t) {
|
|
7
7
|
return `@${e}${t ? " " : ""}${t}`;
|
|
8
8
|
}
|
|
9
|
-
const P = /\d/,
|
|
10
|
-
function
|
|
9
|
+
const P = /\d/, $ = ["-", "_", "/", "."];
|
|
10
|
+
function M(e = "") {
|
|
11
11
|
if (!P.test(e))
|
|
12
12
|
return e !== e.toLowerCase();
|
|
13
13
|
}
|
|
14
14
|
function U(e, t) {
|
|
15
|
-
const n =
|
|
15
|
+
const n = $, r = [];
|
|
16
16
|
if (!e || typeof e != "string")
|
|
17
17
|
return r;
|
|
18
|
-
let
|
|
18
|
+
let u = "", a, i;
|
|
19
19
|
for (const s of e) {
|
|
20
20
|
const o = n.includes(s);
|
|
21
21
|
if (o === !0) {
|
|
22
|
-
r.push(
|
|
22
|
+
r.push(u), u = "", a = void 0;
|
|
23
23
|
continue;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const c = M(s);
|
|
26
26
|
if (i === !1) {
|
|
27
|
-
if (a === !1 &&
|
|
28
|
-
r.push(
|
|
27
|
+
if (a === !1 && c === !0) {
|
|
28
|
+
r.push(u), u = s, a = c;
|
|
29
29
|
continue;
|
|
30
30
|
}
|
|
31
|
-
if (a === !0 &&
|
|
32
|
-
const f =
|
|
33
|
-
r.push(
|
|
31
|
+
if (a === !0 && c === !1 && u.length > 1) {
|
|
32
|
+
const f = u.at(-1);
|
|
33
|
+
r.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 r.push(
|
|
39
|
+
return r.push(u), r;
|
|
40
40
|
}
|
|
41
41
|
function _(e, t) {
|
|
42
42
|
return e ? (Array.isArray(e) ? e : U(e)).map((n) => n.toLowerCase()).join("-") : "";
|
|
@@ -72,12 +72,12 @@ function z(e, t) {
|
|
|
72
72
|
function H(e, t) {
|
|
73
73
|
return `var(${O(e)}${t ? `, ${t}` : ""})`;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function v(e, t) {
|
|
76
76
|
return `${e} ${q(t)}`;
|
|
77
77
|
}
|
|
78
78
|
function Q(e) {
|
|
79
79
|
return function(n, r) {
|
|
80
|
-
return Object.entries(n).map(([
|
|
80
|
+
return Object.entries(n).map(([u, a]) => B(u, e(a, r)));
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
function E(e) {
|
|
@@ -88,41 +88,41 @@ function E(e) {
|
|
|
88
88
|
}
|
|
89
89
|
function S(e) {
|
|
90
90
|
const t = E(e), n = Q(e);
|
|
91
|
-
return function(
|
|
92
|
-
const { variables: s, declarations: o, children:
|
|
91
|
+
return function(u, a, i) {
|
|
92
|
+
const { variables: s, declarations: o, children: c } = a, f = u === ":root", l = (s ?? []).map(
|
|
93
93
|
(A) => t(A, i)
|
|
94
94
|
), m = n(
|
|
95
95
|
o ?? {},
|
|
96
96
|
i
|
|
97
|
-
),
|
|
97
|
+
), p = (c ?? []).map(
|
|
98
98
|
(A) => e(A, i)
|
|
99
|
-
), d = l.length > 0, h = m.length > 0,
|
|
100
|
-
return f ? `${d || h ?
|
|
99
|
+
), d = l.length > 0, h = m.length > 0, C = p.length > 0;
|
|
100
|
+
return f ? `${d || h ? v(u, [
|
|
101
101
|
...l,
|
|
102
102
|
...d && h ? [""] : [],
|
|
103
103
|
...m
|
|
104
|
-
]) : ""}${
|
|
104
|
+
]) : ""}${C && (d || h) ? `
|
|
105
105
|
|
|
106
|
-
` : ""}${
|
|
106
|
+
` : ""}${p.join(`
|
|
107
107
|
|
|
108
|
-
`)}` :
|
|
108
|
+
`)}` : v(u, [
|
|
109
109
|
...l,
|
|
110
|
-
...d && (
|
|
110
|
+
...d && (C || h) ? [""] : [],
|
|
111
111
|
...m,
|
|
112
|
-
...h &&
|
|
113
|
-
...
|
|
114
|
-
(A, F) => F ===
|
|
112
|
+
...h && C ? [""] : [],
|
|
113
|
+
...p.flatMap(
|
|
114
|
+
(A, F) => F === p.length - 1 ? [A] : [A, ""]
|
|
115
115
|
)
|
|
116
116
|
]);
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
function Z(e) {
|
|
120
120
|
const t = S(e);
|
|
121
|
-
return function(r,
|
|
121
|
+
return function(r, u) {
|
|
122
122
|
const a = N.includes(r.identifier), i = R.includes(
|
|
123
123
|
r.identifier
|
|
124
|
-
), s = Object.keys(r.declarations).length > 0, o = r.variables.length > 0,
|
|
125
|
-
return a || i && !(s || o ||
|
|
124
|
+
), s = Object.keys(r.declarations).length > 0, o = r.variables.length > 0, c = r.children.length > 0, f = L(r.identifier, r.rule);
|
|
125
|
+
return a || i && !(s || o || c) ? `${f};` : t(f, r, u);
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
function W(e) {
|
|
@@ -167,7 +167,7 @@ function g(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
172
|
if (t.set(Date, (i) => new Date(i)), t.set(
|
|
173
173
|
Map,
|
|
@@ -179,25 +179,25 @@ function oe(e) {
|
|
|
179
179
|
for (const i of e.constructorHandlers)
|
|
180
180
|
t.set(i[0], i[1]);
|
|
181
181
|
let n;
|
|
182
|
-
return e.proto ? a :
|
|
182
|
+
return e.proto ? a : u;
|
|
183
183
|
function r(i, s) {
|
|
184
|
-
const o = Object.keys(i),
|
|
184
|
+
const o = Object.keys(i), c = Array.from({ length: o.length });
|
|
185
185
|
for (let f = 0; f < o.length; f++) {
|
|
186
186
|
const l = o[f], m = i[l];
|
|
187
|
-
typeof m != "object" || m === null ?
|
|
187
|
+
typeof m != "object" || m === null ? c[l] = m : m.constructor !== Object && (n = t.get(m.constructor)) ? c[l] = n(m, s) : ArrayBuffer.isView(m) ? c[l] = g(m) : c[l] = s(m);
|
|
188
188
|
}
|
|
189
|
-
return
|
|
189
|
+
return c;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function u(i) {
|
|
192
192
|
if (typeof i != "object" || i === null) return i;
|
|
193
|
-
if (Array.isArray(i)) return r(i,
|
|
193
|
+
if (Array.isArray(i)) return r(i, u);
|
|
194
194
|
if (i.constructor !== Object && (n = t.get(i.constructor)))
|
|
195
|
-
return n(i,
|
|
195
|
+
return n(i, u);
|
|
196
196
|
const s = {};
|
|
197
197
|
for (const o in i) {
|
|
198
198
|
if (Object.hasOwnProperty.call(i, o) === !1) continue;
|
|
199
|
-
const
|
|
200
|
-
typeof
|
|
199
|
+
const c = i[o];
|
|
200
|
+
typeof c != "object" || c === null ? s[o] = c : c.constructor !== Object && (n = t.get(c.constructor)) ? s[o] = n(c, u) : ArrayBuffer.isView(c) ? s[o] = g(c) : s[o] = u(c);
|
|
201
201
|
}
|
|
202
202
|
return s;
|
|
203
203
|
}
|
|
@@ -208,38 +208,38 @@ function oe(e) {
|
|
|
208
208
|
return n(i, a);
|
|
209
209
|
const s = {};
|
|
210
210
|
for (const o in i) {
|
|
211
|
-
const
|
|
212
|
-
typeof
|
|
211
|
+
const c = i[o];
|
|
212
|
+
typeof c != "object" || c === null ? s[o] = c : c.constructor !== Object && (n = t.get(c.constructor)) ? s[o] = n(c, a) : ArrayBuffer.isView(c) ? s[o] = g(c) : s[o] = a(c);
|
|
213
213
|
}
|
|
214
214
|
return s;
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function ce(e) {
|
|
218
218
|
const t = [], n = [], r = /* @__PURE__ */ new Map();
|
|
219
219
|
if (r.set(Date, (o) => new Date(o)), r.set(
|
|
220
220
|
Map,
|
|
221
|
-
(o,
|
|
221
|
+
(o, c) => new Map(a(Array.from(o), c))
|
|
222
222
|
), r.set(
|
|
223
223
|
Set,
|
|
224
|
-
(o,
|
|
224
|
+
(o, c) => new Set(a(Array.from(o), c))
|
|
225
225
|
), e.constructorHandlers)
|
|
226
226
|
for (const o of e.constructorHandlers)
|
|
227
227
|
r.set(o[0], o[1]);
|
|
228
|
-
let
|
|
228
|
+
let u;
|
|
229
229
|
return e.proto ? s : i;
|
|
230
|
-
function a(o,
|
|
230
|
+
function a(o, c) {
|
|
231
231
|
const f = Object.keys(o), l = Array.from({ length: f.length });
|
|
232
232
|
for (let m = 0; m < f.length; m++) {
|
|
233
|
-
const
|
|
233
|
+
const p = f[m], d = o[p];
|
|
234
234
|
if (typeof d != "object" || d === null)
|
|
235
|
-
l[
|
|
236
|
-
else if (d.constructor !== Object && (
|
|
237
|
-
l[
|
|
235
|
+
l[p] = d;
|
|
236
|
+
else if (d.constructor !== Object && (u = r.get(d.constructor)))
|
|
237
|
+
l[p] = u(d, c);
|
|
238
238
|
else if (ArrayBuffer.isView(d))
|
|
239
|
-
l[
|
|
239
|
+
l[p] = g(d);
|
|
240
240
|
else {
|
|
241
241
|
const h = t.indexOf(d);
|
|
242
|
-
h !== -1 ? l[
|
|
242
|
+
h !== -1 ? l[p] = n[h] : l[p] = c(d);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
return l;
|
|
@@ -247,53 +247,53 @@ function ue(e) {
|
|
|
247
247
|
function i(o) {
|
|
248
248
|
if (typeof o != "object" || o === null) return o;
|
|
249
249
|
if (Array.isArray(o)) return a(o, i);
|
|
250
|
-
if (o.constructor !== Object && (
|
|
251
|
-
return
|
|
252
|
-
const
|
|
253
|
-
t.push(o), n.push(
|
|
250
|
+
if (o.constructor !== Object && (u = r.get(o.constructor)))
|
|
251
|
+
return u(o, i);
|
|
252
|
+
const c = {};
|
|
253
|
+
t.push(o), n.push(c);
|
|
254
254
|
for (const f in o) {
|
|
255
255
|
if (Object.hasOwnProperty.call(o, f) === !1) continue;
|
|
256
256
|
const l = o[f];
|
|
257
257
|
if (typeof l != "object" || l === null)
|
|
258
|
-
|
|
259
|
-
else if (l.constructor !== Object && (
|
|
260
|
-
|
|
258
|
+
c[f] = l;
|
|
259
|
+
else if (l.constructor !== Object && (u = r.get(l.constructor)))
|
|
260
|
+
c[f] = u(l, i);
|
|
261
261
|
else if (ArrayBuffer.isView(l))
|
|
262
|
-
|
|
262
|
+
c[f] = g(l);
|
|
263
263
|
else {
|
|
264
264
|
const m = t.indexOf(l);
|
|
265
|
-
m !== -1 ?
|
|
265
|
+
m !== -1 ? c[f] = n[m] : c[f] = i(l);
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
return t.pop(), n.pop(),
|
|
268
|
+
return t.pop(), n.pop(), c;
|
|
269
269
|
}
|
|
270
270
|
function s(o) {
|
|
271
271
|
if (typeof o != "object" || o === null) return o;
|
|
272
272
|
if (Array.isArray(o)) return a(o, s);
|
|
273
|
-
if (o.constructor !== Object && (
|
|
274
|
-
return
|
|
275
|
-
const
|
|
276
|
-
t.push(o), n.push(
|
|
273
|
+
if (o.constructor !== Object && (u = r.get(o.constructor)))
|
|
274
|
+
return u(o, s);
|
|
275
|
+
const c = {};
|
|
276
|
+
t.push(o), n.push(c);
|
|
277
277
|
for (const f in o) {
|
|
278
278
|
const l = o[f];
|
|
279
279
|
if (typeof l != "object" || l === null)
|
|
280
|
-
|
|
281
|
-
else if (l.constructor !== Object && (
|
|
282
|
-
|
|
280
|
+
c[f] = l;
|
|
281
|
+
else if (l.constructor !== Object && (u = r.get(l.constructor)))
|
|
282
|
+
c[f] = u(l, s);
|
|
283
283
|
else if (ArrayBuffer.isView(l))
|
|
284
|
-
|
|
284
|
+
c[f] = g(l);
|
|
285
285
|
else {
|
|
286
286
|
const m = t.indexOf(l);
|
|
287
|
-
m !== -1 ?
|
|
287
|
+
m !== -1 ? c[f] = n[m] : c[f] = s(l);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
return t.pop(), n.pop(),
|
|
290
|
+
return t.pop(), n.pop(), c;
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
oe();
|
|
294
|
-
function
|
|
294
|
+
function ue(e) {
|
|
295
295
|
return function(n, r) {
|
|
296
|
-
return n.value.map((
|
|
296
|
+
return n.value.map((u) => e(u, r)).join("").trim();
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
299
|
function ie(e) {
|
|
@@ -312,10 +312,10 @@ function se(e) {
|
|
|
312
312
|
}
|
|
313
313
|
function ae(e) {
|
|
314
314
|
const t = S(e);
|
|
315
|
-
return function(r,
|
|
315
|
+
return function(r, u) {
|
|
316
316
|
return r.themes.reduce(
|
|
317
|
-
(a, i) => (a.push(e(i,
|
|
318
|
-
[t(":root", r,
|
|
317
|
+
(a, i) => (a.push(e(i, u)), a),
|
|
318
|
+
[t(":root", r, u)]
|
|
319
319
|
// Default theme (root)
|
|
320
320
|
).join(`
|
|
321
321
|
|
|
@@ -324,37 +324,37 @@ function ae(e) {
|
|
|
324
324
|
}
|
|
325
325
|
function le(e) {
|
|
326
326
|
const t = S(e);
|
|
327
|
-
return function(r,
|
|
328
|
-
return t(r.query, r,
|
|
327
|
+
return function(r, u) {
|
|
328
|
+
return t(r.query, r, u);
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
331
|
function fe(e) {
|
|
332
332
|
const t = S(e);
|
|
333
|
-
return function(r,
|
|
334
|
-
const i = (
|
|
335
|
-
return t(i, r,
|
|
333
|
+
return function(r, u) {
|
|
334
|
+
const i = (u.theme?.selector ?? D)({ name: r.name });
|
|
335
|
+
return t(i, r, u);
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
function me(e) {
|
|
339
339
|
const t = S(e);
|
|
340
|
-
return function(r,
|
|
341
|
-
const a = [], s = (
|
|
340
|
+
return function(r, u) {
|
|
341
|
+
const a = [], s = (u.utilities?.selector ?? I)({
|
|
342
342
|
name: r.name,
|
|
343
343
|
value: r.value,
|
|
344
344
|
modifiers: r.modifiers
|
|
345
345
|
});
|
|
346
|
-
return a.push(t(s, r,
|
|
346
|
+
return a.push(t(s, r, u)), a.join(`
|
|
347
347
|
|
|
348
348
|
`);
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
const n = ae(
|
|
351
|
+
function y(e, t) {
|
|
352
|
+
const n = ae(y), r = le(y), u = me(y), a = Z(y), i = fe(y), s = E(y), o = se(y), c = ue(y), f = ie();
|
|
353
353
|
switch (!0) {
|
|
354
354
|
case Y(e):
|
|
355
355
|
return r(e, t);
|
|
356
356
|
case ee(e):
|
|
357
|
-
return
|
|
357
|
+
return u(e, t);
|
|
358
358
|
case X(e):
|
|
359
359
|
return a(e, t);
|
|
360
360
|
case re(e):
|
|
@@ -366,7 +366,7 @@ function p(e, t) {
|
|
|
366
366
|
case G(e):
|
|
367
367
|
return o(e, t);
|
|
368
368
|
case te(e):
|
|
369
|
-
return
|
|
369
|
+
return c(e, t);
|
|
370
370
|
default:
|
|
371
371
|
return f(e, t);
|
|
372
372
|
}
|
|
@@ -391,7 +391,7 @@ dQ8di7mQHz+mCy96jQR4lFSDfHMgl27qaAh5VboTBRxgZliN8D5Fl590QkS94wAj
|
|
|
391
391
|
hC7NbH+hPcGc/qIaZSjZfyZeBIZS74qJkrzjEA7/pukROD8UQUrQ512HHZ6XlgMn
|
|
392
392
|
4bWT2K9CpWbbhsKFTecCHuxlmPkFJNMuvAb/LdP08BSnpntlyAJcQeBrna2qBen+
|
|
393
393
|
GwIDAQAB
|
|
394
|
-
-----END PUBLIC KEY-----`,
|
|
394
|
+
-----END PUBLIC KEY-----`, pe = "__licenseRequired", ye = "__licenseValidated";
|
|
395
395
|
async function he(e) {
|
|
396
396
|
const t = e.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s/g, ""), n = Uint8Array.from(atob(t), (r) => r.charCodeAt(0));
|
|
397
397
|
return await crypto.subtle.importKey(
|
|
@@ -412,10 +412,10 @@ async function be({
|
|
|
412
412
|
const n = new TextEncoder().encode(e), r = Uint8Array.from(
|
|
413
413
|
atob(t),
|
|
414
414
|
(a) => a.charCodeAt(0)
|
|
415
|
-
),
|
|
415
|
+
), u = await he(de);
|
|
416
416
|
if (!await crypto.subtle.verify(
|
|
417
417
|
{ name: "RSASSA-PKCS1-v1_5" },
|
|
418
|
-
|
|
418
|
+
u,
|
|
419
419
|
r,
|
|
420
420
|
n
|
|
421
421
|
))
|
|
@@ -425,12 +425,12 @@ async function be({
|
|
|
425
425
|
return JSON.parse(e);
|
|
426
426
|
}
|
|
427
427
|
function Ae(e) {
|
|
428
|
-
return Object.prototype.hasOwnProperty.call(e,
|
|
428
|
+
return Object.prototype.hasOwnProperty.call(e, pe);
|
|
429
429
|
}
|
|
430
430
|
async function ge(e) {
|
|
431
431
|
const t = Object.getOwnPropertyDescriptor(
|
|
432
432
|
e,
|
|
433
|
-
|
|
433
|
+
ye
|
|
434
434
|
);
|
|
435
435
|
if (!t?.value)
|
|
436
436
|
return {
|
|
@@ -490,35 +490,35 @@ function j(e, t = "") {
|
|
|
490
490
|
content: t
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
|
-
async function
|
|
493
|
+
async function ve(e, {
|
|
494
494
|
type: t = "all",
|
|
495
|
-
consumers: n = { css:
|
|
495
|
+
consumers: n = { css: y, ts: T }
|
|
496
496
|
} = {}) {
|
|
497
|
-
const r = { files: [] },
|
|
497
|
+
const r = { files: [] }, u = e.options;
|
|
498
498
|
if (Ae(e)) {
|
|
499
499
|
const s = await ge(e);
|
|
500
500
|
(!s.valid || s.instanceId !== e.id) && Se(e);
|
|
501
501
|
}
|
|
502
502
|
const { recipes: a, ...i } = e.root;
|
|
503
503
|
if (t === "all" || t === "css") {
|
|
504
|
-
const s = j("index.css", n.css(i,
|
|
504
|
+
const s = j("index.css", n.css(i, u));
|
|
505
505
|
r.files.push(s);
|
|
506
506
|
}
|
|
507
507
|
if (t === "all" || t === "ts") {
|
|
508
|
-
const s = j("index.ts", n.ts([],
|
|
508
|
+
const s = j("index.ts", n.ts([], u));
|
|
509
509
|
r.files.push(s);
|
|
510
510
|
}
|
|
511
511
|
return r;
|
|
512
512
|
}
|
|
513
513
|
export {
|
|
514
|
-
|
|
514
|
+
Ce as DEFAULT_INDENT,
|
|
515
515
|
N as STATEMENT_AT_RULES,
|
|
516
516
|
R as STATEMENT_OR_BLOCK_AT_RULES,
|
|
517
517
|
k as addIndentToLine,
|
|
518
|
-
|
|
518
|
+
y as consumeCSS,
|
|
519
519
|
T as consumeTS,
|
|
520
520
|
Z as createAtRuleConsumer,
|
|
521
|
-
|
|
521
|
+
ue as createCSSTemplateLiteralConsumer,
|
|
522
522
|
S as createContainerConsumer,
|
|
523
523
|
Q as createDeclarationsConsumer,
|
|
524
524
|
j as createFile,
|
|
@@ -534,5 +534,5 @@ export {
|
|
|
534
534
|
w as defaultVariableNameFn,
|
|
535
535
|
V as indentLines,
|
|
536
536
|
x as toKebabCase,
|
|
537
|
-
|
|
537
|
+
ve as transpile
|
|
538
538
|
};
|
package/dist/transpiler.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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:n})=>`._${[...n,e
|
|
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:n})=>`._${[...n,e,...t==="default"?[]:[t]].filter(Boolean).join("\\:")}`,v=({name:e})=>e.replace(/^\.+|\.+$/g,"").replace(/\.+/g,"--");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 n=J,r=[];if(!e||typeof e!="string")return r;let c="",s,i;for(const a of e){const o=n.includes(a);if(o===!0){r.push(c),c="",s=void 0;continue}const u=G(a);if(i===!1){if(s===!1&&u===!0){r.push(c),c=a,s=u;continue}if(s===!0&&u===!1&&c.length>1){const f=c.at(-1);r.push(c.slice(0,Math.max(0,c.length-1))),c=f+a,s=u;continue}}c+=a,s=u,i=o}return r.push(c),r}function X(e,t){return e?(Array.isArray(e)?e:Y(e)).map(n=>n.toLowerCase()).join("-"):""}function L(e){return` ${e}`}function D(e){return e.split(`
|
|
2
2
|
`).map(t=>L(t)).join(`
|
|
3
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}`)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@styleframe/transpiler",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/transpiler.d.ts",
|
|
6
6
|
"module": "./dist/transpiler.js",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"scule": "^1.3.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@styleframe/core": "^2.
|
|
25
|
+
"@styleframe/core": "^2.3.0",
|
|
26
26
|
"@styleframe/license": "^2.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@styleframe/config-typescript": "^
|
|
30
|
-
"@styleframe/config-vite": "^
|
|
31
|
-
"@styleframe/core": "^2.
|
|
29
|
+
"@styleframe/config-typescript": "^2",
|
|
30
|
+
"@styleframe/config-vite": "^2",
|
|
31
|
+
"@styleframe/core": "^2.3.0",
|
|
32
32
|
"@styleframe/license": "^2.0.0",
|
|
33
33
|
"@vitest/coverage-v8": "^3.2.4",
|
|
34
34
|
"typescript": "^5.8.3",
|