mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-28 19:00:33 +01:00
2 lines
2.0 KiB
JavaScript
2 lines
2.0 KiB
JavaScript
import{b as y,S,x as n,E as k,A as $,o as r,f as l,c as B,w as p,h as C,k as m,u as _,j as I,q as T,s as N,v as j}from"./entry.5c8819da.js";import M from"./TabsHeader.4ceb7ffd.js";/* empty css */const O={class:"sandbox my-4 min-h-[500px] w-full"},V={class:"absolute top-1/2 right-0 -translate-y-1/2 transform px-4"},z=["src"],E={key:2,class:"flex-1 text-white"},L=y({__name:"Sandbox",props:{src:{type:String,default:""},repo:{type:String,default:""},branch:{type:String,default:""},dir:{type:String,default:""},file:{type:String,default:"app.vue"}},setup(d){const t=d,i=S(),s={CodeSandBox:()=>`https://codesandbox.io/embed/github/${t.repo}/tree/${t.branch}/${t.dir}?hidenavigation=1&theme=${i.value}`,StackBlitz:()=>`https://stackblitz.com/github/${t.repo}/tree/${t.branch}/${t.dir}?embed=1&file=${t.file}&theme=${i.value}`},u=Object.keys(s).map(e=>({label:e})),c=n(-1),b=n(),a=n(""),o=n(""),x=e=>{o.value=e,a.value=t.src||s[o.value](),localStorage.setItem("docus_sandbox",e)},f=k(()=>{var e;return(e=a.value)==null?void 0:e.replace("?embed=1&","?").replace("/embed/","/s/")}),v=e=>{c.value=e,x(u[e].label)};return $(()=>{o.value=window.localStorage.getItem("docus_sandbox")||"CodeSandBox",a.value=t.src||s[o.value](),c.value=Object.keys(s).indexOf(o.value)}),(e,U)=>{const h=T,g=N,w=M;return r(),l("div",O,[d.src?I("",!0):(r(),B(w,{key:0,ref_key:"tabs",ref:b,"active-tab-index":c.value,tabs:_(u),"onUpdate:activeTabIndex":v},{footer:p(()=>[C("div",V,[m(g,{class:"u-text-gray-500 hover:u-text-gray-700 flex items-center",to:_(f),target:"_blank"},{default:p(()=>[m(h,{name:"heroicons-outline:arrows-expand",class:"h-6 w-6"})]),_:1},8,["to"])])]),_:1},8,["active-tab-index","tabs"])),a.value?(r(),l("iframe",{key:1,src:a.value,title:"Sandbox editor",sandbox:"allow-modals allow-forms allow-popups allow-scripts allow-same-origin",class:"h-full min-h-[700px] w-full overflow-hidden"},null,8,z)):(r(),l("span",E,"Loading Sandbox..."))])}}}),P=j(L,[["__scopeId","data-v-6e13e020"]]);export{P as default};
|