@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.
Files changed (79) hide show
  1. package/.saltyrc.schema.json +1 -1
  2. package/bin/index.cjs +3 -1
  3. package/bin/index.js +2 -2
  4. package/bin/main.cjs +445 -11
  5. package/bin/main.js +405 -224
  6. package/cache/resolve-dynamic-config-cache.cjs +13 -1
  7. package/cache/resolve-dynamic-config-cache.js +10 -8
  8. package/compiler/index.cjs +774 -1
  9. package/compiler/index.d.ts +3 -0
  10. package/compiler/index.js +754 -20
  11. package/config/index.cjs +16 -1
  12. package/config/index.js +14 -12
  13. package/css/index.cjs +12 -1
  14. package/css/index.js +10 -10
  15. package/css/keyframes.cjs +49 -1
  16. package/css/keyframes.js +44 -34
  17. package/css/media.cjs +93 -1
  18. package/css/media.js +54 -49
  19. package/css/merge.cjs +15 -1
  20. package/css/merge.js +13 -3
  21. package/css/token.cjs +4 -1
  22. package/css/token.js +2 -2
  23. package/dash-case-Cz8wwE9a.cjs +32 -0
  24. package/dash-case-NMk0mXyT.js +33 -0
  25. package/define-templates-CVhhgPnd.js +60 -0
  26. package/define-templates-Deq1aCbN.cjs +59 -0
  27. package/factories/index.cjs +37 -1
  28. package/factories/index.js +27 -20
  29. package/generators/index.cjs +121 -1
  30. package/generators/index.js +82 -49
  31. package/helpers/index.cjs +53 -1
  32. package/helpers/index.js +40 -1170
  33. package/helpers-DM2fbDDz.js +18 -0
  34. package/helpers-wv74jTRI.cjs +18 -0
  35. package/index-ByR0nfaf.cjs +4 -0
  36. package/index-DKz1QXqs.js +4 -0
  37. package/package.json +1 -1
  38. package/parse-styles-CqBQc3eQ.js +232 -0
  39. package/parse-styles-D-p_guRO.cjs +231 -0
  40. package/parsers/index.cjs +57 -2
  41. package/parsers/index.js +55 -30
  42. package/pascal-case-By_l58S-.cjs +7 -0
  43. package/pascal-case-F3Usi5Wf.js +8 -0
  44. package/{react-styled-file-CGVf5n1B.js → react-styled-file-B99mwk0w.js} +2 -2
  45. package/react-styled-file-U02jek-B.cjs +11 -0
  46. package/react-vanilla-file-Bj6XC8GS.cjs +18 -0
  47. package/{react-vanilla-file-CCXbsjIb.js → react-vanilla-file-D9px70iK.js} +2 -2
  48. package/salty.config-DjosWdPw.js +4 -0
  49. package/salty.config-cqavVm2t.cjs +4 -0
  50. package/server/index.cjs +4 -1
  51. package/server/index.js +2 -2
  52. package/should-restart-5jI-bzz0.js +18 -0
  53. package/should-restart-DoaGoD5T.cjs +17 -0
  54. package/util/index.cjs +13 -1
  55. package/util/index.js +10 -8
  56. package/viewport-clamp-CEmzmcSj.cjs +10 -0
  57. package/viewport-clamp-K553uXu3.js +11 -0
  58. package/dash-case-BJEkFEGQ.cjs +0 -1
  59. package/dash-case-DBThphLm.js +0 -19
  60. package/define-templates-4A2yHcMF.js +0 -52
  61. package/define-templates-Cunsb_Tr.cjs +0 -1
  62. package/helpers-CC5pFyba.cjs +0 -1
  63. package/helpers-nHqH4L9L.js +0 -11
  64. package/index-84Wroia-.cjs +0 -1
  65. package/index-CituHO0U.js +0 -524
  66. package/index-D_732b92.js +0 -4
  67. package/index-ol1Q_xul.cjs +0 -41
  68. package/parse-styles-B1E0JeC7.cjs +0 -5
  69. package/parse-styles-y_-drahL.js +0 -161
  70. package/pascal-case-BQpR5PdN.js +0 -6
  71. package/pascal-case-iWoaJWwT.cjs +0 -1
  72. package/react-styled-file-Dkubsz-U.cjs +0 -8
  73. package/react-vanilla-file-CG_WJLam.cjs +0 -15
  74. package/salty.config-BhBY_oOk.js +0 -10
  75. package/salty.config-Dk6ZcCxI.cjs +0 -7
  76. package/should-restart-C6VJ-qaY.js +0 -12
  77. package/should-restart-DAhvRrtu.cjs +0 -1
  78. package/viewport-clamp-CaYwREKc.js +0 -7
  79. package/viewport-clamp-mq_DFtRR.cjs +0 -1
@@ -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
- };
@@ -1,6 +0,0 @@
1
- function p(e) {
2
- return e ? typeof e != "string" ? p(String(e)) : e.replace(/\s/g, "-").replace(/[-_]([a-z0-9])/g, (a) => a[1].toUpperCase()).replace(/^[a-z]/, (a) => a.toUpperCase()) : "";
3
- }
4
- export {
5
- p
6
- };
@@ -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;
@@ -1,10 +0,0 @@
1
- const n = `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
- `;
8
- export {
9
- n as default
10
- };
@@ -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;