effcss 3.5.2 → 3.6.0
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 +23 -21
- package/dist/build/define-provider.min.js +2 -2
- package/dist/consumer.js +2 -2
- package/dist/index.js +2 -2
- package/dist/types/src/_provider/_process/atrules.d.ts +63 -0
- package/dist/types/src/common.d.ts +29 -3
- package/dist/types/src/index.d.ts +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -137,12 +137,21 @@ export interface ICardMaker {
|
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
const myStyleSheetMaker: TStyleSheetMaker = ({ bem, pseudo, at: {
|
|
140
|
+
const myStyleSheetMaker: TStyleSheetMaker = ({ bem, pseudo, at: { keyframes }, merge, palette, coef, size }) = {
|
|
141
|
+
// specify selector variants via generic
|
|
142
|
+
const selector = bem<ICardMaker>;
|
|
141
143
|
// creates unique keyframes identifier
|
|
142
|
-
const spin =
|
|
144
|
+
const spin = keyframes({
|
|
145
|
+
from: {
|
|
146
|
+
transform: 'rotate(0deg)',
|
|
147
|
+
},
|
|
148
|
+
to: {
|
|
149
|
+
transform: 'rotate(360deg)',
|
|
150
|
+
},
|
|
151
|
+
});
|
|
143
152
|
// deeply merges objects
|
|
144
153
|
const cardLogoStyles = merge({
|
|
145
|
-
animation:
|
|
154
|
+
animation: `20s linear infinite ${spin}`,
|
|
146
155
|
[pseudo.h()]: {
|
|
147
156
|
filter: "drop-shadow(0 0 2em #61dafbaa)",
|
|
148
157
|
}
|
|
@@ -155,22 +164,15 @@ const myStyleSheetMaker: TStyleSheetMaker = ({ bem, pseudo, at: { kf }, merge, p
|
|
|
155
164
|
}
|
|
156
165
|
});
|
|
157
166
|
return {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
[bem<ICardMaker>('card')]: { ... },
|
|
167
|
-
[bem<ICardMaker>('card.logo')]: cardLogoStyles,
|
|
168
|
-
[bem<ICardMaker>('card..rounded')]: { ... },
|
|
169
|
-
[bem<ICardMaker>('card..h.full')]: { ... },
|
|
170
|
-
[bem<ICardMaker>('card.footer')]: { ... },
|
|
171
|
-
[bem<ICardMaker>('card.footer.visible')]: { ... },
|
|
167
|
+
...spin,
|
|
168
|
+
[selector('card')]: { ... },
|
|
169
|
+
[selector('card.logo')]: cardLogoStyles,
|
|
170
|
+
[selector('card..rounded')]: { ... },
|
|
171
|
+
[selector('card..h.full')]: { ... },
|
|
172
|
+
[selector('card.footer')]: { ... },
|
|
173
|
+
[selector('card.footer.visible')]: { ... },
|
|
172
174
|
...each(coef.short, (k, v) => ({
|
|
173
|
-
[
|
|
175
|
+
[selector(`card.footer.sz.${k}`)]: {
|
|
174
176
|
height: size(v)
|
|
175
177
|
}
|
|
176
178
|
}))
|
|
@@ -183,13 +185,13 @@ export const App = (props: {
|
|
|
183
185
|
const { css } = props;
|
|
184
186
|
const stylesRef = useRef();
|
|
185
187
|
if (!stylesRef.current) {
|
|
186
|
-
const bem = css.use(myStyleSheetMaker)
|
|
188
|
+
const bem = css.use(myStyleSheetMaker)<ICardMaker>;
|
|
187
189
|
// thanks to the ICardMaker interface,
|
|
188
190
|
// you don't need to look at the implementation - just create the necessary attributes
|
|
189
191
|
stylesRef.current = {
|
|
190
|
-
card: bem
|
|
192
|
+
card: bem('card..rounded'),
|
|
191
193
|
// element with modifiers
|
|
192
|
-
footer: bem
|
|
194
|
+
footer: bem({
|
|
193
195
|
card: {
|
|
194
196
|
footer: {
|
|
195
197
|
visible: '',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* EffCSS v3.
|
|
2
|
+
* EffCSS v3.6.0
|
|
3
3
|
* {@link https://gitverse.ru/msabitov/effcss}
|
|
4
4
|
* Copyright (c) Marat Sabitov
|
|
5
5
|
* @license Apache-2.0
|
|
6
6
|
*/
|
|
7
|
-
"function"==typeof SuppressedError&&SuppressedError;const t=void 0,e=Object.entries,s=Array.isArray,r=Object.defineProperties,n=t=>`data-${t}`,i=t=>"string"==typeof t,a=t=>null!==t&&"object"==typeof t,c=(t,e)=>`${t}${e?"__"+e:""}`,l=t=>t.split("."),h=(s,r)=>e(s).reduce(((s,[n,i])=>{if(a(i)){const c=e(i);c.length?s.push(...c.reduce(((s,[i,c])=>{if((e=>null!==e&&e!==t)(i)&&r&&s.push([n,i,t,t]),a(c)){const t=e(c);t.length&&s.push(...t.reduce(((t,[e,s])=>{const r=typeof s;return"string"!==r&&"number"!==r||t.push([n,i,e,s]),t}),[]))}return s}),[])):s.push([n,t,t,t])}return s}),[]),o=(t,e,s,r)=>""+(c(t,e)+(s?"_"+s:"")+(s&&r?"_"+r:"")),u=(t,e,s,r)=>"."+o(t,e,s,r),g=(t,e,s,r)=>`[${n(c(t,e))}${s&&r?`~="${s}_${r}"`:s?`~="${s}"`:""}]`,m=(t,...r)=>r.length?r.reduce(((t,r)=>(e(r).forEach((([e,r])=>{r&&"object"==typeof r&&t[e]?s(t[e])&&s(r)?t[e]=[...t[e],...r]:m(t[e],r||{}):t[e]=r})),t)),t):t,p={def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},d="effcss-provider",b={theme:null,hydrate:null,mode:"a",prefix:"f",size:null,time:null,angle:null},f={l:{dark:{bg:{xl:.24,l:.3,m:.36,s:.42,xs:.48},fg:{xl:.98,l:.93,m:.86,s:.79,xs:.72}},light:{bg:{xl:.98,l:.93,m:.88,s:.83,xs:.78},fg:{xl:0,l:.12,m:.24,s:.36,xs:.48}}},c:{dark:{bg:{pale:.02,base:.06,rich:.1},fg:{pale:.06,base:.1,rich:.14}},light:{bg:{pale:.01,base:.04,rich:.7},fg:{pale:.07,base:.11,rich:.15}}},h:{pri:184,sec:290,suc:Number(146.2.toFixed(2)),inf:Number(256..toFixed(2)),war:Number((.1*184+.9*109).toFixed(2)),dan:Number(44.5.toFixed(2))}},x={bp:{"3xs":18,"2xs":24,xs:30,sm:40,md:48,lg:64,xl:80,"2xl":96},vars:{"":{rtime:"200ms",rem:"16px",rangle:"30deg",l:p,h:{def:261.35,b:261.35,i:194.77,e:29.23,w:70.66,s:142.49},c:{def:.03,xs:.03,s:.06,m:.1,l:.15,xl:.25},a:{def:1,min:0,xs:.1,s:.25,m:.5,l:.75,xl:.9,max:1},t:{def:300,xs:100,s:200,m:300,l:450,xl:600,no:0,min:50,max:750},int:[...Array(12).keys()],fr:{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"},ar:{1:1,"2/1":2,"1/2":.5,"4/3":1.3333,"3/4":.75,"9/16":.5625,"16/9":1.7778}},light:{l:p},dark:{l:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}},palette:f,coef:{$0_:{xxs:.0625,xs:.125,s:.25,m:.5,l:.75,xl:.875,xxl:.9375},$1_:{xxs:1.0625,xs:1.125,s:1.25,m:1.5,l:1.75,xl:1.875,xxl:1.9375},$2_:{xxs:2.5,xs:4,s:5,m:7.5,l:10,xl:12,xxl:15},$16_:{xxs:20,xs:28,s:36,m:48,l:64,xl:80,xxl:120},max:150}},$=({prefix:t})=>{let e=1;return{get base(){return t+0},get current(){return t+e},next(){return e++,this.current},reset(){e=1}}},y=()=>{const t=new Set,s=new Map;return{use(e,r){const n=s.get(e);return n||(t.add(r),s.set(e,r),r)},useMany(t){return e(t).map((([t,e])=>this.use(e,t)))},getKey:t=>s.get(t),get keys(){return[...t]},get makers(){return Object.fromEntries(s.entries().map((([t,e])=>[e,t])))}}},v="@media",j="@container",O="@property",_="@keyframes",w="@layer",k="@scope",S="@supports",q=(t,e)=>{const s=v+` ${e||""}${e?" and ":""}(${t})`;return{s:s,q:t,t:e,toString:()=>s}};q.toString=()=>v;const A=t=>t+"px",E=t=>t+"vh",P=t=>t+"vw",z=t=>t+"vmin",C=t=>t+"vmax",N=t=>t+"rem",I=t=>t+"deg",W=t=>t+"ms",F=t=>t+"%",K=t=>t+"cqw",M=t=>t+"cqh",B=t=>t+"cqi",L=t=>t+"cqb",R=t=>t+"cqmin",H=t=>t+"cqmax",T=Object.fromEntries,V=Object.entries,Z=":first-",D=":last-",G=":only-",J="child",Q=":nth-",U="of-type",X=Q+J,Y=":focus",tt={r:":root",h:":hover",f:Y,fv:Y+"-visible",a:":active",v:":visited",val:":valid",inv:":invalid",e:":empty",d:":disabled",rq:":required",o:":optional",m:":modal",l:":link",ph:":placeholder",ch:":checked",po:":popover-open",fc:Z+J,lc:D+J,oc:G+J,odd:X+"(odd)",even:X+"(even)",ft:Z+U,lt:D+U,ot:G+U,bef:"::before",aft:"::after",bd:"::backdrop"},et={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:X,ntho:Q+U,dir:":dir",lang:":lang"},st="oklch",rt=t=>st+`(${t})`,nt=t=>rt(`from ${t}`),it="def",at=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",it),c:e("c",it),h:e("h",it),a:e("a",it)},this.merge=t=>new s(Object.assign(this.state,t)),this.l=t=>this.merge({l:e("l",t)}),this.c=t=>this.merge({c:e("c",t)}),this.h=t=>this.merge({h:e("h",t)}),this.a=t=>this.merge({a:e("a",t)}),this.state=Object.assign(this.state,t)}get s(){return this.toString()}toString(){const{l:t,c:e,h:s,a:r}=this.state;return rt(`${t} ${e} ${s} / ${r}`)}}return t=>new s(t)},ct=(t,e=.1)=>nt(`${t} calc(l + ${e}) c h / alpha)`),lt=(t,e=.1)=>nt(`${t} calc(l - ${e}) c h / alpha)`),ht=(t,e=.1)=>nt(`${t} l c h / calc(alpha + ${e}))`),ot=(t,e=.1)=>nt(`${t} l c h / calc(alpha - ${e}))`),ut=(t,e=.04)=>nt(`${t} l calc(c + ${e}) h / alpha)`),gt=(t,e=.04)=>nt(`${t} l calc(c - ${e}) h / alpha)`),mt=(t,e=30)=>nt(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),pt=({base:t,mixin:e,method:s,bpart:r,mpart:n})=>`color-mix(in ${s||st}, ${t}${void 0!==r?` ${r}%`:""}, ${e}${void 0!==n?` ${n}%`:""})`,dt=t=>({create:at(t),oklch:rt,lighten:ct,darken:lt,saturate:ut,desaturate:gt,fadein:ht,fadeout:ot,spin:mt,mix:pt}),bt=(t,e,s)=>Object.entries(t).reduce(e,s),ft=Symbol("noParse"),xt=(t,e,s)=>{var r,n,i;let a=""+t;return null==e?"":"object"!=typeof e||e.hasOwnProperty(ft)?`${c=a,c.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}:${""+e};`:(!s||(null===(r=s.startsWith)||void 0===r?void 0:r.call(s,"@"))||(null===(n=a.startsWith)||void 0===n?void 0:n.call(a,"&"))||(null===(i=a.startsWith)||void 0===i?void 0:i.call(a,"@"))?"":"&")+a+`{${bt(e,((t,e)=>t+xt(...e,a)),"")}}`;var c},$t="palette",yt=t=>{class e{constructor(t={}){this.state={l:"l",c:"base",h:"pri",a:1,m:"bg"},Object.assign(this,{[ft]:!0}),this.state=Object.assign(this.state,t)}get xs(){return new e(Object.assign(Object.assign({},this.state),{l:"xs"}))}get s(){return new e(Object.assign(Object.assign({},this.state),{l:"s"}))}get m(){return new e(Object.assign(Object.assign({},this.state),{l:"m"}))}get l(){return new e(Object.assign(Object.assign({},this.state),{l:"l"}))}get xl(){return new e(Object.assign(Object.assign({},this.state),{l:"xl"}))}get lightness(){return{xs:this.xs,s:this.s,m:this.m,l:this.l,xl:this.xl}}get gray(){return new e(Object.assign(Object.assign({},this.state),{c:"gray"}))}get pale(){return new e(Object.assign(Object.assign({},this.state),{c:"pale"}))}get base(){return new e(Object.assign(Object.assign({},this.state),{c:"base"}))}get rich(){return new e(Object.assign(Object.assign({},this.state),{c:"rich"}))}get chroma(){return{gray:this.gray,pale:this.pale,base:this.base,rich:this.rich}}get pri(){return new e(Object.assign(Object.assign({},this.state),{h:"pri"}))}get sec(){return new e(Object.assign(Object.assign({},this.state),{h:"sec"}))}get suc(){return new e(Object.assign(Object.assign({},this.state),{h:"suc"}))}get inf(){return new e(Object.assign(Object.assign({},this.state),{h:"inf"}))}get war(){return new e(Object.assign(Object.assign({},this.state),{h:"war"}))}get dan(){return new e(Object.assign(Object.assign({},this.state),{h:"dan"}))}get hue(){return{pri:this.pri,sec:this.sec,suc:this.suc,inf:this.inf,war:this.war,dan:this.dan}}alpha(t=1){return new e(Object.assign(Object.assign({},this.state),{a:t}))}get bg(){return new e(Object.assign(Object.assign({},this.state),{m:"bg"}))}get fg(){return new e(Object.assign(Object.assign({},this.state),{m:"fg"}))}toString(){const{l:e,c:s,h:r,a:n,m:i}=this.state;return`oklch(${t($t,"l",i,e)} ${t($t,"c",i,s)} ${t($t,"h",r)} / ${n})`}}return new e},vt="coef",jt=t=>{class e{constructor(t={}){this.state={center:8},this.state=Object.assign(this.state,t)}get min(){return t(vt,this.state.center-4)}get xxs(){return t(vt,this.state.center-3)}get xs(){return t(vt,this.state.center-2)}get s(){return t(vt,this.state.center-1)}get m(){return t(vt,this.state.center)}get l(){return t(vt,this.state.center+1)}get xl(){return t(vt,this.state.center+2)}get xxl(){return t(vt,this.state.center+3)}get max(){return t(vt,this.state.center+4)}get $0_(){return new e({center:4})}get $1_(){return new e({center:12})}get $2_(){return new e({center:20})}get $16_(){return new e({center:28})}get $1(){return new e({center:8})}get $2(){return new e({center:16})}get $16(){return new e({center:24})}get short(){return{s:this.s,m:this.m,l:this.l}}get base(){return Object.assign(Object.assign({xs:this.xs},this.short),{xl:this.xl})}get long(){return Object.assign(Object.assign({xxs:this.xxs},this.base),{xxl:this.xxl})}get full(){return Object.assign(Object.assign({min:this.min},this.long),{max:this.max})}get main(){return{min:this.min,m:this.m,max:this.max}}get sparse(){return{min:this.min,xs:this.xs,m:this.m,xl:this.xl,max:this.max}}}return new e},Ot=Object.assign,_t=Object.entries,wt={dash:(...t)=>t.join("-"),comma:(...t)=>t.join(),space:(...t)=>t.join(" "),range:(t,e)=>Array.from(Array(t).entries()).reduce(((t,[s])=>Ot(t,e(s+1))),{}),each:(t,e)=>_t(t).reduce(((t,[s,r])=>Ot(t,e(s,r))),{}),when:(t,e,s={})=>t?e:s},kt="width: ",St=t=>{const{scope:e,globalKey:s="",bp:r={}}=t,n=e(s).varExp,i=t=>n(...t.split(".")),a=(t=1)=>`calc(${t} * ${i("rtime")})`,c=(t=1)=>`calc(${t} * ${i("rangle")})`,l=(t=1)=>`calc(${t} * 1rem)`;return{compile:({key:t,maker:s})=>{const h=e(t),o=(t=>{const e={cp:1,lay:1,kf:1,cq:1},s=(s,r)=>{const n="string"==typeof r?r:t.name("cq",e.cq++),i=j+` ${n?n+" ":""}(${s})`;return{c:n,q:s,s:i,toString:()=>i}};s.toString=()=>j;const r=(s,r)=>{const n="--"+(s||t.name("cp",e.cp++)),i=O+" "+n;return{k:n,v:`var(${n})`,s:i,r:{[i]:{syntax:(null==r?void 0:r.syn)||'"*"',inherits:(null==r?void 0:r.inh)||!1,initialValue:null==r?void 0:r.ini}},toString:()=>i}};r.toString=()=>O;const n=s=>{const r=s||t.name("kf",e.kf++),n=_+" "+r;return{k:r,s:n,toString:()=>n}};n.toString=()=>_;const i=s=>{const r=s||t.name("lay",e.lay++),n=w+" "+r;return{k:r,s:n,toString:()=>n}};i.toString=()=>w,i.toString=()=>k;const a=(t="",e=!1)=>{const s=S+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return a.toString=()=>S,{pr:r,kf:n,mq:q,cq:s,lay:i,sc:(t="",e="")=>{const s=k+` ${t?`(${t})`:""}${t&&e?" ":""}${e?`to (${e})`:""}`;return{r:t,l:e,s:s,toString:()=>s}},sup:a}})(h),u=t=>{const e=r[t]||t;return"number"==typeof e?e+"rem":""},g=t=>"min-"+kt+u(t),p=t=>"max-"+kt+u(t),d=(t,e)=>"string"==typeof e?o.cq(t,e):o.mq(t),b=(t,e,s)=>""+d(g(t)+") and ("+p(e),s),f={up:(t,e)=>""+d(g(t),e),down:(t,e)=>""+d(p(t),e),between:b,only:(t,e)=>b(t,t,e)};return x=s(Object.assign(wt,{key:t,vars:i,size:l,time:a,angle:c,bem:h.selector,pseudo:Object.assign(T(V(tt).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),T(V(et).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:dt(n),palette:yt(n),coef:jt(n),units:{px:A,vh:E,vw:P,vmin:z,vmax:C,rem:N,deg:I,ms:W,pc:F,cqw:K,cqh:M,cqb:L,cqi:B,cqmin:R,cqmax:H},at:o,limit:f,merge:m})),bt(x,((t,e)=>t+xt(...e)),"");var x}}};const qt="theme",At="size",Et="time",Pt="angle",zt="palette",Ct=Object.assign,Nt=Object.entries,It=Object.fromEntries,Wt=(t,e)=>t.getAttribute(e)||b[e],Ft=(t,e)=>{const s=Wt(t,e);return null!==s?Number(s):null},Kt=(t,e,s)=>null===s?t.removeAttribute(e):t.setAttribute(e,s+""),Mt=t=>`:root:has(script[is=${d}]${t?`[${t}]`:""})`,Bt=t=>[t.xxs,t.xs,t.s,t.m,t.l,t.xl,t.xxl],Lt=["xs","s","m","l","xl"],Rt=["pale","base","rich"];!function(t={}){const s=window.document,a=window.customElements;if(null==a?void 0:a.get(d))return!1;{class p extends HTMLScriptElement{constructor(){super(...arguments),this._c=y(),this._m=function(){let t={},e={},s=[],r=[];const n=(t,e)=>(e.toString=()=>"effcss-"+t,e),i=t=>{var e;return t.adoptedStyleSheets=[...(null===(e=t.adoptedStyleSheets)||void 0===e?void 0:e.length)?[...t.adoptedStyleSheets].filter((t=>!(t+"").startsWith("effcss-"))):[],...s]},a=()=>{r=r.reduce(((t,e)=>{const s=e.deref();return s&&(i(s),t.push(e)),t}),[])},c=t=>s.findIndex((e=>e===t)),l=e=>e?t[e]:void 0,h=(e,r)=>{if(!t[e])return t[e]=n(e,r),s.push(t[e]),a(),!0},o=t=>{const e=l(t);return!!e&&-1!==c(e)};return{apply:i,notify:a,getIndex:c,get:l,has:t=>!!t&&!!l(t),getAll:()=>t,add:h,status:o,on:(...t)=>{const e=t.reduce(((t,e)=>{const r=l(e);return!(!r||o(e))&&(s.push(r),t)}),!0);return a(),e},off:(...t)=>{const e=t.reduce(((t,e)=>{const r=l(e);if(r&&o(e)){const e=c(r);return s.splice(e,1),t}return!1}),!0);return a(),e},remove:r=>{const n=l(r);if(!n)return;const i=c(n);return i>-1&&(s.splice(i,1),delete t[r],delete e[r]),a(),!0},removeAll:()=>(s.splice(0),t={},e={},a(),!0),pack:(e,s)=>{let r=t[e]||new CSSStyleSheet;return r.replaceSync(s),r=n(e,r),!!r.cssRules.length&&h(e,r)},replace:(e,s)=>{const r=t[e];if(r)return r.replaceSync(s),a(),!0},register:t=>{r.findIndex((e=>e.deref()===t))>=0||(r.push(new WeakRef(t)),i(t))},unregister:t=>{const e=r.findIndex((e=>e.deref()===t));e>=0&&r.splice(e,1)}}}(),this._settings=x,this._cust=()=>{var t;const e=null===(t=this._settings)||void 0===t?void 0:t.vars,{varName:s}=this._s(this._k.base),r=t=>s("",t);function n(t,e){return Nt(t).reduce(((t,[r,i])=>i&&"object"==typeof i?Ct(t,n(i,[...e,r])):(t[s(...e,r)]=i,t)),{})}const i=It(Nt(e||{}).map((([t,e])=>[t,n(e,[])]))),{"":a={},dark:c,light:l}=i,h=function(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(s[r[n]]=t[r[n]])}return s}(i,["","dark","light"]),o=this.size,u=this.time,g=this.angle,{l:m,c:p,h:d}=this._settings.palette,b=this._settings.coef,f=[0,...Bt(b.$0_),1,...Bt(b.$1_),2,...Bt(b.$2_),16,...Bt(b.$16_),b.max];this._=({bem:t,each:e,when:n,vars:c,merge:l,at:{mq:b},units:{px:x,ms:$,deg:y}})=>{const v="prefers-color-scheme",j={light:`${v}: light`,dark:`${v}: dark`};return l({[Mt()]:l({fontSize:c("rem")},a,e(f,((t,e)=>({[s("coef",t)]:e}))),e(d,((t,e)=>({[s(zt,"h",t)]:e}))),{[s(zt,"c","bg","gray")]:0,[s(zt,"c","fg","gray")]:0},e(j,((t,r)=>({[b(r).s]:l(i[t]||{},e(Lt,((e,r)=>({[s(zt,"l","bg",r)]:m[t].bg[r],[s(zt,"l","fg",r)]:m[t].fg[r]}))),e(Rt,((e,r)=>({[s(zt,"c","bg",r)]:p[t].bg[r],[s(zt,"c","fg",r)]:p[t].fg[r]}))))}))))},e(h,((e,s)=>({[Mt(`${qt}=${e}`)]:s,[t(`..theme.${e}`)]:s}))),n(!!o,{[Mt(At)]:{[r("rem")]:x(o)}}),n(!!u,{[Mt(Et)]:{[r("rtime")]:$(u)}}),n(!!g,{[Mt(Pt)]:{[r("rangle")]:y(g)}}))},this.use(this._,this._k.base,!0)},this.use=(t,e,s)=>{const r=e||this._k.current;let n=this._c.use(t,r);return(s||this._m&&!this._m.has(e))&&this._m.pack(n,this.css(t,n)),e||this._k.next(),this.resolve(n)},this.usePublic=t=>It(Nt(t).map((([t,e])=>[t,this.use(e,t)]))),this.usePrivate=t=>t.map((t=>this.use(t))),this.resolve=t=>this._s(t||this._k.base).attr,this.css=(t,e)=>this._p.compile({key:e,maker:t}),this.status=t=>{const e=this.key(t);return!!e&&this._m.status(e)},this.on=(...t)=>this._m.on(...t.map(this.key)),this.off=(...t)=>this._m.off(...t.map(this.key)),this.key=t=>"string"==typeof t?t:this._c.getKey(t),this.stylesheets=(t=this._c.keys)=>t.map((t=>this._m.get(this.key(t))))}static get observedAttributes(){return[At,Et,Pt]}get prefix(){return Wt(this,"prefix")||""}get mode(){return Wt(this,"mode")}get hydrate(){return""===this.getAttribute("hydrate")}get settings(){return this._settings}set settings(t){var e,s,r;const n=m({},this._settings,t),{makers:i,bp:a,off:c}=n;(a&&(null===(e=this._settings)||void 0===e?void 0:e.bp)!==a||!this._p)&&(this._p=St({scope:this._s,globalKey:this._k.base,bp:a})),i&&(null===(s=this._settings)||void 0===s?void 0:s.makers)!==i&&(this._c.useMany(i),this.usePublic(i),(null==c?void 0:c.length)&&this._settings.off!==c&&this.off(...c),this.hydrate&&this._k.reset()),this._settings=n,(!(null===(r=this._m)||void 0===r?void 0:r.has(this._k.base))||t.vars||t.palette||t.coef)&&this._cust()}set theme(t){Kt(this,qt,t)}get theme(){return Wt(this,qt)||""}set size(t){Kt(this,At,t)}get size(){return Ft(this,At)}set time(t){Kt(this,"time",t)}get time(){return Ft(this,Et)}set angle(t){Kt(this,"angle",t)}get angle(){return Ft(this,Pt)}attributeChangedCallback(){this._k&&this._cust()}connectedCallback(){this._k=$({prefix:this.prefix}),this._s=((t={})=>{const{mode:s}=t;let a,m;return t=>{const p=(...e)=>""+e.filter(Boolean).reduce(((t,e)=>`${t}-${e}`),t),d=(...t)=>"--"+p(...t);return"c"===s?(a=t=>{let e,s,r,n;return i(t)?([e,s,r,n]=l(t),u(p(e),s,r,n)):t&&h(t).map((([t,e,s,r])=>u(p(t),e,s,r))).join(",")},m=t=>{let e,s,n,a;const c="class";let u="";return Array.isArray(t)?u=[...t.reduce(((t,r)=>([e,s,n,a]=l(r),t.add(o(p(e),s)),n&&t.add(o(p(e),s,n,a)),t)),new Set).values()].join(" "):i(t)?([e,s,n,a]=l(t),u=o(p(e),s,n,a)):u=t&&h(t,!0).map((([t,e,s,r])=>o(p(t),e,s,r))).join(" "),r({[c]:u},{toString:{value:()=>`${c}="${u}"`}})}):(a=t=>{let e,s,r,n;return i(t)?([e,s,r,n]=l(t),g(p(e),s,r,n)):t&&h(t).map((([t,e,s,r])=>g(p(t),e,s,r))).join(",")},m=t=>{let s,a,o,u,g,m,d="";if(Array.isArray(t))m=t.reduce(((t,e)=>{[s,a,o,u]=l(e);const r=c(p(s),a);return g=n(r),d=o?u?`${o}_${u}`:`${o}`:"",t[g]&&d?t[g]=t[g]+" "+d:t[g]=d,t}),{});else if(i(t)){[s,a,o,u]=l(t);const e=c(p(s),a);g=n(e),d=o?u?`${o}_${u}`:`${o}`:"",m={[g]:d}}else m=t&&h(t,!0).reduce(((t,[e,s,r,i])=>{const a=c(p(e),s);g=n(a);const l=r?i?`${r}_${i}`:`${r}`:"";return d=t[g]?t[g]+" "+l:l,t[g]=d,t}),{});return r(m,{toString:{value:()=>e(m).map((([t,e])=>`${t}="${e}"`)).join(" ")}}),m}),{selector:a,attr:m,name:p,varName:d,varExp:(...t)=>`var(${d(...t)})`}}})({mode:this.mode});const a=this;this._n={set adoptedStyleSheets(t){a.dispatchEvent(new CustomEvent("effcsschanges",{detail:{styles:t},bubbles:!0}))}},this._m.register(this._n),this._m.register(s),this.settings=t}toString(){return`<script ${[...this.attributes].map((t=>t.value?`${t.name}="${t.value}"`:""===t.value?t.name:"")).filter(Boolean).join(" ")}>${this.textContent}<\/script>`}}a.define(d,p,{extends:"script"})}}();
|
|
7
|
+
"function"==typeof SuppressedError&&SuppressedError;const t=void 0,e=Object.entries,s=Array.isArray,r=Object.defineProperties,n=t=>`data-${t}`,i=t=>"string"==typeof t,a=t=>null!==t&&"object"==typeof t,c=(t,e)=>`${t}${e?"__"+e:""}`,l=t=>t.split("."),h=(s,r)=>e(s).reduce(((s,[n,i])=>{if(a(i)){const c=e(i);c.length?s.push(...c.reduce(((s,[i,c])=>{if((e=>null!==e&&e!==t)(i)&&r&&s.push([n,i,t,t]),a(c)){const t=e(c);t.length&&s.push(...t.reduce(((t,[e,s])=>{const r=typeof s;return"string"!==r&&"number"!==r||t.push([n,i,e,s]),t}),[]))}return s}),[])):s.push([n,t,t,t])}return s}),[]),o=(t,e,s,r)=>""+(c(t,e)+(s?"_"+s:"")+(s&&r?"_"+r:"")),u=(t,e,s,r)=>"."+o(t,e,s,r),g=(t,e,s,r)=>`[${n(c(t,e))}${s&&r?`~="${s}_${r}"`:s?`~="${s}"`:""}]`,m=(t,...r)=>r.length?r.reduce(((t,r)=>(e(r).forEach((([e,r])=>{r&&"object"==typeof r&&t[e]?s(t[e])&&s(r)?t[e]=[...t[e],...r]:m(t[e],r||{}):t[e]=r})),t)),t):t,p={def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},d="effcss-provider",b={theme:null,hydrate:null,mode:"a",prefix:"f",size:null,time:null,angle:null},f={l:{dark:{bg:{xl:.24,l:.3,m:.36,s:.42,xs:.48},fg:{xl:.98,l:.93,m:.86,s:.79,xs:.72}},light:{bg:{xl:.98,l:.93,m:.88,s:.83,xs:.78},fg:{xl:0,l:.12,m:.24,s:.36,xs:.48}}},c:{dark:{bg:{pale:.02,base:.06,rich:.1},fg:{pale:.06,base:.1,rich:.14}},light:{bg:{pale:.01,base:.04,rich:.7},fg:{pale:.07,base:.11,rich:.15}}},h:{pri:184,sec:290,suc:Number(146.2.toFixed(2)),inf:Number(256..toFixed(2)),war:Number((.1*184+.9*109).toFixed(2)),dan:Number(44.5.toFixed(2))}},x={bp:{"3xs":18,"2xs":24,xs:30,sm:40,md:48,lg:64,xl:80,"2xl":96},vars:{"":{rtime:"200ms",rem:"16px",rangle:"30deg",l:p,h:{def:261.35,b:261.35,i:194.77,e:29.23,w:70.66,s:142.49},c:{def:.03,xs:.03,s:.06,m:.1,l:.15,xl:.25},a:{def:1,min:0,xs:.1,s:.25,m:.5,l:.75,xl:.9,max:1},t:{def:300,xs:100,s:200,m:300,l:450,xl:600,no:0,min:50,max:750},int:[...Array(12).keys()],fr:{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"},ar:{1:1,"2/1":2,"1/2":.5,"4/3":1.3333,"3/4":.75,"9/16":.5625,"16/9":1.7778}},light:{l:p},dark:{l:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}},palette:f,coef:{$0_:{xxs:.0625,xs:.125,s:.25,m:.5,l:.75,xl:.875,xxl:.9375},$1_:{xxs:1.0625,xs:1.125,s:1.25,m:1.5,l:1.75,xl:1.875,xxl:1.9375},$2_:{xxs:2.5,xs:4,s:5,m:7.5,l:10,xl:12,xxl:15},$16_:{xxs:20,xs:28,s:36,m:48,l:64,xl:80,xxl:120},max:150}};function $(t){const e=({b:s,e:r,m:n})=>({b:t=>e({b:t,e:"",m:{}}),e:t=>e({b:s,e:t,m:{}}),m:(t={})=>e({b:s,e:r,m:t}),get $(){return t({[s]:{[r]:n}})}});return e({b:"",e:"",m:{}})}const v=({prefix:t})=>{let e=1;return{get base(){return t+0},get current(){return t+e},next(){return e++,this.current},reset(){e=1}}},y=()=>{const t=new Set,s=new Map;return{use(e,r){const n=s.get(e);return n||(t.add(r),s.set(e,r),r)},useMany(t){return e(t).map((([t,e])=>this.use(e,t)))},getKey:t=>s.get(t),get keys(){return[...t]},get makers(){return Object.fromEntries(s.entries().map((([t,e])=>[e,t])))}}},j=(t,e,s)=>Object.entries(t).reduce(e,s),O=Symbol("noParse"),_=(t,e,s)=>{var r,n,i;let a=""+t;return null==e?"":"object"!=typeof e||e.hasOwnProperty(O)?`${c=a,c.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}:${""+e};`:(!s||(null===(r=s.startsWith)||void 0===r?void 0:r.call(s,"@"))||(null===(n=a.startsWith)||void 0===n?void 0:n.call(a,"&"))||(null===(i=a.startsWith)||void 0===i?void 0:i.call(a,"@"))?"":"&")+a+`{${j(e,((t,e)=>t+_(...e,a)),"")}}`;var c},w="@media",k="@container",S="@property",q="@keyframes",A="@layer",E="@scope",P="@supports",N=(t,e)=>{const s=w+` ${e||""}${e?" and ":""}(${t})`;return{s:s,q:t,t:e,toString:()=>s}};N.toString=()=>w;const z=t=>t+"px",C=t=>t+"vh",I=t=>t+"vw",W=t=>t+"vmin",F=t=>t+"vmax",K=t=>t+"rem",M=t=>t+"deg",B=t=>t+"ms",L=t=>t+"%",R=t=>t+"cqw",V=t=>t+"cqh",H=t=>t+"cqi",T=t=>t+"cqb",Z=t=>t+"cqmin",D=t=>t+"cqmax",G=Object.fromEntries,J=Object.entries,Q=":first-",U=":last-",X=":only-",Y="child",tt=":nth-",et="of-type",st=tt+Y,rt=":focus",nt={r:":root",h:":hover",f:rt,fv:rt+"-visible",a:":active",v:":visited",val:":valid",inv:":invalid",e:":empty",d:":disabled",rq:":required",o:":optional",m:":modal",l:":link",ph:":placeholder",ch:":checked",po:":popover-open",fc:Q+Y,lc:U+Y,oc:X+Y,odd:st+"(odd)",even:st+"(even)",ft:Q+et,lt:U+et,ot:X+et,bef:"::before",aft:"::after",bd:"::backdrop"},it={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:st,ntho:tt+et,dir:":dir",lang:":lang"},at="oklch",ct=t=>at+`(${t})`,lt=t=>ct(`from ${t}`),ht="def",ot=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",ht),c:e("c",ht),h:e("h",ht),a:e("a",ht)},this.merge=t=>new s(Object.assign(this.state,t)),this.l=t=>this.merge({l:e("l",t)}),this.c=t=>this.merge({c:e("c",t)}),this.h=t=>this.merge({h:e("h",t)}),this.a=t=>this.merge({a:e("a",t)}),this.state=Object.assign(this.state,t)}get s(){return this.toString()}toString(){const{l:t,c:e,h:s,a:r}=this.state;return ct(`${t} ${e} ${s} / ${r}`)}}return t=>new s(t)},ut=(t,e=.1)=>lt(`${t} calc(l + ${e}) c h / alpha)`),gt=(t,e=.1)=>lt(`${t} calc(l - ${e}) c h / alpha)`),mt=(t,e=.1)=>lt(`${t} l c h / calc(alpha + ${e}))`),pt=(t,e=.1)=>lt(`${t} l c h / calc(alpha - ${e}))`),dt=(t,e=.04)=>lt(`${t} l calc(c + ${e}) h / alpha)`),bt=(t,e=.04)=>lt(`${t} l calc(c - ${e}) h / alpha)`),ft=(t,e=30)=>lt(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),xt=({base:t,mixin:e,method:s,bpart:r,mpart:n})=>`color-mix(in ${s||at}, ${t}${void 0!==r?` ${r}%`:""}, ${e}${void 0!==n?` ${n}%`:""})`,$t=t=>({create:ot(t),oklch:ct,lighten:ut,darken:gt,saturate:dt,desaturate:bt,fadein:mt,fadeout:pt,spin:ft,mix:xt}),vt="palette",yt=t=>{class e{constructor(t={}){this.state={l:"l",c:"base",h:"pri",a:1,m:"bg"},Object.assign(this,{[O]:!0}),this.state=Object.assign(this.state,t)}get xs(){return new e(Object.assign(Object.assign({},this.state),{l:"xs"}))}get s(){return new e(Object.assign(Object.assign({},this.state),{l:"s"}))}get m(){return new e(Object.assign(Object.assign({},this.state),{l:"m"}))}get l(){return new e(Object.assign(Object.assign({},this.state),{l:"l"}))}get xl(){return new e(Object.assign(Object.assign({},this.state),{l:"xl"}))}get lightness(){return{xs:this.xs,s:this.s,m:this.m,l:this.l,xl:this.xl}}get gray(){return new e(Object.assign(Object.assign({},this.state),{c:"gray"}))}get pale(){return new e(Object.assign(Object.assign({},this.state),{c:"pale"}))}get base(){return new e(Object.assign(Object.assign({},this.state),{c:"base"}))}get rich(){return new e(Object.assign(Object.assign({},this.state),{c:"rich"}))}get chroma(){return{gray:this.gray,pale:this.pale,base:this.base,rich:this.rich}}get pri(){return new e(Object.assign(Object.assign({},this.state),{h:"pri"}))}get sec(){return new e(Object.assign(Object.assign({},this.state),{h:"sec"}))}get suc(){return new e(Object.assign(Object.assign({},this.state),{h:"suc"}))}get inf(){return new e(Object.assign(Object.assign({},this.state),{h:"inf"}))}get war(){return new e(Object.assign(Object.assign({},this.state),{h:"war"}))}get dan(){return new e(Object.assign(Object.assign({},this.state),{h:"dan"}))}get hue(){return{pri:this.pri,sec:this.sec,suc:this.suc,inf:this.inf,war:this.war,dan:this.dan}}alpha(t=1){return new e(Object.assign(Object.assign({},this.state),{a:t}))}get bg(){return new e(Object.assign(Object.assign({},this.state),{m:"bg"}))}get fg(){return new e(Object.assign(Object.assign({},this.state),{m:"fg"}))}toString(){const{l:e,c:s,h:r,a:n,m:i}=this.state;return`oklch(${t(vt,"l",i,e)} ${t(vt,"c",i,s)} ${t(vt,"h",r)} / ${n})`}}return new e},jt="coef",Ot=t=>{class e{constructor(t={}){this.state={center:8},this.state=Object.assign(this.state,t)}get min(){return t(jt,this.state.center-4)}get xxs(){return t(jt,this.state.center-3)}get xs(){return t(jt,this.state.center-2)}get s(){return t(jt,this.state.center-1)}get m(){return t(jt,this.state.center)}get l(){return t(jt,this.state.center+1)}get xl(){return t(jt,this.state.center+2)}get xxl(){return t(jt,this.state.center+3)}get max(){return t(jt,this.state.center+4)}get $0_(){return new e({center:4})}get $1_(){return new e({center:12})}get $2_(){return new e({center:20})}get $16_(){return new e({center:28})}get $1(){return new e({center:8})}get $2(){return new e({center:16})}get $16(){return new e({center:24})}get short(){return{s:this.s,m:this.m,l:this.l}}get base(){return Object.assign(Object.assign({xs:this.xs},this.short),{xl:this.xl})}get long(){return Object.assign(Object.assign({xxs:this.xxs},this.base),{xxl:this.xxl})}get full(){return Object.assign(Object.assign({min:this.min},this.long),{max:this.max})}get main(){return{min:this.min,m:this.m,max:this.max}}get sparse(){return{min:this.min,xs:this.xs,m:this.m,xl:this.xl,max:this.max}}}return new e},_t=Object.assign,wt=Object.entries,kt={dash:(...t)=>t.join("-"),comma:(...t)=>t.join(),space:(...t)=>t.join(" "),range:(t,e)=>Array.from(Array(t).entries()).reduce(((t,[s])=>_t(t,e(s+1))),{}),each:(t,e)=>wt(t).reduce(((t,[s,r])=>_t(t,e(s,r))),{}),when:(t,e,s={})=>t?e:s},St="width: ",qt=t=>{const{scope:e,globalKey:s="",bp:r={}}=t,n=e(s).varExp,i=t=>n(...t.split(".")),a=(t=1)=>`calc(${t} * ${i("rtime")})`,c=(t=1)=>`calc(${t} * ${i("rangle")})`,l=(t=1)=>`calc(${t} * 1rem)`;return{compile:({key:t,maker:s})=>{const h=e(t),o=(t=>{const e={cp:1,lay:1,kf:1,cq:1},s=(s,r)=>{const n="string"==typeof r?r:t.name("cq",e.cq++),i=k+` ${n?n+" ":""}(${s})`;return{c:n,q:s,s:i,toString:()=>i}};s.toString=()=>k;const r=(s,r)=>{const n="--"+(s||t.name("cp",e.cp++)),i=S+" "+n;return{k:n,v:`var(${n})`,s:i,r:{[i]:{syntax:(null==r?void 0:r.syn)||'"*"',inherits:(null==r?void 0:r.inh)||!1,initialValue:null==r?void 0:r.ini}},toString:()=>i}};r.toString=()=>S;const n=s=>{const r=s||t.name("kf",e.kf++),n=q+" "+r;return{k:r,s:n,toString:()=>n}};n.toString=()=>q;const i=s=>{const r=s||t.name("lay",e.lay++),n=A+" "+r;return{k:r,s:n,toString:()=>n}};i.toString=()=>A,i.toString=()=>E;const a=(t="",e=!1)=>{const s=P+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return a.toString=()=>P,{pr:r,kf:n,mq:N,cq:s,lay:i,sc:(t="",e="")=>{const s=E+` ${t?`(${t})`:""}${t&&e?" ":""}${e?`to (${e})`:""}`;return{r:t,l:e,s:s,toString:()=>s}},sup:a,keyframes:s=>{const r=t.name("kf",e.kf++),n=q+" "+r;return Object.defineProperties((t=>{if(!t)return{animationName:r};const{dur:e,tf:s,del:n,ic:i,dir:a,ps:c,fm:l}=t;return{animation:[e,s,n,i,a,c,l,r].filter(Boolean).join(" ")}}),{[n]:{value:s,enumerable:!0},toString:{value:()=>r},[O]:{value:!0}})},property:(s={})=>{const{syn:r='"*"',inh:n=!0,ini:i,def:a}=s,c="--"+t.name("cp",e.cp++),l=`var(${c}${void 0!==a?","+a:""})`,h=S+" "+c;return Object.defineProperties((t=>({[c]:t})),{[h]:{value:{syntax:r,inherits:n,initialValue:i},enumerable:!0},toString:{value:()=>l},[O]:{value:!0}})}}})(h),u=t=>{const e=r[t]||t;return"number"==typeof e?e+"rem":""},g=t=>"min-"+St+u(t),p=t=>"max-"+St+u(t),d=(t,e)=>"string"==typeof e?o.cq(t,e):o.mq(t),b=(t,e,s)=>""+d(g(t)+") and ("+p(e),s),f={up:(t,e)=>""+d(g(t),e),down:(t,e)=>""+d(p(t),e),between:b,only:(t,e)=>b(t,t,e)};return x=s(Object.assign(kt,{key:t,vars:i,size:l,time:a,angle:c,bem:h.selector,pseudo:Object.assign(G(J(nt).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),G(J(it).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:$t(n),palette:yt(n),coef:Ot(n),units:{px:z,vh:C,vw:I,vmin:W,vmax:F,rem:K,deg:M,ms:B,pc:L,cqw:R,cqh:V,cqb:T,cqi:H,cqmin:Z,cqmax:D},at:o,limit:f,merge:m})),j(x,((t,e)=>t+_(...e)),"");var x}}};const At="theme",Et="size",Pt="time",Nt="angle",zt="palette",Ct=Object.assign,It=Object.entries,Wt=Object.fromEntries,Ft=(t,e)=>t.getAttribute(e)||b[e],Kt=(t,e)=>{const s=Ft(t,e);return null!==s?Number(s):null},Mt=(t,e,s)=>null===s?t.removeAttribute(e):t.setAttribute(e,s+""),Bt=t=>`:root:has(script[is=${d}]${t?`[${t}]`:""})`,Lt=t=>[t.xxs,t.xs,t.s,t.m,t.l,t.xl,t.xxl],Rt=["xs","s","m","l","xl"],Vt=["pale","base","rich"];!function(t={}){const s=window.document,a=window.customElements;if(null==a?void 0:a.get(d))return!1;{class p extends HTMLScriptElement{constructor(){super(...arguments),this._c=y(),this._m=function(){let t={},e={},s=[],r=[];const n=(t,e)=>(e.toString=()=>"effcss-"+t,e),i=t=>{var e;return t.adoptedStyleSheets=[...(null===(e=t.adoptedStyleSheets)||void 0===e?void 0:e.length)?[...t.adoptedStyleSheets].filter((t=>!(t+"").startsWith("effcss-"))):[],...s]},a=()=>{r=r.reduce(((t,e)=>{const s=e.deref();return s&&(i(s),t.push(e)),t}),[])},c=t=>s.findIndex((e=>e===t)),l=e=>e?t[e]:void 0,h=(e,r)=>{if(!t[e])return t[e]=n(e,r),s.push(t[e]),a(),!0},o=t=>{const e=l(t);return!!e&&-1!==c(e)};return{apply:i,notify:a,getIndex:c,get:l,has:t=>!!t&&!!l(t),getAll:()=>t,add:h,status:o,on:(...t)=>{const e=t.reduce(((t,e)=>{const r=l(e);return!(!r||o(e))&&(s.push(r),t)}),!0);return a(),e},off:(...t)=>{const e=t.reduce(((t,e)=>{const r=l(e);if(r&&o(e)){const e=c(r);return s.splice(e,1),t}return!1}),!0);return a(),e},remove:r=>{const n=l(r);if(!n)return;const i=c(n);return i>-1&&(s.splice(i,1),delete t[r],delete e[r]),a(),!0},removeAll:()=>(s.splice(0),t={},e={},a(),!0),pack:(e,s)=>{let r=t[e]||new CSSStyleSheet;return r.replaceSync(s),r=n(e,r),!!r.cssRules.length&&h(e,r)},replace:(e,s)=>{const r=t[e];if(r)return r.replaceSync(s),a(),!0},register:t=>{r.findIndex((e=>e.deref()===t))>=0||(r.push(new WeakRef(t)),i(t))},unregister:t=>{const e=r.findIndex((e=>e.deref()===t));e>=0&&r.splice(e,1)}}}(),this._settings=x,this._cust=()=>{var t;const e=null===(t=this._settings)||void 0===t?void 0:t.vars,{varName:s}=this._s(this._k.base),r=t=>s("",t);function n(t,e){return It(t).reduce(((t,[r,i])=>i&&"object"==typeof i?Ct(t,n(i,[...e,r])):(t[s(...e,r)]=i,t)),{})}const i=Wt(It(e||{}).map((([t,e])=>[t,n(e,[])]))),{"":a={},dark:c,light:l}=i,h=function(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(s[r[n]]=t[r[n]])}return s}(i,["","dark","light"]),o=this.size,u=this.time,g=this.angle,{l:m,c:p,h:d}=this._settings.palette,b=this._settings.coef,f=[0,...Lt(b.$0_),1,...Lt(b.$1_),2,...Lt(b.$2_),16,...Lt(b.$16_),b.max];this._=({bem:t,each:e,when:n,vars:c,merge:l,at:{mq:b},units:{px:x,ms:$,deg:v}})=>{const y="prefers-color-scheme",j={light:`${y}: light`,dark:`${y}: dark`};return l({[Bt()]:l({fontSize:c("rem")},a,e(f,((t,e)=>({[s("coef",t)]:e}))),e(d,((t,e)=>({[s(zt,"h",t)]:e}))),{[s(zt,"c","bg","gray")]:0,[s(zt,"c","fg","gray")]:0},e(j,((t,r)=>({[b(r).s]:l(i[t]||{},e(Rt,((e,r)=>({[s(zt,"l","bg",r)]:m[t].bg[r],[s(zt,"l","fg",r)]:m[t].fg[r]}))),e(Vt,((e,r)=>({[s(zt,"c","bg",r)]:p[t].bg[r],[s(zt,"c","fg",r)]:p[t].fg[r]}))))}))))},e(h,((e,s)=>({[Bt(`${At}=${e}`)]:s,[t(`..theme.${e}`)]:s}))),n(!!o,{[Bt(Et)]:{[r("rem")]:x(o)}}),n(!!u,{[Bt(Pt)]:{[r("rtime")]:$(u)}}),n(!!g,{[Bt(Nt)]:{[r("rangle")]:v(g)}}))},this.use(this._,this._k.base,!0)},this.use=(t,e,s)=>{const r=e||this._k.current;let n=this._c.use(t,r);return(s||this._m&&!this._m.has(e))&&this._m.pack(n,this.css(t,n)),e||this._k.next(),this.resolve(n)},this.usePublic=t=>Wt(It(t).map((([t,e])=>[t,this.use(e,t)]))),this.usePrivate=t=>t.map((t=>this.use(t))),this.resolve=t=>this._s(t||this._k.base).attr,this.css=(t,e)=>this._p.compile({key:e,maker:t}),this.status=t=>{const e=this.key(t);return!!e&&this._m.status(e)},this.on=(...t)=>this._m.on(...t.map(this.key)),this.off=(...t)=>this._m.off(...t.map(this.key)),this.key=t=>"string"==typeof t?t:this._c.getKey(t),this.stylesheets=(t=this._c.keys)=>t.map((t=>this._m.get(this.key(t))))}static get observedAttributes(){return[Et,Pt,Nt]}get prefix(){return Ft(this,"prefix")||""}get mode(){return Ft(this,"mode")}get hydrate(){return""===this.getAttribute("hydrate")}get settings(){return this._settings}set settings(t){var e,s,r;const n=m({},this._settings,t),{makers:i,bp:a,off:c}=n;(a&&(null===(e=this._settings)||void 0===e?void 0:e.bp)!==a||!this._p)&&(this._p=qt({scope:this._s,globalKey:this._k.base,bp:a})),i&&(null===(s=this._settings)||void 0===s?void 0:s.makers)!==i&&(this._c.useMany(i),this.usePublic(i),(null==c?void 0:c.length)&&this._settings.off!==c&&this.off(...c),this.hydrate&&this._k.reset()),this._settings=n,(!(null===(r=this._m)||void 0===r?void 0:r.has(this._k.base))||t.vars||t.palette||t.coef)&&this._cust()}get makers(){return this._c.makers}set theme(t){Mt(this,At,t)}get theme(){return Ft(this,At)||""}set size(t){Mt(this,Et,t)}get size(){return Kt(this,Et)}set time(t){Mt(this,"time",t)}get time(){return Kt(this,Pt)}set angle(t){Mt(this,"angle",t)}get angle(){return Kt(this,Nt)}attributeChangedCallback(){this._k&&this._cust()}connectedCallback(){this._k=v({prefix:this.prefix}),this._s=((t={})=>{const{mode:s}=t;let a,m;return t=>{const p=(...e)=>""+e.filter(Boolean).reduce(((t,e)=>`${t}-${e}`),t),d=(...t)=>"--"+p(...t);return"c"===s?(a=t=>{let e,s,r,n;return i(t)?([e,s,r,n]=l(t),u(p(e),s,r,n)):t&&h(t).map((([t,e,s,r])=>u(p(t),e,s,r))).join(",")},m=t=>{if(void 0===t)return $(m);let e,s,n,a;const c="class";let u="";return Array.isArray(t)?u=[...t.reduce(((t,r)=>([e,s,n,a]=l(r),t.add(o(p(e),s)),n&&t.add(o(p(e),s,n,a)),t)),new Set).values()].join(" "):i(t)?([e,s,n,a]=l(t),u=o(p(e),s,n,a)):u=t&&h(t,!0).map((([t,e,s,r])=>o(p(t),e,s,r))).join(" "),r({[c]:u},{toString:{value:()=>`${c}="${u}"`}})}):(a=t=>{let e,s,r,n;return i(t)?([e,s,r,n]=l(t),g(p(e),s,r,n)):t&&h(t).map((([t,e,s,r])=>g(p(t),e,s,r))).join(",")},m=t=>{if(void 0===t)return $(m);let s,a,o,u,g,d,b="";if(Array.isArray(t))d=t.reduce(((t,e)=>{[s,a,o,u]=l(e);const r=c(p(s),a);return g=n(r),b=o?u?`${o}_${u}`:`${o}`:"",t[g]&&b?t[g]=t[g]+" "+b:t[g]=b,t}),{});else if(i(t)){[s,a,o,u]=l(t);const e=c(p(s),a);g=n(e),b=o?u?`${o}_${u}`:`${o}`:"",d={[g]:b}}else d=t&&h(t,!0).reduce(((t,[e,s,r,i])=>{const a=c(p(e),s);g=n(a);const l=r?i?`${r}_${i}`:`${r}`:"";return b=t[g]?t[g]+" "+l:l,t[g]=b,t}),{});return r(d,{toString:{value:()=>e(d).map((([t,e])=>`${t}="${e}"`)).join(" ")}}),d}),{selector:a,attr:m,name:p,varName:d,varExp:(...t)=>`var(${d(...t)})`}}})({mode:this.mode});const a=this;this._n={set adoptedStyleSheets(t){a.dispatchEvent(new CustomEvent("effcsschanges",{detail:{styles:t},bubbles:!0}))}},this._m.register(this._n),this._m.register(s),this.settings=t}toString(){return`<script ${[...this.attributes].map((t=>t.value?`${t.name}="${t.value}"`:""===t.value?t.name:"")).filter(Boolean).join(" ")}>${this.textContent}<\/script>`}}a.define(d,p,{extends:"script"})}}();
|
package/dist/consumer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* EffCSS v3.
|
|
2
|
+
* EffCSS v3.6.0
|
|
3
3
|
* {@link https://gitverse.ru/msabitov/effcss}
|
|
4
4
|
* Copyright (c) Marat Sabitov
|
|
5
5
|
* @license Apache-2.0
|
|
6
6
|
*/
|
|
7
|
-
const e=void 0,t=Object.entries,r=Object.defineProperties,n=e=>`data-${e}`,s=e=>"string"==typeof e,u=e=>null!==e&&"object"==typeof e,i=(e,t)=>`${e}${t?"__"+t:""}`,l=e=>e.split("."),o=(r,n)=>t(r).reduce(((r,[s,i])=>{if(u(i)){const l=t(i);l.length?r.push(...l.reduce(((r,[i,l])=>{if((t=>null!==t&&t!==e)(i)&&n&&r.push([s,i,e,e]),u(l)){const e=t(l);e.length&&r.push(...e.reduce(((e,[t,r])=>{const n=typeof r;return"string"!==n&&"number"!==n||e.push([s,i,t,r]),e}),[]))}return r}),[])):r.push([s,e,e,e])}return r}),[]),a=(e,t,r,n)=>""+(i(e,t)+(r?"_"+r:"")+(r&&n?"_"+n:"")),c=(e,t,r,n)=>"."+a(e,t,r,n),
|
|
7
|
+
const e=void 0,t=Object.entries,r=Object.defineProperties,n=e=>`data-${e}`,s=e=>"string"==typeof e,u=e=>null!==e&&"object"==typeof e,i=(e,t)=>`${e}${t?"__"+t:""}`,l=e=>e.split("."),o=(r,n)=>t(r).reduce(((r,[s,i])=>{if(u(i)){const l=t(i);l.length?r.push(...l.reduce(((r,[i,l])=>{if((t=>null!==t&&t!==e)(i)&&n&&r.push([s,i,e,e]),u(l)){const e=t(l);e.length&&r.push(...e.reduce(((e,[t,r])=>{const n=typeof r;return"string"!==n&&"number"!==n||e.push([s,i,t,r]),e}),[]))}return r}),[])):r.push([s,e,e,e])}return r}),[]),a=(e,t,r,n)=>""+(i(e,t)+(r?"_"+r:"")+(r&&n?"_"+n:"")),c=(e,t,r,n)=>"."+a(e,t,r,n),m=(e,t,r,s)=>`[${n(i(e,t))}${r&&s?`~="${r}_${s}"`:r?`~="${r}"`:""}]`,d="effcss-provider",p={theme:null,hydrate:null,mode:"a",prefix:"f",size:null,time:null,angle:null};Number(146.2.toFixed(2)),Number(256..toFixed(2)),Number((.1*184+.9*109).toFixed(2)),Number(44.5.toFixed(2));function g(e){const t=({b:r,e:n,m:s})=>({b:e=>t({b:e,e:"",m:{}}),e:e=>t({b:r,e:e,m:{}}),m:(e={})=>t({b:r,e:n,m:e}),get $(){return e({[r]:{[n]:s}})}});return t({b:"",e:"",m:{}})}Array(12).keys();const $=({prefix:e})=>{let t=1;return{get base(){return e+0},get current(){return e+t},next(){return t++,this.current},reset(){t=1}}},f=()=>{const e=new Set,r=new Map;return{use(t,n){const s=r.get(t);return s||(e.add(n),r.set(t,n),n)},useMany(e){return t(e).map((([e,t])=>this.use(t,e)))},getKey:e=>r.get(e),get keys(){return[...e]},get makers(){return Object.fromEntries(r.entries().map((([e,t])=>[t,e])))}}},b=e=>null==e?null:Number(e),h=(e={})=>{var u;let h,y,v,j,x,S,k,O=null===(u=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===u?void 0:u.querySelector(`script[is=${d}]`);if(O)return O;({prefix:y,mode:v,hydrate:j,theme:h,size:x,time:S,angle:k}=Object.assign({},p,e));let _,z,A,N=b(x),w=b(S),F=b(k);const E=new Set,P=()=>y||p.prefix,T=()=>v||p.mode,B=()=>""===j,K=$({prefix:P()}),M=((e={})=>{const{mode:u}=e;let d,p;return e=>{const $=(...t)=>""+t.filter(Boolean).reduce(((e,t)=>`${e}-${t}`),e),f=(...e)=>"--"+$(...e);return"c"===u?(d=e=>{let t,r,n,u;return s(e)?([t,r,n,u]=l(e),c($(t),r,n,u)):e&&o(e).map((([e,t,r,n])=>c($(e),t,r,n))).join(",")},p=e=>{if(void 0===e)return g(p);let t,n,u,i;const c="class";let m="";return Array.isArray(e)?m=[...e.reduce(((e,r)=>([t,n,u,i]=l(r),e.add(a($(t),n)),u&&e.add(a($(t),n,u,i)),e)),new Set).values()].join(" "):s(e)?([t,n,u,i]=l(e),m=a($(t),n,u,i)):m=e&&o(e,!0).map((([e,t,r,n])=>a($(e),t,r,n))).join(" "),r({[c]:m},{toString:{value:()=>`${c}="${m}"`}})}):(d=e=>{let t,r,n,u;return s(e)?([t,r,n,u]=l(e),m($(t),r,n,u)):e&&o(e).map((([e,t,r,n])=>m($(e),t,r,n))).join(",")},p=e=>{if(void 0===e)return g(p);let u,a,c,m,d,f,b="";if(Array.isArray(e))f=e.reduce(((e,t)=>{[u,a,c,m]=l(t);const r=i($(u),a);return d=n(r),b=c?m?`${c}_${m}`:`${c}`:"",e[d]&&b?e[d]=e[d]+" "+b:e[d]=b,e}),{});else if(s(e)){[u,a,c,m]=l(e);const t=i($(u),a);d=n(t),b=c?m?`${c}_${m}`:`${c}`:"",f={[d]:b}}else f=e&&o(e,!0).reduce(((e,[t,r,s,u])=>{const l=i($(t),r);d=n(l);const o=s?u?`${s}_${u}`:`${s}`:"";return b=e[d]?e[d]+" "+o:o,e[d]=b,e}),{});return r(f,{toString:{value:()=>t(f).map((([e,t])=>`${e}="${t}"`)).join(" ")}}),f}),{selector:d,attr:p,name:$,varName:f,varExp:(...e)=>`var(${f(...e)})`}}})({mode:T()}),q=f(),C=e=>"string"==typeof e?e:q.getKey(e),D=e=>M(e||K.base).attr,G=(e,t)=>{const r=t||K.current;let n=q.use(e,r);return t||K.next(),D(n)};return{get makers(){return q.makers},get prefix(){return P()},get mode(){return T()},get hydrate(){return B()},set theme(e){h=e},get theme(){return h||""},get size(){return N},set size(e){N=e},get time(){return w},set time(e){w=e},get angle(){return F},set angle(e){F=e},get settings(){return{bp:A,vars:z,off:[...E],makers:q.makers,palette:_}},set settings(e){({bp:A,vars:z,palette:_}=e)},resolve:D,use:G,usePublic:e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[e,G(t,e)]))),usePrivate:e=>e.map((e=>G(e))),css:()=>"",key:C,status:e=>{const t=C(e);return!!t&&!E.has(t)},on:(...e)=>e.map(C).reduce(((e,t)=>e&&!!t&&E.delete(t)),!0),off:(...e)=>e.map(C).reduce(((e,t)=>e&&!!t&&!!E.add(t)),!0),stylesheets:()=>[],toString(){const e=q.makers;delete e[K.base];const t=Object.entries({is:d,prefix:P(),mode:T(),hydrate:B(),theme:h,size:null!==N&&String(N),time:null!==w&&String(w),angle:null!==F&&String(F)}).map((([e,t])=>t?`${e}="${t}"`:""===t?e:"")).filter(Boolean).join(" "),r=`document.currentScript.settings = {makers: {${e?Object.entries(e).reduce(((e,[t,r])=>e+`${e?",":""}${t}: ${r.toString().replaceAll(/\s+/g," ")}`),""):""}},${z?` vars: ${z},`:""}${A?` bp: ${A},`:""}${_?` palette: ${_},`:""}${E.size?` off: [${[...E]}]`:""}}`;return`<script ${t}>${r}<\/script>`}}};export{h as createConsumer};
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* EffCSS v3.
|
|
2
|
+
* EffCSS v3.6.0
|
|
3
3
|
* {@link https://gitverse.ru/msabitov/effcss}
|
|
4
4
|
* Copyright (c) Marat Sabitov
|
|
5
5
|
* @license Apache-2.0
|
|
6
6
|
*/
|
|
7
|
-
"function"==typeof SuppressedError&&SuppressedError;const t=void 0,e=Object.entries,s=Array.isArray,r=Object.defineProperties,n=t=>`data-${t}`,i=t=>"string"==typeof t,a=t=>null!==t&&"object"==typeof t,c=(t,e)=>`${t}${e?"__"+e:""}`,l=t=>t.split("."),h=(s,r)=>e(s).reduce(((s,[n,i])=>{if(a(i)){const c=e(i);c.length?s.push(...c.reduce(((s,[i,c])=>{if((e=>null!==e&&e!==t)(i)&&r&&s.push([n,i,t,t]),a(c)){const t=e(c);t.length&&s.push(...t.reduce(((t,[e,s])=>{const r=typeof s;return"string"!==r&&"number"!==r||t.push([n,i,e,s]),t}),[]))}return s}),[])):s.push([n,t,t,t])}return s}),[]),o=(t,e,s,r)=>""+(c(t,e)+(s?"_"+s:"")+(s&&r?"_"+r:"")),u=(t,e,s,r)=>"."+o(t,e,s,r),g=(t,e,s,r)=>`[${n(c(t,e))}${s&&r?`~="${s}_${r}"`:s?`~="${s}"`:""}]`,m=(t,...r)=>r.length?r.reduce(((t,r)=>(e(r).forEach((([e,r])=>{r&&"object"==typeof r&&t[e]?s(t[e])&&s(r)?t[e]=[...t[e],...r]:m(t[e],r||{}):t[e]=r})),t)),t):t,p={def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},d="effcss-provider",b={theme:null,hydrate:null,mode:"a",prefix:"f",size:null,time:null,angle:null},f={l:{dark:{bg:{xl:.24,l:.3,m:.36,s:.42,xs:.48},fg:{xl:.98,l:.93,m:.86,s:.79,xs:.72}},light:{bg:{xl:.98,l:.93,m:.88,s:.83,xs:.78},fg:{xl:0,l:.12,m:.24,s:.36,xs:.48}}},c:{dark:{bg:{pale:.02,base:.06,rich:.1},fg:{pale:.06,base:.1,rich:.14}},light:{bg:{pale:.01,base:.04,rich:.7},fg:{pale:.07,base:.11,rich:.15}}},h:{pri:184,sec:290,suc:Number(146.2.toFixed(2)),inf:Number(256..toFixed(2)),war:Number((.1*184+.9*109).toFixed(2)),dan:Number(44.5.toFixed(2))}},x={bp:{"3xs":18,"2xs":24,xs:30,sm:40,md:48,lg:64,xl:80,"2xl":96},vars:{"":{rtime:"200ms",rem:"16px",rangle:"30deg",l:p,h:{def:261.35,b:261.35,i:194.77,e:29.23,w:70.66,s:142.49},c:{def:.03,xs:.03,s:.06,m:.1,l:.15,xl:.25},a:{def:1,min:0,xs:.1,s:.25,m:.5,l:.75,xl:.9,max:1},t:{def:300,xs:100,s:200,m:300,l:450,xl:600,no:0,min:50,max:750},int:[...Array(12).keys()],fr:{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"},ar:{1:1,"2/1":2,"1/2":.5,"4/3":1.3333,"3/4":.75,"9/16":.5625,"16/9":1.7778}},light:{l:p},dark:{l:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}},palette:f,coef:{$0_:{xxs:.0625,xs:.125,s:.25,m:.5,l:.75,xl:.875,xxl:.9375},$1_:{xxs:1.0625,xs:1.125,s:1.25,m:1.5,l:1.75,xl:1.875,xxl:1.9375},$2_:{xxs:2.5,xs:4,s:5,m:7.5,l:10,xl:12,xxl:15},$16_:{xxs:20,xs:28,s:36,m:48,l:64,xl:80,xxl:120},max:150}},$=({prefix:t})=>{let e=1;return{get base(){return t+0},get current(){return t+e},next(){return e++,this.current},reset(){e=1}}},y=()=>{const t=new Set,s=new Map;return{use(e,r){const n=s.get(e);return n||(t.add(r),s.set(e,r),r)},useMany(t){return e(t).map((([t,e])=>this.use(e,t)))},getKey:t=>s.get(t),get keys(){return[...t]},get makers(){return Object.fromEntries(s.entries().map((([t,e])=>[e,t])))}}},v="@media",j="@container",O="@property",_="@keyframes",w="@layer",k="@scope",S="@supports",q=(t,e)=>{const s=v+` ${e||""}${e?" and ":""}(${t})`;return{s:s,q:t,t:e,toString:()=>s}};q.toString=()=>v;const A=t=>t+"px",E=t=>t+"vh",P=t=>t+"vw",z=t=>t+"vmin",C=t=>t+"vmax",N=t=>t+"rem",I=t=>t+"deg",W=t=>t+"ms",F=t=>t+"%",K=t=>t+"cqw",M=t=>t+"cqh",B=t=>t+"cqi",L=t=>t+"cqb",R=t=>t+"cqmin",H=t=>t+"cqmax",T=Object.fromEntries,V=Object.entries,Z=":first-",D=":last-",G=":only-",J="child",Q=":nth-",U="of-type",X=Q+J,Y=":focus",tt={r:":root",h:":hover",f:Y,fv:Y+"-visible",a:":active",v:":visited",val:":valid",inv:":invalid",e:":empty",d:":disabled",rq:":required",o:":optional",m:":modal",l:":link",ph:":placeholder",ch:":checked",po:":popover-open",fc:Z+J,lc:D+J,oc:G+J,odd:X+"(odd)",even:X+"(even)",ft:Z+U,lt:D+U,ot:G+U,bef:"::before",aft:"::after",bd:"::backdrop"},et={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:X,ntho:Q+U,dir:":dir",lang:":lang"},st="oklch",rt=t=>st+`(${t})`,nt=t=>rt(`from ${t}`),it="def",at=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",it),c:e("c",it),h:e("h",it),a:e("a",it)},this.merge=t=>new s(Object.assign(this.state,t)),this.l=t=>this.merge({l:e("l",t)}),this.c=t=>this.merge({c:e("c",t)}),this.h=t=>this.merge({h:e("h",t)}),this.a=t=>this.merge({a:e("a",t)}),this.state=Object.assign(this.state,t)}get s(){return this.toString()}toString(){const{l:t,c:e,h:s,a:r}=this.state;return rt(`${t} ${e} ${s} / ${r}`)}}return t=>new s(t)},ct=(t,e=.1)=>nt(`${t} calc(l + ${e}) c h / alpha)`),lt=(t,e=.1)=>nt(`${t} calc(l - ${e}) c h / alpha)`),ht=(t,e=.1)=>nt(`${t} l c h / calc(alpha + ${e}))`),ot=(t,e=.1)=>nt(`${t} l c h / calc(alpha - ${e}))`),ut=(t,e=.04)=>nt(`${t} l calc(c + ${e}) h / alpha)`),gt=(t,e=.04)=>nt(`${t} l calc(c - ${e}) h / alpha)`),mt=(t,e=30)=>nt(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),pt=({base:t,mixin:e,method:s,bpart:r,mpart:n})=>`color-mix(in ${s||st}, ${t}${void 0!==r?` ${r}%`:""}, ${e}${void 0!==n?` ${n}%`:""})`,dt=t=>({create:at(t),oklch:rt,lighten:ct,darken:lt,saturate:ut,desaturate:gt,fadein:ht,fadeout:ot,spin:mt,mix:pt}),bt=(t,e,s)=>Object.entries(t).reduce(e,s),ft=Symbol("noParse"),xt=(t,e,s)=>{var r,n,i;let a=""+t;return null==e?"":"object"!=typeof e||e.hasOwnProperty(ft)?`${c=a,c.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}:${""+e};`:(!s||(null===(r=s.startsWith)||void 0===r?void 0:r.call(s,"@"))||(null===(n=a.startsWith)||void 0===n?void 0:n.call(a,"&"))||(null===(i=a.startsWith)||void 0===i?void 0:i.call(a,"@"))?"":"&")+a+`{${bt(e,((t,e)=>t+xt(...e,a)),"")}}`;var c},$t="palette",yt=t=>{class e{constructor(t={}){this.state={l:"l",c:"base",h:"pri",a:1,m:"bg"},Object.assign(this,{[ft]:!0}),this.state=Object.assign(this.state,t)}get xs(){return new e(Object.assign(Object.assign({},this.state),{l:"xs"}))}get s(){return new e(Object.assign(Object.assign({},this.state),{l:"s"}))}get m(){return new e(Object.assign(Object.assign({},this.state),{l:"m"}))}get l(){return new e(Object.assign(Object.assign({},this.state),{l:"l"}))}get xl(){return new e(Object.assign(Object.assign({},this.state),{l:"xl"}))}get lightness(){return{xs:this.xs,s:this.s,m:this.m,l:this.l,xl:this.xl}}get gray(){return new e(Object.assign(Object.assign({},this.state),{c:"gray"}))}get pale(){return new e(Object.assign(Object.assign({},this.state),{c:"pale"}))}get base(){return new e(Object.assign(Object.assign({},this.state),{c:"base"}))}get rich(){return new e(Object.assign(Object.assign({},this.state),{c:"rich"}))}get chroma(){return{gray:this.gray,pale:this.pale,base:this.base,rich:this.rich}}get pri(){return new e(Object.assign(Object.assign({},this.state),{h:"pri"}))}get sec(){return new e(Object.assign(Object.assign({},this.state),{h:"sec"}))}get suc(){return new e(Object.assign(Object.assign({},this.state),{h:"suc"}))}get inf(){return new e(Object.assign(Object.assign({},this.state),{h:"inf"}))}get war(){return new e(Object.assign(Object.assign({},this.state),{h:"war"}))}get dan(){return new e(Object.assign(Object.assign({},this.state),{h:"dan"}))}get hue(){return{pri:this.pri,sec:this.sec,suc:this.suc,inf:this.inf,war:this.war,dan:this.dan}}alpha(t=1){return new e(Object.assign(Object.assign({},this.state),{a:t}))}get bg(){return new e(Object.assign(Object.assign({},this.state),{m:"bg"}))}get fg(){return new e(Object.assign(Object.assign({},this.state),{m:"fg"}))}toString(){const{l:e,c:s,h:r,a:n,m:i}=this.state;return`oklch(${t($t,"l",i,e)} ${t($t,"c",i,s)} ${t($t,"h",r)} / ${n})`}}return new e},vt="coef",jt=t=>{class e{constructor(t={}){this.state={center:8},this.state=Object.assign(this.state,t)}get min(){return t(vt,this.state.center-4)}get xxs(){return t(vt,this.state.center-3)}get xs(){return t(vt,this.state.center-2)}get s(){return t(vt,this.state.center-1)}get m(){return t(vt,this.state.center)}get l(){return t(vt,this.state.center+1)}get xl(){return t(vt,this.state.center+2)}get xxl(){return t(vt,this.state.center+3)}get max(){return t(vt,this.state.center+4)}get $0_(){return new e({center:4})}get $1_(){return new e({center:12})}get $2_(){return new e({center:20})}get $16_(){return new e({center:28})}get $1(){return new e({center:8})}get $2(){return new e({center:16})}get $16(){return new e({center:24})}get short(){return{s:this.s,m:this.m,l:this.l}}get base(){return Object.assign(Object.assign({xs:this.xs},this.short),{xl:this.xl})}get long(){return Object.assign(Object.assign({xxs:this.xxs},this.base),{xxl:this.xxl})}get full(){return Object.assign(Object.assign({min:this.min},this.long),{max:this.max})}get main(){return{min:this.min,m:this.m,max:this.max}}get sparse(){return{min:this.min,xs:this.xs,m:this.m,xl:this.xl,max:this.max}}}return new e},Ot=Object.assign,_t=Object.entries,wt={dash:(...t)=>t.join("-"),comma:(...t)=>t.join(),space:(...t)=>t.join(" "),range:(t,e)=>Array.from(Array(t).entries()).reduce(((t,[s])=>Ot(t,e(s+1))),{}),each:(t,e)=>_t(t).reduce(((t,[s,r])=>Ot(t,e(s,r))),{}),when:(t,e,s={})=>t?e:s},kt="width: ",St=t=>{const{scope:e,globalKey:s="",bp:r={}}=t,n=e(s).varExp,i=t=>n(...t.split(".")),a=(t=1)=>`calc(${t} * ${i("rtime")})`,c=(t=1)=>`calc(${t} * ${i("rangle")})`,l=(t=1)=>`calc(${t} * 1rem)`;return{compile:({key:t,maker:s})=>{const h=e(t),o=(t=>{const e={cp:1,lay:1,kf:1,cq:1},s=(s,r)=>{const n="string"==typeof r?r:t.name("cq",e.cq++),i=j+` ${n?n+" ":""}(${s})`;return{c:n,q:s,s:i,toString:()=>i}};s.toString=()=>j;const r=(s,r)=>{const n="--"+(s||t.name("cp",e.cp++)),i=O+" "+n;return{k:n,v:`var(${n})`,s:i,r:{[i]:{syntax:(null==r?void 0:r.syn)||'"*"',inherits:(null==r?void 0:r.inh)||!1,initialValue:null==r?void 0:r.ini}},toString:()=>i}};r.toString=()=>O;const n=s=>{const r=s||t.name("kf",e.kf++),n=_+" "+r;return{k:r,s:n,toString:()=>n}};n.toString=()=>_;const i=s=>{const r=s||t.name("lay",e.lay++),n=w+" "+r;return{k:r,s:n,toString:()=>n}};i.toString=()=>w,i.toString=()=>k;const a=(t="",e=!1)=>{const s=S+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return a.toString=()=>S,{pr:r,kf:n,mq:q,cq:s,lay:i,sc:(t="",e="")=>{const s=k+` ${t?`(${t})`:""}${t&&e?" ":""}${e?`to (${e})`:""}`;return{r:t,l:e,s:s,toString:()=>s}},sup:a}})(h),u=t=>{const e=r[t]||t;return"number"==typeof e?e+"rem":""},g=t=>"min-"+kt+u(t),p=t=>"max-"+kt+u(t),d=(t,e)=>"string"==typeof e?o.cq(t,e):o.mq(t),b=(t,e,s)=>""+d(g(t)+") and ("+p(e),s),f={up:(t,e)=>""+d(g(t),e),down:(t,e)=>""+d(p(t),e),between:b,only:(t,e)=>b(t,t,e)};return x=s(Object.assign(wt,{key:t,vars:i,size:l,time:a,angle:c,bem:h.selector,pseudo:Object.assign(T(V(tt).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),T(V(et).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:dt(n),palette:yt(n),coef:jt(n),units:{px:A,vh:E,vw:P,vmin:z,vmax:C,rem:N,deg:I,ms:W,pc:F,cqw:K,cqh:M,cqb:L,cqi:B,cqmin:R,cqmax:H},at:o,limit:f,merge:m})),bt(x,((t,e)=>t+xt(...e)),"");var x}}};const qt="theme",At="size",Et="time",Pt="angle",zt="palette",Ct=Object.assign,Nt=Object.entries,It=Object.fromEntries,Wt=(t,e)=>t.getAttribute(e)||b[e],Ft=(t,e)=>{const s=Wt(t,e);return null!==s?Number(s):null},Kt=(t,e,s)=>null===s?t.removeAttribute(e):t.setAttribute(e,s+""),Mt=t=>`:root:has(script[is=${d}]${t?`[${t}]`:""})`,Bt=t=>[t.xxs,t.xs,t.s,t.m,t.l,t.xl,t.xxl],Lt=["xs","s","m","l","xl"],Rt=["pale","base","rich"];function Ht(t={}){const s=window.document,a=window.customElements;if(null==a?void 0:a.get(d))return!1;{class p extends HTMLScriptElement{constructor(){super(...arguments),this._c=y(),this._m=function(){let t={},e={},s=[],r=[];const n=(t,e)=>(e.toString=()=>"effcss-"+t,e),i=t=>{var e;return t.adoptedStyleSheets=[...(null===(e=t.adoptedStyleSheets)||void 0===e?void 0:e.length)?[...t.adoptedStyleSheets].filter((t=>!(t+"").startsWith("effcss-"))):[],...s]},a=()=>{r=r.reduce(((t,e)=>{const s=e.deref();return s&&(i(s),t.push(e)),t}),[])},c=t=>s.findIndex((e=>e===t)),l=e=>e?t[e]:void 0,h=(e,r)=>{if(!t[e])return t[e]=n(e,r),s.push(t[e]),a(),!0},o=t=>{const e=l(t);return!!e&&-1!==c(e)};return{apply:i,notify:a,getIndex:c,get:l,has:t=>!!t&&!!l(t),getAll:()=>t,add:h,status:o,on:(...t)=>{const e=t.reduce(((t,e)=>{const r=l(e);return!(!r||o(e))&&(s.push(r),t)}),!0);return a(),e},off:(...t)=>{const e=t.reduce(((t,e)=>{const r=l(e);if(r&&o(e)){const e=c(r);return s.splice(e,1),t}return!1}),!0);return a(),e},remove:r=>{const n=l(r);if(!n)return;const i=c(n);return i>-1&&(s.splice(i,1),delete t[r],delete e[r]),a(),!0},removeAll:()=>(s.splice(0),t={},e={},a(),!0),pack:(e,s)=>{let r=t[e]||new CSSStyleSheet;return r.replaceSync(s),r=n(e,r),!!r.cssRules.length&&h(e,r)},replace:(e,s)=>{const r=t[e];if(r)return r.replaceSync(s),a(),!0},register:t=>{r.findIndex((e=>e.deref()===t))>=0||(r.push(new WeakRef(t)),i(t))},unregister:t=>{const e=r.findIndex((e=>e.deref()===t));e>=0&&r.splice(e,1)}}}(),this._settings=x,this._cust=()=>{var t;const e=null===(t=this._settings)||void 0===t?void 0:t.vars,{varName:s}=this._s(this._k.base),r=t=>s("",t);function n(t,e){return Nt(t).reduce(((t,[r,i])=>i&&"object"==typeof i?Ct(t,n(i,[...e,r])):(t[s(...e,r)]=i,t)),{})}const i=It(Nt(e||{}).map((([t,e])=>[t,n(e,[])]))),{"":a={},dark:c,light:l}=i,h=function(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(s[r[n]]=t[r[n]])}return s}(i,["","dark","light"]),o=this.size,u=this.time,g=this.angle,{l:m,c:p,h:d}=this._settings.palette,b=this._settings.coef,f=[0,...Bt(b.$0_),1,...Bt(b.$1_),2,...Bt(b.$2_),16,...Bt(b.$16_),b.max];this._=({bem:t,each:e,when:n,vars:c,merge:l,at:{mq:b},units:{px:x,ms:$,deg:y}})=>{const v="prefers-color-scheme",j={light:`${v}: light`,dark:`${v}: dark`};return l({[Mt()]:l({fontSize:c("rem")},a,e(f,((t,e)=>({[s("coef",t)]:e}))),e(d,((t,e)=>({[s(zt,"h",t)]:e}))),{[s(zt,"c","bg","gray")]:0,[s(zt,"c","fg","gray")]:0},e(j,((t,r)=>({[b(r).s]:l(i[t]||{},e(Lt,((e,r)=>({[s(zt,"l","bg",r)]:m[t].bg[r],[s(zt,"l","fg",r)]:m[t].fg[r]}))),e(Rt,((e,r)=>({[s(zt,"c","bg",r)]:p[t].bg[r],[s(zt,"c","fg",r)]:p[t].fg[r]}))))}))))},e(h,((e,s)=>({[Mt(`${qt}=${e}`)]:s,[t(`..theme.${e}`)]:s}))),n(!!o,{[Mt(At)]:{[r("rem")]:x(o)}}),n(!!u,{[Mt(Et)]:{[r("rtime")]:$(u)}}),n(!!g,{[Mt(Pt)]:{[r("rangle")]:y(g)}}))},this.use(this._,this._k.base,!0)},this.use=(t,e,s)=>{const r=e||this._k.current;let n=this._c.use(t,r);return(s||this._m&&!this._m.has(e))&&this._m.pack(n,this.css(t,n)),e||this._k.next(),this.resolve(n)},this.usePublic=t=>It(Nt(t).map((([t,e])=>[t,this.use(e,t)]))),this.usePrivate=t=>t.map((t=>this.use(t))),this.resolve=t=>this._s(t||this._k.base).attr,this.css=(t,e)=>this._p.compile({key:e,maker:t}),this.status=t=>{const e=this.key(t);return!!e&&this._m.status(e)},this.on=(...t)=>this._m.on(...t.map(this.key)),this.off=(...t)=>this._m.off(...t.map(this.key)),this.key=t=>"string"==typeof t?t:this._c.getKey(t),this.stylesheets=(t=this._c.keys)=>t.map((t=>this._m.get(this.key(t))))}static get observedAttributes(){return[At,Et,Pt]}get prefix(){return Wt(this,"prefix")||""}get mode(){return Wt(this,"mode")}get hydrate(){return""===this.getAttribute("hydrate")}get settings(){return this._settings}set settings(t){var e,s,r;const n=m({},this._settings,t),{makers:i,bp:a,off:c}=n;(a&&(null===(e=this._settings)||void 0===e?void 0:e.bp)!==a||!this._p)&&(this._p=St({scope:this._s,globalKey:this._k.base,bp:a})),i&&(null===(s=this._settings)||void 0===s?void 0:s.makers)!==i&&(this._c.useMany(i),this.usePublic(i),(null==c?void 0:c.length)&&this._settings.off!==c&&this.off(...c),this.hydrate&&this._k.reset()),this._settings=n,(!(null===(r=this._m)||void 0===r?void 0:r.has(this._k.base))||t.vars||t.palette||t.coef)&&this._cust()}set theme(t){Kt(this,qt,t)}get theme(){return Wt(this,qt)||""}set size(t){Kt(this,At,t)}get size(){return Ft(this,At)}set time(t){Kt(this,"time",t)}get time(){return Ft(this,Et)}set angle(t){Kt(this,"angle",t)}get angle(){return Ft(this,Pt)}attributeChangedCallback(){this._k&&this._cust()}connectedCallback(){this._k=$({prefix:this.prefix}),this._s=((t={})=>{const{mode:s}=t;let a,m;return t=>{const p=(...e)=>""+e.filter(Boolean).reduce(((t,e)=>`${t}-${e}`),t),d=(...t)=>"--"+p(...t);return"c"===s?(a=t=>{let e,s,r,n;return i(t)?([e,s,r,n]=l(t),u(p(e),s,r,n)):t&&h(t).map((([t,e,s,r])=>u(p(t),e,s,r))).join(",")},m=t=>{let e,s,n,a;const c="class";let u="";return Array.isArray(t)?u=[...t.reduce(((t,r)=>([e,s,n,a]=l(r),t.add(o(p(e),s)),n&&t.add(o(p(e),s,n,a)),t)),new Set).values()].join(" "):i(t)?([e,s,n,a]=l(t),u=o(p(e),s,n,a)):u=t&&h(t,!0).map((([t,e,s,r])=>o(p(t),e,s,r))).join(" "),r({[c]:u},{toString:{value:()=>`${c}="${u}"`}})}):(a=t=>{let e,s,r,n;return i(t)?([e,s,r,n]=l(t),g(p(e),s,r,n)):t&&h(t).map((([t,e,s,r])=>g(p(t),e,s,r))).join(",")},m=t=>{let s,a,o,u,g,m,d="";if(Array.isArray(t))m=t.reduce(((t,e)=>{[s,a,o,u]=l(e);const r=c(p(s),a);return g=n(r),d=o?u?`${o}_${u}`:`${o}`:"",t[g]&&d?t[g]=t[g]+" "+d:t[g]=d,t}),{});else if(i(t)){[s,a,o,u]=l(t);const e=c(p(s),a);g=n(e),d=o?u?`${o}_${u}`:`${o}`:"",m={[g]:d}}else m=t&&h(t,!0).reduce(((t,[e,s,r,i])=>{const a=c(p(e),s);g=n(a);const l=r?i?`${r}_${i}`:`${r}`:"";return d=t[g]?t[g]+" "+l:l,t[g]=d,t}),{});return r(m,{toString:{value:()=>e(m).map((([t,e])=>`${t}="${e}"`)).join(" ")}}),m}),{selector:a,attr:m,name:p,varName:d,varExp:(...t)=>`var(${d(...t)})`}}})({mode:this.mode});const a=this;this._n={set adoptedStyleSheets(t){a.dispatchEvent(new CustomEvent("effcsschanges",{detail:{styles:t},bubbles:!0}))}},this._m.register(this._n),this._m.register(s),this.settings=t}toString(){return`<script ${[...this.attributes].map((t=>t.value?`${t.name}="${t.value}"`:""===t.value?t.name:"")).filter(Boolean).join(" ")}>${this.textContent}<\/script>`}}return a.define(d,p,{extends:"script"}),!0}}export{Ht as defineProvider};
|
|
7
|
+
"function"==typeof SuppressedError&&SuppressedError;const t=void 0,e=Object.entries,s=Array.isArray,r=Object.defineProperties,n=t=>`data-${t}`,i=t=>"string"==typeof t,a=t=>null!==t&&"object"==typeof t,c=(t,e)=>`${t}${e?"__"+e:""}`,l=t=>t.split("."),h=(s,r)=>e(s).reduce(((s,[n,i])=>{if(a(i)){const c=e(i);c.length?s.push(...c.reduce(((s,[i,c])=>{if((e=>null!==e&&e!==t)(i)&&r&&s.push([n,i,t,t]),a(c)){const t=e(c);t.length&&s.push(...t.reduce(((t,[e,s])=>{const r=typeof s;return"string"!==r&&"number"!==r||t.push([n,i,e,s]),t}),[]))}return s}),[])):s.push([n,t,t,t])}return s}),[]),o=(t,e,s,r)=>""+(c(t,e)+(s?"_"+s:"")+(s&&r?"_"+r:"")),u=(t,e,s,r)=>"."+o(t,e,s,r),g=(t,e,s,r)=>`[${n(c(t,e))}${s&&r?`~="${s}_${r}"`:s?`~="${s}"`:""}]`,m=(t,...r)=>r.length?r.reduce(((t,r)=>(e(r).forEach((([e,r])=>{r&&"object"==typeof r&&t[e]?s(t[e])&&s(r)?t[e]=[...t[e],...r]:m(t[e],r||{}):t[e]=r})),t)),t):t,p={def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},d="effcss-provider",b={theme:null,hydrate:null,mode:"a",prefix:"f",size:null,time:null,angle:null},f={l:{dark:{bg:{xl:.24,l:.3,m:.36,s:.42,xs:.48},fg:{xl:.98,l:.93,m:.86,s:.79,xs:.72}},light:{bg:{xl:.98,l:.93,m:.88,s:.83,xs:.78},fg:{xl:0,l:.12,m:.24,s:.36,xs:.48}}},c:{dark:{bg:{pale:.02,base:.06,rich:.1},fg:{pale:.06,base:.1,rich:.14}},light:{bg:{pale:.01,base:.04,rich:.7},fg:{pale:.07,base:.11,rich:.15}}},h:{pri:184,sec:290,suc:Number(146.2.toFixed(2)),inf:Number(256..toFixed(2)),war:Number((.1*184+.9*109).toFixed(2)),dan:Number(44.5.toFixed(2))}},x={bp:{"3xs":18,"2xs":24,xs:30,sm:40,md:48,lg:64,xl:80,"2xl":96},vars:{"":{rtime:"200ms",rem:"16px",rangle:"30deg",l:p,h:{def:261.35,b:261.35,i:194.77,e:29.23,w:70.66,s:142.49},c:{def:.03,xs:.03,s:.06,m:.1,l:.15,xl:.25},a:{def:1,min:0,xs:.1,s:.25,m:.5,l:.75,xl:.9,max:1},t:{def:300,xs:100,s:200,m:300,l:450,xl:600,no:0,min:50,max:750},int:[...Array(12).keys()],fr:{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"},ar:{1:1,"2/1":2,"1/2":.5,"4/3":1.3333,"3/4":.75,"9/16":.5625,"16/9":1.7778}},light:{l:p},dark:{l:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}},palette:f,coef:{$0_:{xxs:.0625,xs:.125,s:.25,m:.5,l:.75,xl:.875,xxl:.9375},$1_:{xxs:1.0625,xs:1.125,s:1.25,m:1.5,l:1.75,xl:1.875,xxl:1.9375},$2_:{xxs:2.5,xs:4,s:5,m:7.5,l:10,xl:12,xxl:15},$16_:{xxs:20,xs:28,s:36,m:48,l:64,xl:80,xxl:120},max:150}};function $(t){const e=({b:s,e:r,m:n})=>({b:t=>e({b:t,e:"",m:{}}),e:t=>e({b:s,e:t,m:{}}),m:(t={})=>e({b:s,e:r,m:t}),get $(){return t({[s]:{[r]:n}})}});return e({b:"",e:"",m:{}})}const v=({prefix:t})=>{let e=1;return{get base(){return t+0},get current(){return t+e},next(){return e++,this.current},reset(){e=1}}},y=()=>{const t=new Set,s=new Map;return{use(e,r){const n=s.get(e);return n||(t.add(r),s.set(e,r),r)},useMany(t){return e(t).map((([t,e])=>this.use(e,t)))},getKey:t=>s.get(t),get keys(){return[...t]},get makers(){return Object.fromEntries(s.entries().map((([t,e])=>[e,t])))}}},j=(t,e,s)=>Object.entries(t).reduce(e,s),O=Symbol("noParse"),_=(t,e,s)=>{var r,n,i;let a=""+t;return null==e?"":"object"!=typeof e||e.hasOwnProperty(O)?`${c=a,c.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}:${""+e};`:(!s||(null===(r=s.startsWith)||void 0===r?void 0:r.call(s,"@"))||(null===(n=a.startsWith)||void 0===n?void 0:n.call(a,"&"))||(null===(i=a.startsWith)||void 0===i?void 0:i.call(a,"@"))?"":"&")+a+`{${j(e,((t,e)=>t+_(...e,a)),"")}}`;var c},w="@media",k="@container",S="@property",q="@keyframes",A="@layer",E="@scope",P="@supports",N=(t,e)=>{const s=w+` ${e||""}${e?" and ":""}(${t})`;return{s:s,q:t,t:e,toString:()=>s}};N.toString=()=>w;const z=t=>t+"px",C=t=>t+"vh",I=t=>t+"vw",W=t=>t+"vmin",F=t=>t+"vmax",K=t=>t+"rem",M=t=>t+"deg",B=t=>t+"ms",L=t=>t+"%",R=t=>t+"cqw",V=t=>t+"cqh",H=t=>t+"cqi",T=t=>t+"cqb",Z=t=>t+"cqmin",D=t=>t+"cqmax",G=Object.fromEntries,J=Object.entries,Q=":first-",U=":last-",X=":only-",Y="child",tt=":nth-",et="of-type",st=tt+Y,rt=":focus",nt={r:":root",h:":hover",f:rt,fv:rt+"-visible",a:":active",v:":visited",val:":valid",inv:":invalid",e:":empty",d:":disabled",rq:":required",o:":optional",m:":modal",l:":link",ph:":placeholder",ch:":checked",po:":popover-open",fc:Q+Y,lc:U+Y,oc:X+Y,odd:st+"(odd)",even:st+"(even)",ft:Q+et,lt:U+et,ot:X+et,bef:"::before",aft:"::after",bd:"::backdrop"},it={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:st,ntho:tt+et,dir:":dir",lang:":lang"},at="oklch",ct=t=>at+`(${t})`,lt=t=>ct(`from ${t}`),ht="def",ot=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",ht),c:e("c",ht),h:e("h",ht),a:e("a",ht)},this.merge=t=>new s(Object.assign(this.state,t)),this.l=t=>this.merge({l:e("l",t)}),this.c=t=>this.merge({c:e("c",t)}),this.h=t=>this.merge({h:e("h",t)}),this.a=t=>this.merge({a:e("a",t)}),this.state=Object.assign(this.state,t)}get s(){return this.toString()}toString(){const{l:t,c:e,h:s,a:r}=this.state;return ct(`${t} ${e} ${s} / ${r}`)}}return t=>new s(t)},ut=(t,e=.1)=>lt(`${t} calc(l + ${e}) c h / alpha)`),gt=(t,e=.1)=>lt(`${t} calc(l - ${e}) c h / alpha)`),mt=(t,e=.1)=>lt(`${t} l c h / calc(alpha + ${e}))`),pt=(t,e=.1)=>lt(`${t} l c h / calc(alpha - ${e}))`),dt=(t,e=.04)=>lt(`${t} l calc(c + ${e}) h / alpha)`),bt=(t,e=.04)=>lt(`${t} l calc(c - ${e}) h / alpha)`),ft=(t,e=30)=>lt(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),xt=({base:t,mixin:e,method:s,bpart:r,mpart:n})=>`color-mix(in ${s||at}, ${t}${void 0!==r?` ${r}%`:""}, ${e}${void 0!==n?` ${n}%`:""})`,$t=t=>({create:ot(t),oklch:ct,lighten:ut,darken:gt,saturate:dt,desaturate:bt,fadein:mt,fadeout:pt,spin:ft,mix:xt}),vt="palette",yt=t=>{class e{constructor(t={}){this.state={l:"l",c:"base",h:"pri",a:1,m:"bg"},Object.assign(this,{[O]:!0}),this.state=Object.assign(this.state,t)}get xs(){return new e(Object.assign(Object.assign({},this.state),{l:"xs"}))}get s(){return new e(Object.assign(Object.assign({},this.state),{l:"s"}))}get m(){return new e(Object.assign(Object.assign({},this.state),{l:"m"}))}get l(){return new e(Object.assign(Object.assign({},this.state),{l:"l"}))}get xl(){return new e(Object.assign(Object.assign({},this.state),{l:"xl"}))}get lightness(){return{xs:this.xs,s:this.s,m:this.m,l:this.l,xl:this.xl}}get gray(){return new e(Object.assign(Object.assign({},this.state),{c:"gray"}))}get pale(){return new e(Object.assign(Object.assign({},this.state),{c:"pale"}))}get base(){return new e(Object.assign(Object.assign({},this.state),{c:"base"}))}get rich(){return new e(Object.assign(Object.assign({},this.state),{c:"rich"}))}get chroma(){return{gray:this.gray,pale:this.pale,base:this.base,rich:this.rich}}get pri(){return new e(Object.assign(Object.assign({},this.state),{h:"pri"}))}get sec(){return new e(Object.assign(Object.assign({},this.state),{h:"sec"}))}get suc(){return new e(Object.assign(Object.assign({},this.state),{h:"suc"}))}get inf(){return new e(Object.assign(Object.assign({},this.state),{h:"inf"}))}get war(){return new e(Object.assign(Object.assign({},this.state),{h:"war"}))}get dan(){return new e(Object.assign(Object.assign({},this.state),{h:"dan"}))}get hue(){return{pri:this.pri,sec:this.sec,suc:this.suc,inf:this.inf,war:this.war,dan:this.dan}}alpha(t=1){return new e(Object.assign(Object.assign({},this.state),{a:t}))}get bg(){return new e(Object.assign(Object.assign({},this.state),{m:"bg"}))}get fg(){return new e(Object.assign(Object.assign({},this.state),{m:"fg"}))}toString(){const{l:e,c:s,h:r,a:n,m:i}=this.state;return`oklch(${t(vt,"l",i,e)} ${t(vt,"c",i,s)} ${t(vt,"h",r)} / ${n})`}}return new e},jt="coef",Ot=t=>{class e{constructor(t={}){this.state={center:8},this.state=Object.assign(this.state,t)}get min(){return t(jt,this.state.center-4)}get xxs(){return t(jt,this.state.center-3)}get xs(){return t(jt,this.state.center-2)}get s(){return t(jt,this.state.center-1)}get m(){return t(jt,this.state.center)}get l(){return t(jt,this.state.center+1)}get xl(){return t(jt,this.state.center+2)}get xxl(){return t(jt,this.state.center+3)}get max(){return t(jt,this.state.center+4)}get $0_(){return new e({center:4})}get $1_(){return new e({center:12})}get $2_(){return new e({center:20})}get $16_(){return new e({center:28})}get $1(){return new e({center:8})}get $2(){return new e({center:16})}get $16(){return new e({center:24})}get short(){return{s:this.s,m:this.m,l:this.l}}get base(){return Object.assign(Object.assign({xs:this.xs},this.short),{xl:this.xl})}get long(){return Object.assign(Object.assign({xxs:this.xxs},this.base),{xxl:this.xxl})}get full(){return Object.assign(Object.assign({min:this.min},this.long),{max:this.max})}get main(){return{min:this.min,m:this.m,max:this.max}}get sparse(){return{min:this.min,xs:this.xs,m:this.m,xl:this.xl,max:this.max}}}return new e},_t=Object.assign,wt=Object.entries,kt={dash:(...t)=>t.join("-"),comma:(...t)=>t.join(),space:(...t)=>t.join(" "),range:(t,e)=>Array.from(Array(t).entries()).reduce(((t,[s])=>_t(t,e(s+1))),{}),each:(t,e)=>wt(t).reduce(((t,[s,r])=>_t(t,e(s,r))),{}),when:(t,e,s={})=>t?e:s},St="width: ",qt=t=>{const{scope:e,globalKey:s="",bp:r={}}=t,n=e(s).varExp,i=t=>n(...t.split(".")),a=(t=1)=>`calc(${t} * ${i("rtime")})`,c=(t=1)=>`calc(${t} * ${i("rangle")})`,l=(t=1)=>`calc(${t} * 1rem)`;return{compile:({key:t,maker:s})=>{const h=e(t),o=(t=>{const e={cp:1,lay:1,kf:1,cq:1},s=(s,r)=>{const n="string"==typeof r?r:t.name("cq",e.cq++),i=k+` ${n?n+" ":""}(${s})`;return{c:n,q:s,s:i,toString:()=>i}};s.toString=()=>k;const r=(s,r)=>{const n="--"+(s||t.name("cp",e.cp++)),i=S+" "+n;return{k:n,v:`var(${n})`,s:i,r:{[i]:{syntax:(null==r?void 0:r.syn)||'"*"',inherits:(null==r?void 0:r.inh)||!1,initialValue:null==r?void 0:r.ini}},toString:()=>i}};r.toString=()=>S;const n=s=>{const r=s||t.name("kf",e.kf++),n=q+" "+r;return{k:r,s:n,toString:()=>n}};n.toString=()=>q;const i=s=>{const r=s||t.name("lay",e.lay++),n=A+" "+r;return{k:r,s:n,toString:()=>n}};i.toString=()=>A,i.toString=()=>E;const a=(t="",e=!1)=>{const s=P+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return a.toString=()=>P,{pr:r,kf:n,mq:N,cq:s,lay:i,sc:(t="",e="")=>{const s=E+` ${t?`(${t})`:""}${t&&e?" ":""}${e?`to (${e})`:""}`;return{r:t,l:e,s:s,toString:()=>s}},sup:a,keyframes:s=>{const r=t.name("kf",e.kf++),n=q+" "+r;return Object.defineProperties((t=>{if(!t)return{animationName:r};const{dur:e,tf:s,del:n,ic:i,dir:a,ps:c,fm:l}=t;return{animation:[e,s,n,i,a,c,l,r].filter(Boolean).join(" ")}}),{[n]:{value:s,enumerable:!0},toString:{value:()=>r},[O]:{value:!0}})},property:(s={})=>{const{syn:r='"*"',inh:n=!0,ini:i,def:a}=s,c="--"+t.name("cp",e.cp++),l=`var(${c}${void 0!==a?","+a:""})`,h=S+" "+c;return Object.defineProperties((t=>({[c]:t})),{[h]:{value:{syntax:r,inherits:n,initialValue:i},enumerable:!0},toString:{value:()=>l},[O]:{value:!0}})}}})(h),u=t=>{const e=r[t]||t;return"number"==typeof e?e+"rem":""},g=t=>"min-"+St+u(t),p=t=>"max-"+St+u(t),d=(t,e)=>"string"==typeof e?o.cq(t,e):o.mq(t),b=(t,e,s)=>""+d(g(t)+") and ("+p(e),s),f={up:(t,e)=>""+d(g(t),e),down:(t,e)=>""+d(p(t),e),between:b,only:(t,e)=>b(t,t,e)};return x=s(Object.assign(kt,{key:t,vars:i,size:l,time:a,angle:c,bem:h.selector,pseudo:Object.assign(G(J(nt).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),G(J(it).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:$t(n),palette:yt(n),coef:Ot(n),units:{px:z,vh:C,vw:I,vmin:W,vmax:F,rem:K,deg:M,ms:B,pc:L,cqw:R,cqh:V,cqb:T,cqi:H,cqmin:Z,cqmax:D},at:o,limit:f,merge:m})),j(x,((t,e)=>t+_(...e)),"");var x}}};const At="theme",Et="size",Pt="time",Nt="angle",zt="palette",Ct=Object.assign,It=Object.entries,Wt=Object.fromEntries,Ft=(t,e)=>t.getAttribute(e)||b[e],Kt=(t,e)=>{const s=Ft(t,e);return null!==s?Number(s):null},Mt=(t,e,s)=>null===s?t.removeAttribute(e):t.setAttribute(e,s+""),Bt=t=>`:root:has(script[is=${d}]${t?`[${t}]`:""})`,Lt=t=>[t.xxs,t.xs,t.s,t.m,t.l,t.xl,t.xxl],Rt=["xs","s","m","l","xl"],Vt=["pale","base","rich"];function Ht(t={}){const s=window.document,a=window.customElements;if(null==a?void 0:a.get(d))return!1;{class p extends HTMLScriptElement{constructor(){super(...arguments),this._c=y(),this._m=function(){let t={},e={},s=[],r=[];const n=(t,e)=>(e.toString=()=>"effcss-"+t,e),i=t=>{var e;return t.adoptedStyleSheets=[...(null===(e=t.adoptedStyleSheets)||void 0===e?void 0:e.length)?[...t.adoptedStyleSheets].filter((t=>!(t+"").startsWith("effcss-"))):[],...s]},a=()=>{r=r.reduce(((t,e)=>{const s=e.deref();return s&&(i(s),t.push(e)),t}),[])},c=t=>s.findIndex((e=>e===t)),l=e=>e?t[e]:void 0,h=(e,r)=>{if(!t[e])return t[e]=n(e,r),s.push(t[e]),a(),!0},o=t=>{const e=l(t);return!!e&&-1!==c(e)};return{apply:i,notify:a,getIndex:c,get:l,has:t=>!!t&&!!l(t),getAll:()=>t,add:h,status:o,on:(...t)=>{const e=t.reduce(((t,e)=>{const r=l(e);return!(!r||o(e))&&(s.push(r),t)}),!0);return a(),e},off:(...t)=>{const e=t.reduce(((t,e)=>{const r=l(e);if(r&&o(e)){const e=c(r);return s.splice(e,1),t}return!1}),!0);return a(),e},remove:r=>{const n=l(r);if(!n)return;const i=c(n);return i>-1&&(s.splice(i,1),delete t[r],delete e[r]),a(),!0},removeAll:()=>(s.splice(0),t={},e={},a(),!0),pack:(e,s)=>{let r=t[e]||new CSSStyleSheet;return r.replaceSync(s),r=n(e,r),!!r.cssRules.length&&h(e,r)},replace:(e,s)=>{const r=t[e];if(r)return r.replaceSync(s),a(),!0},register:t=>{r.findIndex((e=>e.deref()===t))>=0||(r.push(new WeakRef(t)),i(t))},unregister:t=>{const e=r.findIndex((e=>e.deref()===t));e>=0&&r.splice(e,1)}}}(),this._settings=x,this._cust=()=>{var t;const e=null===(t=this._settings)||void 0===t?void 0:t.vars,{varName:s}=this._s(this._k.base),r=t=>s("",t);function n(t,e){return It(t).reduce(((t,[r,i])=>i&&"object"==typeof i?Ct(t,n(i,[...e,r])):(t[s(...e,r)]=i,t)),{})}const i=Wt(It(e||{}).map((([t,e])=>[t,n(e,[])]))),{"":a={},dark:c,light:l}=i,h=function(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(s[r[n]]=t[r[n]])}return s}(i,["","dark","light"]),o=this.size,u=this.time,g=this.angle,{l:m,c:p,h:d}=this._settings.palette,b=this._settings.coef,f=[0,...Lt(b.$0_),1,...Lt(b.$1_),2,...Lt(b.$2_),16,...Lt(b.$16_),b.max];this._=({bem:t,each:e,when:n,vars:c,merge:l,at:{mq:b},units:{px:x,ms:$,deg:v}})=>{const y="prefers-color-scheme",j={light:`${y}: light`,dark:`${y}: dark`};return l({[Bt()]:l({fontSize:c("rem")},a,e(f,((t,e)=>({[s("coef",t)]:e}))),e(d,((t,e)=>({[s(zt,"h",t)]:e}))),{[s(zt,"c","bg","gray")]:0,[s(zt,"c","fg","gray")]:0},e(j,((t,r)=>({[b(r).s]:l(i[t]||{},e(Rt,((e,r)=>({[s(zt,"l","bg",r)]:m[t].bg[r],[s(zt,"l","fg",r)]:m[t].fg[r]}))),e(Vt,((e,r)=>({[s(zt,"c","bg",r)]:p[t].bg[r],[s(zt,"c","fg",r)]:p[t].fg[r]}))))}))))},e(h,((e,s)=>({[Bt(`${At}=${e}`)]:s,[t(`..theme.${e}`)]:s}))),n(!!o,{[Bt(Et)]:{[r("rem")]:x(o)}}),n(!!u,{[Bt(Pt)]:{[r("rtime")]:$(u)}}),n(!!g,{[Bt(Nt)]:{[r("rangle")]:v(g)}}))},this.use(this._,this._k.base,!0)},this.use=(t,e,s)=>{const r=e||this._k.current;let n=this._c.use(t,r);return(s||this._m&&!this._m.has(e))&&this._m.pack(n,this.css(t,n)),e||this._k.next(),this.resolve(n)},this.usePublic=t=>Wt(It(t).map((([t,e])=>[t,this.use(e,t)]))),this.usePrivate=t=>t.map((t=>this.use(t))),this.resolve=t=>this._s(t||this._k.base).attr,this.css=(t,e)=>this._p.compile({key:e,maker:t}),this.status=t=>{const e=this.key(t);return!!e&&this._m.status(e)},this.on=(...t)=>this._m.on(...t.map(this.key)),this.off=(...t)=>this._m.off(...t.map(this.key)),this.key=t=>"string"==typeof t?t:this._c.getKey(t),this.stylesheets=(t=this._c.keys)=>t.map((t=>this._m.get(this.key(t))))}static get observedAttributes(){return[Et,Pt,Nt]}get prefix(){return Ft(this,"prefix")||""}get mode(){return Ft(this,"mode")}get hydrate(){return""===this.getAttribute("hydrate")}get settings(){return this._settings}set settings(t){var e,s,r;const n=m({},this._settings,t),{makers:i,bp:a,off:c}=n;(a&&(null===(e=this._settings)||void 0===e?void 0:e.bp)!==a||!this._p)&&(this._p=qt({scope:this._s,globalKey:this._k.base,bp:a})),i&&(null===(s=this._settings)||void 0===s?void 0:s.makers)!==i&&(this._c.useMany(i),this.usePublic(i),(null==c?void 0:c.length)&&this._settings.off!==c&&this.off(...c),this.hydrate&&this._k.reset()),this._settings=n,(!(null===(r=this._m)||void 0===r?void 0:r.has(this._k.base))||t.vars||t.palette||t.coef)&&this._cust()}get makers(){return this._c.makers}set theme(t){Mt(this,At,t)}get theme(){return Ft(this,At)||""}set size(t){Mt(this,Et,t)}get size(){return Kt(this,Et)}set time(t){Mt(this,"time",t)}get time(){return Kt(this,Pt)}set angle(t){Mt(this,"angle",t)}get angle(){return Kt(this,Nt)}attributeChangedCallback(){this._k&&this._cust()}connectedCallback(){this._k=v({prefix:this.prefix}),this._s=((t={})=>{const{mode:s}=t;let a,m;return t=>{const p=(...e)=>""+e.filter(Boolean).reduce(((t,e)=>`${t}-${e}`),t),d=(...t)=>"--"+p(...t);return"c"===s?(a=t=>{let e,s,r,n;return i(t)?([e,s,r,n]=l(t),u(p(e),s,r,n)):t&&h(t).map((([t,e,s,r])=>u(p(t),e,s,r))).join(",")},m=t=>{if(void 0===t)return $(m);let e,s,n,a;const c="class";let u="";return Array.isArray(t)?u=[...t.reduce(((t,r)=>([e,s,n,a]=l(r),t.add(o(p(e),s)),n&&t.add(o(p(e),s,n,a)),t)),new Set).values()].join(" "):i(t)?([e,s,n,a]=l(t),u=o(p(e),s,n,a)):u=t&&h(t,!0).map((([t,e,s,r])=>o(p(t),e,s,r))).join(" "),r({[c]:u},{toString:{value:()=>`${c}="${u}"`}})}):(a=t=>{let e,s,r,n;return i(t)?([e,s,r,n]=l(t),g(p(e),s,r,n)):t&&h(t).map((([t,e,s,r])=>g(p(t),e,s,r))).join(",")},m=t=>{if(void 0===t)return $(m);let s,a,o,u,g,d,b="";if(Array.isArray(t))d=t.reduce(((t,e)=>{[s,a,o,u]=l(e);const r=c(p(s),a);return g=n(r),b=o?u?`${o}_${u}`:`${o}`:"",t[g]&&b?t[g]=t[g]+" "+b:t[g]=b,t}),{});else if(i(t)){[s,a,o,u]=l(t);const e=c(p(s),a);g=n(e),b=o?u?`${o}_${u}`:`${o}`:"",d={[g]:b}}else d=t&&h(t,!0).reduce(((t,[e,s,r,i])=>{const a=c(p(e),s);g=n(a);const l=r?i?`${r}_${i}`:`${r}`:"";return b=t[g]?t[g]+" "+l:l,t[g]=b,t}),{});return r(d,{toString:{value:()=>e(d).map((([t,e])=>`${t}="${e}"`)).join(" ")}}),d}),{selector:a,attr:m,name:p,varName:d,varExp:(...t)=>`var(${d(...t)})`}}})({mode:this.mode});const a=this;this._n={set adoptedStyleSheets(t){a.dispatchEvent(new CustomEvent("effcsschanges",{detail:{styles:t},bubbles:!0}))}},this._m.register(this._n),this._m.register(s),this.settings=t}toString(){return`<script ${[...this.attributes].map((t=>t.value?`${t.name}="${t.value}"`:""===t.value?t.name:"")).filter(Boolean).join(" ")}>${this.textContent}<\/script>`}}return a.define(d,p,{extends:"script"}),!0}}export{Ht as defineProvider};
|
|
@@ -1,4 +1,39 @@
|
|
|
1
1
|
import { TCreateScope } from '../../common';
|
|
2
|
+
type TProperty = {
|
|
3
|
+
(val: string | number | boolean): object;
|
|
4
|
+
};
|
|
5
|
+
type TKeyframes = {
|
|
6
|
+
(config?: Partial<{
|
|
7
|
+
/**
|
|
8
|
+
* Duration
|
|
9
|
+
*/
|
|
10
|
+
dur: string;
|
|
11
|
+
/**
|
|
12
|
+
* Delay
|
|
13
|
+
*/
|
|
14
|
+
del: string;
|
|
15
|
+
/**
|
|
16
|
+
* Iteration-count
|
|
17
|
+
*/
|
|
18
|
+
ic: string;
|
|
19
|
+
/**
|
|
20
|
+
* Direction
|
|
21
|
+
*/
|
|
22
|
+
dir: string;
|
|
23
|
+
/**
|
|
24
|
+
* Timing-function
|
|
25
|
+
*/
|
|
26
|
+
tf: string;
|
|
27
|
+
/**
|
|
28
|
+
* Play-state
|
|
29
|
+
*/
|
|
30
|
+
ps: string;
|
|
31
|
+
/**
|
|
32
|
+
* Fill-mode
|
|
33
|
+
*/
|
|
34
|
+
fm: string;
|
|
35
|
+
}>): object;
|
|
36
|
+
};
|
|
2
37
|
export declare const resolveAtRules: (scope: ReturnType<ReturnType<TCreateScope>>) => {
|
|
3
38
|
/**
|
|
4
39
|
* `@property` selector
|
|
@@ -145,4 +180,32 @@ export declare const resolveAtRules: (scope: ReturnType<ReturnType<TCreateScope>
|
|
|
145
180
|
};
|
|
146
181
|
toString(): string;
|
|
147
182
|
};
|
|
183
|
+
/**
|
|
184
|
+
* Scoped `@keyframes` rule maker
|
|
185
|
+
* @param config - keyframes
|
|
186
|
+
*/
|
|
187
|
+
keyframes: (config: Record<string, object>) => TKeyframes;
|
|
188
|
+
/**
|
|
189
|
+
* Scoped `@property` rule maker
|
|
190
|
+
* @param config - property params
|
|
191
|
+
*/
|
|
192
|
+
property: (config?: {
|
|
193
|
+
/**
|
|
194
|
+
* Syntax
|
|
195
|
+
*/
|
|
196
|
+
syn?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Inherits
|
|
199
|
+
*/
|
|
200
|
+
inh?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Initial value
|
|
203
|
+
*/
|
|
204
|
+
ini?: string | number | boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Default value
|
|
207
|
+
*/
|
|
208
|
+
def?: string | number | boolean;
|
|
209
|
+
}) => TProperty;
|
|
148
210
|
};
|
|
211
|
+
export {};
|
|
@@ -302,7 +302,6 @@ export type TProviderSettings = {
|
|
|
302
302
|
coef: TCoefConfig;
|
|
303
303
|
};
|
|
304
304
|
export type TProviderSettingsPartial = RecursivePartial<TProviderSettings>;
|
|
305
|
-
type TStrDict = Record<string, string>;
|
|
306
305
|
type Paths<T> = T extends object ? {
|
|
307
306
|
[K in keyof T]: `${Exclude<K, symbol>}${'' | Paths<T[K]> extends '' ? '' : `.${Paths<T[K]>}`}`;
|
|
308
307
|
}[keyof T] : T extends string ? T : never;
|
|
@@ -318,8 +317,35 @@ type TMods<T> = T extends object ? {
|
|
|
318
317
|
}[keyof T] : T extends string ? T : never;
|
|
319
318
|
type TStringBEM<T> = TBlocks<T> | TMods<T> | TElems<T>;
|
|
320
319
|
type TBEM<T> = TDeepPartial<T> | TStringBEM<T> | TStringBEM<T>[];
|
|
321
|
-
type
|
|
322
|
-
type
|
|
320
|
+
type TStyleSheet = Record<string, Record<string, Record<string, string | number>>>;
|
|
321
|
+
export type TMonoResolver<T extends TStyleSheet, B extends keyof T, E extends keyof T[B]> = {
|
|
322
|
+
/**
|
|
323
|
+
* Specify block
|
|
324
|
+
* @param val - block name
|
|
325
|
+
*/
|
|
326
|
+
b<BL extends Exclude<keyof T, Symbol | number>>(val: BL): TMonoResolver<T, BL, ''>;
|
|
327
|
+
/**
|
|
328
|
+
* Specify element
|
|
329
|
+
* @param val - element name
|
|
330
|
+
*/
|
|
331
|
+
e<EL extends Exclude<keyof T[B], Symbol | number>>(val: EL): TMonoResolver<T, B, EL>;
|
|
332
|
+
/**
|
|
333
|
+
* Specify modifiers
|
|
334
|
+
* @param val - modifiers object
|
|
335
|
+
*/
|
|
336
|
+
m(val?: Partial<T[B][E]>): TMonoResolver<T, B, E>;
|
|
337
|
+
/**
|
|
338
|
+
* Result style attributes
|
|
339
|
+
*/
|
|
340
|
+
get $(): {
|
|
341
|
+
[key in string]: string;
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
type TResolveSelector = <T extends TStyleSheet>(params: TBEM<T>) => string;
|
|
345
|
+
type TResolveAttr = {
|
|
346
|
+
<T extends TStyleSheet>(params: TBEM<T>): Record<string, string>;
|
|
347
|
+
<T extends TStyleSheet>(): TMonoResolver<T, "", "">;
|
|
348
|
+
};
|
|
323
349
|
type TParts = (string | number)[];
|
|
324
350
|
type TScope = {
|
|
325
351
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createProcessor } from './_provider/process';
|
|
2
2
|
import type { TProviderSettings, TProviderSettingsPartial } from './common';
|
|
3
|
-
import { createScope } from './common';
|
|
3
|
+
import { createCollector, createScope } from './common';
|
|
4
4
|
type TResolveAttr = ReturnType<ReturnType<typeof createScope>>['attr'];
|
|
5
5
|
/**
|
|
6
6
|
* StyleSheet maker
|
|
@@ -32,6 +32,10 @@ export interface IStyleProvider {
|
|
|
32
32
|
* Get hydrate
|
|
33
33
|
*/
|
|
34
34
|
get hydrate(): boolean | null;
|
|
35
|
+
/**
|
|
36
|
+
* Get stylesheet makers
|
|
37
|
+
*/
|
|
38
|
+
get makers(): ReturnType<typeof createCollector>['makers'];
|
|
35
39
|
/**
|
|
36
40
|
* Get theme value
|
|
37
41
|
*/
|