@salty-css/core 0.0.1-alpha.205 → 0.0.1-alpha.207
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/bin/main.cjs +1 -1
- package/bin/main.js +1 -1
- package/compiler/index.cjs +1 -1
- package/compiler/index.d.ts +1 -1
- package/compiler/index.js +2 -2
- package/css/index.cjs +1 -1
- package/css/index.js +3 -3
- package/css/keyframes.cjs +1 -1
- package/css/keyframes.js +1 -1
- package/css/merge.cjs +1 -1
- package/css/merge.d.ts +2 -3
- package/css/merge.js +1 -1
- package/generators/index.cjs +1 -1
- package/generators/index.js +51 -40
- package/generators/styled-generator.d.ts +1 -1
- package/generators/styles-generator.d.ts +4 -0
- package/index-BZxPdVzL.cjs +38 -0
- package/index-Djy7Z9Ft.js +498 -0
- package/package.json +1 -1
- package/parse-styles-CkaV3OGz.js +126 -0
- package/parse-styles-DKWtadpv.cjs +3 -0
- package/parsers/parse-styles.d.ts +3 -2
- package/parsers/parser-types.d.ts +1 -1
- package/server/index.cjs +1 -1
- package/server/index.js +1 -1
- package/index-BEJWepok.cjs +0 -38
- package/index-BsRtXRDr.js +0 -490
- package/parse-styles-B67L4oyf.cjs +0 -3
- package/parse-styles-DZbuVYRn.js +0 -125
package/parse-styles-DZbuVYRn.js
DELETED
@@ -1,125 +0,0 @@
|
|
1
|
-
import { d as C } from "./dash-case-DBThphLm.js";
|
2
|
-
const U = (n) => (e) => {
|
3
|
-
if (typeof e != "string" || !n) return;
|
4
|
-
let t = e;
|
5
|
-
const i = [];
|
6
|
-
return Object.values(n).forEach((d) => {
|
7
|
-
const { pattern: w, transform: P } = d;
|
8
|
-
t = t.replace(w, (j) => {
|
9
|
-
const { value: T, css: u } = P(j);
|
10
|
-
return u && i.push(u), T;
|
11
|
-
});
|
12
|
-
}), { transformed: t, additionalCss: i };
|
13
|
-
}, k = (n) => (e) => typeof e != "string" || !/\{[^{}]+\}/g.test(e) ? void 0 : { transformed: e.replace(/\{([^{}]+)\}/g, (...d) => `var(--${C(d[1].replaceAll(".", "-"))})`) }, F = k(), A = [
|
14
|
-
"top",
|
15
|
-
"right",
|
16
|
-
"bottom",
|
17
|
-
"left",
|
18
|
-
"min-width",
|
19
|
-
/.*width.*/,
|
20
|
-
/^[^line]*height.*/,
|
21
|
-
// Exclude line-height
|
22
|
-
/padding.*/,
|
23
|
-
/margin.*/,
|
24
|
-
/border.*/,
|
25
|
-
/inset.*/,
|
26
|
-
/.*radius.*/,
|
27
|
-
/.*spacing.*/,
|
28
|
-
/.*gap.*/,
|
29
|
-
/.*indent.*/,
|
30
|
-
/.*offset.*/,
|
31
|
-
/.*size.*/,
|
32
|
-
/.*thickness.*/,
|
33
|
-
/.*font-size.*/
|
34
|
-
], M = (n, e, t) => {
|
35
|
-
if (A.some((d) => typeof d == "string" ? d === n : d.test(n))) {
|
36
|
-
const d = (t == null ? void 0 : t.defaultUnit) || "px";
|
37
|
-
return `${e}${d}`;
|
38
|
-
}
|
39
|
-
return `${e}`;
|
40
|
-
}, Q = ["Webkit", "Moz", "ms", "O"], _ = (n) => n.startsWith("-") ? n : Q.some((e) => n.startsWith(e)) ? `-${C(n)}` : C(n), h = async (n, e = "", t) => {
|
41
|
-
if (!n) throw new Error("No styles provided to parseStyles function!");
|
42
|
-
const i = /* @__PURE__ */ new Set(), w = Object.entries(n).map(async ([y, s]) => {
|
43
|
-
var b;
|
44
|
-
const r = y.trim(), $ = _(r), f = (a, c = ";") => `${$}:${a}${c}`;
|
45
|
-
if (typeof s == "function" && (s = s({ scope: e, config: t })), s instanceof Promise && (s = await s), t != null && t.templates && t.templatePaths[r]) {
|
46
|
-
const { default: a } = await import(t.templatePaths[r]);
|
47
|
-
if (typeof a.params[r] == "function") {
|
48
|
-
const c = await a.params[r](s), [o] = await h(c, "");
|
49
|
-
return o;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
if (t != null && t.templates && t.templates[r]) {
|
53
|
-
const c = s.split(".").reduce((o, p) => o[p], t.templates[r]);
|
54
|
-
if (c) {
|
55
|
-
const [o] = await h(c, "");
|
56
|
-
return o;
|
57
|
-
}
|
58
|
-
console.warn(`Template "${r}" with path of "${s}" was not found in config!`);
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
if (typeof s == "object") {
|
62
|
-
if (!s) return;
|
63
|
-
if (s.isColor) return f(s.toString());
|
64
|
-
if (r === "defaultVariants") return;
|
65
|
-
if (r === "variants") {
|
66
|
-
const o = Object.entries(s);
|
67
|
-
for (const [p, m] of o) {
|
68
|
-
if (!m) return;
|
69
|
-
const x = Object.entries(m);
|
70
|
-
for (const [V, l] of x) {
|
71
|
-
if (!l) return;
|
72
|
-
const O = `${e}.${p}-${V}`;
|
73
|
-
(await h(l, O, t)).forEach((S) => i.add(S));
|
74
|
-
}
|
75
|
-
}
|
76
|
-
return;
|
77
|
-
}
|
78
|
-
if (r === "compoundVariants") {
|
79
|
-
for (const o of s) {
|
80
|
-
const { css: p, ...m } = o, x = Object.entries(m).reduce((l, [O, W]) => `${l}.${O}-${W}`, e);
|
81
|
-
(await h(p, x, t)).forEach((l) => i.add(l));
|
82
|
-
}
|
83
|
-
return;
|
84
|
-
}
|
85
|
-
if (r.startsWith("@")) {
|
86
|
-
const o = ((b = t == null ? void 0 : t.mediaQueries) == null ? void 0 : b[r]) || r, p = await N(s, e, t), m = `${o} { ${p} }`;
|
87
|
-
i.add(m);
|
88
|
-
return;
|
89
|
-
}
|
90
|
-
const a = y.includes("&") ? r.replace("&", e) : r.startsWith(":") ? `${e}${r}` : `${e} ${r}`;
|
91
|
-
(await h(s, a, t)).forEach((o) => i.add(o));
|
92
|
-
return;
|
93
|
-
}
|
94
|
-
if (typeof s == "number") {
|
95
|
-
const a = M($, s, t);
|
96
|
-
return f(a);
|
97
|
-
}
|
98
|
-
if (typeof s != "string")
|
99
|
-
if ("toString" in s) s = s.toString();
|
100
|
-
else throw new Error(`Invalid value type for property ${$}`);
|
101
|
-
return f(s);
|
102
|
-
}), { modifiers: P } = t || {}, j = [k(), U(P)], u = (await Promise.all(w).then((y) => Promise.all(
|
103
|
-
y.map((s) => j.reduce(async (r, $) => {
|
104
|
-
const f = await r;
|
105
|
-
if (!f) return f;
|
106
|
-
const E = await $(f);
|
107
|
-
if (!E) return f;
|
108
|
-
const { transformed: b, additionalCss: a } = E;
|
109
|
-
let c = "";
|
110
|
-
if (a)
|
111
|
-
for (const o of a)
|
112
|
-
c += await N(o, "");
|
113
|
-
return `${c}${b}`;
|
114
|
-
}, Promise.resolve(s)))
|
115
|
-
))).join(`
|
116
|
-
`);
|
117
|
-
if (!u.trim()) return i;
|
118
|
-
const z = e ? `${e} { ${u} }` : u;
|
119
|
-
return i.add(z), i;
|
120
|
-
}, N = async (n, e, t) => [...await h(n, e, t)].join(`
|
121
|
-
`);
|
122
|
-
export {
|
123
|
-
F as a,
|
124
|
-
N as p
|
125
|
-
};
|