@unocss/inspector 0.14.3 → 0.15.3

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{d as g,J as C,K as k,i as s,a as p,c as x,l as _,m as M,b as o,p as y,t as m,k as S,v as $,q as w}from"./vendor.10d74678.js";import{i as A,c as B,d as R,_ as V,a as z}from"./index.cccfc7f2.js";const E=["v-bind:",":"],b=/[\s'"`;]+/g,F=/<\w[\w:\.$-]*\s((?:'[\s\S]*?'|"[\s\S]*?"|`[\s\S]*?`|\{[\s\S]*?\}|[\s\S]*?)*?)>/g,N=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-]+)(?:=(["'])([^\2]*?)\2)?/g,j=r=>({name:"attributify",extract({code:c}){const t=Array.from(c.matchAll(F)).flatMap(e=>Array.from((e[1]||"").matchAll(N))).flatMap(([,e,i,d])=>{var l;if((l=r==null?void 0:r.ignoreAttributes)==null?void 0:l.includes(e))return[];for(const n of E)if(e.startsWith(n)){e=e.slice(n.length);break}return d?["class","className"].includes(e)?d.split(b).filter(A):d.split(b).filter(Boolean).map(n=>`[${e}~="${n}"]`):A(e)&&(r==null?void 0:r.nonValuedAttribute)!==!1?[`[${e}=""]`]:[]});return new Set(t)}}),I={key:0,"h-full":"",grid:"~ rows-[max-content,1fr]","of-hidden":""},K=o("div",{op50:""}," Module ",-1),P=o("div",{"i-carbon-launch":""},null,-1),U=o("div",{op50:""}," Matched Rules ",-1),W=o("div",{op50:""}," CSS Size ",-1),q=o("span",{op50:""},"gzipped",-1),D={key:0,"row-span-3":""},J=o("div",{op50:""}," Potentially Unmatched ",-1),T={"h-full":"","of-hidden":"",grid:"","grid-cols-2":""},Z=g({props:{id:null},setup(r){const c=r,{data:t}=B(C(c,"id")),e=c.id.split(/\./g).pop();function i(){fetch(`/__open-in-editor?file=${encodeURIComponent(c.id)}`)}const d=j({strict:!0}),l=k(async()=>{var f;const n=await d.extract({code:((f=t.value)==null?void 0:f.code)||""})||[];return Array.from(n).filter(a=>!a.startsWith("[")).filter(a=>{var u;return!((u=t.value)==null?void 0:u.matched.includes(a))})});return(n,f)=>{const a=R,u=V,h=z;return s(t)?(p(),x("div",I,[_(u,{grid:"~ cols-3 gap-4"},{default:M(()=>{var v;return[o("div",null,[K,o("a",{"cursor-pointer":"",op80:"","hover:op100":"",onClick:i},[_(a,{id:s(t).id,"mr-1":""},null,8,["id"]),P])]),o("div",null,[U,y(" "+m(s(t).matched.length),1)]),o("div",null,[W,y(" "+m(((((v=s(t))==null?void 0:v.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),q]),s(l).length?(p(),x("div",D,[J,o("code",null,m(s(l).join(", ")),1)])):S("",!0)]}),_:1}),o("div",T,[_(h,{"h-full":"","model-value":s(t).code,"read-only":!0,mode:s(e),matched:s(t).matched},null,8,["model-value","mode","matched"]),_(h,{"h-full":"",b:"l main","model-value":s(t).css,"read-only":!0,mode:"css"},null,8,["model-value"])])])):S("",!0)}}}),L=g({setup(r){const c=$();return(t,e)=>{const i=Z;return p(),w(i,{id:s(c).params.id},null,8,["id"])}}});export{L as default};
@@ -0,0 +1,3 @@
1
+ var ue=Object.defineProperty,pe=Object.defineProperties;var _e=Object.getOwnPropertyDescriptors;var Z=Object.getOwnPropertySymbols;var he=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;var J=(e,n,t)=>n in e?ue(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,S=(e,n)=>{for(var t in n||(n={}))he.call(n,t)&&J(e,t,n[t]);if(Z)for(var t of Z(n))me.call(n,t)&&J(e,t,n[t]);return e},Q=(e,n)=>pe(e,_e(n));import{C as fe,w as X,d as y,r as ve,u as ge,o as ye,n as xe,a as d,c as p,b as r,e as ke,f as Y,g as w,h as b,i as l,j as be,F,t as _,k as E,l as h,m as x,p as g,q as $,s as V,v as $e,x as R,y as ee,z as we,A as Ee,B as L,D as Re,E as Ce,G as je}from"./vendor.10d74678.js";const Oe=function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))o(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&o(c)}).observe(document,{childList:!0,subtree:!0});function t(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerpolicy&&(i.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?i.credentials="include":s.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(s){if(s.ep)return;s.ep=!0;const i=t(s);fetch(s.href,i)}};Oe();const Se="modulepreload",te={},Fe="/__unocss/",M=function(n,t){return!t||t.length===0?n():Promise.all(t.map(o=>{if(o=`${Fe}${o}`,o in te)return;te[o]=!0;const s=o.endsWith(".css"),i=s?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${o}"]${i}`))return;const c=document.createElement("link");if(c.rel=s?"stylesheet":Se,s||(c.as="script",c.crossOrigin=""),c.href=o,document.head.appendChild(c),s)return new Promise((a,m)=>{c.addEventListener("load",a),c.addEventListener("error",m)})})).then(()=>n())};function oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Ve=/^\[(.+?)~?="(.*)"\]$/,Le=/(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-?]/;function Me(e){return e.match(Ve)}function Ut(e=""){return Le.test(e)}function Pe(e,n){const t=[],o=[],s=new Set;Array.from(n).forEach(c=>{const a=Me(c);a?a[2]?o.push(a):s.add(a[1]):s.add(c)});let i=0;return e.split(/[\s"';<>]/g).forEach(c=>{const a=i+c.length;s.has(c)&&t.push([i,a,c]),i=a+1}),o.forEach(([,c,a])=>{const m=new RegExp(`${oe(c)}=(['"])[^\\1]*?${oe(a)}[^\\1]*?\\1`,"g");Array.from(e.matchAll(m)).forEach(v=>{const f=v.index+v[0].indexOf(a),k=f+a.length;t.push([f,k,`[${c}="${a}"]`])})}),t}function Ie(e,n,t={}){const o=fe.fromTextArea(e.value,S({theme:"vars"},t));let s=!1;return o.on("change",()=>{if(s){s=!1;return}n.value=o.getValue()}),X(n,i=>{if(i!==o.getValue()){s=!0;const c=o.listSelections();o.replaceRange(i,o.posFromIndex(0),o.posFromIndex(1/0)),o.setSelections(c)}},{immediate:!0}),o}const Te={relative:"","font-mono":"","overflow-auto":"","text-sm":""},Ae=y({props:{modelValue:null,mode:null,readOnly:{type:Boolean},matched:null},setup(e,{emit:n}){const t=e,o={html:"htmlmixed",vue:"htmlmixed",js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript"},s=ve(),i=ge(t,"modelValue",n,{passive:!0});return ye(async()=>{const c=Ie(s,i,Q(S({},t),{mode:o[t.mode||""]||t.mode}));c.setSize("100%","100%"),setTimeout(()=>c.refresh(),100);const a=[];function m(f,k){a.push(c.markText(c.posFromIndex(f),c.posFromIndex(k),{className:"highlighted"}))}function v(){a.forEach(f=>f.clear()),Pe(t.modelValue,Array.from(t.matched||[])).forEach(f=>m(...f))}X(()=>[t.modelValue,t.matched],async()=>{await xe(),t.matched&&v()},{immediate:!0})}),(c,a)=>(d(),p("div",Te,[r("textarea",{ref:(m,v)=>{v.el=m,s.value=m}},null,512)]))}});var ne=(e,n)=>{const t=e.__vccOpts||e;for(const[o,s]of n)t[o]=s;return t};const De={},Ne={"bg-gray4:10":"","p-5":"",b:"b main",text:"sm gray5 dark:gray3"};function ze(e,n){return d(),p("div",Ne,[ke(e.$slots,"default")])}var Be=ne(De,[["render",ze]]);const Ue="/@vite/client",se=Y(),re=Y(),We=se.on,ce=re.on;M(()=>import(Ue),[]).then(e=>{const n=e.createHotContext("/");n.on("vite:beforeUpdate",t=>{t.updates.forEach(o=>{se.trigger(o)})}),n.on("unocss:config-changed",()=>{re.trigger()})}).catch(e=>{console.error("failed to connect to client vite server, you might need to do manual refresh to see the updates"),console.error(e)});const C="/__unocss_api",ie=w(C).json(),P=w(`${C}/overview`,{immediate:!1}).json(),u=ie.data,j=P.data;ce(()=>{ie.execute(),P.execute()});function Wt(e){const n=w(b(()=>`${C}/module?id=${encodeURIComponent(l(e))}`),{refetch:!0}).json();return ce(()=>n.execute()),We(t=>{var o;(t.path===l(e)||t.path===l(e).slice(((o=u.value)==null?void 0:o.root.length)||0))&&setTimeout(()=>{n.execute()},50)}),n}function Ht(e){const n=be(e,500);return w(b(()=>`${C}/repl?token=${encodeURIComponent(n.value)}`),{refetch:!0}).json()}const O=b(()=>{if(!u.value)return{workspace:{children:{},items:[]},root:{children:{},items:[]}};const e=u.value.modules.map(o=>({full:o,path:o})),n=e.filter(o=>o.full.startsWith(u.value.root)),t=e.filter(o=>!o.full.startsWith(u.value.root));return n.forEach(o=>o.path=o.path.slice(u.value.root.length+1)),{workspace:ae(n,"Project Root"),root:ae(t,"Disk Root")}});function ae(e,n){const t={name:n,children:{},items:[]};function o(s,i,c=t){if(i.length<=1){c.items.push(s);return}const a=i.shift();c.children[a]||(c.children[a]={name:a,children:{},items:[]}),o(s,i,c.children[a])}return e.forEach(s=>{const i=s.path.split(/\//g).filter(Boolean);o(s,i)}),t}const He={key:0,"ws-wrap":""},qe=r("span",{op80:""},".",-1),Ke={key:1},Ge=y({props:{id:null},setup(e){return(n,t)=>e.id&&l(u)?(d(),p("span",He,[e.id.startsWith(l(u).root)?(d(),p(F,{key:0},[qe,r("span",null,_(e.id.slice(l(u).root.length)),1)],64)):(d(),p("span",Ke,_(e.id),1))])):E("",!0)}}),Ze={"h-full":"",grid:"~ rows-[max-content,1fr]"},Je={p4:"",grid:"~ cols-4 gap-4"},Qe=r("div",{op80:""}," Presets ",-1),Xe={op50:"","ws-pre":""},Ye={overflow:"auto"},et=r("div",{op80:""}," Rules ",-1),tt=r("span",{op50:""},"dynamic",-1),ot=r("br",null,null,-1),nt=r("span",{op50:""},"static",-1),st=r("div",{op80:""}," Variants ",-1),rt=r("div",{op80:""}," Shortcuts ",-1),ct={key:0},it=r("div",{op80:""}," Config File ",-1),at=r("div",{op80:""}," Version ",-1),lt={op50:"","ws-pre":""},dt={b:"t main",p4:"",grid:"~ cols-4 gap-4"},ut=r("div",{op80:""}," Included Files ",-1),pt=r("div",{op80:""}," CSS Size ",-1),_t=r("span",{op50:""},"gzipped",-1),ht=r("div",{op80:""}," Matched Rules ",-1),mt=r("div",{op80:""}," Layers ",-1),ft={op50:"","ws-pre":""},vt=y({setup(e){return P.execute(),(n,t)=>{var c;const o=Ge,s=Be,i=Ae;return d(),p("div",Ze,[h(s,{p0:""},{default:x(()=>{var a,m,v,f,k,I,T,A,D,N,z,B,U,W,H,q,K,G;return[r("div",Je,[r("div",null,[Qe,r("div",Xe,_((v=(m=(a=l(u))==null?void 0:a.config)==null?void 0:m.presets)==null?void 0:v.map(de=>de.name).join(`
2
+ `)),1)]),r("div",Ye,[et,g(" "+_((I=(k=(f=l(u))==null?void 0:f.config)==null?void 0:k.rulesDynamic)==null?void 0:I.length)+" ",1),tt,ot,g(" "+_(Object.keys(((A=(T=l(u))==null?void 0:T.config)==null?void 0:A.rulesStaticMap)||{}).length)+" ",1),nt]),r("div",null,[st,g(" "+_((z=(N=(D=l(u))==null?void 0:D.config)==null?void 0:N.variants)==null?void 0:z.length),1)]),r("div",null,[rt,g(" "+_((B=l(u))==null?void 0:B.config.shortcuts.length),1)]),((U=l(u))==null?void 0:U.configPath)?(d(),p("div",ct,[it,h(o,{id:l(u).configPath},null,8,["id"])])):E("",!0),r("div",null,[at,r("div",lt,_((W=l(u))==null?void 0:W.version),1)])]),r("div",dt,[r("div",null,[ut,g(" "+_((H=l(u))==null?void 0:H.modules.length),1)]),r("div",null,[pt,g(" "+_(((((q=l(j))==null?void 0:q.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),_t]),r("div",null,[ht,g(" "+_((K=l(j))==null?void 0:K.matched.length),1)]),r("div",null,[mt,r("div",ft,_((G=l(j))==null?void 0:G.layers.join(`
3
+ `)),1)])])]}),_:1}),h(i,{"h-full":"","model-value":((c=l(j))==null?void 0:c.css)||"/* empty */","read-only":!0,mode:"css"},null,8,["model-value"])])}}}),gt={};function yt(e,n){const t=vt;return d(),$(t)}var xt=ne(gt,[["render",yt]]);const kt=[{name:"index",path:"/",component:xt,props:!0},{name:"repl",path:"/repl",component:()=>M(()=>import("./repl.27639657.js"),["assets/repl.27639657.js","assets/repl.bafd2276.css","assets/vendor.10d74678.js"]),props:!0},{name:"module-id",path:"/module/:id",component:()=>M(()=>import("./[id].bdb23977.js"),["assets/[id].bdb23977.js","assets/[id].e876e72e.css","assets/vendor.10d74678.js"]),props:!0}],bt=y({props:{id:null},setup(e){const n=e,t=b(()=>n.id.split(/\./g).pop()),o=b(()=>{switch(t.value){case"vue":return"i-logos-vue";default:return"i-carbon-document-blank"}});return(s,i)=>(d(),p("div",{class:V(l(o))},null,2))}}),$t={open:""},wt={"cursor-default":"","select-none":"","text-sm":"",truncate:"",p:"y1"},Et={"ml-1":""},Rt=y({props:{node:null,icon:{default:"i-carbon-folder"}},setup(e){const n=$e();return(t,o)=>{const s=R("ModuleTreeNode",!0),i=bt,c=R("RouterLink");return d(),p("details",$t,[r("summary",wt,[r("div",{class:V(e.icon)},null,2),g(" "+_(e.node.name),1)]),(d(!0),p(F,null,ee(Object.entries(e.node.children),a=>(d(),$(s,{key:a[0],ml2:"",node:a[1]},null,8,["node"]))),128)),(d(!0),p(F,null,ee(e.node.items,a=>(d(),p("div",{key:a.full,ml4:"",truncate:""},[h(c,{block:"","text-sm":"",p:"x2 y1",rounded:"",to:`/module/${encodeURIComponent(a.full)}`,class:V({"bg-gray/10":a.full===l(n).params.id})},{default:x(()=>[h(i,{id:a.path},null,8,["id"]),r("span",Et,_(a.path.split("/").pop()),1)]),_:2},1032,["to","class"])]))),128))])}}});var Ct="/__unocss/icon.svg";const jt={p:"x4 y3",b:"b main",flex:"","children:my-auto":""},Ot=r("div",{flex:"","flex-auto":"","children:my-auto":"","ws-nowrap":""},[r("img",{src:Ct,filter:"","dark:invert":"","inline-block":"",h:"1.3em",m:"r-1.5"}),r("div",{"of-hidden":""},[g(" Inspector "),r("sup",{"text-teal5":"","bg-teal5:10":"",p:"x1.5 y0.5",rounded:"",italic:""},"beta")])],-1),St=y({setup(e){const n=we(),t=Ee(n);return(o,s)=>(d(),p("nav",jt,[Ot,r("button",{"text-lg":"","i-carbon-sun":"","dark:i-carbon-moon":"",onClick:s[0]||(s[0]=i=>l(t)())})]))}}),Ft={"h-full":"",grid:"~ rows-[max-content,1fr]",b:"r main","of-hidden":""},Vt={overflow:"auto",p:"y4",flex:"~ col gap-3"},Lt=r("div",{"i-carbon-dashboard":""},null,-1),Mt=r("span",null," Overview ",-1),Pt=r("div",{"i-carbon-terminal":""},null,-1),It=r("span",null," REPL ",-1),Tt=r("div",{b:"b main"},null,-1),At=y({setup(e){return(n,t)=>{const o=St,s=R("RouterLink"),i=Rt;return d(),p("div",Ft,[h(o),r("div",Vt,[h(s,{block:"",to:"/","text-sm":"",m:"l-3.7"},{default:x(()=>[Lt,Mt]),_:1}),h(s,{block:"",to:"/repl","text-sm":"",m:"l-3.7"},{default:x(()=>[Pt,It]),_:1}),Tt,Object.keys(l(O).workspace.children).length?(d(),$(i,{key:0,node:l(O).workspace,pl3:"",icon:"i-carbon-portfolio"},null,8,["node"])):E("",!0),Object.keys(l(O).root.children).length?(d(),$(i,{key:1,node:l(O).root,pl3:"",icon:"i-carbon-vmdk-disk"},null,8,["node"])):E("",!0)])])}}}),Dt={"h-full":"","of-hidden":""},Nt=y({setup(e){return(n,t)=>{const o=At,s=R("RouterView");return d(),$(l(L.exports.Splitpanes),{"h-full":"",flex:""},{default:x(()=>[h(l(L.exports.Pane),{size:"15","push-other-panes":!1},{default:x(()=>[h(o)]),_:1}),h(l(L.exports.Pane),{size:"85"},{default:x(()=>[r("div",Dt,[h(s)])]),_:1})]),_:1})}}}),le=Re(Nt);le.use(Ce({history:je(),routes:kt}));le.mount("#app");export{Be as _,Ae as a,ne as b,Wt as c,Ge as d,Ht as f,Ut as i};
@@ -1,3 +1,3 @@
1
- import{d as m,H as f,a as c,c as p,l as t,m as h,b as n,i as s,I as v,q as g}from"./vendor.6dcf7589.js";import{f as x,_ as y,a as b,b as B}from"./index.d3ee7df2.js";const V={"h-full":"",grid:"~ rows-[max-content,1fr]","of-hidden":""},C=n("div",null," REPL Playground ",-1),R=n("div",{op60:""}," Edit your code below to test and play UnoCSS's matching and generating. ",-1),S={"h-full":"","of-hidden":"",grid:"","grid-cols-2":""},k=m({setup(i){const e=f("unocss:inspector:repl",`<div class="text-sm hover:text-red">
1
+ import{d as m,H as f,a as r,c as p,l as t,m as h,b as n,i as s,I as v,q as g}from"./vendor.10d74678.js";import{f as x,_ as y,a as b,b as B}from"./index.cccfc7f2.js";const V={"h-full":"",grid:"~ rows-[max-content,1fr]","of-hidden":""},C=n("div",null," REPL Playground ",-1),R=n("div",{op60:""}," Edit your code below to test and play UnoCSS's matching and generating. ",-1),S={"h-full":"","of-hidden":"",grid:"","grid-cols-2":""},k=m({setup(i){const e=f("unocss:inspector:repl",`<div class="text-sm hover:text-red">
2
2
  Hello World
3
- </div>`),{data:o}=x(e);return(P,a)=>{var d,r;const u=y,l=b;return c(),p("div",V,[t(u,null,{default:h(()=>[C,R]),_:1}),n("div",S,[t(l,{modelValue:s(e),"onUpdate:modelValue":a[0]||(a[0]=_=>v(e)?e.value=_:null),"h-full":"",mode:"html",matched:((d=s(o))==null?void 0:d.matched)||[]},null,8,["modelValue","matched"]),t(l,{"h-full":"","b-l":"","b-main":"","model-value":((r=s(o))==null?void 0:r.css)||"/* empty */","read-only":!0,mode:"css"},null,8,["model-value"])])])}}}),w={};function E(i,e){const o=k;return c(),g(o)}var N=B(w,[["render",E]]);export{N as default};
3
+ </div>`),{data:o}=x(e);return(P,a)=>{var d,c;const u=y,l=b;return r(),p("div",V,[t(u,null,{default:h(()=>[C,R]),_:1}),n("div",S,[t(l,{modelValue:s(e),"onUpdate:modelValue":a[0]||(a[0]=_=>v(e)?e.value=_:null),"h-full":"",mode:"html",matched:((d=s(o))==null?void 0:d.matched)||[]},null,8,["modelValue","matched"]),t(l,{"h-full":"","b-l":"","b-main":"","model-value":((c=s(o))==null?void 0:c.css)||"/* empty */","read-only":!0,mode:"css"},null,8,["model-value"])])])}}}),w={};function E(i,e){const o=k;return r(),g(o)}var N=B(w,[["render",E]]);export{N as default};