@salty-css/core 0.0.1-alpha.116 → 0.0.1-alpha.117

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.
@@ -1 +1 @@
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 o=(s,t,e)=>g(s,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../dash-case-8PdMJjFC.cjs"),d=require("../parse-templates-lpgqU05M.cjs");class N{constructor(t,e){o(this,"_isProd");o(this,"_callerName");o(this,"_context");this.tagName=t,this.params=e}get hash(){return f.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 templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?d.getTemplateKeys(this._context.config.templates):[]}get css(){var a;const{base:t={},variants:e={},compoundVariants:n=[]}=this.params,i={...t,variants:e,compoundVariants:n};return d.parseStyles(i,`.${this.cssClassName}`,this.priority,(a=this._context)==null?void 0:a.config)}get props(){const{element:t,variants:e={},compoundVariants:n=[],defaultVariants:i={}}=this.params,a=new Set([]),h=r=>{const c=i[r];c!==void 0?a.add(`${r}=${String(c)}`):a.add(r)};Object.keys(e).forEach(h),n.map(r=>Object.keys(r).forEach(h));const p=new Set([]),m=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return m&&m.forEach((r,c,u)=>{const l=u.at(1);l&&p.add(l)}),{element:t,variantKeys:[...a],propValueKeys:[...p],attr:{"data-component-name":this._isProd?void 0:this._callerName}}}_withBuildContext(t){this._context=t;const{name:e,config:n,prod:i}=t;return this._isProd=i,this._callerName=e,this}}exports.StyleComponentGenerator=N;
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 _=require("../dash-case-8PdMJjFC.cjs"),u=require("../parse-templates-lpgqU05M.cjs");class S{constructor(t,e){o(this,"_isProd");o(this,"_callerName");o(this,"_context");this.tagName=t,this.params=e}get hash(){return _.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 templateKeys(){var t;return(t=this._context)!=null&&t.config.templates?u.getTemplateKeys(this._context.config.templates):[]}get css(){var n;const{base:t={},variants:e={},compoundVariants:i=[]}=this.params,r={...t,variants:e,compoundVariants:i};return u.parseStyles(r,`.${this.cssClassName}`,this.priority,(n=this._context)==null?void 0:n.config)}get props(){const{element:t,variants:e={},compoundVariants:i=[],defaultVariants:r={},defaultProps:n={},passProps:y}=this.params,c=new Set([]),h=a=>{const p=r[a];p!==void 0?c.add(`${a}=${String(p)}`):c.add(a)};Object.keys(e).forEach(h),i.map(a=>Object.keys(a).forEach(h));const l=new Set([]),m=/\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));return m&&m.forEach((a,p,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:i,prod:r}=t;return this._isProd=r,this._callerName=e,this}}exports.StyleComponentGenerator=S;
@@ -1,9 +1,9 @@
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 o = (e, t, s) => f(e, typeof t != "symbol" ? t + "" : t, s);
4
- import { t as g } from "../dash-case-D_tXuO4I.js";
5
- import { g as y, p as N } from "../parse-templates-D1FebDfR.js";
6
- class b {
1
+ var g = Object.defineProperty;
2
+ var y = (e, t, s) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var o = (e, t, s) => y(e, typeof t != "symbol" ? t + "" : t, s);
4
+ import { t as N } from "../dash-case-D_tXuO4I.js";
5
+ import { g as _, p as x } from "../parse-templates-D1FebDfR.js";
6
+ class K {
7
7
  constructor(t, s) {
8
8
  o(this, "_isProd");
9
9
  o(this, "_callerName");
@@ -11,7 +11,7 @@ class b {
11
11
  this.tagName = t, this.params = s;
12
12
  }
13
13
  get hash() {
14
- return g(this.params.base || this.params);
14
+ return N(this.params.base || this.params);
15
15
  }
16
16
  get priority() {
17
17
  var t;
@@ -29,27 +29,29 @@ class b {
29
29
  }
30
30
  get templateKeys() {
31
31
  var t;
32
- return (t = this._context) != null && t.config.templates ? y(this._context.config.templates) : [];
32
+ return (t = this._context) != null && t.config.templates ? _(this._context.config.templates) : [];
33
33
  }
34
34
  get css() {
35
- var a;
36
- const { base: t = {}, variants: s = {}, compoundVariants: n = [] } = this.params, i = { ...t, variants: s, compoundVariants: n };
37
- return N(i, `.${this.cssClassName}`, this.priority, (a = this._context) == null ? void 0 : a.config);
35
+ var n;
36
+ const { base: t = {}, variants: s = {}, compoundVariants: i = [] } = this.params, r = { ...t, variants: s, compoundVariants: i };
37
+ return x(r, `.${this.cssClassName}`, this.priority, (n = this._context) == null ? void 0 : n.config);
38
38
  }
39
39
  get props() {
40
- const { element: t, variants: s = {}, compoundVariants: n = [], defaultVariants: i = {} } = this.params, a = /* @__PURE__ */ new Set([]), h = (r) => {
41
- const c = i[r];
42
- c !== void 0 ? a.add(`${r}=${String(c)}`) : a.add(r);
40
+ const { element: t, variants: s = {}, compoundVariants: i = [], defaultVariants: r = {}, defaultProps: n = {}, passProps: u } = this.params, c = /* @__PURE__ */ new Set([]), h = (a) => {
41
+ const p = r[a];
42
+ p !== void 0 ? c.add(`${a}=${String(p)}`) : c.add(a);
43
43
  };
44
- Object.keys(s).forEach(h), n.map((r) => Object.keys(r).forEach(h));
45
- const p = /* @__PURE__ */ new Set([]), m = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
46
- return m && m.forEach((r, c, d) => {
47
- const l = d.at(1);
48
- l && p.add(l);
44
+ Object.keys(s).forEach(h), i.map((a) => Object.keys(a).forEach(h));
45
+ const m = /* @__PURE__ */ new Set([]), l = /\{props\.([\w\d]+)\}/gi.exec(JSON.stringify(this.params.base));
46
+ return l && l.forEach((a, p, f) => {
47
+ const d = f.at(1);
48
+ d && m.add(d);
49
49
  }), {
50
50
  element: t,
51
- variantKeys: [...a],
52
- propValueKeys: [...p],
51
+ variantKeys: [...c],
52
+ propValueKeys: [...m],
53
+ passProps: u,
54
+ defaultProps: n,
53
55
  attr: {
54
56
  "data-component-name": this._isProd ? void 0 : this._callerName
55
57
  }
@@ -57,10 +59,10 @@ class b {
57
59
  }
58
60
  _withBuildContext(t) {
59
61
  this._context = t;
60
- const { name: s, config: n, prod: i } = t;
61
- return this._isProd = i, this._callerName = s, this;
62
+ const { name: s, config: i, prod: r } = t;
63
+ return this._isProd = r, this._callerName = s, this;
62
64
  }
63
65
  }
64
66
  export {
65
- b as StyleComponentGenerator
67
+ K as StyleComponentGenerator
66
68
  };
@@ -3,6 +3,8 @@ export interface GeneratorProps {
3
3
  element?: string;
4
4
  variantKeys?: string[];
5
5
  propValueKeys?: string[];
6
+ passProps?: boolean | string | string[];
7
+ defaultProps?: Record<PropertyKey, unknown>;
6
8
  attr: {
7
9
  [key: string]: any;
8
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/core",
3
- "version": "0.0.1-alpha.116",
3
+ "version": "0.0.1-alpha.117",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
package/types/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export type CreateElementProps = {
7
7
  children?: ReactNode;
8
8
  className?: string;
9
9
  element?: string;
10
- passVariantProps?: boolean | string | string[];
10
+ passProps?: boolean | string | string[];
11
11
  style?: CssProperties | {
12
12
  [key: string]: PropertyValueToken | NeverObj;
13
13
  };
@@ -74,6 +74,8 @@ export interface GeneratorOptions {
74
74
  className?: string;
75
75
  displayName?: string;
76
76
  element?: string;
77
+ passProps?: boolean | string | string[];
78
+ defaultProps?: Record<PropertyKey, unknown>;
77
79
  }
78
80
  interface Base extends CssProperties, CssStyles, CssPseudos, TemplateTokens {
79
81
  }