@salty-css/core 0.0.1-alpha.184 → 0.0.1-alpha.187
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/generator/index.cjs +1 -1
- package/generator/index.js +9 -9
- package/package.json +1 -1
- package/types/index.d.ts +1 -1
package/generator/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var f=Object.defineProperty;var y=(a,t,s)=>t in a?f(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var c=(a,t,s)=>y(a,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../dash-case-BJEkFEGQ.cjs"),g=require("../parse-templates-VIvmVb52.cjs"),N=require("../parse-styles-3zK35muR.cjs");class _{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_${u.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?g.getTemplateKeys(this._context.config.templates):[]}get css(){var n;const{base:t={},variants:s={},compoundVariants:i=[]}=this.params,r={...t,variants:s,compoundVariants:i};return N.parseStyles(r,`.${this.cssClassName}`,(n=this._context)==null?void 0:n.config)}get props(){const{element:t,variants:s={},compoundVariants:i=[],defaultVariants:r={},defaultProps:p={},passProps:n}=this.params,h=new Set([]),l=e=>{const o=r[e];o!==void 0?h.add(`${e}=${String(o)}`):h.add(e)};Object.keys(s).forEach(l),i.map(e=>Object.keys(e).forEach(l));const m=new Set([]);if(this.params.base){const e=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);e&&e.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:i,prod:r}=t;return this._isProd=r,this._callerName=s,this}}exports.StyleComponentGenerator=_;
|
package/generator/index.js
CHANGED
@@ -20,7 +20,7 @@ class K {
|
|
20
20
|
}
|
21
21
|
get classNames() {
|
22
22
|
const s = [this.hash], { className: t } = this.params;
|
23
|
-
return t && s.push(t), s.join(" ");
|
23
|
+
return typeof t == "string" && s.push(t), typeof t == "object" && s.push(...t), s.join(" ");
|
24
24
|
}
|
25
25
|
get cssClassName() {
|
26
26
|
return this.hash;
|
@@ -36,21 +36,21 @@ class K {
|
|
36
36
|
return (s = this._context) != null && s.config.templates ? N(this._context.config.templates) : [];
|
37
37
|
}
|
38
38
|
get css() {
|
39
|
-
var
|
39
|
+
var o;
|
40
40
|
const { base: s = {}, variants: t = {}, compoundVariants: i = [] } = this.params, r = { ...s, variants: t, compoundVariants: i };
|
41
|
-
return _(r, `.${this.cssClassName}`, (
|
41
|
+
return _(r, `.${this.cssClassName}`, (o = this._context) == null ? void 0 : o.config);
|
42
42
|
}
|
43
43
|
get props() {
|
44
|
-
const { element: s, variants: t = {}, compoundVariants: i = [], defaultVariants: r = {}, defaultProps: p = {}, passProps:
|
45
|
-
const
|
46
|
-
|
44
|
+
const { element: s, variants: t = {}, compoundVariants: i = [], defaultVariants: r = {}, defaultProps: p = {}, passProps: o } = this.params, h = /* @__PURE__ */ new Set([]), m = (e) => {
|
45
|
+
const n = r[e];
|
46
|
+
n !== void 0 ? h.add(`${e}=${String(n)}`) : h.add(e);
|
47
47
|
};
|
48
48
|
Object.keys(t).forEach(m), i.map((e) => Object.keys(e).forEach(m));
|
49
49
|
const l = /* @__PURE__ */ new Set([]);
|
50
50
|
if (this.params.base) {
|
51
51
|
const e = JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);
|
52
|
-
e && e.forEach((
|
53
|
-
const d =
|
52
|
+
e && e.forEach((n) => {
|
53
|
+
const d = n.replace(/\{props\.([\w\d]+)\}/gi, "$1");
|
54
54
|
d && l.add(d);
|
55
55
|
});
|
56
56
|
}
|
@@ -58,7 +58,7 @@ class K {
|
|
58
58
|
element: s,
|
59
59
|
variantKeys: [...h],
|
60
60
|
propValueKeys: [...l],
|
61
|
-
passProps:
|
61
|
+
passProps: o,
|
62
62
|
defaultProps: p,
|
63
63
|
attr: {
|
64
64
|
"data-component-name": this._isProd ? void 0 : this._callerName
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
@@ -72,7 +72,7 @@ export type CssStyles = {
|
|
72
72
|
};
|
73
73
|
export type Styles = CssStyles & Variants;
|
74
74
|
export interface GeneratorOptions {
|
75
|
-
className?: string;
|
75
|
+
className?: string | string[];
|
76
76
|
displayName?: string;
|
77
77
|
element?: string;
|
78
78
|
passProps?: boolean | string | string[];
|