effcss 3.5.1 → 3.5.3
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 +12 -10
- 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/coef.d.ts +2 -135
- package/dist/types/src/_provider/_process/palette.d.ts +2 -116
- package/dist/types/src/_provider/_process/utils.d.ts +1 -1
- package/dist/types/src/common.d.ts +253 -28
- package/dist/types/src/index.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,6 +138,8 @@ export interface ICardMaker {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
const myStyleSheetMaker: TStyleSheetMaker = ({ bem, pseudo, at: { kf }, merge, palette, coef, size }) = {
|
|
141
|
+
// specify selector variants via generic
|
|
142
|
+
const selector = bem<ICardMaker>;
|
|
141
143
|
// creates unique keyframes identifier
|
|
142
144
|
const spin = kf();
|
|
143
145
|
// deeply merges objects
|
|
@@ -163,14 +165,14 @@ const myStyleSheetMaker: TStyleSheetMaker = ({ bem, pseudo, at: { kf }, merge, p
|
|
|
163
165
|
transform: 'rotate(360deg)',
|
|
164
166
|
},
|
|
165
167
|
},
|
|
166
|
-
[
|
|
167
|
-
[
|
|
168
|
-
[
|
|
169
|
-
[
|
|
170
|
-
[
|
|
171
|
-
[
|
|
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.5.
|
|
2
|
+
* EffCSS v3.5.3
|
|
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=>{const e={pri:t($t,"h","pri"),sec:t($t,"h","sec"),ter:t($t,"h","ter"),suc:t($t,"h","suc"),inf:t($t,"h","inf"),war:t($t,"h","war"),dan:t($t,"h","dan")};class s{constructor(t={}){this.state={l:"l",c:"base",h:e.pri,a:1,m:"bg"},Object.assign(this,{[ft]:!0}),this.state=Object.assign(this.state,t)}get xs(){return new s(Object.assign(Object.assign({},this.state),{l:"xs"}))}get s(){return new s(Object.assign(Object.assign({},this.state),{l:"s"}))}get m(){return new s(Object.assign(Object.assign({},this.state),{l:"m"}))}get l(){return new s(Object.assign(Object.assign({},this.state),{l:"l"}))}get xl(){return new s(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 s(Object.assign(Object.assign({},this.state),{c:"gray"}))}get pale(){return new s(Object.assign(Object.assign({},this.state),{c:"pale"}))}get base(){return new s(Object.assign(Object.assign({},this.state),{c:"base"}))}get rich(){return new s(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 s(Object.assign(Object.assign({},this.state),{h:e.pri}))}get sec(){return new s(Object.assign(Object.assign({},this.state),{h:e.sec}))}get suc(){return new s(Object.assign(Object.assign({},this.state),{h:e.suc}))}get inf(){return new s(Object.assign(Object.assign({},this.state),{h:e.inf}))}get war(){return new s(Object.assign(Object.assign({},this.state),{h:e.war}))}get dan(){return new s(Object.assign(Object.assign({},this.state),{h:e.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 s(Object.assign(Object.assign({},this.state),{a:t}))}get bg(){return new s(Object.assign(Object.assign({},this.state),{m:"bg"}))}get fg(){return new s(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)} ${r} / ${n})`}}return new s},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="@media",O="@container",_="@property",w="@keyframes",k="@layer",S="@scope",q="@supports",A=(t,e)=>{const s=j+` ${e||""}${e?" and ":""}(${t})`;return{s:s,q:t,t:e,toString:()=>s}};A.toString=()=>j;const E=t=>t+"px",P=t=>t+"vh",z=t=>t+"vw",C=t=>t+"vmin",N=t=>t+"vmax",I=t=>t+"rem",W=t=>t+"deg",F=t=>t+"ms",K=t=>t+"%",M=t=>t+"cqw",B=t=>t+"cqh",L=t=>t+"cqi",R=t=>t+"cqb",H=t=>t+"cqmin",T=t=>t+"cqmax",V=Object.fromEntries,Z=Object.entries,D=":first-",G=":last-",J=":only-",Q="child",U=":nth-",X="of-type",Y=U+Q,tt=":focus",et={r:":root",h:":hover",f:tt,fv:tt+"-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:D+Q,lc:G+Q,oc:J+Q,odd:Y+"(odd)",even:Y+"(even)",ft:D+X,lt:G+X,ot:J+X,bef:"::before",aft:"::after",bd:"::backdrop"},st={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:Y,ntho:U+X,dir:":dir",lang:":lang"},rt="oklch",nt=t=>rt+`(${t})`,it=t=>nt(`from ${t}`),at="def",ct=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",at),c:e("c",at),h:e("h",at),a:e("a",at)},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 nt(`${t} ${e} ${s} / ${r}`)}}return t=>new s(t)},lt=(t,e=.1)=>it(`${t} calc(l + ${e}) c h / alpha)`),ht=(t,e=.1)=>it(`${t} calc(l - ${e}) c h / alpha)`),ot=(t,e=.1)=>it(`${t} l c h / calc(alpha + ${e}))`),ut=(t,e=.1)=>it(`${t} l c h / calc(alpha - ${e}))`),gt=(t,e=.04)=>it(`${t} l calc(c + ${e}) h / alpha)`),mt=(t,e=.04)=>it(`${t} l calc(c - ${e}) h / alpha)`),pt=(t,e=30)=>it(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),dt=({base:t,mixin:e,method:s,bpart:r,mpart:n})=>`color-mix(in ${s||rt}, ${t}${void 0!==r?` ${r}%`:""}, ${e}${void 0!==n?` ${n}%`:""})`,bt=t=>({create:ct(t),oklch:nt,lighten:lt,darken:ht,saturate:gt,desaturate:mt,fadein:ot,fadeout:ut,spin:pt,mix:dt}),ft=(t,e,s)=>Object.entries(t).reduce(e,s),xt=Symbol("noParse"),$t=(t,e,s)=>{var r,n,i;let a=""+t;return null==e?"":"object"!=typeof e||e.hasOwnProperty(xt)?`${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+`{${ft(e,((t,e)=>t+$t(...e,a)),"")}}`;var c},vt="palette",yt=t=>{class e{constructor(t={}){this.state={l:"l",c:"base",h:"pri",a:1,m:"bg"},Object.assign(this,{[xt]:!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=O+` ${n?n+" ":""}(${s})`;return{c:n,q:s,s:i,toString:()=>i}};s.toString=()=>O;const r=(s,r)=>{const n="--"+(s||t.name("cp",e.cp++)),i=_+" "+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=()=>_;const n=s=>{const r=s||t.name("kf",e.kf++),n=w+" "+r;return{k:r,s:n,toString:()=>n}};n.toString=()=>w;const i=s=>{const r=s||t.name("lay",e.lay++),n=k+" "+r;return{k:r,s:n,toString:()=>n}};i.toString=()=>k,i.toString=()=>S;const a=(t="",e=!1)=>{const s=q+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return a.toString=()=>q,{pr:r,kf:n,mq:A,cq:s,lay:i,sc:(t="",e="")=>{const s=S+` ${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-"+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(V(Z(et).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),V(Z(st).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:bt(n),palette:yt(n),coef:Ot(n),units:{px:E,vh:P,vw:z,vmin:C,vmax:N,rem:I,deg:W,ms:F,pc:K,cqw:M,cqh:B,cqb:R,cqi:L,cqmin:H,cqmax:T},at:o,limit:f,merge:m})),ft(x,((t,e)=>t+$t(...e)),"");var x}}};const At="theme",Et="size",Pt="time",zt="angle",Ct="palette",Nt=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"],Ht=["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?Nt(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(Ct,"h",t)]:e}))),{[s(Ct,"c","bg","gray")]:0,[s(Ct,"c","fg","gray")]:0},e(j,((t,r)=>({[b(r).s]:l(i[t]||{},e(Rt,((e,r)=>({[s(Ct,"l","bg",r)]:m[t].bg[r],[s(Ct,"l","fg",r)]:m[t].fg[r]}))),e(Ht,((e,r)=>({[s(Ct,"c","bg",r)]:p[t].bg[r],[s(Ct,"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(zt)]:{[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,zt]}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()}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,zt)}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.5.
|
|
2
|
+
* EffCSS v3.5.3
|
|
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 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.5.
|
|
2
|
+
* EffCSS v3.5.3
|
|
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=>{const e={pri:t($t,"h","pri"),sec:t($t,"h","sec"),ter:t($t,"h","ter"),suc:t($t,"h","suc"),inf:t($t,"h","inf"),war:t($t,"h","war"),dan:t($t,"h","dan")};class s{constructor(t={}){this.state={l:"l",c:"base",h:e.pri,a:1,m:"bg"},Object.assign(this,{[ft]:!0}),this.state=Object.assign(this.state,t)}get xs(){return new s(Object.assign(Object.assign({},this.state),{l:"xs"}))}get s(){return new s(Object.assign(Object.assign({},this.state),{l:"s"}))}get m(){return new s(Object.assign(Object.assign({},this.state),{l:"m"}))}get l(){return new s(Object.assign(Object.assign({},this.state),{l:"l"}))}get xl(){return new s(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 s(Object.assign(Object.assign({},this.state),{c:"gray"}))}get pale(){return new s(Object.assign(Object.assign({},this.state),{c:"pale"}))}get base(){return new s(Object.assign(Object.assign({},this.state),{c:"base"}))}get rich(){return new s(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 s(Object.assign(Object.assign({},this.state),{h:e.pri}))}get sec(){return new s(Object.assign(Object.assign({},this.state),{h:e.sec}))}get suc(){return new s(Object.assign(Object.assign({},this.state),{h:e.suc}))}get inf(){return new s(Object.assign(Object.assign({},this.state),{h:e.inf}))}get war(){return new s(Object.assign(Object.assign({},this.state),{h:e.war}))}get dan(){return new s(Object.assign(Object.assign({},this.state),{h:e.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 s(Object.assign(Object.assign({},this.state),{a:t}))}get bg(){return new s(Object.assign(Object.assign({},this.state),{m:"bg"}))}get fg(){return new s(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)} ${r} / ${n})`}}return new s},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="@media",O="@container",_="@property",w="@keyframes",k="@layer",S="@scope",q="@supports",A=(t,e)=>{const s=j+` ${e||""}${e?" and ":""}(${t})`;return{s:s,q:t,t:e,toString:()=>s}};A.toString=()=>j;const E=t=>t+"px",P=t=>t+"vh",z=t=>t+"vw",C=t=>t+"vmin",N=t=>t+"vmax",I=t=>t+"rem",W=t=>t+"deg",F=t=>t+"ms",K=t=>t+"%",M=t=>t+"cqw",B=t=>t+"cqh",L=t=>t+"cqi",R=t=>t+"cqb",H=t=>t+"cqmin",T=t=>t+"cqmax",V=Object.fromEntries,Z=Object.entries,D=":first-",G=":last-",J=":only-",Q="child",U=":nth-",X="of-type",Y=U+Q,tt=":focus",et={r:":root",h:":hover",f:tt,fv:tt+"-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:D+Q,lc:G+Q,oc:J+Q,odd:Y+"(odd)",even:Y+"(even)",ft:D+X,lt:G+X,ot:J+X,bef:"::before",aft:"::after",bd:"::backdrop"},st={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:Y,ntho:U+X,dir:":dir",lang:":lang"},rt="oklch",nt=t=>rt+`(${t})`,it=t=>nt(`from ${t}`),at="def",ct=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",at),c:e("c",at),h:e("h",at),a:e("a",at)},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 nt(`${t} ${e} ${s} / ${r}`)}}return t=>new s(t)},lt=(t,e=.1)=>it(`${t} calc(l + ${e}) c h / alpha)`),ht=(t,e=.1)=>it(`${t} calc(l - ${e}) c h / alpha)`),ot=(t,e=.1)=>it(`${t} l c h / calc(alpha + ${e}))`),ut=(t,e=.1)=>it(`${t} l c h / calc(alpha - ${e}))`),gt=(t,e=.04)=>it(`${t} l calc(c + ${e}) h / alpha)`),mt=(t,e=.04)=>it(`${t} l calc(c - ${e}) h / alpha)`),pt=(t,e=30)=>it(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),dt=({base:t,mixin:e,method:s,bpart:r,mpart:n})=>`color-mix(in ${s||rt}, ${t}${void 0!==r?` ${r}%`:""}, ${e}${void 0!==n?` ${n}%`:""})`,bt=t=>({create:ct(t),oklch:nt,lighten:lt,darken:ht,saturate:gt,desaturate:mt,fadein:ot,fadeout:ut,spin:pt,mix:dt}),ft=(t,e,s)=>Object.entries(t).reduce(e,s),xt=Symbol("noParse"),$t=(t,e,s)=>{var r,n,i;let a=""+t;return null==e?"":"object"!=typeof e||e.hasOwnProperty(xt)?`${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+`{${ft(e,((t,e)=>t+$t(...e,a)),"")}}`;var c},vt="palette",yt=t=>{class e{constructor(t={}){this.state={l:"l",c:"base",h:"pri",a:1,m:"bg"},Object.assign(this,{[xt]:!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=O+` ${n?n+" ":""}(${s})`;return{c:n,q:s,s:i,toString:()=>i}};s.toString=()=>O;const r=(s,r)=>{const n="--"+(s||t.name("cp",e.cp++)),i=_+" "+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=()=>_;const n=s=>{const r=s||t.name("kf",e.kf++),n=w+" "+r;return{k:r,s:n,toString:()=>n}};n.toString=()=>w;const i=s=>{const r=s||t.name("lay",e.lay++),n=k+" "+r;return{k:r,s:n,toString:()=>n}};i.toString=()=>k,i.toString=()=>S;const a=(t="",e=!1)=>{const s=q+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return a.toString=()=>q,{pr:r,kf:n,mq:A,cq:s,lay:i,sc:(t="",e="")=>{const s=S+` ${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-"+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(V(Z(et).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),V(Z(st).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:bt(n),palette:yt(n),coef:Ot(n),units:{px:E,vh:P,vw:z,vmin:C,vmax:N,rem:I,deg:W,ms:F,pc:K,cqw:M,cqh:B,cqb:R,cqi:L,cqmin:H,cqmax:T},at:o,limit:f,merge:m})),ft(x,((t,e)=>t+$t(...e)),"");var x}}};const At="theme",Et="size",Pt="time",zt="angle",Ct="palette",Nt=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"],Ht=["pale","base","rich"];function Tt(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?Nt(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(Ct,"h",t)]:e}))),{[s(Ct,"c","bg","gray")]:0,[s(Ct,"c","fg","gray")]:0},e(j,((t,r)=>({[b(r).s]:l(i[t]||{},e(Rt,((e,r)=>({[s(Ct,"l","bg",r)]:m[t].bg[r],[s(Ct,"l","fg",r)]:m[t].fg[r]}))),e(Ht,((e,r)=>({[s(Ct,"c","bg",r)]:p[t].bg[r],[s(Ct,"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(zt)]:{[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,zt]}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()}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,zt)}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{Tt as defineProvider};
|
|
@@ -1,135 +1,2 @@
|
|
|
1
|
-
import { TCreateScope } from '../../common';
|
|
2
|
-
export declare const resolveCoef: (varExp: ReturnType<ReturnType<TCreateScope>>["varExp"]) =>
|
|
3
|
-
/**
|
|
4
|
-
* Coefficient state
|
|
5
|
-
*/
|
|
6
|
-
state: {
|
|
7
|
-
center: number;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Returns `xxs` coefficient
|
|
11
|
-
*/
|
|
12
|
-
readonly min: string;
|
|
13
|
-
/**
|
|
14
|
-
* Returns `xxs` coefficient
|
|
15
|
-
*/
|
|
16
|
-
readonly xxs: string;
|
|
17
|
-
/**
|
|
18
|
-
* Returns `xs` coefficient
|
|
19
|
-
*/
|
|
20
|
-
readonly xs: string;
|
|
21
|
-
/**
|
|
22
|
-
* Returns `s` coefficient
|
|
23
|
-
*/
|
|
24
|
-
readonly s: string;
|
|
25
|
-
/**
|
|
26
|
-
* Returns `m` coefficient
|
|
27
|
-
*/
|
|
28
|
-
readonly m: string;
|
|
29
|
-
/**
|
|
30
|
-
* Returns `l` coefficient
|
|
31
|
-
*/
|
|
32
|
-
readonly l: string;
|
|
33
|
-
/**
|
|
34
|
-
* Returns `xl` coefficient
|
|
35
|
-
*/
|
|
36
|
-
readonly xl: string;
|
|
37
|
-
/**
|
|
38
|
-
* Returns `xxl` coefficient
|
|
39
|
-
*/
|
|
40
|
-
readonly xxl: string;
|
|
41
|
-
/**
|
|
42
|
-
* Returns `xxl` coefficient
|
|
43
|
-
*/
|
|
44
|
-
readonly max: string;
|
|
45
|
-
/**
|
|
46
|
-
* Range from 0 to 1
|
|
47
|
-
*/
|
|
48
|
-
readonly $0_: /*elided*/ any;
|
|
49
|
-
/**
|
|
50
|
-
* Range from 1 to 2
|
|
51
|
-
*/
|
|
52
|
-
readonly $1_: /*elided*/ any;
|
|
53
|
-
/**
|
|
54
|
-
* Range from 2 to 16
|
|
55
|
-
*/
|
|
56
|
-
readonly $2_: /*elided*/ any;
|
|
57
|
-
/**
|
|
58
|
-
* Range from 16 to the end
|
|
59
|
-
*/
|
|
60
|
-
readonly $16_: /*elided*/ any;
|
|
61
|
-
/**
|
|
62
|
-
* Range around 1
|
|
63
|
-
*/
|
|
64
|
-
readonly $1: /*elided*/ any;
|
|
65
|
-
/**
|
|
66
|
-
* Range around 2
|
|
67
|
-
*/
|
|
68
|
-
readonly $2: /*elided*/ any;
|
|
69
|
-
/**
|
|
70
|
-
* Range around 16
|
|
71
|
-
*/
|
|
72
|
-
readonly $16: /*elided*/ any;
|
|
73
|
-
/**
|
|
74
|
-
* Short range dictionary
|
|
75
|
-
*/
|
|
76
|
-
readonly short: {
|
|
77
|
-
s: string;
|
|
78
|
-
m: string;
|
|
79
|
-
l: string;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Base range dictionary
|
|
83
|
-
*/
|
|
84
|
-
readonly base: {
|
|
85
|
-
xl: string;
|
|
86
|
-
s: string;
|
|
87
|
-
m: string;
|
|
88
|
-
l: string;
|
|
89
|
-
xs: string;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Long range dictionary
|
|
93
|
-
*/
|
|
94
|
-
readonly long: {
|
|
95
|
-
xxl: string;
|
|
96
|
-
xl: string;
|
|
97
|
-
s: string;
|
|
98
|
-
m: string;
|
|
99
|
-
l: string;
|
|
100
|
-
xs: string;
|
|
101
|
-
xxs: string;
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* Full range dictionary
|
|
105
|
-
*/
|
|
106
|
-
readonly full: {
|
|
107
|
-
max: string;
|
|
108
|
-
xxl: string;
|
|
109
|
-
xl: string;
|
|
110
|
-
s: string;
|
|
111
|
-
m: string;
|
|
112
|
-
l: string;
|
|
113
|
-
xs: string;
|
|
114
|
-
xxs: string;
|
|
115
|
-
min: string;
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Main range dictionary
|
|
119
|
-
*/
|
|
120
|
-
readonly main: {
|
|
121
|
-
min: string;
|
|
122
|
-
m: string;
|
|
123
|
-
max: string;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Sparse range dictionary
|
|
127
|
-
*/
|
|
128
|
-
readonly sparse: {
|
|
129
|
-
min: string;
|
|
130
|
-
xs: string;
|
|
131
|
-
m: string;
|
|
132
|
-
xl: string;
|
|
133
|
-
max: string;
|
|
134
|
-
};
|
|
135
|
-
};
|
|
1
|
+
import { TCreateScope, ICoef } from '../../common';
|
|
2
|
+
export declare const resolveCoef: (varExp: ReturnType<ReturnType<TCreateScope>>["varExp"]) => ICoef;
|
|
@@ -1,116 +1,2 @@
|
|
|
1
|
-
import { TCreateScope } from '../../common';
|
|
2
|
-
export declare const resolvePalette: (varExp: ReturnType<ReturnType<TCreateScope>>["varExp"]) =>
|
|
3
|
-
/**
|
|
4
|
-
* Palette state
|
|
5
|
-
*/
|
|
6
|
-
state: {
|
|
7
|
-
l: string;
|
|
8
|
-
c: string;
|
|
9
|
-
h: string;
|
|
10
|
-
a: number;
|
|
11
|
-
m: string;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Returns `xs` lightness color
|
|
15
|
-
*/
|
|
16
|
-
readonly xs: /*elided*/ any;
|
|
17
|
-
/**
|
|
18
|
-
* Returns `s` lightness color
|
|
19
|
-
*/
|
|
20
|
-
readonly s: /*elided*/ any;
|
|
21
|
-
/**
|
|
22
|
-
* Returns `m` lightness color
|
|
23
|
-
*/
|
|
24
|
-
readonly m: /*elided*/ any;
|
|
25
|
-
/**
|
|
26
|
-
* Returns `l` lightness color
|
|
27
|
-
*/
|
|
28
|
-
readonly l: /*elided*/ any;
|
|
29
|
-
/**
|
|
30
|
-
* Returns `xl` lightness color
|
|
31
|
-
*/
|
|
32
|
-
readonly xl: /*elided*/ any;
|
|
33
|
-
/**
|
|
34
|
-
* Returns lightness color dictionary
|
|
35
|
-
*/
|
|
36
|
-
readonly lightness: {
|
|
37
|
-
xs: /*elided*/ any;
|
|
38
|
-
s: /*elided*/ any;
|
|
39
|
-
m: /*elided*/ any;
|
|
40
|
-
l: /*elided*/ any;
|
|
41
|
-
xl: /*elided*/ any;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Returns zero chroma color
|
|
45
|
-
*/
|
|
46
|
-
readonly gray: /*elided*/ any;
|
|
47
|
-
/**
|
|
48
|
-
* Returns pale chroma color
|
|
49
|
-
*/
|
|
50
|
-
readonly pale: /*elided*/ any;
|
|
51
|
-
/**
|
|
52
|
-
* Returns base chroma color
|
|
53
|
-
*/
|
|
54
|
-
readonly base: /*elided*/ any;
|
|
55
|
-
/**
|
|
56
|
-
* Returns rich chroma color
|
|
57
|
-
*/
|
|
58
|
-
readonly rich: /*elided*/ any;
|
|
59
|
-
/**
|
|
60
|
-
* Returns chroma color dictionary
|
|
61
|
-
*/
|
|
62
|
-
readonly chroma: {
|
|
63
|
-
gray: /*elided*/ any;
|
|
64
|
-
pale: /*elided*/ any;
|
|
65
|
-
base: /*elided*/ any;
|
|
66
|
-
rich: /*elided*/ any;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Returns primary hue color
|
|
70
|
-
*/
|
|
71
|
-
readonly pri: /*elided*/ any;
|
|
72
|
-
/**
|
|
73
|
-
* Returns secondary hue color
|
|
74
|
-
*/
|
|
75
|
-
readonly sec: /*elided*/ any;
|
|
76
|
-
/**
|
|
77
|
-
* Returns success hue color
|
|
78
|
-
*/
|
|
79
|
-
readonly suc: /*elided*/ any;
|
|
80
|
-
/**
|
|
81
|
-
* Returns info hue color
|
|
82
|
-
*/
|
|
83
|
-
readonly inf: /*elided*/ any;
|
|
84
|
-
/**
|
|
85
|
-
* Returns warning hue color
|
|
86
|
-
*/
|
|
87
|
-
readonly war: /*elided*/ any;
|
|
88
|
-
/**
|
|
89
|
-
* Returns danger hue color
|
|
90
|
-
*/
|
|
91
|
-
readonly dan: /*elided*/ any;
|
|
92
|
-
/**
|
|
93
|
-
* Returns hue color dictionary
|
|
94
|
-
*/
|
|
95
|
-
readonly hue: {
|
|
96
|
-
pri: /*elided*/ any;
|
|
97
|
-
sec: /*elided*/ any;
|
|
98
|
-
suc: /*elided*/ any;
|
|
99
|
-
inf: /*elided*/ any;
|
|
100
|
-
war: /*elided*/ any;
|
|
101
|
-
dan: /*elided*/ any;
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* Returns specified alpha color
|
|
105
|
-
*/
|
|
106
|
-
alpha(a?: number): /*elided*/ any;
|
|
107
|
-
/**
|
|
108
|
-
* Returns background color
|
|
109
|
-
*/
|
|
110
|
-
readonly bg: /*elided*/ any;
|
|
111
|
-
/**
|
|
112
|
-
* Returns foreground color
|
|
113
|
-
*/
|
|
114
|
-
readonly fg: /*elided*/ any;
|
|
115
|
-
toString(): string;
|
|
116
|
-
};
|
|
1
|
+
import { TCreateScope, IPalette } from '../../common';
|
|
2
|
+
export declare const resolvePalette: (varExp: ReturnType<ReturnType<TCreateScope>>["varExp"]) => IPalette;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const NO_PARSE_SYMBOL: symbol;
|
|
2
|
-
export declare const parseStyles: (styles: object) =>
|
|
2
|
+
export declare const parseStyles: (styles: object) => string;
|
|
@@ -1,6 +1,108 @@
|
|
|
1
|
-
type
|
|
2
|
-
type
|
|
3
|
-
type
|
|
1
|
+
type THue = 'pri' | 'sec' | 'suc' | 'inf' | 'war' | 'dan';
|
|
2
|
+
type TLightness = 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
3
|
+
type TChroma = 'pale' | 'base' | 'rich';
|
|
4
|
+
type TMode = 'bg' | 'fg';
|
|
5
|
+
/**
|
|
6
|
+
* Palette generator
|
|
7
|
+
* @description
|
|
8
|
+
* Allows to create palette colors
|
|
9
|
+
*/
|
|
10
|
+
export interface IPalette {
|
|
11
|
+
state: {
|
|
12
|
+
l: TLightness;
|
|
13
|
+
c: TChroma | 'gray';
|
|
14
|
+
h: THue;
|
|
15
|
+
a: number;
|
|
16
|
+
m: TMode;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Returns `xs` lightness color
|
|
20
|
+
*/
|
|
21
|
+
get xs(): IPalette;
|
|
22
|
+
/**
|
|
23
|
+
* Returns `s` lightness color
|
|
24
|
+
*/
|
|
25
|
+
get s(): IPalette;
|
|
26
|
+
/**
|
|
27
|
+
* Returns `m` lightness color
|
|
28
|
+
*/
|
|
29
|
+
get m(): IPalette;
|
|
30
|
+
/**
|
|
31
|
+
* Returns `l` lightness color
|
|
32
|
+
*/
|
|
33
|
+
get l(): IPalette;
|
|
34
|
+
/**
|
|
35
|
+
* Returns `xl` lightness color
|
|
36
|
+
*/
|
|
37
|
+
get xl(): IPalette;
|
|
38
|
+
/**
|
|
39
|
+
* Returns lightness color dictionary
|
|
40
|
+
*/
|
|
41
|
+
get lightness(): Record<TLightness, IPalette>;
|
|
42
|
+
/**
|
|
43
|
+
* Returns zero chroma color
|
|
44
|
+
*/
|
|
45
|
+
get gray(): IPalette;
|
|
46
|
+
/**
|
|
47
|
+
* Returns pale chroma color
|
|
48
|
+
*/
|
|
49
|
+
get pale(): IPalette;
|
|
50
|
+
/**
|
|
51
|
+
* Returns base chroma color
|
|
52
|
+
*/
|
|
53
|
+
get base(): IPalette;
|
|
54
|
+
/**
|
|
55
|
+
* Returns rich chroma color
|
|
56
|
+
*/
|
|
57
|
+
get rich(): IPalette;
|
|
58
|
+
/**
|
|
59
|
+
* Returns chroma color dictionary
|
|
60
|
+
*/
|
|
61
|
+
get chroma(): Record<TChroma, IPalette>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns primary hue color
|
|
64
|
+
*/
|
|
65
|
+
get pri(): IPalette;
|
|
66
|
+
/**
|
|
67
|
+
* Returns secondary hue color
|
|
68
|
+
*/
|
|
69
|
+
get sec(): IPalette;
|
|
70
|
+
/**
|
|
71
|
+
* Returns success hue color
|
|
72
|
+
*/
|
|
73
|
+
get suc(): IPalette;
|
|
74
|
+
/**
|
|
75
|
+
* Returns info hue color
|
|
76
|
+
*/
|
|
77
|
+
get inf(): IPalette;
|
|
78
|
+
/**
|
|
79
|
+
* Returns warning hue color
|
|
80
|
+
*/
|
|
81
|
+
get war(): IPalette;
|
|
82
|
+
/**
|
|
83
|
+
* Returns danger hue color
|
|
84
|
+
*/
|
|
85
|
+
get dan(): IPalette;
|
|
86
|
+
/**
|
|
87
|
+
* Returns hue color dictionary
|
|
88
|
+
*/
|
|
89
|
+
get hue(): Record<THue, IPalette>;
|
|
90
|
+
/**
|
|
91
|
+
* Returns specified alpha color
|
|
92
|
+
*/
|
|
93
|
+
alpha(a?: number): IPalette;
|
|
94
|
+
/**
|
|
95
|
+
* Returns background color
|
|
96
|
+
*/
|
|
97
|
+
get bg(): IPalette;
|
|
98
|
+
/**
|
|
99
|
+
* Returns foreground color
|
|
100
|
+
*/
|
|
101
|
+
get fg(): IPalette;
|
|
102
|
+
}
|
|
103
|
+
type RecursivePartial<T> = {
|
|
104
|
+
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
|
|
105
|
+
};
|
|
4
106
|
type TPaletteDict<T extends string> = {
|
|
5
107
|
dark: {
|
|
6
108
|
bg: Record<T, number>;
|
|
@@ -11,32 +113,129 @@ type TPaletteDict<T extends string> = {
|
|
|
11
113
|
fg: Record<T, number>;
|
|
12
114
|
};
|
|
13
115
|
};
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export type
|
|
18
|
-
export type TPaletteLightness = TPaletteDict<TLightnessToken>;
|
|
19
|
-
export type TPaletteChroma = TPaletteDict<TChromaToken>;
|
|
20
|
-
export type TPalette = {
|
|
116
|
+
export type TPaletteHue = Record<THue, number>;
|
|
117
|
+
export type TPaletteLightness = TPaletteDict<TLightness>;
|
|
118
|
+
export type TPaletteChroma = TPaletteDict<TChroma>;
|
|
119
|
+
export type TPaletteConfig = {
|
|
21
120
|
l: TPaletteLightness;
|
|
22
121
|
c: TPaletteChroma;
|
|
23
122
|
h: TPaletteHue;
|
|
24
123
|
};
|
|
25
|
-
export type
|
|
26
|
-
export type
|
|
27
|
-
export type
|
|
28
|
-
export type
|
|
29
|
-
export type
|
|
30
|
-
export type
|
|
31
|
-
export type
|
|
32
|
-
export type
|
|
33
|
-
|
|
34
|
-
$
|
|
35
|
-
$
|
|
36
|
-
$
|
|
37
|
-
$16_: TCoefRangeConfig;
|
|
124
|
+
export type TShortRange = 's' | 'm' | 'l';
|
|
125
|
+
export type TMainRange = 'min' | 'm' | 'max';
|
|
126
|
+
export type TBaseRange = 'xs' | TShortRange | 'xl';
|
|
127
|
+
export type TLongRange = 'xxs' | TBaseRange | 'xxl';
|
|
128
|
+
export type TFullRange = 'min' | TLongRange | 'max';
|
|
129
|
+
export type TSparseRange = 'min' | 'xs' | 'm' | 'xl' | 'max';
|
|
130
|
+
export type TRangeConfig = Record<'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxl', number>;
|
|
131
|
+
export type TCoefConfig = {
|
|
132
|
+
$0_: TRangeConfig;
|
|
133
|
+
$1_: TRangeConfig;
|
|
134
|
+
$2_: TRangeConfig;
|
|
135
|
+
$16_: TRangeConfig;
|
|
38
136
|
max: number;
|
|
39
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* Coefficient generator
|
|
140
|
+
* @description
|
|
141
|
+
* Allows to create coefficient ranges
|
|
142
|
+
*/
|
|
143
|
+
export interface ICoef {
|
|
144
|
+
/**
|
|
145
|
+
* Coefficient state
|
|
146
|
+
*/
|
|
147
|
+
state: {
|
|
148
|
+
center: number;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Returns `xxs` coefficient
|
|
152
|
+
*/
|
|
153
|
+
get min(): string;
|
|
154
|
+
/**
|
|
155
|
+
* Returns `xxs` coefficient
|
|
156
|
+
*/
|
|
157
|
+
get xxs(): string;
|
|
158
|
+
/**
|
|
159
|
+
* Returns `xs` coefficient
|
|
160
|
+
*/
|
|
161
|
+
get xs(): string;
|
|
162
|
+
/**
|
|
163
|
+
* Returns `s` coefficient
|
|
164
|
+
*/
|
|
165
|
+
get s(): string;
|
|
166
|
+
/**
|
|
167
|
+
* Returns `m` coefficient
|
|
168
|
+
*/
|
|
169
|
+
get m(): string;
|
|
170
|
+
/**
|
|
171
|
+
* Returns `l` coefficient
|
|
172
|
+
*/
|
|
173
|
+
get l(): string;
|
|
174
|
+
/**
|
|
175
|
+
* Returns `xl` coefficient
|
|
176
|
+
*/
|
|
177
|
+
get xl(): string;
|
|
178
|
+
/**
|
|
179
|
+
* Returns `xxl` coefficient
|
|
180
|
+
*/
|
|
181
|
+
get xxl(): string;
|
|
182
|
+
/**
|
|
183
|
+
* Returns `xxl` coefficient
|
|
184
|
+
*/
|
|
185
|
+
get max(): string;
|
|
186
|
+
/**
|
|
187
|
+
* Range from 0 to 1
|
|
188
|
+
*/
|
|
189
|
+
get $0_(): ICoef;
|
|
190
|
+
/**
|
|
191
|
+
* Range around 1
|
|
192
|
+
*/
|
|
193
|
+
get $1(): ICoef;
|
|
194
|
+
/**
|
|
195
|
+
* Range from 1 to 2
|
|
196
|
+
*/
|
|
197
|
+
get $1_(): ICoef;
|
|
198
|
+
/**
|
|
199
|
+
* Range around 2
|
|
200
|
+
*/
|
|
201
|
+
get $2(): ICoef;
|
|
202
|
+
/**
|
|
203
|
+
* Range from 2 to 16
|
|
204
|
+
*/
|
|
205
|
+
get $2_(): ICoef;
|
|
206
|
+
/**
|
|
207
|
+
* Range around 16
|
|
208
|
+
*/
|
|
209
|
+
get $16(): ICoef;
|
|
210
|
+
/**
|
|
211
|
+
* Range from 16 to the end
|
|
212
|
+
*/
|
|
213
|
+
get $16_(): ICoef;
|
|
214
|
+
/**
|
|
215
|
+
* Short range dictionary
|
|
216
|
+
*/
|
|
217
|
+
get short(): Record<TShortRange, string>;
|
|
218
|
+
/**
|
|
219
|
+
* Base range dictionary
|
|
220
|
+
*/
|
|
221
|
+
get base(): Record<TBaseRange, string>;
|
|
222
|
+
/**
|
|
223
|
+
* Long range dictionary
|
|
224
|
+
*/
|
|
225
|
+
get long(): Record<TLongRange, string>;
|
|
226
|
+
/**
|
|
227
|
+
* Full range dictionary
|
|
228
|
+
*/
|
|
229
|
+
get full(): Record<TFullRange, string>;
|
|
230
|
+
/**
|
|
231
|
+
* Main range dictionary
|
|
232
|
+
*/
|
|
233
|
+
get main(): Record<TMainRange, string>;
|
|
234
|
+
/**
|
|
235
|
+
* Sparse range dictionary
|
|
236
|
+
*/
|
|
237
|
+
get sparse(): Record<TSparseRange, string>;
|
|
238
|
+
}
|
|
40
239
|
/**
|
|
41
240
|
* Provider attributes
|
|
42
241
|
*/
|
|
@@ -96,14 +295,13 @@ export type TProviderSettings = {
|
|
|
96
295
|
/**
|
|
97
296
|
* Palette
|
|
98
297
|
*/
|
|
99
|
-
palette:
|
|
298
|
+
palette: TPaletteConfig;
|
|
100
299
|
/**
|
|
101
300
|
* Coefficients
|
|
102
301
|
*/
|
|
103
|
-
coef:
|
|
302
|
+
coef: TCoefConfig;
|
|
104
303
|
};
|
|
105
304
|
export type TProviderSettingsPartial = RecursivePartial<TProviderSettings>;
|
|
106
|
-
type TStrDict = Record<string, string>;
|
|
107
305
|
type Paths<T> = T extends object ? {
|
|
108
306
|
[K in keyof T]: `${Exclude<K, symbol>}${'' | Paths<T[K]> extends '' ? '' : `.${Paths<T[K]>}`}`;
|
|
109
307
|
}[keyof T] : T extends string ? T : never;
|
|
@@ -119,8 +317,35 @@ type TMods<T> = T extends object ? {
|
|
|
119
317
|
}[keyof T] : T extends string ? T : never;
|
|
120
318
|
type TStringBEM<T> = TBlocks<T> | TMods<T> | TElems<T>;
|
|
121
319
|
type TBEM<T> = TDeepPartial<T> | TStringBEM<T> | TStringBEM<T>[];
|
|
122
|
-
type
|
|
123
|
-
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
|
+
};
|
|
124
349
|
type TParts = (string | number)[];
|
|
125
350
|
type TScope = {
|
|
126
351
|
/**
|
|
@@ -6,6 +6,10 @@ type TResolveAttr = ReturnType<ReturnType<typeof createScope>>['attr'];
|
|
|
6
6
|
* StyleSheet maker
|
|
7
7
|
*/
|
|
8
8
|
export type TStyleSheetMaker = Parameters<ReturnType<typeof createProcessor>['compile']>[0]['maker'];
|
|
9
|
+
/**
|
|
10
|
+
* StyleSheet maker utils
|
|
11
|
+
*/
|
|
12
|
+
export type TStyleSheetUtils = Parameters<TStyleSheetMaker>[0];
|
|
9
13
|
/**
|
|
10
14
|
* Style target
|
|
11
15
|
*/
|