effcss 4.9.0 → 4.11.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
@@ -90,17 +90,16 @@ const root = createRoot(document.getElementById("root"));
90
90
  root.render(<App css={consumer} />);
91
91
  ```
92
92
 
93
- Each CSS stylesheet corresponds to a single `Stylesheet maker`. `Stylesheet maker` is a JS function that should return object with style rules:
93
+ Each CSS stylesheet corresponds to a single `Stylesheet maker`. `Stylesheet maker` is a JS function that should return object or string with style rules:
94
94
 
95
- **App.tsx**
95
+ **maker.ts**
96
96
 
97
- ```tsx
98
- import { useRef } from 'react';
99
- import { IStyleProvider, TStyleSheetMaker } from 'effcss';
97
+ ```ts
98
+ import { TStyleSheetMaker } from 'effcss';
100
99
 
101
100
  // you can describe your styles
102
101
  // so that other people can use them via TypeScript generics
103
- export type TCardMaker = {
102
+ export type TMyMaker = {
104
103
  /**
105
104
  * Font-size utility
106
105
  */
@@ -142,7 +141,7 @@ export type TCardMaker = {
142
141
  };
143
142
  }
144
143
 
145
- const myStyleSheetMaker: TStyleSheetMaker = ({ select, pseudo: {h}, at: { keyframes, property }, merge, palette, coef, size, units: {px} }) = {
144
+ export const myMaker: TStyleSheetMaker = ({ select, pseudo: {h}, at: { keyframes, property }, merge, palette, coef, size, units: {px} }) = {
146
145
  // specify selector variants via generic
147
146
  const selector = select<TCardMaker>;
148
147
  // create property with unique identifier
@@ -196,21 +195,33 @@ const myStyleSheetMaker: TStyleSheetMaker = ({ select, pseudo: {h}, at: { keyfra
196
195
  }))
197
196
  };
198
197
  };
198
+ ```
199
+
200
+ To use `Stylesheet maker` just pass it to `cx` (creates classnames string) or `dx` (creates data attributes object) methods of `Style provider`:
201
+
202
+ **App.tsx**
203
+
204
+ ```tsx
205
+ import { useRef } from 'react';
206
+ import { useStyleProvider } from 'effcss';
207
+ import type { TMyMaker } from './maker';
208
+ import { myMaker } from './maker';
199
209
 
200
210
  export const App = (props: {
201
211
  css: IStyleProvider;
202
212
  }) => {
203
- const { css } = props;
213
+ const styleProvider = useStyleProvider();
204
214
  const stylesRef = useRef();
215
+ // put it inside ref to avoid recalculations
205
216
  if (!stylesRef.current) {
206
217
  const [card] = css.use(myStyleSheetMaker);
207
- // thanks to the TCardMaker type,
218
+ // thanks to the TMyMaker type,
208
219
  // you don't need to look at the implementation - just create the necessary attributes
209
220
  stylesRef.current = {
210
- // apply list of selectors
211
- card: card.list<TCardMaker>('card.rounded:', 'fsz:24'),
212
- // apply object with selectors
213
- footer: card.obj<TCardMaker>({
221
+ // you can apply list of selectors
222
+ card: styleProvider.dx<TMyMaker>('card.rounded:', 'fsz:24'),
223
+ // or you can apply object with selectors
224
+ footer: styleProvider.dx<TMyMaker>({
214
225
  card: {
215
226
  footer: {
216
227
  visible: '',
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * EffCSS v4.9.0
2
+ * EffCSS v4.11.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"),S=e=>w(e,"vh"),j=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))),{}),Se=(e,t)=>ve(e).reduce(((e,[r,s])=>ye(e,t(r,s))),{}),je=(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:S,vw:j,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})=>{const w=i(t),k=w.selector,S=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:_e,comma:Ae,space:Oe,range:ke,each:Se,when:je,merge:ze,themeVar:o,size:f,time:c,angle:p,easing:v,bem:k,select:S,pseudo:Ce,color:be(o),palette:fe(o),coef:$e(o),units:qe,at:j});return"string"==typeof _?_:(t=>e(t,((e,t)=>e+s(...t)),""))(_)}}},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",St="easing",jt=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(St)]:{[r.varName(St)]: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,St),contrast:Bt(e,wt),neutral:Bt(e,kt)});const o=Be({prefix:e.pre}),l=((e={})=>{const{mode:t,min:r,dict:s={}}=e;let n;n="a"===t?Ge:Ze;const i=e=>{let r=0,s=Qe,a=Qe;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,...Je(t)?t.split("."):t].filter(Boolean).join("-"),c="class",u=t=>t?e+(t.startsWith("_")?"":"-")+t:void 0===t?void 0:e;"a"===t&&(c="data-"+e,u=Qe);const h=e=>"--"+l(Je(e)?e.split("."):e),m=e=>Ve({[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=Je(e);return i=o||Array.isArray(e)?[...(o?[e]:e).reduce(((e,i)=>([t,r,s,n]=He(i),e.add(u(a(Fe(t,r)))),s&&e.add(u(a(Fe(t,r,s,n)))),e)),new Set).values()].join(" "):e&&Ue(e,!0).map((([e,t,r,s])=>u(a(Fe(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=Ke;"full"===t&&(r=De);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]=He(t);return n(e,s(Fe(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=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=>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 ${_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(St),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,St,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;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;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(jt,{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=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};
@@ -87,6 +87,7 @@ export type TProcessor = {
87
87
  compile(params: {
88
88
  key: string;
89
89
  maker: (params: IMakerParams) => object | string;
90
+ mode?: 'a' | 'c';
90
91
  }): string;
91
92
  };
92
93
  type TCreateProcessor = (params: {
@@ -51,7 +51,7 @@ export type TMonoResolver<T extends TStyleSheet, B extends keyof T, E extends ke
51
51
  [key in string]: string;
52
52
  };
53
53
  };
54
- type TStyles = {
54
+ export type TStyles = {
55
55
  [key in string]: string | number | Record<string, never> | TStyles;
56
56
  };
57
57
  type TAttrs = {
@@ -74,6 +74,10 @@ type TResolveAttr = {
74
74
  */
75
75
  obj<T extends TStyles>(arg: TDeepPartial<T>, type?: 'full'): TAttrs;
76
76
  };
77
+ /**
78
+ * Design details
79
+ */
80
+ export type TDetails<T> = TDeepPartial<T> | TSelectors<T>[];
77
81
  type TParts = (string | number)[];
78
82
  export type TDefaultTheme = {
79
83
  angle: number;
@@ -114,7 +118,7 @@ export type TScope = {
114
118
  * Style scope resolver
115
119
  */
116
120
  export type TScopeResolver = {
117
- (key: string): TScope;
121
+ (key: string, mode?: 'a' | 'c'): TScope;
118
122
  dict?: Record<string, Record<string, string>>;
119
123
  };
120
124
  /**
@@ -1,9 +1,10 @@
1
- export type { TShortRange, TMainRange, TBaseRange, TLongRange, TFullRange, TSparseRange } from './_provider/_process/coef';
2
- export type { TPaletteHue, TPaletteChroma, TPaletteLightness, TPaletteMode } from './_provider/_process/palette';
3
1
  import type { TProcessor } from './_provider/process';
4
2
  import type { TCollector } from './_provider/collect';
5
- import type { TScopeResolver } from './_provider/scope';
3
+ import type { TDetails, TScopeResolver, TStyles } from './_provider/scope';
6
4
  import type { TThemeController } from './_provider/theme';
5
+ export type { TShortRange, TMainRange, TBaseRange, TLongRange, TFullRange, TSparseRange } from './_provider/_process/coef';
6
+ export type { TPaletteHue, TPaletteChroma, TPaletteLightness, TPaletteMode } from './_provider/_process/palette';
7
+ export type { TDetails };
7
8
  /**
8
9
  * EffCSS core attributes
9
10
  */
@@ -50,6 +51,9 @@ export type TProviderAttrs = {
50
51
  * @description
51
52
  * `a` - data-attributes
52
53
  * `c` - classes
54
+ * @deprecated
55
+ * Will be deleted in the next major version.
56
+ * Use `dx` and `cx` methods to to explicitly create selectors in form of data attributes or classnames respectively
53
57
  */
54
58
  mode: 'a' | 'c';
55
59
  /**
@@ -99,6 +103,38 @@ export type TMonoElement<TStyle extends object> = {
99
103
  type TStyleTarget = string | TStyleSheetMaker;
100
104
  type TNumberOrNull = number | null;
101
105
  type TStringOrNull = string | null;
106
+ /**
107
+ * Classname expression
108
+ */
109
+ type CX = {
110
+ /**
111
+ * Resolve classnames
112
+ * @param maker - stylesheet maker
113
+ * @param details - design details
114
+ */
115
+ <T extends TStyles>(maker: TStyleSheetMaker, details: TDetails<T>): string;
116
+ /**
117
+ * Join expressions
118
+ * @param args - arguments
119
+ */
120
+ join(...args: (string | false | null | undefined)[]): string;
121
+ };
122
+ /**
123
+ * Data attribute expression
124
+ */
125
+ type DX = {
126
+ /**
127
+ * Resolve data attributes
128
+ * @param maker - stylesheet maker
129
+ * @param details - design details
130
+ */
131
+ <T extends TStyles>(maker: TStyleSheetMaker, details: TDetails<T>): Record<string, string>;
132
+ /**
133
+ * Join expressions
134
+ * @param args - arguments
135
+ */
136
+ join(...args: (Record<string, string> | false | null | undefined)[]): Record<string, string>;
137
+ };
102
138
  /**
103
139
  * Style provider
104
140
  * @description
@@ -208,7 +244,15 @@ export interface IStyleProvider {
208
244
  * @param maker - stylesheet maker
209
245
  * @param key - stylesheet key
210
246
  */
211
- css(maker: TStyleSheetMaker, key: string): string;
247
+ css(maker: TStyleSheetMaker, key: string, mode?: 'a' | 'c'): string;
248
+ /**
249
+ * Classnames expression resolver
250
+ */
251
+ cx: CX;
252
+ /**
253
+ * Data attributes expression resolver
254
+ */
255
+ dx: DX;
212
256
  /**
213
257
  * Is stylesheet on
214
258
  * @param key - stylesheet key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effcss",
3
- "version": "4.9.0",
3
+ "version": "4.11.0",
4
4
  "description": "Self-confident CSS-in-JS",
5
5
  "type": "module",
6
6
  "scripts": {