@salty-css/core 0.0.1-alpha.300 → 0.0.1-alpha.301
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/.saltyrc.schema.json +1 -1
- package/bin/index.cjs +3 -1
- package/bin/index.js +2 -2
- package/bin/main.cjs +445 -11
- package/bin/main.js +405 -224
- package/cache/resolve-dynamic-config-cache.cjs +13 -1
- package/cache/resolve-dynamic-config-cache.js +10 -8
- package/compiler/index.cjs +774 -1
- package/compiler/index.d.ts +3 -0
- package/compiler/index.js +754 -20
- package/config/index.cjs +16 -1
- package/config/index.js +14 -12
- package/css/index.cjs +12 -1
- package/css/index.js +10 -10
- package/css/keyframes.cjs +49 -1
- package/css/keyframes.js +44 -34
- package/css/media.cjs +93 -1
- package/css/media.js +54 -49
- package/css/merge.cjs +15 -1
- package/css/merge.js +13 -3
- package/css/token.cjs +4 -1
- package/css/token.js +2 -2
- package/dash-case-Cz8wwE9a.cjs +32 -0
- package/dash-case-NMk0mXyT.js +33 -0
- package/define-templates-CVhhgPnd.js +60 -0
- package/define-templates-Deq1aCbN.cjs +59 -0
- package/factories/index.cjs +37 -1
- package/factories/index.js +27 -20
- package/generators/index.cjs +121 -1
- package/generators/index.js +82 -49
- package/helpers/index.cjs +53 -1
- package/helpers/index.js +40 -1170
- package/helpers-DM2fbDDz.js +18 -0
- package/helpers-wv74jTRI.cjs +18 -0
- package/index-ByR0nfaf.cjs +4 -0
- package/index-DKz1QXqs.js +4 -0
- package/package.json +1 -1
- package/parse-styles-CqBQc3eQ.js +232 -0
- package/parse-styles-D-p_guRO.cjs +231 -0
- package/parsers/index.cjs +57 -2
- package/parsers/index.js +55 -30
- package/pascal-case-By_l58S-.cjs +7 -0
- package/pascal-case-F3Usi5Wf.js +8 -0
- package/{react-styled-file-CGVf5n1B.js → react-styled-file-B99mwk0w.js} +2 -2
- package/react-styled-file-U02jek-B.cjs +11 -0
- package/react-vanilla-file-Bj6XC8GS.cjs +18 -0
- package/{react-vanilla-file-CCXbsjIb.js → react-vanilla-file-D9px70iK.js} +2 -2
- package/salty.config-DjosWdPw.js +4 -0
- package/salty.config-cqavVm2t.cjs +4 -0
- package/server/index.cjs +4 -1
- package/server/index.js +2 -2
- package/should-restart-5jI-bzz0.js +18 -0
- package/should-restart-DoaGoD5T.cjs +17 -0
- package/util/index.cjs +13 -1
- package/util/index.js +10 -8
- package/viewport-clamp-CEmzmcSj.cjs +10 -0
- package/viewport-clamp-K553uXu3.js +11 -0
- package/dash-case-BJEkFEGQ.cjs +0 -1
- package/dash-case-DBThphLm.js +0 -19
- package/define-templates-4A2yHcMF.js +0 -52
- package/define-templates-Cunsb_Tr.cjs +0 -1
- package/helpers-CC5pFyba.cjs +0 -1
- package/helpers-nHqH4L9L.js +0 -11
- package/index-84Wroia-.cjs +0 -1
- package/index-CituHO0U.js +0 -524
- package/index-D_732b92.js +0 -4
- package/index-ol1Q_xul.cjs +0 -41
- package/parse-styles-B1E0JeC7.cjs +0 -5
- package/parse-styles-y_-drahL.js +0 -161
- package/pascal-case-BQpR5PdN.js +0 -6
- package/pascal-case-iWoaJWwT.cjs +0 -1
- package/react-styled-file-Dkubsz-U.cjs +0 -8
- package/react-vanilla-file-CG_WJLam.cjs +0 -15
- package/salty.config-BhBY_oOk.js +0 -10
- package/salty.config-Dk6ZcCxI.cjs +0 -7
- package/should-restart-C6VJ-qaY.js +0 -12
- package/should-restart-DAhvRrtu.cjs +0 -1
- package/viewport-clamp-CaYwREKc.js +0 -7
- package/viewport-clamp-mq_DFtRR.cjs +0 -1
package/parse-styles-y_-drahL.js
DELETED
@@ -1,161 +0,0 @@
|
|
1
|
-
import { d as S } from "./dash-case-DBThphLm.js";
|
2
|
-
import { d as I } from "./viewport-clamp-CaYwREKc.js";
|
3
|
-
const N = (o) => (s) => {
|
4
|
-
if (typeof s != "string" || !o) return;
|
5
|
-
let t = s;
|
6
|
-
const u = [];
|
7
|
-
return Object.values(o).forEach((e) => {
|
8
|
-
const { pattern: l, transform: f } = e;
|
9
|
-
t = t.replace(l, (C) => {
|
10
|
-
const { value: V, css: P } = f(C);
|
11
|
-
return P && u.push(P), V;
|
12
|
-
});
|
13
|
-
}), { transformed: t, additionalCss: u };
|
14
|
-
}, A = (o) => (s) => typeof s != "string" || !/\{[^{}]+\}/g.test(s) ? void 0 : { transformed: s.replace(/\{([^{}]+)\}/g, (...e) => {
|
15
|
-
const l = S(e[1].replaceAll(".", "-"));
|
16
|
-
return o && !o.includes(l) && console.warn(`Token ${l} might not exist`), l.startsWith("-") ? `-${l}` : `var(--${l})`;
|
17
|
-
}) }, D = A(), M = [
|
18
|
-
"top",
|
19
|
-
"right",
|
20
|
-
"bottom",
|
21
|
-
"left",
|
22
|
-
"min-width",
|
23
|
-
/.*width.*/,
|
24
|
-
/^[^line]*height.*/,
|
25
|
-
// Exclude line-height
|
26
|
-
/padding.*/,
|
27
|
-
/margin.*/,
|
28
|
-
/border.*/,
|
29
|
-
/inset.*/,
|
30
|
-
/.*radius.*/,
|
31
|
-
/.*spacing.*/,
|
32
|
-
/.*gap.*/,
|
33
|
-
/.*indent.*/,
|
34
|
-
/.*offset.*/,
|
35
|
-
/.*size.*/,
|
36
|
-
/.*thickness.*/,
|
37
|
-
/.*font-size.*/
|
38
|
-
], Q = (o, s, t) => {
|
39
|
-
if (M.some((e) => typeof e == "string" ? e === o : e.test(o))) {
|
40
|
-
const e = (t == null ? void 0 : t.defaultUnit) || "px";
|
41
|
-
if (e.startsWith("viewport-clamp:"))
|
42
|
-
try {
|
43
|
-
const f = e.split(":")[1];
|
44
|
-
return I({
|
45
|
-
screenSize: parseInt(f)
|
46
|
-
})(Number(s));
|
47
|
-
} catch (f) {
|
48
|
-
throw console.error(f), new Error(`Invalid viewport-clamp value: ${e}`);
|
49
|
-
}
|
50
|
-
return `${s}${e}`;
|
51
|
-
}
|
52
|
-
return `${s}`;
|
53
|
-
}, _ = ["Webkit", "Moz", "ms", "O"], q = (o) => o.startsWith("-") ? o : _.some((s) => o.startsWith(s)) ? `-${S(o)}` : S(o), v = async (o, s = "", t, u = !1) => {
|
54
|
-
if (!o) throw new Error("No styles provided to parseStyles function!");
|
55
|
-
const e = /* @__PURE__ */ new Set(), l = Object.entries(o), f = async ([h, r]) => {
|
56
|
-
var x;
|
57
|
-
const n = h.trim().replace(/^\?+/g, ""), E = q(n), $ = (a, d = ";") => `${E}:${a}${d}`, j = { scope: s, config: t };
|
58
|
-
if (typeof r == "function") return f([h, r(j)]);
|
59
|
-
if (r instanceof Promise) return f([h, await r]);
|
60
|
-
if (t != null && t.templates && t.templatePaths[n])
|
61
|
-
try {
|
62
|
-
const [a, d] = t.templatePaths[n].split(";;"), i = await import(
|
63
|
-
/* webpackIgnore: true */
|
64
|
-
/* @vite-ignore */
|
65
|
-
d
|
66
|
-
), c = d.includes("salty.config"), p = c ? i[a].templates : i[a], w = c ? p[n] : p.params[n];
|
67
|
-
if (p && typeof w == "function") {
|
68
|
-
const y = await w(r), [m] = await v(y, "");
|
69
|
-
return m;
|
70
|
-
}
|
71
|
-
} catch (a) {
|
72
|
-
console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`, a);
|
73
|
-
return;
|
74
|
-
}
|
75
|
-
if (t != null && t.templates && t.templates[n]) {
|
76
|
-
if (u) return;
|
77
|
-
const d = r.split(".").reduce((i, c) => i[c], t.templates[n]);
|
78
|
-
if (d) {
|
79
|
-
const [i] = await v(d, "");
|
80
|
-
return i;
|
81
|
-
}
|
82
|
-
console.warn(`Template "${n}" with path of "${r}" was not found in config!`);
|
83
|
-
return;
|
84
|
-
}
|
85
|
-
if (typeof r == "object") {
|
86
|
-
if (!r) return;
|
87
|
-
if (r.isColor) return $(r.toString());
|
88
|
-
if (n === "defaultVariants") return;
|
89
|
-
if (n === "variants") {
|
90
|
-
const i = Object.entries(r);
|
91
|
-
for (const [c, p] of i) {
|
92
|
-
if (!p) continue;
|
93
|
-
const w = Object.entries(p);
|
94
|
-
for (const [y, m] of w) {
|
95
|
-
if (!m) continue;
|
96
|
-
const b = `${s}.${c}-${y}`;
|
97
|
-
(await v(m, b, t)).forEach((U) => e.add(U));
|
98
|
-
}
|
99
|
-
}
|
100
|
-
return;
|
101
|
-
}
|
102
|
-
if (n === "compoundVariants") {
|
103
|
-
for (const i of r) {
|
104
|
-
const { css: c, ...p } = i, w = Object.entries(p).reduce((m, [b, O]) => `${m}.${b}-${O}`, s);
|
105
|
-
(await v(c, w, t)).forEach((m) => e.add(m));
|
106
|
-
}
|
107
|
-
return;
|
108
|
-
}
|
109
|
-
if (n === "anyOfVariants") {
|
110
|
-
for (const i of r) {
|
111
|
-
const { css: c, ...p } = i, w = Object.entries(p).map(([b, O]) => `.${b}-${O}`), y = `${s}:where(${w.join(", ")})`;
|
112
|
-
console.log(`Union variant scope: ${y}`), (await v(c, y, t)).forEach((b) => e.add(b));
|
113
|
-
}
|
114
|
-
return;
|
115
|
-
}
|
116
|
-
if (n.startsWith("@")) {
|
117
|
-
const i = ((x = t == null ? void 0 : t.mediaQueries) == null ? void 0 : x[n]) || n, c = await z(r, s, t), p = `${i} { ${c} }`;
|
118
|
-
e.add(p);
|
119
|
-
return;
|
120
|
-
}
|
121
|
-
const a = h.includes("&") ? n.replaceAll("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
|
122
|
-
(await v(r, a, t)).forEach((i) => e.add(i));
|
123
|
-
return;
|
124
|
-
}
|
125
|
-
if (typeof r == "number") {
|
126
|
-
const a = Q(E, r, t);
|
127
|
-
return $(a);
|
128
|
-
}
|
129
|
-
if (typeof r != "string")
|
130
|
-
if ("toString" in r) r = r.toString();
|
131
|
-
else throw new Error(`Invalid value type for property ${E}`);
|
132
|
-
return $(r);
|
133
|
-
}, C = l.map(f), { modifiers: V } = t || {}, P = [A(), N(V)], W = (await Promise.all(C).then((h) => Promise.all(
|
134
|
-
h.map((r) => P.reduce(async (n, E) => {
|
135
|
-
const $ = await n;
|
136
|
-
if (!$) return $;
|
137
|
-
const j = await E($);
|
138
|
-
if (!j) return $;
|
139
|
-
const { transformed: x, additionalCss: a } = j;
|
140
|
-
let d = "";
|
141
|
-
if (a)
|
142
|
-
for (const i of a)
|
143
|
-
d += await z(i, "");
|
144
|
-
return `${d}${x}`;
|
145
|
-
}, Promise.resolve(r)))
|
146
|
-
))).filter((h) => h !== void 0).join(`
|
147
|
-
`);
|
148
|
-
if (!W.trim()) return Array.from(e);
|
149
|
-
const T = s ? `${s} {
|
150
|
-
${W}
|
151
|
-
}` : W;
|
152
|
-
return e.has(T) ? Array.from(e) : [T, ...e];
|
153
|
-
}, z = async (o, s, t, u = !1) => (await v(o, s, t, u)).join(`
|
154
|
-
`);
|
155
|
-
export {
|
156
|
-
D as a,
|
157
|
-
N as b,
|
158
|
-
v as c,
|
159
|
-
A as d,
|
160
|
-
z as p
|
161
|
-
};
|
package/pascal-case-BQpR5PdN.js
DELETED
package/pascal-case-iWoaJWwT.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";function r(e){return e?typeof e!="string"?r(String(e)):e.replace(/\s/g,"-").replace(/[-_]([a-z0-9])/g,a=>a[1].toUpperCase()).replace(/^[a-z]/,a=>a.toUpperCase()):""}exports.pascalCase=r;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`import { styled } from "@salty-css/react/styled";
|
2
|
-
|
3
|
-
export const <%- name %> = styled('<%- tag %>', {
|
4
|
-
<% if(className) { %>className: '<%- className %>',<% } %>
|
5
|
-
base: {
|
6
|
-
// Add your styles here
|
7
|
-
}
|
8
|
-
})`;exports.default=e;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`import { <%- styledComponentName %> } from "./<%- fileName %>.css";
|
2
|
-
|
3
|
-
interface <%- componentName %>Props {
|
4
|
-
text?: string;
|
5
|
-
}
|
6
|
-
|
7
|
-
export const <%- componentName %> = ({ text = 'Lorem ipsum' }: <%- componentName %>Props) => {
|
8
|
-
return (
|
9
|
-
<<%- styledComponentName %>>
|
10
|
-
{text}
|
11
|
-
</<%- styledComponentName %>>
|
12
|
-
);
|
13
|
-
};
|
14
|
-
|
15
|
-
export default <%- componentName %>;`;exports.default=e;
|
package/salty.config-BhBY_oOk.js
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=`import { defineConfig } from '@salty-css/core/config';
|
2
|
-
|
3
|
-
export const config = defineConfig({
|
4
|
-
// Add your custom config here
|
5
|
-
externalModules: ['react', 'react-dom']
|
6
|
-
});
|
7
|
-
`;exports.default=e;
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { readFile as r } from "fs/promises";
|
2
|
-
import { i as e } from "./index-CituHO0U.js";
|
3
|
-
const f = async (t) => {
|
4
|
-
if (!t || t.includes("node_modules") || t.includes("saltygen")) return !1;
|
5
|
-
if (t.includes("salty.config")) return !0;
|
6
|
-
if (!e(t)) return !1;
|
7
|
-
const s = await r(t, "utf-8");
|
8
|
-
return !!(/.+define[A-Z]\w+/.test(s) || /.+keyframes\(.+/.test(s));
|
9
|
-
};
|
10
|
-
export {
|
11
|
-
f as c
|
12
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";const s=require("fs/promises"),r=require("./index-ol1Q_xul.cjs"),i=async t=>{if(!t||t.includes("node_modules")||t.includes("saltygen"))return!1;if(t.includes("salty.config"))return!0;if(!r.isSaltyFile(t))return!1;const e=await s.readFile(t,"utf-8");return!!(/.+define[A-Z]\w+/.test(e)||/.+keyframes\(.+/.test(e))};exports.checkShouldRestart=i;
|
@@ -1,7 +0,0 @@
|
|
1
|
-
const x = (e) => (t, i, a) => {
|
2
|
-
const { screenSize: r, axis: o = "horizontal", minMultiplier: l = 0.5, maxMultiplier: c = 1.5, minMaxUnit: n = "px" } = e, s = Math.round(t / r * 1e4) / 100, m = o === "vertical" ? "vh" : "vw", p = i || Math.round(l * t), u = a || Math.round(c * t);
|
3
|
-
return `clamp(${p}${n}, ${s}${m}, ${u}${n})`;
|
4
|
-
};
|
5
|
-
export {
|
6
|
-
x as d
|
7
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";const M=i=>(t,n,a)=>{const{screenSize:r,axis:o="horizontal",minMultiplier:l=.5,maxMultiplier:c=1.5,minMaxUnit:e="px"}=i,s=Math.round(t/r*1e4)/100,m=o==="vertical"?"vh":"vw",p=n||Math.round(l*t),u=a||Math.round(c*t);return`clamp(${p}${e}, ${s}${m}, ${u}${e})`};exports.defineViewportClamp=M;
|