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