@salty-css/react 0.0.1-alpha.125 → 0.0.1-alpha.126

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