// Shared open/close state for the ⌘K command palette. The trigger lives on
// the topbar and on the global keyboard shortcut handler, while the rendered
// panel lives in the default layout — they all read/write the same ref via
// this composable.

const isOpen = ref(false)

export const useCommandPalette = () => ({
  isOpen,
  open: () => {
    isOpen.value = true
  },
  close: () => {
    isOpen.value = false
  },
  toggle: () => {
    isOpen.value = !isOpen.value
  },
})
