@unocss/inspector 0.50.8 → 0.51.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.
- package/README.md +2 -18
- package/dist/client/assets/_id_-4d45dd08.js +1 -0
- package/dist/client/assets/{index-7d78ddf9.js → index-e95ed3fa.js} +20 -20
- package/dist/client/assets/{repl-66016622.js → repl-12807c6a.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/_id_-16901f97.js +0 -1
package/README.md
CHANGED
|
@@ -2,25 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
The inspector UI for UnoCSS. Ships with `unocss` and `@unocss/vite`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Documentation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
<img src="https://user-images.githubusercontent.com/11247099/140886020-7014f412-f020-4aed-a169-d025cc1bbcd3.png">
|
|
9
|
-
|
|
10
|
-
## TODO
|
|
11
|
-
|
|
12
|
-
- [x] Basic Overview
|
|
13
|
-
- [x] Basic REPL
|
|
14
|
-
- [x] Basic file view
|
|
15
|
-
- [x] Resizeable sidebar (use `splitpanes`, refer to playground)
|
|
16
|
-
- [x] Data caches (move the fetches to shared modules instead of in components)
|
|
17
|
-
- [ ] Manual refresh button
|
|
18
|
-
- [x] Auto reload on file changes (reuse Vite's hmr if possible)
|
|
19
|
-
- [ ] Config view
|
|
20
|
-
- [ ] Edit files directly
|
|
21
|
-
- [x] CSS Prettify
|
|
22
|
-
|
|
23
|
-
> 🙌 Contribution welcome!
|
|
7
|
+
Please refer to the [documentation](https://unocss.dev/tools/inspector).
|
|
24
8
|
|
|
25
9
|
## License
|
|
26
10
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as O,t as k,d as B,x as I,y as W,r as C,u as j,z as D,A as U,B as Z,j as d,c as M,g as b,w as A,e as m,C as N,_ as q,o as R,k as S,D as V,E as P,n as w,h as G,v as K,i as H,M as J,F as L,m as Q,l as X,q as Y,G as tt}from"./index-e95ed3fa.js";const F=/^(?!.*\[(?:[^:]+):(?:.+)\]$)((?:.+:)?!?)?(.*)$/;function et(t={}){const c=t.prefix??"un-",i=t.prefixedOnly??!1,p=t.trueToNonValued??!1;let f;return{name:"attributify",match(v,{generator:e}){var h,u;const s=O(v);if(!s)return;let n=s[1];if(n.startsWith(c))n=n.slice(c.length);else if(i)return;const r=s[2],[,o="",a=r]=r.match(F)||[];if(a==="~"||p&&a==="true"||!a)return`${o}${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`${_}${o}${n}-${l}`}return`${o}${n}-${a}`}}}const lt=/(<\w[\w:\.$-]*\s)((?:'[^>]*?'|"[^>]*?"|`[^>]*?`|\{[^>]*?\}|[^>]*?)*)/g,rt=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-]+)(?:=("[^"]*|'[^']*))?/g,z=/[\s'"`;>]+/,st={name:"attributify",extract:({content:t,cursor:c})=>{const i=t.matchAll(lt);let p,f=0;for(const l of i){const[,x,y]=l,g=l.index+x.length;if(c>g&&c<=g+y.length){f=g,p=y;break}}if(!p)return null;const v=p.matchAll(rt);let e=0,s,n;for(const l of v){const[x,y,g]=l,$=f+l.index;if(c>$&&c<=$+x.length){e=$,s=y,n=g==null?void 0:g.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 o=z.exec(n),a=0,h;for(;o;){const[l]=o;if(c>r+a&&c<=r+a+o.index){h=n.slice(a,a+o.index);break}a+=o.index+l.length,o=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)}}}}},nt=["v-bind:",":"],E=/[\s'"`;]+/g,at=/<[^>\s]*\s((?:'.*?'|".*?"|`.*?`|\{.*?\}|[^>]*?)*)/g,ct=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-.~<]+)=?(?:["]([^"]*)["]|[']([^']*)[']|[{]([^}]*)[}])?/gms,T=["placeholder","fill","opacity"];function ot(t){const c=(t==null?void 0:t.ignoreAttributes)??T,i=(t==null?void 0:t.nonValuedAttribute)??!0,p=(t==null?void 0:t.trueToNonValued)??!1;return{name:"@unocss/preset-attributify/extractor",extract({code:f}){const v=Array.from(f.matchAll(at)).flatMap(e=>Array.from((e[1]||"").matchAll(ct))).flatMap(([,e,...s])=>{const n=s.filter(Boolean).join("");if(c.includes(e))return[];for(const r of nt)if(e.startsWith(r)){e=e.slice(r.length);break}if(!n){if(k(e)&&i!==!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(([,,o])=>o.split(E)).flat();return(r.length?r:n.split(E)).filter(o=>!!o&&o!==":").map(o=>`[${e}~="${o}"]`)}});return new Set(v)}}}function it(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=[et(t)],i=[ot(t)];return{name:"@unocss/preset-attributify",enforce:"post",variants:c,extractors:i,options:t,autocomplete:{extractors:[st]},extractorDefault:t.strict?!1:void 0}}const ut={key:0,"h-full":"","of-hidden":""},dt=m("div",{op50:""}," Module ",-1),ft=m("div",{"i-carbon-launch":""},null,-1),mt=m("div",{op50:""}," Matched Rules ",-1),ht=m("div",{op50:""}," CSS Size ",-1),_t=m("span",{op50:""},"gzipped",-1),pt={key:0,"row-span-3":""},xt=m("div",{op50:""}," Potentially Unmatched ",-1),yt={"h-full":"","of-hidden":""},vt=B({__name:"ModuleInfo",props:{id:null},setup(t){const c=t,{data:i}=I(W(c,"id")),p=c.id.split(/\./g).pop(),f=C(null),v=j(f,"module-scrolls");function e(){fetch(`/__open-in-editor?file=${encodeURIComponent(c.id)}`)}const{extractors:s}=it({strict:!0}),n=D(async()=>{var h;const a=new Set;if(s){const u={code:((h=i.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!((_=i.value)!=null&&_.matched.includes(u))})}),r=C(!1),o=U(Z(()=>{var a;return(a=i.value)==null?void 0:a.css}),r);return(a,h)=>{const u=L,_=q,l=Q,x=X;return d(i)?(R(),M("div",ut,[b(_,{ref_key:"status",ref:f,grid:"~ cols-3 gap-4"},{default:A(()=>{var y;return[m("div",null,[dt,m("a",{"cursor-pointer":"",op80:"","hover:op100":"",onClick:e},[b(u,{id:d(i).id,"mr-1":""},null,8,["id"]),ft])]),m("div",null,[mt,S(" "+V(d(i).matched.length),1)]),m("div",null,[ht,S(" "+V(((((y=d(i))==null?void 0:y.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),_t]),d(n).length?(R(),M("div",pt,[xt,m("code",null,V(d(n).join(", ")),1)])):N("",!0)]}),_:1},512),m("div",yt,[b(d(J),null,{default:A(()=>[b(d(P),{size:"50"},{default:A(()=>[b(l,{"h-full":"","model-value":d(i).code,"read-only":!0,mode:d(p),matched:d(i).matched,class:"scrolls module-scrolls",style:w(d(v))},null,8,["model-value","mode","matched","style"])]),_:1}),b(d(P),{size:"50"},{default:A(()=>[m("div",null,[b(x,{border:"l b gray-400/20",title:"Output CSS"},{default:A(()=>[m("label",null,[G(m("input",{"onUpdate:modelValue":h[0]||(h[0]=y=>H(r)?r.value=y:null),type:"checkbox"},null,512),[[K,d(r)]]),S(" Prettify ")])]),_:1}),b(l,{"h-full":"",b:"l main","model-value":d(o),"read-only":!0,mode:"css",class:"scrolls module-scrolls",style:w(d(v))},null,8,["model-value","style"])])]),_:1})]),_:1})])])):N("",!0)}}}),gt=B({__name:"[id]",setup(t){const c=tt();return(i,p)=>{const f=vt;return R(),Y(f,{id:d(c).params.id},null,8,["id"])}}});export{gt as default};
|