├── .all-contributorsrc ├── .browserslistrc ├── .editorconfig ├── .github └── workflows │ └── test.yml ├── .gitignore ├── .husky ├── commit-msg └── pre-commit ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── LICENSE ├── PULL_REQUEST_TEMPLATE.md ├── README.md ├── angular.json ├── commitlint.config.js ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── help_screenshot.png ├── hooks └── pre-commit.js ├── karma.conf.js ├── logo.svg ├── package-lock.json ├── package.json ├── prettier.config.js ├── projects └── ngneat │ └── hotkeys │ ├── README.md │ ├── karma.conf.js │ ├── ng-package.json │ ├── package.json │ ├── src │ ├── lib │ │ ├── hotkeys-help │ │ │ ├── hotkeys-help.component.html │ │ │ ├── hotkeys-help.component.scss │ │ │ └── hotkeys-help.component.ts │ │ ├── hotkeys-shortcut.pipe.ts │ │ ├── hotkeys.directive.ts │ │ ├── hotkeys.service.ts │ │ ├── tests │ │ │ ├── hotkeys-help.component.spec.ts │ │ │ ├── hotkeys-shortcut.pipe.spec.ts │ │ │ ├── hotkeys.directive.spec.ts │ │ │ └── hotkeys.service.spec.ts │ │ └── utils │ │ │ ├── alias.ts │ │ │ ├── array.ts │ │ │ └── platform.ts │ ├── public-api.ts │ └── test.ts │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ ├── tsconfig.spec.json │ └── tslint.json ├── src ├── app │ ├── app.component.css │ ├── app.component.html │ └── app.component.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "hotkeys", 3 | "projectOwner": "@ngneat", 4 | "repoType": "github", 5 | "repoHost": "https://github.com", 6 | "files": [ 7 | "README.md" 8 | ], 9 | "imageSize": 100, 10 | "commit": true, 11 | "commitConvention": "angular", 12 | "contributors": [ 13 | { 14 | "login": "flatstadt", 15 | "name": "Carlos Vilacha", 16 | "avatar_url": "https://avatars3.githubusercontent.com/u/1565222?v=4", 17 | "profile": "http://carlosvilacha.com", 18 | "contributions": [ 19 | "code", 20 | "content", 21 | "doc" 22 | ] 23 | }, 24 | { 25 | "login": "NetanelBasal", 26 | "name": "Netanel Basal", 27 | "avatar_url": "https://avatars1.githubusercontent.com/u/6745730?v=4", 28 | "profile": "https://www.netbasal.com", 29 | "contributions": [ 30 | "blog", 31 | "code", 32 | "doc", 33 | "ideas" 34 | ] 35 | }, 36 | { 37 | "login": "alvaromartmart", 38 | "name": "Álvaro Martínez", 39 | "avatar_url": "https://avatars1.githubusercontent.com/u/18287793?s=120&v=4", 40 | "profile": "https://github.com/alvaromartmart", 41 | "contributions": [ 42 | "code", 43 | "doc" 44 | ] 45 | } 46 | ], 47 | "contributorsPerLine": 7 48 | } 49 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | strategy: 14 | matrix: 15 | node-version: [18.x] 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Use Node.js ${{ matrix.node-version }} 20 | uses: actions/setup-node@v1 21 | with: 22 | node-version: ${{ matrix.node-version }} 23 | - uses: actions/cache@v1 24 | with: 25 | path: ~/.npm 26 | key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} 27 | restore-keys: | 28 | ${{ runner.os }}-node- 29 | - run: npm i 30 | - run: npm run test:lib:headless 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.angular/cache 36 | /.sass-cache 37 | /connect.lock 38 | /coverage 39 | /libpeerconnection.log 40 | npm-debug.log 41 | yarn-error.log 42 | testem.log 43 | /typings 44 | 45 | # System Files 46 | .DS_Store 47 | Thumbs.db 48 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx commitlint -e $GIT_PARAMS 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npm run hooks:pre-commit && npx lint-staged 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | ## [4.1.0](https://github.com/ngneat/hotkeys/compare/v4.0.0...v4.1.0) (2025-02-04) 6 | 7 | 8 | ### Features 9 | 10 | * add aliases to the hotkeys pipe ([4cbf546](https://github.com/ngneat/hotkeys/commit/4cbf546abc11602f524a12be369a62949db7e88d)), closes [#65](https://github.com/ngneat/hotkeys/issues/65) 11 | * adds a global modifier to the directive ([27bcc43](https://github.com/ngneat/hotkeys/commit/27bcc43de5e984ad81b239c1a5a0b354063e0ee7)), closes [#35](https://github.com/ngneat/hotkeys/issues/35) 12 | * adds pausing and resuming to the hotkey service ([f11c600](https://github.com/ngneat/hotkeys/commit/f11c600ee365f9a1a6466936d93fae2353290272)), closes [#62](https://github.com/ngneat/hotkeys/issues/62) 13 | * adds pausing and resuming to the hotkey service ([fe7e558](https://github.com/ngneat/hotkeys/commit/fe7e558104e73032b6e6bf561156417dab881b68)), closes [#62](https://github.com/ngneat/hotkeys/issues/62) 14 | 15 | ## [4.0.0](https://github.com/ngneat/hotkeys/compare/v2.0.0...v4.0.0) (2024-03-20) 16 | 17 | 18 | ### ⚠ BREAKING CHANGES 19 | 20 | * Angular v17 is required 21 | * **dependencies:** ** 22 | 23 | ### Bug Fixes 24 | 25 | * **dependencies:** removing @ng-bootstrap/ng-bootstrap ([ef30dec](https://github.com/ngneat/hotkeys/commit/ef30dec1c2ae42f17789be84272269c46291cb6d)), closes [#89](https://github.com/ngneat/hotkeys/issues/89) 26 | * **release:** bump all dependencies to latest ([17f74c6](https://github.com/ngneat/hotkeys/commit/17f74c60567e16248af7c6f9dd6a537559663929)) 27 | * **release:** update to angular 17 and bump all dependencies to latest ([26a6048](https://github.com/ngneat/hotkeys/commit/26a6048b33f1c3a75b870253b7dc69377fae9151)) 28 | * **release:** update to angular 17 and bump all dependencies to latest ([5323d0c](https://github.com/ngneat/hotkeys/commit/5323d0cbc38279a2a502f794a3c278a32d80adbb)) 29 | * **release:** update to angular 17 and bump all dependencies to latest ([234edd9](https://github.com/ngneat/hotkeys/commit/234edd98c864ce3f8978f1f0f92ef425368a6f7f)) 30 | * **release:** update to angular 17 and bump all dependencies to latest ([3d17db6](https://github.com/ngneat/hotkeys/commit/3d17db65d74312aff7c8f710c52104d73131ff9f)) 31 | 32 | 33 | * Merge pull request #91 from Pilpin/master ([1ff0709](https://github.com/ngneat/hotkeys/commit/1ff0709a83b8edf97c6d6b7de59e4514d3353797)), closes [#91](https://github.com/ngneat/hotkeys/issues/91) 34 | 35 | ## [2.0.0](https://github.com/ngneat/hotkeys/compare/v1.2.0...v2.0.0) (2023-09-11) 36 | 37 | 38 | ### ⚠ BREAKING CHANGES 39 | 40 | * 🧨 Replaced @angular/material with @ng-bootstrap/ng-bootstrap 41 | * `dimiss` property has been renamed to `dismiss` in help component. 42 | 43 | ### Features 44 | 45 | * ignore contentEditable elements ([4185015](https://github.com/ngneat/hotkeys/commit/4185015fb21e22f7f69ec7c885aafac5b2778a32)) 46 | * upgrade all deps ([bf602dc](https://github.com/ngneat/hotkeys/commit/bf602dcd21750820c24f7c427763cf6e12cad126)) 47 | * upgrade to 16 ([b2c839e](https://github.com/ngneat/hotkeys/commit/b2c839eb97a4d4348ecf39ace89ad16d143c2b46)) 48 | * upgrade to angular 15 ([e66128f](https://github.com/ngneat/hotkeys/commit/e66128f5e2a314474feb38c828bf216eaf9fa8ee)) 49 | 50 | 51 | ### Bug Fixes 52 | 53 | * added unit test ([f6d326c](https://github.com/ngneat/hotkeys/commit/f6d326cb515c651567f387fc0a21987f2edea785)) 54 | * change property `dimiss` to `dismiss` in help component output ([c4c69f1](https://github.com/ngneat/hotkeys/commit/c4c69f1b649dc7a666325a5c030f98c3aaa01b90)) 55 | * remove empty sequence map entry ([e66063e](https://github.com/ngneat/hotkeys/commit/e66063e735c92977d5c4afa213284eeaaa0a5458)) 56 | * tests ([6354acf](https://github.com/ngneat/hotkeys/commit/6354acfdbfe2c8b255dbd5bd04c601b2f929c130)) 57 | * update node.js version ([0da82aa](https://github.com/ngneat/hotkeys/commit/0da82aac30d45dfc6074d8fe22100418d2dca5ff)) 58 | 59 | 60 | * 💡 Remove Angular material and use bootstrap ([bc7be48](https://github.com/ngneat/hotkeys/commit/bc7be48bbd72780752265e5e038c427b3a6e853c)), closes [#83](https://github.com/ngneat/hotkeys/issues/83) 61 | 62 | ## [1.3.0](https://github.com/ngneat/hotkeys/compare/v1.2.0...v1.3.0) (2022-06-10) 63 | 64 | 65 | ### Features 66 | 67 | * ignore contentEditable elements ([4185015](https://github.com/ngneat/hotkeys/commit/4185015fb21e22f7f69ec7c885aafac5b2778a32)) 68 | 69 | 70 | ### Bug Fixes 71 | 72 | * added unit test ([f6d326c](https://github.com/ngneat/hotkeys/commit/f6d326cb515c651567f387fc0a21987f2edea785)) 73 | * remove empty sequence map entry ([e66063e](https://github.com/ngneat/hotkeys/commit/e66063e735c92977d5c4afa213284eeaaa0a5458)) 74 | * update node.js version ([0da82aa](https://github.com/ngneat/hotkeys/commit/0da82aac30d45dfc6074d8fe22100418d2dca5ff)) 75 | 76 | ## [1.2.0](https://github.com/ngneat/hotkeys/compare/v1.1.4...v1.2.0) (2022-04-09) 77 | 78 | 79 | ### Features 80 | 81 | * support ctrl,alt,shift for sequence hotkey ([ac0f78d](https://github.com/ngneat/hotkeys/commit/ac0f78d5ff25ec4e0117c9f47de0ce598bc52418)) 82 | * support for sequence hotkeys added ([fcdcdbd](https://github.com/ngneat/hotkeys/commit/fcdcdbd5403e9bd21b832fd9a90abb88fc6b5d5b)) 83 | 84 | 85 | ### Bug Fixes 86 | 87 | * arrow keys mapping to keycodes ([a772d84](https://github.com/ngneat/hotkeys/commit/a772d843efdb2ff7775e18f3a4aa6e83f6320d4e)) 88 | 89 | 90 | ### Tests 91 | 92 | * updated specs ([5acfe1b](https://github.com/ngneat/hotkeys/commit/5acfe1b0918e0d414c2f86e98f1511ccca06719e)) 93 | 94 | ### [1.1.4](https://github.com/ngneat/hotkeys/compare/v1.1.3...v1.1.4) (2021-07-29) 95 | 96 | 97 | ### Bug Fixes 98 | 99 | * dispose EventManager when unsubscribed ([91083c6](https://github.com/ngneat/hotkeys/commit/91083c6fc735f60e0851fcabba69bc373c5f90e2)) 100 | 101 | ### [1.1.3](https://github.com/ngneat/hotkeys/compare/v1.1.2...v1.1.3) (2021-07-26) 102 | 103 | 104 | ### Bug Fixes 105 | 106 | * unsubscribe shortcuts when removed ([1e2aba3](https://github.com/ngneat/hotkeys/commit/1e2aba3bb5256231ef1542aceb7744298888ec4c)) 107 | * use single subject ([91d9ad8](https://github.com/ngneat/hotkeys/commit/91d9ad8409df0989ad7f94be9299d188cabbf6db)) 108 | 109 | ### [1.1.2](https://github.com/ngneat/hotkeys/compare/v1.1.1...v1.1.2) (2021-01-02) 110 | 111 | 112 | ### Bug Fixes 113 | 114 | * 🐛 remove peer deps ([b54f358](https://github.com/ngneat/hotkeys/commit/b54f3589ea8dcd1fafe8b115f9f4d84b9691d216)) 115 | 116 | ### [1.1.1](https://github.com/ngneat/hotkeys/compare/v1.1.0...v1.1.1) (2020-06-29) 117 | 118 | 119 | ### Bug Fixes 120 | 121 | * filter form elements events ([9f955eb](https://github.com/ngneat/hotkeys/commit/9f955eb7498913f96111710e5b1c8a5f0fe58e9f)) 122 | * inefficiencies ([c047201](https://github.com/ngneat/hotkeys/commit/c047201b5900d034111ec6e560227bdb5d6dcb77)) 123 | 124 | ## [1.1.0](https://github.com/ngneat/hotkeys/compare/v1.0.1...v1.1.0) (2020-06-14) 125 | 126 | 127 | ### Features 128 | 129 | * add HotkeyService.removeShortcuts ([#6](https://github.com/ngneat/hotkeys/issues/6)) ([b0af8e0](https://github.com/ngneat/hotkeys/commit/b0af8e0e25405a823344184c476c7138d27282ed)) 130 | 131 | ### [1.0.1](https://github.com/ngneat/hotkeys/compare/v1.0.0...v1.0.1) (2020-05-13) 132 | 133 | 134 | ### Bug Fixes 135 | 136 | * 🐛 remove material ([6d39222](https://github.com/ngneat/hotkeys/commit/6d3922297fc071ce72baa681e3d5789c4e2b4e10)) 137 | 138 | ## 1.0.0 (2020-04-24) 139 | -------------------------------------------------------------------------------- /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 contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at netanel7799@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Hotkeys 2 | 3 | 🙏 We would ❤️ for you to contribute to Hotkeys and help make it even better than it is today! 4 | 5 | # Developing 6 | 7 | Start by installing all dependencies: 8 | 9 | ```bash 10 | npm i 11 | ``` 12 | 13 | Run the tests: 14 | 15 | ```bash 16 | npm test 17 | npm run e2e 18 | ``` 19 | 20 | Run the playground app: 21 | 22 | ```bash 23 | npm start 24 | ``` 25 | 26 | ## Building 27 | 28 | ```bash 29 | npm run build 30 | ``` 31 | 32 | ## Coding Rules 33 | 34 | To ensure consistency throughout the source code, keep these rules in mind as you are working: 35 | 36 | - All features or bug fixes **must be tested** by one or more specs (unit-tests). 37 | - All public API methods **must be documented**. 38 | 39 | ## Commit Message Guidelines 40 | 41 | We have very precise rules over how our git commit messages can be formatted. This leads to **more 42 | readable messages** that are easy to follow when looking through the **project history**. But also, 43 | we use the git commit messages to **generate the Hotkeys changelog**. 44 | 45 | ### Commit Message Format 46 | 47 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special 48 | format that includes a **type**, a **scope** and a **subject**: 49 | 50 | ``` 51 | (): 52 | 53 | 54 | 55 |