@salty-css/react 0.0.1-alpha.191 → 0.0.1-alpha.193

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/keyframes.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./parse-styles-JzVmxd-u.cjs"),j=({animationName:m,params:l,appendInitialStyles:f,...t})=>{const r=m||u.toHash(t),o=(n={})=>{const{duration:e="500ms",easing:s="ease-in-out",delay:a="0s",iterationCount:i="1",direction:d="normal",fillMode:g="forwards",playState:p="running"}={...l,...n},c=`${r} ${e} ${s} ${a} ${i} ${d} ${g} ${p}`;if(!f)return c;const $=t.from||t["0%"];if(!$)return c;const b=u.parseStyles($,"");return`${c};${b}`},y=Object.entries(t).reduce((n,[e,s])=>{if(!s)return n;const a=u.parseStyles(s,""),i=typeof e=="number"?`${e}%`:e;return`${n}${i}{${a}}`},""),S=`@keyframes ${r} {${y}}`;return Object.assign(o,{toString:o,isKeyframes:!0,animationName:r,css:S,keyframes:t}),o};exports.keyframes=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./parse-styles-ExYxradY.cjs"),j=({animationName:m,params:l,appendInitialStyles:f,...t})=>{const r=m||u.toHash(t),o=(n={})=>{const{duration:e="500ms",easing:s="ease-in-out",delay:a="0s",iterationCount:i="1",direction:d="normal",fillMode:g="forwards",playState:p="running"}={...l,...n},c=`${r} ${e} ${s} ${a} ${i} ${d} ${g} ${p}`;if(!f)return c;const $=t.from||t["0%"];if(!$)return c;const b=u.parseStyles($,"");return`${c};${b}`},y=Object.entries(t).reduce((n,[e,s])=>{if(!s)return n;const a=u.parseStyles(s,""),i=typeof e=="number"?`${e}%`:e;return`${n}${i}{${a}}`},""),S=`@keyframes ${r} {${y}}`;return Object.assign(o,{toString:o,isKeyframes:!0,animationName:r,css:S,keyframes:t}),o};exports.keyframes=j;
package/keyframes.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as j, p as m } from "./parse-styles-lB6EJuGj.js";
1
+ import { t as j, p as m } from "./parse-styles-h7jgRe88.js";
2
2
  const N = ({ animationName: u, params: f, appendInitialStyles: l, ...t }) => {
3
3
  const e = u || j(t), o = (s = {}) => {
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.191",
3
+ "version": "0.0.1-alpha.193",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -55,10 +55,14 @@
55
55
  "./config": {
56
56
  "import": "./config.js",
57
57
  "require": "./config.cjs"
58
+ },
59
+ "./helpers": {
60
+ "import": "./helpers.js",
61
+ "require": "./helpers.cjs"
58
62
  }
59
63
  },
60
64
  "dependencies": {
61
- "@salty-css/core": "^0.0.1-alpha.191",
65
+ "@salty-css/core": "^0.0.1-alpha.193",
62
66
  "clsx": ">=2.x",
63
67
  "react": ">=19.x || >=18.3.x"
64
68
  }
@@ -0,0 +1,7 @@
1
+ "use strict";const O=require("./parse-tokens-p68muVgG.cjs"),E=e=>String.fromCharCode(e+(e>25?39:97)),P=(e,s)=>{let t="",n;for(n=Math.abs(e);n>52;n=n/52|0)t=E(n%52)+t;return t=E(n%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},T=(e,s)=>{let t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return e},W=(e,s=5)=>{const t=T(5381,JSON.stringify(e))>>>0;return P(t,s)},k=(e,s)=>{if(typeof e!="string")return{result:e};if(!s)return{result:e};const t=[];return Object.values(s).forEach(n=>{const{pattern:a,transform:S}=n;e=e.replace(a,i=>{const{value:$,css:r}=S(i);return r&&t.push(r),$})}),{result:e,additionalCss:t}},h=(e,s,t)=>{if(!e)return"";const n=[],a=Object.entries(e).reduce((i,[$,r])=>{const o=$.trim(),V=o.startsWith("-")?o:O.dashCase(o),j=(c,u=";")=>i=`${i}${c}${u}`,m=c=>j(`${V}:${c}`);if(typeof r=="function"&&(r=r()),typeof r=="object"){if(!r)return i;if(r.isColor)return m(r.toString()),i;if(o==="variants")return Object.entries(r).forEach(([p,f])=>{f&&Object.entries(f).forEach(([y,d])=>{if(!d)return;const b=`${s}.${p}-${y}`,l=h(d,b,t);n.push(l)})}),i;if(o==="defaultVariants")return i;if(o==="compoundVariants")return r.forEach(p=>{const{css:f,...y}=p,d=Object.entries(y).reduce((l,[H,N])=>`${l}.${H}-${N}`,s),b=h(f,d,t);n.push(b)}),i;if(o.startsWith("@")){const p=h(r,s,t),f=`${o} {
2
+ ${p.replace(`
3
+ `,`
4
+ `)}
5
+ }`;return n.push(f),i}const c=$.includes("&")?o.replace("&",s):o.startsWith(":")?`${s}${o}`:`${s} ${o}`,u=h(r,c,t);return n.push(u),i}if(t!=null&&t.templates&&t.templates[o]){const u=r.split(".").reduce((p,f)=>p[f],t.templates[o]);if(u){const p=h(u,"");return`${i}${p}`}return console.warn(`Template "${o}" with path of "${r}" was not found in config!`),i}if(typeof r=="number")return m(r);if(typeof r!="string")if("toString"in r)r=r.toString();else return i;const{modifiers:w}=t||{},A=function*(){yield O.parseValueTokens(r),yield k(r,w)}();for(const{result:c,additionalCss:u=[]}of A)r=c,u.forEach(p=>{const f=h(p,"");j(f,"")});return m(r)},"");return a?s?[`${s} { ${a} }`,...n].join(`
6
+ `):a:n.join(`
7
+ `)};exports.parseStyles=h;exports.toHash=W;
@@ -15,23 +15,25 @@ const O = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), H = (e, s) => {
15
15
  if (!s) return { result: e };
16
16
  const t = [];
17
17
  return Object.values(s).forEach((n) => {
18
- const { pattern: h, transform: y } = n;
19
- e = e.replace(h, (i) => {
20
- const { value: $, css: r } = y(i);
18
+ const { pattern: a, transform: S } = n;
19
+ e = e.replace(a, (i) => {
20
+ const { value: $, css: r } = S(i);
21
21
  return r && t.push(r), $;
22
22
  });
23
23
  }), { result: e, additionalCss: t };
24
- }, a = (e, s, t) => {
24
+ }, h = (e, s, t) => {
25
25
  if (!e) return "";
26
- const n = [], h = Object.entries(e).reduce((i, [$, r]) => {
27
- const o = $.trim();
26
+ const n = [], a = Object.entries(e).reduce((i, [$, r]) => {
27
+ const o = $.trim(), E = o.startsWith("-") ? o : P(o), j = (c, u = ";") => i = `${i}${c}${u}`, m = (c) => j(`${E}:${c}`);
28
28
  if (typeof r == "function" && (r = r()), typeof r == "object") {
29
29
  if (!r) return i;
30
+ if (r.isColor)
31
+ return m(r.toString()), i;
30
32
  if (o === "variants")
31
33
  return Object.entries(r).forEach(([p, f]) => {
32
- f && Object.entries(f).forEach(([m, d]) => {
34
+ f && Object.entries(f).forEach(([b, d]) => {
33
35
  if (!d) return;
34
- const b = `${s}.${p}-${m}`, l = a(d, b, t);
36
+ const y = `${s}.${p}-${b}`, l = h(d, y, t);
35
37
  n.push(l);
36
38
  });
37
39
  }), i;
@@ -39,30 +41,29 @@ const O = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), H = (e, s) => {
39
41
  return i;
40
42
  if (o === "compoundVariants")
41
43
  return r.forEach((p) => {
42
- const { css: f, ...m } = p, d = Object.entries(m).reduce((l, [A, N]) => `${l}.${A}-${N}`, s), b = a(f, d, t);
43
- n.push(b);
44
+ const { css: f, ...b } = p, d = Object.entries(b).reduce((l, [A, N]) => `${l}.${A}-${N}`, s), y = h(f, d, t);
45
+ n.push(y);
44
46
  }), i;
45
47
  if (o.startsWith("@")) {
46
- const p = a(r, s, t), f = `${o} {
48
+ const p = h(r, s, t), f = `${o} {
47
49
  ${p.replace(`
48
50
  `, `
49
51
  `)}
50
52
  }`;
51
53
  return n.push(f), i;
52
54
  }
53
- const c = $.includes("&") ? o.replace("&", s) : o.startsWith(":") ? `${s}${o}` : `${s} ${o}`, u = a(r, c, t);
55
+ const c = $.includes("&") ? o.replace("&", s) : o.startsWith(":") ? `${s}${o}` : `${s} ${o}`, u = h(r, c, t);
54
56
  return n.push(u), i;
55
57
  }
56
58
  if (t != null && t.templates && t.templates[o]) {
57
59
  const u = r.split(".").reduce((p, f) => p[f], t.templates[o]);
58
60
  if (u) {
59
- const p = a(u, "");
61
+ const p = h(u, "");
60
62
  return `${i}${p}`;
61
63
  }
62
64
  return console.warn(`Template "${o}" with path of "${r}" was not found in config!`), i;
63
65
  }
64
- const E = o.startsWith("-") ? o : P(o), j = (c, u = ";") => i = `${i}${c}${u}`, S = (c) => j(`${E}:${c}`);
65
- if (typeof r == "number") return S(r);
66
+ if (typeof r == "number") return m(r);
66
67
  if (typeof r != "string")
67
68
  if ("toString" in r) r = r.toString();
68
69
  else return i;
@@ -71,16 +72,16 @@ const O = (e) => String.fromCharCode(e + (e > 25 ? 39 : 97)), H = (e, s) => {
71
72
  }();
72
73
  for (const { result: c, additionalCss: u = [] } of w)
73
74
  r = c, u.forEach((p) => {
74
- const f = a(p, "");
75
+ const f = h(p, "");
75
76
  j(f, "");
76
77
  });
77
- return S(r);
78
+ return m(r);
78
79
  }, "");
79
- return h ? s ? [`${s} { ${h} }`, ...n].join(`
80
- `) : h : n.join(`
80
+ return a ? s ? [`${s} { ${a} }`, ...n].join(`
81
+ `) : a : n.join(`
81
82
  `);
82
83
  };
83
84
  export {
84
- a as p,
85
+ h as p,
85
86
  x as t
86
87
  };
package/styled.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-CvvtKU2d.cjs"),g=require("./element-factory-D4kpeFoW.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./styles-generator-CUWHpzaW.cjs"),g=require("./element-factory-D4kpeFoW.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,4 +1,4 @@
1
- import { S as y } from "./styles-generator-DvUWzifu.js";
1
+ import { S as y } from "./styles-generator-D0MGOscb.js";
2
2
  import { e as h } from "./element-factory-C7JVLDq7.js";
3
3
  class g extends y {
4
4
  constructor(e, t) {
@@ -1 +1 @@
1
- "use strict";var h=Object.defineProperty;var o=(e,s,t)=>s in e?h(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var a=(e,s,t)=>o(e,typeof s!="symbol"?s+"":s,t);const r=require("./parse-styles-JzVmxd-u.cjs"),l=require("./parse-tokens-p68muVgG.cjs");class u{constructor(s){a(this,"buildContext",{});this.params=s}get hash(){return r.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const s=[this.hash],{className:t}=this.params;return typeof t=="string"&&s.push(t),typeof t=="object"&&s.push(...t),s.join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${l.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:i=[]}=this.params,{config:n}=this.buildContext,c={...s,variants:t,compoundVariants:i};return r.parseStyles(c,`.${this.cssClassName}`,n)}_withBuildContext(s){return this.buildContext=s,this}}exports.StylesGenerator=u;
1
+ "use strict";var h=Object.defineProperty;var o=(e,s,t)=>s in e?h(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var a=(e,s,t)=>o(e,typeof s!="symbol"?s+"":s,t);const r=require("./parse-styles-ExYxradY.cjs"),l=require("./parse-tokens-p68muVgG.cjs");class u{constructor(s){a(this,"buildContext",{});this.params=s}get hash(){return r.toHash(this.params.base||this.params)}get cssClassName(){return this.hash}get classNames(){const s=[this.hash],{className:t}=this.params;return typeof t=="string"&&s.push(t),typeof t=="object"&&s.push(...t),s.join(" ")}get cssFileName(){const{callerName:s}=this.buildContext;return s?`cl_${l.dashCase(s)}-${this.hash}.css`:`${this.hash}.css`}get css(){const{base:s={},variants:t={},compoundVariants:i=[]}=this.params,{config:n}=this.buildContext,c={...s,variants:t,compoundVariants:i};return r.parseStyles(c,`.${this.cssClassName}`,n)}_withBuildContext(s){return this.buildContext=s,this}}exports.StylesGenerator=u;
@@ -1,7 +1,7 @@
1
1
  var o = Object.defineProperty;
2
2
  var n = (a, s, t) => s in a ? o(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
3
3
  var e = (a, s, t) => n(a, typeof s != "symbol" ? s + "" : s, t);
4
- import { t as c, p as l } from "./parse-styles-lB6EJuGj.js";
4
+ import { t as c, p as l } from "./parse-styles-h7jgRe88.js";
5
5
  import { d as m } from "./parse-tokens-YUi047xd.js";
6
6
  class f {
7
7
  constructor(s) {
@@ -1,7 +0,0 @@
1
- "use strict";const O=require("./parse-tokens-p68muVgG.cjs"),E=e=>String.fromCharCode(e+(e>25?39:97)),P=(e,s)=>{let t="",n;for(n=Math.abs(e);n>52;n=n/52|0)t=E(n%52)+t;return t=E(n%52)+t,t.length<s?t=t.padStart(s,"a"):t.length>s&&(t=t.slice(-s)),t},T=(e,s)=>{let t=s.length;for(;t;)e=e*33^s.charCodeAt(--t);return e},W=(e,s=5)=>{const t=T(5381,JSON.stringify(e))>>>0;return P(t,s)},k=(e,s)=>{if(typeof e!="string")return{result:e};if(!s)return{result:e};const t=[];return Object.values(s).forEach(n=>{const{pattern:a,transform:b}=n;e=e.replace(a,i=>{const{value:$,css:r}=b(i);return r&&t.push(r),$})}),{result:e,additionalCss:t}},h=(e,s,t)=>{if(!e)return"";const n=[],a=Object.entries(e).reduce((i,[$,r])=>{const o=$.trim();if(typeof r=="function"&&(r=r()),typeof r=="object"){if(!r)return i;if(o==="variants")return Object.entries(r).forEach(([p,c])=>{c&&Object.entries(c).forEach(([m,d])=>{if(!d)return;const l=`${s}.${p}-${m}`,y=h(d,l,t);n.push(y)})}),i;if(o==="defaultVariants")return i;if(o==="compoundVariants")return r.forEach(p=>{const{css:c,...m}=p,d=Object.entries(m).reduce((y,[H,N])=>`${y}.${H}-${N}`,s),l=h(c,d,t);n.push(l)}),i;if(o.startsWith("@")){const p=h(r,s,t),c=`${o} {
2
- ${p.replace(`
3
- `,`
4
- `)}
5
- }`;return n.push(c),i}const f=$.includes("&")?o.replace("&",s):o.startsWith(":")?`${s}${o}`:`${s} ${o}`,u=h(r,f,t);return n.push(u),i}if(t!=null&&t.templates&&t.templates[o]){const u=r.split(".").reduce((p,c)=>p[c],t.templates[o]);if(u){const p=h(u,"");return`${i}${p}`}return console.warn(`Template "${o}" with path of "${r}" was not found in config!`),i}const V=o.startsWith("-")?o:O.dashCase(o),S=(f,u=";")=>i=`${i}${f}${u}`,j=f=>S(`${V}:${f}`);if(typeof r=="number")return j(r);if(typeof r!="string")if("toString"in r)r=r.toString();else return i;const{modifiers:w}=t||{},A=function*(){yield O.parseValueTokens(r),yield k(r,w)}();for(const{result:f,additionalCss:u=[]}of A)r=f,u.forEach(p=>{const c=h(p,"");S(c,"")});return j(r)},"");return a?s?[`${s} { ${a} }`,...n].join(`
6
- `):a:n.join(`
7
- `)};exports.parseStyles=h;exports.toHash=W;