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