@keybindy/core
Version:
A lightweight and framework-agnostic keyboard shortcut manager for web apps. Define, register, and handle keybindings with ease.
197 lines (195 loc) • 4.38 kB
JavaScript
const KeyMapping = {
// Modifiers
ControlLeft: 'Ctrl (Left)',
ControlRight: 'Ctrl (Right)',
ShiftLeft: 'Shift (Left)',
ShiftRight: 'Shift (Right)',
AltLeft: 'Alt (Left)',
AltRight: 'Alt (Right)',
MetaLeft: 'Meta (Left)',
MetaRight: 'Meta (Right)',
/**
* Legacy for Firefox/Chrome pre-118/52
*/
OSLeft: 'Meta (Left)',
OSRight: 'Meta (Right)',
// Letters
KeyA: 'A',
KeyB: 'B',
KeyC: 'C',
KeyD: 'D',
KeyE: 'E',
KeyF: 'F',
KeyG: 'G',
KeyH: 'H',
KeyI: 'I',
KeyJ: 'J',
KeyK: 'K',
KeyL: 'L',
KeyM: 'M',
KeyN: 'N',
KeyO: 'O',
KeyP: 'P',
KeyQ: 'Q',
KeyR: 'R',
KeyS: 'S',
KeyT: 'T',
KeyU: 'U',
KeyV: 'V',
KeyW: 'W',
KeyX: 'X',
KeyY: 'Y',
KeyZ: 'Z',
// Digits
Digit0: '0',
Digit1: '1',
Digit2: '2',
Digit3: '3',
Digit4: '4',
Digit5: '5',
Digit6: '6',
Digit7: '7',
Digit8: '8',
Digit9: '9',
// Numpad
Numpad0: 'Numpad 0',
Numpad1: 'Numpad 1',
Numpad2: 'Numpad 2',
Numpad3: 'Numpad 3',
Numpad4: 'Numpad 4',
Numpad5: 'Numpad 5',
Numpad6: 'Numpad 6',
Numpad7: 'Numpad 7',
Numpad8: 'Numpad 8',
Numpad9: 'Numpad 9',
NumpadAdd: 'Numpad +',
NumpadSubtract: 'Numpad -',
NumpadMultiply: 'Numpad *',
NumpadDivide: 'Numpad /',
NumpadEnter: 'Numpad Enter',
NumpadDecimal: 'Numpad .',
NumpadEqual: 'Numpad =',
NumpadComma: 'Numpad ,',
NumpadParenLeft: 'Numpad (',
NumpadParenRight: 'Numpad )',
// Symbols
Minus: '-',
Equal: '=',
BracketLeft: '[',
BracketRight: ']',
Backslash: '\\',
Semicolon: ';',
Quote: "'",
Comma: ',',
Period: '.',
Slash: '/',
Backquote: '`',
IntlBackslash: 'Intl \\',
IntlRo: 'Intl Ro',
IntlYen: 'Intl Yen',
// Control Keys
Escape: 'Esc',
Tab: 'Tab',
CapsLock: 'Caps Lock',
Enter: 'Enter',
Space: 'Space',
Backspace: 'Backspace',
NumLock: 'Num Lock',
ScrollLock: 'Scroll Lock',
Pause: 'Pause',
ContextMenu: 'Context Menu',
PrintScreen: 'Print Screen',
// Navigation Keys
Insert: 'Insert',
Delete: 'Delete',
Home: 'Home',
End: 'End',
PageUp: 'Page Up',
PageDown: 'Page Down',
ArrowUp: 'Arrow Up',
ArrowDown: 'Arrow Down',
ArrowLeft: 'Arrow Left',
ArrowRight: 'Arrow Right',
// Function Keys
F1: 'F1',
F2: 'F2',
F3: 'F3',
F4: 'F4',
F5: 'F5',
F6: 'F6',
F7: 'F7',
F8: 'F8',
F9: 'F9',
F10: 'F10',
F11: 'F11',
F12: 'F12',
F13: 'F13',
F14: 'F14',
F15: 'F15',
F16: 'F16',
F17: 'F17',
F18: 'F18',
F19: 'F19',
F20: 'F20',
F21: 'F21',
F22: 'F22',
F23: 'F23',
F24: 'F24',
// Media Keys
AudioVolumeMute: 'Volume Mute',
AudioVolumeDown: 'Volume Down',
AudioVolumeUp: 'Volume Up',
VolumeMute: 'Volume Mute',
VolumeDown: 'Volume Down',
VolumeUp: 'Volume Up',
MediaTrackNext: 'Media Next Track',
MediaTrackPrevious: 'Media Previous Track',
MediaPlayPause: 'Media Play/Pause',
MediaStop: 'Media Stop',
MediaSelect: 'Media Select',
// Browser Keys
BrowserHome: 'Browser Home',
BrowserSearch: 'Browser Search',
BrowserFavorites: 'Browser Favorites',
BrowserRefresh: 'Browser Refresh',
BrowserStop: 'Browser Stop',
BrowserForward: 'Browser Forward',
BrowserBack: 'Browser Back',
// Application Keys
LaunchApp1: 'Launch App 1',
LaunchApp2: 'Launch App 2',
LaunchMail: 'Launch Mail',
LaunchMediaPlayer: 'Launch Media Player',
LaunchCalculator: 'Launch Calculator',
// Language Keys
Convert: 'Convert',
NonConvert: 'Non Convert',
KanaMode: 'Kana Mode',
Lang1: 'Language 1',
Lang2: 'Language 2',
Lang3: 'Language 3',
Lang4: 'Language 4',
Lang5: 'Language 5',
// System Keys
Power: 'Power',
Sleep: 'Sleep',
WakeUp: 'Wake Up',
Eject: 'Eject',
// Editing Keys
Undo: 'Undo',
Redo: 'Redo',
Copy: 'Copy',
Cut: 'Cut',
Paste: 'Paste',
Select: 'Select',
Again: 'Again',
Find: 'Find',
Open: 'Open',
Props: 'Properties',
// Other
Help: 'Help',
Fn: 'Fn',
BrightnessUp: 'Brightness Up',
BrightnessDown: 'Brightness Down',
};
export { KeyMapping };