@unocss/inspector 0.57.7 → 0.58.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 U,t as N,d as W,x as Z,y as q,r as R,u as G,z as H,A as K,B as J,h as s,c as P,g as A,w as k,q as I,C as z,_ as L,D as Q,o as S,e as m,k as w,E as C,i as M,F as B,n as F,j as X,v as Y,M as ee,G as te,H as re,m as le,l as se,I as ae}from"./index-XB28YVlX.js";const j=/^(?!.*\[(?:[^:]+):(?:.+)\]$)((?:.+:)?!?)?(.*)$/;function ne(e={}){const h=e.prefix??"un-",r=e.prefixedOnly??!1,g=e.trueToNonValued??!1;let c;return{name:"attributify",match(a,{generator:$}){var _,n;const o=U(a);if(!o)return;let t=o[1];if(t.startsWith(h))t=t.slice(h.length);else if(r)return;const i=o[2],[,x="",p=i]=i.match(j)||[];if(p==="~"||g&&p==="true"||!p)return`${x}${t}`;if(c==null){const l=(n=(_=$==null?void 0:$.config)==null?void 0:_.separators)==null?void 0:n.join("|");l?c=new RegExp(`^(.*\\](?:${l}))(\\[[^\\]]+?\\])$`):c=!1}if(c){const[,l,u]=i.match(c)||[];if(u)return`${l}${x}${t}-${u}`}return`${x}${t}-${p}`}}}const ce=/(<\w[\w:\.$-]*\s)((?:'[^>]*?'|"[^>]*?"|`[^>]*?`|\{[^>]*?\}|[^>]*?)*)/g,oe=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-]+)(?:=("[^"]*|'[^']*))?/g,O=/[\s'"`;>]+/;function ie(e){return{name:"attributify",extract:({content:h,cursor:r})=>{const g=h.matchAll(ce);let c,a=0;for(const f of g){const[,v,y]=f,b=f.index+v.length;if(r>b&&r<=b+y.length){a=b,c=y;break}}if(!c)return null;const $=c.matchAll(oe);let o=0,t,i;for(const f of $){const[v,y,b]=f,E=a+f.index;if(r>E&&r<=E+v.length){o=E,t=y,i=b==null?void 0:b.slice(1);break}}if(!t||t==="class"||t==="className"||t===":class")return null;const x=!!(e!=null&&e.prefix)&&t.startsWith(e.prefix);if(e!=null&&e.prefixedOnly&&!x)return null;const p=x?t.slice(e.prefix.length):t;if(i===void 0)return{extracted:p,resolveReplacement(f){const v=x?e.prefix.length:0;return{start:o+v,end:o+t.length,replacement:f}}};const _=o+t.length+2;let n=O.exec(i),l=0,u;for(;n;){const[f]=n;if(r>_+l&&r<=_+l+n.index){u=i.slice(l,l+n.index);break}l+=n.index+f.length,n=O.exec(i.slice(l))}u===void 0&&(u=i.slice(l));const[,d="",V]=u.match(j)||[];return{extracted:`${d}${p}-${V}`,transformSuggestions(f){return f.filter(v=>v.startsWith(`${d}${p}-`)).map(v=>d+v.slice(d.length+p.length+1))},resolveReplacement(f){return{start:l+_,end:l+_+u.length,replacement:d+f.slice(d.length+p.length+1)}}}}}}const ue=["v-bind:",":"],T=/[\s'"`;]+/g,de=/<[^>\s]*\s((?:'.*?'|".*?"|`.*?`|\{.*?\}|[^>]*?)*)/g,fe=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-.~<]+)=?(?:["]([^"]*)["]|[']([^']*)[']|[{]([^}]*)[}])?/gms,D=["placeholder","fill","opacity","stroke-opacity"];function me(e){const h=(e==null?void 0:e.ignoreAttributes)??D,r=(e==null?void 0:e.nonValuedAttribute)??!0,g=(e==null?void 0:e.trueToNonValued)??!1;return{name:"@unocss/preset-attributify/extractor",extract({code:c}){return Array.from(c.matchAll(de)).flatMap(a=>Array.from((a[1]||"").matchAll(fe))).flatMap(([,a,...$])=>{const o=$.filter(Boolean).join("");if(h.includes(a))return[];for(const t of ue)if(a.startsWith(t)){a=a.slice(t.length);break}if(!o){if(N(a)&&r!==!1){const t=[`[${a}=""]`];return g&&t.push(`[${a}="true"]`),t}return[]}return["class","className"].includes(a)?o.split(T).filter(N):e!=null&&e.prefixedOnly&&e.prefix&&!a.startsWith(e.prefix)?[]:o.split(T).filter(t=>!!t&&t!==":").map(t=>`[${a}~="${t}"]`)})}}}const he=(e={})=>{e.strict=e.strict??!1,e.prefix=e.prefix??"un-",e.prefixedOnly=e.prefixedOnly??!1,e.nonValuedAttribute=e.nonValuedAttribute??!0,e.ignoreAttributes=e.ignoreAttributes??D;const h=[ne(e)],r=[me(e)],g=[ie(e)];return{name:"@unocss/preset-attributify",enforce:"post",variants:h,extractors:r,options:e,autocomplete:{extractors:g},extractorDefault:e.strict?!1:void 0}},_e={key:0,"h-full":"","of-hidden":"",flex:"","flex-col":""},xe={p:"4",grid:"~ cols-4 gap-4"},pe=m("div",{op50:""}," Module ",-1),ye=m("div",{"i-carbon-launch":""},null,-1),ve=m("div",{op50:""}," Matched Rules ",-1),be=m("div",{op50:""}," CSS Size ",-1),ge=m("span",{op50:""},"gzipped",-1),$e={key:0,"row-span-3":""},Ae=m("div",{op50:""}," Potentially Unmatched ",-1),Ve={key:0,"h-full":"","of-hidden":""},ke=W({__name:"ModuleInfo",props:{id:{}},setup(e){const h=e,{data:r}=Z(q(h,"id")),g=h.id.split(/\./g).pop(),c=R(null),a=G(c,"module-scrolls");function $(){fetch(`/__open-in-editor?file=${encodeURIComponent(h.id)}`)}const{extractors:o}=he({strict:!0}),t=H(async()=>{var n;const _=new Set;if(o){const l={code:((n=r.value)==null?void 0:n.code)||""};for(const u of o){const d=await u.extract(l);d==null||d.forEach(V=>_.add(V))}}return Array.from(_).filter(l=>!l.startsWith("[")).filter(l=>{var u,d;return!((d=(u=r.value)==null?void 0:u.matched)!=null&&d.some(({rawSelector:V})=>V===l))})}),i=R(!1),x=R("source"),p=K(J(()=>{var _;return(_=r.value)==null?void 0:_.css}),i);return(_,n)=>{const l=te,u=re,d=L,V=le,f=se,v=Q;return s(r)?(S(),P("div",_e,[A(d,{ref_key:"status",ref:c,p0:""},{default:k(()=>{var y;return[m("div",xe,[m("div",null,[pe,m("a",{"cursor-pointer":"",op80:"","hover:op100":"",onClick:$},[A(l,{id:s(r).id,"mr-1":""},null,8,["id"]),ye])]),m("div",null,[ve,w(" "+C(s(r).matched.length),1)]),m("div",null,[be,w(" "+C(((((y=s(r))==null?void 0:y.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),ge]),s(t).length?(S(),P("div",$e,[Ae,m("code",null,C(s(t).join(", ")),1)])):z("",!0)]),A(u,{modelValue:s(x),"onUpdate:modelValue":n[0]||(n[0]=b=>M(x)?x.value=b:null)},null,8,["modelValue"])]}),_:1},512),s(x)==="source"?(S(),P("div",Ve,[A(s(ee),null,{default:k(()=>[A(s(B),{size:"50"},{default:k(()=>{var y;return[A(V,{"h-full":"","model-value":s(r).code,"read-only":!0,mode:s(g),matched:(y=s(r).matched)==null?void 0:y.map(({rawSelector:b})=>b),class:"scrolls module-scrolls",style:F(s(a))},null,8,["model-value","mode","matched","style"])]}),_:1}),A(s(B),{size:"50"},{default:k(()=>[m("div",null,[A(f,{border:"l b gray-400/20",title:"Output CSS"},{default:k(()=>[m("label",null,[X(m("input",{"onUpdate:modelValue":n[1]||(n[1]=y=>M(i)?i.value=y:null),type:"checkbox"},null,512),[[Y,s(i)]]),w(" Prettify ")])]),_:1}),A(V,{"h-full":"",border:"l main","model-value":s(p),"read-only":!0,mode:"css",class:"scrolls module-scrolls",style:F(s(a))},null,8,["model-value","style"])])]),_:1})]),_:1})])):(S(),I(v,{key:1,"flex-grow":"","overflow-y-auto":"",selectors:s(r).matched,colors:s(r).colors},null,8,["selectors","colors"]))])):z("",!0)}}}),Ee=W({__name:"[id]",setup(e){const h=ae();return(r,g)=>{const c=ke;return S(),I(c,{id:s(h).params.id},null,8,["id"])}}});export{Ee as default};