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