Detalhes do pacote

ember-keyboard

adopted-ember-addons122.6kMIT9.0.1

An Ember.js addon for the painless support of keyboard events

ember-addon

readme (leia-me)

ember-keyboard logo   npm version Build Status

ember-keyboard

An Ember addon for painlessly supporting keyboard events

Features

  • Ember Octane-friendly template declarations for keyboard shortcuts
  • Support for keyup and keydown, as well as the modifier keys: ctrl, alt, shift, and meta.
  • Dynamic priority levels allow you to specify which components respond first to key events and under what circumstances. (Thanks to ember-key-responder for the inspiration)
  • Human-readable key-mappings. (Thanks to ember-keyboard-service for the inspiration)

Documentation & Demo

You can find interactive documentation here.

Compatibility

  • Ember 4 compatibility requires ember-keyboard 7.x or higher
  • For Ember 3.8 to 3.28, you can use ember-keyboard 6.x (not compatible with Internet Explorer)
  • For use with Ember 2.0 up to 3.8 or IE compatibility, use ember-keyboard 5.x.
  • Node.js v16 or above
  • ember-auto-import v2.0.0 or above (this is v2 addon)

Accessibility Considerations

In order to avoid adding keyboard shortcuts to your application that are already in use by assistive technology, please review the existing keyboard shortcuts and gestures available today: https://dequeuniversity.com/screenreaders/.

Installation

ember install ember-keyboard

changelog (log de mudanças)

Changelog

Release (2024-08-23)

ember-keyboard 9.0.1 (patch)

:bug: Bug Fix

  • ember-keyboard, test-app
    • #757 Don't evaluate getters when looking for handlers (@wagenet)

:house: Internal

Committers: 2

Release (2024-08-22)

ember-keyboard 9.0.0 (major)

:boom: Breaking Change

  • ember-keyboard, test-app

:rocket: Enhancement

:house: Internal

Committers: 3

v8.2.1 (2023-08-16)

:rocket: Enhancement

:memo: Documentation

  • #674 Add note about v2 addon format and ember-auto-import requirement (@SergeAstapov)

:house: Internal

Committers: 2

v8.2.0 (2022-07-12)

:rocket: Enhancement

:memo: Documentation

:house: Internal

Committers: 3

v8.1.1 (2022-04-10)

:bug: Bug Fix

Committers: 1

v8.1.0 (2022-04-07)

:rocket: Enhancement

:memo: Documentation

:house: Internal

  • #616 replace highlight.js EOL warning in changelog by title (@jelhan)

Committers: 2

v8.0.0 (2022-03-17)

:boom: Breaking Change

  • #598 convert to v2 addon (@SergeAstapov) Your app or addon now must have ember-auto-import version 2 or higher in its dependencies in order to use this addon (or any v2 addons)

:rocket: Enhancement

  • #578 Support inputs in shadow DOM in disableOnInputFields mode (@simonihmig)

:house: Internal

Committers: 2

v7.0.1 (2022-01-18)

:rocket: Enhancement

  • #557 Add disableOnInputFields option, which allows to automatically disable keyboard events on all input fields (@st-h)

:house: Internal

Committers: 1

v7.0.0 (2022-01-11)

:house: Internal

Committers: 1

v7.0.0-beta.0 (2021-11-28)

Special thanks to @SergeAstapov for his great work on this release!

:boom: Breaking Change

:rocket: Enhancement

:house: Internal

Committers: 1

v6.0.4 (2021-11-19)

This will be the last release in the 6.x series. 7.0 will drop code related to several deprecations.

:boom: Breaking Change

:rocket: Enhancement

:house: Internal

Committers: 1

v6.0.3 (2021-05-28)

ember-cli-babel has been updated in this release.

:bug: Bug Fix

  • #347 fix: ES6 @keyResponder decorator fails with params (@urbany)

:house: Internal

Committers: 3

v6.0.2 (2020-10-30)

:rocket: Enhancement

:memo: Documentation

:house: Internal

Committers: 4

v6.0.1 (2020-09-07)

:house: Internal

Committers: 2

v6.0.0 (2020-06-10)

This major release sports new Octane-friendly API. You can see examples and read about the reasons for the API choices in our API Design doc.

Upgrading from ember-keyboard 5.0.0 to 6.0.0

ember-keyboard 6.0.0-beta.1 introduces new APIs to bring ember-keyboard into the Ember Octane era. The old mixins-based API still works but is deprecated in this release and slated for removal in version 7.

Version 6 requires Ember 3.8 or higher, so if you are on a version of Ember before that, you should stick with 5.0.0 until you are able to upgrade your app's Ember version.

If your app is on a recent version of Ember, you are good to go. The path is to upgrade to ember-keyboard 6.x and you can iteratively update to the new APIs until you have no more deprecation warnings left.

The deprecations page discusses migration paths for each warning you may encounter, but our broader advice is to consider moving as much of your keyboard handling logic to templates as possible. We think that you'll find the on-key helper and modifier to be very convenient to work with. The decorator API (which required ember 3.10 or higher) is closest equivalent to the mixins API, but it should be used sparingly in situations where the template approach isn't a good fit.

There is one other potential breaking change to be aware of when upgrading from v5 to v6: ember-keyboard versions before 6.0 had an ambiguous API when it came to specifying key combos and required the use of code identifiers, like KeyT, Digit1, etc. Be sure to read the docs regarding key vs. code properties and be sure you are specifying the key combo consistent with your intended behavior. You will likely find that you want to update some key combos to the key equivalent. e.g. replace ctrl+KeyT with ctrl+t.

Upgrading from ember-keyboard 6.0.0-beta.0 to 6.0.0

The keyboard-press component has been deprecated and replaced with the on-key helper. The on-keyboard and keyboard-shortut modifiers have been deprecated and replaced with the on-key modifier. The deprecations page has more info, along with the 5 to 6 upgrade guide immediately below.

Upgrading from ember-keyboard 6.0.0-beta.1 to 6.0.0

The only changes since 6.0.0-beta.1 were internal dependency updates. Upgrading should be smooth.

:house: Internal Changes since 6.0.0-beta.1

Committers: 2

Other contributors

Thank you to @optikalefx, @NullVoxPopuli @mattmcmanus, @seanCodes, and @bendemboski for helping to shape the API Design for this release.

v6.0.0-beta.1 (2020-06-04)

This is the second beta of ember-keyboard 6.0.0!

:rocket: :boom: Breaking Change

:memo: Documentation

<summary>:house: Internal</summary> #180 Bump ember-cli-babel from 7.20.4 to 7.20.5 (@dependabot-preview[bot]) #178 Bump release-it from 13.6.1 to 13.6.2 (@dependabot-preview[bot]) #177 Bump ember-cli-babel from 7.20.0 to 7.20.4 (@dependabot-preview[bot]) #171 Bump qunit-dom from 1.1.0 to 1.2.0 (@dependabot-preview[bot]) #169 Bump eslint from 7.0.0 to 7.1.0 (@dependabot-preview[bot]) #166 Bump ember-template-lint from 2.4.1 to 2.8.0 (@dependabot-preview[bot]) #167 Bump ember-compatibility-helpers from 1.2.0 to 1.2.1 (@dependabot-preview[bot]) #168 Bump markdown-code-highlighting from 0.2.0 to 0.2.1 (@dependabot-preview[bot]) #160 [Security] Bump tar from 2.2.1 to 2.2.2 (@dependabot-preview[bot]) #161 [Security] Bump lodash from 4.17.10 to 4.17.15 (@dependabot-preview[bot]) #162 Bump eslint-plugin-node from 11.0.0 to 11.1.0 (@dependabot-preview[bot]) #156 [Security] Bump jquery from 3.4.1 to 3.5.1 (@dependabot-preview[bot]) #157 [Security] Bump lodash.defaultsdeep from 4.6.0 to 4.6.1 (@dependabot-preview[bot]) #158 [Security] Bump lodash.merge from 4.6.1 to 4.6.2 (@dependabot-preview[bot]) #159 [Security] Bump mixin-deep from 1.3.1 to 1.3.2 (@dependabot-preview[bot]) #155 Adopt release-it to help with changelog and release management (@lukemelia) #154 Fix an issue in the keyboard service unit test that left key responders registered (@lukemelia) #153 Bump ember-cli-babel from 7.19.0 to 7.20.0 (@dependabot-preview[bot]) #152 Bump marked from 0.3.19 to 1.1.0 (@dependabot-preview[bot]) #148 Bump @babel/plugin-proposal-object-rest-spread from 7.3.1 to 7.9.6 (@dependabot-preview[bot]) #141 Bump markdown-code-highlighting from 0.2.0 to 0.2.1 (@dependabot-preview[bot]) #138 Bump eslint from 6.8.0 to 7.0.0 (@dependabot-preview[bot]) #142 Bump qunit-dom from 1.1.0 to 1.2.0 (@dependabot-preview[bot]) #128 [Security] Bump lodash.merge from 4.6.1 to 4.6.2 (@dependabot-preview[bot]) #136 [Security] Bump jquery from 3.4.1 to 3.5.1 (@dependabot-preview[bot]) #131 Bump ember-cli-github-pages from 0.2.0 to 0.2.2 (@dependabot-preview[bot]) #130 [Security] Bump lodash from 4.17.10 to 4.17.15 (@dependabot-preview[bot]) #132 [Security] Bump mixin-deep from 1.3.1 to 1.3.2 (@dependabot-preview[bot]) #133 [Security] Bump tar from 2.2.1 to 2.2.2 (@dependabot-preview[bot]) #137 Bump ember-test-selectors from 1.0.0 to 4.1.0 (@dependabot-preview[bot])

Committers: 2

Other contributors

Thank you to @optikalefx, @NullVoxPopuli @mattmcmanus, @seanCodes, and @bendemboski for helping to shape the API Design for this release.

v6.0.0-beta.0 (2020-04-29) (Pre-release)

(Octane-friendly!)

This is the first beta of ember-keyboard 6.0.0!

  • [BREAKING] Now requires ember >= 3.8 and node >= 10.x
  • [FEATURE] Add on-keyboard and keyboard-shortcut element modifiers and make keyboard-press component public and documented #111 (lukemelia) - These names may be changed before final release of 6.0.

The best place for documentation on the new features is https://github.com/adopted-ember-addons/ember-keyboard/blob/master/tests/dummy/app/templates/usage.hbs -- our docs site will be updated when 6.0.0 final is released)

Note: ember-keyboard has been moved to the adopted-ember-addons org. We're grateful to @briarsweetbriar for maintaining the project prior to this transition and for facilitating a smooth transition and ensuring this addon can continue to evolve with Ember.

v5.0.0 (2019-11-19)

  • Upgrades to ember-cli-babel 7.

v4.0.0 (2018-09-05)

Support software keymaps

Big thanks to @NullVoxPopuli for this PR. Now, ember-keyboard will respond to the key mapping, rather than the key itself. For instance, with a Dvorak key mapping, pressing 'k' will give a code of 'KeyV' and a key of 'k'. Now, ember-keyboard will treat a Dvorak 'KeyV' as a 'k'.

This may introduce a regression if you intended to map to the key themselves, rather than to their code. If that's the case, please take out an issue and we'll figure out a way to support that behavior as well.

v3.0.0 (2018-01-16)

Remove jQuery and make touch/mouse events opt-in

This release has two potential breaking changes:

  1. jQuery's been removed! This means that responders will now receive vanilla events, instead of jQuery events. For instance, using jQuery's isImmediatePropagationStopped will no longer work:
responder: Ember.on(keyDown('KeyA'), function(event) {
  event.isImmediatePropagationStopped();
})
  1. Mouse/touch events are now opt-in. You'll have to specify them in your config/environment.js file:
emberKeyboard: {
  listeners: ['keyUp', 'keyDown', 'keyPress', 'click', 'mouseDown', 'mouseUp', 'touchStart', 'touchEnd']
}

...

v2.0.0 (2016-07-13)

Use code instead of key

This release switches to the more consistent code property. For instance:

keyDown('KeyA', . . .)
keyDown('Digit1', . . .)
keyDown('Numpad1', . . .)
keyDown('Space', . . .)

v1.1.0 (2016-04-23)

:bug: Bugs

  • Add support for irregular IE key names

v1.0.3 (2016-03-23)

:rocket: Enhancement

  • Add a keyPress test helper

v1.0.2 (2016-03-23)

v1.0.1 (2016-03-22)

:house: Internal

  • Update Ember CLI

v1.0.0 (2016-03-22)

:rocket: Enhancement

  • Add a keyPress listener to accompany keyDown and keyUp
  • Add ability to specify which events ember-keyboard listens for in the app's config/environment.js

v0.2.8 (2016-03-09)

:rocket: Enhancement

  • Add test helpers

...

v0.0.2 (2015-10-24)

  • The beginning