/** * Keyboard Shortcuts Types * * Type definitions for keyboard shortcut management system */ /** * Platform-specific key definitions * Allows defining different keys for each platform */ export interface PlatformKeys { mac?: string[]; windows?: string[]; linux?: string[]; /** Fallback keys if platform-specific not defined */ default?: string[]; } export interface KeyboardShortcut { /** Unique identifier for this shortcut */ id: string; /** * Key combination(s) that trigger this shortcut * Can be a simple array: ['ctrl+k', 'cmd+k'] * Or platform-specific: { mac: ['cmd+k'], windows: ['ctrl+k'], linux: ['ctrl+k'] } * * For key sequences (like "g h" for "go home"): * Use space-separated keys: ['g h', 'g w'] - press g, then h or w * Sequences must be pressed within the sequence timeout (default 1000ms) */ keys: string[] | PlatformKeys; /** Human-readable description */ description: string; /** Category for grouping shortcuts (e.g., 'navigation', 'editing') */ category?: string; /** Action to execute when shortcut is triggered */ action: () => void; /** Whether this shortcut is enabled */ enabled?: boolean; /** Whether this is a global shortcut (works everywhere) */ global?: boolean; /** Disable on mobile/tablet devices */ disableOnMobile?: boolean; /** * Whether this shortcut is a key sequence (e.g., "g h") * If not specified, will be auto-detected based on space in key definition */ isSequence?: boolean; } export interface ShortcutConfig { shortcuts: KeyboardShortcut[]; enabled?: boolean; preventDefault?: boolean; stopPropagation?: boolean; } export interface ShortcutContext { registerShortcut: (shortcut: KeyboardShortcut) => void; unregisterShortcut: (id: string) => void; toggleShortcuts: (enabled: boolean) => void; getShortcuts: () => KeyboardShortcut[]; } export type ModifierKey = 'ctrl' | 'alt' | 'shift' | 'meta' | 'cmd'; export type KeyCombination = string | string[]; export interface UseKeyboardShortcutsReturn { handleKeyDown: (event: KeyboardEvent) => void; } export interface UseHotkeysReturn { register: (key: string, callback: () => void) => void; unregister: (key: string) => void; } export interface UseShortcutHelpReturn { isHelpVisible: boolean; showHelp: () => void; hideHelp: () => void; toggleHelp: () => void; shortcuts: KeyboardShortcut[]; } export type PlatformType = 'mac' | 'windows' | 'linux' | 'unknown'; export interface ParsedKeyCombo { modifiers: Set; key: string; } /** Available modifier keys for shortcut definitions */ export declare const MODIFIER_KEYS: readonly ModifierKey[]; /** Available platform types */ export declare const PLATFORM_TYPES: readonly PlatformType[]; //# sourceMappingURL=types.d.ts.map