import { ICommand } from './command'; import { HotkeyRegistrationOptions } from './hotkeyHandler'; export * from './command'; type AbstractCommand = ICommand; export interface ICommandHandler { /** * @internal * Currently pressed keys */ pressedKeys: string[]; /** * Whether the command with the given name exists * @param name - Name of the command */ hasCommand(name: string): boolean; /** * Register a new command * @param name - Name of the command * @param command - Command definition */ registerCommand(name: string, command: T): void; /** * Executes the command with the given name * @param name - Name of the command * @param throwOnNonexisting - Whether to throw an error if the command with the specified name does not exist. * If set to `false` and the command doesn't exist, the method will just return undefined. */ executeCommand(name: string, throwOnNonexisting?: false, ...args: Parameters): ReturnType | void; /** * Executes the command with the given name * @param name - Name of the command * @param throwOnNonexisting - Whether to throw an error if the command with the specified name does not exist. * If set to `false` and the command doesn't exist, the method will just return `undefined`. */ executeCommand(name: string, throwOnNonexisting: true, ...args: Parameters): ReturnType; /** * Checks whether the command can be executed at the present time. * @param name - Name of the command * @param throwOnNonexisting - Whether to throw an error if the command with the specified name does not exist. * If set to `false` and the command doesn't exist, the method will just return `false`. */ canExecuteCommand(name: string, throwOnNonexisting?: boolean, ...args: Parameters): boolean; /** * Register a new hotkey combination for the command. * @param keys Combination of keys. When all keys in the given array are pressed at the same time, the command will be executed. * @param commandName Name of the command that should be executed when the keys are pressed. * @param options Options for the hotkey registration. */ registerHotkey(keys: string[], commandName: string, options?: HotkeyRegistrationOptions): void; /** @internal */ handleKeyUp(ev: KeyboardEvent): void; /** @internal */ handleKeyDown(ev: KeyboardEvent): void; } export declare const useCommandHandler: () => ICommandHandler;