@unocss/inspector 0.62.2 → 0.62.4

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,3 @@
1
+ import{d as x,r as S,u as b,a as k,b as V,f as B,o as y,c as w,e as s,g as a,w as p,h as C,i as _,v as R,j as l,k as P,n as f,_ as E,l as N,m as U,p as $,q as I}from"./index-izPeb8ug.js";const L={"h-full":"",grid:"~ rows-[max-content_1fr]","of-hidden":""},M={"h-full":"","of-hidden":"",grid:"","grid-cols-2":""},T=x({__name:"ReplPlayground",setup(v){const r=S(null),t=b(r,"repl-scrolls"),o=k("unocss:inspector:repl",`<div class="text-sm hover:text-red">
2
+ Hello World
3
+ </div>`),n=V("unocss-inspector-safelist",!1),{data:c}=B(o,n);return(z,e)=>{var i,m;const g=E,h=N,u=U;return y(),w("div",L,[s("div",{ref_key:"status",ref:r},[a(g,null,{default:p(()=>e[2]||(e[2]=[s("div",null," REPL Playground ",-1),s("div",{op60:""}," Edit your code below to test and play UnoCSS's matching and generating. ",-1)])),_:1}),a(h,{border:"b gray-400/20",title:""},{default:p(()=>[s("label",null,[C(s("input",{"onUpdate:modelValue":e[0]||(e[0]=d=>_(n)?n.value=d:null),type:"checkbox"},null,512),[[R,l(n)]]),e[3]||(e[3]=P(" Include safelist "))])]),_:1})],512),s("div",M,[a(u,{modelValue:l(o),"onUpdate:modelValue":e[1]||(e[1]=d=>_(o)?o.value=d:null),mode:"html",matched:((i=l(c))==null?void 0:i.matched)||[],class:"scrolls repl-scrolls",style:f(l(t))},null,8,["modelValue","matched","style"]),a(u,{border:"l main","model-value":((m=l(c))==null?void 0:m.css)||"/* empty */","read-only":!0,mode:"css",class:"scrolls repl-scrolls",style:f(l(t))},null,8,["model-value","style"])])])}}}),j={};function q(v,r){const t=T;return y(),I(t)}const H=$(j,[["render",q]]);export{H 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-Bn8_BYIe.js"></script>
12
- <link rel="stylesheet" crossorigin href="/__unocss/assets/index-CHdeVSig.css">
11
+ <script type="module" crossorigin src="/__unocss/assets/index-izPeb8ug.js"></script>
12
+ <link rel="stylesheet" crossorigin href="/__unocss/assets/index-BZOng_h8.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="app"></div>
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { Plugin } from 'vite';
2
1
  import { UnocssPluginContext } from '@unocss/core';
2
+ import { Plugin } from 'vite';
3
3
 
4
4
  declare function UnocssInspector(ctx: UnocssPluginContext): Plugin;
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Plugin } from 'vite';
2
1
  import { UnocssPluginContext } from '@unocss/core';
2
+ import { Plugin } from 'vite';
3
3
 
4
4
  declare function UnocssInspector(ctx: UnocssPluginContext): Plugin;
5
5
 
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { dirname, resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
- import sirv from 'sirv';
4
3
  import { escapeSelector, CountableSet, BetterMap } from '@unocss/core';
5
4
  import gzipSize from 'gzip-size';
5
+ import sirv from 'sirv';
6
6
  import { createValueHandler, parseCssColor, getStringComponent } from '@unocss/rule-utils';
7
7
 
8
8
  const SKIP_START_COMMENT = "@unocss-skip-start";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/inspector",
3
3
  "type": "module",
4
- "version": "0.62.2",
4
+ "version": "0.62.4",
5
5
  "description": "The inspector UI for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -36,8 +36,8 @@
36
36
  "dependencies": {
37
37
  "gzip-size": "^6.0.0",
38
38
  "sirv": "^2.0.4",
39
- "@unocss/rule-utils": "0.62.2",
40
- "@unocss/core": "0.62.2"
39
+ "@unocss/core": "0.62.4",
40
+ "@unocss/rule-utils": "0.62.4"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "unbuild",
@@ -1 +0,0 @@
1
- import{s as q,t as M,d as W,x as G,y as H,r as R,u as K,z as J,A as L,B as Q,j as s,c as w,g as A,w as k,q as j,C as B,_ as X,D as Y,o as S,e as m,k as P,E as C,i as F,F as z,n as O,h as Z,v as ee,M as te,G as re,H as le,m as se,l as ne,I as ae}from"./index-Bn8_BYIe.js";const D=/^(?!.*\[[^:]+:.+\]$)((?:.+:)?!?)(.*)$/;function ce(e={}){const h=e.prefix??"un-",r=e.prefixedOnly??!1,g=e.trueToNonValued??!1;let o;return{name:"attributify",match(n,{generator:$}){var _,c;const a=q(n);if(!a)return;let t=a[1];if(t.startsWith(h))t=t.slice(h.length);else if(r)return;const i=a[2],[,x="",p=i]=i.match(D)||[];if(p==="~"||g&&p==="true"||!p)return`${x}${t}`;if(o==null){const l=(c=(_=$==null?void 0:$.config)==null?void 0:_.separators)==null?void 0:c.join("|");l?o=new RegExp(`^(.*\\](?:${l}))(\\[[^\\]]+?\\])$`):o=!1}if(o){const[,l,u]=i.match(o)||[];if(u)return`${l}${x}${t}-${u}`}return`${x}${t}-${p}`}}}const oe=/(<\w[\w:.$-]*\s)((?:'[^>']*'|"[^>"]*"|`[^>`]*`|\{[^>}]*\}|[^>]*?)*)/g,ie=/(\?|(?!\d|-{2}|-\d)[\w\u00A0-\uFFFF-:%]+)(?:=("[^"]*|'[^']*))?/g,I=/[\s'"`;>]+/;function ue(e){return{name:"attributify",extract:({content:h,cursor:r})=>{const g=h.matchAll(oe);let o,n=0;for(const f of g){const[,v,y]=f,b=f.index+v.length;if(r>b&&r<=b+y.length){n=b,o=y;break}}if(!o)return null;const $=o.matchAll(ie);let a=0,t,i;for(const f of $){const[v,y,b]=f,E=n+f.index;if(r>E&&r<=E+v.length){a=E,t=y,i=b==null?void 0:b.slice(1);break}}if(!t||t==="class"||t==="className"||t===":class")return null;const x=!!(e!=null&&e.prefix)&&t.startsWith(e.prefix);if(e!=null&&e.prefixedOnly&&!x)return null;const p=x?t.slice(e.prefix.length):t;if(i===void 0)return{extracted:p,resolveReplacement(f){const v=x?e.prefix.length:0;return{start:a+v,end:a+t.length,replacement:f}}};const _=a+t.length+2;let c=I.exec(i),l=0,u;for(;c;){const[f]=c;if(r>_+l&&r<=_+l+c.index){u=i.slice(l,l+c.index);break}l+=c.index+f.length,c=I.exec(i.slice(l))}u===void 0&&(u=i.slice(l));const[,d="",V]=u.match(D)||[];return{extracted:`${d}${p}-${V}`,transformSuggestions(f){return f.filter(v=>v.startsWith(`${d}${p}-`)).map(v=>d+v.slice(d.length+p.length+1))},resolveReplacement(f){return{start:l+_,end:l+_+u.length,replacement:d+f.slice(d.length+p.length+1)}}}}}}const de=["v-bind:",":"],T=/[\s'"`;]+/g,N=/<[^>\s]*\s((?:'[^']*'|"[^"]*"|`[^`]*`|\{[^}]*\}|=>|[^>]*?)*)/g,fe=/(\?|(?!\d|-{2}|-\d)[\w\u00A0-\uFFFF:!%.~<-]+)=?(?:"([^"]*)"|'([^']*)'|\{([^}]*)\})?/g,U=["placeholder","fill","opacity","stroke-opacity"];function me(e){const h=(e==null?void 0:e.ignoreAttributes)??U,r=(e==null?void 0:e.nonValuedAttribute)??!0,g=(e==null?void 0:e.trueToNonValued)??!1;return{name:"@unocss/preset-attributify/extractor",extract({code:o}){return Array.from(o.matchAll(N)).flatMap(n=>Array.from((n[1]||"").matchAll(fe))).flatMap(([,n,...$])=>{const a=$.filter(Boolean).join("");if(h.includes(n))return[];for(const t of de)if(n.startsWith(t)){n=n.slice(t.length);break}if(!a){if(M(n)&&r!==!1){const t=[`[${n}=""]`];return g&&t.push(`[${n}="true"]`),t}return[]}return["class","className"].includes(n)?a.split(T).filter(M):N.test(a)?(N.lastIndex=0,this.extract({code:a})):e!=null&&e.prefixedOnly&&e.prefix&&!n.startsWith(e.prefix)?[]:a.split(T).filter(t=>!!t&&t!==":").map(t=>`[${n}~="${t}"]`)})}}}const he=(e={})=>{e.strict=e.strict??!1,e.prefix=e.prefix??"un-",e.prefixedOnly=e.prefixedOnly??!1,e.nonValuedAttribute=e.nonValuedAttribute??!0,e.ignoreAttributes=e.ignoreAttributes??U;const h=[ce(e)],r=[me(e)],g=[ue(e)];return{name:"@unocss/preset-attributify",enforce:"post",variants:h,extractors:r,options:e,autocomplete:{extractors:g},extractorDefault:e.strict?!1:void 0}},_e={key:0,"h-full":"","of-hidden":"",flex:"","flex-col":""},xe={p:"4",grid:"~ cols-4 gap-4"},pe=m("div",{op50:""}," Module ",-1),ye=m("div",{"i-carbon-launch":""},null,-1),ve=m("div",{op50:""}," Matched Rules ",-1),be=m("div",{op50:""}," CSS Size ",-1),ge=m("span",{op50:""},"gzipped",-1),$e={key:0,"row-span-3":""},Ae=m("div",{op50:""}," Potentially Unmatched ",-1),Ve={key:0,"h-full":"","of-hidden":""},ke=W({__name:"ModuleInfo",props:{id:{}},setup(e){const h=e,{data:r}=G(H(h,"id")),g=h.id.split(/\./g).pop(),o=R(null),n=K(o,"module-scrolls");function $(){fetch(`/__open-in-editor?file=${encodeURIComponent(h.id)}`)}const{extractors:a}=he({strict:!0}),t=J(async()=>{var c;const _=new Set;if(a){const l={code:((c=r.value)==null?void 0:c.code)||""};for(const u of a){const d=await u.extract(l);d==null||d.forEach(V=>_.add(V))}}return Array.from(_).filter(l=>!l.startsWith("[")).filter(l=>{var u,d;return!((d=(u=r.value)==null?void 0:u.matched)!=null&&d.some(({rawSelector:V})=>V===l))})}),i=R(!1),x=R("source"),p=L(Q(()=>{var _;return(_=r.value)==null?void 0:_.css}),i);return(_,c)=>{const l=re,u=le,d=X,V=se,f=ne,v=Y;return s(r)?(S(),w("div",_e,[A(d,{ref_key:"status",ref:o,p0:""},{default:k(()=>{var y;return[m("div",xe,[m("div",null,[pe,m("a",{"cursor-pointer":"",op80:"","hover:op100":"",onClick:$},[A(l,{id:s(r).id,"mr-1":""},null,8,["id"]),ye])]),m("div",null,[ve,P(" "+C(s(r).matched.length),1)]),m("div",null,[be,P(" "+C(((((y=s(r))==null?void 0:y.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),ge]),s(t).length?(S(),w("div",$e,[Ae,m("code",null,C(s(t).join(", ")),1)])):B("",!0)]),A(u,{modelValue:s(x),"onUpdate:modelValue":c[0]||(c[0]=b=>F(x)?x.value=b:null)},null,8,["modelValue"])]}),_:1},512),s(x)==="source"?(S(),w("div",Ve,[A(s(te),null,{default:k(()=>[A(s(z),{size:"50"},{default:k(()=>{var y;return[A(V,{"h-full":"","model-value":s(r).code,"read-only":!0,mode:s(g),matched:(y=s(r).matched)==null?void 0:y.map(({rawSelector:b})=>b),class:"scrolls module-scrolls",style:O(s(n))},null,8,["model-value","mode","matched","style"])]}),_:1}),A(s(z),{size:"50"},{default:k(()=>[m("div",null,[A(f,{border:"l b gray-400/20",title:"Output CSS"},{default:k(()=>[m("label",null,[Z(m("input",{"onUpdate:modelValue":c[1]||(c[1]=y=>F(i)?i.value=y:null),type:"checkbox"},null,512),[[ee,s(i)]]),P(" Prettify ")])]),_:1}),A(V,{"h-full":"",border:"l main","model-value":s(p),"read-only":!0,mode:"css",class:"scrolls module-scrolls",style:O(s(n))},null,8,["model-value","style"])])]),_:1})]),_:1})])):(S(),j(v,{key:1,"flex-grow":"","overflow-y-auto":"",selectors:s(r).matched,colors:s(r).colors},null,8,["selectors","colors"]))])):B("",!0)}}}),Ee=W({__name:"[id]",setup(e){const h=ae();return(r,g)=>{const o=ke;return S(),j(o,{id:s(h).params.id},null,8,["id"])}}});export{Ee as default};