@salty-css/core 0.0.1-alpha.250 → 0.0.1-alpha.251

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"),A=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),e=require("../index-CelIwoBr.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora"),ae=require("../should-restart-DJb3U4c8.cjs");var G=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,P)=>{se.exec(y,x=>{if(x)return P(x);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(),x=y.join(" ");await X(`npm install ${x}`),P.succeed(`Installed packages: ${C}`)},re=()=>A.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!re())return;await X(`./node_modules/.bin/prettier --write "${y}"`),e.logger.info(`Formatted ${y} with Prettier`)}catch(C){e.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function ce(){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:f}=await C[i],d=ne.render(f,a);return{fileName:i,content:d}},x=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:G&&G.tagName.toUpperCase()==="SCRIPT"&&G.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await x()).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}`},H=i=>{const a=i==="."?"":i,f=process.cwd();return n.join(f,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 e.logError("Salty CSS project must be initialized in a directory with a package.json file.");e.logger.info("Initializing a new Salty-CSS project!");const{dir:f=i,cssFile:d,skipInstall:p}=this.opts();if(!f)return e.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 c=process.cwd(),r=H(f),q=await Promise.all([P("salty.config.ts"),P("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=q.map(async({fileName:t,content:u})=>{const l=n.join(r,t);if(await s.readFile(l,"utf-8").catch(()=>{})!==void 0){e.logger.debug("File already exists: "+l);return}const k=t.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),e.logger.info("Creating file: "+l),await s.writeFile(l,u),await S(l)});await Promise.all(m);const w=n.relative(c,r)||".",h=n.join(c,".saltyrc.json"),g=await s.readFile(h,"utf-8").catch(()=>{});if(g===void 0){e.logger.info("Creating file: "+h);const u=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,u),await S(h)}else{const t=JSON.parse(g),u=(t==null?void 0:t.projects)||[];if(u.findIndex(o=>o.dir===w)===-1){u.push({dir:w,framework:"react"}),t.projects=[...u];const o=JSON.stringify(t,null,2);o!==g&&(e.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(c,".gitignore"),T=await s.readFile(j,"utf-8").catch(()=>{});T!==void 0&&(T.includes("saltygen")||(e.logger.info("Edit file: "+j),await s.writeFile(j,T+`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),A=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),e=require("../index-DyGh-vDg.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora"),ae=require("../should-restart-CYlWrlX_.cjs");var G=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,P)=>{se.exec(y,x=>{if(x)return P(x);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(),x=y.join(" ");await X(`npm install ${x}`),P.succeed(`Installed packages: ${C}`)},re=()=>A.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!re())return;await X(`./node_modules/.bin/prettier --write "${y}"`),e.logger.info(`Formatted ${y} with Prettier`)}catch(C){e.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function ce(){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:f}=await C[i],d=ne.render(f,a);return{fileName:i,content:d}},x=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:G&&G.tagName.toUpperCase()==="SCRIPT"&&G.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await x()).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}`},H=i=>{const a=i==="."?"":i,f=process.cwd();return n.join(f,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 e.logError("Salty CSS project must be initialized in a directory with a package.json file.");e.logger.info("Initializing a new Salty-CSS project!");const{dir:f=i,cssFile:d,skipInstall:p}=this.opts();if(!f)return e.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 c=process.cwd(),r=H(f),q=await Promise.all([P("salty.config.ts"),P("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=q.map(async({fileName:t,content:u})=>{const l=n.join(r,t);if(await s.readFile(l,"utf-8").catch(()=>{})!==void 0){e.logger.debug("File already exists: "+l);return}const k=t.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),e.logger.info("Creating file: "+l),await s.writeFile(l,u),await S(l)});await Promise.all(m);const w=n.relative(c,r)||".",h=n.join(c,".saltyrc.json"),g=await s.readFile(h,"utf-8").catch(()=>{});if(g===void 0){e.logger.info("Creating file: "+h);const u=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,u),await S(h)}else{const t=JSON.parse(g),u=(t==null?void 0:t.projects)||[];if(u.findIndex(o=>o.dir===w)===-1){u.push({dir:w,framework:"react"}),t.projects=[...u];const o=JSON.stringify(t,null,2);o!==g&&(e.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(c,".gitignore"),T=await s.readFile(j,"utf-8").catch(()=>{});T!==void 0&&(T.includes("saltygen")||(e.logger.info("Edit file: "+j),await s.writeFile(j,T+`
2
2
 
3
3
  # Salty-CSS
4
4
  saltygen
package/bin/main.js CHANGED
@@ -3,11 +3,11 @@ import { existsSync as Q, watch as re } from "fs";
3
3
  import { mkdir as q, readFile as S, writeFile as C } from "fs/promises";
4
4
  import { join as a, relative as z, parse as ce, format as te } from "path";
5
5
  import { render as le } from "ejs";
6
- import { l as t, a as h, g as K, i as de, b as fe } from "../index-B_V_O1Qg.js";
6
+ import { l as t, a as h, g as K, i as de, b as fe } from "../index-98hLLzQu.js";
7
7
  import { p as pe } from "../pascal-case-BQpR5PdN.js";
8
8
  import { exec as ue } from "child_process";
9
9
  import ge from "ora";
10
- import { c as ye } from "../should-restart-eXCtNI8U.js";
10
+ import { c as ye } from "../should-restart-B8yt6be1.js";
11
11
  const ne = (g) => new Promise((P, x) => {
12
12
  ue(g, ($) => {
13
13
  if ($) return x($);
@@ -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-CXclnoUS.cjs");const e=require("../index-CelIwoBr.cjs");require("../css/merge.cjs");require("../define-templates-Cunsb_Tr.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-DYBhuRjk.cjs");const e=require("../index-DyGh-vDg.cjs");require("../css/merge.cjs");require("../define-templates-Cunsb_Tr.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-DZ-LjC9e.js";
8
- import { e as g, d as F, g as y, b as x, i as S, m as c, s as f, c as C } from "../index-B_V_O1Qg.js";
7
+ import "../parse-styles-r5eD5mRH.js";
8
+ import { e as g, d as F, g as y, b as x, i as S, m as c, s as f, c as C } from "../index-98hLLzQu.js";
9
9
  import "../css/merge.js";
10
10
  import "../define-templates-4A2yHcMF.js";
11
11
  export {
package/css/keyframes.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../parse-styles-CXclnoUS.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-DYBhuRjk.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-DZ-LjC9e.js";
1
+ import { p as m } from "../parse-styles-r5eD5mRH.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-CXclnoUS.cjs"),c=require("../dash-case-BJEkFEGQ.cjs");class y{constructor(t){m(this,"buildContext",{});this.params=t}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){const{base:t,variants:s,compoundVariants:e}=this.params;return c.toHash({base:t,variants:s,compoundVariants:e})}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 y{constructor(t){super(t),this._params=t}}class x extends y{constructor(t,s){super(s),this.tagName=t,this._params=s}get priority(){var t;return this.params.priority?this.params.priority: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:f,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:f}}}}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-DYBhuRjk.cjs"),c=require("../dash-case-BJEkFEGQ.cjs");class y{constructor(t){m(this,"buildContext",{});this.params=t}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){const{base:t,variants:s,compoundVariants:e}=this.params;return c.toHash({base:t,variants:s,compoundVariants:e})}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 y{constructor(t){super(t),this._params=t}}class x extends y{constructor(t,s){super(s),this.tagName=t,this._params=s}get priority(){var t;return this.params.priority?this.params.priority: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:f,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:f}}}}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-DZ-LjC9e.js";
4
+ import { p as x } from "../parse-styles-r5eD5mRH.js";
5
5
  import { t as m, d as f } from "../dash-case-DBThphLm.js";
6
6
  class y {
7
7
  constructor(t) {
@@ -4,7 +4,7 @@ import { d as K, t as J } from "./dash-case-DBThphLm.js";
4
4
  import { join as r, parse as tt } from "path";
5
5
  import { existsSync as ut, writeFileSync as j, mkdirSync as H, readFileSync as _, statSync as Et, readdirSync as Ot } from "fs";
6
6
  import { readFile as Ct } from "fs/promises";
7
- import { p as ft, a as Mt } from "./parse-styles-DZ-LjC9e.js";
7
+ import { p as ft, a as Mt } from "./parse-styles-r5eD5mRH.js";
8
8
  import { createLogger as Rt, format as rt, transports as Jt } from "winston";
9
9
  import { mergeObjects as I, mergeFactories as zt } from "./css/merge.js";
10
10
  import { d as Wt } from "./define-templates-4A2yHcMF.js";
@@ -1,5 +1,5 @@
1
- "use strict";const Te=require("esbuild"),Oe=require("child_process"),D=require("./dash-case-BJEkFEGQ.cjs"),c=require("path"),l=require("fs"),we=require("fs/promises"),Z=require("./parse-styles-CXclnoUS.cjs"),Q=require("winston"),J=require("./css/merge.cjs"),Ee=require("./define-templates-Cunsb_Tr.cjs"),ce=require("typescript");var re=typeof document<"u"?document.currentScript:null;function Ve(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 Se=Ve(Te),je=async(e,t=[])=>{if(!e)return"";const s=[],n={};for(const[o,a]of Object.entries(e))if(typeof a!="function")if(a&&typeof a=="object"){const i=o.trim(),d=await je(a,[...t,i]);s.push(d)}else n[o]=a;if(Object.keys(n).length){const o=t.map(D.dashCase).join("-"),a="t_"+D.toHash(o,4),i=await Z.parseAndJoinStyles(n,`.${o}, .${a}`);s.push(i)}return s.join(`
2
- `)},ve=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="function"?t[s]="any":typeof n=="object"&&(t[s]=be(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},be=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const a=t?`${t}.${n}`:n;return typeof o=="object"?be(o,a,s):s.add(t)}),[...s]):[],$e=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=c.join(e,"package.json");return l.existsSync(t)?t:$e(c.join(e,".."))},Re=async e=>{const t=$e(e);return await we.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Me=async e=>{const t=await Re(e);if(t)return t.type};let H;const Fe=async e=>{if(H)return H;const t=await Me(e);return t==="module"?H="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:re&&re.tagName.toUpperCase()==="SCRIPT"&&re.src||new URL("index-CelIwoBr.cjs",document.baseURI).href).endsWith(".cjs"))&&(H="cjs"),H||"esm"},B=Q.createLogger({level:"debug",format:Q.format.combine(Q.format.colorize(),Q.format.cli()),transports:[new Q.transports.Console({})]}),Je=e=>{B.error(e)};function Ce(e){return e?typeof e!="string"?Ce(String(e)):e.replace(/[^\d\w]/g,"."):""}const ze={"*, *::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"}},qe=(e,t)=>new Promise((s,n)=>{const o=setTimeout(()=>{n(new Error("Timeout"))},100),a=ce.createSourceFile("temp.ts",e,ce.ScriptTarget.Latest,!0);function i(d){if(ce.isVariableDeclaration(d)&&d.name.getText()===t){const S=d.getStart(),m=d.getEnd();clearTimeout(o),s([S,m])}d.forEachChild(i)}i(a)}),E={externalModules:[],rcFile:void 0,destDir:void 0},Pe=e=>{if(E.externalModules.length>0)return E.externalModules;const s=l.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return E.externalModules=n,n},z=async e=>{if(E.destDir)return E.destDir;const t=await fe(e),s=c.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return E.destDir=s,s},le=["salty","css","styles","styled"],Ne=(e=[])=>new RegExp(`\\.(${[...le,...e].join("|")})\\.`),ee=(e,t=[])=>Ne(t).test(e),xe=async e=>{if(E.rcFile)return E.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=c.join(e,".saltyrc.json"),s=await we.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(E.rcFile=s,s):xe(c.join(e,".."))},fe=async e=>{var n,o;const t=await xe(e),s=(n=t.projects)==null?void 0:n.find(a=>e.endsWith(a.dir||""));return s||((o=t.projects)==null?void 0:o.find(a=>a.dir===t.defaultProject))},He=async e=>{const t=await fe(e),s=await z(e),n=c.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=c.join(s,"salty.config.js"),a=await Fe(e),i=Pe(n);await Se.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:a,external:i});const d=Date.now(),{config:S}=await import(`${o}?t=${d}`);return{config:S,path:o}},ke=async(e,t)=>{var me,ye;const s=await z(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async w=>{const{contents:$,outputFilePath:K}=await U(e,w,s);Object.entries($).forEach(([_,P])=>{P.isMedia?n.mediaQueries.push([_,P]):P.isGlobalDefine?n.globalStyles.push(P):P.isDefineVariables?n.variables.push(P):P.isDefineTemplates&&n.templates.push(P._setPath(`${_};;${K}`))})}));const{config:o,path:a}=await He(e),i={...o},{mediaQueries:d}=n;i.mediaQueries=Object.fromEntries(d.map(([w,$])=>[`@${w}`,$]));const S=d.map(([w])=>`'@${w}'`).join(" | "),m=new Set,r=async(w,$=[])=>{if(!w)return[];const K=Object.entries(w).map(async([P,M])=>{const L=async T=>{if(!T)return;if(T instanceof Promise)return await L(await T);if(typeof T=="function")return await L(await T());if(typeof T=="object")return await r(T,[...$,P]);const oe=Ce(P),ie=D.dashCase(P),ae=[...$,oe].join(".");m.add(`"${ae}"`);const Y=[...$.map(D.dashCase),ie].join("-"),ge=Z.parseVariableTokens(T);return ge?`--${Y}: ${ge.transformed};`:`--${Y}: ${T};`};return await L(M)});return(await Promise.all(K)).flat()},g=async w=>{if(!w)return[];const $=Object.entries(w).map(async([_,P])=>{const M=await r(P);return _==="base"?M.join(""):i.mediaQueries[_]?`${i.mediaQueries[_]} { ${M.join("")} }`:`${_} { ${M.join("")} }`});return(await Promise.all($)).flat()},y=async w=>{if(!w)return[];const $=Object.entries(w).map(async([_,P])=>{const M=Object.entries(P).map(async([T,oe])=>{const ie=await r(oe,[_]),ae=`.${_}-${T}, [data-${_}="${T}"]`,Y=ie.join("");return`${ae} { ${Y} }`});return(await Promise.all(M)).flat()});return(await Promise.all($)).flat()},h=w=>({...w,responsive:void 0,conditional:void 0}),p=w=>n.variables.map($=>w==="static"?h($._current):$._current[w]),F=J.mergeObjects(h(o.variables),p("static")),x=await r(F),k=J.mergeObjects((me=o.variables)==null?void 0:me.responsive,p("responsive")),V=await g(k),q=J.mergeObjects((ye=o.variables)==null?void 0:ye.conditional,p("conditional")),A=await y(q),de=c.join(s,"css/_variables.css"),v=`:root { ${x.join("")} ${V.join("")} } ${A.join("")}`;l.writeFileSync(de,v),i.staticVariables=F;const te=c.join(s,"css/_global.css"),u=J.mergeObjects(o.global,n.globalStyles),j=await Z.parseAndJoinStyles(u,"");l.writeFileSync(te,`@layer global { ${j} }`);const b=c.join(s,"css/_reset.css"),C=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:ze,N=await Z.parseAndJoinStyles(C,"");l.writeFileSync(b,`@layer reset { ${N} }`);const O=c.join(s,"css/_templates.css"),R=J.mergeObjects(o.templates,n.templates),W=await je(R),I=ve(R);l.writeFileSync(O,`@layer templates { ${W} }`),i.templates=R;const X=o.templates?[Ee.defineTemplates(o.templates)._setPath(`config;;${a}`)]:[],se=J.mergeFactories(n.templates,X);i.templatePaths=Object.fromEntries(Object.entries(se).map(([w,$])=>[w,$._path]));const G=c.join(s,"types/css-tokens.d.ts"),De=`
1
+ "use strict";const Te=require("esbuild"),Oe=require("child_process"),D=require("./dash-case-BJEkFEGQ.cjs"),c=require("path"),l=require("fs"),we=require("fs/promises"),Z=require("./parse-styles-DYBhuRjk.cjs"),Q=require("winston"),J=require("./css/merge.cjs"),Ee=require("./define-templates-Cunsb_Tr.cjs"),ce=require("typescript");var re=typeof document<"u"?document.currentScript:null;function Ve(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 Se=Ve(Te),je=async(e,t=[])=>{if(!e)return"";const s=[],n={};for(const[o,a]of Object.entries(e))if(typeof a!="function")if(a&&typeof a=="object"){const i=o.trim(),d=await je(a,[...t,i]);s.push(d)}else n[o]=a;if(Object.keys(n).length){const o=t.map(D.dashCase).join("-"),a="t_"+D.toHash(o,4),i=await Z.parseAndJoinStyles(n,`.${o}, .${a}`);s.push(i)}return s.join(`
2
+ `)},ve=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="function"?t[s]="any":typeof n=="object"&&(t[s]=be(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},be=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const a=t?`${t}.${n}`:n;return typeof o=="object"?be(o,a,s):s.add(t)}),[...s]):[],$e=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=c.join(e,"package.json");return l.existsSync(t)?t:$e(c.join(e,".."))},Re=async e=>{const t=$e(e);return await we.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Me=async e=>{const t=await Re(e);if(t)return t.type};let H;const Fe=async e=>{if(H)return H;const t=await Me(e);return t==="module"?H="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:re&&re.tagName.toUpperCase()==="SCRIPT"&&re.src||new URL("index-DyGh-vDg.cjs",document.baseURI).href).endsWith(".cjs"))&&(H="cjs"),H||"esm"},B=Q.createLogger({level:"debug",format:Q.format.combine(Q.format.colorize(),Q.format.cli()),transports:[new Q.transports.Console({})]}),Je=e=>{B.error(e)};function Ce(e){return e?typeof e!="string"?Ce(String(e)):e.replace(/[^\d\w]/g,"."):""}const ze={"*, *::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"}},qe=(e,t)=>new Promise((s,n)=>{const o=setTimeout(()=>{n(new Error("Timeout"))},100),a=ce.createSourceFile("temp.ts",e,ce.ScriptTarget.Latest,!0);function i(d){if(ce.isVariableDeclaration(d)&&d.name.getText()===t){const S=d.getStart(),m=d.getEnd();clearTimeout(o),s([S,m])}d.forEachChild(i)}i(a)}),E={externalModules:[],rcFile:void 0,destDir:void 0},Pe=e=>{if(E.externalModules.length>0)return E.externalModules;const s=l.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return E.externalModules=n,n},z=async e=>{if(E.destDir)return E.destDir;const t=await fe(e),s=c.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return E.destDir=s,s},le=["salty","css","styles","styled"],Ne=(e=[])=>new RegExp(`\\.(${[...le,...e].join("|")})\\.`),ee=(e,t=[])=>Ne(t).test(e),xe=async e=>{if(E.rcFile)return E.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=c.join(e,".saltyrc.json"),s=await we.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(E.rcFile=s,s):xe(c.join(e,".."))},fe=async e=>{var n,o;const t=await xe(e),s=(n=t.projects)==null?void 0:n.find(a=>e.endsWith(a.dir||""));return s||((o=t.projects)==null?void 0:o.find(a=>a.dir===t.defaultProject))},He=async e=>{const t=await fe(e),s=await z(e),n=c.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=c.join(s,"salty.config.js"),a=await Fe(e),i=Pe(n);await Se.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:a,external:i});const d=Date.now(),{config:S}=await import(`${o}?t=${d}`);return{config:S,path:o}},ke=async(e,t)=>{var me,ye;const s=await z(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async w=>{const{contents:$,outputFilePath:K}=await U(e,w,s);Object.entries($).forEach(([_,P])=>{P.isMedia?n.mediaQueries.push([_,P]):P.isGlobalDefine?n.globalStyles.push(P):P.isDefineVariables?n.variables.push(P):P.isDefineTemplates&&n.templates.push(P._setPath(`${_};;${K}`))})}));const{config:o,path:a}=await He(e),i={...o},{mediaQueries:d}=n;i.mediaQueries=Object.fromEntries(d.map(([w,$])=>[`@${w}`,$]));const S=d.map(([w])=>`'@${w}'`).join(" | "),m=new Set,r=async(w,$=[])=>{if(!w)return[];const K=Object.entries(w).map(async([P,M])=>{const L=async T=>{if(!T)return;if(T instanceof Promise)return await L(await T);if(typeof T=="function")return await L(await T());if(typeof T=="object")return await r(T,[...$,P]);const oe=Ce(P),ie=D.dashCase(P),ae=[...$,oe].join(".");m.add(`"${ae}"`);const Y=[...$.map(D.dashCase),ie].join("-"),ge=Z.parseVariableTokens(T);return ge?`--${Y}: ${ge.transformed};`:`--${Y}: ${T};`};return await L(M)});return(await Promise.all(K)).flat()},g=async w=>{if(!w)return[];const $=Object.entries(w).map(async([_,P])=>{const M=await r(P);return _==="base"?M.join(""):i.mediaQueries[_]?`${i.mediaQueries[_]} { ${M.join("")} }`:`${_} { ${M.join("")} }`});return(await Promise.all($)).flat()},y=async w=>{if(!w)return[];const $=Object.entries(w).map(async([_,P])=>{const M=Object.entries(P).map(async([T,oe])=>{const ie=await r(oe,[_]),ae=`.${_}-${T}, [data-${_}="${T}"]`,Y=ie.join("");return`${ae} { ${Y} }`});return(await Promise.all(M)).flat()});return(await Promise.all($)).flat()},h=w=>({...w,responsive:void 0,conditional:void 0}),p=w=>n.variables.map($=>w==="static"?h($._current):$._current[w]),F=J.mergeObjects(h(o.variables),p("static")),x=await r(F),k=J.mergeObjects((me=o.variables)==null?void 0:me.responsive,p("responsive")),V=await g(k),q=J.mergeObjects((ye=o.variables)==null?void 0:ye.conditional,p("conditional")),A=await y(q),de=c.join(s,"css/_variables.css"),v=`:root { ${x.join("")} ${V.join("")} } ${A.join("")}`;l.writeFileSync(de,v),i.staticVariables=F;const te=c.join(s,"css/_global.css"),u=J.mergeObjects(o.global,n.globalStyles),j=await Z.parseAndJoinStyles(u,"");l.writeFileSync(te,`@layer global { ${j} }`);const b=c.join(s,"css/_reset.css"),C=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:ze,N=await Z.parseAndJoinStyles(C,"");l.writeFileSync(b,`@layer reset { ${N} }`);const O=c.join(s,"css/_templates.css"),R=J.mergeObjects(o.templates,n.templates),W=await je(R),I=ve(R);l.writeFileSync(O,`@layer templates { ${W} }`),i.templates=R;const X=o.templates?[Ee.defineTemplates(o.templates)._setPath(`config;;${a}`)]:[],se=J.mergeFactories(n.templates,X);i.templatePaths=Object.fromEntries(Object.entries(se).map(([w,$])=>[w,$._path]));const G=c.join(s,"types/css-tokens.d.ts"),De=`
3
3
  // Variable types
4
4
  type VariableTokens = ${[...m].join("|")};
5
5
  type PropertyValueToken = \`{\${VariableTokens}}\`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.250",
3
+ "version": "0.0.1-alpha.251",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -1,5 +1,5 @@
1
- "use strict";const V=require("./dash-case-BJEkFEGQ.cjs"),k=a=>e=>{if(typeof e!="string"||!a)return;let t=e;const u=[];return Object.values(a).forEach(n=>{const{pattern:b,transform:y}=n;t=t.replace(b,x=>{const{value:O,css:E}=y(x);return E&&u.push(E),O})}),{transformed:t,additionalCss:u}},z=a=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${V.dashCase(n[1].replaceAll(".","-"))})`)},q=z(),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),$=async(a,e="",t,u=!1)=>{if(!a)throw new Error("No styles provided to parseStyles function!");const n=new Set,b=Object.entries(a),y=async([p,s])=>{var C;const r=p.trim(),w=_(r),l=(i,d=";")=>`${w}:${i}${d}`,P={scope:e,config:t};if(typeof s=="function")return y([p,s(P)]);if(s instanceof Promise)return y([p,await s]);if(t!=null&&t.templates&&t.templatePaths[r])try{const[i,d]=t.templatePaths[r].split(";;"),o=await import(d),c=d.includes("salty.config"),f=c?o[i].templates:o[i],h=c?f[r]:f.params[r];if(f&&typeof h=="function"){const j=await h(s),[m]=await $(j,"");return m}}catch(i){console.error(`Error loading template "${r}" from path "${t.templatePaths[r]}"`,i);return}if(t!=null&&t.templates&&t.templates[r]){if(u)return;const d=s.split(".").reduce((o,c)=>o[c],t.templates[r]);if(d){const[o]=await $(d,"");return o}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 l(s.toString());if(r==="defaultVariants")return;if(r==="variants"){const o=Object.entries(s);for(const[c,f]of o){if(!f)continue;const h=Object.entries(f);for(const[j,m]of h){if(!m)continue;const T=`${e}.${c}-${j}`;(await $(m,T,t)).forEach(U=>n.add(U))}}return}if(r==="compoundVariants"){for(const o of s){const{css:c,...f}=o,h=Object.entries(f).reduce((m,[T,N])=>`${m}.${T}-${N}`,e);(await $(c,h,t)).forEach(m=>n.add(m))}return}if(r.startsWith("@")){const o=((C=t==null?void 0:t.mediaQueries)==null?void 0:C[r])||r,c=await A(s,e,t),f=`${o} { ${c} }`;n.add(f);return}const i=p.includes("&")?r.replace("&",e):r.startsWith(":")?`${e}${r}`:`${e} ${r}`;(await $(s,i,t)).forEach(o=>n.add(o));return}if(typeof s=="number"){const i=M(w,s,t);return l(i)}if(typeof s!="string")if("toString"in s)s=s.toString();else throw new Error(`Invalid value type for property ${w}`);return l(s)},x=b.map(y),{modifiers:O}=t||{},E=[z(),k(O)],S=(await Promise.all(x).then(p=>Promise.all(p.map(s=>E.reduce(async(r,w)=>{const l=await r;if(!l)return l;const P=await w(l);if(!P)return l;const{transformed:C,additionalCss:i}=P;let d="";if(i)for(const o of i)d+=await A(o,"");return`${d}${C}`},Promise.resolve(s)))))).filter(p=>p!==void 0).join(`
2
- `);if(!S.trim())return Array.from(n);const W=e?`${e} {
3
- ${S}
4
- }`:S;return n.has(W)?Array.from(n):[W,...n]},A=async(a,e,t,u=!1)=>(await $(a,e,t,u)).join(`
5
- `);exports.parseAndJoinStyles=A;exports.parseVariableTokens=q;
1
+ "use strict";const T=require("./dash-case-BJEkFEGQ.cjs"),k=a=>e=>{if(typeof e!="string"||!a)return;let t=e;const u=[];return Object.values(a).forEach(n=>{const{pattern:b,transform:y}=n;t=t.replace(b,x=>{const{value:A,css:E}=y(x);return E&&u.push(E),A})}),{transformed:t,additionalCss:u}},z=a=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${T.dashCase(n[1].replaceAll(".","-"))})`)},q=z(),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))?`-${T.dashCase(a)}`:T.dashCase(a),$=async(a,e="",t,u=!1)=>{if(!a)throw new Error("No styles provided to parseStyles function!");const n=new Set,b=Object.entries(a),y=async([p,s])=>{var C;const r=p.trim(),w=_(r),l=(i,d=";")=>`${w}:${i}${d}`,P={scope:e,config:t};if(typeof s=="function")return y([p,s(P)]);if(s instanceof Promise)return y([p,await s]);if(t!=null&&t.templates&&t.templatePaths[r])try{const[i,d]=t.templatePaths[r].split(";;"),o=await import(d),c=d.includes("salty.config"),f=c?o[i].templates:o[i],h=c?f[r]:f.params[r];if(f&&typeof h=="function"){const j=await h(s),[m]=await $(j,"");return m}}catch(i){console.error(`Error loading template "${r}" from path "${t.templatePaths[r]}"`,i);return}if(t!=null&&t.templates&&t.templates[r]){if(u)return;const d=s.split(".").reduce((o,c)=>o[c],t.templates[r]);if(d){const[o]=await $(d,"");return o}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 l(s.toString());if(r==="defaultVariants")return;if(r==="variants"){const o=Object.entries(s);for(const[c,f]of o){if(!f)continue;const h=Object.entries(f);for(const[j,m]of h){if(!m)continue;const S=`${e}.${c}-${j}`;(await $(m,S,t)).forEach(U=>n.add(U))}}return}if(r==="compoundVariants"){for(const o of s){const{css:c,...f}=o,h=Object.entries(f).reduce((m,[S,N])=>`${m}.${S}-${N}`,e);(await $(c,h,t)).forEach(m=>n.add(m))}return}if(r.startsWith("@")){const o=((C=t==null?void 0:t.mediaQueries)==null?void 0:C[r])||r,c=await V(s,e,t),f=`${o} { ${c} }`;n.add(f);return}const i=p.includes("&")?r.replaceAll("&",e):r.startsWith(":")?`${e}${r}`:`${e} ${r}`;(await $(s,i,t)).forEach(o=>n.add(o));return}if(typeof s=="number"){const i=M(w,s,t);return l(i)}if(typeof s!="string")if("toString"in s)s=s.toString();else throw new Error(`Invalid value type for property ${w}`);return l(s)},x=b.map(y),{modifiers:A}=t||{},E=[z(),k(A)],O=(await Promise.all(x).then(p=>Promise.all(p.map(s=>E.reduce(async(r,w)=>{const l=await r;if(!l)return l;const P=await w(l);if(!P)return l;const{transformed:C,additionalCss:i}=P;let d="";if(i)for(const o of i)d+=await V(o,"");return`${d}${C}`},Promise.resolve(s)))))).filter(p=>p!==void 0).join(`
2
+ `);if(!O.trim())return Array.from(n);const W=e?`${e} {
3
+ ${O}
4
+ }`:O;return n.has(W)?Array.from(n):[W,...n]},V=async(a,e,t,u=!1)=>(await $(a,e,t,u)).join(`
5
+ `);exports.parseAndJoinStyles=V;exports.parseVariableTokens=q;
@@ -1,4 +1,4 @@
1
- import { d as V } from "./dash-case-DBThphLm.js";
1
+ import { d as T } from "./dash-case-DBThphLm.js";
2
2
  const M = (o) => (e) => {
3
3
  if (typeof e != "string" || !o) return;
4
4
  let t = e;
@@ -10,7 +10,7 @@ const M = (o) => (e) => {
10
10
  return E && p.push(E), O;
11
11
  });
12
12
  }), { transformed: t, additionalCss: p };
13
- }, z = (o) => (e) => typeof e != "string" || !/\{[^{}]+\}/g.test(e) ? void 0 : { transformed: e.replace(/\{([^{}]+)\}/g, (...n) => `var(--${V(n[1].replaceAll(".", "-"))})`) }, B = z(), Q = [
13
+ }, z = (o) => (e) => typeof e != "string" || !/\{[^{}]+\}/g.test(e) ? void 0 : { transformed: e.replace(/\{([^{}]+)\}/g, (...n) => `var(--${T(n[1].replaceAll(".", "-"))})`) }, B = z(), Q = [
14
14
  "top",
15
15
  "right",
16
16
  "bottom",
@@ -37,7 +37,7 @@ const M = (o) => (e) => {
37
37
  return `${e}${n}`;
38
38
  }
39
39
  return `${e}`;
40
- }, k = ["Webkit", "Moz", "ms", "O"], q = (o) => o.startsWith("-") ? o : k.some((e) => o.startsWith(e)) ? `-${V(o)}` : V(o), $ = async (o, e = "", t, p = !1) => {
40
+ }, k = ["Webkit", "Moz", "ms", "O"], q = (o) => o.startsWith("-") ? o : k.some((e) => o.startsWith(e)) ? `-${T(o)}` : T(o), $ = async (o, e = "", t, p = !1) => {
41
41
  if (!o) throw new Error("No styles provided to parseStyles function!");
42
42
  const n = /* @__PURE__ */ new Set(), b = Object.entries(o), y = async ([u, s]) => {
43
43
  var j;
@@ -76,15 +76,15 @@ const M = (o) => (e) => {
76
76
  const h = Object.entries(f);
77
77
  for (const [x, m] of h) {
78
78
  if (!m) continue;
79
- const T = `${e}.${c}-${x}`;
80
- (await $(m, T, t)).forEach((U) => n.add(U));
79
+ const S = `${e}.${c}-${x}`;
80
+ (await $(m, S, t)).forEach((U) => n.add(U));
81
81
  }
82
82
  }
83
83
  return;
84
84
  }
85
85
  if (r === "compoundVariants") {
86
86
  for (const a of s) {
87
- const { css: c, ...f } = a, h = Object.entries(f).reduce((m, [T, A]) => `${m}.${T}-${A}`, e);
87
+ const { css: c, ...f } = a, h = Object.entries(f).reduce((m, [S, W]) => `${m}.${S}-${W}`, e);
88
88
  (await $(c, h, t)).forEach((m) => n.add(m));
89
89
  }
90
90
  return;
@@ -94,7 +94,7 @@ const M = (o) => (e) => {
94
94
  n.add(f);
95
95
  return;
96
96
  }
97
- const i = u.includes("&") ? r.replace("&", e) : r.startsWith(":") ? `${e}${r}` : `${e} ${r}`;
97
+ const i = u.includes("&") ? r.replaceAll("&", e) : r.startsWith(":") ? `${e}${r}` : `${e} ${r}`;
98
98
  (await $(s, i, t)).forEach((a) => n.add(a));
99
99
  return;
100
100
  }
@@ -106,7 +106,7 @@ const M = (o) => (e) => {
106
106
  if ("toString" in s) s = s.toString();
107
107
  else throw new Error(`Invalid value type for property ${w}`);
108
108
  return l(s);
109
- }, C = b.map(y), { modifiers: O } = t || {}, E = [z(), M(O)], S = (await Promise.all(C).then((u) => Promise.all(
109
+ }, C = b.map(y), { modifiers: O } = t || {}, E = [z(), M(O)], A = (await Promise.all(C).then((u) => Promise.all(
110
110
  u.map((s) => E.reduce(async (r, w) => {
111
111
  const l = await r;
112
112
  if (!l) return l;
@@ -121,11 +121,11 @@ const M = (o) => (e) => {
121
121
  }, Promise.resolve(s)))
122
122
  ))).filter((u) => u !== void 0).join(`
123
123
  `);
124
- if (!S.trim()) return Array.from(n);
125
- const W = e ? `${e} {
126
- ${S}
127
- }` : S;
128
- return n.has(W) ? Array.from(n) : [W, ...n];
124
+ if (!A.trim()) return Array.from(n);
125
+ const V = e ? `${e} {
126
+ ${A}
127
+ }` : A;
128
+ return n.has(V) ? Array.from(n) : [V, ...n];
129
129
  }, N = async (o, e, t, p = !1) => (await $(o, e, t, p)).join(`
130
130
  `);
131
131
  export {
package/server/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../should-restart-DJb3U4c8.cjs");exports.checkShouldRestart=e.checkShouldRestart;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../should-restart-CYlWrlX_.cjs");exports.checkShouldRestart=e.checkShouldRestart;
package/server/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as o } from "../should-restart-eXCtNI8U.js";
1
+ import { c as o } from "../should-restart-B8yt6be1.js";
2
2
  export {
3
3
  o as checkShouldRestart
4
4
  };
@@ -1,5 +1,5 @@
1
1
  import { readFile as r } from "fs/promises";
2
- import { i as e } from "./index-B_V_O1Qg.js";
2
+ import { i as e } from "./index-98hLLzQu.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 +1 @@
1
- "use strict";const s=require("fs/promises"),r=require("./index-CelIwoBr.cjs"),i=async t=>{if(!t||t.includes("node_modules")||t.includes("saltygen"))return!1;if(t.includes("salty.config"))return!0;if(!r.isSaltyFile(t))return!1;const e=await s.readFile(t,"utf-8");return!!(/.+define[A-Z]\w+/.test(e)||/.+keyframes\(.+/.test(e))};exports.checkShouldRestart=i;
1
+ "use strict";const s=require("fs/promises"),r=require("./index-DyGh-vDg.cjs"),i=async t=>{if(!t||t.includes("node_modules")||t.includes("saltygen"))return!1;if(t.includes("salty.config"))return!0;if(!r.isSaltyFile(t))return!1;const e=await s.readFile(t,"utf-8");return!!(/.+define[A-Z]\w+/.test(e)||/.+keyframes\(.+/.test(e))};exports.checkShouldRestart=i;