├── .travis.yml ├── assets └── keys.jpg ├── tsconfig.json ├── package.json ├── LICENSE ├── .gitignore ├── README.md ├── dist ├── index.js.map ├── es5 │ ├── index.js.map │ └── index.js ├── index.d.ts └── index.js ├── index.ts └── CODE_OF_CONDUCT.md /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | language: node_js 3 | node_js: 4 | - "8.8" -------------------------------------------------------------------------------- /assets/keys.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashubham/w3c-keys/HEAD/assets/keys.jpg -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "declarationDir": "dist", 5 | "module": "esnext", 6 | "target": "es2018", 7 | "outDir": "dist", 8 | "sourceMap": true 9 | }, 10 | "files": [ 11 | "index.ts" 12 | ] 13 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "w3c-keys", 3 | "version": "1.0.3", 4 | "description": "keyboardEvent.key compatible key codes with Typescript Definitions. Edit", 5 | "main": "dist/es5/index.js", 6 | "module": "dist/index.js", 7 | "types": "dist/index.d.ts", 8 | "scripts": { 9 | "build": "tsc", 10 | "build:es5": "tsc -p . --module commonjs --outDir dist/es5 --target es5", 11 | "prepare": "npm run build ; npm run build:es5" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/ashubham/w3c-keys.git" 16 | }, 17 | "keywords": [ 18 | "keyboardEvent", 19 | "key", 20 | "typescript", 21 | "keycode", 22 | "key", 23 | "code", 24 | "es6" 25 | ], 26 | "author": "ashubham@gmail.com", 27 | "license": "MIT", 28 | "bugs": { 29 | "url": "https://github.com/ashubham/w3c-keys/issues" 30 | }, 31 | "homepage": "https://github.com/ashubham/w3c-keys#readme", 32 | "devDependencies": { 33 | "typescript": "^3.6.4" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Ashish Shubham 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # w3c-keys 2 | [![Build Status](https://travis-ci.org/ashubham/w3c-keys.svg?branch=master)](https://travis-ci.org/ashubham/w3c-keys) 3 | [![npm version](https://badge.fury.io/js/w3c-keys.svg)](https://badge.fury.io/js/w3c-keys) 4 | [![npm](https://img.shields.io/npm/dm/w3c-keys.svg)](https://www.npmjs.com/package/w3c-keys) 5 | 6 | w3c-keys 7 | 8 | keyboardEvent.key compatible key codes with Typescript Definitions. 9 | 10 | Read https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key 11 | 12 | Compatible with IE/Edge/Safari Key idiosyncrasies. 13 | 14 | Super Lightweight: ~900 Bytes Gzipped (Potentially smaller when combined gzipped with a bigger app) 15 | 16 | ## Usage 17 | 18 | ```typescript 19 | import { Key } from 'w3c-keys'; 20 | 21 | // To dispatch Events. 22 | let evt = new KeyboardEvent('keydown', { 23 | key: Key.Space 24 | }); 25 | document.body.dispatchEvent(evt); 26 | 27 | // To check event keys. 28 | document.body.on('keydown', (e) => { 29 | if(e.key === Key.Backspace) { 30 | // Do some shiz... 31 | } 32 | }); 33 | ``` 34 | 35 | ## Why not use evt.which keyCodes ? 36 | 37 | - `evt.which` keycodes are a deprecated standard. 38 | - Ability to create synthetic key events is not possible with `evt.which`. 39 | -------------------------------------------------------------------------------- /dist/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,MAAM,CAAN,IAAY,GAkJX;AAlJD,WAAY,GAAG;IACX,8BAAuB,CAAA;IACvB,kBAAW,CAAA;IACX,sBAAe,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AAkB,CAAA;IAClB,kBAAW,CAAA;IACX,wBAAiB,CAAA;IACjB,wBAAiB,CAAA;IACjB,0BAAmB,CAAA;IACnB,kBAAY,CAAA;AAChB,CAAC,EAlJW,GAAG,KAAH,GAAG,QAkJd"} -------------------------------------------------------------------------------- /dist/es5/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;AACA,IAAY,GAkJX;AAlJD,WAAY,GAAG;IACX,8BAAuB,CAAA;IACvB,kBAAW,CAAA;IACX,sBAAe,CAAA;IACf,sBAAe,CAAA;IACf,0BAAmB,CAAA;IACnB,kBAAW,CAAA;IACX,4BAAqB,CAAA;IACrB,wBAAiB,CAAA;IACjB,kBAAW,CAAA;IACX,kBAAW,CAAA;IACX,wBAAiB,CAAA;IACjB,4BAAqB,CAAA;IACrB,kBAAW,CAAA;IACX,oBAAa,CAAA;IACb,8BAAuB,CAAA;IACvB,0BAAmB,CAAA;IACnB,gCAAyB,CAAA;IACzB,8BAAuB,CAAA;IACvB,oBAAa,CAAA;IACb,gBAAS,CAAA;IACT,sBAAe,CAAA;IACf,oBAAa,CAAA;IACb,wBAAiB,CAAA;IACjB,wBAAiB,CAAA;IACjB,iBAAU,CAAA;IACV,wBAAiB,CAAA;IACjB,gBAAS,CAAA;IACT,4BAAqB,CAAA;IACrB,gBAAS,CAAA;IACT,mBAAY,CAAA;IACZ,kBAAW,CAAA;IACX,2BAAe,CAAA;IACf,iBAAU,CAAA;IACV,iBAAU,CAAA;IACV,uBAAgB,CAAA;IAChB,iBAAU,CAAA;IACV,wBAAiB,CAAA;IACjB,gBAAS,CAAA;IACT,kBAAW,CAAA;IACX,gBAAS,CAAA;IACT,kBAAW,CAAA;IACX,sBAAe,CAAA;IACf,kBAAW,CAAA;IACX,iBAAU,CAAA;IACV,qBAAc,CAAA;IACd,iBAAU,CAAA;IACV,sBAAe,CAAA;IACf,cAAO,CAAA;IACP,cAAO,CAAA;IACP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T,gBAAS,CAAA;IACT,gBAAS,CAAA;IACT,gBAAS,CAAA;IACT,gBAAS,CAAA;IACT,gBAAS,CAAA;IACT,gBAAS,CAAA;IACT,gBAAS,CAAA;IACT,kBAAW,CAAA;IACX,kBAAW,CAAA;IACX,kBAAW,CAAA;IACX,0BAAmB,CAAA;IACnB,gCAAyB,CAAA;IACzB,sBAAe,CAAA;IACf,mBAAY,CAAA;IACZ,kBAAW,CAAA;IACX,iBAAU,CAAA;IACV,mBAAY,CAAA;IACZ,uBAAgB,CAAA;IAChB,qBAAc,CAAA;IACd,yBAAkB,CAAA;IAClB,kBAAW,CAAA;IACX,wBAAiB,CAAA;IACjB,wBAAiB,CAAA;IACjB,0BAAmB,CAAA;IACnB,kBAAY,CAAA;AAChB,CAAC,EAlJW,GAAG,GAAH,WAAG,KAAH,WAAG,QAkJd"} -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | 2 | export enum Key { 3 | Backspace = 'Backspace', 4 | Tab = 'Tab', 5 | Enter = 'Enter', 6 | Shift = 'Shift', 7 | Control = 'Control', 8 | Alt = 'Alt', 9 | CapsLock = 'CapsLock', 10 | Escape = 'Escape', 11 | Esc = 'Esc', 12 | Space = ' ', 13 | PageUp = 'PageUp', 14 | PageDown = 'PageDown', 15 | End = 'End', 16 | Home = 'Home', 17 | ArrowLeft = 'ArrowLeft', 18 | ArrowUp = 'ArrowUp', 19 | ArrowRight = 'ArrowRight', 20 | ArrowDown = 'ArrowDown', 21 | Left = 'Left', 22 | Up = 'Up', 23 | Right = 'Right', 24 | Down = 'Down', 25 | Insert = 'Insert', 26 | Delete = 'Delete', 27 | Zero = '0', 28 | ClosedParen = ')', 29 | One = '1', 30 | ExclamationMark = '!', 31 | Two = '2', 32 | AtSign = '@', 33 | Three = '3', 34 | PoundSign = '£', 35 | Hash = '#', 36 | Four = '4', 37 | DollarSign = '$', 38 | Five = '5', 39 | PercentSign = '%', 40 | Six = '6', 41 | Caret = '^', 42 | Hat = '^', 43 | Seven = '7', 44 | Ampersand = '&', 45 | Eight = '8', 46 | Star = '*', 47 | Asterisk = '*', 48 | Nine = '9', 49 | OpenParen = '(', 50 | a = 'a', 51 | b = 'b', 52 | c = 'c', 53 | d = 'd', 54 | e = 'e', 55 | f = 'f', 56 | g = 'g', 57 | h = 'h', 58 | i = 'i', 59 | j = 'j', 60 | k = 'k', 61 | l = 'l', 62 | m = 'm', 63 | n = 'n', 64 | o = 'o', 65 | p = 'p', 66 | q = 'q', 67 | r = 'r', 68 | s = 's', 69 | t = 't', 70 | u = 'u', 71 | v = 'v', 72 | w = 'w', 73 | x = 'x', 74 | y = 'y', 75 | z = 'z', 76 | A = 'A', 77 | B = 'B', 78 | C = 'C', 79 | D = 'D', 80 | E = 'E', 81 | F = 'F', 82 | G = 'G', 83 | H = 'H', 84 | I = 'I', 85 | J = 'J', 86 | K = 'K', 87 | L = 'L', 88 | M = 'M', 89 | N = 'N', 90 | O = 'O', 91 | P = 'P', 92 | Q = 'Q', 93 | R = 'R', 94 | S = 'S', 95 | T = 'T', 96 | U = 'U', 97 | V = 'V', 98 | W = 'W', 99 | X = 'X', 100 | Y = 'Y', 101 | Z = 'Z', 102 | Meta = 'Meta', 103 | LeftWindowKey = 'Meta', 104 | RightWindowKey = 'Meta', 105 | Numpad0 = '0', 106 | Numpad1 = '1', 107 | Numpad2 = '2', 108 | Numpad3 = '3', 109 | Numpad4 = '4', 110 | Numpad5 = '5', 111 | Numpad6 = '6', 112 | Numpad7 = '7', 113 | Numpad8 = '8', 114 | Numpad9 = '9', 115 | Multiply = '*', 116 | Add = '+', 117 | Subtract = '-', 118 | DecimalPoint = '.', 119 | MSDecimalPoint = 'Decimal', 120 | Divide = '/', 121 | F1 = 'F1', 122 | F2 = 'F2', 123 | F3 = 'F3', 124 | F4 = 'F4', 125 | F5 = 'F5', 126 | F6 = 'F6', 127 | F7 = 'F7', 128 | F8 = 'F8', 129 | F9 = 'F9', 130 | F10 = 'F10', 131 | F11 = 'F11', 132 | F12 = 'F12', 133 | NumLock = 'NumLock', 134 | ScrollLock = 'ScrollLock', 135 | SemiColon = ';', 136 | Equals = '=', 137 | Comma = ',', 138 | Dash = '-', 139 | Period = '.', 140 | UnderScore = '_', 141 | PlusSign = '+', 142 | ForwardSlash = '/', 143 | Tilde = '~', 144 | GraveAccent = '`', 145 | OpenBracket = '[', 146 | ClosedBracket = ']', 147 | Quote = '\'' 148 | } -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum Key { 2 | Backspace = "Backspace", 3 | Tab = "Tab", 4 | Enter = "Enter", 5 | Shift = "Shift", 6 | Control = "Control", 7 | Alt = "Alt", 8 | CapsLock = "CapsLock", 9 | Escape = "Escape", 10 | Esc = "Esc", 11 | Space = " ", 12 | PageUp = "PageUp", 13 | PageDown = "PageDown", 14 | End = "End", 15 | Home = "Home", 16 | ArrowLeft = "ArrowLeft", 17 | ArrowUp = "ArrowUp", 18 | ArrowRight = "ArrowRight", 19 | ArrowDown = "ArrowDown", 20 | Left = "Left", 21 | Up = "Up", 22 | Right = "Right", 23 | Down = "Down", 24 | Insert = "Insert", 25 | Delete = "Delete", 26 | Zero = "0", 27 | ClosedParen = ")", 28 | One = "1", 29 | ExclamationMark = "!", 30 | Two = "2", 31 | AtSign = "@", 32 | Three = "3", 33 | PoundSign = "\u00A3", 34 | Hash = "#", 35 | Four = "4", 36 | DollarSign = "$", 37 | Five = "5", 38 | PercentSign = "%", 39 | Six = "6", 40 | Caret = "^", 41 | Hat = "^", 42 | Seven = "7", 43 | Ampersand = "&", 44 | Eight = "8", 45 | Star = "*", 46 | Asterisk = "*", 47 | Nine = "9", 48 | OpenParen = "(", 49 | a = "a", 50 | b = "b", 51 | c = "c", 52 | d = "d", 53 | e = "e", 54 | f = "f", 55 | g = "g", 56 | h = "h", 57 | i = "i", 58 | j = "j", 59 | k = "k", 60 | l = "l", 61 | m = "m", 62 | n = "n", 63 | o = "o", 64 | p = "p", 65 | q = "q", 66 | r = "r", 67 | s = "s", 68 | t = "t", 69 | u = "u", 70 | v = "v", 71 | w = "w", 72 | x = "x", 73 | y = "y", 74 | z = "z", 75 | A = "A", 76 | B = "B", 77 | C = "C", 78 | D = "D", 79 | E = "E", 80 | F = "F", 81 | G = "G", 82 | H = "H", 83 | I = "I", 84 | J = "J", 85 | K = "K", 86 | L = "L", 87 | M = "M", 88 | N = "N", 89 | O = "O", 90 | P = "P", 91 | Q = "Q", 92 | R = "R", 93 | S = "S", 94 | T = "T", 95 | U = "U", 96 | V = "V", 97 | W = "W", 98 | X = "X", 99 | Y = "Y", 100 | Z = "Z", 101 | Meta = "Meta", 102 | LeftWindowKey = "Meta", 103 | RightWindowKey = "Meta", 104 | Numpad0 = "0", 105 | Numpad1 = "1", 106 | Numpad2 = "2", 107 | Numpad3 = "3", 108 | Numpad4 = "4", 109 | Numpad5 = "5", 110 | Numpad6 = "6", 111 | Numpad7 = "7", 112 | Numpad8 = "8", 113 | Numpad9 = "9", 114 | Multiply = "*", 115 | Add = "+", 116 | Subtract = "-", 117 | DecimalPoint = ".", 118 | MSDecimalPoint = "Decimal", 119 | Divide = "/", 120 | F1 = "F1", 121 | F2 = "F2", 122 | F3 = "F3", 123 | F4 = "F4", 124 | F5 = "F5", 125 | F6 = "F6", 126 | F7 = "F7", 127 | F8 = "F8", 128 | F9 = "F9", 129 | F10 = "F10", 130 | F11 = "F11", 131 | F12 = "F12", 132 | NumLock = "NumLock", 133 | ScrollLock = "ScrollLock", 134 | SemiColon = ";", 135 | Equals = "=", 136 | Comma = ",", 137 | Dash = "-", 138 | Period = ".", 139 | UnderScore = "_", 140 | PlusSign = "+", 141 | ForwardSlash = "/", 142 | Tilde = "~", 143 | GraveAccent = "`", 144 | OpenBracket = "[", 145 | ClosedBracket = "]", 146 | Quote = "'" 147 | } 148 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at ashubham@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | export var Key; 2 | (function (Key) { 3 | Key["Backspace"] = "Backspace"; 4 | Key["Tab"] = "Tab"; 5 | Key["Enter"] = "Enter"; 6 | Key["Shift"] = "Shift"; 7 | Key["Control"] = "Control"; 8 | Key["Alt"] = "Alt"; 9 | Key["CapsLock"] = "CapsLock"; 10 | Key["Escape"] = "Escape"; 11 | Key["Esc"] = "Esc"; 12 | Key["Space"] = " "; 13 | Key["PageUp"] = "PageUp"; 14 | Key["PageDown"] = "PageDown"; 15 | Key["End"] = "End"; 16 | Key["Home"] = "Home"; 17 | Key["ArrowLeft"] = "ArrowLeft"; 18 | Key["ArrowUp"] = "ArrowUp"; 19 | Key["ArrowRight"] = "ArrowRight"; 20 | Key["ArrowDown"] = "ArrowDown"; 21 | Key["Left"] = "Left"; 22 | Key["Up"] = "Up"; 23 | Key["Right"] = "Right"; 24 | Key["Down"] = "Down"; 25 | Key["Insert"] = "Insert"; 26 | Key["Delete"] = "Delete"; 27 | Key["Zero"] = "0"; 28 | Key["ClosedParen"] = ")"; 29 | Key["One"] = "1"; 30 | Key["ExclamationMark"] = "!"; 31 | Key["Two"] = "2"; 32 | Key["AtSign"] = "@"; 33 | Key["Three"] = "3"; 34 | Key["PoundSign"] = "\u00A3"; 35 | Key["Hash"] = "#"; 36 | Key["Four"] = "4"; 37 | Key["DollarSign"] = "$"; 38 | Key["Five"] = "5"; 39 | Key["PercentSign"] = "%"; 40 | Key["Six"] = "6"; 41 | Key["Caret"] = "^"; 42 | Key["Hat"] = "^"; 43 | Key["Seven"] = "7"; 44 | Key["Ampersand"] = "&"; 45 | Key["Eight"] = "8"; 46 | Key["Star"] = "*"; 47 | Key["Asterisk"] = "*"; 48 | Key["Nine"] = "9"; 49 | Key["OpenParen"] = "("; 50 | Key["a"] = "a"; 51 | Key["b"] = "b"; 52 | Key["c"] = "c"; 53 | Key["d"] = "d"; 54 | Key["e"] = "e"; 55 | Key["f"] = "f"; 56 | Key["g"] = "g"; 57 | Key["h"] = "h"; 58 | Key["i"] = "i"; 59 | Key["j"] = "j"; 60 | Key["k"] = "k"; 61 | Key["l"] = "l"; 62 | Key["m"] = "m"; 63 | Key["n"] = "n"; 64 | Key["o"] = "o"; 65 | Key["p"] = "p"; 66 | Key["q"] = "q"; 67 | Key["r"] = "r"; 68 | Key["s"] = "s"; 69 | Key["t"] = "t"; 70 | Key["u"] = "u"; 71 | Key["v"] = "v"; 72 | Key["w"] = "w"; 73 | Key["x"] = "x"; 74 | Key["y"] = "y"; 75 | Key["z"] = "z"; 76 | Key["A"] = "A"; 77 | Key["B"] = "B"; 78 | Key["C"] = "C"; 79 | Key["D"] = "D"; 80 | Key["E"] = "E"; 81 | Key["F"] = "F"; 82 | Key["G"] = "G"; 83 | Key["H"] = "H"; 84 | Key["I"] = "I"; 85 | Key["J"] = "J"; 86 | Key["K"] = "K"; 87 | Key["L"] = "L"; 88 | Key["M"] = "M"; 89 | Key["N"] = "N"; 90 | Key["O"] = "O"; 91 | Key["P"] = "P"; 92 | Key["Q"] = "Q"; 93 | Key["R"] = "R"; 94 | Key["S"] = "S"; 95 | Key["T"] = "T"; 96 | Key["U"] = "U"; 97 | Key["V"] = "V"; 98 | Key["W"] = "W"; 99 | Key["X"] = "X"; 100 | Key["Y"] = "Y"; 101 | Key["Z"] = "Z"; 102 | Key["Meta"] = "Meta"; 103 | Key["LeftWindowKey"] = "Meta"; 104 | Key["RightWindowKey"] = "Meta"; 105 | Key["Numpad0"] = "0"; 106 | Key["Numpad1"] = "1"; 107 | Key["Numpad2"] = "2"; 108 | Key["Numpad3"] = "3"; 109 | Key["Numpad4"] = "4"; 110 | Key["Numpad5"] = "5"; 111 | Key["Numpad6"] = "6"; 112 | Key["Numpad7"] = "7"; 113 | Key["Numpad8"] = "8"; 114 | Key["Numpad9"] = "9"; 115 | Key["Multiply"] = "*"; 116 | Key["Add"] = "+"; 117 | Key["Subtract"] = "-"; 118 | Key["DecimalPoint"] = "."; 119 | Key["MSDecimalPoint"] = "Decimal"; 120 | Key["Divide"] = "/"; 121 | Key["F1"] = "F1"; 122 | Key["F2"] = "F2"; 123 | Key["F3"] = "F3"; 124 | Key["F4"] = "F4"; 125 | Key["F5"] = "F5"; 126 | Key["F6"] = "F6"; 127 | Key["F7"] = "F7"; 128 | Key["F8"] = "F8"; 129 | Key["F9"] = "F9"; 130 | Key["F10"] = "F10"; 131 | Key["F11"] = "F11"; 132 | Key["F12"] = "F12"; 133 | Key["NumLock"] = "NumLock"; 134 | Key["ScrollLock"] = "ScrollLock"; 135 | Key["SemiColon"] = ";"; 136 | Key["Equals"] = "="; 137 | Key["Comma"] = ","; 138 | Key["Dash"] = "-"; 139 | Key["Period"] = "."; 140 | Key["UnderScore"] = "_"; 141 | Key["PlusSign"] = "+"; 142 | Key["ForwardSlash"] = "/"; 143 | Key["Tilde"] = "~"; 144 | Key["GraveAccent"] = "`"; 145 | Key["OpenBracket"] = "["; 146 | Key["ClosedBracket"] = "]"; 147 | Key["Quote"] = "'"; 148 | })(Key || (Key = {})); 149 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /dist/es5/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var Key; 4 | (function (Key) { 5 | Key["Backspace"] = "Backspace"; 6 | Key["Tab"] = "Tab"; 7 | Key["Enter"] = "Enter"; 8 | Key["Shift"] = "Shift"; 9 | Key["Control"] = "Control"; 10 | Key["Alt"] = "Alt"; 11 | Key["CapsLock"] = "CapsLock"; 12 | Key["Escape"] = "Escape"; 13 | Key["Esc"] = "Esc"; 14 | Key["Space"] = " "; 15 | Key["PageUp"] = "PageUp"; 16 | Key["PageDown"] = "PageDown"; 17 | Key["End"] = "End"; 18 | Key["Home"] = "Home"; 19 | Key["ArrowLeft"] = "ArrowLeft"; 20 | Key["ArrowUp"] = "ArrowUp"; 21 | Key["ArrowRight"] = "ArrowRight"; 22 | Key["ArrowDown"] = "ArrowDown"; 23 | Key["Left"] = "Left"; 24 | Key["Up"] = "Up"; 25 | Key["Right"] = "Right"; 26 | Key["Down"] = "Down"; 27 | Key["Insert"] = "Insert"; 28 | Key["Delete"] = "Delete"; 29 | Key["Zero"] = "0"; 30 | Key["ClosedParen"] = ")"; 31 | Key["One"] = "1"; 32 | Key["ExclamationMark"] = "!"; 33 | Key["Two"] = "2"; 34 | Key["AtSign"] = "@"; 35 | Key["Three"] = "3"; 36 | Key["PoundSign"] = "\u00A3"; 37 | Key["Hash"] = "#"; 38 | Key["Four"] = "4"; 39 | Key["DollarSign"] = "$"; 40 | Key["Five"] = "5"; 41 | Key["PercentSign"] = "%"; 42 | Key["Six"] = "6"; 43 | Key["Caret"] = "^"; 44 | Key["Hat"] = "^"; 45 | Key["Seven"] = "7"; 46 | Key["Ampersand"] = "&"; 47 | Key["Eight"] = "8"; 48 | Key["Star"] = "*"; 49 | Key["Asterisk"] = "*"; 50 | Key["Nine"] = "9"; 51 | Key["OpenParen"] = "("; 52 | Key["a"] = "a"; 53 | Key["b"] = "b"; 54 | Key["c"] = "c"; 55 | Key["d"] = "d"; 56 | Key["e"] = "e"; 57 | Key["f"] = "f"; 58 | Key["g"] = "g"; 59 | Key["h"] = "h"; 60 | Key["i"] = "i"; 61 | Key["j"] = "j"; 62 | Key["k"] = "k"; 63 | Key["l"] = "l"; 64 | Key["m"] = "m"; 65 | Key["n"] = "n"; 66 | Key["o"] = "o"; 67 | Key["p"] = "p"; 68 | Key["q"] = "q"; 69 | Key["r"] = "r"; 70 | Key["s"] = "s"; 71 | Key["t"] = "t"; 72 | Key["u"] = "u"; 73 | Key["v"] = "v"; 74 | Key["w"] = "w"; 75 | Key["x"] = "x"; 76 | Key["y"] = "y"; 77 | Key["z"] = "z"; 78 | Key["A"] = "A"; 79 | Key["B"] = "B"; 80 | Key["C"] = "C"; 81 | Key["D"] = "D"; 82 | Key["E"] = "E"; 83 | Key["F"] = "F"; 84 | Key["G"] = "G"; 85 | Key["H"] = "H"; 86 | Key["I"] = "I"; 87 | Key["J"] = "J"; 88 | Key["K"] = "K"; 89 | Key["L"] = "L"; 90 | Key["M"] = "M"; 91 | Key["N"] = "N"; 92 | Key["O"] = "O"; 93 | Key["P"] = "P"; 94 | Key["Q"] = "Q"; 95 | Key["R"] = "R"; 96 | Key["S"] = "S"; 97 | Key["T"] = "T"; 98 | Key["U"] = "U"; 99 | Key["V"] = "V"; 100 | Key["W"] = "W"; 101 | Key["X"] = "X"; 102 | Key["Y"] = "Y"; 103 | Key["Z"] = "Z"; 104 | Key["Meta"] = "Meta"; 105 | Key["LeftWindowKey"] = "Meta"; 106 | Key["RightWindowKey"] = "Meta"; 107 | Key["Numpad0"] = "0"; 108 | Key["Numpad1"] = "1"; 109 | Key["Numpad2"] = "2"; 110 | Key["Numpad3"] = "3"; 111 | Key["Numpad4"] = "4"; 112 | Key["Numpad5"] = "5"; 113 | Key["Numpad6"] = "6"; 114 | Key["Numpad7"] = "7"; 115 | Key["Numpad8"] = "8"; 116 | Key["Numpad9"] = "9"; 117 | Key["Multiply"] = "*"; 118 | Key["Add"] = "+"; 119 | Key["Subtract"] = "-"; 120 | Key["DecimalPoint"] = "."; 121 | Key["MSDecimalPoint"] = "Decimal"; 122 | Key["Divide"] = "/"; 123 | Key["F1"] = "F1"; 124 | Key["F2"] = "F2"; 125 | Key["F3"] = "F3"; 126 | Key["F4"] = "F4"; 127 | Key["F5"] = "F5"; 128 | Key["F6"] = "F6"; 129 | Key["F7"] = "F7"; 130 | Key["F8"] = "F8"; 131 | Key["F9"] = "F9"; 132 | Key["F10"] = "F10"; 133 | Key["F11"] = "F11"; 134 | Key["F12"] = "F12"; 135 | Key["NumLock"] = "NumLock"; 136 | Key["ScrollLock"] = "ScrollLock"; 137 | Key["SemiColon"] = ";"; 138 | Key["Equals"] = "="; 139 | Key["Comma"] = ","; 140 | Key["Dash"] = "-"; 141 | Key["Period"] = "."; 142 | Key["UnderScore"] = "_"; 143 | Key["PlusSign"] = "+"; 144 | Key["ForwardSlash"] = "/"; 145 | Key["Tilde"] = "~"; 146 | Key["GraveAccent"] = "`"; 147 | Key["OpenBracket"] = "["; 148 | Key["ClosedBracket"] = "]"; 149 | Key["Quote"] = "'"; 150 | })(Key = exports.Key || (exports.Key = {})); 151 | //# sourceMappingURL=index.js.map --------------------------------------------------------------------------------