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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/class-name.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./styles-generator-BvW5rzpp.cjs");class a extends r.StylesGenerator{constructor(e){super(e),this._params=e}}const n=s=>{const e=new a(s),t=new String(e.cssClassName);return Object.assign(t,{get isClassName(){return!0},generator:e}),t};exports.className=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./styles-generator-DvtuxJMl.cjs");class a extends r.StylesGenerator{constructor(e){super(e),this._params=e}}const n=s=>{const e=new a(s),t=new String(e.cssClassName);return Object.assign(t,{get isClassName(){return!0},generator:e}),t};exports.className=n;
package/class-name.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as r } from "./styles-generator-Bn-B7D2c.js";
1
+ import { S as r } from "./styles-generator-QutiM0qS.js";
2
2
  class a extends r {
3
3
  constructor(s) {
4
4
  super(s), this._params = s;
package/keyframes.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./parse-styles-Dbs9sKzP.cjs"),w=async({animationName:l,params:u,appendInitialStyles:y,...t})=>{const e=l||i.toHash(t),r=async(n={})=>{const{duration:s="500ms",easing:o="ease-in-out",delay:c="0s",iterationCount:S="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...n},a=`${e} ${s} ${o} ${c} ${S} ${p} ${g} ${b}`;if(!y)return a;const m=t.from||t["0%"];if(!m)return a;const j=await i.parseAndJoinStyles(m,"");return`${a};${j}`},$=Object.entries(t).map(async([n,s])=>{if(!s)return"";const o=await i.parseAndJoinStyles(s,"");return`${typeof n=="number"?`${n}%`:n}{${o}}`}),d=(await Promise.all($)).join(""),f=`@keyframes ${e} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:e,css:f,keyframes:t}),r};exports.keyframes=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./parse-styles-DqNFvgCM.cjs"),w=async({animationName:l,params:u,appendInitialStyles:y,...t})=>{const e=l||i.toHash(t),r=async(n={})=>{const{duration:s="500ms",easing:o="ease-in-out",delay:c="0s",iterationCount:S="1",direction:p="normal",fillMode:g="forwards",playState:b="running"}={...u,...n},a=`${e} ${s} ${o} ${c} ${S} ${p} ${g} ${b}`;if(!y)return a;const m=t.from||t["0%"];if(!m)return a;const j=await i.parseAndJoinStyles(m,"");return`${a};${j}`},$=Object.entries(t).map(async([n,s])=>{if(!s)return"";const o=await i.parseAndJoinStyles(s,"");return`${typeof n=="number"?`${n}%`:n}{${o}}`}),d=(await Promise.all($)).join(""),f=`@keyframes ${e} {${d}}`;return Object.assign(r,{toString:r,isKeyframes:!0,animationName:e,css:f,keyframes:t}),r};exports.keyframes=w;
package/keyframes.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as j, p as m } from "./parse-styles-BmW7IL0U.js";
1
+ import { t as j, p as m } from "./parse-styles-BbXScIK9.js";
2
2
  const h = async ({ animationName: $, params: l, appendInitialStyles: u, ...t }) => {
3
3
  const r = $ || j(t), e = async (n = {}) => {
4
4
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/react",
3
- "version": "0.0.1-alpha.250",
3
+ "version": "0.0.1-alpha.251",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -66,7 +66,7 @@
66
66
  }
67
67
  },
68
68
  "dependencies": {
69
- "@salty-css/core": "^0.0.1-alpha.250",
69
+ "@salty-css/core": "^0.0.1-alpha.251",
70
70
  "clsx": ">=2.x",
71
71
  "react": ">=19.x || >=18.3.x"
72
72
  }
@@ -87,15 +87,15 @@ const J = (e) => (s) => {
87
87
  const h = Object.entries(p);
88
88
  for (const [C, m] of h) {
89
89
  if (!m) continue;
90
- const A = `${s}.${f}-${C}`;
91
- (await $(m, A, t)).forEach((U) => o.add(U));
90
+ const O = `${s}.${f}-${C}`;
91
+ (await $(m, O, t)).forEach((U) => o.add(U));
92
92
  }
93
93
  }
94
94
  return;
95
95
  }
96
96
  if (n === "compoundVariants") {
97
97
  for (const a of r) {
98
- const { css: f, ...p } = a, h = Object.entries(p).reduce((m, [A, W]) => `${m}.${A}-${W}`, s);
98
+ const { css: f, ...p } = a, h = Object.entries(p).reduce((m, [O, W]) => `${m}.${O}-${W}`, s);
99
99
  (await $(f, h, t)).forEach((m) => o.add(m));
100
100
  }
101
101
  return;
@@ -105,7 +105,7 @@ const J = (e) => (s) => {
105
105
  o.add(p);
106
106
  return;
107
107
  }
108
- const c = u.includes("&") ? n.replace("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
108
+ const c = u.includes("&") ? n.replaceAll("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
109
109
  (await $(r, c, t)).forEach((a) => o.add(a));
110
110
  return;
111
111
  }
@@ -117,7 +117,7 @@ const J = (e) => (s) => {
117
117
  if ("toString" in r) r = r.toString();
118
118
  else throw new Error(`Invalid value type for property ${w}`);
119
119
  return l(r);
120
- }, S = j.map(y), { modifiers: x } = t || {}, b = [H(), J(x)], O = (await Promise.all(S).then((u) => Promise.all(
120
+ }, S = j.map(y), { modifiers: x } = t || {}, b = [H(), J(x)], A = (await Promise.all(S).then((u) => Promise.all(
121
121
  u.map((r) => b.reduce(async (n, w) => {
122
122
  const l = await n;
123
123
  if (!l) return l;
@@ -132,10 +132,10 @@ const J = (e) => (s) => {
132
132
  }, Promise.resolve(r)))
133
133
  ))).filter((u) => u !== void 0).join(`
134
134
  `);
135
- if (!O.trim()) return Array.from(o);
135
+ if (!A.trim()) return Array.from(o);
136
136
  const N = s ? `${s} {
137
- ${O}
138
- }` : O;
137
+ ${A}
138
+ }` : A;
139
139
  return o.has(N) ? Array.from(o) : [N, ...o];
140
140
  }, M = async (e, s, t, i = !1) => (await $(e, s, t, i)).join(`
141
141
  `);
@@ -1,4 +1,4 @@
1
- "use strict";const N=require("./parse-tokens-DfRKmjt1.cjs"),M=e=>s=>{if(typeof s!="string"||!e)return;let t=s;const a=[];return Object.values(e).forEach(o=>{const{pattern:S,transform:$}=o;t=t.replace(S,j=>{const{value:A,css:b}=$(j);return b&&a.push(b),A})}),{transformed:t,additionalCss:a}},H=e=>String.fromCharCode(e+(e>25?39:97)),T=(e,s)=>{let t="",a;for(a=Math.abs(e);a>52;a=a/52|0)t=H(a%52)+t;return t=H(a%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},U=(e,s)=>{let t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return e},q=(e,s=5)=>{const t=U(5381,JSON.stringify(e))>>>0;return T(t,s)},Q=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],_=(e,s,t)=>{if(Q.some(o=>typeof o=="string"?o===e:o.test(e))){const o=(t==null?void 0:t.defaultUnit)||"px";return`${s}${o}`}return`${s}`},F=["Webkit","Moz","ms","O"],I=e=>e.startsWith("-")?e:F.some(s=>e.startsWith(s))?`-${N.dashCase(e)}`:N.dashCase(e),y=async(e,s="",t,a=!1)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const o=new Set,S=Object.entries(e),$=async([p,r])=>{var C;const n=p.trim(),w=I(n),l=(c,d=";")=>`${w}:${c}${d}`,P={scope:s,config:t};if(typeof r=="function")return $([p,r(P)]);if(r instanceof Promise)return $([p,await r]);if(t!=null&&t.templates&&t.templatePaths[n])try{const[c,d]=t.templatePaths[n].split(";;"),i=await import(d),f=d.includes("salty.config"),u=f?i[c].templates:i[c],h=f?u[n]:u.params[n];if(u&&typeof h=="function"){const E=await h(r),[m]=await y(E,"");return m}}catch(c){console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`,c);return}if(t!=null&&t.templates&&t.templates[n]){if(a)return;const d=r.split(".").reduce((i,f)=>i[f],t.templates[n]);if(d){const[i]=await y(d,"");return i}console.warn(`Template "${n}" with path of "${r}" was not found in config!`);return}if(typeof r=="object"){if(!r)return;if(r.isColor)return l(r.toString());if(n==="defaultVariants")return;if(n==="variants"){const i=Object.entries(r);for(const[f,u]of i){if(!u)continue;const h=Object.entries(u);for(const[E,m]of h){if(!m)continue;const x=`${s}.${f}-${E}`;(await y(m,x,t)).forEach(J=>o.add(J))}}return}if(n==="compoundVariants"){for(const i of r){const{css:f,...u}=i,h=Object.entries(u).reduce((m,[x,z])=>`${m}.${x}-${z}`,s);(await y(f,h,t)).forEach(m=>o.add(m))}return}if(n.startsWith("@")){const i=((C=t==null?void 0:t.mediaQueries)==null?void 0:C[n])||n,f=await W(r,s,t),u=`${i} { ${f} }`;o.add(u);return}const c=p.includes("&")?n.replace("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await y(r,c,t)).forEach(i=>o.add(i));return}if(typeof r=="number"){const c=_(w,r,t);return l(c)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${w}`);return l(r)},j=S.map($),{modifiers:A}=t||{},b=[N.parseValueTokens(),M(A)],O=(await Promise.all(j).then(p=>Promise.all(p.map(r=>b.reduce(async(n,w)=>{const l=await n;if(!l)return l;const P=await w(l);if(!P)return l;const{transformed:C,additionalCss:c}=P;let d="";if(c)for(const i of c)d+=await W(i,"");return`${d}${C}`},Promise.resolve(r)))))).filter(p=>p!==void 0).join(`
1
+ "use strict";const N=require("./parse-tokens-DfRKmjt1.cjs"),M=e=>s=>{if(typeof s!="string"||!e)return;let t=s;const a=[];return Object.values(e).forEach(o=>{const{pattern:S,transform:$}=o;t=t.replace(S,j=>{const{value:A,css:b}=$(j);return b&&a.push(b),A})}),{transformed:t,additionalCss:a}},H=e=>String.fromCharCode(e+(e>25?39:97)),T=(e,s)=>{let t="",a;for(a=Math.abs(e);a>52;a=a/52|0)t=H(a%52)+t;return t=H(a%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},U=(e,s)=>{let t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return e},q=(e,s=5)=>{const t=U(5381,JSON.stringify(e))>>>0;return T(t,s)},Q=["top","right","bottom","left","min-width",/.*width.*/,/^[^line]*height.*/,/padding.*/,/margin.*/,/border.*/,/inset.*/,/.*radius.*/,/.*spacing.*/,/.*gap.*/,/.*indent.*/,/.*offset.*/,/.*size.*/,/.*thickness.*/,/.*font-size.*/],_=(e,s,t)=>{if(Q.some(o=>typeof o=="string"?o===e:o.test(e))){const o=(t==null?void 0:t.defaultUnit)||"px";return`${s}${o}`}return`${s}`},F=["Webkit","Moz","ms","O"],I=e=>e.startsWith("-")?e:F.some(s=>e.startsWith(s))?`-${N.dashCase(e)}`:N.dashCase(e),y=async(e,s="",t,a=!1)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const o=new Set,S=Object.entries(e),$=async([l,r])=>{var C;const n=l.trim(),w=I(n),p=(c,d=";")=>`${w}:${c}${d}`,P={scope:s,config:t};if(typeof r=="function")return $([l,r(P)]);if(r instanceof Promise)return $([l,await r]);if(t!=null&&t.templates&&t.templatePaths[n])try{const[c,d]=t.templatePaths[n].split(";;"),i=await import(d),f=d.includes("salty.config"),u=f?i[c].templates:i[c],h=f?u[n]:u.params[n];if(u&&typeof h=="function"){const E=await h(r),[m]=await y(E,"");return m}}catch(c){console.error(`Error loading template "${n}" from path "${t.templatePaths[n]}"`,c);return}if(t!=null&&t.templates&&t.templates[n]){if(a)return;const d=r.split(".").reduce((i,f)=>i[f],t.templates[n]);if(d){const[i]=await y(d,"");return i}console.warn(`Template "${n}" with path of "${r}" was not found in config!`);return}if(typeof r=="object"){if(!r)return;if(r.isColor)return p(r.toString());if(n==="defaultVariants")return;if(n==="variants"){const i=Object.entries(r);for(const[f,u]of i){if(!u)continue;const h=Object.entries(u);for(const[E,m]of h){if(!m)continue;const x=`${s}.${f}-${E}`;(await y(m,x,t)).forEach(J=>o.add(J))}}return}if(n==="compoundVariants"){for(const i of r){const{css:f,...u}=i,h=Object.entries(u).reduce((m,[x,z])=>`${m}.${x}-${z}`,s);(await y(f,h,t)).forEach(m=>o.add(m))}return}if(n.startsWith("@")){const i=((C=t==null?void 0:t.mediaQueries)==null?void 0:C[n])||n,f=await W(r,s,t),u=`${i} { ${f} }`;o.add(u);return}const c=l.includes("&")?n.replaceAll("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await y(r,c,t)).forEach(i=>o.add(i));return}if(typeof r=="number"){const c=_(w,r,t);return p(c)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${w}`);return p(r)},j=S.map($),{modifiers:A}=t||{},b=[N.parseValueTokens(),M(A)],O=(await Promise.all(j).then(l=>Promise.all(l.map(r=>b.reduce(async(n,w)=>{const p=await n;if(!p)return p;const P=await w(p);if(!P)return p;const{transformed:C,additionalCss:c}=P;let d="";if(c)for(const i of c)d+=await W(i,"");return`${d}${C}`},Promise.resolve(r)))))).filter(l=>l!==void 0).join(`
2
2
  `);if(!O.trim())return Array.from(o);const V=s?`${s} {
3
3
  ${O}
4
4
  }`:O;return o.has(V)?Array.from(o):[V,...o]},W=async(e,s,t,a=!1)=>(await y(e,s,t,a)).join(`
package/styled.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-BvW5rzpp.cjs"),h=require("./element-factory-DjYdX8Jd.cjs");class g extends m.StylesGenerator{constructor(e,t){super(t),this.tagName=e,this._params=t}get priority(){var e;return this.params.priority?this.params.priority:typeof this.tagName=="function"||typeof this.tagName=="object"?(((e=this.tagName.generator)==null?void 0:e.priority)||0)+1:0}get clientProps(){const{element:e,variants:t={},compoundVariants:s=[],defaultVariants:d={},defaultProps:l={},passProps:u}=this.params,{callerName:y,isProduction:f}=this.buildContext,o=new Set([]),i=r=>{const a=d[r];a!==void 0?o.add(`${r}=${String(a)}`):o.add(r)};Object.keys(t).forEach(i),s.map(r=>Object.keys(r).forEach(i));const c=new Set([]);if(this.params.base){const r=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);r&&r.forEach(a=>{const p=a.replace(/\{props\.([\w\d]+)\}/gi,"$1");p&&c.add(p)})}return{element:e,variantKeys:[...o],propValueKeys:[...c],passProps:u,defaultProps:l,attr:{"data-component-name":f?void 0:y}}}}const b=(n,e)=>{const t=new g(n,e),s=h.elementFactory(n,t.cssClassName,t.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(s,{generator:t}),s};exports.styled=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-DvtuxJMl.cjs"),h=require("./element-factory-DjYdX8Jd.cjs");class g extends m.StylesGenerator{constructor(e,t){super(t),this.tagName=e,this._params=t}get priority(){var e;return this.params.priority?this.params.priority:typeof this.tagName=="function"||typeof this.tagName=="object"?(((e=this.tagName.generator)==null?void 0:e.priority)||0)+1:0}get clientProps(){const{element:e,variants:t={},compoundVariants:s=[],defaultVariants:d={},defaultProps:l={},passProps:u}=this.params,{callerName:y,isProduction:f}=this.buildContext,o=new Set([]),i=r=>{const a=d[r];a!==void 0?o.add(`${r}=${String(a)}`):o.add(r)};Object.keys(t).forEach(i),s.map(r=>Object.keys(r).forEach(i));const c=new Set([]);if(this.params.base){const r=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);r&&r.forEach(a=>{const p=a.replace(/\{props\.([\w\d]+)\}/gi,"$1");p&&c.add(p)})}return{element:e,variantKeys:[...o],propValueKeys:[...c],passProps:u,defaultProps:l,attr:{"data-component-name":f?void 0:y}}}}const b=(n,e)=>{const t=new g(n,e),s=h.elementFactory(n,t.cssClassName,t.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(s,{generator:t}),s};exports.styled=b;
package/styled.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as y } from "./styles-generator-Bn-B7D2c.js";
1
+ import { S as y } from "./styles-generator-QutiM0qS.js";
2
2
  import { e as h } from "./element-factory-B1PSIJV4.js";
3
3
  class g extends y {
4
4
  constructor(e, t) {
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var l=(a,s,t)=>s in a?c(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var o=(a,s,t)=>l(a,typeof s!="symbol"?s+"":s,t);const n=require("./parse-styles-Dbs9sKzP.cjs"),h=require("./parse-tokens-DfRKmjt1.cjs");class u{constructor(s){o(this,"buildContext",{});this.params=s}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){const{base:s,variants:t,compoundVariants:e}=this.params;return n.toHash({base:s,variants:t,compoundVariants:e})}get cssClassName(){return this.hash}get classNames(){const s=new Set([this.cssClassName]),{className:t}=this.params;return typeof t=="string"&&s.add(t),typeof t=="object"&&t.forEach(e=>s.add(e)),this.getTemplateClasses().forEach(e=>s.add(e)),this.buildContext.classNames&&this.buildContext.classNames.forEach(e=>s.add(e)),[...s].join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${h.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:e=[]}=this.params,{config:r}=this.buildContext,i={...s,variants:t,compoundVariants:e};return n.parseAndJoinStyles(i,`.${this.cssClassName}`,r,this.isRoot)}getTemplateClasses(s=this.buildContext.config){if(!(s!=null&&s.templates)||!this.params.base||this.priority>0)return[];const t=Object.keys(s.templates);return Object.entries(this.params.base).reduce((e,[r,i])=>(t.includes(r)&&e.push("t_"+n.toHash(h.dashCase(`${r}-${i}`),4)),e),[])}_withBuildContext(s){return this.buildContext=s,this}}exports.StylesGenerator=u;
1
+ "use strict";var c=Object.defineProperty;var l=(a,s,t)=>s in a?c(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var o=(a,s,t)=>l(a,typeof s!="symbol"?s+"":s,t);const n=require("./parse-styles-DqNFvgCM.cjs"),h=require("./parse-tokens-DfRKmjt1.cjs");class u{constructor(s){o(this,"buildContext",{});this.params=s}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){const{base:s,variants:t,compoundVariants:e}=this.params;return n.toHash({base:s,variants:t,compoundVariants:e})}get cssClassName(){return this.hash}get classNames(){const s=new Set([this.cssClassName]),{className:t}=this.params;return typeof t=="string"&&s.add(t),typeof t=="object"&&t.forEach(e=>s.add(e)),this.getTemplateClasses().forEach(e=>s.add(e)),this.buildContext.classNames&&this.buildContext.classNames.forEach(e=>s.add(e)),[...s].join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${h.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:e=[]}=this.params,{config:r}=this.buildContext,i={...s,variants:t,compoundVariants:e};return n.parseAndJoinStyles(i,`.${this.cssClassName}`,r,this.isRoot)}getTemplateClasses(s=this.buildContext.config){if(!(s!=null&&s.templates)||!this.params.base||this.priority>0)return[];const t=Object.keys(s.templates);return Object.entries(this.params.base).reduce((e,[r,i])=>(t.includes(r)&&e.push("t_"+n.toHash(h.dashCase(`${r}-${i}`),4)),e),[])}_withBuildContext(s){return this.buildContext=s,this}}exports.StylesGenerator=u;
@@ -1,7 +1,7 @@
1
1
  var c = Object.defineProperty;
2
2
  var l = (a, s, t) => s in a ? c(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
3
3
  var o = (a, s, t) => l(a, typeof s != "symbol" ? s + "" : s, t);
4
- import { t as n, p as d } from "./parse-styles-BmW7IL0U.js";
4
+ import { t as n, p as d } from "./parse-styles-BbXScIK9.js";
5
5
  import { d as h } from "./parse-tokens-CssTiO78.js";
6
6
  class C {
7
7
  constructor(s) {