effcss 4.0.1 → 4.2.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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * EffCSS v4.0.1
2
+ * EffCSS v4.2.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 e(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(s[r[n]]=e[r[n]])}return s}"function"==typeof SuppressedError&&SuppressedError;const t=(e,t,s)=>Object.entries(e).reduce(t,s),s=Symbol("noParse"),r=(e,n,i)=>{var a,l,o;let c=""+e;return null==n?"":"object"!=typeof n||n.hasOwnProperty(s)?""===n?c+";":`${u=c,u.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))}:${""+n};`:(!i||(null===(a=i.startsWith)||void 0===a?void 0:a.call(i,"@"))||(null===(l=c.startsWith)||void 0===l?void 0:l.call(c,"&"))||(null===(o=c.startsWith)||void 0===o?void 0:o.call(c,"@"))?"":"&")+c+`{${t(n,((e,t)=>e+r(...t,c)),"")}}`;var u},n="@layer",i="@starting-style",a=e=>`(${e})`,l=e=>"string"==typeof e,o=()=>{const e=e=>({toString:()=>`(min-width:${l(e)?e:e+"rem"})`}),t=e=>({toString:()=>`(max-width:${l(e)?e:e+"rem"})`}),s=(s,r)=>({toString:()=>`${e(s)} and ${t(r)}`});return{up:e,down:t,between:s,only:e=>s(e,e)}},c=(e,t)=>e?"string"==typeof e?e.includes("(")||t?e:a(e):e+"":"",u=(e={})=>{const{type:t,condition:s}=e,r=c(s),n="object"==typeof s&&"or"===s.type,i=`@media${t?" "+t:""}${t&&r?" and":""}${r?" "+(t&&n?a(r):r):""}`;return Object.defineProperties((e=>({[i]:e})),{all:{get:()=>u({condition:s,type:"all"})},print:{get:()=>u({condition:s,type:"print"})},screen:{get:()=>u({condition:s,type:"screen"})},where:{value:e=>u({condition:e,type:t})},toString:{value:()=>i}})},h=({condition:e}={})=>{const t=c(e),s="@supports"+(t?" "+t:"");return Object.defineProperties((e=>({[s]:e})),{where:{value:e=>h({condition:e})},toString:{value:()=>s}})},g=e=>({[i]:e});g.toString=i;const m=e=>{const{root:t="",limit:s="",mode:r=[!1,!1]}=e,n=`@scope ${t?`(${t}${r[0]?" > *":""})`:""}${t&&s?" ":""}${s?`to (${s}${r[1]?" > *":""})`:""}`;return Object.defineProperties((e=>({[n]:e})),{limit:{value:e=>m({root:t,limit:e,mode:r})},root:{value:e=>m({root:e,limit:s,mode:r})},both:{value:()=>m({root:t,limit:s,mode:[!1,!0]})},none:{value:()=>m({root:t,limit:s,mode:[!0,!1]})},low:{value:()=>m({root:t,limit:s,mode:[!0,!0]})},high:{value:()=>m({root:t,limit:s,mode:[!1,!1]})},toString:{value:()=>n}})},d=e=>{const t={cp:1,lay:1,kf:1,cq:1},r=(n={})=>{const{scroll:i,type:a,name:l,condition:o}=n,u=c(o),h=`@container${l?" "+l:""}${u?" "+u:""}`;return Object.defineProperties((e=>({[h]:e})),{container:{value:(l||"none")+" / "+(a&&i?`${a} scroll-state`:i?"scroll-state":a||"normal"),enumerable:!0},named:{get:()=>r({scroll:i,condition:o,name:l||e.name(["cq",t.cq++]),type:a})},size:{get:()=>r({name:l,scroll:i,condition:o,type:"size"})},isize:{get:()=>r({name:l,scroll:i,condition:o,type:"inline-size"})},scroll:{get:()=>r({name:l,scroll:!0,condition:o,type:a})},where:{value:e=>r({name:l,scroll:i,condition:e,type:a})},[s]:{value:!0},toString:{value:()=>h}})},i=({name:s}={})=>{const r=`${n}${s?" "+s:""}`,a=e=>({[r]:e});return a.toString=()=>r,Object.defineProperties(a,{named:{get:()=>i({name:s||e.name(["lay",t.lay++])})},list:{value:(...e)=>({[n+(e.map((e=>(e+"").split(n)[1])).filter(Boolean).join(",")||s)]:""})}})};return{layer:i(),supports:h(),keyframes:r=>{const n=e.name(["kf",t.kf++]),i="@keyframes "+n;return Object.defineProperties((e=>{if(!e)return{animationName:n};const{dur:t,tf:s,del:r,ic:i,dir:a,ps:l,fm:o}=e;return{animation:[t,s,r,i,a,l,o,n].filter(Boolean).join(" ")}}),{[i]:{value:r,enumerable:!0},toString:{value:()=>n},[s]:{value:!0}})},property:(r={})=>{const{syn:n='"*"',inh:i=!0,ini:a,def:l}=r,o="--"+e.name(["cp",t.cp++]),c=`var(${o}${void 0!==l?","+l:""})`,u="@property "+o;return Object.defineProperties((e=>({[o]:e})),{[u]:{value:{syntax:n,inherits:i,initialValue:a},enumerable:!0},toString:{value:()=>c},fallback:{value:e=>`var(${o},${e})`},[s]:{value:!0}})},scope:m({}),media:u({}),container:r({}),startingStyle:g,$logic:{and:(...e)=>Object.defineProperties({type:"and",value:e},{toString:{value:()=>e.filter(Boolean).map((e=>{const t=c(e);return"object"==typeof e&&"or"===e.type?a(t):t})).join(" and ")}}),or:(...e)=>Object.defineProperties({type:"or",value:e},{toString:{value:()=>e.filter(Boolean).map((e=>c(e))).join(" or ")}}),not:e=>"object"==typeof e&&"not"===e.type?e.value[0]:Object.defineProperties({type:"not",value:[e]},{toString:{value:()=>`not (${c(e,!0)})`}})},$width:o()}},p=(e,t)=>`calc(${e} * 1${t})`,b=e=>p(e,"px"),f=e=>p(e,"vh"),$=e=>p(e,"vw"),y=e=>p(e,"vmin"),v=e=>p(e,"vmax"),j=e=>p(e,"em"),O=e=>p(e,"rem"),x=e=>p(e,"deg"),w=e=>p(e,"rad"),k=e=>p(e,"rad"),S=e=>p(e,"ms"),_=e=>p(e,"s"),z=e=>p(e,"%"),A=e=>p(e,"cqw"),P=e=>p(e,"cqh"),q=e=>p(e,"cqi"),C=e=>p(e,"cqb"),E=e=>p(e,"cqmin"),N=e=>p(e,"cqmax"),T=Object.fromEntries,M=Object.entries,B=":first-",W=":last-",R=":only-",I="child",V=":nth-",D="of-type",J=V+I,K=":focus",L={r:":root",h:":hover",f:K,fv:K+"-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:B+I,lc:W+I,oc:R+I,odd:J+"(odd)",even:J+"(even)",ft:B+D,lt:W+D,ot:R+D,bef:"::before",aft:"::after",bd:"::backdrop"},F={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:J,ntho:V+D,dir:":dir",lang:":lang"},H=e=>`oklch(${e})`,Z=e=>H(`from ${e}`),G=(e,t=.1)=>Z(`${e} calc(l + ${t}) c h / alpha)`),Q=(e,t=.1)=>Z(`${e} calc(l - ${t}) c h / alpha)`),U=(e,t=.1)=>Z(`${e} l c h / calc(alpha + ${t}))`),X=(e,t=.1)=>Z(`${e} l c h / calc(alpha - ${t}))`),Y=(e,t=.04)=>Z(`${e} l calc(c + ${t}) h / alpha)`),ee=(e,t=.04)=>Z(`${e} l calc(c - ${t}) h / alpha)`),te=(e,t=30)=>Z(`${e} l c calc(h${"number"==typeof t?t>0?" + "+t:" - "+-t:t}) / alpha)`),se=e=>{class t{constructor(e={}){this.state={l:"l",c:"base",h:"pri",a:1,m:"bg"},Object.assign(this,{[s]:!0}),this.state=Object.assign(this.state,e)}get xs(){return new t(Object.assign(Object.assign({},this.state),{l:"xs"}))}get s(){return new t(Object.assign(Object.assign({},this.state),{l:"s"}))}get m(){return new t(Object.assign(Object.assign({},this.state),{l:"m"}))}get l(){return new t(Object.assign(Object.assign({},this.state),{l:"l"}))}get xl(){return new t(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 t(Object.assign(Object.assign({},this.state),{c:"gray"}))}get pale(){return new t(Object.assign(Object.assign({},this.state),{c:"pale"}))}get base(){return new t(Object.assign(Object.assign({},this.state),{c:"base"}))}get rich(){return new t(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 t(Object.assign(Object.assign({},this.state),{h:"pri"}))}get sec(){return new t(Object.assign(Object.assign({},this.state),{h:"sec"}))}get suc(){return new t(Object.assign(Object.assign({},this.state),{h:"suc"}))}get inf(){return new t(Object.assign(Object.assign({},this.state),{h:"inf"}))}get war(){return new t(Object.assign(Object.assign({},this.state),{h:"war"}))}get dan(){return new t(Object.assign(Object.assign({},this.state),{h:"dan"}))}get hue(){return{pri:this.pri,sec:this.sec,suc:this.suc,inf:this.inf,war:this.war,dan:this.dan}}alpha(e=1){return new t(Object.assign(Object.assign({},this.state),{a:e}))}get bg(){return new t(Object.assign(Object.assign({},this.state),{m:"bg"}))}get fg(){return new t(Object.assign(Object.assign({},this.state),{m:"fg"}))}toString(){const{l:t,c:s,h:r,a:n,m:i}=this.state;return`oklch(${e(`lightness.${i}.${t}`)} ${e(`chroma.${i}.${s}`)} ${e(`hue.${r}`)} / ${n})`}}return new t},re="coef",ne=e=>{class t{constructor(e={}){this.state={center:8},this.state=Object.assign(this.state,e)}get min(){return e(`${re}.${this.state.center-4}`)}get xxs(){return e(`${re}.${this.state.center-3}`)}get xs(){return e(`${re}.${this.state.center-2}`)}get s(){return e(`${re}.${this.state.center-1}`)}get m(){return e(`${re}.${this.state.center}`)}get l(){return e(`${re}.${this.state.center+1}`)}get xl(){return e(`${re}.${this.state.center+2}`)}get xxl(){return e(`${re}.${this.state.center+3}`)}get max(){return e(`${re}.${this.state.center+4}`)}get $xxs(){return new t({center:4})}get $xs(){return new t({center:8})}get $s(){return new t({center:12})}get $m(){return new t({center:16})}get $l(){return new t({center:20})}get $xl(){return new t({center:24})}get $xxl(){return new t({center:28})}get short(){return{s:this.s,m:this.m,l:this.l}}get base(){return Object.assign(Object.assign({xs:this.xs},this.short),{xl:this.xl})}get long(){return Object.assign(Object.assign({xxs:this.xxs},this.base),{xxl:this.xxl})}get full(){return Object.assign(Object.assign({min:this.min},this.long),{max:this.max})}get main(){return{min:this.min,m:this.m,max:this.max}}get sparse(){return{min:this.min,xs:this.xs,m:this.m,xl:this.xl,max:this.max}}}return new t},ie=Object.assign,ae=Object.entries,le=Array.isArray,oe=(e,t)=>Array.from(Array(e).entries()).reduce(((e,[s])=>ie(e,t(s+1))),{}),ce=(e,t)=>ae(e).reduce(((e,[s,r])=>ie(e,t(s,r))),{}),ue=(e,t,s={})=>e?t:s,he=(...e)=>e.join("-"),ge=(...e)=>e.join(),me=(...e)=>e.join(" "),de=(e,...t)=>t.length?t.reduce(((e,t)=>(t&&e&&"object"==typeof t&&ae(t).forEach((([t,s])=>{s&&"object"==typeof s&&e[t]?le(e[t])&&le(s)?e[t]=[...e[t],...s]:de(e[t],s||{}):e[t]=s})),e)),e):e,pe=e=>{const{scope:s,globalKey:n}=e,i=s(n).varExp,a=(e=1)=>`calc(${1!==e?e+" * ":""}${i("time")} * 1ms)`,l=(e=1)=>`calc(${1!==e?e+" * ":""}${i("angle")} * 1deg)`,o=(e=1)=>`calc(${1!==e?e+" * ":""}${i("size")} * 1px)`;return{compile:({key:e,maker:n})=>{const c=s(e),u=c.selector,h=d(c);return g=n({dash:he,comma:ge,space:me,range:oe,each:ce,when:ue,merge:de,themeVar:i,size:o,time:a,angle:l,bem:u,pseudo:Object.assign(T(M(L).map((([e,t])=>{function s(e=""){return e+t}return s.toString=()=>t,[e,s]}))),T(M(F).map((([e,t])=>{function s(e,s=""){return s+t+`(${e})`}return s.toString=()=>t,[e,s]})))),color:{oklch:H,lighten:G,darken:Q,saturate:Y,desaturate:ee,fadein:U,fadeout:X,spin:te},palette:se(i),coef:ne(i),units:{px:b,vh:f,vw:$,vmin:y,vmax:v,em:j,rem:O,deg:x,rad:w,turn:k,ms:S,s:_,pc:z,cqw:A,cqh:P,cqb:C,cqi:q,cqmin:E,cqmax:N},at:h}),t(g,((e,t)=>e+r(...t)),"");var g}}},be=Symbol("effcss-stylesheet");class fe{constructor(){this.disabled=!1,this.cssRules=[]}replaceSync(e){e&&(this.cssRules=[{cssText:e}])}}function $e({initStyles:e,emulate:t}={}){const s={};null==e||e.forEach((e=>{var t;const r=null===(t=null==e?void 0:e.dataset)||void 0===t?void 0:t.effcss;r&&(s[r]=e)}));let r={},n={},i=[],a=[];const l=(e,t)=>t.hasOwnProperty(be)?t:Object.defineProperties(t,{[be]:{value:e}}),o=e=>{var t;return e.adoptedStyleSheets=[...(null===(t=e.adoptedStyleSheets)||void 0===t?void 0:t.length)?[...e.adoptedStyleSheets].filter((e=>!e.hasOwnProperty(be))):[],...i]},c=()=>{a=a.reduce(((e,t)=>{const s=t.deref();return s&&(o(s),e.push(t)),e}),[])},u=e=>e?r[e]:void 0,h=(e,t)=>{if(!r[e]){r[e]=l(e,t),i.push(r[e]);const n=s[e];return n&&(n.disabled=!0),c(),!0}};return{get:u,all:()=>r,add:h,status:e=>{const t=u(e);return!(null==t?void 0:t.disabled)},on:(...e)=>{e.forEach((e=>{const t=u(e);t&&(t.disabled=!1)})),c()},off:(...e)=>{e.forEach((e=>{const t=u(e);t&&(t.disabled=!0)})),c()},remove:e=>{const t=u(e);if(!t)return;const s=(a=t,i.findIndex((e=>e===a)));var a;return s>-1&&(i.splice(s,1),delete r[e],delete n[e]),c(),!0},removeAll:()=>(i.splice(0),r={},n={},c(),!0),pack:(e,s)=>{let n=r[e]||(!t&&globalThis.CSSStyleSheet?new globalThis.CSSStyleSheet:new fe);return n.replaceSync(s),n=l(e,n),!!n.cssRules.length&&h(e,n)},register:e=>{a.findIndex((t=>t.deref()===e))>=0||(a.push(new WeakRef(e)),o(e))},unregister:e=>{const t=a.findIndex((t=>t.deref()===e));t>=0&&a.splice(t,1)},hydrate:e=>s[e]&&!s[e].disabled&&s[e].textContent||void 0}}const ye=({prefix:e})=>{let t=0;return{get initial(){return e+0},get current(){return e+t},next(){return t++,this.current}}},ve=({prefix:e})=>{const t=new Set,s=new Map,r=ye({prefix:e});return{use(e){let n=this.key(e);return n||(n=r.current,t.add(n),s.set(e,n),r.next(),n)},remake(e,t){const r=s.get(t);return r?(s.delete(t),s.set(e,r),r):this.use(e)},key:e=>e?s.get(e)||"":r.initial,get keys(){return[...t]},get makers(){return Object.fromEntries(s.entries().map((([e,t])=>[t,e])))}}},je=void 0,Oe=Object.entries,xe=Object.defineProperties,we=e=>"string"==typeof e,ke=e=>null!==e&&"object"==typeof e,Se=e=>e.split("."),_e=(e,t)=>Oe(e).reduce(((e,[s,r])=>{if(ke(r)){const n=Oe(r);n.length?e.push(...n.reduce(((e,[r,n])=>{if((e=>null!==e&&e!==je)(r)&&t&&e.push([s,r,je,je]),ke(n)){const t=Oe(n);t.length&&e.push(...t.reduce(((e,[t,n])=>{const i=typeof n;return"string"!==i&&"number"!==i||e.push([s,r,t,n]),e}),[]))}return e}),[])):e.push([s,je,je,je])}return e}),[]),ze=(e,t,s,r)=>""+(((e,t)=>`${e||""}${t?"__"+t:""}`)(e,t)+(s?"_"+s:"")+(s&&r?"_"+r:""))||"_",Ae=(e,t)=>"."+(t?e+(t.startsWith("_")?"":"-")+t:e),Pe=(e,t)=>`[data-${e}${t?`~="${t}"`:""}]`;const qe=e=>e||"",Ce=Object.assign,Ee=Object.entries,Ne="theme",Te=e=>Number((.1*184+.9*e).toFixed(2)),Me={time:200,size:16,angle:30,coef:{0:0,1:.0625,2:.125,3:.25,4:.5,5:.75,6:.875,7:.9375,8:1,9:1.0625,10:1.125,11:1.25,12:1.5,13:1.75,14:1.875,15:1.9375,16:2,17:2.5,18:4,19:5,20:7.5,21:10,22:12,23:15,24:16,25:20,26:28,27:36,28:48,29:64,30:80,31:120,32:150},hue:{pri:184,sec:290,suc:Te(142),inf:Te(264),war:Te(109),dan:Te(29)},$light:{lightness:{bg:{xl:.98,l:.93,m:.88,s:.83,xs:.78},fg:{xl:0,l:.12,m:.24,s:.36,xs:.48}},chroma:{bg:{gray:0,pale:.01,base:.04,rich:.7},fg:{gray:0,pale:.07,base:.11,rich:.15}}},$dark:{lightness:{bg:{xl:.24,l:.3,m:.36,s:.42,xs:.48},fg:{xl:.98,l:.93,m:.86,s:.79,xs:.72}},chroma:{bg:{pale:.02,base:.06,rich:.1},fg:{pale:.06,base:.1,rich:.14}}}},Be=({provider:t,init:s,scope:r,onChange:n})=>{const i={"":Me},a=[],l={get:(e="")=>i[e],add(e,t){i[t]||(i[t]=de({$light:{},$dark:{}},e),a.push({type:"add",payload:{params:e,name:t}}),null==n||n())},delete(e){i[e]&&""!==e&&(this.current===e&&this.switch(),delete i[e],a.push({type:"delete",payload:{name:e}}),null==n||n())},update(e,t=""){i[t]&&(i[t]=de({$light:{},$dark:{}},i[t],e),a.push({type:"update",payload:{params:e,name:t}}),null==n||n())},switch(e=""){i[e]&&t.setAttribute(Ne,e)},vars(t=""){const s=this.get(t);return s?(t=>{var{$light:s={},$dark:n={}}=t,i=e(t,["$light","$dark"]);function a(e,t=[]){return Ee(e).reduce(((e,[s,n])=>n&&"object"==typeof n?Ce(e,a(n,[...t,s])):(e[r.varName([...t,s])]=n,e)),{})}return Object.assign(Object.assign({},a(i)),{$light:a(s),$dark:a(n)})})(s):{$light:{},$dark:{}}},get list(){const t=e(i,[""]);return Object.keys(t)},get current(){return t.getAttribute(Ne)||""},get all(){return i},get actions(){return a}};return null==s||s.forEach((({type:e,payload:t})=>{switch(e){case"add":l.add(t.params,t.name);break;case"delete":l.delete(t.name);break;case"update":l.update(t.params,t.name)}})),l},We="effcss",Re=We+"-provider",Ie="script",Ve="style",De="size",Je="time",Ke="angle",Le=We+"changes",Fe="data-"+We,He="prefers-color-scheme",Ze=`${He}: light`,Ge=`${He}: dark`,Qe={mode:"a",pre:"f"},Ue=e=>"boolean"==typeof e,Xe=(e,t)=>{const s=((e,t)=>e.getAttribute(t)||Qe[t])(e,t);return(e=>"string"==typeof e?Number(e):null)(s)},Ye=(e,t,s)=>null===s?e.removeAttribute(t):e.setAttribute(t,s+""),et=e=>`:root:has([is=${Re}]${e?`[${e}]`:""})`,tt=({theme:t,attrs:s,scope:r})=>({bem:n,each:i,themeVar:a,merge:l,pseudo:{r:o},at:{media:c},units:{px:u}})=>{const h=s.size,g=s.time,m=s.angle,d=t.vars(),{$dark:p={},$light:b={}}=d,f=e(d,["$dark","$light"]);return l({[et()]:Object.assign(Object.assign(Object.assign(Object.assign({},f),c.where(Ze)(b)),c.where(Ge)(p)),{[o()]:{fontSize:u(a("size"))}})},i(t.list,((s,r)=>{const i=t.vars(r),{$dark:a={},$light:l={}}=i,o=e(i,["$dark","$light"]),u=Object.assign(Object.assign(Object.assign({},o),c.where(Ze)(l)),c.where(Ge)(a));return{[et(`theme=${s}`)]:u,[n(`..theme.${s}`)]:u}})),h&&{[et(De)]:{[r.varName("size")]:h}},g&&{[et(Je)]:{[r.varName("time")]:g}},m&&{[et(Ke)]:{[r.varName("angle")]:m}})},st=(e,{initStyles:t,emulate:s,onChange:r,globalMaker:n,noscript:i})=>{let a;e.textContent&&(a=JSON.parse(e.textContent)),Object.defineProperties(e,{pre:{get:()=>e.getAttribute("pre")||"f"},mode:{get:()=>e.getAttribute("mode")||"a"},min:{get:()=>""===e.getAttribute("min")},size:{set(t){Ye(e,De,t)},get:()=>Xe(e,De)},time:{set(t){Ye(e,Je,t)},get:()=>Xe(e,Je)},angle:{set(t){Ye(e,Ke,t)},get:()=>Xe(e,Ke)}});const l=ve({prefix:e.pre}),o=((e={})=>{const{mode:t,min:s,dict:r={}}=e;let n;n="a"===t?Pe:Ae;const i=e=>{let s=0,r=qe,a=qe;const l=i.dict;l&&(l[e]||(l[e]={}),r=t=>{var r;return null!==(r=l[e][t])&&void 0!==r?r:l[e][t]=(s++).toString(36)},a=t=>l[e][t]);let o=t=>[e,...we(t)?t.split("."):t].filter(Boolean).join("-"),c="class",u=t=>t?e+(t.startsWith("_")?"":"-")+t:void 0===t?void 0:e;"a"===t&&(c="data-"+e,u=qe);const h=e=>"--"+o(we(e)?e.split("."):e),g=e=>{if(void 0===e)return function(e){const t=({b:s,e:r,m:n})=>({b:e=>t({b:e,e:"",m:{}}),e:e=>t({b:s,e:e,m:{}}),m:(e={})=>t({b:s,e:r,m:e}),get $(){return e({[s]:{[r]:n}})}});return t({b:"",e:"",m:{}})}(g);let t,s,r,n,i="";const l=we(e);return i=l||Array.isArray(e)?[...(l?[e]:e).reduce(((e,i)=>([t,s,r,n]=Se(i),e.add(u(a(ze(t,s)))),r&&e.add(u(a(ze(t,s,r,n)))),e)),new Set).values()].join(" "):e&&_e(e,!0).map((([e,t,s,r])=>u(a(ze(e,t,s,r))))).join(" "),xe({[c]:i},{toString:{value:()=>`${c}="${i}"`},$:{value:i}})};return{selector:t=>{const[s,i,a,l]=Se(t);return n(e,r(ze(s,i,a,l)))},attr:g,name:o,varName:h,varExp:(e,t)=>`var(${h(e)}${void 0!==t?","+t:""})`}};return s&&(i.dict=r),i})({mode:e.mode,min:e.min,dict:null==a?void 0:a.dict}),c=o(l.key()),u=pe({scope:o,globalKey:l.key()}),h=$e({initStyles:t,emulate:s});e.theme=Be({provider:e,init:null==a?void 0:a.theme,onChange:r,scope:c});const g=(({scope:e,collector:t,manager:s,processor:r,globalMaker:n})=>{const i=e=>"string"==typeof e?e:t.key(e),a=s=>e(s||t.key()).attr,l=(e,t)=>r.compile({key:t,maker:e}),o=e=>{let r=t.use(e);return s&&!s.get(r)&&s.pack(r,s.hydrate(r)||l(e,r)),a(r)},c=(...e)=>0===e.length?[o(n)]:e.map((e=>o(e)));return{use:c,remake:(e,r)=>{let n=t.key(r||e);return s&&s.get(n)?(r&&t.remake(e,r),s.pack(n,s.hydrate(n)||l(e,n)),a(n)):c(e)[0]},css:l,status:e=>{const t=i(e);return!!t&&s.status(t)},on:(...e)=>s.on(...e.map(i)),off:(...e)=>s.off(...e.map(i)),stylesheets:(e=t.keys)=>e.map((e=>s.get(i(e))))}})({scope:o,processor:u,manager:h,collector:l,globalMaker:n});Object.defineProperties(e,{_c:{value:l},_s:{value:o},_p:{value:u},_m:{value:h},toString:{value:()=>{const t=Object.assign({},h.all()),s=Object.entries(t).filter((([e,t])=>!t.disabled)).map((([e,t])=>`<style ${Fe}="${e}">${[...t.cssRules].map((e=>e.cssText)).join("")}</style>`)).join("");let r=Ve,n="";const a={is:Re,min:e.getAttribute("min"),mode:e.getAttribute("mode"),size:e.getAttribute("size"),time:e.getAttribute("time"),angle:e.getAttribute("angle")};if(!i){r=Ie,a.type="application/json";const t={theme:e.theme.actions};e.min&&l.keys.length>1&&(t.dict=o.dict),n=JSON.stringify(t)}return s+`<${r} ${Object.entries(a).map((([e,t])=>null!=t&&t!==Qe[e]?""===t?e:`${e}="${t}"`:"")).filter(Boolean).join(" ")}${e.theme.current?` theme="${e.theme.current}"`:""}>${n}</${r}>`}}}),Object.assign(e,g)};const rt=(e={})=>{let{noscript:t,attrs:s={}}=e,{mode:r=Qe.mode,min:n,pre:i=Qe.prefix,size:a=null,time:l=null,angle:o=null}=s;return new class{get tagName(){return""}get textContent(){return""}getAttribute(e){const t=this.attributes[e];return null!=t?Ue(t)?"":t+"":null}setAttribute(e,t){this.attributes[e]=t+"",e!==De&&e!==Je&&e!==Ke||this._customize()}removeAttribute(e){delete this.attributes[e]}get makers(){return this._c.makers}constructor(){this.attributes={size:a?a+"":null,time:l?l+"":null,angle:o?o+"":null,pre:i,mode:r,min:n?"":null},this._customize=()=>{const e=this.size,t=this.time,s=this.angle,r=tt({theme:this.theme,attrs:{size:e,time:t,angle:s},scope:this._s(this._c.key())});this.remake(r,this._),this._=r},st(this,{emulate:!0,onChange:this._customize,globalMaker:this._,noscript:t}),this._customize()}}},nt=(t={})=>{const{emulate:s}=t,r=e(t,["emulate"]),n=null===globalThis||void 0===globalThis?void 0:globalThis.document;if(n&&!s){void 0===nt.isDefined&&(nt.isDefined=function(){const e=globalThis.document,t=globalThis.customElements;if(null==t?void 0:t.get(Re))return!1;{class s extends HTMLScriptElement{constructor(){super(...arguments),this._customize=()=>{const e=this.size,t=this.time,s=this.angle,r=tt({theme:this.theme,attrs:{size:e,time:t,angle:s},scope:this._s(this._c.key())});this.remake(r,this._),this._=r}}static get observedAttributes(){return[De,Je,Ke]}get makers(){return this._c.makers}attributeChangedCallback(){this.isConnected&&this._customize()}connectedCallback(){st(this,{initStyles:[...e.querySelectorAll(Ve+`[${Fe}]`)],onChange:this._customize,globalMaker:this._}),this._customize();const t=this;this._n={set adoptedStyleSheets(e){t.dispatchEvent(new CustomEvent(Le,{detail:{styles:e},bubbles:!0}))}},this._m.register(this._n),this._m.register(e)}}return t.define(Re,s,{extends:Ie}),!0}}());const e=n.querySelector(`[is=${Re}]`);if(e)return e;const t=n.createElement(Ie,{is:Re});t.setAttribute("is",Re);const s=null==r?void 0:r.attrs;return s&&Object.entries(s).map((([e,s])=>s&&Qe[e]!==s&&t.setAttribute(e,Ue(s)?"":s+""))),n.head.appendChild(t),t}return rt(r)};export{Qe as DEFAULT_ATTRS,Re as TAG_NAME,nt as useStyleProvider};
7
+ function e(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(s[r[n]]=e[r[n]])}return s}"function"==typeof SuppressedError&&SuppressedError;const t=(e,t,s)=>Object.entries(e).reduce(t,s),s=(e,t)=>{return`${s=e,s.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))}:${""+t};`;var s},r=Symbol("noParse"),n=(e,i,a)=>{var l,o,c;let u=""+e;return null==i?"":Array.isArray(i)?i.map((e=>s(u,e))).join(""):"object"!=typeof i||i.hasOwnProperty(r)?""===i?u+";":s(u,i):(!a||(null===(l=a.startsWith)||void 0===l?void 0:l.call(a,"@"))||(null===(o=u.startsWith)||void 0===o?void 0:o.call(u,"&"))||(null===(c=u.startsWith)||void 0===c?void 0:c.call(u,"@"))?"":"&")+u+`{${t(i,((e,t)=>e+n(...t,u)),"")}}`},i="@layer",a="@starting-style",l=e=>`(${e})`,o=e=>"string"==typeof e,c={and:(...e)=>Object.defineProperties({type:"and",value:e},{toString:{value:()=>e.filter(Boolean).map((e=>{const t=p(e);return"object"==typeof e&&"or"===e.type?l(t):t})).join(" and ")}}),or:(...e)=>Object.defineProperties({type:"or",value:e},{toString:{value:()=>e.filter(Boolean).map((e=>p(e))).join(" or ")}}),not:e=>"object"==typeof e&&"not"===e.type?e.value[0]:Object.defineProperties({type:"not",value:[e]},{toString:{value:()=>`not (${p(e,!0)})`}})},u=e=>{const t=t=>({toString:()=>`(min-${e}:${o(t)?t:t+"rem"})`}),s=t=>({toString:()=>`(max-${e}:${o(t)?t:t+"rem"})`}),r=(e,r)=>({toString:()=>`${t(e)} and ${s(r)}`});return{up:t,down:s,between:r,only:e=>r(e,e)}},h=u("width"),g=u("height"),m=u("inline-size"),d=u("block-size"),p=(e,t)=>e?"string"==typeof e?e.includes("(")||t?e:l(e):e+"":"",b=(e={})=>{const{type:t,condition:s}=e,r=p(s),n="object"==typeof s&&"or"===s.type,i=`@media${t?" "+t:""}${t&&r?" and":""}${r?" "+(t&&n?l(r):r):""}`;return Object.defineProperties((e=>({[i]:e})),{all:{get:()=>b({condition:s,type:"all"})},print:{get:()=>b({condition:s,type:"print"})},screen:{get:()=>b({condition:s,type:"screen"})},where:{value:e=>b({condition:e,type:t})},toString:{value:()=>i}})},f=b({}),$=({condition:e}={})=>{const t=p(e),s="@supports"+(t?" "+t:"");return Object.defineProperties((e=>({[s]:e})),{where:{value:e=>$({condition:e})},toString:{value:()=>s}})},y=$(),v=e=>({[a]:e});v.toString=a;const j=e=>{const{root:t="",limit:s="",mode:r=[!1,!1]}=e,n=`@scope ${t?`(${t}${r[0]?" > *":""})`:""}${t&&s?" ":""}${s?`to (${s}${r[1]?" > *":""})`:""}`;return Object.defineProperties((e=>({[n]:e})),{limit:{value:e=>j({root:t,limit:e,mode:r})},root:{value:e=>j({root:e,limit:s,mode:r})},both:{value:()=>j({root:t,limit:s,mode:[!1,!0]})},none:{value:()=>j({root:t,limit:s,mode:[!0,!1]})},low:{value:()=>j({root:t,limit:s,mode:[!0,!0]})},high:{value:()=>j({root:t,limit:s,mode:[!1,!1]})},toString:{value:()=>n}})},O=j({}),x=(e,t)=>`calc(${e} * 1${t})`,w=e=>x(e,"px"),k=e=>x(e,"vh"),S=e=>x(e,"vw"),_=e=>x(e,"vmin"),A=e=>x(e,"vmax"),z=e=>x(e,"em"),P=e=>x(e,"rem"),q=e=>x(e,"deg"),C=e=>x(e,"rad"),E=e=>x(e,"rad"),T=e=>x(e,"ms"),N=e=>x(e,"s"),M=e=>x(e,"%"),B=e=>x(e,"cqw"),W=e=>x(e,"cqh"),R=e=>x(e,"cqi"),I=e=>x(e,"cqb"),V=e=>x(e,"cqmin"),D=e=>x(e,"cqmax"),J=Object.fromEntries,K=Object.entries,L=":first-",F=":last-",H=":only-",Z="child",G=":nth-",Q="of-type",U=G+Z,X=":focus",Y={r:":root",h:":hover",f:X,fv:X+"-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:L+Z,lc:F+Z,oc:H+Z,odd:U+"(odd)",even:U+"(even)",ft:L+Q,lt:F+Q,ot:H+Q,bef:"::before",aft:"::after",bd:"::backdrop"},ee={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:U,ntho:G+Q,dir:":dir",lang:":lang"},te=e=>`oklch(${e})`,se=e=>te(`from ${e}`),re=(e,t=.1)=>se(`${e} calc(l + ${t}) c h / alpha)`),ne=(e,t=.1)=>se(`${e} calc(l - ${t}) c h / alpha)`),ie=(e,t=.1)=>se(`${e} l c h / calc(alpha + ${t}))`),ae=(e,t=.1)=>se(`${e} l c h / calc(alpha - ${t}))`),le=(e,t=.04)=>se(`${e} l calc(c + ${t}) h / alpha)`),oe=(e,t=.04)=>se(`${e} l calc(c - ${t}) h / alpha)`),ce=(e,t=30)=>se(`${e} l c calc(h${"number"==typeof t?t>0?" + "+t:" - "+-t:t}) / alpha)`),ue=e=>{class t{constructor(e={}){this.state={l:"l",c:"base",h:"pri",a:1,m:"bg"},Object.assign(this,{[r]:!0}),this.state=Object.assign(this.state,e)}get xs(){return new t(Object.assign(Object.assign({},this.state),{l:"xs"}))}get s(){return new t(Object.assign(Object.assign({},this.state),{l:"s"}))}get m(){return new t(Object.assign(Object.assign({},this.state),{l:"m"}))}get l(){return new t(Object.assign(Object.assign({},this.state),{l:"l"}))}get xl(){return new t(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 t(Object.assign(Object.assign({},this.state),{c:"gray"}))}get pale(){return new t(Object.assign(Object.assign({},this.state),{c:"pale"}))}get base(){return new t(Object.assign(Object.assign({},this.state),{c:"base"}))}get rich(){return new t(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 t(Object.assign(Object.assign({},this.state),{h:"pri"}))}get sec(){return new t(Object.assign(Object.assign({},this.state),{h:"sec"}))}get suc(){return new t(Object.assign(Object.assign({},this.state),{h:"suc"}))}get inf(){return new t(Object.assign(Object.assign({},this.state),{h:"inf"}))}get war(){return new t(Object.assign(Object.assign({},this.state),{h:"war"}))}get dan(){return new t(Object.assign(Object.assign({},this.state),{h:"dan"}))}get hue(){return{pri:this.pri,sec:this.sec,suc:this.suc,inf:this.inf,war:this.war,dan:this.dan}}alpha(e=1){return new t(Object.assign(Object.assign({},this.state),{a:e}))}get bg(){return new t(Object.assign(Object.assign({},this.state),{m:"bg"}))}get fg(){return new t(Object.assign(Object.assign({},this.state),{m:"fg"}))}toString(){const{l:t,c:s,h:r,a:n,m:i}=this.state;return`oklch(${e(`lightness.${i}.${t}`)} ${e(`chroma.${i}.${s}`)} ${e(`hue.${r}`)} / ${n})`}}return new t},he="coef",ge=e=>{class t{constructor(e={}){this.state={center:8},this.state=Object.assign(this.state,e)}get min(){return e(`${he}.${this.state.center-4}`)}get xxs(){return e(`${he}.${this.state.center-3}`)}get xs(){return e(`${he}.${this.state.center-2}`)}get s(){return e(`${he}.${this.state.center-1}`)}get m(){return e(`${he}.${this.state.center}`)}get l(){return e(`${he}.${this.state.center+1}`)}get xl(){return e(`${he}.${this.state.center+2}`)}get xxl(){return e(`${he}.${this.state.center+3}`)}get max(){return e(`${he}.${this.state.center+4}`)}get $xxs(){return new t({center:4})}get $xs(){return new t({center:8})}get $s(){return new t({center:12})}get $m(){return new t({center:16})}get $l(){return new t({center:20})}get $xl(){return new t({center:24})}get $xxl(){return new t({center:28})}get short(){return{s:this.s,m:this.m,l:this.l}}get base(){return Object.assign(Object.assign({xs:this.xs},this.short),{xl:this.xl})}get long(){return Object.assign(Object.assign({xxs:this.xxs},this.base),{xxl:this.xxl})}get full(){return Object.assign(Object.assign({min:this.min},this.long),{max:this.max})}get main(){return{min:this.min,m:this.m,max:this.max}}get sparse(){return{min:this.min,xs:this.xs,m:this.m,xl:this.xl,max:this.max}}}return new t},me=Object.assign,de=Object.entries,pe=Array.isArray,be=e=>"object"==typeof e,fe=(e,t)=>Array.from(Array(e).entries()).reduce(((e,[s])=>me(e,t(s+1))),{}),$e=(e,t)=>de(e).reduce(((e,[s,r])=>me(e,t(s,r))),{}),ye=(e,t,s={})=>e?t:s,ve=(...e)=>e.join("-"),je=(...e)=>e.join(),Oe=(...e)=>e.join(" "),xe=(e,...t)=>t.length?t.reduce(((e,t)=>(t&&e&&be(t)&&de(t).forEach((([t,s])=>{s&&be(s)&&e[t]?pe(e[t])&&pe(s)?e[t]=[...e[t],...s]:xe(e[t],s||{}):e[t]=s})),e)),e):e,we=Object.assign(J(K(Y).map((([e,t])=>{function s(e=""){return e+t}return s.toString=()=>t,[e,s]}))),J(K(ee).map((([e,t])=>{function s(e,s=""){return s+t+`(${e})`}return s.toString=()=>t,[e,s]})))),ke={oklch:te,lighten:re,darken:ne,saturate:le,desaturate:oe,fadein:ie,fadeout:ae,spin:ce},Se={px:w,vh:k,vw:S,vmin:_,vmax:A,em:z,rem:P,deg:q,rad:C,turn:E,ms:T,s:N,pc:M,cqw:B,cqh:W,cqb:I,cqi:R,cqmin:V,cqmax:D},_e=e=>1!==e?e+" * ":"",Ae=e=>{const{scope:s,globalKey:a}=e,l=s(a).varExp,o=(e=1)=>Se.ms(_e(e)+l("time")),u=(e=1)=>Se.deg(_e(e)+l("angle")),b=(e=1)=>Se.px(_e(e)+l("size"));return{compile:({key:e,maker:a})=>{const $=s(e),j=$.selector,x=(e=>{const t={cp:1,lay:1,kf:1,cq:1},s=(n={})=>{const{scroll:i,type:a,name:l,condition:o}=n,c=p(o),u=`@container${l?" "+l:""}${c?" "+c:""}`;return Object.defineProperties((e=>({[u]:e})),{container:{value:(l||"none")+" / "+(a&&i?`${a} scroll-state`:i?"scroll-state":a||"normal"),enumerable:!0},named:{get:()=>s({scroll:i,condition:o,name:l||e.name(["cq",t.cq++]),type:a})},size:{get:()=>s({name:l,scroll:i,condition:o,type:"size"})},isize:{get:()=>s({name:l,scroll:i,condition:o,type:"inline-size"})},scroll:{get:()=>s({name:l,scroll:!0,condition:o,type:a})},where:{value:e=>s({name:l,scroll:i,condition:e,type:a})},[r]:{value:!0},toString:{value:()=>u}})},n=({name:s}={})=>{const r=`${i}${s?" "+s:""}`,a=e=>({[r]:e});return a.toString=()=>r,Object.defineProperties(a,{named:{get:()=>n({name:s||e.name(["lay",t.lay++])})},list:{value:(...e)=>({[i+(e.map((e=>(e+"").split(i)[1])).filter(Boolean).join(",")||s)]:""})}})};return{layer:n(),supports:y,keyframes:s=>{const n=e.name(["kf",t.kf++]),i="@keyframes "+n;return Object.defineProperties((e=>{if(!e)return{animationName:n};const{dur:t,tf:s,del:r,ic:i,dir:a,ps:l,fm:o}=e;return{animation:[t,s,r,i,a,l,o,n].filter(Boolean).join(" ")}}),{[i]:{value:s,enumerable:!0},toString:{value:()=>n},[r]:{value:!0}})},property:(s={})=>{const{syn:n='"*"',inh:i=!0,ini:a,def:l}=s,o="--"+e.name(["cp",t.cp++]),c=`var(${o}${void 0!==l?","+l:""})`,u="@property "+o;return Object.defineProperties((e=>({[o]:e})),{[u]:{value:{syntax:n,inherits:i,initialValue:a},enumerable:!0},toString:{value:()=>c},fallback:{value:e=>`var(${o},${e})`},[r]:{value:!0}})},scope:O,media:f,container:s({}),startingStyle:v,$logic:c,$width:h,$height:g,$block:d,$inline:m}})($);return w=a({dash:ve,comma:je,space:Oe,range:fe,each:$e,when:ye,merge:xe,themeVar:l,size:b,time:o,angle:u,bem:j,pseudo:we,color:ke,palette:ue(l),coef:ge(l),units:Se,at:x}),t(w,((e,t)=>e+n(...t)),"");var w}}},ze=Symbol("effcss-stylesheet");class Pe{constructor(){this.disabled=!1,this.cssRules=[]}replaceSync(e){e&&(this.cssRules=[{cssText:e}])}}function qe({initStyles:e,emulate:t}={}){const s={};null==e||e.forEach((e=>{var t;const r=null===(t=null==e?void 0:e.dataset)||void 0===t?void 0:t.effcss;r&&(s[r]=e)}));let r={},n={},i=[],a=[];const l=(e,t)=>t.hasOwnProperty(ze)?t:Object.defineProperties(t,{[ze]:{value:e}}),o=e=>{var t;return e.adoptedStyleSheets=[...(null===(t=e.adoptedStyleSheets)||void 0===t?void 0:t.length)?[...e.adoptedStyleSheets].filter((e=>!e.hasOwnProperty(ze))):[],...i]},c=()=>{a=a.reduce(((e,t)=>{const s=t.deref();return s&&(o(s),e.push(t)),e}),[])},u=e=>e?r[e]:void 0,h=(e,t)=>{if(!r[e]){r[e]=l(e,t),i.push(r[e]);const n=s[e];return n&&(n.disabled=!0),c(),!0}};return{get:u,all:()=>r,add:h,status:e=>{const t=u(e);return!(null==t?void 0:t.disabled)},on:(...e)=>{e.forEach((e=>{const t=u(e);t&&(t.disabled=!1)})),c()},off:(...e)=>{e.forEach((e=>{const t=u(e);t&&(t.disabled=!0)})),c()},remove:e=>{const t=u(e);if(!t)return;const s=(a=t,i.findIndex((e=>e===a)));var a;return s>-1&&(i.splice(s,1),delete r[e],delete n[e]),c(),!0},removeAll:()=>(i.splice(0),r={},n={},c(),!0),pack:(e,s)=>{let n=r[e]||(!t&&globalThis.CSSStyleSheet?new globalThis.CSSStyleSheet:new Pe);return n.replaceSync(s),n=l(e,n),!!n.cssRules.length&&h(e,n)},register:e=>{a.findIndex((t=>t.deref()===e))>=0||(a.push(new WeakRef(e)),o(e))},unregister:e=>{const t=a.findIndex((t=>t.deref()===e));t>=0&&a.splice(t,1)},hydrate:e=>s[e]&&!s[e].disabled&&s[e].textContent||void 0}}const Ce=({prefix:e})=>{let t=0;return{get initial(){return e+0},get current(){return e+t},next(){return t++,this.current}}},Ee=({prefix:e})=>{const t=new Set,s=new Map,r=Ce({prefix:e});return{use(e){let n=this.key(e);return n||(n=r.current,t.add(n),s.set(e,n),r.next(),n)},remake(e,t){const r=s.get(t);return r?(s.delete(t),s.set(e,r),r):this.use(e)},key:e=>e?s.get(e)||"":r.initial,get keys(){return[...t]},get makers(){return Object.fromEntries(s.entries().map((([e,t])=>[t,e])))}}},Te=void 0,Ne=Object.entries,Me=Object.defineProperties,Be=e=>"string"==typeof e,We=e=>null!==e&&"object"==typeof e,Re=e=>e.split("."),Ie=(e,t)=>Ne(e).reduce(((e,[s,r])=>{if(We(r)){const n=Ne(r);n.length?e.push(...n.reduce(((e,[r,n])=>{if((e=>null!==e&&e!==Te)(r)&&t&&e.push([s,r,Te,Te]),We(n)){const t=Ne(n);t.length&&e.push(...t.reduce(((e,[t,n])=>{const i=typeof n;return"string"!==i&&"number"!==i||e.push([s,r,t,n]),e}),[]))}return e}),[])):e.push([s,Te,Te,Te])}return e}),[]),Ve=(e,t,s,r)=>""+(((e,t)=>`${e||""}${t?"__"+t:""}`)(e,t)+(s?"_"+s:"")+(s&&r?"_"+r:""))||"_",De=(e,t)=>"."+(t?e+(t.startsWith("_")?"":"-")+t:e),Je=(e,t)=>`[data-${e}${t?`~="${t}"`:""}]`;const Ke=e=>e||"",Le=Object.assign,Fe=Object.entries,He="theme",Ze="delete",Ge="update",Qe="$light",Ue="$dark",Xe="lightness",Ye="chroma",et=e=>Number((.1*184+.9*e).toFixed(2)),tt={time:200,size:16,angle:30,coef:{0:0,1:.0625,2:.125,3:.25,4:.5,5:.75,6:.875,7:.9375,8:1,9:1.0625,10:1.125,11:1.25,12:1.5,13:1.75,14:1.875,15:1.9375,16:2,17:2.5,18:4,19:5,20:7.5,21:10,22:12,23:15,24:16,25:20,26:28,27:36,28:48,29:64,30:80,31:120,32:150},hue:{pri:184,sec:290,suc:et(142),inf:et(264),war:et(109),dan:et(29)},[Qe]:{[Xe]:{bg:{xl:.98,l:.93,m:.88,s:.83,xs:.78},fg:{xl:0,l:.12,m:.24,s:.36,xs:.48}},[Ye]:{bg:{gray:0,pale:.01,base:.04,rich:.7},fg:{gray:0,pale:.07,base:.11,rich:.15}}},[Ue]:{[Xe]:{bg:{xl:.24,l:.3,m:.36,s:.42,xs:.48},fg:{xl:.98,l:.93,m:.86,s:.79,xs:.72}},[Ye]:{bg:{pale:.02,base:.06,rich:.1},fg:{pale:.06,base:.1,rich:.14}}}},st=({provider:t,init:s,scope:r,onChange:n})=>{const i={"":tt},a=[],l={get:(e="")=>i[e],add(e,t){i[t]||(i[t]=xe({[Qe]:{},[Ue]:{}},e),a.push({type:"add",payload:{params:e,name:t}}),null==n||n())},delete(e){e&&i[e]&&(this.current===e&&this.switch(),delete i[e],a.push({type:Ze,payload:{name:e}}),null==n||n())},update(e,t=""){i[t]&&(i[t]=xe({[Qe]:{},[Ue]:{}},i[t],e),a.push({type:Ge,payload:{params:e,name:t}}),null==n||n())},switch(e=""){i[e]&&t.setAttribute(He,e)},vars(t=""){const s=this.get(t);return s?(t=>{var{$light:s={},$dark:n={}}=t,i=e(t,["$light","$dark"]);function a(e,t=[]){return Fe(e).reduce(((e,[s,n])=>n&&"object"==typeof n?Le(e,a(n,[...t,s])):(e[r.varName([...t,s])]=n,e)),{})}return Object.assign(Object.assign({},a(i)),{[Qe]:a(s),[Ue]:a(n)})})(s):{[Qe]:{},[Ue]:{}}},get list(){const t=e(i,[""]);return Object.keys(t)},get current(){return t.getAttribute(He)||""},get all(){return i},get actions(){return a}};return null==s||s.forEach((({type:e,payload:t})=>{switch(e){case"add":l.add(t.params,t.name);break;case Ze:l.delete(t.name);break;case Ge:l.update(t.params,t.name)}})),l},rt="effcss",nt=rt+"-provider",it="script",at="style",lt="size",ot="time",ct="angle",ut=rt+"changes",ht="data-"+rt,gt="prefers-color-scheme",mt=`${gt}: light`,dt=`${gt}: dark`,pt={mode:"a",pre:"f"},bt=e=>"boolean"==typeof e,ft=(e,t)=>{const s=((e,t)=>e.getAttribute(t)||pt[t])(e,t);return(e=>"string"==typeof e?Number(e):null)(s)},$t=(e,t,s)=>null===s?e.removeAttribute(t):e.setAttribute(t,s+""),yt=e=>`:root:has([is=${nt}]${e?`[${e}]`:""})`,vt=({theme:t,attrs:s,scope:r})=>({bem:n,each:i,themeVar:a,merge:l,pseudo:{r:o},at:{media:c},units:{px:u}})=>{const h=s.size,g=s.time,m=s.angle,d=t.vars(),{$dark:p={},$light:b={}}=d,f=e(d,["$dark","$light"]);return l({[yt()]:Object.assign(Object.assign(Object.assign(Object.assign({},f),c.where(mt)(b)),c.where(dt)(p)),{[o()]:{fontSize:u(a("size"))}})},i(t.list,((s,r)=>{const i=t.vars(r),{$dark:a={},$light:l={}}=i,o=e(i,["$dark","$light"]),u=Object.assign(Object.assign(Object.assign({},o),c.where(mt)(l)),c.where(dt)(a));return{[yt(`theme=${s}`)]:u,[n(`..theme.${s}`)]:u}})),h&&{[yt(lt)]:{[r.varName(lt)]:h}},g&&{[yt(ot)]:{[r.varName(ot)]:g}},m&&{[yt(ct)]:{[r.varName(ct)]:m}})},jt=(e,{initStyles:t,emulate:s,onChange:r,globalMaker:n,noscript:i})=>{let a;e.textContent&&(a=JSON.parse(e.textContent)),Object.defineProperties(e,{pre:{get:()=>e.getAttribute("pre")||"f"},mode:{get:()=>e.getAttribute("mode")||"a"},min:{get:()=>""===e.getAttribute("min")},size:{set(t){$t(e,lt,t)},get:()=>ft(e,lt)},time:{set(t){$t(e,ot,t)},get:()=>ft(e,ot)},angle:{set(t){$t(e,ct,t)},get:()=>ft(e,ct)}});const l=Ee({prefix:e.pre}),o=((e={})=>{const{mode:t,min:s,dict:r={}}=e;let n;n="a"===t?Je:De;const i=e=>{let s=0,r=Ke,a=Ke;const l=i.dict;l&&(l[e]||(l[e]={}),r=t=>{var r;return null!==(r=l[e][t])&&void 0!==r?r:l[e][t]=(s++).toString(36)},a=t=>l[e][t]);let o=t=>[e,...Be(t)?t.split("."):t].filter(Boolean).join("-"),c="class",u=t=>t?e+(t.startsWith("_")?"":"-")+t:void 0===t?void 0:e;"a"===t&&(c="data-"+e,u=Ke);const h=e=>"--"+o(Be(e)?e.split("."):e),g=e=>{if(void 0===e)return function(e){const t=({b:s,e:r,m:n})=>({b:e=>t({b:e,e:"",m:{}}),e:e=>t({b:s,e:e,m:{}}),m:(e={})=>t({b:s,e:r,m:e}),get $(){return e({[s]:{[r]:n}})}});return t({b:"",e:"",m:{}})}(g);let t,s,r,n,i="";const l=Be(e);return i=l||Array.isArray(e)?[...(l?[e]:e).reduce(((e,i)=>([t,s,r,n]=Re(i),e.add(u(a(Ve(t,s)))),r&&e.add(u(a(Ve(t,s,r,n)))),e)),new Set).values()].join(" "):e&&Ie(e,!0).map((([e,t,s,r])=>u(a(Ve(e,t,s,r))))).join(" "),Me({[c]:i},{toString:{value:()=>`${c}="${i}"`},$:{value:i}})};return{selector:t=>{const[s,i,a,l]=Re(t);return n(e,r(Ve(s,i,a,l)))},attr:g,name:o,varName:h,varExp:(e,t)=>`var(${h(e)}${void 0!==t?","+t:""})`}};return s&&(i.dict=r),i})({mode:e.mode,min:e.min,dict:null==a?void 0:a.dict}),c=o(l.key()),u=Ae({scope:o,globalKey:l.key()}),h=qe({initStyles:t,emulate:s});e.theme=st({provider:e,init:null==a?void 0:a.theme,onChange:r,scope:c});const g=(({scope:e,collector:t,manager:s,processor:r,globalMaker:n})=>{const i=e=>"string"==typeof e?e:t.key(e),a=s=>e(s||t.key()).attr,l=(e,t)=>r.compile({key:t,maker:e}),o=e=>{let r=t.use(e);return s&&!s.get(r)&&s.pack(r,s.hydrate(r)||l(e,r)),a(r)},c=(...e)=>0===e.length?[o(n)]:e.map((e=>o(e)));return{use:c,remake:(e,r)=>{let n=t.key(r||e);return s&&s.get(n)?(r&&t.remake(e,r),s.pack(n,s.hydrate(n)||l(e,n)),a(n)):c(e)[0]},css:l,status:e=>{const t=i(e);return!!t&&s.status(t)},on:(...e)=>s.on(...e.map(i)),off:(...e)=>s.off(...e.map(i)),stylesheets:(e=t.keys)=>e.map((e=>s.get(i(e))))}})({scope:o,processor:u,manager:h,collector:l,globalMaker:n});Object.defineProperties(e,{_c:{value:l},_s:{value:o},_p:{value:u},_m:{value:h},toString:{value:()=>{const t=Object.assign({},h.all()),s=Object.entries(t).filter((([e,t])=>!t.disabled)).map((([e,t])=>`<style ${ht}="${e}">${[...t.cssRules].map((e=>e.cssText)).join("")}</style>`)).join("");let r=at,n="";const a={is:nt,min:e.getAttribute("min"),mode:e.getAttribute("mode"),size:e.getAttribute(lt),time:e.getAttribute(ot),angle:e.getAttribute(ct)};if(!i){r=it,a.type="application/json";const t={theme:e.theme.actions};e.min&&l.keys.length>1&&(t.dict=o.dict),n=JSON.stringify(t)}return s+`<${r} ${Object.entries(a).map((([e,t])=>null!=t&&t!==pt[e]?""===t?e:`${e}="${t}"`:"")).filter(Boolean).join(" ")}${e.theme.current?` theme="${e.theme.current}"`:""}>${n}</${r}>`}}}),Object.assign(e,g)},Ot=Symbol(nt);const xt=(e={})=>{let{noscript:t,attrs:s={}}=e,{mode:r=pt.mode,min:n,pre:i=pt.prefix,size:a=null,time:l=null,angle:o=null}=s;return new class{get tagName(){return""}get textContent(){return""}getAttribute(e){const t=this.attributes[e];return null!=t?bt(t)?"":t+"":null}setAttribute(e,t){this.attributes[e]=t+"",e!==lt&&e!==ot&&e!==ct||this._customize()}removeAttribute(e){delete this.attributes[e]}get makers(){return this._c.makers}constructor(){this.attributes={size:a?a+"":null,time:l?l+"":null,angle:o?o+"":null,pre:i,mode:r,min:n?"":null},this._customize=()=>{const e=this.size,t=this.time,s=this.angle,r=vt({theme:this.theme,attrs:{size:e,time:t,angle:s},scope:this._s(this._c.key())});this.remake(r,this._),this._=r},jt(this,{emulate:!0,onChange:this._customize,globalMaker:this._,noscript:t}),this._customize()}}},wt=(t={})=>{const{emulate:s,global:r}=t,n=e(t,["emulate","global"]),i=null===globalThis||void 0===globalThis?void 0:globalThis.document;let a;const l=globalThis[Ot];if(r&&l)a=l;else if(i&&!s){void 0===wt.isDefined&&(wt.isDefined=function(){const e=globalThis.document,t=globalThis.customElements;if(null==t?void 0:t.get(nt))return!1;{class s extends HTMLScriptElement{constructor(){super(...arguments),this._customize=()=>{const e=this.size,t=this.time,s=this.angle,r=vt({theme:this.theme,attrs:{size:e,time:t,angle:s},scope:this._s(this._c.key())});this.remake(r,this._),this._=r}}static get observedAttributes(){return[lt,ot,ct]}get makers(){return this._c.makers}attributeChangedCallback(){this.isConnected&&this._customize()}connectedCallback(){jt(this,{initStyles:[...e.querySelectorAll(at+`[${ht}]`)],onChange:this._customize,globalMaker:this._}),this._customize();const t=this;this._n={set adoptedStyleSheets(e){t.dispatchEvent(new CustomEvent(ut,{detail:{styles:e},bubbles:!0}))}},this._m.register(this._n),this._m.register(e)}}return t.define(nt,s,{extends:it}),!0}}());const e=i.querySelector(`[is=${nt}]`);if(e)a=e;else{const e=i.createElement(it,{is:nt});e.setAttribute("is",nt);const t=null==n?void 0:n.attrs;t&&Object.entries(t).map((([t,s])=>s&&pt[t]!==s&&e.setAttribute(t,bt(s)?"":s+""))),i.head.appendChild(e),a=e}}else a=xt(n);return r&&!l&&(globalThis[Ot]=a),a};export{pt as DEFAULT_ATTRS,nt as TAG_NAME,wt as useStyleProvider};
@@ -218,5 +218,56 @@ export declare const resolveAtRules: (ctx: ReturnType<ReturnType<TCreateScope>>)
218
218
  toString: () => string;
219
219
  };
220
220
  };
221
+ /**
222
+ * Height condition maker
223
+ */
224
+ $height: {
225
+ up: (val: string | number) => {
226
+ toString: () => string;
227
+ };
228
+ down: (val: string | number) => {
229
+ toString: () => string;
230
+ };
231
+ between: (from: string | number, to: string | number) => {
232
+ toString: () => string;
233
+ };
234
+ only: (val: string | number) => {
235
+ toString: () => string;
236
+ };
237
+ };
238
+ /**
239
+ * Block-size condition maker
240
+ */
241
+ $block: {
242
+ up: (val: string | number) => {
243
+ toString: () => string;
244
+ };
245
+ down: (val: string | number) => {
246
+ toString: () => string;
247
+ };
248
+ between: (from: string | number, to: string | number) => {
249
+ toString: () => string;
250
+ };
251
+ only: (val: string | number) => {
252
+ toString: () => string;
253
+ };
254
+ };
255
+ /**
256
+ * Inline-size condition maker
257
+ */
258
+ $inline: {
259
+ up: (val: string | number) => {
260
+ toString: () => string;
261
+ };
262
+ down: (val: string | number) => {
263
+ toString: () => string;
264
+ };
265
+ between: (from: string | number, to: string | number) => {
266
+ toString: () => string;
267
+ };
268
+ only: (val: string | number) => {
269
+ toString: () => string;
270
+ };
271
+ };
221
272
  };
222
273
  export {};
@@ -173,6 +173,10 @@ type TUseStylePropviderParams = {
173
173
  * Create Style Provider emulation
174
174
  */
175
175
  emulate?: boolean;
176
+ /**
177
+ * Use as global object
178
+ */
179
+ global?: boolean;
176
180
  };
177
181
  type TUseStyleProvider = {
178
182
  (settings?: TUseStylePropviderParams): IStyleProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effcss",
3
- "version": "4.0.1",
3
+ "version": "4.2.0",
4
4
  "description": "Self-confident CSS-in-JS",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -12,7 +12,8 @@
12
12
  "ui",
13
13
  "typescript",
14
14
  "css",
15
- "css-in-js"
15
+ "css-in-js",
16
+ "css-in-ts"
16
17
  ],
17
18
  "author": "Marat Sabitov",
18
19
  "license": "Apache-2.0",