@salty-css/core 0.0.1-alpha.57 → 0.0.1-alpha.59

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.
@@ -1,11 +1,11 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("esbuild"),G=require("child_process"),N=require("../dash-case-DKzpenwY.cjs"),i=require("path"),a=require("fs"),J=require("fs/promises"),V=require("../parse-templates-W0YfTmOT.cjs");function A(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const e=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(s,n,e.get?e:{enumerable:!0,get:()=>t[n]})}}return s.default=t,Object.freeze(s)}const q=A(W),O=t=>i.join(t,"./saltygen"),M=["salty","css","styles","styled"],z=(t=[])=>new RegExp(`\\.(${[...M,...t].join("|")})\\.`),E=(t,s=[])=>z(s).test(t),L=async t=>{const s=O(t),n=i.join(t,"salty.config.ts"),e=i.join(s,"salty.config.js");await q.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:e,format:"esm",external:["react"]});const l=Date.now(),{config:k}=await import(`${e}?t=${l}`);return k},B=async t=>{const s=await L(t),n=new Set,e=(c,y=[])=>c?Object.entries(c).flatMap(([u,p])=>{if(!p)return;if(typeof p=="object")return e(p,[...y,u]);const w=[...y,u].join(".");n.add(`"${w}"`);const d=[...y.map(N.dashCase),N.dashCase(u)].join("-"),{result:m}=V.parseValueTokens(p);return`--${d}: ${m};`}):[],l=c=>c?Object.entries(c).flatMap(([y,u])=>{const p=e(u);return y==="base"?p.join(""):`${y} { ${p.join("")} }`}):[],k=c=>c?Object.entries(c).flatMap(([y,u])=>Object.entries(u).flatMap(([p,w])=>{const d=e(w,[y]),m=`.${y}-${p}, [data-${y}="${p}"]`,D=d.join("");return`${m} { ${D} }`})):[],S=e(s.variables),C=l(s.responsiveVariables),r=k(s.conditionalVariables),F=O(t),h=i.join(F,"css/variables.css"),x=`:root { ${S.join("")} ${C.join("")} } ${r.join("")}`;a.writeFileSync(h,x);const g=i.join(F,"types/css-tokens.d.ts"),f=`type VariableTokens = ${[...n].join("|")||'""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;a.writeFileSync(g,f);const $=i.join(F,"css/global.css"),b=V.parseStyles(s.global,"");a.writeFileSync($,b);const j=i.join(F,"css/templates.css"),P=V.parseTemplates(s.templates);a.writeFileSync(j,P)},v=async(t,s)=>{const n=N.toHash(t),e=i.join(s,"js",n+".js");await q.build({entryPoints:[t],minify:!0,treeShaking:!0,bundle:!0,outfile:e,format:"esm",target:["es2022"],keepNames:!0,external:["react"]});const l=Date.now();return await import(`${e}?t=${l}`)},_=async t=>{const s=O(t),n=i.join(s,"salty.config.js"),{config:e}=await import(n);return e},U=async t=>{try{const s=[],n=[],e=O(t),l=i.join(e,"index.css");(()=>{a.existsSync(e)&&G.execSync("rm -rf "+e),a.mkdirSync(e),a.mkdirSync(i.join(e,"css")),a.mkdirSync(i.join(e,"types"))})(),await B(t);const S=await _(t);async function C(o,f){const $=["node_modules","saltygen"],b=a.statSync(o);if(b.isDirectory()){const j=a.readdirSync(o);if($.some(c=>o.includes(c)))return;await Promise.all(j.map(c=>C(i.join(o,c),i.join(f,c))))}else if(b.isFile()&&E(o)){const P=await v(o,e),c=[];Object.entries(P).forEach(([w,d])=>{if(d.isKeyframes&&d.css){const R=`${d.animationName}.css`,H=`css/${R}`,K=i.join(e,H);s.push(R),a.writeFileSync(K,d.css);return}if(!d.generator)return;const m=d.generator._withBuildContext({name:w,config:S}),D=`${m.hash}-${m.priority}.css`;n[m.priority]||(n[m.priority]=[]),n[m.priority].push(D),c.push(D);const T=`css/${D}`,I=i.join(e,T);a.writeFileSync(I,m.css)});const y=c.map(w=>`@import url('./${w}');`).join(`
2
- `),u=N.toHash(o,6),p=i.join(e,`css/${u}.css`);a.writeFileSync(p,y)}}await C(t,e);const r=s.map(o=>`@import url('./css/${o}');`).join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("esbuild"),G=require("child_process"),N=require("../dash-case-DKzpenwY.cjs"),i=require("path"),a=require("fs"),J=require("fs/promises"),R=require("../parse-templates-DVK3iZIl.cjs");var V=typeof document<"u"?document.currentScript:null;function A(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(s,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return s.default=e,Object.freeze(s)}const q=A(L),I=()=>(typeof document>"u"?require("url").pathToFileURL(__filename).href:V&&V.tagName.toUpperCase()==="SCRIPT"&&V.src||new URL("compiler/index.cjs",document.baseURI).href).endsWith(".cjs")?"cjs":"esm",O=e=>i.join(e,"./saltygen"),z=["salty","css","styles","styled"],B=(e=[])=>new RegExp(`\\.(${[...z,...e].join("|")})\\.`),v=(e,s=[])=>B(s).test(e),X=async e=>{const s=O(e),n=i.join(e,"salty.config.ts"),t=i.join(s,"salty.config.js"),l=I();console.log("Module type:",l),await q.build({entryPoints:[n],minify:!0,treeShaking:!0,bundle:!0,outfile:t,format:l});const C=Date.now(),{config:d}=await import(`${t}?t=${C}`);return d},H=async e=>{const s=await X(e),n=new Set,t=(c,u=[])=>c?Object.entries(c).flatMap(([f,p])=>{if(!p)return;if(typeof p=="object")return t(p,[...u,f]);const w=[...u,f].join(".");n.add(`"${w}"`);const m=[...u.map(N.dashCase),N.dashCase(f)].join("-"),{result:h}=R.parseValueTokens(p);return`--${m}: ${h};`}):[],l=c=>c?Object.entries(c).flatMap(([u,f])=>{const p=t(f);return u==="base"?p.join(""):`${u} { ${p.join("")} }`}):[],C=c=>c?Object.entries(c).flatMap(([u,f])=>Object.entries(f).flatMap(([p,w])=>{const m=t(w,[u]),h=`.${u}-${p}, [data-${u}="${p}"]`,D=m.join("");return`${h} { ${D} }`})):[],d=t(s.variables),x=l(s.responsiveVariables),r=C(s.conditionalVariables),F=O(e),j=i.join(F,"css/variables.css"),T=`:root { ${d.join("")} ${x.join("")} } ${r.join("")}`;a.writeFileSync(j,T);const g=i.join(F,"types/css-tokens.d.ts"),y=`type VariableTokens = ${[...n].join("|")||'""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;a.writeFileSync(g,y);const $=i.join(F,"css/global.css"),b=R.parseStyles(s.global,"");a.writeFileSync($,b);const S=i.join(F,"css/templates.css"),k=R.parseTemplates(s.templates);a.writeFileSync(S,k)},E=async(e,s)=>{const n=N.toHash(e),t=i.join(s,"js",n+".js"),l=I();console.log("Module type:",l),await q.build({entryPoints:[e],minify:!0,treeShaking:!0,bundle:!0,outfile:t,format:l,target:["es2022"],keepNames:!0});const C=Date.now();return await import(`${t}?t=${C}`)},_=async e=>{const s=O(e),n=i.join(s,"salty.config.js"),{config:t}=await import(n);return t},Y=async e=>{try{const s=[],n=[],t=O(e),l=i.join(t,"index.css");(()=>{a.existsSync(t)&&G.execSync("rm -rf "+t),a.mkdirSync(t),a.mkdirSync(i.join(t,"css")),a.mkdirSync(i.join(t,"types"))})(),await H(e);const d=await _(e);async function x(o,y){const $=["node_modules","saltygen"],b=a.statSync(o);if(b.isDirectory()){const S=a.readdirSync(o);if($.some(c=>o.includes(c)))return;await Promise.all(S.map(c=>x(i.join(o,c),i.join(y,c))))}else if(b.isFile()&&v(o)){const k=await E(o,t),c=[];Object.entries(k).forEach(([w,m])=>{if(m.isKeyframes&&m.css){const M=`${m.animationName}.css`,W=`css/${M}`,K=i.join(t,W);s.push(M),a.writeFileSync(K,m.css);return}if(!m.generator)return;const h=m.generator._withBuildContext({name:w,config:d}),D=`${h.hash}-${h.priority}.css`;n[h.priority]||(n[h.priority]=[]),n[h.priority].push(D),c.push(D);const P=`css/${D}`,U=i.join(t,P);a.writeFileSync(U,h.css)});const u=c.map(w=>`@import url('./${w}');`).join(`
2
+ `),f=N.toHash(o,6),p=i.join(t,`css/${f}.css`);a.writeFileSync(p,u)}}await x(e,t);const r=s.map(o=>`@import url('./css/${o}');`).join(`
3
3
  `);let g=`@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
4
4
 
5
- ${["variables.css","global.css","templates.css"].filter(o=>{try{return a.readFileSync(i.join(e,"css",o),"utf8").length>0}catch{return!1}}).map(o=>`@import url('./css/${o}');`).join(`
5
+ ${["variables.css","global.css","templates.css"].filter(o=>{try{return a.readFileSync(i.join(t,"css",o),"utf8").length>0}catch{return!1}}).map(o=>`@import url('./css/${o}');`).join(`
6
6
  `)}
7
- ${r}`;if(S.importStrategy!=="component"){const o=n.flat().map(f=>`@import url('./css/${f}');`).join(`
8
- `);g+=o}a.writeFileSync(l,g)}catch(s){console.error(s)}},X=async(t,s)=>{try{const n=[],e=i.join(t,"./saltygen"),l=i.join(e,"index.css");if(E(s)){const S=await _(t),C=await v(s,e);Object.entries(C).forEach(([g,o])=>{if(!o.generator)return;const f=o.generator._withBuildContext({name:g,config:S}),$=`${f.hash}-${f.priority}.css`,b=`css/${$}`,j=i.join(e,b);n.push($),a.writeFileSync(j,f.css)});const r=a.readFileSync(l,"utf8").split(`
9
- `),F=n.map(g=>`@import url('../saltygen/css/${g}');`),x=[...new Set([...r,...F])].join(`
10
- `);a.writeFileSync(l,x)}}catch(n){console.error(n)}},Y=async(t,s)=>{try{const n=i.join(t,"./saltygen");if(E(s)){const l=a.readFileSync(s,"utf8");l.replace(/^(?!export\s)const\s.*/gm,h=>`export ${h}`)!==l&&await J.writeFile(s,l);const S=await _(t),C=await v(s,n);let r=l;Object.entries(C).forEach(([h,x])=>{var D;if(x.isKeyframes||!x.generator)return;const g=x.generator._withBuildContext({name:h,config:S}),o=new RegExp(`\\s${h}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(l);if(!o)return console.error("Could not find the original declaration");const f=(D=o.at(1))==null?void 0:D.trim(),$=new RegExp(`\\s${h}[=\\s]+styled\\(`,"g").exec(r);if(!$)return console.error("Could not find the original declaration");const{index:b}=$;let j=!1;const P=setTimeout(()=>j=!0,5e3);let c=0,y=!1,u=0;for(;!y&&!j;){const T=r[b+c];T==="("&&u++,T===")"&&u--,u===0&&T===")"&&(y=!0),c>r.length&&(j=!0),c++}if(!j)clearTimeout(P);else throw new Error("Failed to find the end of the styled call and timed out");const p=b+c,w=r.slice(b,p),d=r,m=` ${h} = styled(${f}, "${g.classNames}", "${g._callerName}", ${JSON.stringify(g.props)});`;r=r.replace(w,m),d===r&&console.error("Minimize file failed to change content",{name:h,tagName:f})});const F=N.toHash(s,6);return S.importStrategy==="component"&&(r=`import '../../saltygen/css/${F}.css';
11
- ${r}`),r=r.replace("{ styled }","{ styledClient as styled }"),r=r.replace("@salty-css/react/styled","@salty-css/react/styled-client"),r}}catch(n){console.error("Error in minimizeFile:",n)}};exports.compileSaltyFile=v;exports.generateConfigStyles=B;exports.generateCss=U;exports.generateFile=X;exports.isSaltyFile=E;exports.minimizeFile=Y;exports.saltyFileExtensions=M;exports.saltyFileRegExp=z;
7
+ ${r}`;if(d.importStrategy!=="component"){const o=n.flat().map(y=>`@import url('./css/${y}');`).join(`
8
+ `);g+=o}a.writeFileSync(l,g)}catch(s){console.error(s)}},Z=async(e,s)=>{try{const n=[],t=i.join(e,"./saltygen"),l=i.join(t,"index.css");if(v(s)){const d=await _(e),x=await E(s,t);Object.entries(x).forEach(([g,o])=>{if(!o.generator)return;const y=o.generator._withBuildContext({name:g,config:d}),$=`${y.hash}-${y.priority}.css`,b=`css/${$}`,S=i.join(t,b);n.push($),a.writeFileSync(S,y.css)});const r=a.readFileSync(l,"utf8").split(`
9
+ `),F=n.map(g=>`@import url('../saltygen/css/${g}');`),T=[...new Set([...r,...F])].join(`
10
+ `);a.writeFileSync(l,T)}}catch(n){console.error(n)}},Q=async(e,s)=>{try{const n=i.join(e,"./saltygen");if(v(s)){const l=a.readFileSync(s,"utf8");l.replace(/^(?!export\s)const\s.*/gm,j=>`export ${j}`)!==l&&await J.writeFile(s,l);const d=await _(e),x=await E(s,n);let r=l;Object.entries(x).forEach(([j,T])=>{var D;if(T.isKeyframes||!T.generator)return;const g=T.generator._withBuildContext({name:j,config:d}),o=new RegExp(`\\s${j}[=\\s]+[^()]+styled\\(([^,]+),`,"g").exec(l);if(!o)return console.error("Could not find the original declaration");const y=(D=o.at(1))==null?void 0:D.trim(),$=new RegExp(`\\s${j}[=\\s]+styled\\(`,"g").exec(r);if(!$)return console.error("Could not find the original declaration");const{index:b}=$;let S=!1;const k=setTimeout(()=>S=!0,5e3);let c=0,u=!1,f=0;for(;!u&&!S;){const P=r[b+c];P==="("&&f++,P===")"&&f--,f===0&&P===")"&&(u=!0),c>r.length&&(S=!0),c++}if(!S)clearTimeout(k);else throw new Error("Failed to find the end of the styled call and timed out");const p=b+c,w=r.slice(b,p),m=r,h=` ${j} = styled(${y}, "${g.classNames}", "${g._callerName}", ${JSON.stringify(g.props)});`;r=r.replace(w,h),m===r&&console.error("Minimize file failed to change content",{name:j,tagName:y})});const F=N.toHash(s,6);return d.importStrategy==="component"&&(r=`import '../../saltygen/css/${F}.css';
11
+ ${r}`),r=r.replace("{ styled }","{ styledClient as styled }"),r=r.replace("@salty-css/react/styled","@salty-css/react/styled-client"),r}}catch(n){console.error("Error in minimizeFile:",n)}};exports.compileSaltyFile=E;exports.generateConfigStyles=H;exports.generateCss=Y;exports.generateFile=Z;exports.isSaltyFile=v;exports.minimizeFile=Q;exports.saltyFileExtensions=z;exports.saltyFileRegExp=B;
package/compiler/index.js CHANGED
@@ -1,102 +1,102 @@
1
1
  import * as _ from "esbuild";
2
- import { execSync as W } from "child_process";
3
- import { t as E, d as M } from "../dash-case-DMQMcCO6.js";
2
+ import { execSync as G } from "child_process";
3
+ import { t as E, d as I } from "../dash-case-DMQMcCO6.js";
4
4
  import { join as i } from "path";
5
- import { writeFileSync as b, existsSync as G, mkdirSync as V, statSync as J, readdirSync as q, readFileSync as v } from "fs";
6
- import { writeFile as A } from "fs/promises";
7
- import { p as L, a as U, b as X } from "../parse-templates-D4p3pgQR.js";
8
- const N = (s) => i(s, "./saltygen"), Y = ["salty", "css", "styles", "styled"], Z = (s = []) => new RegExp(`\\.(${[...Y, ...s].join("|")})\\.`), O = (s, e = []) => Z(e).test(s), Q = async (s) => {
9
- const e = N(s), n = i(s, "salty.config.ts"), t = i(e, "salty.config.js");
10
- await _.build({
5
+ import { writeFileSync as w, existsSync as J, mkdirSync as V, statSync as q, readdirSync as A, readFileSync as v } from "fs";
6
+ import { writeFile as L } from "fs/promises";
7
+ import { p as U, a as X, b as Y } from "../parse-templates-DUUSaubj.js";
8
+ const z = () => import.meta.url.endsWith(".cjs") ? "cjs" : "esm", N = (s) => i(s, "./saltygen"), Z = ["salty", "css", "styles", "styled"], Q = (s = []) => new RegExp(`\\.(${[...Z, ...s].join("|")})\\.`), M = (s, e = []) => Q(e).test(s), tt = async (s) => {
9
+ const e = N(s), n = i(s, "salty.config.ts"), t = i(e, "salty.config.js"), a = z();
10
+ console.log("Module type:", a), await _.build({
11
11
  entryPoints: [n],
12
12
  minify: !0,
13
13
  treeShaking: !0,
14
14
  bundle: !0,
15
15
  outfile: t,
16
- format: "esm",
17
- external: ["react"]
16
+ format: a
17
+ // external: ['react'],
18
18
  });
19
- const a = Date.now(), { config: k } = await import(`${t}?t=${a}`);
20
- return k;
21
- }, tt = async (s) => {
22
- const e = await Q(s), n = /* @__PURE__ */ new Set(), t = (c, l = []) => c ? Object.entries(c).flatMap(([m, p]) => {
19
+ const C = Date.now(), { config: y } = await import(`${t}?t=${C}`);
20
+ return y;
21
+ }, st = async (s) => {
22
+ const e = await tt(s), n = /* @__PURE__ */ new Set(), t = (c, l = []) => c ? Object.entries(c).flatMap(([m, p]) => {
23
23
  if (!p) return;
24
24
  if (typeof p == "object") return t(p, [...l, m]);
25
25
  const j = [...l, m].join(".");
26
26
  n.add(`"${j}"`);
27
- const g = [...l.map(M), M(m)].join("-"), { result: u } = X(p);
28
- return `--${g}: ${u};`;
27
+ const g = [...l.map(I), I(m)].join("-"), { result: d } = Y(p);
28
+ return `--${g}: ${d};`;
29
29
  }) : [], a = (c) => c ? Object.entries(c).flatMap(([l, m]) => {
30
30
  const p = t(m);
31
31
  return l === "base" ? p.join("") : `${l} { ${p.join("")} }`;
32
- }) : [], k = (c) => c ? Object.entries(c).flatMap(([l, m]) => Object.entries(m).flatMap(([p, j]) => {
33
- const g = t(j, [l]), u = `.${l}-${p}, [data-${l}="${p}"]`, D = g.join("");
34
- return `${u} { ${D} }`;
35
- })) : [], w = t(e.variables), C = a(e.responsiveVariables), r = k(e.conditionalVariables), F = N(s), d = i(F, "css/variables.css"), x = `:root { ${w.join("")} ${C.join("")} } ${r.join("")}`;
36
- b(d, x);
37
- const y = i(F, "types/css-tokens.d.ts"), f = `type VariableTokens = ${[...n].join("|") || '""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;
38
- b(y, f);
39
- const S = i(F, "css/global.css"), $ = L(e.global, "");
40
- b(S, $);
41
- const h = i(F, "css/templates.css"), P = U(e.templates);
42
- b(h, P);
43
- }, R = async (s, e) => {
44
- const n = E(s), t = i(e, "js", n + ".js");
45
- await _.build({
32
+ }) : [], C = (c) => c ? Object.entries(c).flatMap(([l, m]) => Object.entries(m).flatMap(([p, j]) => {
33
+ const g = t(j, [l]), d = `.${l}-${p}, [data-${l}="${p}"]`, k = g.join("");
34
+ return `${d} { ${k} }`;
35
+ })) : [], y = t(e.variables), x = a(e.responsiveVariables), r = C(e.conditionalVariables), F = N(s), h = i(F, "css/variables.css"), D = `:root { ${y.join("")} ${x.join("")} } ${r.join("")}`;
36
+ w(h, D);
37
+ const u = i(F, "types/css-tokens.d.ts"), f = `type VariableTokens = ${[...n].join("|") || '""'}; type PropertyValueToken = \`{\${VariableTokens}}\``;
38
+ w(u, f);
39
+ const S = i(F, "css/global.css"), b = U(e.global, "");
40
+ w(S, b);
41
+ const $ = i(F, "css/templates.css"), T = X(e.templates);
42
+ w($, T);
43
+ }, O = async (s, e) => {
44
+ const n = E(s), t = i(e, "js", n + ".js"), a = z();
45
+ console.log("Module type:", a), await _.build({
46
46
  entryPoints: [s],
47
47
  minify: !0,
48
48
  treeShaking: !0,
49
49
  bundle: !0,
50
50
  outfile: t,
51
- format: "esm",
51
+ format: a,
52
52
  target: ["es2022"],
53
- keepNames: !0,
54
- external: ["react"]
53
+ keepNames: !0
54
+ // external: ['react'],
55
55
  });
56
- const a = Date.now();
57
- return await import(`${t}?t=${a}`);
58
- }, B = async (s) => {
56
+ const C = Date.now();
57
+ return await import(`${t}?t=${C}`);
58
+ }, R = async (s) => {
59
59
  const e = N(s), n = i(e, "salty.config.js"), { config: t } = await import(n);
60
60
  return t;
61
- }, ct = async (s) => {
61
+ }, at = async (s) => {
62
62
  try {
63
63
  const e = [], n = [], t = N(s), a = i(t, "index.css");
64
64
  (() => {
65
- G(t) && W("rm -rf " + t), V(t), V(i(t, "css")), V(i(t, "types"));
66
- })(), await tt(s);
67
- const w = await B(s);
68
- async function C(o, f) {
69
- const S = ["node_modules", "saltygen"], $ = J(o);
70
- if ($.isDirectory()) {
71
- const h = q(o);
65
+ J(t) && G("rm -rf " + t), V(t), V(i(t, "css")), V(i(t, "types"));
66
+ })(), await st(s);
67
+ const y = await R(s);
68
+ async function x(o, f) {
69
+ const S = ["node_modules", "saltygen"], b = q(o);
70
+ if (b.isDirectory()) {
71
+ const $ = A(o);
72
72
  if (S.some((c) => o.includes(c))) return;
73
- await Promise.all(h.map((c) => C(i(o, c), i(f, c))));
74
- } else if ($.isFile() && O(o)) {
75
- const P = await R(o, t), c = [];
76
- Object.entries(P).forEach(([j, g]) => {
73
+ await Promise.all($.map((c) => x(i(o, c), i(f, c))));
74
+ } else if (b.isFile() && M(o)) {
75
+ const T = await O(o, t), c = [];
76
+ Object.entries(T).forEach(([j, g]) => {
77
77
  if (g.isKeyframes && g.css) {
78
- const I = `${g.animationName}.css`, H = `css/${I}`, K = i(t, H);
79
- e.push(I), b(K, g.css);
78
+ const B = `${g.animationName}.css`, H = `css/${B}`, K = i(t, H);
79
+ e.push(B), w(K, g.css);
80
80
  return;
81
81
  }
82
82
  if (!g.generator) return;
83
- const u = g.generator._withBuildContext({
83
+ const d = g.generator._withBuildContext({
84
84
  name: j,
85
- config: w
86
- }), D = `${u.hash}-${u.priority}.css`;
87
- n[u.priority] || (n[u.priority] = []), n[u.priority].push(D), c.push(D);
88
- const T = `css/${D}`, z = i(t, T);
89
- b(z, u.css);
85
+ config: y
86
+ }), k = `${d.hash}-${d.priority}.css`;
87
+ n[d.priority] || (n[d.priority] = []), n[d.priority].push(k), c.push(k);
88
+ const P = `css/${k}`, W = i(t, P);
89
+ w(W, d.css);
90
90
  });
91
91
  const l = c.map((j) => `@import url('./${j}');`).join(`
92
92
  `), m = E(o, 6), p = i(t, `css/${m}.css`);
93
- b(p, l);
93
+ w(p, l);
94
94
  }
95
95
  }
96
- await C(s, t);
96
+ await x(s, t);
97
97
  const r = e.map((o) => `@import url('./css/${o}');`).join(`
98
98
  `);
99
- let y = `@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
99
+ let u = `@layer l0, l1, l2, l3, l4, l5, l6, l7, l8;
100
100
 
101
101
  ${["variables.css", "global.css", "templates.css"].filter((o) => {
102
102
  try {
@@ -107,69 +107,69 @@ ${["variables.css", "global.css", "templates.css"].filter((o) => {
107
107
  }).map((o) => `@import url('./css/${o}');`).join(`
108
108
  `)}
109
109
  ${r}`;
110
- if (w.importStrategy !== "component") {
110
+ if (y.importStrategy !== "component") {
111
111
  const o = n.flat().map((f) => `@import url('./css/${f}');`).join(`
112
112
  `);
113
- y += o;
113
+ u += o;
114
114
  }
115
- b(a, y);
115
+ w(a, u);
116
116
  } catch (e) {
117
117
  console.error(e);
118
118
  }
119
- }, at = async (s, e) => {
119
+ }, lt = async (s, e) => {
120
120
  try {
121
121
  const n = [], t = i(s, "./saltygen"), a = i(t, "index.css");
122
- if (O(e)) {
123
- const w = await B(s), C = await R(e, t);
124
- Object.entries(C).forEach(([y, o]) => {
122
+ if (M(e)) {
123
+ const y = await R(s), x = await O(e, t);
124
+ Object.entries(x).forEach(([u, o]) => {
125
125
  if (!o.generator) return;
126
126
  const f = o.generator._withBuildContext({
127
- name: y,
128
- config: w
129
- }), S = `${f.hash}-${f.priority}.css`, $ = `css/${S}`, h = i(t, $);
130
- n.push(S), b(h, f.css);
127
+ name: u,
128
+ config: y
129
+ }), S = `${f.hash}-${f.priority}.css`, b = `css/${S}`, $ = i(t, b);
130
+ n.push(S), w($, f.css);
131
131
  });
132
132
  const r = v(a, "utf8").split(`
133
- `), F = n.map((y) => `@import url('../saltygen/css/${y}');`), x = [.../* @__PURE__ */ new Set([...r, ...F])].join(`
133
+ `), F = n.map((u) => `@import url('../saltygen/css/${u}');`), D = [.../* @__PURE__ */ new Set([...r, ...F])].join(`
134
134
  `);
135
- b(a, x);
135
+ w(a, D);
136
136
  }
137
137
  } catch (n) {
138
138
  console.error(n);
139
139
  }
140
- }, lt = async (s, e) => {
140
+ }, pt = async (s, e) => {
141
141
  try {
142
142
  const n = i(s, "./saltygen");
143
- if (O(e)) {
143
+ if (M(e)) {
144
144
  const a = v(e, "utf8");
145
- a.replace(/^(?!export\s)const\s.*/gm, (d) => `export ${d}`) !== a && await A(e, a);
146
- const w = await B(s), C = await R(e, n);
145
+ a.replace(/^(?!export\s)const\s.*/gm, (h) => `export ${h}`) !== a && await L(e, a);
146
+ const y = await R(s), x = await O(e, n);
147
147
  let r = a;
148
- Object.entries(C).forEach(([d, x]) => {
149
- var D;
150
- if (x.isKeyframes || !x.generator) return;
151
- const y = x.generator._withBuildContext({
152
- name: d,
153
- config: w
154
- }), o = new RegExp(`\\s${d}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(a);
148
+ Object.entries(x).forEach(([h, D]) => {
149
+ var k;
150
+ if (D.isKeyframes || !D.generator) return;
151
+ const u = D.generator._withBuildContext({
152
+ name: h,
153
+ config: y
154
+ }), o = new RegExp(`\\s${h}[=\\s]+[^()]+styled\\(([^,]+),`, "g").exec(a);
155
155
  if (!o) return console.error("Could not find the original declaration");
156
- const f = (D = o.at(1)) == null ? void 0 : D.trim(), S = new RegExp(`\\s${d}[=\\s]+styled\\(`, "g").exec(r);
156
+ const f = (k = o.at(1)) == null ? void 0 : k.trim(), S = new RegExp(`\\s${h}[=\\s]+styled\\(`, "g").exec(r);
157
157
  if (!S) return console.error("Could not find the original declaration");
158
- const { index: $ } = S;
159
- let h = !1;
160
- const P = setTimeout(() => h = !0, 5e3);
158
+ const { index: b } = S;
159
+ let $ = !1;
160
+ const T = setTimeout(() => $ = !0, 5e3);
161
161
  let c = 0, l = !1, m = 0;
162
- for (; !l && !h; ) {
163
- const T = r[$ + c];
164
- T === "(" && m++, T === ")" && m--, m === 0 && T === ")" && (l = !0), c > r.length && (h = !0), c++;
162
+ for (; !l && !$; ) {
163
+ const P = r[b + c];
164
+ P === "(" && m++, P === ")" && m--, m === 0 && P === ")" && (l = !0), c > r.length && ($ = !0), c++;
165
165
  }
166
- if (!h) clearTimeout(P);
166
+ if (!$) clearTimeout(T);
167
167
  else throw new Error("Failed to find the end of the styled call and timed out");
168
- const p = $ + c, j = r.slice($, p), g = r, u = ` ${d} = styled(${f}, "${y.classNames}", "${y._callerName}", ${JSON.stringify(y.props)});`;
169
- r = r.replace(j, u), g === r && console.error("Minimize file failed to change content", { name: d, tagName: f });
168
+ const p = b + c, j = r.slice(b, p), g = r, d = ` ${h} = styled(${f}, "${u.classNames}", "${u._callerName}", ${JSON.stringify(u.props)});`;
169
+ r = r.replace(j, d), g === r && console.error("Minimize file failed to change content", { name: h, tagName: f });
170
170
  });
171
171
  const F = E(e, 6);
172
- return w.importStrategy === "component" && (r = `import '../../saltygen/css/${F}.css';
172
+ return y.importStrategy === "component" && (r = `import '../../saltygen/css/${F}.css';
173
173
  ${r}`), r = r.replace("{ styled }", "{ styledClient as styled }"), r = r.replace("@salty-css/react/styled", "@salty-css/react/styled-client"), r;
174
174
  }
175
175
  } catch (n) {
@@ -177,12 +177,12 @@ ${r}`), r = r.replace("{ styled }", "{ styledClient as styled }"), r = r.replace
177
177
  }
178
178
  };
179
179
  export {
180
- R as compileSaltyFile,
181
- tt as generateConfigStyles,
182
- ct as generateCss,
183
- at as generateFile,
184
- O as isSaltyFile,
185
- lt as minimizeFile,
186
- Y as saltyFileExtensions,
187
- Z as saltyFileRegExp
180
+ O as compileSaltyFile,
181
+ st as generateConfigStyles,
182
+ at as generateCss,
183
+ lt as generateFile,
184
+ M as isSaltyFile,
185
+ pt as minimizeFile,
186
+ Z as saltyFileExtensions,
187
+ Q as saltyFileRegExp
188
188
  };
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var l=(a,t,s)=>t in a?m(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var c=(a,t,s)=>l(a,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../dash-case-DKzpenwY.cjs"),p=require("../parse-templates-W0YfTmOT.cjs");class g{constructor(t,s){c(this,"_callerName");c(this,"_context");this.tagName=t,this.params=s}get hash(){return u.toHash(this.params.base||this.params)}get priority(){var t;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((t=this.tagName.generator)==null?void 0:t.priority)||0)+1:0}get classNames(){const t=[this.hash],{className:s}=this.params;return s&&t.push(s),t.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?p.getTemplateKeys(this._context.config.templates):[]}get css(){var e;const{base:t={},variants:s={},compoundVariants:r=[]}=this.params,i={...t,variants:s,compoundVariants:r};return p.parseStyles(i,`.${this.cssClassName}`,this.priority,(e=this._context)==null?void 0:e.config)}get props(){const{element:t}=this.params,s=this.params.variants?Object.keys(this.params.variants).map(e=>{var n;const o=(n=this.params.defaultVariants)==null?void 0:n[e];return o!==void 0?`${e}=${String(o)}`:e}):void 0,r=new Set([]),i=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return i&&i.forEach((e,o,n)=>{const h=n.at(1);h&&r.add(h)}),{element:t,variantKeys:s,propValueKeys:[...r]}}_withBuildContext(t){this._context=t;const{name:s,config:r}=t;return this._callerName=s,this}}exports.StyleComponentGenerator=g;
1
+ "use strict";var m=Object.defineProperty;var l=(a,t,s)=>t in a?m(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var c=(a,t,s)=>l(a,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../dash-case-DKzpenwY.cjs"),p=require("../parse-templates-DVK3iZIl.cjs");class g{constructor(t,s){c(this,"_callerName");c(this,"_context");this.tagName=t,this.params=s}get hash(){return u.toHash(this.params.base||this.params)}get priority(){var t;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((t=this.tagName.generator)==null?void 0:t.priority)||0)+1:0}get classNames(){const t=[this.hash],{className:s}=this.params;return s&&t.push(s),t.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?p.getTemplateKeys(this._context.config.templates):[]}get css(){var e;const{base:t={},variants:s={},compoundVariants:r=[]}=this.params,i={...t,variants:s,compoundVariants:r};return p.parseStyles(i,`.${this.cssClassName}`,this.priority,(e=this._context)==null?void 0:e.config)}get props(){const{element:t}=this.params,s=this.params.variants?Object.keys(this.params.variants).map(e=>{var n;const o=(n=this.params.defaultVariants)==null?void 0:n[e];return o!==void 0?`${e}=${String(o)}`:e}):void 0,r=new Set([]),i=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return i&&i.forEach((e,o,n)=>{const h=n.at(1);h&&r.add(h)}),{element:t,variantKeys:s,propValueKeys:[...r]}}_withBuildContext(t){this._context=t;const{name:s,config:r}=t;return this._callerName=s,this}}exports.StyleComponentGenerator=g;
@@ -2,7 +2,7 @@ var h = Object.defineProperty;
2
2
  var m = (e, t, s) => t in e ? h(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
3
  var c = (e, t, s) => m(e, typeof t != "symbol" ? t + "" : t, s);
4
4
  import { t as l } from "../dash-case-DMQMcCO6.js";
5
- import { g, p as u } from "../parse-templates-D4p3pgQR.js";
5
+ import { g, p as u } from "../parse-templates-DUUSaubj.js";
6
6
  class d {
7
7
  constructor(t, s) {
8
8
  c(this, "_callerName");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.57",
3
+ "version": "0.0.1-alpha.59",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -0,0 +1,96 @@
1
+ import { d as O } from "./dash-case-DMQMcCO6.js";
2
+ const W = (s, r) => {
3
+ if (typeof s != "string") return { result: s };
4
+ if (!r) return { result: s };
5
+ const o = [];
6
+ return Object.values(r).forEach((i) => {
7
+ const { pattern: p, transform: c } = i;
8
+ s = s.replace(p, (a) => {
9
+ const { value: e, css: m } = c(a);
10
+ return m && o.push(m), e;
11
+ });
12
+ }), { result: s, additionalCss: o };
13
+ }, N = (s) => typeof s != "string" ? { result: s } : /\{[^{}]+\}/g.test(s) ? { result: s.replace(/\{([^{}]+)\}/g, (...i) => `var(--${O(i[1].replaceAll(".", "-"))})`) } : { result: s }, d = (s, r, o, i) => {
14
+ if (!s) return "";
15
+ const p = [], c = Object.entries(s).reduce((e, [m, t]) => {
16
+ const n = m.trim();
17
+ if (typeof t == "function" && (t = t()), typeof t == "object") {
18
+ if (!t) return e;
19
+ if (n === "variants")
20
+ return Object.entries(t).forEach(([f, u]) => {
21
+ u && Object.entries(u).forEach(([b, l]) => {
22
+ if (!l) return;
23
+ const j = `${r}.${f}-${b}`, y = d(l, j, o);
24
+ p.push(y);
25
+ });
26
+ }), e;
27
+ if (n === "defaultVariants")
28
+ return e;
29
+ if (n === "compoundVariants")
30
+ return t.forEach((f) => {
31
+ const { css: u, ...b } = f, l = Object.entries(b).reduce((y, [V, w]) => `${y}.${V}-${w}`, r), j = d(u, l, o);
32
+ p.push(j);
33
+ }), e;
34
+ if (n.startsWith("@")) {
35
+ const f = d(t, r, o), u = `${n} {
36
+ ${f.replace(`
37
+ `, `
38
+ `)}
39
+ }`;
40
+ return p.push(u), e;
41
+ }
42
+ const $ = m.includes("&") ? n.replace("&", r) : n.startsWith(":") ? `${r}${n}` : `${r} ${n}`, h = d(t, $, o);
43
+ return p.push(h), e;
44
+ }
45
+ if (i != null && i.templates && i.templates[n]) {
46
+ const h = t.split(".").reduce((f, u) => f[u], i.templates[n]);
47
+ if (h) {
48
+ const f = d(h, "");
49
+ return `${e}${f}`;
50
+ }
51
+ return console.warn(`Template "${n}" with path of "${t}" was not found in config!`), e;
52
+ }
53
+ const S = n.startsWith("-") ? n : O(n), g = ($, h = ";") => e = `${e}${$}${h}`, E = ($) => g(`${S}:${$}`);
54
+ if (typeof t == "number") return E(t);
55
+ if (typeof t != "string")
56
+ if ("toString" in t) t = t.toString();
57
+ else return e;
58
+ const { modifiers: T } = i || {}, k = function* () {
59
+ yield N(t), yield W(t, T);
60
+ }();
61
+ for (const { result: $, additionalCss: h = [] } of k)
62
+ t = $, h.forEach((f) => {
63
+ const u = d(f, "");
64
+ g(u, "");
65
+ });
66
+ return E(t);
67
+ }, "");
68
+ if (!c) return p.join(`
69
+ `);
70
+ if (!r) return c;
71
+ let a = "";
72
+ return o !== void 0 ? a = `@layer l${o} { ${r} { ${c} } }` : a = `${r} { ${c} }`, [a, ...p].join(`
73
+ `);
74
+ }, P = (s, r = []) => {
75
+ if (!s) return "";
76
+ const o = [], i = {};
77
+ if (Object.entries(s).forEach(([p, c]) => {
78
+ if (typeof c == "object") {
79
+ if (!c) return;
80
+ const a = p.trim(), e = P(c, [...r, a]);
81
+ o.push(e);
82
+ } else
83
+ i[p] = c;
84
+ }), Object.keys(i).length) {
85
+ const p = r.map(O).join("-"), c = d(i, `.${p}`);
86
+ o.push(c);
87
+ }
88
+ return o.join(`
89
+ `);
90
+ }, x = (s) => Object.keys(s);
91
+ export {
92
+ P as a,
93
+ N as b,
94
+ x as g,
95
+ d as p
96
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";const T=require("./dash-case-DKzpenwY.cjs"),K=(e,s)=>{if(typeof e!="string")return{result:e};if(!s)return{result:e};const o=[];return Object.values(s).forEach(i=>{const{pattern:p,transform:c}=i;e=e.replace(p,d=>{const{value:r,css:l}=c(d);return l&&o.push(l),r})}),{result:e,additionalCss:o}},g=e=>typeof e!="string"?{result:e}:/\{[^{}]+\}/g.test(e)?{result:e.replace(/\{([^{}]+)\}/g,(...i)=>`var(--${T.dashCase(i[1].replaceAll(".","-"))})`)}:{result:e},a=(e,s,o,i)=>{if(!e)return"";const p=[],c=Object.entries(e).reduce((r,[l,t])=>{const n=l.trim();if(typeof t=="function"&&(t=t()),typeof t=="object"){if(!t)return r;if(n==="variants")return Object.entries(t).forEach(([f,u])=>{u&&Object.entries(u).forEach(([j,m])=>{if(!m)return;const y=`${s}.${f}-${j}`,b=a(m,y,o);p.push(b)})}),r;if(n==="defaultVariants")return r;if(n==="compoundVariants")return t.forEach(f=>{const{css:u,...j}=f,m=Object.entries(j).reduce((b,[W,q])=>`${b}.${W}-${q}`,s),y=a(u,m,o);p.push(y)}),r;if(n.startsWith("@")){const f=a(t,s,o),u=`${n} {
2
+ ${f.replace(`
3
+ `,`
4
+ `)}
5
+ }`;return p.push(u),r}const $=l.includes("&")?n.replace("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`,h=a(t,$,o);return p.push(h),r}if(i!=null&&i.templates&&i.templates[n]){const h=t.split(".").reduce((f,u)=>f[u],i.templates[n]);if(h){const f=a(h,"");return`${r}${f}`}return console.warn(`Template "${n}" with path of "${t}" was not found in config!`),r}const E=n.startsWith("-")?n:T.dashCase(n),O=($,h=";")=>r=`${r}${$}${h}`,S=$=>O(`${E}:${$}`);if(typeof t=="number")return S(t);if(typeof t!="string")if("toString"in t)t=t.toString();else return r;const{modifiers:V}=i||{},w=function*(){yield g(t),yield K(t,V)}();for(const{result:$,additionalCss:h=[]}of w)t=$,h.forEach(f=>{const u=a(f,"");O(u,"")});return S(t)},"");if(!c)return p.join(`
6
+ `);if(!s)return c;let d="";return o!==void 0?d=`@layer l${o} { ${s} { ${c} } }`:d=`${s} { ${c} }`,[d,...p].join(`
7
+ `)},k=(e,s=[])=>{if(!e)return"";const o=[],i={};if(Object.entries(e).forEach(([p,c])=>{if(typeof c=="object"){if(!c)return;const d=p.trim(),r=k(c,[...s,d]);o.push(r)}else i[p]=c}),Object.keys(i).length){const p=s.map(T.dashCase).join("-"),c=a(i,`.${p}`);o.push(c)}return o.join(`
8
+ `)},N=e=>Object.keys(e);exports.getTemplateKeys=N;exports.parseStyles=a;exports.parseTemplates=k;exports.parseValueTokens=g;
@@ -0,0 +1 @@
1
+ export declare const detectCurrentModuleType: () => "cjs" | "esm";
@@ -1,92 +0,0 @@
1
- import { d as O } from "./dash-case-DMQMcCO6.js";
2
- const N = (t, r) => {
3
- if (typeof t != "string") return { result: t };
4
- if (!r) return { result: t };
5
- const e = [];
6
- return Object.values(r).forEach((n) => {
7
- const { pattern: o, transform: c } = n;
8
- t = t.replace(o, (h) => {
9
- const { value: i, css: m } = c(h);
10
- return m && e.push(m), i;
11
- });
12
- }), { result: t, additionalCss: e };
13
- }, P = (t) => typeof t != "string" ? { result: t } : /\{[^{}]+\}/g.test(t) ? { result: t.replace(/\{([^{}]+)\}/g, (...n) => `var(--${O(n[1].replaceAll(".", "-"))})`) } : { result: t }, d = (t, r, e, n) => {
14
- if (!t) return "";
15
- const o = [], c = Object.entries(t).reduce((i, [m, s]) => {
16
- const p = m.trim();
17
- if (typeof s == "function" && (s = s()), typeof s == "object") {
18
- if (!s) return i;
19
- if (p === "variants")
20
- return Object.entries(s).forEach(([u, f]) => {
21
- f && Object.entries(f).forEach(([b, j]) => {
22
- if (!j) return;
23
- const l = `${r}.${u}-${b}`, y = d(j, l, e);
24
- o.push(y);
25
- });
26
- }), i;
27
- if (p === "defaultVariants")
28
- return i;
29
- if (p === "compoundVariants")
30
- return s.forEach((u) => {
31
- const { css: f, ...b } = u, j = Object.entries(b).reduce((y, [V, W]) => `${y}.${V}-${W}`, r), l = d(f, j, e);
32
- o.push(l);
33
- }), i;
34
- if (p.startsWith("@")) {
35
- const u = d(s, r, e), f = `${p} {
36
- ${u.replace(`
37
- `, `
38
- `)}
39
- }`;
40
- return o.push(f), i;
41
- }
42
- const $ = m.includes("&") ? p.replace("&", r) : p.startsWith(":") ? `${r}${p}` : `${r} ${p}`, a = d(s, $, e);
43
- return o.push(a), i;
44
- }
45
- if (n != null && n.templates && n.templates[p]) {
46
- const a = s.split(".").reduce((f, b) => f[b], n.templates[p]), u = d(a, "");
47
- return `${i}${u}`;
48
- }
49
- const g = p.startsWith("-") ? p : O(p), E = ($, a = ";") => i = `${i}${$}${a}`, S = ($) => E(`${g}:${$}`);
50
- if (typeof s == "number") return S(s);
51
- if (typeof s != "string")
52
- if ("toString" in s) s = s.toString();
53
- else return i;
54
- const { modifiers: k } = n || {}, T = function* () {
55
- yield P(s), yield N(s, k);
56
- }();
57
- for (const { result: $, additionalCss: a = [] } of T)
58
- s = $, a.forEach((u) => {
59
- const f = d(u, "");
60
- E(f, "");
61
- });
62
- return S(s);
63
- }, "");
64
- if (!c) return o.join(`
65
- `);
66
- if (!r) return c;
67
- let h = "";
68
- return e !== void 0 ? h = `@layer l${e} { ${r} { ${c} } }` : h = `${r} { ${c} }`, [h, ...o].join(`
69
- `);
70
- }, _ = (t, r = []) => {
71
- if (!t) return "";
72
- const e = [], n = {};
73
- if (Object.entries(t).forEach(([o, c]) => {
74
- if (typeof c == "object") {
75
- if (!c) return;
76
- const h = o.trim(), i = _(c, [...r, h]);
77
- e.push(i);
78
- } else
79
- n[o] = c;
80
- }), Object.keys(n).length) {
81
- const o = r.map(O).join("-"), c = d(n, `.${o}`);
82
- e.push(c);
83
- }
84
- return e.join(`
85
- `);
86
- }, A = (t) => Object.keys(t);
87
- export {
88
- _ as a,
89
- P as b,
90
- A as g,
91
- d as p
92
- };
@@ -1,8 +0,0 @@
1
- "use strict";const O=require("./dash-case-DKzpenwY.cjs"),N=(t,e)=>{if(typeof t!="string")return{result:t};if(!e)return{result:t};const r=[];return Object.values(e).forEach(n=>{const{pattern:o,transform:c}=n;t=t.replace(o,a=>{const{value:i,css:l}=c(a);return l&&r.push(l),i})}),{result:t,additionalCss:r}},k=t=>typeof t!="string"?{result:t}:/\{[^{}]+\}/g.test(t)?{result:t.replace(/\{([^{}]+)\}/g,(...n)=>`var(--${O.dashCase(n[1].replaceAll(".","-"))})`)}:{result:t},h=(t,e,r,n)=>{if(!t)return"";const o=[],c=Object.entries(t).reduce((i,[l,s])=>{const p=l.trim();if(typeof s=="function"&&(s=s()),typeof s=="object"){if(!s)return i;if(p==="variants")return Object.entries(s).forEach(([u,f])=>{f&&Object.entries(f).forEach(([m,j])=>{if(!j)return;const y=`${e}.${u}-${m}`,b=h(j,y,r);o.push(b)})}),i;if(p==="defaultVariants")return i;if(p==="compoundVariants")return s.forEach(u=>{const{css:f,...m}=u,j=Object.entries(m).reduce((b,[q,K])=>`${b}.${q}-${K}`,e),y=h(f,j,r);o.push(y)}),i;if(p.startsWith("@")){const u=h(s,e,r),f=`${p} {
2
- ${u.replace(`
3
- `,`
4
- `)}
5
- }`;return o.push(f),i}const $=l.includes("&")?p.replace("&",e):p.startsWith(":")?`${e}${p}`:`${e} ${p}`,d=h(s,$,r);return o.push(d),i}if(n!=null&&n.templates&&n.templates[p]){const d=s.split(".").reduce((f,m)=>f[m],n.templates[p]),u=h(d,"");return`${i}${u}`}const V=p.startsWith("-")?p:O.dashCase(p),T=($,d=";")=>i=`${i}${$}${d}`,S=$=>T(`${V}:${$}`);if(typeof s=="number")return S(s);if(typeof s!="string")if("toString"in s)s=s.toString();else return i;const{modifiers:g}=n||{},W=function*(){yield k(s),yield N(s,g)}();for(const{result:$,additionalCss:d=[]}of W)s=$,d.forEach(u=>{const f=h(u,"");T(f,"")});return S(s)},"");if(!c)return o.join(`
6
- `);if(!e)return c;let a="";return r!==void 0?a=`@layer l${r} { ${e} { ${c} } }`:a=`${e} { ${c} }`,[a,...o].join(`
7
- `)},E=(t,e=[])=>{if(!t)return"";const r=[],n={};if(Object.entries(t).forEach(([o,c])=>{if(typeof c=="object"){if(!c)return;const a=o.trim(),i=E(c,[...e,a]);r.push(i)}else n[o]=c}),Object.keys(n).length){const o=e.map(O.dashCase).join("-"),c=h(n,`.${o}`);r.push(c)}return r.join(`
8
- `)},P=t=>Object.keys(t);exports.getTemplateKeys=P;exports.parseStyles=h;exports.parseTemplates=E;exports.parseValueTokens=k;