@unocss/inspector 0.46.1 → 0.46.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.
@@ -1,3 +1,3 @@
1
- import{d as x,r as b,u as S,a as k,b as V,f as B,o as h,c as w,e as a,w as m,g as s,h as C,v as R,i as e,j as p,k as P,n as f,_ as E,l as N,m as U,p as $,q as I}from"./index.77a8dc12.js";const L={"h-full":"",grid:"~ rows-[max-content_1fr]","of-hidden":""},M=s("div",null," REPL Playground ",-1),T=s("div",{op60:""}," Edit your code below to test and play UnoCSS's matching and generating. ",-1),j={"h-full":"","of-hidden":"",grid:"","grid-cols-2":""},q=x({__name:"ReplPlayground",setup(y){const r=b(null),l=S(r,"rpel-scrolls"),t=k("unocss:inspector:repl",`<div class="text-sm hover:text-red">
1
+ import{d as x,r as b,u as S,a as k,b as V,f as B,o as h,c as w,e as a,w as m,g as s,h as C,v as R,i as e,j as p,k as P,n as f,_ as E,l as N,m as U,p as $,q as I}from"./index.c61f0d8e.js";const L={"h-full":"",grid:"~ rows-[max-content_1fr]","of-hidden":""},M=s("div",null," REPL Playground ",-1),T=s("div",{op60:""}," Edit your code below to test and play UnoCSS's matching and generating. ",-1),j={"h-full":"","of-hidden":"",grid:"","grid-cols-2":""},q=x({__name:"ReplPlayground",setup(y){const r=b(null),l=S(r,"rpel-scrolls"),t=k("unocss:inspector:repl",`<div class="text-sm hover:text-red">
2
2
  Hello World
3
3
  </div>`),o=V("unocss-inspector-safelist",!1),{data:d}=B(t,o);return(H,n)=>{var i,_;const g=E,v=N,u=U;return h(),w("div",L,[a(g,{ref_key:"status",ref:r},{default:m(()=>[M,T]),_:1},512),a(v,{border:"b gray-400/20",title:""},{default:m(()=>[s("label",null,[C(s("input",{"onUpdate:modelValue":n[0]||(n[0]=c=>p(o)?o.value=c:null),type:"checkbox"},null,512),[[R,e(o)]]),P(" Include safelist ")])]),_:1}),s("div",j,[a(u,{modelValue:e(t),"onUpdate:modelValue":n[1]||(n[1]=c=>p(t)?t.value=c:null),mode:"html",matched:((i=e(d))==null?void 0:i.matched)||[],class:"scrolls rpel-scrolls",style:f(e(l))},null,8,["modelValue","matched","style"]),a(u,{"b-l":"","b-main":"","model-value":((_=e(d))==null?void 0:_.css)||"/* empty */","read-only":!0,mode:"css",class:"scrolls rpel-scrolls",style:f(e(l))},null,8,["model-value","style"])])])}}}),z={};function D(y,r){const l=q;return h(),I(l)}const A=$(z,[["render",D]]);export{A as default};
@@ -8,8 +8,8 @@
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.77a8dc12.js"></script>
12
- <link rel="stylesheet" href="/__unocss/assets/index.b630285a.css">
11
+ <script type="module" crossorigin src="/__unocss/assets/index.c61f0d8e.js"></script>
12
+ <link rel="stylesheet" href="/__unocss/assets/index.33faea6b.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="app"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/inspector",
3
- "version": "0.46.1",
3
+ "version": "0.46.2",
4
4
  "description": "The inspector UI for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- import{s as k,t as I,d as M,x as O,y as W,r as C,u as D,z as U,A as Z,B as j,i as u,c as R,e as g,w as A,g as f,C as w,_ as q,o as E,k as S,D as V,E as N,n as P,h as G,v as H,F as K,G as J,m as L,l as Q,q as X,H as Y}from"./index.77a8dc12.js";const tt=t=>[...new Set(t.split(/\\?[\s'"`;={}]+/g))].filter(k),et={name:"split",order:0,extract({code:t}){return tt(t)}},B=/^(?!.*\[(?:[^:]+):(?:.+)\]$)((?:.+:)?!?)?(.*)$/,st=(t={})=>{var i,h,d;const a=(i=t.prefix)!=null?i:"un-",c=(h=t.prefixedOnly)!=null?h:!1,_=(d=t.trueToNonValued)!=null?d:!1;return{name:"attributify",match(r){const o=I(r);if(!o)return;let e=o[1];if(e.startsWith(a))e=e.slice(a.length);else if(c)return;const p=o[2],[,l="",s=p]=p.match(B)||[];return s==="~"||_&&s==="true"||!s?`${l}${e}`:`${l}${e}-${s}`}}},lt=/(<\w[\w:\.$-]*\s)((?:'[^>]*?'|"[^>]*?"|`[^>]*?`|\{[^>]*?\}|[^>]*?)*)/g,rt=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:%-]+)(?:=("[^"]*|'[^']*))?/g,z=/[\s'"`;>]+/,nt={name:"attributify",extract:({content:t,cursor:a})=>{const c=t.matchAll(lt);let _,i=0;for(const n of c){const[,x,y]=n,b=n.index+x.length;if(a>b&&a<=b+y.length){i=b,_=y;break}}if(!_)return null;const h=_.matchAll(rt);let d=0,r,o;for(const n of h){const[x,y,b]=n,$=i+n.index;if(a>$&&a<=$+x.length){d=$,r=y,o=b==null?void 0:b.slice(1);break}}if(!r||r==="class"||r==="className"||r===":class")return null;if(o===void 0)return{extracted:r,resolveReplacement(n){return{start:d,end:d+r.length,replacement:n}}};const e=d+r.length+2;let p=z.exec(o),l=0,s;for(;p;){const[n]=p;if(a>e+l&&a<=e+l+p.index){s=o.slice(l,l+p.index);break}l+=p.index+n.length,p=z.exec(o.slice(l))}s===void 0&&(s=o.slice(l));const[,m="",v]=s.match(B)||[];return{extracted:`${m}${r}-${v}`,transformSuggestions(n){return n.filter(x=>x.startsWith(`${m}${r}-`)).map(x=>m+x.slice(m.length+r.length+1))},resolveReplacement(n){return{start:l+e,end:l+e+s.length,replacement:m+n.slice(m.length+r.length+1)}}}}},at=["v-bind:",":"],F=/[\s'"`;]+/g,ct=/<\w(?=.*>)[\w:\.$-]*\s((?:['"`\{].*?['"`\}]|.*?)*?)>/gs,ot=/([?]|(?!\d|-{2}|-\d)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-]+)(?:={?(["'])([^\2]*?)\2}?)?/g,T=["placeholder"],it=t=>{var i,h,d;const a=(i=t==null?void 0:t.ignoreAttributes)!=null?i:T,c=(h=t==null?void 0:t.nonValuedAttribute)!=null?h:!0,_=(d=t==null?void 0:t.trueToNonValued)!=null?d:!1;return{name:"attributify",extract({code:r}){const o=Array.from(r.matchAll(ct)).flatMap(e=>Array.from((e[1]||"").matchAll(ot))).flatMap(([,e,p,l])=>{if(a.includes(e))return[];for(const s of at)if(e.startsWith(s)){e=e.slice(s.length);break}if(!l){if(k(e)&&c!==!1){const s=[`[${e}=""]`];return _&&s.push(`[${e}="true"]`),s}return[]}return["class","className"].includes(e)?l.split(F).filter(k):l.split(F).filter(Boolean).map(s=>`[${e}~="${s}"]`)});return new Set(o)}}},ut=(t={})=>{var i,h,d,r,o;t.strict=(i=t.strict)!=null?i:!1,t.prefix=(h=t.prefix)!=null?h:"un-",t.prefixedOnly=(d=t.prefixedOnly)!=null?d:!1,t.nonValuedAttribute=(r=t.nonValuedAttribute)!=null?r:!0,t.ignoreAttributes=(o=t.ignoreAttributes)!=null?o:T;const a=[st(t)],c=[it(t)],_=[nt];return t.strict||c.unshift(et),{name:"@unocss/preset-attributify",variants:a,extractors:c,options:t,autocomplete:{extractors:_}}},dt={key:0,"h-full":"","of-hidden":""},ft=f("div",{op50:""}," Module ",-1),mt=f("div",{"i-carbon-launch":""},null,-1),ht=f("div",{op50:""}," Matched Rules ",-1),_t=f("div",{op50:""}," CSS Size ",-1),pt=f("span",{op50:""},"gzipped",-1),xt={key:0,"row-span-3":""},yt=f("div",{op50:""}," Potentially Unmatched ",-1),vt={"h-full":"","of-hidden":""},gt=M({__name:"ModuleInfo",props:{id:null},setup(t){const a=t,{data:c}=O(W(a,"id")),_=a.id.split(/\./g).pop(),i=C(null),h=D(i,"module-scrolls");function d(){fetch(`/__open-in-editor?file=${encodeURIComponent(a.id)}`)}const{extractors:r}=ut({strict:!0}),o=U(async()=>{var s;const l=new Set;if(r){const m={code:((s=c.value)==null?void 0:s.code)||""};for(const v of r){const n=await v.extract(m);n==null||n.forEach(x=>l.add(x))}}return Array.from(l).filter(m=>!m.startsWith("[")).filter(m=>{var v;return!((v=c.value)!=null&&v.matched.includes(m))})}),e=C(!1),p=Z(j(()=>{var l;return(l=c.value)==null?void 0:l.css}),e);return(l,s)=>{const m=J,v=q,n=L,x=Q;return u(c)?(E(),R("div",dt,[g(v,{ref_key:"status",ref:i,grid:"~ cols-3 gap-4"},{default:A(()=>{var y;return[f("div",null,[ft,f("a",{"cursor-pointer":"",op80:"","hover:op100":"",onClick:d},[g(m,{id:u(c).id,"mr-1":""},null,8,["id"]),mt])]),f("div",null,[ht,S(" "+V(u(c).matched.length),1)]),f("div",null,[_t,S(" "+V(((((y=u(c))==null?void 0:y.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),pt]),u(o).length?(E(),R("div",xt,[yt,f("code",null,V(u(o).join(", ")),1)])):w("",!0)]}),_:1},512),f("div",vt,[g(u(K),null,{default:A(()=>[g(u(N),{size:"50"},{default:A(()=>[g(n,{"h-full":"","model-value":u(c).code,"read-only":!0,mode:u(_),matched:u(c).matched,class:"scrolls module-scrolls",style:P(u(h))},null,8,["model-value","mode","matched","style"])]),_:1}),g(u(N),{size:"50"},{default:A(()=>[f("div",null,[g(x,{border:"l b gray-400/20",title:"Output CSS"},{default:A(()=>[f("label",null,[G(f("input",{"onUpdate:modelValue":s[0]||(s[0]=y=>e.value=y),type:"checkbox"},null,512),[[H,e.value]]),S(" Prettify ")])]),_:1}),g(n,{"h-full":"",b:"l main","model-value":u(p),"read-only":!0,mode:"css",class:"scrolls module-scrolls",style:P(u(h))},null,8,["model-value","style"])])]),_:1})]),_:1})])])):w("",!0)}}}),At=M({__name:"[id]",setup(t){const a=Y();return(c,_)=>{const i=gt;return E(),X(i,{id:u(a).params.id},null,8,["id"])}}});export{At as default};