adaptorex
Version:
Connect all your live interactive storytelling devices and software
2 lines (1 loc) • 7.71 kB
JavaScript
import{u as w,c as P,r as M,a as N,d as a,o as l,e,f as b,g as r,F as C,h as O,B as L,i as c,l as h,C as E,t as _,j as p,k as T,D as F,m as V,_ as j}from"./index-BpVbOCok.js";import{_ as S}from"./FoldOut-DMTy7aLC.js";const R={class:"level-left"},q={class:"level-item"},G={class:"is-uppercase"},U={key:0,class:"level-item"},z=["href"],H={key:0,class:"level-right"},J={class:"level-item"},K={class:"level-item"},Q={class:"level-item"},W={key:1},X={key:2},Y={class:"is-uppercase"},Z={class:"level"},ee={class:"level-left"},se={class:"level-item"},te={class:""},le={class:"level-right"},ne={class:"level-item"},oe={class:"level-item"},ae={class:"level-item"},ie={class:"level-item"},ce={class:"level-item"},re={class:"button"},de=e("div",null,null,-1),ue=e("h2",{class:"m-2 mb-3"},"AVAILABLE",-1),me={class:"plugin-settings-container has-background-purple-5"},he={class:"level"},_e={class:"level-left is-flex-shrink-1"},ve={class:"level-item"},pe={class:"is-uppercase"},ge={class:"level-item is-flex-shrink-1"},be={class:"content is-small"},ke=["href"],fe={class:"level-right"},Ce={class:"level-item"},$e={__name:"PluginSettings",setup(B,{expose:$}){const v=w();$({onVisible:()=>{v.dispatch("plugins/getAvailable"),v.dispatch("plugins/getInstalled")}}),v.dispatch("plugins/getAvailable"),v.dispatch("plugins/getInstalled");const y=P(()=>v.state.plugins.plugins),k=P(()=>v.getters["plugins/availablePlugins"]),t=M({visible:!1,plugin:null,collection:null,item:null});function u({plugin:i,collection:d,item:n}){t.value.plugin=i,t.value.collection=d,t.value.item=n,t.value.visible=!0}return(i,d)=>{const n=N("Icon");return l(),a(C,null,[(l(!0),a(C,null,O(y.value,s=>(l(),a("div",{key:s.name,class:L(["plugin-settings-container",[s.core?"has-background-light":"has-background-white"]])},[c(S,null,{header:h(()=>[e("nav",{class:L(["level",[s.core?"":" is-interactive"]])},[e("div",R,[e("div",q,[e("h1",G,_(s.package?.title||s.name),1)]),s.package?.homepage&&s.package?.homepage!=""?(l(),a("div",U,[e("a",{class:"is-flex pl-1",href:s.package?.homepage,target:"_blank",rel:"noopener noreferrer"},[c(n,{class:"has-text-grey",icon:"help-circle",tooltip:"Open Documentation",interactive:!1})],8,z)])):r("",!0)]),s.core?r("",!0):(l(),a("div",H,[e("div",J,[s.connectible?(l(),b(n,{key:0,class:"m-1",icon:"circle",tooltip:`Plugin ${s.connected?"connected":"disconnected"}`,fill:s.connected?"green":"red",interactive:!1},null,8,["tooltip","fill"])):r("",!0)]),e("div",K,[c(n,{icon:"refresh-cw",tooltip:"Reload Plugin",class:"m-1",onClick:p(I=>i.$store.dispatch("plugins/load",{plugin:s.name}),["stop"])},null,8,["onClick"])]),e("div",Q,[c(n,{icon:"trash",tooltip:"Delete Plugin",onClick:p(I=>i.$store.dispatch("plugins/remove",{plugin:s.name}),["stop"])},null,8,["onClick"])])]))],2)]),default:h(({toggleFold:I})=>[s.core?r("",!0):(l(),b(E,{key:0,schema:s.settings.schema,data:s.settings?.data||{},onOnConfirm:g=>i.$store.dispatch("plugins/updateSettings",{plugin:s.name,data:g}),onOnClose:I},null,8,["schema","data","onOnConfirm","onOnClose"])),s.core?r("",!0):(l(),a("br",W)),!s.core&&s.items?.length?(l(),a("h2",X,"ITEMS")):r("",!0),(l(!0),a(C,null,O(s.items,(g,m,D)=>(l(),a("div",{key:D,class:"ml-2 m-1 p-1"},[e("h2",Y,_(m),1),(l(!0),a(C,null,O(g.items,(o,A)=>(l(),a("div",{key:m+"_item_"+A,class:"mb-2 p-2 has-background-blue-4 has-text-black"},[c(S,{class:"has-background-blue-5"},{header:h(()=>[e("nav",Z,[e("div",ee,[e("div",se,[e("p",te,_(o?.name||`${m}_${D}`),1)])]),e("div",le,[e("p",ne,[o.connectible?(l(),b(n,{key:0,class:"has-text-black",icon:"plug",title:"Connect Item",onClick:p(f=>i.$store.dispatch("plugins/connectItem",{plugin:s.name,collection:m,item:o._id}),["stop"])},null,8,["onClick"])):r("",!0)]),e("p",oe,[o.connectible?(l(),b(n,{key:0,class:"has-text-black",icon:"unplug",title:"Disconnect Item",onClick:p(f=>i.$store.dispatch("plugins/disconnectItem",{plugin:s.name,collection:m,item:o._id}),["stop"])},null,8,["onClick"])):r("",!0)]),e("p",ae,[o.connectible?(l(),b(n,{key:0,icon:"circle",tooltip:`Item ${o.connected?"connected":"disconnected"}`,fill:o.connected?"green":"red"},null,8,["tooltip","fill"])):r("",!0)]),e("p",ie,[c(n,{class:"has-text-black",icon:"refresh-cw",title:"Reload Plugin Item",onClick:p(f=>i.$store.dispatch("plugins/loadItem",{plugin:s.name,collection:m,item:o._id}),["stop"])},null,8,["onClick"])]),e("p",ce,[c(n,{icon:"trash",title:"Delete Plugin Item",class:"has-text-black my-2 mr-2",onClick:p(f=>u({plugin:s.name,collection:m,item:o._id||o.name}),["stop"])},null,8,["onClick"])])])])]),default:h(f=>[c(E,{schema:g.schema,data:o,onOnConfirm:x=>i.$store.dispatch("plugins/editItem",{plugin:s.name,collection:m,item:o._id,data:x}),onOnClose:f.toggleFold},null,8,["schema","data","onOnConfirm","onOnClose"])]),_:2},1024)]))),128)),c(S,{class:"has-background-blue-5"},{header:h(()=>[e("button",re,[c(n,{icon:"plus-circle"})])]),default:h(o=>[c(E,{schema:g.schema,data:T(F)(g.schema),"confirm-on-unmount":!1,onOnConfirm:A=>{i.$store.dispatch("plugins/addItem",{plugin:s.name,collection:m,data:A}),o.toggleFold()},onOnClose:o.toggleFold},null,8,["schema","data","onOnConfirm","onOnClose"])]),_:2},1024),de]))),128))]),_:2},1024)],2))),128)),ue,(l(!0),a(C,null,O(k.value,s=>(l(),a("div",{key:s},[e("div",me,[e("nav",he,[e("div",_e,[e("div",ve,[e("h1",pe,_(s.title||s.name),1)]),e("div",ge,[e("div",be,[V(_(s.description)+" ",1),s.homepage&&s.homepage!=""?(l(),a("a",{key:0,class:"",href:s.homepage,target:"_blank",rel:"noopener noreferrer"}," More information ",8,ke)):r("",!0)])])]),e("div",fe,[e("div",Ce,[c(n,{icon:"plus-circle",class:"has-text-black",tooltip:"Activate Plugin",interactive:!0,onClick:p(I=>i.$store.dispatch("plugins/install",{plugin:s.name}),["stop"])},null,8,["onClick"])])])])])]))),128)),t.value.visible?(l(),b(j,{key:0,modal:t.value,"css-classes":["is-danger"],onCloseModal:d[2]||(d[2]=s=>t.value.visible=!1)},{header:h(()=>[V("Delete Plugin Item "+_(t.value.item),1)]),default:h(()=>[e("p",null," Do you really want to delete the "+_(t.value.collection)+" Item of the plugin "+_(t.value.plugin)+"? ",1)]),footer:h(()=>[e("button",{class:"button is-danger m-1",onClick:d[0]||(d[0]=s=>i.$store.dispatch("plugins/removeItem",{plugin:t.value.plugin,collection:t.value.collection,item:t.value.item}).then(()=>t.value.visible=!1))}," DELETE "),e("button",{class:"button m-1",onClick:d[1]||(d[1]=s=>t.value.visible=!1)},"CANCEL")]),_:1},8,["modal"])):r("",!0)],64)}}},ye={class:"is-clipped-container is-flex is-flex-direction-column has-background-purple-5 p-4"},Ie=e("h1",{class:"title is-5 is-uppercase"},"Settings",-1),Oe={class:"tabs"},Pe=e("a",null,"PLUGINS",-1),Ae=[Pe],Ee=e("a",null,"SETUP",-1),Se=[Ee],De={class:"tab-container is-scroll-container"},Le={id:"tab_plugins",class:"tab-content"},Ve={id:"tab_setup",class:"tab-content is-hidden"},xe={__name:"GameSettings",setup(B){const $=w();P(()=>$.state.game.selected);const v=P(()=>$.state.game.setup);function y(k,t,u){const i=document.querySelectorAll("li.tab-link:not(.dashboard)"),d=document.querySelectorAll("div.tab-content:not(.dashboard)");Array.from(i).forEach(n=>n.classList.remove("is-active")),Array.from(d).forEach(n=>n.classList.add("is-hidden")),document.getElementById(t).classList.remove("is-hidden"),k.currentTarget.classList.add("is-active"),u&&Object.prototype.hasOwnProperty.call(u,"onVisible")&&u.onVisible()}return(k,t)=>(l(),a("div",ye,[Ie,e("div",Oe,[e("ul",null,[e("li",{class:"tab-link is-active",onClick:t[0]||(t[0]=u=>y(u,"tab_plugins",k.$refs.pluginComponent))},Ae),e("li",{class:"tab-link",onClick:t[1]||(t[1]=u=>y(u,"tab_setup"))},Se)])]),e("div",De,[e("div",Le,[c($e,{ref:"pluginComponent"},null,512)]),e("div",Ve,[e("div",null,_(v.value),1)])])]))}};export{xe as default};