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