@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
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ function pascalCase(str) {
3
+ if (!str) return "";
4
+ if (typeof str !== "string") return pascalCase(String(str));
5
+ return str.replace(/\s/g, "-").replace(/[-_]([a-z0-9])/g, (g) => g[1].toUpperCase()).replace(/^[a-z]/, (g) => g.toUpperCase());
6
+ }
7
+ exports.pascalCase = pascalCase;
@@ -0,0 +1,8 @@
1
+ function pascalCase(str) {
2
+ if (!str) return "";
3
+ if (typeof str !== "string") return pascalCase(String(str));
4
+ return str.replace(/\s/g, "-").replace(/[-_]([a-z0-9])/g, (g) => g[1].toUpperCase()).replace(/^[a-z]/, (g) => g.toUpperCase());
5
+ }
6
+ export {
7
+ pascalCase as p
8
+ };
@@ -1,4 +1,4 @@
1
- const e = `import { styled } from "@salty-css/react/styled";
1
+ const reactStyledFile = `import { styled } from "@salty-css/react/styled";
2
2
 
3
3
  export const <%- name %> = styled('<%- tag %>', {
4
4
  <% if(className) { %>className: '<%- className %>',<% } %>
@@ -7,5 +7,5 @@ export const <%- name %> = styled('<%- tag %>', {
7
7
  }
8
8
  })`;
9
9
  export {
10
- e as default
10
+ reactStyledFile as default
11
11
  };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const reactStyledFile = `import { styled } from "@salty-css/react/styled";
4
+
5
+ export const <%- name %> = styled('<%- tag %>', {
6
+ <% if(className) { %>className: '<%- className %>',<% } %>
7
+ base: {
8
+ // Add your styles here
9
+ }
10
+ })`;
11
+ exports.default = reactStyledFile;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const reactVanillaFile = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
4
+
5
+ interface <%- componentName %>Props {
6
+ text?: string;
7
+ }
8
+
9
+ export const <%- componentName %> = ({ text = 'Lorem ipsum' }: <%- componentName %>Props) => {
10
+ return (
11
+ <<%- styledComponentName %>>
12
+ {text}
13
+ </<%- styledComponentName %>>
14
+ );
15
+ };
16
+
17
+ export default <%- componentName %>;`;
18
+ exports.default = reactVanillaFile;
@@ -1,4 +1,4 @@
1
- const n = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
1
+ const reactVanillaFile = `import { <%- styledComponentName %> } from "./<%- fileName %>.css";
2
2
 
3
3
  interface <%- componentName %>Props {
4
4
  text?: string;
@@ -14,5 +14,5 @@ export const <%- componentName %> = ({ text = 'Lorem ipsum' }: <%- componentName
14
14
 
15
15
  export default <%- componentName %>;`;
16
16
  export {
17
- n as default
17
+ reactVanillaFile as default
18
18
  };
@@ -0,0 +1,4 @@
1
+ const salty_config = "import { defineConfig } from '@salty-css/core/config';\n\nexport const config = defineConfig({\n // Add your custom config here\n externalModules: ['react', 'react-dom']\n});\n";
2
+ export {
3
+ salty_config as default
4
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const salty_config = "import { defineConfig } from '@salty-css/core/config';\n\nexport const config = defineConfig({\n // Add your custom config here\n externalModules: ['react', 'react-dom']\n});\n";
4
+ exports.default = salty_config;
package/server/index.cjs CHANGED
@@ -1 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../should-restart-DAhvRrtu.cjs");exports.checkShouldRestart=e.checkShouldRestart;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const shouldRestart = require("../should-restart-DoaGoD5T.cjs");
4
+ exports.checkShouldRestart = shouldRestart.checkShouldRestart;
package/server/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as o } from "../should-restart-C6VJ-qaY.js";
1
+ import { c } from "../should-restart-5jI-bzz0.js";
2
2
  export {
3
- o as checkShouldRestart
3
+ c as checkShouldRestart
4
4
  };
@@ -0,0 +1,18 @@
1
+ import { readFile } from "fs/promises";
2
+ import { isSaltyFile } from "./compiler/index.js";
3
+ const checkShouldRestart = async (filename) => {
4
+ if (!filename) return false;
5
+ if (filename.includes("node_modules")) return false;
6
+ if (filename.includes("saltygen")) return false;
7
+ const isConfig = filename.includes("salty.config");
8
+ if (isConfig) return true;
9
+ const isSalty = isSaltyFile(filename);
10
+ if (!isSalty) return false;
11
+ const contents = await readFile(filename, "utf-8");
12
+ if (/.+define[A-Z]\w+/.test(contents)) return true;
13
+ if (/.+keyframes\(.+/.test(contents)) return true;
14
+ return false;
15
+ };
16
+ export {
17
+ checkShouldRestart as c
18
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ const promises = require("fs/promises");
3
+ const compiler_index = require("./compiler/index.cjs");
4
+ const checkShouldRestart = async (filename) => {
5
+ if (!filename) return false;
6
+ if (filename.includes("node_modules")) return false;
7
+ if (filename.includes("saltygen")) return false;
8
+ const isConfig = filename.includes("salty.config");
9
+ if (isConfig) return true;
10
+ const isSalty = compiler_index.isSaltyFile(filename);
11
+ if (!isSalty) return false;
12
+ const contents = await promises.readFile(filename, "utf-8");
13
+ if (/.+define[A-Z]\w+/.test(contents)) return true;
14
+ if (/.+keyframes\(.+/.test(contents)) return true;
15
+ return false;
16
+ };
17
+ exports.checkShouldRestart = checkShouldRestart;
package/util/index.cjs CHANGED
@@ -1 +1,13 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../dash-case-BJEkFEGQ.cjs"),t=require("../pascal-case-iWoaJWwT.cjs");function s(e){return e?typeof e!="string"?s(String(e)):e.replace(/\s/g,"-").replace(/-([a-z])/g,r=>r[1].toUpperCase()):""}exports.dashCase=a.dashCase;exports.toHash=a.toHash;exports.pascalCase=t.pascalCase;exports.camelCase=s;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const dashCase = require("../dash-case-Cz8wwE9a.cjs");
4
+ const pascalCase = require("../pascal-case-By_l58S-.cjs");
5
+ function camelCase(str) {
6
+ if (!str) return "";
7
+ if (typeof str !== "string") return camelCase(String(str));
8
+ return str.replace(/\s/g, "-").replace(/-([a-z])/g, (g) => g[1].toUpperCase());
9
+ }
10
+ exports.dashCase = dashCase.dashCase;
11
+ exports.toHash = dashCase.toHash;
12
+ exports.pascalCase = pascalCase.pascalCase;
13
+ exports.camelCase = camelCase;
package/util/index.js CHANGED
@@ -1,11 +1,13 @@
1
- import { d as o, t as s } from "../dash-case-DBThphLm.js";
2
- import { p as f } from "../pascal-case-BQpR5PdN.js";
3
- function r(e) {
4
- return e ? typeof e != "string" ? r(String(e)) : e.replace(/\s/g, "-").replace(/-([a-z])/g, (a) => a[1].toUpperCase()) : "";
1
+ import { d, t } from "../dash-case-NMk0mXyT.js";
2
+ import { p } from "../pascal-case-F3Usi5Wf.js";
3
+ function camelCase(str) {
4
+ if (!str) return "";
5
+ if (typeof str !== "string") return camelCase(String(str));
6
+ return str.replace(/\s/g, "-").replace(/-([a-z])/g, (g) => g[1].toUpperCase());
5
7
  }
6
8
  export {
7
- r as camelCase,
8
- o as dashCase,
9
- f as pascalCase,
10
- s as toHash
9
+ camelCase,
10
+ d as dashCase,
11
+ p as pascalCase,
12
+ t as toHash
11
13
  };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ const defineViewportClamp = (config) => (value, min, max) => {
3
+ const { screenSize, axis = "horizontal", minMultiplier = 0.5, maxMultiplier = 1.5, minMaxUnit = "px" } = config;
4
+ const relativeValue = Math.round(value / screenSize * 1e4) / 100;
5
+ const relativeUnit = axis === "vertical" ? "vh" : "vw";
6
+ const minValue = min || Math.round(minMultiplier * value);
7
+ const maxValue = max || Math.round(maxMultiplier * value);
8
+ return `clamp(${minValue}${minMaxUnit}, ${relativeValue}${relativeUnit}, ${maxValue}${minMaxUnit})`;
9
+ };
10
+ exports.defineViewportClamp = defineViewportClamp;
@@ -0,0 +1,11 @@
1
+ const defineViewportClamp = (config) => (value, min, max) => {
2
+ const { screenSize, axis = "horizontal", minMultiplier = 0.5, maxMultiplier = 1.5, minMaxUnit = "px" } = config;
3
+ const relativeValue = Math.round(value / screenSize * 1e4) / 100;
4
+ const relativeUnit = axis === "vertical" ? "vh" : "vw";
5
+ const minValue = min || Math.round(minMultiplier * value);
6
+ const maxValue = max || Math.round(maxMultiplier * value);
7
+ return `clamp(${minValue}${minMaxUnit}, ${relativeValue}${relativeUnit}, ${maxValue}${minMaxUnit})`;
8
+ };
9
+ export {
10
+ defineViewportClamp as d
11
+ };
@@ -1 +0,0 @@
1
- "use strict";const n=e=>String.fromCharCode(e+(e>25?39:97)),i=(e,r)=>{let t="",a;for(a=Math.abs(e);a>52;a=a/52|0)t=n(a%52)+t;return t=n(a%52)+t,t.length<r?t=t.padStart(r,"a"):t.length>r&&(t=t.slice(-r)),t},o=(e,r)=>{let t=r.length;for(;t;)e=e*33^r.charCodeAt(--t);return e},c=(e,r=5)=>{const t=o(5381,JSON.stringify(e))>>>0;return i(t,r)};function s(e){return e?typeof e!="string"?s(String(e)):e.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(r,t)=>(t>0?"-":"")+r.toLowerCase()):""}exports.dashCase=s;exports.toHash=c;
@@ -1,19 +0,0 @@
1
- const n = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), o = (e, r) => {
2
- let t = "", a;
3
- for (a = Math.abs(e); a > 52; a = a / 52 | 0) t = n(a % 52) + t;
4
- return t = n(a % 52) + t, t.length < r ? t = t.padStart(r, "a") : t.length > r && (t = t.slice(-r)), t;
5
- }, i = (e, r) => {
6
- let t = r.length;
7
- for (; t; ) e = e * 33 ^ r.charCodeAt(--t);
8
- return e;
9
- }, c = (e, r = 5) => {
10
- const t = i(5381, JSON.stringify(e)) >>> 0;
11
- return o(t, r);
12
- };
13
- function s(e) {
14
- return e ? typeof e != "string" ? s(String(e)) : e.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (r, t) => (t > 0 ? "-" : "") + r.toLowerCase()) : "";
15
- }
16
- export {
17
- s as d,
18
- c as t
19
- };
@@ -1,52 +0,0 @@
1
- var n = Object.defineProperty;
2
- var h = (e, t, r) => t in e ? n(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var s = (e, t, r) => h(e, typeof t != "symbol" ? t + "" : t, r);
4
- class i {
5
- constructor(t) {
6
- s(this, "_path");
7
- this.params = t;
8
- }
9
- get _current() {
10
- return this.params.template;
11
- }
12
- get isDefineTemplate() {
13
- return !0;
14
- }
15
- _setPath(t) {
16
- return this._path = t, this;
17
- }
18
- }
19
- class p {
20
- constructor(t) {
21
- s(this, "_path");
22
- s(this, "templates", []);
23
- this.params = t, Object.entries(t).forEach(([r, a]) => {
24
- this.templates.push(
25
- new i({
26
- name: r,
27
- template: a
28
- })
29
- );
30
- });
31
- }
32
- get _current() {
33
- return this.params;
34
- }
35
- get _children() {
36
- return Object.fromEntries(
37
- this.templates.map((t) => [t.params.name, t])
38
- );
39
- }
40
- get isDefineTemplates() {
41
- return !0;
42
- }
43
- _setPath(t) {
44
- return this._path = t, this.templates.forEach((r) => r._setPath(t)), this;
45
- }
46
- }
47
- const m = (e) => new p(e);
48
- export {
49
- i as T,
50
- p as a,
51
- m as d
52
- };
@@ -1 +0,0 @@
1
- "use strict";var i=Object.defineProperty;var p=(e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var s=(e,t,r)=>p(e,typeof t!="symbol"?t+"":t,r);class a{constructor(t){s(this,"_path");this.params=t}get _current(){return this.params.template}get isDefineTemplate(){return!0}_setPath(t){return this._path=t,this}}class n{constructor(t){s(this,"_path");s(this,"templates",[]);this.params=t,Object.entries(t).forEach(([r,h])=>{this.templates.push(new a({name:r,template:h}))})}get _current(){return this.params}get _children(){return Object.fromEntries(this.templates.map(t=>[t.params.name,t]))}get isDefineTemplates(){return!0}_setPath(t){return this._path=t,this.templates.forEach(r=>r._setPath(t)),this}}const c=e=>new n(e);exports.TemplateFactory=a;exports.TemplatesFactory=n;exports.defineTemplates=c;
@@ -1 +0,0 @@
1
- "use strict";const i=require("path");var n=typeof document<"u"?document.currentScript:null;const c=()=>{let{pathname:e}=new URL(typeof document>"u"?require("url").pathToFileURL(__filename).href:n&&n.tagName.toUpperCase()==="SCRIPT"&&n.src||new URL("helpers-CC5pFyba.cjs",document.baseURI).href);for(;/core\/?(src\/)?$/.test(e)===!1;)e=i.join(e,"../");return e},o=async(e,t=10,r=0)=>r>=t?e:e instanceof Promise?await o(await e,r+1,t):typeof e=="function"&&"_shouldResolve"in e?await o(await e(),r+1,t):e;exports.getCorePackageRoot=c;exports.resolveExportValue=o;
@@ -1,11 +0,0 @@
1
- import { join as i } from "path";
2
- const a = () => {
3
- let { pathname: t } = new URL(import.meta.url);
4
- for (; /core\/?(src\/)?$/.test(t) === !1; )
5
- t = i(t, "../");
6
- return t;
7
- }, n = async (t, r = 10, o = 0) => o >= r ? t : t instanceof Promise ? await n(await t, o + 1, r) : typeof t == "function" && "_shouldResolve" in t ? await n(await t(), o + 1, r) : t;
8
- export {
9
- a as g,
10
- n as r
11
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="/* Empty */";exports.default=e;