1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
// https://www.w3.org/TR/uievents-key/#keys-modifier
export enum ModifierKeys {
Alt = 'Alt',
Shift = 'Shift',
AltGraph = 'AltGraph',
CapsLock = 'CapsLock',
Control = 'Control',
Fn = 'Fn',
FnLock = 'FnLock',
Meta = 'Meta',
NumLock = 'NumLock',
ScrollLock = 'ScrollLock',
Symbol = 'Symbol',
SymbolLock = 'SymbolLock',
}
export enum EditingKeys {
Backspace = 'Backspace',
Delete = 'Delete',
}
export enum UIKeys {
Escape = 'Escape',
}
export enum NavigationKeys {
ArrowUp = 'ArrowUp',
ArrowDown = 'ArrowDown',
ArrowLeft = 'ArrowLeft',
ArrowRight = 'ArrowRight',
}
export type OSforKeys = 'macOS' | 'Windows' | 'Other';
export const modifierSymbols: Record<
ModifierKeys | EditingKeys | UIKeys | NavigationKeys,
{ macOS?: string, Windows?: string, Other: string }
> = {
Alt: { macOS: '⌥', Other: 'Alt' },
AltGraph: { macOS: '⌥', Other: 'Alt' },
CapsLock: { Other: '⇪' },
Control: { macOS: '⌃', Other: 'Ctrl' },
Fn: { macOS: 'fn', Other: 'Fn' },
FnLock: { macOS: 'fn', Other: 'Fn' },
Meta: { macOS: '⌘', Windows: '⊞ Win', Other: 'Meta' },
NumLock: { macOS: '⇭', Other: 'Num' },
ScrollLock: { macOS: '⤓', Other: 'ScrLk' },
Shift: { Other: 'Shift', macOS: '⇧' },
Symbol: { macOS: '⎄', Other: 'Sym' },
SymbolLock: { macOS: '⎄', Other: 'Sym' },
Escape: { macOS: '⎋', Other: 'Esc' },
Delete: { macOS: '⌦', Other: 'Del' },
Backspace: { macOS: '⌫', Other: '⟵' },
ArrowUp: { Other: '↑' },
ArrowDown: { Other: '↓' },
ArrowLeft: { Other: '←' },
ArrowRight: { Other: '→' },
};
export const keySymbols: Record<string, { macOS?: string, Windows?: string, Other: string }> = {
' ': { Other: '␣' },
'Tab': { macOS: '⇥', Other: '⭾' },
'Enter': { macOS: '↩', Other: '↵' },
'Escape': { macOS: '⎋', Other: 'Esc' },
'Backspace': { macOS: '⌫', Other: '⟵' },
'ArrowUp': { Other: '↑' },
'ArrowDown': { Other: '↓' },
'ArrowLeft': { Other: '←' },
'ArrowRight': { Other: '→' },
'Insert': { Other: 'Ins' },
'Delete': { macOS: '⌦', Other: 'Del' },
'Home': { macOS: '↖', Other: 'Home' },
'End': { macOS: '↘', Other: 'End' },
'PageUp': { macOS: '⇞', Other: 'PgUp' },
'PageDown': { macOS: '⇟', Other: 'PgDn' },
'Shift': { macOS: '⇧', Other: 'Shift' },
'PrintScreen': { Other: 'PrtSc' },
'ScrollLock': { macOS: '⤓', Other: 'ScrLk' },
'Pause': { macOS: '⎉', Other: 'Pause' },
};
|