effcss 4.6.2 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -142,7 +142,7 @@ export type TCardMaker = {
142
142
  };
143
143
  }
144
144
 
145
- const myStyleSheetMaker: TStyleSheetMaker = ({ select, pseudo, at: { keyframes, property }, merge, palette, coef, size, units: {px} }) = {
145
+ const myStyleSheetMaker: TStyleSheetMaker = ({ select, pseudo: {h}, at: { keyframes, property }, merge, palette, coef, size, units: {px} }) = {
146
146
  // specify selector variants via generic
147
147
  const selector = select<TCardMaker>;
148
148
  // create property with unique identifier
@@ -164,16 +164,16 @@ const myStyleSheetMaker: TStyleSheetMaker = ({ select, pseudo, at: { keyframes,
164
164
  const cardLogoStyles = merge({
165
165
  width: widthProperty,
166
166
  animation: `20s linear infinite ${spin}`,
167
- [pseudo.h()]: {
167
+ ...h({
168
168
  filter: "drop-shadow(0 0 2em #61dafbaa)",
169
- }
169
+ })
170
170
  }, {
171
171
  border: 'none',
172
172
  background: palette.pale.xl.alpha(0.8),
173
173
  aspectRatio: 1,
174
- [pseudo.h()]: {
174
+ ...h({
175
175
  opacity: 0.5
176
- }
176
+ })
177
177
  });
178
178
  return {
179
179
  ...sizeProperty,
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * EffCSS v4.6.2
2
+ * EffCSS v4.7.0
3
3
  * {@link https://sourcecraft.dev/msabitov/effcss}
4
4
  * Copyright (c) Marat Sabitov
5
5
  * @license Apache-2.0
6
6
  */
7
- const e=(e,t,r)=>Object.entries(e).reduce(t,r),t=(e,t)=>{return`${r=e,r.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))}:${""+t};`;var r},r=Symbol("noParse"),s=(n,i,a)=>{let o=""+n;return null==i?"":Array.isArray(i)?i.map((e=>t(o,e))).join(""):"object"!=typeof i||i.hasOwnProperty(r)?""===i?o+";":t(o,i):(!a||a.startsWith?.("@")||o.startsWith?.("&")||o.startsWith?.("@")?"":"&")+o+`{${e(i,((e,t)=>e+s(...t,o)),"")}}`},n="@layer",i="@starting-style",a=e=>`(${e})`,o=e=>"string"==typeof e,l={and:(...e)=>Object.defineProperties({type:"and",value:e},{toString:{value:()=>e.filter(Boolean).map((e=>{const t=g(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=>g(e))).join(" or ")}}),not:e=>"object"==typeof e&&"not"===e.type?e.value[0]:Object.defineProperties({type:"not",value:[e]},{toString:{value:()=>`not (${g(e,!0)})`}})},c=e=>{const t=t=>({toString:()=>`(min-${e}:${o(t)?t:t+"rem"})`}),r=t=>({toString:()=>`(max-${e}:${o(t)?t:t+"rem"})`}),s=(e,s)=>({toString:()=>`${t(e)} and ${r(s)}`});return{up:t,down:r,between:s,only:e=>s(e,e)}},u=c("width"),h=c("height"),m=c("inline-size"),d=c("block-size"),g=(e,t)=>e?"string"==typeof e?e.includes("(")||t?e:a(e):e+"":"",p=(e={})=>{const{type:t,condition:r}=e,s=g(r),n="object"==typeof r&&"or"===r.type,i=`@media${t?" "+t:""}${t&&s?" and":""}${s?" "+(t&&n?a(s):s):""}`;return Object.defineProperties((e=>({[i]:e})),{all:{get:()=>p({condition:r,type:"all"})},print:{get:()=>p({condition:r,type:"print"})},screen:{get:()=>p({condition:r,type:"screen"})},where:{value:e=>p({condition:e,type:t})},toString:{value:()=>i}})},b=p({}),f=({condition:e}={})=>{const t=g(e),r="@supports"+(t?" "+t:"");return Object.defineProperties((e=>({[r]:e})),{where:{value:e=>f({condition:e})},toString:{value:()=>r}})},$=f(),y=e=>({[i]:e});y.toString=i;const v=e=>{const{root:t="",limit:r="",mode:s=[!1,!1]}=e,n=`@scope ${t?`(${t}${s[0]?" > *":""})`:""}${t&&r?" ":""}${r?`to (${r}${s[1]?" > *":""})`:""}`;return Object.defineProperties((e=>({[n]:e})),{limit:{value:e=>v({root:t,limit:e,mode:s})},root:{value:e=>v({root:e,limit:r,mode:s})},both:{value:()=>v({root:t,limit:r,mode:[!1,!0]})},none:{value:()=>v({root:t,limit:r,mode:[!0,!1]})},low:{value:()=>v({root:t,limit:r,mode:[!0,!0]})},high:{value:()=>v({root:t,limit:r,mode:[!1,!1]})},toString:{value:()=>n}})},x=v({}),w=(e,t)=>`calc(${e} * 1${t})`,S=e=>w(e,"px"),k=e=>w(e,"vh"),j=e=>w(e,"vw"),_=e=>w(e,"vmin"),O=e=>w(e,"vmax"),A=e=>w(e,"em"),z=e=>w(e,"rem"),C=e=>w(e,"deg"),q=e=>w(e,"rad"),P=e=>w(e,"rad"),T=e=>w(e,"ms"),E=e=>w(e,"s"),N=e=>w(e,"%"),M=e=>w(e,"cqw"),R=e=>w(e,"cqh"),B=e=>w(e,"cqi"),W=e=>w(e,"cqb"),I=e=>w(e,"cqmin"),V=e=>w(e,"cqmax"),J=Object.fromEntries,L=Object.entries,H=":first-",D=":last-",K=":only-",U="child",F=":nth-",Z="of-type",G=F+U,Q=":focus",X="valid",Y="in"+X,ee=":user-",te={r:":root",h:":hover",f:Q,fv:Q+"-visible",a:":active",v:":visited",val:":"+X,inv:":"+Y,uval:ee+X,uinv:ee+Y,e:":empty",d:":disabled",rq:":required",o:":optional",m:":modal",l:":link",ph:":placeholder",ch:":checked",po:":popover-open",fc:H+U,lc:D+U,oc:K+U,odd:G+"(odd)",even:G+"(even)",ft:H+Z,lt:D+Z,ot:K+Z,bef:"::before",aft:"::after",bd:"::backdrop"},re={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:G,ntho:F+Z,dir:":dir",lang:":lang"},se=e=>`oklch(${e})`,ne=e=>se(`from ${e}`),ie=(e,t=.1)=>ne(`${e} calc(l + ${t}) c h / alpha`),ae=(e,t=.1)=>ne(`${e} calc(l - ${t}) c h / alpha`),oe=(e,t=.1)=>ne(`${e} l c h / calc(alpha + ${t})`),le=(e,t=.1)=>ne(`${e} l c h / calc(alpha - ${t})`),ce=(e,t=.04)=>ne(`${e} l calc(c + ${t}) h / alpha`),ue=(e,t=.04)=>ne(`${e} l calc(c - ${t}) h / alpha`),he=(e,t=30)=>ne(`${e} l c calc(h${"number"==typeof t?t>0?" + "+t:" - "+-t:t}) / alpha`),me=e=>{const t=e("color");return{root:e=>e?ne(t+` ${e.l||"l"} ${e.c||"c"} ${e.h||"h"} / ${e.a||"1"}`):t,oklch:se,lighten:ie,darken:ae,saturate:ce,desaturate:ue,fadein:oe,fadeout:le,spin:he}},de=e=>{class t{state={l:"l",c:"base",h:"pri",a:"1",m:"bg"};constructor(e={}){Object.assign(this,{[r]:!0}),this.state=Object.assign(this.state,e)}get xs(){return new t({...this.state,l:"xs"})}get s(){return new t({...this.state,l:"s"})}get m(){return new t({...this.state,l:"m"})}get l(){return new t({...this.state,l:"l"})}get xl(){return new t({...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({...this.state,c:"gray"})}get pale(){return new t({...this.state,c:"pale"})}get base(){return new t({...this.state,c:"base"})}get rich(){return new t({...this.state,c:"rich"})}get chroma(){return{gray:this.gray,pale:this.pale,base:this.base,rich:this.rich}}get pri(){return new t({...this.state,h:"pri"})}get sec(){return new t({...this.state,h:"sec"})}get suc(){return new t({...this.state,h:"suc"})}get inf(){return new t({...this.state,h:"inf"})}get war(){return new t({...this.state,h:"war"})}get dan(){return new t({...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({...this.state,a:e+""})}get bg(){return new t({...this.state,m:"bg"})}get fg(){return new t({...this.state,m:"fg"})}toString(){const{l:t,c:r,h:s,a:n,m:i}=this.state;return`oklch(${e(`lightness.${i}.${t}`)} ${e(`chroma.${i}.${r}`)} ${e(`hue.${s}`)} / ${n})`}}return new t},ge=e=>{const t=(t,r=0)=>e(`coef.${t.state.center+r}`);class r{state={center:8};constructor(e={}){this.state=Object.assign(this.state,e)}get min(){return t(this,-4)}get xxs(){return t(this,-3)}get xs(){return t(this,-2)}get s(){return t(this,-1)}get m(){return t(this)}get l(){return t(this,1)}get xl(){return t(this,2)}get xxl(){return t(this,3)}get max(){return t(this,4)}get $xxs(){return new r({center:4})}get $xs(){return new r({center:8})}get $s(){return new r({center:12})}get $m(){return new r({center:16})}get $l(){return new r({center:20})}get $xl(){return new r({center:24})}get $xxl(){return new r({center:28})}get short(){return{s:this.s,m:this.m,l:this.l}}get base(){return{xs:this.xs,...this.short,xl:this.xl}}get long(){return{xxs:this.xxs,...this.base,xxl:this.xxl}}get full(){return{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 r},pe=Object.assign,be=Object.entries,fe=Array.isArray,$e=e=>"object"==typeof e,ye=(e,t)=>Array.from(Array(e).entries()).reduce(((e,[r])=>pe(e,t(r+1))),{}),ve=(e,t)=>be(e).reduce(((e,[r,s])=>pe(e,t(r,s))),{}),xe=(e,t,r={})=>e?t:r,we=(...e)=>e.join("-"),Se=(...e)=>e.join(),ke=(...e)=>e.join(" "),je=(e,...t)=>t.length?t.reduce(((e,t)=>(t&&e&&$e(t)&&be(t).forEach((([t,r])=>{r&&$e(r)&&e[t]?fe(e[t])&&fe(r)?e[t]=[...e[t],...r]:je(e[t],r||{}):e[t]=r})),e)),e):e,_e=Object.assign(J(L(te).map((([e,t])=>{function r(e=""){return e+t}return r.toString=()=>t,[e,r]}))),J(L(re).map((([e,t])=>{function r(e,r=""){return r+t+`(${e})`}return r.toString=()=>t,[e,r]})))),Oe={px:S,vh:k,vw:j,vmin:_,vmax:O,em:A,rem:z,deg:C,rad:q,turn:P,ms:T,s:E,pc:N,cqw:M,cqh:R,cqb:W,cqi:B,cqmin:I,cqmax:V},Ae=e=>1!==e?e+" * ":"",ze=t=>{const{scope:i,globalKey:a}=t,o=i(a).varExp,c=(e=1)=>Oe.ms(Ae(e)+o("time")),p=(e=1)=>Oe.deg(Ae(e)+o("angle")),f=(e=1)=>Oe.px(Ae(e)+o("size")),v=e=>e?`cubic-bezier(${e.x1||0},${e.y1||0},${e.x2||1},${e.y2||1})`:o("easing");return{compile:({key:t,maker:a})=>{const w=i(t),S=w.selector,k=w.select,j=(e=>{const t={cp:1,lay:1,kf:1,cq:1},s=(n={})=>{const{scroll:i,type:a,name:o,condition:l}=n,c=g(l),u=`@container${o?" "+o:""}${c?" "+c:""}`;return Object.defineProperties((e=>({[u]:e})),{container:{value:(o||"none")+" / "+(a&&i?`${a} scroll-state`:i?"scroll-state":a||"normal"),enumerable:!0},named:{get:()=>s({scroll:i,condition:l,name:o||e.name(["cq",t.cq++]),type:a})},size:{get:()=>s({name:o,scroll:i,condition:l,type:"size"})},isize:{get:()=>s({name:o,scroll:i,condition:l,type:"inline-size"})},scroll:{get:()=>s({name:o,scroll:!0,condition:l,type:a})},where:{value:e=>s({name:o,scroll:i,condition:e,type:a})},[r]:{value:!0},toString:{value:()=>u}})},i=({name:r}={})=>{const s=`${n}${r?" "+r:""}`,a=e=>({[s]:e});return a.toString=()=>s,Object.defineProperties(a,{named:{get:()=>i({name:r||e.name(["lay",t.lay++])})},list:{value:(...e)=>({[n+(e.map((e=>(e+"").split(n)[1])).filter(Boolean).join(",")||r)]:""})}})};return{layer:i(),supports:$,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:r,del:s,ic:i,dir:a,ps:o,fm:l}=e;return{animation:[t,r,s,i,a,o,l,n].filter(Boolean).join(" ")}}),{[i]:{value:s,enumerable:!0},toString:{value:()=>n},[r]:{value:!0}})},property:(s={})=>{let n,i,a='"*"',o=!0;"object"==typeof s?({syn:a=a,inh:o=o,ini:n,def:i}=s):(i=s,n=s,o=!1);const l="--"+e.name(["cp",t.cp++]),c=`var(${l}${void 0!==i?","+i:""})`,u="@property "+l;return Object.defineProperties((e=>({[l]:e})),{[u]:{value:{syntax:a,inherits:o,initialValue:n},enumerable:!0},toString:{value:()=>c},fallback:{value:e=>`var(${l},${e})`},[r]:{value:!0}})},scope:x,media:b,container:s({}),startingStyle:y,$logic:l,$width:u,$height:h,$block:d,$inline:m}})(w),_=a({dash:we,comma:Se,space:ke,range:ye,each:ve,when:xe,merge:je,themeVar:o,size:f,time:c,angle:p,easing:v,bem:S,select:k,pseudo:_e,color:me(o),palette:de(o),coef:ge(o),units:Oe,at:j});return"string"==typeof _?_:(t=>e(t,((e,t)=>e+s(...t)),""))(_)}}},Ce=Symbol("effcss-stylesheet");class qe{disabled=!1;cssRules=[];replaceSync(e){e&&(this.cssRules=[{cssText:e}])}}function Pe({initStyles:e,emulate:t}={}){const r={};e?.forEach((e=>{const t=e?.dataset?.effcss;t&&(r[t]=e)}));let s={},n={},i=[],a=[];const o=(e,t)=>t.hasOwnProperty(Ce)?t:Object.defineProperties(t,{[Ce]:{value:e}}),l=e=>e.adoptedStyleSheets=[...e.adoptedStyleSheets?.length?[...e.adoptedStyleSheets].filter((e=>!e.hasOwnProperty(Ce))):[],...i],c=()=>{a=a.reduce(((e,t)=>{const r=t.deref();return r&&(l(r),e.push(t)),e}),[])},u=e=>e?s[e]:void 0,h=(e,t)=>{if(!s[e]){s[e]=o(e,t),i.push(s[e]);const n=r[e];return n&&(n.disabled=!0),c(),!0}};return{get:u,all:()=>s,add:h,status:e=>{const t=u(e);return!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 r=(a=t,i.findIndex((e=>e===a)));var a;return r>-1&&(i.splice(r,1),delete s[e],delete n[e]),c(),!0},removeAll:()=>(i.splice(0),s={},n={},c(),!0),pack:(e,r)=>{let n=s[e]||(!t&&globalThis.CSSStyleSheet?new globalThis.CSSStyleSheet:new qe);return n.replaceSync(r),n=o(e,n),!!n.cssRules.length&&h(e,n)},register:e=>{a.findIndex((t=>t.deref()===e))>=0||(a.push(new WeakRef(e)),l(e))},unregister:e=>{const t=a.findIndex((t=>t.deref()===e));t>=0&&a.splice(t,1)},hydrate:e=>r[e]&&!r[e].disabled&&r[e].textContent||void 0}}const Te=({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,r=new Map,s=Te({prefix:e});return{use(e){let n=this.key(e);return n||(n=s.current,t.add(n),r.set(e,n),s.next(),n)},remake(e,t){const s=r.get(t);return s?(r.delete(t),r.set(e,s),s):this.use(e)},key:e=>e?r.get(e)||"":s.initial,get keys(){return[...t]},get makers(){return Object.fromEntries(r.entries().map((([e,t])=>[t,e])))}}},Ne=void 0,Me=Object.entries,Re=Object.defineProperties,Be=e=>"string"==typeof e,We=e=>null!==e&&"object"==typeof e,Ie=e=>e.split("."),Ve=(e,t="")=>Me(e).reduce(((e,[r,s])=>{const n=t?`${t}-${r}`:r;return"object"==typeof s?(e.add(n),e=e.union(Ve(s,n))):e.add(n+`_${s}`),e}),new Set),Je=(e,t="")=>Me(e).reduce(((e,[r,s])=>{const n=t?`${t}-${r}`:r;if("object"==typeof s){const t=Je(s,n);t.size||e.add(n),e=e.union(t)}else t&&e.add(t),e.add(n+`_${s}`);return e}),new Set),Le=(e,t)=>Me(e).reduce(((e,[r,s])=>{if(We(s)){const n=Me(s);n.length?e.push(...n.reduce(((e,[s,n])=>{if((e=>null!==e&&e!==Ne)(s)&&t&&e.push([r,s,Ne,Ne]),We(n)){const t=Me(n);t.length&&e.push(...t.reduce(((e,[t,n])=>{const i=typeof n;return"string"!==i&&"number"!==i||e.push([r,s,t,n]),e}),[]))}return e}),[])):e.push([r,Ne,Ne,Ne])}return e}),[]),He=(e,t,r,s)=>""+(((e,t)=>`${e||""}${t?"__"+t:""}`)(e,t)+(r?"_"+r:"")+(r&&s?"_"+s:""))||"_",De=(e,t)=>"."+(t?e+(t.startsWith("_")?"":"-")+t:e),Ke=(e,t)=>`[data-${e}${t?`~="${t}"`:""}]`;const Ue=e=>e||"",Fe=Object.assign,Ze=Object.entries,Ge="theme",Qe="delete",Xe="update",Ye="$light",et="$dark",tt="lightness",rt="chroma",st=e=>Number((.1*184+.9*e).toFixed(2)),nt={time:200,size:16,angle:30,color:"#2192a7",easing:"linear",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:3,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:st(142),inf:st(264),war:st(109),dan:st(29)},[Ye]:{[tt]:{bg:{xl:1,l:.94,m:.88,s:.83,xs:.78},fg:{xl:0,l:.12,m:.24,s:.36,xs:.48}},[rt]:{bg:{gray:0,pale:.01,base:.04,rich:.7},fg:{gray:0,pale:.07,base:.11,rich:.15}}},[et]:{[tt]:{bg:{xl:.24,l:.3,m:.36,s:.42,xs:.48},fg:{xl:1,l:.93,m:.86,s:.79,xs:.72}},[rt]:{bg:{pale:.02,base:.06,rich:.1},fg:{pale:.06,base:.1,rich:.14}}}},it=({provider:e,init:t,scope:r,onChange:s})=>{const n={"":nt},i=[],a=({$light:e={},$dark:t={},...s})=>{function n(e,t=[]){return Ze(e).reduce(((e,[s,i])=>i&&"object"==typeof i?Fe(e,n(i,[...t,s])):(e[r.varName([...t,s])]=i,e)),{})}return{...n(s),[Ye]:n(e),[et]:n(t)}},o={get:(e="")=>n[e],add(e,t){n[t]||(n[t]=je({[Ye]:{},[et]:{}},e),i.push({type:"add",payload:{params:e,name:t}}),s?.())},delete(e){e&&n[e]&&(this.current===e&&this.switch(),delete n[e],i.push({type:Qe,payload:{name:e}}),s?.())},update(e,t=""){n[t]&&(n[t]=je({[Ye]:{},[et]:{}},n[t],e),i.push({type:Xe,payload:{params:e,name:t}}),s?.())},switch(t=""){n[t]&&e.setAttribute(Ge,t)},vars(e=""){const t=this.get(e);return t?a(t):{[Ye]:{},[et]:{}}},makeThemeVars:a,get list(){const{"":e,...t}=n;return Object.keys(t)},get current(){return e.getAttribute(Ge)||""},get all(){return n},get actions(){return i}};return t?.forEach((({type:e,payload:t})=>{switch(e){case"add":o.add(t.params,t.name);break;case Qe:o.delete(t.name);break;case Xe:o.update(t.params,t.name)}})),o},at="effcss",ot=at+"-provider",lt=at+"-override",ct="values",ut=":host",ht="display:contents;",mt="@media",dt="script",gt="style",pt="size",bt="time",ft="angle",$t="color",yt="easing",vt=at+"changes",xt="data-"+at,wt="prefers-color-scheme",St=`${wt}: light`,kt=`${wt}: dark`,jt={mode:"a",pre:"f"},_t=e=>"boolean"==typeof e,Ot=(e,t)=>{const r=((e,t)=>e.getAttribute(t)||jt[t])(e,t);return(e=>"string"==typeof e?Number(e):null)(r)},At=(e,t,r)=>null===r?e.removeAttribute(t):e.setAttribute(t,r+""),zt=e=>`:root:has([is=${ot}]${e?`[${e}]`:""})`,Ct=e=>Object.entries(e).reduce(((e,[t,r])=>e+t+":"+r+";"),""),qt=({theme:e,attrs:t,scope:r})=>({bem:s,each:n,themeVar:i,merge:a,pseudo:{r:o},at:{media:l},units:{px:c}})=>{const u=t.size,h=t.time,m=t.angle,d=t.color,g=t.easing,{$dark:p={},$light:b={},...f}=e.vars();return a({[zt()]:{...f,...l.where(St)(b),...l.where(kt)(p),[o()]:{fontSize:c(i("size"))}}},n(e.list,((t,r)=>{const{$dark:n={},$light:i={},...a}=e.vars(r),o={...a,...l.where(St)(i),...l.where(kt)(n)};return{[zt(`theme=${t}`)]:o,[s(`..theme.${t}`)]:o}})),u&&{[zt(pt)]:{[r.varName(pt)]:u}},h&&{[zt(bt)]:{[r.varName(bt)]:h}},m&&{[zt(ft)]:{[r.varName(ft)]:m}},d&&{[zt($t)]:{[r.varName($t)]:d}},g&&{[zt(yt)]:{[r.varName(yt)]:g}})},Pt=(e,t)=>({set(r){At(e,t,r)},get:()=>Ot(e,t)}),Tt=(e,t)=>({set(r){At(e,t,r)},get:()=>e.getAttribute(t)}),Et=(e,{initStyles:t,emulate:r,onChange:s,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:Pt(e,pt),time:Pt(e,bt),angle:Pt(e,ft),color:Tt(e,$t),easing:Tt(e,yt)});const o=Ee({prefix:e.pre}),l=((e={})=>{const{mode:t,min:r,dict:s={}}=e;let n;n="a"===t?Ke:De;const i=e=>{let r=0,s=Ue,a=Ue;const o=i.dict;o&&(o[e]||(o[e]={}),s=t=>o[e][t]??(o[e][t]=(r++).toString(36)),a=t=>o[e][t]);let l=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=Ue);const h=e=>"--"+l(Be(e)?e.split("."):e),m=e=>Re({[c]:e},{toString:{value:()=>`${c}="${e}"`},$:{value:e}}),d=e=>{if(void 0===e)return function(e){const t=({b:r,e:s,m:n})=>({b:e=>t({b:e,e:"",m:{}}),e:e=>t({b:r,e:e,m:{}}),m:(e={})=>t({b:r,e:s,m:e}),get $(){return e({[r]:{[s]:n}})}});return t({b:"",e:"",m:{}})}(d);let t,r,s,n,i="";const o=Be(e);return i=o||Array.isArray(e)?[...(o?[e]:e).reduce(((e,i)=>([t,r,s,n]=Ie(i),e.add(u(a(He(t,r)))),s&&e.add(u(a(He(t,r,s,n)))),e)),new Set).values()].join(" "):e&&Le(e,!0).map((([e,t,r,s])=>u(a(He(e,t,r,s))))).join(" "),m(i)};return d.list=(...e)=>{const t=[...e.reduce(((e,t)=>{const[r,s]=t.split(":");if(!r)return e;if(void 0===s)return e.add(r.replaceAll(".","-")),e;const n=r.split("."),i=n.pop(),a=n.join("-");return n.length?(e.add(a),e.add(a+`-${i}_${s}`)):e.add(`${i}_${s}`),e}),new Set).keys()].map((e=>u(a(e)))).join(" ");return m(t)},d.obj=(e,t)=>{let r=Je;"full"===t&&(r=Ve);const s=[...r(e).values()].map((e=>u(a(e)))).join(" ");return m(s)},{select:t=>{const r=t.replaceAll(".","-").replace(":","_");return n(e,s(r))},selector:t=>{const[r,i,a,o]=Ie(t);return n(e,s(He(r,i,a,o)))},attr:d,name:l,varName:h,varExp:(e,t)=>`var(${h(e)}${void 0!==t?","+t:""})`}};return r&&(i.dict=s),i})({mode:e.mode,min:e.min,dict:a?.dict}),c=l(o.key()),u=ze({scope:l,globalKey:o.key()}),h=Pe({initStyles:t,emulate:r});e.theme=it({provider:e,init:a?.theme,onChange:s,scope:c});const m=(({scope:e,collector:t,manager:r,processor:s,globalMaker:n})=>{const i=e=>"string"==typeof e?e:t.key(e),a=r=>e(r||t.key()).attr,o=(e,t)=>s.compile({key:t,maker:e}),l=e=>{let s=t.use(e);return r&&!r.get(s)&&r.pack(s,r.hydrate(s)||o(e,s)),a(s)},c=(...e)=>0===e.length?[l(n)]:e.map((e=>l(e)));return{use:c,remake:(e,s)=>{let n=t.key(s||e);return r&&r.get(n)?(s&&t.remake(e,s),r.pack(n,r.hydrate(n)||o(e,n)),a(n)):c(e)[0]},css:o,status:e=>{const t=i(e);return!!t&&r.status(t)},on:(...e)=>r.on(...e.map(i)),off:(...e)=>r.off(...e.map(i)),stylesheets:(e=t.keys)=>e.map((e=>r.get(i(e))))}})({scope:l,processor:u,manager:h,collector:o,globalMaker:n});Object.defineProperties(e,{_c:{value:o},_s:{value:l},_p:{value:u},_m:{value:h},toString:{value:()=>{const t={...h.all()},r=Object.entries(t).filter((([e,t])=>!t.disabled)).map((([e,t])=>`<style ${xt}="${e}">${[...t.cssRules].map((e=>e.cssText)).join("")}</style>`)).join("");let s=gt,n="";const a={is:ot,min:e.getAttribute("min"),mode:e.getAttribute("mode"),size:e.getAttribute(pt),time:e.getAttribute(bt),angle:e.getAttribute(ft),color:e.getAttribute($t),easing:e.getAttribute(yt)};if(!i){s=dt,a.type="application/json";const t={theme:e.theme.actions,dict:l.dict};n=JSON.stringify(t)}return r+`<${s} ${Object.entries(a).map((([e,t])=>null!=t&&t!==jt[e]?""===t?e:`${e}="${t}"`:"")).filter(Boolean).join(" ")}${e.theme.current?` theme="${e.theme.current}"`:""}>${n}</${s}>`}}}),Object.assign(e,m)},Nt=Symbol(ot),Mt=[pt,bt,ft,$t,yt],Rt=new Set(Mt),Bt=()=>globalThis?.document.querySelector(`[is=${ot}]`);const Wt=(e={})=>{let{noscript:t,attrs:r={}}=e,{mode:s=jt.mode,min:n,pre:i=jt.prefix,size:a=null,time:o=null,angle:l=null,color:c=null,easing:u=null}=r;return new class{get tagName(){return""}get textContent(){return""}attributes={size:a?a+"":null,time:o?o+"":null,angle:l?l+"":null,color:c||null,easing:u||null,pre:i,mode:s,min:n?"":null};getAttribute(e){const t=this.attributes[e];return null!=t?_t(t)?"":t+"":null}setAttribute(e,t){this.attributes[e]=t+"",Rt.has(e)&&this._customize()}removeAttribute(e){delete this.attributes[e]}theme;pre;mode;min;size;angle;time;color;easing;use;remake;css;get makers(){return this._c.makers}status;on;off;stylesheets;_c;_m;_s;_p;_;_n;_customize=()=>{const e=this.size,t=this.time,r=this.angle,s=this.color,n=this.easing,i=qt({theme:this.theme,attrs:{size:e,time:t,angle:r,color:s,easing:n},scope:this._s(this._c.key())});this.remake(i,this._),this._=i};constructor(){Et(this,{emulate:!0,onChange:this._customize,globalMaker:this._,noscript:t}),this._customize()}}},It=(e={})=>{const{emulate:t,global:r,...s}=e,n=globalThis?.document;let i;const a=globalThis[Nt];if(r&&a)i=a;else if(n&&!t){void 0===It.isDefined&&(It.isDefined=function(){const e=globalThis.document,t=globalThis.customElements;if(t?.get(ot))return!1;{class r extends HTMLScriptElement{static get observedAttributes(){return Mt}theme;pre;mode;min;size;angle;time;color;easing;use;remake;css;get makers(){return this._c.makers}status;on;off;stylesheets;_c;_m;_s;_p;_;_n;_customize=()=>{const e=this.size,t=this.time,r=this.angle,s=this.color,n=this.easing,i=qt({theme:this.theme,attrs:{size:e,time:t,angle:r,color:s,easing:n},scope:this._s(this._c.key())});this.remake(i,this._),this._=i};attributeChangedCallback(){this.isConnected&&this._customize()}connectedCallback(){Et(this,{initStyles:[...e.querySelectorAll(gt+`[${xt}]`)],onChange:this._customize,globalMaker:this._}),this._customize();const t=this;this._n={set adoptedStyleSheets(e){t.dispatchEvent(new CustomEvent(vt,{detail:{styles:e},bubbles:!0}))}},this._m.register(this._n),this._m.register(e)}disconnectedCallback(){delete globalThis[Nt]}}t.define(ot,r,{extends:dt});class s extends HTMLElement{static get observedAttributes(){return[ct]}_customize(){const e=Bt();if(this.shadowRoot&&e){const t=this.getAttribute(ct),r=new CSSStyleSheet;if(t){const{$dark:s={},$light:n={},...i}=e.theme.makeThemeVars(JSON.parse(decodeURIComponent(t)));r.replaceSync(ut+`{${ht+Ct(i)}}`+mt+`(${St}){${ut}{${Ct(n)}}}`+mt+`(${kt}){${ut}{${Ct(s)}}}`)}else r.replaceSync(ut+`{${ht}}`);this.shadowRoot.adoptedStyleSheets=[r]}}attributeChangedCallback(){this.isConnected&&this._customize()}connectedCallback(){this.attachShadow({mode:"open"}).innerHTML="<slot></slot>",this._customize()}}return t.define(lt,s),!0}}());const e=Bt();if(e)i=e;else{const e=n.createElement(dt,{is:ot});e.setAttribute("is",ot);const t=s?.attrs;t&&Object.entries(t).map((([t,r])=>r&&jt[t]!==r&&e.setAttribute(t,_t(r)?"":r+""))),n.head.appendChild(e),i=e}}else i=Wt(s);return r&&!a&&(globalThis[Nt]=i),i},Vt=e=>encodeURIComponent(JSON.stringify(e));export{jt as DEFAULT_ATTRS,ot as TAG_NAME,lt as TAG_NAME_OVERRIDE,Vt as prepareOverrideValues,It as useStyleProvider};
7
+ const e=(e,t,r)=>Object.entries(e).reduce(t,r),t=(e,t)=>{return`${r=e,r.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))}:${""+t};`;var r},r=Symbol("noParse"),s=(n,i,a)=>{let o=""+n;return null==i?"":Array.isArray(i)?i.map((e=>t(o,e))).join(""):"object"!=typeof i||i.hasOwnProperty(r)?""===i?o+";":t(o,i):(!a||a.startsWith?.("@")||o.startsWith?.("&")||o.startsWith?.("@")?"":"&")+o+`{${e(i,((e,t)=>e+s(...t,o)),"")}}`},n="@layer",i="@starting-style",a=e=>`(${e})`,o=e=>"string"==typeof e,l={and:(...e)=>Object.defineProperties({type:"and",value:e},{toString:{value:()=>e.filter(Boolean).map((e=>{const t=g(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=>g(e))).join(" or ")}}),not:e=>"object"==typeof e&&"not"===e.type?e.value[0]:Object.defineProperties({type:"not",value:[e]},{toString:{value:()=>`not (${g(e,!0)})`}})},c=e=>{const t=t=>({toString:()=>`(min-${e}:${o(t)?t:t+"rem"})`}),r=t=>({toString:()=>`(max-${e}:${o(t)?t:t+"rem"})`}),s=(e,s)=>({toString:()=>`${t(e)} and ${r(s)}`});return{up:t,down:r,between:s,only:e=>s(e,e)}},u=c("width"),h=c("height"),m=c("inline-size"),d=c("block-size"),g=(e,t)=>e?"string"==typeof e?e.includes("(")||t?e:a(e):e+"":"",p=(e={})=>{const{type:t,condition:r}=e,s=g(r),n="object"==typeof r&&"or"===r.type,i=`@media${t?" "+t:""}${t&&s?" and":""}${s?" "+(t&&n?a(s):s):""}`;return Object.defineProperties((e=>({[i]:e})),{all:{get:()=>p({condition:r,type:"all"})},print:{get:()=>p({condition:r,type:"print"})},screen:{get:()=>p({condition:r,type:"screen"})},where:{value:e=>p({condition:e,type:t})},toString:{value:()=>i}})},b=p({}),f=({condition:e}={})=>{const t=g(e),r="@supports"+(t?" "+t:"");return Object.defineProperties((e=>({[r]:e})),{where:{value:e=>f({condition:e})},toString:{value:()=>r}})},$=f(),y=e=>({[i]:e});y.toString=i;const v=e=>{const{root:t="",limit:r="",mode:s=[!1,!1]}=e,n=`@scope ${t?`(${t}${s[0]?" > *":""})`:""}${t&&r?" ":""}${r?`to (${r}${s[1]?" > *":""})`:""}`;return Object.defineProperties((e=>({[n]:e})),{limit:{value:e=>v({root:t,limit:e,mode:s})},root:{value:e=>v({root:e,limit:r,mode:s})},both:{value:()=>v({root:t,limit:r,mode:[!1,!0]})},none:{value:()=>v({root:t,limit:r,mode:[!0,!1]})},low:{value:()=>v({root:t,limit:r,mode:[!0,!0]})},high:{value:()=>v({root:t,limit:r,mode:[!1,!1]})},toString:{value:()=>n}})},x=v({}),w=(e,t)=>`calc(${e} * 1${t})`,S=e=>w(e,"px"),k=e=>w(e,"vh"),j=e=>w(e,"vw"),_=e=>w(e,"vmin"),O=e=>w(e,"vmax"),A=e=>w(e,"em"),z=e=>w(e,"rem"),C=e=>w(e,"deg"),q=e=>w(e,"rad"),P=e=>w(e,"rad"),T=e=>w(e,"ms"),E=e=>w(e,"s"),N=e=>w(e,"%"),M=e=>w(e,"cqw"),R=e=>w(e,"cqh"),B=e=>w(e,"cqi"),W=e=>w(e,"cqb"),I=e=>w(e,"cqmin"),V=e=>w(e,"cqmax"),J=Object.fromEntries,L=Object.entries,H=":first-",D=":last-",K=":only-",U="child",F=":nth-",Z="of-type",G=F+U,Q=":focus",X="valid",Y="in"+X,ee=":user-",te="placeholder",re={r:":root",h:":hover",f:Q,fv:Q+"-visible",a:":active",v:":visited",val:":"+X,inv:":"+Y,uval:ee+X,uinv:ee+Y,e:":empty",d:":disabled",rq:":required",o:":optional",m:":modal",l:":link",phs:`:${te}-shown`,ch:":checked",po:":popover-open",fc:H+U,lc:D+U,oc:K+U,odd:G+"(odd)",even:G+"(even)",ft:H+Z,lt:D+Z,ot:K+Z,bef:"::before",aft:"::after",ph:`::${te}`,bd:"::backdrop",fl:"::first-line",dc:"::details-content",sel:"::selection"},se={has:":has",not:":not",is:":is",wh:":where",st:":state",nthc:G,ntho:F+Z,dir:":dir",lang:":lang"},ne=e=>`oklch(${e})`,ie=e=>ne(`from ${e}`),ae=(e,t=.1)=>ie(`${e} calc(l + ${t}) c h / alpha`),oe=(e,t=.1)=>ie(`${e} calc(l - ${t}) c h / alpha`),le=(e,t=.1)=>ie(`${e} l c h / calc(alpha + ${t})`),ce=(e,t=.1)=>ie(`${e} l c h / calc(alpha - ${t})`),ue=(e,t=.04)=>ie(`${e} l calc(c + ${t}) h / alpha`),he=(e,t=.04)=>ie(`${e} l calc(c - ${t}) h / alpha`),me=e=>ie(`${e} l c calc(h + 180) / alpha`),de=e=>ie(`${e} l 0 h / alpha`),ge=(e,t=30)=>ie(`${e} l c calc(h${"number"==typeof t?t>0?" + "+t:" - "+-t:t}) / alpha`),pe=e=>{const t=e("color");return{root:e=>e?ie(t+` ${e.l||"l"} ${e.c||"c"} ${e.h||"h"} / ${e.a||"1"}`):t,oklch:ne,lighten:ae,darken:oe,saturate:ue,desaturate:he,fadein:le,fadeout:ce,spin:ge,complement:me,grayscale:de}},be=e=>{class t{state={l:"l",c:"base",h:"pri",a:"1",m:"bg"};constructor(e={}){Object.assign(this,{[r]:!0}),this.state=Object.assign(this.state,e)}get xs(){return new t({...this.state,l:"xs"})}get s(){return new t({...this.state,l:"s"})}get m(){return new t({...this.state,l:"m"})}get l(){return new t({...this.state,l:"l"})}get xl(){return new t({...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({...this.state,c:"gray"})}get pale(){return new t({...this.state,c:"pale"})}get base(){return new t({...this.state,c:"base"})}get rich(){return new t({...this.state,c:"rich"})}get chroma(){return{gray:this.gray,pale:this.pale,base:this.base,rich:this.rich}}get pri(){return new t({...this.state,h:"pri"})}get sec(){return new t({...this.state,h:"sec"})}get suc(){return new t({...this.state,h:"suc"})}get inf(){return new t({...this.state,h:"inf"})}get war(){return new t({...this.state,h:"war"})}get dan(){return new t({...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({...this.state,a:e+""})}get bg(){return new t({...this.state,m:"bg"})}get fg(){return new t({...this.state,m:"fg"})}toString(){const{l:t,c:r,h:s,a:n,m:i}=this.state;return`oklch(${e(`lightness.${i}.${t}`)} ${e(`chroma.${i}.${r}`)} ${e(`hue.${s}`)} / ${n})`}}return new t},fe=e=>{const t=(t,r=0)=>e(`coef.${t.state.center+r}`);class r{state={center:8};constructor(e={}){this.state=Object.assign(this.state,e)}get min(){return t(this,-4)}get xxs(){return t(this,-3)}get xs(){return t(this,-2)}get s(){return t(this,-1)}get m(){return t(this)}get l(){return t(this,1)}get xl(){return t(this,2)}get xxl(){return t(this,3)}get max(){return t(this,4)}get $xxs(){return new r({center:4})}get $xs(){return new r({center:8})}get $s(){return new r({center:12})}get $m(){return new r({center:16})}get $l(){return new r({center:20})}get $xl(){return new r({center:24})}get $xxl(){return new r({center:28})}get short(){return{s:this.s,m:this.m,l:this.l}}get base(){return{xs:this.xs,...this.short,xl:this.xl}}get long(){return{xxs:this.xxs,...this.base,xxl:this.xxl}}get full(){return{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 r},$e=Object.assign,ye=Object.entries,ve=Array.isArray,xe=e=>"object"==typeof e,we=(e,t)=>Array.from(Array(e).entries()).reduce(((e,[r])=>$e(e,t(r+1))),{}),Se=(e,t)=>ye(e).reduce(((e,[r,s])=>$e(e,t(r,s))),{}),ke=(e,t,r={})=>e?t:r,je=(...e)=>e.join("-"),_e=(...e)=>e.join(),Oe=(...e)=>e.join(" "),Ae=(e,...t)=>t.length?t.reduce(((e,t)=>(t&&e&&xe(t)&&ye(t).forEach((([t,r])=>{r&&xe(r)&&e[t]?ve(e[t])&&ve(r)?e[t]=[...e[t],...r]:Ae(e[t],r||{}):e[t]=r})),e)),e):e,ze=Object.assign(J(L(re).map((([e,t])=>{function r(e=""){return e&&"object"==typeof e?{[t]:e}:e+t}return r.toString=()=>t,[e,r]}))),J(L(se).map((([e,t])=>{function r(e,r=""){const s=t+`(${e})`;return r&&"object"==typeof r?{[s]:r}:r+s}return r.toString=()=>t,[e,r]})))),Ce={px:S,vh:k,vw:j,vmin:_,vmax:O,em:A,rem:z,deg:C,rad:q,turn:P,ms:T,s:E,pc:N,cqw:M,cqh:R,cqb:W,cqi:B,cqmin:I,cqmax:V},qe=e=>1!==e?e+" * ":"",Pe=t=>{const{scope:i,globalKey:a}=t,o=i(a).varExp,c=(e=1)=>Ce.ms(qe(e)+o("time")),p=(e=1)=>Ce.deg(qe(e)+o("angle")),f=(e=1)=>Ce.px(qe(e)+o("size")),v=e=>e?`cubic-bezier(${e.x1||0},${e.y1||0},${e.x2||1},${e.y2||1})`:o("easing");return{compile:({key:t,maker:a})=>{const w=i(t),S=w.selector,k=w.select,j=(e=>{const t={cp:1,lay:1,kf:1,cq:1},s=(n={})=>{const{scroll:i,type:a,name:o,condition:l}=n,c=g(l),u=`@container${o?" "+o:""}${c?" "+c:""}`;return Object.defineProperties((e=>({[u]:e})),{container:{value:(o||"none")+" / "+(a&&i?`${a} scroll-state`:i?"scroll-state":a||"normal"),enumerable:!0},named:{get:()=>s({scroll:i,condition:l,name:o||e.name(["cq",t.cq++]),type:a})},size:{get:()=>s({name:o,scroll:i,condition:l,type:"size"})},isize:{get:()=>s({name:o,scroll:i,condition:l,type:"inline-size"})},scroll:{get:()=>s({name:o,scroll:!0,condition:l,type:a})},where:{value:e=>s({name:o,scroll:i,condition:e,type:a})},[r]:{value:!0},toString:{value:()=>u}})},i=({name:r}={})=>{const s=`${n}${r?" "+r:""}`,a=e=>({[s]:e});return a.toString=()=>s,Object.defineProperties(a,{named:{get:()=>i({name:r||e.name(["lay",t.lay++])})},list:{value:(...e)=>({[n+(e.map((e=>(e+"").split(n)[1])).filter(Boolean).join(",")||r)]:""})}})};return{layer:i(),supports:$,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:r,del:s,ic:i,dir:a,ps:o,fm:l}=e;return{animation:[t,r,s,i,a,o,l,n].filter(Boolean).join(" ")}}),{[i]:{value:s,enumerable:!0},toString:{value:()=>n},[r]:{value:!0}})},property:(s={})=>{let n,i,a='"*"',o=!0;"object"==typeof s?({syn:a=a,inh:o=o,ini:n,def:i}=s):(i=s,n=s,o=!1);const l="--"+e.name(["cp",t.cp++]),c=`var(${l}${void 0!==i?","+i:""})`,u="@property "+l;return Object.defineProperties((e=>({[l]:e})),{[u]:{value:{syntax:a,inherits:o,initialValue:n},enumerable:!0},toString:{value:()=>c},fallback:{value:e=>`var(${l},${e})`},[r]:{value:!0}})},scope:x,media:b,container:s({}),startingStyle:y,$logic:l,$width:u,$height:h,$block:d,$inline:m}})(w),_=a({dash:je,comma:_e,space:Oe,range:we,each:Se,when:ke,merge:Ae,themeVar:o,size:f,time:c,angle:p,easing:v,bem:S,select:k,pseudo:ze,color:pe(o),palette:be(o),coef:fe(o),units:Ce,at:j});return"string"==typeof _?_:(t=>e(t,((e,t)=>e+s(...t)),""))(_)}}},Te=Symbol("effcss-stylesheet");class Ee{disabled=!1;cssRules=[];replaceSync(e){e&&(this.cssRules=[{cssText:e}])}}function Ne({initStyles:e,emulate:t}={}){const r={};e?.forEach((e=>{const t=e?.dataset?.effcss;t&&(r[t]=e)}));let s={},n={},i=[],a=[];const o=(e,t)=>t.hasOwnProperty(Te)?t:Object.defineProperties(t,{[Te]:{value:e}}),l=e=>e.adoptedStyleSheets=[...e.adoptedStyleSheets?.length?[...e.adoptedStyleSheets].filter((e=>!e.hasOwnProperty(Te))):[],...i],c=()=>{a=a.reduce(((e,t)=>{const r=t.deref();return r&&(l(r),e.push(t)),e}),[])},u=e=>e?s[e]:void 0,h=(e,t)=>{if(!s[e]){s[e]=o(e,t),i.push(s[e]);const n=r[e];return n&&(n.disabled=!0),c(),!0}};return{get:u,all:()=>s,add:h,status:e=>{const t=u(e);return!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 r=(a=t,i.findIndex((e=>e===a)));var a;return r>-1&&(i.splice(r,1),delete s[e],delete n[e]),c(),!0},removeAll:()=>(i.splice(0),s={},n={},c(),!0),pack:(e,r)=>{let n=s[e]||(!t&&globalThis.CSSStyleSheet?new globalThis.CSSStyleSheet:new Ee);return n.replaceSync(r),n=o(e,n),!!n.cssRules.length&&h(e,n)},register:e=>{a.findIndex((t=>t.deref()===e))>=0||(a.push(new WeakRef(e)),l(e))},unregister:e=>{const t=a.findIndex((t=>t.deref()===e));t>=0&&a.splice(t,1)},hydrate:e=>r[e]&&!r[e].disabled&&r[e].textContent||void 0}}const Me=({prefix:e})=>{let t=0;return{get initial(){return e+0},get current(){return e+t},next(){return t++,this.current}}},Re=({prefix:e})=>{const t=new Set,r=new Map,s=Me({prefix:e});return{use(e){let n=this.key(e);return n||(n=s.current,t.add(n),r.set(e,n),s.next(),n)},remake(e,t){const s=r.get(t);return s?(r.delete(t),r.set(e,s),s):this.use(e)},key:e=>e?r.get(e)||"":s.initial,get keys(){return[...t]},get makers(){return Object.fromEntries(r.entries().map((([e,t])=>[t,e])))}}},Be=void 0,We=Object.entries,Ie=Object.defineProperties,Ve=e=>"string"==typeof e,Je=e=>null!==e&&"object"==typeof e,Le=e=>e.split("."),He=(e,t="")=>We(e).reduce(((e,[r,s])=>{const n=t?`${t}-${r}`:r;return"object"==typeof s?(e.add(n),e=e.union(He(s,n))):e.add(n+`_${s}`),e}),new Set),De=(e,t="")=>We(e).reduce(((e,[r,s])=>{const n=t?`${t}-${r}`:r;if("object"==typeof s){const t=De(s,n);t.size||e.add(n),e=e.union(t)}else t&&e.add(t),e.add(n+`_${s}`);return e}),new Set),Ke=(e,t)=>We(e).reduce(((e,[r,s])=>{if(Je(s)){const n=We(s);n.length?e.push(...n.reduce(((e,[s,n])=>{if((e=>null!==e&&e!==Be)(s)&&t&&e.push([r,s,Be,Be]),Je(n)){const t=We(n);t.length&&e.push(...t.reduce(((e,[t,n])=>{const i=typeof n;return"string"!==i&&"number"!==i||e.push([r,s,t,n]),e}),[]))}return e}),[])):e.push([r,Be,Be,Be])}return e}),[]),Ue=(e,t,r,s)=>""+(((e,t)=>`${e||""}${t?"__"+t:""}`)(e,t)+(r?"_"+r:"")+(r&&s?"_"+s:""))||"_",Fe=(e,t)=>"."+(t?e+(t.startsWith("_")?"":"-")+t:e),Ze=(e,t)=>`[data-${e}${t?`~="${t}"`:""}]`;const Ge=e=>e||"",Qe=Object.assign,Xe=Object.entries,Ye="theme",et="delete",tt="update",rt="$light",st="$dark",nt="lightness",it="chroma",at=e=>Number((.1*184+.9*e).toFixed(2)),ot={time:200,size:16,angle:30,color:"#2192a7",easing:"linear",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:3,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:at(142),inf:at(264),war:at(109),dan:at(29)},[rt]:{[nt]:{bg:{xl:1,l:.94,m:.88,s:.83,xs:.78},fg:{xl:0,l:.12,m:.24,s:.36,xs:.48}},[it]:{bg:{gray:0,pale:.01,base:.04,rich:.7},fg:{gray:0,pale:.07,base:.11,rich:.15}}},[st]:{[nt]:{bg:{xl:.24,l:.3,m:.36,s:.42,xs:.48},fg:{xl:1,l:.93,m:.86,s:.79,xs:.72}},[it]:{bg:{pale:.02,base:.06,rich:.1},fg:{pale:.06,base:.1,rich:.14}}}},lt=({provider:e,init:t,scope:r,onChange:s})=>{const n={"":ot},i=[],a=({$light:e={},$dark:t={},...s})=>{function n(e,t=[]){return Xe(e).reduce(((e,[s,i])=>i&&"object"==typeof i?Qe(e,n(i,[...t,s])):(e[r.varName([...t,s])]=i,e)),{})}return{...n(s),[rt]:n(e),[st]:n(t)}},o={get:(e="")=>n[e],add(e,t){n[t]||(n[t]=Ae({[rt]:{},[st]:{}},e),i.push({type:"add",payload:{params:e,name:t}}),s?.())},delete(e){e&&n[e]&&(this.current===e&&this.switch(),delete n[e],i.push({type:et,payload:{name:e}}),s?.())},update(e,t=""){n[t]&&(n[t]=Ae({[rt]:{},[st]:{}},n[t],e),i.push({type:tt,payload:{params:e,name:t}}),s?.())},switch(t=""){n[t]&&e.setAttribute(Ye,t)},vars(e=""){const t=this.get(e);return t?a(t):{[rt]:{},[st]:{}}},makeThemeVars:a,get list(){const{"":e,...t}=n;return Object.keys(t)},get current(){return e.getAttribute(Ye)||""},get all(){return n},get actions(){return i}};return t?.forEach((({type:e,payload:t})=>{switch(e){case"add":o.add(t.params,t.name);break;case et:o.delete(t.name);break;case tt:o.update(t.params,t.name)}})),o},ct="effcss",ut=ct+"-provider",ht=ct+"-override",mt="values",dt=":host",gt="display:contents;",pt="@media",bt="script",ft="style",$t="size",yt="time",vt="angle",xt="color",wt="easing",St=ct+"changes",kt="data-"+ct,jt="prefers-color-scheme",_t=`${jt}: light`,Ot=`${jt}: dark`,At={mode:"a",pre:"f"},zt=e=>"boolean"==typeof e,Ct=(e,t)=>{const r=((e,t)=>e.getAttribute(t)||At[t])(e,t);return(e=>"string"==typeof e?Number(e):null)(r)},qt=(e,t,r)=>null===r?e.removeAttribute(t):e.setAttribute(t,r+""),Pt=e=>`:root:has([is=${ut}]${e?`[${e}]`:""})`,Tt=e=>Object.entries(e).reduce(((e,[t,r])=>e+t+":"+r+";"),""),Et=({theme:e,attrs:t,scope:r})=>({bem:s,each:n,themeVar:i,merge:a,pseudo:{r:o},at:{media:l},units:{px:c}})=>{const u=t.size,h=t.time,m=t.angle,d=t.color,g=t.easing,{$dark:p={},$light:b={},...f}=e.vars();return a({[Pt()]:{...f,...l.where(_t)(b),...l.where(Ot)(p),[o()]:{fontSize:c(i("size"))}}},n(e.list,((t,r)=>{const{$dark:n={},$light:i={},...a}=e.vars(r),o={...a,...l.where(_t)(i),...l.where(Ot)(n)};return{[Pt(`theme=${t}`)]:o,[s(`..theme.${t}`)]:o}})),u&&{[Pt($t)]:{[r.varName($t)]:u}},h&&{[Pt(yt)]:{[r.varName(yt)]:h}},m&&{[Pt(vt)]:{[r.varName(vt)]:m}},d&&{[Pt(xt)]:{[r.varName(xt)]:d}},g&&{[Pt(wt)]:{[r.varName(wt)]:g}})},Nt=(e,t)=>({set(r){qt(e,t,r)},get:()=>Ct(e,t)}),Mt=(e,t)=>({set(r){qt(e,t,r)},get:()=>e.getAttribute(t)}),Rt=(e,{initStyles:t,emulate:r,onChange:s,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:Nt(e,$t),time:Nt(e,yt),angle:Nt(e,vt),color:Mt(e,xt),easing:Mt(e,wt)});const o=Re({prefix:e.pre}),l=((e={})=>{const{mode:t,min:r,dict:s={}}=e;let n;n="a"===t?Ze:Fe;const i=e=>{let r=0,s=Ge,a=Ge;const o=i.dict;o&&(o[e]||(o[e]={}),s=t=>o[e][t]??(o[e][t]=(r++).toString(36)),a=t=>o[e][t]);let l=t=>[e,...Ve(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=Ge);const h=e=>"--"+l(Ve(e)?e.split("."):e),m=e=>Ie({[c]:e},{toString:{value:()=>`${c}="${e}"`},$:{value:e}}),d=e=>{if(void 0===e)return function(e){const t=({b:r,e:s,m:n})=>({b:e=>t({b:e,e:"",m:{}}),e:e=>t({b:r,e:e,m:{}}),m:(e={})=>t({b:r,e:s,m:e}),get $(){return e({[r]:{[s]:n}})}});return t({b:"",e:"",m:{}})}(d);let t,r,s,n,i="";const o=Ve(e);return i=o||Array.isArray(e)?[...(o?[e]:e).reduce(((e,i)=>([t,r,s,n]=Le(i),e.add(u(a(Ue(t,r)))),s&&e.add(u(a(Ue(t,r,s,n)))),e)),new Set).values()].join(" "):e&&Ke(e,!0).map((([e,t,r,s])=>u(a(Ue(e,t,r,s))))).join(" "),m(i)};return d.list=(...e)=>{const t=[...e.reduce(((e,t)=>{const[r,s]=t.split(":");if(!r)return e;if(void 0===s)return e.add(r.replaceAll(".","-")),e;const n=r.split("."),i=n.pop(),a=n.join("-");return n.length?(e.add(a),e.add(a+`-${i}_${s}`)):e.add(`${i}_${s}`),e}),new Set).keys()].map((e=>u(a(e)))).join(" ");return m(t)},d.obj=(e,t)=>{let r=De;"full"===t&&(r=He);const s=[...r(e).values()].map((e=>u(a(e)))).join(" ");return m(s)},{select:t=>{const r=t.replaceAll(".","-").replace(":","_");return n(e,s(r))},selector:t=>{const[r,i,a,o]=Le(t);return n(e,s(Ue(r,i,a,o)))},attr:d,name:l,varName:h,varExp:(e,t)=>`var(${h(e)}${void 0!==t?","+t:""})`}};return r&&(i.dict=s),i})({mode:e.mode,min:e.min,dict:a?.dict}),c=l(o.key()),u=Pe({scope:l,globalKey:o.key()}),h=Ne({initStyles:t,emulate:r});e.theme=lt({provider:e,init:a?.theme,onChange:s,scope:c});const m=(({scope:e,collector:t,manager:r,processor:s,globalMaker:n})=>{const i=e=>"string"==typeof e?e:t.key(e),a=r=>e(r||t.key()).attr,o=(e,t)=>s.compile({key:t,maker:e}),l=e=>{let s=t.use(e);return r&&!r.get(s)&&r.pack(s,r.hydrate(s)||o(e,s)),a(s)},c=(...e)=>0===e.length?[l(n)]:e.map((e=>l(e)));return{use:c,remake:(e,s)=>{let n=t.key(s||e);return r&&r.get(n)?(s&&t.remake(e,s),r.pack(n,r.hydrate(n)||o(e,n)),a(n)):c(e)[0]},css:o,status:e=>{const t=i(e);return!!t&&r.status(t)},on:(...e)=>r.on(...e.map(i)),off:(...e)=>r.off(...e.map(i)),stylesheets:(e=t.keys)=>e.map((e=>r.get(i(e))))}})({scope:l,processor:u,manager:h,collector:o,globalMaker:n});Object.defineProperties(e,{_c:{value:o},_s:{value:l},_p:{value:u},_m:{value:h},toString:{value:()=>{const t={...h.all()},r=Object.entries(t).filter((([e,t])=>!t.disabled)).map((([e,t])=>`<style ${kt}="${e}">${[...t.cssRules].map((e=>e.cssText)).join("")}</style>`)).join("");let s=ft,n="";const a={is:ut,min:e.getAttribute("min"),mode:e.getAttribute("mode"),size:e.getAttribute($t),time:e.getAttribute(yt),angle:e.getAttribute(vt),color:e.getAttribute(xt),easing:e.getAttribute(wt)};if(!i){s=bt,a.type="application/json";const t={theme:e.theme.actions,dict:l.dict};n=JSON.stringify(t)}return r+`<${s} ${Object.entries(a).map((([e,t])=>null!=t&&t!==At[e]?""===t?e:`${e}="${t}"`:"")).filter(Boolean).join(" ")}${e.theme.current?` theme="${e.theme.current}"`:""}>${n}</${s}>`}}}),Object.assign(e,m)},Bt=Symbol(ut),Wt=[$t,yt,vt,xt,wt],It=new Set(Wt),Vt=()=>globalThis?.document.querySelector(`[is=${ut}]`);const Jt=(e={})=>{let{noscript:t,attrs:r={}}=e,{mode:s=At.mode,min:n,pre:i=At.prefix,size:a=null,time:o=null,angle:l=null,color:c=null,easing:u=null}=r;return new class{get tagName(){return""}get textContent(){return""}attributes={size:a?a+"":null,time:o?o+"":null,angle:l?l+"":null,color:c||null,easing:u||null,pre:i,mode:s,min:n?"":null};getAttribute(e){const t=this.attributes[e];return null!=t?zt(t)?"":t+"":null}setAttribute(e,t){this.attributes[e]=t+"",It.has(e)&&this._customize()}removeAttribute(e){delete this.attributes[e]}theme;pre;mode;min;size;angle;time;color;easing;use;remake;css;get makers(){return this._c.makers}status;on;off;stylesheets;_c;_m;_s;_p;_;_n;_customize=()=>{const e=this.size,t=this.time,r=this.angle,s=this.color,n=this.easing,i=Et({theme:this.theme,attrs:{size:e,time:t,angle:r,color:s,easing:n},scope:this._s(this._c.key())});this.remake(i,this._),this._=i};constructor(){Rt(this,{emulate:!0,onChange:this._customize,globalMaker:this._,noscript:t}),this._customize()}}},Lt=(e={})=>{const{emulate:t,global:r,...s}=e,n=globalThis?.document;let i;const a=globalThis[Bt];if(r&&a)i=a;else if(n&&!t){void 0===Lt.isDefined&&(Lt.isDefined=function(){const e=globalThis.document,t=globalThis.customElements;if(t?.get(ut))return!1;{class r extends HTMLScriptElement{static get observedAttributes(){return Wt}theme;pre;mode;min;size;angle;time;color;easing;use;remake;css;get makers(){return this._c.makers}status;on;off;stylesheets;_c;_m;_s;_p;_;_n;_customize=()=>{const e=this.size,t=this.time,r=this.angle,s=this.color,n=this.easing,i=Et({theme:this.theme,attrs:{size:e,time:t,angle:r,color:s,easing:n},scope:this._s(this._c.key())});this.remake(i,this._),this._=i};attributeChangedCallback(){this.isConnected&&this._customize()}connectedCallback(){Rt(this,{initStyles:[...e.querySelectorAll(ft+`[${kt}]`)],onChange:this._customize,globalMaker:this._}),this._customize();const t=this;this._n={set adoptedStyleSheets(e){t.dispatchEvent(new CustomEvent(St,{detail:{styles:e},bubbles:!0}))}},this._m.register(this._n),this._m.register(e)}disconnectedCallback(){delete globalThis[Bt]}}t.define(ut,r,{extends:bt});class s extends HTMLElement{static get observedAttributes(){return[mt]}_customize(){const e=Vt();if(this.shadowRoot&&e){const t=this.getAttribute(mt),r=new CSSStyleSheet;if(t){const{$dark:s={},$light:n={},...i}=e.theme.makeThemeVars(JSON.parse(decodeURIComponent(t)));r.replaceSync(dt+`{${gt+Tt(i)}}`+pt+`(${_t}){${dt}{${Tt(n)}}}`+pt+`(${Ot}){${dt}{${Tt(s)}}}`)}else r.replaceSync(dt+`{${gt}}`);this.shadowRoot.adoptedStyleSheets=[r]}}attributeChangedCallback(){this.isConnected&&this._customize()}connectedCallback(){this.attachShadow({mode:"open"}).innerHTML="<slot></slot>",this._customize()}}return t.define(ht,s),!0}}());const e=Vt();if(e)i=e;else{const e=n.createElement(bt,{is:ut});e.setAttribute("is",ut);const t=s?.attrs;t&&Object.entries(t).map((([t,r])=>r&&At[t]!==r&&e.setAttribute(t,zt(r)?"":r+""))),n.head.appendChild(e),i=e}}else i=Jt(s);return r&&!a&&(globalThis[Bt]=i),i},Ht=e=>encodeURIComponent(JSON.stringify(e));export{At as DEFAULT_ATTRS,ut as TAG_NAME,ht as TAG_NAME_OVERRIDE,Ht as prepareOverrideValues,Lt as useStyleProvider};
@@ -44,5 +44,13 @@ export declare const resolveColor: (varExp: ReturnType<ReturnType<TCreateScope>>
44
44
  * Rotate color hue
45
45
  */
46
46
  spin: TChangeColor;
47
+ /**
48
+ * Get complement color
49
+ */
50
+ complement: (color: string | object) => string;
51
+ /**
52
+ * Get grayscale color
53
+ */
54
+ grayscale: (color: string | object) => string;
47
55
  };
48
56
  export {};
@@ -1,5 +1,11 @@
1
- type TSimplePseudo = (val?: string | number) => string;
2
- type TComplexPseudo = (content: string | number, val?: string | number) => string;
1
+ type TSimplePseudo = {
2
+ (val?: string | number): string;
3
+ (val: object): object;
4
+ };
5
+ type TComplexPseudo = {
6
+ (content: string | number, val?: string | number): string;
7
+ (content: string | number, val: object): object;
8
+ };
3
9
  type TPseudo = {
4
10
  /**
5
11
  * :root
@@ -66,9 +72,9 @@ type TPseudo = {
66
72
  */
67
73
  l: TSimplePseudo;
68
74
  /**
69
- * :placeholder
75
+ * :placeholder-shown
70
76
  */
71
- ph: TSimplePseudo;
77
+ phs: TSimplePseudo;
72
78
  /**
73
79
  * :checked
74
80
  */
@@ -121,6 +127,22 @@ type TPseudo = {
121
127
  * ::backdrop
122
128
  */
123
129
  bd: TSimplePseudo;
130
+ /**
131
+ * ::placeholder
132
+ */
133
+ ph: TSimplePseudo;
134
+ /**
135
+ * ::first-line
136
+ */
137
+ fl: TSimplePseudo;
138
+ /**
139
+ * ::details-content
140
+ */
141
+ dc: TSimplePseudo;
142
+ /**
143
+ * ::selection
144
+ */
145
+ sel: TSimplePseudo;
124
146
  /**
125
147
  * :has
126
148
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effcss",
3
- "version": "4.6.2",
3
+ "version": "4.7.0",
4
4
  "description": "Self-confident CSS-in-JS",
5
5
  "type": "module",
6
6
  "scripts": {