astro-ghostcms/.pnpm-store/v3/files/a0/ecf6069c6a072748f37ce12cd34...

2 lines
6.3 KiB
Plaintext

import{s as Z,t as z,d as W,x as q,y as G,r as R,u as H,z as K,A as J,B as L,j as s,c as P,g as A,w as k,q as j,C as M,_ as Q,D as X,o as S,e as m,k as w,E as C,i as B,F,n as O,h as Y,v as ee,M as te,G as re,H as le,m as se,l as ae,I as ne}from"./index-V0fxeEOR.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(a,{generator:$}){var _,c;const n=Z(a);if(!n)return;let t=n[1];if(t.startsWith(h))t=t.slice(h.length);else if(r)return;const i=n[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)[a-zA-Z0-9\u00A0-\uFFFF-_:%-]+)(?:=("[^"]*|'[^']*))?/g,I=/[\s'"`;>]+/;function ue(e){return{name:"attributify",extract:({content:h,cursor:r})=>{const g=h.matchAll(oe);let o,a=0;for(const f of g){const[,v,y]=f,b=f.index+v.length;if(r>b&&r<=b+y.length){a=b,o=y;break}}if(!o)return null;const $=o.matchAll(ie);let n=0,t,i;for(const f of $){const[v,y,b]=f,E=a+f.index;if(r>E&&r<=E+v.length){n=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:n+v,end:n+t.length,replacement:f}}};const _=n+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)[a-zA-Z0-9\u00A0-\uFFFF-_:!%-.~<]+)=?(?:["]([^"]*)["]|[']([^']*)[']|[{]([^}]*)[}])?/gms,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(a=>Array.from((a[1]||"").matchAll(fe))).flatMap(([,a,...$])=>{const n=$.filter(Boolean).join("");if(h.includes(a))return[];for(const t of de)if(a.startsWith(t)){a=a.slice(t.length);break}if(!n){if(z(a)&&r!==!1){const t=[`[${a}=""]`];return g&&t.push(`[${a}="true"]`),t}return[]}return["class","className"].includes(a)?n.split(T).filter(z):N.test(n)?(N.lastIndex=0,this.extract({code:n})):e!=null&&e.prefixedOnly&&e.prefix&&!a.startsWith(e.prefix)?[]:n.split(T).filter(t=>!!t&&t!==":").map(t=>`[${a}~="${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}=q(G(h,"id")),g=h.id.split(/\./g).pop(),o=R(null),a=H(o,"module-scrolls");function $(){fetch(`/__open-in-editor?file=${encodeURIComponent(h.id)}`)}const{extractors:n}=he({strict:!0}),t=K(async()=>{var c;const _=new Set;if(n){const l={code:((c=r.value)==null?void 0:c.code)||""};for(const u of n){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=J(L(()=>{var _;return(_=r.value)==null?void 0:_.css}),i);return(_,c)=>{const l=re,u=le,d=Q,V=se,f=ae,v=X;return s(r)?(S(),P("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,w(" "+C(s(r).matched.length),1)]),m("div",null,[be,w(" "+C(((((y=s(r))==null?void 0:y.gzipSize)||0)/1024).toFixed(2))+" KiB ",1),ge]),s(t).length?(S(),P("div",$e,[Ae,m("code",null,C(s(t).join(", ")),1)])):M("",!0)]),A(u,{modelValue:s(x),"onUpdate:modelValue":c[0]||(c[0]=b=>B(x)?x.value=b:null)},null,8,["modelValue"])]}),_:1},512),s(x)==="source"?(S(),P("div",Ve,[A(s(te),null,{default:k(()=>[A(s(F),{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(a))},null,8,["model-value","mode","matched","style"])]}),_:1}),A(s(F),{size:"50"},{default:k(()=>[m("div",null,[A(f,{border:"l b gray-400/20",title:"Output CSS"},{default:k(()=>[m("label",null,[Y(m("input",{"onUpdate:modelValue":c[1]||(c[1]=y=>B(i)?i.value=y:null),type:"checkbox"},null,512),[[ee,s(i)]]),w(" 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(a))},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"]))])):M("",!0)}}}),Ee=W({__name:"[id]",setup(e){const h=ne();return(r,g)=>{const o=ke;return S(),j(o,{id:s(h).params.id},null,8,["id"])}}});export{Ee as default};