@salty-css/react 0.0.1-alpha.251 → 0.0.1-alpha.253
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/{element-factory-B1PSIJV4.js → element-factory-BZyANreM.js} +1 -1
- package/{element-factory-DjYdX8Jd.cjs → element-factory-C2FUkBsK.cjs} +1 -1
- package/keyframes.cjs +1 -1
- package/keyframes.js +1 -1
- package/package.json +2 -2
- package/{parse-styles-BbXScIK9.js → parse-styles-9pzOKdzH.js} +1 -1
- package/{parse-styles-DqNFvgCM.cjs → parse-styles-DWI60Z4z.cjs} +1 -1
- package/parse-tokens-BnDwbP7V.cjs +1 -0
- package/parse-tokens-BqB-N10P.js +12 -0
- package/styled-client.cjs +1 -1
- package/styled-client.js +1 -1
- package/styled.cjs +1 -1
- package/styled.js +17 -16
- package/{styles-generator-DvtuxJMl.cjs → styles-generator-BYrIpvu6.cjs} +1 -1
- package/{styles-generator-QutiM0qS.js → styles-generator-CwRnWDqg.js} +2 -2
- package/parse-tokens-CssTiO78.js +0 -9
- package/parse-tokens-DfRKmjt1.cjs +0 -1
package/class-name.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./styles-generator-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./styles-generator-BYrIpvu6.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,5 +1,5 @@
|
|
1
1
|
import { forwardRef as C, createElement as g } from "react";
|
2
|
-
import { p as N, d as A } from "./parse-tokens-
|
2
|
+
import { p as N, d as A } from "./parse-tokens-BqB-N10P.js";
|
3
3
|
function K(n) {
|
4
4
|
var s, e, t = "";
|
5
5
|
if (typeof n == "string" || typeof n == "number") t += n;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";const K=require("react"),O=require("./parse-tokens-
|
1
|
+
"use strict";const K=require("react"),O=require("./parse-tokens-BnDwbP7V.cjs");function $(n){var s,e,t="";if(typeof n=="string"||typeof n=="number")t+=n;else if(typeof n=="object")if(Array.isArray(n)){var u=n.length;for(s=0;s<u;s++)n[s]&&(e=$(n[s]))&&(t&&(t+=" "),t+=e)}else for(e in n)n[e]&&(t&&(t+=" "),t+=e);return t}function N(){for(var n,s,e=0,t="",u=arguments.length;e<u;e++)(n=arguments[e])&&(s=$(n))&&(t&&(t+=" "),t+=s);return t}const A=["passProps"],F=(n,s="",e={},t)=>{const u=({extend:d=n,element:S=e.element,className:w="",children:V,passProps:o=e.passProps,_vks:r=new Set,...l},C)=>{const f={passProps:o};e.attr&&Object.assign(f,e.attr),t&&Object.assign(f,t),e.defaultProps&&Object.assign(l,e.defaultProps),l&&Object.assign(f,l);const b=new Set([...s.split(" "),...w.split(" ")]),y=typeof d=="function"||typeof d=="object",h=y&&"isStyled"in d,E=y?d:S||d;if(!E)throw new Error("No element provided");const m=f.style||{};f.style||(f.style=m),Object.entries(m).forEach(([i,a])=>{const c=O.parseVariableTokens(a);c&&(m[i]=c.transformed)}),e.propValueKeys&&e.propValueKeys.forEach(i=>{const a=`css-${i}`,c=l[a];if(c===void 0)return;const q=`--props-${O.dashCase(i)}`;m[q]=c,r&&r.add(a)}),e.variantKeys&&e.variantKeys.forEach(i=>{const[a,c]=i.split("=");l[a]!==void 0?(b.add(`${a}-${l[a]}`),r&&r.add(a)):c!==void 0&&b.add(`${a}-${c}`)}),r&&(!y||!h)?r.forEach(i=>{if(!o)return delete f[i];if(o!==!0&&!o.includes(i))return delete f[i]}):h&&Object.assign(f,{_vks:r}),h||A.forEach(i=>delete f[i]);const g=N(...b);return K.createElement(E,{element:y?S:void 0,className:g,ref:C,...f},V)},j=K.forwardRef(u);return Object.assign(j,{isStyled:!0,className:s,toString:()=>`.${s}`}),j};exports.elementFactory=F;
|
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-DWI60Z4z.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.253",
|
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.253",
|
70
70
|
"clsx": ">=2.x",
|
71
71
|
"react": ">=19.x || >=18.3.x"
|
72
72
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";const N=require("./parse-tokens-
|
1
|
+
"use strict";const N=require("./parse-tokens-BnDwbP7V.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(`
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";function s(e){return e?typeof e!="string"?s(String(e)):e.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(r,t)=>(t>0?"-":"")+r.toLowerCase()):""}const a=e=>r=>typeof r!="string"||!/\{[^{}]+\}/g.test(r)?void 0:{transformed:r.replace(/\{([^{}]+)\}/g,(...o)=>{const n=s(o[1].replaceAll(".","-"));return n.startsWith("-")?`-${n}`:`var(--${n})`})},i=a();exports.dashCase=s;exports.parseValueTokens=a;exports.parseVariableTokens=i;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
function a(e) {
|
2
|
+
return e ? typeof e != "string" ? a(String(e)) : e.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (r, t) => (t > 0 ? "-" : "") + r.toLowerCase()) : "";
|
3
|
+
}
|
4
|
+
const o = (e) => (r) => typeof r != "string" || !/\{[^{}]+\}/g.test(r) ? void 0 : { transformed: r.replace(/\{([^{}]+)\}/g, (...s) => {
|
5
|
+
const n = a(s[1].replaceAll(".", "-"));
|
6
|
+
return n.startsWith("-") ? `-${n}` : `var(--${n})`;
|
7
|
+
}) }, f = o();
|
8
|
+
export {
|
9
|
+
o as a,
|
10
|
+
a as d,
|
11
|
+
f as p
|
12
|
+
};
|
package/styled-client.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./element-factory-C2FUkBsK.cjs"),n=(e,t,r)=>l.elementFactory(e,t,r);exports.styledClient=n;
|
package/styled-client.js
CHANGED
package/styled.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./styles-generator-BYrIpvu6.cjs"),g=require("./parse-tokens-BnDwbP7V.cjs"),b=require("./element-factory-C2FUkBsK.cjs");class S 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:f}=this.buildContext,o=new Set([]),i=s=>{const a=d[s];a!==void 0?o.add(`${s}=${String(a)}`):o.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"),m=g.dashCase(p);p&&c.add(m)})}return{element:e,variantKeys:[...o],propValueKeys:[...c],passProps:u,defaultProps:l,attr:{"data-component-name":f?void 0:y}}}}const v=(n,e)=>{const t=new S(n,e),r=b.elementFactory(n,t.cssClassName,t.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(r,{generator:t}),r};exports.styled=v;
|
package/styled.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
import { S as y } from "./styles-generator-
|
2
|
-
import {
|
3
|
-
|
1
|
+
import { S as y } from "./styles-generator-CwRnWDqg.js";
|
2
|
+
import { d as g } from "./parse-tokens-BqB-N10P.js";
|
3
|
+
import { e as b } from "./element-factory-BZyANreM.js";
|
4
|
+
class S extends y {
|
4
5
|
constructor(e, t) {
|
5
6
|
super(t), this.tagName = e, this._params = t;
|
6
7
|
}
|
@@ -9,17 +10,17 @@ class g extends y {
|
|
9
10
|
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;
|
10
11
|
}
|
11
12
|
get clientProps() {
|
12
|
-
const { element: e, variants: t = {}, compoundVariants:
|
13
|
-
const
|
14
|
-
|
13
|
+
const { element: e, variants: t = {}, compoundVariants: s = [], defaultVariants: d = {}, defaultProps: m = {}, passProps: f } = this.params, { callerName: l, isProduction: u } = this.buildContext, o = /* @__PURE__ */ new Set([]), i = (a) => {
|
14
|
+
const r = d[a];
|
15
|
+
r !== void 0 ? o.add(`${a}=${String(r)}`) : o.add(a);
|
15
16
|
};
|
16
|
-
Object.keys(t).forEach(i),
|
17
|
+
Object.keys(t).forEach(i), s.map((a) => Object.keys(a).forEach(i));
|
17
18
|
const c = /* @__PURE__ */ new Set([]);
|
18
19
|
if (this.params.base) {
|
19
|
-
const a = JSON.stringify(this.params.base).match(/\{props\.([
|
20
|
-
a && a.forEach((
|
21
|
-
const p =
|
22
|
-
p && c.add(
|
20
|
+
const a = JSON.stringify(this.params.base).match(/\{-?props\.([^}]+)\}/gi);
|
21
|
+
a && a.forEach((r) => {
|
22
|
+
const p = r.replace(/\{(?:-)?props\.([^}]+)\}/gi, "$1"), h = g(p);
|
23
|
+
p && c.add(h);
|
23
24
|
});
|
24
25
|
}
|
25
26
|
return {
|
@@ -34,14 +35,14 @@ class g extends y {
|
|
34
35
|
};
|
35
36
|
}
|
36
37
|
}
|
37
|
-
const
|
38
|
-
const t = new
|
38
|
+
const K = (n, e) => {
|
39
|
+
const t = new S(n, e), s = b(n, t.cssClassName, t.clientProps, {
|
39
40
|
"data-unoptimized-client-component": !0
|
40
41
|
});
|
41
|
-
return Object.assign(
|
42
|
+
return Object.assign(s, {
|
42
43
|
generator: t
|
43
|
-
}),
|
44
|
+
}), s;
|
44
45
|
};
|
45
46
|
export {
|
46
|
-
|
47
|
+
K as styled
|
47
48
|
};
|
@@ -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-DWI60Z4z.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,8 +1,8 @@
|
|
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-
|
5
|
-
import { d as h } from "./parse-tokens-
|
4
|
+
import { t as n, p as d } from "./parse-styles-9pzOKdzH.js";
|
5
|
+
import { d as h } from "./parse-tokens-BqB-N10P.js";
|
6
6
|
class C {
|
7
7
|
constructor(s) {
|
8
8
|
o(this, "buildContext", {});
|
package/parse-tokens-CssTiO78.js
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
function a(e) {
|
2
|
-
return e ? typeof e != "string" ? a(String(e)) : e.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (r, n) => (n > 0 ? "-" : "") + r.toLowerCase()) : "";
|
3
|
-
}
|
4
|
-
const s = (e) => (r) => typeof r != "string" || !/\{[^{}]+\}/g.test(r) ? void 0 : { transformed: r.replace(/\{([^{}]+)\}/g, (...t) => `var(--${a(t[1].replaceAll(".", "-"))})`) }, f = s();
|
5
|
-
export {
|
6
|
-
s as a,
|
7
|
-
a as d,
|
8
|
-
f as p
|
9
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";function n(e){return e?typeof e!="string"?n(String(e)):e.replace(/[\s.]/g,"-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g,(r,a)=>(a>0?"-":"")+r.toLowerCase()):""}const s=e=>r=>typeof r!="string"||!/\{[^{}]+\}/g.test(r)?void 0:{transformed:r.replace(/\{([^{}]+)\}/g,(...t)=>`var(--${n(t[1].replaceAll(".","-"))})`)},o=s();exports.dashCase=n;exports.parseValueTokens=s;exports.parseVariableTokens=o;
|