@limetech/lime-elements
Version:
23 lines • 850 B
TypeScript
export declare const tokenizeHotkeyString: (hotkey: string) => string[];
/**
* Normalize a user-defined hotkey string to the canonical format.
*
* Returns `null` for empty/invalid inputs or if the string only contains
* modifiers (e.g. `"ctrl+shift"`).
*
* If multiple non-modifier keys are present, only the last one is used
* (e.g. `"ctrl+a+b"` becomes `"ctrl+b"`).
*
* @param hotkey - User-provided hotkey string.
*/
export declare const normalizeHotkeyString: (hotkey: string) => string | null;
/**
* Convert a `KeyboardEvent` into a canonical hotkey string.
*
* Uses `event.code` when possible for letter/digit keys to avoid
* layout-dependent results.
*
* @param event - Keyboard event to normalize.
*/
export declare const hotkeyFromKeyboardEvent: (event: KeyboardEvent) => string | null;
//# sourceMappingURL=hotkeys.d.ts.map