@unocss/inspector 0.16.1 → 0.17.2

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.
@@ -8,9 +8,9 @@
8
8
  <link rel="preconnect" href="https://fonts.googleapis.com" />
9
9
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10
10
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;400&family=Fira+Code&display=swap" rel="stylesheet" />
11
- <script type="module" crossorigin src="/__unocss/assets/index.d18746ae.js"></script>
12
- <link rel="modulepreload" href="/__unocss/assets/vendor.cbb6255c.js">
13
- <link rel="stylesheet" href="/__unocss/assets/index.0faa1eb7.css">
11
+ <script type="module" crossorigin src="/__unocss/assets/index.23ef12af.js"></script>
12
+ <link rel="modulepreload" href="/__unocss/assets/vendor.56204abf.js">
13
+ <link rel="stylesheet" href="/__unocss/assets/index.393afdd6.css">
14
14
  </head>
15
15
  <body>
16
16
  <div id="app"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/inspector",
3
- "version": "0.16.1",
3
+ "version": "0.17.2",
4
4
  "description": "The inspector UI for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -1,3 +0,0 @@
1
- var ue=Object.defineProperty,pe=Object.defineProperties;var _e=Object.getOwnPropertyDescriptors;var G=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,F=(e,n)=>{for(var t in n||(n={}))he.call(n,t)&&J(e,t,n[t]);if(G)for(var t of G(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 x,r as ve,u as ge,o as ye,a as d,c as p,b as r,e as xe,f as Y,g as E,h as k,i as l,j as be,F as V,t as _,k as R,l as h,m as b,n as g,p as $,q as L,s as ke,v as C,x as ee,y as $e,z as we,A as M,B as Ee,D as Re,E as Ce}from"./vendor.cbb6255c.js";const je=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)}};je();const Oe="modulepreload",te={},Se="/__unocss/",P=function(n,t){return!t||t.length===0?n():Promise.all(t.map(o=>{if(o=`${Se}${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":Oe,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 Fe=/^\[(.+?)~?="(.*)"\]$/,Ve=/(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-?]/;function Le(e){return e.match(Fe)}function Bt(e=""){return Ve.test(e)}function Me(e,n){const t=[],o=[],s=new Set;Array.from(n).forEach(c=>{const a=Le(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 y=v.index+v[0].indexOf(a),f=y+a.length;t.push([y,f,`[${c}="${a}"]`])})}),t}function Pe(e,n,t={}){const o=fe.fromTextArea(e.value,F({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":""},Ie=x({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=Pe(s,i,Q(F({},t),{mode:o[t.mode||""]||t.mode}));c.setSize("100%","100%"),setTimeout(()=>c.refresh(),100);const a=[];function m(f,w){a.push(c.markText(c.posFromIndex(f),c.posFromIndex(w),{className:"highlighted"}))}function v(){a.forEach(f=>f.clear()),Me(t.modelValue,Array.from(t.matched||[])).forEach(f=>m(f[0],f[1]))}let y=0;X(()=>[t.modelValue,t.matched],async()=>{clearTimeout(y),t.matched&&(y=setTimeout(v,100))},{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 Ae={},De={"bg-gray4:10":"","p-5":"",b:"b main",text:"sm gray5 dark:gray3"};function Ne(e,n){return d(),p("div",De,[xe(e.$slots,"default")])}var ze=ne(Ae,[["render",Ne]]);const Be="/@vite/client",se=Y(),re=Y(),Ue=se.on,ce=re.on;P(()=>import(Be),[]).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 j="/__unocss_api",ie=E(j).json(),T=E(`${j}/overview`,{immediate:!1}).json(),u=ie.data,O=T.data;ce(()=>{ie.execute(),T.execute()});function Ut(e){const n=E(k(()=>`${j}/module?id=${encodeURIComponent(l(e))}`),{refetch:!0}).json();return ce(()=>n.execute()),Ue(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 Wt(e){const n=be(e,500);return E(k(()=>`${j}/repl?token=${encodeURIComponent(n.value)}`),{refetch:!0}).json()}const S=k(()=>{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 We={key:0,"ws-wrap":""},He=r("span",{op80:""},".",-1),qe={key:1},Ke=x({props:{id:null},setup(e){return(n,t)=>e.id&&l(u)?(d(),p("span",We,[e.id.startsWith(l(u).root)?(d(),p(V,{key:0},[He,r("span",null,_(e.id.slice(l(u).root.length)),1)],64)):(d(),p("span",qe,_(e.id),1))])):R("",!0)}}),Ze={"h-full":"",grid:"~ rows-[max-content,1fr]"},Ge={p4:"",grid:"~ cols-4 gap-4"},Je=r("div",{op80:""}," Presets ",-1),Qe={op50:"","ws-pre":""},Xe={overflow:"auto"},Ye=r("div",{op80:""}," Rules ",-1),et=r("span",{op50:""},"dynamic",-1),tt=r("br",null,null,-1),ot=r("span",{op50:""},"static",-1),nt=r("div",{op80:""}," Variants ",-1),st=r("div",{op80:""}," Shortcuts ",-1),rt={key:0},ct=r("div",{op80:""}," Config File ",-1),it=r("div",{op80:""}," Version ",-1),at={op50:"","ws-pre":""},lt={b:"t main",p4:"",grid:"~ cols-4 gap-4"},dt=r("div",{op80:""}," Included Files ",-1),ut=r("div",{op80:""}," CSS Size ",-1),pt=r("span",{op50:""},"gzipped",-1),_t=r("div",{op80:""}," Matched Rules ",-1),ht=r("div",{op80:""}," Layers ",-1),mt={op50:"","ws-pre":""},ft=x({setup(e){return T.execute(),(n,t)=>{var c;const o=Ke,s=ze,i=Ie;return d(),p("div",Ze,[h(s,{p0:""},{default:b(()=>{var a,m,v,y,f,w,I,A,D,N,z,B,U,W,H,q,K,Z;return[r("div",Ge,[r("div",null,[Je,r("div",Qe,_((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",Xe,[Ye,g(" "+_((w=(f=(y=l(u))==null?void 0:y.config)==null?void 0:f.rulesDynamic)==null?void 0:w.length)+" ",1),et,tt,g(" "+_(Object.keys(((A=(I=l(u))==null?void 0:I.config)==null?void 0:A.rulesStaticMap)||{}).length)+" ",1),ot]),r("div",null,[nt,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,[st,g(" "+_((B=l(u))==null?void 0:B.config.shortcuts.length),1)]),((U=l(u))==null?void 0:U.configPath)?(d(),p("div",rt,[ct,h(o,{id:l(u).configPath},null,8,["id"])])):R("",!0),r("div",null,[it,r("div",at,_((W=l(u))==null?void 0:W.version),1)])]),r("div",lt,[r("div",null,[dt,g(" "+_((H=l(u))==null?void 0:H.modules.length),1)]),r("div",null,[ut,g(" "+_(((((q=l(O))==null?void 0:q.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),pt]),r("div",null,[_t,g(" "+_((K=l(O))==null?void 0:K.matched.length),1)]),r("div",null,[ht,r("div",mt,_((Z=l(O))==null?void 0:Z.layers.join(`
3
- `)),1)])])]}),_:1}),h(i,{"h-full":"","model-value":((c=l(O))==null?void 0:c.css)||"/* empty */","read-only":!0,mode:"css"},null,8,["model-value"])])}}}),vt={};function gt(e,n){const t=ft;return d(),$(t)}var yt=ne(vt,[["render",gt]]);const xt=[{name:"index",path:"/",component:yt,props:!0},{name:"repl",path:"/repl",component:()=>P(()=>import("./repl.7fe75be7.js"),["assets/repl.7fe75be7.js","assets/repl.93895690.css","assets/vendor.cbb6255c.js"]),props:!0},{name:"module-id",path:"/module/:id",component:()=>P(()=>import("./_id_.8035d466.js"),["assets/_id_.8035d466.js","assets/_id_.afc768e5.css","assets/vendor.cbb6255c.js"]),props:!0}],bt=x({props:{id:null},setup(e){const n=e,t=k(()=>n.id.split(/\./g).pop()),o=k(()=>{switch(t.value){case"vue":return"i-logos-vue";default:return"i-carbon-document-blank"}});return(s,i)=>(d(),p("div",{class:L(l(o))},null,2))}}),kt={open:""},$t={"cursor-default":"","select-none":"","text-sm":"",truncate:"",p:"y1"},wt={"ml-1":""},Et=x({props:{node:null,icon:{default:"i-carbon-folder"}},setup(e){const n=ke();return(t,o)=>{const s=C("ModuleTreeNode",!0),i=bt,c=C("RouterLink");return d(),p("details",kt,[r("summary",$t,[r("div",{class:L(e.icon)},null,2),g(" "+_(e.node.name),1)]),(d(!0),p(V,null,ee(Object.entries(e.node.children),a=>(d(),$(s,{key:a[0],ml2:"",node:a[1]},null,8,["node"]))),128)),(d(!0),p(V,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:L({"bg-gray/10":a.full===l(n).params.id})},{default:b(()=>[h(i,{id:a.path},null,8,["id"]),r("span",wt,_(a.path.split("/").pop()),1)]),_:2},1032,["to","class"])]))),128))])}}});var Rt="/__unocss/icon.svg";const Ct={p:"x4 y3",b:"b main",flex:"","children:my-auto":""},jt=r("div",{flex:"","flex-auto":"","children:my-auto":"","ws-nowrap":""},[r("img",{src:Rt,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),Ot=x({setup(e){const n=$e(),t=we(n);return(o,s)=>(d(),p("nav",Ct,[jt,r("button",{"text-lg":"","i-carbon-sun":"","dark:i-carbon-moon":"",onClick:s[0]||(s[0]=i=>l(t)())})]))}}),St={"h-full":"",grid:"~ rows-[max-content,1fr]",b:"r main","of-hidden":""},Ft={overflow:"auto",p:"y4",flex:"~ col gap-3"},Vt=r("div",{"i-carbon-dashboard":""},null,-1),Lt=r("span",null," Overview ",-1),Mt=r("div",{"i-carbon-terminal":""},null,-1),Pt=r("span",null," REPL ",-1),Tt=r("div",{b:"b main"},null,-1),It=x({setup(e){return(n,t)=>{const o=Ot,s=C("RouterLink"),i=Et;return d(),p("div",St,[h(o),r("div",Ft,[h(s,{block:"",to:"/","text-sm":"",m:"l-3.7"},{default:b(()=>[Vt,Lt]),_:1}),h(s,{block:"",to:"/repl","text-sm":"",m:"l-3.7"},{default:b(()=>[Mt,Pt]),_:1}),Tt,Object.keys(l(S).workspace.children).length?(d(),$(i,{key:0,node:l(S).workspace,pl3:"",icon:"i-carbon-portfolio"},null,8,["node"])):R("",!0),Object.keys(l(S).root.children).length?(d(),$(i,{key:1,node:l(S).root,pl3:"",icon:"i-carbon-vmdk-disk"},null,8,["node"])):R("",!0)])])}}}),At={"h-full":"","of-hidden":""},Dt=x({setup(e){return(n,t)=>{const o=It,s=C("RouterView");return d(),$(l(M.exports.Splitpanes),{"h-full":"",flex:""},{default:b(()=>[h(l(M.exports.Pane),{size:"15","push-other-panes":!1},{default:b(()=>[h(o)]),_:1}),h(l(M.exports.Pane),{size:"85"},{default:b(()=>[r("div",At,[h(s)])]),_:1})]),_:1})}}}),le=Ee(Dt);le.use(Re({history:Ce(),routes:xt}));le.mount("#app");export{ze as _,Ie as a,ne as b,Ut as c,Ke as d,Wt as f,Bt as i};