@unocss/inspector 0.32.1 → 0.32.9

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Anthony Fu <https://github.com/antfu>
3
+ Copyright (c) 2021-PRESENT Anthony Fu <https://github.com/antfu>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -24,4 +24,4 @@ Visit `http://localhost:3000/__unocss` in your Vite dev server to see the inspec
24
24
 
25
25
  ## License
26
26
 
27
- MIT License © 2021-PRESENT [Anthony Fu](https://github.com/antfu)
27
+ MIT License &copy; 2021-PRESENT [Anthony Fu](https://github.com/antfu)
@@ -0,0 +1 @@
1
+ import{l as S,m as M,d as F,p as P,t as B,r as T,u as O,q as W,g as h,o as V,c as E,b,w as I,e as p,s as R,v as $,x as k,n as w,y as U,_ as Z,h as j,k as q,z as D}from"./index.2fe34db0.js";const K=t=>t.split(/[\s'"`;>=]+/g).filter(S),G={name:"split",order:0,extract({code:t}){return new Set(K(t))}},z=/^(?!\[(?:[^:]+):(?:.+)\]$)((?:.+:)?!?)?(.*)$/,H=(t={})=>{var o,d,i;const n=(o=t.prefix)!=null?o:"un-",c=(d=t.prefixedOnly)!=null?d:!1,_=(i=t.trueToNonValued)!=null?i:!1;return{name:"attributify",match(l){const a=M(l);if(!a)return;let e=a[1];if(e.startsWith(n))e=e.slice(n.length);else if(c)return;const u=a[2],[,s="",r=u]=u.match(z)||[];return r==="~"||_&&r==="true"||!r?`${s}${e}`:`${s}${e}-${r}`}}},J=/(<\w[\w:\.$-]*\s)((?:'[^>]*?'|"[^>]*?"|`[^>]*?`|\{[^>]*?\}|[^>]*?)*)/g,L=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-]+)(?:=("[^"]*|'[^']*))?/g,N=/[\s'"`;>]+/,Q={name:"attributify",extract:({content:t,cursor:n})=>{const c=t.matchAll(J);let _,o=0;for(const m of c){const[,x,v]=m,g=m.index+x.length;if(n>g&&n<=g+v.length){o=g,_=v;break}}if(!_)return null;const d=_.matchAll(L);let i=0,l,a;for(const m of d){const[x,v,g]=m,A=o+m.index;if(n>A&&n<=A+x.length){i=A,l=v,a=g==null?void 0:g.slice(1);break}}if(!l||l==="class"||l==="className")return null;if(a===void 0)return{extracted:l,resolveReplacement(m){return{start:i,end:i+l.length,replacement:m}}};const e=i+l.length+2;let u=N.exec(a),s=0,r;for(;u;){const[m]=u;if(n>e+s&&n<=e+s+u.index){r=a.slice(s,s+u.index);break}s+=u.index+m.length,u=N.exec(a.slice(s))}r===void 0&&(r=a.slice(s));const[,f="",y]=r.match(z)||[];return{extracted:`${f}${l}-${y}`,transformSuggestions(m){return m.filter(x=>x.startsWith(`${f}${l}-`)).map(x=>f+x.slice(f.length+l.length+1))},resolveReplacement(m){return{start:s+e,end:s+e+r.length,replacement:f+m.slice(f.length+l.length+1)}}}}},X=["v-bind:",":"],C=/[\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=t=>{var o,d,i;const n=(o=t==null?void 0:t.ignoreAttributes)!=null?o:[],c=(d=t==null?void 0:t.nonValuedAttribute)!=null?d:!0,_=(i=t==null?void 0:t.trueToNonValued)!=null?i:!1;return{name:"attributify",extract({code:l}){const a=Array.from(l.matchAll(Y)).flatMap(e=>Array.from((e[1]||"").matchAll(tt))).flatMap(([,e,u,s])=>{if(n.includes(e))return[];for(const r of X)if(e.startsWith(r)){e=e.slice(r.length);break}if(!s){if(S(e)&&c!==!1){const r=[`[${e}=""]`];return _&&r.push(`[${e}="true"]`),r}return[]}return["class","className"].includes(e)?s.split(C).filter(S):s.split(C).filter(Boolean).map(r=>`[${e}~="${r}"]`)});return new Set(a)}}},rt=(t={})=>{var o,d,i,l,a;t.strict=(o=t.strict)!=null?o:!1,t.prefix=(d=t.prefix)!=null?d:"un-",t.prefixedOnly=(i=t.prefixedOnly)!=null?i:!1,t.nonValuedAttribute=(l=t.nonValuedAttribute)!=null?l:!0,t.ignoreAttributes=(a=t.ignoreAttributes)!=null?a:[];const n=[H(t)],c=[et(t)],_=[Q];return t.strict||c.unshift(G),{name:"@unocss/preset-attributify",variants:n,extractors:c,options:t,autocomplete:{extractors:_}}},st={key:0,"h-full":"","of-hidden":""},lt=p("div",{op50:""}," Module ",-1),nt=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":""},ut=p("div",{op50:""}," Potentially Unmatched ",-1),dt={"h-full":"","of-hidden":"",grid:"","grid-cols-2":""},ft=F({props:{id:null},setup(t){const n=t,{data:c}=P(B(n,"id")),_=n.id.split(/\./g).pop(),o=T(null),d=O(o,"module-scrolls");function i(){fetch(`/__open-in-editor?file=${encodeURIComponent(n.id)}`)}const{extractors:l}=rt({strict:!0}),a=W(async()=>{var u;const e=new Set;if(l){const s={code:((u=c.value)==null?void 0:u.code)||""};for(const r of l){const f=await r.extract(s);f==null||f.forEach(y=>e.add(y))}}return Array.from(e).filter(s=>!s.startsWith("[")).filter(s=>{var r;return!((r=c.value)!=null&&r.matched.includes(s))})});return(e,u)=>{const s=U,r=Z,f=j;return h(c)?(V(),E("div",st,[b(r,{ref_key:"status",ref:o,grid:"~ cols-3 gap-4"},{default:I(()=>{var y;return[p("div",null,[lt,p("a",{"cursor-pointer":"",op80:"","hover:op100":"",onClick:i},[b(s,{id:h(c).id,"mr-1":""},null,8,["id"]),nt])]),p("div",null,[ct,R(" "+$(h(c).matched.length),1)]),p("div",null,[at,R(" "+$(((((y=h(c))==null?void 0:y.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),ot]),h(a).length?(V(),E("div",it,[ut,p("code",null,$(h(a).join(", ")),1)])):k("",!0)]}),_:1},512),p("div",dt,[b(f,{"h-full":"","model-value":h(c).code,"read-only":!0,mode:h(_),matched:h(c).matched,class:"scrolls module-scrolls",style:w(h(d))},null,8,["model-value","mode","matched","style"]),b(f,{"h-full":"",b:"l main","model-value":h(c).css,"read-only":!0,mode:"css",class:"scrolls module-scrolls",style:w(h(d))},null,8,["model-value","style"])])])):k("",!0)}}}),ht=F({setup(t){const n=D();return(c,_)=>{const o=ft;return V(),q(o,{id:h(n).params.id},null,8,["id"])}}});export{ht as default};