mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-02 21:49:31 +08:00
1 line
5.4 KiB
Text
1 line
5.4 KiB
Text
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.e99f8bc9.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};
|