@unocss/runtime 0.53.4 → 0.53.5

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/core.global.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";(()=>{function Re(t){let e=t.length,r=-1,n,s="",i=t.charCodeAt(0);for(;++r<e;){if(n=t.charCodeAt(r),n===0){s+="\uFFFD";continue}if(n===44){s+="\\,";continue}if(n>=1&&n<=31||n===127||r===0&&n>=48&&n<=57||r===1&&n>=48&&n<=57&&i===45){s+=`\\${n.toString(16)} `;continue}if(r===0&&e===1&&n===45){s+=`\\${t.charAt(r)}`;continue}if(n>=128||n===45||n===95||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122){s+=t.charAt(r);continue}s+=`\\${t.charAt(r)}`}return s}var H=Re;function A(t=[]){return Array.isArray(t)?t:[t]}function D(t){return Array.from(new Set(t))}function R(t){return typeof t=="string"}function j(t){return R(t)?t:(Array.isArray(t)?t:Object.entries(t)).filter(e=>e[1]!=null)}function ee(t){return Array.isArray(t)?t.find(e=>!Array.isArray(e)||Array.isArray(e[0]))?t.map(e=>j(e)):[t]:[j(t)]}function be(t){return t.filter(([e,r],n)=>{if(e.startsWith("$$"))return!1;for(let s=n-1;s>=0;s--)if(t[s][0]===e&&t[s][1]===r)return!1;return!0})}function F(t){return t==null?"":be(t).map(([e,r])=>r!=null?`${e}:${r};`:void 0).filter(Boolean).join("")}function G(t){return t&&typeof t=="object"&&!Array.isArray(t)}function q(t,e,r=!1){let n=t,s=e;if(Array.isArray(s))return r&&Array.isArray(s)?[...n,...s]:[...s];let i={...n};return G(n)&&G(s)&&Object.keys(s).forEach(o=>{G(n[o])&&G(s[o])||Array.isArray(n[o])&&Array.isArray(s[o])?i[o]=q(n[o],s[o],r):Object.assign(i,{[o]:s[o]})}),i}function k(t){let e,r,n;if(Array.isArray(t)){for(r=Array(e=t.length);e--;)r[e]=(n=t[e])&&typeof n=="object"?k(n):n;return r}if(Object.prototype.toString.call(t)==="[object Object]"){r={};for(e in t)e==="__proto__"?Object.defineProperty(r,e,{value:k(t[e]),configurable:!0,enumerable:!0,writable:!0}):r[e]=(n=t[e])&&typeof n=="object"?k(n):n;return r}return t}function te(t){return R(t[0])}function re(t){return R(t[0])}var Y="$$shortcut-no-merge";function ne(t){return typeof t=="function"?{match:t}:t}function Z(t){return t.length===3}function se(t){return t!=null}function ie(){}var B=class{_map=new Map;get(e,r){let n=this._map.get(e);if(n)return n.get(r)}getFallback(e,r,n){let s=this._map.get(e);return s||(s=new Map,this._map.set(e,s)),s.has(r)||s.set(r,n),s.get(r)}set(e,r,n){let s=this._map.get(e);return s||(s=new Map,this._map.set(e,s)),s.set(r,n),this}has(e,r){return this._map.get(e)?.has(r)}delete(e,r){return this._map.get(e)?.delete(r)||!1}deleteTop(e){return this._map.delete(e)}map(e){return Array.from(this._map.entries()).flatMap(([r,n])=>Array.from(n.entries()).map(([s,i])=>e(i,r,s)))}};var z={};function ve(t=["-",":"]){let e=t.join("|");return z[e]||(z[e]=new RegExp(`((?:[!@<~\\w+:_/-]|\\[&?>?:?\\S*\\])+?)(${e})\\(((?:[~!<>\\w\\s:/\\\\,%#.$?-]|\\[.*?\\])+?)\\)(?!\\s*?=>)`,"gm")),z[e].lastIndex=0,z[e]}function we(t,e=["-",":"],r=5){let n=ve(e),s=!1,i=t.toString(),o=new Set;do{let l=i;i=i.replace(n,(f,u,a,d)=>e.includes(a)?(o.add(u+a),d.split(/\s/g).filter(Boolean).map(y=>y==="~"?u:y.replace(/^(!?)(.*)/,`$1${u}${a}$2`)).join(" ")):f),s=i!==l,r-=1}while(s&&r);return{prefixes:Array.from(o),expanded:i,hasChanged:s}}function oe(t,e=["-",":"],r=5){let{expanded:n}=we(t.toString(),e,r);return typeof t=="string"?n:t.length()?t.overwrite(0,t.length(),n):t}var ae=new Set;function ce(t){ae.has(t)||(console.warn("[unocss]",t),ae.add(t))}var le=/[\\:]?[\s'"`;{}]+/g;function Ae(t){return[...new Set(t.split(le))]}var I={name:"@unocss/core/extractor-split",order:0,extract({code:t}){return Ae(t)}};function ue(){return{events:{},emit(t,...e){(this.events[t]||[]).forEach(r=>r(...e))},on(t,e){return(this.events[t]=this.events[t]||[]).push(e),()=>this.events[t]=(this.events[t]||[]).filter(r=>r!==e)}}}var W="default",N="preflights",Ue="shortcuts",fe={[N]:-100,[Ue]:-10,[W]:0};function de(t){return A(t).flatMap(e=>Array.isArray(e)?[e]:Object.entries(e))}var pe="_uno_resolved";function Me(t){if(pe in t)return t;t={...t},Object.defineProperty(t,pe,{value:!0,enumerable:!1});let e=t.shortcuts?de(t.shortcuts):void 0;if(t.shortcuts=e,t.prefix||t.layer){let r=n=>{n[2]||(n[2]={});let s=n[2];s.prefix==null&&t.prefix&&(s.prefix=A(t.prefix)),s.layer==null&&t.layer&&(s.layer=t.layer)};e?.forEach(r),t.rules?.forEach(r)}return t}function he(t){let e=Me(t);if(!e.presets)return[e];let r=(e.presets||[]).flatMap(A).flatMap(he);return[e,...r]}function J(t={},e={}){let r=Object.assign({},e,t),n=D((r.presets||[]).flatMap(A).flatMap(he)),s=[...n.filter(c=>c.enforce==="pre"),...n.filter(c=>!c.enforce),...n.filter(c=>c.enforce==="post")],i=[...s,r],o=[...i].reverse(),l=Object.assign({},fe,...i.map(c=>c.layers));function f(c){return D(i.flatMap(x=>A(x[c]||[])))}let u=f("extractors"),a=o.find(c=>c.extractorDefault!==void 0)?.extractorDefault;a===void 0&&(a=I),a&&!u.includes(a)&&u.unshift(a),u.sort((c,x)=>(c.order||0)-(x.order||0));let d=f("rules"),y={},T=d.length,v=d.map((c,x)=>{if(te(c)){A(c[2]?.prefix||"").forEach(U=>{y[U+c[0]]=[x,c[1],c[2],c]});return}return[x,...c]}).filter(Boolean).reverse(),w=Ve(i.map(c=>c.theme)),S=f("extendTheme");for(let c of S)w=c(w)||w;let E={templates:D(i.flatMap(c=>A(c.autocomplete?.templates))),extractors:i.flatMap(c=>A(c.autocomplete?.extractors)).sort((c,x)=>(c.order||0)-(x.order||0))},C=f("separators");C.length||(C=[":","-"]);let h={mergeSelectors:!0,warn:!0,blocklist:[],sortLayers:c=>c,...r,presets:s,envMode:r.envMode||"build",shortcutsLayer:r.shortcutsLayer||"shortcuts",layers:l,theme:w,rulesSize:T,rulesDynamic:v,rulesStaticMap:y,preprocess:f("preprocess"),postprocess:f("postprocess"),preflights:f("preflights"),autocomplete:E,variants:f("variants").map(ne).sort((c,x)=>(c.order||0)-(x.order||0)),shortcuts:de(f("shortcuts")).reverse(),extractors:u,safelist:f("safelist"),separators:C};for(let c of i)c?.configResolved?.(h);return h}function Ve(t){return t.map(e=>e?k(e):{}).reduce((e,r)=>q(e,r),{})}var me="0.53.4";var Q=class{constructor(e={},r={}){this.userConfig=e;this.defaults=r;this.config=J(e,r),this.events.emit("config",this.config)}version=me;_cache=new Map;config;blocked=new Set;parentOrders=new Map;events=ue();setConfig(e,r){e&&(r&&(this.defaults=r),this.userConfig=e,this.blocked.clear(),this.parentOrders.clear(),this._cache.clear(),this.config=J(e,this.defaults),this.events.emit("config",this.config))}async applyExtractors(e,r,n=new Set){let s={original:e,code:e,id:r,extracted:n};for(let i of this.config.extractors){let o=await i.extract?.(s);if(o)for(let l of o)n.add(l)}return n}makeContext(e,r){let n={rawSelector:e,currentSelector:r[1],theme:this.config.theme,generator:this,variantHandlers:r[2],constructCSS:(...s)=>this.constructCustomCSS(n,...s),variantMatch:r};return n}async parseToken(e,r){if(this.blocked.has(e))return;let n=`${e}${r?` ${r}`:""}`;if(this._cache.has(n))return this._cache.get(n);let s=e;for(let u of this.config.preprocess)s=u(e);if(this.isBlocked(s)){this.blocked.add(e),this._cache.set(n,null);return}let i=await this.matchVariants(e,s);if(!i||this.isBlocked(i[1])){this.blocked.add(e),this._cache.set(n,null);return}let o=this.makeContext(e,[r||i[0],i[1],i[2],i[3]]);this.config.details&&(o.variants=[...i[3]]);let l=await this.expandShortcut(o.currentSelector,o),f=l?await this.stringifyShortcuts(o.variantMatch,o,l[0],l[1]):(await this.parseUtil(o.variantMatch,o))?.map(u=>this.stringifyUtil(u,o)).filter(se);if(f?.length)return this._cache.set(n,f),f;this._cache.set(n,null)}async generate(e,r={}){let{id:n,scope:s,preflights:i=!0,safelist:o=!0,minify:l=!1}=r,f=R(e)?await this.applyExtractors(e,n):Array.isArray(e)?new Set(e):e;o&&this.config.safelist.forEach(h=>f.add(h));let u=l?"":`
2
- `,a=new Set([W]),d=new Set,y=new Map,T={},v=Array.from(f).map(async h=>{if(d.has(h))return;let c=await this.parseToken(h);if(c!=null){d.add(h);for(let x of c){let b=x[3]||"",U=x[4]?.layer;y.has(b)||y.set(b,[]),y.get(b).push(x),U&&a.add(U)}}});await Promise.all(v),await(async()=>{if(!i)return;let h={generator:this,theme:this.config.theme},c=new Set([]);this.config.preflights.forEach(({layer:x=N})=>{a.add(x),c.add(x)}),T=Object.fromEntries(await Promise.all(Array.from(c).map(async x=>{let U=(await Promise.all(this.config.preflights.filter(_=>(_.layer||N)===x).map(async _=>await _.getCSS(h)))).filter(Boolean).join(u);return[x,U]})))})();let w=this.config.sortLayers(Array.from(a).sort((h,c)=>(this.config.layers[h]??0)-(this.config.layers[c]??0)||h.localeCompare(c))),S={},E=h=>{if(S[h])return S[h];let c=Array.from(y).sort((b,U)=>(this.parentOrders.get(b[0])??0)-(this.parentOrders.get(U[0])??0)||b[0]?.localeCompare(U[0]||"")||0).map(([b,U])=>{let _=U.length,L=U.filter(p=>(p[4]?.layer||W)===h).sort((p,g)=>p[0]-g[0]||(p[4]?.sort||0)-(g[4]?.sort||0)||p[5]?.currentSelector?.localeCompare(g[5]?.currentSelector??"")||p[1]?.localeCompare(g[1]||"")||p[2]?.localeCompare(g[2]||"")||0).map(([,p,g,,M,,V])=>[[[(p&&Pe(p,s))??"",M?.sort??0]],g,!!(V??M?.noMerge)]);if(!L.length)return;let K=L.reverse().map(([p,g,M],V)=>{if(!M&&this.config.mergeSelectors)for(let P=V+1;P<_;P++){let $=L[P];if($&&!$[2]&&(p&&$[0]||p==null&&$[0]==null)&&$[1]===g)return p&&$[0]&&$[0].push(...p),null}let O=p?D(p.sort((P,$)=>P[1]-$[1]||P[0]?.localeCompare($[0]||"")||0).map(P=>P[0]).filter(Boolean)):[];return O.length?`${O.join(`,${u}`)}{${g}}`:g}).filter(Boolean).reverse().join(u);if(!b)return K;let m=b.split(" $$ ");return`${m.join("{")}{${u}${K}${u}}${m.map(p=>"").join("}")}`}).filter(Boolean).join(u);i&&(c=[T[h],c].filter(Boolean).join(u));let x=l?"":`/* layer: ${h} */${u}`;return S[h]=c?x+c:""},C=(h=w,c)=>h.filter(x=>!c?.includes(x)).map(x=>E(x)||"").filter(Boolean).join(u);return{get css(){return C()},layers:w,matched:d,getLayers:C,getLayer:E}}async matchVariants(e,r){let n=new Set,s=[],i=r||e,o=!1,l={rawSelector:e,theme:this.config.theme,generator:this};for(;;){o=!1;for(let f of this.config.variants){if(!f.multiPass&&n.has(f))continue;let u=await f.match(i,l);if(u){R(u)&&(u={matcher:u}),i=u.matcher,s.unshift(u),n.add(f),o=!0;break}}if(!o)break;if(s.length>500)throw new Error(`Too many variants applied to "${e}"`)}return[e,i,s,n]}applyVariants(e,r=e[4],n=e[1]){let i=r.slice().sort((u,a)=>(u.order||0)-(a.order||0)).reduceRight((u,a)=>d=>{let y=a.body?.(d.entries)||d.entries,T=Array.isArray(a.parent)?a.parent:[a.parent,void 0];return(a.handle??Le)({...d,entries:y,selector:a.selector?.(d.selector,y)||d.selector,parent:T[0]||d.parent,parentOrder:T[1]||d.parentOrder,layer:a.layer||d.layer,sort:a.sort||d.sort},u)},u=>u)({prefix:"",selector:De(n),pseudo:"",entries:e[2]}),{parent:o,parentOrder:l}=i;o!=null&&l!=null&&this.parentOrders.set(o,l);let f={selector:[i.prefix,i.selector,i.pseudo].join(""),entries:i.entries,parent:o,layer:i.layer,sort:i.sort,noMerge:i.noMerge};for(let u of this.config.postprocess)u(f);return f}constructCustomCSS(e,r,n){let s=j(r);if(R(s))return s;let{selector:i,entries:o,parent:l}=this.applyVariants([0,n||e.rawSelector,s,void 0,e.variantHandlers]),f=`${i}{${F(o)}}`;return l?`${l}{${f}}`:f}async parseUtil(e,r,n=!1,s){let[i,o,l]=R(e)?await this.matchVariants(e):e;this.config.details&&(r.rules=r.rules??[]);let f=this.config.rulesStaticMap[o];if(f&&f[1]&&(n||!f[2]?.internal)){this.config.details&&r.rules.push(f[3]);let a=f[0],d=j(f[1]),y=f[2];return R(d)?[[a,d,y]]:[[a,i,d,y,l]]}r.variantHandlers=l;let{rulesDynamic:u}=this.config;for(let[a,d,y,T]of u){if(T?.internal&&!n)continue;let v=o;if(T?.prefix){let C=A(T.prefix);if(s){let h=A(s);if(!C.some(c=>h.includes(c)))continue}else{let h=C.find(c=>o.startsWith(c));if(h==null)continue;v=o.slice(h.length)}}let w=v.match(d);if(!w)continue;let S=await y(w,r);if(!S)continue;this.config.details&&r.rules.push([d,y,T]);let E=ee(S).filter(C=>C.length);if(E.length)return E.map(C=>R(C)?[a,C,T]:[a,i,C,T,l])}}stringifyUtil(e,r){if(!e)return;if(Z(e))return[e[0],void 0,e[1],void 0,e[2],this.config.details?r:void 0,void 0];let{selector:n,entries:s,parent:i,layer:o,sort:l,noMerge:f}=this.applyVariants(e),u=F(s);if(!u)return;let{layer:a,sort:d,...y}=e[3]??{},T={...y,layer:o??a,sort:l??d};return[e[0],n,u,i,T,this.config.details?r:void 0,f]}async expandShortcut(e,r,n=5){if(n===0)return;let s=this.config.details?l=>{r.shortcuts=r.shortcuts??[],r.shortcuts.push(l)}:ie,i,o;for(let l of this.config.shortcuts){let f=e;if(l[2]?.prefix){let a=A(l[2].prefix).find(d=>e.startsWith(d));if(a==null)continue;f=e.slice(a.length)}if(re(l)){if(l[0]===f){i=i||l[2],o=l[1],s(l);break}}else{let u=f.match(l[0]);if(u&&(o=l[1](u,r)),o){i=i||l[2],s(l);break}}}if(R(o)&&(o=oe(o.trim()).split(/\s+/g)),!o){let[l,f]=R(e)?await this.matchVariants(e):e;if(l!==f){let u=await this.expandShortcut(f,r,n-1);u&&(o=u[0].map(a=>R(a)?l.replace(f,a):a))}}if(o)return[(await Promise.all(o.map(async l=>(R(l)?(await this.expandShortcut(l,r,n-1))?.[0]:void 0)||[l]))).flat(1).filter(Boolean),i]}async stringifyShortcuts(e,r,n,s={layer:this.config.shortcutsLayer}){let i=new B,o=(await Promise.all(D(n).map(async a=>{let d=R(a)?await this.parseUtil(a,r,!0,s.prefix):[[1/0,"{inline}",j(a),void 0,[]]];return d||ce(`unmatched utility "${a}" in shortcut "${e[1]}"`),d||[]}))).flat(1).filter(Boolean).sort((a,d)=>a[0]-d[0]),[l,,f]=e,u=[];for(let a of o){if(Z(a)){u.push([a[0],void 0,a[1],void 0,a[2],r,void 0]);continue}let{selector:d,entries:y,parent:T,sort:v,noMerge:w}=this.applyVariants(a,[...a[4],...f],l);i.getFallback(d,T,[[],a[0]])[0].push([y,!!(w??a[3]?.noMerge),v??0])}return u.concat(i.map(([a,d],y,T)=>{let v=(S,E,C)=>{let h=Math.max(...C.map(x=>x[1])),c=C.map(x=>x[0]);return(S?[c.flat(1)]:c).map(x=>{let b=F(x);if(b)return[d,y,b,T,{...s,noMerge:E,sort:h},r,void 0]})};return[[a.filter(([,S])=>S).map(([S,,E])=>[S,E]),!0],[a.filter(([,S])=>!S).map(([S,,E])=>[S,E]),!1]].map(([S,E])=>[...v(!1,E,S.filter(([C])=>C.some(h=>h[0]===Y))),...v(!0,E,S.filter(([C])=>C.every(h=>h[0]!==Y)))])}).flat(2).filter(Boolean))}isBlocked(e){return!e||this.config.blocklist.some(r=>R(r)?r===e:r.test(e))}};function xe(t,e){return new Q(t,e)}var _e=/\s\$\$\s+/g;function Oe(t){return t.match(/\s\$\$\s/)}function Pe(t,e){return Oe(t)?t.replace(_e,e?` ${e} `:" "):e?`${e} ${t}`:t}var ge=/^\[(.+?)(~?=)"(.*)"\]$/;function De(t){return ge.test(t)?t.replace(ge,(e,r,n,s)=>`[${H(r)}${n}"${H(s)}"]`):`.${H(t)}`}function Le(t,e){return e(t)}function je(t){return t.replace(/-(\w)/g,(e,r)=>r?r.toUpperCase():"")}function ye(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Se(t){return t.replace(/(?:^|\B)([A-Z])/g,"-$1").toLowerCase()}var Ce=["Webkit","Moz","ms"];function Te(t){let e={};function r(n){let s=e[n];if(s)return s;let i=je(n);if(i!=="filter"&&i in t)return e[n]=Se(i);i=ye(i);for(let o=0;o<Ce.length;o++){let l=`${Ce[o]}${i}`;if(l in t)return e[n]=Se(ye(l))}return n}return({entries:n})=>n.forEach(s=>{s[0].startsWith("--")||(s[0]=r(s[0]))})}function Ee(t){return t.replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<")}function X(t={}){if(typeof window>"u"){console.warn("@unocss/runtime been used in non-browser environment, skipped.");return}let e=window,r=window.document,n=()=>r.documentElement,s=e.__unocss||{},i=Object.assign({},t,s.runtime),o=i.defaults||{},l=i.cloakAttribute??"un-cloak";i.autoPrefix&&(o.postprocess=A(o.postprocess)).unshift(Te(r.createElement("div").style)),i.configResolved?.(s,o);let f=xe(s,o),u=new Map,a=!0,d=new Set,y,T,v=[],w=()=>new Promise(m=>{v.push(m),T!=null&&clearTimeout(T),T=setTimeout(()=>C().then(()=>{let p=v;v=[],p.forEach(g=>g())}),0)});function S(m){if(m.nodeType!==1)return;let p=m;p.hasAttribute(l)&&p.removeAttribute(l),p.querySelectorAll(`[${l}]`).forEach(g=>{g.removeAttribute(l)})}function E(m,p){let g=u.get(m);if(!g)if(g=r.createElement("style"),g.setAttribute("data-unocss-runtime-layer",m),u.set(m,g),p==null)n().prepend(g);else{let M=E(p),V=M.parentNode;V?V.insertBefore(g,M.nextSibling):n().prepend(g)}return g}async function C(){let m=await f.generate(d);return m.layers.reduce((p,g)=>(E(g,p).innerHTML=m.getLayer(g)??"",g),void 0),d=m.matched,{...m,getStyleElement:p=>u.get(p),getStyleElements:()=>u}}async function h(m){let p=d.size;await f.applyExtractors(m,void 0,d),p!==d.size&&await w()}async function c(){let m=r.body,p=m&&m.outerHTML;p&&(await h(`${p} ${Ee(p)}`),S(n()),S(m))}let x=new MutationObserver(m=>{a||m.forEach(async p=>{if(p.target.nodeType!==1)return;let g=p.target;for(let M of u)if(g===M[1])return;if(p.type==="childList")p.addedNodes.forEach(async M=>{if(M.nodeType!==1)return;let V=M;y&&!y(V)||(await h(V.outerHTML),S(V))});else{if(y&&!y(g))return;if(p.attributeName!==l){let M=Array.from(g.attributes).map(O=>O.value?`${O.name}="${O.value}"`:O.name).join(" "),V=`<${g.tagName.toLowerCase()} ${M}>`;await h(V)}g.hasAttribute(l)&&g.removeAttribute(l)}})}),b=!1;function U(){if(b)return;let m=n()||r.body;m&&(x.observe(m,{childList:!0,subtree:!0,attributes:!0}),b=!0)}function _(){i.bypassDefined&&ke(f.blocked),c(),U()}function L(){r.readyState==="loading"?e.addEventListener("DOMContentLoaded",_):_()}let K=e.__unocss_runtime=e.__unocss_runtime={version:f.version,uno:f,async extract(m){R(m)||(m.forEach(p=>d.add(p)),m=""),await h(m)},extractAll:c,inspect(m){y=m},toggleObserver(m){m===void 0?a=!a:a=!!m,!b&&!a&&L()},update:C};i.ready?.(K)!==!1&&(a=!1,L())}function ke(t=new Set){for(let e=0;e<document.styleSheets.length;e++){let r=document.styleSheets[e],n;try{if(n=r.cssRules||r.rules,!n)continue;Array.from(n).flatMap(s=>s.selectorText?.split(/,/g)||[]).forEach(s=>{s&&(s=s.trim(),s.startsWith(".")&&(s=s.slice(1)),t.add(s))})}catch{continue}}return t}X();})();
1
+ "use strict";(()=>{function Ee(t){let e=t.length,r=-1,n,s="",i=t.charCodeAt(0);for(;++r<e;){if(n=t.charCodeAt(r),n===0){s+="\uFFFD";continue}if(n===44){s+="\\,";continue}if(n>=1&&n<=31||n===127||r===0&&n>=48&&n<=57||r===1&&n>=48&&n<=57&&i===45){s+=`\\${n.toString(16)} `;continue}if(r===0&&e===1&&n===45){s+=`\\${t.charAt(r)}`;continue}if(n>=128||n===45||n===95||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122){s+=t.charAt(r);continue}s+=`\\${t.charAt(r)}`}return s}var H=Ee;function A(t=[]){return Array.isArray(t)?t:[t]}function P(t){return Array.from(new Set(t))}function E(t){return typeof t=="string"}function L(t){return E(t)?t:(Array.isArray(t)?t:Object.entries(t)).filter(e=>e[1]!=null)}function ee(t){return Array.isArray(t)?t.find(e=>!Array.isArray(e)||Array.isArray(e[0]))?t.map(e=>L(e)):[t]:[L(t)]}function Re(t){return t.filter(([e,r],n)=>{if(e.startsWith("$$"))return!1;for(let s=n-1;s>=0;s--)if(t[s][0]===e&&t[s][1]===r)return!1;return!0})}function F(t){return t==null?"":Re(t).map(([e,r])=>r!=null?`${e}:${r};`:void 0).filter(Boolean).join("")}function G(t){return t&&typeof t=="object"&&!Array.isArray(t)}function Y(t,e,r=!1){let n=t,s=e;if(Array.isArray(s))return r&&Array.isArray(s)?[...n,...s]:[...s];let i={...n};return G(n)&&G(s)&&Object.keys(s).forEach(o=>{G(n[o])&&G(s[o])||Array.isArray(n[o])&&Array.isArray(s[o])?i[o]=Y(n[o],s[o],r):Object.assign(i,{[o]:s[o]})}),i}function k(t){let e,r,n;if(Array.isArray(t)){for(r=Array(e=t.length);e--;)r[e]=(n=t[e])&&typeof n=="object"?k(n):n;return r}if(Object.prototype.toString.call(t)==="[object Object]"){r={};for(e in t)e==="__proto__"?Object.defineProperty(r,e,{value:k(t[e]),configurable:!0,enumerable:!0,writable:!0}):r[e]=(n=t[e])&&typeof n=="object"?k(n):n;return r}return t}function te(t){return E(t[0])}function re(t){return E(t[0])}var q="$$shortcut-no-merge";function ne(t){return typeof t=="function"?{match:t}:t}function Z(t){return t.length===3}function se(t){return t!=null}function ie(){}var B=class{_map=new Map;get(e,r){let n=this._map.get(e);if(n)return n.get(r)}getFallback(e,r,n){let s=this._map.get(e);return s||(s=new Map,this._map.set(e,s)),s.has(r)||s.set(r,n),s.get(r)}set(e,r,n){let s=this._map.get(e);return s||(s=new Map,this._map.set(e,s)),s.set(r,n),this}has(e,r){return this._map.get(e)?.has(r)}delete(e,r){return this._map.get(e)?.delete(r)||!1}deleteTop(e){return this._map.delete(e)}map(e){return Array.from(this._map.entries()).flatMap(([r,n])=>Array.from(n.entries()).map(([s,i])=>e(i,r,s)))}};var I={};function ve(t=["-",":"]){let e=t.join("|");return I[e]||(I[e]=new RegExp(`((?:[!@<~\\w+:_/-]|\\[&?>?:?\\S*\\])+?)(${e})\\(((?:[~!<>\\w\\s:/\\\\,%#.$?-]|\\[.*?\\])+?)\\)(?!\\s*?=>)`,"gm")),I[e].lastIndex=0,I[e]}function we(t,e=["-",":"],r=5){let n=ve(e),s=!1,i=t.toString(),o=new Set;do{let l=i;i=i.replace(n,(f,u,a,d)=>e.includes(a)?(o.add(u+a),d.split(/\s/g).filter(Boolean).map(y=>y==="~"?u:y.replace(/^(!?)(.*)/,`$1${u}${a}$2`)).join(" ")):f),s=i!==l,r-=1}while(s&&r);return{prefixes:Array.from(o),expanded:i,hasChanged:s}}function oe(t,e=["-",":"],r=5){let{expanded:n}=we(t.toString(),e,r);return typeof t=="string"?n:t.length()?t.overwrite(0,t.original.length,n):t}var ae=new Set;function ce(t){ae.has(t)||(console.warn("[unocss]",t),ae.add(t))}var le=/[\\:]?[\s'"`;{}]+/g;function Ae(t){return[...new Set(t.split(le))]}var z={name:"@unocss/core/extractor-split",order:0,extract({code:t}){return Ae(t)}};function ue(){return{events:{},emit(t,...e){(this.events[t]||[]).forEach(r=>r(...e))},on(t,e){return(this.events[t]=this.events[t]||[]).push(e),()=>this.events[t]=(this.events[t]||[]).filter(r=>r!==e)}}}var N="default",W="preflights",Ue="shortcuts",fe={[W]:-100,[Ue]:-10,[N]:0};function de(t){return A(t).flatMap(e=>Array.isArray(e)?[e]:Object.entries(e))}var pe="_uno_resolved";function Me(t){if(pe in t)return t;t={...t},Object.defineProperty(t,pe,{value:!0,enumerable:!1});let e=t.shortcuts?de(t.shortcuts):void 0;if(t.shortcuts=e,t.prefix||t.layer){let r=n=>{n[2]||(n[2]={});let s=n[2];s.prefix==null&&t.prefix&&(s.prefix=A(t.prefix)),s.layer==null&&t.layer&&(s.layer=t.layer)};e?.forEach(r),t.rules?.forEach(r)}return t}function he(t){let e=Me(t);if(!e.presets)return[e];let r=(e.presets||[]).flatMap(A).flatMap(he);return[e,...r]}function J(t={},e={}){let r=Object.assign({},e,t),n=P((r.presets||[]).flatMap(A).flatMap(he)),s=[...n.filter(c=>c.enforce==="pre"),...n.filter(c=>!c.enforce),...n.filter(c=>c.enforce==="post")],i=[...s,r],o=[...i].reverse(),l=Object.assign({},fe,...i.map(c=>c.layers));function f(c){return P(i.flatMap(x=>A(x[c]||[])))}let u=f("extractors"),a=o.find(c=>c.extractorDefault!==void 0)?.extractorDefault;a===void 0&&(a=z),a&&!u.includes(a)&&u.unshift(a),u.sort((c,x)=>(c.order||0)-(x.order||0));let d=f("rules"),y={},C=d.length,v=d.map((c,x)=>{if(te(c)){A(c[2]?.prefix||"").forEach(U=>{y[U+c[0]]=[x,c[1],c[2],c]});return}return[x,...c]}).filter(Boolean).reverse(),w=Ve(i.map(c=>c.theme)),S=f("extendTheme");for(let c of S)w=c(w)||w;let b={templates:P(i.flatMap(c=>A(c.autocomplete?.templates))),extractors:i.flatMap(c=>A(c.autocomplete?.extractors)).sort((c,x)=>(c.order||0)-(x.order||0))},T=f("separators");T.length||(T=[":","-"]);let h={mergeSelectors:!0,warn:!0,blocklist:[],sortLayers:c=>c,...r,presets:s,envMode:r.envMode||"build",shortcutsLayer:r.shortcutsLayer||"shortcuts",layers:l,theme:w,rulesSize:C,rulesDynamic:v,rulesStaticMap:y,preprocess:f("preprocess"),postprocess:f("postprocess"),preflights:f("preflights"),autocomplete:b,variants:f("variants").map(ne).sort((c,x)=>(c.order||0)-(x.order||0)),shortcuts:de(f("shortcuts")).reverse(),extractors:u,safelist:f("safelist"),separators:T};for(let c of i)c?.configResolved?.(h);return h}function Ve(t){return t.map(e=>e?k(e):{}).reduce((e,r)=>Y(e,r),{})}var me="0.53.5";var Q=class{constructor(e={},r={}){this.userConfig=e;this.defaults=r;this.config=J(e,r),this.events.emit("config",this.config)}version=me;_cache=new Map;config;blocked=new Set;parentOrders=new Map;events=ue();setConfig(e,r){e&&(r&&(this.defaults=r),this.userConfig=e,this.blocked.clear(),this.parentOrders.clear(),this._cache.clear(),this.config=J(e,this.defaults),this.events.emit("config",this.config))}async applyExtractors(e,r,n=new Set){let s={original:e,code:e,id:r,extracted:n};for(let i of this.config.extractors){let o=await i.extract?.(s);if(o)for(let l of o)n.add(l)}return n}makeContext(e,r){let n={rawSelector:e,currentSelector:r[1],theme:this.config.theme,generator:this,variantHandlers:r[2],constructCSS:(...s)=>this.constructCustomCSS(n,...s),variantMatch:r};return n}async parseToken(e,r){if(this.blocked.has(e))return;let n=`${e}${r?` ${r}`:""}`;if(this._cache.has(n))return this._cache.get(n);let s=e;for(let u of this.config.preprocess)s=u(e);if(this.isBlocked(s)){this.blocked.add(e),this._cache.set(n,null);return}let i=await this.matchVariants(e,s);if(!i||this.isBlocked(i[1])){this.blocked.add(e),this._cache.set(n,null);return}let o=this.makeContext(e,[r||i[0],i[1],i[2],i[3]]);this.config.details&&(o.variants=[...i[3]]);let l=await this.expandShortcut(o.currentSelector,o),f=l?await this.stringifyShortcuts(o.variantMatch,o,l[0],l[1]):(await this.parseUtil(o.variantMatch,o))?.map(u=>this.stringifyUtil(u,o)).filter(se);if(f?.length)return this._cache.set(n,f),f;this._cache.set(n,null)}async generate(e,r={}){let{id:n,scope:s,preflights:i=!0,safelist:o=!0,minify:l=!1}=r,f=E(e)?await this.applyExtractors(e,n):Array.isArray(e)?new Set(e):e;o&&this.config.safelist.forEach(h=>f.add(h));let u=l?"":`
2
+ `,a=new Set([N]),d=new Set,y=new Map,C={},v=Array.from(f).map(async h=>{if(d.has(h))return;let c=await this.parseToken(h);if(c!=null){d.add(h);for(let x of c){let R=x[3]||"",U=x[4]?.layer;y.has(R)||y.set(R,[]),y.get(R).push(x),U&&a.add(U)}}});await Promise.all(v),await(async()=>{if(!i)return;let h={generator:this,theme:this.config.theme},c=new Set([]);this.config.preflights.forEach(({layer:x=W})=>{a.add(x),c.add(x)}),C=Object.fromEntries(await Promise.all(Array.from(c).map(async x=>{let U=(await Promise.all(this.config.preflights.filter(_=>(_.layer||W)===x).map(async _=>await _.getCSS(h)))).filter(Boolean).join(u);return[x,U]})))})();let w=this.config.sortLayers(Array.from(a).sort((h,c)=>(this.config.layers[h]??0)-(this.config.layers[c]??0)||h.localeCompare(c))),S={},b=h=>{if(S[h])return S[h];let c=Array.from(y).sort((R,U)=>(this.parentOrders.get(R[0])??0)-(this.parentOrders.get(U[0])??0)||R[0]?.localeCompare(U[0]||"")||0).map(([R,U])=>{let _=U.length,D=U.filter(p=>(p[4]?.layer||N)===h).sort((p,g)=>p[0]-g[0]||(p[4]?.sort||0)-(g[4]?.sort||0)||p[5]?.currentSelector?.localeCompare(g[5]?.currentSelector??"")||p[1]?.localeCompare(g[1]||"")||p[2]?.localeCompare(g[2]||"")||0).map(([,p,g,,M,,V])=>[[[(p&&Oe(p,s))??"",M?.sort??0]],g,!!(V??M?.noMerge)]);if(!D.length)return;let K=D.reverse().map(([p,g,M],V)=>{if(!M&&this.config.mergeSelectors)for(let O=V+1;O<_;O++){let $=D[O];if($&&!$[2]&&(p&&$[0]||p==null&&$[0]==null)&&$[1]===g)return p&&$[0]&&$[0].push(...p),null}let j=p?P(p.sort((O,$)=>O[1]-$[1]||O[0]?.localeCompare($[0]||"")||0).map(O=>O[0]).filter(Boolean)):[];return j.length?`${j.join(`,${u}`)}{${g}}`:g}).filter(Boolean).reverse().join(u);if(!R)return K;let m=R.split(" $$ ");return`${m.join("{")}{${u}${K}${u}}${m.map(p=>"").join("}")}`}).filter(Boolean).join(u);i&&(c=[C[h],c].filter(Boolean).join(u));let x=l?"":`/* layer: ${h} */${u}`;return S[h]=c?x+c:""},T=(h=w,c)=>h.filter(x=>!c?.includes(x)).map(x=>b(x)||"").filter(Boolean).join(u);return{get css(){return T()},layers:w,matched:d,getLayers:T,getLayer:b}}async matchVariants(e,r){let n=new Set,s=[],i=r||e,o=!1,l={rawSelector:e,theme:this.config.theme,generator:this};for(;;){o=!1;for(let f of this.config.variants){if(!f.multiPass&&n.has(f))continue;let u=await f.match(i,l);if(u){E(u)&&(u={matcher:u}),i=u.matcher,s.unshift(u),n.add(f),o=!0;break}}if(!o)break;if(s.length>500)throw new Error(`Too many variants applied to "${e}"`)}return[e,i,s,n]}applyVariants(e,r=e[4],n=e[1]){let i=r.slice().sort((u,a)=>(u.order||0)-(a.order||0)).reduceRight((u,a)=>d=>{let y=a.body?.(d.entries)||d.entries,C=Array.isArray(a.parent)?a.parent:[a.parent,void 0];return(a.handle??De)({...d,entries:y,selector:a.selector?.(d.selector,y)||d.selector,parent:C[0]||d.parent,parentOrder:C[1]||d.parentOrder,layer:a.layer||d.layer,sort:a.sort||d.sort},u)},u=>u)({prefix:"",selector:Pe(n),pseudo:"",entries:e[2]}),{parent:o,parentOrder:l}=i;o!=null&&l!=null&&this.parentOrders.set(o,l);let f={selector:[i.prefix,i.selector,i.pseudo].join(""),entries:i.entries,parent:o,layer:i.layer,sort:i.sort,noMerge:i.noMerge};for(let u of this.config.postprocess)u(f);return f}constructCustomCSS(e,r,n){let s=L(r);if(E(s))return s;let{selector:i,entries:o,parent:l}=this.applyVariants([0,n||e.rawSelector,s,void 0,e.variantHandlers]),f=`${i}{${F(o)}}`;return l?`${l}{${f}}`:f}async parseUtil(e,r,n=!1,s){let[i,o,l]=E(e)?await this.matchVariants(e):e;this.config.details&&(r.rules=r.rules??[]);let f=this.config.rulesStaticMap[o];if(f&&f[1]&&(n||!f[2]?.internal)){this.config.details&&r.rules.push(f[3]);let a=f[0],d=L(f[1]),y=f[2];return E(d)?[[a,d,y]]:[[a,i,d,y,l]]}r.variantHandlers=l;let{rulesDynamic:u}=this.config;for(let[a,d,y,C]of u){if(C?.internal&&!n)continue;let v=o;if(C?.prefix){let T=A(C.prefix);if(s){let h=A(s);if(!T.some(c=>h.includes(c)))continue}else{let h=T.find(c=>o.startsWith(c));if(h==null)continue;v=o.slice(h.length)}}let w=v.match(d);if(!w)continue;let S=await y(w,r);if(!S)continue;this.config.details&&r.rules.push([d,y,C]);let b=ee(S).filter(T=>T.length);if(b.length)return b.map(T=>E(T)?[a,T,C]:[a,i,T,C,l])}}stringifyUtil(e,r){if(!e)return;if(Z(e))return[e[0],void 0,e[1],void 0,e[2],this.config.details?r:void 0,void 0];let{selector:n,entries:s,parent:i,layer:o,sort:l,noMerge:f}=this.applyVariants(e),u=F(s);if(!u)return;let{layer:a,sort:d,...y}=e[3]??{},C={...y,layer:o??a,sort:l??d};return[e[0],n,u,i,C,this.config.details?r:void 0,f]}async expandShortcut(e,r,n=5){if(n===0)return;let s=this.config.details?l=>{r.shortcuts=r.shortcuts??[],r.shortcuts.push(l)}:ie,i,o;for(let l of this.config.shortcuts){let f=e;if(l[2]?.prefix){let a=A(l[2].prefix).find(d=>e.startsWith(d));if(a==null)continue;f=e.slice(a.length)}if(re(l)){if(l[0]===f){i=i||l[2],o=l[1],s(l);break}}else{let u=f.match(l[0]);if(u&&(o=l[1](u,r)),o){i=i||l[2],s(l);break}}}if(E(o)&&(o=oe(o.trim()).split(/\s+/g)),!o){let[l,f]=E(e)?await this.matchVariants(e):e;if(l!==f){let u=await this.expandShortcut(f,r,n-1);u&&(o=u[0].map(a=>E(a)?l.replace(f,a):a))}}if(o)return[(await Promise.all(o.map(async l=>(E(l)?(await this.expandShortcut(l,r,n-1))?.[0]:void 0)||[l]))).flat(1).filter(Boolean),i]}async stringifyShortcuts(e,r,n,s={layer:this.config.shortcutsLayer}){let i=new B,o=(await Promise.all(P(n).map(async a=>{let d=E(a)?await this.parseUtil(a,r,!0,s.prefix):[[Number.POSITIVE_INFINITY,"{inline}",L(a),void 0,[]]];return d||ce(`unmatched utility "${a}" in shortcut "${e[1]}"`),d||[]}))).flat(1).filter(Boolean).sort((a,d)=>a[0]-d[0]),[l,,f]=e,u=[];for(let a of o){if(Z(a)){u.push([a[0],void 0,a[1],void 0,a[2],r,void 0]);continue}let{selector:d,entries:y,parent:C,sort:v,noMerge:w}=this.applyVariants(a,[...a[4],...f],l);i.getFallback(d,C,[[],a[0]])[0].push([y,!!(w??a[3]?.noMerge),v??0])}return u.concat(i.map(([a,d],y,C)=>{let v=(S,b,T)=>{let h=Math.max(...T.map(x=>x[1])),c=T.map(x=>x[0]);return(S?[c.flat(1)]:c).map(x=>{let R=F(x);if(R)return[d,y,R,C,{...s,noMerge:b,sort:h},r,void 0]})};return[[a.filter(([,S])=>S).map(([S,,b])=>[S,b]),!0],[a.filter(([,S])=>!S).map(([S,,b])=>[S,b]),!1]].map(([S,b])=>[...v(!1,b,S.filter(([T])=>T.some(h=>h[0]===q))),...v(!0,b,S.filter(([T])=>T.every(h=>h[0]!==q)))])}).flat(2).filter(Boolean))}isBlocked(e){return!e||this.config.blocklist.some(r=>E(r)?r===e:r.test(e))}};function xe(t,e){return new Q(t,e)}var _e=/\s\$\$\s+/g;function je(t){return t.match(/\s\$\$\s/)}function Oe(t,e){return je(t)?t.replace(_e,e?` ${e} `:" "):e?`${e} ${t}`:t}var ge=/^\[(.+?)(~?=)"(.*)"\]$/;function Pe(t){return ge.test(t)?t.replace(ge,(e,r,n,s)=>`[${H(r)}${n}"${H(s)}"]`):`.${H(t)}`}function De(t,e){return e(t)}function Le(t){return t.replace(/-(\w)/g,(e,r)=>r?r.toUpperCase():"")}function ye(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Se(t){return t.replace(/(?:^|\B)([A-Z])/g,"-$1").toLowerCase()}var Te=["Webkit","Moz","ms"];function Ce(t){let e={};function r(n){let s=e[n];if(s)return s;let i=Le(n);if(i!=="filter"&&i in t)return e[n]=Se(i);i=ye(i);for(let o=0;o<Te.length;o++){let l=`${Te[o]}${i}`;if(l in t)return e[n]=Se(ye(l))}return n}return({entries:n})=>n.forEach(s=>{s[0].startsWith("--")||(s[0]=r(s[0]))})}function be(t){return t.replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<")}function X(t={}){if(typeof window>"u"){console.warn("@unocss/runtime been used in non-browser environment, skipped.");return}let e=window,r=window.document,n=()=>r.documentElement,s=e.__unocss||{},i=Object.assign({},t,s.runtime),o=i.defaults||{},l=i.cloakAttribute??"un-cloak";i.autoPrefix&&(o.postprocess=A(o.postprocess)).unshift(Ce(r.createElement("div").style)),i.configResolved?.(s,o);let f=xe(s,o),u=new Map,a=!0,d=new Set,y,C,v=[],w=()=>new Promise(m=>{v.push(m),C!=null&&clearTimeout(C),C=setTimeout(()=>T().then(()=>{let p=v;v=[],p.forEach(g=>g())}),0)});function S(m){if(m.nodeType!==1)return;let p=m;p.hasAttribute(l)&&p.removeAttribute(l),p.querySelectorAll(`[${l}]`).forEach(g=>{g.removeAttribute(l)})}function b(m,p){let g=u.get(m);if(!g)if(g=r.createElement("style"),g.setAttribute("data-unocss-runtime-layer",m),u.set(m,g),p==null)n().prepend(g);else{let M=b(p),V=M.parentNode;V?V.insertBefore(g,M.nextSibling):n().prepend(g)}return g}async function T(){let m=await f.generate(d);return m.layers.reduce((p,g)=>(b(g,p).innerHTML=m.getLayer(g)??"",g),void 0),d=m.matched,{...m,getStyleElement:p=>u.get(p),getStyleElements:()=>u}}async function h(m){let p=d.size;await f.applyExtractors(m,void 0,d),p!==d.size&&await w()}async function c(){let m=r.body,p=m&&m.outerHTML;p&&(await h(`${p} ${be(p)}`),S(n()),S(m))}let x=new MutationObserver(m=>{a||m.forEach(async p=>{if(p.target.nodeType!==1)return;let g=p.target;for(let M of u)if(g===M[1])return;if(p.type==="childList")p.addedNodes.forEach(async M=>{if(M.nodeType!==1)return;let V=M;y&&!y(V)||(await h(V.outerHTML),S(V))});else{if(y&&!y(g))return;if(p.attributeName!==l){let M=Array.from(g.attributes).map(j=>j.value?`${j.name}="${j.value}"`:j.name).join(" "),V=`<${g.tagName.toLowerCase()} ${M}>`;await h(V)}g.hasAttribute(l)&&g.removeAttribute(l)}})}),R=!1;function U(){if(R)return;let m=n()||r.body;m&&(x.observe(m,{childList:!0,subtree:!0,attributes:!0}),R=!0)}function _(){i.bypassDefined&&ke(f.blocked),c(),U()}function D(){r.readyState==="loading"?e.addEventListener("DOMContentLoaded",_):_()}let K=e.__unocss_runtime=e.__unocss_runtime={version:f.version,uno:f,async extract(m){E(m)||(m.forEach(p=>d.add(p)),m=""),await h(m)},extractAll:c,inspect(m){y=m},toggleObserver(m){m===void 0?a=!a:a=!!m,!R&&!a&&D()},update:T};i.ready?.(K)!==!1&&(a=!1,D())}function ke(t=new Set){for(let e=0;e<document.styleSheets.length;e++){let r=document.styleSheets[e],n;try{if(n=r.cssRules||r.rules,!n)continue;Array.from(n).flatMap(s=>s.selectorText?.split(/,/g)||[]).forEach(s=>{s&&(s=s.trim(),s.startsWith(".")&&(s=s.slice(1)),t.add(s))})}catch{continue}}return t}X();})();
@@ -0,0 +1,95 @@
1
+ import { UserConfig, GenerateResult, UserConfigDefaults, UnoGenerator } from '@unocss/core';
2
+
3
+ interface RuntimeGenerateResult extends GenerateResult {
4
+ getStyleElement(name: string): HTMLStyleElement | undefined;
5
+ getStyleElements(): Map<string, HTMLStyleElement>;
6
+ }
7
+ interface RuntimeOptions {
8
+ /**
9
+ * Default config of UnoCSS
10
+ */
11
+ defaults?: UserConfigDefaults;
12
+ /**
13
+ * Enable css property auto prefixer
14
+ * @default false
15
+ */
16
+ autoPrefix?: boolean;
17
+ /**
18
+ * Attribute to use as cloaking
19
+ * @default 'un-cloak'
20
+ */
21
+ cloakAttribute?: string;
22
+ /**
23
+ * Callback to modify config
24
+ */
25
+ configResolved?: (config: UserConfig, defaults: UserConfigDefaults) => void;
26
+ /**
27
+ * Callback when the runtime is ready. Returning false will prevent default extraction
28
+ */
29
+ ready?: (runtime: RuntimeContext) => false | any;
30
+ /**
31
+ * When enabled, UnoCSS will look for the existing selectors defined in the stylesheet and bypass them.
32
+ * This is useful when using the runtime alongwith the build-time UnoCSS.
33
+ */
34
+ bypassDefined?: boolean;
35
+ }
36
+ type RuntimeInspectorCallback = (element: Element) => boolean;
37
+ interface RuntimeContext {
38
+ /**
39
+ * The UnoCSS instance.
40
+ *
41
+ * @type {UnoGenerator}
42
+ */
43
+ uno: UnoGenerator;
44
+ /**
45
+ * Run extractor on specified tokens
46
+ *
47
+ * @returns {Promise<void>}
48
+ */
49
+ extract: (tokens: string | string[]) => Promise<void>;
50
+ /**
51
+ * Rerun extractor on the whole <body>, regardless of paused status or inspection limitation.
52
+ *
53
+ * @returns {Promise<void>}
54
+ */
55
+ extractAll: () => Promise<void>;
56
+ /**
57
+ * Set/unset inspection callback to allow/ignore element to be extracted.
58
+ *
59
+ * @param {RuntimeInspectorCallback} [callback] - Callback to determine whether the element will be extracted.
60
+ *
61
+ * @returns {void}
62
+ */
63
+ inspect: (callback?: RuntimeInspectorCallback) => void;
64
+ /**
65
+ * Pause/resume/toggle the runtime.
66
+ *
67
+ * @param {boolean} [state] - False or True respectively pause or resume the runtime. Undefined parameter toggles the pause/resume state.
68
+ *
69
+ * @returns {void}
70
+ */
71
+ toggleObserver: (state?: boolean) => void;
72
+ /**
73
+ * Manually run the update cycle.
74
+ *
75
+ * @returns {RuntimeGenerateResult}
76
+ */
77
+ update: () => Promise<RuntimeGenerateResult>;
78
+ /**
79
+ * The UnoCSS version.
80
+ *
81
+ * @type {string}
82
+ */
83
+ version: string;
84
+ }
85
+ declare global {
86
+ interface Window {
87
+ __unocss?: UserConfig & {
88
+ runtime?: RuntimeOptions;
89
+ };
90
+ __unocss_runtime?: RuntimeContext;
91
+ }
92
+ }
93
+ declare function init(inlineConfig?: RuntimeOptions): void;
94
+
95
+ export { RuntimeContext, RuntimeGenerateResult, RuntimeInspectorCallback, RuntimeOptions, init as default };