@unocss/inspector 0.46.5 → 0.47.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.
@@ -0,0 +1 @@
1
+ import{s as I,t as R,x as O,d as B,y as W,z as D,r as C,u as U,A as j,B as Z,C as q,i as d,c as w,e as v,w as A,g as m,D as M,_ as G,o as E,k as S,E as V,F as N,n as P,h as H,v as K,M as J,G as L,m as Q,l as X,q as Y,H as tt}from"./index.3651546a.js";const F=/^(?!.*\[(?:[^:]+):(?:.+)\]$)((?:.+:)?!?)?(.*)$/,et=(t={})=>{var u,h,f;const a=(u=t.prefix)!=null?u:"un-",c=(h=t.prefixedOnly)!=null?h:!1,p=(f=t.trueToNonValued)!=null?f:!1;return{name:"attributify",match(r){const o=I(r);if(!o)return;let e=o[1];if(e.startsWith(a))e=e.slice(a.length);else if(c)return;const _=o[2],[,s="",l=_]=_.match(F)||[];return l==="~"||p&&l==="true"||!l?`${s}${e}`:`${s}${e}-${l}`}}},lt=/(<\w[\w:\.$-]*\s)((?:'[^>]*?'|"[^>]*?"|`[^>]*?`|\{[^>]*?\}|[^>]*?)*)/g,st=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-]+)(?:=("[^"]*|'[^']*))?/g,z=/[\s'"`;>]+/,rt={name:"attributify",extract:({content:t,cursor:a})=>{const c=t.matchAll(lt);let p,u=0;for(const n of c){const[,x,y]=n,b=n.index+x.length;if(a>b&&a<=b+y.length){u=b,p=y;break}}if(!p)return null;const h=p.matchAll(st);let f=0,r,o;for(const n of h){const[x,y,b]=n,$=u+n.index;if(a>$&&a<=$+x.length){f=$,r=y,o=b==null?void 0:b.slice(1);break}}if(!r||r==="class"||r==="className"||r===":class")return null;if(o===void 0)return{extracted:r,resolveReplacement(n){return{start:f,end:f+r.length,replacement:n}}};const e=f+r.length+2;let _=z.exec(o),s=0,l;for(;_;){const[n]=_;if(a>e+s&&a<=e+s+_.index){l=o.slice(s,s+_.index);break}s+=_.index+n.length,_=z.exec(o.slice(s))}l===void 0&&(l=o.slice(s));const[,i="",g]=l.match(F)||[];return{extracted:`${i}${r}-${g}`,transformSuggestions(n){return n.filter(x=>x.startsWith(`${i}${r}-`)).map(x=>i+x.slice(i.length+r.length+1))},resolveReplacement(n){return{start:s+e,end:s+e+l.length,replacement:i+n.slice(i.length+r.length+1)}}}}},nt=["v-bind:",":"],k=/[\s'"`;]+/g,at=/<\w(?=.*>)[\w:\.$-]*\s((?:['"`\{].*?['"`\}]|.*?)*?)>/gs,ct=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-]+)=?(?:["]([^"]*)["]|[']([^']*)[']|[{]([^}]*)[}])?/gms,T=["placeholder"],ot=t=>{var u,h,f;const a=(u=t==null?void 0:t.ignoreAttributes)!=null?u:T,c=(h=t==null?void 0:t.nonValuedAttribute)!=null?h:!0,p=(f=t==null?void 0:t.trueToNonValued)!=null?f:!1;return{name:"attributify",extract({code:r}){const o=Array.from(r.matchAll(at)).flatMap(e=>Array.from((e[1]||"").matchAll(ct))).flatMap(([,e,..._])=>{const s=_.filter(Boolean).join("");if(a.includes(e))return[];for(const l of nt)if(e.startsWith(l)){e=e.slice(l.length);break}if(!s){if(R(e)&&c!==!1){const l=[`[${e}=""]`];return p&&l.push(`[${e}="true"]`),l}return[]}if(["class","className"].includes(e))return s.split(k).filter(R);{const l=Array.from(s.matchAll(/(?:[\?:].*?)(["'])([^\1]*?)\1/gms)).map(([,,i])=>i.split(k)).flat();return(l.length?l:s.split(k)).filter(Boolean).map(i=>`[${e}~="${i}"]`)}});return new Set(o)}}},it=(t={})=>{var u,h,f,r,o;t.strict=(u=t.strict)!=null?u:!1,t.prefix=(h=t.prefix)!=null?h:"un-",t.prefixedOnly=(f=t.prefixedOnly)!=null?f:!1,t.nonValuedAttribute=(r=t.nonValuedAttribute)!=null?r:!0,t.ignoreAttributes=(o=t.ignoreAttributes)!=null?o:T;const a=[et(t)],c=[ot(t)],p=[rt];return t.strict||c.unshift(O),{name:"@unocss/preset-attributify",variants:a,extractors:c,options:t,autocomplete:{extractors:p}}},ut={key:0,"h-full":"","of-hidden":""},dt=m("div",{op50:""}," Module ",-1),ft=m("div",{"i-carbon-launch":""},null,-1),mt=m("div",{op50:""}," Matched Rules ",-1),ht=m("div",{op50:""}," CSS Size ",-1),_t=m("span",{op50:""},"gzipped",-1),pt={key:0,"row-span-3":""},xt=m("div",{op50:""}," Potentially Unmatched ",-1),yt={"h-full":"","of-hidden":""},gt=B({__name:"ModuleInfo",props:{id:null},setup(t){const a=t,{data:c}=W(D(a,"id")),p=a.id.split(/\./g).pop(),u=C(null),h=U(u,"module-scrolls");function f(){fetch(`/__open-in-editor?file=${encodeURIComponent(a.id)}`)}const{extractors:r}=it({strict:!0}),o=j(async()=>{var l;const s=new Set;if(r){const i={code:((l=c.value)==null?void 0:l.code)||""};for(const g of r){const n=await g.extract(i);n==null||n.forEach(x=>s.add(x))}}return Array.from(s).filter(i=>!i.startsWith("[")).filter(i=>{var g;return!((g=c.value)!=null&&g.matched.includes(i))})}),e=C(!1),_=Z(q(()=>{var s;return(s=c.value)==null?void 0:s.css}),e);return(s,l)=>{const i=L,g=G,n=Q,x=X;return d(c)?(E(),w("div",ut,[v(g,{ref_key:"status",ref:u,grid:"~ cols-3 gap-4"},{default:A(()=>{var y;return[m("div",null,[dt,m("a",{"cursor-pointer":"",op80:"","hover:op100":"",onClick:f},[v(i,{id:d(c).id,"mr-1":""},null,8,["id"]),ft])]),m("div",null,[mt,S(" "+V(d(c).matched.length),1)]),m("div",null,[ht,S(" "+V(((((y=d(c))==null?void 0:y.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),_t]),d(o).length?(E(),w("div",pt,[xt,m("code",null,V(d(o).join(", ")),1)])):M("",!0)]}),_:1},512),m("div",yt,[v(d(J),null,{default:A(()=>[v(d(N),{size:"50"},{default:A(()=>[v(n,{"h-full":"","model-value":d(c).code,"read-only":!0,mode:d(p),matched:d(c).matched,class:"scrolls module-scrolls",style:P(d(h))},null,8,["model-value","mode","matched","style"])]),_:1}),v(d(N),{size:"50"},{default:A(()=>[m("div",null,[v(x,{border:"l b gray-400/20",title:"Output CSS"},{default:A(()=>[m("label",null,[H(m("input",{"onUpdate:modelValue":l[0]||(l[0]=y=>e.value=y),type:"checkbox"},null,512),[[K,e.value]]),S(" Prettify ")])]),_:1}),v(n,{"h-full":"",b:"l main","model-value":d(_),"read-only":!0,mode:"css",class:"scrolls module-scrolls",style:P(d(h))},null,8,["model-value","style"])])]),_:1})]),_:1})])])):M("",!0)}}}),bt=B({__name:"[id]",setup(t){const a=tt();return(c,p)=>{const u=gt;return E(),Y(u,{id:d(a).params.id},null,8,["id"])}}});export{bt as default};