@salty-css/core 0.0.1-alpha.203 → 0.0.1-alpha.204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/main.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),G=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),t=require("../index-_k0TKi9f.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora");var z=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,P)=>{se.exec(y,F=>{if(F)return P(F);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),P=oe(`Installing packages: ${C}`).start(),F=y.join(" ");await X(`npm install ${F}`),P.succeed(`Installed packages: ${C}`)},ae=()=>G.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!ae())return;await X(`./node_modules/.bin/prettier --write "${y}"`),t.logger.info(`Formatted ${y} with Prettier`)}catch(C){t.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function re(){const y=new te.Command;y.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const C={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-Dk6ZcCxI.cjs")),"saltygen/index.css":Promise.resolve().then(()=>require("../index-84Wroia-.cjs")),"react/react-styled-file.ts":Promise.resolve().then(()=>require("../react-styled-file-Dkubsz-U.cjs")),"react/react-vanilla-file.ts":Promise.resolve().then(()=>require("../react-vanilla-file-CG_WJLam.cjs"))},P=async(i,a)=>{const{default:l}=await C[i],u=ne.render(l,a);return{fileName:i,content:u}},F=async()=>{const i=n.join(process.cwd(),".saltyrc.json");return await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>({}))},b=n.join(process.cwd(),"package.json"),N=async(i=b)=>{const a=await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>{});if(!a)throw"Could not read package.json file!";return a},Y=async(i,a=b)=>{typeof i=="object"&&(i=JSON.stringify(i,null,2)),await s.writeFile(a,i)},B=async()=>{const i=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:z&&z.tagName.toUpperCase()==="SCRIPT"&&z.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await F()).defaultProject)(),$=await B(),D={core:`@salty-css/core@${$.version}`,react:`@salty-css/react@${$.version}`,eslintConfigCore:`@salty-css/eslint-config-core@${$.version}`,vite:`@salty-css/vite@${$.version}`,next:`@salty-css/next@${$.version}`},R=i=>{const a=i==="."?"":i,l=process.cwd();return n.join(l,a)};y.command("init [directory]").description("Initialize a new Salty-CSS project.").option("-d, --dir <dir>","Project directory to initialize the project in.").option("--css-file <css-file>","Existing CSS file where to import the generated CSS. Path must be relative to the given project directory.").option("--skip-install","Skip installing dependencies.").action(async function(i="."){if(!await N().catch(()=>{}))return t.logError("Salty CSS project must be initialized in a directory with a package.json file.");t.logger.info("Initializing a new Salty-CSS project!");const{dir:l=i,cssFile:u,skipInstall:p}=this.opts();if(!l)return t.logError("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");p||await I(D.core,D.react);const f=process.cwd(),r=R(l),T=await Promise.all([P("salty.config.ts"),P("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=T.map(async({fileName:e,content:g})=>{const c=n.join(r,e);if(await s.readFile(c,"utf-8").catch(()=>{})!==void 0){t.logger.debug("File already exists: "+c);return}const k=e.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),t.logger.info("Creating file: "+c),await s.writeFile(c,g),await S(c)});await Promise.all(m);const w=n.relative(f,r)||".",h=n.join(f,".saltyrc.json"),d=await s.readFile(h,"utf-8").catch(()=>{});if(d===void 0){t.logger.info("Creating file: "+h);const g=JSON.stringify({$schema:"./node_modules/@salty-css/core/.saltyrc.schema.json",info:"This file is used to define projects and their configurations for Salty CSS cli. Do not delete, modify or add this file to .gitignore.",defaultProject:w,projects:[{dir:w,framework:"react"}]},null,2);await s.writeFile(h,g),await S(h)}else{const e=JSON.parse(d),g=(e==null?void 0:e.projects)||[];if(g.findIndex(o=>o.dir===w)===-1){g.push({dir:w,framework:"react"}),e.projects=[...g];const o=JSON.stringify(e,null,2);o!==d&&(t.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(f,".gitignore"),U=await s.readFile(j,"utf-8").catch(()=>{});U!==void 0&&(U.includes("saltygen")||(t.logger.info("Edit file: "+j),await s.writeFile(j,U+`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("commander"),G=require("fs"),s=require("fs/promises"),n=require("path"),ne=require("ejs"),t=require("../index-DMCrqpTd.cjs"),ie=require("../pascal-case-iWoaJWwT.cjs"),se=require("child_process"),oe=require("ora");var z=typeof document<"u"?document.currentScript:null;const X=y=>new Promise((C,P)=>{se.exec(y,F=>{if(F)return P(F);C()})}),I=async(...y)=>{const C=y.map(b=>b.replace("-D","").split("@").slice(0,-1).join("@").trim()).join(", "),P=oe(`Installing packages: ${C}`).start(),F=y.join(" ");await X(`npm install ${F}`),P.succeed(`Installed packages: ${C}`)},ae=()=>G.existsSync(n.join(process.cwd(),"node_modules",".bin","prettier"));async function S(y){try{if(!ae())return;await X(`./node_modules/.bin/prettier --write "${y}"`),t.logger.info(`Formatted ${y} with Prettier`)}catch(C){t.logger.error(`Error formatting ${y} with Prettier:`,C)}}async function re(){const y=new te.Command;y.name("salty-css").description("Salty-CSS CLI tool to help with annoying configuration tasks.");const C={"salty.config.ts":Promise.resolve().then(()=>require("../salty.config-Dk6ZcCxI.cjs")),"saltygen/index.css":Promise.resolve().then(()=>require("../index-84Wroia-.cjs")),"react/react-styled-file.ts":Promise.resolve().then(()=>require("../react-styled-file-Dkubsz-U.cjs")),"react/react-vanilla-file.ts":Promise.resolve().then(()=>require("../react-vanilla-file-CG_WJLam.cjs"))},P=async(i,a)=>{const{default:l}=await C[i],u=ne.render(l,a);return{fileName:i,content:u}},F=async()=>{const i=n.join(process.cwd(),".saltyrc.json");return await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>({}))},b=n.join(process.cwd(),"package.json"),N=async(i=b)=>{const a=await s.readFile(i,"utf-8").then(JSON.parse).catch(()=>{});if(!a)throw"Could not read package.json file!";return a},Y=async(i,a=b)=>{typeof i=="object"&&(i=JSON.stringify(i,null,2)),await s.writeFile(a,i)},B=async()=>{const i=new URL("../package.json",typeof document>"u"?require("url").pathToFileURL(__filename).href:z&&z.tagName.toUpperCase()==="SCRIPT"&&z.src||new URL("bin/main.cjs",document.baseURI).href);return N(i)},V=await(async()=>(await F()).defaultProject)(),$=await B(),D={core:`@salty-css/core@${$.version}`,react:`@salty-css/react@${$.version}`,eslintConfigCore:`@salty-css/eslint-config-core@${$.version}`,vite:`@salty-css/vite@${$.version}`,next:`@salty-css/next@${$.version}`},R=i=>{const a=i==="."?"":i,l=process.cwd();return n.join(l,a)};y.command("init [directory]").description("Initialize a new Salty-CSS project.").option("-d, --dir <dir>","Project directory to initialize the project in.").option("--css-file <css-file>","Existing CSS file where to import the generated CSS. Path must be relative to the given project directory.").option("--skip-install","Skip installing dependencies.").action(async function(i="."){if(!await N().catch(()=>{}))return t.logError("Salty CSS project must be initialized in a directory with a package.json file.");t.logger.info("Initializing a new Salty-CSS project!");const{dir:l=i,cssFile:u,skipInstall:p}=this.opts();if(!l)return t.logError("Project directory must be provided. Add it as the first argument after init command or use the --dir option.");p||await I(D.core,D.react);const f=process.cwd(),r=R(l),T=await Promise.all([P("salty.config.ts"),P("saltygen/index.css")]);await s.mkdir(r,{recursive:!0});const m=T.map(async({fileName:e,content:g})=>{const c=n.join(r,e);if(await s.readFile(c,"utf-8").catch(()=>{})!==void 0){t.logger.debug("File already exists: "+c);return}const k=e.split("/").slice(0,-1).join("/");k&&await s.mkdir(n.join(r,k),{recursive:!0}),t.logger.info("Creating file: "+c),await s.writeFile(c,g),await S(c)});await Promise.all(m);const w=n.relative(f,r)||".",h=n.join(f,".saltyrc.json"),d=await s.readFile(h,"utf-8").catch(()=>{});if(d===void 0){t.logger.info("Creating file: "+h);const g=JSON.stringify({$schema:"./node_modules/@salty-css/core/.saltyrc.schema.json",info:"This file is used to define projects and their configurations for Salty CSS cli. Do not delete, modify or add this file to .gitignore.",defaultProject:w,projects:[{dir:w,framework:"react"}]},null,2);await s.writeFile(h,g),await S(h)}else{const e=JSON.parse(d),g=(e==null?void 0:e.projects)||[];if(g.findIndex(o=>o.dir===w)===-1){g.push({dir:w,framework:"react"}),e.projects=[...g];const o=JSON.stringify(e,null,2);o!==d&&(t.logger.info("Edit file: "+h),await s.writeFile(h,o),await S(h))}}const j=n.join(f,".gitignore"),U=await s.readFile(j,"utf-8").catch(()=>{});U!==void 0&&(U.includes("saltygen")||(t.logger.info("Edit file: "+j),await s.writeFile(j,U+`
2
2
 
3
3
  # Salty-CSS
4
4
  saltygen
package/bin/main.js CHANGED
@@ -3,7 +3,7 @@ import { existsSync as K } from "fs";
3
3
  import { mkdir as q, readFile as C, writeFile as w } from "fs/promises";
4
4
  import { join as i, relative as z, parse as re, format as ee } from "path";
5
5
  import { render as ce } from "ejs";
6
- import { l as t, a as h, g as te } from "../index-CuE3hjO7.js";
6
+ import { l as t, a as h, g as te } from "../index-DOGHBmYn.js";
7
7
  import { p as le } from "../pascal-case-BQpR5PdN.js";
8
8
  import { exec as de } from "child_process";
9
9
  import fe from "ora";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("esbuild");require("child_process");require("../dash-case-BJEkFEGQ.cjs");require("path");require("fs");require("fs/promises");require("../parse-styles-DhDStS4F.cjs");const e=require("../index-_k0TKi9f.cjs");require("../css/merge.cjs");exports.compileSaltyFile=e.compileSaltyFile;exports.generateConfigStyles=e.generateConfigStyles;exports.generateCss=e.generateCss;exports.generateFile=e.generateFile;exports.isSaltyFile=e.isSaltyFile;exports.minimizeFile=e.minimizeFile;exports.saltyFileExtensions=e.saltyFileExtensions;exports.saltyFileRegExp=e.saltyFileRegExp;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("esbuild");require("child_process");require("../dash-case-BJEkFEGQ.cjs");require("path");require("fs");require("fs/promises");require("../parse-styles-B67L4oyf.cjs");const e=require("../index-DMCrqpTd.cjs");require("../css/merge.cjs");exports.compileSaltyFile=e.compileSaltyFile;exports.generateConfigStyles=e.generateConfigStyles;exports.generateCss=e.generateCss;exports.generateFile=e.generateFile;exports.isSaltyFile=e.isSaltyFile;exports.minimizeFile=e.minimizeFile;exports.saltyFileExtensions=e.saltyFileExtensions;exports.saltyFileRegExp=e.saltyFileRegExp;
package/compiler/index.js CHANGED
@@ -4,8 +4,8 @@ import "../dash-case-DBThphLm.js";
4
4
  import "path";
5
5
  import "fs";
6
6
  import "fs/promises";
7
- import "../parse-styles-CbYzTfwr.js";
8
- import { d as n, c as g, g as F, e as y, i as x, m as S, s as c, b as f } from "../index-CuE3hjO7.js";
7
+ import "../parse-styles-DZbuVYRn.js";
8
+ import { d as n, c as g, g as F, e as y, i as x, m as S, s as c, b as f } from "../index-DOGHBmYn.js";
9
9
  import "../css/merge.js";
10
10
  export {
11
11
  n as compileSaltyFile,
package/css/keyframes.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../parse-styles-DhDStS4F.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-B67L4oyf.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-CbYzTfwr.js";
1
+ import { p as m } from "../parse-styles-DZbuVYRn.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 b=Object.defineProperty;var N=(e,s,t)=>s in e?b(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var u=(e,s,t)=>N(e,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../parse-styles-DhDStS4F.cjs"),m=require("../dash-case-BJEkFEGQ.cjs");class f{constructor(s){u(this,"buildContext",{});this.params=s}get hash(){return m.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const s=[this.hash],{className:t}=this.params;return typeof t=="string"&&s.push(t),typeof t=="object"&&s.push(...t),s.join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${m.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:n=[]}=this.params,{config:i}=this.buildContext,o={...s,variants:t,compoundVariants:n};return C.parseAndJoinStyles(o,`.${this.cssClassName}`,i)}_withBuildContext(s){return this.buildContext=s,this}}class S 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 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:n=[],defaultVariants:i={},defaultProps:o={},passProps:h}=this.params,{callerName:y,isProduction:g}=this.buildContext,c=new Set([]),d=a=>{const r=i[a];r!==void 0?c.add(`${a}=${String(r)}`):c.add(a)};Object.keys(t).forEach(d),n.map(a=>Object.keys(a).forEach(d));const l=new Set([]);if(this.params.base){const a=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);a&&a.forEach(r=>{const p=r.replace(/\{props\.([\w\d]+)\}/gi,"$1");p&&l.add(p)})}return{element:s,variantKeys:[...c],propValueKeys:[...l],passProps:h,defaultProps:o,attr:{"data-component-name":g?void 0:y}}}}exports.ClassNameGenerator=S;exports.StyledGenerator=v;
1
+ "use strict";var b=Object.defineProperty;var N=(e,s,t)=>s in e?b(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var u=(e,s,t)=>N(e,typeof s!="symbol"?s+"":s,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../parse-styles-B67L4oyf.cjs"),m=require("../dash-case-BJEkFEGQ.cjs");class f{constructor(s){u(this,"buildContext",{});this.params=s}get hash(){return m.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const s=[this.hash],{className:t}=this.params;return typeof t=="string"&&s.push(t),typeof t=="object"&&s.push(...t),s.join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${m.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:n=[]}=this.params,{config:i}=this.buildContext,o={...s,variants:t,compoundVariants:n};return C.parseAndJoinStyles(o,`.${this.cssClassName}`,i)}_withBuildContext(s){return this.buildContext=s,this}}class S 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 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:n=[],defaultVariants:i={},defaultProps:o={},passProps:h}=this.params,{callerName:y,isProduction:g}=this.buildContext,c=new Set([]),d=a=>{const r=i[a];r!==void 0?c.add(`${a}=${String(r)}`):c.add(a)};Object.keys(t).forEach(d),n.map(a=>Object.keys(a).forEach(d));const l=new Set([]);if(this.params.base){const a=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);a&&a.forEach(r=>{const p=r.replace(/\{props\.([\w\d]+)\}/gi,"$1");p&&l.add(p)})}return{element:s,variantKeys:[...c],propValueKeys:[...l],passProps:h,defaultProps:o,attr:{"data-component-name":g?void 0:y}}}}exports.ClassNameGenerator=S;exports.StyledGenerator=v;
@@ -1,7 +1,7 @@
1
1
  var y = Object.defineProperty;
2
2
  var b = (e, s, t) => s in e ? y(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
3
  var u = (e, s, t) => b(e, typeof s != "symbol" ? s + "" : s, t);
4
- import { p as N } from "../parse-styles-CbYzTfwr.js";
4
+ import { p as N } from "../parse-styles-DZbuVYRn.js";
5
5
  import { t as C, d as x } from "../dash-case-DBThphLm.js";
6
6
  class m {
7
7
  constructor(s) {
@@ -1,5 +1,5 @@
1
- "use strict";const Ce=require("esbuild"),xe=require("child_process"),P=require("./dash-case-BJEkFEGQ.cjs"),r=require("path"),a=require("fs"),oe=require("fs/promises"),X=require("./parse-styles-DhDStS4F.cjs"),B=require("winston"),V=require("./css/merge.cjs");var ne=typeof document<"u"?document.currentScript:null;function Ne(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const de=Ne(Ce),pe=async(e,t=[])=>{if(!e)return"";const s=[],n={};for(const[o,i]of Object.entries(e))if(typeof i=="function")console.log("Function found",o);else if(i&&typeof i=="object"){const f=o.trim(),d=await pe(i,[...t,f]);s.push(d)}else n[o]=i;if(Object.keys(n).length){const o=t.map(P.dashCase).join("-"),i=await X.parseAndJoinStyles(n,`.${o}`);s.push(i)}return s.join(`
2
- `)},ke=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=ye(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},ye=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const i=t?`${t}.${n}`:n;return typeof o=="object"?ye(o,i,s):s.add(t)}),[...s]):[],me=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=r.join(e,"package.json");return a.existsSync(t)?t:me(r.join(e,".."))},Pe=async e=>{const t=me(e);return await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},De=async e=>{const t=await Pe(e);if(t)return t.type};let J;const ge=async e=>{if(J)return J;const t=await De(e);return t==="module"?J="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:ne&&ne.tagName.toUpperCase()==="SCRIPT"&&ne.src||new URL("index-_k0TKi9f.cjs",document.baseURI).href).endsWith(".cjs"))&&(J="cjs"),J||"esm"},G=B.createLogger({level:"debug",format:B.format.combine(B.format.colorize(),B.format.cli()),transports:[new B.transports.Console({})]}),_e=e=>{G.error(e)};function he(e){return e?typeof e!="string"?he(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const Te={"*, *::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"}},R={externalModules:[],rcFile:void 0,destDir:void 0},Se=e=>{if(R.externalModules.length>0)return R.externalModules;const s=a.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return R.externalModules=n,n},M=async e=>{if(R.destDir)return R.destDir;const t=await re(e),s=r.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return R.destDir=s,s},ie=["salty","css","styles","styled"],we=(e=[])=>new RegExp(`\\.(${[...ie,...e].join("|")})\\.`),Y=(e,t=[])=>we(t).test(e),je=async e=>{if(R.rcFile)return R.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=r.join(e,".saltyrc.json"),s=await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(R.rcFile=s,s):je(r.join(e,".."))},re=async e=>{var n,o;const t=await je(e),s=(n=t.projects)==null?void 0:n.find(i=>e.endsWith(i.dir||""));return s||((o=t.projects)==null?void 0:o.find(i=>i.dir===t.defaultProject))},Ee=async e=>{const t=await re(e),s=await M(e),n=r.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=r.join(s,"salty.config.js"),i=await ge(e),f=Se(n);await de.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:i,external:f});const d=Date.now(),{config:y}=await import(`${o}?t=${d}`);return y},be=async(e,t)=>{var ce,le;const s=await M(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async h=>{const{contents:b,outputFilePath:O}=await K(e,h,s);Object.entries(b).forEach(([x,k])=>{k.isMedia?n.mediaQueries.push([x,k]):k.isGlobalDefine?n.globalStyles.push(k):k.isDefineVariables?n.variables.push(k):k.isDefineTemplates&&n.templates.push(k._setPath(O))})}));const o=await Ee(e),i={...o},f=new Set,d=(h,b=[])=>h?Object.entries(h).flatMap(([O,x])=>{if(!x)return;if(typeof x=="object")return d(x,[...b,O]);const k=he(O),te=P.dashCase(O),se=[...b,k].join(".");f.add(`"${se}"`);const U=[...b.map(P.dashCase),te].join("-"),fe=X.parseVariableTokens(x);return fe?`--${U}: ${fe.transformed};`:`--${U}: ${x};`}):[],y=h=>h?Object.entries(h).flatMap(([b,O])=>{const x=d(O);return b==="base"?x.join(""):`${b} { ${x.join("")} }`}):[],u=h=>h?Object.entries(h).flatMap(([b,O])=>Object.entries(O).flatMap(([x,k])=>{const te=d(k,[b]),se=`.${b}-${x}, [data-${b}="${x}"]`,U=te.join("");return`${se} { ${U} }`})):[],m=h=>({...h,responsive:void 0,conditional:void 0}),g=h=>n.variables.map(b=>h==="static"?m(b._current):b._current[h]),p=V.mergeStyles(m(o.variables),g("static")),F=d(p),S=V.mergeStyles((ce=o.variables)==null?void 0:ce.responsive,g("responsive")),T=y(S),D=V.mergeStyles((le=o.variables)==null?void 0:le.conditional,g("conditional")),_=u(D),v=r.join(s,"css/_variables.css"),E=`:root { ${F.join("")} ${T.join("")} } ${_.join("")}`;a.writeFileSync(v,E),i.staticVariables=p;const z=r.join(s,"css/_global.css"),N=V.mergeStyles(o.global,n.globalStyles),H=await X.parseAndJoinStyles(N,"");a.writeFileSync(z,`@layer global { ${H} }`);const c=r.join(s,"css/_reset.css"),j=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:Te,l=await X.parseAndJoinStyles(j,"");a.writeFileSync(c,`@layer reset { ${l} }`);const $=r.join(s,"css/_templates.css"),C=V.mergeStyles(o.templates,n.templates),q=await pe(C),I=ke(C);a.writeFileSync($,q),i.templates=C;const W=V.mergeFactories(n.templates);i.templatePaths=Object.fromEntries(Object.entries(W).map(([h,b])=>[h,b._path||"nope"]));const{mediaQueries:A}=n;i.mediaQueries=Object.fromEntries(A.map(([h,b])=>[`@${h}`,b]));const L=A.map(([h])=>`'@${h}'`).join(" | "),ee=r.join(s,"types/css-tokens.d.ts"),Z=`
1
+ "use strict";const Ce=require("esbuild"),xe=require("child_process"),P=require("./dash-case-BJEkFEGQ.cjs"),r=require("path"),a=require("fs"),oe=require("fs/promises"),X=require("./parse-styles-B67L4oyf.cjs"),B=require("winston"),V=require("./css/merge.cjs");var ne=typeof document<"u"?document.currentScript:null;function Ne(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const de=Ne(Ce),pe=async(e,t=[])=>{if(!e)return"";const s=[],n={};for(const[o,i]of Object.entries(e))if(typeof i=="function")console.log("Function found",o);else if(i&&typeof i=="object"){const f=o.trim(),d=await pe(i,[...t,f]);s.push(d)}else n[o]=i;if(Object.keys(n).length){const o=t.map(P.dashCase).join("-"),i=await X.parseAndJoinStyles(n,`.${o}`);s.push(i)}return s.join(`
2
+ `)},ke=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=ye(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},ye=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const i=t?`${t}.${n}`:n;return typeof o=="object"?ye(o,i,s):s.add(t)}),[...s]):[],me=e=>{if(!e||e==="/")throw new Error("Could not find package.json file");const t=r.join(e,"package.json");return a.existsSync(t)?t:me(r.join(e,".."))},Pe=async e=>{const t=me(e);return await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},De=async e=>{const t=await Pe(e);if(t)return t.type};let J;const ge=async e=>{if(J)return J;const t=await De(e);return t==="module"?J="esm":(t==="commonjs"||(typeof document>"u"?require("url").pathToFileURL(__filename).href:ne&&ne.tagName.toUpperCase()==="SCRIPT"&&ne.src||new URL("index-DMCrqpTd.cjs",document.baseURI).href).endsWith(".cjs"))&&(J="cjs"),J||"esm"},G=B.createLogger({level:"debug",format:B.format.combine(B.format.colorize(),B.format.cli()),transports:[new B.transports.Console({})]}),_e=e=>{G.error(e)};function he(e){return e?typeof e!="string"?he(String(e)):e.replace(/[\s-]/g,".").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(t,s)=>(s>0?".":"")+t.toLowerCase()):""}const Te={"*, *::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"}},R={externalModules:[],rcFile:void 0,destDir:void 0},Se=e=>{if(R.externalModules.length>0)return R.externalModules;const s=a.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return R.externalModules=n,n},M=async e=>{if(R.destDir)return R.destDir;const t=await re(e),s=r.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return R.destDir=s,s},ie=["salty","css","styles","styled"],we=(e=[])=>new RegExp(`\\.(${[...ie,...e].join("|")})\\.`),Y=(e,t=[])=>we(t).test(e),je=async e=>{if(R.rcFile)return R.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=r.join(e,".saltyrc.json"),s=await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(R.rcFile=s,s):je(r.join(e,".."))},re=async e=>{var n,o;const t=await je(e),s=(n=t.projects)==null?void 0:n.find(i=>e.endsWith(i.dir||""));return s||((o=t.projects)==null?void 0:o.find(i=>i.dir===t.defaultProject))},Ee=async e=>{const t=await re(e),s=await M(e),n=r.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=r.join(s,"salty.config.js"),i=await ge(e),f=Se(n);await de.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:i,external:f});const d=Date.now(),{config:y}=await import(`${o}?t=${d}`);return y},be=async(e,t)=>{var ce,le;const s=await M(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async h=>{const{contents:b,outputFilePath:O}=await K(e,h,s);Object.entries(b).forEach(([x,k])=>{k.isMedia?n.mediaQueries.push([x,k]):k.isGlobalDefine?n.globalStyles.push(k):k.isDefineVariables?n.variables.push(k):k.isDefineTemplates&&n.templates.push(k._setPath(O))})}));const o=await Ee(e),i={...o},f=new Set,d=(h,b=[])=>h?Object.entries(h).flatMap(([O,x])=>{if(!x)return;if(typeof x=="object")return d(x,[...b,O]);const k=he(O),te=P.dashCase(O),se=[...b,k].join(".");f.add(`"${se}"`);const U=[...b.map(P.dashCase),te].join("-"),fe=X.parseVariableTokens(x);return fe?`--${U}: ${fe.transformed};`:`--${U}: ${x};`}):[],y=h=>h?Object.entries(h).flatMap(([b,O])=>{const x=d(O);return b==="base"?x.join(""):`${b} { ${x.join("")} }`}):[],u=h=>h?Object.entries(h).flatMap(([b,O])=>Object.entries(O).flatMap(([x,k])=>{const te=d(k,[b]),se=`.${b}-${x}, [data-${b}="${x}"]`,U=te.join("");return`${se} { ${U} }`})):[],m=h=>({...h,responsive:void 0,conditional:void 0}),g=h=>n.variables.map(b=>h==="static"?m(b._current):b._current[h]),p=V.mergeStyles(m(o.variables),g("static")),F=d(p),S=V.mergeStyles((ce=o.variables)==null?void 0:ce.responsive,g("responsive")),T=y(S),D=V.mergeStyles((le=o.variables)==null?void 0:le.conditional,g("conditional")),_=u(D),v=r.join(s,"css/_variables.css"),E=`:root { ${F.join("")} ${T.join("")} } ${_.join("")}`;a.writeFileSync(v,E),i.staticVariables=p;const z=r.join(s,"css/_global.css"),N=V.mergeStyles(o.global,n.globalStyles),H=await X.parseAndJoinStyles(N,"");a.writeFileSync(z,`@layer global { ${H} }`);const c=r.join(s,"css/_reset.css"),j=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:Te,l=await X.parseAndJoinStyles(j,"");a.writeFileSync(c,`@layer reset { ${l} }`);const $=r.join(s,"css/_templates.css"),C=V.mergeStyles(o.templates,n.templates),q=await pe(C),I=ke(C);a.writeFileSync($,q),i.templates=C;const W=V.mergeFactories(n.templates);i.templatePaths=Object.fromEntries(Object.entries(W).map(([h,b])=>[h,b._path||"nope"]));const{mediaQueries:A}=n;i.mediaQueries=Object.fromEntries(A.map(([h,b])=>[`@${h}`,b]));const L=A.map(([h])=>`'@${h}'`).join(" | "),ee=r.join(s,"types/css-tokens.d.ts"),Z=`
3
3
  // Variable types
4
4
  type VariableTokens = ${[...f].join("|")};
5
5
  type PropertyValueToken = \`{\${VariableTokens}}\`;
@@ -4,7 +4,7 @@ import { d as W, t as I } from "./dash-case-DBThphLm.js";
4
4
  import { join as i, parse as Y } from "path";
5
5
  import { existsSync as it, writeFileSync as j, mkdirSync as J, readFileSync as D, statSync as Pt, readdirSync as kt } from "fs";
6
6
  import { readFile as gt, writeFile as Dt } from "fs/promises";
7
- import { p as at, a as _t } from "./parse-styles-CbYzTfwr.js";
7
+ import { p as at, a as _t } from "./parse-styles-DZbuVYRn.js";
8
8
  import { createLogger as Tt, format as ot, transports as Et } from "winston";
9
9
  import { mergeStyles as z, mergeFactories as Ot } from "./css/merge.js";
10
10
  const yt = async (t, e = []) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.203",
3
+ "version": "0.0.1-alpha.204",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -0,0 +1,3 @@
1
+ "use strict";const T=require("./dash-case-BJEkFEGQ.cjs"),A=n=>e=>{if(typeof e!="string"||!n)return;let t=e;const a=[];return Object.values(n).forEach(d=>{const{pattern:w,transform:P}=d;t=t.replace(w,j=>{const{value:x,css:u}=P(j);return u&&a.push(u),x})}),{transformed:t,additionalCss:a}},N=n=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...d)=>`var(--${T.dashCase(d[1].replaceAll(".","-"))})`)},U=N(),q=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],J=(n,e,t)=>{if(q.some(d=>typeof d=="string"?d===n:d.test(n))){const d=(t==null?void 0:t.defaultUnit)||"px";return`${e}${d}`}return`${e}`},M=["Webkit","Moz","ms","O"],Q=n=>n.startsWith("-")?n:M.some(e=>n.startsWith(e))?`-${T.dashCase(n)}`:T.dashCase(n),h=async(n,e="",t)=>{if(!n)throw new Error("No styles provided to parseStyles function!");const a=new Set,w=Object.entries(n).map(async([y,s])=>{var b;const r=y.trim(),$=Q(r),f=(o,c=";")=>`${$}:${o}${c}`;if(typeof s=="function"&&(s=s({scope:e,config:t})),s instanceof Promise&&(s=await s),t!=null&&t.templates&&t.templatePaths[r]){const{default:o}=await import(t.templatePaths[r]);if(typeof o.params[r]=="function"){const c=await o.params[r](s),[i]=await h(c,"");return i}}if(t!=null&&t.templates&&t.templates[r]){const c=s.split(".").reduce((i,p)=>i[p],t.templates[r]);if(c){const[i]=await h(c,"");return i}console.warn(`Template "${r}" with path of "${s}" was not found in config!`);return}if(typeof s=="object"){if(!s)return;if(s.isColor)return f(s.toString());if(r==="defaultVariants")return;if(r==="variants"){const i=Object.entries(s);for(const[p,l]of i){if(!l)return;const E=Object.entries(l);for(const[W,m]of E){if(!m)return;const O=`${e}.${p}-${W}`;(await h(m,O,t)).forEach(z=>a.add(z))}}return}if(r==="compoundVariants"){for(const i of s){const{css:p,...l}=i,E=Object.entries(l).reduce((m,[O,k])=>`${m}.${O}-${k}`,e);(await h(p,E,t)).forEach(m=>a.add(m))}return}if(r.startsWith("@")){const i=((b=t==null?void 0:t.mediaQueries)==null?void 0:b[r])||r,p=await V(s,e,t),l=`${i} { ${p} }`;a.add(l);return}const o=y.includes("&")?r.replace("&",e):r.startsWith(":")?`${e}${r}`:`${e} ${r}`;(await h(s,o,t)).forEach(i=>a.add(i));return}if(typeof s=="number"){const o=J($,s,t);return f(o)}if(typeof s!="string")if("toString"in s)s=s.toString();else throw new Error(`Invalid value type for property ${$}`);return f(s)}),{modifiers:P}=t||{},j=[N(),A(P)],u=(await Promise.all(w).then(y=>Promise.all(y.map(s=>j.reduce(async(r,$)=>{const f=await r;if(!f)return f;const C=await $(f);if(!C)return f;const{transformed:b,additionalCss:o}=C;let c="";if(o)for(const i of o)c+=await V(i,"");return`${c}${b}`},Promise.resolve(s)))))).join(`
2
+ `);if(!u.trim())return a;const S=e?`${e} { ${u} }`:u;return a.add(S),a},V=async(n,e,t)=>[...await h(n,e,t)].join(`
3
+ `);exports.parseAndJoinStyles=V;exports.parseVariableTokens=U;
@@ -0,0 +1,125 @@
1
+ import { d as C } from "./dash-case-DBThphLm.js";
2
+ const U = (n) => (e) => {
3
+ if (typeof e != "string" || !n) return;
4
+ let t = e;
5
+ const i = [];
6
+ return Object.values(n).forEach((d) => {
7
+ const { pattern: w, transform: P } = d;
8
+ t = t.replace(w, (j) => {
9
+ const { value: T, css: u } = P(j);
10
+ return u && i.push(u), T;
11
+ });
12
+ }), { transformed: t, additionalCss: i };
13
+ }, k = (n) => (e) => typeof e != "string" || !/\{[^{}]+\}/g.test(e) ? void 0 : { transformed: e.replace(/\{([^{}]+)\}/g, (...d) => `var(--${C(d[1].replaceAll(".", "-"))})`) }, F = k(), A = [
14
+ "top",
15
+ "right",
16
+ "bottom",
17
+ "left",
18
+ "min-width",
19
+ /.*width.*/,
20
+ /^[^line]*height.*/,
21
+ // Exclude line-height
22
+ /padding.*/,
23
+ /margin.*/,
24
+ /border.*/,
25
+ /inset.*/,
26
+ /.*radius.*/,
27
+ /.*spacing.*/,
28
+ /.*gap.*/,
29
+ /.*indent.*/,
30
+ /.*offset.*/,
31
+ /.*size.*/,
32
+ /.*thickness.*/,
33
+ /.*font-size.*/
34
+ ], M = (n, e, t) => {
35
+ if (A.some((d) => typeof d == "string" ? d === n : d.test(n))) {
36
+ const d = (t == null ? void 0 : t.defaultUnit) || "px";
37
+ return `${e}${d}`;
38
+ }
39
+ return `${e}`;
40
+ }, Q = ["Webkit", "Moz", "ms", "O"], _ = (n) => n.startsWith("-") ? n : Q.some((e) => n.startsWith(e)) ? `-${C(n)}` : C(n), h = async (n, e = "", t) => {
41
+ if (!n) throw new Error("No styles provided to parseStyles function!");
42
+ const i = /* @__PURE__ */ new Set(), w = Object.entries(n).map(async ([y, s]) => {
43
+ var b;
44
+ const r = y.trim(), $ = _(r), f = (a, c = ";") => `${$}:${a}${c}`;
45
+ if (typeof s == "function" && (s = s({ scope: e, config: t })), s instanceof Promise && (s = await s), t != null && t.templates && t.templatePaths[r]) {
46
+ const { default: a } = await import(t.templatePaths[r]);
47
+ if (typeof a.params[r] == "function") {
48
+ const c = await a.params[r](s), [o] = await h(c, "");
49
+ return o;
50
+ }
51
+ }
52
+ if (t != null && t.templates && t.templates[r]) {
53
+ const c = s.split(".").reduce((o, p) => o[p], t.templates[r]);
54
+ if (c) {
55
+ const [o] = await h(c, "");
56
+ return o;
57
+ }
58
+ console.warn(`Template "${r}" with path of "${s}" was not found in config!`);
59
+ return;
60
+ }
61
+ if (typeof s == "object") {
62
+ if (!s) return;
63
+ if (s.isColor) return f(s.toString());
64
+ if (r === "defaultVariants") return;
65
+ if (r === "variants") {
66
+ const o = Object.entries(s);
67
+ for (const [p, m] of o) {
68
+ if (!m) return;
69
+ const x = Object.entries(m);
70
+ for (const [V, l] of x) {
71
+ if (!l) return;
72
+ const O = `${e}.${p}-${V}`;
73
+ (await h(l, O, t)).forEach((S) => i.add(S));
74
+ }
75
+ }
76
+ return;
77
+ }
78
+ if (r === "compoundVariants") {
79
+ for (const o of s) {
80
+ const { css: p, ...m } = o, x = Object.entries(m).reduce((l, [O, W]) => `${l}.${O}-${W}`, e);
81
+ (await h(p, x, t)).forEach((l) => i.add(l));
82
+ }
83
+ return;
84
+ }
85
+ if (r.startsWith("@")) {
86
+ const o = ((b = t == null ? void 0 : t.mediaQueries) == null ? void 0 : b[r]) || r, p = await N(s, e, t), m = `${o} { ${p} }`;
87
+ i.add(m);
88
+ return;
89
+ }
90
+ const a = y.includes("&") ? r.replace("&", e) : r.startsWith(":") ? `${e}${r}` : `${e} ${r}`;
91
+ (await h(s, a, t)).forEach((o) => i.add(o));
92
+ return;
93
+ }
94
+ if (typeof s == "number") {
95
+ const a = M($, s, t);
96
+ return f(a);
97
+ }
98
+ if (typeof s != "string")
99
+ if ("toString" in s) s = s.toString();
100
+ else throw new Error(`Invalid value type for property ${$}`);
101
+ return f(s);
102
+ }), { modifiers: P } = t || {}, j = [k(), U(P)], u = (await Promise.all(w).then((y) => Promise.all(
103
+ y.map((s) => j.reduce(async (r, $) => {
104
+ const f = await r;
105
+ if (!f) return f;
106
+ const E = await $(f);
107
+ if (!E) return f;
108
+ const { transformed: b, additionalCss: a } = E;
109
+ let c = "";
110
+ if (a)
111
+ for (const o of a)
112
+ c += await N(o, "");
113
+ return `${c}${b}`;
114
+ }, Promise.resolve(s)))
115
+ ))).join(`
116
+ `);
117
+ if (!u.trim()) return i;
118
+ const z = e ? `${e} { ${u} }` : u;
119
+ return i.add(z), i;
120
+ }, N = async (n, e, t) => [...await h(n, e, t)].join(`
121
+ `);
122
+ export {
123
+ F as a,
124
+ N as p
125
+ };
package/server/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("fs/promises"),r=require("../index-_k0TKi9f.cjs"),i=async t=>{if(!t||t.includes("node_modules")||t.includes("saltygen"))return!1;if(t.includes("salty.config"))return!0;if(!r.isSaltyFile(t))return!1;const e=await s.readFile(t,"utf-8");return!!/.+define[A-Z]\w+/.test(e)};exports.checkShouldRestart=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("fs/promises"),r=require("../index-DMCrqpTd.cjs"),i=async t=>{if(!t||t.includes("node_modules")||t.includes("saltygen"))return!1;if(t.includes("salty.config"))return!0;if(!r.isSaltyFile(t))return!1;const e=await s.readFile(t,"utf-8");return!!/.+define[A-Z]\w+/.test(e)};exports.checkShouldRestart=i;
package/server/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { readFile as r } from "fs/promises";
2
- import { i as e } from "../index-CuE3hjO7.js";
2
+ import { i as e } from "../index-DOGHBmYn.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,118 +0,0 @@
1
- import { d as C } from "./dash-case-DBThphLm.js";
2
- const A = (r) => (e) => {
3
- if (typeof e != "string" || !r) return;
4
- let t = e;
5
- const o = [];
6
- return Object.values(r).forEach((a) => {
7
- const { pattern: w, transform: j } = a;
8
- t = t.replace(w, (P) => {
9
- const { value: T, css: u } = j(P);
10
- return u && o.push(u), T;
11
- });
12
- }), { transformed: t, additionalCss: o };
13
- }, k = (r) => (e) => typeof e != "string" || !/\{[^{}]+\}/g.test(e) ? void 0 : { transformed: e.replace(/\{([^{}]+)\}/g, (...a) => `var(--${C(a[1].replaceAll(".", "-"))})`) }, F = k(), M = [
14
- "top",
15
- "right",
16
- "bottom",
17
- "left",
18
- "min-width",
19
- /.*width.*/,
20
- /^[^line]*height.*/,
21
- // Exclude line-height
22
- /padding.*/,
23
- /margin.*/,
24
- /border.*/,
25
- /inset.*/,
26
- /.*radius.*/,
27
- /.*spacing.*/,
28
- /.*gap.*/,
29
- /.*indent.*/,
30
- /.*offset.*/,
31
- /.*size.*/,
32
- /.*thickness.*/,
33
- /.*font-size.*/
34
- ], Q = (r, e, t) => {
35
- if (M.some((a) => typeof a == "string" ? a === r : a.test(r))) {
36
- const a = (t == null ? void 0 : t.defaultUnit) || "px";
37
- return `${e}${a}`;
38
- }
39
- return `${e}`;
40
- }, S = ["Webkit", "Moz", "ms", "O"], _ = (r) => r.startsWith("-") ? r : S.some((e) => r.startsWith(e)) ? `-${C(r)}` : C(r), $ = async (r, e = "", t) => {
41
- if (!r) throw new Error("No styles provided to parseStyles function!");
42
- const o = /* @__PURE__ */ new Set(), w = Object.entries(r).map(async ([y, s]) => {
43
- var b;
44
- const n = y.trim(), h = _(n), c = (d, f = ";") => `${h}:${d}${f}`;
45
- if (typeof s == "function" && (s = s({ scope: e, config: t })), s instanceof Promise && (s = await s), t != null && t.templates && t.templates[n]) {
46
- const f = s.split(".").reduce((i, p) => i[p], t.templates[n]);
47
- if (f) {
48
- const [i] = await $(f, "");
49
- return i;
50
- }
51
- console.warn(`Template "${n}" with path of "${s}" was not found in config!`);
52
- return;
53
- }
54
- if (typeof s == "object") {
55
- if (!s) return;
56
- if (s.isColor) return c(s.toString());
57
- if (n === "defaultVariants") return;
58
- if (n === "variants") {
59
- const i = Object.entries(s);
60
- for (const [p, m] of i) {
61
- if (!m) return;
62
- const x = Object.entries(m);
63
- for (const [V, l] of x) {
64
- if (!l) return;
65
- const O = `${e}.${p}-${V}`;
66
- (await $(l, O, t)).forEach((U) => o.add(U));
67
- }
68
- }
69
- return;
70
- }
71
- if (n === "compoundVariants") {
72
- for (const i of s) {
73
- const { css: p, ...m } = i, x = Object.entries(m).reduce((l, [O, W]) => `${l}.${O}-${W}`, e);
74
- (await $(p, x, t)).forEach((l) => o.add(l));
75
- }
76
- return;
77
- }
78
- if (n.startsWith("@")) {
79
- const i = ((b = t == null ? void 0 : t.mediaQueries) == null ? void 0 : b[n]) || n, p = await N(s, e, t), m = `${i} { ${p} }`;
80
- o.add(m);
81
- return;
82
- }
83
- const d = y.includes("&") ? n.replace("&", e) : n.startsWith(":") ? `${e}${n}` : `${e} ${n}`;
84
- (await $(s, d, t)).forEach((i) => o.add(i));
85
- return;
86
- }
87
- if (typeof s == "number") {
88
- const d = Q(h, s, t);
89
- return c(d);
90
- }
91
- if (typeof s != "string")
92
- if ("toString" in s) s = s.toString();
93
- else throw new Error(`Invalid value type for property ${h}`);
94
- return c(s);
95
- }), { modifiers: j } = t || {}, P = [k(), A(j)], u = (await Promise.all(w).then((y) => Promise.all(
96
- y.map((s) => P.reduce(async (n, h) => {
97
- const c = await n;
98
- if (!c) return c;
99
- const E = await h(c);
100
- if (!E) return c;
101
- const { transformed: b, additionalCss: d } = E;
102
- let f = "";
103
- if (d)
104
- for (const i of d)
105
- f += await N(i, "");
106
- return `${f}${b}`;
107
- }, Promise.resolve(s)))
108
- ))).join(`
109
- `);
110
- if (!u.trim()) return o;
111
- const z = e ? `${e} { ${u} }` : u;
112
- return o.add(z), o;
113
- }, N = async (r, e, t) => [...await $(r, e, t)].join(`
114
- `);
115
- export {
116
- F as a,
117
- N as p
118
- };
@@ -1,3 +0,0 @@
1
- "use strict";const T=require("./dash-case-BJEkFEGQ.cjs"),S=r=>e=>{if(typeof e!="string"||!r)return;let t=e;const i=[];return Object.values(r).forEach(a=>{const{pattern:w,transform:j}=a;t=t.replace(w,C=>{const{value:x,css:p}=j(C);return p&&i.push(p),x})}),{transformed:t,additionalCss:i}},N=r=>e=>typeof e!="string"||!/\{[^{}]+\}/g.test(e)?void 0:{transformed:e.replace(/\{([^{}]+)\}/g,(...a)=>`var(--${T.dashCase(a[1].replaceAll(".","-"))})`)},U=N(),q=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],J=(r,e,t)=>{if(q.some(a=>typeof a=="string"?a===r:a.test(r))){const a=(t==null?void 0:t.defaultUnit)||"px";return`${e}${a}`}return`${e}`},M=["Webkit","Moz","ms","O"],Q=r=>r.startsWith("-")?r:M.some(e=>r.startsWith(e))?`-${T.dashCase(r)}`:T.dashCase(r),$=async(r,e="",t)=>{if(!r)throw new Error("No styles provided to parseStyles function!");const i=new Set,w=Object.entries(r).map(async([y,s])=>{var b;const n=y.trim(),h=Q(n),c=(d,f=";")=>`${h}:${d}${f}`;if(typeof s=="function"&&(s=s({scope:e,config:t})),s instanceof Promise&&(s=await s),t!=null&&t.templates&&t.templates[n]){const f=s.split(".").reduce((o,u)=>o[u],t.templates[n]);if(f){const[o]=await $(f,"");return o}console.warn(`Template "${n}" with path of "${s}" was not found in config!`);return}if(typeof s=="object"){if(!s)return;if(s.isColor)return c(s.toString());if(n==="defaultVariants")return;if(n==="variants"){const o=Object.entries(s);for(const[u,l]of o){if(!l)return;const E=Object.entries(l);for(const[W,m]of E){if(!m)return;const O=`${e}.${u}-${W}`;(await $(m,O,t)).forEach(A=>i.add(A))}}return}if(n==="compoundVariants"){for(const o of s){const{css:u,...l}=o,E=Object.entries(l).reduce((m,[O,k])=>`${m}.${O}-${k}`,e);(await $(u,E,t)).forEach(m=>i.add(m))}return}if(n.startsWith("@")){const o=((b=t==null?void 0:t.mediaQueries)==null?void 0:b[n])||n,u=await V(s,e,t),l=`${o} { ${u} }`;i.add(l);return}const d=y.includes("&")?n.replace("&",e):n.startsWith(":")?`${e}${n}`:`${e} ${n}`;(await $(s,d,t)).forEach(o=>i.add(o));return}if(typeof s=="number"){const d=J(h,s,t);return c(d)}if(typeof s!="string")if("toString"in s)s=s.toString();else throw new Error(`Invalid value type for property ${h}`);return c(s)}),{modifiers:j}=t||{},C=[N(),S(j)],p=(await Promise.all(w).then(y=>Promise.all(y.map(s=>C.reduce(async(n,h)=>{const c=await n;if(!c)return c;const P=await h(c);if(!P)return c;const{transformed:b,additionalCss:d}=P;let f="";if(d)for(const o of d)f+=await V(o,"");return`${f}${b}`},Promise.resolve(s)))))).join(`
2
- `);if(!p.trim())return i;const z=e?`${e} { ${p} }`:p;return i.add(z),i},V=async(r,e,t)=>[...await $(r,e,t)].join(`
3
- `);exports.parseAndJoinStyles=V;exports.parseVariableTokens=U;