1 | export interface IKeyCodeTable {
|
2 | [code: number]: string;
|
3 | }
|
4 | export interface IKeyCodeReverseTable {
|
5 | [key: string]: number;
|
6 | }
|
7 | export interface IKeyMap {
|
8 | [key: string]: string;
|
9 | }
|
10 | export declare const KeyCodes: IKeyCodeTable;
|
11 | export declare const Modifiers: IKeyCodeTable;
|
12 | export declare const ModifierBitMasks: IKeyCodeReverseTable;
|
13 | export declare const Aliases: IKeyMap;
|
14 | export declare const ShiftKeys: IKeyMap;
|
15 | export interface IKeyCombo {
|
16 | key?: string;
|
17 | modifiers: number;
|
18 | }
|
19 | export declare function comboMatches(a: IKeyCombo, b: IKeyCombo): boolean;
|
20 | /**
|
21 | * Converts a key combo string into a key combo object. Key combos include
|
22 | * zero or more modifier keys, such as `shift` or `alt`, and exactly one
|
23 | * action key, such as `A`, `enter`, or `left`.
|
24 | *
|
25 | * For action keys that require a shift, e.g. `@` or `|`, we inlude the
|
26 | * necessary `shift` modifier and automatically convert the action key to the
|
27 | * unshifted version. For example, `@` is equivalent to `shift+2`.
|
28 | */
|
29 | export declare const parseKeyCombo: (combo: string) => IKeyCombo;
|
30 | /**
|
31 | * Converts a keyboard event into a valid combo prop string
|
32 | */
|
33 | export declare const getKeyComboString: (e: KeyboardEvent) => string;
|
34 | /**
|
35 | * Determines the key combo object from the given keyboard event. Again, a key
|
36 | * combo includes zero or more modifiers (represented by a bitmask) and one
|
37 | * action key, which we determine from the `e.which` property of the keyboard
|
38 | * event.
|
39 | */
|
40 | export declare const getKeyCombo: (e: KeyboardEvent) => IKeyCombo;
|
41 | /**
|
42 | * Splits a key combo string into its constituent key values and looks up
|
43 | * aliases, such as `return` -> `enter`.
|
44 | *
|
45 | * Unlike the parseKeyCombo method, this method does NOT convert shifted
|
46 | * action keys. So `"@"` will NOT be converted to `["shift", "2"]`).
|
47 | */
|
48 | export declare const normalizeKeyCombo: (combo: string, platformOverride?: string | undefined) => string[];
|