effcss 3.3.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 +2 -1
- 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/palette.d.ts +116 -0
- package/dist/types/src/_provider/_process/utils.d.ts +1 -0
- package/dist/types/src/_provider/process.d.ts +5 -0
- package/dist/types/src/common.d.ts +31 -0
- package/dist/types/src/index.d.ts +3 -3
- package/package.json +1 -1
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
|
+
* 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",i="@layer",n="@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",m=t=>t+"vmax",d=t=>t+"rem",p=t=>t+"deg",g=t=>t+"ms",f=t=>t+"%",v=t=>t+"cqw",$=t=>t+"cqh",b=t=>t+"cqi",y=t=>t+"cqb",_=t=>t+"cqmin",k=t=>t+"cqmax",x=Object.fromEntries,S=Object.entries,j=":first-",w=":last-",A=":only-",q="child",O=":nth-",E="of-type",z=O+q,C=":focus",P={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+q,lc:w+q,oc:A+q,odd:z+"(odd)",even:z+"(even)",ft:j+E,lt:w+E,ot:A+E,bef:"::before",aft:"::after",bd:"::backdrop"},I={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:z,ntho:O+E,dir:":dir",lang:":lang"},W="oklch",K=t=>W+`(${t})`,M=t=>K(`from ${t}`),N="def",B=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",N),c:e("c",N),h:e("h",N),a:e("a",N)},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 K(`${t} ${e} ${s} / ${r}`)}}return t=>new s(t)},L=(t,e=.1)=>M(`${t} calc(l + ${e}) c h / alpha)`),R=(t,e=.1)=>M(`${t} calc(l - ${e}) c h / alpha)`),H=(t,e=.1)=>M(`${t} l c h / calc(alpha + ${e}))`),T=(t,e=.1)=>M(`${t} l c h / calc(alpha - ${e}))`),V=(t,e=.04)=>M(`${t} l calc(c + ${e}) h / alpha)`),Z=(t,e=.04)=>M(`${t} l calc(c - ${e}) h / alpha)`),D=(t,e=30)=>M(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),F=({base:t,mixin:e,method:s,bpart:r,mpart:i})=>`color-mix(in ${s||W}, ${t}${void 0!==r?` ${r}%`:""}, ${e}${void 0!==i?` ${i}%`:""})`,G=t=>({create:B(t),oklch:K,lighten:L,darken:R,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,i,n;let o=""+t;return null==e?"":"object"==typeof e?(!s||(null===(r=s.startsWith)||void 0===r?void 0:r.call(s,"@"))||(null===(i=o.startsWith)||void 0===i?void 0:i.call(o,"&"))||(null===(n=o.startsWith)||void 0===n?void 0:n.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:A={}}=t,q=j(w),O=t=>q.varExp(...t.split(".")),E=(t=1)=>`calc(${t} * ${O("rtime")})`;return{compile:({key:t,maker:w})=>{const z=j(t),C=(t=>{const a={cp:1,lay:1,kf:1,cq:1},l=(s,r)=>{const i="string"==typeof r?r:t.name("cq",a.cq++),n=e+` ${i?i+" ":""}(${s})`;return{c:i,q:s,s:n,toString:()=>n}};l.toString=()=>e;const h=(e,r)=>{const i="--"+(e||t.name("cp",a.cp++)),n=s+" "+i;return{k:i,v:`var(${i})`,s:n,r:{[n]:{syntax:(null==r?void 0:r.syn)||'"*"',inherits:(null==r?void 0:r.inh)||!1,initialValue:null==r?void 0:r.ini}},toString:()=>n}};h.toString=()=>s;const u=e=>{const s=e||t.name("kf",a.kf++),i=r+" "+s;return{k:s,s:i,toString:()=>i}};u.toString=()=>r;const m=e=>{const s=e||t.name("lay",a.lay++),r=i+" "+s;return{k:s,s:r,toString:()=>r}};m.toString=()=>i,m.toString=()=>n;const d=(t="",e=!1)=>{const s=o+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return d.toString=()=>o,{pr:h,kf:u,mq:c,cq:l,lay:m,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),W=t=>{const e=A[t]||t;return"number"==typeof e?e+"rem":""},K=t=>"min-"+st+W(t),M=t=>"max-"+st+W(t),N=(t,e)=>"string"==typeof e?C.cq(t,e):C.mq(t),B=(t,e,s)=>""+N(K(t)+") and ("+M(e),s),L={up:(t,e)=>""+N(K(t),e),down:(t,e)=>""+N(M(t),e),between:B,only:(t,e)=>B(t,t,e)};return R=w(Object.assign(et,{key:t,vars:O,time:E,bem:z.selector,pseudo:Object.assign(x(S(P).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),x(S(I).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:G(q.varExp),units:{px:a,vh:l,vw:h,vmin:u,vmax:m,rem:d,deg:p,ms:g,pc:f,cqw:v,cqh:$,cqb:y,cqi:b,cqmin:_,cqmax:k},at:C,limit:L})),Y(R,((t,e)=>t+tt(...e)),"");var R}}};const it=void 0,nt=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("."),mt=(t,e)=>nt(t).reduce(((t,[s,r])=>{if(lt(r)){const i=nt(r);i.length?t.push(...i.reduce(((t,[r,i])=>{if((t=>null!==t&&t!==it)(r)&&e&&t.push([s,r,it,it]),lt(i)){const e=nt(i);e.length&&t.push(...e.reduce(((t,[e,i])=>{const n=typeof i;return"string"!==n&&"number"!==n||t.push([s,r,e,i]),t}),[]))}return t}),[])):t.push([s,it,it,it])}return t}),[]),dt=(t,e,s,r)=>""+(ht(t,e)+(s?"_"+s:"")+(s&&r?"_"+r:"")),pt=(t,e,s,r)=>"."+dt(t,e,s,r),gt=(t,e,s,r)=>`[${ct(ht(t,e))}${s&&r?`~="${s}_${r}"`:s?`~="${s}"`:""}]`,ft={def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},vt="effcss-provider",$t={theme:null,hydrate:null,mode:"a",prefix:"f",size:null,time:null},bt={bp:{"3xs":18,"2xs":24,xs:30,sm:40,md:48,lg:64,xl:80,"2xl":96},vars:{"":{rtime:"200ms",rem:"16px",l:ft,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:ft},dark:{l:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}}},yt=({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 i=e.get(s);return i||(t.add(r),e.set(s,r),r)},useMany(t){return nt(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)||$t[e];!function(t={}){const e=window.document,s=window.customElements;if(null==s?void 0:s.get(vt))return!1;{class r extends HTMLScriptElement{constructor(){super(...arguments),this._c=_t(),this._m=function(){let t={},e={},s=[],r=[];const i=(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]},o=()=>{r=r.reduce(((t,e)=>{const s=e.deref();return s&&(n(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]=i(e,r),s.push(t[e]),o(),!0},h=t=>{const e=a(t);return!!e&&-1!==c(e)};return{apply:n,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 i=a(r);if(!i)return;const n=c(i);return n>-1&&(s.splice(n,1),delete t[r],delete e[r]),o(),!0},removeAll:()=>(s.splice(0),t={},e={},o(),!0),pack:(e,s)=>{let r=t[e]||new CSSStyleSheet;return r.replaceSync(s),r=i(e,r),!!r.cssRules.length&&l(e,r)},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)),n(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,[i,n])=>n&&"object"==typeof n?xt(t,s(n,[...r,i])):(t[e(...r,i)]=n,t)),{})}const r=jt(St(t||{}).map((([t,e])=>[t,s(e,[])]))),{"":i={},dark:n,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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(s[r[i]]=t[r[i]])}return s}(r,["","dark","light"]),a=this.getAttribute("size"),l=this.getAttribute("time");this._=({bem:t,each:s,when:r,vars:h,merge:u,at:{mq:m},units:{px:d,ms:p}})=>{const g="prefers-color-scheme",f={light:`${g}: light`,dark:`${g}: dark`};return u({[`:root:has(script[is=${vt}])`]:u({fontSize:h("rem")},i)},r(!!n,{[m(f.dark).s]:n}),r(!!o,{[m(f.light).s]:o}),s(c,((e,s)=>({[`:root:has(script[is=${vt}][${kt}=${e}])`]:s,[t(`..theme.${e}`)]:s}))),r(!!a,{[`:root:has(script[is=${vt}][size])`]:{[e("","rem")]:d(a)}}),r(!!l,{[`:root:has(script[is=${vt}][time])`]:{[e("","rtime")]:p(l)}}))},this.use(this._,this._k.base,!0)},this.use=(t,e,s)=>{const r=e||this._k.current;let i=this._c.use(t,r);return(s||this._m&&!this._m.has(e))&&this._m.pack(i,this.css(t,i)),e||this._k.next(),this.resolve(i)},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))))}static get observedAttributes(){return["size","time"]}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 i=xt({},this._settings,t),{makers:n,vars:o,bp:c,off:a}=i;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),n&&(null===(r=this._settings)||void 0===r?void 0:r.makers)!==n&&(this._c.useMany(n),this.usePublic(n),(null==a?void 0:a.length)&&this._settings.off!==a&&this.off(...a),this.hydrate&&this._k.reset()),this._settings=i}set theme(t){t?this.setAttribute(kt,t):this.removeAttribute(kt)}get theme(){return wt(this,kt)||""}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(){var t;this._k&&this._cust(null===(t=this._settings)||void 0===t?void 0:t.vars)}connectedCallback(){this._k=yt({prefix:this.prefix}),this._s=((t={})=>{const{mode:e}=t;let s,r;return t=>{const i=(...e)=>""+e.filter(Boolean).reduce(((t,e)=>`${t}-${e}`),t),n=(...t)=>"--"+i(...t);return"c"===e?(s=t=>{let e,s,r,n;return at(t)?([e,s,r,n]=ut(t),pt(i(e),s,r,n)):t&&mt(t).map((([t,e,s,r])=>pt(i(t),e,s,r))).join(",")},r=t=>{let e,s,r,n;const o="class";let c="";return Array.isArray(t)?c=[...t.reduce(((t,o)=>([e,s,r,n]=ut(o),t.add(dt(i(e),s)),r&&t.add(dt(i(e),s,r,n)),t)),new Set).values()].join(" "):at(t)?([e,s,r,n]=ut(t),c=dt(i(e),s,r,n)):c=t&&mt(t,!0).map((([t,e,s,r])=>dt(i(t),e,s,r))).join(" "),ot({[o]:c},{toString:{value:()=>`${o}="${c}"`}})}):(s=t=>{let e,s,r,n;return at(t)?([e,s,r,n]=ut(t),gt(i(e),s,r,n)):t&&mt(t).map((([t,e,s,r])=>gt(i(t),e,s,r))).join(",")},r=t=>{let e,s,r,n,o,c,a="";if(Array.isArray(t))c=t.reduce(((t,c)=>{[e,s,r,n]=ut(c);const l=ht(i(e),s);return o=ct(l),a=r?n?`${r}_${n}`:`${r}`:"",t[o]&&a?t[o]=t[o]+" "+a:t[o]=a,t}),{});else if(at(t)){[e,s,r,n]=ut(t);const l=ht(i(e),s);o=ct(l),a=r?n?`${r}_${n}`:`${r}`:"",c={[o]:a}}else c=t&&mt(t,!0).reduce(((t,[e,s,r,n])=>{const c=ht(i(e),s);o=ct(c);const l=r?n?`${r}_${n}`:`${r}`:"";return a=t[o]?t[o]+" "+l:l,t[o]=a,t}),{});return ot(c,{toString:{value:()=>nt(c).map((([t,e])=>`${t}="${e}"`)).join(" ")}}),c}),{selector:s,attr:r,name:i,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=xt({},bt,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(vt,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
|
+
* 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,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};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),
|
|
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
|
+
* 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",i="@layer",n="@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",m=t=>t+"vmax",d=t=>t+"rem",p=t=>t+"deg",g=t=>t+"ms",f=t=>t+"%",v=t=>t+"cqw",$=t=>t+"cqh",b=t=>t+"cqi",y=t=>t+"cqb",_=t=>t+"cqmin",k=t=>t+"cqmax",x=Object.fromEntries,S=Object.entries,j=":first-",w=":last-",A=":only-",q="child",O=":nth-",E="of-type",z=O+q,C=":focus",P={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+q,lc:w+q,oc:A+q,odd:z+"(odd)",even:z+"(even)",ft:j+E,lt:w+E,ot:A+E,bef:"::before",aft:"::after",bd:"::backdrop"},I={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:z,ntho:O+E,dir:":dir",lang:":lang"},W="oklch",K=t=>W+`(${t})`,M=t=>K(`from ${t}`),N="def",B=t=>{const e=(e,s)=>"string"==typeof s?t(e,s):s;class s{constructor(t={}){this.state={l:e("l",N),c:e("c",N),h:e("h",N),a:e("a",N)},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 K(`${t} ${e} ${s} / ${r}`)}}return t=>new s(t)},L=(t,e=.1)=>M(`${t} calc(l + ${e}) c h / alpha)`),R=(t,e=.1)=>M(`${t} calc(l - ${e}) c h / alpha)`),H=(t,e=.1)=>M(`${t} l c h / calc(alpha + ${e}))`),T=(t,e=.1)=>M(`${t} l c h / calc(alpha - ${e}))`),V=(t,e=.04)=>M(`${t} l calc(c + ${e}) h / alpha)`),Z=(t,e=.04)=>M(`${t} l calc(c - ${e}) h / alpha)`),D=(t,e=30)=>M(`${t} l c calc(h${"number"==typeof e?e>0?" + "+e:" - "+-e:e}) / alpha)`),F=({base:t,mixin:e,method:s,bpart:r,mpart:i})=>`color-mix(in ${s||W}, ${t}${void 0!==r?` ${r}%`:""}, ${e}${void 0!==i?` ${i}%`:""})`,G=t=>({create:B(t),oklch:K,lighten:L,darken:R,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,i,n;let o=""+t;return null==e?"":"object"==typeof e?(!s||(null===(r=s.startsWith)||void 0===r?void 0:r.call(s,"@"))||(null===(i=o.startsWith)||void 0===i?void 0:i.call(o,"&"))||(null===(n=o.startsWith)||void 0===n?void 0:n.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:A={}}=t,q=j(w),O=t=>q.varExp(...t.split(".")),E=(t=1)=>`calc(${t} * ${O("rtime")})`;return{compile:({key:t,maker:w})=>{const z=j(t),C=(t=>{const a={cp:1,lay:1,kf:1,cq:1},l=(s,r)=>{const i="string"==typeof r?r:t.name("cq",a.cq++),n=e+` ${i?i+" ":""}(${s})`;return{c:i,q:s,s:n,toString:()=>n}};l.toString=()=>e;const h=(e,r)=>{const i="--"+(e||t.name("cp",a.cp++)),n=s+" "+i;return{k:i,v:`var(${i})`,s:n,r:{[n]:{syntax:(null==r?void 0:r.syn)||'"*"',inherits:(null==r?void 0:r.inh)||!1,initialValue:null==r?void 0:r.ini}},toString:()=>n}};h.toString=()=>s;const u=e=>{const s=e||t.name("kf",a.kf++),i=r+" "+s;return{k:s,s:i,toString:()=>i}};u.toString=()=>r;const m=e=>{const s=e||t.name("lay",a.lay++),r=i+" "+s;return{k:s,s:r,toString:()=>r}};m.toString=()=>i,m.toString=()=>n;const d=(t="",e=!1)=>{const s=o+` ${e?"not ":""}(${t})`;return{c:t,n:e,s:s,toString:()=>s}};return d.toString=()=>o,{pr:h,kf:u,mq:c,cq:l,lay:m,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),W=t=>{const e=A[t]||t;return"number"==typeof e?e+"rem":""},K=t=>"min-"+st+W(t),M=t=>"max-"+st+W(t),N=(t,e)=>"string"==typeof e?C.cq(t,e):C.mq(t),B=(t,e,s)=>""+N(K(t)+") and ("+M(e),s),L={up:(t,e)=>""+N(K(t),e),down:(t,e)=>""+N(M(t),e),between:B,only:(t,e)=>B(t,t,e)};return R=w(Object.assign(et,{key:t,vars:O,time:E,bem:z.selector,pseudo:Object.assign(x(S(P).map((([t,e])=>{function s(t=""){return t+e}return s.toString=()=>e,[t,s]}))),x(S(I).map((([t,e])=>{function s(t,s=""){return s+e+`(${t})`}return s.toString=()=>e,[t,s]})))),color:G(q.varExp),units:{px:a,vh:l,vw:h,vmin:u,vmax:m,rem:d,deg:p,ms:g,pc:f,cqw:v,cqh:$,cqb:y,cqi:b,cqmin:_,cqmax:k},at:C,limit:L})),Y(R,((t,e)=>t+tt(...e)),"");var R}}};const it=void 0,nt=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("."),mt=(t,e)=>nt(t).reduce(((t,[s,r])=>{if(lt(r)){const i=nt(r);i.length?t.push(...i.reduce(((t,[r,i])=>{if((t=>null!==t&&t!==it)(r)&&e&&t.push([s,r,it,it]),lt(i)){const e=nt(i);e.length&&t.push(...e.reduce(((t,[e,i])=>{const n=typeof i;return"string"!==n&&"number"!==n||t.push([s,r,e,i]),t}),[]))}return t}),[])):t.push([s,it,it,it])}return t}),[]),dt=(t,e,s,r)=>""+(ht(t,e)+(s?"_"+s:"")+(s&&r?"_"+r:"")),pt=(t,e,s,r)=>"."+dt(t,e,s,r),gt=(t,e,s,r)=>`[${ct(ht(t,e))}${s&&r?`~="${s}_${r}"`:s?`~="${s}"`:""}]`,ft={def:.75,c:.05,s:.65,m:.75,l:.85,n:.9},vt="effcss-provider",$t={theme:null,hydrate:null,mode:"a",prefix:"f",size:null,time:null},bt={bp:{"3xs":18,"2xs":24,xs:30,sm:40,md:48,lg:64,xl:80,"2xl":96},vars:{"":{rtime:"200ms",rem:"16px",l:ft,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:ft},dark:{l:{def:.4,n:.25,s:.3,m:.4,l:.5,c:.95}}}},yt=({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 i=e.get(s);return i||(t.add(r),e.set(s,r),r)},useMany(t){return nt(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)||$t[e];function At(t={}){const e=window.document,s=window.customElements;if(null==s?void 0:s.get(vt))return!1;{class r extends HTMLScriptElement{constructor(){super(...arguments),this._c=_t(),this._m=function(){let t={},e={},s=[],r=[];const i=(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]},o=()=>{r=r.reduce(((t,e)=>{const s=e.deref();return s&&(n(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]=i(e,r),s.push(t[e]),o(),!0},h=t=>{const e=a(t);return!!e&&-1!==c(e)};return{apply:n,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 i=a(r);if(!i)return;const n=c(i);return n>-1&&(s.splice(n,1),delete t[r],delete e[r]),o(),!0},removeAll:()=>(s.splice(0),t={},e={},o(),!0),pack:(e,s)=>{let r=t[e]||new CSSStyleSheet;return r.replaceSync(s),r=i(e,r),!!r.cssRules.length&&l(e,r)},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)),n(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,[i,n])=>n&&"object"==typeof n?xt(t,s(n,[...r,i])):(t[e(...r,i)]=n,t)),{})}const r=jt(St(t||{}).map((([t,e])=>[t,s(e,[])]))),{"":i={},dark:n,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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(s[r[i]]=t[r[i]])}return s}(r,["","dark","light"]),a=this.getAttribute("size"),l=this.getAttribute("time");this._=({bem:t,each:s,when:r,vars:h,merge:u,at:{mq:m},units:{px:d,ms:p}})=>{const g="prefers-color-scheme",f={light:`${g}: light`,dark:`${g}: dark`};return u({[`:root:has(script[is=${vt}])`]:u({fontSize:h("rem")},i)},r(!!n,{[m(f.dark).s]:n}),r(!!o,{[m(f.light).s]:o}),s(c,((e,s)=>({[`:root:has(script[is=${vt}][${kt}=${e}])`]:s,[t(`..theme.${e}`)]:s}))),r(!!a,{[`:root:has(script[is=${vt}][size])`]:{[e("","rem")]:d(a)}}),r(!!l,{[`:root:has(script[is=${vt}][time])`]:{[e("","rtime")]:p(l)}}))},this.use(this._,this._k.base,!0)},this.use=(t,e,s)=>{const r=e||this._k.current;let i=this._c.use(t,r);return(s||this._m&&!this._m.has(e))&&this._m.pack(i,this.css(t,i)),e||this._k.next(),this.resolve(i)},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))))}static get observedAttributes(){return["size","time"]}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 i=xt({},this._settings,t),{makers:n,vars:o,bp:c,off:a}=i;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),n&&(null===(r=this._settings)||void 0===r?void 0:r.makers)!==n&&(this._c.useMany(n),this.usePublic(n),(null==a?void 0:a.length)&&this._settings.off!==a&&this.off(...a),this.hydrate&&this._k.reset()),this._settings=i}set theme(t){t?this.setAttribute(kt,t):this.removeAttribute(kt)}get theme(){return wt(this,kt)||""}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(){var t;this._k&&this._cust(null===(t=this._settings)||void 0===t?void 0:t.vars)}connectedCallback(){this._k=yt({prefix:this.prefix}),this._s=((t={})=>{const{mode:e}=t;let s,r;return t=>{const i=(...e)=>""+e.filter(Boolean).reduce(((t,e)=>`${t}-${e}`),t),n=(...t)=>"--"+i(...t);return"c"===e?(s=t=>{let e,s,r,n;return at(t)?([e,s,r,n]=ut(t),pt(i(e),s,r,n)):t&&mt(t).map((([t,e,s,r])=>pt(i(t),e,s,r))).join(",")},r=t=>{let e,s,r,n;const o="class";let c="";return Array.isArray(t)?c=[...t.reduce(((t,o)=>([e,s,r,n]=ut(o),t.add(dt(i(e),s)),r&&t.add(dt(i(e),s,r,n)),t)),new Set).values()].join(" "):at(t)?([e,s,r,n]=ut(t),c=dt(i(e),s,r,n)):c=t&&mt(t,!0).map((([t,e,s,r])=>dt(i(t),e,s,r))).join(" "),ot({[o]:c},{toString:{value:()=>`${o}="${c}"`}})}):(s=t=>{let e,s,r,n;return at(t)?([e,s,r,n]=ut(t),gt(i(e),s,r,n)):t&&mt(t).map((([t,e,s,r])=>gt(i(t),e,s,r))).join(",")},r=t=>{let e,s,r,n,o,c,a="";if(Array.isArray(t))c=t.reduce(((t,c)=>{[e,s,r,n]=ut(c);const l=ht(i(e),s);return o=ct(l),a=r?n?`${r}_${n}`:`${r}`:"",t[o]&&a?t[o]=t[o]+" "+a:t[o]=a,t}),{});else if(at(t)){[e,s,r,n]=ut(t);const l=ht(i(e),s);o=ct(l),a=r?n?`${r}_${n}`:`${r}`:"",c={[o]:a}}else c=t&&mt(t,!0).reduce(((t,[e,s,r,n])=>{const c=ht(i(e),s);o=ct(c);const l=r?n?`${r}_${n}`:`${r}`:"";return a=t[o]?t[o]+" "+l:l,t[o]=a,t}),{});return ot(c,{toString:{value:()=>nt(c).map((([t,e])=>`${t}="${e}"`)).join(" ")}}),c}),{selector:s,attr:r,name:i,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=xt({},bt,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(vt,r,{extends:"script"}),!0}}export{At 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
|
+
};
|
|
@@ -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
|
*/
|
|
@@ -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
|
*/
|
|
@@ -50,7 +75,12 @@ export type TProviderSettings = {
|
|
|
50
75
|
* Switched off stylesheets
|
|
51
76
|
*/
|
|
52
77
|
off: string[];
|
|
78
|
+
/**
|
|
79
|
+
* Palette
|
|
80
|
+
*/
|
|
81
|
+
palette: TPalette;
|
|
53
82
|
};
|
|
83
|
+
export type TProviderSettingsPartial = RecursivePartial<TProviderSettings>;
|
|
54
84
|
type TStrDict = Record<string, string>;
|
|
55
85
|
type Paths<T> = T extends object ? {
|
|
56
86
|
[K in keyof T]: `${Exclude<K, symbol>}${'' | Paths<T[K]> extends '' ? '' : `.${Paths<T[K]>}`}`;
|
|
@@ -104,6 +134,7 @@ export type TCreateScope = (params?: {
|
|
|
104
134
|
}) => TScopeResolver;
|
|
105
135
|
export declare const TAG_NAME = "effcss-provider";
|
|
106
136
|
export declare const DEFAULT_ATTRS: TProviderAttrs;
|
|
137
|
+
export declare const mixPalette: (prev: TPalette, next?: TPaletteConfig) => TPalette;
|
|
107
138
|
export declare const DEFAULT_BREAKPOINTS: {
|
|
108
139
|
'3xs': number;
|
|
109
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
|
/**
|
|
@@ -62,7 +62,7 @@ export interface IStyleProvider {
|
|
|
62
62
|
/**
|
|
63
63
|
* Set provider settings
|
|
64
64
|
*/
|
|
65
|
-
set settings(val:
|
|
65
|
+
set settings(val: TProviderSettingsPartial);
|
|
66
66
|
/**
|
|
67
67
|
* Use stylesheet maker
|
|
68
68
|
* @param maker - stylesheet maker
|
|
@@ -142,5 +142,5 @@ export type TBaseStyleSheet = {
|
|
|
142
142
|
/**
|
|
143
143
|
* Define style provider custom element
|
|
144
144
|
*/
|
|
145
|
-
export declare function defineProvider(settings?:
|
|
145
|
+
export declare function defineProvider(settings?: TProviderSettingsPartial): boolean;
|
|
146
146
|
export {};
|