@unocss/runtime 0.44.7 → 0.45.4
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/attributify.global.js +3 -3
- package/core.global.js +2 -2
- package/dist/index.js +4 -1
- package/dist/index.mjs +4 -3
- package/full.global.js +3 -3
- package/mini.global.js +3 -3
- package/package.json +4 -4
- package/uno.global.js +3 -3
package/core.global.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(()=>{function
|
|
2
|
-
`,d=new Set([I]),f=new Set,S=new Map,l={},h=Array.from(c).map(async m=>{var y;if(f.has(m))return;let C=await this.parseToken(m);if(C!=null){f.add(m);for(let v of C){let u=v[3]||"",x=(y=v[4])==null?void 0:y.layer;S.has(u)||S.set(u,[]),S.get(u).push(v),x&&d.add(x)}}}),b=(async()=>{if(!
|
|
1
|
+
"use strict";(()=>{function vt(e){let t=e.length,r=-1,n,s="",i=e.charCodeAt(0);for(;++r<t;){if(n=e.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&&t===1&&n===45){s+=`\\${e.charAt(r)}`;continue}if(n>=128||n===45||n===95||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122){s+=e.charAt(r);continue}s+=`\\${e.charAt(r)}`}return s}var F=vt;function L(e=[]){return Array.isArray(e)?e:[e]}function j(e){return Array.from(new Set(e))}function R(e){return typeof e=="string"}function k(e){return R(e)?e:(Array.isArray(e)?e:Object.entries(e)).filter(t=>t[1]!=null)}function rt(e){return Array.isArray(e)?e.find(t=>!Array.isArray(t)||Array.isArray(t[0]))?e.map(t=>k(t)):[e]:[k(e)]}function Ut(e){return e.filter(([t,r],n)=>{if(t.startsWith("$$"))return!1;for(let s=n-1;s>=0;s--)if(e[s][0]===t&&e[s][1]===r)return!1;return!0})}function B(e){return e==null?"":Ut(e).map(([t,r])=>r!=null?`${t}:${r};`:void 0).filter(Boolean).join("")}function z(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Y(e,t){let r=e,n=t;if(Array.isArray(r))return[...n];let s={...r};return z(r)&&z(n)&&Object.keys(n).forEach(i=>{z(r[i])&&z(n[i])||Array.isArray(r[i])&&Array.isArray(n[i])?s[i]=Y(r[i],n[i]):Object.assign(s,{[i]:n[i]})}),s}function H(e){let t,r,n;if(Array.isArray(e)){for(r=Array(t=e.length);t--;)r[t]=(n=e[t])&&typeof n=="object"?H(n):n;return r}if(Object.prototype.toString.call(e)==="[object Object]"){r={};for(t in e)t==="__proto__"?Object.defineProperty(r,t,{value:H(e[t]),configurable:!0,enumerable:!0,writable:!0}):r[t]=(n=e[t])&&typeof n=="object"?H(n):n;return r}return e}function nt(e){return R(e[0])}function st(e){return R(e[0])}var wt=/(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-?]/,q="$$shortcut-no-merge";function it(e=""){return wt.test(e)}function ot(e){return typeof e=="function"?{match:e}:e}function W(e){return e.length===3}function at(e){return e!=null}function Z(){}var G=class{_map=new Map;get(t,r){let n=this._map.get(t);if(n)return n.get(r)}getFallback(t,r,n){let s=this._map.get(t);return s||(s=new Map,this._map.set(t,s)),s.has(r)||s.set(r,n),s.get(r)}set(t,r,n){let s=this._map.get(t);return s||(s=new Map,this._map.set(t,s)),s.set(r,n),this}has(t,r){var n;return(n=this._map.get(t))==null?void 0:n.has(r)}delete(t,r){var n;return((n=this._map.get(t))==null?void 0:n.delete(r))||!1}deleteTop(t){return this._map.delete(t)}map(t){return Array.from(this._map.entries()).flatMap(([r,n])=>Array.from(n.entries()).map(([s,i])=>t(i,r,s)))}};var ct=/([!\w+:_/-]+?)([:-])\(((?:[~!\w\s:/\\,%#.$-]|\[.*?\])*?)\)/gm;function lt(e,t=["-",":"]){ct.lastIndex=0;let r=!1,n=e.toString();do{let s=n;n=n.replace(ct,(i,o,p,c)=>t.includes(p)?c.split(/\s/g).filter(Boolean).map(a=>a==="~"?o:a.replace(/^(!?)(.*)/,`$1${o}${p}$2`)).join(" "):i),r=n!==s}while(r);return typeof e=="string"?n:e.overwrite(0,e.length(),n)}var ut=new Set;function ft(e){ut.has(e)||(console.warn("[unocss]",e),ut.add(e))}var At=e=>e.split(/\\?[\s'"`;=]+/g).filter(it),J={name:"split",order:0,extract({code:e}){return new Set(At(e))}};function pt(){return{events:{},emit(e,...t){(this.events[e]||[]).forEach(r=>r(...t))},on(e,t){return(this.events[e]=this.events[e]||[]).push(t),()=>this.events[e]=(this.events[e]||[]).filter(r=>r!==t)}}}var I="default",N="preflights",Vt="shortcuts",dt={[N]:-100,[Vt]:-10,[I]:0};function ht(e){return L(e).flatMap(t=>Array.isArray(t)?[t]:Object.entries(t))}function Tt(e){var r;let t=e.shortcuts?ht(e.shortcuts):void 0;if(e.shortcuts=t,e.prefix||e.layer){let n=s=>{s[2]||(s[2]={});let i=s[2];i.prefix==null&&e.prefix&&(i.prefix=e.prefix),i.layer==null&&e.layer&&(i.prefix=e.layer)};t==null||t.forEach(n),(r=e.rules)==null||r.forEach(n)}return e}function Q(e={},t={}){let r=Object.assign({},t,e),n=(r.presets||[]).flatMap(L).map(Tt),s=[...n.filter(l=>l.enforce==="pre"),...n.filter(l=>!l.enforce),...n.filter(l=>l.enforce==="post")],i=Object.assign(dt,...n.map(l=>l.layers),e.layers);function o(l){return j([...s.flatMap(h=>L(h[l]||[])),...L(r[l]||[])])}let p=o("extractors");p.length||p.push(J),p.sort((l,h)=>(l.order||0)-(h.order||0));let c=o("rules"),a={},d=c.length;c.forEach((l,h)=>{var b;if(nt(l)){let _=((b=l[2])==null?void 0:b.prefix)||"";a[_+l[0]]=[h,l[1],l[2],l],delete c[h]}});let f=H([...s.map(l=>l.theme||{}),r.theme||{}].reduce((l,h)=>Y(l,h),{}));o("extendTheme").forEach(l=>l(f));let S={templates:j(s.map(l=>{var h;return L((h=l.autocomplete)==null?void 0:h.templates)}).flat()),extractors:s.map(l=>{var h;return L((h=l.autocomplete)==null?void 0:h.extractors)}).flat().sort((l,h)=>(l.order||0)-(h.order||0))};return{mergeSelectors:!0,warn:!0,blocklist:[],sortLayers:l=>l,...r,presets:s,envMode:r.envMode||"build",shortcutsLayer:r.shortcutsLayer||"shortcuts",layers:i,theme:f,rulesSize:d,rulesDynamic:c,rulesStaticMap:a,preprocess:o("preprocess"),postprocess:o("postprocess"),preflights:o("preflights"),autocomplete:S,variants:o("variants").map(ot),shortcuts:ht(o("shortcuts")),extractors:p,safelist:o("safelist")}}var gt="0.45.4";var X=class{constructor(t={},r={}){this.userConfig=t;this.defaults=r;this.config=Q(t,r),this.events.emit("config",this.config)}version=gt;_cache=new Map;config;blocked=new Set;parentOrders=new Map;events=pt();setConfig(t,r){!t||(r&&(this.defaults=r),this.userConfig=t,this.blocked.clear(),this.parentOrders.clear(),this._cache.clear(),this.config=Q(t,this.defaults),this.events.emit("config",this.config))}async applyExtractors(t,r,n=new Set){let s={get original(){return t},code:t,id:r};for(let i of this.config.extractors){let o=await i.extract(s);o==null||o.forEach(p=>n.add(p))}return n}makeContext(t,r){let n={rawSelector:t,currentSelector:r[1],theme:this.config.theme,generator:this,variantHandlers:r[2],constructCSS:(...s)=>this.constructCustomCSS(n,...s),variantMatch:r};return n}async parseToken(t,r){var c;if(this.blocked.has(t))return;let n=`${t}${r?` ${r}`:""}`;if(this._cache.has(n))return this._cache.get(n);let s=t;for(let a of this.config.preprocess)s=a(t);if(this.isBlocked(s)){this.blocked.add(t),this._cache.set(n,null);return}let i=this.matchVariants(t,s);if(!i||this.isBlocked(i[1])){this.blocked.add(t),this._cache.set(n,null);return}let o=this.makeContext(t,[r||i[0],i[1],i[2],i[3]]);this.config.details&&(o.variants=[...i[3]]);let p=this.expandShortcut(o.currentSelector,o);if(p){let a=await this.stringifyShortcuts(o.variantMatch,o,p[0],p[1]);if(a!=null&&a.length)return this._cache.set(n,a),a}else{let a=(c=await this.parseUtil(o.variantMatch,o))==null?void 0:c.map(d=>this.stringifyUtil(d,o)).filter(at);if(a!=null&&a.length)return this._cache.set(n,a),a}this._cache.set(n,null)}async generate(t,r={}){let{id:n,scope:s,preflights:i=!0,safelist:o=!0,minify:p=!1}=r,c=R(t)?await this.applyExtractors(t,n):Array.isArray(t)?new Set(t):t;o&&this.config.safelist.forEach(m=>c.add(m));let a=p?"":`
|
|
2
|
+
`,d=new Set([I]),f=new Set,S=new Map,l={},h=Array.from(c).map(async m=>{var y;if(f.has(m))return;let C=await this.parseToken(m);if(C!=null){f.add(m);for(let v of C){let u=v[3]||"",x=(y=v[4])==null?void 0:y.layer;S.has(u)||S.set(u,[]),S.get(u).push(v),x&&d.add(x)}}}),b=(async()=>{if(!i)return;let m={generator:this,theme:this.config.theme},C=new Set([]);this.config.preflights.forEach(({layer:y=N})=>{d.add(y),C.add(y)}),l=Object.fromEntries(await Promise.all(Array.from(C).map(async y=>{let u=(await Promise.all(this.config.preflights.filter(x=>(x.layer||N)===y).map(async x=>await x.getCSS(m)))).filter(Boolean).join(a);return[y,u]})))})();await Promise.all([...h,b]);let _=this.config.sortLayers(Array.from(d).sort((m,C)=>(this.config.layers[m]??0)-(this.config.layers[C]??0)||m.localeCompare(C))),g={},w=m=>{if(g[m])return g[m];let C=Array.from(S).sort((v,u)=>{var x;return(this.parentOrders.get(v[0])??0)-(this.parentOrders.get(u[0])??0)||((x=v[0])==null?void 0:x.localeCompare(u[0]||""))||0}).map(([v,u])=>{let x=u.length,A=u.filter(E=>{var V;return(((V=E[4])==null?void 0:V.layer)||I)===m}).sort((E,V)=>{var T,D,K,$;return E[0]-V[0]||(((T=E[4])==null?void 0:T.sort)||0)-(((D=V[4])==null?void 0:D.sort)||0)||((K=E[1])==null?void 0:K.localeCompare(V[1]||""))||(($=E[2])==null?void 0:$.localeCompare(V[2]||""))||0}).map(([,E,V,,T])=>[[[(E&&Mt(E,s))??"",(T==null?void 0:T.sort)??0]],V,!!(T!=null&&T.noMerge)]);if(!A.length)return;let P=A.reverse().map(([E,V,T],D)=>{if(!T&&this.config.mergeSelectors)for(let $=D+1;$<x;$++){let M=A[$];if(M&&!M[2]&&(E&&M[0]||E==null&&M[0]==null)&&M[1]===V)return E&&M[0]&&M[0].push(...E),null}let K=E?j(E.sort(($,M)=>{var et;return $[1]-M[1]||((et=$[0])==null?void 0:et.localeCompare(M[0]||""))||0}).map($=>$[0]).filter(Boolean)):[];return K.length?`${K.join(`,${a}`)}{${V}}`:V}).filter(Boolean).reverse().join(a);if(!v)return P;let O=v.split(" $$ ");return`${O.join("{")}{${a}${P}${a}}${O.map(E=>"").join("}")}`}).filter(Boolean).join(a);i&&(C=[l[m],C].filter(Boolean).join(a));let y=p?"":`/* layer: ${m} */${a}`;return g[m]=C?y+C:""},U=(m=_,C)=>m.filter(y=>!(C!=null&&C.includes(y))).map(y=>w(y)||"").filter(Boolean).join(a);return{get css(){return U()},layers:_,matched:f,getLayers:U,getLayer:w}}matchVariants(t,r){let n=new Set,s=[],i=r||t,o=!1,p={rawSelector:t,theme:this.config.theme,generator:this};for(;;){o=!1;for(let c of this.config.variants){if(!c.multiPass&&n.has(c))continue;let a=c.match(i,p);if(!!a){R(a)&&(a={matcher:a}),i=a.matcher,s.unshift(a),n.add(c),o=!0;break}}if(!o)break;if(s.length>500)throw new Error(`Too many variants applied to "${t}"`)}return[t,i,s,n]}applyVariants(t,r=t[4],n=t[1]){let i=[...r].sort((a,d)=>(a.order||0)-(d.order||0)).reverse().reduce((a,d)=>f=>{var h,b;let S=((h=d.body)==null?void 0:h.call(d,f.entries))||f.entries,l=Array.isArray(d.parent)?d.parent:[d.parent,void 0];return(d.handle??Lt)({...f,entries:S,selector:((b=d.selector)==null?void 0:b.call(d,f.selector,S))||f.selector,parent:l[0]||f.parent,parentOrder:l[1]||f.parentOrder,layer:d.layer||f.layer,sort:d.sort||f.sort},a)},a=>a)({prefix:"",selector:Pt(n),pseudo:"",entries:t[2]}),{parent:o,parentOrder:p}=i;o!=null&&p!=null&&this.parentOrders.set(o,p);let c={selector:Ot([i.prefix,i.selector,i.pseudo].join("")),entries:i.entries,parent:o,layer:i.layer,sort:i.sort};for(let a of this.config.postprocess)a(c);return c}constructCustomCSS(t,r,n){let s=k(r);if(R(s))return s;let{selector:i,entries:o,parent:p}=this.applyVariants([0,n||t.rawSelector,s,void 0,t.variantHandlers]),c=`${i}{${B(o)}}`;return p?`${p}{${c}}`:c}async parseUtil(t,r,n=!1){var f,S;let[s,i,o]=R(t)?this.matchVariants(t):t,p=this.config.details?l=>{r.rules=r.rules??[],r.rules.push(l)}:Z,c=this.config.rulesStaticMap[i];if(c&&c[1]&&(n||!((f=c[2])!=null&&f.internal))){p(c[3]);let l=c[0],h=k(c[1]),b=c[2];return R(h)?[[l,h,b]]:[[l,s,h,b,o]]}r.variantHandlers=o;let{rulesDynamic:a,rulesSize:d}=this.config;for(let l=d-1;l>=0;l--){let h=a[l];if(!h||((S=h[2])==null?void 0:S.internal)&&!n)continue;let[b,_,g]=h;if((g==null?void 0:g.prefix)&&!i.startsWith(g.prefix))continue;let U=(g!=null&&g.prefix?i.slice(g.prefix.length):i).match(b);if(!U)continue;let m=await _(U,r);if(!m)continue;p(h);let C=rt(m).filter(y=>y.length);if(C.length)return C.map(y=>R(y)?[l,y,g]:[l,s,y,g,o])}}stringifyUtil(t,r){if(!t)return;if(W(t))return[t[0],void 0,t[1],void 0,t[2],this.config.details?r:void 0];let{selector:n,entries:s,parent:i,layer:o,sort:p}=this.applyVariants(t),c=B(s);if(!c)return;let{layer:a,sort:d,...f}=t[3]??{},S={...f,layer:o??a,sort:p??d};return[t[0],n,c,i,S,this.config.details?r:void 0]}expandShortcut(t,r,n=5){var p;if(n===0)return;let s=this.config.details?c=>{r.shortcuts=r.shortcuts??[],r.shortcuts.push(c)}:Z,i,o;for(let c of this.config.shortcuts){let a=(p=c[2])!=null&&p.prefix?t.slice(c[2].prefix.length):t;if(st(c)){if(c[0]===a){i=i||c[2],o=c[1],s(c);break}}else{let d=a.match(c[0]);if(d&&(o=c[1](d,r)),o){i=i||c[2],s(c);break}}}if(R(o)&&(o=lt(o).split(/\s+/g)),!o){let[c,a]=R(t)?this.matchVariants(t):t;if(c!==a){let d=this.expandShortcut(a,r,n-1);d&&(o=d[0].map(f=>R(f)?c.replace(a,f):f))}}if(!!o)return[o.flatMap(c=>{var a;return(R(c)?(a=this.expandShortcut(c,r,n-1))==null?void 0:a[0]:void 0)||[c]}).filter(Boolean),i]}async stringifyShortcuts(t,r,n,s={layer:this.config.shortcutsLayer}){var d;let i=new G,o=(await Promise.all(j(n).map(async f=>{let S=R(f)?await this.parseUtil(f,r,!0):[[1/0,"{inline}",k(f),void 0,[]]];return S||ft(`unmatched utility "${f}" in shortcut "${t[1]}"`),S||[]}))).flat(1).filter(Boolean).sort((f,S)=>f[0]-S[0]),[p,,c]=t,a=[];for(let f of o){if(W(f)){a.push([f[0],void 0,f[1],void 0,f[2],r]);continue}let{selector:S,entries:l,parent:h,sort:b}=this.applyVariants(f,[...f[4],...c],p);i.getFallback(S,h,[[],f[0]])[0].push([l,!!((d=f[3])!=null&&d.noMerge),b??0])}return a.concat(i.map(([f,S],l,h)=>{let b=(g,w,U)=>{let m=Math.max(...U.map(y=>y[1])),C=U.map(y=>y[0]);return(g?[C.flat(1)]:C).map(y=>{let v=B(y);if(v)return[S,l,v,h,{...s,noMerge:w,sort:m},r]})};return[[f.filter(([,g])=>g).map(([g,,w])=>[g,w]),!0],[f.filter(([,g])=>!g).map(([g,,w])=>[g,w]),!1]].map(([g,w])=>[...b(!1,w,g.filter(([U])=>U.some(m=>m[0]===q))),...b(!0,w,g.filter(([U])=>U.every(m=>m[0]!==q)))])}).flat(2).filter(Boolean))}isBlocked(t){return!t||this.config.blocklist.some(r=>R(r)?r===t:r.test(t))}};function yt(e,t){return new X(e,t)}var xt=/ \$\$ /,_t=e=>e.match(xt);function Mt(e,t){return _t(e)?e.replace(xt,t?` ${t} `:" "):t?`${t} ${e}`:e}function Ot(e){let t=e.match(/::[\w-]+(\([\w-]+\))?/g);return t&&(t.forEach(r=>e=e.replace(r,"")),e+=t.join("")),e}var mt=/^\[(.+?)(~?=)"(.*)"\]$/;function Pt(e){return mt.test(e)?e.replace(mt,(t,r,n,s)=>`[${F(r)}${n}"${F(s)}"]`):`.${F(e)}`}function Lt(e,t){return t(e)}var jt=e=>e.replace(/-(\w)/g,(t,r)=>r?r.toUpperCase():""),St=e=>e.charAt(0).toUpperCase()+e.slice(1),Ct=e=>e.replace(/(?:^|\B)([A-Z])/g,"-$1").toLowerCase(),Et=["Webkit","Moz","ms"];function bt(e){let t={};function r(n){let s=t[n];if(s)return s;let i=jt(n);if(i!=="filter"&&i in e)return t[n]=Ct(i);i=St(i);for(let o=0;o<Et.length;o++){let p=`${Et[o]}${i}`;if(p in e)return t[n]=Ct(St(p))}return n}return({entries:n})=>n.forEach(s=>{s[0].startsWith("--")||(s[0]=r(s[0]))})}function Rt(e){return e.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<")}function tt(e={}){var y,v;if(typeof window>"u"){console.warn("@unocss/runtime been used in non-browser environment, skipped.");return}let t=window.__unocss||{},r=t==null?void 0:t.runtime,n=Object.assign(e.defaults||{},r);if(r!=null&&r.autoPrefix){let u=n.postprocess;u||(u=[]),Array.isArray(u)||(u=[u]),u.unshift(bt(document.createElement("div").style)),n.postprocess=u}(y=r==null?void 0:r.configResolved)==null||y.call(r,t,n);let s,i=!0,o,p=yt(t,n),c=new Set,a,d=[],f=()=>new Promise(u=>{d.push(u),a!=null&&clearTimeout(a),a=setTimeout(()=>l().then(()=>{let x=d;d=[],x.forEach(A=>A())}),0)});function S(u=document.body){if(u.nodeType!==1)return;let x=u;x.hasAttribute("un-cloak")&&x.removeAttribute("un-cloak"),x.querySelectorAll("[un-cloak]").forEach(A=>{A.removeAttribute("un-cloak")})}async function l(){let u=await p.generate(c);s||(s=document.createElement("style"),document.documentElement.prepend(s)),s.innerHTML=u.css,c=u.matched}async function h(u){let x=c.size;await p.applyExtractors(u,void 0,c),x!==c.size&&await f()}async function b(){let u=document.body&&document.body.outerHTML;u&&(await h(`${u} ${Rt(u)}`),S())}let _=new MutationObserver(u=>{i||u.forEach(async x=>{if(x.target.nodeType!==1)return;let A=x.target;if(A!==s)if(x.type==="childList")x.addedNodes.forEach(async P=>{if(P.nodeType!==1)return;let O=P;o&&!o(O)||(await h(O.outerHTML),S(O))});else{if(o&&!o(A))return;if(x.attributeName!=="un-cloak"){let P=Array.from(A.attributes).map(E=>E.value?`${E.name}="${E.value}"`:E.name).join(" "),O=`<${A.tagName.toLowerCase()} ${P}>`;await h(O)}A.hasAttribute("un-cloak")&&A.removeAttribute("un-cloak")}})}),g=!1;function w(){if(g)return;let u=document.documentElement||document.body;!u||(_.observe(u,{childList:!0,subtree:!0,attributes:!0}),g=!0)}function U(){b(),w()}function m(){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",U):U()}let C=window.__unocss_runtime=window.__unocss_runtime={version:p.version,uno:p,async extract(u){typeof u!="string"&&(u.forEach(x=>c.add(x)),u=""),await h(u)},extractAll:b,inspect(u){o=u},toggleObserver(u){u===void 0?i=!i:i=!!u,!g&&!i&&m()}};((v=r==null?void 0:r.ready)==null?void 0:v.call(r,C))!==!1&&(i=!1,m())}tt();})();
|
package/dist/index.js
CHANGED
|
@@ -52,6 +52,9 @@ function autoPrefixer(style) {
|
|
|
52
52
|
e[0] = autoPrefix(e[0]);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
+
function decodeHtml(html) {
|
|
56
|
+
return html.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<");
|
|
57
|
+
}
|
|
55
58
|
|
|
56
59
|
// src/index.ts
|
|
57
60
|
function init(inlineConfig = {}) {
|
|
@@ -118,7 +121,7 @@ function init(inlineConfig = {}) {
|
|
|
118
121
|
async function extractAll() {
|
|
119
122
|
const html = document.body && document.body.outerHTML;
|
|
120
123
|
if (html) {
|
|
121
|
-
await extract(html);
|
|
124
|
+
await extract(`${html} ${decodeHtml(html)}`);
|
|
122
125
|
removeCloak();
|
|
123
126
|
}
|
|
124
127
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
// src/index.ts
|
|
4
2
|
import { createGenerator } from "@unocss/core";
|
|
5
3
|
|
|
@@ -30,6 +28,9 @@ function autoPrefixer(style) {
|
|
|
30
28
|
e[0] = autoPrefix(e[0]);
|
|
31
29
|
});
|
|
32
30
|
}
|
|
31
|
+
function decodeHtml(html) {
|
|
32
|
+
return html.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<");
|
|
33
|
+
}
|
|
33
34
|
|
|
34
35
|
// src/index.ts
|
|
35
36
|
function init(inlineConfig = {}) {
|
|
@@ -96,7 +97,7 @@ function init(inlineConfig = {}) {
|
|
|
96
97
|
async function extractAll() {
|
|
97
98
|
const html = document.body && document.body.outerHTML;
|
|
98
99
|
if (html) {
|
|
99
|
-
await extract(html);
|
|
100
|
+
await extract(`${html} ${decodeHtml(html)}`);
|
|
100
101
|
removeCloak();
|
|
101
102
|
}
|
|
102
103
|
}
|