first commit

This commit is contained in:
Dede Fuji Abdul
2023-10-16 09:00:27 +07:00
commit 275153649c
75 changed files with 20360 additions and 0 deletions

47
src/stores/command.ts Normal file
View File

@@ -0,0 +1,47 @@
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 }
})