UNPKG

@nuxt/devtools

Version:

The Nuxt DevTools gives you insights and transparency about your Nuxt App.

2 lines (1 loc) 3.55 kB
import{a4 as $,ba as E,bb as N,bc as V,a6 as j,l as B,ag as k,bd as D,i as I,aa as L,r as P,n as S}from"./kbaft34e.js";import{p as q,k as C,q as x,r as W,E as M,z as O,w as _,M as R,J as U,a3 as n,V as u,a4 as y,S as r,ab as w,aa as A,u as T,af as F,a5 as z}from"./vendor/json-editor-vue-pb6xqf2y.js";import{_ as G}from"./launch-page.vue-mzq6noib.js";import"./vendor/unocss-k776m6tm.js";import"./vendor/shiki-hjqm7vcp.js";import"./nmarkdown.vue-isat7p33.js";import"./client-jlcyzfwz.js";const h=new Map,J=q({__name:"IframeView",props:{tab:{}},setup(f){const m=f,c=$(),d=C(),i=x(()=>m.tab.name),e=C(),t=W(E(d));M(()=>{const o=m.tab.view,l=o.persistent!==!1,b=["clipboard-write","clipboard-read"];if(h.get(i.value)&&l)e.value=h.get(i.value),e.value.style.visibility="visible";else{e.value=document.createElement("iframe"),e.value.setAttribute("allow",b.join("; ")),e.value.setAttribute("aria-label","Nuxt Devtools"),l&&h.set(i.value,e.value),e.value.src=o.src;try{e.value.style.opacity="0.01",e.value.onload=()=>{v(),s(),e.value.style.opacity="1"}}catch{e.value.style.opacity="1"}document.body.appendChild(e.value),O(p)}setTimeout(s,100)}),_(p),_(s),_(v),R(()=>{e.value&&(e.value.style.visibility="hidden")});function s(){if(!(!e.value||!e.value.contentWindow))try{const o=e.value.contentWindow.document.querySelector("html");o?.classList.toggle("dark",c.value==="dark"),o?.classList.toggle("light",c.value==="dark"),new MutationObserver(()=>{c.value=e.value?.contentWindow?.document.querySelector("html")?.classList.contains("dark")?"dark":"light"}).observe(o,{attributes:!0,attributeFilter:["class"]})}catch{}}const a=N();function v(){if(!(!e.value||!e.value.contentWindow))try{e.value.contentWindow.__NUXT_DEVTOOLS__=a.value}catch{}}function p(){e.value&&Object.assign(e.value.style,{position:"fixed",left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,outline:"none"})}return(o,l)=>(n(),U("div",{ref_key:"anchor",ref:d,"h-full":"","w-full":""},null,512))}}),X={flex:"~ col gap2",mxa:"","items-center":""},H={"text-xl":""},K={"text-rose":""},ne=q({__name:"custom-[name]",props:{name:{}},setup(f){const m=f,c=V(),d=j(),i=x(()=>m.name??c.params.name),e=B(),t=x(()=>e.value.find(s=>s.name===i.value));return M(()=>{t.value?t.value.requireAuth&&!k.value&&D():setTimeout(()=>{t.value||d.push("/modules/overview")},2e3)}),(s,a)=>{const v=I,p=L,o=J,l=G,b=S;return t.value?t.value.requireAuth&&!T(k)?(n(),u(p,{key:1})):t.value.view.type==="iframe"?(n(),u(o,{key:2,tab:t.value},null,8,["tab"])):t.value.view.type==="vnode"?(n(),u(F(t.value.view.vnode),{key:3})):t.value.view.type==="launch"?(n(),u(l,{key:4,name:`custom-${t.value.name}`,icon:t.value.view.icon||t.value.icon,title:t.value.view.title||t.value.title,description:t.value.view.description,actions:t.value.view.actions,onAction:a[0]||(a[0]=g=>T(P).customTabAction(t.value.name,g))},null,8,["name","icon","title","description","actions"])):(n(),u(v,{key:5},{default:y(()=>[z(b,{flex:"~ col","h-full":"","items-center":"","justify-center":""},{default:y(()=>[w(" Unknown tab type "+A(t.value.view),1)]),_:1})]),_:1})):(n(),u(v,{key:0},{default:y(()=>[r("div",X,[a[3]||(a[3]=r("div",{"i-carbon-queued":"",mb2:"","text-5xl":"",op50:""},null,-1)),r("p",H,[a[1]||(a[1]=w(" Tab ")),r("code",K,A(i.value),1),a[2]||(a[2]=w(" not found "))]),a[4]||(a[4]=r("p",{op50:""}," It might because the module contributing this tab is not installed or enabled ",-1)),a[5]||(a[5]=r("p",{mt8:"","animate-pulse":""}," Redirecting to overview page... ",-1))])]),_:1}))}}});export{ne as default};