const KEY_TO_NDS_BUTTON: Record = { ArrowUp: "UP", ArrowDown: "DOWN", ArrowLeft: "LEFT", ArrowRight: "RIGHT", D: "A", S: "B", Z: "X", Q: "Y", " ": "SELECT", Enter: "START", }; export const mapKeyToNDS = (key: string): string | null => { key = key.length === 1 ? key.toUpperCase() : key; return KEY_TO_NDS_BUTTON[key] ?? null; }; export const useMouseUp = (callback: () => void) => { onMounted(() => { document.addEventListener("mouseup", callback); }); onUnmounted(() => { document.removeEventListener("mouseup", callback); }); };