@salty-css/react 0.0.1-alpha.255 → 0.0.1-alpha.256
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 +1 -1
- package/class-name.js +1 -1
- package/keyframes.cjs +1 -1
- package/keyframes.js +1 -1
- package/package.json +2 -2
- package/parse-styles-CfxJtQu_.cjs +5 -0
- package/{parse-styles-sSzIlEhG.js → parse-styles-anFzH8TT.js} +1 -1
- package/styled.cjs +1 -1
- package/styled.js +1 -1
- package/{styles-generator-CysDWakn.js → styles-generator-BQCMgM_V.js} +1 -1
- package/{styles-generator-B0g3tMVE.cjs → styles-generator-CihJA9Kx.cjs} +1 -1
- package/parse-styles-D_3y2nqs.cjs +0 -5
package/class-name.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./styles-generator-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./styles-generator-CihJA9Kx.cjs");class u extends i.StylesGenerator{constructor(s){super(s),this._params=s}}const m=t=>{const s=new u(t),r=a=>{const e=new String(a);return Object.assign(e,{get isClassName(){return!0},variant:(n,c)=>{const o=`${n}-${c}`,l=`${e} ${o}`;return r(l)},generator:s}),e};return r(s.cssClassName)};exports.className=m;
|
package/class-name.js
CHANGED
package/keyframes.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./parse-styles-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./parse-styles-CfxJtQu_.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
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salty-css/react",
|
3
|
-
"version": "0.0.1-alpha.
|
3
|
+
"version": "0.0.1-alpha.256",
|
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.
|
69
|
+
"@salty-css/core": "^0.0.1-alpha.256",
|
70
70
|
"clsx": ">=2.x",
|
71
71
|
"react": ">=19.x || >=18.3.x"
|
72
72
|
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";const N=require("./parse-tokens-BnDwbP7V.cjs"),J=r=>s=>{if(typeof s!="string"||!r)return;let t=s;const a=[];return Object.values(r).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}},z=r=>String.fromCharCode(r+(r>25?39:97)),M=(r,s)=>{let t="",a;for(a=Math.abs(r);a>52;a=a/52|0)t=z(a%52)+t;return t=z(a%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},T=(r,s)=>{let t=s.length;for(;t;)r=r*33^s.charCodeAt(--t);return r},U=(r,s=5)=>{const t=T(5381,JSON.stringify(r))>>>0;return M(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.*/],Q=(r,s,t)=>{if(q.some(o=>typeof o=="string"?o===r:o.test(r))){const o=(t==null?void 0:t.defaultUnit)||"px";return`${s}${o}`}return`${s}`},_=["Webkit","Moz","ms","O"],F=r=>r.startsWith("-")?r:_.some(s=>r.startsWith(s))?`-${N.dashCase(r)}`:N.dashCase(r),y=async(r,s="",t,a=!1)=>{if(!r)throw new Error("No styles provided to parseStyles function!");const o=new Set,S=Object.entries(r),$=async([f,e])=>{var C;const n=f.trim().replace(/^\?+/g,""),w=F(n),u=(c,d=";")=>`${w}:${c}${d}`,P={scope:s,config:t};if(typeof e=="function")return $([f,e(P)]);if(e instanceof Promise)return $([f,await e]);if(t!=null&&t.templates&&t.templatePaths[n])try{const[c,d]=t.templatePaths[n].split(";;"),i=await import(d),l=d.includes("salty.config"),p=l?i[c].templates:i[c],h=l?p[n]:p.params[n];if(p&&typeof h=="function"){const E=await h(e),[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=e.split(".").reduce((i,l)=>i[l],t.templates[n]);if(d){const[i]=await y(d,"");return i}console.warn(`Template "${n}" with path of "${e}" was not found in config!`);return}if(typeof e=="object"){if(!e)return;if(e.isColor)return u(e.toString());if(n==="defaultVariants")return;if(n==="variants"){const i=Object.entries(e);for(const[l,p]of i){if(!p)continue;const h=Object.entries(p);for(const[E,m]of h){if(!m)continue;const x=`${s}.${l}-${E}`;(await y(m,x,t)).forEach(H=>o.add(H))}}return}if(n==="compoundVariants"){for(const i of e){const{css:l,...p}=i,h=Object.entries(p).reduce((m,[x,V])=>`${m}.${x}-${V}`,s);(await y(l,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,l=await W(e,s,t),p=`${i} { ${l} }`;o.add(p);return}const c=f.includes("&")?n.replaceAll("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await y(e,c,t)).forEach(i=>o.add(i));return}if(typeof e=="number"){const c=Q(w,e,t);return u(c)}if(typeof e!="string")if("toString"in e)e=e.toString();else throw new Error(`Invalid value type for property ${w}`);return u(e)},j=S.map($),{modifiers:A}=t||{},b=[N.parseValueTokens(),J(A)],O=(await Promise.all(j).then(f=>Promise.all(f.map(e=>b.reduce(async(n,w)=>{const u=await n;if(!u)return u;const P=await w(u);if(!P)return u;const{transformed:C,additionalCss:c}=P;let d="";if(c)for(const i of c)d+=await W(i,"");return`${d}${C}`},Promise.resolve(e)))))).filter(f=>f!==void 0).join(`
|
2
|
+
`);if(!O.trim())return Array.from(o);const v=s?`${s} {
|
3
|
+
${O}
|
4
|
+
}`:O;return o.has(v)?Array.from(o):[v,...o]},W=async(r,s,t,a=!1)=>(await y(r,s,t,a)).join(`
|
5
|
+
`);exports.parseAndJoinStyles=W;exports.toHash=U;
|
@@ -52,7 +52,7 @@ const H = (r) => (s) => {
|
|
52
52
|
if (!r) throw new Error("No styles provided to parseStyles function!");
|
53
53
|
const o = /* @__PURE__ */ new Set(), j = Object.entries(r), y = async ([f, e]) => {
|
54
54
|
var E;
|
55
|
-
const n = f.trim(), w = F(n), m = (c, d = ";") => `${w}:${c}${d}`, P = { scope: s, config: t };
|
55
|
+
const n = f.trim().replace(/^\?+/g, ""), w = F(n), m = (c, d = ";") => `${w}:${c}${d}`, P = { scope: s, config: t };
|
56
56
|
if (typeof e == "function") return y([f, e(P)]);
|
57
57
|
if (e instanceof Promise) return y([f, await e]);
|
58
58
|
if (t != null && t.templates && t.templatePaths[n])
|
package/styled.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./styles-generator-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./styles-generator-CihJA9Kx.cjs"),g=require("./parse-tokens-BnDwbP7V.cjs"),b=require("./element-factory-Dt_Z9aHy.cjs");class v extends h.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:r=[],defaultVariants:d={},defaultProps:l={},passProps:u}=this.params,{callerName:y,isProduction:m}=this.buildContext,n=new Set([]),i=s=>{const a=d[s];a!==void 0?n.add(`${s}=${String(a)}`):n.add(s)};Object.keys(t).forEach(i),r.map(s=>Object.keys(s).forEach(i));const c=new Set([]);if(this.params.base){const s=JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);s&&s.forEach(a=>{const p=a.replace(/\{(?:-)?props\.([^}]+)\}/gi,"$1"),f=g.dashCase(p);p&&c.add(f)})}return{element:e,variantKeys:[...n],propValueKeys:[...c],passProps:u,defaultProps:l,attr:{"data-component-name":m?void 0:y}}}}const S=(o,e)=>{const t=new v(o,e),r=b.elementFactory(o,t.cssClassName,t.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(r,{generator:t}),r};exports.styled=S;
|
package/styled.js
CHANGED
@@ -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-
|
4
|
+
import { t as n, p as d } from "./parse-styles-anFzH8TT.js";
|
5
5
|
import { d as h } from "./parse-tokens-Cbbbt7eO.js";
|
6
6
|
class C {
|
7
7
|
constructor(s) {
|
@@ -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-
|
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-CfxJtQu_.cjs"),h=require("./parse-tokens-BnDwbP7V.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,5 +0,0 @@
|
|
1
|
-
"use strict";const N=require("./parse-tokens-BnDwbP7V.cjs"),J=r=>s=>{if(typeof s!="string"||!r)return;let t=s;const a=[];return Object.values(r).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}},z=r=>String.fromCharCode(r+(r>25?39:97)),M=(r,s)=>{let t="",a;for(a=Math.abs(r);a>52;a=a/52|0)t=z(a%52)+t;return t=z(a%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},T=(r,s)=>{let t=s.length;for(;t;)r=r*33^s.charCodeAt(--t);return r},U=(r,s=5)=>{const t=T(5381,JSON.stringify(r))>>>0;return M(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.*/],Q=(r,s,t)=>{if(q.some(o=>typeof o=="string"?o===r:o.test(r))){const o=(t==null?void 0:t.defaultUnit)||"px";return`${s}${o}`}return`${s}`},_=["Webkit","Moz","ms","O"],F=r=>r.startsWith("-")?r:_.some(s=>r.startsWith(s))?`-${N.dashCase(r)}`:N.dashCase(r),y=async(r,s="",t,a=!1)=>{if(!r)throw new Error("No styles provided to parseStyles function!");const o=new Set,S=Object.entries(r),$=async([f,e])=>{var C;const n=f.trim(),w=F(n),u=(c,d=";")=>`${w}:${c}${d}`,P={scope:s,config:t};if(typeof e=="function")return $([f,e(P)]);if(e instanceof Promise)return $([f,await e]);if(t!=null&&t.templates&&t.templatePaths[n])try{const[c,d]=t.templatePaths[n].split(";;"),i=await import(d),l=d.includes("salty.config"),p=l?i[c].templates:i[c],h=l?p[n]:p.params[n];if(p&&typeof h=="function"){const E=await h(e),[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=e.split(".").reduce((i,l)=>i[l],t.templates[n]);if(d){const[i]=await y(d,"");return i}console.warn(`Template "${n}" with path of "${e}" was not found in config!`);return}if(typeof e=="object"){if(!e)return;if(e.isColor)return u(e.toString());if(n==="defaultVariants")return;if(n==="variants"){const i=Object.entries(e);for(const[l,p]of i){if(!p)continue;const h=Object.entries(p);for(const[E,m]of h){if(!m)continue;const x=`${s}.${l}-${E}`;(await y(m,x,t)).forEach(H=>o.add(H))}}return}if(n==="compoundVariants"){for(const i of e){const{css:l,...p}=i,h=Object.entries(p).reduce((m,[x,V])=>`${m}.${x}-${V}`,s);(await y(l,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,l=await W(e,s,t),p=`${i} { ${l} }`;o.add(p);return}const c=f.includes("&")?n.replaceAll("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await y(e,c,t)).forEach(i=>o.add(i));return}if(typeof e=="number"){const c=Q(w,e,t);return u(c)}if(typeof e!="string")if("toString"in e)e=e.toString();else throw new Error(`Invalid value type for property ${w}`);return u(e)},j=S.map($),{modifiers:A}=t||{},b=[N.parseValueTokens(),J(A)],O=(await Promise.all(j).then(f=>Promise.all(f.map(e=>b.reduce(async(n,w)=>{const u=await n;if(!u)return u;const P=await w(u);if(!P)return u;const{transformed:C,additionalCss:c}=P;let d="";if(c)for(const i of c)d+=await W(i,"");return`${d}${C}`},Promise.resolve(e)))))).filter(f=>f!==void 0).join(`
|
2
|
-
`);if(!O.trim())return Array.from(o);const v=s?`${s} {
|
3
|
-
${O}
|
4
|
-
}`:O;return o.has(v)?Array.from(o):[v,...o]},W=async(r,s,t,a=!1)=>(await y(r,s,t,a)).join(`
|
5
|
-
`);exports.parseAndJoinStyles=W;exports.toHash=U;
|