@salty-css/core 0.0.1-alpha.217 → 0.0.1-alpha.219
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.js +2 -2
- package/css/keyframes.cjs +1 -1
- package/css/keyframes.js +1 -1
- package/generators/index.cjs +1 -1
- package/generators/index.js +1 -1
- package/index-CNuRN2e-.cjs +38 -0
- package/index-ClF7lS_W.js +502 -0
- package/package.json +1 -1
- package/parse-styles-3N79AOBO.cjs +5 -0
- package/parse-styles-Bo7fQ_SV.js +134 -0
- package/server/index.cjs +1 -1
- package/server/index.js +1 -1
- package/index-B6M9WK93.cjs +0 -38
- package/index-B_bv7TCc.js +0 -503
- package/parse-styles-C6OYNcYI.cjs +0 -5
- package/parse-styles-Cc_Ir3PV.js +0 -132
package/parse-styles-Cc_Ir3PV.js
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
import { d as W } from "./dash-case-DBThphLm.js";
|
2
|
-
const U = (o) => (e) => {
|
3
|
-
if (typeof e != "string" || !o) return;
|
4
|
-
let t = e;
|
5
|
-
const p = [];
|
6
|
-
return Object.values(o).forEach((n) => {
|
7
|
-
const { pattern: P, transform: E } = n;
|
8
|
-
t = t.replace(P, (j) => {
|
9
|
-
const { value: x, css: C } = E(j);
|
10
|
-
return C && p.push(C), x;
|
11
|
-
});
|
12
|
-
}), { transformed: t, additionalCss: p };
|
13
|
-
}, k = (o) => (e) => typeof e != "string" || !/\{[^{}]+\}/g.test(e) ? void 0 : { transformed: e.replace(/\{([^{}]+)\}/g, (...n) => `var(--${W(n[1].replaceAll(".", "-"))})`) }, J = k(), M = [
|
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
|
-
], Q = (o, e, t) => {
|
35
|
-
if (M.some((n) => typeof n == "string" ? n === o : n.test(o))) {
|
36
|
-
const n = (t == null ? void 0 : t.defaultUnit) || "px";
|
37
|
-
return `${e}${n}`;
|
38
|
-
}
|
39
|
-
return `${e}`;
|
40
|
-
}, _ = ["Webkit", "Moz", "ms", "O"], q = (o) => o.startsWith("-") ? o : _.some((e) => o.startsWith(e)) ? `-${W(o)}` : W(o), $ = async (o, e = "", t, p = !1) => {
|
41
|
-
if (!o) throw new Error("No styles provided to parseStyles function!");
|
42
|
-
const n = /* @__PURE__ */ new Set(), E = Object.entries(o).map(async ([m, s]) => {
|
43
|
-
var w;
|
44
|
-
const r = m.trim(), y = q(r), u = (a, d = ";") => `${y}:${a}${d}`;
|
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
|
-
try {
|
47
|
-
const [a, d] = t.templatePaths[r].split(";;"), i = await import(d), c = d.includes("salty.config"), f = c ? i[a].templates : i[a], h = c ? f[r] : f.params[r];
|
48
|
-
if (f && typeof h == "function") {
|
49
|
-
const b = await h(s), [l] = await $(b, "");
|
50
|
-
return l;
|
51
|
-
}
|
52
|
-
} catch (a) {
|
53
|
-
console.error(`Error loading template "${r}" from path "${t.templatePaths[r]}"`, a);
|
54
|
-
return;
|
55
|
-
}
|
56
|
-
if (t != null && t.templates && t.templates[r]) {
|
57
|
-
if (p) return;
|
58
|
-
const d = s.split(".").reduce((i, c) => i[c], t.templates[r]);
|
59
|
-
if (d) {
|
60
|
-
const [i] = await $(d, "");
|
61
|
-
return i;
|
62
|
-
}
|
63
|
-
console.warn(`Template "${r}" with path of "${s}" was not found in config!`);
|
64
|
-
return;
|
65
|
-
}
|
66
|
-
if (typeof s == "object") {
|
67
|
-
if (!s) return;
|
68
|
-
if (s.isColor) return u(s.toString());
|
69
|
-
if (r === "defaultVariants") return;
|
70
|
-
if (r === "variants") {
|
71
|
-
const i = Object.entries(s);
|
72
|
-
for (const [c, f] of i) {
|
73
|
-
if (!f) return;
|
74
|
-
const h = Object.entries(f);
|
75
|
-
for (const [b, l] of h) {
|
76
|
-
if (!l) return;
|
77
|
-
const V = `${e}.${c}-${b}`;
|
78
|
-
(await $(l, V, t)).forEach((z) => n.add(z));
|
79
|
-
}
|
80
|
-
}
|
81
|
-
return;
|
82
|
-
}
|
83
|
-
if (r === "compoundVariants") {
|
84
|
-
for (const i of s) {
|
85
|
-
const { css: c, ...f } = i, h = Object.entries(f).reduce((l, [V, N]) => `${l}.${V}-${N}`, e);
|
86
|
-
(await $(c, h, t)).forEach((l) => n.add(l));
|
87
|
-
}
|
88
|
-
return;
|
89
|
-
}
|
90
|
-
if (r.startsWith("@")) {
|
91
|
-
const i = ((w = t == null ? void 0 : t.mediaQueries) == null ? void 0 : w[r]) || r, c = await S(s, e, t), f = `${i} { ${c} }`;
|
92
|
-
n.add(f);
|
93
|
-
return;
|
94
|
-
}
|
95
|
-
const a = m.includes("&") ? r.replace("&", e) : r.startsWith(":") ? `${e}${r}` : `${e} ${r}`;
|
96
|
-
(await $(s, a, t)).forEach((i) => n.add(i));
|
97
|
-
return;
|
98
|
-
}
|
99
|
-
if (typeof s == "number") {
|
100
|
-
const a = Q(y, s, t);
|
101
|
-
return u(a);
|
102
|
-
}
|
103
|
-
if (typeof s != "string")
|
104
|
-
if ("toString" in s) s = s.toString();
|
105
|
-
else throw new Error(`Invalid value type for property ${y}`);
|
106
|
-
return u(s);
|
107
|
-
}), { modifiers: j } = t || {}, x = [k(), U(j)], O = (await Promise.all(E).then((m) => Promise.all(
|
108
|
-
m.map((s) => x.reduce(async (r, y) => {
|
109
|
-
const u = await r;
|
110
|
-
if (!u) return u;
|
111
|
-
const T = await y(u);
|
112
|
-
if (!T) return u;
|
113
|
-
const { transformed: w, additionalCss: a } = T;
|
114
|
-
let d = "";
|
115
|
-
if (a)
|
116
|
-
for (const i of a)
|
117
|
-
d += await S(i, "");
|
118
|
-
return `${d}${w}`;
|
119
|
-
}, Promise.resolve(s)))
|
120
|
-
))).filter((m) => m !== void 0).join(`
|
121
|
-
`);
|
122
|
-
if (!O.trim()) return Array.from(n);
|
123
|
-
const A = e ? `${e} {
|
124
|
-
${O}
|
125
|
-
}` : O;
|
126
|
-
return n.has(A) ? Array.from(n) : [A, ...n];
|
127
|
-
}, S = async (o, e, t, p = !1) => (await $(o, e, t, p)).join(`
|
128
|
-
`);
|
129
|
-
export {
|
130
|
-
J as a,
|
131
|
-
S as p
|
132
|
-
};
|