gadgets
Version:
Reusable React UI widgets - This is my widget library. There are many like it, but this one is mine...
32 lines (31 loc) • 991 B
TypeScript
import { KeyMapOptions } from "react-hotkeys";
export interface KeyMap {
[key: string]: string | KeyMapOptions;
}
export interface KeyHandler {
[key: string]: (...args: any[]) => void;
}
export interface KeyCombo {
altKey: boolean;
ctrlKey: boolean;
key: string;
metaKey: boolean;
shiftKey: boolean;
}
/**
* Takes an keyboard combo in the HotKeys format and breaks it up into its
* constituent parts. It returns a `KeyCombo` structure that represents
* that combo. This structure includes:
*
* - .altKey {boolean}
* - .ctrlKey {boolean}
* - .key {string}
* - .metaKey {boolean}
* - .shiftKey {boolean}
*
* @param combo {string} - the keyboard combo keys to parse
* @param delimit="+" {string} - the characters that separates each part of
* the combo input key. Used to separate it into parts.
* @returns a `KeyCombo` structure that contains the new key parts.
*/
export declare function parseKeyCombo(combo: string, delimit?: string): KeyCombo;