@salty-css/core 0.0.1-alpha.295 → 0.0.1-alpha.297

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-D0QitXLT.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora"),ae=require("../should-restart-DT8O0pOt.cjs");var G=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,v)=>{se.exec(y,x=>{if(x)return v(x);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),v=oe(`Installing packages: ${C}`).start(),x=y.join(" ");await X(`npm install ${x}`),v.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"))},v=async(i,a)=>{const{default:g}=await C[i],d=ne.render(g,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,g=process.cwd();return n.join(g,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:g=i,cssFile:d,skipInstall:p}=this.opts();if(!g)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(g),q=await Promise.all([v("salty.config.ts"),v("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"),f=await s.readFile(h,"utf-8").catch(()=>{});if(f===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(f),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!==f&&(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-DojP6pQJ.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora"),ae=require("../should-restart-B-ov9sPO.cjs");var G=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,v)=>{se.exec(y,x=>{if(x)return v(x);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),v=oe(`Installing packages: ${C}`).start(),x=y.join(" ");await X(`npm install ${x}`),v.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"))},v=async(i,a)=>{const{default:g}=await C[i],d=ne.render(g,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,g=process.cwd();return n.join(g,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:g=i,cssFile:d,skipInstall:p}=this.opts();if(!g)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(g),q=await Promise.all([v("salty.config.ts"),v("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"),f=await s.readFile(h,"utf-8").catch(()=>{});if(f===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(f),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!==f&&(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 rt } 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 ct, format as et } from "path";
5
5
  import { render as lt } from "ejs";
6
- import { l as e, a as h, g as K, i as dt, b as ft } from "../index-Bzka2M7f.js";
6
+ import { l as e, a as h, g as K, i as dt, b as ft } from "../index-Bsj-9mQh.js";
7
7
  import { p as pt } from "../pascal-case-BQpR5PdN.js";
8
8
  import { exec as gt } from "child_process";
9
9
  import ut from "ora";
10
- import { c as yt } from "../should-restart-CNF2idbd.js";
10
+ import { c as yt } from "../should-restart-Dvo5_WYL.js";
11
11
  const st = (u) => new Promise((v, k) => {
12
12
  gt(u, ($) => {
13
13
  if ($) return k($);
@@ -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-CIRNw7l_.cjs");require("../parsers/index.cjs");const e=require("../index-D0QitXLT.cjs");require("../css/merge.cjs");require("../define-templates-Cunsb_Tr.cjs");require("../helpers-CC5pFyba.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-B1E0JeC7.cjs");require("../parsers/index.cjs");const e=require("../index-DojP6pQJ.cjs");require("../css/merge.cjs");require("../define-templates-Cunsb_Tr.cjs");require("../helpers-CC5pFyba.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,9 +4,9 @@ import "../dash-case-DBThphLm.js";
4
4
  import "path";
5
5
  import "fs";
6
6
  import "fs/promises";
7
- import "../parse-styles-CPuIGA08.js";
7
+ import "../parse-styles-y_-drahL.js";
8
8
  import "../parsers/index.js";
9
- import { e as y, d as x, g as S, b as c, i as f, m as C, s as E, c as b } from "../index-Bzka2M7f.js";
9
+ import { e as y, d as x, g as S, b as c, i as f, m as C, s as E, c as b } from "../index-Bsj-9mQh.js";
10
10
  import "../css/merge.js";
11
11
  import "../define-templates-4A2yHcMF.js";
12
12
  import "../helpers-nHqH4L9L.js";
package/css/keyframes.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../parse-styles-CIRNw7l_.cjs"),O=require("../dash-case-BJEkFEGQ.cjs"),h=({animationName:l,params:y,appendInitialStyles:$,...t})=>{const i=async(d={})=>{const n=l||O.toHash(t),r=async()=>{const{duration:s="500ms",easing:e="ease-in-out",delay:o="0s",iterationCount:c="1",direction:g="normal",fillMode:b="forwards",playState:j="running"}={...y,...d},a=`${n} ${s} ${e} ${o} ${c} ${g} ${b} ${j}`;if(!$)return a;const m=t.from||t["0%"];if(!m)return a;const w=await u.parseAndJoinStyles(m,"");return`${a};${w}`},f=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await u.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),S=(await Promise.all(f)).join(""),p=`@keyframes ${n} {${S}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:p,keyframes:t}),r};return Object.assign(i,{_shouldResolve:!0}),i};exports.keyframes=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../parse-styles-B1E0JeC7.cjs"),O=require("../dash-case-BJEkFEGQ.cjs"),h=({animationName:l,params:y,appendInitialStyles:$,...t})=>{const i=async(d={})=>{const n=l||O.toHash(t),r=async()=>{const{duration:s="500ms",easing:e="ease-in-out",delay:o="0s",iterationCount:c="1",direction:g="normal",fillMode:b="forwards",playState:j="running"}={...y,...d},a=`${n} ${s} ${e} ${o} ${c} ${g} ${b} ${j}`;if(!$)return a;const m=t.from||t["0%"];if(!m)return a;const w=await u.parseAndJoinStyles(m,"");return`${a};${w}`},f=Object.entries(t).map(async([s,e])=>{if(!e)return"";const o=await u.parseAndJoinStyles(e,"");return`${typeof s=="number"?`${s}%`:s}{${o}}`}),S=(await Promise.all(f)).join(""),p=`@keyframes ${n} {${S}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:n,css:p,keyframes:t}),r};return Object.assign(i,{_shouldResolve:!0}),i};exports.keyframes=h;
package/css/keyframes.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as $ } from "../parse-styles-CPuIGA08.js";
1
+ import { p as $ } from "../parse-styles-y_-drahL.js";
2
2
  import { t as O } from "../dash-case-DBThphLm.js";
3
3
  const N = ({ animationName: u, params: f, appendInitialStyles: l, ...t }) => {
4
4
  const i = async (y = {}) => {
@@ -1 +1 @@
1
- "use strict";var C=Object.defineProperty;var N=(a,s,t)=>s in a?C(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var m=(a,s,t)=>N(a,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../parse-styles-CIRNw7l_.cjs"),n=require("../dash-case-BJEkFEGQ.cjs");class y{constructor(s){m(this,"buildContext",{});this.params=s}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){const{base:s,variants:t,compoundVariants:e}=this.params;return n.toHash({base:s,variants:t,compoundVariants:e})}get cssClassName(){return this.hash}get classNames(){const s=new Set([this.cssClassName]),{className:t}=this.params;return typeof t=="string"&&s.add(t),typeof t=="object"&&t.forEach(e=>s.add(e)),this.getTemplateClasses().forEach(e=>s.add(e)),this.buildContext.classNames&&this.buildContext.classNames.forEach(e=>s.add(e)),[...s].join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${n.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:e=[]}=this.params,{config:i}=this.buildContext,o={...s,variants:t,compoundVariants:e};return S.parseAndJoinStyles(o,`.${this.cssClassName}`,i,this.isRoot)}getTemplateClasses(s=this.buildContext.config){if(!(s!=null&&s.templates)||!this.params.base||this.priority>0)return[];const t=Object.keys(s.templates);return Object.entries(this.params.base).reduce((e,[i,o])=>(t.includes(i)&&e.push("t_"+n.toHash(n.dashCase(`${i}-${o}`),4)),e),[])}_withBuildContext(s){return this.buildContext=s,this}}class v extends y{constructor(s){super(s),this._params=s}}class x extends y{constructor(s,t){super(t),this.tagName=s,this._params=t}get priority(){var s;return this.params.priority?this.params.priority:typeof this.tagName=="function"||typeof this.tagName=="object"?(((s=this.tagName.generator)==null?void 0:s.priority)||0)+1:0}get clientProps(){const{element:s,variants:t={},compoundVariants:e=[],defaultVariants:i={},defaultProps:o={},passProps:d}=this.params,{callerName:f,isProduction:b}=this.buildContext,h=new Set([]),l=r=>{const c=i[r];c!==void 0?h.add(`${r}=${String(c)}`):h.add(r)};Object.keys(t).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\.([^}]+)\}/gi);r&&r.forEach(c=>{const u=c.replace(/\{(?:-)?props\.([^}]+)\}/gi,"$1"),g=n.dashCase(u);u&&p.add(g)})}return{element:s,hash:this.hash,variantKeys:[...h],propValueKeys:[...p],passProps:d,defaultProps:o,attr:{"data-component-name":b?void 0:f}}}}exports.ClassNameGenerator=v;exports.StyledGenerator=x;
1
+ "use strict";var N=Object.defineProperty;var S=(r,s,t)=>s in r?N(r,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[s]=t;var y=(r,s,t)=>S(r,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../parse-styles-B1E0JeC7.cjs"),o=require("../dash-case-BJEkFEGQ.cjs");class f{constructor(s){y(this,"buildContext",{});this.params=s}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){const{base:s,variants:t,compoundVariants:e,anyOfVariants:i}=this.params;return o.toHash({base:s,variants:t,compoundVariants:e,anyOfVariants:i})}get cssClassName(){return this.hash}get classNames(){const s=new Set([this.cssClassName]),{className:t}=this.params;return typeof t=="string"&&s.add(t),typeof t=="object"&&t.forEach(e=>s.add(e)),this.getTemplateClasses().forEach(e=>s.add(e)),this.buildContext.classNames&&this.buildContext.classNames.forEach(e=>s.add(e)),[...s].join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${o.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:e=[],anyOfVariants:i=[]}=this.params,{config:n}=this.buildContext,h={...s,variants:t,compoundVariants:e,anyOfVariants:i};return v.parseAndJoinStyles(h,`.${this.cssClassName}`,n,this.isRoot)}getTemplateClasses(s=this.buildContext.config){if(!(s!=null&&s.templates)||!this.params.base||this.priority>0)return[];const t=Object.keys(s.templates);return Object.entries(this.params.base).reduce((e,[i,n])=>(t.includes(i)&&e.push("t_"+o.toHash(o.dashCase(`${i}-${n}`),4)),e),[])}_withBuildContext(s){return this.buildContext=s,this}}class x extends f{constructor(s){super(s),this._params=s}}class V extends f{constructor(s,t){super(t),this.tagName=s,this._params=t}get priority(){var s;return this.params.priority?this.params.priority:typeof this.tagName=="function"||typeof this.tagName=="object"?(((s=this.tagName.generator)==null?void 0:s.priority)||0)+1:0}get clientProps(){const{element:s,variants:t={},compoundVariants:e=[],anyOfVariants:i=[],defaultVariants:n={},defaultProps:h={},passProps:p}=this.params,{callerName:b,isProduction:g}=this.buildContext,d=new Set([]),l=a=>{const c=n[a];c!==void 0?d.add(`${a}=${String(c)}`):d.add(a)};Object.keys(t).forEach(l),e.map(a=>Object.keys(a).forEach(l)),i.map(a=>Object.keys(a).forEach(l));const u=new Set([]);if(this.params.base){const a=JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);a&&a.forEach(c=>{const m=c.replace(/\{(?:-)?props\.([^}]+)\}/gi,"$1"),C=o.dashCase(m);m&&u.add(C)})}return{element:s,hash:this.hash,variantKeys:[...d],propValueKeys:[...u],passProps:p,defaultProps:h,attr:{"data-component-name":g?void 0:b}}}}exports.ClassNameGenerator=x;exports.StyledGenerator=V;
@@ -1,11 +1,11 @@
1
- var C = Object.defineProperty;
2
- var x = (a, t, s) => t in a ? C(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s;
3
- var u = (a, t, s) => x(a, typeof t != "symbol" ? t + "" : t, s);
4
- import { p as v } from "../parse-styles-CPuIGA08.js";
5
- import { t as f, d as h } from "../dash-case-DBThphLm.js";
6
- class y {
1
+ var x = Object.defineProperty;
2
+ var V = (r, t, s) => t in r ? x(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s;
3
+ var f = (r, t, s) => V(r, typeof t != "symbol" ? t + "" : t, s);
4
+ import { p as v } from "../parse-styles-y_-drahL.js";
5
+ import { t as y, d } from "../dash-case-DBThphLm.js";
6
+ class b {
7
7
  constructor(t) {
8
- u(this, "buildContext", {});
8
+ f(this, "buildContext", {});
9
9
  this.params = t;
10
10
  }
11
11
  get priority() {
@@ -15,39 +15,39 @@ class y {
15
15
  return this.priority === 0;
16
16
  }
17
17
  get hash() {
18
- const { base: t, variants: s, compoundVariants: e } = this.params;
19
- return f({ base: t, variants: s, compoundVariants: e });
18
+ const { base: t, variants: s, compoundVariants: a, anyOfVariants: i } = this.params;
19
+ return y({ base: t, variants: s, compoundVariants: a, anyOfVariants: i });
20
20
  }
21
21
  get cssClassName() {
22
22
  return this.hash;
23
23
  }
24
24
  get classNames() {
25
25
  const t = /* @__PURE__ */ new Set([this.cssClassName]), { className: s } = this.params;
26
- 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(" ");
26
+ return typeof s == "string" && t.add(s), typeof s == "object" && s.forEach((a) => t.add(a)), this.getTemplateClasses().forEach((a) => t.add(a)), this.buildContext.classNames && this.buildContext.classNames.forEach((a) => t.add(a)), [...t].join(" ");
27
27
  }
28
28
  get cssFileName() {
29
29
  const { callerName: t } = this.buildContext;
30
- return t ? `cl_${h(t)}-${this.hash}.css` : `${this.hash}.css`;
30
+ return t ? `cl_${d(t)}-${this.hash}.css` : `${this.hash}.css`;
31
31
  }
32
32
  get css() {
33
- const { base: t = {}, variants: s = {}, compoundVariants: e = [] } = this.params, { config: i } = this.buildContext, o = { ...t, variants: s, compoundVariants: e };
34
- return v(o, `.${this.cssClassName}`, i, this.isRoot);
33
+ const { base: t = {}, variants: s = {}, compoundVariants: a = [], anyOfVariants: i = [] } = this.params, { config: n } = this.buildContext, c = { ...t, variants: s, compoundVariants: a, anyOfVariants: i };
34
+ return v(c, `.${this.cssClassName}`, n, this.isRoot);
35
35
  }
36
36
  getTemplateClasses(t = this.buildContext.config) {
37
37
  if (!(t != null && t.templates) || !this.params.base || this.priority > 0) return [];
38
38
  const s = Object.keys(t.templates);
39
- return Object.entries(this.params.base).reduce((e, [i, o]) => (s.includes(i) && e.push("t_" + f(h(`${i}-${o}`), 4)), e), []);
39
+ return Object.entries(this.params.base).reduce((a, [i, n]) => (s.includes(i) && a.push("t_" + y(d(`${i}-${n}`), 4)), a), []);
40
40
  }
41
41
  _withBuildContext(t) {
42
42
  return this.buildContext = t, this;
43
43
  }
44
44
  }
45
- class j extends y {
45
+ class j extends b {
46
46
  constructor(t) {
47
47
  super(t), this._params = t;
48
48
  }
49
49
  }
50
- class E extends y {
50
+ class E extends b {
51
51
  constructor(t, s) {
52
52
  super(s), this.tagName = t, this._params = s;
53
53
  }
@@ -56,28 +56,28 @@ class E extends y {
56
56
  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;
57
57
  }
58
58
  get clientProps() {
59
- const { element: t, variants: s = {}, compoundVariants: e = [], defaultVariants: i = {}, defaultProps: o = {}, passProps: p } = this.params, { callerName: b, isProduction: g } = this.buildContext, c = /* @__PURE__ */ new Set([]), d = (r) => {
60
- const n = i[r];
61
- n !== void 0 ? c.add(`${r}=${String(n)}`) : c.add(r);
59
+ const { element: t, variants: s = {}, compoundVariants: a = [], anyOfVariants: i = [], defaultVariants: n = {}, defaultProps: c = {}, passProps: l } = this.params, { callerName: g, isProduction: N } = this.buildContext, h = /* @__PURE__ */ new Set([]), p = (e) => {
60
+ const o = n[e];
61
+ o !== void 0 ? h.add(`${e}=${String(o)}`) : h.add(e);
62
62
  };
63
- Object.keys(s).forEach(d), e.map((r) => Object.keys(r).forEach(d));
64
- const l = /* @__PURE__ */ new Set([]);
63
+ Object.keys(s).forEach(p), a.map((e) => Object.keys(e).forEach(p)), i.map((e) => Object.keys(e).forEach(p));
64
+ const m = /* @__PURE__ */ new Set([]);
65
65
  if (this.params.base) {
66
- const r = JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);
67
- r && r.forEach((n) => {
68
- const m = n.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1"), N = h(m);
69
- m && l.add(N);
66
+ const e = JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);
67
+ e && e.forEach((o) => {
68
+ const u = o.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1"), C = d(u);
69
+ u && m.add(C);
70
70
  });
71
71
  }
72
72
  return {
73
73
  element: t,
74
74
  hash: this.hash,
75
- variantKeys: [...c],
76
- propValueKeys: [...l],
77
- passProps: p,
78
- defaultProps: o,
75
+ variantKeys: [...h],
76
+ propValueKeys: [...m],
77
+ passProps: l,
78
+ defaultProps: c,
79
79
  attr: {
80
- "data-component-name": g ? void 0 : b
80
+ "data-component-name": N ? void 0 : g
81
81
  }
82
82
  };
83
83
  }
@@ -4,7 +4,7 @@ import { t as K, d as U } from "./dash-case-DBThphLm.js";
4
4
  import { join as i, parse as tt } from "path";
5
5
  import { existsSync as ft, mkdirSync as H, statSync as Ot, readdirSync as Mt, readFileSync as _, writeFileSync as P } from "fs";
6
6
  import { readFile as Ft } from "fs/promises";
7
- import { p as bt, a as Rt } from "./parse-styles-CPuIGA08.js";
7
+ import { p as bt, a as Rt } from "./parse-styles-y_-drahL.js";
8
8
  import { parseTemplates as Jt, getTemplateTypes as zt } from "./parsers/index.js";
9
9
  import { createLogger as Wt, transports as Gt, format as rt } from "winston";
10
10
  import { mergeObjects as I, mergeFactories as Ht } from "./css/merge.js";
@@ -1,4 +1,4 @@
1
- "use strict";const Oe=require("esbuild"),Ee=require("child_process"),_=require("./dash-case-BJEkFEGQ.cjs"),i=require("path"),c=require("fs"),je=require("fs/promises"),ce=require("./parse-styles-CIRNw7l_.cjs"),we=require("./parsers/index.cjs"),B=require("winston"),q=require("./css/merge.cjs"),Ve=require("./define-templates-Cunsb_Tr.cjs"),re=require("typescript"),Z=require("./helpers-CC5pFyba.cjs");var le=typeof document<"u"?document.currentScript:null;function Re(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 be=Re(Oe),Fe=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:Fe(i.join(e,".."))},Me=async e=>{const t=Fe(e);return await je.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Je=async e=>{const t=await Me(e);if(t)return t.type};let W;const $e=async e=>{if(W)return W;const t=await Je(e);return t==="module"?W="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:le&&le.tagName.toUpperCase()==="SCRIPT"&&le.src||new URL("index-D0QitXLT.cjs",document.baseURI).href).endsWith(".cjs"))&&(W="cjs"),W||"esm"},U=B.createLogger({level:"debug",format:B.format.combine(B.format.colorize(),B.format.cli()),transports:[new B.transports.Console({})]}),qe=e=>{U.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"}},He=(e,t)=>new Promise((s,n)=>{const r=setTimeout(()=>{n(new Error("Timeout"))},100),l=re.createSourceFile("temp.ts",e,re.ScriptTarget.Latest,!0);function o(m){if(re.isVariableDeclaration(m)&&m.name.getText()===t){const w=m.getStart(),F=m.getEnd();clearTimeout(r),s([w,F])}m.forEachChild(o)}o(l)}),E={externalModules:[],rcFile:void 0,destDir:void 0},Pe=e=>{if(E.externalModules.length>0)return E.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 E.externalModules=n,n},z=async e=>{if(E.destDir)return E.destDir;const t=await ue(e),s=i.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return E.destDir=s,s},fe=["salty","css","styles","styled"],Ne=(e=[])=>new RegExp(`\\.(${[...fe,...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=i.join(e,".saltyrc.json"),s=await je.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(E.rcFile=s,s):xe(i.join(e,".."))},ue=async e=>{var n,r;const t=await xe(e),s=(n=t.projects)==null?void 0:n.find(l=>e.endsWith(l.dir||""));return s||((r=t.projects)==null?void 0:r.find(l=>l.dir===t.defaultProject))},We=async e=>{const t=await ue(e),s=await z(e),n=i.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),r=i.join(s,"salty.config.js"),l=await $e(e),o=Pe(n);await be.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:r,format:l,external:o});const m=Date.now(),{config:w}=await import(`${r}?t=${m}`);return{config:w,path:r}},ke=async(e,t)=>{var ye,ge;const s=await z(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async h=>{const{contents:C,outputFilePath:L}=await A(e,h,s);Object.entries(C).forEach(([v,P])=>{P.isMedia?n.mediaQueries.push([v,P]):P.isGlobalDefine?n.globalStyles.push(P):P.isDefineVariables?n.variables.push(P):P.isDefineTemplates&&n.templates.push(P._setPath(`${v};;${L}`))})}));const{config:r,path:l}=await We(e),o={...r},{mediaQueries:m}=n;o.mediaQueries=Object.fromEntries(m.map(([h,C])=>[`@${h}`,C]));const w=m.map(([h])=>`'@${h}'`).join(" | "),F=new Set,a=async(h,C=[])=>{if(!h)return[];const L=Object.entries(h).map(async([P,J])=>{const Q=async D=>{if(!D)return;if(D instanceof Promise)return await Q(await D);if(typeof D=="function")return await Q(await D());if(typeof D=="object")return await a(D,[...C,P]);const oe=Ce(P),ie=_.dashCase(P),ae=[...C,oe].join(".");F.add(`"${ae}"`);const Y=[...C.map(_.dashCase),ie].join("-"),he=ce.parseVariableTokens(D);return he?`--${Y}: ${he.transformed};`:`--${Y}: ${D};`};return await Q(J)});return(await Promise.all(L)).flat()},p=async h=>{if(!h)return[];const C=Object.entries(h).map(async([v,P])=>{const J=await a(P);return v==="base"?J.join(""):o.mediaQueries[v]?`${o.mediaQueries[v]} { ${J.join("")} }`:`${v} { ${J.join("")} }`});return(await Promise.all(C)).flat()},d=async h=>{if(!h)return[];const C=Object.entries(h).map(async([v,P])=>{const J=Object.entries(P).map(async([D,oe])=>{const ie=await a(oe,[v]),ae=`.${v}-${D}, [data-${v}="${D}"]`,Y=ie.join("");return`${ae} { ${Y} }`});return(await Promise.all(J)).flat()});return(await Promise.all(C)).flat()},y=h=>({...h,responsive:void 0,conditional:void 0}),g=h=>n.variables.map(C=>h==="static"?y(C._current):C._current[h]),b=q.mergeObjects(y(r.variables),g("static")),k=await a(b),N=q.mergeObjects((ye=r.variables)==null?void 0:ye.responsive,g("responsive")),T=await p(N),V=q.mergeObjects((ge=r.variables)==null?void 0:ge.conditional,g("conditional")),H=await d(V),de=i.join(s,"css/_variables.css"),R=`:root { ${k.join("")} ${T.join("")} } ${H.join("")}`;c.writeFileSync(de,R),o.staticVariables=b;const te=i.join(s,"css/_global.css"),f=q.mergeObjects(r.global,n.globalStyles),S=await ce.parseAndJoinStyles(f,"");c.writeFileSync(te,`@layer global { ${S} }`);const $=i.join(s,"css/_reset.css"),j=r.reset==="none"?{}:typeof r.reset=="object"?r.reset:ze,x=await ce.parseAndJoinStyles(j,"");c.writeFileSync($,`@layer reset { ${x} }`);const O=i.join(s,"css/_templates.css"),M=q.mergeObjects(r.templates,n.templates),I=await we.parseTemplates(M),G=we.getTemplateTypes(M);c.writeFileSync(O,`@layer templates { ${I} }`),o.templates=M;const X=r.templates?[Ve.defineTemplates(r.templates)._setPath(`config;;${l}`)]:[],se=q.mergeFactories(n.templates,X);o.templatePaths=Object.fromEntries(Object.entries(se).map(([h,C])=>[h,C._path]));const K=i.join(s,"types/css-tokens.d.ts"),ve=`
1
+ "use strict";const Oe=require("esbuild"),Ee=require("child_process"),_=require("./dash-case-BJEkFEGQ.cjs"),i=require("path"),c=require("fs"),je=require("fs/promises"),ce=require("./parse-styles-B1E0JeC7.cjs"),we=require("./parsers/index.cjs"),B=require("winston"),q=require("./css/merge.cjs"),Ve=require("./define-templates-Cunsb_Tr.cjs"),re=require("typescript"),Z=require("./helpers-CC5pFyba.cjs");var le=typeof document<"u"?document.currentScript:null;function Re(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 be=Re(Oe),Fe=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:Fe(i.join(e,".."))},Me=async e=>{const t=Fe(e);return await je.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Je=async e=>{const t=await Me(e);if(t)return t.type};let W;const $e=async e=>{if(W)return W;const t=await Je(e);return t==="module"?W="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:le&&le.tagName.toUpperCase()==="SCRIPT"&&le.src||new URL("index-DojP6pQJ.cjs",document.baseURI).href).endsWith(".cjs"))&&(W="cjs"),W||"esm"},U=B.createLogger({level:"debug",format:B.format.combine(B.format.colorize(),B.format.cli()),transports:[new B.transports.Console({})]}),qe=e=>{U.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"}},He=(e,t)=>new Promise((s,n)=>{const r=setTimeout(()=>{n(new Error("Timeout"))},100),l=re.createSourceFile("temp.ts",e,re.ScriptTarget.Latest,!0);function o(m){if(re.isVariableDeclaration(m)&&m.name.getText()===t){const w=m.getStart(),F=m.getEnd();clearTimeout(r),s([w,F])}m.forEachChild(o)}o(l)}),E={externalModules:[],rcFile:void 0,destDir:void 0},Pe=e=>{if(E.externalModules.length>0)return E.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 E.externalModules=n,n},z=async e=>{if(E.destDir)return E.destDir;const t=await ue(e),s=i.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return E.destDir=s,s},fe=["salty","css","styles","styled"],Ne=(e=[])=>new RegExp(`\\.(${[...fe,...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=i.join(e,".saltyrc.json"),s=await je.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(E.rcFile=s,s):xe(i.join(e,".."))},ue=async e=>{var n,r;const t=await xe(e),s=(n=t.projects)==null?void 0:n.find(l=>e.endsWith(l.dir||""));return s||((r=t.projects)==null?void 0:r.find(l=>l.dir===t.defaultProject))},We=async e=>{const t=await ue(e),s=await z(e),n=i.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),r=i.join(s,"salty.config.js"),l=await $e(e),o=Pe(n);await be.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:r,format:l,external:o});const m=Date.now(),{config:w}=await import(`${r}?t=${m}`);return{config:w,path:r}},ke=async(e,t)=>{var ye,ge;const s=await z(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async h=>{const{contents:C,outputFilePath:L}=await A(e,h,s);Object.entries(C).forEach(([v,P])=>{P.isMedia?n.mediaQueries.push([v,P]):P.isGlobalDefine?n.globalStyles.push(P):P.isDefineVariables?n.variables.push(P):P.isDefineTemplates&&n.templates.push(P._setPath(`${v};;${L}`))})}));const{config:r,path:l}=await We(e),o={...r},{mediaQueries:m}=n;o.mediaQueries=Object.fromEntries(m.map(([h,C])=>[`@${h}`,C]));const w=m.map(([h])=>`'@${h}'`).join(" | "),F=new Set,a=async(h,C=[])=>{if(!h)return[];const L=Object.entries(h).map(async([P,J])=>{const Q=async D=>{if(!D)return;if(D instanceof Promise)return await Q(await D);if(typeof D=="function")return await Q(await D());if(typeof D=="object")return await a(D,[...C,P]);const oe=Ce(P),ie=_.dashCase(P),ae=[...C,oe].join(".");F.add(`"${ae}"`);const Y=[...C.map(_.dashCase),ie].join("-"),he=ce.parseVariableTokens(D);return he?`--${Y}: ${he.transformed};`:`--${Y}: ${D};`};return await Q(J)});return(await Promise.all(L)).flat()},p=async h=>{if(!h)return[];const C=Object.entries(h).map(async([v,P])=>{const J=await a(P);return v==="base"?J.join(""):o.mediaQueries[v]?`${o.mediaQueries[v]} { ${J.join("")} }`:`${v} { ${J.join("")} }`});return(await Promise.all(C)).flat()},d=async h=>{if(!h)return[];const C=Object.entries(h).map(async([v,P])=>{const J=Object.entries(P).map(async([D,oe])=>{const ie=await a(oe,[v]),ae=`.${v}-${D}, [data-${v}="${D}"]`,Y=ie.join("");return`${ae} { ${Y} }`});return(await Promise.all(J)).flat()});return(await Promise.all(C)).flat()},y=h=>({...h,responsive:void 0,conditional:void 0}),g=h=>n.variables.map(C=>h==="static"?y(C._current):C._current[h]),b=q.mergeObjects(y(r.variables),g("static")),k=await a(b),N=q.mergeObjects((ye=r.variables)==null?void 0:ye.responsive,g("responsive")),T=await p(N),V=q.mergeObjects((ge=r.variables)==null?void 0:ge.conditional,g("conditional")),H=await d(V),de=i.join(s,"css/_variables.css"),R=`:root { ${k.join("")} ${T.join("")} } ${H.join("")}`;c.writeFileSync(de,R),o.staticVariables=b;const te=i.join(s,"css/_global.css"),f=q.mergeObjects(r.global,n.globalStyles),S=await ce.parseAndJoinStyles(f,"");c.writeFileSync(te,`@layer global { ${S} }`);const $=i.join(s,"css/_reset.css"),j=r.reset==="none"?{}:typeof r.reset=="object"?r.reset:ze,x=await ce.parseAndJoinStyles(j,"");c.writeFileSync($,`@layer reset { ${x} }`);const O=i.join(s,"css/_templates.css"),M=q.mergeObjects(r.templates,n.templates),I=await we.parseTemplates(M),G=we.getTemplateTypes(M);c.writeFileSync(O,`@layer templates { ${I} }`),o.templates=M;const X=r.templates?[Ve.defineTemplates(r.templates)._setPath(`config;;${l}`)]:[],se=q.mergeFactories(n.templates,X);o.templatePaths=Object.fromEntries(Object.entries(se).map(([h,C])=>[h,C._path]));const K=i.join(s,"types/css-tokens.d.ts"),ve=`
2
2
  // Variable types
3
3
  type VariableTokens = ${[...F].join("|")};
4
4
  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.295",
3
+ "version": "0.0.1-alpha.297",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -0,0 +1,5 @@
1
+ "use strict";const x=require("./dash-case-BJEkFEGQ.cjs"),I=require("./viewport-clamp-mq_DFtRR.cjs"),U=o=>s=>{if(typeof s!="string"||!o)return;let t=s;const m=[];return Object.values(o).forEach(e=>{const{pattern:d,transform:f}=e;t=t.replace(d,E=>{const{value:S,css:P}=f(E);return P&&m.push(P),S})}),{transformed:t,additionalCss:m}},A=o=>s=>typeof s!="string"||!/\{[^{}]+\}/g.test(s)?void 0:{transformed:s.replace(/\{([^{}]+)\}/g,(...e)=>{const d=x.dashCase(e[1].replaceAll(".","-"));return o&&!o.includes(d)&&console.warn(`Token ${d} might not exist`),d.startsWith("-")?`-${d}`:`var(--${d})`})},M=A(),N=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],k=(o,s,t)=>{if(N.some(e=>typeof e=="string"?e===o:e.test(o))){const e=(t==null?void 0:t.defaultUnit)||"px";if(e.startsWith("viewport-clamp:"))try{const f=e.split(":")[1];return I.defineViewportClamp({screenSize:parseInt(f)})(Number(s))}catch(f){throw console.error(f),new Error(`Invalid viewport-clamp value: ${e}`)}return`${s}${e}`}return`${s}`},J=["Webkit","Moz","ms","O"],Q=o=>o.startsWith("-")?o:J.some(s=>o.startsWith(s))?`-${x.dashCase(o)}`:x.dashCase(o),y=async(o,s="",t,m=!1)=>{if(!o)throw new Error("No styles provided to parseStyles function!");const e=new Set,d=Object.entries(o),f=async([h,r])=>{var V;const n=h.trim().replace(/^\?+/g,""),v=Q(n),$=(a,l=";")=>`${v}:${a}${l}`,j={scope:s,config:t};if(typeof r=="function")return f([h,r(j)]);if(r instanceof Promise)return f([h,await r]);if(t!=null&&t.templates&&t.templatePaths[n])try{const[a,l]=t.templatePaths[n].split(";;"),i=await import(l),c=l.includes("salty.config"),p=c?i[a].templates:i[a],w=c?p[n]:p.params[n];if(p&&typeof w=="function"){const b=await w(r),[u]=await y(b,"");return u}}catch(a){console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`,a);return}if(t!=null&&t.templates&&t.templates[n]){if(m)return;const l=r.split(".").reduce((i,c)=>i[c],t.templates[n]);if(l){const[i]=await y(l,"");return i}console.warn(`Template "${n}" with path of "${r}" was not found in config!`);return}if(typeof r=="object"){if(!r)return;if(r.isColor)return $(r.toString());if(n==="defaultVariants")return;if(n==="variants"){const i=Object.entries(r);for(const[c,p]of i){if(!p)continue;const w=Object.entries(p);for(const[b,u]of w){if(!u)continue;const C=`${s}.${c}-${b}`;(await y(u,C,t)).forEach(q=>e.add(q))}}return}if(n==="compoundVariants"){for(const i of r){const{css:c,...p}=i,w=Object.entries(p).reduce((u,[C,O])=>`${u}.${C}-${O}`,s);(await y(c,w,t)).forEach(u=>e.add(u))}return}if(n==="anyOfVariants"){for(const i of r){const{css:c,...p}=i,w=Object.entries(p).map(([C,O])=>`.${C}-${O}`),b=`${s}:where(${w.join(", ")})`;console.log(`Union variant scope: ${b}`),(await y(c,b,t)).forEach(C=>e.add(C))}return}if(n.startsWith("@")){const i=((V=t==null?void 0:t.mediaQueries)==null?void 0:V[n])||n,c=await W(r,s,t),p=`${i} { ${c} }`;e.add(p);return}const a=h.includes("&")?n.replaceAll("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await y(r,a,t)).forEach(i=>e.add(i));return}if(typeof r=="number"){const a=k(v,r,t);return $(a)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${v}`);return $(r)},E=d.map(f),{modifiers:S}=t||{},P=[A(),U(S)],T=(await Promise.all(E).then(h=>Promise.all(h.map(r=>P.reduce(async(n,v)=>{const $=await n;if(!$)return $;const j=await v($);if(!j)return $;const{transformed:V,additionalCss:a}=j;let l="";if(a)for(const i of a)l+=await W(i,"");return`${l}${V}`},Promise.resolve(r)))))).filter(h=>h!==void 0).join(`
2
+ `);if(!T.trim())return Array.from(e);const z=s?`${s} {
3
+ ${T}
4
+ }`:T;return e.has(z)?Array.from(e):[z,...e]},W=async(o,s,t,m=!1)=>(await y(o,s,t,m)).join(`
5
+ `);exports.parseAndJoinStyles=W;exports.parseStyles=y;exports.parseValueModifiers=U;exports.parseValueTokens=A;exports.parseVariableTokens=M;
@@ -0,0 +1,161 @@
1
+ import { d as S } from "./dash-case-DBThphLm.js";
2
+ import { d as I } from "./viewport-clamp-CaYwREKc.js";
3
+ const N = (o) => (s) => {
4
+ if (typeof s != "string" || !o) return;
5
+ let t = s;
6
+ const u = [];
7
+ return Object.values(o).forEach((e) => {
8
+ const { pattern: l, transform: f } = e;
9
+ t = t.replace(l, (C) => {
10
+ const { value: V, css: P } = f(C);
11
+ return P && u.push(P), V;
12
+ });
13
+ }), { transformed: t, additionalCss: u };
14
+ }, A = (o) => (s) => typeof s != "string" || !/\{[^{}]+\}/g.test(s) ? void 0 : { transformed: s.replace(/\{([^{}]+)\}/g, (...e) => {
15
+ const l = S(e[1].replaceAll(".", "-"));
16
+ return o && !o.includes(l) && console.warn(`Token ${l} might not exist`), l.startsWith("-") ? `-${l}` : `var(--${l})`;
17
+ }) }, D = A(), M = [
18
+ "top",
19
+ "right",
20
+ "bottom",
21
+ "left",
22
+ "min-width",
23
+ /.*width.*/,
24
+ /^[^line]*height.*/,
25
+ // Exclude line-height
26
+ /padding.*/,
27
+ /margin.*/,
28
+ /border.*/,
29
+ /inset.*/,
30
+ /.*radius.*/,
31
+ /.*spacing.*/,
32
+ /.*gap.*/,
33
+ /.*indent.*/,
34
+ /.*offset.*/,
35
+ /.*size.*/,
36
+ /.*thickness.*/,
37
+ /.*font-size.*/
38
+ ], Q = (o, s, t) => {
39
+ if (M.some((e) => typeof e == "string" ? e === o : e.test(o))) {
40
+ const e = (t == null ? void 0 : t.defaultUnit) || "px";
41
+ if (e.startsWith("viewport-clamp:"))
42
+ try {
43
+ const f = e.split(":")[1];
44
+ return I({
45
+ screenSize: parseInt(f)
46
+ })(Number(s));
47
+ } catch (f) {
48
+ throw console.error(f), new Error(`Invalid viewport-clamp value: ${e}`);
49
+ }
50
+ return `${s}${e}`;
51
+ }
52
+ return `${s}`;
53
+ }, _ = ["Webkit", "Moz", "ms", "O"], q = (o) => o.startsWith("-") ? o : _.some((s) => o.startsWith(s)) ? `-${S(o)}` : S(o), v = async (o, s = "", t, u = !1) => {
54
+ if (!o) throw new Error("No styles provided to parseStyles function!");
55
+ const e = /* @__PURE__ */ new Set(), l = Object.entries(o), f = async ([h, r]) => {
56
+ var x;
57
+ const n = h.trim().replace(/^\?+/g, ""), E = q(n), $ = (a, d = ";") => `${E}:${a}${d}`, j = { scope: s, config: t };
58
+ if (typeof r == "function") return f([h, r(j)]);
59
+ if (r instanceof Promise) return f([h, await r]);
60
+ if (t != null && t.templates && t.templatePaths[n])
61
+ try {
62
+ const [a, d] = t.templatePaths[n].split(";;"), i = await import(
63
+ /* webpackIgnore: true */
64
+ /* @vite-ignore */
65
+ d
66
+ ), c = d.includes("salty.config"), p = c ? i[a].templates : i[a], w = c ? p[n] : p.params[n];
67
+ if (p && typeof w == "function") {
68
+ const y = await w(r), [m] = await v(y, "");
69
+ return m;
70
+ }
71
+ } catch (a) {
72
+ console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`, a);
73
+ return;
74
+ }
75
+ if (t != null && t.templates && t.templates[n]) {
76
+ if (u) return;
77
+ const d = r.split(".").reduce((i, c) => i[c], t.templates[n]);
78
+ if (d) {
79
+ const [i] = await v(d, "");
80
+ return i;
81
+ }
82
+ console.warn(`Template "${n}" with path of "${r}" was not found in config!`);
83
+ return;
84
+ }
85
+ if (typeof r == "object") {
86
+ if (!r) return;
87
+ if (r.isColor) return $(r.toString());
88
+ if (n === "defaultVariants") return;
89
+ if (n === "variants") {
90
+ const i = Object.entries(r);
91
+ for (const [c, p] of i) {
92
+ if (!p) continue;
93
+ const w = Object.entries(p);
94
+ for (const [y, m] of w) {
95
+ if (!m) continue;
96
+ const b = `${s}.${c}-${y}`;
97
+ (await v(m, b, t)).forEach((U) => e.add(U));
98
+ }
99
+ }
100
+ return;
101
+ }
102
+ if (n === "compoundVariants") {
103
+ for (const i of r) {
104
+ const { css: c, ...p } = i, w = Object.entries(p).reduce((m, [b, O]) => `${m}.${b}-${O}`, s);
105
+ (await v(c, w, t)).forEach((m) => e.add(m));
106
+ }
107
+ return;
108
+ }
109
+ if (n === "anyOfVariants") {
110
+ for (const i of r) {
111
+ const { css: c, ...p } = i, w = Object.entries(p).map(([b, O]) => `.${b}-${O}`), y = `${s}:where(${w.join(", ")})`;
112
+ console.log(`Union variant scope: ${y}`), (await v(c, y, t)).forEach((b) => e.add(b));
113
+ }
114
+ return;
115
+ }
116
+ if (n.startsWith("@")) {
117
+ const i = ((x = t == null ? void 0 : t.mediaQueries) == null ? void 0 : x[n]) || n, c = await z(r, s, t), p = `${i} { ${c} }`;
118
+ e.add(p);
119
+ return;
120
+ }
121
+ const a = h.includes("&") ? n.replaceAll("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
122
+ (await v(r, a, t)).forEach((i) => e.add(i));
123
+ return;
124
+ }
125
+ if (typeof r == "number") {
126
+ const a = Q(E, r, t);
127
+ return $(a);
128
+ }
129
+ if (typeof r != "string")
130
+ if ("toString" in r) r = r.toString();
131
+ else throw new Error(`Invalid value type for property ${E}`);
132
+ return $(r);
133
+ }, C = l.map(f), { modifiers: V } = t || {}, P = [A(), N(V)], W = (await Promise.all(C).then((h) => Promise.all(
134
+ h.map((r) => P.reduce(async (n, E) => {
135
+ const $ = await n;
136
+ if (!$) return $;
137
+ const j = await E($);
138
+ if (!j) return $;
139
+ const { transformed: x, additionalCss: a } = j;
140
+ let d = "";
141
+ if (a)
142
+ for (const i of a)
143
+ d += await z(i, "");
144
+ return `${d}${x}`;
145
+ }, Promise.resolve(r)))
146
+ ))).filter((h) => h !== void 0).join(`
147
+ `);
148
+ if (!W.trim()) return Array.from(e);
149
+ const T = s ? `${s} {
150
+ ${W}
151
+ }` : W;
152
+ return e.has(T) ? Array.from(e) : [T, ...e];
153
+ }, z = async (o, s, t, u = !1) => (await v(o, s, t, u)).join(`
154
+ `);
155
+ export {
156
+ D as a,
157
+ N as b,
158
+ v as c,
159
+ A as d,
160
+ z as p
161
+ };
package/parsers/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../parse-styles-CIRNw7l_.cjs"),c=require("../dash-case-BJEkFEGQ.cjs"),p=async(e,s=[])=>{if(!e)return"";const t=[],r={};for(const[n,o]of Object.entries(e))if(typeof o!="function")if(o&&typeof o=="object"){const i=n.trim(),u=await p(o,[...s,i]);t.push(u)}else r[n]=o;if(Object.keys(r).length){const n=s.map(c.dashCase).join("-"),o="t_"+c.toHash(n,4),i=await a.parseAndJoinStyles(r,`.${n}, .${o}`);t.push(i)}return t.join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../parse-styles-B1E0JeC7.cjs"),c=require("../dash-case-BJEkFEGQ.cjs"),p=async(e,s=[])=>{if(!e)return"";const t=[],r={};for(const[n,o]of Object.entries(e))if(typeof o!="function")if(o&&typeof o=="object"){const i=n.trim(),u=await p(o,[...s,i]);t.push(u)}else r[n]=o;if(Object.keys(r).length){const n=s.map(c.dashCase).join("-"),o="t_"+c.toHash(n,4),i=await a.parseAndJoinStyles(r,`.${n}, .${o}`);t.push(i)}return t.join(`
2
2
  `)},y=e=>Object.keys(e),f=e=>e?Object.entries(e).reduce((s,[t,r])=>(typeof r=="function"?s[t]="any":typeof r=="object"&&(s[t]=l(r).map(n=>`"${n}"`).join(" | ")),s),{}):{},l=(e,s="",t=new Set)=>e?(Object.entries(e).forEach(([r,n])=>{const o=s?`${s}.${r}`:r;return typeof n=="object"?l(n,o,t):t.add(s)}),[...t]):[];exports.parseAndJoinStyles=a.parseAndJoinStyles;exports.parseStyles=a.parseStyles;exports.parseValueModifiers=a.parseValueModifiers;exports.parseValueTokens=a.parseValueTokens;exports.parseVariableTokens=a.parseVariableTokens;exports.getTemplateKeys=y;exports.getTemplateTokens=l;exports.getTemplateTypes=f;exports.parseTemplates=p;
package/parsers/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { p as f } from "../parse-styles-CPuIGA08.js";
2
- import { c as T, b as O, d as $, a as g } from "../parse-styles-CPuIGA08.js";
1
+ import { p as f } from "../parse-styles-y_-drahL.js";
2
+ import { c as T, b as O, d as $, a as g } from "../parse-styles-y_-drahL.js";
3
3
  import { d as p, t as u } from "../dash-case-DBThphLm.js";
4
4
  const l = async (e, s = []) => {
5
5
  if (!e) return "";
package/server/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../should-restart-DT8O0pOt.cjs");exports.checkShouldRestart=e.checkShouldRestart;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../should-restart-B-ov9sPO.cjs");exports.checkShouldRestart=e.checkShouldRestart;
package/server/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as o } from "../should-restart-CNF2idbd.js";
1
+ import { c as o } from "../should-restart-Dvo5_WYL.js";
2
2
  export {
3
3
  o as checkShouldRestart
4
4
  };
@@ -1 +1 @@
1
- "use strict";const s=require("fs/promises"),r=require("./index-D0QitXLT.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-DojP6pQJ.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,5 +1,5 @@
1
1
  import { readFile as r } from "fs/promises";
2
- import { i as e } from "./index-Bzka2M7f.js";
2
+ import { i as e } from "./index-Bsj-9mQh.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;
package/types/index.d.ts CHANGED
@@ -30,7 +30,7 @@ type InvalidVariantKeys = '' | 'css';
30
30
  type VariantOptions = {
31
31
  [key in InvalidVariantKeys]?: never;
32
32
  };
33
- export type CompoundVariant = {
33
+ export type MultiVariant = {
34
34
  [key: PropertyKey]: string | boolean | undefined;
35
35
  } | {
36
36
  css: CSSinJS;
@@ -44,7 +44,8 @@ type Variants = {
44
44
  defaultVariants?: {
45
45
  [key: PropertyKey]: any;
46
46
  };
47
- compoundVariants?: CompoundVariant[];
47
+ compoundVariants?: MultiVariant[];
48
+ anyOfVariants?: MultiVariant[];
48
49
  };
49
50
  type BooleanVariantValue = 'true' | 'false' | boolean;
50
51
  type VariantPropValue<T> = T extends 'true' ? BooleanVariantValue : T extends 'false' ? BooleanVariantValue : T extends boolean ? BooleanVariantValue : T | '';
@@ -55,10 +56,12 @@ type AllKeys<T> = T extends any ? keyof T : never;
55
56
  export type Merge<T> = {
56
57
  [k in AllKeys<T>]?: PickType<T, k>;
57
58
  };
58
- export type VariantProps<STYLES extends StyledParams, B = STYLES['variants'] extends undefined ? object : STYLES['variants'], C = STYLES['compoundVariants'] extends CompoundVariant[] ? Merge<STYLES['compoundVariants'][number]> : object> = Merge<{
59
+ export type VariantProps<STYLES extends StyledParams, B = STYLES['variants'] extends undefined ? object : STYLES['variants'], C = STYLES['compoundVariants'] extends MultiVariant[] ? Merge<STYLES['compoundVariants'][number]> : object, U = STYLES['anyOfVariants'] extends MultiVariant[] ? Merge<STYLES['anyOfVariants'][number]> : object> = Merge<{
59
60
  [K in keyof B]?: K extends 'css' ? never : VariantPropValue<keyof B[K]>;
60
61
  } | {
61
62
  [K in keyof C]?: K extends 'css' ? never : VariantPropValue<C[K]>;
63
+ } | {
64
+ [K in keyof U]?: K extends 'css' ? never : VariantPropValue<U[K]>;
62
65
  }>;
63
66
  type CssValuePropKey = `props-${string}`;
64
67
  export type ValueProps = {
@@ -1,5 +0,0 @@
1
- "use strict";const x=require("./dash-case-BJEkFEGQ.cjs"),M=require("./viewport-clamp-mq_DFtRR.cjs"),q=o=>s=>{if(typeof s!="string"||!o)return;let t=s;const u=[];return Object.values(o).forEach(e=>{const{pattern:p,transform:f}=e;t=t.replace(p,C=>{const{value:V,css:v}=f(C);return v&&u.push(v),V})}),{transformed:t,additionalCss:u}},A=o=>s=>typeof s!="string"||!/\{[^{}]+\}/g.test(s)?void 0:{transformed:s.replace(/\{([^{}]+)\}/g,(...e)=>{const p=x.dashCase(e[1].replaceAll(".","-"));return o&&!o.includes(p)&&console.warn(`Token ${p} might not exist`),p.startsWith("-")?`-${p}`:`var(--${p})`})},N=A(),U=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],k=(o,s,t)=>{if(U.some(e=>typeof e=="string"?e===o:e.test(o))){const e=(t==null?void 0:t.defaultUnit)||"px";if(e.startsWith("viewport-clamp:"))try{const f=e.split(":")[1];return M.defineViewportClamp({screenSize:parseInt(f)})(Number(s))}catch(f){throw console.error(f),new Error(`Invalid viewport-clamp value: ${e}`)}return`${s}${e}`}return`${s}`},J=["Webkit","Moz","ms","O"],Q=o=>o.startsWith("-")?o:J.some(s=>o.startsWith(s))?`-${x.dashCase(o)}`:x.dashCase(o),$=async(o,s="",t,u=!1)=>{if(!o)throw new Error("No styles provided to parseStyles function!");const e=new Set,p=Object.entries(o),f=async([m,r])=>{var P;const n=m.trim().replace(/^\?+/g,""),b=Q(n),h=(a,c=";")=>`${b}:${a}${c}`,E={scope:s,config:t};if(typeof r=="function")return f([m,r(E)]);if(r instanceof Promise)return f([m,await r]);if(t!=null&&t.templates&&t.templatePaths[n])try{const[a,c]=t.templatePaths[n].split(";;"),i=await import(c),l=c.includes("salty.config"),d=l?i[a].templates:i[a],y=l?d[n]:d.params[n];if(d&&typeof y=="function"){const S=await y(r),[w]=await $(S,"");return w}}catch(a){console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`,a);return}if(t!=null&&t.templates&&t.templates[n]){if(u)return;const c=r.split(".").reduce((i,l)=>i[l],t.templates[n]);if(c){const[i]=await $(c,"");return i}console.warn(`Template "${n}" with path of "${r}" was not found in config!`);return}if(typeof r=="object"){if(!r)return;if(r.isColor)return h(r.toString());if(n==="defaultVariants")return;if(n==="variants"){const i=Object.entries(r);for(const[l,d]of i){if(!d)continue;const y=Object.entries(d);for(const[S,w]of y){if(!w)continue;const T=`${s}.${l}-${S}`;(await $(w,T,t)).forEach(I=>e.add(I))}}return}if(n==="compoundVariants"){for(const i of r){const{css:l,...d}=i,y=Object.entries(d).reduce((w,[T,z])=>`${w}.${T}-${z}`,s);(await $(l,y,t)).forEach(w=>e.add(w))}return}if(n.startsWith("@")){const i=((P=t==null?void 0:t.mediaQueries)==null?void 0:P[n])||n,l=await W(r,s,t),d=`${i} { ${l} }`;e.add(d);return}const a=m.includes("&")?n.replaceAll("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await $(r,a,t)).forEach(i=>e.add(i));return}if(typeof r=="number"){const a=k(b,r,t);return h(a)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${b}`);return h(r)},C=p.map(f),{modifiers:V}=t||{},v=[A(),q(V)],j=(await Promise.all(C).then(m=>Promise.all(m.map(r=>v.reduce(async(n,b)=>{const h=await n;if(!h)return h;const E=await b(h);if(!E)return h;const{transformed:P,additionalCss:a}=E;let c="";if(a)for(const i of a)c+=await W(i,"");return`${c}${P}`},Promise.resolve(r)))))).filter(m=>m!==void 0).join(`
2
- `);if(!j.trim())return Array.from(e);const O=s?`${s} {
3
- ${j}
4
- }`:j;return e.has(O)?Array.from(e):[O,...e]},W=async(o,s,t,u=!1)=>(await $(o,s,t,u)).join(`
5
- `);exports.parseAndJoinStyles=W;exports.parseStyles=$;exports.parseValueModifiers=q;exports.parseValueTokens=A;exports.parseVariableTokens=N;
@@ -1,154 +0,0 @@
1
- import { d as O } from "./dash-case-DBThphLm.js";
2
- import { d as N } from "./viewport-clamp-CaYwREKc.js";
3
- const U = (o) => (s) => {
4
- if (typeof s != "string" || !o) return;
5
- let t = s;
6
- const m = [];
7
- return Object.values(o).forEach((e) => {
8
- const { pattern: p, transform: f } = e;
9
- t = t.replace(p, (E) => {
10
- const { value: x, css: v } = f(E);
11
- return v && m.push(v), x;
12
- });
13
- }), { transformed: t, additionalCss: m };
14
- }, A = (o) => (s) => typeof s != "string" || !/\{[^{}]+\}/g.test(s) ? void 0 : { transformed: s.replace(/\{([^{}]+)\}/g, (...e) => {
15
- const p = O(e[1].replaceAll(".", "-"));
16
- return o && !o.includes(p) && console.warn(`Token ${p} might not exist`), p.startsWith("-") ? `-${p}` : `var(--${p})`;
17
- }) }, D = A(), M = [
18
- "top",
19
- "right",
20
- "bottom",
21
- "left",
22
- "min-width",
23
- /.*width.*/,
24
- /^[^line]*height.*/,
25
- // Exclude line-height
26
- /padding.*/,
27
- /margin.*/,
28
- /border.*/,
29
- /inset.*/,
30
- /.*radius.*/,
31
- /.*spacing.*/,
32
- /.*gap.*/,
33
- /.*indent.*/,
34
- /.*offset.*/,
35
- /.*size.*/,
36
- /.*thickness.*/,
37
- /.*font-size.*/
38
- ], Q = (o, s, t) => {
39
- if (M.some((e) => typeof e == "string" ? e === o : e.test(o))) {
40
- const e = (t == null ? void 0 : t.defaultUnit) || "px";
41
- if (e.startsWith("viewport-clamp:"))
42
- try {
43
- const f = e.split(":")[1];
44
- return N({
45
- screenSize: parseInt(f)
46
- })(Number(s));
47
- } catch (f) {
48
- throw console.error(f), new Error(`Invalid viewport-clamp value: ${e}`);
49
- }
50
- return `${s}${e}`;
51
- }
52
- return `${s}`;
53
- }, _ = ["Webkit", "Moz", "ms", "O"], q = (o) => o.startsWith("-") ? o : _.some((s) => o.startsWith(s)) ? `-${O(o)}` : O(o), y = async (o, s = "", t, m = !1) => {
54
- if (!o) throw new Error("No styles provided to parseStyles function!");
55
- const e = /* @__PURE__ */ new Set(), p = Object.entries(o), f = async ([u, r]) => {
56
- var P;
57
- const n = u.trim().replace(/^\?+/g, ""), b = q(n), h = (a, c = ";") => `${b}:${a}${c}`, C = { scope: s, config: t };
58
- if (typeof r == "function") return f([u, r(C)]);
59
- if (r instanceof Promise) return f([u, await r]);
60
- if (t != null && t.templates && t.templatePaths[n])
61
- try {
62
- const [a, c] = t.templatePaths[n].split(";;"), i = await import(
63
- /* webpackIgnore: true */
64
- /* @vite-ignore */
65
- c
66
- ), d = c.includes("salty.config"), l = d ? i[a].templates : i[a], $ = d ? l[n] : l.params[n];
67
- if (l && typeof $ == "function") {
68
- const j = await $(r), [w] = await y(j, "");
69
- return w;
70
- }
71
- } catch (a) {
72
- console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`, a);
73
- return;
74
- }
75
- if (t != null && t.templates && t.templates[n]) {
76
- if (m) return;
77
- const c = r.split(".").reduce((i, d) => i[d], t.templates[n]);
78
- if (c) {
79
- const [i] = await y(c, "");
80
- return i;
81
- }
82
- console.warn(`Template "${n}" with path of "${r}" was not found in config!`);
83
- return;
84
- }
85
- if (typeof r == "object") {
86
- if (!r) return;
87
- if (r.isColor) return h(r.toString());
88
- if (n === "defaultVariants") return;
89
- if (n === "variants") {
90
- const i = Object.entries(r);
91
- for (const [d, l] of i) {
92
- if (!l) continue;
93
- const $ = Object.entries(l);
94
- for (const [j, w] of $) {
95
- if (!w) continue;
96
- const W = `${s}.${d}-${j}`;
97
- (await y(w, W, t)).forEach((I) => e.add(I));
98
- }
99
- }
100
- return;
101
- }
102
- if (n === "compoundVariants") {
103
- for (const i of r) {
104
- const { css: d, ...l } = i, $ = Object.entries(l).reduce((w, [W, V]) => `${w}.${W}-${V}`, s);
105
- (await y(d, $, t)).forEach((w) => e.add(w));
106
- }
107
- return;
108
- }
109
- if (n.startsWith("@")) {
110
- const i = ((P = t == null ? void 0 : t.mediaQueries) == null ? void 0 : P[n]) || n, d = await z(r, s, t), l = `${i} { ${d} }`;
111
- e.add(l);
112
- return;
113
- }
114
- const a = u.includes("&") ? n.replaceAll("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
115
- (await y(r, a, t)).forEach((i) => e.add(i));
116
- return;
117
- }
118
- if (typeof r == "number") {
119
- const a = Q(b, r, t);
120
- return h(a);
121
- }
122
- if (typeof r != "string")
123
- if ("toString" in r) r = r.toString();
124
- else throw new Error(`Invalid value type for property ${b}`);
125
- return h(r);
126
- }, E = p.map(f), { modifiers: x } = t || {}, v = [A(), U(x)], S = (await Promise.all(E).then((u) => Promise.all(
127
- u.map((r) => v.reduce(async (n, b) => {
128
- const h = await n;
129
- if (!h) return h;
130
- const C = await b(h);
131
- if (!C) return h;
132
- const { transformed: P, additionalCss: a } = C;
133
- let c = "";
134
- if (a)
135
- for (const i of a)
136
- c += await z(i, "");
137
- return `${c}${P}`;
138
- }, Promise.resolve(r)))
139
- ))).filter((u) => u !== void 0).join(`
140
- `);
141
- if (!S.trim()) return Array.from(e);
142
- const T = s ? `${s} {
143
- ${S}
144
- }` : S;
145
- return e.has(T) ? Array.from(e) : [T, ...e];
146
- }, z = async (o, s, t, m = !1) => (await y(o, s, t, m)).join(`
147
- `);
148
- export {
149
- D as a,
150
- U as b,
151
- y as c,
152
- A as d,
153
- z as p
154
- };