import { ref } from 'vue' import { defineStore } from 'pinia' export const useCommandPalattesStore = defineStore('command_palettes', () => { const open = ref(false); const controlStatus = ref(false) const keyFStatus = ref(false) function showCommandPalettes() { open.value = true; } function handleOnDismissCommandPalettes() { open.value = false; } function onKeyPressed(event: KeyboardEvent) { if (event.key === 'Control') { console.log('control pressed'); controlStatus.value = true } if (event.key === 'f') { console.log('f pressed'); keyFStatus.value = true } if (controlStatus.value && keyFStatus.value) { showCommandPalettes() } } function onKeyUp(event: KeyboardEvent) { if (event.key === 'Control') { console.log('control released'); controlStatus.value = false } if (event.key === 'f') { console.log('f released'); keyFStatus.value = false } } return { open, showCommandPalettes, handleOnDismissCommandPalettes, onKeyPressed, onKeyUp } })