effcss 4.11.0 → 4.13.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
@@ -30,6 +30,7 @@ EffCSS is a self-confident CSS-in-JS library based only on the browser APIs. Use
30
30
 
31
31
  - [Docs](https://effnd.tech/css/)
32
32
  - [SourceCraft](https://sourcecraft.dev/msabitov/effcss)
33
+ - [GitFlic](https://gitflic.ru/project/msabitov/effcss)
33
34
  - [GitVerse](https://gitverse.ru/msabitov/effcss)
34
35
  - [GitHub](https://github.com/msabitov/effcss)
35
36
  - [GitLab](https://gitlab.com/msabitov/effcss)
@@ -79,15 +80,16 @@ Just call `useStyleProvider` in your code:
79
80
 
80
81
  ```jsx
81
82
  import { useStyleProvider } from "effcss";
83
+ import { App } from "./App.tsx";
82
84
 
83
- const consumer = useStyleProvider({
85
+ const styleProvider = useStyleProvider({
84
86
  attrs: {
85
87
  min: true // to create minified selectors
86
88
  }
87
89
  });
88
90
 
89
91
  const root = createRoot(document.getElementById("root"));
90
- root.render(<App css={consumer} />);
92
+ root.render(<App styleProvider={styleProvider} />);
91
93
  ```
92
94
 
93
95
  Each CSS stylesheet corresponds to a single `Stylesheet maker`. `Stylesheet maker` is a JS function that should return object or string with style rules:
@@ -116,32 +118,16 @@ export type TMyMaker = {
116
118
  * Card height
117
119
  */
118
120
  h: 'full' | 'half';
119
- /**
120
- * Card logo scope
121
- */
122
- logo: {
123
- /**
124
- * Logo width
125
- */
126
- w: 's' | 'l';
127
- },
128
- /**
129
- * Card footer scope
130
- */
131
- footer: {
132
- /**
133
- * Footer visibility
134
- */
135
- visible: '';
136
- /**
137
- * Footer size
138
- */
139
- sz: 's' | 'm' | 'l';
140
- };
141
121
  };
142
122
  }
143
123
 
144
- export const myMaker: TStyleSheetMaker = ({ select, pseudo: {h}, at: { keyframes, property }, merge, palette, coef, size, units: {px} }) = {
124
+ export const myMaker: TStyleSheetMaker = ({
125
+ select, merge,
126
+ pseudo: {h},
127
+ at: { keyframes, property },
128
+ theme: { neutral, size },
129
+ units: { px }
130
+ }) = {
145
131
  // specify selector variants via generic
146
132
  const selector = select<TCardMaker>;
147
133
  // create property with unique identifier
@@ -168,31 +154,31 @@ export const myMaker: TStyleSheetMaker = ({ select, pseudo: {h}, at: { keyframes
168
154
  })
169
155
  }, {
170
156
  border: 'none',
171
- background: palette.pale.xl.alpha(0.8),
157
+ background: neutral,
172
158
  aspectRatio: 1,
173
159
  ...h({
174
160
  opacity: 0.5
175
161
  })
176
162
  });
177
163
  return {
164
+ // add @property rule
178
165
  ...sizeProperty,
166
+ // add @keyframes rule
179
167
  ...spin,
180
- [selector('fsz:16')]: { ... },
181
- [selector('card')]: { ... },
182
- [selector('card.logo')]: cardLogoStyles,
183
- [selector('card.logo.w:s')]: {
184
- ...widthProperty(px(100))
168
+ // add rules according to the TMyMaker contract
169
+ [selector('fsz:16')]: {
170
+ // rule content
171
+ },
172
+ [selector('card')]: {
173
+ // rule content
174
+ },
175
+ [selector('card.rounded:')]: {
176
+ // rule content
177
+ },
178
+ [selector('card.h:full')]: {
179
+ // rule content
185
180
  },
186
- [selector('card.logo.w:l')]: widthProperty(px(300)),
187
- [selector('card.rounded:')]: { ... },
188
- [selector('card.h:full')]: { ... },
189
- [selector('card.footer')]: { ... },
190
- [selector('card.footer.visible:')]: { ... },
191
- ...each(coef.short, (k, v) => ({
192
- [selector(`card.footer.sz:${k}`)]: {
193
- height: size(v)
194
- }
195
- }))
181
+ // ... and so on
196
182
  };
197
183
  };
198
184
  ```
@@ -208,25 +194,21 @@ import type { TMyMaker } from './maker';
208
194
  import { myMaker } from './maker';
209
195
 
210
196
  export const App = (props: {
211
- css: IStyleProvider;
197
+ styleProvider: IStyleProvider;
212
198
  }) => {
213
- const styleProvider = useStyleProvider();
214
199
  const stylesRef = useRef();
215
200
  // put it inside ref to avoid recalculations
216
201
  if (!stylesRef.current) {
217
- const [card] = css.use(myStyleSheetMaker);
218
- // thanks to the TMyMaker type,
219
- // you don't need to look at the implementation - just create the necessary attributes
202
+ // thanks to the TMyMaker contract type,
203
+ // you don't need to look at the implementation - just pass the necessary selectors
220
204
  stylesRef.current = {
221
205
  // you can apply list of selectors
222
- card: styleProvider.dx<TMyMaker>('card.rounded:', 'fsz:24'),
206
+ card: styleProvider.dx<TMyMaker>(myMaker, ['card.h:full', 'fsz:16']),
223
207
  // or you can apply object with selectors
224
- footer: styleProvider.dx<TMyMaker>({
208
+ another: styleProvider.dx<TMyMaker>(myMaker, {
209
+ fsz: 16,
225
210
  card: {
226
- footer: {
227
- visible: '',
228
- size: 'm'
229
- }
211
+ h: 'full'
230
212
  }
231
213
  })
232
214
  };
@@ -235,7 +217,7 @@ export const App = (props: {
235
217
  // just apply attributes to appropriate elements
236
218
  return (
237
219
  <div {...styles.card}>
238
- <div {...styles.footer}>...</div>
220
+ <div {...styles.another}>...</div>
239
221
  </div>
240
222
  );
241
223
  };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * EffCSS v4.11.0
2
+ * EffCSS v4.13.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})`,k=e=>w(e,"px"),j=e=>w(e,"vh"),S=e=>w(e,"vw"),_=e=>w(e,"vmin"),A=e=>w(e,"vmax"),O=e=>w(e,"em"),z=e=>w(e,"rem"),C=e=>w(e,"deg"),q=e=>w(e,"rad"),P=e=>w(e,"rad"),N=e=>w(e,"ms"),E=e=>w(e,"s"),T=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=>t?ie(e+` ${t.l||"l"} ${t.c||"c"} ${t.h||"h"} / ${t.a||"1"}`):e,oe=(e,t=.1)=>ie(`${e} calc(l + ${t}) c h / alpha`),le=(e,t=.1)=>ie(`${e} calc(l - ${t}) c h / alpha`),ce=(e,t=.1)=>ie(`${e} l c h / calc(alpha + ${t})`),ue=(e,t=.1)=>ie(`${e} l c h / calc(alpha - ${t})`),he=(e,t=.04)=>ie(`${e} l calc(c + ${t}) h / alpha`),me=(e,t=.04)=>ie(`${e} l calc(c - ${t}) h / alpha`),de=e=>ie(`${e} l c calc(h + 180) / alpha`),ge=e=>ie(`${e} l 0 h / alpha`),pe=(e,t=30)=>ie(`${e} l c calc(h${"number"==typeof t?t>0?" + "+t:" - "+-t:t}) / alpha`),be=e=>{const t=e("color"),r=e("contrast"),s=e("neutral");return{root:ae(t),contrast:ae(r),neutral:ae(s),oklch:ne,lighten:oe,darken:le,saturate:he,desaturate:me,fadein:ce,fadeout:ue,spin:pe,complement:de,grayscale:ge}},fe=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},$e=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},ye=Object.assign,ve=Object.entries,xe=Array.isArray,we=e=>"object"==typeof e,ke=(e,t)=>Array.from(Array(e).entries()).reduce(((e,[r])=>ye(e,t(r+1))),{}),je=(e,t)=>ve(e).reduce(((e,[r,s])=>ye(e,t(r,s))),{}),Se=(e,t,r={})=>e?t:r,_e=(...e)=>e.join("-"),Ae=(...e)=>e.join(),Oe=(...e)=>e.join(" "),ze=(e,...t)=>t.length?t.reduce(((e,t)=>(t&&e&&we(t)&&ve(t).forEach((([t,r])=>{r&&we(r)&&e[t]?xe(e[t])&&xe(r)?e[t]=[...e[t],...r]:ze(e[t],r||{}):e[t]=r})),e)),e):e,Ce=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]})))),qe={px:k,vh:j,vw:S,vmin:_,vmax:A,em:O,rem:z,deg:C,rad:q,turn:P,ms:N,s:E,pc:T,cqw:M,cqh:R,cqb:W,cqi:B,cqmin:I,cqmax:V},Pe=e=>1!==e?e+" * ":"",Ne=t=>{const{scope:i,globalKey:a}=t,o=i(a).varExp,c=(e=1)=>qe.ms(Pe(e)+o("time")),p=(e=1)=>qe.deg(Pe(e)+o("angle")),f=(e=1)=>qe.px(Pe(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,mode:w})=>{const k=i(t,w),j=k.selector,S=k.select,_=(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}})(k),A=a({dash:_e,comma:Ae,space:Oe,range:ke,each:je,when:Se,merge:ze,themeVar:o,size:f,time:c,angle:p,easing:v,bem:j,select:S,pseudo:Ce,color:be(o),palette:fe(o),coef:$e(o),units:qe,at:_});return"string"==typeof A?A:(t=>e(t,((e,t)=>e+s(...t)),""))(A)}}},Ee=Symbol("effcss-stylesheet");class Te{disabled=!1;cssRules=[];replaceSync(e){e&&(this.cssRules=[{cssText:e}])}}function Me({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(Ee)?t:Object.defineProperties(t,{[Ee]:{value:e}}),l=e=>e.adoptedStyleSheets=[...e.adoptedStyleSheets?.length?[...e.adoptedStyleSheets].filter((e=>!e.hasOwnProperty(Ee))):[],...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 Te);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 Re=({prefix:e})=>{let t=0;return{get initial(){return e+0},get current(){return e+t},next(){return t++,this.current}}},Be=({prefix:e})=>{const t=new Set,r=new Map,s=Re({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])))}}},We=void 0,Ie=Object.entries,Ve=Object.defineProperties,Je=e=>"string"==typeof e,Le=e=>null!==e&&"object"==typeof e,He=e=>e.split("."),De=(e,t="")=>Ie(e).reduce(((e,[r,s])=>{const n=t?`${t}-${r}`:r;return"object"==typeof s?(e.add(n),e=e.union(De(s,n))):e.add(n+`_${s}`),e}),new Set),Ke=(e,t="")=>Ie(e).reduce(((e,[r,s])=>{const n=t?`${t}-${r}`:r;if("object"==typeof s){const t=Ke(s,n);t.size||e.add(n),e=e.union(t)}else t&&e.add(t),e.add(n+`_${s}`);return e}),new Set),Ue=(e,t)=>Ie(e).reduce(((e,[r,s])=>{if(Le(s)){const n=Ie(s);n.length?e.push(...n.reduce(((e,[s,n])=>{if((e=>null!==e&&e!==We)(s)&&t&&e.push([r,s,We,We]),Le(n)){const t=Ie(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,We,We,We])}return e}),[]),Fe=(e,t,r,s)=>""+(((e,t)=>`${e||""}${t?"__"+t:""}`)(e,t)+(r?"_"+r:"")+(r&&s?"_"+s:""))||"_",Ze=(e,t)=>"."+(t?e+(t.startsWith("_")?"":"-")+t:e),Ge=(e,t)=>`[data-${e}${t?`~="${t}"`:""}]`;const Qe=e=>e||"",Xe=Object.assign,Ye=Object.entries,et="theme",tt="delete",rt="update",st="$light",nt="$dark",it="lightness",at="chroma",ot=e=>Number((.1*184+.9*e).toFixed(2)),lt={time:200,size:16,angle:30,color:"#2192a7",contrast:"light-dark(black, white)",neutral:"light-dark(white, #1b1f1f)",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:ot(142),inf:ot(264),war:ot(109),dan:ot(29)},[st]:{[it]:{bg:{xl:1,l:.94,m:.88,s:.83,xs:.78},fg:{xl:0,l:.12,m:.24,s:.36,xs:.48}},[at]:{bg:{gray:0,pale:.01,base:.04,rich:.7},fg:{gray:0,pale:.07,base:.11,rich:.15}}},[nt]:{[it]:{bg:{xl:.24,l:.3,m:.36,s:.42,xs:.48},fg:{xl:1,l:.93,m:.86,s:.79,xs:.72}},[at]:{bg:{pale:.02,base:.06,rich:.1},fg:{pale:.06,base:.1,rich:.14}}}},ct=({provider:e,init:t,scope:r,onChange:s})=>{const n={"":lt},i=[],a=({$light:e={},$dark:t={},...s})=>{function n(e,t=[]){return Ye(e).reduce(((e,[s,i])=>i&&"object"==typeof i?Xe(e,n(i,[...t,s])):(e[r.varName([...t,s])]=i,e)),{})}return{...n(s),[st]:n(e),[nt]:n(t)}},o={get:(e="")=>n[e],add(e,t){n[t]||(n[t]=ze({[st]:{},[nt]:{}},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:tt,payload:{name:e}}),s?.())},update(e,t=""){n[t]&&(n[t]=ze({[st]:{},[nt]:{}},n[t],e),i.push({type:rt,payload:{params:e,name:t}}),s?.())},switch(t=""){n[t]&&e.setAttribute(et,t)},vars(e=""){const t=this.get(e);return t?a(t):{[st]:{},[nt]:{}}},makeThemeVars:a,get list(){const{"":e,...t}=n;return Object.keys(t)},get current(){return e.getAttribute(et)||""},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 tt:o.delete(t.name);break;case rt:o.update(t.params,t.name)}})),o},ut="effcss",ht=ut+"-provider",mt=ut+"-override",dt="values",gt=":host",pt="@media",bt="script",ft="style",$t="size",yt="time",vt="angle",xt="color",wt="contrast",kt="neutral",jt="easing",St=ut+"changes",_t="data-"+ut,At="prefers-color-scheme",Ot=`${At}: light`,zt=`${At}: dark`,Ct={mode:"a",pre:"f"},qt=e=>"boolean"==typeof e,Pt=(e,t)=>{const r=((e,t)=>e.getAttribute(t)||Ct[t])(e,t);return(e=>"string"==typeof e?Number(e):null)(r)},Nt=(e,t,r)=>null===r?e.removeAttribute(t):e.setAttribute(t,r+""),Et=e=>`:root:has([is=${ht}]${e?`[${e}]`:""})`,Tt=e=>Object.entries(e).reduce(((e,[t,r])=>e+t+":"+r+";"),""),Mt=({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,p=t.contrast,b=t.neutral,{$dark:f={},$light:$={},...y}=e.vars();return a({[Et()]:{...y,...l.where(Ot)($),...l.where(zt)(f),[o()]:{fontSize:c(i("size"))}}},n(e.list,((t,r)=>{const{$dark:n={},$light:i={},...a}=e.vars(r),o={...a,...l.where(Ot)(i),...l.where(zt)(n)};return{[Et(`theme=${t}`)]:o,[s(`..theme.${t}`)]:o}})),u&&{[Et($t)]:{[r.varName($t)]:u}},h&&{[Et(yt)]:{[r.varName(yt)]:h}},m&&{[Et(vt)]:{[r.varName(vt)]:m}},d&&{[Et(xt)]:{[r.varName(xt)]:d}},g&&{[Et(jt)]:{[r.varName(jt)]:g}},p&&{[Et(wt)]:{[r.varName(wt)]:p}},b&&{[Et(kt)]:{[r.varName(kt)]:b}})},Rt=(e,t)=>({set(r){Nt(e,t,r)},get:()=>Pt(e,t)}),Bt=(e,t)=>({set(r){Nt(e,t,r)},get:()=>e.getAttribute(t)}),Wt=(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:Rt(e,$t),time:Rt(e,yt),angle:Rt(e,vt),color:Bt(e,xt),easing:Bt(e,jt),contrast:Bt(e,wt),neutral:Bt(e,kt)});const o=Be({prefix:e.pre}),l=((e={})=>{const{mode:t,min:r,dict:s={}}=e,n=(e,r=t)=>{let s;s="a"===r?Ge:Ze;let i=0,a=Qe,o=Qe;const l=n.dict;l&&(l[e]||(l[e]={}),a=t=>l[e][t]??(l[e][t]=(i++).toString(36)),o=t=>l[e][t]);let c=t=>[e,...Je(t)?t.split("."):t].filter(Boolean).join("-"),u="class",h=t=>t?e+(t.startsWith("_")?"":"-")+t:void 0===t?void 0:e;"a"===r&&(u="data-"+e,h=Qe);const m=e=>"--"+c(Je(e)?e.split("."):e),d=e=>Ve({[u]:e},{toString:{value:()=>`${u}="${e}"`},$:{value:e}}),g=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:{}})}(g);let t,r,s,n,i="";const a=Je(e);return i=a||Array.isArray(e)?[...(a?[e]:e).reduce(((e,i)=>([t,r,s,n]=He(i),e.add(h(o(Fe(t,r)))),s&&e.add(h(o(Fe(t,r,s,n)))),e)),new Set).values()].join(" "):e&&Ue(e,!0).map((([e,t,r,s])=>h(o(Fe(e,t,r,s))))).join(" "),d(i)};return g.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=>h(o(e)))).join(" ");return d(t)},g.obj=(e,t)=>{let r=Ke;"full"===t&&(r=De);const s=[...r(e).values()].map((e=>h(o(e)))).join(" ");return d(s)},{select:t=>{const r=t.replaceAll(".","-").replace(":","_");return s(e,a(r))},selector:t=>{const[r,n,i,o]=He(t);return s(e,a(Fe(r,n,i,o)))},attr:g,name:c,varName:m,varExp:(e,t)=>`var(${m(e)}${void 0!==t?","+t:""})`}};return r&&(n.dict=s),n})({mode:e.mode,min:e.min,dict:a?.dict}),c=l(o.key()),u=Ne({scope:l,globalKey:o.key()}),h=Me({initStyles:t,emulate:r});e.theme=ct({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,s)=>e(r||t.key(),s).attr,o=(e,t,r)=>s.compile({key:t,maker:e,mode:r}),l=(e,s)=>{let n=t.use(e);return r&&!r.get(n)&&r.pack(n,r.hydrate(n)||o(e,n,s)),a(n,s)},c=(...e)=>0===e.length?[l(n)]:e.map((e=>l(e))),u=(e,t)=>{const r=l(e,"c");return Array.isArray(t)?r.list(...t).$:r.obj(t).$};u.join=(...e)=>e.reduce(((e,t)=>t?e?e+" "+t:t||"":e),"");const h=(e,t)=>{const r=l(e,"a");return Array.isArray(t)?r.list(...t):r.obj(t)};return h.join=(...e)=>e.reduce(((e,t)=>t?{...e,...t}:e),{}),{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,cx:u,dx:h,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 ${_t}="${e}">${[...t.cssRules].map((e=>e.cssText)).join("")}</style>`)).join("");let s=ft,n="";const a={is:ht,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(jt),contrast:e.getAttribute(wt),neutral:e.getAttribute(kt)};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!==Ct[e]?""===t?e:`${e}="${t}"`:"")).filter(Boolean).join(" ")}${e.theme.current?` theme="${e.theme.current}"`:""}>${n}</${s}>`}}}),Object.assign(e,m)},It=Symbol(ht),Vt=[$t,yt,vt,xt,jt,wt,kt],Jt=new Set(Vt),Lt=()=>globalThis?.document.querySelector(`[is=${ht}]`);const Ht=(e={})=>{let{noscript:t,attrs:r={}}=e,{mode:s=Ct.mode,min:n,pre:i=Ct.prefix,size:a=null,time:o=null,angle:l=null,color:c=null,easing:u=null,contrast:h=null,neutral:m=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,contrast:h||null,neutral:m||null,pre:i,mode:s,min:n?"":null};getAttribute(e){const t=this.attributes[e];return null!=t?qt(t)?"":t+"":null}setAttribute(e,t){this.attributes[e]=t+"",Jt.has(e)&&this._customize()}removeAttribute(e){delete this.attributes[e]}theme;pre;mode;min;size;angle;time;color;easing;contrast;neutral;use;remake;css;cx;dx;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=this.contrast,a=this.neutral,o=Mt({theme:this.theme,attrs:{size:e,time:t,angle:r,color:s,easing:n,contrast:i,neutral:a},scope:this._s(this._c.key())});this.remake(o,this._),this._=o};constructor(){Wt(this,{emulate:!0,onChange:this._customize,globalMaker:this._,noscript:t}),this._customize()}}},Dt=(e={})=>{const{emulate:t,global:r,...s}=e,n=globalThis?.document;let i;const a=globalThis[It];if(r&&a)i=a;else if(n&&!t){void 0===Dt.isDefined&&(Dt.isDefined=function(){const e=globalThis.document,t=globalThis.customElements;if(t?.get(ht))return!1;{class r extends HTMLScriptElement{static get observedAttributes(){return Vt}theme;pre;mode;min;size;angle;time;color;easing;contrast;neutral;use;remake;css;cx;dx;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=this.contrast,a=this.neutral,o=Mt({theme:this.theme,attrs:{size:e,time:t,angle:r,color:s,easing:n,contrast:i,neutral:a},scope:this._s(this._c.key())});this.remake(o,this._),this._=o};attributeChangedCallback(){this.isConnected&&this._customize()}connectedCallback(){Wt(this,{initStyles:[...e.querySelectorAll(ft+`[${_t}]`)],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[It]}}t.define(ht,r,{extends:bt});class s extends HTMLElement{static get observedAttributes(){return[dt,...Vt]}_customize(){const e=Lt();if(this.shadowRoot&&e){const t=this.getAttribute(dt),r=new CSSStyleSheet,s=t?JSON.parse(decodeURIComponent(t)):{};Vt.forEach((e=>{const t=this.getAttribute(e);t&&(s[e]=t)}));const{$dark:n={},$light:i={},...a}=e.theme.makeThemeVars(s),o=Tt(i),l=Tt(n);r.replaceSync(gt+`{${"display:contents;"+Tt(a)}}`+gt+`([scheme=light]){color-scheme:light;${o}}`+gt+`([scheme=dark]){color-scheme:dark;${l}}`+pt+`(${Ot}){${gt}{${o}}}`+pt+`(${zt}){${gt}{${l}}}`),this.shadowRoot.adoptedStyleSheets=[r]}}attributeChangedCallback(){this.isConnected&&this._customize()}connectedCallback(){this.attachShadow({mode:"open"}).innerHTML="<slot></slot>",this._customize()}}return t.define(mt,s),!0}}());const e=Lt();if(e)i=e;else{const e=n.createElement(bt,{is:ht});e.setAttribute("is",ht);const t=s?.attrs;t&&Object.entries(t).map((([t,r])=>r&&Ct[t]!==r&&e.setAttribute(t,qt(r)?"":r+""))),n.head.appendChild(e),i=e}}else i=Ht(s);return r&&!a&&(globalThis[It]=i),i},Kt=e=>encodeURIComponent(JSON.stringify(e));export{Ct as DEFAULT_ATTRS,ht as TAG_NAME,mt as TAG_NAME_OVERRIDE,Kt as prepareOverrideValues,Dt 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=p(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=>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)})`}})},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"),p=(e,t)=>e?"string"==typeof e?e.includes("(")||t?e:a(e):e+"":"",g=(e={})=>{const{type:t,condition:r}=e,s=p(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:()=>g({condition:r,type:"all"})},print:{get:()=>g({condition:r,type:"print"})},screen:{get:()=>g({condition:r,type:"screen"})},where:{value:e=>g({condition:e,type:t})},toString:{value:()=>i}})},b=g({}),f=({condition:e}={})=>{const t=p(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})`,j=e=>w(e,"px"),k=e=>w(e,"vh"),S=e=>w(e,"vw"),_=e=>w(e,"vmin"),A=e=>w(e,"vmax"),O=e=>w(e,"em"),z=e=>w(e,"rem"),C=e=>w(e,"deg"),P=e=>w(e,"rad"),q=e=>w(e,"rad"),E=e=>w(e,"ms"),N=e=>w(e,"s"),T=e=>w(e,"%"),R=e=>w(e,"cqw"),M=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-",U=":only-",F="child",Z=":nth-",G="of-type",K=Z+F,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+F,lc:D+F,oc:U+F,odd:K+"(odd)",even:K+"(even)",ft:H+G,lt:D+G,ot:U+G,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:K,ntho:Z+G,dir:":dir",lang:":lang"},ne=e=>`oklch(${e})`,ie=e=>ne(`from ${e}`),ae=e=>t=>{if(!t)return e||"currentColor";const{l:r,c:s,h:n,a:i=1}=t;return ne(r&&s&&n?(e?`from ${e} `:"")+`${r} ${s} ${n} / ${i||(e?"alpha":1)}`:`from ${e||"currentColor"} ${r||"l"} ${s||"c"} ${n||"h"} / ${i||"alpha"}`)},oe=(e,t=.1)=>ie(`${e} calc(l + ${t}) c h / alpha`),le=(e,t=.1)=>ie(`${e} calc(l - ${t}) c h / alpha`),ce=(e,t=.1)=>ie(`${e} l c h / calc(alpha + ${t})`),ue=(e,t=.1)=>ie(`${e} l c h / calc(alpha - ${t})`),he=(e,t=.04)=>ie(`${e} l calc(c + ${t}) h / alpha`),me=(e,t=.04)=>ie(`${e} l calc(c - ${t}) h / alpha`),de=e=>ie(`${e} l c calc(h + 180) / alpha`),pe=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`),be=e=>"string"==typeof e?ne(e):ae(e.from)(e),fe=e=>{const t=e("color"),r=e("contrast"),s=e("neutral");return{root:ae(t),contrast:ae(r),neutral:ae(s),oklch:be,lighten:oe,darken:le,saturate:he,desaturate:me,fadein:ce,fadeout:ue,spin:ge,complement:de,grayscale:pe}},$e=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},ye=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},ve=Object.assign,xe=Object.entries,we=Array.isArray,je=e=>"object"==typeof e,ke=(e,t)=>Array.from(Array(e).entries()).reduce(((e,[r])=>ve(e,t(r+1))),{}),Se=(e,t)=>xe(e).reduce(((e,[r,s])=>ve(e,t(r,s))),{}),_e=(e,t,r={})=>e?t:r,Ae=(...e)=>e.join("-"),Oe=(...e)=>e.join(),ze=(...e)=>e.join(" "),Ce=(e,...t)=>t.length?t.reduce(((e,t)=>(t&&e&&je(t)&&xe(t).forEach((([t,r])=>{r&&je(r)&&e[t]?we(e[t])&&we(r)?e[t]=[...e[t],...r]:Ce(e[t],r||{}):e[t]=r})),e)),e):e,Pe=(e,t,s="")=>{const n=(n=0)=>{const i=t(e),a=n?t(e+"-"+n,i):i;return Object.defineProperties(((e=1)=>`calc(${a} * ${e}${s})`),{toString:{value:()=>`calc(${a} * 1${s})`},[r]:{value:!0}})},i={get:(e,t,r)=>"symbol"==typeof t||Number.isNaN(+t)?Reflect.get(e,t,r):n(+t)};return new Proxy(n(),i)},qe=(e,t)=>{const s=(s=0)=>{const n=t(e),i=s?t(e+"-"+s,n):n;return Object.defineProperties({},{toString:{value:()=>i},[r]:{value:!0}})},n={get:(e,t,r)=>"symbol"==typeof t||Number.isNaN(+t)?Reflect.get(e,t,r):s(+t)};return new Proxy(s(),n)},Ee=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]})))),Ne={px:j,vh:k,vw:S,vmin:_,vmax:A,em:O,rem:z,deg:C,rad:P,turn:q,ms:E,s:N,pc:T,cqw:R,cqh:M,cqb:W,cqi:B,cqmin:I,cqmax:V},Te=e=>1!==e?e+" * ":"",Re=t=>{const{scope:i,prefix:a}=t,o=i(a).varExp,c=(e=1)=>Ne.ms(Te(e)+o("time")),g=(e=1)=>Ne.deg(Te(e)+o("angle")),f=(e=1)=>Ne.px(Te(e)+o("size")),v=e=>e?`cubic-bezier(${e.x1||0},${e.y1||0},${e.x2||1},${e.y2||1})`:o("easing"),w={variable:o,tuning:o,time:Pe("time",o,"ms"),angle:Pe("angle",o,"deg"),size:Pe("size",o,"px"),space:Pe("space",o,"px"),easing:qe("easing",o),color:qe("color",o),contrast:qe("contrast",o),neutral:qe("neutral",o)};return{compile:({key:t,maker:a,mode:j})=>{const k=i(t,j);w.tuning=k.varExp;const S=k.selector,_=k.select,A=(e=>{const t={cp:1,lay:1,kf:1,cq:1},s=(n={})=>{const{scroll:i,type:a,name:o,condition:l}=n,c=p(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}})(k),O=a({dash:Ae,comma:Oe,space:ze,range:ke,each:Se,when:_e,merge:Ce,theme:w,themeVar:o,size:f,time:c,angle:g,easing:v,bem:S,select:_,pseudo:Ee,color:fe(o),palette:$e(o),coef:ye(o),units:Ne,at:A});return"string"==typeof O?O:(t=>e(t,((e,t)=>e+s(...t)),""))(O)}}},Me=Symbol("effcss-stylesheet");class Be{disabled=!1;cssRules=[];replaceSync(e){e&&(this.cssRules=[{cssText:e}])}}function We({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(Me)?t:Object.defineProperties(t,{[Me]:{value:e}}),l=e=>e.adoptedStyleSheets=[...e.adoptedStyleSheets?.length?[...e.adoptedStyleSheets].filter((e=>!e.hasOwnProperty(Me))):[],...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 Be);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 Ie=({prefix:e})=>{let t=0;return{get initial(){return e},get current(){return e+(t||"")},next(){return t++,this.current}}},Ve=({prefix:e})=>{const t=new Set,r=new Map,s=Ie({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])))}}},Je=void 0,Le=Object.entries,He=Object.defineProperties,De=e=>"string"==typeof e,Ue=e=>null!==e&&"object"==typeof e,Fe=e=>e.split("."),Ze=(e,t="")=>Le(e).reduce(((e,[r,s])=>{const n=t?`${t}-${r}`:r;return"object"==typeof s?(e.add(n),e=e.union(Ze(s,n))):e.add(n+`_${s}`),e}),new Set),Ge=(e,t="")=>Le(e).reduce(((e,[r,s])=>{const n=t?`${t}-${r}`:r;if("object"==typeof s){const t=Ge(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)=>Le(e).reduce(((e,[r,s])=>{if(Ue(s)){const n=Le(s);n.length?e.push(...n.reduce(((e,[s,n])=>{if((e=>null!==e&&e!==Je)(s)&&t&&e.push([r,s,Je,Je]),Ue(n)){const t=Le(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,Je,Je,Je])}return e}),[]),Qe=(e,t,r,s)=>""+(((e,t)=>`${e||""}${t?"__"+t:""}`)(e,t)+(r?"_"+r:"")+(r&&s?"_"+s:""))||"_",Xe=(e,t)=>"."+(t?e+(t.startsWith("_")?"":"-")+t:e),Ye=(e,t)=>`[data-${e}${t?`~="${t}"`:""}]`;const et=e=>e||"",tt=Object.assign,rt=Object.entries,st="theme",nt="delete",it="update",at="$light",ot="$dark",lt="lightness",ct="chroma",ut=e=>Number((.1*184+.9*e).toFixed(2)),ht={time:200,size:16,space:12,angle:30,color:"#2192a7",contrast:"light-dark(black, white)",neutral:"light-dark(white, #1b1f1f)",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:ut(142),inf:ut(264),war:ut(109),dan:ut(29)},[at]:{[lt]:{bg:{xl:1,l:.94,m:.88,s:.83,xs:.78},fg:{xl:0,l:.12,m:.24,s:.36,xs:.48}},[ct]:{bg:{gray:0,pale:.01,base:.04,rich:.7},fg:{gray:0,pale:.07,base:.11,rich:.15}}},[ot]:{[lt]:{bg:{xl:.24,l:.3,m:.36,s:.42,xs:.48},fg:{xl:1,l:.93,m:.86,s:.79,xs:.72}},[ct]:{bg:{pale:.02,base:.06,rich:.1},fg:{pale:.06,base:.1,rich:.14}}}},mt=({provider:e,init:t,scope:r,onChange:s})=>{const n={"":ht},i=[],a=({$light:e={},$dark:t={},...s})=>{function n(e,t=[]){return rt(e).reduce(((e,[s,i])=>Array.isArray(i)?(i.forEach(((n,i)=>{e[r.varName([...t,s,i])]=n})),e):i&&"object"==typeof i?tt(e,n(i,s?[...t,s]:t)):(e[r.varName([...t,s])]=i,e)),{})}return{...n(s),[at]:n(e),[ot]:n(t)}},o={get:(e="")=>n[e],add(e,t){n[t]||(n[t]=Ce({[at]:{},[ot]:{}},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:nt,payload:{name:e}}),s?.())},update(e,t=""){const r=n[t];if(r){let a;a="function"==typeof e?e(r):e,n[t]=Ce({[at]:{},[ot]:{}},r,a),i.push({type:it,payload:{params:e,name:t}}),s?.()}},switch(t=""){n[t]&&e.setAttribute(st,t)},vars(e=""){const t=this.get(e);return t?a(t):{[at]:{},[ot]:{}}},makeThemeVars:a,get list(){const{"":e,...t}=n;return Object.keys(t)},get current(){return e.getAttribute(st)||""},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 nt:o.delete(t.name);break;case it:o.update(t.params,t.name)}})),o},dt="effcss",pt=dt+"-provider",gt=dt+"-override",bt="values",ft=":host",$t="@media",yt="script",vt="style",xt="size",wt="space",jt="time",kt="angle",St="color",_t="contrast",At="neutral",Ot="easing",zt=dt+"changes",Ct="data-"+dt,Pt="prefers-color-scheme",qt=`${Pt}: light`,Et=`${Pt}: dark`,Nt={mode:"a",pre:"f"},Tt=";",Rt=e=>"boolean"==typeof e,Mt=e=>"string"==typeof e?Number(e):null,Bt=(e,t)=>{const r=((e,t)=>e.getAttribute(t)||Nt[t])(e,t);if(!r)return Mt(r);const s=r.split(Tt);return s.length>1?s.map(Mt):Mt(r)},Wt=(e,t,r)=>null===r?e.removeAttribute(t):e.setAttribute(t,Array.isArray(r)?r.join(Tt):r+""),It=e=>`:root:has([is=${pt}]${e?`[${e}]`:""})`,Vt=e=>Object.entries(e).reduce(((e,[t,r])=>e+t+":"+r+";"),""),Jt=(e,t)=>e+(+t?"-"+t:""),Lt=({theme:e,attrs:t,scope:r})=>({bem:s,each:n,themeVar:i,merge:a,pseudo:{r:o},at:{media:l},units:{px:c}})=>{const{$dark:u={},$light:h={},...m}=e.vars();return a({[It()]:{...m,...l.where(qt)(h),...l.where(Et)(u),[o()]:{fontSize:c(i("size"))}}},n(e.list,((t,r)=>{const{$dark:n={},$light:i={},...a}=e.vars(r),o={...a,...l.where(qt)(i),...l.where(Et)(n)};return{[It(`theme=${t}`)]:o,[s(`..theme.${t}`)]:o}})),...Object.entries(t).map((([e,t])=>t&&{[It(e)]:n(Array.isArray(t)?t:[t],((t,s)=>({[r.varName(Jt(e,+t))]:s})))})))},Ht=(e,t)=>({set(r){Wt(e,t,r)},get:()=>Bt(e,t)}),Dt=(e,t)=>({set(r){Wt(e,t,r)},get(){const r=e.getAttribute(t);if(!r)return r;const s=r.split(Tt);return s.length>1?s:r}}),Ut=(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:Ht(e,xt),space:Ht(e,wt),time:Ht(e,jt),angle:Ht(e,kt),color:Dt(e,St),easing:Dt(e,Ot),contrast:Dt(e,_t),neutral:Dt(e,At)});const o=e.pre,l=Ve({prefix:o}),c=((e={})=>{const{mode:t,min:r,dict:s={}}=e,n=(e,r=t)=>{let s;s="a"===r?Ye:Xe;let i=0,a=et,o=et;const l=n.dict;l&&(l[e]||(l[e]={}),a=t=>l[e][t]??(l[e][t]=(i++).toString(36)),o=t=>l[e][t]);let c=t=>[e,...De(t)?t.split("."):t].filter(Boolean).join("-"),u="class",h=t=>t?e+(t.startsWith("_")?"":"-")+t:void 0===t?void 0:e;"a"===r&&(u="data-"+e,h=et);const m=e=>"--"+c(De(e)?e.split("."):e),d=e=>He({[u]:e},{toString:{value:()=>`${u}="${e}"`},$:{value:e}}),p=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:{}})}(p);let t,r,s,n,i="";const a=De(e);return i=a||Array.isArray(e)?[...(a?[e]:e).reduce(((e,i)=>([t,r,s,n]=Fe(i),e.add(h(o(Qe(t,r)))),s&&e.add(h(o(Qe(t,r,s,n)))),e)),new Set).values()].join(" "):e&&Ke(e,!0).map((([e,t,r,s])=>h(o(Qe(e,t,r,s))))).join(" "),d(i)};return p.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=>h(o(e)))).join(" ");return d(t)},p.obj=(e,t)=>{let r=Ge;"full"===t&&(r=Ze);const s=[...r(e).values()].map((e=>h(o(e)))).join(" ");return d(s)},{select:t=>{const r=t.replaceAll(".","-").replace(":","_");return s(e,a(r))},selector:t=>{const[r,n,i,o]=Fe(t);return s(e,a(Qe(r,n,i,o)))},attr:p,name:c,varName:m,varExp:(e,t)=>`var(${m(e)}${void 0!==t?","+t:""})`}};return r&&(n.dict=s),n})({mode:e.mode,min:e.min,dict:a?.dict}),u=c(l.key()),h=Re({scope:c,prefix:o}),m=We({initStyles:t,emulate:r});e.theme=mt({provider:e,init:a?.theme,onChange:s,scope:u});const d=(({scope:e,collector:t,manager:r,processor:s,globalMaker:n})=>{const i=e=>"string"==typeof e?e:t.key(e),a=(r,s)=>e(r||t.key(),s).attr,o=(e,t,r)=>s.compile({key:t,maker:e,mode:r}),l=(e,s)=>{let n=t.use(e);return r&&!r.get(n)&&r.pack(n,r.hydrate(n)||o(e,n,s)),a(n,s)},c=(...e)=>0===e.length?[l(n)]:e.map((e=>l(e))),u=(e,t)=>{const r=l(e,"c");return Array.isArray(t)?r.list(...t).$:r.obj(t).$};u.join=(...e)=>e.reduce(((e,t)=>t?e?e+" "+t:t||"":e),"");const h=(e,t)=>{const r=l(e,"a");return Array.isArray(t)?r.list(...t):r.obj(t)};return h.join=(...e)=>e.reduce(((e,t)=>t?{...e,...t}:e),{}),{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,cx:u,dx:h,tune:(r,s)=>{const n=t.key(s);let i={};if(n){const a=e(n);function o(e,t){"object"!=typeof t?i[a.varName(e)]=t:Object.entries(t).map((([t,r])=>{o(t&&e?e+"-"+t:e||t,r)}))}o("",r)}return i},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:c,processor:h,manager:m,collector:l,globalMaker:n});Object.defineProperties(e,{_c:{value:l},_s:{value:c},_p:{value:h},_m:{value:m},toString:{value:()=>{const t={...m.all()},r=Object.entries(t).filter((([e,t])=>!t.disabled)).map((([e,t])=>`<style ${Ct}="${e}">${[...t.cssRules].map((e=>e.cssText)).join("")}</style>`)).join("");let s=vt,n="";const a={is:pt,min:e.getAttribute("min"),mode:e.getAttribute("mode"),size:e.getAttribute(xt),space:e.getAttribute(wt),time:e.getAttribute(jt),angle:e.getAttribute(kt),color:e.getAttribute(St),easing:e.getAttribute(Ot),contrast:e.getAttribute(_t),neutral:e.getAttribute(At)};if(!i){s=yt,a.type="application/json";const t={theme:e.theme.actions,dict:c.dict};n=JSON.stringify(t)}return r+`<${s} ${Object.entries(a).map((([e,t])=>null!=t&&t!==Nt[e]?""===t?e:`${e}="${t}"`:"")).filter(Boolean).join(" ")}${e.theme.current?` theme="${e.theme.current}"`:""}>${n}</${s}>`}}}),Object.assign(e,d)},Ft=Symbol(pt),Zt=[xt,wt,jt,kt,St,Ot,_t,At],Gt=new Set(Zt),Kt=()=>globalThis?.document.querySelector(`[is=${pt}]`);const Qt=(e={})=>{let{noscript:t,attrs:r={}}=e,{mode:s=Nt.mode,min:n,pre:i=Nt.prefix,size:a=null,space:o=null,time:l=null,angle:c=null,easing:u=null,color:h=null,contrast:m=null,neutral:d=null}=r;return new class{get tagName(){return""}get textContent(){return""}attributes={size:a?a+"":null,space:o?o+"":null,time:l?l+"":null,angle:c?c+"":null,color:h||null,easing:u||null,contrast:m||null,neutral:d||null,pre:i,mode:s,min:n?"":null};getAttribute(e){const t=this.attributes[e];return null!=t?Rt(t)?"":t+"":null}setAttribute(e,t){this.attributes[e]=t+"",Gt.has(e)&&this._customize()}removeAttribute(e){delete this.attributes[e]}theme;pre;mode;min;size;space;angle;time;color;easing;contrast;neutral;use;remake;css;cx;dx;tune;get makers(){return this._c.makers}status;on;off;stylesheets;_c;_m;_s;_p;_;_n;_customize=()=>{const e=this.size,t=this.space,r=this.time,s=this.angle,n=this.color,i=this.easing,a=this.contrast,o=this.neutral,l=Lt({theme:this.theme,attrs:{size:e,space:t,time:r,angle:s,color:n,easing:i,contrast:a,neutral:o},scope:this._s(this._c.key())});this.remake(l,this._),this._=l};constructor(){Ut(this,{emulate:!0,onChange:this._customize,globalMaker:this._,noscript:t}),this._customize()}}},Xt=(e={})=>{const{emulate:t,global:r,...s}=e,n=globalThis?.document;let i;const a=globalThis[Ft];if(r&&a)i=a;else if(n&&!t){void 0===Xt.isDefined&&(Xt.isDefined=function(){const e=globalThis.document,t=globalThis.customElements;if(t?.get(pt))return!1;{class r extends HTMLScriptElement{static get observedAttributes(){return Zt}theme;pre;mode;min;size;space;angle;time;color;easing;contrast;neutral;use;remake;css;cx;dx;tune;get makers(){return this._c.makers}status;on;off;stylesheets;_c;_m;_s;_p;_;_n;_customize=()=>{const e=this.size,t=this.space,r=this.time,s=this.angle,n=this.color,i=this.easing,a=this.contrast,o=this.neutral,l=Lt({theme:this.theme,attrs:{size:e,space:t,time:r,angle:s,color:n,easing:i,contrast:a,neutral:o},scope:this._s(this._c.key())});this.remake(l,this._),this._=l};attributeChangedCallback(){this.isConnected&&this._customize()}connectedCallback(){Ut(this,{initStyles:[...e.querySelectorAll(vt+`[${Ct}]`)],onChange:this._customize,globalMaker:this._}),this._customize();const t=this;this._n={set adoptedStyleSheets(e){t.dispatchEvent(new CustomEvent(zt,{detail:{styles:e},bubbles:!0}))}},this._m.register(this._n),this._m.register(e)}disconnectedCallback(){delete globalThis[Ft]}}t.define(pt,r,{extends:yt});class s extends HTMLElement{static get observedAttributes(){return[bt,...Zt]}_customize(){const e=Kt();if(this.shadowRoot&&e){const t=this.getAttribute(bt),r=new CSSStyleSheet,s=t?JSON.parse(decodeURIComponent(t)):{};Zt.forEach((e=>{const t=this.getAttribute(e);t&&t.split(Tt).forEach(((t,r)=>{s[Jt(e,r)]=t}))}));const{$dark:n={},$light:i={},...a}=e.theme.makeThemeVars(s),o=Vt(i),l=Vt(n);r.replaceSync(ft+`{${"display:contents;"+Vt(a)}}`+ft+`([scheme=light]){color-scheme:light;${o}}`+ft+`([scheme=dark]){color-scheme:dark;${l}}`+$t+`(${qt}){${ft}{${o}}}`+$t+`(${Et}){${ft}{${l}}}`),this.shadowRoot.adoptedStyleSheets=[r]}}attributeChangedCallback(){this.isConnected&&this._customize()}connectedCallback(){this.attachShadow({mode:"open"}).innerHTML="<slot></slot>",this._customize()}}return t.define(gt,s),!0}}());const e=Kt();if(e)i=e;else{const e=n.createElement(yt,{is:pt});e.setAttribute("is",pt);const t=s?.attrs;t&&Object.entries(t).map((([t,r])=>r&&Nt[t]!==r&&e.setAttribute(t,Rt(r)?"":r+""))),n.head.appendChild(e),i=e}}else i=Qt(s);return r&&!a&&(globalThis[Ft]=i),i},Yt=e=>encodeURIComponent(JSON.stringify(e));export{Nt as DEFAULT_ATTRS,pt as TAG_NAME,gt as TAG_NAME_OVERRIDE,Yt as prepareOverrideValues,Xt as useStyleProvider};
@@ -17,28 +17,39 @@ type TOKLCH = {
17
17
  */
18
18
  a?: string | number;
19
19
  };
20
- type TChangeStr = (val: string) => string;
20
+ type TOKLCHFrom = TOKLCH & {
21
+ /**
22
+ * Origin color
23
+ */
24
+ from?: string;
25
+ };
21
26
  type TChangeColor = (color: string | object, val?: number | string) => string;
22
27
  export declare const resolveColor: (varExp: ReturnType<ReturnType<TCreateScope>>["varExp"]) => {
23
28
  /**
24
29
  * Theme root color
25
30
  * @param params - oklch params
31
+ * @deprecated
32
+ * Will be deleted in the next major version. Use `theme.color` utility instead
26
33
  */
27
34
  root: (params?: TOKLCH) => string;
28
35
  /**
29
36
  * Theme contrast color
30
37
  * @param params - oklch params
38
+ * @deprecated
39
+ * Will be deleted in the next major version. Use `theme.contrast` utility instead
31
40
  */
32
41
  contrast: (params?: TOKLCH) => string;
33
42
  /**
34
43
  * Theme neutral color
35
44
  * @param params - oklch params
45
+ * @deprecated
46
+ * Will be deleted in the next major version. Use `theme.neutral` utility instead
36
47
  */
37
48
  neutral: (params?: TOKLCH) => string;
38
49
  /**
39
50
  * oklch()
40
51
  */
41
- oklch: TChangeStr;
52
+ oklch: (params: TOKLCHFrom | string) => string;
42
53
  /**
43
54
  * Increase color lightness
44
55
  */
@@ -0,0 +1,8 @@
1
+ type TScalableVariable = (coef?: number | string | object) => string;
2
+ type TProxyVariable = {
3
+ [index: number]: TScalableVariable;
4
+ };
5
+ type TProxyScalableVariable = TProxyVariable & TScalableVariable;
6
+ export declare const scalableVariable: (name: string, resolver: (val: string, fallback?: string | number) => string, unit?: string | object) => TProxyScalableVariable;
7
+ export declare const simpleVariable: (name: string, resolver: (val: string, fallback?: string | number) => string) => TProxyVariable;
8
+ export {};
@@ -6,6 +6,7 @@ import { resolveColor } from './_process/color';
6
6
  import { resolvePalette } from './_process/palette';
7
7
  import { resolveCoef } from './_process/coef';
8
8
  import { dash, comma, space, range, each, when, merge } from './utils';
9
+ import { scalableVariable, simpleVariable } from './_process/vars';
9
10
  type TScope = ReturnType<ReturnType<TCreateScope>>;
10
11
  type TBezier = {
11
12
  x1?: number;
@@ -14,6 +15,8 @@ type TBezier = {
14
15
  y2?: number;
15
16
  };
16
17
  type TRelative = (coef?: number | string | object) => string;
18
+ type TProxyNumVar = ReturnType<typeof scalableVariable>;
19
+ type TProxyStrVar = ReturnType<typeof simpleVariable>;
17
20
  export interface IMakerParams {
18
21
  dash: typeof dash;
19
22
  comma: typeof comma;
@@ -60,24 +63,83 @@ export interface IMakerParams {
60
63
  * Resolve theme variable
61
64
  * @param name - name
62
65
  * @param fallback - fallback value
66
+ * @deprecated
67
+ * Will be deleted in the next major version. Use `theme.variable` utility instead
63
68
  */
64
69
  themeVar: TScope['varExp'];
65
70
  /**
66
71
  * Scalable size value
72
+ * @deprecated
73
+ * Will be deleted in the next major version. Use `theme.size` utility instead
67
74
  */
68
75
  size: TRelative;
69
76
  /**
70
77
  * Scalable time value
78
+ * @deprecated
79
+ * Will be deleted in the next major version. Use `theme.time` utility instead
71
80
  */
72
81
  time: TRelative;
73
82
  /**
74
83
  * Scalable angle value
84
+ * @deprecated
85
+ * Will be deleted in the next major version. Use `theme.angle` utility instead
75
86
  */
76
87
  angle: TRelative;
77
88
  /**
78
89
  * Easing function
90
+ * @deprecated
91
+ * Will be deleted in the next major version. Use `theme.easing` utility instead
79
92
  */
80
93
  easing: (bezier?: TBezier) => string;
94
+ /**
95
+ * Theme utils
96
+ */
97
+ theme: {
98
+ /**
99
+ * Resolve theme variable
100
+ * @param name - name
101
+ * @param fallback - fallback value
102
+ */
103
+ variable: TScope['varExp'];
104
+ /**
105
+ * Get tuning value
106
+ * @param name - name
107
+ * @param fallback - fallback value
108
+ */
109
+ tuning: TScope['varExp'];
110
+ /**
111
+ * Size variable
112
+ */
113
+ size: TProxyNumVar;
114
+ /**
115
+ * Space variable
116
+ */
117
+ space: TProxyNumVar;
118
+ /**
119
+ * Time variable
120
+ */
121
+ time: TProxyNumVar;
122
+ /**
123
+ * Angle variable
124
+ */
125
+ angle: TProxyNumVar;
126
+ /**
127
+ * Easing function variable
128
+ */
129
+ easing: TProxyStrVar;
130
+ /**
131
+ * Base color variable
132
+ */
133
+ color: TProxyStrVar;
134
+ /**
135
+ * Contrast color variable
136
+ */
137
+ contrast: TProxyStrVar;
138
+ /**
139
+ * Neutral color variable
140
+ */
141
+ neutral: TProxyStrVar;
142
+ };
81
143
  }
82
144
  export type TProcessor = {
83
145
  /**
@@ -92,7 +154,7 @@ export type TProcessor = {
92
154
  };
93
155
  type TCreateProcessor = (params: {
94
156
  scope: ReturnType<TCreateScope>;
95
- globalKey: string;
157
+ prefix: string;
96
158
  }) => TProcessor;
97
159
  /**
98
160
  * Create style processor
@@ -1,7 +1,7 @@
1
1
  type Paths<T> = T extends object ? {
2
2
  [K in keyof T]: `${Exclude<K, symbol>}${'' | Paths<T[K]> extends '' ? '' : `.${Paths<T[K]>}`}`;
3
3
  }[keyof T] : T extends string ? T : never;
4
- type TDeepPartial<T> = T extends object ? {
4
+ export type TDeepPartial<T> = T extends object ? {
5
5
  [P in keyof T]?: TDeepPartial<T[P]>;
6
6
  } : T;
7
7
  type TBlocks<T> = Exclude<keyof T, symbol | number>;
@@ -112,7 +112,7 @@ export type TScope = {
112
112
  /**
113
113
  * Var expression
114
114
  */
115
- varExp: <T extends Record<string, object | number | string | boolean> = TDefaultTheme>(name: TLeaves<T>, fallback?: string | number) => string;
115
+ varExp: <T extends Record<string, object | number | string | boolean>>(name: TLeaves<T>, fallback?: string | number) => string;
116
116
  };
117
117
  /**
118
118
  * Style scope resolver
@@ -22,13 +22,13 @@ type TThemeAction = {
22
22
  };
23
23
  };
24
24
  export type TThemeValue = {
25
- [key in (string | number)]: string | number | boolean | TThemeValue;
25
+ [key in (string | number)]: string | number | boolean | (string | number)[] | TThemeValue;
26
26
  };
27
27
  export type TThemeController = {
28
28
  get(name?: string): TThemeValue;
29
29
  add(params: TThemeValue, name: string): void;
30
30
  delete(name: string): void;
31
- update(params: TThemeValue, name?: string): void;
31
+ update(params: TThemeValue | ((prev: object) => object), name?: string): void;
32
32
  switch(name?: string): void;
33
33
  vars<T extends object = object>(theme?: string): TThemeParams<T>;
34
34
  makeThemeVars<T extends object>(params: TThemeParams<T>): TThemeValue;
@@ -1,5 +1,6 @@
1
1
  import type { TProcessor } from './_provider/process';
2
2
  import type { TCollector } from './_provider/collect';
3
+ import type { TDeepPartial } from './_provider/scope';
3
4
  import type { TDetails, TScopeResolver, TStyles } from './_provider/scope';
4
5
  import type { TThemeController } from './_provider/theme';
5
6
  export type { TShortRange, TMainRange, TBaseRange, TLongRange, TFullRange, TSparseRange } from './_provider/_process/coef';
@@ -13,6 +14,10 @@ type TAttrs = {
13
14
  * Root font size in px
14
15
  */
15
16
  size: number;
17
+ /**
18
+ * Root space variable in px
19
+ */
20
+ space: number;
16
21
  /**
17
22
  * Root time in ms
18
23
  */
@@ -101,8 +106,8 @@ export type TMonoElement<TStyle extends object> = {
101
106
  * Style target
102
107
  */
103
108
  type TStyleTarget = string | TStyleSheetMaker;
104
- type TNumberOrNull = number | null;
105
- type TStringOrNull = string | null;
109
+ type TNumberAttr = number[] | number | null;
110
+ type TStringAttr = string[] | string | null;
106
111
  /**
107
112
  * Classname expression
108
113
  */
@@ -168,66 +173,75 @@ export interface IStyleProvider {
168
173
  /**
169
174
  * Get root size value
170
175
  */
171
- get size(): TNumberOrNull;
176
+ get size(): TNumberAttr;
172
177
  /**
173
178
  * Set root size value
174
- * @param val - rem value in px
179
+ * @param val - variable value in px
175
180
  */
176
- set size(val: TNumberOrNull);
181
+ set size(val: TNumberAttr);
182
+ /**
183
+ * Get root space value
184
+ */
185
+ get space(): TNumberAttr;
186
+ /**
187
+ * Set root space value
188
+ * @param val - variable value in px
189
+ */
190
+ set space(val: TNumberAttr);
177
191
  /**
178
192
  * Get root time value
179
193
  */
180
- get time(): TNumberOrNull;
194
+ get time(): TNumberAttr;
181
195
  /**
182
196
  * Set root time value
183
197
  * @param val - time value in ms
184
198
  */
185
- set time(val: TNumberOrNull);
199
+ set time(val: TNumberAttr);
186
200
  /**
187
201
  * Get root angle value
188
202
  */
189
- get angle(): TNumberOrNull;
203
+ get angle(): TNumberAttr;
190
204
  /**
191
205
  * Set root angle value
192
206
  * @param val - angle value in ms
193
207
  */
194
- set angle(val: TNumberOrNull);
208
+ set angle(val: TNumberAttr);
195
209
  /**
196
210
  * Get brand color value
197
211
  */
198
- get color(): TStringOrNull;
212
+ get color(): TStringAttr;
199
213
  /**
200
214
  * Set brand color value
201
215
  * @param val - color string
202
216
  */
203
- set color(val: TStringOrNull);
217
+ set color(val: TStringAttr);
204
218
  /**
205
219
  * Get neutral color value
206
220
  */
207
- get neutral(): TStringOrNull;
221
+ get neutral(): TStringAttr;
208
222
  /**
209
223
  * Set neutral color value
210
224
  * @param val - color string
211
225
  */
212
- set neutral(val: TStringOrNull);
226
+ set neutral(val: TStringAttr);
213
227
  /**
214
228
  * Get contrast color value
215
229
  */
216
- get contrast(): TStringOrNull;
230
+ get contrast(): TStringAttr;
217
231
  /**
218
232
  * Set contrast color value
219
233
  * @param val - color string
220
234
  */
221
- set contrast(val: TStringOrNull);
235
+ set contrast(val: TStringAttr);
222
236
  /**
223
237
  * Get root easing function
224
238
  */
225
- get easing(): TStringOrNull;
239
+ get easing(): TStringAttr;
226
240
  /**
227
241
  * Set root easing function
228
242
  * @param val - easing function
229
243
  */
230
- set easing(val: TStringOrNull);
244
+ set easing(val: TStringAttr);
231
245
  /**
232
246
  * Use stylesheet makers
233
247
  * @param makers - stylesheet makers
@@ -253,6 +267,12 @@ export interface IStyleProvider {
253
267
  * Data attributes expression resolver
254
268
  */
255
269
  dx: DX;
270
+ /**
271
+ * Tune stylesheet
272
+ * @param maker - stylesheet maker
273
+ * @param tunings - tunings object
274
+ */
275
+ tune<T extends object>(tunings: TDeepPartial<T>, maker?: TStyleSheetMaker): object;
256
276
  /**
257
277
  * Is stylesheet on
258
278
  * @param key - stylesheet key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effcss",
3
- "version": "4.11.0",
3
+ "version": "4.13.0",
4
4
  "description": "Self-confident CSS-in-JS",
5
5
  "type": "module",
6
6
  "scripts": {