@unocss/inspector 0.45.14 → 0.45.19
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/dist/client/assets/_id_.8d881369.js +1 -0
- package/dist/client/assets/index.cc6486c7.js +282 -0
- package/dist/client/assets/repl.c7af7bd1.js +3 -0
- package/dist/client/index.html +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.mjs +2 -1
- package/package.json +2 -1
- package/dist/client/assets/_id_.2b9c31d6.js +0 -1
- package/dist/client/assets/index.c521dd0f.js +0 -282
- package/dist/client/assets/repl.8e3c422b.js +0 -3
|
@@ -0,0 +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,n as f,k as P,_ as E,l as N,m as U,p as $,q as I}from"./index.cc6486c7.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=P(" Include safelist "),q={"h-full":"","of-hidden":"",grid:"","grid-cols-2":""},z=x({__name:"ReplPlayground",setup(y){const c=b(null),t=S(c,"rpel-scrolls"),l=k("unocss:inspector:repl",`<div class="text-sm hover:text-red">
|
|
2
|
+
Hello World
|
|
3
|
+
</div>`),o=V("unocss-inspector-safelist",!1),{data:d}=B(l,o);return(W,n)=>{var i,_;const g=E,v=N,u=U;return h(),w("div",L,[a(g,{ref_key:"status",ref:c},{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]=r=>p(o)?o.value=r:null),type:"checkbox"},null,512),[[R,e(o)]]),j])]),_:1}),s("div",q,[a(u,{modelValue:e(l),"onUpdate:modelValue":n[1]||(n[1]=r=>p(l)?l.value=r:null),mode:"html",matched:((i=e(d))==null?void 0:i.matched)||[],class:"scrolls rpel-scrolls",style:f(e(t))},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(t))},null,8,["model-value","style"])])])}}}),D={};function H(y,c){const t=z;return h(),I(t)}const F=$(D,[["render",H]]);export{F as default};
|
package/dist/client/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
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.
|
|
11
|
+
<script type="module" crossorigin src="/__unocss/assets/index.cc6486c7.js"></script>
|
|
12
12
|
<link rel="stylesheet" href="/__unocss/assets/index.ffb3a076.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
package/dist/index.cjs
CHANGED
|
@@ -59,7 +59,8 @@ function UnocssInspector(ctx) {
|
|
|
59
59
|
if (req.url.startsWith("/repl")) {
|
|
60
60
|
const query = new URLSearchParams(req.url.slice(5));
|
|
61
61
|
const token = query.get("token") || "";
|
|
62
|
-
const
|
|
62
|
+
const includeSafelist = JSON.parse(query.get("safelist") ?? "false");
|
|
63
|
+
const result = await ctx.uno.generate(token, { preflights: false, safelist: includeSafelist });
|
|
63
64
|
const mod = {
|
|
64
65
|
...result,
|
|
65
66
|
matched: Array.from(result.matched)
|
package/dist/index.mjs
CHANGED
|
@@ -52,7 +52,8 @@ function UnocssInspector(ctx) {
|
|
|
52
52
|
if (req.url.startsWith("/repl")) {
|
|
53
53
|
const query = new URLSearchParams(req.url.slice(5));
|
|
54
54
|
const token = query.get("token") || "";
|
|
55
|
-
const
|
|
55
|
+
const includeSafelist = JSON.parse(query.get("safelist") ?? "false");
|
|
56
|
+
const result = await ctx.uno.generate(token, { preflights: false, safelist: includeSafelist });
|
|
56
57
|
const mod = {
|
|
57
58
|
...result,
|
|
58
59
|
matched: Array.from(result.matched)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/inspector",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.19",
|
|
4
4
|
"description": "The inspector UI for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
25
26
|
"require": "./dist/index.cjs",
|
|
26
27
|
"import": "./dist/index.mjs"
|
|
27
28
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as V,m as I,d as M,p as O,t as W,r as C,u as D,q as U,s as Z,v as j,g as u,c as R,b as g,w as A,e as f,x as w,_ as q,o as k,y as E,z as S,A as N,n as P,B as G,C as K,D as H,E as J,h as L,F as Q,k as X,G as Y}from"./index.c521dd0f.js";const tt=t=>t.split(/\\?[\s'"`;={}]+/g).filter(V),et={name:"split",order:0,extract({code:t}){return new Set(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(V(e)&&c!==!1){const s=[`[${e}=""]`];return _&&s.push(`[${e}="true"]`),s}return[]}return["class","className"].includes(e)?l.split(F).filter(V):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=E(" Prettify "),bt=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)?(k(),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,E(" "+S(u(c).matched.length),1)]),f("div",null,[_t,E(" "+S(((((y=u(c))==null?void 0:y.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),pt]),u(o).length?(k(),R("div",xt,[yt,f("code",null,S(u(o).join(", ")),1)])):w("",!0)]}),_:1},512),f("div",vt,[g(u(H),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),[[K,e.value]]),gt])]),_: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)}}}),$t=M({__name:"[id]",setup(t){const a=Y();return(c,_)=>{const i=bt;return k(),X(i,{id:u(a).params.id},null,8,["id"])}}});export{$t as default};
|