const isMac = (navigator.userAgent.indexOf('Mac OS') !== -1); export const codes = { 'backspace': 8, 'tab': 9, 'enter': 13, 'pause/break': 19, 'caps lock': 20, 'esc': 27, 'space': 32, 'page up': 33, 'page down': 34, 'end': 35, 'home': 36, 'left': 37, 'up': 38, 'right': 39, 'down': 40, 'insert': 45, 'delete': 46, 'numpad *': 106, 'numpad +': 107, 'numpad -': 109, 'numpad .': 110, 'numpad /': 111, 'num lock': 144, 'scroll lock': 145, 'my computer': 182, 'my calculator': 183, ';': 186, '=': 187, ',': 188, '-': 189, '.': 190, '/': 191, '`': 192, '[': 219, '\\': 220, ']': 221, "'": 222, 'windows': 91, '⇧': 16, '⌥': 18, '⌃': 17, 'pause': 19, 'break': 19, 'caps': 20, 'return': 13, 'escape': 27, 'spc': 32, 'pgup': 33, 'pgdn': 34, 'ins': 45, 'del': 46, 'F2': 113 }; export const modifiers = { 'shift': 'shiftKey', 'ctrl': 'ctrlKey', 'alt': 'altKey', 'cmd': isMac ? 'metaKey' : 'ctrlKey', 'command': isMac ? 'metaKey' : 'ctrlKey', 'left command': 'metaKey', 'right command': 'MetaRight', '⌘': isMac ? 'metaKey' : 'ctrlKey', 'option': 'altKey', 'ctl': 'ctrlKey', 'control': 'ctrlKey', }; export const symbols = { 'cmd': isMac ? '⌘' : 'Ctrl', 'command': isMac ? '⌘' : 'Ctrl', 'left command': isMac ? '⌘' : 'Ctrl', 'right command': isMac ? '⌘' : 'Ctrl', 'option': isMac ? '⌥' : 'Alt', 'left': '←', 'right': '→', 'up': '↑', 'down': '↓', 'alt': isMac ? '⌥' : 'Alt', 'ctrl': 'Ctrl', 'control': 'Ctrl', 'shift': '⇧' };