@salty-css/react 0.0.1-alpha.184 → 0.0.1-alpha.186

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.
Files changed (3) hide show
  1. package/package.json +2 -2
  2. package/styled.cjs +1 -1
  3. package/styled.js +27 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/react",
3
- "version": "0.0.1-alpha.184",
3
+ "version": "0.0.1-alpha.186",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -54,7 +54,7 @@
54
54
  }
55
55
  },
56
56
  "dependencies": {
57
- "@salty-css/core": "^0.0.1-alpha.184",
57
+ "@salty-css/core": "^0.0.1-alpha.186",
58
58
  "clsx": ">=2.x",
59
59
  "react": ">=19.x || >=18.3.x"
60
60
  }
package/styled.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty;var g=(e,t,s)=>t in e?y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var c=(e,t,s)=>g(e,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./parse-styles-JzVmxd-u.cjs"),f=require("./parse-tokens-p68muVgG.cjs"),N=require("./element-factory-D4kpeFoW.cjs"),_=e=>Object.keys(e);class b{constructor(t,s){c(this,"_isProd");c(this,"_callerName");c(this,"_context");this.tagName=t,this.params=s}get hash(){return u.toHash(this.params.base||this.params)}get priority(){var t;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((t=this.tagName.generator)==null?void 0:t.priority)||0)+1:0}get classNames(){const t=[this.hash],{className:s}=this.params;return s&&t.push(s),t.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get cssFileName(){return this._callerName?`c_${f.dashCase(this._callerName)}-${this.hash}-${this.priority}.css`:`${this.hash}-${this.priority}.css`}get templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?_(this._context.config.templates):[]}get css(){var n;const{base:t={},variants:s={},compoundVariants:r=[]}=this.params,i={...t,variants:s,compoundVariants:r};return u.parseStyles(i,`.${this.cssClassName}`,(n=this._context)==null?void 0:n.config)}get props(){const{element:t,variants:s={},compoundVariants:r=[],defaultVariants:i={},defaultProps:p={},passProps:n}=this.params,h=new Set([]),l=a=>{const o=i[a];o!==void 0?h.add(`${a}=${String(o)}`):h.add(a)};Object.keys(s).forEach(l),r.map(a=>Object.keys(a).forEach(l));const m=new Set([]);if(this.params.base){const a=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);a&&a.forEach(o=>{const d=o.replace(/\{props\.([\w\d]+)\}/gi,"$1");d&&m.add(d)})}return{element:t,variantKeys:[...h],propValueKeys:[...m],passProps:n,defaultProps:p,attr:{"data-component-name":this._isProd?void 0:this._callerName}}}_withBuildContext(t){this._context=t;const{name:s,config:r,prod:i}=t;return this._isProd=i,this._callerName=s,this}}const $=(e,t)=>{const s=new b(e,t),r=N.elementFactory(e,s.cssClassName,s.props,{"data-unoptimized-client-component":!0});return Object.assign(r,{generator:s}),r};exports.styled=$;
1
+ "use strict";var y=Object.defineProperty;var f=(e,t,s)=>t in e?y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var c=(e,t,s)=>f(e,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./parse-styles-JzVmxd-u.cjs"),g=require("./parse-tokens-p68muVgG.cjs"),N=require("./element-factory-D4kpeFoW.cjs"),_=e=>Object.keys(e);class b{constructor(t,s){c(this,"_isProd");c(this,"_callerName");c(this,"_context");this.tagName=t,this.params=s}get hash(){return u.toHash(this.params.base||this.params)}get priority(){var t;return typeof this.tagName=="function"||typeof this.tagName=="object"?(((t=this.tagName.generator)==null?void 0:t.priority)||0)+1:0}get classNames(){const t=[this.hash],{className:s}=this.params;return typeof s=="string"&&t.push(s),typeof s=="object"&&t.push(...s),t.join(" ")}get cssClassName(){return this.hash}get cssDisplayNameVar(){return`--${this.hash}-display-name: ${this._callerName};`}get cssFileName(){return this._callerName?`c_${g.dashCase(this._callerName)}-${this.hash}-${this.priority}.css`:`${this.hash}-${this.priority}.css`}get templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?_(this._context.config.templates):[]}get css(){var n;const{base:t={},variants:s={},compoundVariants:r=[]}=this.params,i={...t,variants:s,compoundVariants:r};return u.parseStyles(i,`.${this.cssClassName}`,(n=this._context)==null?void 0:n.config)}get props(){const{element:t,variants:s={},compoundVariants:r=[],defaultVariants:i={},defaultProps:p={},passProps:n}=this.params,h=new Set([]),l=a=>{const o=i[a];o!==void 0?h.add(`${a}=${String(o)}`):h.add(a)};Object.keys(s).forEach(l),r.map(a=>Object.keys(a).forEach(l));const m=new Set([]);if(this.params.base){const a=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);a&&a.forEach(o=>{const d=o.replace(/\{props\.([\w\d]+)\}/gi,"$1");d&&m.add(d)})}return{element:t,variantKeys:[...h],propValueKeys:[...m],passProps:n,defaultProps:p,attr:{"data-component-name":this._isProd?void 0:this._callerName}}}_withBuildContext(t){this._context=t;const{name:s,config:r,prod:i}=t;return this._isProd=i,this._callerName=s,this}}const $=(e,t)=>{const s=new b(e,t),r=N.elementFactory(e,s.cssClassName,s.props,{"data-unoptimized-client-component":!0});return Object.assign(r,{generator:s}),r};exports.styled=$;
package/styled.js CHANGED
@@ -1,27 +1,27 @@
1
1
  var u = Object.defineProperty;
2
- var f = (e, s, t) => s in e ? u(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
- var c = (e, s, t) => f(e, typeof s != "symbol" ? s + "" : s, t);
4
- import { t as g, p as y } from "./parse-styles-lB6EJuGj.js";
2
+ var f = (e, t, s) => t in e ? u(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var c = (e, t, s) => f(e, typeof t != "symbol" ? t + "" : t, s);
4
+ import { t as y, p as g } from "./parse-styles-lB6EJuGj.js";
5
5
  import { d as N } from "./parse-tokens-YUi047xd.js";
6
6
  import { e as _ } from "./element-factory-C7JVLDq7.js";
7
- const $ = (e) => Object.keys(e);
8
- class b {
9
- constructor(s, t) {
7
+ const b = (e) => Object.keys(e);
8
+ class $ {
9
+ constructor(t, s) {
10
10
  c(this, "_isProd");
11
11
  c(this, "_callerName");
12
12
  c(this, "_context");
13
- this.tagName = s, this.params = t;
13
+ this.tagName = t, this.params = s;
14
14
  }
15
15
  get hash() {
16
- return g(this.params.base || this.params);
16
+ return y(this.params.base || this.params);
17
17
  }
18
18
  get priority() {
19
- var s;
20
- return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((s = this.tagName.generator) == null ? void 0 : s.priority) || 0) + 1 : 0;
19
+ var t;
20
+ return typeof this.tagName == "function" || typeof this.tagName == "object" ? (((t = this.tagName.generator) == null ? void 0 : t.priority) || 0) + 1 : 0;
21
21
  }
22
22
  get classNames() {
23
- const s = [this.hash], { className: t } = this.params;
24
- return t && s.push(t), s.join(" ");
23
+ const t = [this.hash], { className: s } = this.params;
24
+ return typeof s == "string" && t.push(s), typeof s == "object" && t.push(...s), t.join(" ");
25
25
  }
26
26
  get cssClassName() {
27
27
  return this.hash;
@@ -33,20 +33,20 @@ class b {
33
33
  return this._callerName ? `c_${N(this._callerName)}-${this.hash}-${this.priority}.css` : `${this.hash}-${this.priority}.css`;
34
34
  }
35
35
  get templateKeys() {
36
- var s;
37
- return (s = this._context) != null && s.config.templates ? $(this._context.config.templates) : [];
36
+ var t;
37
+ return (t = this._context) != null && t.config.templates ? b(this._context.config.templates) : [];
38
38
  }
39
39
  get css() {
40
40
  var n;
41
- const { base: s = {}, variants: t = {}, compoundVariants: r = [] } = this.params, i = { ...s, variants: t, compoundVariants: r };
42
- return y(i, `.${this.cssClassName}`, (n = this._context) == null ? void 0 : n.config);
41
+ const { base: t = {}, variants: s = {}, compoundVariants: r = [] } = this.params, i = { ...t, variants: s, compoundVariants: r };
42
+ return g(i, `.${this.cssClassName}`, (n = this._context) == null ? void 0 : n.config);
43
43
  }
44
44
  get props() {
45
- const { element: s, variants: t = {}, compoundVariants: r = [], defaultVariants: i = {}, defaultProps: p = {}, passProps: n } = this.params, h = /* @__PURE__ */ new Set([]), m = (a) => {
45
+ const { element: t, variants: s = {}, compoundVariants: r = [], defaultVariants: i = {}, defaultProps: p = {}, passProps: n } = this.params, h = /* @__PURE__ */ new Set([]), m = (a) => {
46
46
  const o = i[a];
47
47
  o !== void 0 ? h.add(`${a}=${String(o)}`) : h.add(a);
48
48
  };
49
- Object.keys(t).forEach(m), r.map((a) => Object.keys(a).forEach(m));
49
+ Object.keys(s).forEach(m), r.map((a) => Object.keys(a).forEach(m));
50
50
  const l = /* @__PURE__ */ new Set([]);
51
51
  if (this.params.base) {
52
52
  const a = JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);
@@ -56,7 +56,7 @@ class b {
56
56
  });
57
57
  }
58
58
  return {
59
- element: s,
59
+ element: t,
60
60
  variantKeys: [...h],
61
61
  propValueKeys: [...l],
62
62
  passProps: n,
@@ -66,20 +66,20 @@ class b {
66
66
  }
67
67
  };
68
68
  }
69
- _withBuildContext(s) {
70
- this._context = s;
71
- const { name: t, config: r, prod: i } = s;
72
- return this._isProd = i, this._callerName = t, this;
69
+ _withBuildContext(t) {
70
+ this._context = t;
71
+ const { name: s, config: r, prod: i } = t;
72
+ return this._isProd = i, this._callerName = s, this;
73
73
  }
74
74
  }
75
- const j = (e, s) => {
76
- const t = new b(e, s), r = _(e, t.cssClassName, t.props, {
75
+ const S = (e, t) => {
76
+ const s = new $(e, t), r = _(e, s.cssClassName, s.props, {
77
77
  "data-unoptimized-client-component": !0
78
78
  });
79
79
  return Object.assign(r, {
80
- generator: t
80
+ generator: s
81
81
  }), r;
82
82
  };
83
83
  export {
84
- j as styled
84
+ S as styled
85
85
  };