@nuxt/devtools
Version:
<a href="https://devtools.nuxt.com"><img width="1200" alt="Nuxt DevTools" src="https://github-production-user-asset-6210df.s3.amazonaws.com/904724/261577617-a10567bd-ad33-48cc-9bda-9e37dbe1929f.png"></a> <br>
2 lines (1 loc) • 6.55 kB
JavaScript
import{d as O,am as oe,cj as ae,N as se,r as M,O as T,ck as E,aC as re,w as le,aB as ue,Z as ie,a as de,J as v,K as k,f as n,o as r,h as f,j as u,k as l,i as m,l as U,m as i,F as w,n as A,t as b,D as F,ac as B,v as d,p as z,aw as me,G as pe,bd as fe,ad as ce,cl as G,_ as ve,V as ye,a4 as _e,ar as ge,y as ke,R as be,aI as xe}from"./Bysyzw-g.js";import{_ as we}from"./DFUDf3T0.js";import{_ as Ce}from"./DxQMSSvi.js";import{_ as Ke}from"./CQTsRCSt.js";import{s as Se}from"./B4nba3hY.js";import"./3LqotSTl.js";const Ve={class:"h-[48px] flex items-center justify-between gap1 px-3"},Ne={class:"w-full text-sm"},$e=["value"],Ie=["onClick"],he={key:0,"h-full":"","of-hidden":"",flex:"~ col"},je={border:"b base",class:"h-[49px] flex flex-none items-center justify-between px-4 text-sm"},De={class:"flex items-center gap-4"},Me={key:1},Ue=["onKeyup"],Ae={key:0,op50:""},Be={key:1},Le={"font-bold":""},qe={"text-sm":""},Pe=O({__name:"StorageDetails",async setup(J){let p,g;const C=oe(),K=ae(),S=se(),x=M(""),y=M(""),s=T("storage:current",""),t=M(),_=T("storage:file:state",""),{data:V}=([p,g]=E(()=>G("storageMounts",()=>v.getStorageMounts())),p=await p,g(),p),{data:N,refresh:L}=([p,g]=E(async()=>G("storageKeys",async()=>s.value?await v.getStorageKeys(s.value):[])),p=await p,g(),p),W=K.hook("storage:key:update",async(o,e)=>{if(!(!s.value||o.split(":")[0]!==s.value)&&(await L(),_.value===o)){if(e==="remove")return S.replace({query:{storage:s.value}});await I(_.value)}});re(W),le(s,()=>{L(),_.value=""}),ue(async()=>{if(!_.value){t.value=null;return}I(_.value)}),ie("keydown",o=>{o.key==="s"&&(o.ctrlKey||o.metaKey)&&(h(),o.preventDefault())});function $(o){return o.replace(`${s.value}:`,"")}const Z=de(()=>N.value?N.value.filter(o=>o.includes(x.value)):[]);async function I(o){const e=await v.getStorageItem(await k(),o);t.value={key:o,updatedKey:$(o),editingKey:!1,content:e,updatedContent:e}}async function H(){if(!y.value||!s.value)return;const o=`${s.value}:${y.value}`;N.value?.includes(o)||await v.setStorageItem(await k(),o,""),S.replace({query:{storage:s.value,key:o}}),y.value=""}async function h(){t.value&&(await v.setStorageItem(await k(),t.value.key,t.value.updatedContent),await I(t.value.key))}async function Q(){!t.value||!s.value||(await v.removeStorageItem(await k(),t.value.key),t.value=null)}async function X(){if(!t.value||!s.value)return;const o=`${s.value}:${t.value.updatedKey}`,e=await k();await v.setStorageItem(e,o,t.value.updatedContent),await v.removeStorageItem(e,t.value.key),S.replace({query:{storage:s.value,key:o}})}return(o,e)=>{const j=ve,Y=we,D=ye,ee=_e,q=Ce,P=ge,R=ke,te=be,ne=Ke;return n(s)?(r(),f(te,{key:0,"storage-key":"tab-storage"},{left:u(()=>[l("div",Ve,[m(j,{icon:"carbon-chevron-left","ml--1":"",border:!1,onClick:e[0]||(e[0]=a=>s.value="")}),l("div",Ne,[m(Y,{modelValue:n(s),"onUpdate:modelValue":e[1]||(e[1]=a=>U(s)?s.value=a:null),n:"primary",icon:"carbon-data-base"},{default:u(()=>[(r(!0),i(w,null,A(n(V),(a,c)=>(r(),i("option",{key:c,value:c},b(c),9,$e))),128))]),_:1},8,["modelValue"])])]),m(D,{modelValue:n(x),"onUpdate:modelValue":e[2]||(e[2]=a=>U(x)?x.value=a:null),icon:"carbon-search",placeholder:"Search...",n:"primary sm",border:"y x-none base! rounded-0",class:"w-full py2 ring-0!"},null,8,["modelValue"]),(r(!0),i(w,null,A(n(Z),a=>(r(),i(w,{key:a},[l("button",{block:"","w-full":"",truncate:"",px2:"",py1:"","text-start":"","text-sm":"","font-mono":"",class:F(a===n(t)?.key?"text-primary n-bg-active":"text-secondary hover:n-bg-hover"),onClick:c=>_.value=a},b($(a)),11,Ie),e[8]||(e[8]=l("div",{"x-divider":""},null,-1))],64))),128)),m(D,{modelValue:n(y),"onUpdate:modelValue":e[3]||(e[3]=a=>U(y)?y.value=a:null),icon:"carbon-add",placeholder:"key",n:"sm",border:"t-none x-none base! rounded-0",class:"w-full py2 font-mono ring-0!",onKeyup:B(H,["enter"])},null,8,["modelValue"])]),right:u(()=>[n(t)?.key?(r(),i("div",he,[l("div",je,[l("div",De,[n(t).editingKey?(r(),f(D,{key:0,modelValue:n(t).updatedKey,"onUpdate:modelValue":e[4]||(e[4]=a=>n(t).updatedKey=a),onKeyup:B(X,["enter"])},null,8,["modelValue"])):(r(),i("code",Me,[d(b($(n(t).key))+" ",1),m(ee,{icon:"carbon-edit",class:"cursor-pointer op50 hover:op100",onClick:e[5]||(e[5]=a=>n(t).editingKey=!0)})])),n(t).editingKey?z("",!0):(r(),f(j,{key:2,n:"green xs",disabled:n(t).content===n(t).updatedContent,class:F({"border-green":n(t).content!==n(t).updatedContent}),onClick:h},{default:u(()=>e[9]||(e[9]=[d(" Save ")])),_:1},8,["disabled","class"]))]),l("div",null,[m(j,{n:"red xs",onClick:Q},{default:u(()=>e[10]||(e[10]=[d(" Delete ")])),_:1})])]),typeof n(t).content=="object"?(r(),f(n(Se),me({key:0,modelValue:n(t).updatedContent,"onUpdate:modelValue":e[6]||(e[6]=a=>n(t).updatedContent=a),class:[[n(C)==="dark"?"jse-theme-dark":"light"],"json-editor-vue h-full of-auto text-sm outline-none"]},o.$attrs,{mode:"text","navigation-bar":!1,indentation:2,"tab-size":2}),null,16,["modelValue","class"])):pe((r(),i("textarea",{key:1,"onUpdate:modelValue":e[7]||(e[7]=a=>n(t).updatedContent=a),placeholder:"Item value...",class:"h-full of-auto p-4 text-sm font-mono outline-none",onKeyup:B(fe(h,["ctrl"]),["enter"])},null,40,Ue)),[[ce,n(t).updatedContent]])])):(r(),f(R,{key:1},{default:u(()=>[m(P,{px6:"",py4:""},{default:u(()=>[e[12]||(e[12]=d(" Select one key to start.")),e[13]||(e[13]=l("br",null,null,-1)),e[14]||(e[14]=d("Learn more about ")),m(q,{href:"https://nitro.unjs.io/guide/storage",n:"orange",target:"_blank"},{default:u(()=>e[11]||(e[11]=[d(" Nitro storage ")])),_:1})]),_:1})]),_:1}))]),_:1})):(r(),f(R,{key:1},{default:u(()=>[Object.keys(n(V)).length?(r(),i("p",Ae," Select one storage to start: ")):(r(),i("p",Be,[e[16]||(e[16]=d(" No custom storage defined in ")),e[17]||(e[17]=l("code",null,"nitro.storage",-1)),e[18]||(e[18]=d(".")),e[19]||(e[19]=l("br",null,null,-1)),e[20]||(e[20]=d(" Learn more about ")),m(q,{href:"https://nitro.unjs.io/guide/storage",n:"orange",target:"_blank"},{default:u(()=>e[15]||(e[15]=[d(" Nitro storage ")])),_:1})])),(r(!0),i(w,null,A(n(V),(a,c)=>(r(),f(P,{key:c,"min-w-80":"","cursor-pointer":"","p-4":"","text-left":"",hover:"border-green",onClick:Re=>s.value=c},{default:u(()=>[l("span",Le,b(c),1),e[21]||(e[21]=l("br",null,null,-1)),l("span",qe,b(a.driver)+" driver",1),e[22]||(e[22]=l("br",null,null,-1)),a.base?(r(),f(ne,{key:0,"text-xs":"",filepath:a.base},null,8,["filepath"])):z("",!0)]),_:2},1032,["onClick"]))),128))]),_:1}))}}}),Je=O({__name:"storage",setup(J){return(p,g)=>{const C=Pe,K=xe;return r(),f(K,null,{default:u(()=>[m(C)]),_:1})}}});export{Je as default};