@styleframe/loader 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/index.cjs +108 -101
- package/dist/index.js +108 -101
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @styleframe/loader
|
|
2
2
|
|
|
3
|
+
## 2.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#113](https://github.com/styleframe-dev/styleframe/pull/113) [`b73095f`](https://github.com/styleframe-dev/styleframe/commit/b73095f114ef41158ab552e2784500215393b294) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Improve color previews and HMR handling
|
|
8
|
+
- Fix caching configuration in loader to use fsCache and moduleCache options
|
|
9
|
+
- Add HMR refetch handling for .styleframe.css virtual imports
|
|
10
|
+
- Update SwatchCard styling with proper footer alignment and better contrast
|
|
11
|
+
|
|
3
12
|
## 2.4.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
function I$1(e, t) {
|
|
11
11
|
return `@${e}${t ? " " : ""}${t}`;
|
|
12
12
|
}
|
|
13
|
-
const U = /\d/, P$1 = ["-", "_", "/", "."];
|
|
13
|
+
const U$1 = /\d/, P$1 = ["-", "_", "/", "."];
|
|
14
14
|
function M(e = "") {
|
|
15
|
-
if (!U.test(e))
|
|
15
|
+
if (!U$1.test(e))
|
|
16
16
|
return e !== e.toLowerCase();
|
|
17
17
|
}
|
|
18
18
|
function N(e, t) {
|
|
@@ -42,17 +42,17 @@
|
|
|
42
42
|
}
|
|
43
43
|
return n.push(o), n;
|
|
44
44
|
}
|
|
45
|
-
function k(e) {
|
|
45
|
+
function k$1(e) {
|
|
46
46
|
return e ? e[0].toUpperCase() + e.slice(1) : "";
|
|
47
47
|
}
|
|
48
|
-
function V
|
|
48
|
+
function V(e) {
|
|
49
49
|
return e ? e[0].toLowerCase() + e.slice(1) : "";
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return e ? (Array.isArray(e) ? e : N(e)).map((r) => k(r)).join("") : "";
|
|
51
|
+
function K$1(e, t) {
|
|
52
|
+
return e ? (Array.isArray(e) ? e : N(e)).map((r) => k$1(r)).join("") : "";
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
return V
|
|
54
|
+
function q$1(e, t) {
|
|
55
|
+
return V(K$1(e || ""));
|
|
56
56
|
}
|
|
57
57
|
function z$1(e, t) {
|
|
58
58
|
return e ? (Array.isArray(e) ? e : N(e)).map((r) => r.toLowerCase()).join("-") : "";
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
return e === e.toUpperCase();
|
|
70
70
|
}
|
|
71
71
|
function Z$1(e) {
|
|
72
|
-
return
|
|
72
|
+
return q$1(e);
|
|
73
73
|
}
|
|
74
74
|
function W$1(e) {
|
|
75
75
|
return z$1(e);
|
|
@@ -85,14 +85,14 @@
|
|
|
85
85
|
` : ""}${e.map((t) => `${Q$1(`${t}`)}
|
|
86
86
|
`).join("")}}`;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function B(e) {
|
|
89
89
|
return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
|
|
90
90
|
}
|
|
91
91
|
function X$1(e, t) {
|
|
92
|
-
return O(
|
|
92
|
+
return O(B(e), t);
|
|
93
93
|
}
|
|
94
94
|
function ee$1(e, t) {
|
|
95
|
-
return `var(${
|
|
95
|
+
return `var(${B(e)}${t ? `, ${t}` : ""})`;
|
|
96
96
|
}
|
|
97
97
|
function R$1(e, t) {
|
|
98
98
|
return `${e} ${Y$1(t)}`;
|
|
@@ -102,38 +102,38 @@
|
|
|
102
102
|
return Object.entries(r).map(([o, s]) => O(o, e(s, n)));
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function E$1(e) {
|
|
106
106
|
return function(r, n) {
|
|
107
107
|
const s = (n.variables?.name ?? w)({ name: r.name });
|
|
108
108
|
return X$1(s, e(r.value, n));
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
function S$1(e) {
|
|
112
|
-
const t =
|
|
112
|
+
const t = E$1(e), r = te$1(e);
|
|
113
113
|
return function(o, s, u) {
|
|
114
114
|
const { variables: a, declarations: c, children: i } = s, f = o === ":root", l = (a ?? []).map(
|
|
115
115
|
(A2) => t(A2, u)
|
|
116
|
-
),
|
|
116
|
+
), m2 = r(
|
|
117
117
|
c ?? {},
|
|
118
118
|
u
|
|
119
119
|
), y = (i ?? []).map(
|
|
120
120
|
(A2) => e(A2, u)
|
|
121
|
-
),
|
|
122
|
-
return f ? `${
|
|
121
|
+
), p = l.length > 0, b = m2.length > 0, C2 = y.length > 0;
|
|
122
|
+
return f ? `${p || b ? R$1(o, [
|
|
123
123
|
...l,
|
|
124
|
-
...
|
|
125
|
-
...
|
|
126
|
-
]) : ""}${C2 && (
|
|
124
|
+
...p && b ? [""] : [],
|
|
125
|
+
...m2
|
|
126
|
+
]) : ""}${C2 && (p || b) ? `
|
|
127
127
|
|
|
128
128
|
` : ""}${y.join(`
|
|
129
129
|
|
|
130
130
|
`)}` : R$1(o, [
|
|
131
131
|
...l,
|
|
132
|
-
...
|
|
133
|
-
...
|
|
132
|
+
...p && (C2 || b) ? [""] : [],
|
|
133
|
+
...m2,
|
|
134
134
|
...b && C2 ? [""] : [],
|
|
135
135
|
...y.flatMap(
|
|
136
|
-
(A2,
|
|
136
|
+
(A2, _) => _ === y.length - 1 ? [A2] : [A2, ""]
|
|
137
137
|
)
|
|
138
138
|
]);
|
|
139
139
|
};
|
|
@@ -216,8 +216,8 @@
|
|
|
216
216
|
function n(u, a) {
|
|
217
217
|
const c = Object.keys(u), i = Array.from({ length: c.length });
|
|
218
218
|
for (let f = 0; f < c.length; f++) {
|
|
219
|
-
const l = c[f],
|
|
220
|
-
typeof
|
|
219
|
+
const l = c[f], m2 = u[l];
|
|
220
|
+
typeof m2 != "object" || m2 === null ? i[l] = m2 : m2.constructor !== Object && (r = t.get(m2.constructor)) ? i[l] = r(m2, a) : ArrayBuffer.isView(m2) ? i[l] = g(m2) : i[l] = a(m2);
|
|
221
221
|
}
|
|
222
222
|
return i;
|
|
223
223
|
}
|
|
@@ -262,17 +262,17 @@
|
|
|
262
262
|
return e.proto ? a : u;
|
|
263
263
|
function s(c, i) {
|
|
264
264
|
const f = Object.keys(c), l = Array.from({ length: f.length });
|
|
265
|
-
for (let
|
|
266
|
-
const y = f[
|
|
267
|
-
if (typeof
|
|
268
|
-
l[y] =
|
|
269
|
-
else if (
|
|
270
|
-
l[y] = o(
|
|
271
|
-
else if (ArrayBuffer.isView(
|
|
272
|
-
l[y] = g(
|
|
265
|
+
for (let m2 = 0; m2 < f.length; m2++) {
|
|
266
|
+
const y = f[m2], p = c[y];
|
|
267
|
+
if (typeof p != "object" || p === null)
|
|
268
|
+
l[y] = p;
|
|
269
|
+
else if (p.constructor !== Object && (o = n.get(p.constructor)))
|
|
270
|
+
l[y] = o(p, i);
|
|
271
|
+
else if (ArrayBuffer.isView(p))
|
|
272
|
+
l[y] = g(p);
|
|
273
273
|
else {
|
|
274
|
-
const b = t.indexOf(
|
|
275
|
-
b !== -1 ? l[y] = r[b] : l[y] = i(
|
|
274
|
+
const b = t.indexOf(p);
|
|
275
|
+
b !== -1 ? l[y] = r[b] : l[y] = i(p);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
return l;
|
|
@@ -294,8 +294,8 @@
|
|
|
294
294
|
else if (ArrayBuffer.isView(l))
|
|
295
295
|
i[f] = g(l);
|
|
296
296
|
else {
|
|
297
|
-
const
|
|
298
|
-
|
|
297
|
+
const m2 = t.indexOf(l);
|
|
298
|
+
m2 !== -1 ? i[f] = r[m2] : i[f] = u(l);
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
return t.pop(), r.pop(), i;
|
|
@@ -316,8 +316,8 @@
|
|
|
316
316
|
else if (ArrayBuffer.isView(l))
|
|
317
317
|
i[f] = g(l);
|
|
318
318
|
else {
|
|
319
|
-
const
|
|
320
|
-
|
|
319
|
+
const m2 = t.indexOf(l);
|
|
320
|
+
m2 !== -1 ? i[f] = r[m2] : i[f] = a(l);
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
return t.pop(), r.pop(), i;
|
|
@@ -338,7 +338,7 @@
|
|
|
338
338
|
);
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
|
-
function be
|
|
341
|
+
function be(e) {
|
|
342
342
|
const t = S$1(e);
|
|
343
343
|
return function(n, o) {
|
|
344
344
|
return n.themes.reduce(
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
return t(n.query, n, o);
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
|
-
function ge(e) {
|
|
359
|
+
function ge$1(e) {
|
|
360
360
|
const t = S$1(e);
|
|
361
361
|
return function(n, o) {
|
|
362
362
|
const u = (o.themes?.selector ?? D)({ name: n.name });
|
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
};
|
|
378
378
|
}
|
|
379
379
|
function d(e, t) {
|
|
380
|
-
const r = be
|
|
380
|
+
const r = be(d), n = Ae$1(d), o = Se(d), s = re$1(d), u = ge$1(d), a = E$1(d), c = he(d), i = ne$1(d), f = de$1();
|
|
381
381
|
switch (true) {
|
|
382
382
|
case v$1(e):
|
|
383
383
|
return n(e, t);
|
|
@@ -475,7 +475,7 @@ GwIDAQAB
|
|
|
475
475
|
["verify"]
|
|
476
476
|
);
|
|
477
477
|
}
|
|
478
|
-
async function
|
|
478
|
+
async function Be({
|
|
479
479
|
payload: e,
|
|
480
480
|
signature: t
|
|
481
481
|
}) {
|
|
@@ -494,7 +494,7 @@ GwIDAQAB
|
|
|
494
494
|
);
|
|
495
495
|
return JSON.parse(e);
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function Ee(e) {
|
|
498
498
|
return Object.prototype.hasOwnProperty.call(e, we);
|
|
499
499
|
}
|
|
500
500
|
async function Te(e) {
|
|
@@ -518,7 +518,7 @@ GwIDAQAB
|
|
|
518
518
|
valid: false
|
|
519
519
|
};
|
|
520
520
|
try {
|
|
521
|
-
return await
|
|
521
|
+
return await Be(
|
|
522
522
|
r
|
|
523
523
|
);
|
|
524
524
|
} catch {
|
|
@@ -554,7 +554,7 @@ GwIDAQAB
|
|
|
554
554
|
}
|
|
555
555
|
});
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function $(e, t = "") {
|
|
558
558
|
return {
|
|
559
559
|
name: e,
|
|
560
560
|
content: t
|
|
@@ -565,19 +565,19 @@ GwIDAQAB
|
|
|
565
565
|
consumers: r = { css: d, ts: j$1 }
|
|
566
566
|
} = {}) {
|
|
567
567
|
const n = { files: [] }, o = e.options;
|
|
568
|
-
if (
|
|
568
|
+
if (Ee(e)) {
|
|
569
569
|
const s = await Te(e);
|
|
570
570
|
(!s.valid || s.instanceId !== e.id) && _e(e);
|
|
571
571
|
}
|
|
572
572
|
if (t === "all" || t === "css") {
|
|
573
|
-
const s =
|
|
573
|
+
const s = $(
|
|
574
574
|
"index.css",
|
|
575
575
|
r.css(e.root, o)
|
|
576
576
|
);
|
|
577
577
|
n.files.push(s);
|
|
578
578
|
}
|
|
579
579
|
if (t === "all" || t === "ts") {
|
|
580
|
-
const s =
|
|
580
|
+
const s = $(
|
|
581
581
|
"index.ts",
|
|
582
582
|
r.ts(e.root, o)
|
|
583
583
|
);
|
|
@@ -614,38 +614,38 @@ GwIDAQAB
|
|
|
614
614
|
await promises.writeFile(filePath, file.content);
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function K(e) {
|
|
618
618
|
return typeof e == "object" && e !== null;
|
|
619
619
|
}
|
|
620
|
-
function
|
|
621
|
-
return
|
|
620
|
+
function m(e, r) {
|
|
621
|
+
return K(e) && "type" in e && e.type === r;
|
|
622
622
|
}
|
|
623
623
|
function L(e) {
|
|
624
|
-
return
|
|
624
|
+
return m(e, "variable");
|
|
625
625
|
}
|
|
626
626
|
function A(e) {
|
|
627
|
-
return
|
|
627
|
+
return m(e, "reference");
|
|
628
628
|
}
|
|
629
|
-
function
|
|
630
|
-
return
|
|
629
|
+
function ge(e) {
|
|
630
|
+
return m(e, "selector");
|
|
631
631
|
}
|
|
632
632
|
function q(e) {
|
|
633
|
-
return
|
|
633
|
+
return m(e, "modifier");
|
|
634
634
|
}
|
|
635
635
|
function E(e) {
|
|
636
|
-
return
|
|
636
|
+
return m(e, "css");
|
|
637
637
|
}
|
|
638
638
|
function Ae(e) {
|
|
639
|
-
return
|
|
639
|
+
return m(e, "recipe");
|
|
640
640
|
}
|
|
641
641
|
function G(e) {
|
|
642
642
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
643
643
|
}
|
|
644
|
-
function
|
|
645
|
-
return G(e) || A(e) || E(e) || Array.isArray(e) && e.every(
|
|
644
|
+
function U(e) {
|
|
645
|
+
return G(e) || A(e) || E(e) || Array.isArray(e) && e.every(U);
|
|
646
646
|
}
|
|
647
647
|
function I(e) {
|
|
648
|
-
return
|
|
648
|
+
return K(e) && "children" in e && "declarations" in e && "variables" in e;
|
|
649
649
|
}
|
|
650
650
|
function z(e = (r) => r) {
|
|
651
651
|
return (r) => {
|
|
@@ -670,7 +670,7 @@ GwIDAQAB
|
|
|
670
670
|
};
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function S(e, r) {
|
|
674
674
|
return function(t, i, c) {
|
|
675
675
|
const o = {
|
|
676
676
|
type: "at-rule",
|
|
@@ -680,17 +680,17 @@ GwIDAQAB
|
|
|
680
680
|
variables: [],
|
|
681
681
|
children: []
|
|
682
682
|
}, u = v(o, r);
|
|
683
|
-
return typeof c == "function" ? o.declarations = c(u) ?? {} : c && (o.declarations = c),
|
|
683
|
+
return typeof c == "function" ? o.declarations = c(u) ?? {} : c && (o.declarations = c), k(o.declarations, u), e.children.push(o), o;
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
686
|
function Y(e, r) {
|
|
687
|
-
const n =
|
|
687
|
+
const n = S(e, r);
|
|
688
688
|
return function(i, c) {
|
|
689
689
|
return n("media", i, c);
|
|
690
690
|
};
|
|
691
691
|
}
|
|
692
692
|
function Z(e, r) {
|
|
693
|
-
const n =
|
|
693
|
+
const n = S(e, r);
|
|
694
694
|
return function(i, c) {
|
|
695
695
|
return n("keyframes", i, c);
|
|
696
696
|
};
|
|
@@ -717,7 +717,7 @@ GwIDAQAB
|
|
|
717
717
|
variables: [],
|
|
718
718
|
children: []
|
|
719
719
|
}, o = v(c, r);
|
|
720
|
-
return typeof i == "function" ? c.declarations = i(o) ?? {} : I(i) ? (c.variables = i.variables, c.declarations = i.declarations, c.children = i.children) : c.declarations = i,
|
|
720
|
+
return typeof i == "function" ? c.declarations = i(o) ?? {} : I(i) ? (c.variables = i.variables, c.declarations = i.declarations, c.children = i.children) : c.declarations = i, k(c.declarations, o), e.children.push(c), c;
|
|
721
721
|
};
|
|
722
722
|
}
|
|
723
723
|
function X(e, r) {
|
|
@@ -740,7 +740,7 @@ GwIDAQAB
|
|
|
740
740
|
};
|
|
741
741
|
}
|
|
742
742
|
function v(e, r) {
|
|
743
|
-
const n = X(e), t = Q(e, r), i =
|
|
743
|
+
const n = X(e), t = Q(e, r), i = S(e, r), c = Z(r, r), o = Y(e, r), u = J(), s = W();
|
|
744
744
|
return {
|
|
745
745
|
variable: n,
|
|
746
746
|
selector: t,
|
|
@@ -751,11 +751,11 @@ GwIDAQAB
|
|
|
751
751
|
css: s
|
|
752
752
|
};
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function k(e, r) {
|
|
755
755
|
for (const n in e)
|
|
756
756
|
if (n.startsWith("@")) {
|
|
757
757
|
const t = e[n];
|
|
758
|
-
if (typeof t == "object" && t !== null &&
|
|
758
|
+
if (typeof t == "object" && t !== null && !U(t)) {
|
|
759
759
|
const i = n.replace(/^@(\w+).*/, "$1"), c = n.replace(`@${i}`, "").trim();
|
|
760
760
|
r.atRule(i, c, t), delete e[n];
|
|
761
761
|
}
|
|
@@ -840,16 +840,16 @@ GwIDAQAB
|
|
|
840
840
|
function c(s, f) {
|
|
841
841
|
const l = Object.keys(s), a = Array.from({ length: l.length });
|
|
842
842
|
for (let y = 0; y < l.length; y++) {
|
|
843
|
-
const
|
|
843
|
+
const p = l[y], d2 = s[p];
|
|
844
844
|
if (typeof d2 != "object" || d2 === null)
|
|
845
|
-
a[
|
|
845
|
+
a[p] = d2;
|
|
846
846
|
else if (d2.constructor !== Object && (i = t.get(d2.constructor)))
|
|
847
|
-
a[
|
|
847
|
+
a[p] = i(d2, f);
|
|
848
848
|
else if (ArrayBuffer.isView(d2))
|
|
849
|
-
a[
|
|
849
|
+
a[p] = j(d2);
|
|
850
850
|
else {
|
|
851
851
|
const h2 = r.indexOf(d2);
|
|
852
|
-
h2 !== -1 ? a[
|
|
852
|
+
h2 !== -1 ? a[p] = n[h2] : a[p] = f(d2);
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
855
|
return a;
|
|
@@ -945,7 +945,7 @@ GwIDAQAB
|
|
|
945
945
|
declarations: R(t.declarations),
|
|
946
946
|
variables: R(t.variables),
|
|
947
947
|
children: R(t.children)
|
|
948
|
-
}),
|
|
948
|
+
}), k(t.declarations, i);
|
|
949
949
|
return t;
|
|
950
950
|
}
|
|
951
951
|
function ue(e, r) {
|
|
@@ -993,7 +993,7 @@ GwIDAQAB
|
|
|
993
993
|
for (const [l, a] of Object.entries(f)) {
|
|
994
994
|
const y = o.values.find(
|
|
995
995
|
(h2) => h2.key === l && h2.modifiers.length === 0
|
|
996
|
-
),
|
|
996
|
+
), p = {
|
|
997
997
|
type: "utility",
|
|
998
998
|
name: t,
|
|
999
999
|
value: l,
|
|
@@ -1002,32 +1002,32 @@ GwIDAQAB
|
|
|
1002
1002
|
children: [],
|
|
1003
1003
|
modifiers: []
|
|
1004
1004
|
}, d2 = v(
|
|
1005
|
-
|
|
1005
|
+
p,
|
|
1006
1006
|
r
|
|
1007
1007
|
);
|
|
1008
|
-
if (
|
|
1008
|
+
if (p.declarations = i({
|
|
1009
1009
|
...d2,
|
|
1010
1010
|
value: a
|
|
1011
|
-
}) ?? {},
|
|
1011
|
+
}) ?? {}, k(p.declarations, d2), y || (o.values.push({
|
|
1012
1012
|
key: l,
|
|
1013
1013
|
value: a,
|
|
1014
1014
|
modifiers: []
|
|
1015
|
-
}), e.children.push(
|
|
1016
|
-
const h2 = s.map((
|
|
1017
|
-
(
|
|
1018
|
-
)).reduce((
|
|
1015
|
+
}), e.children.push(p)), s && s.length > 0) {
|
|
1016
|
+
const h2 = s.map((g2) => g2.key), H2 = ce(h2).filter((g2) => !o.values.find(
|
|
1017
|
+
(b) => b.key === l && b.modifiers.length === g2.length && b.modifiers.every((w2) => g2.includes(w2))
|
|
1018
|
+
)).reduce((g2, b) => {
|
|
1019
1019
|
const w2 = /* @__PURE__ */ new Map();
|
|
1020
|
-
for (const
|
|
1021
|
-
const
|
|
1022
|
-
(N2) => N2.key.includes(
|
|
1020
|
+
for (const $2 of b) {
|
|
1021
|
+
const V2 = s.find(
|
|
1022
|
+
(N2) => N2.key.includes($2)
|
|
1023
1023
|
);
|
|
1024
|
-
|
|
1024
|
+
V2 && q(V2) && w2.set($2, V2);
|
|
1025
1025
|
}
|
|
1026
1026
|
return o.values.push({
|
|
1027
1027
|
key: l,
|
|
1028
1028
|
value: a,
|
|
1029
|
-
modifiers:
|
|
1030
|
-
}),
|
|
1029
|
+
modifiers: b
|
|
1030
|
+
}), g2.push(fe(p, r, w2)), g2;
|
|
1031
1031
|
}, []);
|
|
1032
1032
|
e.children.push(...H2);
|
|
1033
1033
|
}
|
|
@@ -1057,10 +1057,10 @@ GwIDAQAB
|
|
|
1057
1057
|
type: "recipe",
|
|
1058
1058
|
...t
|
|
1059
1059
|
};
|
|
1060
|
-
return i._runtime =
|
|
1060
|
+
return i._runtime = pe(i, r), me(i, r), r.recipes.push(i), i;
|
|
1061
1061
|
};
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1063
|
+
function C(e, r) {
|
|
1064
1064
|
const n = e.autogenerate(r);
|
|
1065
1065
|
return Object.keys(n)[0] ?? "default";
|
|
1066
1066
|
}
|
|
@@ -1071,21 +1071,25 @@ GwIDAQAB
|
|
|
1071
1071
|
const c = {};
|
|
1072
1072
|
for (const [o, u] of Object.entries(i)) {
|
|
1073
1073
|
const s = T(r, o);
|
|
1074
|
-
s
|
|
1074
|
+
s ? c[o] = C(
|
|
1075
1075
|
s,
|
|
1076
1076
|
u
|
|
1077
|
-
)
|
|
1077
|
+
) : console.warn(
|
|
1078
|
+
`[styleframe] Utility "${o}" not found in registry. Skipping runtime generation for this declaration.`
|
|
1079
|
+
);
|
|
1078
1080
|
}
|
|
1079
1081
|
n[t] = c;
|
|
1080
1082
|
} else if (typeof i == "boolean")
|
|
1081
1083
|
n[t] = i;
|
|
1082
1084
|
else {
|
|
1083
1085
|
const c = T(r, t);
|
|
1084
|
-
c
|
|
1086
|
+
c ? n[t] = C(c, i) : console.warn(
|
|
1087
|
+
`[styleframe] Utility "${t}" not found in registry. Skipping runtime generation for this declaration.`
|
|
1088
|
+
);
|
|
1085
1089
|
}
|
|
1086
1090
|
return n;
|
|
1087
1091
|
}
|
|
1088
|
-
function
|
|
1092
|
+
function pe(e, r) {
|
|
1089
1093
|
const n = {};
|
|
1090
1094
|
if (e.base && (n.base = F(e.base, r)), e.variants) {
|
|
1091
1095
|
const t = {};
|
|
@@ -1130,7 +1134,7 @@ GwIDAQAB
|
|
|
1130
1134
|
const t = r.replace(/[A-Z]/g, (i) => `-${i.toLowerCase()}`);
|
|
1131
1135
|
return e.utilities.find((i) => i.name === t);
|
|
1132
1136
|
}
|
|
1133
|
-
function
|
|
1137
|
+
function me(e, r) {
|
|
1134
1138
|
const n = /* @__PURE__ */ new Map();
|
|
1135
1139
|
if (e.base && x(e.base, n), e.variants)
|
|
1136
1140
|
for (const i of Object.values(e.variants))
|
|
@@ -1173,7 +1177,7 @@ GwIDAQAB
|
|
|
1173
1177
|
}
|
|
1174
1178
|
}
|
|
1175
1179
|
function Re(e) {
|
|
1176
|
-
const r = ne("sf-"), n = ae(), t = { ...e }, i = le(n, n), c = ue(n, n), o = de(n, n), u = ye(n, n), { variable: s, selector: f, atRule: l, keyframes: a, media: y, ref:
|
|
1180
|
+
const r = ne("sf-"), n = ae(), t = { ...e }, i = le(n, n), c = ue(n, n), o = de(n, n), u = ye(n, n), { variable: s, selector: f, atRule: l, keyframes: a, media: y, ref: p, css: d2 } = v(n, n);
|
|
1177
1181
|
return {
|
|
1178
1182
|
id: r,
|
|
1179
1183
|
root: n,
|
|
@@ -1186,7 +1190,7 @@ GwIDAQAB
|
|
|
1186
1190
|
atRule: l,
|
|
1187
1191
|
keyframes: a,
|
|
1188
1192
|
media: y,
|
|
1189
|
-
ref:
|
|
1193
|
+
ref: p,
|
|
1190
1194
|
css: d2,
|
|
1191
1195
|
options: t
|
|
1192
1196
|
};
|
|
@@ -1213,7 +1217,7 @@ GwIDAQAB
|
|
|
1213
1217
|
if (exportName === "default") continue;
|
|
1214
1218
|
if (Ae(exportValue)) {
|
|
1215
1219
|
exportValue._exportName = exportName;
|
|
1216
|
-
} else if (
|
|
1220
|
+
} else if (ge(exportValue)) {
|
|
1217
1221
|
exportValue._exportName = exportName;
|
|
1218
1222
|
}
|
|
1219
1223
|
}
|
|
@@ -1226,7 +1230,10 @@ GwIDAQAB
|
|
|
1226
1230
|
if (!resolvedPath) {
|
|
1227
1231
|
return Re();
|
|
1228
1232
|
}
|
|
1229
|
-
const jiti$1 = jiti.createJiti(path.dirname(resolvedPath), {
|
|
1233
|
+
const jiti$1 = jiti.createJiti(path.dirname(resolvedPath), {
|
|
1234
|
+
fsCache: false,
|
|
1235
|
+
moduleCache: false
|
|
1236
|
+
});
|
|
1230
1237
|
const module2 = await jiti$1.import(resolvedPath);
|
|
1231
1238
|
if (!module2.default) {
|
|
1232
1239
|
throw new Error(
|
package/dist/index.js
CHANGED
|
@@ -12,9 +12,9 @@ const F$1 = ["charset", "import", "namespace"], L$1 = ["layer"], D = ({ name: e
|
|
|
12
12
|
function I$1(e, t) {
|
|
13
13
|
return `@${e}${t ? " " : ""}${t}`;
|
|
14
14
|
}
|
|
15
|
-
const U = /\d/, P$1 = ["-", "_", "/", "."];
|
|
15
|
+
const U$1 = /\d/, P$1 = ["-", "_", "/", "."];
|
|
16
16
|
function M(e = "") {
|
|
17
|
-
if (!U.test(e))
|
|
17
|
+
if (!U$1.test(e))
|
|
18
18
|
return e !== e.toLowerCase();
|
|
19
19
|
}
|
|
20
20
|
function N(e, t) {
|
|
@@ -44,17 +44,17 @@ function N(e, t) {
|
|
|
44
44
|
}
|
|
45
45
|
return n.push(o), n;
|
|
46
46
|
}
|
|
47
|
-
function k(e) {
|
|
47
|
+
function k$1(e) {
|
|
48
48
|
return e ? e[0].toUpperCase() + e.slice(1) : "";
|
|
49
49
|
}
|
|
50
|
-
function V
|
|
50
|
+
function V(e) {
|
|
51
51
|
return e ? e[0].toLowerCase() + e.slice(1) : "";
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
return e ? (Array.isArray(e) ? e : N(e)).map((r) => k(r)).join("") : "";
|
|
53
|
+
function K$1(e, t) {
|
|
54
|
+
return e ? (Array.isArray(e) ? e : N(e)).map((r) => k$1(r)).join("") : "";
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
return V
|
|
56
|
+
function q$1(e, t) {
|
|
57
|
+
return V(K$1(e || ""));
|
|
58
58
|
}
|
|
59
59
|
function z$1(e, t) {
|
|
60
60
|
return e ? (Array.isArray(e) ? e : N(e)).map((r) => r.toLowerCase()).join("-") : "";
|
|
@@ -71,7 +71,7 @@ function J$1(e) {
|
|
|
71
71
|
return e === e.toUpperCase();
|
|
72
72
|
}
|
|
73
73
|
function Z$1(e) {
|
|
74
|
-
return
|
|
74
|
+
return q$1(e);
|
|
75
75
|
}
|
|
76
76
|
function W$1(e) {
|
|
77
77
|
return z$1(e);
|
|
@@ -87,14 +87,14 @@ function Y$1(e) {
|
|
|
87
87
|
` : ""}${e.map((t) => `${Q$1(`${t}`)}
|
|
88
88
|
`).join("")}}`;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function B(e) {
|
|
91
91
|
return `--${(e.startsWith("--") ? e.slice(2) : e).replace(/[^a-zA-Z0-9_\-\u0080-\uFFFF]/g, "-") || "unknown-variable"}`;
|
|
92
92
|
}
|
|
93
93
|
function X$1(e, t) {
|
|
94
|
-
return O(
|
|
94
|
+
return O(B(e), t);
|
|
95
95
|
}
|
|
96
96
|
function ee$1(e, t) {
|
|
97
|
-
return `var(${
|
|
97
|
+
return `var(${B(e)}${t ? `, ${t}` : ""})`;
|
|
98
98
|
}
|
|
99
99
|
function R$1(e, t) {
|
|
100
100
|
return `${e} ${Y$1(t)}`;
|
|
@@ -104,38 +104,38 @@ function te$1(e) {
|
|
|
104
104
|
return Object.entries(r).map(([o, s]) => O(o, e(s, n)));
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function E$1(e) {
|
|
108
108
|
return function(r, n) {
|
|
109
109
|
const s = (n.variables?.name ?? w)({ name: r.name });
|
|
110
110
|
return X$1(s, e(r.value, n));
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
function S$1(e) {
|
|
114
|
-
const t =
|
|
114
|
+
const t = E$1(e), r = te$1(e);
|
|
115
115
|
return function(o, s, u) {
|
|
116
116
|
const { variables: a, declarations: c, children: i } = s, f = o === ":root", l = (a ?? []).map(
|
|
117
117
|
(A2) => t(A2, u)
|
|
118
|
-
),
|
|
118
|
+
), m2 = r(
|
|
119
119
|
c ?? {},
|
|
120
120
|
u
|
|
121
121
|
), y = (i ?? []).map(
|
|
122
122
|
(A2) => e(A2, u)
|
|
123
|
-
),
|
|
124
|
-
return f ? `${
|
|
123
|
+
), p = l.length > 0, b = m2.length > 0, C2 = y.length > 0;
|
|
124
|
+
return f ? `${p || b ? R$1(o, [
|
|
125
125
|
...l,
|
|
126
|
-
...
|
|
127
|
-
...
|
|
128
|
-
]) : ""}${C2 && (
|
|
126
|
+
...p && b ? [""] : [],
|
|
127
|
+
...m2
|
|
128
|
+
]) : ""}${C2 && (p || b) ? `
|
|
129
129
|
|
|
130
130
|
` : ""}${y.join(`
|
|
131
131
|
|
|
132
132
|
`)}` : R$1(o, [
|
|
133
133
|
...l,
|
|
134
|
-
...
|
|
135
|
-
...
|
|
134
|
+
...p && (C2 || b) ? [""] : [],
|
|
135
|
+
...m2,
|
|
136
136
|
...b && C2 ? [""] : [],
|
|
137
137
|
...y.flatMap(
|
|
138
|
-
(A2,
|
|
138
|
+
(A2, _) => _ === y.length - 1 ? [A2] : [A2, ""]
|
|
139
139
|
)
|
|
140
140
|
]);
|
|
141
141
|
};
|
|
@@ -218,8 +218,8 @@ function pe$1(e) {
|
|
|
218
218
|
function n(u, a) {
|
|
219
219
|
const c = Object.keys(u), i = Array.from({ length: c.length });
|
|
220
220
|
for (let f = 0; f < c.length; f++) {
|
|
221
|
-
const l = c[f],
|
|
222
|
-
typeof
|
|
221
|
+
const l = c[f], m2 = u[l];
|
|
222
|
+
typeof m2 != "object" || m2 === null ? i[l] = m2 : m2.constructor !== Object && (r = t.get(m2.constructor)) ? i[l] = r(m2, a) : ArrayBuffer.isView(m2) ? i[l] = g(m2) : i[l] = a(m2);
|
|
223
223
|
}
|
|
224
224
|
return i;
|
|
225
225
|
}
|
|
@@ -264,17 +264,17 @@ function ye$1(e) {
|
|
|
264
264
|
return e.proto ? a : u;
|
|
265
265
|
function s(c, i) {
|
|
266
266
|
const f = Object.keys(c), l = Array.from({ length: f.length });
|
|
267
|
-
for (let
|
|
268
|
-
const y = f[
|
|
269
|
-
if (typeof
|
|
270
|
-
l[y] =
|
|
271
|
-
else if (
|
|
272
|
-
l[y] = o(
|
|
273
|
-
else if (ArrayBuffer.isView(
|
|
274
|
-
l[y] = g(
|
|
267
|
+
for (let m2 = 0; m2 < f.length; m2++) {
|
|
268
|
+
const y = f[m2], p = c[y];
|
|
269
|
+
if (typeof p != "object" || p === null)
|
|
270
|
+
l[y] = p;
|
|
271
|
+
else if (p.constructor !== Object && (o = n.get(p.constructor)))
|
|
272
|
+
l[y] = o(p, i);
|
|
273
|
+
else if (ArrayBuffer.isView(p))
|
|
274
|
+
l[y] = g(p);
|
|
275
275
|
else {
|
|
276
|
-
const b = t.indexOf(
|
|
277
|
-
b !== -1 ? l[y] = r[b] : l[y] = i(
|
|
276
|
+
const b = t.indexOf(p);
|
|
277
|
+
b !== -1 ? l[y] = r[b] : l[y] = i(p);
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
return l;
|
|
@@ -296,8 +296,8 @@ function ye$1(e) {
|
|
|
296
296
|
else if (ArrayBuffer.isView(l))
|
|
297
297
|
i[f] = g(l);
|
|
298
298
|
else {
|
|
299
|
-
const
|
|
300
|
-
|
|
299
|
+
const m2 = t.indexOf(l);
|
|
300
|
+
m2 !== -1 ? i[f] = r[m2] : i[f] = u(l);
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
return t.pop(), r.pop(), i;
|
|
@@ -318,8 +318,8 @@ function ye$1(e) {
|
|
|
318
318
|
else if (ArrayBuffer.isView(l))
|
|
319
319
|
i[f] = g(l);
|
|
320
320
|
else {
|
|
321
|
-
const
|
|
322
|
-
|
|
321
|
+
const m2 = t.indexOf(l);
|
|
322
|
+
m2 !== -1 ? i[f] = r[m2] : i[f] = a(l);
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
return t.pop(), r.pop(), i;
|
|
@@ -340,7 +340,7 @@ function he(e) {
|
|
|
340
340
|
);
|
|
341
341
|
};
|
|
342
342
|
}
|
|
343
|
-
function be
|
|
343
|
+
function be(e) {
|
|
344
344
|
const t = S$1(e);
|
|
345
345
|
return function(n, o) {
|
|
346
346
|
return n.themes.reduce(
|
|
@@ -358,7 +358,7 @@ function Ae$1(e) {
|
|
|
358
358
|
return t(n.query, n, o);
|
|
359
359
|
};
|
|
360
360
|
}
|
|
361
|
-
function ge(e) {
|
|
361
|
+
function ge$1(e) {
|
|
362
362
|
const t = S$1(e);
|
|
363
363
|
return function(n, o) {
|
|
364
364
|
const u = (o.themes?.selector ?? D)({ name: n.name });
|
|
@@ -379,7 +379,7 @@ function Se(e) {
|
|
|
379
379
|
};
|
|
380
380
|
}
|
|
381
381
|
function d(e, t) {
|
|
382
|
-
const r = be
|
|
382
|
+
const r = be(d), n = Ae$1(d), o = Se(d), s = re$1(d), u = ge$1(d), a = E$1(d), c = he(d), i = ne$1(d), f = de$1();
|
|
383
383
|
switch (true) {
|
|
384
384
|
case v$1(e):
|
|
385
385
|
return n(e, t);
|
|
@@ -477,7 +477,7 @@ async function Oe(e) {
|
|
|
477
477
|
["verify"]
|
|
478
478
|
);
|
|
479
479
|
}
|
|
480
|
-
async function
|
|
480
|
+
async function Be({
|
|
481
481
|
payload: e,
|
|
482
482
|
signature: t
|
|
483
483
|
}) {
|
|
@@ -496,7 +496,7 @@ async function Ee({
|
|
|
496
496
|
);
|
|
497
497
|
return JSON.parse(e);
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function Ee(e) {
|
|
500
500
|
return Object.prototype.hasOwnProperty.call(e, we);
|
|
501
501
|
}
|
|
502
502
|
async function Te(e) {
|
|
@@ -520,7 +520,7 @@ async function Te(e) {
|
|
|
520
520
|
valid: false
|
|
521
521
|
};
|
|
522
522
|
try {
|
|
523
|
-
return await
|
|
523
|
+
return await Be(
|
|
524
524
|
r
|
|
525
525
|
);
|
|
526
526
|
} catch {
|
|
@@ -556,7 +556,7 @@ function _e(e) {
|
|
|
556
556
|
}
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function $(e, t = "") {
|
|
560
560
|
return {
|
|
561
561
|
name: e,
|
|
562
562
|
content: t
|
|
@@ -567,19 +567,19 @@ async function Le(e, {
|
|
|
567
567
|
consumers: r = { css: d, ts: j$1 }
|
|
568
568
|
} = {}) {
|
|
569
569
|
const n = { files: [] }, o = e.options;
|
|
570
|
-
if (
|
|
570
|
+
if (Ee(e)) {
|
|
571
571
|
const s = await Te(e);
|
|
572
572
|
(!s.valid || s.instanceId !== e.id) && _e(e);
|
|
573
573
|
}
|
|
574
574
|
if (t === "all" || t === "css") {
|
|
575
|
-
const s =
|
|
575
|
+
const s = $(
|
|
576
576
|
"index.css",
|
|
577
577
|
r.css(e.root, o)
|
|
578
578
|
);
|
|
579
579
|
n.files.push(s);
|
|
580
580
|
}
|
|
581
581
|
if (t === "all" || t === "ts") {
|
|
582
|
-
const s =
|
|
582
|
+
const s = $(
|
|
583
583
|
"index.ts",
|
|
584
584
|
r.ts(e.root, o)
|
|
585
585
|
);
|
|
@@ -616,38 +616,38 @@ async function build(instance, { clean = true, outputDir = "./styleframe", trans
|
|
|
616
616
|
await writeFile(filePath, file.content);
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function K(e) {
|
|
620
620
|
return typeof e == "object" && e !== null;
|
|
621
621
|
}
|
|
622
|
-
function
|
|
623
|
-
return
|
|
622
|
+
function m(e, r) {
|
|
623
|
+
return K(e) && "type" in e && e.type === r;
|
|
624
624
|
}
|
|
625
625
|
function L(e) {
|
|
626
|
-
return
|
|
626
|
+
return m(e, "variable");
|
|
627
627
|
}
|
|
628
628
|
function A(e) {
|
|
629
|
-
return
|
|
629
|
+
return m(e, "reference");
|
|
630
630
|
}
|
|
631
|
-
function
|
|
632
|
-
return
|
|
631
|
+
function ge(e) {
|
|
632
|
+
return m(e, "selector");
|
|
633
633
|
}
|
|
634
634
|
function q(e) {
|
|
635
|
-
return
|
|
635
|
+
return m(e, "modifier");
|
|
636
636
|
}
|
|
637
637
|
function E(e) {
|
|
638
|
-
return
|
|
638
|
+
return m(e, "css");
|
|
639
639
|
}
|
|
640
640
|
function Ae(e) {
|
|
641
|
-
return
|
|
641
|
+
return m(e, "recipe");
|
|
642
642
|
}
|
|
643
643
|
function G(e) {
|
|
644
644
|
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null;
|
|
645
645
|
}
|
|
646
|
-
function
|
|
647
|
-
return G(e) || A(e) || E(e) || Array.isArray(e) && e.every(
|
|
646
|
+
function U(e) {
|
|
647
|
+
return G(e) || A(e) || E(e) || Array.isArray(e) && e.every(U);
|
|
648
648
|
}
|
|
649
649
|
function I(e) {
|
|
650
|
-
return
|
|
650
|
+
return K(e) && "children" in e && "declarations" in e && "variables" in e;
|
|
651
651
|
}
|
|
652
652
|
function z(e = (r) => r) {
|
|
653
653
|
return (r) => {
|
|
@@ -672,7 +672,7 @@ function W(e, r) {
|
|
|
672
672
|
};
|
|
673
673
|
};
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function S(e, r) {
|
|
676
676
|
return function(t, i, c) {
|
|
677
677
|
const o = {
|
|
678
678
|
type: "at-rule",
|
|
@@ -682,17 +682,17 @@ function C(e, r) {
|
|
|
682
682
|
variables: [],
|
|
683
683
|
children: []
|
|
684
684
|
}, u = v(o, r);
|
|
685
|
-
return typeof c == "function" ? o.declarations = c(u) ?? {} : c && (o.declarations = c),
|
|
685
|
+
return typeof c == "function" ? o.declarations = c(u) ?? {} : c && (o.declarations = c), k(o.declarations, u), e.children.push(o), o;
|
|
686
686
|
};
|
|
687
687
|
}
|
|
688
688
|
function Y(e, r) {
|
|
689
|
-
const n =
|
|
689
|
+
const n = S(e, r);
|
|
690
690
|
return function(i, c) {
|
|
691
691
|
return n("media", i, c);
|
|
692
692
|
};
|
|
693
693
|
}
|
|
694
694
|
function Z(e, r) {
|
|
695
|
-
const n =
|
|
695
|
+
const n = S(e, r);
|
|
696
696
|
return function(i, c) {
|
|
697
697
|
return n("keyframes", i, c);
|
|
698
698
|
};
|
|
@@ -719,7 +719,7 @@ function Q(e, r) {
|
|
|
719
719
|
variables: [],
|
|
720
720
|
children: []
|
|
721
721
|
}, o = v(c, r);
|
|
722
|
-
return typeof i == "function" ? c.declarations = i(o) ?? {} : I(i) ? (c.variables = i.variables, c.declarations = i.declarations, c.children = i.children) : c.declarations = i,
|
|
722
|
+
return typeof i == "function" ? c.declarations = i(o) ?? {} : I(i) ? (c.variables = i.variables, c.declarations = i.declarations, c.children = i.children) : c.declarations = i, k(c.declarations, o), e.children.push(c), c;
|
|
723
723
|
};
|
|
724
724
|
}
|
|
725
725
|
function X(e, r) {
|
|
@@ -742,7 +742,7 @@ function X(e, r) {
|
|
|
742
742
|
};
|
|
743
743
|
}
|
|
744
744
|
function v(e, r) {
|
|
745
|
-
const n = X(e), t = Q(e, r), i =
|
|
745
|
+
const n = X(e), t = Q(e, r), i = S(e, r), c = Z(r, r), o = Y(e, r), u = J(), s = W();
|
|
746
746
|
return {
|
|
747
747
|
variable: n,
|
|
748
748
|
selector: t,
|
|
@@ -753,11 +753,11 @@ function v(e, r) {
|
|
|
753
753
|
css: s
|
|
754
754
|
};
|
|
755
755
|
}
|
|
756
|
-
function
|
|
756
|
+
function k(e, r) {
|
|
757
757
|
for (const n in e)
|
|
758
758
|
if (n.startsWith("@")) {
|
|
759
759
|
const t = e[n];
|
|
760
|
-
if (typeof t == "object" && t !== null &&
|
|
760
|
+
if (typeof t == "object" && t !== null && !U(t)) {
|
|
761
761
|
const i = n.replace(/^@(\w+).*/, "$1"), c = n.replace(`@${i}`, "").trim();
|
|
762
762
|
r.atRule(i, c, t), delete e[n];
|
|
763
763
|
}
|
|
@@ -842,16 +842,16 @@ function te(e) {
|
|
|
842
842
|
function c(s, f) {
|
|
843
843
|
const l = Object.keys(s), a = Array.from({ length: l.length });
|
|
844
844
|
for (let y = 0; y < l.length; y++) {
|
|
845
|
-
const
|
|
845
|
+
const p = l[y], d2 = s[p];
|
|
846
846
|
if (typeof d2 != "object" || d2 === null)
|
|
847
|
-
a[
|
|
847
|
+
a[p] = d2;
|
|
848
848
|
else if (d2.constructor !== Object && (i = t.get(d2.constructor)))
|
|
849
|
-
a[
|
|
849
|
+
a[p] = i(d2, f);
|
|
850
850
|
else if (ArrayBuffer.isView(d2))
|
|
851
|
-
a[
|
|
851
|
+
a[p] = j(d2);
|
|
852
852
|
else {
|
|
853
853
|
const h2 = r.indexOf(d2);
|
|
854
|
-
h2 !== -1 ? a[
|
|
854
|
+
h2 !== -1 ? a[p] = n[h2] : a[p] = f(d2);
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
857
|
return a;
|
|
@@ -947,7 +947,7 @@ function fe(e, r, n) {
|
|
|
947
947
|
declarations: R(t.declarations),
|
|
948
948
|
variables: R(t.variables),
|
|
949
949
|
children: R(t.children)
|
|
950
|
-
}),
|
|
950
|
+
}), k(t.declarations, i);
|
|
951
951
|
return t;
|
|
952
952
|
}
|
|
953
953
|
function ue(e, r) {
|
|
@@ -995,7 +995,7 @@ function le(e, r) {
|
|
|
995
995
|
for (const [l, a] of Object.entries(f)) {
|
|
996
996
|
const y = o.values.find(
|
|
997
997
|
(h2) => h2.key === l && h2.modifiers.length === 0
|
|
998
|
-
),
|
|
998
|
+
), p = {
|
|
999
999
|
type: "utility",
|
|
1000
1000
|
name: t,
|
|
1001
1001
|
value: l,
|
|
@@ -1004,32 +1004,32 @@ function le(e, r) {
|
|
|
1004
1004
|
children: [],
|
|
1005
1005
|
modifiers: []
|
|
1006
1006
|
}, d2 = v(
|
|
1007
|
-
|
|
1007
|
+
p,
|
|
1008
1008
|
r
|
|
1009
1009
|
);
|
|
1010
|
-
if (
|
|
1010
|
+
if (p.declarations = i({
|
|
1011
1011
|
...d2,
|
|
1012
1012
|
value: a
|
|
1013
|
-
}) ?? {},
|
|
1013
|
+
}) ?? {}, k(p.declarations, d2), y || (o.values.push({
|
|
1014
1014
|
key: l,
|
|
1015
1015
|
value: a,
|
|
1016
1016
|
modifiers: []
|
|
1017
|
-
}), e.children.push(
|
|
1018
|
-
const h2 = s.map((
|
|
1019
|
-
(
|
|
1020
|
-
)).reduce((
|
|
1017
|
+
}), e.children.push(p)), s && s.length > 0) {
|
|
1018
|
+
const h2 = s.map((g2) => g2.key), H2 = ce(h2).filter((g2) => !o.values.find(
|
|
1019
|
+
(b) => b.key === l && b.modifiers.length === g2.length && b.modifiers.every((w2) => g2.includes(w2))
|
|
1020
|
+
)).reduce((g2, b) => {
|
|
1021
1021
|
const w2 = /* @__PURE__ */ new Map();
|
|
1022
|
-
for (const
|
|
1023
|
-
const
|
|
1024
|
-
(N2) => N2.key.includes(
|
|
1022
|
+
for (const $2 of b) {
|
|
1023
|
+
const V2 = s.find(
|
|
1024
|
+
(N2) => N2.key.includes($2)
|
|
1025
1025
|
);
|
|
1026
|
-
|
|
1026
|
+
V2 && q(V2) && w2.set($2, V2);
|
|
1027
1027
|
}
|
|
1028
1028
|
return o.values.push({
|
|
1029
1029
|
key: l,
|
|
1030
1030
|
value: a,
|
|
1031
|
-
modifiers:
|
|
1032
|
-
}),
|
|
1031
|
+
modifiers: b
|
|
1032
|
+
}), g2.push(fe(p, r, w2)), g2;
|
|
1033
1033
|
}, []);
|
|
1034
1034
|
e.children.push(...H2);
|
|
1035
1035
|
}
|
|
@@ -1059,10 +1059,10 @@ function de(e, r) {
|
|
|
1059
1059
|
type: "recipe",
|
|
1060
1060
|
...t
|
|
1061
1061
|
};
|
|
1062
|
-
return i._runtime =
|
|
1062
|
+
return i._runtime = pe(i, r), me(i, r), r.recipes.push(i), i;
|
|
1063
1063
|
};
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function C(e, r) {
|
|
1066
1066
|
const n = e.autogenerate(r);
|
|
1067
1067
|
return Object.keys(n)[0] ?? "default";
|
|
1068
1068
|
}
|
|
@@ -1073,21 +1073,25 @@ function F(e, r) {
|
|
|
1073
1073
|
const c = {};
|
|
1074
1074
|
for (const [o, u] of Object.entries(i)) {
|
|
1075
1075
|
const s = T(r, o);
|
|
1076
|
-
s
|
|
1076
|
+
s ? c[o] = C(
|
|
1077
1077
|
s,
|
|
1078
1078
|
u
|
|
1079
|
-
)
|
|
1079
|
+
) : console.warn(
|
|
1080
|
+
`[styleframe] Utility "${o}" not found in registry. Skipping runtime generation for this declaration.`
|
|
1081
|
+
);
|
|
1080
1082
|
}
|
|
1081
1083
|
n[t] = c;
|
|
1082
1084
|
} else if (typeof i == "boolean")
|
|
1083
1085
|
n[t] = i;
|
|
1084
1086
|
else {
|
|
1085
1087
|
const c = T(r, t);
|
|
1086
|
-
c
|
|
1088
|
+
c ? n[t] = C(c, i) : console.warn(
|
|
1089
|
+
`[styleframe] Utility "${t}" not found in registry. Skipping runtime generation for this declaration.`
|
|
1090
|
+
);
|
|
1087
1091
|
}
|
|
1088
1092
|
return n;
|
|
1089
1093
|
}
|
|
1090
|
-
function
|
|
1094
|
+
function pe(e, r) {
|
|
1091
1095
|
const n = {};
|
|
1092
1096
|
if (e.base && (n.base = F(e.base, r)), e.variants) {
|
|
1093
1097
|
const t = {};
|
|
@@ -1132,7 +1136,7 @@ function T(e, r) {
|
|
|
1132
1136
|
const t = r.replace(/[A-Z]/g, (i) => `-${i.toLowerCase()}`);
|
|
1133
1137
|
return e.utilities.find((i) => i.name === t);
|
|
1134
1138
|
}
|
|
1135
|
-
function
|
|
1139
|
+
function me(e, r) {
|
|
1136
1140
|
const n = /* @__PURE__ */ new Map();
|
|
1137
1141
|
if (e.base && x(e.base, n), e.variants)
|
|
1138
1142
|
for (const i of Object.values(e.variants))
|
|
@@ -1175,7 +1179,7 @@ function pe(e, r) {
|
|
|
1175
1179
|
}
|
|
1176
1180
|
}
|
|
1177
1181
|
function Re(e) {
|
|
1178
|
-
const r = ne("sf-"), n = ae(), t = { ...e }, i = le(n, n), c = ue(n, n), o = de(n, n), u = ye(n, n), { variable: s, selector: f, atRule: l, keyframes: a, media: y, ref:
|
|
1182
|
+
const r = ne("sf-"), n = ae(), t = { ...e }, i = le(n, n), c = ue(n, n), o = de(n, n), u = ye(n, n), { variable: s, selector: f, atRule: l, keyframes: a, media: y, ref: p, css: d2 } = v(n, n);
|
|
1179
1183
|
return {
|
|
1180
1184
|
id: r,
|
|
1181
1185
|
root: n,
|
|
@@ -1188,7 +1192,7 @@ function Re(e) {
|
|
|
1188
1192
|
atRule: l,
|
|
1189
1193
|
keyframes: a,
|
|
1190
1194
|
media: y,
|
|
1191
|
-
ref:
|
|
1195
|
+
ref: p,
|
|
1192
1196
|
css: d2,
|
|
1193
1197
|
options: t
|
|
1194
1198
|
};
|
|
@@ -1215,7 +1219,7 @@ function trackNamedExports(module) {
|
|
|
1215
1219
|
if (exportName === "default") continue;
|
|
1216
1220
|
if (Ae(exportValue)) {
|
|
1217
1221
|
exportValue._exportName = exportName;
|
|
1218
|
-
} else if (
|
|
1222
|
+
} else if (ge(exportValue)) {
|
|
1219
1223
|
exportValue._exportName = exportName;
|
|
1220
1224
|
}
|
|
1221
1225
|
}
|
|
@@ -1228,7 +1232,10 @@ async function loadConfiguration({
|
|
|
1228
1232
|
if (!resolvedPath) {
|
|
1229
1233
|
return Re();
|
|
1230
1234
|
}
|
|
1231
|
-
const jiti = createJiti(path.dirname(resolvedPath), {
|
|
1235
|
+
const jiti = createJiti(path.dirname(resolvedPath), {
|
|
1236
|
+
fsCache: false,
|
|
1237
|
+
moduleCache: false
|
|
1238
|
+
});
|
|
1232
1239
|
const module = await jiti.import(resolvedPath);
|
|
1233
1240
|
if (!module.default) {
|
|
1234
1241
|
throw new Error(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@styleframe/loader",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@styleframe/core": "^2.6.0",
|
|
27
|
-
"@styleframe/license": "^2.0.
|
|
27
|
+
"@styleframe/license": "^2.0.2",
|
|
28
28
|
"@styleframe/transpiler": "^2.6.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@styleframe/config-typescript": "^2",
|
|
32
32
|
"@styleframe/config-vite": "^2",
|
|
33
33
|
"@styleframe/core": "^2.6.0",
|
|
34
|
-
"@styleframe/license": "^2.0.
|
|
34
|
+
"@styleframe/license": "^2.0.2",
|
|
35
35
|
"@styleframe/transpiler": "^2.6.0",
|
|
36
36
|
"@vitest/coverage-v8": "^3.2.4",
|
|
37
37
|
"tsx": "^4.20.6",
|