@salty-css/core 0.0.1-alpha.127 → 0.0.1-alpha.128
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 +18 -14
- package/package.json +1 -1
package/generator/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var y=Object.defineProperty;var f=(a,t,s)=>t in a?y(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var c=(a,t,s)=>f(a,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../dash-case-BJEkFEGQ.cjs"),u=require("../parse-templates-DIOn-gO_.cjs");class N{constructor(t,s){c(this,"_isProd");c(this,"_callerName");c(this,"_context");this.tagName=t,this.params=s}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: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_${d.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?u.getTemplateKeys(this._context.config.templates):[]}get css(){var
|
1
|
+
"use strict";var y=Object.defineProperty;var f=(a,t,s)=>t in a?y(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var c=(a,t,s)=>f(a,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../dash-case-BJEkFEGQ.cjs"),u=require("../parse-templates-DIOn-gO_.cjs");class N{constructor(t,s){c(this,"_isProd");c(this,"_callerName");c(this,"_context");this.tagName=t,this.params=s}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: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_${d.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?u.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 u.parseStyles(r,`.${this.cssClassName}`,this.priority,(n=this._context)==null?void 0:n.config)}get props(){const{element:t,variants:s={},compoundVariants:i=[],defaultVariants:r={},defaultProps:n={},passProps:g}=this.params,h=new Set([]),p=e=>{const o=r[e];o!==void 0?h.add(`${e}=${String(o)}`):h.add(e)};Object.keys(s).forEach(p),i.map(e=>Object.keys(e).forEach(p));const l=new Set([]);if(this.params.base){const e=JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);e&&e.forEach(o=>{const m=o.replace(/\{props\.([\w\d]+)\}/gi,"$1");m&&l.add(m)})}return{element:t,variantKeys:[...h],propValueKeys:[...l],passProps:g,defaultProps:n,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=N;
|
package/generator/index.js
CHANGED
@@ -35,26 +35,30 @@ class v {
|
|
35
35
|
return (t = this._context) != null && t.config.templates ? N(this._context.config.templates) : [];
|
36
36
|
}
|
37
37
|
get css() {
|
38
|
-
var
|
39
|
-
const { base: t = {}, variants: s = {}, compoundVariants:
|
40
|
-
return _(r, `.${this.cssClassName}`, this.priority, (
|
38
|
+
var n;
|
39
|
+
const { base: t = {}, variants: s = {}, compoundVariants: i = [] } = this.params, r = { ...t, variants: s, compoundVariants: i };
|
40
|
+
return _(r, `.${this.cssClassName}`, this.priority, (n = this._context) == null ? void 0 : n.config);
|
41
41
|
}
|
42
42
|
get props() {
|
43
|
-
const { element: t, variants: s = {}, compoundVariants:
|
44
|
-
const
|
45
|
-
|
43
|
+
const { element: t, variants: s = {}, compoundVariants: i = [], defaultVariants: r = {}, defaultProps: n = {}, passProps: d } = this.params, h = /* @__PURE__ */ new Set([]), p = (e) => {
|
44
|
+
const o = r[e];
|
45
|
+
o !== void 0 ? h.add(`${e}=${String(o)}`) : h.add(e);
|
46
46
|
};
|
47
|
-
Object.keys(s).forEach(p),
|
48
|
-
const m = /* @__PURE__ */ new Set([])
|
49
|
-
|
50
|
-
const
|
51
|
-
|
52
|
-
|
47
|
+
Object.keys(s).forEach(p), i.map((e) => Object.keys(e).forEach(p));
|
48
|
+
const m = /* @__PURE__ */ new Set([]);
|
49
|
+
if (this.params.base) {
|
50
|
+
const e = JSON.stringify(this.params.base).match(/\{props\.([\w\d]+)\}/gi);
|
51
|
+
e && e.forEach((o) => {
|
52
|
+
const l = o.replace(/\{props\.([\w\d]+)\}/gi, "$1");
|
53
|
+
l && m.add(l);
|
54
|
+
});
|
55
|
+
}
|
56
|
+
return {
|
53
57
|
element: t,
|
54
58
|
variantKeys: [...h],
|
55
59
|
propValueKeys: [...m],
|
56
60
|
passProps: d,
|
57
|
-
defaultProps:
|
61
|
+
defaultProps: n,
|
58
62
|
attr: {
|
59
63
|
"data-component-name": this._isProd ? void 0 : this._callerName
|
60
64
|
}
|
@@ -62,7 +66,7 @@ class v {
|
|
62
66
|
}
|
63
67
|
_withBuildContext(t) {
|
64
68
|
this._context = t;
|
65
|
-
const { name: s, config:
|
69
|
+
const { name: s, config: i, prod: r } = t;
|
66
70
|
return this._isProd = r, this._callerName = s, this;
|
67
71
|
}
|
68
72
|
}
|