@salty-css/core 0.0.1-alpha.207 → 0.0.1-alpha.209

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 CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),G=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),t=require("../index-BZxPdVzL.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora");var z=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,P)=>{se.exec(y,F=>{if(F)return P(F);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),P=oe(`Installing packages: ${C}`).start(),F=y.join(" ");await X(`npm install ${F}`),P.succeed(`Installed packages: ${C}`)},ae=()=>G.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!ae())return;await X(`./node_modules/.bin/prettier --write "${y}"`),t.logger.info(`Formatted ${y} with Prettier`)}catch(C){t.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function re(){const y=new te.Command;y.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const C={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-Dk6ZcCxI.cjs")),"saltygen/index.css":Promise.resolve().then(()=>require("../index-84Wroia-.cjs")),"react/react-styled-file.ts":Promise.resolve().then(()=>require("../react-styled-file-Dkubsz-U.cjs")),"react/react-vanilla-file.ts":Promise.resolve().then(()=>require("../react-vanilla-file-CG_WJLam.cjs"))},P=async(i,a)=>{const{default:l}=await C[i],u=ne.render(l,a);return{fileName:i,content:u}},F=async()=>{const i=n.join(process.cwd(),".saltyrc.json");return await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>({}))},b=n.join(process.cwd(),"package.json"),N=async(i=b)=>{const a=await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>{});if(!a)throw"Could not read package.json file!";return a},Y=async(i,a=b)=>{typeof i=="object"&&(i=JSON.stringify(i,null,2)),await s.writeFile(a,i)},B=async()=>{const i=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:z&&z.tagName.toUpperCase()==="SCRIPT"&&z.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await F()).defaultProject)(),$=await B(),D={core:`@salty-css/core@${$.version}`,react:`@salty-css/react@${$.version}`,eslintConfigCore:`@salty-css/eslint-config-core@${$.version}`,vite:`@salty-css/vite@${$.version}`,next:`@salty-css/next@${$.version}`},R=i=>{const a=i==="."?"":i,l=process.cwd();return n.join(l,a)};y.command("init [directory]").description("Initialize a new Salty-CSS project.").option("-d, --dir <dir>","Project directory to initialize the project in.").option("--css-file <css-file>","Existing CSS file where to import the generated CSS. Path must be relative to the given project directory.").option("--skip-install","Skip installing dependencies.").action(async function(i="."){if(!await N().catch(()=>{}))return t.logError("Salty CSS project must be initialized in a directory with a package.json file.");t.logger.info("Initializing a new Salty-CSS project!");const{dir:l=i,cssFile:u,skipInstall:p}=this.opts();if(!l)return t.logError("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");p||await I(D.core,D.react);const f=process.cwd(),r=R(l),T=await Promise.all([P("salty.config.ts"),P("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=T.map(async({fileName:e,content:g})=>{const c=n.join(r,e);if(await s.readFile(c,"utf-8").catch(()=>{})!==void 0){t.logger.debug("File already exists: "+c);return}const k=e.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),t.logger.info("Creating file: "+c),await s.writeFile(c,g),await S(c)});await Promise.all(m);const w=n.relative(f,r)||".",h=n.join(f,".saltyrc.json"),d=await s.readFile(h,"utf-8").catch(()=>{});if(d===void 0){t.logger.info("Creating file: "+h);const g=JSON.stringify({$schema:"./node_modules/@salty-css/core/.saltyrc.schema.json",info:"This file is used to define projects and their configurations for Salty CSS cli. Do not delete, modify or add this file to .gitignore.",defaultProject:w,projects:[{dir:w,framework:"react"}]},null,2);await s.writeFile(h,g),await S(h)}else{const e=JSON.parse(d),g=(e==null?void 0:e.projects)||[];if(g.findIndex(o=>o.dir===w)===-1){g.push({dir:w,framework:"react"}),e.projects=[...g];const o=JSON.stringify(e,null,2);o!==d&&(t.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(f,".gitignore"),U=await s.readFile(j,"utf-8").catch(()=>{});U!==void 0&&(U.includes("saltygen")||(t.logger.info("Edit file: "+j),await s.writeFile(j,U+`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),G=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),t=require("../index-C5koRP2C.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora");var z=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,P)=>{se.exec(y,F=>{if(F)return P(F);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),P=oe(`Installing packages: ${C}`).start(),F=y.join(" ");await X(`npm install ${F}`),P.succeed(`Installed packages: ${C}`)},ae=()=>G.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!ae())return;await X(`./node_modules/.bin/prettier --write "${y}"`),t.logger.info(`Formatted ${y} with Prettier`)}catch(C){t.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function re(){const y=new te.Command;y.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const C={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-Dk6ZcCxI.cjs")),"saltygen/index.css":Promise.resolve().then(()=>require("../index-84Wroia-.cjs")),"react/react-styled-file.ts":Promise.resolve().then(()=>require("../react-styled-file-Dkubsz-U.cjs")),"react/react-vanilla-file.ts":Promise.resolve().then(()=>require("../react-vanilla-file-CG_WJLam.cjs"))},P=async(i,a)=>{const{default:l}=await C[i],u=ne.render(l,a);return{fileName:i,content:u}},F=async()=>{const i=n.join(process.cwd(),".saltyrc.json");return await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>({}))},b=n.join(process.cwd(),"package.json"),N=async(i=b)=>{const a=await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>{});if(!a)throw"Could not read package.json file!";return a},Y=async(i,a=b)=>{typeof i=="object"&&(i=JSON.stringify(i,null,2)),await s.writeFile(a,i)},B=async()=>{const i=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:z&&z.tagName.toUpperCase()==="SCRIPT"&&z.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await F()).defaultProject)(),$=await B(),D={core:`@salty-css/core@${$.version}`,react:`@salty-css/react@${$.version}`,eslintConfigCore:`@salty-css/eslint-config-core@${$.version}`,vite:`@salty-css/vite@${$.version}`,next:`@salty-css/next@${$.version}`},R=i=>{const a=i==="."?"":i,l=process.cwd();return n.join(l,a)};y.command("init [directory]").description("Initialize a new Salty-CSS project.").option("-d, --dir <dir>","Project directory to initialize the project in.").option("--css-file <css-file>","Existing CSS file where to import the generated CSS. Path must be relative to the given project directory.").option("--skip-install","Skip installing dependencies.").action(async function(i="."){if(!await N().catch(()=>{}))return t.logError("Salty CSS project must be initialized in a directory with a package.json file.");t.logger.info("Initializing a new Salty-CSS project!");const{dir:l=i,cssFile:u,skipInstall:p}=this.opts();if(!l)return t.logError("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");p||await I(D.core,D.react);const f=process.cwd(),r=R(l),T=await Promise.all([P("salty.config.ts"),P("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=T.map(async({fileName:e,content:g})=>{const c=n.join(r,e);if(await s.readFile(c,"utf-8").catch(()=>{})!==void 0){t.logger.debug("File already exists: "+c);return}const k=e.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),t.logger.info("Creating file: "+c),await s.writeFile(c,g),await S(c)});await Promise.all(m);const w=n.relative(f,r)||".",h=n.join(f,".saltyrc.json"),d=await s.readFile(h,"utf-8").catch(()=>{});if(d===void 0){t.logger.info("Creating file: "+h);const g=JSON.stringify({$schema:"./node_modules/@salty-css/core/.saltyrc.schema.json",info:"This file is used to define projects and their configurations for Salty CSS cli. Do not delete, modify or add this file to .gitignore.",defaultProject:w,projects:[{dir:w,framework:"react"}]},null,2);await s.writeFile(h,g),await S(h)}else{const e=JSON.parse(d),g=(e==null?void 0:e.projects)||[];if(g.findIndex(o=>o.dir===w)===-1){g.push({dir:w,framework:"react"}),e.projects=[...g];const o=JSON.stringify(e,null,2);o!==d&&(t.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(f,".gitignore"),U=await s.readFile(j,"utf-8").catch(()=>{});U!==void 0&&(U.includes("saltygen")||(t.logger.info("Edit file: "+j),await s.writeFile(j,U+`
2
2
 
3
3
  # Salty-CSS
4
4
  saltygen
package/bin/main.js CHANGED
@@ -3,7 +3,7 @@ import { existsSync as K } from "fs";
3
3
  import { mkdir as q, readFile as C, writeFile as w } from "fs/promises";
4
4
  import { join as i, relative as z, parse as re, format as ee } from "path";
5
5
  import { render as ce } from "ejs";
6
- import { l as t, a as h, g as te } from "../index-Djy7Z9Ft.js";
6
+ import { l as t, a as h, g as te } from "../index-DXHGOCFn.js";
7
7
  import { p as le } from "../pascal-case-BQpR5PdN.js";
8
8
  import { exec as de } from "child_process";
9
9
  import fe from "ora";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("esbuild");require("child_process");require("../dash-case-BJEkFEGQ.cjs");require("path");require("fs");require("fs/promises");require("../parse-styles-DKWtadpv.cjs");const e=require("../index-BZxPdVzL.cjs");require("../css/merge.cjs");exports.compileSaltyFile=e.compileSaltyFile;exports.generateConfigStyles=e.generateConfigStyles;exports.generateCss=e.generateCss;exports.generateFile=e.generateFile;exports.isSaltyFile=e.isSaltyFile;exports.minimizeFile=e.minimizeFile;exports.saltyFileExtensions=e.saltyFileExtensions;exports.saltyFileRegExp=e.saltyFileRegExp;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("esbuild");require("child_process");require("../dash-case-BJEkFEGQ.cjs");require("path");require("fs");require("fs/promises");require("../parse-styles-GZrbHhPa.cjs");const e=require("../index-C5koRP2C.cjs");require("../css/merge.cjs");exports.compileSaltyFile=e.compileSaltyFile;exports.generateConfigStyles=e.generateConfigStyles;exports.generateCss=e.generateCss;exports.generateFile=e.generateFile;exports.isSaltyFile=e.isSaltyFile;exports.minimizeFile=e.minimizeFile;exports.saltyFileExtensions=e.saltyFileExtensions;exports.saltyFileRegExp=e.saltyFileRegExp;
package/compiler/index.js CHANGED
@@ -4,8 +4,8 @@ import "../dash-case-DBThphLm.js";
4
4
  import "path";
5
5
  import "fs";
6
6
  import "fs/promises";
7
- import "../parse-styles-CkaV3OGz.js";
8
- import { d as n, c as g, g as F, e as y, i as x, m as S, s as c, b as f } from "../index-Djy7Z9Ft.js";
7
+ import "../parse-styles--rFRnpgg.js";
8
+ import { d as n, c as g, g as F, e as y, i as x, m as S, s as c, b as f } from "../index-DXHGOCFn.js";
9
9
  import "../css/merge.js";
10
10
  export {
11
11
  n as compileSaltyFile,
package/css/keyframes.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../parse-styles-DKWtadpv.cjs"),w=require("../dash-case-BJEkFEGQ.cjs"),C=async({animationName:l,params:u,appendInitialStyles:y,...t})=>{const n=l||w.toHash(t),r=async(s={})=>{const{duration:e="500ms",easing:o="ease-in-out",delay:i="0s",iterationCount:S="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...s},a=`${n} ${e} ${o} ${i} ${S} ${p} ${g} ${b}`;if(!y)return a;const c=t.from||t["0%"];if(!c)return a;const j=await m.parseAndJoinStyles(c,"");return`${a};${j}`},$=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await m.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),d=(await Promise.all($)).join(""),f=`@keyframes ${n} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:f,keyframes:t}),r};exports.keyframes=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../parse-styles-GZrbHhPa.cjs"),w=require("../dash-case-BJEkFEGQ.cjs"),C=async({animationName:l,params:u,appendInitialStyles:y,...t})=>{const n=l||w.toHash(t),r=async(s={})=>{const{duration:e="500ms",easing:o="ease-in-out",delay:i="0s",iterationCount:S="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...s},a=`${n} ${e} ${o} ${i} ${S} ${p} ${g} ${b}`;if(!y)return a;const c=t.from||t["0%"];if(!c)return a;const j=await m.parseAndJoinStyles(c,"");return`${a};${j}`},$=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await m.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),d=(await Promise.all($)).join(""),f=`@keyframes ${n} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:f,keyframes:t}),r};exports.keyframes=C;
package/css/keyframes.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as m } from "../parse-styles-CkaV3OGz.js";
1
+ import { p as m } from "../parse-styles--rFRnpgg.js";
2
2
  import { t as j } from "../dash-case-DBThphLm.js";
3
3
  const v = async ({ animationName: $, params: f, appendInitialStyles: l, ...t }) => {
4
4
  const r = $ || j(t), o = async (n = {}) => {
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var C=(a,t,s)=>t in a?g(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var m=(a,t,s)=>C(a,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("../parse-styles-DKWtadpv.cjs"),c=require("../dash-case-BJEkFEGQ.cjs");class f{constructor(t){m(this,"buildContext",{});this.params=t}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){return c.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const t=new Set([this.cssClassName]),{className:s}=this.params;return typeof s=="string"&&t.add(s),typeof s=="object"&&s.forEach(e=>t.add(e)),this.getTemplateClasses().forEach(e=>t.add(e)),this.buildContext.classNames&&this.buildContext.classNames.forEach(e=>t.add(e)),[...t].join(" ")}get cssFileName(){const{callerName:t}=this.buildContext;return t?`cl_${c.dashCase(t)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:t={},variants:s={},compoundVariants:e=[]}=this.params,{config:i}=this.buildContext,n={...t,variants:s,compoundVariants:e};return N.parseAndJoinStyles(n,`.${this.cssClassName}`,i,this.isRoot)}getTemplateClasses(t=this.buildContext.config){if(!(t!=null&&t.templates)||!this.params.base||this.priority>0)return[];const s=Object.keys(t.templates);return Object.entries(this.params.base).reduce((e,[i,n])=>(s.includes(i)&&e.push("t_"+c.toHash(c.dashCase(`${i}-${n}`),4)),e),[])}_withBuildContext(t){return this.buildContext=t,this}}class S extends f{constructor(t){super(t),this._params=t}}class x extends f{constructor(t,s){super(s),this.tagName=t,this._params=s}get priority(){var t;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((t=this.tagName.generator)==null?void 0:t.priority)||0)+1:0}get clientProps(){const{element:t,variants:s={},compoundVariants:e=[],defaultVariants:i={},defaultProps:n={},passProps:d}=this.params,{callerName:y,isProduction:b}=this.buildContext,h=new Set([]),l=r=>{const o=i[r];o!==void 0?h.add(`${r}=${String(o)}`):h.add(r)};Object.keys(s).forEach(l),e.map(r=>Object.keys(r).forEach(l));const p=new Set([]);if(this.params.base){const r=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);r&&r.forEach(o=>{const u=o.replace(/\{props\.([\w\d]+)\}/gi,"$1");u&&p.add(u)})}return{element:t,variantKeys:[...h],propValueKeys:[...p],passProps:d,defaultProps:n,attr:{"data-component-name":b?void 0:y}}}}exports.ClassNameGenerator=S;exports.StyledGenerator=x;
1
+ "use strict";var g=Object.defineProperty;var C=(a,t,s)=>t in a?g(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var m=(a,t,s)=>C(a,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("../parse-styles-GZrbHhPa.cjs"),c=require("../dash-case-BJEkFEGQ.cjs");class f{constructor(t){m(this,"buildContext",{});this.params=t}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){return c.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const t=new Set([this.cssClassName]),{className:s}=this.params;return typeof s=="string"&&t.add(s),typeof s=="object"&&s.forEach(e=>t.add(e)),this.getTemplateClasses().forEach(e=>t.add(e)),this.buildContext.classNames&&this.buildContext.classNames.forEach(e=>t.add(e)),[...t].join(" ")}get cssFileName(){const{callerName:t}=this.buildContext;return t?`cl_${c.dashCase(t)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:t={},variants:s={},compoundVariants:e=[]}=this.params,{config:i}=this.buildContext,n={...t,variants:s,compoundVariants:e};return N.parseAndJoinStyles(n,`.${this.cssClassName}`,i,this.isRoot)}getTemplateClasses(t=this.buildContext.config){if(!(t!=null&&t.templates)||!this.params.base||this.priority>0)return[];const s=Object.keys(t.templates);return Object.entries(this.params.base).reduce((e,[i,n])=>(s.includes(i)&&e.push("t_"+c.toHash(c.dashCase(`${i}-${n}`),4)),e),[])}_withBuildContext(t){return this.buildContext=t,this}}class S extends f{constructor(t){super(t),this._params=t}}class x extends f{constructor(t,s){super(s),this.tagName=t,this._params=s}get priority(){var t;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((t=this.tagName.generator)==null?void 0:t.priority)||0)+1:0}get clientProps(){const{element:t,variants:s={},compoundVariants:e=[],defaultVariants:i={},defaultProps:n={},passProps:d}=this.params,{callerName:y,isProduction:b}=this.buildContext,h=new Set([]),l=r=>{const o=i[r];o!==void 0?h.add(`${r}=${String(o)}`):h.add(r)};Object.keys(s).forEach(l),e.map(r=>Object.keys(r).forEach(l));const p=new Set([]);if(this.params.base){const r=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);r&&r.forEach(o=>{const u=o.replace(/\{props\.([\w\d]+)\}/gi,"$1");u&&p.add(u)})}return{element:t,variantKeys:[...h],propValueKeys:[...p],passProps:d,defaultProps:n,attr:{"data-component-name":b?void 0:y}}}}exports.ClassNameGenerator=S;exports.StyledGenerator=x;
@@ -1,7 +1,7 @@
1
1
  var N = Object.defineProperty;
2
2
  var C = (a, t, s) => t in a ? N(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s;
3
3
  var u = (a, t, s) => C(a, typeof t != "symbol" ? t + "" : t, s);
4
- import { p as x } from "../parse-styles-CkaV3OGz.js";
4
+ import { p as x } from "../parse-styles--rFRnpgg.js";
5
5
  import { t as m, d as f } from "../dash-case-DBThphLm.js";
6
6
  class y {
7
7
  constructor(t) {
@@ -1,5 +1,5 @@
1
- "use strict";const Ce=require("esbuild"),xe=require("child_process"),D=require("./dash-case-BJEkFEGQ.cjs"),i=require("path"),c=require("fs"),oe=require("fs/promises"),X=require("./parse-styles-DKWtadpv.cjs"),B=require("winston"),M=require("./css/merge.cjs");var ne=typeof document<"u"?document.currentScript:null;function Ne(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const pe=Ne(Ce),ye=async(e,t=[])=>{if(!e)return"";const s=[],n={};for(const[r,o]of Object.entries(e))if(typeof o!="function")if(o&&typeof o=="object"){const a=r.trim(),y=await ye(o,[...t,a]);s.push(y)}else n[r]=o;if(Object.keys(n).length){const r=t.map(D.dashCase).join("-"),o="t_"+D.toHash(r,4),a=await X.parseAndJoinStyles(n,`.${r}, .${o}`);s.push(a)}return s.join(`
2
- `)},Pe=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="function"?t[s]="any":typeof n=="object"&&(t[s]=me(n).map(r=>`"${r}"`).join(" | ")),t),{}):{},me=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,r])=>{const o=t?`${t}.${n}`:n;return typeof r=="object"?me(r,o,s):s.add(t)}),[...s]):[],ge=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=i.join(e,"package.json");return c.existsSync(t)?t:ge(i.join(e,".."))},ke=async e=>{const t=ge(e);return await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},De=async e=>{const t=await ke(e);if(t)return t.type};let H;const he=async e=>{if(H)return H;const t=await De(e);return t==="module"?H="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:ne&&ne.tagName.toUpperCase()==="SCRIPT"&&ne.src||new URL("index-BZxPdVzL.cjs",document.baseURI).href).endsWith(".cjs"))&&(H="cjs"),H||"esm"},G=B.createLogger({level:"debug",format:B.format.combine(B.format.colorize(),B.format.cli()),transports:[new B.transports.Console({})]}),_e=e=>{G.error(e)};function Se(e){return e?typeof e!="string"?Se(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const Oe={"*, *::before, *::after":{boxSizing:"border-box"},"*":{margin:0},html:{lineHeight:1.15,textSizeAdjust:"100%",WebkitFontSmoothing:"antialiased"},"img, picture, video, canvas, svg":{display:"block",maxWidth:"100%"},"p, h1, h2, h3, h4, h5, h6":{overflowWrap:"break-word"},p:{textWrap:"pretty"},"h1, h2, h3, h4, h5, h6":{textWrap:"balance"},a:{color:"currentColor"},button:{lineHeight:"1em",color:"currentColor"},"input, optgroup, select, textarea":{fontFamily:"inherit",fontSize:"100%",lineHeight:"1.15em"}},V={externalModules:[],rcFile:void 0,destDir:void 0},je=e=>{if(V.externalModules.length>0)return V.externalModules;const s=c.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(r=>r.replace(/['"`]/g,"").trim());return V.externalModules=n,n},v=async e=>{if(V.destDir)return V.destDir;const t=await re(e),s=i.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return V.destDir=s,s},ie=["salty","css","styles","styled"],we=(e=[])=>new RegExp(`\\.(${[...ie,...e].join("|")})\\.`),Y=(e,t=[])=>we(t).test(e),be=async e=>{if(V.rcFile)return V.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=i.join(e,".saltyrc.json"),s=await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(V.rcFile=s,s):be(i.join(e,".."))},re=async e=>{var n,r;const t=await be(e),s=(n=t.projects)==null?void 0:n.find(o=>e.endsWith(o.dir||""));return s||((r=t.projects)==null?void 0:r.find(o=>o.dir===t.defaultProject))},Te=async e=>{const t=await re(e),s=await v(e),n=i.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),r=i.join(s,"salty.config.js"),o=await he(e),a=je(n);await pe.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:r,format:o,external:a});const y=Date.now(),{config:$}=await import(`${r}?t=${y}`);return $},Fe=async(e,t)=>{var le,fe;const s=await v(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async m=>{const{contents:b,outputFilePath:R}=await K(e,m,s);Object.entries(b).forEach(([k,O])=>{O.isMedia?n.mediaQueries.push([k,O]):O.isGlobalDefine?n.globalStyles.push(O):O.isDefineVariables?n.variables.push(O):O.isDefineTemplates&&n.templates.push(O._setPath(R))})}));const r=await Te(e),o={...r},a=new Set,y=(m,b=[])=>m?Object.entries(m).flatMap(([R,k])=>{if(!k)return;if(typeof k=="object")return y(k,[...b,R]);const O=Se(R),te=D.dashCase(R),se=[...b,O].join(".");a.add(`"${se}"`);const U=[...b.map(D.dashCase),te].join("-"),ue=X.parseVariableTokens(k);return ue?`--${U}: ${ue.transformed};`:`--${U}: ${k};`}):[],$=m=>m?Object.entries(m).flatMap(([b,R])=>{const k=y(R);return b==="base"?k.join(""):`${b} { ${k.join("")} }`}):[],l=m=>m?Object.entries(m).flatMap(([b,R])=>Object.entries(R).flatMap(([k,O])=>{const te=y(O,[b]),se=`.${b}-${k}, [data-${b}="${k}"]`,U=te.join("");return`${se} { ${U} }`})):[],d=m=>({...m,responsive:void 0,conditional:void 0}),g=m=>n.variables.map(b=>m==="static"?d(b._current):b._current[m]),p=M.mergeObjects(d(r.variables),g("static")),j=y(p),h=M.mergeObjects((le=r.variables)==null?void 0:le.responsive,g("responsive")),C=$(h),N=M.mergeObjects((fe=r.variables)==null?void 0:fe.conditional,g("conditional")),P=l(N),J=i.join(s,"css/_variables.css"),T=`:root { ${j.join("")} ${C.join("")} } ${P.join("")}`;c.writeFileSync(J,T),o.staticVariables=p;const q=i.join(s,"css/_global.css"),_=M.mergeObjects(r.global,n.globalStyles),I=await X.parseAndJoinStyles(_,"");c.writeFileSync(q,`@layer global { ${I} }`);const f=i.join(s,"css/_reset.css"),w=r.reset==="none"?{}:typeof r.reset=="object"?r.reset:Oe,u=await X.parseAndJoinStyles(w,"");c.writeFileSync(f,`@layer reset { ${u} }`);const F=i.join(s,"css/_templates.css"),x=M.mergeObjects(r.templates,n.templates),E=await ye(x),W=Pe(x);c.writeFileSync(F,`@layer templates { ${E} }`),o.templates=x;const A=M.mergeFactories(n.templates);o.templatePaths=Object.fromEntries(Object.entries(A).map(([m,b])=>[m,b._path]));const{mediaQueries:z}=n;o.mediaQueries=Object.fromEntries(z.map(([m,b])=>[`@${m}`,b]));const L=z.map(([m])=>`'@${m}'`).join(" | "),ee=i.join(s,"types/css-tokens.d.ts"),Z=`
1
+ "use strict";const Ce=require("esbuild"),xe=require("child_process"),D=require("./dash-case-BJEkFEGQ.cjs"),i=require("path"),c=require("fs"),oe=require("fs/promises"),X=require("./parse-styles-GZrbHhPa.cjs"),B=require("winston"),M=require("./css/merge.cjs");var ne=typeof document<"u"?document.currentScript:null;function Ne(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const pe=Ne(Ce),ye=async(e,t=[])=>{if(!e)return"";const s=[],n={};for(const[r,o]of Object.entries(e))if(typeof o!="function")if(o&&typeof o=="object"){const a=r.trim(),y=await ye(o,[...t,a]);s.push(y)}else n[r]=o;if(Object.keys(n).length){const r=t.map(D.dashCase).join("-"),o="t_"+D.toHash(r,4),a=await X.parseAndJoinStyles(n,`.${r}, .${o}`);s.push(a)}return s.join(`
2
+ `)},Pe=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="function"?t[s]="any":typeof n=="object"&&(t[s]=me(n).map(r=>`"${r}"`).join(" | ")),t),{}):{},me=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,r])=>{const o=t?`${t}.${n}`:n;return typeof r=="object"?me(r,o,s):s.add(t)}),[...s]):[],ge=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=i.join(e,"package.json");return c.existsSync(t)?t:ge(i.join(e,".."))},ke=async e=>{const t=ge(e);return await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},De=async e=>{const t=await ke(e);if(t)return t.type};let H;const he=async e=>{if(H)return H;const t=await De(e);return t==="module"?H="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:ne&&ne.tagName.toUpperCase()==="SCRIPT"&&ne.src||new URL("index-C5koRP2C.cjs",document.baseURI).href).endsWith(".cjs"))&&(H="cjs"),H||"esm"},G=B.createLogger({level:"debug",format:B.format.combine(B.format.colorize(),B.format.cli()),transports:[new B.transports.Console({})]}),_e=e=>{G.error(e)};function Se(e){return e?typeof e!="string"?Se(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const Oe={"*, *::before, *::after":{boxSizing:"border-box"},"*":{margin:0},html:{lineHeight:1.15,textSizeAdjust:"100%",WebkitFontSmoothing:"antialiased"},"img, picture, video, canvas, svg":{display:"block",maxWidth:"100%"},"p, h1, h2, h3, h4, h5, h6":{overflowWrap:"break-word"},p:{textWrap:"pretty"},"h1, h2, h3, h4, h5, h6":{textWrap:"balance"},a:{color:"currentColor"},button:{lineHeight:"1em",color:"currentColor"},"input, optgroup, select, textarea":{fontFamily:"inherit",fontSize:"100%",lineHeight:"1.15em"}},V={externalModules:[],rcFile:void 0,destDir:void 0},je=e=>{if(V.externalModules.length>0)return V.externalModules;const s=c.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(r=>r.replace(/['"`]/g,"").trim());return V.externalModules=n,n},v=async e=>{if(V.destDir)return V.destDir;const t=await re(e),s=i.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return V.destDir=s,s},ie=["salty","css","styles","styled"],we=(e=[])=>new RegExp(`\\.(${[...ie,...e].join("|")})\\.`),Y=(e,t=[])=>we(t).test(e),be=async e=>{if(V.rcFile)return V.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=i.join(e,".saltyrc.json"),s=await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(V.rcFile=s,s):be(i.join(e,".."))},re=async e=>{var n,r;const t=await be(e),s=(n=t.projects)==null?void 0:n.find(o=>e.endsWith(o.dir||""));return s||((r=t.projects)==null?void 0:r.find(o=>o.dir===t.defaultProject))},Ee=async e=>{const t=await re(e),s=await v(e),n=i.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),r=i.join(s,"salty.config.js"),o=await he(e),a=je(n);await pe.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:r,format:o,external:a});const y=Date.now(),{config:F}=await import(`${r}?t=${y}`);return F},$e=async(e,t)=>{var le,fe;const s=await v(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async m=>{const{contents:b,outputFilePath:R}=await K(e,m,s);Object.entries(b).forEach(([k,O])=>{O.isMedia?n.mediaQueries.push([k,O]):O.isGlobalDefine?n.globalStyles.push(O):O.isDefineVariables?n.variables.push(O):O.isDefineTemplates&&n.templates.push(O._setPath(R))})}));const r=await Ee(e),o={...r},a=new Set,y=(m,b=[])=>m?Object.entries(m).flatMap(([R,k])=>{if(!k)return;if(typeof k=="object")return y(k,[...b,R]);const O=Se(R),te=D.dashCase(R),se=[...b,O].join(".");a.add(`"${se}"`);const U=[...b.map(D.dashCase),te].join("-"),ue=X.parseVariableTokens(k);return ue?`--${U}: ${ue.transformed};`:`--${U}: ${k};`}):[],F=m=>m?Object.entries(m).flatMap(([b,R])=>{const k=y(R);return b==="base"?k.join(""):`${b} { ${k.join("")} }`}):[],l=m=>m?Object.entries(m).flatMap(([b,R])=>Object.entries(R).flatMap(([k,O])=>{const te=y(O,[b]),se=`.${b}-${k}, [data-${b}="${k}"]`,U=te.join("");return`${se} { ${U} }`})):[],d=m=>({...m,responsive:void 0,conditional:void 0}),g=m=>n.variables.map(b=>m==="static"?d(b._current):b._current[m]),p=M.mergeObjects(d(r.variables),g("static")),j=y(p),h=M.mergeObjects((le=r.variables)==null?void 0:le.responsive,g("responsive")),C=F(h),N=M.mergeObjects((fe=r.variables)==null?void 0:fe.conditional,g("conditional")),P=l(N),J=i.join(s,"css/_variables.css"),E=`:root { ${j.join("")} ${C.join("")} } ${P.join("")}`;c.writeFileSync(J,E),o.staticVariables=p;const q=i.join(s,"css/_global.css"),_=M.mergeObjects(r.global,n.globalStyles),I=await X.parseAndJoinStyles(_,"");c.writeFileSync(q,`@layer global { ${I} }`);const f=i.join(s,"css/_reset.css"),w=r.reset==="none"?{}:typeof r.reset=="object"?r.reset:Oe,u=await X.parseAndJoinStyles(w,"");c.writeFileSync(f,`@layer reset { ${u} }`);const $=i.join(s,"css/_templates.css"),x=M.mergeObjects(r.templates,n.templates),T=await ye(x),W=Pe(x);c.writeFileSync($,`@layer templates { ${T} }`),o.templates=x;const A=M.mergeFactories(n.templates);o.templatePaths=Object.fromEntries(Object.entries(A).map(([m,b])=>[m,b._path]));const{mediaQueries:z}=n;o.mediaQueries=Object.fromEntries(z.map(([m,b])=>[`@${m}`,b]));const L=z.map(([m])=>`'@${m}'`).join(" | "),ee=i.join(s,"types/css-tokens.d.ts"),Z=`
3
3
  // Variable types
4
4
  type VariableTokens = ${[...a].join("|")};
5
5
  type PropertyValueToken = \`{\${VariableTokens}}\`;
@@ -12,27 +12,27 @@
12
12
 
13
13
  // Media query types
14
14
  type MediaQueryKeys = ${L||"''"};
15
- `;c.writeFileSync(ee,Z);const $e=i.join(s,"cache/config-cache.json");c.writeFileSync($e,JSON.stringify(o,null,2))},de=e=>e.replace(/styled\(([^"'`{,]+),/g,(t,s)=>{if(/^['"`]/.test(s))return t;const r=new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);if(!r.test(e))return t;const a=r.exec(e);if(a){const y=a.at(1);if(ie.some(l=>y==null?void 0:y.includes(l)))return t}return"styled('div',"}),Ee=(e,t)=>{try{const s=c.readFileSync(i.join(t,"saltygen/cache/config-cache.json"),"utf8");return s?`globalThis.saltyConfig = ${s};
15
+ `;c.writeFileSync(ee,Z);const Fe=i.join(s,"cache/config-cache.json");c.writeFileSync(Fe,JSON.stringify(o,null,2))},de=e=>e.replace(/styled\(([^"'`{,]+),/g,(t,s)=>{if(/^['"`]/.test(s))return t;const r=new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);if(!r.test(e))return t;const a=r.exec(e);if(a){const y=a.at(1);if(ie.some(l=>y==null?void 0:y.includes(l)))return t}return"styled('div',"}),Te=(e,t)=>{try{const s=c.readFileSync(i.join(t,"saltygen/cache/config-cache.json"),"utf8");return s?`globalThis.saltyConfig = ${s};
16
16
 
17
17
  ${e}`:`globalThis.saltyConfig = {};
18
18
 
19
- ${e}`}catch{return e}},K=async(e,t,s)=>{const n=D.toHash(t),r=i.join(s,"./temp");c.existsSync(r)||c.mkdirSync(r);const o=i.parse(t);let a=c.readFileSync(t,"utf8");a=de(a),a=Ee(a,e);const y=i.join(s,"js",n+".js"),$=await re(e),l=i.join(e,($==null?void 0:$.configDir)||"","salty.config.ts"),d=je(l),g=await he(e);await pe.build({stdin:{contents:a,sourcefile:o.base,resolveDir:o.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:y,format:g,target:["node20"],keepNames:!0,external:d,packages:"external",plugins:[{name:"test",setup:h=>{h.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},C=>{const N=c.readFileSync(C.path,"utf8");return{contents:de(N),loader:"ts"}})}}]});const p=Date.now();return{contents:await import(`${y}?t=${p}`),outputFilePath:y}},Re=async e=>{const t=await v(e),s=i.join(t,"cache/config-cache.json"),n=c.readFileSync(s,"utf8");if(!n)throw new Error("Could not find config cache file");return JSON.parse(n)},ae=async e=>{const t=await Re(e),s=await v(e),n=i.join(s,"salty.config.js"),r=Date.now(),{config:o}=await import(`${n}?t=${r}`);return M.mergeObjects(o,t)},ce=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Ve=async(e,t=ce(),s=!0)=>{try{const n=Date.now();t?G.info("Generating CSS in production mode! 🔥"):G.info("Generating CSS in development mode! 🚀");const r=[],o=[],a=await v(e),y=i.join(a,"index.css");s&&(()=>{c.existsSync(a)&&xe.execSync("rm -rf "+a),c.mkdirSync(a,{recursive:!0}),c.mkdirSync(i.join(a,"css")),c.mkdirSync(i.join(a,"types")),c.mkdirSync(i.join(a,"js")),c.mkdirSync(i.join(a,"cache"))})();const l=new Set,d=new Set;async function g(f){const S=["node_modules","saltygen"],w=c.statSync(f);if(w.isDirectory()){const u=c.readdirSync(f);if(S.some(x=>f.includes(x)))return;await Promise.all(u.map(x=>g(i.join(f,x))))}else if(w.isFile()&&Y(f)){l.add(f);const F=c.readFileSync(f,"utf8");/define[\w\d]+\(/.test(F)&&d.add(f)}}await g(e),await Fe(e,d);const p={keyframes:[],components:[],classNames:[]};await Promise.all([...l].map(async f=>{const{contents:S}=await K(e,f,a);Object.entries(S).forEach(([w,u])=>{u.isKeyframes?p.keyframes.push({value:u,src:f,name:w}):u.isClassName?p.classNames.push({...u,src:f,name:w}):u.generator&&p.components.push({...u,src:f,name:w})})}));const j=await ae(e);for(const f of p.keyframes){const{value:S}=f,w=`a_${S.animationName}.css`,u=`css/${w}`,F=i.join(a,u);r.push(w),c.writeFileSync(F,S.css)}const h={};for(const f of p.components){const{src:S,name:w}=f,u=f.generator._withBuildContext({callerName:w,isProduction:t,config:j});o[u.priority]||(o[u.priority]=[]);const F=await u.css;if(!F)continue;o[u.priority].push(u.cssFileName);const x=`css/${u.cssFileName}`,E=i.join(a,x);c.writeFileSync(E,F),j.importStrategy==="component"&&(h[S]?h[S].push(u.cssFileName):h[S]=[u.cssFileName])}for(const f of p.classNames){const{src:S,name:w}=f,u=f.generator._withBuildContext({callerName:w,isProduction:t,config:j}),F=await u.css;if(!F)continue;o[0].push(u.cssFileName);const x=`css/${u.cssFileName}`,E=i.join(a,x);c.writeFileSync(E,F),j.importStrategy==="component"&&(h[S]?h[S].push(u.cssFileName):h[S]=[u.cssFileName])}j.importStrategy==="component"&&Object.entries(h).forEach(([f,S])=>{const w=S.map(W=>`@import url('./${W}');`).join(`
20
- `),u=D.toHash(f,6),F=i.parse(f),x=D.dashCase(F.name),E=i.join(a,`css/f_${x}-${u}.css`);c.writeFileSync(E,w)});const C=r.map(f=>`@import url('./css/${f}');`).join(`
21
- `);let T=`@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
19
+ ${e}`}catch{return e}},K=async(e,t,s)=>{const n=D.toHash(t),r=i.join(s,"./temp");c.existsSync(r)||c.mkdirSync(r);const o=i.parse(t);let a=c.readFileSync(t,"utf8");a=de(a),a=Te(a,e);const y=i.join(s,"js",n+".js"),F=await re(e),l=i.join(e,(F==null?void 0:F.configDir)||"","salty.config.ts"),d=je(l),g=await he(e);await pe.build({stdin:{contents:a,sourcefile:o.base,resolveDir:o.dir,loader:"tsx"},minify:!1,treeShaking:!0,bundle:!0,outfile:y,format:g,target:["node20"],keepNames:!0,external:d,packages:"external",plugins:[{name:"test",setup:h=>{h.onLoad({filter:/.*\.css|salty|styles|styled\.ts/},C=>{const N=c.readFileSync(C.path,"utf8");return{contents:de(N),loader:"ts"}})}}]});const p=Date.now();return{contents:await import(`${y}?t=${p}`),outputFilePath:y}},Re=async e=>{const t=await v(e),s=i.join(t,"cache/config-cache.json"),n=c.readFileSync(s,"utf8");if(!n)throw new Error("Could not find config cache file");return JSON.parse(n)},ae=async e=>{const t=await Re(e),s=await v(e),n=i.join(s,"salty.config.js"),r=Date.now(),{config:o}=await import(`${n}?t=${r}`);return M.mergeObjects(o,t)},ce=()=>{try{return process.env.NODE_ENV==="production"}catch{return!1}},Ve=async(e,t=ce(),s=!0)=>{try{const n=Date.now();t?G.info("Generating CSS in production mode! 🔥"):G.info("Generating CSS in development mode! 🚀");const r=[],o=[],a=await v(e),y=i.join(a,"index.css");s&&(()=>{c.existsSync(a)&&xe.execSync("rm -rf "+a),c.mkdirSync(a,{recursive:!0}),c.mkdirSync(i.join(a,"css")),c.mkdirSync(i.join(a,"types")),c.mkdirSync(i.join(a,"js")),c.mkdirSync(i.join(a,"cache"))})();const l=new Set,d=new Set;async function g(f){const S=["node_modules","saltygen"],w=c.statSync(f);if(w.isDirectory()){const u=c.readdirSync(f);if(S.some(x=>f.includes(x)))return;await Promise.all(u.map(x=>g(i.join(f,x))))}else if(w.isFile()&&Y(f)){l.add(f);const $=c.readFileSync(f,"utf8");/define[\w\d]+\(/.test($)&&d.add(f)}}await g(e),await $e(e,d);const p={keyframes:[],components:[],classNames:[]};await Promise.all([...l].map(async f=>{const{contents:S}=await K(e,f,a);Object.entries(S).forEach(([w,u])=>{u.isKeyframes?p.keyframes.push({value:u,src:f,name:w}):u.isClassName?p.classNames.push({...u,src:f,name:w}):u.generator&&p.components.push({...u,src:f,name:w})})}));const j=await ae(e);for(const f of p.keyframes){const{value:S}=f,w=`a_${S.animationName}.css`,u=`css/${w}`,$=i.join(a,u);r.push(w),c.writeFileSync($,S.css)}const h={};for(const f of p.components){const{src:S,name:w}=f;h[S]||(h[S]=[]);const u=f.generator._withBuildContext({callerName:w,isProduction:t,config:j});o[u.priority]||(o[u.priority]=[]);const $=await u.css;if(!$)continue;o[u.priority].push(u.cssFileName);const x=`css/${u.cssFileName}`,T=i.join(a,x);c.writeFileSync(T,$),j.importStrategy==="component"&&h[S].push(u.cssFileName)}for(const f of p.classNames){const{src:S,name:w}=f;h[S]||(h[S]=[]);const u=f.generator._withBuildContext({callerName:w,isProduction:t,config:j}),$=await u.css;if(!$)continue;o[0].push(u.cssFileName);const x=`css/${u.cssFileName}`,T=i.join(a,x);c.writeFileSync(T,$),j.importStrategy==="component"&&h[S].push(u.cssFileName)}j.importStrategy==="component"&&Object.entries(h).forEach(([f,S])=>{const w=S.map(W=>`@import url('./${W}');`).join(`
20
+ `),u=D.toHash(f,6),$=i.parse(f),x=D.dashCase($.name),T=i.join(a,`css/f_${x}-${u}.css`);c.writeFileSync(T,w||"/* Empty file */")});const C=r.map(f=>`@import url('./css/${f}');`).join(`
21
+ `);let E=`@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
22
22
 
23
23
  ${["_variables.css","_reset.css","_global.css","_templates.css"].filter(f=>{try{return c.readFileSync(i.join(a,"css",f),"utf8").length>0}catch{return!1}}).map(f=>`@import url('./css/${f}');`).join(`
24
24
  `)}
25
- ${C}`;if(j.importStrategy!=="component"){const f=o.reduce((S,w,u)=>{const F=w.reduce((A,z)=>{var Z;const L=i.join(a,"css",z),ee=c.readFileSync(L,"utf8"),Q=((Z=/.*-([^-]+)-\d+.css/.exec(z))==null?void 0:Z.at(1))||D.toHash(L,6);return A.includes(Q)?A:`${A}
25
+ ${C}`;if(j.importStrategy!=="component"){const f=o.reduce((S,w,u)=>{const $=w.reduce((A,z)=>{var Z;const L=i.join(a,"css",z),ee=c.readFileSync(L,"utf8"),Q=((Z=/.*-([^-]+)-\d+.css/.exec(z))==null?void 0:Z.at(1))||D.toHash(L,6);return A.includes(Q)?A:`${A}
26
26
  /*start:${Q}-${z}*/
27
27
  ${ee}
28
28
  /*end:${Q}*/
29
- `},""),x=`l_${u}.css`,E=i.join(a,"css",x),W=`@layer l${u} { ${F}
30
- }`;return c.writeFileSync(E,W),`${S}
31
- @import url('./css/${x}');`},"");T+=f}c.writeFileSync(y,T);const _=Date.now()-n,I=_<200?"🔥":_<500?"🚀":_<1e3?"🎉":_<2e3?"🚗":_<5e3?"🤔":"🥴";G.info(`Generated CSS in ${_}ms! ${I}`)}catch(n){console.error(n)}},Me=async(e,t,s=ce())=>{try{const n=await v(e);if(Y(t)){const o=[],a=await ae(e),{contents:y}=await K(e,t,n);for(const[$,l]of Object.entries(y)){if(l.isKeyframes&&l.css){const C=`css/${`a_${l.animationName}.css`}`,N=i.join(n,C);c.writeFileSync(N,await l.css);return}if(l.isClassName){const h=l.generator._withBuildContext({callerName:$,isProduction:s,config:a}),C=await h.css;if(!C)continue;o[0].push(h.cssFileName);const N=`css/${h.cssFileName}`,P=i.join(n,N);c.writeFileSync(P,C)}if(!l.generator)return;const d=l.generator._withBuildContext({callerName:$,isProduction:s,config:a}),g=await d.css;if(!g)continue;const p=`css/${d.cssFileName}`,j=i.join(n,p);c.writeFileSync(j,g),o[d.priority]||(o[d.priority]=[]),o[d.priority].push(d.cssFileName)}if(a.importStrategy!=="component")o.forEach(($,l)=>{const d=`l_${l}.css`,g=i.join(n,"css",d);let p=c.readFileSync(g,"utf8");$.forEach(j=>{var P;const h=i.join(n,"css",j),C=((P=/.*-([^-]+)-\d+.css/.exec(j))==null?void 0:P.at(1))||D.toHash(h,6);if(!p.includes(C)){const J=c.readFileSync(h,"utf8"),T=`/*start:${C}-${j}*/
29
+ `},""),x=`l_${u}.css`,T=i.join(a,"css",x),W=`@layer l${u} { ${$}
30
+ }`;return c.writeFileSync(T,W),`${S}
31
+ @import url('./css/${x}');`},"");E+=f}c.writeFileSync(y,E);const _=Date.now()-n,I=_<200?"🔥":_<500?"🚀":_<1e3?"🎉":_<2e3?"🚗":_<5e3?"🤔":"🥴";G.info(`Generated CSS in ${_}ms! ${I}`)}catch(n){console.error(n)}},Me=async(e,t,s=ce())=>{try{const n=await v(e);if(Y(t)){const o=[],a=await ae(e),{contents:y}=await K(e,t,n);for(const[F,l]of Object.entries(y)){if(l.isKeyframes&&l.css){const C=`css/${`a_${l.animationName}.css`}`,N=i.join(n,C);c.writeFileSync(N,await l.css);return}if(l.isClassName){const h=l.generator._withBuildContext({callerName:F,isProduction:s,config:a}),C=await h.css;if(!C)continue;o[0].push(h.cssFileName);const N=`css/${h.cssFileName}`,P=i.join(n,N);c.writeFileSync(P,C)}if(!l.generator)return;const d=l.generator._withBuildContext({callerName:F,isProduction:s,config:a}),g=await d.css;if(!g)continue;const p=`css/${d.cssFileName}`,j=i.join(n,p);c.writeFileSync(j,g),o[d.priority]||(o[d.priority]=[]),o[d.priority].push(d.cssFileName)}if(a.importStrategy!=="component")o.forEach((F,l)=>{const d=`l_${l}.css`,g=i.join(n,"css",d);let p=c.readFileSync(g,"utf8");F.forEach(j=>{var P;const h=i.join(n,"css",j),C=((P=/.*-([^-]+)-\d+.css/.exec(j))==null?void 0:P.at(1))||D.toHash(h,6);if(!p.includes(C)){const J=c.readFileSync(h,"utf8"),E=`/*start:${C}-${j}*/
32
32
  ${J}
33
33
  /*end:${C}*/
34
34
  `;p=`${p.replace(/\}$/,"")}
35
- ${T}
36
- }`}}),c.writeFileSync(g,p)});else{const $=o.flat().map(j=>`@import url('./${j}');`).join(`
37
- `),l=D.toHash(t,6),d=i.parse(t),g=D.dashCase(d.name),p=i.join(n,`css/f_${g}-${l}.css`);c.writeFileSync(p,$)}}}catch(n){console.error(n)}},ve=async(e,t,s=ce())=>{try{const n=await v(e);if(Y(t)){const o=c.readFileSync(t,"utf8");o.replace(/^(?!export\s)const\s.*/gm,d=>`export ${d}`)!==o&&await oe.writeFile(t,o);const y=await ae(e),{contents:$}=await K(e,t,n);let l=o;if(Object.entries($).forEach(([d,g])=>{var u;if(g.isKeyframes||!g.generator)return;const p=g.generator._withBuildContext({callerName:d,isProduction:s,config:y}),j=new RegExp(`\\s${d}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(o);if(!j)return console.error("Could not find the original declaration");const h=(u=j.at(1))==null?void 0:u.trim(),C=new RegExp(`\\s${d}[=\\s]+styled\\(`,"g").exec(l);if(!C)return console.error("Could not find the original declaration");const{index:N}=C;let P=!1;const J=setTimeout(()=>P=!0,5e3);let T=0,q=!1,_=0;for(;!q&&!P;){const F=l[N+T];F==="("&&_++,F===")"&&_--,_===0&&F===")"&&(q=!0),T>l.length&&(P=!0),T++}if(!P)clearTimeout(J);else throw new Error("Failed to find the end of the styled call and timed out");const I=N+T,f=l.slice(N,I),S=l,w=` ${d} = styled(${h}, "${p.classNames}", ${JSON.stringify(p.clientProps)});`;l=l.replace(f,w),S===l&&console.error("Minimize file failed to change content",{name:d,tagName:h})}),y.importStrategy==="component"){const d=D.toHash(t,6),g=i.parse(t);l=`import '../../saltygen/css/${`f_${D.dashCase(g.name)}-${d}.css`}';
38
- ${l}`}return l=l.replace("{ styled }","{ styledClient as styled }"),l=l.replace("@salty-css/react/styled","@salty-css/react/styled-client"),l}}catch(n){console.error("Error in minimizeFile:",n)}};exports.compileSaltyFile=K;exports.generateConfigStyles=Fe;exports.generateCss=Ve;exports.generateFile=Me;exports.isSaltyFile=Y;exports.logError=_e;exports.logger=G;exports.minimizeFile=ve;exports.saltyFileExtensions=ie;exports.saltyFileRegExp=we;
35
+ ${E}
36
+ }`}}),c.writeFileSync(g,p)});else{const F=o.flat().map(j=>`@import url('./${j}');`).join(`
37
+ `),l=D.toHash(t,6),d=i.parse(t),g=D.dashCase(d.name),p=i.join(n,`css/f_${g}-${l}.css`);c.writeFileSync(p,F||"/* Empty file */")}}}catch(n){console.error(n)}},ve=async(e,t,s=ce())=>{try{const n=await v(e);if(Y(t)){const o=c.readFileSync(t,"utf8");o.replace(/^(?!export\s)const\s.*/gm,d=>`export ${d}`)!==o&&await oe.writeFile(t,o);const y=await ae(e),{contents:F}=await K(e,t,n);let l=o;if(Object.entries(F).forEach(([d,g])=>{var u;if(g.isKeyframes||!g.generator)return;const p=g.generator._withBuildContext({callerName:d,isProduction:s,config:y}),j=new RegExp(`\\s${d}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(o);if(!j)return console.error("Could not find the original declaration");const h=(u=j.at(1))==null?void 0:u.trim(),C=new RegExp(`\\s${d}[=\\s]+styled\\(`,"g").exec(l);if(!C)return console.error("Could not find the original declaration");const{index:N}=C;let P=!1;const J=setTimeout(()=>P=!0,5e3);let E=0,q=!1,_=0;for(;!q&&!P;){const $=l[N+E];$==="("&&_++,$===")"&&_--,_===0&&$===")"&&(q=!0),E>l.length&&(P=!0),E++}if(!P)clearTimeout(J);else throw new Error("Failed to find the end of the styled call and timed out");const I=N+E,f=l.slice(N,I),S=l,w=` ${d} = styled(${h}, "${p.classNames}", ${JSON.stringify(p.clientProps)});`;l=l.replace(f,w),S===l&&console.error("Minimize file failed to change content",{name:d,tagName:h})}),y.importStrategy==="component"){const d=D.toHash(t,6),g=i.parse(t);l=`import '../../saltygen/css/${`f_${D.dashCase(g.name)}-${d}.css`}';
38
+ ${l}`}return l=l.replace("{ styled }","{ styledClient as styled }"),l=l.replace("@salty-css/react/styled","@salty-css/react/styled-client"),l}}catch(n){console.error("Error in minimizeFile:",n)}};exports.compileSaltyFile=K;exports.generateConfigStyles=$e;exports.generateCss=Ve;exports.generateFile=Me;exports.isSaltyFile=Y;exports.logError=_e;exports.logger=G;exports.minimizeFile=ve;exports.saltyFileExtensions=ie;exports.saltyFileRegExp=we;
@@ -1,11 +1,11 @@
1
1
  import * as gt from "esbuild";
2
- import { execSync as xt } from "child_process";
2
+ import { execSync as Nt } from "child_process";
3
3
  import { d as G, t as v } from "./dash-case-DBThphLm.js";
4
4
  import { join as r, parse as Y } from "path";
5
- import { existsSync as it, writeFileSync as N, mkdirSync as I, readFileSync as E, statSync as Pt, readdirSync as kt } from "fs";
5
+ import { existsSync as it, writeFileSync as x, mkdirSync as I, readFileSync as T, statSync as Pt, readdirSync as kt } from "fs";
6
6
  import { readFile as yt, writeFile as Dt } from "fs/promises";
7
- import { p as at, a as _t } from "./parse-styles-CkaV3OGz.js";
8
- import { createLogger as Tt, format as ot, transports as Et } from "winston";
7
+ import { p as at, a as _t } from "./parse-styles--rFRnpgg.js";
8
+ import { createLogger as Et, format as ot, transports as Tt } from "winston";
9
9
  import { mergeObjects as B, mergeFactories as Ot } from "./css/merge.js";
10
10
  const ht = async (t, e = []) => {
11
11
  if (!t) return "";
@@ -43,10 +43,10 @@ const wt = async (t) => {
43
43
  if (W) return W;
44
44
  const e = await vt(t);
45
45
  return e === "module" ? W = "esm" : (e === "commonjs" || import.meta.url.endsWith(".cjs")) && (W = "cjs"), W || "esm";
46
- }, X = Tt({
46
+ }, X = Et({
47
47
  level: "debug",
48
48
  format: ot.combine(ot.colorize(), ot.cli()),
49
- transports: [new Et.Console({})]
49
+ transports: [new Tt.Console({})]
50
50
  }), Ut = (t) => {
51
51
  X.error(t);
52
52
  };
@@ -105,7 +105,7 @@ const Rt = {
105
105
  destDir: void 0
106
106
  }, Ct = (t) => {
107
107
  if (M.externalModules.length > 0) return M.externalModules;
108
- const s = E(t, "utf8").match(/externalModules:\s?\[(.*)\]/);
108
+ const s = T(t, "utf8").match(/externalModules:\s?\[(.*)\]/);
109
109
  if (!s) return [];
110
110
  const n = s[1].split(",").map((a) => a.replace(/['"`]/g, "").trim());
111
111
  return M.externalModules = n, n;
@@ -113,15 +113,15 @@ const Rt = {
113
113
  if (M.destDir) return M.destDir;
114
114
  const e = await ct(t), s = r(t, (e == null ? void 0 : e.saltygenDir) || "saltygen");
115
115
  return M.destDir = s, s;
116
- }, Ft = ["salty", "css", "styles", "styled"], Jt = (t = []) => new RegExp(`\\.(${[...Ft, ...t].join("|")})\\.`), rt = (t, e = []) => Jt(e).test(t), jt = async (t) => {
116
+ }, jt = ["salty", "css", "styles", "styled"], Jt = (t = []) => new RegExp(`\\.(${[...jt, ...t].join("|")})\\.`), rt = (t, e = []) => Jt(e).test(t), Ft = async (t) => {
117
117
  if (M.rcFile) return M.rcFile;
118
118
  if (t === "/") throw new Error("Could not find .saltyrc.json file");
119
119
  const e = r(t, ".saltyrc.json"), s = await yt(e, "utf-8").then(JSON.parse).catch(() => {
120
120
  });
121
- return s ? (M.rcFile = s, s) : jt(r(t, ".."));
121
+ return s ? (M.rcFile = s, s) : Ft(r(t, ".."));
122
122
  }, ct = async (t) => {
123
123
  var n, a;
124
- const e = await jt(t), s = (n = e.projects) == null ? void 0 : n.find((o) => t.endsWith(o.dir || ""));
124
+ const e = await Ft(t), s = (n = e.projects) == null ? void 0 : n.find((o) => t.endsWith(o.dir || ""));
125
125
  return s || ((a = e.projects) == null ? void 0 : a.find((o) => o.dir === e.defaultProject));
126
126
  }, zt = async (t) => {
127
127
  const e = await ct(t), s = await R(t), n = r(t, (e == null ? void 0 : e.configDir) || "", "salty.config.ts"), a = r(s, "salty.config.js"), o = await wt(t), i = Ct(n);
@@ -165,14 +165,14 @@ const Rt = {
165
165
  }) : [], c = (m) => m ? Object.entries(m).flatMap(([w, V]) => Object.entries(V).flatMap(([k, _]) => {
166
166
  const st = d(_, [w]), nt = `.${w}-${k}, [data-${w}="${k}"]`, U = st.join("");
167
167
  return `${nt} { ${U} }`;
168
- })) : [], u = (m) => ({ ...m, responsive: void 0, conditional: void 0 }), g = (m) => n.variables.map((w) => m === "static" ? u(w._current) : w._current[m]), p = B(u(a.variables), g("static")), $ = d(p), y = B((ut = a.variables) == null ? void 0 : ut.responsive, g("responsive")), F = C(y), x = B((pt = a.variables) == null ? void 0 : pt.conditional, g("conditional")), P = c(x), J = r(s, "css/_variables.css"), T = `:root { ${$.join("")} ${F.join("")} } ${P.join("")}`;
169
- N(J, T), o.staticVariables = p;
168
+ })) : [], u = (m) => ({ ...m, responsive: void 0, conditional: void 0 }), g = (m) => n.variables.map((w) => m === "static" ? u(w._current) : w._current[m]), p = B(u(a.variables), g("static")), $ = d(p), y = B((ut = a.variables) == null ? void 0 : ut.responsive, g("responsive")), j = C(y), N = B((pt = a.variables) == null ? void 0 : pt.conditional, g("conditional")), P = c(N), J = r(s, "css/_variables.css"), E = `:root { ${$.join("")} ${j.join("")} } ${P.join("")}`;
169
+ x(J, E), o.staticVariables = p;
170
170
  const H = r(s, "css/_global.css"), D = B(a.global, n.globalStyles), K = await at(D, "");
171
- N(H, `@layer global { ${K} }`);
171
+ x(H, `@layer global { ${K} }`);
172
172
  const l = r(s, "css/_reset.css"), b = a.reset === "none" ? {} : typeof a.reset == "object" ? a.reset : Rt, f = await at(b, "");
173
- N(l, `@layer reset { ${f} }`);
174
- const S = r(s, "css/_templates.css"), j = B(a.templates, n.templates), O = await ht(j), A = Vt(j);
175
- N(S, `@layer templates { ${O} }`), o.templates = j;
173
+ x(l, `@layer reset { ${f} }`);
174
+ const S = r(s, "css/_templates.css"), F = B(a.templates, n.templates), O = await ht(F), A = Vt(F);
175
+ x(S, `@layer templates { ${O} }`), o.templates = F;
176
176
  const L = Ot(n.templates);
177
177
  o.templatePaths = Object.fromEntries(Object.entries(L).map(([m, w]) => [m, w._path]));
178
178
  const { mediaQueries: z } = n;
@@ -191,9 +191,9 @@ const Rt = {
191
191
  // Media query types
192
192
  type MediaQueryKeys = ${Q || "''"};
193
193
  `;
194
- N(et, q);
195
- const Nt = r(s, "cache/config-cache.json");
196
- N(Nt, JSON.stringify(o, null, 2));
194
+ x(et, q);
195
+ const xt = r(s, "cache/config-cache.json");
196
+ x(xt, JSON.stringify(o, null, 2));
197
197
  }, mt = (t) => t.replace(/styled\(([^"'`{,]+),/g, (e, s) => {
198
198
  if (/^['"`]/.test(s)) return e;
199
199
  const a = new RegExp(`import[^;]*${s}[,\\s{][^;]*from\\s?([^{};]+);`);
@@ -201,12 +201,12 @@ const Rt = {
201
201
  const i = a.exec(t);
202
202
  if (i) {
203
203
  const d = i.at(1);
204
- if (Ft.some((c) => d == null ? void 0 : d.includes(c))) return e;
204
+ if (jt.some((c) => d == null ? void 0 : d.includes(c))) return e;
205
205
  }
206
206
  return "styled('div',";
207
207
  }), It = (t, e) => {
208
208
  try {
209
- const s = E(r(e, "saltygen/cache/config-cache.json"), "utf8");
209
+ const s = T(r(e, "saltygen/cache/config-cache.json"), "utf8");
210
210
  return s ? `globalThis.saltyConfig = ${s};
211
211
 
212
212
  ${t}` : `globalThis.saltyConfig = {};
@@ -219,7 +219,7 @@ ${t}`;
219
219
  const n = v(e), a = r(s, "./temp");
220
220
  it(a) || I(a);
221
221
  const o = Y(e);
222
- let i = E(e, "utf8");
222
+ let i = T(e, "utf8");
223
223
  i = mt(i), i = It(i, t);
224
224
  const d = r(s, "js", n + ".js"), C = await ct(t), c = r(t, (C == null ? void 0 : C.configDir) || "", "salty.config.ts"), u = Ct(c), g = await wt(t);
225
225
  await gt.build({
@@ -242,9 +242,9 @@ ${t}`;
242
242
  {
243
243
  name: "test",
244
244
  setup: (y) => {
245
- y.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (F) => {
246
- const x = E(F.path, "utf8");
247
- return { contents: mt(x), loader: "ts" };
245
+ y.onLoad({ filter: /.*\.css|salty|styles|styled\.ts/ }, (j) => {
246
+ const N = T(j.path, "utf8");
247
+ return { contents: mt(N), loader: "ts" };
248
248
  });
249
249
  }
250
250
  }
@@ -253,7 +253,7 @@ ${t}`;
253
253
  const p = Date.now();
254
254
  return { contents: await import(`${d}?t=${p}`), outputFilePath: d };
255
255
  }, Bt = async (t) => {
256
- const e = await R(t), s = r(e, "cache/config-cache.json"), n = E(s, "utf8");
256
+ const e = await R(t), s = r(e, "cache/config-cache.json"), n = T(s, "utf8");
257
257
  if (!n) throw new Error("Could not find config cache file");
258
258
  return JSON.parse(n);
259
259
  }, lt = async (t) => {
@@ -271,18 +271,18 @@ ${t}`;
271
271
  e ? X.info("Generating CSS in production mode! 🔥") : X.info("Generating CSS in development mode! 🚀");
272
272
  const a = [], o = [], i = await R(t), d = r(i, "index.css");
273
273
  s && (() => {
274
- it(i) && xt("rm -rf " + i), I(i, { recursive: !0 }), I(r(i, "css")), I(r(i, "types")), I(r(i, "js")), I(r(i, "cache"));
274
+ it(i) && Nt("rm -rf " + i), I(i, { recursive: !0 }), I(r(i, "css")), I(r(i, "types")), I(r(i, "js")), I(r(i, "cache"));
275
275
  })();
276
276
  const c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
277
277
  async function g(l) {
278
278
  const h = ["node_modules", "saltygen"], b = Pt(l);
279
279
  if (b.isDirectory()) {
280
280
  const f = kt(l);
281
- if (h.some((j) => l.includes(j))) return;
282
- await Promise.all(f.map((j) => g(r(l, j))));
281
+ if (h.some((F) => l.includes(F))) return;
282
+ await Promise.all(f.map((F) => g(r(l, F))));
283
283
  } else if (b.isFile() && rt(l)) {
284
284
  c.add(l);
285
- const S = E(l, "utf8");
285
+ const S = T(l, "utf8");
286
286
  /define[\w\d]+\(/.test(S) && u.add(l);
287
287
  }
288
288
  }
@@ -315,11 +315,13 @@ ${t}`;
315
315
  const $ = await lt(t);
316
316
  for (const l of p.keyframes) {
317
317
  const { value: h } = l, b = `a_${h.animationName}.css`, f = `css/${b}`, S = r(i, f);
318
- a.push(b), N(S, h.css);
318
+ a.push(b), x(S, h.css);
319
319
  }
320
320
  const y = {};
321
321
  for (const l of p.components) {
322
- const { src: h, name: b } = l, f = l.generator._withBuildContext({
322
+ const { src: h, name: b } = l;
323
+ y[h] || (y[h] = []);
324
+ const f = l.generator._withBuildContext({
323
325
  callerName: b,
324
326
  isProduction: e,
325
327
  config: $
@@ -328,56 +330,58 @@ ${t}`;
328
330
  const S = await f.css;
329
331
  if (!S) continue;
330
332
  o[f.priority].push(f.cssFileName);
331
- const j = `css/${f.cssFileName}`, O = r(i, j);
332
- N(O, S), $.importStrategy === "component" && (y[h] ? y[h].push(f.cssFileName) : y[h] = [f.cssFileName]);
333
+ const F = `css/${f.cssFileName}`, O = r(i, F);
334
+ x(O, S), $.importStrategy === "component" && y[h].push(f.cssFileName);
333
335
  }
334
336
  for (const l of p.classNames) {
335
- const { src: h, name: b } = l, f = l.generator._withBuildContext({
337
+ const { src: h, name: b } = l;
338
+ y[h] || (y[h] = []);
339
+ const f = l.generator._withBuildContext({
336
340
  callerName: b,
337
341
  isProduction: e,
338
342
  config: $
339
343
  }), S = await f.css;
340
344
  if (!S) continue;
341
345
  o[0].push(f.cssFileName);
342
- const j = `css/${f.cssFileName}`, O = r(i, j);
343
- N(O, S), $.importStrategy === "component" && (y[h] ? y[h].push(f.cssFileName) : y[h] = [f.cssFileName]);
346
+ const F = `css/${f.cssFileName}`, O = r(i, F);
347
+ x(O, S), $.importStrategy === "component" && y[h].push(f.cssFileName);
344
348
  }
345
349
  $.importStrategy === "component" && Object.entries(y).forEach(([l, h]) => {
346
350
  const b = h.map((A) => `@import url('./${A}');`).join(`
347
- `), f = v(l, 6), S = Y(l), j = G(S.name), O = r(i, `css/f_${j}-${f}.css`);
348
- N(O, b);
351
+ `), f = v(l, 6), S = Y(l), F = G(S.name), O = r(i, `css/f_${F}-${f}.css`);
352
+ x(O, b || "/* Empty file */");
349
353
  });
350
- const F = a.map((l) => `@import url('./css/${l}');`).join(`
354
+ const j = a.map((l) => `@import url('./css/${l}');`).join(`
351
355
  `);
352
- let T = `@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
356
+ let E = `@layer reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
353
357
 
354
358
  ${["_variables.css", "_reset.css", "_global.css", "_templates.css"].filter((l) => {
355
359
  try {
356
- return E(r(i, "css", l), "utf8").length > 0;
360
+ return T(r(i, "css", l), "utf8").length > 0;
357
361
  } catch {
358
362
  return !1;
359
363
  }
360
364
  }).map((l) => `@import url('./css/${l}');`).join(`
361
365
  `)}
362
- ${F}`;
366
+ ${j}`;
363
367
  if ($.importStrategy !== "component") {
364
368
  const l = o.reduce((h, b, f) => {
365
369
  const S = b.reduce((L, z) => {
366
370
  var q;
367
- const Q = r(i, "css", z), et = E(Q, "utf8"), Z = ((q = /.*-([^-]+)-\d+.css/.exec(z)) == null ? void 0 : q.at(1)) || v(Q, 6);
371
+ const Q = r(i, "css", z), et = T(Q, "utf8"), Z = ((q = /.*-([^-]+)-\d+.css/.exec(z)) == null ? void 0 : q.at(1)) || v(Q, 6);
368
372
  return L.includes(Z) ? L : `${L}
369
373
  /*start:${Z}-${z}*/
370
374
  ${et}
371
375
  /*end:${Z}*/
372
376
  `;
373
- }, ""), j = `l_${f}.css`, O = r(i, "css", j), A = `@layer l${f} { ${S}
377
+ }, ""), F = `l_${f}.css`, O = r(i, "css", F), A = `@layer l${f} { ${S}
374
378
  }`;
375
- return N(O, A), `${h}
376
- @import url('./css/${j}');`;
379
+ return x(O, A), `${h}
380
+ @import url('./css/${F}');`;
377
381
  }, "");
378
- T += l;
382
+ E += l;
379
383
  }
380
- N(d, T);
384
+ x(d, E);
381
385
  const D = Date.now() - n, K = D < 200 ? "🔥" : D < 500 ? "🚀" : D < 1e3 ? "🎉" : D < 2e3 ? "🚗" : D < 5e3 ? "🤔" : "🥴";
382
386
  X.info(`Generated CSS in ${D}ms! ${K}`);
383
387
  } catch (n) {
@@ -390,8 +394,8 @@ ${et}
390
394
  const o = [], i = await lt(t), { contents: d } = await tt(t, e, n);
391
395
  for (const [C, c] of Object.entries(d)) {
392
396
  if (c.isKeyframes && c.css) {
393
- const F = `css/${`a_${c.animationName}.css`}`, x = r(n, F);
394
- N(x, await c.css);
397
+ const j = `css/${`a_${c.animationName}.css`}`, N = r(n, j);
398
+ x(N, await c.css);
395
399
  return;
396
400
  }
397
401
  if (c.isClassName) {
@@ -399,11 +403,11 @@ ${et}
399
403
  callerName: C,
400
404
  isProduction: s,
401
405
  config: i
402
- }), F = await y.css;
403
- if (!F) continue;
406
+ }), j = await y.css;
407
+ if (!j) continue;
404
408
  o[0].push(y.cssFileName);
405
- const x = `css/${y.cssFileName}`, P = r(n, x);
406
- N(P, F);
409
+ const N = `css/${y.cssFileName}`, P = r(n, N);
410
+ x(P, j);
407
411
  }
408
412
  if (!c.generator) return;
409
413
  const u = c.generator._withBuildContext({
@@ -413,30 +417,30 @@ ${et}
413
417
  }), g = await u.css;
414
418
  if (!g) continue;
415
419
  const p = `css/${u.cssFileName}`, $ = r(n, p);
416
- N($, g), o[u.priority] || (o[u.priority] = []), o[u.priority].push(u.cssFileName);
420
+ x($, g), o[u.priority] || (o[u.priority] = []), o[u.priority].push(u.cssFileName);
417
421
  }
418
422
  if (i.importStrategy !== "component")
419
423
  o.forEach((C, c) => {
420
424
  const u = `l_${c}.css`, g = r(n, "css", u);
421
- let p = E(g, "utf8");
425
+ let p = T(g, "utf8");
422
426
  C.forEach(($) => {
423
427
  var P;
424
- const y = r(n, "css", $), F = ((P = /.*-([^-]+)-\d+.css/.exec($)) == null ? void 0 : P.at(1)) || v(y, 6);
425
- if (!p.includes(F)) {
426
- const J = E(y, "utf8"), T = `/*start:${F}-${$}*/
428
+ const y = r(n, "css", $), j = ((P = /.*-([^-]+)-\d+.css/.exec($)) == null ? void 0 : P.at(1)) || v(y, 6);
429
+ if (!p.includes(j)) {
430
+ const J = T(y, "utf8"), E = `/*start:${j}-${$}*/
427
431
  ${J}
428
- /*end:${F}*/
432
+ /*end:${j}*/
429
433
  `;
430
434
  p = `${p.replace(/\}$/, "")}
431
- ${T}
435
+ ${E}
432
436
  }`;
433
437
  }
434
- }), N(g, p);
438
+ }), x(g, p);
435
439
  });
436
440
  else {
437
441
  const C = o.flat().map(($) => `@import url('./${$}');`).join(`
438
442
  `), c = v(e, 6), u = Y(e), g = G(u.name), p = r(n, `css/f_${g}-${c}.css`);
439
- N(p, C);
443
+ x(p, C || "/* Empty file */");
440
444
  }
441
445
  }
442
446
  } catch (n) {
@@ -446,7 +450,7 @@ ${T}
446
450
  try {
447
451
  const n = await R(t);
448
452
  if (rt(e)) {
449
- const o = E(e, "utf8");
453
+ const o = T(e, "utf8");
450
454
  o.replace(/^(?!export\s)const\s.*/gm, (u) => `export ${u}`) !== o && await Dt(e, o);
451
455
  const d = await lt(t), { contents: C } = await tt(t, e, n);
452
456
  let c = o;
@@ -459,19 +463,19 @@ ${T}
459
463
  config: d
460
464
  }), $ = new RegExp(`\\s${u}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(o);
461
465
  if (!$) return console.error("Could not find the original declaration");
462
- const y = (f = $.at(1)) == null ? void 0 : f.trim(), F = new RegExp(`\\s${u}[=\\s]+styled\\(`, "g").exec(c);
463
- if (!F) return console.error("Could not find the original declaration");
464
- const { index: x } = F;
466
+ const y = (f = $.at(1)) == null ? void 0 : f.trim(), j = new RegExp(`\\s${u}[=\\s]+styled\\(`, "g").exec(c);
467
+ if (!j) return console.error("Could not find the original declaration");
468
+ const { index: N } = j;
465
469
  let P = !1;
466
470
  const J = setTimeout(() => P = !0, 5e3);
467
- let T = 0, H = !1, D = 0;
471
+ let E = 0, H = !1, D = 0;
468
472
  for (; !H && !P; ) {
469
- const S = c[x + T];
470
- S === "(" && D++, S === ")" && D--, D === 0 && S === ")" && (H = !0), T > c.length && (P = !0), T++;
473
+ const S = c[N + E];
474
+ S === "(" && D++, S === ")" && D--, D === 0 && S === ")" && (H = !0), E > c.length && (P = !0), E++;
471
475
  }
472
476
  if (!P) clearTimeout(J);
473
477
  else throw new Error("Failed to find the end of the styled call and timed out");
474
- const K = x + T, l = c.slice(x, K), h = c, b = ` ${u} = styled(${y}, "${p.classNames}", ${JSON.stringify(p.clientProps)});`;
478
+ const K = N + E, l = c.slice(N, K), h = c, b = ` ${u} = styled(${y}, "${p.classNames}", ${JSON.stringify(p.clientProps)});`;
475
479
  c = c.replace(l, b), h === c && console.error("Minimize file failed to change content", { name: u, tagName: y });
476
480
  }), d.importStrategy === "component") {
477
481
  const u = v(e, 6), g = Y(e);
@@ -494,5 +498,5 @@ export {
494
498
  rt as i,
495
499
  X as l,
496
500
  te as m,
497
- Ft as s
501
+ jt as s
498
502
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.207",
3
+ "version": "0.0.1-alpha.209",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -1,16 +1,16 @@
1
1
  import { d as V } from "./dash-case-DBThphLm.js";
2
- const A = (i) => (e) => {
2
+ const U = (i) => (e) => {
3
3
  if (typeof e != "string" || !i) return;
4
4
  let t = e;
5
5
  const f = [];
6
6
  return Object.values(i).forEach((n) => {
7
7
  const { pattern: y, transform: b } = n;
8
8
  t = t.replace(y, (P) => {
9
- const { value: j, css: E } = b(P);
10
- return E && f.push(E), j;
9
+ const { value: E, css: j } = b(P);
10
+ return j && f.push(j), E;
11
11
  });
12
12
  }), { transformed: t, additionalCss: f };
13
- }, z = (i) => (e) => typeof e != "string" || !/\{[^{}]+\}/g.test(e) ? void 0 : { transformed: e.replace(/\{([^{}]+)\}/g, (...n) => `var(--${V(n[1].replaceAll(".", "-"))})`) }, I = z(), M = [
13
+ }, z = (i) => (e) => typeof e != "string" || !/\{[^{}]+\}/g.test(e) ? void 0 : { transformed: e.replace(/\{([^{}]+)\}/g, (...n) => `var(--${V(n[1].replaceAll(".", "-"))})`) }, J = z(), M = [
14
14
  "top",
15
15
  "right",
16
16
  "bottom",
@@ -37,15 +37,15 @@ const A = (i) => (e) => {
37
37
  return `${e}${n}`;
38
38
  }
39
39
  return `${e}`;
40
- }, _ = ["Webkit", "Moz", "ms", "O"], q = (i) => i.startsWith("-") ? i : _.some((e) => i.startsWith(e)) ? `-${V(i)}` : V(i), l = async (i, e = "", t, f = !1) => {
40
+ }, _ = ["Webkit", "Moz", "ms", "O"], q = (i) => i.startsWith("-") ? i : _.some((e) => i.startsWith(e)) ? `-${V(i)}` : V(i), h = async (i, e = "", t, f = !1) => {
41
41
  if (!i) throw new Error("No styles provided to parseStyles function!");
42
- const n = /* @__PURE__ */ new Set(), b = Object.entries(i).map(async ([$, s]) => {
42
+ const n = /* @__PURE__ */ new Set(), b = Object.entries(i).map(async ([u, s]) => {
43
43
  var w;
44
- const r = $.trim(), h = q(r), c = (a, d = ";") => `${h}:${a}${d}`;
44
+ const r = u.trim(), $ = q(r), c = (a, d = ";") => `${$}:${a}${d}`;
45
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
46
  const { default: a } = await import(t.templatePaths[r]);
47
47
  if (typeof a.params[r] == "function") {
48
- const d = await a.params[r](s), [o] = await l(d, "");
48
+ const d = await a.params[r](s), [o] = await h(d, "");
49
49
  return o;
50
50
  }
51
51
  }
@@ -53,7 +53,7 @@ const A = (i) => (e) => {
53
53
  if (f) return;
54
54
  const d = s.split(".").reduce((o, p) => o[p], t.templates[r]);
55
55
  if (d) {
56
- const [o] = await l(d, "");
56
+ const [o] = await h(d, "");
57
57
  return o;
58
58
  }
59
59
  console.warn(`Template "${r}" with path of "${s}" was not found in config!`);
@@ -65,46 +65,46 @@ const A = (i) => (e) => {
65
65
  if (r === "defaultVariants") return;
66
66
  if (r === "variants") {
67
67
  const o = Object.entries(s);
68
- for (const [p, u] of o) {
69
- if (!u) return;
70
- const C = Object.entries(u);
71
- for (const [W, m] of C) {
72
- if (!m) return;
73
- const T = `${e}.${p}-${W}`;
74
- (await l(m, T, t)).forEach((U) => n.add(U));
68
+ for (const [p, m] of o) {
69
+ if (!m) return;
70
+ const C = Object.entries(m);
71
+ for (const [A, l] of C) {
72
+ if (!l) return;
73
+ const T = `${e}.${p}-${A}`;
74
+ (await h(l, T, t)).forEach((S) => n.add(S));
75
75
  }
76
76
  }
77
77
  return;
78
78
  }
79
79
  if (r === "compoundVariants") {
80
80
  for (const o of s) {
81
- const { css: p, ...u } = o, C = Object.entries(u).reduce((m, [T, N]) => `${m}.${T}-${N}`, e);
82
- (await l(p, C, t)).forEach((m) => n.add(m));
81
+ const { css: p, ...m } = o, C = Object.entries(m).reduce((l, [T, N]) => `${l}.${T}-${N}`, e);
82
+ (await h(p, C, t)).forEach((l) => n.add(l));
83
83
  }
84
84
  return;
85
85
  }
86
86
  if (r.startsWith("@")) {
87
- const o = ((w = t == null ? void 0 : t.mediaQueries) == null ? void 0 : w[r]) || r, p = await k(s, e, t), u = `${o} { ${p} }`;
88
- n.add(u);
87
+ const o = ((w = t == null ? void 0 : t.mediaQueries) == null ? void 0 : w[r]) || r, p = await k(s, e, t), m = `${o} { ${p} }`;
88
+ n.add(m);
89
89
  return;
90
90
  }
91
- const a = $.includes("&") ? r.replace("&", e) : r.startsWith(":") ? `${e}${r}` : `${e} ${r}`;
92
- (await l(s, a, t)).forEach((o) => n.add(o));
91
+ const a = u.includes("&") ? r.replace("&", e) : r.startsWith(":") ? `${e}${r}` : `${e} ${r}`;
92
+ (await h(s, a, t)).forEach((o) => n.add(o));
93
93
  return;
94
94
  }
95
95
  if (typeof s == "number") {
96
- const a = Q(h, s, t);
96
+ const a = Q($, s, t);
97
97
  return c(a);
98
98
  }
99
99
  if (typeof s != "string")
100
100
  if ("toString" in s) s = s.toString();
101
- else throw new Error(`Invalid value type for property ${h}`);
101
+ else throw new Error(`Invalid value type for property ${$}`);
102
102
  return c(s);
103
- }), { modifiers: P } = t || {}, j = [z(), A(P)], x = (await Promise.all(b).then(($) => Promise.all(
104
- $.map((s) => j.reduce(async (r, h) => {
103
+ }), { modifiers: P } = t || {}, E = [z(), U(P)], x = (await Promise.all(b).then((u) => Promise.all(
104
+ u.map((s) => E.reduce(async (r, $) => {
105
105
  const c = await r;
106
106
  if (!c) return c;
107
- const O = await h(c);
107
+ const O = await $(c);
108
108
  if (!O) return c;
109
109
  const { transformed: w, additionalCss: a } = O;
110
110
  let d = "";
@@ -113,14 +113,16 @@ const A = (i) => (e) => {
113
113
  d += await k(o, "");
114
114
  return `${d}${w}`;
115
115
  }, Promise.resolve(s)))
116
- ))).join(`
117
- `);
118
- if (!x.trim()) return n;
119
- const S = e ? `${e} { ${x} }` : x;
120
- return n.add(S), n;
121
- }, k = async (i, e, t, f = !1) => [...await l(i, e, t, f)].join(`
116
+ ))).filter((u) => u !== void 0).join(`
117
+ `);
118
+ if (!x.trim()) return Array.from(n);
119
+ const W = e ? `${e} {
120
+ ${x}
121
+ }` : x;
122
+ return n.has(W) ? Array.from(n) : [W, ...n];
123
+ }, k = async (i, e, t, f = !1) => (await h(i, e, t, f)).join(`
122
124
  `);
123
125
  export {
124
- I as a,
126
+ J as a,
125
127
  k as p
126
128
  };
@@ -0,0 +1,5 @@
1
+ "use strict";const V=require("./dash-case-BJEkFEGQ.cjs"),U=a=>e=>{if(typeof e!="string"||!a)return;let t=e;const f=[];return Object.values(a).forEach(n=>{const{pattern:y,transform:b}=n;t=t.replace(y,P=>{const{value:E,css:j}=b(P);return j&&f.push(j),E})}),{transformed:t,additionalCss:f}},S=a=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${V.dashCase(n[1].replaceAll(".","-"))})`)},q=S(),J=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],M=(a,e,t)=>{if(J.some(n=>typeof n=="string"?n===a:n.test(a))){const n=(t==null?void 0:t.defaultUnit)||"px";return`${e}${n}`}return`${e}`},Q=["Webkit","Moz","ms","O"],_=a=>a.startsWith("-")?a:Q.some(e=>a.startsWith(e))?`-${V.dashCase(a)}`:V.dashCase(a),h=async(a,e="",t,f=!1)=>{if(!a)throw new Error("No styles provided to parseStyles function!");const n=new Set,b=Object.entries(a).map(async([p,s])=>{var w;const r=p.trim(),$=_(r),c=(o,d=";")=>`${$}:${o}${d}`;if(typeof s=="function"&&(s=s({scope:e,config:t})),s instanceof Promise&&(s=await s),t!=null&&t.templates&&t.templatePaths[r]){const{default:o}=await import(t.templatePaths[r]);if(typeof o.params[r]=="function"){const d=await o.params[r](s),[i]=await h(d,"");return i}}if(t!=null&&t.templates&&t.templates[r]){if(f)return;const d=s.split(".").reduce((i,u)=>i[u],t.templates[r]);if(d){const[i]=await h(d,"");return i}console.warn(`Template "${r}" with path of "${s}" was not found in config!`);return}if(typeof s=="object"){if(!s)return;if(s.isColor)return c(s.toString());if(r==="defaultVariants")return;if(r==="variants"){const i=Object.entries(s);for(const[u,l]of i){if(!l)return;const O=Object.entries(l);for(const[k,m]of O){if(!m)return;const T=`${e}.${u}-${k}`;(await h(m,T,t)).forEach(z=>n.add(z))}}return}if(r==="compoundVariants"){for(const i of s){const{css:u,...l}=i,O=Object.entries(l).reduce((m,[T,N])=>`${m}.${T}-${N}`,e);(await h(u,O,t)).forEach(m=>n.add(m))}return}if(r.startsWith("@")){const i=((w=t==null?void 0:t.mediaQueries)==null?void 0:w[r])||r,u=await A(s,e,t),l=`${i} { ${u} }`;n.add(l);return}const o=p.includes("&")?r.replace("&",e):r.startsWith(":")?`${e}${r}`:`${e} ${r}`;(await h(s,o,t)).forEach(i=>n.add(i));return}if(typeof s=="number"){const o=M($,s,t);return c(o)}if(typeof s!="string")if("toString"in s)s=s.toString();else throw new Error(`Invalid value type for property ${$}`);return c(s)}),{modifiers:P}=t||{},E=[S(),U(P)],C=(await Promise.all(b).then(p=>Promise.all(p.map(s=>E.reduce(async(r,$)=>{const c=await r;if(!c)return c;const x=await $(c);if(!x)return c;const{transformed:w,additionalCss:o}=x;let d="";if(o)for(const i of o)d+=await A(i,"");return`${d}${w}`},Promise.resolve(s)))))).filter(p=>p!==void 0).join(`
2
+ `);if(!C.trim())return Array.from(n);const W=e?`${e} {
3
+ ${C}
4
+ }`:C;return n.has(W)?Array.from(n):[W,...n]},A=async(a,e,t,f=!1)=>(await h(a,e,t,f)).join(`
5
+ `);exports.parseAndJoinStyles=A;exports.parseVariableTokens=q;
@@ -9,5 +9,5 @@ import { CachedConfig, SaltyConfig } from '../types/config-types';
9
9
  * - First item is the main class with all the styles
10
10
  * - Rest of the items are child selectors or media queries etc.
11
11
  */
12
- export declare const parseStyles: <T extends object>(styles?: T, currentScope?: string, config?: (SaltyConfig & CachedConfig) | undefined, omitTemplates?: boolean) => Promise<Set<string>>;
12
+ export declare const parseStyles: <T extends object>(styles?: T, currentScope?: string, config?: (SaltyConfig & CachedConfig) | undefined, omitTemplates?: boolean) => Promise<string[]>;
13
13
  export declare const parseAndJoinStyles: <T extends object>(styles: T, currentClass: string, config?: (SaltyConfig & CachedConfig) | undefined, omitTemplates?: boolean) => Promise<string>;
package/server/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("fs/promises"),r=require("../index-BZxPdVzL.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)};exports.checkShouldRestart=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("fs/promises"),r=require("../index-C5koRP2C.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)};exports.checkShouldRestart=i;
package/server/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { readFile as r } from "fs/promises";
2
- import { i as e } from "../index-Djy7Z9Ft.js";
2
+ import { i as e } from "../index-DXHGOCFn.js";
3
3
  const f = async (t) => {
4
4
  if (!t || t.includes("node_modules") || t.includes("saltygen")) return !1;
5
5
  if (t.includes("salty.config")) return !0;
@@ -1,3 +0,0 @@
1
- "use strict";const x=require("./dash-case-BJEkFEGQ.cjs"),U=i=>e=>{if(typeof e!="string"||!i)return;let t=e;const c=[];return Object.values(i).forEach(n=>{const{pattern:y,transform:b}=n;t=t.replace(y,P=>{const{value:j,css:C}=b(P);return C&&c.push(C),j})}),{transformed:t,additionalCss:c}},S=i=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${x.dashCase(n[1].replaceAll(".","-"))})`)},q=S(),J=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],M=(i,e,t)=>{if(J.some(n=>typeof n=="string"?n===i:n.test(i))){const n=(t==null?void 0:t.defaultUnit)||"px";return`${e}${n}`}return`${e}`},Q=["Webkit","Moz","ms","O"],_=i=>i.startsWith("-")?i:Q.some(e=>i.startsWith(e))?`-${x.dashCase(i)}`:x.dashCase(i),m=async(i,e="",t,c=!1)=>{if(!i)throw new Error("No styles provided to parseStyles function!");const n=new Set,b=Object.entries(i).map(async([$,s])=>{var w;const r=$.trim(),h=_(r),f=(o,d=";")=>`${h}:${o}${d}`;if(typeof s=="function"&&(s=s({scope:e,config:t})),s instanceof Promise&&(s=await s),t!=null&&t.templates&&t.templatePaths[r]){const{default:o}=await import(t.templatePaths[r]);if(typeof o.params[r]=="function"){const d=await o.params[r](s),[a]=await m(d,"");return a}}if(t!=null&&t.templates&&t.templates[r]){if(c)return;const d=s.split(".").reduce((a,p)=>a[p],t.templates[r]);if(d){const[a]=await m(d,"");return a}console.warn(`Template "${r}" with path of "${s}" was not found in config!`);return}if(typeof s=="object"){if(!s)return;if(s.isColor)return f(s.toString());if(r==="defaultVariants")return;if(r==="variants"){const a=Object.entries(s);for(const[p,u]of a){if(!u)return;const T=Object.entries(u);for(const[k,l]of T){if(!l)return;const V=`${e}.${p}-${k}`;(await m(l,V,t)).forEach(A=>n.add(A))}}return}if(r==="compoundVariants"){for(const a of s){const{css:p,...u}=a,T=Object.entries(u).reduce((l,[V,N])=>`${l}.${V}-${N}`,e);(await m(p,T,t)).forEach(l=>n.add(l))}return}if(r.startsWith("@")){const a=((w=t==null?void 0:t.mediaQueries)==null?void 0:w[r])||r,p=await W(s,e,t),u=`${a} { ${p} }`;n.add(u);return}const o=$.includes("&")?r.replace("&",e):r.startsWith(":")?`${e}${r}`:`${e} ${r}`;(await m(s,o,t)).forEach(a=>n.add(a));return}if(typeof s=="number"){const o=M(h,s,t);return f(o)}if(typeof s!="string")if("toString"in s)s=s.toString();else throw new Error(`Invalid value type for property ${h}`);return f(s)}),{modifiers:P}=t||{},j=[S(),U(P)],E=(await Promise.all(b).then($=>Promise.all($.map(s=>j.reduce(async(r,h)=>{const f=await r;if(!f)return f;const O=await h(f);if(!O)return f;const{transformed:w,additionalCss:o}=O;let d="";if(o)for(const a of o)d+=await W(a,"");return`${d}${w}`},Promise.resolve(s)))))).join(`
2
- `);if(!E.trim())return n;const z=e?`${e} { ${E} }`:E;return n.add(z),n},W=async(i,e,t,c=!1)=>[...await m(i,e,t,c)].join(`
3
- `);exports.parseAndJoinStyles=W;exports.parseVariableTokens=q;