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