import { ref, computed } from 'vue' import type { SideMenuItemType, UiPanelsType } from '~/typs/cmpnts' const reqError = ref({ defs: '', lang: '', data: '', gql: '', api: '' }) const currentMapKey = ref('') const isSidebarOpen = ref(false) const toggleSidebar = () => { isSidebarOpen.value = !isSidebarOpen.value } const showModal = ref(false) const isAsidePanelOpen = ref(false) const sideSettingButton = ref(false) const isSettingsPanelOpen = ref(false) const isSearchPanelOpen = ref(false) const usideSettingButton = ref(false) const isNotificationsPanelOpen = ref(false) const useSettings = ref(false) const useSearch = ref(false) const search = ref('') const bcPath = ref('') const navTitle = ref({ text: '', textclick: null as null | Function, title: '', cmpnt: '', ops: [] as any[], btntype: '', cllbck: null as null | Function, }) const dfltNavTitle = () => { navTitle.value = { text: '', textclick: null as null | Function, title: '', cmpnt: '', ops: [] as any[], btntype: '', cllbck: null as null | Function, } } // '#fa-book/biomagnetismo/microorganismos/virus' const bookCllbck = ref() const bookSelec = (data: string) => { if (data === '#') { bcPath.value = '' dfltNavTitle() } else { if (bookCllbck.value) bookCllbck.value(data) // else ... } } const sidebarMenuItems = ref([] as SideMenuItemType[]) const checkin = ref(false) const connection = ref({ state: '', }) const tsksrvcs = 'tsksrvcs' const appsrvcs = 'appsrvcs' const srvcstatus = 'srvcstatus' // const menu_items = ref([ // { id: tsksrvcs, title: 'Tasks', active: false, link: '#' }, // { id: appsrvcs, title: 'Applications', active: false, link: '#' }, // { id: srvcstatus, title: 'Informations', active: false, link: '#' }, // ]) const side_menu_click = ref() const app_home_click = ref() const backdrop_blur = ref(14) const back_opacity = ref(60) const panels = ref({} as UiPanelsType) const show_profile = ref(false) export default function useState() { return { reqError, currentMapKey, isSidebarOpen, toggleSidebar, isAsidePanelOpen, isSettingsPanelOpen, isSearchPanelOpen, isNotificationsPanelOpen, useSettings, usideSettingButton, sideSettingButton, bcPath, bookSelec, bookCllbck, navTitle, dfltNavTitle, checkin, connection, sidebarMenuItems, showModal, tsksrvcs, appsrvcs, srvcstatus, // menu_items, side_menu_click, app_home_click, useSearch, search, back_opacity, backdrop_blur, panels, show_profile, } }