UNPKG

4.13 kBJavaScriptView Raw
1const MAC_ENTER = 3;
2const BACKSPACE = 8;
3const TAB = 9;
4const NUM_CENTER = 12;
5const ENTER = 13;
6const SHIFT = 16;
7const CONTROL = 17;
8const ALT = 18;
9const PAUSE = 19;
10const CAPS_LOCK = 20;
11const ESCAPE = 27;
12const SPACE = 32;
13const PAGE_UP = 33;
14const PAGE_DOWN = 34;
15const END = 35;
16const HOME = 36;
17const LEFT_ARROW = 37;
18const UP_ARROW = 38;
19const RIGHT_ARROW = 39;
20const DOWN_ARROW = 40;
21const PLUS_SIGN = 43;
22const PRINT_SCREEN = 44;
23const INSERT = 45;
24const DELETE = 46;
25const ZERO = 48;
26const ONE = 49;
27const TWO = 50;
28const THREE = 51;
29const FOUR = 52;
30const FIVE = 53;
31const SIX = 54;
32const SEVEN = 55;
33const EIGHT = 56;
34const NINE = 57;
35const FF_SEMICOLON = 59; // Firefox (Gecko) fires this for semicolon instead of 186
36const FF_EQUALS = 61; // Firefox (Gecko) fires this for equals instead of 187
37const QUESTION_MARK = 63;
38const AT_SIGN = 64;
39const A = 65;
40const B = 66;
41const C = 67;
42const D = 68;
43const E = 69;
44const F = 70;
45const G = 71;
46const H = 72;
47const I = 73;
48const J = 74;
49const K = 75;
50const L = 76;
51const M = 77;
52const N = 78;
53const O = 79;
54const P = 80;
55const Q = 81;
56const R = 82;
57const S = 83;
58const T = 84;
59const U = 85;
60const V = 86;
61const W = 87;
62const X = 88;
63const Y = 89;
64const Z = 90;
65const META = 91; // WIN_KEY_LEFT
66const MAC_WK_CMD_LEFT = 91;
67const MAC_WK_CMD_RIGHT = 93;
68const CONTEXT_MENU = 93;
69const NUMPAD_ZERO = 96;
70const NUMPAD_ONE = 97;
71const NUMPAD_TWO = 98;
72const NUMPAD_THREE = 99;
73const NUMPAD_FOUR = 100;
74const NUMPAD_FIVE = 101;
75const NUMPAD_SIX = 102;
76const NUMPAD_SEVEN = 103;
77const NUMPAD_EIGHT = 104;
78const NUMPAD_NINE = 105;
79const NUMPAD_MULTIPLY = 106;
80const NUMPAD_PLUS = 107;
81const NUMPAD_MINUS = 109;
82const NUMPAD_PERIOD = 110;
83const NUMPAD_DIVIDE = 111;
84const F1 = 112;
85const F2 = 113;
86const F3 = 114;
87const F4 = 115;
88const F5 = 116;
89const F6 = 117;
90const F7 = 118;
91const F8 = 119;
92const F9 = 120;
93const F10 = 121;
94const F11 = 122;
95const F12 = 123;
96const NUM_LOCK = 144;
97const SCROLL_LOCK = 145;
98const FIRST_MEDIA = 166;
99const FF_MINUS = 173;
100const MUTE = 173; // Firefox (Gecko) fires 181 for MUTE
101const VOLUME_DOWN = 174; // Firefox (Gecko) fires 182 for VOLUME_DOWN
102const VOLUME_UP = 175; // Firefox (Gecko) fires 183 for VOLUME_UP
103const FF_MUTE = 181;
104const FF_VOLUME_DOWN = 182;
105const LAST_MEDIA = 183;
106const FF_VOLUME_UP = 183;
107const SEMICOLON = 186; // Firefox (Gecko) fires 59 for SEMICOLON
108const EQUALS = 187; // Firefox (Gecko) fires 61 for EQUALS
109const COMMA = 188;
110const DASH = 189; // Firefox (Gecko) fires 173 for DASH/MINUS
111const PERIOD = 190;
112const SLASH = 191;
113const APOSTROPHE = 192;
114const TILDE = 192;
115const OPEN_SQUARE_BRACKET = 219;
116const BACKSLASH = 220;
117const CLOSE_SQUARE_BRACKET = 221;
118const SINGLE_QUOTE = 222;
119const MAC_META = 224;
120
121/**
122 * Checks whether a modifier key is pressed.
123 * @param event Event to be checked.
124 */
125function hasModifierKey(event, ...modifiers) {
126 if (modifiers.length) {
127 return modifiers.some(modifier => event[modifier]);
128 }
129 return event.altKey || event.shiftKey || event.ctrlKey || event.metaKey;
130}
131
132/**
133 * Generated bundle index. Do not edit.
134 */
135
136export { A, ALT, APOSTROPHE, AT_SIGN, B, BACKSLASH, BACKSPACE, C, CAPS_LOCK, CLOSE_SQUARE_BRACKET, COMMA, CONTEXT_MENU, CONTROL, D, DASH, DELETE, DOWN_ARROW, E, EIGHT, END, ENTER, EQUALS, ESCAPE, F, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, FF_EQUALS, FF_MINUS, FF_MUTE, FF_SEMICOLON, FF_VOLUME_DOWN, FF_VOLUME_UP, FIRST_MEDIA, FIVE, FOUR, G, H, HOME, I, INSERT, J, K, L, LAST_MEDIA, LEFT_ARROW, M, MAC_ENTER, MAC_META, MAC_WK_CMD_LEFT, MAC_WK_CMD_RIGHT, META, MUTE, N, NINE, NUMPAD_DIVIDE, NUMPAD_EIGHT, NUMPAD_FIVE, NUMPAD_FOUR, NUMPAD_MINUS, NUMPAD_MULTIPLY, NUMPAD_NINE, NUMPAD_ONE, NUMPAD_PERIOD, NUMPAD_PLUS, NUMPAD_SEVEN, NUMPAD_SIX, NUMPAD_THREE, NUMPAD_TWO, NUMPAD_ZERO, NUM_CENTER, NUM_LOCK, O, ONE, OPEN_SQUARE_BRACKET, P, PAGE_DOWN, PAGE_UP, PAUSE, PERIOD, PLUS_SIGN, PRINT_SCREEN, Q, QUESTION_MARK, R, RIGHT_ARROW, S, SCROLL_LOCK, SEMICOLON, SEVEN, SHIFT, SINGLE_QUOTE, SIX, SLASH, SPACE, T, TAB, THREE, TILDE, TWO, U, UP_ARROW, V, VOLUME_DOWN, VOLUME_UP, W, X, Y, Z, ZERO, hasModifierKey };
137//# sourceMappingURL=keycodes.mjs.map