effcss 2.2.0 → 2.2.1
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/README.md +7 -14
- package/dist/build/define-provider.min.js +2 -2
- package/dist/index.js +1 -1
- package/dist/types/src/constants.d.ts +7 -45
- package/dist/types/src/types.d.ts +58 -48
- package/dist/types/src/utils/browser.d.ts +15 -7
- package/dist/types/src/utils/common.d.ts +12 -10
- package/dist/utils/browser.js +1 -1
- package/dist/utils/common.js +1 -1
- package/package.json +1 -1
- package/dist/types/vitest.config.d.ts +0 -2
package/README.md
CHANGED
|
@@ -73,14 +73,12 @@ First you need to connect the `<style-provider>`:
|
|
|
73
73
|
<!DOCTYPE html>
|
|
74
74
|
<html lang="en">
|
|
75
75
|
<head>
|
|
76
|
-
<!--app-head-->
|
|
77
76
|
<script src="https://unpkg.com/effcss/dist/build/define-provider.min.js" crossorigin="anonymous"></script>
|
|
78
77
|
</head>
|
|
79
78
|
<body>
|
|
80
79
|
<style-provider>
|
|
81
80
|
<div id="root"></div>
|
|
82
81
|
</style-provider>
|
|
83
|
-
<!--app-body-->
|
|
84
82
|
</body>
|
|
85
83
|
</html>
|
|
86
84
|
```
|
|
@@ -105,23 +103,22 @@ import { useRef } from 'react'
|
|
|
105
103
|
|
|
106
104
|
const cardStyle = {
|
|
107
105
|
c: {
|
|
108
|
-
// block
|
|
106
|
+
// BEM block
|
|
109
107
|
_: {
|
|
110
|
-
display: 'flex'
|
|
111
|
-
justifyContent: 'center'
|
|
108
|
+
display: 'flex'
|
|
112
109
|
},
|
|
113
|
-
// element
|
|
110
|
+
// BEM element
|
|
114
111
|
__logo: {
|
|
115
112
|
padding: '2em'
|
|
116
113
|
},
|
|
117
|
-
// boolean element modifier
|
|
114
|
+
// BEM boolean element modifier
|
|
118
115
|
__logo_c_: {
|
|
119
116
|
color: '#888',
|
|
120
117
|
':hover': {
|
|
121
118
|
color: 'black',
|
|
122
119
|
}
|
|
123
120
|
},
|
|
124
|
-
// element modifier with value
|
|
121
|
+
// BEM element modifier with value
|
|
125
122
|
__logo_sz_lg: {
|
|
126
123
|
width: '5rem'
|
|
127
124
|
},
|
|
@@ -131,16 +128,12 @@ const cardStyle = {
|
|
|
131
128
|
':focus': {
|
|
132
129
|
aspectRatio: '1/2'
|
|
133
130
|
}
|
|
134
|
-
},
|
|
135
|
-
body: {
|
|
136
|
-
boxSizing: 'border-box'
|
|
137
131
|
}
|
|
138
132
|
}
|
|
139
133
|
};
|
|
140
134
|
|
|
141
135
|
export const App = (props) => {
|
|
142
136
|
const { css } = props;
|
|
143
|
-
|
|
144
137
|
const stylesRef = useRef();
|
|
145
138
|
if (!stylesRef.current) {
|
|
146
139
|
const cardCSS = css.use(cardStyle);
|
|
@@ -148,7 +141,7 @@ export const App = (props) => {
|
|
|
148
141
|
// just block selector
|
|
149
142
|
block: cardCSS()(),
|
|
150
143
|
// element with modifiers
|
|
151
|
-
|
|
144
|
+
logo: cardCSS('logo')({
|
|
152
145
|
c: '',
|
|
153
146
|
sz: 'lg'
|
|
154
147
|
}),
|
|
@@ -158,7 +151,7 @@ export const App = (props) => {
|
|
|
158
151
|
|
|
159
152
|
// apply attributes to appropriate nodes
|
|
160
153
|
return <div {...styles.block}>
|
|
161
|
-
<div {...styles.
|
|
154
|
+
<div {...styles.logo}>
|
|
162
155
|
...
|
|
163
156
|
</div>
|
|
164
157
|
</div>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* EffCSS v2.2.
|
|
2
|
+
* EffCSS v2.2.1
|
|
3
3
|
* {@link https://gitverse.ru/msabitov/effcss}
|
|
4
4
|
* Copyright (c) Marat Sabitov
|
|
5
5
|
* @license Apache 2.0
|
|
6
6
|
*/
|
|
7
|
-
const t=Object.entries,e=(e,s,i)=>t(e).reduce(s,i),s=t=>"object"==typeof t,i=t=>`{${t}}`,r=Object.assign.bind(Object),n=(t,e)=>`${t}:${e};`,o=(t,e)=>["@property",t,i(n("syntax",e.syn||'"*"')+n("inherits",e.inh||!1)+(e.ini?n("initial-value",e.ini):""))].join(" "),l=t=>`var(${t})`,a=({l:t,c:e,h:s,a:i=1})=>`oklch(${t} ${e} ${s} / ${i})`,c=["l","c","h","a"];class h{constructor(h){this._outerKeys={},this._outerSets={},this._parseSelector=t=>{let e,s,i,r,n;return[e,n]=t.split(":"),e.startsWith("__")?[s,i,r]=e.slice(2).split("_"):[s,i,r]=e.split("_"),{e:s,m:i,mv:r,s:n}},this._prepareVarName=(...t)=>this._resolver.varName(...t),this._prepareKeyframesName=(...t)=>this._resolver.kfName(...t),this.compile=(h,p)=>{const{_:f,kf:m,k:b={},v:u={},c:d}=p,g=this._resolver.selector.bind(this),_=this._parseSelector;let y=r({},d),v=r({},b),$=r({_:{}},u),x="";if(f)for(let t in f){const e=f[t];if("c"===e.typ){const s={};c.forEach((i=>{const r=t+i,n=this._prepareVarName(h,r);s[i]=n,v["_"+r]=s[i],x+=o(n,e)})),$._[t]=a({l:l(s.l),c:l(s.c),h:l(s.h),a:l(s.a)}),e.all&&(y["_"+t+"l"]=`&lig=>${this._prepareVarName(h,t+"l")}:{1}`,y["_"+t+"c"]=`&chr=>${this._prepareVarName(h,t+"c")}:{1}`,y["_"+t+"h"]=`&hue=>${this._prepareVarName(h,t+"h")}:{1}`,y["_"+t+"a"]=`&alp=>${this._prepareVarName(h,t+"a")}:{1}`)}else{const s=this._prepareVarName(h,t);v["_"+t]=s,$._[t]=l(s),x+=o(s,e)}}const w=t=>v[t]||this._outerKeys[t],j=t=>{var e;return $[t]||this._outerSets[t]||(null===(e=this._outerSets)||void 0===e?void 0:e.root[t])},k=t=>t.replaceAll(/\{(.+?)\}/g,((t,e)=>{const[s,i]=e.split(".");if(i){const t=j(s);return""+((null==t?void 0:t[i])||(null==t?void 0:t.def)||"")}return""+(w(s)||"")})),S=e=>{const s=e.split("?");let i;for(let e in s){const r=s[e],[n,o]=r.split("=>"),l=n.match(/(\w+)(\[[\w,]+\])?/);if(!l)continue;const[a,c,h]=l,p=j(c);if(!p)continue;i=p;let f=t(i);const m=null==h?void 0:h.slice(1,-1).split(",");if(m){const t=new Set(m);f=f.filter((([e,s])=>t.has(e)))}if(o){let[t,e]=o.split("|");void 0===e&&(e=t,t=""),f=f.map((([s,i])=>[t.replace("{0}",s)||s,k(e.replaceAll("{1}",""+i))]))}(m||o)&&(i=Object.fromEntries(f));break}return i};function O(t,r,o){var l,a,c,p;let f=""+t;if((null===(l=null==t?void 0:t.startsWith)||void 0===l?void 0:l.call(t,"$"))&&(f=""+w(t.slice(1)),!f))return"";if(Array.isArray(r))return O(f,Object.assign({},...r.map((t=>"string"==typeof t?S(t):t))),o);if(null==r)return"";if(s(r)){const t=!o||(null===(a=o.startsWith)||void 0===a?void 0:a.call(o,"@"))||f.startsWith("&")||f.startsWith("@")?"":"&";if(f.startsWith("_")){const{e:n,m:o,mv:l}=_(f);return o&&"string"!=typeof l?e(r,((r,[l,a])=>{let c;return c=s(a)?e(a,((t,e)=>t+O(...e,f)),""):a+";",r+t+g({b:h,e:n,m:o,mv:l})+i(c)}),""):t+g({b:h,e:n,m:o,mv:l})+i(e(r,((t,e)=>t+O(...e,f)),""))}return t+f+i(e(r,((t,e)=>t+O(...e,f)),""))}{let t=""+r;return(null===(c=null==t?void 0:t.startsWith)||void 0===c?void 0:c.call(t,"&"))?O(f,S(t.slice(1)),o):(null===(p=null==t?void 0:t.includes)||void 0===p?void 0:p.call(t,"{"))?O(f,k(t),o):n(f.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())),t)}}let A="";if(m)for(let t in m){const s=m[t],r=this._prepareKeyframesName(h,t);v["kf_"+t]=r,A+=`@keyframes ${r} `+i(e(s,((t,[s,r])=>t+s+(String(+s)===s?"%":"")+i(e(r,((t,e)=>t+O(...e)),""))),""))}return x+A+e(y,((t,e)=>t+O(...e)),"")};const{sets:p,keys:f,resolver:m}=h;this._resolver=m,f&&(this._outerKeys=f),p&&(this._outerSets=p)}}const p=t=>Array.isArray(t)?t:[t];class f{constructor(){this._stylesheets={},this._rules={},this._styleSheetsArray=[],this._listeners=[],this.getIndex=t=>this._styleSheetsArray.findIndex((e=>e===t)),this.get=t=>this._stylesheets[t],this.has=t=>!!t&&!!this.get(t),this.getAll=()=>this._stylesheets,this.add=(t,e)=>{if(!this._stylesheets[t])return this._stylesheets[t]=e,this._styleSheetsArray.push(e),this.notify(),!0},this.status=t=>{const e=this.get(t);return!!e&&-1!==this.getIndex(e)},this.on=t=>{const e=p(t).reduce(((t,e)=>{const s=this.get(e);return!(!s||this.status(e))&&(this._styleSheetsArray.push(s),t)}),!0);return this.notify(),e},this.off=t=>{const e=p(t).reduce(((t,e)=>{const s=this.get(e);if(s&&this.status(e)){const e=this.getIndex(s);return this._styleSheetsArray.splice(e,1),t}return!1}),!0);return this.notify(),e},this.remove=t=>{const e=this.get(t);if(!e)return;const s=this.getIndex(e);return s>-1&&(this._styleSheetsArray.splice(s,1),delete this._stylesheets[t],delete this._rules[t]),this.notify(),!0},this.pack=(t,e)=>{const s=new CSSStyleSheet;if(s.replaceSync(e),s.cssRules.length)return this.add(t,s);console.log(`StyleSheet '${t}' is empty`)},this.replace=(t,e)=>{const s=this._stylesheets[t];if(s)return s.replaceSync(e),this.notify(),!0},this.apply=t=>{t.adoptedStyleSheets=this._styleSheetsArray},this.registerNode=t=>{this._listeners.findIndex((e=>e.deref()===t))>=0||(this._listeners.push(new WeakRef(t)),this.apply(t))},this.unregisterNode=t=>{const e=this._listeners.findIndex((e=>e.deref()===t));e>=0&&this._listeners.splice(e,1)},this.notify=()=>{this._listeners=this._listeners.reduce(((t,e)=>{const s=e.deref();return s&&(this.apply(s),t.push(e)),t}),[])}}removeAll(){return this._styleSheetsArray.splice(0),this._stylesheets={},this._rules={},this.notify(),!0}}const m=(...t)=>t.join(","),b="rem",u="-",d=" ",g="-x",_="-y",y="down",v="horizontal",$="vertical",x="text",w=x+u,j="font",k=j+u,S="column",O=S+u,A="max-",z="min-",N="content",C=N+"s",E="-items",K="self",T="inline",W="block",I="size",P="-radius",V="direction",q="outline",M="style",R=u+M,B="end",F=u+B,J="start",L=u+J,G="center",H="word",Z="line",D="break",Q=D+u,U="wrap",X="no"+U,Y="rule",tt="object",et="top",st=u+et,it="left",rt=u+it,nt="bottom",ot=u+nt,lt="right",at=u+lt,ct="width",ht=u+ct,pt="color",ft=u+pt,mt="overflow",bt="align",ut="type",dt="transform",gt="all",_t="height",yt="normal",vt="opacity",$t="visibility",xt="scale",wt="box",jt=u+wt,kt="border",St="position",Ot="none",At="auto",zt="fill",Nt="stroke",Ct="reverse",Et="space",Kt="fixed",Tt="origin",Wt="alpha",It="luminance",Pt="clip",Vt="zoom",qt="scroll",Mt="padding",Rt="margin",Bt="both",Ft="mode",Jt="repeat",Lt="light",Gt="linear",Ht="hidden",Zt="shadow",Dt="behavior",Qt="orientation",Ut="name",Xt="after",Yt="before",te="image",ee="list"+R,se=ee+u+ut,ie=ee+u+St,re=ee+u+te,ne=pt+"-scheme",oe=kt+ot,le=kt+rt,ae=kt+at,ce=kt+st,he=kt+u+W,pe=kt+u+T,fe=he+L,me=he+F,be=pe+L,ue=pe+F,de=kt+ht,ge=oe+ht,_e=le+ht,ye=ae+ht,ve=ce+ht,$e=he+ht,xe=pe+ht,we=fe+ht,je=me+ht,ke=be+ht,Se=ue+ht,Oe=kt+P,Ae=oe+rt+P,ze=oe+at+P,Ne=ce+rt+P,Ce=ce+at+P,Ee=kt+L+F+P,Ke=kt+L+L+P,Te=kt+F+F+P,We=kt+F+L+P,Ie=kt+ft,Pe=le+ft,Ve=ae+ft,qe=ce+ft,Me=oe+ft,Re=he+ft,Be=pe+ft,Fe=fe+ft,Je=me+ft,Le=be+ft,Ge=ue+ft,He=kt+R,Ze=le+R,De=ae+R,Qe=ce+R,Ue=oe+R,Xe=he+R,Ye=pe+R,ts=fe+R,es=me+R,ss=be+R,is=ue+R,rs=q+ft,ns=q+ht,os=q+R,ls=q+u+"offset",as=mt+g,cs=mt+_,hs=tt+u+"fit",ps=tt+u+St,fs=xt+u+y,ms=wt+u+Zt,bs=Mt+jt,us=kt+jt,ds=N+jt,gs=zt+jt,_s=Nt+jt,ys="view"+jt,vs="no-"+Pt,$s=Jt+g,xs=Jt+_,ws="no-"+Jt,js=Mt+rt,ks=Mt+st,Ss=Mt+at,Os=Mt+ot,As=Rt+rt,zs=Rt+st,Ns=Rt+at,Cs=Rt+ot,Es="grid",Ks="row",Ts="gap",Ws="justify",Is="flex",Ps=Is+u,Vs="place"+E,qs=T+u+Is,Ms=Ps+"basis",Rs=Ps+"grow",Bs=Ps+"shrink",Fs=Ps+V,Js=Ps+U,Ls=Ws+u+N,Gs=Ws+E,Hs=bt+E,Zs=bt+u+N,Ds=bt+u+K,Qs=Es+u+"template",Us=Qs+u+Ks+"s",Xs=Qs+u+S+"s",Ys=Ks+u+Ts,ti=O+Ts,ei=Ws+u+K,si=Es+u+Ks,ii=si+F,ri=si+L,ni=Es+u+S,oi=ni+F,li=ni+L,ai=O+"count",ci=O+zt,hi=O+Y,pi=hi+ft,fi=hi+R,mi=hi+ht,bi=O+"span",ui=S+ht,di=Ks+u+Ct,gi=O+Ct,_i=U+u+Ct,yi=Is+F,vi=Is+L,$i=Et+"-between",xi=Et+"-around",wi=Et+"-evenly",ji=T+u+Es,ki="mask-",Si=ki+Pt,Oi=ki+"composite",Ai=ki+Ft,zi=ki+Tt,Ni=ki+St,Ci=ki+Jt,Ei=ki+I,Ki=ki+ut,Ti="timing-function",Wi="delay",Ii="duration",Pi="animation",Vi=Pi+u,qi=Vi+Ut,Mi=Vi+Ti,Ri=Vi+V,Bi=Vi+"iteration-count",Fi=Vi+Ii,Ji=Vi+Wi,Li=Vi+"play-state",Gi=Vi+zt+u+Ft,Hi="transition",Zi=Hi+u,Di=Zi+Dt,Qi=Zi+"property",Ui=Zi+Ti,Xi=Zi+Ii,Yi=Zi+Wi,tr="alternate",er=tr+u+Ct,sr="-out",ir="ease",rr=ir+"-in",nr=rr+sr,or=ir+sr,lr="step",ar=lr+L,cr=lr+F,hr="translate",pr="rotate",fr="perspective",mr=fr+u+Tt,br=it+d+et,ur=lt+d+et,dr=it+d+nt,gr=lt+d+nt,_r="inset",yr=_r+u,vr=dt+jt,$r=dt+u+Tt,xr=dt+R,wr=yr+W,jr=wr+F,kr=wr+L,Sr=yr+T,Or=Sr+F,Ar=Sr+L,zr="fit-"+N,Nr=z+N,Cr=A+N,Er=wt+"-sizing",Kr=A+ct,Tr=z+ct,Wr=A+_t,Ir=z+_t,Pr=W+u+I,Vr=A+Pr,qr=z+Pr,Mr=T+u+I,Rr=A+Mr,Br=z+Mr,Fr=qt+u+Dt,Jr=qt+u+Rt,Lr=Jr+st,Gr=Jr+ot,Hr=Jr+rt,Zr=Jr+at,Dr=Jr+u+W,Qr=Dr+F,Ur=Dr+L,Xr=Jr+u+T,Yr=Xr+F,tn=Xr+L,en=qt+u+Mt,sn=en+st,rn=en+ot,nn=en+rt,on=en+at,ln=en+u+W,an=ln+F,cn=ln+L,hn=en+u+T,pn=hn+F,fn=hn+L,mn=qt+u+"snap",bn=mn+u+bt,un=mn+u+"stop",dn=mn+u+ut,gn="over"+Fr,_n=" mandatory",yn="x"+_n,vn="y"+_n,$n=W+_n,xn=T+_n,wn=Bt+_n,jn=" proximity",kn="x"+jn,Sn="y"+jn,On=W+jn,An=T+jn,zn=Bt+jn,Nn=w+"decoration",Cn=Nn+u+pt,En=Nn+u+"thickness",Kn=Nn+u+M,Tn=Nn+u+Z,Wn="white-"+Et,In=w+dt,Pn=w+bt,Vn=$+u+bt,qn=w+mt,Mn=w+Qt,Rn=w+"rendering",Bn=w+Zt,Fn=w+"emphasis",Jn=Fn+ft,Ln=Fn+u+St,Gn=Fn+R,Hn=w+U,Zn=Hn+u+Ft,Dn=Hn+R,Qn=H+u+D,Un=k+I,Xn=k+"weight",Yn=k+"family",to=k+M,eo=k+"synthesis",so=k+"variant",io=so+u+tr+"s",ro=so+"-caps",no=so+"-numeric",oo=so+u+St,lo=so+"-east-asian",ao=so+"-ligatures",co=so+"-settings",ho="writing-"+Ft,po=Z+u+_t,fo=Z+u+D,mo=Z+"-through",bo="over"+Z,uo="under"+Z,go="pre",_o=go+u+Z,yo=go+u+U,vo=Q+Et+"s",$o=Q+gt,xo=Q+H,wo=Q+Xt,jo=Q+Yt,ko=v+"-tb",So=$+"-lr",Oo=$+"-rl",Ao="keep-"+gt,zo="pointer",No="pan",Co=No+g,Eo=No+rt,Ko=No+at,To=No+_,Wo=No+u+y,Io="pinch-"+Vt,Po=$+u+x,Vo="grab",qo=Vo+"bing",Mo="resize",Ro="col-"+Mo,Bo="row-"+Mo,Fo="n-"+Mo,Jo="e-"+Mo,Lo="s-"+Mo,Go="w-"+Mo,Ho="ne-"+Mo,Zo="ew-"+Mo,Do="nw-"+Mo,Qo="se-"+Mo,Uo="sw-"+Mo,Xo="ns-"+Mo,Yo="nesw-"+Mo,tl="nwse-"+Mo,el=Vt+u+"in",sl=Vt+u+"out",il=zo+"-events",rl=qt+u+St,nl="caret"+ft,ol="accent"+ft,ll="filter",al="backdrop-"+ll,cl="background",hl=cl+u,pl=hl+te,fl=hl+pt,ml=hl+Pt,bl=hl+Tt,ul=hl+St,dl=ul+g,gl=ul+_,_l=hl+Jt,yl=hl+I,vl=hl+"blend-"+Ft,$l=hl+"attachment",xl="gradient",wl=Gt+u+xl,jl="radial-"+xl,kl="conic-"+xl,Sl=N+u+$t,Ol=Nt+ht,Al=Nt+u+vt,zl=zt+u+Y,Nl=zt+u+vt,Cl=pt+"-dodge",El=pt+"-burn",Kl="hard-"+Lt,Tl="soft-"+Lt,Wl=pt+"-mix",Il="revert",Pl=Il+"-layer",Vl="container",ql=Vl+u+ut,Ml=Vl+u+Ut,Rl=":first-",Bl=":last-",Fl=":only-",Jl="child",Ll="of-type",Gl=":nth-child",Hl="prefers-",Zl=Hl+ne,Dl="@media",Ql=pt+"-gamut",Ul=Hl+"contrast",Xl="scripting",Yl="::"+Xt,ta="::"+Yt,ea="sideways",sa=ea+at,ia={0:0,"1/12":"0.0833","1/10":"0.1","1/6":"0.1667","1/5":"0.2","1/4":"0.25","3/10":"0.3","1/3":"0.3333","2/5":"0.4","5/12":"0.4167","1/2":"0.5","7/12":"0.5833","3/5":"0.6","2/3":"0.6667","7/10":"0.7","3/4":"0.75","4/5":"0.8","5/6":"0.8333","9/10":"0.9","11/12":"0.9167",1:"1"},ra=[...Array(12).keys()].reduce(((t,e)=>(t[e]=e,t)),{}),na={u:{ini:"initial",inh:"inherit",u:"unset",r:Il,rl:Pl},rep:{rx:$s,ry:xs,r:Jt,s:Et,ro:"round",nr:ws},cnt:{n:yt,s:I,is:Mr},time:{def:300,xs:100,s:200,m:300,l:450,xl:600,no:0,min:50,max:750},lig:{def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},hue:{def:261.35,b:261.35,i:194.77,e:29.23,w:70.66,s:142.49},chr:{def:.03,xs:.03,s:.06,m:.1,l:.15,xl:.25},alp:{def:1,min:0,xs:.1,s:.25,m:.5,l:.75,xl:.9,max:1},cu:{c:"currentColor",t:"transparent"},ff:{def:"Roboto, sans-serif",h:"Georgia, serif"},fwg:{xs:100,s:200,m:400,l:600,xl:700},fsz:{xs:.25,s:.5,m:1,l:1.5,xl:2},fst:{i:"italic",n:yt,o:"oblique"},lsp:{no:0,s:.05,m:.1,l:.2},ws:{n:yt,nw:X,p:go,pl:_o,pw:yo,bs:vo},wb:{n:yt,ba:$o,ka:Ao,bw:xo},wm:{htb:ko,vlr:So,vrl:Oo},hyp:{no:Ot,m:"manual",a:At},tt:{l:"lowercase",u:"uppercase",c:"capitalize"},td:{lt:mo,o:bo,u:uo},tor:{m:"mixed",u:"upright",sr:sa,s:ea,ugo:"use-glyph-"+Qt},ta:{l:it,c:G,j:Ws,r:lt,s:J,e:B},fr:ia,coef:ra,rat:{1:1,"2/1":2,"1/2":.5,"4/3":1.3333,"3/4":.75,"9/16":.5625,"16/9":1.7778},sp:{"3xs":.125,"2xs":.25,xs:.5,s:.75,m:1,l:1.25,xl:1.5,"2xl":2,"3xl":4},sz:{"3xs":1,"2xs":1.5,xs:2,s:5,m:10,l:15,xl:20,"2xl":25,"3xl":30},usz:{a:"auto",no:0,min:Nr,max:Cr,fit:zr},rad:{s:.5,m:1,l:2},th:{s:.1,m:.25,l:.5},csz:{cv:"cover",cn:"contain",a:At,f:zt,sd:fs},box:{c:ds,p:bs,b:us,f:gs,s:_s,v:ys,nc:vs,t:x},sc:{xs:.5,s:.67,m:1,l:1.5,xl:2},tr:{xs:.25,s:.5,m:1,l:1.5,xl:2},sk:{xs:-15,s:-10,m:0,l:10,xl:15},rot:{xs:-180,s:-90,m:0,l:90,xl:180},z:{s:.8,m:1,l:1.2},pers:{s:10,m:15,l:20},ali:{s:J,e:B,c:G,st:"stretch",sb:$i,sa:xi,se:wi,b:"baseline",fs:vi,fe:yi,no:Ot},dis:{g:Es,ig:ji,f:Is,if:qs,b:W,i:T},ca:ra,co:ra,ra:ra,ro:ra,fd:{r:Ks,rr:di,c:S,cr:gi},fb:ia,fo:ra,fg:ra,fs:ra,fw:{w:U,nw:X,wr:_i},lh:{xs:1,s:1.25,m:1.5,l:1.75,xl:2},lb:{a:At,any:"anywhere",n:yt,l:"loose",s:"strict"},ls:{no:Ot,dt:"dotted",i:_r,h:Ht,ds:"dashed",s:"solid",db:"double",o:"outset",r:"ridge",g:"groove"},ov:{h:Ht,s:qt,a:At,c:Pt,e:"ellipsis"},v:{h:Ht,v:"visible",c:"collapse",a:At},o:{min:0,xs:.1,s:.25,m:.5,l:.75,xl:.9,max:1},zi:{min:-1,1:1,2:2,3:3,4:4,5:5,max:10},ttf:{l:Gt,e:ir,ei:rr,eo:or,eio:nr,ss:ar,se:cr},tp:{col:m(pt,fl,Ie,Cn),icon:m(zt,Nt),flt:m(ll,al),ind:m(Mt,Rt),sz:m(ct,Kr,Tr,_t,Wr,Ir),esz:m(qr,Pr,Vr,Br,Mr,Rr),o:vt,b:kt,f:Is,g:Es,pos:m(St,it,et,nt,lt),tf:m(dt,hr,xt,pr,"skew",fr)},tb:{ad:"allow-discrete",n:yt},aic:{inf:"infinite",1:1,2:2,3:3,4:4,5:5},wc:{a:At,sp:rl,c:C,tf:dt,o:vt,i:_r,tfi:m(dt,_r)},afm:{no:Ot,f:"forwards",b:"backwards",both:Bt},adir:{r:Ct,a:tr,ar:er},aps:{r:"running",p:"paused"},pe:{a:At,no:Ot,all:gt,f:zt,s:Nt},cur:{h:"help",a:At,p:zo,cm:"context-menu",pr:"progress",w:"wait",cell:"cell",crh:"crosshair",t:x,vt:Po,cp:"copy",m:"move",g:Vo,gng:qo,cr:Ro,rr:Bo,nr:Fo,er:Jo,sr:Lo,wr:Go,ner:Ho,ewr:Zo,nwr:Do,ser:Qo,swr:Uo,nsr:Xo,neswr:Yo,nwser:tl,zi:el,zo:sl},res:{n:Ot,v:$,h:v,b:Bt},toa:{a:At,no:Ot,px:Co,pl:Eo,pr:Ko,py:To,pu:"pan-up",pd:Wo,pz:Io,m:"manipulation"},us:{n:Ot,t:x,all:gt,a:At},sb:{a:At,s:"smooth"},sss:{n:yt,a:"always"},sst:{n:Ot,x:"x",y:"y",b:W,i:T,both:Bt,xm:yn,ym:vn,bm:$n,im:xn,bothm:wn,xp:kn,yp:Sn,bp:On,ip:An,bothp:zn},pos:{r:"relative",a:"absolute",f:Kt,s:"static"},posv:{b:nt,t:et,c:G,l:it,r:lt,lt:br,rt:ur,lb:dr,rb:gr},cf:{a:At,b:"balance"},cs:{no:Ot,all:gt},mc:{a:"add",s:"subtract",i:"intersect",e:"exclude"},mt:{a:Wt,l:It},mm:{a:Wt,l:It,m:"match-source"},bgbm:{n:yt,m:"multiply",scr:"screen",o:"overlay",d:"darken",l:Lt+"en",dif:"difference",exc:"exclusion",h:"hue",sat:"saturation",c:pt,lum:"luminosity",cd:Cl,cb:El,hl:Kl,sl:Tl},bga:{s:qt,f:Kt,l:"local"}},oa={a:Pi,an:qi,adur:Fi,adel:Ji,aps:Li,afm:Gi,adir:Ri,aic:Bi,atf:Mi,tn:Hi,tdur:Xi,tdel:Yi,tb:Di,tp:Qi,ttf:Ui,ba:wo,bb:jo,bor:kt,bw:de,br:Oe,bs:He,bls:Ze,brs:De,bts:Qe,bbs:Ue,bbls:Xe,bis:Ye,bbss:ts,bbes:es,biss:ss,bies:is,brw:ye,blw:_e,btw:ve,bbw:ge,btlr:Ne,btrr:Ce,bbrr:ze,bblr:Ae,biw:xe,bblw:$e,bbew:je,bbsw:we,bisw:ke,biew:Se,besr:We,beer:Te,bssr:Ke,bser:Ee,bc:Ie,blc:Pe,brc:Ve,btc:qe,bbc:Me,bblc:Re,bic:Be,bbsc:Fe,bbec:Je,bisc:Le,biec:Ge,bg:cl,bgi:pl,bgc:fl,c:pt,cmix:Wl,csh:ne,acc:ol,ctc:nl,st:Nt,stw:Ol,sto:Al,fi:zt,fir:zl,fio:Nl,flt:ll,bf:al,dis:"display",g:Es,jc:Ls,ji:Gs,ai:Hs,pi:Vs,ac:Zs,gt:Qs,gtr:Us,gtc:Xs,gp:Ts,rg:Ys,cg:ti,as:Ds,js:ei,gr:si,gre:ii,grs:ri,gc:ni,gce:oi,gcs:li,fx:Is,fxd:Fs,fxw:Js,fxs:Bs,fxg:Rs,fxb:Ms,ord:"order",dir:V,m:Rt,ml:As,mr:Ns,mt:zs,mb:Cs,p:Mt,pl:js,pr:Ss,pt:ks,pb:Os,out:q,oc:rs,ow:ns,os:os,oo:ls,l:it,r:lt,t:et,b:nt,ins:_r,ib:wr,ibe:jr,ibs:kr,ii:Sr,iie:Or,iis:Ar,wc:"will-change",app:"appearance",pe:il,cur:"cursor",toa:"touch-action",us:"user-select",res:Mo,lis:ee,lisp:ie,lisi:re,list:se,sb:Fr,ssa:bn,sss:un,sst:dn,sm:Jr,sml:Hr,smr:Zr,smt:Lr,smb:Gr,sp:en,spl:nn,spr:on,spt:sn,spb:rn,smbl:Dr,smbe:Qr,smbs:Ur,smi:Xr,smie:Yr,smis:tn,spbl:ln,spbe:an,spbs:cn,spi:hn,spie:pn,spis:fn,osb:gn,ar:"aspect-ratio",w:ct,maxw:Kr,minw:Tr,h:_t,minh:Ir,maxh:Wr,bl:Pr,maxb:Vr,minb:qr,i:Mr,mini:Br,maxi:Rr,per:fr,pero:mr,rot:pr,sc:xt,tf:dt,tfb:vr,tfo:$r,tfs:xr,tr:hr,z:Vt,lts:"letter-spacing",lh:po,lb:fo,f:j,fst:to,ff:Yn,fwg:Xn,fsz:Un,fsn:eo,fv:so,fva:io,fvc:ro,fvea:lo,fvl:ao,fvn:no,fvs:co,fvp:oo,tt:In,td:Nn,tdt:En,tds:Kn,tdl:Tn,ta:Pn,to:qn,trg:Rn,ts:Bn,te:Fn,tep:Ln,tec:Jn,tes:Gn,tw:Hn,twm:Zn,tws:Dn,va:Vn,ws:Wn,tor:Mn,wb:Qn,wm:ho,hyp:"hyphens",bsz:Er,bsh:ms,pos:St,cf:ci,crs:fi,crc:pi,crw:mi,cs:bi,cw:ui,cc:ai,bgcl:ml,bgp:ul,bgpx:dl,bgpy:gl,bgbm:vl,bgo:bl,bgr:_l,bga:$l,bgsz:yl,mcl:Si,mcm:Oi,mm:Ai,mo:zi,mp:Ni,mre:Ci,msz:Ei,mtp:Ki,obf:hs,obp:ps,con:N,ov:mt,ovx:as,ovy:cs,v:$t,cv:Sl,o:vt,zi:"z-index",lgr:wl,rgr:jl,cgr:kl,inf:"infinite",cnt:ql,cnn:Ml,$:":root",$u:"*",$h:":hover",$f:":focus",$fv:":focus-visible",$a:":active",$v:":visited",$val:":valid",$inv:":invalid",$e:":empty",$d:":disabled",$r:":required",$o:":optional",$m:":modal",$l:":link",$fc:Rl+Jl,$lc:Bl+Jl,$oc:Fl+Jl,$1:Gl+"(odd)",$2:Gl+"(even)",$ft:Rl+Ll,$lt:Bl+Ll,$ot:Fl+Ll,$bef:ta,$aft:Yl,$bd:"::backdrop",$ba:`&${ta},&${Yl}`,$pl:":placeholder",$light:Dl+`(${Zl}: light)`,$dark:Dl+`(${Zl}: dark)`,$red_m:Dl+"(prefers-reduced-motion: reduce)",$ori_l:Dl+`(${Qt}: landscape)`,$ori_p:Dl+`(${Qt}: portrait)`,$gam_srgb:Dl+`(${Ql}: srgb)`,$gam_p3:Dl+`(${Ql}: p3)`,$gam_rec:Dl+`(${Ql}: rec2020)`,$con_no:Dl+`(${Ul}: no-preference)`,$con_m:Dl+`(${Ul}: more)`,$con_l:Dl+`(${Ul}: less)`,$con_c:Dl+`(${Ul}: custom)`,$scr_no:Dl+`(${Xl}: none)`,$scr_ini:Dl+`(${Xl}: initial-only)`,$scr_en:Dl+`(${Xl}: enabled)`,$ss:"@starting-style",$ns:"@namespace"},la={xs:30+b,sm:40+b,md:48+b,lg:64+b,xl:80+b},aa={xs:10+b,sm:20+b,md:30+b,lg:40+b,xl:48+b},ca={$c:"{u.inh}",$fsz:"16px",$ff:"{ff.def}",$$u:{$c:"{u.inh}",$fsz:"16px",$ff:"{ff.def}"}},ha={light:{lig:{def:.75,c:.05,s:.65,m:.75,l:.85,n:.9}},dark:{lig:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}},pa="{1}rem",fa="{1}deg",ma="span {1}",ba={fb:"calc(100% * {1})",ra:ma,ca:ma,sz:pa,sp:pa,rad:pa,th:pa,bp:pa,cbp:pa,fsz:pa,lsp:pa,tr:pa,pers:pa,sk:fa,rot:fa,time:"{1}ms"},ua="style-provider",da=t=>"object"==typeof t;class ga{constructor(t){this._counter=0,this._keys=new Set,this._configs=new Map,this.use=(t,e)=>{const s=this._configs.get(t);if(s)return s;const i=e||this._prefix+this._counter.toString(36);return this._keys.add(i),this._configs.set(t,i),this._counter++,i},this.mutate=(t,e)=>Object.assign(this.getConfigs()[t],e),this.getKey=t=>this._configs.get(t),this.getKeys=()=>[...this._keys],this.getConfigs=()=>Object.fromEntries(this._configs.entries().map((([t,e])=>[e,t]))),this._prefix=(null==t?void 0:t.prefix)||"eff",t.initContent&&Object.entries(t.initContent).forEach((([t,e])=>this.use(e,t))),t.hydrate&&(this._counter=0)}}const _a=globalThis.document,ya=t=>"application/json"===(null==t?void 0:t.getAttribute("type")),va=t=>Array.isArray(t)?t:[t];!function(t={}){const{name:e=ua,styles:s={},settings:i={}}=t,r=globalThis.customElements;!(null==r?void 0:r.get(e))&&(r.define(e,class extends HTMLElement{constructor(){super(...arguments),this._setState=()=>{const{units:t,keys:s,sets:i,mediaBP:r=la,containerBP:n=aa,rootStyle:o=ca,themes:l=ha}=this.settingsContent,a=Object.assign(Object.assign({},ba),t||{}),c=Object.assign(Object.assign({},oa),s||{}),h=Object.assign({},na);i&&Object.entries(i).forEach((([t,e])=>h[t]=Object.assign({},e)));const p=Object.entries(l);if(a)for(const t in a)h[t]=h[t]&&Object.fromEntries(Object.entries(h[t]).map((([e,s])=>[e,a[t].replace("{1}",""+s)])));r&&Object.entries(r).forEach((([t,e])=>{c[`min_${t}_`]=`@media (min-width:${e})`,c[`max_${t}_`]=`@media (max-width:${e})`})),n&&Object.entries(n).forEach((([t,e])=>{c[`cmin_${t}_`]=`@container (min-width:${e})`,c[`cmax_${t}_`]=`@container (max-width:${e})`}));const f={},m={};l&&h&&p.forEach((([t,e])=>{const s={};Object.entries(e).forEach((([t,e])=>{Object.entries(e).forEach((([e,i])=>{var r;const n=this._resolver.varName(this.prefix,t,e);a[t]?s[n]=a[t].replace("{1}",""+i):s[n]=i,f[n]||(f[n]=(null===(r=h[t])||void 0===r?void 0:r[e])||"unset",h[t]||(h[t]={}),h[t][e]=`var(${n})`)}))})),m[t]=s})),this._dict={sets:h,keys:c},this._mainConfig={c:Object.assign(Object.assign({[e]:{display:"contents"},_theme:m,$$:Object.assign(f,o)},(null==m?void 0:m.dark)?{$$dark:{$$:m.dark}}:{}),(null==m?void 0:m.light)?{$$light:{$$:m.light}}:{})}},this._resolveTargetKey=t=>"string"==typeof t?t:this._collector.getKey(t),this.use=(t,e)=>{let s=this._collector.use(t,e);return this._manager&&!this._manager.has(e)&&this._manager.pack(s,this.css(t,s)),this.resolve(s)},this.alter=(t,e)=>{const s=this._resolveTargetKey(t);if(s){const t=this._collector.mutate(s,e);this._manager.replace(s,this.css(t,s))}return this.resolve(s)},this.usePublic=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[t,this.use(e,t)]))),this.usePrivate=t=>t.map((t=>this.use(t))),this.css=(t,e)=>{var s;return null===(s=this._processor)||void 0===s?void 0:s.compile(e,t)},this.status=t=>{const e=this._resolveTargetKey(t);return!!e&&this._manager.status(e)},this.on=t=>this._manager.on(va(t).map(this._resolveTargetKey)),this.off=t=>this._manager.off(va(t).map(this._resolveTargetKey)),this.get=(t=this._mainConfig)=>this._manager.get(this._resolveTargetKey(t)),this.getMany=(t=this._collector.getKeys())=>t.map((t=>this.get(t))),this.resolve=t=>this._resolver.attr(t||this._collector.getKey(this._mainConfig)),this.subscribe=t=>this._manager.registerNode(t),this.unsubscribe=t=>this._manager.unregisterNode(t)}get prefix(){return this.getAttribute("prefix")||"eff"}get mode(){return this.getAttribute("mode")||"a"}get isolated(){return null!==this.getAttribute("isolated")}get hydrate(){return null!==this.getAttribute("hydrate")}get eventName(){return this.getAttribute("eventname")||"effcsschanges"}get _settingsSelector(){return"#"+(this.getAttribute("settingsid")||"effcss")}get _initSelector(){return"."+(this.getAttribute("initcls")||"effcss_init")}get settingsContent(){const t=null==_a?void 0:_a.querySelector(this._settingsSelector);let e;return e=ya(t)?(null==t?void 0:t.textContent)&&JSON.parse(null==t?void 0:t.textContent):t?null==t?void 0:t.effcss:i,e||{}}get initContent(){const t=_a.querySelectorAll(this._initSelector);let e=s||{};return t.forEach((t=>{let s;s=ya(t)?(null==t?void 0:t.textContent)&&JSON.parse(null==t?void 0:t.textContent):null==t?void 0:t.effcss,e=Object.assign(Object.assign({},e),s||{})})),e}get configs(){return this._collector.getConfigs()}connectedCallback(){this._resolver=(t=>{const{mode:e}=t,s=t=>Object.entries(t).reduce(((t,[e,s])=>(void 0!==s&&t.push(e+(s?"-"+s:"")),t)),[]).join(" "),i=(t,e)=>Object.defineProperties({[t]:e},{k:{value:t},v:{value:e}}),r=(...t)=>"--"+t.join("-"),n=(...t)=>t.join("-");return"c"===e?{selector:({b:t,e:e,m:s,mv:i})=>`.${t}${(e?"__"+e:"")+(s?"_"+s:"")+(s&&i?"_"+i:"")}`,attr:t=>e=>r=>{let n=r||"";da(n)&&(n=s(n));const o=t+(e?"__"+e:"");return n=o+(n?" "+(null==n?void 0:n.split(" ").map((t=>o+"_"+t.split("-").join("_"))).join(" ")):""),i("class",n)},varName:r,kfName:n}:{selector:({b:t,e:e,m:s,mv:i})=>`[data-${t}${e?"-"+e:""}${s?'~="'+(s||"")+(i?"-"+i:"")+'"':""}]`,attr:t=>e=>r=>{const n=`data-${t}${e?"-"+e:""}`;let o=r||"";return da(o)&&(o=s(o)),i(n,o)},varName:r,kfName:n}})({mode:this.mode}),this._setState();const t=this.initContent,e=this.prefix;var s;this._collector=(s={hydrate:this.hydrate,prefix:e,initContent:t},new ga(s)),this._processor=function(t){return new h(t)}({sets:this._dict.sets,keys:this._dict.keys,resolver:this._resolver}),this._manager=new f;const i=t=>this.dispatchEvent(new CustomEvent(this.eventName,{detail:{styles:t},bubbles:!0}));this._notifier={set adoptedStyleSheets(t){i(t)}},this.subscribe(this._notifier),this.use(this._mainConfig),this.usePublic(t),_a&&!this.isolated&&this._manager.registerNode(_a)}}),window.__EFFCSS_PARAMS__={name:e,styles:s,settings:i})}();
|
|
7
|
+
const t=Object.entries,s=(s,e,i)=>t(s).reduce(e,i),e=t=>"object"==typeof t,i=t=>`{${t}}`,r=Object.assign.bind(Object),n=(t,s)=>`${t}:${s};`,o=(t,s)=>["@property",t,i(n("syntax",s.syn||'"*"')+n("inherits",s.inh||!1)+(s.ini?n("initial-value",s.ini):""))].join(" "),l=t=>`var(${t})`,a=({l:t,c:s,h:e,a:i=1})=>`oklch(${t} ${s} ${e} / ${i})`,c=["l","c","h","a"];class h{constructor(h){this._k={},this._s={},this._sel=t=>{let s,e,i,r,n;return[s,n]=t.split(":"),s.startsWith("__")?[e,i,r]=s.slice(2).split("_"):[e,i,r]=s.split("_"),{e:e,m:i,mv:r,s:n}},this._var=(...t)=>this._r.varName(...t),this._kf=(...t)=>this._r.kfName(...t),this.compile=(h,m)=>{const{_:f,kf:d,k:b={},v:p={},c:u}=m,g=this._r.selector.bind(this),_=this._sel;let v=r({},u),$=r({},b),y=r({_:{}},p),x="";if(f)for(let t in f){const s=f[t];if("c"===s.typ){const e={};c.forEach((i=>{const r=t+i,n=this._var(h,r);e[i]=n,$["_"+r]=e[i],x+=o(n,s)})),y._[t]=a({l:l(e.l),c:l(e.c),h:l(e.h),a:l(e.a)}),s.all&&(v["_"+t+"l"]=`&lig=>${this._var(h,t+"l")}:{1}`,v["_"+t+"c"]=`&chr=>${this._var(h,t+"c")}:{1}`,v["_"+t+"h"]=`&hue=>${this._var(h,t+"h")}:{1}`,v["_"+t+"a"]=`&alp=>${this._var(h,t+"a")}:{1}`)}else{const e=this._var(h,t);$["_"+t]=e,y._[t]=l(e),x+=o(e,s)}}const w=t=>$[t]||this._k[t],k=t=>{var s;return y[t]||this._s[t]||(null===(s=this._s)||void 0===s?void 0:s.root[t])},j=t=>t.replaceAll(/\{(.+?)\}/g,((t,s)=>{const[e,i]=s.split(".");let r;if(i){const t=k(e);r=(null==t?void 0:t[i])||(null==t?void 0:t.def)||""}else r=w(e)||"";return""+r})),z=s=>{const e=s.split("?");let i;for(let s in e){const r=e[s],[n,o]=r.split("=>"),l=n.match(/(\w+)(\[[\w,]+\])?/);if(!l)continue;const[a,c,h]=l,m=k(c);if(!m)continue;i=m;let f=t(i);const d=null==h?void 0:h.slice(1,-1).split(",");if(d){const t=new Set(d);f=f.filter((([s,e])=>t.has(s)))}if(o){let[t,s]=o.split("|");void 0===s&&(s=t,t=""),f=f.map((([e,i])=>[t.replace("{0}",e)||e,j(s.replaceAll("{1}",""+i))]))}(d||o)&&(i=Object.fromEntries(f));break}return i};function O(t,r,o){var l,a,c,m;let f=""+t;if((null===(l=null==t?void 0:t.startsWith)||void 0===l?void 0:l.call(t,"$"))&&(f=""+w(t.slice(1)),!f))return"";if(Array.isArray(r))return O(f,Object.assign({},...r.map((t=>"string"==typeof t?z(t):t))),o);if(null==r)return"";if(e(r)){const t=!o||(null===(a=o.startsWith)||void 0===a?void 0:a.call(o,"@"))||f.startsWith("&")||f.startsWith("@")?"":"&";if(f.startsWith("_")){const{e:n,m:o,mv:l}=_(f);return o&&"string"!=typeof l?s(r,((r,[l,a])=>{let c;return c=e(a)?s(a,((t,s)=>t+O(...s,f)),""):a+";",r+t+g({b:h,e:n,m:o,mv:l})+i(c)}),""):t+g({b:h,e:n,m:o,mv:l})+i(s(r,((t,s)=>t+O(...s,f)),""))}return t+f+i(s(r,((t,s)=>t+O(...s,f)),""))}{let t=""+r;return(null===(c=null==t?void 0:t.startsWith)||void 0===c?void 0:c.call(t,"&"))?O(f,z(t.slice(1)),o):(null===(m=null==t?void 0:t.includes)||void 0===m?void 0:m.call(t,"{"))?O(f,j(t),o):n(f.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())),t)}}let S="";if(d)for(let t in d){const e=d[t],r=this._kf(h,t);$["kf_"+t]=r,S+=`@keyframes ${r} `+i(s(e,((t,[e,r])=>t+e+(String(+e)===e?"%":"")+i(s(r,((t,s)=>t+O(...s)),""))),""))}return x+S+s(v,((t,s)=>t+O(...s)),"")};const{sets:m,keys:f,resolver:d}=h;this._r=d,f&&(this._k=f),m&&(this._s=m)}}const m=t=>Array.isArray(t)?t:[t];class f{constructor(){this._s={},this._r={},this._a=[],this._l=[],this.getIndex=t=>this._a.findIndex((s=>s===t)),this.get=t=>this._s[t],this.has=t=>!!t&&!!this.get(t),this.getAll=()=>this._s,this.add=(t,s)=>{if(!this._s[t])return this._s[t]=s,this._a.push(s),this.notify(),!0},this.status=t=>{const s=this.get(t);return!!s&&-1!==this.getIndex(s)},this.on=t=>{const s=m(t).reduce(((t,s)=>{const e=this.get(s);return!(!e||this.status(s))&&(this._a.push(e),t)}),!0);return this.notify(),s},this.off=t=>{const s=m(t).reduce(((t,s)=>{const e=this.get(s);if(e&&this.status(s)){const s=this.getIndex(e);return this._a.splice(s,1),t}return!1}),!0);return this.notify(),s},this.remove=t=>{const s=this.get(t);if(!s)return;const e=this.getIndex(s);return e>-1&&(this._a.splice(e,1),delete this._s[t],delete this._r[t]),this.notify(),!0},this.pack=(t,s)=>{const e=new CSSStyleSheet;if(e.replaceSync(s),e.cssRules.length)return this.add(t,e);console.log(`StyleSheet '${t}' is empty`)},this.replace=(t,s)=>{const e=this._s[t];if(e)return e.replaceSync(s),this.notify(),!0},this.apply=t=>{t.adoptedStyleSheets=this._a},this.registerNode=t=>{this._l.findIndex((s=>s.deref()===t))>=0||(this._l.push(new WeakRef(t)),this.apply(t))},this.unregisterNode=t=>{const s=this._l.findIndex((s=>s.deref()===t));s>=0&&this._l.splice(s,1)},this.notify=()=>{this._l=this._l.reduce(((t,s)=>{const e=s.deref();return e&&(this.apply(e),t.push(s)),t}),[])}}removeAll(){return this._a.splice(0),this._s={},this._r={},this.notify(),!0}}const d=(...t)=>t.join(","),b="rem",p="-",u=" ",g="-x",_="-y",v="down",$="horizontal",y="vertical",x="text",w=x+p,k="font",j=k+p,z="column",O=z+p,S="max-",A="min-",E="content",C=E+"s",N="-items",W="self",I="inline",P="block",K="size",q="-radius",M="direction",R="outline",B="style",F=p+B,J="end",L=p+J,G="start",H=p+G,T="center",Z="word",D="line",Q="break",U=Q+p,V="wrap",X="no"+V,Y="rule",tt="object",st="top",et=p+st,it="left",rt=p+it,nt="bottom",ot=p+nt,lt="right",at=p+lt,ct="width",ht=p+ct,mt="color",ft=p+mt,dt="overflow",bt="align",pt="type",ut="transform",gt="all",_t="height",vt="normal",$t="opacity",yt="visibility",xt="scale",wt="box",kt=p+wt,jt="border",zt="position",Ot="none",St="auto",At="fill",Et="stroke",Ct="reverse",Nt="space",Wt="fixed",It="origin",Pt="alpha",Kt="luminance",qt="clip",Mt="zoom",Rt="scroll",Bt="padding",Ft="margin",Jt="both",Lt="mode",Gt="repeat",Ht="light",Tt="linear",Zt="hidden",Dt="shadow",Qt="behavior",Ut="orientation",Vt="name",Xt="after",Yt="before",ts="image",ss="list"+F,es=ss+p+pt,is=ss+p+zt,rs=ss+p+ts,ns=mt+"-scheme",os=jt+ot,ls=jt+rt,as=jt+at,cs=jt+et,hs=jt+p+P,ms=jt+p+I,fs=hs+H,ds=hs+L,bs=ms+H,ps=ms+L,us=jt+ht,gs=os+ht,_s=ls+ht,vs=as+ht,$s=cs+ht,ys=hs+ht,xs=ms+ht,ws=fs+ht,ks=ds+ht,js=bs+ht,zs=ps+ht,Os=jt+q,Ss=os+rt+q,As=os+at+q,Es=cs+rt+q,Cs=cs+at+q,Ns=jt+H+L+q,Ws=jt+H+H+q,Is=jt+L+L+q,Ps=jt+L+H+q,Ks=jt+ft,qs=ls+ft,Ms=as+ft,Rs=cs+ft,Bs=os+ft,Fs=hs+ft,Js=ms+ft,Ls=fs+ft,Gs=ds+ft,Hs=bs+ft,Ts=ps+ft,Zs=jt+F,Ds=ls+F,Qs=as+F,Us=cs+F,Vs=os+F,Xs=hs+F,Ys=ms+F,te=fs+F,se=ds+F,ee=bs+F,ie=ps+F,re=R+ft,ne=R+ht,oe=R+F,le=R+p+"offset",ae=dt+g,ce=dt+_,he=tt+p+"fit",me=tt+p+zt,fe=xt+p+v,de=wt+p+Dt,be=Bt+kt,pe=jt+kt,ue=E+kt,ge=At+kt,_e=Et+kt,ve="view"+kt,$e="no-"+qt,ye=Gt+g,xe=Gt+_,we="no-"+Gt,ke=Bt+rt,je=Bt+et,ze=Bt+at,Oe=Bt+ot,Se=Ft+rt,Ae=Ft+et,Ee=Ft+at,Ce=Ft+ot,Ne="grid",We="row",Ie="gap",Pe="justify",Ke="flex",qe=Ke+p,Me="place"+N,Re=I+p+Ke,Be=qe+"basis",Fe=qe+"grow",Je=qe+"shrink",Le=qe+M,Ge=qe+V,He=Pe+p+E,Te=Pe+N,Ze=bt+N,De=bt+p+E,Qe=bt+p+W,Ue=Ne+p+"template",Ve=Ue+p+We+"s",Xe=Ue+p+z+"s",Ye=We+p+Ie,ti=O+Ie,si=Pe+p+W,ei=Ne+p+We,ii=ei+L,ri=ei+H,ni=Ne+p+z,oi=ni+L,li=ni+H,ai=O+"count",ci=O+At,hi=O+Y,mi=hi+ft,fi=hi+F,di=hi+ht,bi=O+"span",pi=z+ht,ui=We+p+Ct,gi=O+Ct,_i=V+p+Ct,vi=Ke+L,$i=Ke+H,yi=Nt+"-between",xi=Nt+"-around",wi=Nt+"-evenly",ki=I+p+Ne,ji="mask-",zi=ji+qt,Oi=ji+"composite",Si=ji+Lt,Ai=ji+It,Ei=ji+zt,Ci=ji+Gt,Ni=ji+K,Wi=ji+pt,Ii="timing-function",Pi="delay",Ki="duration",qi="animation",Mi=qi+p,Ri=Mi+Vt,Bi=Mi+Ii,Fi=Mi+M,Ji=Mi+"iteration-count",Li=Mi+Ki,Gi=Mi+Pi,Hi=Mi+"play-state",Ti=Mi+At+p+Lt,Zi="transition",Di=Zi+p,Qi=Di+Qt,Ui=Di+"property",Vi=Di+Ii,Xi=Di+Ki,Yi=Di+Pi,tr="alternate",sr=tr+p+Ct,er="-out",ir="ease",rr=ir+"-in",nr=rr+er,or=ir+er,lr="step",ar=lr+H,cr=lr+L,hr="translate",mr="rotate",fr="perspective",dr=fr+p+It,br=it+u+st,pr=lt+u+st,ur=it+u+nt,gr=lt+u+nt,_r="inset",vr=_r+p,$r=ut+kt,yr=ut+p+It,xr=ut+F,wr=vr+P,kr=wr+L,jr=wr+H,zr=vr+I,Or=zr+L,Sr=zr+H,Ar="fit-"+E,Er=A+E,Cr=S+E,Nr=wt+"-sizing",Wr=S+ct,Ir=A+ct,Pr=S+_t,Kr=A+_t,qr=P+p+K,Mr=S+qr,Rr=A+qr,Br=I+p+K,Fr=S+Br,Jr=A+Br,Lr=Rt+p+Qt,Gr=Rt+p+Ft,Hr=Gr+et,Tr=Gr+ot,Zr=Gr+rt,Dr=Gr+at,Qr=Gr+p+P,Ur=Qr+L,Vr=Qr+H,Xr=Gr+p+I,Yr=Xr+L,tn=Xr+H,sn=Rt+p+Bt,en=sn+et,rn=sn+ot,nn=sn+rt,on=sn+at,ln=sn+p+P,an=ln+L,cn=ln+H,hn=sn+p+I,mn=hn+L,fn=hn+H,dn=Rt+p+"snap",bn=dn+p+bt,pn=dn+p+"stop",un=dn+p+pt,gn="over"+Lr,_n=" mandatory",vn="x"+_n,$n="y"+_n,yn=P+_n,xn=I+_n,wn=Jt+_n,kn=" proximity",jn="x"+kn,zn="y"+kn,On=P+kn,Sn=I+kn,An=Jt+kn,En=w+"decoration",Cn=En+p+mt,Nn=En+p+"thickness",Wn=En+p+B,In=En+p+D,Pn="white-"+Nt,Kn=w+ut,qn=w+bt,Mn=y+p+bt,Rn=w+dt,Bn=w+Ut,Fn=w+"rendering",Jn=w+Dt,Ln=w+"emphasis",Gn=Ln+ft,Hn=Ln+p+zt,Tn=Ln+F,Zn=w+V,Dn=Zn+p+Lt,Qn=Zn+F,Un=Z+p+Q,Vn=j+K,Xn=j+"weight",Yn=j+"family",to=j+B,so=j+"synthesis",eo=j+"variant",io=eo+p+tr+"s",ro=eo+"-caps",no=eo+"-numeric",oo=eo+p+zt,lo=eo+"-east-asian",ao=eo+"-ligatures",co=eo+"-settings",ho="writing-"+Lt,mo=D+p+_t,fo=D+p+Q,bo=D+"-through",po="over"+D,uo="under"+D,go="pre",_o=go+p+D,vo=go+p+V,$o=U+Nt+"s",yo=U+gt,xo=U+Z,wo=U+Xt,ko=U+Yt,jo=$+"-tb",zo=y+"-lr",Oo=y+"-rl",So="keep-"+gt,Ao="pointer",Eo="pan",Co=Eo+g,No=Eo+rt,Wo=Eo+at,Io=Eo+_,Po=Eo+p+v,Ko="pinch-"+Mt,qo=y+p+x,Mo="grab",Ro=Mo+"bing",Bo="resize",Fo="col-"+Bo,Jo="row-"+Bo,Lo="n-"+Bo,Go="e-"+Bo,Ho="s-"+Bo,To="w-"+Bo,Zo="ne-"+Bo,Do="ew-"+Bo,Qo="nw-"+Bo,Uo="se-"+Bo,Vo="sw-"+Bo,Xo="ns-"+Bo,Yo="nesw-"+Bo,tl="nwse-"+Bo,sl=Mt+p+"in",el=Mt+p+"out",il=Ao+"-events",rl=Rt+p+zt,nl="caret"+ft,ol="accent"+ft,ll="filter",al="backdrop-"+ll,cl="background",hl=cl+p,ml=hl+ts,fl=hl+mt,dl=hl+qt,bl=hl+It,pl=hl+zt,ul=pl+g,gl=pl+_,_l=hl+Gt,vl=hl+K,$l=hl+"blend-"+Lt,yl=hl+"attachment",xl="gradient",wl=Tt+p+xl,kl="radial-"+xl,jl="conic-"+xl,zl=E+p+yt,Ol=Et+ht,Sl=Et+p+$t,Al=At+p+Y,El=At+p+$t,Cl=mt+"-dodge",Nl=mt+"-burn",Wl="hard-"+Ht,Il="soft-"+Ht,Pl=mt+"-mix",Kl="revert",ql=Kl+"-layer",Ml="container",Rl=Ml+p+pt,Bl=Ml+p+Vt,Fl=":first-",Jl=":last-",Ll=":only-",Gl="child",Hl="of-type",Tl=":nth-child",Zl="prefers-",Dl=Zl+ns,Ql="@media",Ul=mt+"-gamut",Vl=Zl+"contrast",Xl="scripting",Yl="::"+Xt,ta="::"+Yt,sa="sideways",ea=sa+at,ia={0:0,"1/12":"0.0833","1/10":"0.1","1/6":"0.1667","1/5":"0.2","1/4":"0.25","3/10":"0.3","1/3":"0.3333","2/5":"0.4","5/12":"0.4167","1/2":"0.5","7/12":"0.5833","3/5":"0.6","2/3":"0.6667","7/10":"0.7","3/4":"0.75","4/5":"0.8","5/6":"0.8333","9/10":"0.9","11/12":"0.9167",1:"1"},ra=[...Array(12).keys()].reduce(((t,s)=>(t[s]=s,t)),{}),na={u:{ini:"initial",inh:"inherit",u:"unset",r:Kl,rl:ql},rep:{rx:ye,ry:xe,r:Gt,s:Nt,ro:"round",nr:we},cnt:{n:vt,s:K,is:Br},time:{def:300,xs:100,s:200,m:300,l:450,xl:600,no:0,min:50,max:750},lig:{def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},hue:{def:261.35,b:261.35,i:194.77,e:29.23,w:70.66,s:142.49},chr:{def:.03,xs:.03,s:.06,m:.1,l:.15,xl:.25},alp:{def:1,min:0,xs:.1,s:.25,m:.5,l:.75,xl:.9,max:1},cu:{c:"currentColor",t:"transparent"},ff:{def:"Roboto, sans-serif",h:"Georgia, serif"},fwg:{xs:100,s:200,m:400,l:600,xl:700},fsz:{xs:.25,s:.5,m:1,l:1.5,xl:2},fst:{i:"italic",n:vt,o:"oblique"},lsp:{no:0,s:.05,m:.1,l:.2},ws:{n:vt,nw:X,p:go,pl:_o,pw:vo,bs:$o},wb:{n:vt,ba:yo,ka:So,bw:xo},wm:{htb:jo,vlr:zo,vrl:Oo},hyp:{no:Ot,m:"manual",a:St},tt:{l:"lowercase",u:"uppercase",c:"capitalize"},td:{lt:bo,o:po,u:uo},tor:{m:"mixed",u:"upright",sr:ea,s:sa,ugo:"use-glyph-"+Ut},ta:{l:it,c:T,j:Pe,r:lt,s:G,e:J},fr:ia,coef:ra,rat:{1:1,"2/1":2,"1/2":.5,"4/3":1.3333,"3/4":.75,"9/16":.5625,"16/9":1.7778},sp:{"3xs":.125,"2xs":.25,xs:.5,s:.75,m:1,l:1.25,xl:1.5,"2xl":2,"3xl":4},sz:{"3xs":1,"2xs":1.5,xs:2,s:5,m:10,l:15,xl:20,"2xl":25,"3xl":30},usz:{a:"auto",no:0,min:Er,max:Cr,fit:Ar},rad:{s:.5,m:1,l:2},th:{s:.1,m:.25,l:.5},csz:{cv:"cover",cn:"contain",a:St,f:At,sd:fe},box:{c:ue,p:be,b:pe,f:ge,s:_e,v:ve,nc:$e,t:x},sc:{xs:.5,s:.67,m:1,l:1.5,xl:2},tr:{xs:.25,s:.5,m:1,l:1.5,xl:2},sk:{xs:-15,s:-10,m:0,l:10,xl:15},rot:{xs:-180,s:-90,m:0,l:90,xl:180},z:{s:.8,m:1,l:1.2},pers:{s:10,m:15,l:20},ali:{s:G,e:J,c:T,st:"stretch",sb:yi,sa:xi,se:wi,b:"baseline",fs:$i,fe:vi,no:Ot},dis:{g:Ne,ig:ki,f:Ke,if:Re,b:P,i:I},ca:ra,co:ra,ra:ra,ro:ra,fd:{r:We,rr:ui,c:z,cr:gi},fb:ia,fo:ra,fg:ra,fs:ra,fw:{w:V,nw:X,wr:_i},lh:{xs:1,s:1.25,m:1.5,l:1.75,xl:2},lb:{a:St,any:"anywhere",n:vt,l:"loose",s:"strict"},ls:{no:Ot,dt:"dotted",i:_r,h:Zt,ds:"dashed",s:"solid",db:"double",o:"outset",r:"ridge",g:"groove"},ov:{h:Zt,s:Rt,a:St,c:qt,e:"ellipsis"},v:{h:Zt,v:"visible",c:"collapse",a:St},o:{min:0,xs:.1,s:.25,m:.5,l:.75,xl:.9,max:1},zi:{min:-1,1:1,2:2,3:3,4:4,5:5,max:10},ttf:{l:Tt,e:ir,ei:rr,eo:or,eio:nr,ss:ar,se:cr},tp:{col:d(mt,fl,Ks,Cn),icon:d(At,Et),flt:d(ll,al),ind:d(Bt,Ft),sz:d(ct,Wr,Ir,_t,Pr,Kr),esz:d(Rr,qr,Mr,Jr,Br,Fr),o:$t,b:jt,f:Ke,g:Ne,pos:d(zt,it,st,nt,lt),tf:d(ut,hr,xt,mr,"skew",fr)},tb:{ad:"allow-discrete",n:vt},aic:{inf:"infinite",1:1,2:2,3:3,4:4,5:5},wc:{a:St,sp:rl,c:C,tf:ut,o:$t,i:_r,tfi:d(ut,_r)},afm:{no:Ot,f:"forwards",b:"backwards",both:Jt},adir:{r:Ct,a:tr,ar:sr},aps:{r:"running",p:"paused"},pe:{a:St,no:Ot,all:gt,f:At,s:Et},cur:{h:"help",a:St,p:Ao,cm:"context-menu",pr:"progress",w:"wait",cell:"cell",crh:"crosshair",t:x,vt:qo,cp:"copy",m:"move",g:Mo,gng:Ro,cr:Fo,rr:Jo,nr:Lo,er:Go,sr:Ho,wr:To,ner:Zo,ewr:Do,nwr:Qo,ser:Uo,swr:Vo,nsr:Xo,neswr:Yo,nwser:tl,zi:sl,zo:el},res:{n:Ot,v:y,h:$,b:Jt},toa:{a:St,no:Ot,px:Co,pl:No,pr:Wo,py:Io,pu:"pan-up",pd:Po,pz:Ko,m:"manipulation"},us:{n:Ot,t:x,all:gt,a:St},sb:{a:St,s:"smooth"},sss:{n:vt,a:"always"},sst:{n:Ot,x:"x",y:"y",b:P,i:I,both:Jt,xm:vn,ym:$n,bm:yn,im:xn,bothm:wn,xp:jn,yp:zn,bp:On,ip:Sn,bothp:An},pos:{r:"relative",a:"absolute",f:Wt,s:"static"},posv:{b:nt,t:st,c:T,l:it,r:lt,lt:br,rt:pr,lb:ur,rb:gr},cf:{a:St,b:"balance"},cs:{no:Ot,all:gt},mc:{a:"add",s:"subtract",i:"intersect",e:"exclude"},mt:{a:Pt,l:Kt},mm:{a:Pt,l:Kt,m:"match-source"},bgbm:{n:vt,m:"multiply",scr:"screen",o:"overlay",d:"darken",l:Ht+"en",dif:"difference",exc:"exclusion",h:"hue",sat:"saturation",c:mt,lum:"luminosity",cd:Cl,cb:Nl,hl:Wl,sl:Il},bga:{s:Rt,f:Wt,l:"local"}},oa={a:qi,an:Ri,adur:Li,adel:Gi,aps:Hi,afm:Ti,adir:Fi,aic:Ji,atf:Bi,tn:Zi,tdur:Xi,tdel:Yi,tb:Qi,tp:Ui,ttf:Vi,ba:wo,bb:ko,bor:jt,bw:us,br:Os,bs:Zs,bls:Ds,brs:Qs,bts:Us,bbs:Vs,bbls:Xs,bis:Ys,bbss:te,bbes:se,biss:ee,bies:ie,brw:vs,blw:_s,btw:$s,bbw:gs,btlr:Es,btrr:Cs,bbrr:As,bblr:Ss,biw:xs,bblw:ys,bbew:ks,bbsw:ws,bisw:js,biew:zs,besr:Ps,beer:Is,bssr:Ws,bser:Ns,bc:Ks,blc:qs,brc:Ms,btc:Rs,bbc:Bs,bblc:Fs,bic:Js,bbsc:Ls,bbec:Gs,bisc:Hs,biec:Ts,bg:cl,bgi:ml,bgc:fl,c:mt,cmix:Pl,csh:ns,acc:ol,ctc:nl,st:Et,stw:Ol,sto:Sl,fi:At,fir:Al,fio:El,flt:ll,bf:al,dis:"display",g:Ne,jc:He,ji:Te,ai:Ze,pi:Me,ac:De,gt:Ue,gtr:Ve,gtc:Xe,gp:Ie,rg:Ye,cg:ti,as:Qe,js:si,gr:ei,gre:ii,grs:ri,gc:ni,gce:oi,gcs:li,fx:Ke,fxd:Le,fxw:Ge,fxs:Je,fxg:Fe,fxb:Be,ord:"order",dir:M,m:Ft,ml:Se,mr:Ee,mt:Ae,mb:Ce,p:Bt,pl:ke,pr:ze,pt:je,pb:Oe,out:R,oc:re,ow:ne,os:oe,oo:le,l:it,r:lt,t:st,b:nt,ins:_r,ib:wr,ibe:kr,ibs:jr,ii:zr,iie:Or,iis:Sr,wc:"will-change",app:"appearance",pe:il,cur:"cursor",toa:"touch-action",us:"user-select",res:Bo,lis:ss,lisp:is,lisi:rs,list:es,sb:Lr,ssa:bn,sss:pn,sst:un,sm:Gr,sml:Zr,smr:Dr,smt:Hr,smb:Tr,sp:sn,spl:nn,spr:on,spt:en,spb:rn,smbl:Qr,smbe:Ur,smbs:Vr,smi:Xr,smie:Yr,smis:tn,spbl:ln,spbe:an,spbs:cn,spi:hn,spie:mn,spis:fn,osb:gn,ar:"aspect-ratio",w:ct,maxw:Wr,minw:Ir,h:_t,minh:Kr,maxh:Pr,bl:qr,maxb:Mr,minb:Rr,i:Br,mini:Jr,maxi:Fr,per:fr,pero:dr,rot:mr,sc:xt,tf:ut,tfb:$r,tfo:yr,tfs:xr,tr:hr,z:Mt,lts:"letter-spacing",lh:mo,lb:fo,f:k,fst:to,ff:Yn,fwg:Xn,fsz:Vn,fsn:so,fv:eo,fva:io,fvc:ro,fvea:lo,fvl:ao,fvn:no,fvs:co,fvp:oo,tt:Kn,td:En,tdt:Nn,tds:Wn,tdl:In,ta:qn,to:Rn,trg:Fn,ts:Jn,te:Ln,tep:Hn,tec:Gn,tes:Tn,tw:Zn,twm:Dn,tws:Qn,va:Mn,ws:Pn,tor:Bn,wb:Un,wm:ho,hyp:"hyphens",bsz:Nr,bsh:de,pos:zt,cf:ci,crs:fi,crc:mi,crw:di,cs:bi,cw:pi,cc:ai,bgcl:dl,bgp:pl,bgpx:ul,bgpy:gl,bgbm:$l,bgo:bl,bgr:_l,bga:yl,bgsz:vl,mcl:zi,mcm:Oi,mm:Si,mo:Ai,mp:Ei,mre:Ci,msz:Ni,mtp:Wi,obf:he,obp:me,con:E,ov:dt,ovx:ae,ovy:ce,v:yt,cv:zl,o:$t,zi:"z-index",lgr:wl,rgr:kl,cgr:jl,inf:"infinite",cnt:Rl,cnn:Bl,$:":root",$u:"*",$h:":hover",$f:":focus",$fv:":focus-visible",$a:":active",$v:":visited",$val:":valid",$inv:":invalid",$e:":empty",$d:":disabled",$r:":required",$o:":optional",$m:":modal",$l:":link",$fc:Fl+Gl,$lc:Jl+Gl,$oc:Ll+Gl,$1:Tl+"(odd)",$2:Tl+"(even)",$ft:Fl+Hl,$lt:Jl+Hl,$ot:Ll+Hl,$bef:ta,$aft:Yl,$bd:"::backdrop",$ba:`&${ta},&${Yl}`,$pl:":placeholder",$light:Ql+`(${Dl}: light)`,$dark:Ql+`(${Dl}: dark)`,$red_m:Ql+"(prefers-reduced-motion: reduce)",$ori_l:Ql+`(${Ut}: landscape)`,$ori_p:Ql+`(${Ut}: portrait)`,$gam_srgb:Ql+`(${Ul}: srgb)`,$gam_p3:Ql+`(${Ul}: p3)`,$gam_rec:Ql+`(${Ul}: rec2020)`,$con_no:Ql+`(${Vl}: no-preference)`,$con_m:Ql+`(${Vl}: more)`,$con_l:Ql+`(${Vl}: less)`,$con_c:Ql+`(${Vl}: custom)`,$scr_no:Ql+`(${Xl}: none)`,$scr_ini:Ql+`(${Xl}: initial-only)`,$scr_en:Ql+`(${Xl}: enabled)`,$ss:"@starting-style",$ns:"@namespace"},la={xs:30+b,sm:40+b,md:48+b,lg:64+b,xl:80+b},aa={xs:10+b,sm:20+b,md:30+b,lg:40+b,xl:48+b},ca={$c:"{u.inh}",$fsz:"16px",$ff:"{ff.def}",$$u:{$c:"{u.inh}",$fsz:"16px",$ff:"{ff.def}"}},ha={light:{lig:{def:.75,c:.05,s:.65,m:.75,l:.85,n:.9}},dark:{lig:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}},ma="{1}rem",fa="{1}deg",da="span {1}",ba={fb:"calc(100% * {1})",ra:da,ca:da,sz:ma,sp:ma,rad:ma,th:ma,bp:ma,cbp:ma,fsz:ma,lsp:ma,tr:ma,pers:ma,sk:fa,rot:fa,time:"{1}ms"},pa="style-provider",ua=t=>"object"==typeof t;class ga{constructor({prefix:t,initContent:s,hydrate:e}={}){this._c=0,this._k=new Set,this._=new Map,this.use=(t,s)=>{const e=this._.get(t);if(e)return e;const i=s||this._p+this._c.toString(36);return this._k.add(i),this._.set(t,i),this._c++,i},this.mutate=(t,s)=>Object.assign(this.getConfigs()[t],s),this.getKey=t=>this._.get(t),this.getKeys=()=>[...this._k],this.getConfigs=()=>Object.fromEntries(this._.entries().map((([t,s])=>[s,t]))),this._p=t||"eff",s&&Object.entries(s).forEach((([t,s])=>this.use(s,t))),e&&(this._c=0)}}const _a=Object.entries,va=t=>"application/json"===(null==t?void 0:t.getAttribute("type")),$a=t=>Array.isArray(t)?t:[t];!function(t={}){const{name:s=pa,styles:e={},settings:i={}}=t,r=window.document,n=window.customElements;!(null==n?void 0:n.get(s))&&(n.define(s,class extends HTMLElement{constructor(){super(...arguments),this._setState=()=>{const{units:t={},keys:e={},sets:i,mediaBP:r=la,containerBP:n=aa,rootStyle:o=ca,themes:l=ha}=this.settingsContent,a=Object.assign(Object.assign({},ba),t),c=Object.assign(Object.assign({},oa),e),h=Object.assign({},na);i&&_a(i).forEach((([t,s])=>h[t]=Object.assign({},s)));const m=_a(l);if(a)for(const t in a)h[t]=h[t]&&Object.fromEntries(_a(h[t]).map((([s,e])=>[s,a[t].replace("{1}",""+e)])));r&&_a(r).forEach((([t,s])=>{c[`min_${t}_`]=`@media (min-width:${s})`,c[`max_${t}_`]=`@media (max-width:${s})`})),n&&_a(n).forEach((([t,s])=>{c[`cmin_${t}_`]=`@container (min-width:${s})`,c[`cmax_${t}_`]=`@container (max-width:${s})`}));const f={},d={};l&&h&&m.forEach((([t,s])=>{const e={};_a(s).forEach((([t,s])=>{_a(s).forEach((([s,i])=>{var r;const n=this._r.varName(this.prefix,t,s);a[t]?e[n]=a[t].replace("{1}",""+i):e[n]=i,f[n]||(f[n]=(null===(r=h[t])||void 0===r?void 0:r[s])||"unset",h[t]||(h[t]={}),h[t][s]=`var(${n})`)}))})),d[t]=e})),this._d={sets:h,keys:c},this._mc={c:Object.assign(Object.assign({[s]:{display:"contents"},_theme:d,$$:Object.assign(f,o)},(null==d?void 0:d.dark)?{$$dark:{$$:d.dark}}:{}),(null==d?void 0:d.light)?{$$light:{$$:d.light}}:{})}},this._res=t=>"string"==typeof t?t:this._c.getKey(t),this.use=(t,s)=>{let e=this._c.use(t,s);return this._m&&!this._m.has(s)&&this._m.pack(e,this.css(t,e)),this.resolve(e)},this.alter=(t,s)=>{const e=this._res(t);if(e){const t=this._c.mutate(e,s);this._m.replace(e,this.css(t,e))}return this.resolve(e)},this.usePublic=t=>Object.fromEntries(_a(t).map((([t,s])=>[t,this.use(s,t)]))),this.usePrivate=t=>t.map((t=>this.use(t))),this.css=(t,s)=>{var e;return null===(e=this._p)||void 0===e?void 0:e.compile(s,t)},this.status=t=>{const s=this._res(t);return!!s&&this._m.status(s)},this.on=t=>this._m.on($a(t).map(this._res)),this.off=t=>this._m.off($a(t).map(this._res)),this.get=(t=this._mc)=>this._m.get(this._res(t)),this.getMany=(t=this._c.getKeys())=>t.map((t=>this.get(t))),this.resolve=t=>this._r.attr(t||this._c.getKey(this._mc)),this.subscribe=t=>this._m.registerNode(t),this.unsubscribe=t=>this._m.unregisterNode(t)}get prefix(){return this.getAttribute("prefix")||"eff"}get mode(){return this.getAttribute("mode")||"a"}get isolated(){return null!==this.getAttribute("isolated")}get hydrate(){return null!==this.getAttribute("hydrate")}get eventName(){return this.getAttribute("eventname")||"effcsschanges"}get settingsContent(){const t=null==r?void 0:r.querySelector("#"+(this.getAttribute("settingsid")||"effcss"));let s;return s=va(t)?JSON.parse((null==t?void 0:t.textContent)||"{}"):t?null==t?void 0:t.effcss:i,s||{}}get initContent(){const t=r.querySelectorAll("."+(this.getAttribute("initcls")||"effcss_init"));let s=e||{};return t.forEach((t=>{let e;e=va(t)?JSON.parse((null==t?void 0:t.textContent)||"{}"):null==t?void 0:t.effcss,s=Object.assign(Object.assign({},s),e||{})})),s}get configs(){return this._c.getConfigs()}connectedCallback(){this._r=(t=>{const{mode:s}=t,e=t=>Object.entries(t).reduce(((t,[s,e])=>(void 0!==e&&t.push(s+(e?"-"+e:"")),t)),[]).join(" "),i=(t,s)=>Object.defineProperties({[t]:s},{k:{value:t},v:{value:s}}),r=(...t)=>"--"+t.join("-"),n=(...t)=>t.join("-");return"c"===s?{selector:({b:t,e:s,m:e,mv:i})=>`.${t}${(s?"__"+s:"")+(e?"_"+e:"")+(e&&i?"_"+i:"")}`,attr:t=>s=>r=>{let n=r||"";ua(n)&&(n=e(n));const o=t+(s?"__"+s:"");return n=o+(n?" "+(null==n?void 0:n.split(" ").map((t=>o+"_"+t.split("-").join("_"))).join(" ")):""),i("class",n)},varName:r,kfName:n}:{selector:({b:t,e:s,m:e,mv:i})=>`[data-${t}${s?"-"+s:""}${e?'~="'+(e||"")+(i?"-"+i:"")+'"':""}]`,attr:t=>s=>r=>{const n=`data-${t}${s?"-"+s:""}`;let o=r||"";return ua(o)&&(o=e(o)),i(n,o)},varName:r,kfName:n}})({mode:this.mode}),this._setState();const t=this.initContent,s=this.prefix;var e;this._c=(e={hydrate:this.hydrate,prefix:s,initContent:t},new ga(e)),this._p=function(t){return new h(t)}({sets:this._d.sets,keys:this._d.keys,resolver:this._r}),this._m=new f;const i=t=>this.dispatchEvent(new CustomEvent(this.eventName,{detail:{styles:t},bubbles:!0}));this._n={set adoptedStyleSheets(t){i(t)}},this.subscribe(this._n),this.use(this._mc),this.usePublic(t),r&&!this.isolated&&this._m.registerNode(r)}}),window.__EFFCSS_PARAMS__={name:s,styles:e,settings:i})}();
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{units as t,keys as
|
|
1
|
+
import{units as t,keys as s,sets as e,PREFIX as i,EVENT_NAME as n,SETTINGS_SCRIPT_ID as r,STYLES_SCRIPT_CLS as h,PROVIDER_TAG_NAME as o,mediaBP as l,containerBP as c,rootStyle as a,themes as u}from"./constants.js";import{createResolver as _,createCollector as d}from"./utils/common.js";const f=Object.entries,m=(t,s,e)=>f(t).reduce(s,e),g=t=>"object"==typeof t,p=t=>`{${t}}`,v=Object.assign.bind(Object),y=(t,s)=>`${t}:${s};`,b=(t,s)=>["@property",t,p(y("syntax",s.syn||'"*"')+y("inherits",s.inh||!1)+(s.ini?y("initial-value",s.ini):""))].join(" "),$=t=>`var(${t})`,j=({l:t,c:s,h:e,a:i=1})=>`oklch(${t} ${s} ${e} / ${i})`,k=["l","c","h","a"];class S{constructor(t){this._k={},this._s={},this._sel=t=>{let s,e,i,n,r;return[s,r]=t.split(":"),s.startsWith("__")?[e,i,n]=s.slice(2).split("_"):[e,i,n]=s.split("_"),{e:e,m:i,mv:n,s:r}},this._var=(...t)=>this._r.varName(...t),this._kf=(...t)=>this._r.kfName(...t),this.compile=(t,s)=>{const{_:e,kf:i,k:n={},v:r={},c:h}=s,o=this._r.selector.bind(this),l=this._sel;let c=v({},h),a=v({},n),u=v({_:{}},r),_="";if(e)for(let s in e){const i=e[s];if("c"===i.typ){const e={};k.forEach((n=>{const r=s+n,h=this._var(t,r);e[n]=h,a["_"+r]=e[n],_+=b(h,i)})),u._[s]=j({l:$(e.l),c:$(e.c),h:$(e.h),a:$(e.a)}),i.all&&(c["_"+s+"l"]=`&lig=>${this._var(t,s+"l")}:{1}`,c["_"+s+"c"]=`&chr=>${this._var(t,s+"c")}:{1}`,c["_"+s+"h"]=`&hue=>${this._var(t,s+"h")}:{1}`,c["_"+s+"a"]=`&alp=>${this._var(t,s+"a")}:{1}`)}else{const e=this._var(t,s);a["_"+s]=e,u._[s]=$(e),_+=b(e,i)}}const d=t=>a[t]||this._k[t],S=t=>{var s;return u[t]||this._s[t]||(null===(s=this._s)||void 0===s?void 0:s.root[t])},A=t=>t.replaceAll(/\{(.+?)\}/g,((t,s)=>{const[e,i]=s.split(".");let n;if(i){const t=S(e);n=(null==t?void 0:t[i])||(null==t?void 0:t.def)||""}else n=d(e)||"";return""+n})),x=t=>{const s=t.split("?");let e;for(let t in s){const i=s[t],[n,r]=i.split("=>"),h=n.match(/(\w+)(\[[\w,]+\])?/);if(!h)continue;const[o,l,c]=h,a=S(l);if(!a)continue;e=a;let u=f(e);const _=null==c?void 0:c.slice(1,-1).split(",");if(_){const t=new Set(_);u=u.filter((([s,e])=>t.has(s)))}if(r){let[t,s]=r.split("|");void 0===s&&(s=t,t=""),u=u.map((([e,i])=>[t.replace("{0}",e)||e,A(s.replaceAll("{1}",""+i))]))}(_||r)&&(e=Object.fromEntries(u));break}return e};function O(s,e,i){var n,r,h,c;let a=""+s;if((null===(n=null==s?void 0:s.startsWith)||void 0===n?void 0:n.call(s,"$"))&&(a=""+d(s.slice(1)),!a))return"";if(Array.isArray(e))return O(a,Object.assign({},...e.map((t=>"string"==typeof t?x(t):t))),i);if(null==e)return"";if(g(e)){const s=!i||(null===(r=i.startsWith)||void 0===r?void 0:r.call(i,"@"))||a.startsWith("&")||a.startsWith("@")?"":"&";if(a.startsWith("_")){const{e:i,m:n,mv:r}=l(a);return n&&"string"!=typeof r?m(e,((e,[r,h])=>{let l;return l=g(h)?m(h,((t,s)=>t+O(...s,a)),""):h+";",e+s+o({b:t,e:i,m:n,mv:r})+p(l)}),""):s+o({b:t,e:i,m:n,mv:r})+p(m(e,((t,s)=>t+O(...s,a)),""))}return s+a+p(m(e,((t,s)=>t+O(...s,a)),""))}{let t=""+e;return(null===(h=null==t?void 0:t.startsWith)||void 0===h?void 0:h.call(t,"&"))?O(a,x(t.slice(1)),i):(null===(c=null==t?void 0:t.includes)||void 0===c?void 0:c.call(t,"{"))?O(a,A(t),i):y(a.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())),t)}}let w="";if(i)for(let s in i){const e=i[s],n=this._kf(t,s);a["kf_"+s]=n,w+=`@keyframes ${n} `+p(m(e,((t,[s,e])=>t+s+(String(+s)===s?"%":"")+p(m(e,((t,s)=>t+O(...s)),""))),""))}return _+w+m(c,((t,s)=>t+O(...s)),"")};const{sets:s,keys:e,resolver:i}=t;this._r=i,e&&(this._k=e),s&&(this._s=s)}}const A=t=>Array.isArray(t)?t:[t];class x{constructor(){this._s={},this._r={},this._a=[],this._l=[],this.getIndex=t=>this._a.findIndex((s=>s===t)),this.get=t=>this._s[t],this.has=t=>!!t&&!!this.get(t),this.getAll=()=>this._s,this.add=(t,s)=>{if(!this._s[t])return this._s[t]=s,this._a.push(s),this.notify(),!0},this.status=t=>{const s=this.get(t);return!!s&&-1!==this.getIndex(s)},this.on=t=>{const s=A(t).reduce(((t,s)=>{const e=this.get(s);return!(!e||this.status(s))&&(this._a.push(e),t)}),!0);return this.notify(),s},this.off=t=>{const s=A(t).reduce(((t,s)=>{const e=this.get(s);if(e&&this.status(s)){const s=this.getIndex(e);return this._a.splice(s,1),t}return!1}),!0);return this.notify(),s},this.remove=t=>{const s=this.get(t);if(!s)return;const e=this.getIndex(s);return e>-1&&(this._a.splice(e,1),delete this._s[t],delete this._r[t]),this.notify(),!0},this.pack=(t,s)=>{const e=new CSSStyleSheet;if(e.replaceSync(s),e.cssRules.length)return this.add(t,e);console.log(`StyleSheet '${t}' is empty`)},this.replace=(t,s)=>{const e=this._s[t];if(e)return e.replaceSync(s),this.notify(),!0},this.apply=t=>{t.adoptedStyleSheets=this._a},this.registerNode=t=>{this._l.findIndex((s=>s.deref()===t))>=0||(this._l.push(new WeakRef(t)),this.apply(t))},this.unregisterNode=t=>{const s=this._l.findIndex((s=>s.deref()===t));s>=0&&this._l.splice(s,1)},this.notify=()=>{this._l=this._l.reduce(((t,s)=>{const e=s.deref();return e&&(this.apply(e),t.push(s)),t}),[])}}removeAll(){return this._a.splice(0),this._s={},this._r={},this.notify(),!0}}const O=Object.entries,w=t=>"application/json"===(null==t?void 0:t.getAttribute("type")),E=t=>Array.isArray(t)?t:[t];function C(f={}){const{name:m=o,styles:g={},settings:p={}}=f,v=window.document,y=window.customElements;return!(null==y?void 0:y.get(m))&&(y.define(m,class extends HTMLElement{constructor(){super(...arguments),this._setState=()=>{const{units:i={},keys:n={},sets:r,mediaBP:h=l,containerBP:o=c,rootStyle:_=a,themes:d=u}=this.settingsContent,f=Object.assign(Object.assign({},t),i),g=Object.assign(Object.assign({},s),n),p=Object.assign({},e);r&&O(r).forEach((([t,s])=>p[t]=Object.assign({},s)));const v=O(d);if(f)for(const t in f)p[t]=p[t]&&Object.fromEntries(O(p[t]).map((([s,e])=>[s,f[t].replace("{1}",""+e)])));h&&O(h).forEach((([t,s])=>{g[`min_${t}_`]=`@media (min-width:${s})`,g[`max_${t}_`]=`@media (max-width:${s})`})),o&&O(o).forEach((([t,s])=>{g[`cmin_${t}_`]=`@container (min-width:${s})`,g[`cmax_${t}_`]=`@container (max-width:${s})`}));const y={},b={};d&&p&&v.forEach((([t,s])=>{const e={};O(s).forEach((([t,s])=>{O(s).forEach((([s,i])=>{var n;const r=this._r.varName(this.prefix,t,s);f[t]?e[r]=f[t].replace("{1}",""+i):e[r]=i,y[r]||(y[r]=(null===(n=p[t])||void 0===n?void 0:n[s])||"unset",p[t]||(p[t]={}),p[t][s]=`var(${r})`)}))})),b[t]=e})),this._d={sets:p,keys:g},this._mc={c:Object.assign(Object.assign({[m]:{display:"contents"},_theme:b,$$:Object.assign(y,_)},(null==b?void 0:b.dark)?{$$dark:{$$:b.dark}}:{}),(null==b?void 0:b.light)?{$$light:{$$:b.light}}:{})}},this._res=t=>"string"==typeof t?t:this._c.getKey(t),this.use=(t,s)=>{let e=this._c.use(t,s);return this._m&&!this._m.has(s)&&this._m.pack(e,this.css(t,e)),this.resolve(e)},this.alter=(t,s)=>{const e=this._res(t);if(e){const t=this._c.mutate(e,s);this._m.replace(e,this.css(t,e))}return this.resolve(e)},this.usePublic=t=>Object.fromEntries(O(t).map((([t,s])=>[t,this.use(s,t)]))),this.usePrivate=t=>t.map((t=>this.use(t))),this.css=(t,s)=>{var e;return null===(e=this._p)||void 0===e?void 0:e.compile(s,t)},this.status=t=>{const s=this._res(t);return!!s&&this._m.status(s)},this.on=t=>this._m.on(E(t).map(this._res)),this.off=t=>this._m.off(E(t).map(this._res)),this.get=(t=this._mc)=>this._m.get(this._res(t)),this.getMany=(t=this._c.getKeys())=>t.map((t=>this.get(t))),this.resolve=t=>this._r.attr(t||this._c.getKey(this._mc)),this.subscribe=t=>this._m.registerNode(t),this.unsubscribe=t=>this._m.unregisterNode(t)}get prefix(){return this.getAttribute("prefix")||i}get mode(){return this.getAttribute("mode")||"a"}get isolated(){return null!==this.getAttribute("isolated")}get hydrate(){return null!==this.getAttribute("hydrate")}get eventName(){return this.getAttribute("eventname")||n}get settingsContent(){const t=null==v?void 0:v.querySelector("#"+(this.getAttribute("settingsid")||r));let s;return s=w(t)?JSON.parse((null==t?void 0:t.textContent)||"{}"):t?null==t?void 0:t.effcss:p,s||{}}get initContent(){const t=v.querySelectorAll("."+(this.getAttribute("initcls")||h));let s=g||{};return t.forEach((t=>{let e;e=w(t)?JSON.parse((null==t?void 0:t.textContent)||"{}"):null==t?void 0:t.effcss,s=Object.assign(Object.assign({},s),e||{})})),s}get configs(){return this._c.getConfigs()}connectedCallback(){this._r=_({mode:this.mode}),this._setState();const t=this.initContent,s=this.prefix;var e;this._c=d({hydrate:this.hydrate,prefix:s,initContent:t}),this._p=(e={sets:this._d.sets,keys:this._d.keys,resolver:this._r},new S(e)),this._m=new x;const i=t=>this.dispatchEvent(new CustomEvent(this.eventName,{detail:{styles:t},bubbles:!0}));this._n={set adoptedStyleSheets(t){i(t)}},this.subscribe(this._n),this.use(this._mc),this.usePublic(t),v&&!this.isolated&&this._m.registerNode(v)}}),window.__EFFCSS_PARAMS__={name:m,styles:g,settings:p},!0)}export{C as defineProvider};
|
|
@@ -23,67 +23,29 @@ export declare const containerBP: {
|
|
|
23
23
|
/**
|
|
24
24
|
* Default root styles
|
|
25
25
|
*/
|
|
26
|
-
export declare const rootStyle:
|
|
27
|
-
$c: string;
|
|
28
|
-
$fsz: string;
|
|
29
|
-
$ff: string;
|
|
30
|
-
$$u: {
|
|
31
|
-
$c: string;
|
|
32
|
-
$fsz: string;
|
|
33
|
-
$ff: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
26
|
+
export declare const rootStyle: object;
|
|
36
27
|
/**
|
|
37
28
|
* Default style params
|
|
38
29
|
*/
|
|
39
|
-
export declare const themes:
|
|
40
|
-
/**
|
|
41
|
-
* Light mode
|
|
42
|
-
*/
|
|
43
|
-
light: {
|
|
44
|
-
lig: {
|
|
45
|
-
def: number;
|
|
46
|
-
c: number;
|
|
47
|
-
s: number;
|
|
48
|
-
m: number;
|
|
49
|
-
l: number;
|
|
50
|
-
n: number;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Dark mode
|
|
55
|
-
*/
|
|
56
|
-
dark: {
|
|
57
|
-
lig: {
|
|
58
|
-
def: number;
|
|
59
|
-
n: number;
|
|
60
|
-
s: number;
|
|
61
|
-
m: number;
|
|
62
|
-
l: number;
|
|
63
|
-
c: number;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
};
|
|
30
|
+
export declare const themes: Record<'light' | 'dark', object>;
|
|
67
31
|
export declare const units: Record<string, string>;
|
|
68
32
|
/**
|
|
69
|
-
* Prefix
|
|
33
|
+
* Prefix for private stylesheets
|
|
70
34
|
*/
|
|
71
35
|
export declare const PREFIX = "eff";
|
|
72
36
|
/**
|
|
73
|
-
* Id for special script element
|
|
74
|
-
* which contains provider settings
|
|
37
|
+
* Id for special script element with provider settings
|
|
75
38
|
*/
|
|
76
39
|
export declare const SETTINGS_SCRIPT_ID = "effcss";
|
|
77
40
|
/**
|
|
78
|
-
* ClassName for special script elements
|
|
79
|
-
* which contain initial stylesheet configs
|
|
41
|
+
* ClassName for special script elements with initial stylesheet configs
|
|
80
42
|
*/
|
|
81
43
|
export declare const STYLES_SCRIPT_CLS = "effcss_init";
|
|
82
44
|
/**
|
|
83
|
-
*
|
|
45
|
+
* Style provider element tag
|
|
84
46
|
*/
|
|
85
47
|
export declare const PROVIDER_TAG_NAME = "style-provider";
|
|
86
48
|
/**
|
|
87
|
-
*
|
|
49
|
+
* Style change event name
|
|
88
50
|
*/
|
|
89
51
|
export declare const EVENT_NAME = "effcsschanges";
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
type TOptBool = boolean | undefined;
|
|
2
|
+
type TOptSheet = CSSStyleSheet | undefined;
|
|
3
|
+
type TStrDict = Record<string, string>;
|
|
4
|
+
type TDict = Record<string, string | number>;
|
|
5
|
+
type TMetaDict = Record<string, TDict>;
|
|
1
6
|
/**
|
|
2
7
|
* Stylesheet config
|
|
3
8
|
* @description
|
|
@@ -13,21 +18,21 @@ export type TStyleSheetConfig = {
|
|
|
13
18
|
* Keyframes
|
|
14
19
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes}
|
|
15
20
|
*/
|
|
16
|
-
kf?: Record<string,
|
|
21
|
+
kf?: Record<string, TMetaDict>;
|
|
17
22
|
/**
|
|
18
|
-
* Keys
|
|
23
|
+
* Keys dictionary
|
|
19
24
|
* @description
|
|
20
25
|
* Dictionary with primitive type values.
|
|
21
26
|
* In interpolation expressions, these values will have an advantage over the global ones.
|
|
22
27
|
*/
|
|
23
|
-
k?:
|
|
28
|
+
k?: TStrDict;
|
|
24
29
|
/**
|
|
25
|
-
* Values
|
|
30
|
+
* Values dictionary
|
|
26
31
|
* @description
|
|
27
|
-
* Dictionary with object
|
|
32
|
+
* Dictionary with object values.
|
|
28
33
|
* In interpolation expressions, these values will have an advantage over the global ones.
|
|
29
34
|
*/
|
|
30
|
-
v?:
|
|
35
|
+
v?: TMetaDict;
|
|
31
36
|
/**
|
|
32
37
|
* Stylesheet content
|
|
33
38
|
* @description
|
|
@@ -36,10 +41,19 @@ export type TStyleSheetConfig = {
|
|
|
36
41
|
*/
|
|
37
42
|
c: object;
|
|
38
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Dictionary of stylesheet configs
|
|
46
|
+
*/
|
|
47
|
+
export type TConfigDict = Record<string, TStyleSheetConfig>;
|
|
48
|
+
/**
|
|
49
|
+
* Array of stylesheet configs
|
|
50
|
+
*/
|
|
51
|
+
export type TConfigArray = TStyleSheetConfig[];
|
|
39
52
|
/**
|
|
40
53
|
* Style target
|
|
41
54
|
*/
|
|
42
55
|
export type TStyleTarget = string | TStyleSheetConfig;
|
|
56
|
+
export type TOneOrManyTargets = TStyleTarget | TStyleTarget[];
|
|
43
57
|
/**
|
|
44
58
|
* Provider settings
|
|
45
59
|
*/
|
|
@@ -55,28 +69,28 @@ export type TProviderSettings = {
|
|
|
55
69
|
/**
|
|
56
70
|
* Global params units
|
|
57
71
|
*/
|
|
58
|
-
units?:
|
|
72
|
+
units?: TStrDict;
|
|
59
73
|
/**
|
|
60
74
|
* Global keys
|
|
61
75
|
*/
|
|
62
|
-
keys?:
|
|
76
|
+
keys?: TStrDict;
|
|
63
77
|
/**
|
|
64
78
|
* Global sets of keys
|
|
65
79
|
*/
|
|
66
|
-
sets?:
|
|
80
|
+
sets?: TMetaDict;
|
|
67
81
|
/**
|
|
68
82
|
* Media queries breakpoints
|
|
69
83
|
*/
|
|
70
|
-
mediaBP?:
|
|
84
|
+
mediaBP?: TStrDict;
|
|
71
85
|
/**
|
|
72
86
|
* Container queries breakpoints
|
|
73
87
|
*/
|
|
74
|
-
containerBP?:
|
|
88
|
+
containerBP?: TStrDict;
|
|
75
89
|
};
|
|
76
90
|
/**
|
|
77
91
|
* Provider initial content
|
|
78
92
|
*/
|
|
79
|
-
export type TProviderInitContent =
|
|
93
|
+
export type TProviderInitContent = TConfigDict;
|
|
80
94
|
/**
|
|
81
95
|
* Style manager
|
|
82
96
|
* @description
|
|
@@ -86,39 +100,37 @@ export interface IStyleManager {
|
|
|
86
100
|
/**
|
|
87
101
|
* Get stylesheet by key
|
|
88
102
|
* @param key - stylesheet key
|
|
89
|
-
* @returns CSS stylesheet if found with this key, otherwise `undefined`
|
|
90
103
|
*/
|
|
91
|
-
get(key?: string):
|
|
104
|
+
get(key?: string): TOptSheet;
|
|
92
105
|
/**
|
|
93
106
|
* Get index of stylesheet
|
|
94
107
|
* @param styleSheet - CSS stylesheet
|
|
95
108
|
*/
|
|
96
109
|
getIndex(styleSheet: CSSStyleSheet): number;
|
|
97
110
|
/**
|
|
98
|
-
* Get all stylesheets
|
|
99
|
-
* @returns CSS stylesheet dicitonary
|
|
111
|
+
* Get all stylesheets dictionary
|
|
100
112
|
*/
|
|
101
113
|
getAll(): Record<string, CSSStyleSheet>;
|
|
102
114
|
/**
|
|
103
115
|
* Add stylesheet
|
|
104
116
|
* @param key - stylesheet key
|
|
105
117
|
* @param stylesheet - {@link https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet | CSSStylesheet} instance
|
|
106
|
-
* @returns `true` if stylesheet is added
|
|
118
|
+
* @returns `true` if stylesheet is added
|
|
107
119
|
*/
|
|
108
|
-
add(key: string, stylesheet: CSSStyleSheet):
|
|
120
|
+
add(key: string, stylesheet: CSSStyleSheet): TOptBool;
|
|
109
121
|
/**
|
|
110
122
|
* Replace stylesheet content
|
|
111
123
|
* @param key - stylesheet key
|
|
112
124
|
* @param styles - stylesheet content string
|
|
113
|
-
* @returns `true` if stylesheet is replaced
|
|
125
|
+
* @returns `true` if stylesheet is replaced
|
|
114
126
|
*/
|
|
115
|
-
replace(key: string, styles: string):
|
|
127
|
+
replace(key: string, styles: string): TOptBool;
|
|
116
128
|
/**
|
|
117
129
|
* Remove stylesheet
|
|
118
130
|
* @param key - stylesheet key
|
|
119
|
-
* @returns `true` if stylesheet is removed
|
|
131
|
+
* @returns `true` if stylesheet is removed
|
|
120
132
|
*/
|
|
121
|
-
remove(key: string):
|
|
133
|
+
remove(key: string): TOptBool;
|
|
122
134
|
/**
|
|
123
135
|
* Remove all stylesheets
|
|
124
136
|
*/
|
|
@@ -127,17 +139,16 @@ export interface IStyleManager {
|
|
|
127
139
|
* Pack styles into CSSStyleSheet and add it into stylesheet dictionary
|
|
128
140
|
* @param key - stylesheet key
|
|
129
141
|
* @param styles - stylesheet content string
|
|
130
|
-
* @returns `true` if stylesheet is packed
|
|
142
|
+
* @returns `true` if stylesheet is packed
|
|
131
143
|
* @example
|
|
132
144
|
* ```ts
|
|
133
145
|
* getProvider().manager.pack('card', '.card{width: auto;height:100%};.card__header{display:flex;height:5rem;}');
|
|
134
146
|
* ```
|
|
135
147
|
*/
|
|
136
|
-
pack(key: string, styles: string):
|
|
148
|
+
pack(key: string, styles: string): TOptBool;
|
|
137
149
|
/**
|
|
138
150
|
* Check if stylesheet exist
|
|
139
151
|
* @param key - stylesheet key
|
|
140
|
-
* @returns boolean flag
|
|
141
152
|
*/
|
|
142
153
|
has(key?: string): boolean;
|
|
143
154
|
/**
|
|
@@ -149,12 +160,12 @@ export interface IStyleManager {
|
|
|
149
160
|
* Switch stylesheet on
|
|
150
161
|
* @param key - stylesheet key
|
|
151
162
|
*/
|
|
152
|
-
on(key?: string | (string | undefined)[]):
|
|
163
|
+
on(key?: string | (string | undefined)[]): TOptBool;
|
|
153
164
|
/**
|
|
154
165
|
* Switch stylesheet off
|
|
155
166
|
* @param key - stylesheet key
|
|
156
167
|
*/
|
|
157
|
-
off(key?: string | (string | undefined)[]):
|
|
168
|
+
off(key?: string | (string | undefined)[]): TOptBool;
|
|
158
169
|
/**
|
|
159
170
|
* Apply stylesheets to style consumer
|
|
160
171
|
* @param consumer - {@link TStyleConsumer | style consumer}
|
|
@@ -168,7 +179,7 @@ export interface IStyleManager {
|
|
|
168
179
|
* @param consumer - {@link TStyleConsumer | style consumer}
|
|
169
180
|
* @description
|
|
170
181
|
* A registered consumer will automatically receive up-to-date styles when they are added, modified, or deleted.
|
|
171
|
-
* If the style provider does not contain the `isolated
|
|
182
|
+
* If the style provider does not contain the `isolated`, the current document will be automatically registered.
|
|
172
183
|
*/
|
|
173
184
|
registerNode(consumer: TStyleConsumer): void;
|
|
174
185
|
/**
|
|
@@ -209,12 +220,6 @@ export type TResolveSelector = (params: {
|
|
|
209
220
|
* {@link https://en.bem.info/methodology/key-concepts/#modifier | Modifier value}
|
|
210
221
|
*/
|
|
211
222
|
mv?: string;
|
|
212
|
-
/**
|
|
213
|
-
* Modifier value condition
|
|
214
|
-
* @description
|
|
215
|
-
* Usually a pseudo state, a pseudo element or some query (`@container`, `@media`).
|
|
216
|
-
*/
|
|
217
|
-
s?: string;
|
|
218
223
|
}) => string;
|
|
219
224
|
/**
|
|
220
225
|
* BEM attribute resolver
|
|
@@ -231,11 +236,15 @@ b?: string) => <E extends string>(
|
|
|
231
236
|
/**
|
|
232
237
|
* {@link https://en.bem.info/methodology/key-concepts/#element | Element}
|
|
233
238
|
*/
|
|
234
|
-
e?: E) => <M extends Record<string, Record<string, string | number |
|
|
239
|
+
e?: E) => <M extends Record<string, Record<string, string | number | TOptBool | null>>>(
|
|
235
240
|
/**
|
|
236
241
|
* {@link https://en.bem.info/methodology/key-concepts/#modifier | Modifiers}
|
|
237
242
|
*/
|
|
238
|
-
m?: string | Partial<M[NoInfer<E>]>) =>
|
|
243
|
+
m?: string | Partial<M[NoInfer<E>]>) => TStrDict;
|
|
244
|
+
/**
|
|
245
|
+
* Resolved attributes object
|
|
246
|
+
*/
|
|
247
|
+
type TResolvedAttr = ReturnType<TResolveAttr>;
|
|
239
248
|
/**
|
|
240
249
|
* Style resolver
|
|
241
250
|
* @description
|
|
@@ -308,7 +317,7 @@ export interface IStyleCollector {
|
|
|
308
317
|
/**
|
|
309
318
|
* Get all collected configs
|
|
310
319
|
*/
|
|
311
|
-
getConfigs():
|
|
320
|
+
getConfigs(): TConfigDict;
|
|
312
321
|
}
|
|
313
322
|
/**
|
|
314
323
|
* Style provider
|
|
@@ -327,7 +336,7 @@ export interface IStyleProvider {
|
|
|
327
336
|
/**
|
|
328
337
|
* All collected stylesheet configs
|
|
329
338
|
*/
|
|
330
|
-
configs:
|
|
339
|
+
configs: TConfigDict;
|
|
331
340
|
/**
|
|
332
341
|
* Use stylesheet
|
|
333
342
|
* @param config - stylesheet config
|
|
@@ -336,29 +345,29 @@ export interface IStyleProvider {
|
|
|
336
345
|
* The method allows to use stylesheet without having its key.
|
|
337
346
|
* It returns {@link IStyleResolver.attr | attribute resolver}, that can create BEM selectors for config passed.
|
|
338
347
|
*/
|
|
339
|
-
use(config: TStyleSheetConfig, key?: string):
|
|
348
|
+
use(config: TStyleSheetConfig, key?: string): TResolvedAttr;
|
|
340
349
|
/**
|
|
341
350
|
* Alter stylesheet with merged config
|
|
342
351
|
* @param target - target stylesheet config or key
|
|
343
352
|
* @param nextConfig - next stylesheet config, that will be merged with previous
|
|
344
353
|
*/
|
|
345
|
-
alter(target: TStyleTarget, nextConfig: TStyleSheetConfig):
|
|
354
|
+
alter(target: TStyleTarget, nextConfig: TStyleSheetConfig): TResolvedAttr;
|
|
346
355
|
/**
|
|
347
356
|
* Use public stylesheet configs
|
|
348
357
|
* @param configs - stylesheet configs
|
|
349
358
|
*/
|
|
350
|
-
usePublic(configs:
|
|
359
|
+
usePublic(configs: TConfigDict): Record<string, TResolvedAttr>;
|
|
351
360
|
/**
|
|
352
361
|
* Use private stylesheet configs
|
|
353
362
|
* @param configs - stylesheet configs
|
|
354
363
|
*/
|
|
355
|
-
usePrivate(configs:
|
|
364
|
+
usePrivate(configs: TConfigArray): TResolvedAttr[];
|
|
356
365
|
/**
|
|
357
366
|
* Resolve stylesheet
|
|
358
367
|
* @param key - stylesheet key
|
|
359
368
|
* @returns BEM attribute resolver for stylesheet
|
|
360
369
|
*/
|
|
361
|
-
resolve(key?: string):
|
|
370
|
+
resolve(key?: string): TResolvedAttr;
|
|
362
371
|
/**
|
|
363
372
|
* Prepare CSS from config
|
|
364
373
|
* @param config - stylesheet config
|
|
@@ -369,27 +378,27 @@ export interface IStyleProvider {
|
|
|
369
378
|
* Get CSS stylesheet
|
|
370
379
|
* @param target - target stylesheet config or key
|
|
371
380
|
*/
|
|
372
|
-
get(target?: TStyleTarget):
|
|
381
|
+
get(target?: TStyleTarget): TOptSheet;
|
|
373
382
|
/**
|
|
374
383
|
* Switch stylesheet/stylesheets on
|
|
375
384
|
* @param target - target stylesheet config or key
|
|
376
385
|
*/
|
|
377
|
-
on(target?:
|
|
386
|
+
on(target?: TOneOrManyTargets): TOptBool;
|
|
378
387
|
/**
|
|
379
388
|
* Switch stylesheet/stylesheets off
|
|
380
389
|
* @param target - target stylesheet config or key
|
|
381
390
|
*/
|
|
382
|
-
off(target?:
|
|
391
|
+
off(target?: TOneOrManyTargets): TOptBool;
|
|
383
392
|
/**
|
|
384
393
|
* Check if stylesheet is on
|
|
385
394
|
* @param target - target stylesheet config or key
|
|
386
395
|
*/
|
|
387
|
-
status(target?: TStyleTarget):
|
|
396
|
+
status(target?: TStyleTarget): TOptBool;
|
|
388
397
|
/**
|
|
389
398
|
* Get many CSS stylesheets
|
|
390
399
|
* @param target - target stylesheet configs and/or keys
|
|
391
400
|
*/
|
|
392
|
-
getMany(targets?: TStyleTarget[]):
|
|
401
|
+
getMany(targets?: TStyleTarget[]): TOptSheet[];
|
|
393
402
|
/**
|
|
394
403
|
* Subscribe to style changes
|
|
395
404
|
* @param consumer - styles consumer
|
|
@@ -559,3 +568,4 @@ declare global {
|
|
|
559
568
|
__EFFCSS_PARAMS__: IDefineProviderProps;
|
|
560
569
|
}
|
|
561
570
|
}
|
|
571
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IStyleDispatcher, IStyleProvider, TStyleSheetConfig, TStyleTarget } from '../types';
|
|
1
|
+
import { IStyleDispatcher, IStyleProvider, TConfigArray, TConfigDict, TStyleSheetConfig, TStyleTarget } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Get style provider component
|
|
4
4
|
* @param root - style provider scope
|
|
@@ -6,35 +6,43 @@ import { IStyleDispatcher, IStyleProvider, TStyleSheetConfig, TStyleTarget } fro
|
|
|
6
6
|
* Use this function to get the first provider element found in the document
|
|
7
7
|
* @see {@link IStyleProvider}
|
|
8
8
|
*/
|
|
9
|
-
export declare const getProvider: (root?: Document, tag?: string) => IStyleProvider;
|
|
9
|
+
export declare const getProvider: (root?: Document, tag?: string | undefined) => IStyleProvider;
|
|
10
10
|
/**
|
|
11
11
|
* Use stylesheet
|
|
12
12
|
* @param config - stylesheet config
|
|
13
13
|
* @param provider - style provider
|
|
14
14
|
* @see {@link IStyleProvider}
|
|
15
15
|
*/
|
|
16
|
-
export declare const useStyleSheet: (config: TStyleSheetConfig, key?: string, provider?: IStyleProvider) => <E extends string>(e?: E) => <M extends Record<string, Record<string, string | number | boolean | undefined | null>>>(m?: string | Partial<M[NoInfer<E>]>) =>
|
|
16
|
+
export declare const useStyleSheet: (config: TStyleSheetConfig, key?: string, provider?: IStyleProvider) => <E extends string>(e?: E) => <M extends Record<string, Record<string, string | number | (boolean | undefined) | null>>>(m?: string | Partial<M[NoInfer<E>]>) => {
|
|
17
|
+
[x: string]: string;
|
|
18
|
+
};
|
|
17
19
|
/**
|
|
18
20
|
* Use public stylehseet configs
|
|
19
21
|
* @param styles - stylesheet configs
|
|
20
22
|
* @param provider - style provider
|
|
21
23
|
* @see {@link IStyleProvider}
|
|
22
24
|
*/
|
|
23
|
-
export declare const usePublicStyleSheets: (styles:
|
|
25
|
+
export declare const usePublicStyleSheets: (styles: TConfigDict, provider?: IStyleProvider) => Record<string, <E extends string>(e?: E) => <M extends Record<string, Record<string, string | number | (boolean | undefined) | null>>>(m?: string | Partial<M[NoInfer<E>]>) => {
|
|
26
|
+
[x: string]: string;
|
|
27
|
+
}>;
|
|
24
28
|
/**
|
|
25
29
|
* Use private stylehseet configs
|
|
26
30
|
* @param styles - stylesheet configs
|
|
27
31
|
* @param provider - style provider
|
|
28
32
|
* @see {@link IStyleProvider}
|
|
29
33
|
*/
|
|
30
|
-
export declare const usePrivateStyleSheets: (styles:
|
|
34
|
+
export declare const usePrivateStyleSheets: (styles: TConfigArray, provider?: IStyleProvider) => (<E extends string>(e?: E) => <M extends Record<string, Record<string, string | number | (boolean | undefined) | null>>>(m?: string | Partial<M[NoInfer<E>]>) => {
|
|
35
|
+
[x: string]: string;
|
|
36
|
+
})[];
|
|
31
37
|
/**
|
|
32
38
|
* Resolve stylesheet
|
|
33
39
|
* @param key stylesheet key
|
|
34
40
|
* @param provider - style provider
|
|
35
41
|
* @see {@link IStyleProvider}
|
|
36
42
|
*/
|
|
37
|
-
export declare const resolveStyleSheet: (key?: string, provider?: IStyleProvider) => <E extends string>(e?: E) => <M extends Record<string, Record<string, string | number | boolean | undefined | null>>>(m?: string | Partial<M[NoInfer<E>]>) =>
|
|
43
|
+
export declare const resolveStyleSheet: (key?: string, provider?: IStyleProvider) => <E extends string>(e?: E) => <M extends Record<string, Record<string, string | number | (boolean | undefined) | null>>>(m?: string | Partial<M[NoInfer<E>]>) => {
|
|
44
|
+
[x: string]: string;
|
|
45
|
+
};
|
|
38
46
|
/**
|
|
39
47
|
* Get stylesheet from provider
|
|
40
48
|
* @param key - stylesheet key
|
|
@@ -88,7 +96,7 @@ declare class StyleDispatcher implements IStyleDispatcher {
|
|
|
88
96
|
/**
|
|
89
97
|
* Style provider
|
|
90
98
|
*/
|
|
91
|
-
protected
|
|
99
|
+
protected _p: IStyleProvider;
|
|
92
100
|
constructor(params?: IStyleDispatcherParams);
|
|
93
101
|
/**
|
|
94
102
|
* Use stylesheet
|
|
@@ -5,11 +5,11 @@ import { TCreateResolver, IStyleCollector, TStyleSheetConfig, TProviderInitConte
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const createResolver: TCreateResolver;
|
|
7
7
|
declare class Collector implements IStyleCollector {
|
|
8
|
-
protected
|
|
9
|
-
protected
|
|
10
|
-
protected
|
|
11
|
-
protected
|
|
12
|
-
constructor(
|
|
8
|
+
protected _p: string;
|
|
9
|
+
protected _c: number;
|
|
10
|
+
protected _k: Set<string>;
|
|
11
|
+
protected _: Map<TStyleSheetConfig, string>;
|
|
12
|
+
constructor({ prefix, initContent, hydrate }?: {
|
|
13
13
|
prefix?: string;
|
|
14
14
|
initContent?: TProviderInitContent;
|
|
15
15
|
hydrate?: boolean;
|
|
@@ -37,10 +37,10 @@ interface IPseudoDispatcherParams {
|
|
|
37
37
|
initcls?: string;
|
|
38
38
|
}
|
|
39
39
|
declare class PseudoDispatcher implements IStyleDispatcher {
|
|
40
|
-
protected
|
|
41
|
-
protected
|
|
42
|
-
protected
|
|
43
|
-
protected
|
|
40
|
+
protected _c: IStyleCollector;
|
|
41
|
+
protected _r: IStyleResolver;
|
|
42
|
+
protected _i: string;
|
|
43
|
+
protected _m: {
|
|
44
44
|
c: {};
|
|
45
45
|
};
|
|
46
46
|
get collector(): IStyleCollector;
|
|
@@ -65,7 +65,9 @@ declare class PseudoDispatcher implements IStyleDispatcher {
|
|
|
65
65
|
* Resolve styles
|
|
66
66
|
* @param key - stylesheet key
|
|
67
67
|
*/
|
|
68
|
-
resolve: (key?: string) => <E extends string>(e?: E) => <M extends Record<string, Record<string, string | number | boolean | undefined | null>>>(m?: string | Partial<M[NoInfer<E>]>) =>
|
|
68
|
+
resolve: (key?: string) => <E extends string>(e?: E) => <M extends Record<string, Record<string, string | number | (boolean | undefined) | null>>>(m?: string | Partial<M[NoInfer<E>]>) => {
|
|
69
|
+
[x: string]: string;
|
|
70
|
+
};
|
|
69
71
|
toString(): string;
|
|
70
72
|
}
|
|
71
73
|
/**
|
package/dist/utils/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PROVIDER_TAG_NAME as e}from"../constants.js";const s=(s,i)=>{var o
|
|
1
|
+
import{PROVIDER_TAG_NAME as e}from"../constants.js";const s=(s,i)=>{var u,o;return void 0===s&&(s=window.document),void 0===i&&(i=null===(u=window.__EFFCSS_PARAMS__)||void 0===u?void 0:u.name),null===(o=null==s?void 0:s.getElementsByTagName(i||e))||void 0===o?void 0:o[0]},i=(e,i,u=s())=>u.use(e,i),u=(e,i=s())=>null==i?void 0:i.usePublic(e),o=(e,i=s())=>null==i?void 0:i.usePrivate(e),t=(e,i=s())=>i.resolve(e),l=(e,i=s())=>null==i?void 0:i.get(e),n=(e,i=s())=>null==i?void 0:i.getMany(e),r=(e,i=s())=>{var u;return[...(null===(u=l(e,i))||void 0===u?void 0:u.cssRules)||[]].map((e=>e.cssText)).join("")},v=(e,i=s())=>[...n(e,i)||[]].reduce(((e,s)=>e+[...(null==s?void 0:s.cssRules)||[]].map((e=>e.cssText)).join("")),""),d=(e,i=s())=>{var u;return function e(s){return s?s.length+[...s].reduce(((s,i)=>s+e(null==i?void 0:i.cssRules)),0):0}(null===(u=l(e,i))||void 0===u?void 0:u.cssRules)},c=(e,i=s())=>e.reduce(((e,s)=>e+d(s,i)),0);class a{constructor(e){this.use=(...e)=>this._p.use(...e),this.usePublic=e=>this._p.usePublic(e),this.usePrivate=e=>this._p.usePrivate(e),this.resolve=e=>this._p.resolve(e);const{root:i,tag:u}=e||{};this._p=s(i,u)}}function h(e){return new a(e)}export{h as createDispatcher,n as getManyStyleSheets,s as getProvider,l as getStyleSheet,c as measureMany,d as measureOne,t as resolveStyleSheet,v as stringifyMany,r as stringifyOne,o as usePrivateStyleSheets,u as usePublicStyleSheets,i as useStyleSheet};
|
package/dist/utils/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{STYLES_SCRIPT_CLS as t}from"../constants.js";const e=t=>"object"==typeof t,s=t=>{const{mode:s}=t||{},i=t=>Object.entries(t).reduce(((t,[e,s])=>(void 0!==s&&t.push(e+(s?"-"+s:"")),t)),[]).join(" "),
|
|
1
|
+
import{STYLES_SCRIPT_CLS as t}from"../constants.js";const e=t=>"object"==typeof t,s=t=>{const{mode:s}=t||{},i=t=>Object.entries(t).reduce(((t,[e,s])=>(void 0!==s&&t.push(e+(s?"-"+s:"")),t)),[]).join(" "),r=(t,e)=>Object.defineProperties({[t]:e},{k:{value:t},v:{value:e}}),n=(...t)=>"--"+t.join("-"),c=(...t)=>t.join("-");return"c"===s?{selector:({b:t,e:e,m:s,mv:i})=>`.${t}${(e?"__"+e:"")+(s?"_"+s:"")+(s&&i?"_"+i:"")}`,attr:t=>s=>n=>{let c=n||"";e(c)&&(c=i(c));const o=t+(s?"__"+s:"");return c=o+(c?" "+(null==c?void 0:c.split(" ").map((t=>o+"_"+t.split("-").join("_"))).join(" ")):""),r("class",c)},varName:n,kfName:c}:{selector:({b:t,e:e,m:s,mv:i})=>`[data-${t}${e?"-"+e:""}${s?'~="'+(s||"")+(i?"-"+i:"")+'"':""}]`,attr:t=>s=>n=>{const c=`data-${t}${s?"-"+s:""}`;let o=n||"";return e(o)&&(o=i(o)),r(c,o)},varName:n,kfName:c}};class i{constructor({prefix:t,initContent:e,hydrate:s}={}){this._c=0,this._k=new Set,this._=new Map,this.use=(t,e)=>{const s=this._.get(t);if(s)return s;const i=e||this._p+this._c.toString(36);return this._k.add(i),this._.set(t,i),this._c++,i},this.mutate=(t,e)=>Object.assign(this.getConfigs()[t],e),this.getKey=t=>this._.get(t),this.getKeys=()=>[...this._k],this.getConfigs=()=>Object.fromEntries(this._.entries().map((([t,e])=>[e,t]))),this._p=t||"eff",e&&Object.entries(e).forEach((([t,e])=>this.use(e,t))),s&&(this._c=0)}}function r(t){return new i(t)}class n{get collector(){return this._c}constructor(e){this._m={c:{}},this.use=(t,e)=>{let s=this._c.use(t,e);return this.resolve(s)},this.usePublic=t=>Object.fromEntries(Object.entries(t).map((([t,e])=>[t,this.use(e,t)]))),this.usePrivate=t=>t.map((t=>this.use(t))),this.resolve=t=>this._r.attr(t||this._c.getKey(this._m));const{prefix:i,mode:n,initcls:c=t}=e||{};this._i=c,this._r=s({mode:n}),this._c=r({prefix:i}),this.use(this._m)}toString(){const t=this._c.getConfigs(),e=this._c.getKey(this._m);return e&&delete t[e],`<script class="${this._i}" type="application/json">${JSON.stringify(t)}<\/script>`}}function c(t){return new n(t)}export{r as createCollector,c as createPseudoDispatcher,s as createResolver};
|
package/package.json
CHANGED