@salty-css/react 0.0.1-alpha.209 → 0.0.1-alpha.210
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-BJ7Coj_x.js → parse-styles-BB9_8E25.js} +37 -37
- package/parse-styles-BpWkUvJj.cjs +5 -0
- package/styled.cjs +1 -1
- package/styled.js +1 -1
- package/{styles-generator-DLj4QdG_.js → styles-generator-B6o2r_I5.js} +1 -1
- package/{styles-generator-DlpxCPs6.cjs → styles-generator-kgxoBbAI.cjs} +1 -1
- package/parse-styles-Chqrd-Ic.cjs +0 -5
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-kgxoBbAI.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
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-BpWkUvJj.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.210",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"typings": "./dist/index.d.ts",
|
@@ -62,7 +62,7 @@
|
|
62
62
|
}
|
63
63
|
},
|
64
64
|
"dependencies": {
|
65
|
-
"@salty-css/core": "^0.0.1-alpha.
|
65
|
+
"@salty-css/core": "^0.0.1-alpha.210",
|
66
66
|
"clsx": ">=2.x",
|
67
67
|
"react": ">=19.x || >=18.3.x"
|
68
68
|
}
|
@@ -4,10 +4,10 @@ const J = (e) => (s) => {
|
|
4
4
|
let t = s;
|
5
5
|
const o = [];
|
6
6
|
return Object.values(e).forEach((i) => {
|
7
|
-
const { pattern: A, transform:
|
8
|
-
t = t.replace(A, (
|
9
|
-
const { value:
|
10
|
-
return
|
7
|
+
const { pattern: A, transform: b } = i;
|
8
|
+
t = t.replace(A, (P) => {
|
9
|
+
const { value: C, css: E } = b(P);
|
10
|
+
return E && o.push(E), C;
|
11
11
|
});
|
12
12
|
}), { transformed: t, additionalCss: o };
|
13
13
|
}, z = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), Q = (e, s) => {
|
@@ -50,19 +50,19 @@ const J = (e) => (s) => {
|
|
50
50
|
return `${s}`;
|
51
51
|
}, F = ["Webkit", "Moz", "ms", "O"], I = (e) => e.startsWith("-") ? e : F.some((s) => e.startsWith(s)) ? `-${V(e)}` : V(e), h = async (e, s = "", t, o = !1) => {
|
52
52
|
if (!e) throw new Error("No styles provided to parseStyles function!");
|
53
|
-
const i = /* @__PURE__ */ new Set(),
|
54
|
-
var
|
55
|
-
const n =
|
53
|
+
const i = /* @__PURE__ */ new Set(), b = Object.entries(e).map(async ([l, r]) => {
|
54
|
+
var y;
|
55
|
+
const n = l.trim(), w = I(n), p = (d, f = ";") => `${w}:${d}${f}`;
|
56
56
|
if (typeof r == "function" && (r = r({ scope: s, config: t })), r instanceof Promise && (r = await r), t != null && t.templates && t.templatePaths[n]) {
|
57
|
-
const
|
58
|
-
if (typeof
|
59
|
-
const
|
60
|
-
return
|
57
|
+
const [d, f] = t.templatePaths[n].split(";;"), c = (await import(f))[d];
|
58
|
+
if (c && typeof c.params[n] == "function") {
|
59
|
+
const u = await c.params[n](r), [$] = await h(u, "");
|
60
|
+
return $;
|
61
61
|
}
|
62
62
|
}
|
63
63
|
if (t != null && t.templates && t.templates[n]) {
|
64
64
|
if (o) return;
|
65
|
-
const f = r.split(".").reduce((a,
|
65
|
+
const f = r.split(".").reduce((a, c) => a[c], t.templates[n]);
|
66
66
|
if (f) {
|
67
67
|
const [a] = await h(f, "");
|
68
68
|
return a;
|
@@ -72,16 +72,16 @@ const J = (e) => (s) => {
|
|
72
72
|
}
|
73
73
|
if (typeof r == "object") {
|
74
74
|
if (!r) return;
|
75
|
-
if (r.isColor) return
|
75
|
+
if (r.isColor) return p(r.toString());
|
76
76
|
if (n === "defaultVariants") return;
|
77
77
|
if (n === "variants") {
|
78
78
|
const a = Object.entries(r);
|
79
|
-
for (const [
|
80
|
-
if (!
|
81
|
-
const
|
82
|
-
for (const [N, m] of
|
79
|
+
for (const [c, u] of a) {
|
80
|
+
if (!u) return;
|
81
|
+
const $ = Object.entries(u);
|
82
|
+
for (const [N, m] of $) {
|
83
83
|
if (!m) return;
|
84
|
-
const O = `${s}.${
|
84
|
+
const O = `${s}.${c}-${N}`;
|
85
85
|
(await h(m, O, t)).forEach((U) => i.add(U));
|
86
86
|
}
|
87
87
|
}
|
@@ -89,47 +89,47 @@ const J = (e) => (s) => {
|
|
89
89
|
}
|
90
90
|
if (n === "compoundVariants") {
|
91
91
|
for (const a of r) {
|
92
|
-
const { css:
|
93
|
-
(await h(
|
92
|
+
const { css: c, ...u } = a, $ = Object.entries(u).reduce((m, [O, W]) => `${m}.${O}-${W}`, s);
|
93
|
+
(await h(c, $, t)).forEach((m) => i.add(m));
|
94
94
|
}
|
95
95
|
return;
|
96
96
|
}
|
97
97
|
if (n.startsWith("@")) {
|
98
|
-
const a = ((
|
99
|
-
i.add(
|
98
|
+
const a = ((y = t == null ? void 0 : t.mediaQueries) == null ? void 0 : y[n]) || n, c = await M(r, s, t), u = `${a} { ${c} }`;
|
99
|
+
i.add(u);
|
100
100
|
return;
|
101
101
|
}
|
102
|
-
const d =
|
102
|
+
const d = l.includes("&") ? n.replace("&", s) : n.startsWith(":") ? `${s}${n}` : `${s} ${n}`;
|
103
103
|
(await h(r, d, t)).forEach((a) => i.add(a));
|
104
104
|
return;
|
105
105
|
}
|
106
106
|
if (typeof r == "number") {
|
107
107
|
const d = q(w, r, t);
|
108
|
-
return
|
108
|
+
return p(d);
|
109
109
|
}
|
110
110
|
if (typeof r != "string")
|
111
111
|
if ("toString" in r) r = r.toString();
|
112
112
|
else throw new Error(`Invalid value type for property ${w}`);
|
113
|
-
return
|
114
|
-
}), { modifiers:
|
115
|
-
|
116
|
-
const
|
117
|
-
if (!
|
118
|
-
const
|
119
|
-
if (!
|
120
|
-
const { transformed:
|
113
|
+
return p(r);
|
114
|
+
}), { modifiers: P } = t || {}, C = [H(), J(P)], j = (await Promise.all(b).then((l) => Promise.all(
|
115
|
+
l.map((r) => C.reduce(async (n, w) => {
|
116
|
+
const p = await n;
|
117
|
+
if (!p) return p;
|
118
|
+
const x = await w(p);
|
119
|
+
if (!x) return p;
|
120
|
+
const { transformed: y, additionalCss: d } = x;
|
121
121
|
let f = "";
|
122
122
|
if (d)
|
123
123
|
for (const a of d)
|
124
124
|
f += await M(a, "");
|
125
|
-
return `${f}${
|
125
|
+
return `${f}${y}`;
|
126
126
|
}, Promise.resolve(r)))
|
127
|
-
))).filter((
|
127
|
+
))).filter((l) => l !== void 0).join(`
|
128
128
|
`);
|
129
|
-
if (!
|
129
|
+
if (!j.trim()) return Array.from(i);
|
130
130
|
const S = s ? `${s} {
|
131
|
-
${
|
132
|
-
}` :
|
131
|
+
${j}
|
132
|
+
}` : j;
|
133
133
|
return i.has(S) ? Array.from(i) : [S, ...i];
|
134
134
|
}, M = async (e, s, t, o = !1) => (await h(e, s, t, o)).join(`
|
135
135
|
`);
|
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";const O=require("./parse-tokens-DfRKmjt1.cjs"),M=e=>s=>{if(typeof s!="string"||!e)return;let t=s;const o=[];return Object.values(e).forEach(i=>{const{pattern:N,transform:b}=i;t=t.replace(N,P=>{const{value:C,css:E}=b(P);return E&&o.push(E),C})}),{transformed:t,additionalCss:o}},H=e=>String.fromCharCode(e+(e>25?39:97)),T=(e,s)=>{let t="",o;for(o=Math.abs(e);o>52;o=o/52|0)t=H(o%52)+t;return t=H(o%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(i=>typeof i=="string"?i===e:i.test(e))){const i=(t==null?void 0:t.defaultUnit)||"px";return`${s}${i}`}return`${s}`},F=["Webkit","Moz","ms","O"],I=e=>e.startsWith("-")?e:F.some(s=>e.startsWith(s))?`-${O.dashCase(e)}`:O.dashCase(e),h=async(e,s="",t,o=!1)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const i=new Set,b=Object.entries(e).map(async([l,r])=>{var y;const n=l.trim(),w=I(n),u=(d,f=";")=>`${w}:${d}${f}`;if(typeof r=="function"&&(r=r({scope:s,config:t})),r instanceof Promise&&(r=await r),t!=null&&t.templates&&t.templatePaths[n]){const[d,f]=t.templatePaths[n].split(";;"),c=(await import(f))[d];if(c&&typeof c.params[n]=="function"){const p=await c.params[n](r),[$]=await h(p,"");return $}}if(t!=null&&t.templates&&t.templates[n]){if(o)return;const f=r.split(".").reduce((a,c)=>a[c],t.templates[n]);if(f){const[a]=await h(f,"");return a}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 u(r.toString());if(n==="defaultVariants")return;if(n==="variants"){const a=Object.entries(r);for(const[c,p]of a){if(!p)return;const $=Object.entries(p);for(const[V,m]of $){if(!m)return;const A=`${s}.${c}-${V}`;(await h(m,A,t)).forEach(J=>i.add(J))}}return}if(n==="compoundVariants"){for(const a of r){const{css:c,...p}=a,$=Object.entries(p).reduce((m,[A,z])=>`${m}.${A}-${z}`,s);(await h(c,$,t)).forEach(m=>i.add(m))}return}if(n.startsWith("@")){const a=((y=t==null?void 0:t.mediaQueries)==null?void 0:y[n])||n,c=await S(r,s,t),p=`${a} { ${c} }`;i.add(p);return}const d=l.includes("&")?n.replace("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await h(r,d,t)).forEach(a=>i.add(a));return}if(typeof r=="number"){const d=_(w,r,t);return u(d)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${w}`);return u(r)}),{modifiers:P}=t||{},C=[O.parseValueTokens(),M(P)],j=(await Promise.all(b).then(l=>Promise.all(l.map(r=>C.reduce(async(n,w)=>{const u=await n;if(!u)return u;const x=await w(u);if(!x)return u;const{transformed:y,additionalCss:d}=x;let f="";if(d)for(const a of d)f+=await S(a,"");return`${f}${y}`},Promise.resolve(r)))))).filter(l=>l!==void 0).join(`
|
2
|
+
`);if(!j.trim())return Array.from(i);const W=s?`${s} {
|
3
|
+
${j}
|
4
|
+
}`:j;return i.has(W)?Array.from(i):[W,...i]},S=async(e,s,t,o=!1)=>(await h(e,s,t,o)).join(`
|
5
|
+
`);exports.parseAndJoinStyles=S;exports.toHash=q;
|
package/styled.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-kgxoBbAI.cjs"),g=require("./element-factory-DjYdX8Jd.cjs");class h extends m.StylesGenerator{constructor(e,t){super(t),this.tagName=e,this._params=t}get priority(){var e;return 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:a=[],defaultVariants:d={},defaultProps:l={},passProps:u}=this.params,{callerName:y,isProduction:f}=this.buildContext,o=new Set([]),i=s=>{const r=d[s];r!==void 0?o.add(`${s}=${String(r)}`):o.add(s)};Object.keys(t).forEach(i),a.map(s=>Object.keys(s).forEach(i));const c=new Set([]);if(this.params.base){const s=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);s&&s.forEach(r=>{const p=r.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 h(n,e),a=g.elementFactory(n,t.cssClassName,t.clientProps,{"data-unoptimized-client-component":!0});return Object.assign(a,{generator:t}),a};exports.styled=b;
|
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 h, p as m } from "./parse-styles-
|
4
|
+
import { t as h, p as m } from "./parse-styles-BB9_8E25.js";
|
5
5
|
import { d as n } from "./parse-tokens-CssTiO78.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 h=(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 h=(a,s,t)=>l(a,typeof s!="symbol"?s+"":s,t);const n=require("./parse-styles-BpWkUvJj.cjs"),o=require("./parse-tokens-DfRKmjt1.cjs");class u{constructor(s){h(this,"buildContext",{});this.params=s}get priority(){return 0}get isRoot(){return this.priority===0}get hash(){return n.toHash(this.params.base||this.params)}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_${o.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(o.dashCase(`${r}-${i}`),4)),e),[])}_withBuildContext(s){return this.buildContext=s,this}}exports.StylesGenerator=u;
|
@@ -1,5 +0,0 @@
|
|
1
|
-
"use strict";const O=require("./parse-tokens-DfRKmjt1.cjs"),M=e=>s=>{if(typeof s!="string"||!e)return;let t=s;const o=[];return Object.values(e).forEach(i=>{const{pattern:N,transform:y}=i;t=t.replace(N,b=>{const{value:P,css:C}=y(b);return C&&o.push(C),P})}),{transformed:t,additionalCss:o}},H=e=>String.fromCharCode(e+(e>25?39:97)),T=(e,s)=>{let t="",o;for(o=Math.abs(e);o>52;o=o/52|0)t=H(o%52)+t;return t=H(o%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(i=>typeof i=="string"?i===e:i.test(e))){const i=(t==null?void 0:t.defaultUnit)||"px";return`${s}${i}`}return`${s}`},F=["Webkit","Moz","ms","O"],I=e=>e.startsWith("-")?e:F.some(s=>e.startsWith(s))?`-${O.dashCase(e)}`:O.dashCase(e),h=async(e,s="",t,o=!1)=>{if(!e)throw new Error("No styles provided to parseStyles function!");const i=new Set,y=Object.entries(e).map(async([p,r])=>{var $;const n=p.trim(),w=I(n),f=(d,c=";")=>`${w}:${d}${c}`;if(typeof r=="function"&&(r=r({scope:s,config:t})),r instanceof Promise&&(r=await r),t!=null&&t.templates&&t.templatePaths[n]){const{default:d}=await import(t.templatePaths[n]);if(typeof d.params[n]=="function"){const c=await d.params[n](r),[a]=await h(c,"");return a}}if(t!=null&&t.templates&&t.templates[n]){if(o)return;const c=r.split(".").reduce((a,u)=>a[u],t.templates[n]);if(c){const[a]=await h(c,"");return a}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 f(r.toString());if(n==="defaultVariants")return;if(n==="variants"){const a=Object.entries(r);for(const[u,l]of a){if(!l)return;const x=Object.entries(l);for(const[V,m]of x){if(!m)return;const A=`${s}.${u}-${V}`;(await h(m,A,t)).forEach(J=>i.add(J))}}return}if(n==="compoundVariants"){for(const a of r){const{css:u,...l}=a,x=Object.entries(l).reduce((m,[A,z])=>`${m}.${A}-${z}`,s);(await h(u,x,t)).forEach(m=>i.add(m))}return}if(n.startsWith("@")){const a=(($=t==null?void 0:t.mediaQueries)==null?void 0:$[n])||n,u=await S(r,s,t),l=`${a} { ${u} }`;i.add(l);return}const d=p.includes("&")?n.replace("&",s):n.startsWith(":")?`${s}${n}`:`${s} ${n}`;(await h(r,d,t)).forEach(a=>i.add(a));return}if(typeof r=="number"){const d=_(w,r,t);return f(d)}if(typeof r!="string")if("toString"in r)r=r.toString();else throw new Error(`Invalid value type for property ${w}`);return f(r)}),{modifiers:b}=t||{},P=[O.parseValueTokens(),M(b)],E=(await Promise.all(y).then(p=>Promise.all(p.map(r=>P.reduce(async(n,w)=>{const f=await n;if(!f)return f;const j=await w(f);if(!j)return f;const{transformed:$,additionalCss:d}=j;let c="";if(d)for(const a of d)c+=await S(a,"");return`${c}${$}`},Promise.resolve(r)))))).filter(p=>p!==void 0).join(`
|
2
|
-
`);if(!E.trim())return Array.from(i);const W=s?`${s} {
|
3
|
-
${E}
|
4
|
-
}`:E;return i.has(W)?Array.from(i):[W,...i]},S=async(e,s,t,o=!1)=>(await h(e,s,t,o)).join(`
|
5
|
-
`);exports.parseAndJoinStyles=S;exports.toHash=q;
|