@salty-css/core 0.0.1-alpha.198 → 0.0.1-alpha.199

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-DyTXfJI6.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-BuND3zHv.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-DuY0wgQt.js";
6
+ import { l as t, a as h, g as te } from "../index-CSEmW-Ey.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-Dhe9azay.cjs");const e=require("../index-DyTXfJI6.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-DnWqKRxl.cjs");const e=require("../index-BuND3zHv.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-Blfh9nVa.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-DuY0wgQt.js";
7
+ import "../parse-styles-DsMtjJSf.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-CSEmW-Ey.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 $=require("../parse-styles-Dhe9azay.cjs"),j=require("../dash-case-BJEkFEGQ.cjs"),C=({animationName:m,params:l,appendInitialStyles:f,...t})=>{const r=m||j.toHash(t),o=(s={})=>{const{duration:e="500ms",easing:n="ease-in-out",delay:a="0s",iterationCount:i="1",direction:S="normal",fillMode:g="forwards",playState:p="running"}={...l,...s},c=`${r} ${e} ${n} ${a} ${i} ${S} ${g} ${p}`;if(!f)return c;const u=t.from||t["0%"];if(!u)return c;const b=$.parseStyles(u,"");return`${c};${b}`},y=Object.entries(t).reduce((s,[e,n])=>{if(!n)return s;const a=$.parseStyles(n,""),i=typeof e=="number"?`${e}%`:e;return`${s}${i}{${a}}`},""),d=`@keyframes ${r} {${y}}`;return Object.assign(o,{toString:o,isKeyframes:!0,animationName:r,css:d,keyframes:t}),o};exports.keyframes=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("../parse-styles-DnWqKRxl.cjs"),j=require("../dash-case-BJEkFEGQ.cjs"),C=({animationName:m,params:l,appendInitialStyles:f,...t})=>{const r=m||j.toHash(t),o=(s={})=>{const{duration:e="500ms",easing:n="ease-in-out",delay:a="0s",iterationCount:i="1",direction:S="normal",fillMode:g="forwards",playState:p="running"}={...l,...s},c=`${r} ${e} ${n} ${a} ${i} ${S} ${g} ${p}`;if(!f)return c;const u=t.from||t["0%"];if(!u)return c;const b=$.parseStyles(u,"");return`${c};${b}`},y=Object.entries(t).reduce((s,[e,n])=>{if(!n)return s;const a=$.parseStyles(n,""),i=typeof e=="number"?`${e}%`:e;return`${s}${i}{${a}}`},""),d=`@keyframes ${r} {${y}}`;return Object.assign(o,{toString:o,isKeyframes:!0,animationName:r,css:d,keyframes:t}),o};exports.keyframes=C;
package/css/keyframes.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as c } from "../parse-styles-Blfh9nVa.js";
1
+ import { p as c } from "../parse-styles-DsMtjJSf.js";
2
2
  import { t as j } from "../dash-case-DBThphLm.js";
3
3
  const O = ({ animationName: u, params: f, appendInitialStyles: p, ...t }) => {
4
4
  const o = u || j(t), e = (r = {}) => {
@@ -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-Dhe9azay.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.parseStyles(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([]),l=a=>{const r=i[a];r!==void 0?c.add(`${a}=${String(r)}`):c.add(a)};Object.keys(t).forEach(l),n.map(a=>Object.keys(a).forEach(l));const d=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&&d.add(p)})}return{element:s,variantKeys:[...c],propValueKeys:[...d],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-DnWqKRxl.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.parseStyles(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([]),l=a=>{const r=i[a];r!==void 0?c.add(`${a}=${String(r)}`):c.add(a)};Object.keys(t).forEach(l),n.map(a=>Object.keys(a).forEach(l));const d=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&&d.add(p)})}return{element:s,variantKeys:[...c],propValueKeys:[...d],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-Blfh9nVa.js";
4
+ import { p as N } from "../parse-styles-DsMtjJSf.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 be=require("esbuild"),Fe=require("child_process"),k=require("./dash-case-BJEkFEGQ.cjs"),i=require("path"),c=require("fs"),oe=require("fs/promises"),A=require("./parse-styles-Dhe9azay.cjs"),G=require("winston"),z=require("./css/merge.cjs");var ne=typeof document<"u"?document.currentScript:null;function $e(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 le=$e(be),fe=(e,t=[])=>{if(!e)return"";const s=[],n={};if(Object.entries(e).forEach(([o,r])=>{if(typeof r=="object"){if(!r)return;const f=o.trim(),u=fe(r,[...t,f]);s.push(u)}else n[o]=r}),Object.keys(n).length){const o=t.map(k.dashCase).join("-"),r=A.parseStyles(n,`.${o}`);s.push(r)}return s.join(`
2
- `)},Ce=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=de(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},de=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const r=t?`${t}.${n}`:n;return typeof o=="object"?de(o,r,s):s.add(t)}),[...s]):[],ue=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:ue(i.join(e,".."))},xe=async e=>{const t=ue(e);return await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Ne=async e=>{const t=await xe(e);if(t)return t.type};let J;const pe=async e=>{if(J)return J;const t=await Ne(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-DyTXfJI6.cjs",document.baseURI).href).endsWith(".cjs"))&&(J="cjs"),J||"esm"},L=G.createLogger({level:"debug",format:G.format.combine(G.format.colorize(),G.format.cli()),transports:[new G.transports.Console({})]}),ke=e=>{L.error(e)};function ye(e){return e?typeof e!="string"?ye(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 Pe={"*, *::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"}},O={externalModules:[],rcFile:void 0,destDir:void 0},ge=e=>{if(O.externalModules.length>0)return O.externalModules;const s=c.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return O.externalModules=n,n},R=async e=>{if(O.destDir)return O.destDir;const t=await re(e),s=i.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return O.destDir=s,s},ie=["salty","css","styles","styled"],me=(e=[])=>new RegExp(`\\.(${[...ie,...e].join("|")})\\.`),U=(e,t=[])=>me(t).test(e),he=async e=>{if(O.rcFile)return O.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=i.join(e,".saltyrc.json"),s=await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(O.rcFile=s,s):he(i.join(e,".."))},re=async e=>{var n,o;const t=await he(e),s=(n=t.projects)==null?void 0:n.find(r=>e.endsWith(r.dir||""));return s||((o=t.projects)==null?void 0:o.find(r=>r.dir===t.defaultProject))},De=async e=>{const t=await re(e),s=await R(e),n=i.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=i.join(s,"salty.config.js"),r=await pe(e),f=ge(n);await le.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:r,external:f});const u=Date.now(),{config:y}=await import(`${o}?t=${u}`);return y},Se=async(e,t)=>{var M,B;const s=await R(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async $=>{const C=await K(e,$,s);Object.values(C).forEach(x=>{x.isMedia?n.mediaQueries.push(x):x.isGlobalDefine?n.globalStyles.push(x):x.isDefineVariables?n.variables.push(x):x.isDefineTemplates&&n.templates.push(x)})}));const o=await De(e),r={...o},f=new Set,u=($,C=[])=>$?Object.entries($).flatMap(([x,_])=>{if(!_)return;if(typeof _=="object")return u(_,[...C,x]);const Y=ye(x),ee=k.dashCase(x),te=[...C,Y].join(".");f.add(`"${te}"`);const se=[...C.map(k.dashCase),ee].join("-"),{result:we}=A.parseValueTokens(_);return`--${se}: ${we};`}):[],y=$=>$?Object.entries($).flatMap(([C,x])=>{const _=u(x);return C==="base"?_.join(""):`${C} { ${_.join("")} }`}):[],d=$=>$?Object.entries($).flatMap(([C,x])=>Object.entries(x).flatMap(([_,Y])=>{const ee=u(Y,[C]),te=`.${C}-${_}, [data-${C}="${_}"]`,se=ee.join("");return`${te} { ${se} }`})):[],g=$=>({...$,responsive:void 0,conditional:void 0}),m=$=>n.variables.map(C=>$==="static"?g(C._current):C._current[$]),p=z.mergeStyles(g(o.variables),m("static")),w=u(p),h=z.mergeStyles((M=o.variables)==null?void 0:M.responsive,m("responsive")),T=y(h),P=z.mergeStyles((B=o.variables)==null?void 0:B.conditional,m("conditional")),D=d(P),V=i.join(s,"css/_variables.css"),E=`:root { ${w.join("")} ${T.join("")} } ${D.join("")}`;c.writeFileSync(V,E),r.staticVariables=p;const H=i.join(s,"css/_global.css"),N=z.mergeStyles(o.global,n.globalStyles),v=A.parseStyles(N,"");c.writeFileSync(H,`@layer global { ${v} }`);const a=i.join(s,"css/_reset.css"),j=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:Pe,l=A.parseStyles(j,"");c.writeFileSync(a,`@layer reset { ${l} }`);const b=i.join(s,"css/_templates.css"),F=z.mergeStyles(o.templates,n.templates),q=fe(F),I=Ce(F);c.writeFileSync(b,q),r.templates=F;const W=i.join(s,"types/css-tokens.d.ts"),Z=`
1
+ "use strict";const be=require("esbuild"),Fe=require("child_process"),k=require("./dash-case-BJEkFEGQ.cjs"),i=require("path"),c=require("fs"),oe=require("fs/promises"),A=require("./parse-styles-DnWqKRxl.cjs"),G=require("winston"),z=require("./css/merge.cjs");var ne=typeof document<"u"?document.currentScript:null;function $e(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 le=$e(be),fe=(e,t=[])=>{if(!e)return"";const s=[],n={};if(Object.entries(e).forEach(([o,r])=>{if(typeof r=="object"){if(!r)return;const f=o.trim(),u=fe(r,[...t,f]);s.push(u)}else n[o]=r}),Object.keys(n).length){const o=t.map(k.dashCase).join("-"),r=A.parseStyles(n,`.${o}`);s.push(r)}return s.join(`
2
+ `)},Ce=e=>e?Object.entries(e).reduce((t,[s,n])=>(typeof n=="object"&&(t[s]=de(n).map(o=>`"${o}"`).join(" | ")),t),{}):{},de=(e,t="",s=new Set)=>e?(Object.entries(e).forEach(([n,o])=>{const r=t?`${t}.${n}`:n;return typeof o=="object"?de(o,r,s):s.add(t)}),[...s]):[],ue=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:ue(i.join(e,".."))},xe=async e=>{const t=ue(e);return await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{})},Ne=async e=>{const t=await xe(e);if(t)return t.type};let J;const pe=async e=>{if(J)return J;const t=await Ne(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-BuND3zHv.cjs",document.baseURI).href).endsWith(".cjs"))&&(J="cjs"),J||"esm"},L=G.createLogger({level:"debug",format:G.format.combine(G.format.colorize(),G.format.cli()),transports:[new G.transports.Console({})]}),ke=e=>{L.error(e)};function ye(e){return e?typeof e!="string"?ye(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 Pe={"*, *::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"}},O={externalModules:[],rcFile:void 0,destDir:void 0},ge=e=>{if(O.externalModules.length>0)return O.externalModules;const s=c.readFileSync(e,"utf8").match(/externalModules:\s?\[(.*)\]/);if(!s)return[];const n=s[1].split(",").map(o=>o.replace(/['"`]/g,"").trim());return O.externalModules=n,n},R=async e=>{if(O.destDir)return O.destDir;const t=await re(e),s=i.join(e,(t==null?void 0:t.saltygenDir)||"saltygen");return O.destDir=s,s},ie=["salty","css","styles","styled"],me=(e=[])=>new RegExp(`\\.(${[...ie,...e].join("|")})\\.`),U=(e,t=[])=>me(t).test(e),he=async e=>{if(O.rcFile)return O.rcFile;if(e==="/")throw new Error("Could not find .saltyrc.json file");const t=i.join(e,".saltyrc.json"),s=await oe.readFile(t,"utf-8").then(JSON.parse).catch(()=>{});return s?(O.rcFile=s,s):he(i.join(e,".."))},re=async e=>{var n,o;const t=await he(e),s=(n=t.projects)==null?void 0:n.find(r=>e.endsWith(r.dir||""));return s||((o=t.projects)==null?void 0:o.find(r=>r.dir===t.defaultProject))},De=async e=>{const t=await re(e),s=await R(e),n=i.join(e,(t==null?void 0:t.configDir)||"","salty.config.ts"),o=i.join(s,"salty.config.js"),r=await pe(e),f=ge(n);await le.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:o,format:r,external:f});const u=Date.now(),{config:y}=await import(`${o}?t=${u}`);return y},Se=async(e,t)=>{var M,B;const s=await R(e),n={mediaQueries:[],globalStyles:[],variables:[],templates:[]};await Promise.all([...t].map(async $=>{const C=await K(e,$,s);Object.values(C).forEach(x=>{x.isMedia?n.mediaQueries.push(x):x.isGlobalDefine?n.globalStyles.push(x):x.isDefineVariables?n.variables.push(x):x.isDefineTemplates&&n.templates.push(x)})}));const o=await De(e),r={...o},f=new Set,u=($,C=[])=>$?Object.entries($).flatMap(([x,_])=>{if(!_)return;if(typeof _=="object")return u(_,[...C,x]);const Y=ye(x),ee=k.dashCase(x),te=[...C,Y].join(".");f.add(`"${te}"`);const se=[...C.map(k.dashCase),ee].join("-"),{result:we}=A.parseValueTokens(_);return`--${se}: ${we};`}):[],y=$=>$?Object.entries($).flatMap(([C,x])=>{const _=u(x);return C==="base"?_.join(""):`${C} { ${_.join("")} }`}):[],d=$=>$?Object.entries($).flatMap(([C,x])=>Object.entries(x).flatMap(([_,Y])=>{const ee=u(Y,[C]),te=`.${C}-${_}, [data-${C}="${_}"]`,se=ee.join("");return`${te} { ${se} }`})):[],g=$=>({...$,responsive:void 0,conditional:void 0}),m=$=>n.variables.map(C=>$==="static"?g(C._current):C._current[$]),p=z.mergeStyles(g(o.variables),m("static")),w=u(p),h=z.mergeStyles((M=o.variables)==null?void 0:M.responsive,m("responsive")),T=y(h),P=z.mergeStyles((B=o.variables)==null?void 0:B.conditional,m("conditional")),D=d(P),V=i.join(s,"css/_variables.css"),E=`:root { ${w.join("")} ${T.join("")} } ${D.join("")}`;c.writeFileSync(V,E),r.staticVariables=p;const H=i.join(s,"css/_global.css"),N=z.mergeStyles(o.global,n.globalStyles),v=A.parseStyles(N,"");c.writeFileSync(H,`@layer global { ${v} }`);const a=i.join(s,"css/_reset.css"),j=o.reset==="none"?{}:typeof o.reset=="object"?o.reset:Pe,l=A.parseStyles(j,"");c.writeFileSync(a,`@layer reset { ${l} }`);const b=i.join(s,"css/_templates.css"),F=z.mergeStyles(o.templates,n.templates),q=fe(F),I=Ce(F);c.writeFileSync(b,q),r.templates=F;const W=i.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 v, t as I } from "./dash-case-DBThphLm.js";
4
4
  import { join as a, parse as q } from "path";
5
5
  import { existsSync as at, writeFileSync as j, mkdirSync as z, readFileSync as P, statSync as jt, readdirSync as xt } from "fs";
6
6
  import { readFile as dt, writeFile as Nt } from "fs/promises";
7
- import { p as rt, a as kt } from "./parse-styles-Blfh9nVa.js";
7
+ import { p as rt, a as kt } from "./parse-styles-DsMtjJSf.js";
8
8
  import { createLogger as Pt, format as ot, transports as Dt } from "winston";
9
9
  import { mergeStyles as W } from "./css/merge.js";
10
10
  const ut = (t, e = []) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.198",
3
+ "version": "0.0.1-alpha.199",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -0,0 +1,7 @@
1
+ "use strict";const y=require("./dash-case-BJEkFEGQ.cjs"),x=(r,e)=>{if(typeof r!="string")return{result:r};if(!e)return{result:r};const s=[];return Object.values(e).forEach(p=>{const{pattern:i,transform:S}=p;r=r.replace(i,n=>{const{value:a,css:t}=S(n);return t&&s.push(t),a})}),{result:r,additionalCss:s}},P=r=>typeof r!="string"?{result:r}:/\{[^{}]+\}/g.test(r)?{result:r.replace(/\{([^{}]+)\}/g,(...p)=>`var(--${y.dashCase(p[1].replaceAll(".","-"))})`)}:{result:r},z=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],U=(r,e,s)=>{if(z.some(i=>typeof i=="string"?i===r:i.test(r))){const i=(s==null?void 0:s.defaultUnit)||"px";return`${e}${i}`}return`${e}`},g=["Webkit","Moz","ms","O"],k=r=>r.startsWith("-")?r:g.some(e=>r.startsWith(e))?`-${y.dashCase(r)}`:y.dashCase(r),d=(r,e,s)=>{if(!r)return"";const p=[],i=Object.entries(r).reduce((n,[a,t])=>{const o=a.trim(),w=k(o),O=(f,h=";")=>n=`${n}${f}${h}`,m=f=>O(`${w}:${f}`);if(typeof t=="function"&&(t=t()),typeof t=="object"){if(!t)return n;if(t.isColor)return m(t.toString()),n;if(o==="variants")return Object.entries(t).forEach(([u,c])=>{c&&Object.entries(c).forEach(([b,$])=>{if(!$)return;const l=`${e}.${u}-${b}`,j=d($,l,s);p.push(j)})}),n;if(o==="defaultVariants")return n;if(o==="compoundVariants")return t.forEach(u=>{const{css:c,...b}=u,$=Object.entries(b).reduce((j,[T,W])=>`${j}.${T}-${W}`,e),l=d(c,$,s);p.push(l)}),n;if(o.startsWith("@")){const u=d(t,e,s),c=`${o} {
2
+ ${u.replace(`
3
+ `,`
4
+ `)}
5
+ }`;return p.push(c),n}const f=a.includes("&")?o.replace("&",e):o.startsWith(":")?`${e}${o}`:`${e} ${o}`,h=d(t,f,s);return p.push(h),n}if(s!=null&&s.templates&&s.templates[o]){const h=t.split(".").reduce((u,c)=>u[c],s.templates[o]);if(h){const u=d(h,"");return`${n}${u}`}return console.warn(`Template "${o}" with path of "${t}" was not found in config!`),n}if(typeof t=="number"){const f=U(w,t,s);return m(f)}if(typeof t!="string")if("toString"in t)t=t.toString();else return n;const{modifiers:V}=s||{},E=function*(){yield P(t),yield x(t,V)}();for(const{result:f,additionalCss:h=[]}of E)t=f,h.forEach(u=>{const c=d(u,"");O(c,"")});return m(t)},"");return i?e?[`${e} { ${i} }`,...p].join(`
6
+ `):i:p.join(`
7
+ `)};exports.parseStyles=d;exports.parseValueTokens=P;
@@ -0,0 +1,106 @@
1
+ import { d as y } from "./dash-case-DBThphLm.js";
2
+ const x = (r, e) => {
3
+ if (typeof r != "string") return { result: r };
4
+ if (!e) return { result: r };
5
+ const s = [];
6
+ return Object.values(e).forEach((p) => {
7
+ const { pattern: i, transform: w } = p;
8
+ r = r.replace(i, (n) => {
9
+ const { value: $, css: t } = w(n);
10
+ return t && s.push(t), $;
11
+ });
12
+ }), { result: r, additionalCss: s };
13
+ }, T = (r) => typeof r != "string" ? { result: r } : /\{[^{}]+\}/g.test(r) ? { result: r.replace(/\{([^{}]+)\}/g, (...p) => `var(--${y(p[1].replaceAll(".", "-"))})`) } : { result: r }, z = [
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
+ ], U = (r, e, s) => {
35
+ if (z.some((i) => typeof i == "string" ? i === r : i.test(r))) {
36
+ const i = (s == null ? void 0 : s.defaultUnit) || "px";
37
+ return `${e}${i}`;
38
+ }
39
+ return `${e}`;
40
+ }, g = ["Webkit", "Moz", "ms", "O"], M = (r) => r.startsWith("-") ? r : g.some((e) => r.startsWith(e)) ? `-${y(r)}` : y(r), d = (r, e, s) => {
41
+ if (!r) return "";
42
+ const p = [], i = Object.entries(r).reduce((n, [$, t]) => {
43
+ const o = $.trim(), O = M(o), P = (u, h = ";") => n = `${n}${u}${h}`, m = (u) => P(`${O}:${u}`);
44
+ if (typeof t == "function" && (t = t()), typeof t == "object") {
45
+ if (!t) return n;
46
+ if (t.isColor)
47
+ return m(t.toString()), n;
48
+ if (o === "variants")
49
+ return Object.entries(t).forEach(([f, c]) => {
50
+ c && Object.entries(c).forEach(([b, a]) => {
51
+ if (!a) return;
52
+ const l = `${e}.${f}-${b}`, j = d(a, l, s);
53
+ p.push(j);
54
+ });
55
+ }), n;
56
+ if (o === "defaultVariants")
57
+ return n;
58
+ if (o === "compoundVariants")
59
+ return t.forEach((f) => {
60
+ const { css: c, ...b } = f, a = Object.entries(b).reduce((j, [V, W]) => `${j}.${V}-${W}`, e), l = d(c, a, s);
61
+ p.push(l);
62
+ }), n;
63
+ if (o.startsWith("@")) {
64
+ const f = d(t, e, s), c = `${o} {
65
+ ${f.replace(`
66
+ `, `
67
+ `)}
68
+ }`;
69
+ return p.push(c), n;
70
+ }
71
+ const u = $.includes("&") ? o.replace("&", e) : o.startsWith(":") ? `${e}${o}` : `${e} ${o}`, h = d(t, u, s);
72
+ return p.push(h), n;
73
+ }
74
+ if (s != null && s.templates && s.templates[o]) {
75
+ const h = t.split(".").reduce((f, c) => f[c], s.templates[o]);
76
+ if (h) {
77
+ const f = d(h, "");
78
+ return `${n}${f}`;
79
+ }
80
+ return console.warn(`Template "${o}" with path of "${t}" was not found in config!`), n;
81
+ }
82
+ if (typeof t == "number") {
83
+ const u = U(O, t, s);
84
+ return m(u);
85
+ }
86
+ if (typeof t != "string")
87
+ if ("toString" in t) t = t.toString();
88
+ else return n;
89
+ const { modifiers: S } = s || {}, E = function* () {
90
+ yield T(t), yield x(t, S);
91
+ }();
92
+ for (const { result: u, additionalCss: h = [] } of E)
93
+ t = u, h.forEach((f) => {
94
+ const c = d(f, "");
95
+ P(c, "");
96
+ });
97
+ return m(t);
98
+ }, "");
99
+ return i ? e ? [`${e} { ${i} }`, ...p].join(`
100
+ `) : i : p.join(`
101
+ `);
102
+ };
103
+ export {
104
+ T as a,
105
+ d as p
106
+ };
@@ -0,0 +1 @@
1
+ export declare const propertyNameCheck: (key: string) => string;
package/server/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("fs/promises"),r=require("../index-DyTXfJI6.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-BuND3zHv.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-DuY0wgQt.js";
2
+ import { i as e } from "../index-CSEmW-Ey.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,106 +0,0 @@
1
- import { d as E } from "./dash-case-DBThphLm.js";
2
- const k = (s, e) => {
3
- if (typeof s != "string") return { result: s };
4
- if (!e) return { result: s };
5
- const r = [];
6
- return Object.values(e).forEach((p) => {
7
- const { pattern: i, transform: j } = p;
8
- s = s.replace(i, (o) => {
9
- const { value: $, css: t } = j(o);
10
- return t && r.push(t), $;
11
- });
12
- }), { result: s, additionalCss: r };
13
- }, x = (s) => typeof s != "string" ? { result: s } : /\{[^{}]+\}/g.test(s) ? { result: s.replace(/\{([^{}]+)\}/g, (...p) => `var(--${E(p[1].replaceAll(".", "-"))})`) } : { result: s }, U = [
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
- ], W = (s, e, r) => {
35
- if (U.some((i) => typeof i == "string" ? i === s : i.test(s))) {
36
- const i = (r == null ? void 0 : r.defaultUnit) || "px";
37
- return `${e}${i}`;
38
- }
39
- return `${e}`;
40
- }, h = (s, e, r) => {
41
- if (!s) return "";
42
- const p = [], i = Object.entries(s).reduce((o, [$, t]) => {
43
- const n = $.trim(), w = n.startsWith("-") ? n : E(n), S = (u, d = ";") => o = `${o}${u}${d}`, m = (u) => S(`${w}:${u}`);
44
- if (typeof t == "function" && (t = t()), typeof t == "object") {
45
- if (!t) return o;
46
- if (t.isColor)
47
- return m(t.toString()), o;
48
- if (n === "variants")
49
- return Object.entries(t).forEach(([f, c]) => {
50
- c && Object.entries(c).forEach(([b, a]) => {
51
- if (!a) return;
52
- const y = `${e}.${f}-${b}`, l = h(a, y, r);
53
- p.push(l);
54
- });
55
- }), o;
56
- if (n === "defaultVariants")
57
- return o;
58
- if (n === "compoundVariants")
59
- return t.forEach((f) => {
60
- const { css: c, ...b } = f, a = Object.entries(b).reduce((l, [V, T]) => `${l}.${V}-${T}`, e), y = h(c, a, r);
61
- p.push(y);
62
- }), o;
63
- if (n.startsWith("@")) {
64
- const f = h(t, e, r), c = `${n} {
65
- ${f.replace(`
66
- `, `
67
- `)}
68
- }`;
69
- return p.push(c), o;
70
- }
71
- const u = $.includes("&") ? n.replace("&", e) : n.startsWith(":") ? `${e}${n}` : `${e} ${n}`, d = h(t, u, r);
72
- return p.push(d), o;
73
- }
74
- if (r != null && r.templates && r.templates[n]) {
75
- const d = t.split(".").reduce((f, c) => f[c], r.templates[n]);
76
- if (d) {
77
- const f = h(d, "");
78
- return `${o}${f}`;
79
- }
80
- return console.warn(`Template "${n}" with path of "${t}" was not found in config!`), o;
81
- }
82
- if (typeof t == "number") {
83
- const u = W(w, t, r);
84
- return m(u);
85
- }
86
- if (typeof t != "string")
87
- if ("toString" in t) t = t.toString();
88
- else return o;
89
- const { modifiers: O } = r || {}, P = function* () {
90
- yield x(t), yield k(t, O);
91
- }();
92
- for (const { result: u, additionalCss: d = [] } of P)
93
- t = u, d.forEach((f) => {
94
- const c = h(f, "");
95
- S(c, "");
96
- });
97
- return m(t);
98
- }, "");
99
- return i ? e ? [`${e} { ${i} }`, ...p].join(`
100
- `) : i : p.join(`
101
- `);
102
- };
103
- export {
104
- x as a,
105
- h as p
106
- };
@@ -1,7 +0,0 @@
1
- "use strict";const V=require("./dash-case-BJEkFEGQ.cjs"),U=(s,e)=>{if(typeof s!="string")return{result:s};if(!e)return{result:s};const r=[];return Object.values(e).forEach(p=>{const{pattern:i,transform:j}=p;s=s.replace(i,o=>{const{value:$,css:t}=j(o);return t&&r.push(t),$})}),{result:s,additionalCss:r}},E=s=>typeof s!="string"?{result:s}:/\{[^{}]+\}/g.test(s)?{result:s.replace(/\{([^{}]+)\}/g,(...p)=>`var(--${V.dashCase(p[1].replaceAll(".","-"))})`)}:{result:s},W=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],g=(s,e,r)=>{if(W.some(i=>typeof i=="string"?i===s:i.test(s))){const i=(r==null?void 0:r.defaultUnit)||"px";return`${e}${i}`}return`${e}`},d=(s,e,r)=>{if(!s)return"";const p=[],i=Object.entries(s).reduce((o,[$,t])=>{const n=$.trim(),S=n.startsWith("-")?n:V.dashCase(n),w=(f,h=";")=>o=`${o}${f}${h}`,m=f=>w(`${S}:${f}`);if(typeof t=="function"&&(t=t()),typeof t=="object"){if(!t)return o;if(t.isColor)return m(t.toString()),o;if(n==="variants")return Object.entries(t).forEach(([u,c])=>{c&&Object.entries(c).forEach(([b,a])=>{if(!a)return;const l=`${e}.${u}-${b}`,y=d(a,l,r);p.push(y)})}),o;if(n==="defaultVariants")return o;if(n==="compoundVariants")return t.forEach(u=>{const{css:c,...b}=u,a=Object.entries(b).reduce((y,[T,k])=>`${y}.${T}-${k}`,e),l=d(c,a,r);p.push(l)}),o;if(n.startsWith("@")){const u=d(t,e,r),c=`${n} {
2
- ${u.replace(`
3
- `,`
4
- `)}
5
- }`;return p.push(c),o}const f=$.includes("&")?n.replace("&",e):n.startsWith(":")?`${e}${n}`:`${e} ${n}`,h=d(t,f,r);return p.push(h),o}if(r!=null&&r.templates&&r.templates[n]){const h=t.split(".").reduce((u,c)=>u[c],r.templates[n]);if(h){const u=d(h,"");return`${o}${u}`}return console.warn(`Template "${n}" with path of "${t}" was not found in config!`),o}if(typeof t=="number"){const f=g(S,t,r);return m(f)}if(typeof t!="string")if("toString"in t)t=t.toString();else return o;const{modifiers:O}=r||{},P=function*(){yield E(t),yield U(t,O)}();for(const{result:f,additionalCss:h=[]}of P)t=f,h.forEach(u=>{const c=d(u,"");w(c,"")});return m(t)},"");return i?e?[`${e} { ${i} }`,...p].join(`
6
- `):i:p.join(`
7
- `)};exports.parseStyles=d;exports.parseValueTokens=E;