UNPKG

adaptorex

Version:

Connect all your live interactive storytelling devices and software

11 lines (7 loc) 7.29 kB
import{u as j,c as C,r as k,a as P,o as i,b as d,d as e,j as v,v as p,l as B,f as u,w as r,g,k as E,i as L,F as D,e as T,h as q,t as F,P as O}from"./index-BijsIkza.js";import{_ as S}from"./FoldOut-riUX07ZO.js";const Y={key:0,class:"has-background-purple-5 p-5 is-scroll-container"},K=e("p",{class:"title is-4 is-uppercase"},"level Config",-1),W=e("p",{class:"title is-4 is-uppercase"},"Name",-1),z={class:"table-container"},J={class:"table has-background-transparent is-bordered"},R={class:"has-background-white p-0",style:{width:"20ch"}},G={class:"control"},H=["disabled"],Q={key:0},X={key:1},Z=e("br",null,null,-1),ee={class:"title is-4 is-uppercase"},te={href:"https://docs.adaptorex.org/basics/variables.html#level-attributes",target:"_blank",rel:"noopener noreferrer"},se={class:"table-container"},le={class:"table has-background-transparent is-bordered"},ae=e("thead",null,[e("tr",null,[e("th",{class:"has-background-white",style:{width:"20ch"}},"NAME"),e("th",{class:"has-background-white",style:{width:"60ch"}},"VALUE")])],-1),oe={class:"has-background-white p-0"},ne={class:"control"},ie=["onUpdate:modelValue","disabled"],ce={class:"has-background-white p-0"},re={class:"control"},ue=["onUpdate:modelValue","disabled"],de=["disabled"],he={class:"title is-4 is-uppercase mt-6",title:"Define arguments that can be passed at the start of the level and/or that are available with default values as variables in the level."},ve={href:"https://docs.adaptorex.org/basics/variables.html#item-container-and-level-arguments",target:"_blank",rel:"noopener noreferrer"},pe=e("p",{class:"subtitle is-6"},null,-1),_e=e("br",null,null,-1),be={class:"table-container"},fe={class:"table has-background-transparent is-bordered"},me=e("thead",null,[e("tr",null,[e("th",{class:"has-background-white",style:{width:"20ch"}},"NAME"),e("th",{class:"has-background-white",style:{width:"20ch"}},"TYPE"),e("th",{class:"has-background-white",style:{width:"40ch"}},"DEFAULT VALUE")])],-1),ke={class:"has-background-white p-0"},ge={class:"control"},ye=["onUpdate:modelValue","disabled"],we={class:"has-background-white p-0"},$e={class:"control"},Ce=["onUpdate:modelValue","disabled"],Ve={class:"has-background-white p-0"},Ae={class:"control"},Ne=["onUpdate:modelValue","disabled"],Ue=["disabled"],xe=e("hr",null,null,-1),Ee={class:"is-flex is-flex-direction-row is-align-items-center"},Le=e("div",null,"Raw Config",-1),De={class:"is-size-7"},Me={__name:"LevelConfig",setup(Te){const _=j(),y=C(()=>_.state.level.selected),V=C(()=>_.state.level.data.config||{arguments:{}}),b=C(()=>Object.entries(V.value).filter(([c])=>c!="arguments")),f=C(()=>Object.entries(V.value.arguments).map(([c,t])=>[c,t.type||t.collection,t.value||t.query])),n=k(void 0),h=k(!1),w=k(null),$=k(!1),m=k(y.value);function I(){$.value=!0,O(()=>N())}function A(){_.dispatch("level/editName",m.value).then(()=>$.value=!1).catch(N())}function M(){m.value=y.value}function N(){w.value.focus,w.value.setActive,w.value.select()}function U(c){let t={[`config.${c}`]:""};_.dispatch("level/edit",{operator:"_remove",query:t}),h.value=!1}function x(){let c=b.value.reduce((t,[l,s])=>(t[l]=s,t),{});c.arguments=f.value.reduce((t,[l,s,o])=>(t[l]={type:s,value:o},t),{}),_.dispatch("level/edit",{operator:"_set",query:{config:c}}),n.value=void 0,h.value=!1}return(c,t)=>{const l=P("Icon");return y.value?(i(),d("div",Y,[K,W,e("div",z,[e("table",J,[e("thead",null,[e("tr",null,[e("td",R,[e("div",G,[v(e("input",{ref_key:"nameInput",ref:w,"onUpdate:modelValue":t[0]||(t[0]=s=>m.value=s),class:"input has-overflow-ellipsis is-cursor-default has-text-black",type:"text",disabled:!$.value,onKeyup:B(A,["enter"])},null,40,H),[[p,m.value]])])]),$.value?(i(),d("div",Q,[u(l,{icon:"check-square",class:"m-3",onClick:r(A,["stop"])}),m.value!==y.value?(i(),g(l,{key:0,icon:"rotate-ccw",class:"my-3",onClick:r(M,["stop"])})):E("",!0)])):(i(),d("div",X,[u(l,{icon:"edit",class:"m-3",onClick:r(I,["stop"])})]))])])])]),Z,e("p",ee,[L(" Attributes "),e("a",te,[u(l,{class:"has-text-dark",icon:"help-circle",tooltip:"Attributes can be used as simple variables in the level, or are displayed at certain places (e.g. the Status of the level in the Level Overview).",interactive:!0},null,8,["tooltip"])])]),e("div",se,[e("table",le,[ae,e("tbody",null,[(i(!0),d(D,null,T(b.value,(s,o)=>(i(),d("tr",{key:`attr_${o}`},[e("td",oe,[e("div",ne,[v(e("input",{"onUpdate:modelValue":a=>s[0]=a,class:"input has-overflow-ellipsis is-cursor-default has-text-black",type:"text",disabled:n.value!=`attr_${o}`},null,8,ie),[[p,s[0]]])])]),e("td",ce,[e("div",re,[v(e("input",{"onUpdate:modelValue":a=>s[1]=a,class:"input has-overflow-ellipsis is-cursor-default has-text-black",type:"text",disabled:n.value!=`attr_${o}`},null,8,ue),[[p,s[1]]])])]),e("div",null,[n.value==`attr_${o}`?(i(),g(l,{key:0,icon:"check-square",class:"m-3",onClick:t[1]||(t[1]=r(a=>x(),["stop"]))})):(i(),g(l,{key:1,icon:"edit",class:"m-3",onClick:r(a=>n.value=`attr_${o}`,["stop"])},null,8,["onClick"])),u(l,{icon:"trash-2",onClick:r(a=>U(s[0]),["stop"])},null,8,["onClick"])])]))),128))])])]),e("div",null,[e("button",{class:"button is-link",disabled:h.value,onClick:t[2]||(t[2]=s=>{b.value.push([`attribute${b.value.length-1}`,"-"]),n.value=`attr_${b.value.length-1}`,h.value=!0})}," ADD NEW ",8,de)]),e("p",he,[L(" Arguments "),e("a",ve,[u(l,{class:"has-text-dark",icon:"help-circle",tooltip:`Arguments are values or items that are forwarded to the new session at the start of the level. NAME: Variable name to use argument in the level. TYPE (optional): Data Type (string, number, array, object) or name of the collection the value is from. DEFAULT VALUE (optional): A value the argument has if it was not specified on session start. Can be an item name or query if TYPE is an items collection.`,interactive:!0},null,8,["tooltip"])])]),pe,_e,e("div",be,[e("table",fe,[me,e("tbody",null,[(i(!0),d(D,null,T(f.value,(s,o)=>(i(),d("tr",{key:`args_${o}`},[e("td",ke,[e("div",ge,[v(e("input",{"onUpdate:modelValue":a=>s[0]=a,class:"input has-overflow-ellipsis is-cursor-default has-text-black",type:"text",disabled:n.value!=`args_${o}`},null,8,ye),[[p,s[0]]])])]),e("td",we,[e("div",$e,[v(e("input",{"onUpdate:modelValue":a=>s[1]=a,class:"input has-overflow-ellipsis is-cursor-default has-text-black",type:"text",disabled:n.value!=`args_${o}`},null,8,Ce),[[p,s[1]]])])]),e("td",Ve,[e("div",Ae,[v(e("input",{"onUpdate:modelValue":a=>s[2]=a,class:"input has-overflow-ellipsis is-cursor-default has-text-black",type:"text",disabled:n.value!=`args_${o}`},null,8,Ne),[[p,s[2]]])])]),e("div",null,[n.value==`args_${o}`?(i(),g(l,{key:0,icon:"check-square",class:"m-3",onClick:t[3]||(t[3]=r(a=>x(),["stop"]))})):(i(),g(l,{key:1,icon:"edit",class:"m-3",onClick:r(a=>n.value=`args_${o}`,["stop"])},null,8,["onClick"])),u(l,{icon:"trash-2",onClick:r(a=>U(`arguments.${s[0]}`),["stop"])},null,8,["onClick"])])]))),128))])])]),e("div",null,[e("button",{class:"button is-link",disabled:h.value,onClick:t[4]||(t[4]=s=>{f.value.push([`argument${f.value.length-1}`,,]),n.value=`args_${f.value.length-1}`,h.value=!0})}," ADD NEW ",8,Ue)]),xe,u(S,null,{header:q(()=>[e("div",Ee,[Le,u(l,{icon:"chevron-right",class:"m-4"})])]),default:q(()=>[e("pre",De,F(JSON.stringify(V.value,null,4)),1)]),_:1})])):E("",!0)}}};export{Me as default};