effcss 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -137,7 +137,7 @@ export interface ICardMaker {
137
137
  };
138
138
  }
139
139
 
140
- const myStyleSheetMaker: TStyleSheetMaker = ({ bem, pseudo, at: { kf }, merge }) = {
140
+ const myStyleSheetMaker: TStyleSheetMaker = ({ bem, pseudo, at: { kf }, merge, palette }) = {
141
141
  // creates unique keyframes identifier
142
142
  const spin = kf();
143
143
  // deeply merges objects
@@ -148,6 +148,7 @@ const myStyleSheetMaker: TStyleSheetMaker = ({ bem, pseudo, at: { kf }, merge })
148
148
  }
149
149
  }, {
150
150
  border: 'none',
151
+ background: palette.pale.xl.alpha(0.8),
151
152
  aspectRatio: 1,
152
153
  [pseudo.h()]: {
153
154
  opacity: 0.5
@@ -1,7 +1,7 @@
1
1
  /*
2
- * EffCSS v3.2.0
2
+ * EffCSS v3.4.0
3
3
  * {@link https://gitverse.ru/msabitov/effcss}
4
4
  * Copyright (c) Marat Sabitov
5
5
  * @license Apache-2.0
6
6
  */
7
- "function"==typeof SuppressedError&&SuppressedError;const t="@media",e="@container",s="@property",r="@keyframes",n="@layer",i="@scope",o="@supports",c=(e,s)=>{const r=t+` ${s||""}${s?" and ":""}(${e})`;return{s:r,q:e,t:s,toString:()=>r}};c.toString=()=>t;const a=t=>t+"px",l=t=>t+"vh",h=t=>t+"vw",u=t=>t+"vmin",d=t=>t+"vmax",p=t=>t+"rem",m=t=>t+"deg",f=t=>t+"ms",g=t=>t+"%",$=t=>t+"cqw",v=t=>t+"cqh",y=t=>t+"cqi",b=t=>t+"cqb",_=t=>t+"cqmin",k=t=>t+"cqmax",x=Object.fromEntries,S=Object.entries,j=":first-",w=":last-",q=":only-",O="child",A=":nth-",E="of-type",P=A+O,C=":focus",I={r:":root",h:":hover",f:C,fv:C+"-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:j+O,lc:w+O,oc:q+O,odd:P+"(odd)",even:P+"(even)",ft:j+E,lt:w+E,ot:q+E,bef:"::before",aft:"::after",bd:"::backdrop"},W={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:P,ntho:A+E,dir:":dir",lang:":lang"},K="oklch",M=t=>K+`(${t})`,B=t=>M(`from ${t}`),L="def",N=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",L),c:e("c",L),h:e("h",L),a:e("a",L)},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 M(`${t} ${e} ${s} / ${r}`)}}return t=>new s(t)},R=(t,e=.1)=>B(`${t} calc(l + ${e}) c h / alpha)`),z=(t,e=.1)=>B(`${t} calc(l - ${e}) c h / alpha)`),H=(t,e=.1)=>B(`${t} l c h / calc(alpha + ${e}))`),T=(t,e=.1)=>B(`${t} l c h / calc(alpha - ${e}))`),V=(t,e=.04)=>B(`${t} l calc(c + ${e}) h / alpha)`),Z=(t,e=.04)=>B(`${t} l calc(c - ${e}) h / alpha)`),D=(t,e=30)=>B(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),F=({base:t,mixin:e,method:s,bpart:r,mpart:n})=>`color-mix(in ${s||K}, ${t}${void 0!==r?` ${r}%`:""}, ${e}${void 0!==n?` ${n}%`:""})`,G=t=>({create:N(t),oklch:M,lighten:R,darken:z,saturate:V,desaturate:Z,fadein:H,fadeout:T,spin:D,mix:F}),J=Object.assign,Q=Object.entries,U=Array.isArray,X=(t,...e)=>e.length?e.reduce(((t,e)=>(Q(e).forEach((([e,s])=>{s&&"object"==typeof s&&t[e]?U(t[e])&&U(s)?t[e]=[...t[e],...s]:X(t[e],s||{}):t[e]=s})),t)),t):t,Y=(t,e,s)=>Object.entries(t).reduce(e,s),tt=(t,e,s)=>{var r,n,i;let o=""+t;return null==e?"":"object"==typeof e?(!s||(null===(r=s.startsWith)||void 0===r?void 0:r.call(s,"@"))||(null===(n=o.startsWith)||void 0===n?void 0:n.call(o,"&"))||(null===(i=o.startsWith)||void 0===i?void 0:i.call(o,"@"))?"":"&")+o+`{${Y(e,((t,e)=>t+tt(...e,o)),"")}}`:`${c=o,c.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}:${""+e};`;var c},et={dash:(...t)=>t.join("-"),comma:(...t)=>t.join(),space:(...t)=>t.join(" "),range:(t,e)=>Array.from(Array(t).entries()).reduce(((t,[s])=>J(t,e(s+1))),{}),each:(t,e)=>Q(t).reduce(((t,[s,r])=>J(t,e(s,r))),{}),merge:X,when:(t,e,s={})=>t?e:s},st="width: ",rt=t=>{const{scope:j,globalKey:w="",bp:q={}}=t,O=j(w),A=t=>O.varExp(...t.split(".")),E=t=>`calc(${t} * ${A("rtime")})`;return{compile:({key:t,maker:w})=>{const P=j(t),C=(t=>{const a={cp:1,lay:1,kf:1,cq:1},l=(s,r)=>{const n="string"==typeof r?r:t.name("cq",a.cq++),i=e+` ${n?n+" ":""}(${s})`;return{c:n,q:s,s:i,toString:()=>i}};l.toString=()=>e;const h=(e,r)=>{const n="--"+(e||t.name("cp",a.cp++)),i=s+" "+n;return{k:n,v:`var(${n})`,s:i,r:{[i]:{syntax:(null==r?void 0:r.syn)||'"*"',inherits:(null==r?void 0:r.inh)||!1,initialValue:null==r?void 0:r.ini}},toString:()=>i}};h.toString=()=>s;const u=e=>{const s=e||t.name("kf",a.kf++),n=r+" "+s;return{k:s,s:n,toString:()=>n}};u.toString=()=>r;const d=e=>{const s=e||t.name("lay",a.lay++),r=n+" "+s;return{k:s,s:r,toString:()=>r}};d.toString=()=>n,d.toString=()=>i;const p=(t="",e=!1)=>{const s=o+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return p.toString=()=>o,{pr:h,kf:u,mq:c,cq:l,lay:d,sc:(t="",e="")=>{const s=i+` ${t?`(${t})`:""}${t&&e?" ":""}${e?`to (${e})`:""}`;return{r:t,l:e,s:s,toString:()=>s}},sup:p}})(P),K=t=>{const e=q[t]||t;return"number"==typeof e?e+"rem":""},M=t=>"min-"+st+K(t),B=t=>"max-"+st+K(t),L=(t,e)=>"string"==typeof e?C.cq(t,e):C.mq(t),N=(t,e,s)=>""+L(M(t)+") and ("+B(e),s),R={up:(t,e)=>""+L(M(t),e),down:(t,e)=>""+L(B(t),e),between:N,only:(t,e)=>N(t,t,e)};return z=w(Object.assign(et,{key:t,vars:A,time:E,bem:P.selector,pseudo:Object.assign(x(S(I).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),x(S(W).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:G(O.varExp),units:{px:a,vh:l,vw:h,vmin:u,vmax:d,rem:p,deg:m,ms:f,pc:g,cqw:$,cqh:v,cqb:b,cqi:y,cqmin:_,cqmax:k},at:C,limit:R})),Y(z,((t,e)=>t+tt(...e)),"");var z}}};const nt=void 0,it=Object.entries,ot=Object.defineProperties,ct=t=>`data-${t}`,at=t=>"string"==typeof t,lt=t=>null!==t&&"object"==typeof t,ht=(t,e)=>`${t}${e?"__"+e:""}`,ut=t=>t.split("."),dt=(t,e)=>it(t).reduce(((t,[s,r])=>{if(lt(r)){const n=it(r);n.length?t.push(...n.reduce(((t,[r,n])=>{if((t=>null!==t&&t!==nt)(r)&&e&&t.push([s,r,nt,nt]),lt(n)){const e=it(n);e.length&&t.push(...e.reduce(((t,[e,n])=>{const i=typeof n;return"string"!==i&&"number"!==i||t.push([s,r,e,n]),t}),[]))}return t}),[])):t.push([s,nt,nt,nt])}return t}),[]),pt=(t,e,s,r)=>""+(ht(t,e)+(s?"_"+s:"")+(s&&r?"_"+r:"")),mt=(t,e,s,r)=>"."+pt(t,e,s,r),ft=(t,e,s,r)=>`[${ct(ht(t,e))}${s&&r?`~="${s}_${r}"`:s?`~="${s}"`:""}]`,gt={def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},$t="effcss-provider",vt={theme:null,hydrate:null,mode:"a",prefix:"f"},yt={bp:{"3xs":18,"2xs":24,xs:30,sm:40,md:48,lg:64,xl:80,"2xl":96},vars:{"":{rtime:"200ms",rem:16,l:gt,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:gt},dark:{l:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}}},bt=({prefix:t})=>{let e=1;return{get base(){return t+0},get current(){return t+e},next(){return e++,this.current},reset(){e=1}}},_t=()=>{const t=new Set,e=new Map;return{use(s,r){const n=e.get(s);return n||(t.add(r),e.set(s,r),r)},useMany(t){return it(t).map((([t,e])=>this.use(e,t)))},getKey:t=>e.get(t),get keys(){return[...t]},get makers(){return Object.fromEntries(e.entries().map((([t,e])=>[e,t])))}}},kt="theme",xt=Object.assign,St=Object.entries,jt=Object.fromEntries,wt=(t,e)=>t.getAttribute(e)||vt[e];!function(t={}){const e=window.document,s=window.customElements;if(null==s?void 0:s.get($t))return!1;{class r extends HTMLScriptElement{constructor(){super(...arguments),this._c=_t(),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]},o=()=>{r=r.reduce(((t,e)=>{const s=e.deref();return s&&(i(s),t.push(e)),t}),[])},c=t=>s.findIndex((e=>e===t)),a=e=>e?t[e]:void 0,l=(e,r)=>{if(!t[e])return t[e]=n(e,r),s.push(t[e]),o(),!0},h=t=>{const e=a(t);return!!e&&-1!==c(e)};return{apply:i,notify:o,getIndex:c,get:a,has:t=>!!t&&!!a(t),getAll:()=>t,add:l,status:h,on:(...t)=>{const e=t.reduce(((t,e)=>{const r=a(e);return!(!r||h(e))&&(s.push(r),t)}),!0);return o(),e},off:(...t)=>{const e=t.reduce(((t,e)=>{const r=a(e);if(r&&h(e)){const e=c(r);return s.splice(e,1),t}return!1}),!0);return o(),e},remove:r=>{const n=a(r);if(!n)return;const i=c(n);return i>-1&&(s.splice(i,1),delete t[r],delete e[r]),o(),!0},removeAll:()=>(s.splice(0),t={},e={},o(),!0),pack:(t,e)=>{let s=new CSSStyleSheet;return s.replaceSync(e),s=n(t,s),!!s.cssRules.length&&l(t,s)},replace:(e,s)=>{const r=t[e];if(r)return r.replaceSync(s),o(),!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._cust=(t={})=>{const{varName:e}=this._s(this._k.base);function s(t,r){return St(t).reduce(((t,[n,i])=>i&&"object"==typeof i?xt(t,s(i,[...r,n])):(t[e(...r,n)]=i,t)),{})}const r=jt(St(t||{}).map((([t,e])=>[t,s(e,[])]))),{"":n={},dark:i,light:o}=r,c=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}(r,["","dark","light"]);this._=({bem:t,each:e,when:s,vars:r,merge:a,at:{mq:l}})=>{const h="prefers-color-scheme",u={light:`${h}: light`,dark:`${h}: dark`};return a({[`:root:has(script[is=${$t}])`]:a({fontSize:r("rem")},n)},s(!!i,{[l(u.dark).s]:i}),s(!!o,{[l(u.light).s]:o}),e(c,((e,s)=>({[`:root:has(script[is=${$t}][${kt}=${e}])`]:s,[t(`..theme.${e}`)]:s}))))},this.use(this._,this._k.base)},this.use=(t,e)=>{const s=e||this._k.current;let r=this._c.use(t,s);return this._m&&!this._m.has(e)&&this._m.pack(r,this.css(t,r)),e||this._k.next(),this.resolve(r)},this.usePublic=t=>jt(St(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))))}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=xt({},this._settings,t),{makers:i,vars:o,bp:c,off:a}=n;c&&(null===(e=this._settings)||void 0===e?void 0:e.bp)!==c&&(this._p=rt({scope:this._s,globalKey:this._k.base,bp:c})),o&&(null===(s=this._settings)||void 0===s?void 0:s.vars)!==o&&this._cust(o),i&&(null===(r=this._settings)||void 0===r?void 0:r.makers)!==i&&(this._c.useMany(i),this.usePublic(i),(null==a?void 0:a.length)&&this._settings.off!==a&&this.off(...a),this.hydrate&&this._k.reset()),this._settings=n}set theme(t){t?this.setAttribute(kt,t):this.removeAttribute(kt)}get theme(){return wt(this,kt)||""}connectedCallback(){this._k=bt({prefix:this.prefix}),this._s=((t={})=>{const{mode:e}=t;let s,r;return t=>{const n=(...e)=>""+e.filter(Boolean).reduce(((t,e)=>`${t}-${e}`),t),i=(...t)=>"--"+n(...t);return"c"===e?(s=t=>{let e,s,r,i;return at(t)?([e,s,r,i]=ut(t),mt(n(e),s,r,i)):t&&dt(t).map((([t,e,s,r])=>mt(n(t),e,s,r))).join(",")},r=t=>{let e,s,r,i;const o="class";let c="";return Array.isArray(t)?c=[...t.reduce(((t,o)=>([e,s,r,i]=ut(o),t.add(pt(n(e),s)),r&&t.add(pt(n(e),s,r,i)),t)),new Set).values()].join(" "):at(t)?([e,s,r,i]=ut(t),c=pt(n(e),s,r,i)):c=t&&dt(t,!0).map((([t,e,s,r])=>pt(n(t),e,s,r))).join(" "),ot({[o]:c},{toString:{value:()=>`${o}="${c}"`}})}):(s=t=>{let e,s,r,i;return at(t)?([e,s,r,i]=ut(t),ft(n(e),s,r,i)):t&&dt(t).map((([t,e,s,r])=>ft(n(t),e,s,r))).join(",")},r=t=>{let e,s,r,i,o,c,a="";if(Array.isArray(t))c=t.reduce(((t,c)=>{[e,s,r,i]=ut(c);const l=ht(n(e),s);return o=ct(l),a=r?i?`${r}_${i}`:`${r}`:"",t[o]&&a?t[o]=t[o]+" "+a:t[o]=a,t}),{});else if(at(t)){[e,s,r,i]=ut(t);const l=ht(n(e),s);o=ct(l),a=r?i?`${r}_${i}`:`${r}`:"",c={[o]:a}}else c=t&&dt(t,!0).reduce(((t,[e,s,r,i])=>{const c=ht(n(e),s);o=ct(c);const l=r?i?`${r}_${i}`:`${r}`:"";return a=t[o]?t[o]+" "+l:l,t[o]=a,t}),{});return ot(c,{toString:{value:()=>it(c).map((([t,e])=>`${t}="${e}"`)).join(" ")}}),c}),{selector:s,attr:r,name:n,varName:i,varExp:(...t)=>`var(${i(...t)})`}}})({mode:this.mode});const s=this;this._n={set adoptedStyleSheets(t){s.dispatchEvent(new CustomEvent("effcsschanges",{detail:{styles:t},bubbles:!0}))}},this._m.register(this._n),this._m.register(e),this.settings=xt({},yt,t)}toString(){return`<script ${[...this.attributes].map((t=>t.value?`${t.name}="${t.value}"`:""===t.value?t.name:"")).filter(Boolean).join(" ")}>${this.textContent}<\/script>`}}s.define($t,r,{extends:"script"})}}();
7
+ "function"==typeof SuppressedError&&SuppressedError;const t="@media",e="@container",s="@property",i="@keyframes",r="@layer",n="@scope",a="@supports",l=(e,s)=>{const i=t+` ${s||""}${s?" and ":""}(${e})`;return{s:i,q:e,t:s,toString:()=>i}};l.toString=()=>t;const c=t=>t+"px",o=t=>t+"vh",h=t=>t+"vw",u=t=>t+"vmin",g=t=>t+"vmax",d=t=>t+"rem",p=t=>t+"deg",m=t=>t+"ms",b=t=>t+"%",f=t=>t+"cqw",v=t=>t+"cqh",$=t=>t+"cqi",y=t=>t+"cqb",j=t=>t+"cqmin",x=t=>t+"cqmax",O=Object.fromEntries,k=Object.entries,_=":first-",w=":last-",S=":only-",q="child",A=":nth-",E="of-type",z=A+q,P=":focus",N={r:":root",h:":hover",f:P,fv:P+"-visible",a:":active",v:":visited",val:":valid",inv:":invalid",e:":empty",d:":disabled",rq:":required",o:":optional",m:":modal",l:":link",ph:":placeholder",ch:":checked",po:":popover-open",fc:_+q,lc:w+q,oc:S+q,odd:z+"(odd)",even:z+"(even)",ft:_+E,lt:w+E,ot:S+E,bef:"::before",aft:"::after",bd:"::backdrop"},C={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:z,ntho:A+E,dir:":dir",lang:":lang"},I="oklch",W=t=>I+`(${t})`,F=t=>W(`from ${t}`),K="def",M=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",K),c:e("c",K),h:e("h",K),a:e("a",K)},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:i}=this.state;return W(`${t} ${e} ${s} / ${i}`)}}return t=>new s(t)},B=(t,e=.1)=>F(`${t} calc(l + ${e}) c h / alpha)`),L=(t,e=.1)=>F(`${t} calc(l - ${e}) c h / alpha)`),R=(t,e=.1)=>F(`${t} l c h / calc(alpha + ${e}))`),H=(t,e=.1)=>F(`${t} l c h / calc(alpha - ${e}))`),T=(t,e=.04)=>F(`${t} l calc(c + ${e}) h / alpha)`),V=(t,e=.04)=>F(`${t} l calc(c - ${e}) h / alpha)`),Z=(t,e=30)=>F(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),D=({base:t,mixin:e,method:s,bpart:i,mpart:r})=>`color-mix(in ${s||I}, ${t}${void 0!==i?` ${i}%`:""}, ${e}${void 0!==r?` ${r}%`:""})`,G=t=>({create:M(t),oklch:W,lighten:B,darken:L,saturate:T,desaturate:V,fadein:R,fadeout:H,spin:Z,mix:D}),J=(t,e,s)=>Object.entries(t).reduce(e,s),Q=Symbol("noParse"),U=(t,e,s)=>{var i,r,n;let a=""+t;return null==e?"":"object"!=typeof e||e.hasOwnProperty(Q)?`${l=a,l.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}:${""+e};`:(!s||(null===(i=s.startsWith)||void 0===i?void 0:i.call(s,"@"))||(null===(r=a.startsWith)||void 0===r?void 0:r.call(a,"&"))||(null===(n=a.startsWith)||void 0===n?void 0:n.call(a,"@"))?"":"&")+a+`{${J(e,((t,e)=>t+U(...e,a)),"")}}`;var l},X="palette",Y=t=>{const e={pri:t(X,"h","pri"),sec:t(X,"h","sec"),ter:t(X,"h","ter"),suc:t(X,"h","suc"),inf:t(X,"h","inf"),war:t(X,"h","war"),dan:t(X,"h","dan")};class s{constructor(t={}){this.state={l:"l",c:"base",h:e.pri,a:1,m:"bg"},Object.assign(this,{[Q]:!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:i,a:r,m:n}=this.state;return`oklch(${t(X,"l",n,e)} ${t(X,"c",n,s)} ${i} / ${r})`}}return new s},tt=Object.assign,et=Object.entries,st=Array.isArray,it=(t,...e)=>e.length?e.reduce(((t,e)=>(et(e).forEach((([e,s])=>{s&&"object"==typeof s&&t[e]?st(t[e])&&st(s)?t[e]=[...t[e],...s]:it(t[e],s||{}):t[e]=s})),t)),t):t,rt={dash:(...t)=>t.join("-"),comma:(...t)=>t.join(),space:(...t)=>t.join(" "),range:(t,e)=>Array.from(Array(t).entries()).reduce(((t,[s])=>tt(t,e(s+1))),{}),each:(t,e)=>et(t).reduce(((t,[s,i])=>tt(t,e(s,i))),{}),merge:it,when:(t,e,s={})=>t?e:s},nt="width: ",at=t=>{const{scope:_,globalKey:w="",bp:S={}}=t,q=_(w),A=t=>q.varExp(...t.split(".")),E=(t=1)=>`calc(${t} * ${A("rtime")})`;return{compile:({key:t,maker:w})=>{const z=_(t),P=(t=>{const c={cp:1,lay:1,kf:1,cq:1},o=(s,i)=>{const r="string"==typeof i?i:t.name("cq",c.cq++),n=e+` ${r?r+" ":""}(${s})`;return{c:r,q:s,s:n,toString:()=>n}};o.toString=()=>e;const h=(e,i)=>{const r="--"+(e||t.name("cp",c.cp++)),n=s+" "+r;return{k:r,v:`var(${r})`,s:n,r:{[n]:{syntax:(null==i?void 0:i.syn)||'"*"',inherits:(null==i?void 0:i.inh)||!1,initialValue:null==i?void 0:i.ini}},toString:()=>n}};h.toString=()=>s;const u=e=>{const s=e||t.name("kf",c.kf++),r=i+" "+s;return{k:s,s:r,toString:()=>r}};u.toString=()=>i;const g=e=>{const s=e||t.name("lay",c.lay++),i=r+" "+s;return{k:s,s:i,toString:()=>i}};g.toString=()=>r,g.toString=()=>n;const d=(t="",e=!1)=>{const s=a+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return d.toString=()=>a,{pr:h,kf:u,mq:l,cq:o,lay:g,sc:(t="",e="")=>{const s=n+` ${t?`(${t})`:""}${t&&e?" ":""}${e?`to (${e})`:""}`;return{r:t,l:e,s:s,toString:()=>s}},sup:d}})(z),I=t=>{const e=S[t]||t;return"number"==typeof e?e+"rem":""},W=t=>"min-"+nt+I(t),F=t=>"max-"+nt+I(t),K=(t,e)=>"string"==typeof e?P.cq(t,e):P.mq(t),M=(t,e,s)=>""+K(W(t)+") and ("+F(e),s),B={up:(t,e)=>""+K(W(t),e),down:(t,e)=>""+K(F(t),e),between:M,only:(t,e)=>M(t,t,e)};return L=w(Object.assign(rt,{key:t,vars:A,time:E,bem:z.selector,pseudo:Object.assign(O(k(N).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),O(k(C).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:G(q.varExp),palette:Y(q.varExp),units:{px:c,vh:o,vw:h,vmin:u,vmax:g,rem:d,deg:p,ms:m,pc:b,cqw:f,cqh:v,cqb:y,cqi:$,cqmin:j,cqmax:x},at:P,limit:B})),J(L,((t,e)=>t+U(...e)),"");var L}}};const lt=void 0,ct=Object.entries,ot=Object.assign,ht=Object.defineProperties,ut=t=>`data-${t}`,gt=t=>"string"==typeof t,dt=t=>null!==t&&"object"==typeof t,pt=(t,e)=>`${t}${e?"__"+e:""}`,mt=t=>t.split("."),bt=(t,e)=>ct(t).reduce(((t,[s,i])=>{if(dt(i)){const r=ct(i);r.length?t.push(...r.reduce(((t,[i,r])=>{if((t=>null!==t&&t!==lt)(i)&&e&&t.push([s,i,lt,lt]),dt(r)){const e=ct(r);e.length&&t.push(...e.reduce(((t,[e,r])=>{const n=typeof r;return"string"!==n&&"number"!==n||t.push([s,i,e,r]),t}),[]))}return t}),[])):t.push([s,lt,lt,lt])}return t}),[]),ft=(t,e,s,i)=>""+(pt(t,e)+(s?"_"+s:"")+(s&&i?"_"+i:"")),vt=(t,e,s,i)=>"."+ft(t,e,s,i),$t=(t,e,s,i)=>`[${ut(pt(t,e))}${s&&i?`~="${s}_${i}"`:s?`~="${s}"`:""}]`,yt={def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},jt="effcss-provider",xt={theme:null,hydrate:null,mode:"a",prefix:"f",size:null,time:null},Ot={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))}},kt=(t,e)=>{var s,i,r,n,a,l,c,o,h,u,g,d,p,m,b,f;return e?{l:{dark:{bg:ot(t.l.dark.bg,null===(i=null===(s=null==e?void 0:e.l)||void 0===s?void 0:s.dark)||void 0===i?void 0:i.bg),fg:ot(t.l.dark.fg,null===(n=null===(r=null==e?void 0:e.l)||void 0===r?void 0:r.dark)||void 0===n?void 0:n.fg)},light:{bg:ot(t.l.light.bg,null===(l=null===(a=null==e?void 0:e.l)||void 0===a?void 0:a.light)||void 0===l?void 0:l.bg),fg:ot(t.l.light.fg,null===(o=null===(c=null==e?void 0:e.l)||void 0===c?void 0:c.light)||void 0===o?void 0:o.fg)}},c:{dark:{bg:ot(t.c.dark.bg,null===(u=null===(h=null==e?void 0:e.c)||void 0===h?void 0:h.dark)||void 0===u?void 0:u.bg),fg:ot(t.c.dark.fg,null===(d=null===(g=null==e?void 0:e.c)||void 0===g?void 0:g.dark)||void 0===d?void 0:d.fg)},light:{bg:ot(t.c.light.bg,null===(m=null===(p=null==e?void 0:e.c)||void 0===p?void 0:p.light)||void 0===m?void 0:m.bg),fg:ot(t.c.light.fg,null===(f=null===(b=null==e?void 0:e.c)||void 0===b?void 0:b.light)||void 0===f?void 0:f.fg)}},h:ot(t.h,null==e?void 0:e.h)}:t},_t={bp:{"3xs":18,"2xs":24,xs:30,sm:40,md:48,lg:64,xl:80,"2xl":96},vars:{"":{rtime:"200ms",rem:"16px",l:yt,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:yt},dark:{l:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}},palette:Ot},wt=({prefix:t})=>{let e=1;return{get base(){return t+0},get current(){return t+e},next(){return e++,this.current},reset(){e=1}}},St=()=>{const t=new Set,e=new Map;return{use(s,i){const r=e.get(s);return r||(t.add(i),e.set(s,i),i)},useMany(t){return ct(t).map((([t,e])=>this.use(e,t)))},getKey:t=>e.get(t),get keys(){return[...t]},get makers(){return Object.fromEntries(e.entries().map((([t,e])=>[e,t])))}}},qt="theme",At="palette",Et=Object.assign,zt=Object.entries,Pt=Object.fromEntries,Nt=(t,e)=>t.getAttribute(e)||xt[e];!function(t={}){const e=window.document,s=window.customElements;if(null==s?void 0:s.get(jt))return!1;{class i extends HTMLScriptElement{constructor(){super(...arguments),this._c=St(),this._m=function(){let t={},e={},s=[],i=[];const r=(t,e)=>(e.toString=()=>"effcss-"+t,e),n=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=()=>{i=i.reduce(((t,e)=>{const s=e.deref();return s&&(n(s),t.push(e)),t}),[])},l=t=>s.findIndex((e=>e===t)),c=e=>e?t[e]:void 0,o=(e,i)=>{if(!t[e])return t[e]=r(e,i),s.push(t[e]),a(),!0},h=t=>{const e=c(t);return!!e&&-1!==l(e)};return{apply:n,notify:a,getIndex:l,get:c,has:t=>!!t&&!!c(t),getAll:()=>t,add:o,status:h,on:(...t)=>{const e=t.reduce(((t,e)=>{const i=c(e);return!(!i||h(e))&&(s.push(i),t)}),!0);return a(),e},off:(...t)=>{const e=t.reduce(((t,e)=>{const i=c(e);if(i&&h(e)){const e=l(i);return s.splice(e,1),t}return!1}),!0);return a(),e},remove:i=>{const r=c(i);if(!r)return;const n=l(r);return n>-1&&(s.splice(n,1),delete t[i],delete e[i]),a(),!0},removeAll:()=>(s.splice(0),t={},e={},a(),!0),pack:(e,s)=>{let i=t[e]||new CSSStyleSheet;return i.replaceSync(s),i=r(e,i),!!i.cssRules.length&&o(e,i)},replace:(e,s)=>{const i=t[e];if(i)return i.replaceSync(s),a(),!0},register:t=>{i.findIndex((e=>e.deref()===t))>=0||(i.push(new WeakRef(t)),n(t))},unregister:t=>{const e=i.findIndex((e=>e.deref()===t));e>=0&&i.splice(e,1)}}}(),this._settings=_t,this._cust=()=>{var t;const e=null===(t=this._settings)||void 0===t?void 0:t.vars,{varName:s}=this._s(this._k.base);function i(t,e){return zt(t).reduce(((t,[r,n])=>n&&"object"==typeof n?Et(t,i(n,[...e,r])):(t[s(...e,r)]=n,t)),{})}const r=Pt(zt(e||{}).map((([t,e])=>[t,i(e,[])]))),{"":n={},dark:a,light:l}=r,c=function(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s}(r,["","dark","light"]),o=this.size,h=this.time,{l:u,c:g,h:d}=this._settings.palette,p=["xs","s","m","l","xl"],m=["pale","base","rich"];this._=({bem:t,each:e,when:i,vars:a,merge:l,at:{mq:b},units:{px:f,ms:v,pc:$}})=>{const y="prefers-color-scheme",j={light:`${y}: light`,dark:`${y}: dark`};return l({[`:root:has(script[is=${jt}])`]:l({fontSize:a("rem")},n,e(d,((t,e)=>({[s(At,"h",t)]:e}))),{[s(At,"c","bg","gray")]:0,[s(At,"c","fg","gray")]:0},e(j,((t,i)=>({[b(i).s]:l(r[t]||{},e(p,((e,i)=>({[s(At,"l","bg",i)]:u[t].bg[i],[s(At,"l","fg",i)]:u[t].fg[i]}))),e(m,((e,i)=>({[s(At,"c","bg",i)]:g[t].bg[i],[s(At,"c","fg",i)]:g[t].fg[i]}))))}))))},e(c,((e,s)=>({[`:root:has(script[is=${jt}][${qt}=${e}])`]:s,[t(`..theme.${e}`)]:s}))),i(!!o,{[`:root:has(script[is=${jt}][size])`]:{[s("","rem")]:f(o)}}),i(!!h,{[`:root:has(script[is=${jt}][time])`]:{[s("","rtime")]:v(h)}}))},this.use(this._,this._k.base,!0)},this.use=(t,e,s)=>{const i=e||this._k.current;let r=this._c.use(t,i);return(s||this._m&&!this._m.has(e))&&this._m.pack(r,this.css(t,r)),e||this._k.next(),this.resolve(r)},this.usePublic=t=>Pt(zt(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["size","time"]}get prefix(){return Nt(this,"prefix")||""}get mode(){return Nt(this,"mode")}get hydrate(){return""===this.getAttribute("hydrate")}get settings(){return this._settings}set settings(t){var e,s,i,r,n;const a=Et({},this._settings,t,{palette:kt(this._settings.palette,null==t?void 0:t.palette)}),{makers:l,vars:c,bp:o,off:h,palette:u}=a;(o&&(null===(e=this._settings)||void 0===e?void 0:e.bp)!==o||!this._p)&&(this._p=at({scope:this._s,globalKey:this._k.base,bp:o})),l&&(null===(s=this._settings)||void 0===s?void 0:s.makers)!==l&&(this._c.useMany(l),this.usePublic(l),(null==h?void 0:h.length)&&this._settings.off!==h&&this.off(...h),this.hydrate&&this._k.reset()),this._settings=a,(!(null===(i=this._m)||void 0===i?void 0:i.has(this._k.base))||c&&(null===(r=this._settings)||void 0===r?void 0:r.vars)!==c||u&&(null===(n=this._settings)||void 0===n?void 0:n.palette)!==u)&&this._cust()}set theme(t){t?this.setAttribute(qt,t):this.removeAttribute(qt)}get theme(){return Nt(this,qt)||""}set size(t){null===t?this.removeAttribute("size"):this.setAttribute("size",t+"")}get size(){const t=this.getAttribute("size");return null!==t?Number(t):null}set time(t){null===t?this.removeAttribute("time"):this.setAttribute("time",t+"")}get time(){const t=this.getAttribute("time");return null!==t?Number(t):null}attributeChangedCallback(){this._k&&this._cust()}connectedCallback(){this._k=wt({prefix:this.prefix}),this._s=((t={})=>{const{mode:e}=t;let s,i;return t=>{const r=(...e)=>""+e.filter(Boolean).reduce(((t,e)=>`${t}-${e}`),t),n=(...t)=>"--"+r(...t);return"c"===e?(s=t=>{let e,s,i,n;return gt(t)?([e,s,i,n]=mt(t),vt(r(e),s,i,n)):t&&bt(t).map((([t,e,s,i])=>vt(r(t),e,s,i))).join(",")},i=t=>{let e,s,i,n;const a="class";let l="";return Array.isArray(t)?l=[...t.reduce(((t,a)=>([e,s,i,n]=mt(a),t.add(ft(r(e),s)),i&&t.add(ft(r(e),s,i,n)),t)),new Set).values()].join(" "):gt(t)?([e,s,i,n]=mt(t),l=ft(r(e),s,i,n)):l=t&&bt(t,!0).map((([t,e,s,i])=>ft(r(t),e,s,i))).join(" "),ht({[a]:l},{toString:{value:()=>`${a}="${l}"`}})}):(s=t=>{let e,s,i,n;return gt(t)?([e,s,i,n]=mt(t),$t(r(e),s,i,n)):t&&bt(t).map((([t,e,s,i])=>$t(r(t),e,s,i))).join(",")},i=t=>{let e,s,i,n,a,l,c="";if(Array.isArray(t))l=t.reduce(((t,l)=>{[e,s,i,n]=mt(l);const o=pt(r(e),s);return a=ut(o),c=i?n?`${i}_${n}`:`${i}`:"",t[a]&&c?t[a]=t[a]+" "+c:t[a]=c,t}),{});else if(gt(t)){[e,s,i,n]=mt(t);const o=pt(r(e),s);a=ut(o),c=i?n?`${i}_${n}`:`${i}`:"",l={[a]:c}}else l=t&&bt(t,!0).reduce(((t,[e,s,i,n])=>{const l=pt(r(e),s);a=ut(l);const o=i?n?`${i}_${n}`:`${i}`:"";return c=t[a]?t[a]+" "+o:o,t[a]=c,t}),{});return ht(l,{toString:{value:()=>ct(l).map((([t,e])=>`${t}="${e}"`)).join(" ")}}),l}),{selector:s,attr:i,name:r,varName:n,varExp:(...t)=>`var(${n(...t)})`}}})({mode:this.mode});const s=this;this._n={set adoptedStyleSheets(t){s.dispatchEvent(new CustomEvent("effcsschanges",{detail:{styles:t},bubbles:!0}))}},this._m.register(this._n),this._m.register(e),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>`}}s.define(jt,i,{extends:"script"})}}();
package/dist/consumer.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * EffCSS v3.2.0
2
+ * EffCSS v3.4.0
3
3
  * {@link https://gitverse.ru/msabitov/effcss}
4
4
  * Copyright (c) Marat Sabitov
5
5
  * @license Apache-2.0
6
6
  */
7
- const e=void 0,t=Object.entries,r=Object.defineProperties,n=e=>`data-${e}`,s=e=>"string"==typeof e,u=e=>null!==e&&"object"==typeof e,o=(e,t)=>`${e}${t?"__"+t:""}`,i=e=>e.split("."),a=(r,n)=>t(r).reduce(((r,[s,o])=>{if(u(o)){const i=t(o);i.length?r.push(...i.reduce(((r,[o,i])=>{if((t=>null!==t&&t!==e)(o)&&n&&r.push([s,o,e,e]),u(i)){const e=t(i);e.length&&r.push(...e.reduce(((e,[t,r])=>{const n=typeof r;return"string"!==n&&"number"!==n||e.push([s,o,t,r]),e}),[]))}return r}),[])):r.push([s,e,e,e])}return r}),[]),c=(e,t,r,n)=>""+(o(e,t)+(r?"_"+r:"")+(r&&n?"_"+n:"")),l=(e,t,r,n)=>"."+c(e,t,r,n),d=(e,t,r,s)=>`[${n(o(e,t))}${r&&s?`~="${r}_${s}"`:r?`~="${r}"`:""}]`,p="effcss-provider",m={theme:null,hydrate:null,mode:"a",prefix:"f"};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])))}}},g=(e={})=>{var u;let g,h,y,b,v=null===(u=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===u?void 0:u.querySelector(`script[is=${p}]`);if(v)return v;({prefix:h,mode:y,hydrate:b,theme:g}=Object.assign({},m,e));const j=new Set,x=()=>h||m.prefix,S=()=>y||m.mode,k=()=>""===b,O=$({prefix:x()}),_=((e={})=>{const{mode:u}=e;let p,m;return e=>{const $=(...t)=>""+t.filter(Boolean).reduce(((e,t)=>`${e}-${t}`),e),f=(...e)=>"--"+$(...e);return"c"===u?(p=e=>{let t,r,n,u;return s(e)?([t,r,n,u]=i(e),l($(t),r,n,u)):e&&a(e).map((([e,t,r,n])=>l($(e),t,r,n))).join(",")},m=e=>{let t,n,u,o;const l="class";let d="";return Array.isArray(e)?d=[...e.reduce(((e,r)=>([t,n,u,o]=i(r),e.add(c($(t),n)),u&&e.add(c($(t),n,u,o)),e)),new Set).values()].join(" "):s(e)?([t,n,u,o]=i(e),d=c($(t),n,u,o)):d=e&&a(e,!0).map((([e,t,r,n])=>c($(e),t,r,n))).join(" "),r({[l]:d},{toString:{value:()=>`${l}="${d}"`}})}):(p=e=>{let t,r,n,u;return s(e)?([t,r,n,u]=i(e),d($(t),r,n,u)):e&&a(e).map((([e,t,r,n])=>d($(e),t,r,n))).join(",")},m=e=>{let u,c,l,d,p,m,f="";if(Array.isArray(e))m=e.reduce(((e,t)=>{[u,c,l,d]=i(t);const r=o($(u),c);return p=n(r),f=l?d?`${l}_${d}`:`${l}`:"",e[p]&&f?e[p]=e[p]+" "+f:e[p]=f,e}),{});else if(s(e)){[u,c,l,d]=i(e);const t=o($(u),c);p=n(t),f=l?d?`${l}_${d}`:`${l}`:"",m={[p]:f}}else m=e&&a(e,!0).reduce(((e,[t,r,s,u])=>{const i=o($(t),r);p=n(i);const a=s?u?`${s}_${u}`:`${s}`:"";return f=e[p]?e[p]+" "+a:a,e[p]=f,e}),{});return r(m,{toString:{value:()=>t(m).map((([e,t])=>`${e}="${t}"`)).join(" ")}}),m}),{selector:p,attr:m,name:$,varName:f,varExp:(...e)=>`var(${f(...e)})`}}})({mode:S()}),A=f(),w=e=>"string"==typeof e?e:A.getKey(e),E=e=>_(e||O.base).attr,P=(e,t)=>{const r=t||O.current;let n=A.use(e,r);return t||O.next(),E(n)};return{get prefix(){return x()},get mode(){return S()},get hydrate(){return k()},set theme(e){g=e},get theme(){return g||""},get settings(){return{bp:undefined,vars:undefined,off:[...j],makers:A.makers}},set settings(e){},resolve:E,use:P,usePublic:e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[e,P(t,e)]))),usePrivate:e=>e.map((e=>P(e))),css:()=>"",key:w,status:e=>{const t=w(e);return!!t&&!j.has(t)},on:(...e)=>e.map(w).reduce(((e,t)=>e&&!!t&&j.delete(t)),!0),off:(...e)=>e.map(w).reduce(((e,t)=>e&&!!t&&!!j.add(t)),!0),stylesheets:()=>[],toString(){const e=A.makers;delete e[O.base];const t=Object.entries({is:p,prefix:x(),mode:S(),hydrate:k(),theme:g}).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," ")}`),""):""}},${j.size?` off: [${[...j]}]`:""}}`;return`<script ${t}>${r}<\/script>`}}};export{g as createConsumer};
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:""}`,o=e=>e.split("."),l=(r,n)=>t(r).reduce(((r,[s,i])=>{if(u(i)){const o=t(i);o.length?r.push(...o.reduce(((r,[i,o])=>{if((t=>null!==t&&t!==e)(i)&&n&&r.push([s,i,e,e]),u(o)){const e=t(o);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),d=(e,t,r,s)=>`[${n(i(e,t))}${r&&s?`~="${r}_${s}"`:r?`~="${r}"`:""}]`,m="effcss-provider",p={theme:null,hydrate:null,mode:"a",prefix:"f",size:null,time:null};Number(146.2.toFixed(2)),Number(256..toFixed(2)),Number((.1*184+.9*109).toFixed(2)),Number(44.5.toFixed(2));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}}},g=()=>{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])))}}},f=e=>null==e?null:Number(e),b=(e={})=>{var u;let b,h,y,v,j,x,S=null===(u=null===globalThis||void 0===globalThis?void 0:globalThis.document)||void 0===u?void 0:u.querySelector(`script[is=${m}]`);if(S)return S;({prefix:h,mode:y,hydrate:v,theme:b,size:j,time:x}=Object.assign({},p,e));let k,O,_,z=f(j),A=f(x);const N=new Set,w=()=>h||p.prefix,F=()=>y||p.mode,E=()=>""===v,P=$({prefix:w()}),T=((e={})=>{const{mode:u}=e;let m,p;return e=>{const $=(...t)=>""+t.filter(Boolean).reduce(((e,t)=>`${e}-${t}`),e),g=(...e)=>"--"+$(...e);return"c"===u?(m=e=>{let t,r,n,u;return s(e)?([t,r,n,u]=o(e),c($(t),r,n,u)):e&&l(e).map((([e,t,r,n])=>c($(e),t,r,n))).join(",")},p=e=>{let t,n,u,i;const c="class";let d="";return Array.isArray(e)?d=[...e.reduce(((e,r)=>([t,n,u,i]=o(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]=o(e),d=a($(t),n,u,i)):d=e&&l(e,!0).map((([e,t,r,n])=>a($(e),t,r,n))).join(" "),r({[c]:d},{toString:{value:()=>`${c}="${d}"`}})}):(m=e=>{let t,r,n,u;return s(e)?([t,r,n,u]=o(e),d($(t),r,n,u)):e&&l(e).map((([e,t,r,n])=>d($(e),t,r,n))).join(",")},p=e=>{let u,a,c,d,m,p,g="";if(Array.isArray(e))p=e.reduce(((e,t)=>{[u,a,c,d]=o(t);const r=i($(u),a);return m=n(r),g=c?d?`${c}_${d}`:`${c}`:"",e[m]&&g?e[m]=e[m]+" "+g:e[m]=g,e}),{});else if(s(e)){[u,a,c,d]=o(e);const t=i($(u),a);m=n(t),g=c?d?`${c}_${d}`:`${c}`:"",p={[m]:g}}else p=e&&l(e,!0).reduce(((e,[t,r,s,u])=>{const o=i($(t),r);m=n(o);const l=s?u?`${s}_${u}`:`${s}`:"";return g=e[m]?e[m]+" "+l:l,e[m]=g,e}),{});return r(p,{toString:{value:()=>t(p).map((([e,t])=>`${e}="${t}"`)).join(" ")}}),p}),{selector:m,attr:p,name:$,varName:g,varExp:(...e)=>`var(${g(...e)})`}}})({mode:F()}),B=g(),K=e=>"string"==typeof e?e:B.getKey(e),M=e=>T(e||P.base).attr,q=(e,t)=>{const r=t||P.current;let n=B.use(e,r);return t||P.next(),M(n)};return{get prefix(){return w()},get mode(){return F()},get hydrate(){return E()},set theme(e){b=e},get theme(){return b||""},get size(){return z},set size(e){z=e},get time(){return A},set time(e){A=e},get settings(){return{bp:_,vars:O,off:[...N],makers:B.makers,palette:k}},set settings(e){({bp:_,vars:O,palette:k}=e)},resolve:M,use:q,usePublic:e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[e,q(t,e)]))),usePrivate:e=>e.map((e=>q(e))),css:()=>"",key:K,status:e=>{const t=K(e);return!!t&&!N.has(t)},on:(...e)=>e.map(K).reduce(((e,t)=>e&&!!t&&N.delete(t)),!0),off:(...e)=>e.map(K).reduce(((e,t)=>e&&!!t&&!!N.add(t)),!0),stylesheets:()=>[],toString(){const e=B.makers;delete e[P.base];const t=Object.entries({is:m,prefix:w(),mode:F(),hydrate:E(),theme:b,size:null!==z&&String(z),time:null!==A&&String(A)}).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," ")}`),""):""}},${O?` vars: ${O},`:""}${_?` bp: ${_},`:""}${k?` palette: ${k},`:""}${N.size?` off: [${[...N]}]`:""}}`;return`<script ${t}>${r}<\/script>`}}};export{b as createConsumer};
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * EffCSS v3.2.0
2
+ * EffCSS v3.4.0
3
3
  * {@link https://gitverse.ru/msabitov/effcss}
4
4
  * Copyright (c) Marat Sabitov
5
5
  * @license Apache-2.0
6
6
  */
7
- "function"==typeof SuppressedError&&SuppressedError;const t="@media",e="@container",s="@property",r="@keyframes",n="@layer",i="@scope",o="@supports",c=(e,s)=>{const r=t+` ${s||""}${s?" and ":""}(${e})`;return{s:r,q:e,t:s,toString:()=>r}};c.toString=()=>t;const a=t=>t+"px",l=t=>t+"vh",h=t=>t+"vw",u=t=>t+"vmin",d=t=>t+"vmax",p=t=>t+"rem",m=t=>t+"deg",f=t=>t+"ms",g=t=>t+"%",$=t=>t+"cqw",v=t=>t+"cqh",y=t=>t+"cqi",b=t=>t+"cqb",_=t=>t+"cqmin",k=t=>t+"cqmax",x=Object.fromEntries,S=Object.entries,j=":first-",w=":last-",q=":only-",O="child",A=":nth-",E="of-type",P=A+O,C=":focus",I={r:":root",h:":hover",f:C,fv:C+"-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:j+O,lc:w+O,oc:q+O,odd:P+"(odd)",even:P+"(even)",ft:j+E,lt:w+E,ot:q+E,bef:"::before",aft:"::after",bd:"::backdrop"},W={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:P,ntho:A+E,dir:":dir",lang:":lang"},K="oklch",M=t=>K+`(${t})`,B=t=>M(`from ${t}`),L="def",N=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",L),c:e("c",L),h:e("h",L),a:e("a",L)},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 M(`${t} ${e} ${s} / ${r}`)}}return t=>new s(t)},R=(t,e=.1)=>B(`${t} calc(l + ${e}) c h / alpha)`),z=(t,e=.1)=>B(`${t} calc(l - ${e}) c h / alpha)`),H=(t,e=.1)=>B(`${t} l c h / calc(alpha + ${e}))`),T=(t,e=.1)=>B(`${t} l c h / calc(alpha - ${e}))`),V=(t,e=.04)=>B(`${t} l calc(c + ${e}) h / alpha)`),Z=(t,e=.04)=>B(`${t} l calc(c - ${e}) h / alpha)`),D=(t,e=30)=>B(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),F=({base:t,mixin:e,method:s,bpart:r,mpart:n})=>`color-mix(in ${s||K}, ${t}${void 0!==r?` ${r}%`:""}, ${e}${void 0!==n?` ${n}%`:""})`,G=t=>({create:N(t),oklch:M,lighten:R,darken:z,saturate:V,desaturate:Z,fadein:H,fadeout:T,spin:D,mix:F}),J=Object.assign,Q=Object.entries,U=Array.isArray,X=(t,...e)=>e.length?e.reduce(((t,e)=>(Q(e).forEach((([e,s])=>{s&&"object"==typeof s&&t[e]?U(t[e])&&U(s)?t[e]=[...t[e],...s]:X(t[e],s||{}):t[e]=s})),t)),t):t,Y=(t,e,s)=>Object.entries(t).reduce(e,s),tt=(t,e,s)=>{var r,n,i;let o=""+t;return null==e?"":"object"==typeof e?(!s||(null===(r=s.startsWith)||void 0===r?void 0:r.call(s,"@"))||(null===(n=o.startsWith)||void 0===n?void 0:n.call(o,"&"))||(null===(i=o.startsWith)||void 0===i?void 0:i.call(o,"@"))?"":"&")+o+`{${Y(e,((t,e)=>t+tt(...e,o)),"")}}`:`${c=o,c.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}:${""+e};`;var c},et={dash:(...t)=>t.join("-"),comma:(...t)=>t.join(),space:(...t)=>t.join(" "),range:(t,e)=>Array.from(Array(t).entries()).reduce(((t,[s])=>J(t,e(s+1))),{}),each:(t,e)=>Q(t).reduce(((t,[s,r])=>J(t,e(s,r))),{}),merge:X,when:(t,e,s={})=>t?e:s},st="width: ",rt=t=>{const{scope:j,globalKey:w="",bp:q={}}=t,O=j(w),A=t=>O.varExp(...t.split(".")),E=t=>`calc(${t} * ${A("rtime")})`;return{compile:({key:t,maker:w})=>{const P=j(t),C=(t=>{const a={cp:1,lay:1,kf:1,cq:1},l=(s,r)=>{const n="string"==typeof r?r:t.name("cq",a.cq++),i=e+` ${n?n+" ":""}(${s})`;return{c:n,q:s,s:i,toString:()=>i}};l.toString=()=>e;const h=(e,r)=>{const n="--"+(e||t.name("cp",a.cp++)),i=s+" "+n;return{k:n,v:`var(${n})`,s:i,r:{[i]:{syntax:(null==r?void 0:r.syn)||'"*"',inherits:(null==r?void 0:r.inh)||!1,initialValue:null==r?void 0:r.ini}},toString:()=>i}};h.toString=()=>s;const u=e=>{const s=e||t.name("kf",a.kf++),n=r+" "+s;return{k:s,s:n,toString:()=>n}};u.toString=()=>r;const d=e=>{const s=e||t.name("lay",a.lay++),r=n+" "+s;return{k:s,s:r,toString:()=>r}};d.toString=()=>n,d.toString=()=>i;const p=(t="",e=!1)=>{const s=o+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return p.toString=()=>o,{pr:h,kf:u,mq:c,cq:l,lay:d,sc:(t="",e="")=>{const s=i+` ${t?`(${t})`:""}${t&&e?" ":""}${e?`to (${e})`:""}`;return{r:t,l:e,s:s,toString:()=>s}},sup:p}})(P),K=t=>{const e=q[t]||t;return"number"==typeof e?e+"rem":""},M=t=>"min-"+st+K(t),B=t=>"max-"+st+K(t),L=(t,e)=>"string"==typeof e?C.cq(t,e):C.mq(t),N=(t,e,s)=>""+L(M(t)+") and ("+B(e),s),R={up:(t,e)=>""+L(M(t),e),down:(t,e)=>""+L(B(t),e),between:N,only:(t,e)=>N(t,t,e)};return z=w(Object.assign(et,{key:t,vars:A,time:E,bem:P.selector,pseudo:Object.assign(x(S(I).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),x(S(W).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:G(O.varExp),units:{px:a,vh:l,vw:h,vmin:u,vmax:d,rem:p,deg:m,ms:f,pc:g,cqw:$,cqh:v,cqb:b,cqi:y,cqmin:_,cqmax:k},at:C,limit:R})),Y(z,((t,e)=>t+tt(...e)),"");var z}}};const nt=void 0,it=Object.entries,ot=Object.defineProperties,ct=t=>`data-${t}`,at=t=>"string"==typeof t,lt=t=>null!==t&&"object"==typeof t,ht=(t,e)=>`${t}${e?"__"+e:""}`,ut=t=>t.split("."),dt=(t,e)=>it(t).reduce(((t,[s,r])=>{if(lt(r)){const n=it(r);n.length?t.push(...n.reduce(((t,[r,n])=>{if((t=>null!==t&&t!==nt)(r)&&e&&t.push([s,r,nt,nt]),lt(n)){const e=it(n);e.length&&t.push(...e.reduce(((t,[e,n])=>{const i=typeof n;return"string"!==i&&"number"!==i||t.push([s,r,e,n]),t}),[]))}return t}),[])):t.push([s,nt,nt,nt])}return t}),[]),pt=(t,e,s,r)=>""+(ht(t,e)+(s?"_"+s:"")+(s&&r?"_"+r:"")),mt=(t,e,s,r)=>"."+pt(t,e,s,r),ft=(t,e,s,r)=>`[${ct(ht(t,e))}${s&&r?`~="${s}_${r}"`:s?`~="${s}"`:""}]`,gt={def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},$t="effcss-provider",vt={theme:null,hydrate:null,mode:"a",prefix:"f"},yt={bp:{"3xs":18,"2xs":24,xs:30,sm:40,md:48,lg:64,xl:80,"2xl":96},vars:{"":{rtime:"200ms",rem:16,l:gt,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:gt},dark:{l:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}}},bt=({prefix:t})=>{let e=1;return{get base(){return t+0},get current(){return t+e},next(){return e++,this.current},reset(){e=1}}},_t=()=>{const t=new Set,e=new Map;return{use(s,r){const n=e.get(s);return n||(t.add(r),e.set(s,r),r)},useMany(t){return it(t).map((([t,e])=>this.use(e,t)))},getKey:t=>e.get(t),get keys(){return[...t]},get makers(){return Object.fromEntries(e.entries().map((([t,e])=>[e,t])))}}},kt="theme",xt=Object.assign,St=Object.entries,jt=Object.fromEntries,wt=(t,e)=>t.getAttribute(e)||vt[e];function qt(t={}){const e=window.document,s=window.customElements;if(null==s?void 0:s.get($t))return!1;{class r extends HTMLScriptElement{constructor(){super(...arguments),this._c=_t(),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]},o=()=>{r=r.reduce(((t,e)=>{const s=e.deref();return s&&(i(s),t.push(e)),t}),[])},c=t=>s.findIndex((e=>e===t)),a=e=>e?t[e]:void 0,l=(e,r)=>{if(!t[e])return t[e]=n(e,r),s.push(t[e]),o(),!0},h=t=>{const e=a(t);return!!e&&-1!==c(e)};return{apply:i,notify:o,getIndex:c,get:a,has:t=>!!t&&!!a(t),getAll:()=>t,add:l,status:h,on:(...t)=>{const e=t.reduce(((t,e)=>{const r=a(e);return!(!r||h(e))&&(s.push(r),t)}),!0);return o(),e},off:(...t)=>{const e=t.reduce(((t,e)=>{const r=a(e);if(r&&h(e)){const e=c(r);return s.splice(e,1),t}return!1}),!0);return o(),e},remove:r=>{const n=a(r);if(!n)return;const i=c(n);return i>-1&&(s.splice(i,1),delete t[r],delete e[r]),o(),!0},removeAll:()=>(s.splice(0),t={},e={},o(),!0),pack:(t,e)=>{let s=new CSSStyleSheet;return s.replaceSync(e),s=n(t,s),!!s.cssRules.length&&l(t,s)},replace:(e,s)=>{const r=t[e];if(r)return r.replaceSync(s),o(),!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._cust=(t={})=>{const{varName:e}=this._s(this._k.base);function s(t,r){return St(t).reduce(((t,[n,i])=>i&&"object"==typeof i?xt(t,s(i,[...r,n])):(t[e(...r,n)]=i,t)),{})}const r=jt(St(t||{}).map((([t,e])=>[t,s(e,[])]))),{"":n={},dark:i,light:o}=r,c=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}(r,["","dark","light"]);this._=({bem:t,each:e,when:s,vars:r,merge:a,at:{mq:l}})=>{const h="prefers-color-scheme",u={light:`${h}: light`,dark:`${h}: dark`};return a({[`:root:has(script[is=${$t}])`]:a({fontSize:r("rem")},n)},s(!!i,{[l(u.dark).s]:i}),s(!!o,{[l(u.light).s]:o}),e(c,((e,s)=>({[`:root:has(script[is=${$t}][${kt}=${e}])`]:s,[t(`..theme.${e}`)]:s}))))},this.use(this._,this._k.base)},this.use=(t,e)=>{const s=e||this._k.current;let r=this._c.use(t,s);return this._m&&!this._m.has(e)&&this._m.pack(r,this.css(t,r)),e||this._k.next(),this.resolve(r)},this.usePublic=t=>jt(St(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))))}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=xt({},this._settings,t),{makers:i,vars:o,bp:c,off:a}=n;c&&(null===(e=this._settings)||void 0===e?void 0:e.bp)!==c&&(this._p=rt({scope:this._s,globalKey:this._k.base,bp:c})),o&&(null===(s=this._settings)||void 0===s?void 0:s.vars)!==o&&this._cust(o),i&&(null===(r=this._settings)||void 0===r?void 0:r.makers)!==i&&(this._c.useMany(i),this.usePublic(i),(null==a?void 0:a.length)&&this._settings.off!==a&&this.off(...a),this.hydrate&&this._k.reset()),this._settings=n}set theme(t){t?this.setAttribute(kt,t):this.removeAttribute(kt)}get theme(){return wt(this,kt)||""}connectedCallback(){this._k=bt({prefix:this.prefix}),this._s=((t={})=>{const{mode:e}=t;let s,r;return t=>{const n=(...e)=>""+e.filter(Boolean).reduce(((t,e)=>`${t}-${e}`),t),i=(...t)=>"--"+n(...t);return"c"===e?(s=t=>{let e,s,r,i;return at(t)?([e,s,r,i]=ut(t),mt(n(e),s,r,i)):t&&dt(t).map((([t,e,s,r])=>mt(n(t),e,s,r))).join(",")},r=t=>{let e,s,r,i;const o="class";let c="";return Array.isArray(t)?c=[...t.reduce(((t,o)=>([e,s,r,i]=ut(o),t.add(pt(n(e),s)),r&&t.add(pt(n(e),s,r,i)),t)),new Set).values()].join(" "):at(t)?([e,s,r,i]=ut(t),c=pt(n(e),s,r,i)):c=t&&dt(t,!0).map((([t,e,s,r])=>pt(n(t),e,s,r))).join(" "),ot({[o]:c},{toString:{value:()=>`${o}="${c}"`}})}):(s=t=>{let e,s,r,i;return at(t)?([e,s,r,i]=ut(t),ft(n(e),s,r,i)):t&&dt(t).map((([t,e,s,r])=>ft(n(t),e,s,r))).join(",")},r=t=>{let e,s,r,i,o,c,a="";if(Array.isArray(t))c=t.reduce(((t,c)=>{[e,s,r,i]=ut(c);const l=ht(n(e),s);return o=ct(l),a=r?i?`${r}_${i}`:`${r}`:"",t[o]&&a?t[o]=t[o]+" "+a:t[o]=a,t}),{});else if(at(t)){[e,s,r,i]=ut(t);const l=ht(n(e),s);o=ct(l),a=r?i?`${r}_${i}`:`${r}`:"",c={[o]:a}}else c=t&&dt(t,!0).reduce(((t,[e,s,r,i])=>{const c=ht(n(e),s);o=ct(c);const l=r?i?`${r}_${i}`:`${r}`:"";return a=t[o]?t[o]+" "+l:l,t[o]=a,t}),{});return ot(c,{toString:{value:()=>it(c).map((([t,e])=>`${t}="${e}"`)).join(" ")}}),c}),{selector:s,attr:r,name:n,varName:i,varExp:(...t)=>`var(${i(...t)})`}}})({mode:this.mode});const s=this;this._n={set adoptedStyleSheets(t){s.dispatchEvent(new CustomEvent("effcsschanges",{detail:{styles:t},bubbles:!0}))}},this._m.register(this._n),this._m.register(e),this.settings=xt({},yt,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 s.define($t,r,{extends:"script"}),!0}}export{qt as defineProvider};
7
+ "function"==typeof SuppressedError&&SuppressedError;const t="@media",e="@container",s="@property",i="@keyframes",r="@layer",n="@scope",a="@supports",l=(e,s)=>{const i=t+` ${s||""}${s?" and ":""}(${e})`;return{s:i,q:e,t:s,toString:()=>i}};l.toString=()=>t;const c=t=>t+"px",o=t=>t+"vh",h=t=>t+"vw",u=t=>t+"vmin",g=t=>t+"vmax",d=t=>t+"rem",p=t=>t+"deg",m=t=>t+"ms",b=t=>t+"%",f=t=>t+"cqw",v=t=>t+"cqh",$=t=>t+"cqi",y=t=>t+"cqb",j=t=>t+"cqmin",x=t=>t+"cqmax",O=Object.fromEntries,k=Object.entries,_=":first-",w=":last-",S=":only-",q="child",A=":nth-",E="of-type",z=A+q,P=":focus",N={r:":root",h:":hover",f:P,fv:P+"-visible",a:":active",v:":visited",val:":valid",inv:":invalid",e:":empty",d:":disabled",rq:":required",o:":optional",m:":modal",l:":link",ph:":placeholder",ch:":checked",po:":popover-open",fc:_+q,lc:w+q,oc:S+q,odd:z+"(odd)",even:z+"(even)",ft:_+E,lt:w+E,ot:S+E,bef:"::before",aft:"::after",bd:"::backdrop"},C={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:z,ntho:A+E,dir:":dir",lang:":lang"},I="oklch",W=t=>I+`(${t})`,F=t=>W(`from ${t}`),K="def",M=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",K),c:e("c",K),h:e("h",K),a:e("a",K)},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:i}=this.state;return W(`${t} ${e} ${s} / ${i}`)}}return t=>new s(t)},B=(t,e=.1)=>F(`${t} calc(l + ${e}) c h / alpha)`),L=(t,e=.1)=>F(`${t} calc(l - ${e}) c h / alpha)`),R=(t,e=.1)=>F(`${t} l c h / calc(alpha + ${e}))`),H=(t,e=.1)=>F(`${t} l c h / calc(alpha - ${e}))`),T=(t,e=.04)=>F(`${t} l calc(c + ${e}) h / alpha)`),V=(t,e=.04)=>F(`${t} l calc(c - ${e}) h / alpha)`),Z=(t,e=30)=>F(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),D=({base:t,mixin:e,method:s,bpart:i,mpart:r})=>`color-mix(in ${s||I}, ${t}${void 0!==i?` ${i}%`:""}, ${e}${void 0!==r?` ${r}%`:""})`,G=t=>({create:M(t),oklch:W,lighten:B,darken:L,saturate:T,desaturate:V,fadein:R,fadeout:H,spin:Z,mix:D}),J=(t,e,s)=>Object.entries(t).reduce(e,s),Q=Symbol("noParse"),U=(t,e,s)=>{var i,r,n;let a=""+t;return null==e?"":"object"!=typeof e||e.hasOwnProperty(Q)?`${l=a,l.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}:${""+e};`:(!s||(null===(i=s.startsWith)||void 0===i?void 0:i.call(s,"@"))||(null===(r=a.startsWith)||void 0===r?void 0:r.call(a,"&"))||(null===(n=a.startsWith)||void 0===n?void 0:n.call(a,"@"))?"":"&")+a+`{${J(e,((t,e)=>t+U(...e,a)),"")}}`;var l},X="palette",Y=t=>{const e={pri:t(X,"h","pri"),sec:t(X,"h","sec"),ter:t(X,"h","ter"),suc:t(X,"h","suc"),inf:t(X,"h","inf"),war:t(X,"h","war"),dan:t(X,"h","dan")};class s{constructor(t={}){this.state={l:"l",c:"base",h:e.pri,a:1,m:"bg"},Object.assign(this,{[Q]:!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:i,a:r,m:n}=this.state;return`oklch(${t(X,"l",n,e)} ${t(X,"c",n,s)} ${i} / ${r})`}}return new s},tt=Object.assign,et=Object.entries,st=Array.isArray,it=(t,...e)=>e.length?e.reduce(((t,e)=>(et(e).forEach((([e,s])=>{s&&"object"==typeof s&&t[e]?st(t[e])&&st(s)?t[e]=[...t[e],...s]:it(t[e],s||{}):t[e]=s})),t)),t):t,rt={dash:(...t)=>t.join("-"),comma:(...t)=>t.join(),space:(...t)=>t.join(" "),range:(t,e)=>Array.from(Array(t).entries()).reduce(((t,[s])=>tt(t,e(s+1))),{}),each:(t,e)=>et(t).reduce(((t,[s,i])=>tt(t,e(s,i))),{}),merge:it,when:(t,e,s={})=>t?e:s},nt="width: ",at=t=>{const{scope:_,globalKey:w="",bp:S={}}=t,q=_(w),A=t=>q.varExp(...t.split(".")),E=(t=1)=>`calc(${t} * ${A("rtime")})`;return{compile:({key:t,maker:w})=>{const z=_(t),P=(t=>{const c={cp:1,lay:1,kf:1,cq:1},o=(s,i)=>{const r="string"==typeof i?i:t.name("cq",c.cq++),n=e+` ${r?r+" ":""}(${s})`;return{c:r,q:s,s:n,toString:()=>n}};o.toString=()=>e;const h=(e,i)=>{const r="--"+(e||t.name("cp",c.cp++)),n=s+" "+r;return{k:r,v:`var(${r})`,s:n,r:{[n]:{syntax:(null==i?void 0:i.syn)||'"*"',inherits:(null==i?void 0:i.inh)||!1,initialValue:null==i?void 0:i.ini}},toString:()=>n}};h.toString=()=>s;const u=e=>{const s=e||t.name("kf",c.kf++),r=i+" "+s;return{k:s,s:r,toString:()=>r}};u.toString=()=>i;const g=e=>{const s=e||t.name("lay",c.lay++),i=r+" "+s;return{k:s,s:i,toString:()=>i}};g.toString=()=>r,g.toString=()=>n;const d=(t="",e=!1)=>{const s=a+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return d.toString=()=>a,{pr:h,kf:u,mq:l,cq:o,lay:g,sc:(t="",e="")=>{const s=n+` ${t?`(${t})`:""}${t&&e?" ":""}${e?`to (${e})`:""}`;return{r:t,l:e,s:s,toString:()=>s}},sup:d}})(z),I=t=>{const e=S[t]||t;return"number"==typeof e?e+"rem":""},W=t=>"min-"+nt+I(t),F=t=>"max-"+nt+I(t),K=(t,e)=>"string"==typeof e?P.cq(t,e):P.mq(t),M=(t,e,s)=>""+K(W(t)+") and ("+F(e),s),B={up:(t,e)=>""+K(W(t),e),down:(t,e)=>""+K(F(t),e),between:M,only:(t,e)=>M(t,t,e)};return L=w(Object.assign(rt,{key:t,vars:A,time:E,bem:z.selector,pseudo:Object.assign(O(k(N).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),O(k(C).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:G(q.varExp),palette:Y(q.varExp),units:{px:c,vh:o,vw:h,vmin:u,vmax:g,rem:d,deg:p,ms:m,pc:b,cqw:f,cqh:v,cqb:y,cqi:$,cqmin:j,cqmax:x},at:P,limit:B})),J(L,((t,e)=>t+U(...e)),"");var L}}};const lt=void 0,ct=Object.entries,ot=Object.assign,ht=Object.defineProperties,ut=t=>`data-${t}`,gt=t=>"string"==typeof t,dt=t=>null!==t&&"object"==typeof t,pt=(t,e)=>`${t}${e?"__"+e:""}`,mt=t=>t.split("."),bt=(t,e)=>ct(t).reduce(((t,[s,i])=>{if(dt(i)){const r=ct(i);r.length?t.push(...r.reduce(((t,[i,r])=>{if((t=>null!==t&&t!==lt)(i)&&e&&t.push([s,i,lt,lt]),dt(r)){const e=ct(r);e.length&&t.push(...e.reduce(((t,[e,r])=>{const n=typeof r;return"string"!==n&&"number"!==n||t.push([s,i,e,r]),t}),[]))}return t}),[])):t.push([s,lt,lt,lt])}return t}),[]),ft=(t,e,s,i)=>""+(pt(t,e)+(s?"_"+s:"")+(s&&i?"_"+i:"")),vt=(t,e,s,i)=>"."+ft(t,e,s,i),$t=(t,e,s,i)=>`[${ut(pt(t,e))}${s&&i?`~="${s}_${i}"`:s?`~="${s}"`:""}]`,yt={def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},jt="effcss-provider",xt={theme:null,hydrate:null,mode:"a",prefix:"f",size:null,time:null},Ot={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))}},kt=(t,e)=>{var s,i,r,n,a,l,c,o,h,u,g,d,p,m,b,f;return e?{l:{dark:{bg:ot(t.l.dark.bg,null===(i=null===(s=null==e?void 0:e.l)||void 0===s?void 0:s.dark)||void 0===i?void 0:i.bg),fg:ot(t.l.dark.fg,null===(n=null===(r=null==e?void 0:e.l)||void 0===r?void 0:r.dark)||void 0===n?void 0:n.fg)},light:{bg:ot(t.l.light.bg,null===(l=null===(a=null==e?void 0:e.l)||void 0===a?void 0:a.light)||void 0===l?void 0:l.bg),fg:ot(t.l.light.fg,null===(o=null===(c=null==e?void 0:e.l)||void 0===c?void 0:c.light)||void 0===o?void 0:o.fg)}},c:{dark:{bg:ot(t.c.dark.bg,null===(u=null===(h=null==e?void 0:e.c)||void 0===h?void 0:h.dark)||void 0===u?void 0:u.bg),fg:ot(t.c.dark.fg,null===(d=null===(g=null==e?void 0:e.c)||void 0===g?void 0:g.dark)||void 0===d?void 0:d.fg)},light:{bg:ot(t.c.light.bg,null===(m=null===(p=null==e?void 0:e.c)||void 0===p?void 0:p.light)||void 0===m?void 0:m.bg),fg:ot(t.c.light.fg,null===(f=null===(b=null==e?void 0:e.c)||void 0===b?void 0:b.light)||void 0===f?void 0:f.fg)}},h:ot(t.h,null==e?void 0:e.h)}:t},_t={bp:{"3xs":18,"2xs":24,xs:30,sm:40,md:48,lg:64,xl:80,"2xl":96},vars:{"":{rtime:"200ms",rem:"16px",l:yt,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:yt},dark:{l:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}},palette:Ot},wt=({prefix:t})=>{let e=1;return{get base(){return t+0},get current(){return t+e},next(){return e++,this.current},reset(){e=1}}},St=()=>{const t=new Set,e=new Map;return{use(s,i){const r=e.get(s);return r||(t.add(i),e.set(s,i),i)},useMany(t){return ct(t).map((([t,e])=>this.use(e,t)))},getKey:t=>e.get(t),get keys(){return[...t]},get makers(){return Object.fromEntries(e.entries().map((([t,e])=>[e,t])))}}},qt="theme",At="palette",Et=Object.assign,zt=Object.entries,Pt=Object.fromEntries,Nt=(t,e)=>t.getAttribute(e)||xt[e];function Ct(t={}){const e=window.document,s=window.customElements;if(null==s?void 0:s.get(jt))return!1;{class i extends HTMLScriptElement{constructor(){super(...arguments),this._c=St(),this._m=function(){let t={},e={},s=[],i=[];const r=(t,e)=>(e.toString=()=>"effcss-"+t,e),n=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=()=>{i=i.reduce(((t,e)=>{const s=e.deref();return s&&(n(s),t.push(e)),t}),[])},l=t=>s.findIndex((e=>e===t)),c=e=>e?t[e]:void 0,o=(e,i)=>{if(!t[e])return t[e]=r(e,i),s.push(t[e]),a(),!0},h=t=>{const e=c(t);return!!e&&-1!==l(e)};return{apply:n,notify:a,getIndex:l,get:c,has:t=>!!t&&!!c(t),getAll:()=>t,add:o,status:h,on:(...t)=>{const e=t.reduce(((t,e)=>{const i=c(e);return!(!i||h(e))&&(s.push(i),t)}),!0);return a(),e},off:(...t)=>{const e=t.reduce(((t,e)=>{const i=c(e);if(i&&h(e)){const e=l(i);return s.splice(e,1),t}return!1}),!0);return a(),e},remove:i=>{const r=c(i);if(!r)return;const n=l(r);return n>-1&&(s.splice(n,1),delete t[i],delete e[i]),a(),!0},removeAll:()=>(s.splice(0),t={},e={},a(),!0),pack:(e,s)=>{let i=t[e]||new CSSStyleSheet;return i.replaceSync(s),i=r(e,i),!!i.cssRules.length&&o(e,i)},replace:(e,s)=>{const i=t[e];if(i)return i.replaceSync(s),a(),!0},register:t=>{i.findIndex((e=>e.deref()===t))>=0||(i.push(new WeakRef(t)),n(t))},unregister:t=>{const e=i.findIndex((e=>e.deref()===t));e>=0&&i.splice(e,1)}}}(),this._settings=_t,this._cust=()=>{var t;const e=null===(t=this._settings)||void 0===t?void 0:t.vars,{varName:s}=this._s(this._k.base);function i(t,e){return zt(t).reduce(((t,[r,n])=>n&&"object"==typeof n?Et(t,i(n,[...e,r])):(t[s(...e,r)]=n,t)),{})}const r=Pt(zt(e||{}).map((([t,e])=>[t,i(e,[])]))),{"":n={},dark:a,light:l}=r,c=function(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s}(r,["","dark","light"]),o=this.size,h=this.time,{l:u,c:g,h:d}=this._settings.palette,p=["xs","s","m","l","xl"],m=["pale","base","rich"];this._=({bem:t,each:e,when:i,vars:a,merge:l,at:{mq:b},units:{px:f,ms:v,pc:$}})=>{const y="prefers-color-scheme",j={light:`${y}: light`,dark:`${y}: dark`};return l({[`:root:has(script[is=${jt}])`]:l({fontSize:a("rem")},n,e(d,((t,e)=>({[s(At,"h",t)]:e}))),{[s(At,"c","bg","gray")]:0,[s(At,"c","fg","gray")]:0},e(j,((t,i)=>({[b(i).s]:l(r[t]||{},e(p,((e,i)=>({[s(At,"l","bg",i)]:u[t].bg[i],[s(At,"l","fg",i)]:u[t].fg[i]}))),e(m,((e,i)=>({[s(At,"c","bg",i)]:g[t].bg[i],[s(At,"c","fg",i)]:g[t].fg[i]}))))}))))},e(c,((e,s)=>({[`:root:has(script[is=${jt}][${qt}=${e}])`]:s,[t(`..theme.${e}`)]:s}))),i(!!o,{[`:root:has(script[is=${jt}][size])`]:{[s("","rem")]:f(o)}}),i(!!h,{[`:root:has(script[is=${jt}][time])`]:{[s("","rtime")]:v(h)}}))},this.use(this._,this._k.base,!0)},this.use=(t,e,s)=>{const i=e||this._k.current;let r=this._c.use(t,i);return(s||this._m&&!this._m.has(e))&&this._m.pack(r,this.css(t,r)),e||this._k.next(),this.resolve(r)},this.usePublic=t=>Pt(zt(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["size","time"]}get prefix(){return Nt(this,"prefix")||""}get mode(){return Nt(this,"mode")}get hydrate(){return""===this.getAttribute("hydrate")}get settings(){return this._settings}set settings(t){var e,s,i,r,n;const a=Et({},this._settings,t,{palette:kt(this._settings.palette,null==t?void 0:t.palette)}),{makers:l,vars:c,bp:o,off:h,palette:u}=a;(o&&(null===(e=this._settings)||void 0===e?void 0:e.bp)!==o||!this._p)&&(this._p=at({scope:this._s,globalKey:this._k.base,bp:o})),l&&(null===(s=this._settings)||void 0===s?void 0:s.makers)!==l&&(this._c.useMany(l),this.usePublic(l),(null==h?void 0:h.length)&&this._settings.off!==h&&this.off(...h),this.hydrate&&this._k.reset()),this._settings=a,(!(null===(i=this._m)||void 0===i?void 0:i.has(this._k.base))||c&&(null===(r=this._settings)||void 0===r?void 0:r.vars)!==c||u&&(null===(n=this._settings)||void 0===n?void 0:n.palette)!==u)&&this._cust()}set theme(t){t?this.setAttribute(qt,t):this.removeAttribute(qt)}get theme(){return Nt(this,qt)||""}set size(t){null===t?this.removeAttribute("size"):this.setAttribute("size",t+"")}get size(){const t=this.getAttribute("size");return null!==t?Number(t):null}set time(t){null===t?this.removeAttribute("time"):this.setAttribute("time",t+"")}get time(){const t=this.getAttribute("time");return null!==t?Number(t):null}attributeChangedCallback(){this._k&&this._cust()}connectedCallback(){this._k=wt({prefix:this.prefix}),this._s=((t={})=>{const{mode:e}=t;let s,i;return t=>{const r=(...e)=>""+e.filter(Boolean).reduce(((t,e)=>`${t}-${e}`),t),n=(...t)=>"--"+r(...t);return"c"===e?(s=t=>{let e,s,i,n;return gt(t)?([e,s,i,n]=mt(t),vt(r(e),s,i,n)):t&&bt(t).map((([t,e,s,i])=>vt(r(t),e,s,i))).join(",")},i=t=>{let e,s,i,n;const a="class";let l="";return Array.isArray(t)?l=[...t.reduce(((t,a)=>([e,s,i,n]=mt(a),t.add(ft(r(e),s)),i&&t.add(ft(r(e),s,i,n)),t)),new Set).values()].join(" "):gt(t)?([e,s,i,n]=mt(t),l=ft(r(e),s,i,n)):l=t&&bt(t,!0).map((([t,e,s,i])=>ft(r(t),e,s,i))).join(" "),ht({[a]:l},{toString:{value:()=>`${a}="${l}"`}})}):(s=t=>{let e,s,i,n;return gt(t)?([e,s,i,n]=mt(t),$t(r(e),s,i,n)):t&&bt(t).map((([t,e,s,i])=>$t(r(t),e,s,i))).join(",")},i=t=>{let e,s,i,n,a,l,c="";if(Array.isArray(t))l=t.reduce(((t,l)=>{[e,s,i,n]=mt(l);const o=pt(r(e),s);return a=ut(o),c=i?n?`${i}_${n}`:`${i}`:"",t[a]&&c?t[a]=t[a]+" "+c:t[a]=c,t}),{});else if(gt(t)){[e,s,i,n]=mt(t);const o=pt(r(e),s);a=ut(o),c=i?n?`${i}_${n}`:`${i}`:"",l={[a]:c}}else l=t&&bt(t,!0).reduce(((t,[e,s,i,n])=>{const l=pt(r(e),s);a=ut(l);const o=i?n?`${i}_${n}`:`${i}`:"";return c=t[a]?t[a]+" "+o:o,t[a]=c,t}),{});return ht(l,{toString:{value:()=>ct(l).map((([t,e])=>`${t}="${e}"`)).join(" ")}}),l}),{selector:s,attr:i,name:r,varName:n,varExp:(...t)=>`var(${n(...t)})`}}})({mode:this.mode});const s=this;this._n={set adoptedStyleSheets(t){s.dispatchEvent(new CustomEvent("effcsschanges",{detail:{styles:t},bubbles:!0}))}},this._m.register(this._n),this._m.register(e),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 s.define(jt,i,{extends:"script"}),!0}}export{Ct as defineProvider};
@@ -0,0 +1,116 @@
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 +1,2 @@
1
+ export declare const NO_PARSE_SYMBOL: symbol;
1
2
  export declare const parseStyles: (styles: object) => any;
@@ -3,6 +3,7 @@ import { resolveAtRules } from './_process/atrules';
3
3
  import { resolveUnits } from './_process/units';
4
4
  import { resolvePseudo } from './_process/pseudo';
5
5
  import { resolveColor } from './_process/color';
6
+ import { resolvePalette } from './_process/palette';
6
7
  import { getBaseHandlers } from './_process/base';
7
8
  type Leaves<T> = T extends object ? {
8
9
  [K in keyof T]: `${Exclude<K, symbol>}${Leaves<T[K]> extends never ? '' : `.${Leaves<T[K]>}`}`;
@@ -32,6 +33,10 @@ interface IMakerParams extends ReturnType<typeof getBaseHandlers> {
32
33
  * Colors
33
34
  */
34
35
  color: ReturnType<typeof resolveColor>;
36
+ /**
37
+ * Color palette
38
+ */
39
+ palette: ReturnType<typeof resolvePalette>;
35
40
  /**
36
41
  * Global vars
37
42
  */
@@ -39,7 +44,7 @@ interface IMakerParams extends ReturnType<typeof getBaseHandlers> {
39
44
  /**
40
45
  * Scalable time value
41
46
  */
42
- time: (coef: number) => string;
47
+ time: (coef?: number) => string;
43
48
  /**
44
49
  * Width limit queries
45
50
  */
@@ -1,3 +1,28 @@
1
+ type THueToken = 'pri' | 'sec' | 'suc' | 'inf' | 'war' | 'dan';
2
+ type TLightnessToken = 'xs' | 's' | 'm' | 'l' | 'xl';
3
+ type TChromaToken = 'pale' | 'base' | 'rich';
4
+ type TPaletteDict<T extends string> = {
5
+ dark: {
6
+ bg: Record<T, number>;
7
+ fg: Record<T, number>;
8
+ };
9
+ light: {
10
+ bg: Record<T, number>;
11
+ fg: Record<T, number>;
12
+ };
13
+ };
14
+ type RecursivePartial<T> = {
15
+ [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
16
+ };
17
+ export type TPaletteHue = Record<THueToken, number>;
18
+ export type TPaletteLightness = TPaletteDict<TLightnessToken>;
19
+ export type TPaletteChroma = TPaletteDict<TChromaToken>;
20
+ export type TPalette = {
21
+ l: TPaletteLightness;
22
+ c: TPaletteChroma;
23
+ h: TPaletteHue;
24
+ };
25
+ export type TPaletteConfig = RecursivePartial<TPalette>;
1
26
  /**
2
27
  * Provider attributes
3
28
  */
@@ -21,6 +46,14 @@ export type TProviderAttrs = {
21
46
  * Theme
22
47
  */
23
48
  theme: string | null;
49
+ /**
50
+ * Root font size in px
51
+ */
52
+ size: string | null;
53
+ /**
54
+ * Root time in ms
55
+ */
56
+ time: string | null;
24
57
  };
25
58
  /**
26
59
  * Provider settings
@@ -42,7 +75,12 @@ export type TProviderSettings = {
42
75
  * Switched off stylesheets
43
76
  */
44
77
  off: string[];
78
+ /**
79
+ * Palette
80
+ */
81
+ palette: TPalette;
45
82
  };
83
+ export type TProviderSettingsPartial = RecursivePartial<TProviderSettings>;
46
84
  type TStrDict = Record<string, string>;
47
85
  type Paths<T> = T extends object ? {
48
86
  [K in keyof T]: `${Exclude<K, symbol>}${'' | Paths<T[K]> extends '' ? '' : `.${Paths<T[K]>}`}`;
@@ -96,6 +134,7 @@ export type TCreateScope = (params?: {
96
134
  }) => TScopeResolver;
97
135
  export declare const TAG_NAME = "effcss-provider";
98
136
  export declare const DEFAULT_ATTRS: TProviderAttrs;
137
+ export declare const mixPalette: (prev: TPalette, next?: TPaletteConfig) => TPalette;
99
138
  export declare const DEFAULT_BREAKPOINTS: {
100
139
  '3xs': number;
101
140
  '2xs': number;
@@ -1,5 +1,5 @@
1
1
  import { createProcessor } from './_provider/process';
2
- import type { TProviderSettings } from './common';
2
+ import type { TProviderSettings, TProviderSettingsPartial } from './common';
3
3
  import { createScope } from './common';
4
4
  type TResolveAttr = ReturnType<ReturnType<typeof createScope>>['attr'];
5
5
  /**
@@ -37,6 +37,24 @@ export interface IStyleProvider {
37
37
  * @param val - theme value
38
38
  */
39
39
  set theme(val: string);
40
+ /**
41
+ * Get root size value
42
+ */
43
+ get size(): number | null;
44
+ /**
45
+ * Set root size value
46
+ * @param val - rem value in px
47
+ */
48
+ set size(val: number | null);
49
+ /**
50
+ * Get root time value
51
+ */
52
+ get time(): number | null;
53
+ /**
54
+ * Set root time value
55
+ * @param val - rem value in ms
56
+ */
57
+ set time(val: number | null);
40
58
  /**
41
59
  * Get provider settings
42
60
  */
@@ -44,13 +62,15 @@ export interface IStyleProvider {
44
62
  /**
45
63
  * Set provider settings
46
64
  */
47
- set settings(val: Partial<TProviderSettings>);
65
+ set settings(val: TProviderSettingsPartial);
48
66
  /**
49
67
  * Use stylesheet maker
50
68
  * @param maker - stylesheet maker
69
+ * @param key - stylesheet key
70
+ * @param force - force generation
51
71
  * @returns {@link TResolveAttr | attribute resolver}
52
72
  */
53
- use(maker: TStyleSheetMaker, key?: string): TResolveAttr;
73
+ use(maker: TStyleSheetMaker, key?: string, force?: boolean): TResolveAttr;
54
74
  /**
55
75
  * Use public stylesheet makers
56
76
  * @param makers - stylesheet makers
@@ -122,5 +142,5 @@ export type TBaseStyleSheet = {
122
142
  /**
123
143
  * Define style provider custom element
124
144
  */
125
- export declare function defineProvider(settings?: Partial<TProviderSettings>): boolean;
145
+ export declare function defineProvider(settings?: TProviderSettingsPartial): boolean;
126
146
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effcss",
3
- "version": "3.2.0",
3
+ "version": "3.4.0",
4
4
  "description": "Self-confident CSS-in-JS",
5
5
  "type": "module",
6
6
  "scripts": {