1 | export interface KeyCodeTable {
|
2 | [code: number]: string;
|
3 | }
|
4 | export interface KeyCodeReverseTable {
|
5 | [key: string]: number;
|
6 | }
|
7 | export interface KeyMap {
|
8 | [key: string]: string;
|
9 | }
|
10 | export declare const MODIFIER_BIT_MASKS: KeyCodeReverseTable;
|
11 | export declare const CONFIG_ALIASES: KeyMap;
|
12 | /**
|
13 | * Key mapping used in getKeyCombo() implementation for physical keys which are not alphabet characters or digits.
|
14 | *
|
15 | * N.B. at some point, we should stop using this mapping, since we can implement the desired functionality in a more
|
16 | * straightforward way by using the `event.code` property, which will always tell us the identifiers represented by the
|
17 | * _values_ in this object (the default physical keys, unaltered by modifier keys or keyboard layout).
|
18 | */
|
19 | export declare const SHIFT_KEYS: KeyMap;
|
20 | export interface KeyCombo {
|
21 | key?: string;
|
22 | modifiers: number;
|
23 | }
|
24 | export declare function comboMatches(a: KeyCombo, b: KeyCombo): boolean;
|
25 | /**
|
26 | * Converts a key combo string into a key combo object. Key combos include
|
27 | * zero or more modifier keys, such as `shift` or `alt`, and exactly one
|
28 | * action key, such as `A`, `enter`, or `left`.
|
29 | *
|
30 | * For action keys that require a shift, e.g. `@` or `|`, we inlude the
|
31 | * necessary `shift` modifier and automatically convert the action key to the
|
32 | * unshifted version. For example, `@` is equivalent to `shift+2`.
|
33 | */
|
34 | export declare const parseKeyCombo: (combo: string) => KeyCombo;
|
35 | /**
|
36 | * Interprets a keyboard event as a valid KeyComboTag `combo` prop string value.
|
37 | *
|
38 | * Note that this function is only used in the docs example and tests; it is not used by `useHotkeys()` or any
|
39 | * Blueprint consumers that we are currently aware of.
|
40 | */
|
41 | export declare const getKeyComboString: (e: KeyboardEvent) => string;
|
42 | /**
|
43 | * Determines the key combo object from the given keyboard event. A key combo includes zero or more modifiers
|
44 | * (represented by a bitmask) and one physical key. For most keys, we prefer dealing with the `code` property of the
|
45 | * event, since this is not altered by keyboard layout or the state of modifier keys. Fall back to using the `key`
|
46 | * property.
|
47 | *
|
48 | * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
|
49 | */
|
50 | export declare const getKeyCombo: (e: KeyboardEvent) => KeyCombo;
|
51 | /**
|
52 | * Splits a key combo string into its constituent key values and looks up
|
53 | * aliases, such as `return` -> `enter`.
|
54 | *
|
55 | * Unlike the parseKeyCombo method, this method does NOT convert shifted
|
56 | * action keys. So `"@"` will NOT be converted to `["shift", "2"]`).
|
57 | */
|
58 | export declare const normalizeKeyCombo: (combo: string, platformOverride: string | undefined) => string[];
|
59 | export declare function isMac(platformOverride: string | undefined): boolean;
|