-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.d.ts
232 lines (227 loc) · 3.39 KB
/
index.d.ts
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
declare const keyboardKey: {
/**
* Get the `keyCode` or `which` value from a keyboard event or `key` name.
* @param eventOrKey A keyboard event-like object or `key` name. If an object, at least one of
* `key`, `keyCode`, or `which` must be defined.
*/
getCode(eventOrKey: string | Pick<KeyboardEvent, 'key' | 'keyCode' | 'which'>): number | undefined
/**
* Get the key name from a keyboard event, `keyCode`, or `which` value.
* @param eventOrCode A keyboard event-like object or key code. If an object, at least one of
* `key`, `keyCode`, or `which` must be defined. If `key` is defined, it will be returned.
*/
getKey(
eventOrCode: number | Pick<KeyboardEvent, 'key' | 'keyCode' | 'which' | 'shiftKey'>,
): string | undefined
/**
* Mapping from numeric key code to key name. If the value is an array, the first element is the
* primary key name, and the second element is the key name when shift is pressed.
*/
codes: { [code: number]: string | [string, string] }
Cancel: 3
Help: 6
Backspace: 8
Tab: 9
Clear: 12
Enter: 13
Shift: 16
Control: 17
Alt: 18
Pause: 19
CapsLock: 20
Escape: 27
Convert: 28
NonConvert: 29
Accept: 30
ModeChange: 31
' ': 32
PageUp: 33
PageDown: 34
End: 35
Home: 36
ArrowLeft: 37
ArrowUp: 38
ArrowRight: 39
ArrowDown: 40
Select: 41
Print: 42
Execute: 43
PrintScreen: 44
Insert: 45
Delete: 46
0: 48
')': 48
1: 49
'!': 49
2: 50
'@': 50
3: 51
'#': 51
4: 52
$: 52
5: 53
'%': 53
6: 54
'^': 54
7: 55
'&': 55
8: 56
'*': 56
9: 57
'(': 57
a: 65
A: 65
b: 66
B: 66
c: 67
C: 67
d: 68
D: 68
e: 69
E: 69
f: 70
F: 70
g: 71
G: 71
h: 72
H: 72
i: 73
I: 73
j: 74
J: 74
k: 75
K: 75
l: 76
L: 76
m: 77
M: 77
n: 78
N: 78
o: 79
O: 79
p: 80
P: 80
q: 81
Q: 81
r: 82
R: 82
s: 83
S: 83
t: 84
T: 84
u: 85
U: 85
v: 86
V: 86
w: 87
W: 87
x: 88
X: 88
y: 89
Y: 89
z: 90
Z: 90
OS: 91
ContextMenu: 93
F1: 112
F2: 113
F3: 114
F4: 115
F5: 116
F6: 117
F7: 118
F8: 119
F9: 120
F10: 121
F11: 122
F12: 123
F13: 124
F14: 125
F15: 126
F16: 127
F17: 128
F18: 129
F19: 130
F20: 131
F21: 132
F22: 133
F23: 134
F24: 135
NumLock: 144
ScrollLock: 145
VolumeMute: 181
VolumeDown: 182
VolumeUp: 183
';': 186
':': 186
'=': 187
'+': 187
',': 188
'<': 188
'-': 189
_: 189
'.': 190
'>': 190
'/': 191
'?': 191
'`': 192
'~': 192
'[': 219
'{': 219
'\\': 220
'|': 220
']': 221
'}': 221
"'": 222
'"': 222
Meta: 224
AltGraph: 225
Attn: 246
CrSel: 247
ExSel: 248
EraseEof: 249
Play: 250
ZoomOut: 251
Spacebar: 32
Digit0: 48
Digit1: 49
Digit2: 50
Digit3: 51
Digit4: 52
Digit5: 53
Digit6: 54
Digit7: 55
Digit8: 56
Digit9: 57
Tilde: 192
GraveAccent: 192
ExclamationPoint: 49
AtSign: 50
PoundSign: 51
PercentSign: 53
Caret: 54
Ampersand: 55
PlusSign: 187
MinusSign: 189
EqualsSign: 187
DivisionSign: 191
MultiplicationSign: 56
Comma: 188
Decimal: 190
Colon: 186
Semicolon: 186
Pipe: 220
BackSlash: 220
QuestionMark: 191
SingleQuote: 222
DoubleQuote: 222
LeftCurlyBrace: 219
RightCurlyBrace: 221
LeftParenthesis: 57
RightParenthesis: 48
LeftAngleBracket: 188
RightAngleBracket: 190
LeftSquareBracket: 219
RightSquareBracket: 221
}
export = keyboardKey