Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

atom-keymap

Package Overview
Dependencies
Maintainers
9
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atom-keymap - npm Package Compare versions

Comparing version 7.0.8 to 7.1.0

82

api.json

@@ -6,3 +6,3 @@ {

"filename": "src/keymap-manager.coffee",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L66",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L65",
"sections": [

@@ -42,3 +42,3 @@ {

"sectionName": "Class Methods",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L83",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L82",
"visibility": "Public",

@@ -105,3 +105,3 @@ "summary": "Create a keydown DOM event for testing purposes.",

"sectionName": "Construction and Destruction",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L109",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L107",
"visibility": "Public",

@@ -130,3 +130,3 @@ "summary": "Create a new KeymapManager.",

"sectionName": "Construction and Destruction",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L117",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L115",
"visibility": "Public",

@@ -139,3 +139,3 @@ "summary": "Clear all registered key bindings and enqueued keystrokes. For use\nin tests. ",

"sectionName": "Construction and Destruction",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L125",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L123",
"visibility": "Public",

@@ -148,3 +148,3 @@ "summary": "Unwatch all watched paths. ",

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L151",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L144",
"visibility": "Public",

@@ -199,3 +199,3 @@ "summary": "Invoke the given callback when one or more keystrokes completely\nmatch a key binding.",

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L167",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L160",
"visibility": "Public",

@@ -250,3 +250,3 @@ "summary": "Invoke the given callback when one or more keystrokes partially\nmatch a binding.",

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L181",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L174",
"visibility": "Public",

@@ -295,3 +295,3 @@ "summary": "Invoke the given callback when one or more keystrokes fail to match\nany bindings.",

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L212",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L205",
"visibility": "Public",

@@ -340,3 +340,3 @@ "summary": "Invoke the given callback when a keymap file not able to be loaded.",

"sectionName": "Adding and Removing Bindings",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L227",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L220",
"visibility": "Public",

@@ -369,3 +369,3 @@ "summary": "Add sets of key bindings grouped by CSS selector.",

"sectionName": "Accessing Bindings",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L266",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L259",
"visibility": "Public",

@@ -384,3 +384,3 @@ "summary": "Get all current key bindings.",

"sectionName": "Accessing Bindings",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L281",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L274",
"visibility": "Public",

@@ -427,3 +427,3 @@ "summary": "Get the key bindings for a given command and optional target.",

"sectionName": "Managing Keymap Files",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L318",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L311",
"visibility": "Public",

@@ -464,3 +464,3 @@ "summary": "Load the key bindings from the given path.",

"sectionName": "Managing Keymap Files",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L341",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L334",
"visibility": "Public",

@@ -495,3 +495,3 @@ "summary": "Cause the keymap to reload the key bindings file at the given path\nwhenever it changes.",

"sectionName": "Managing Keyboard Events",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L413",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L406",
"visibility": "Public",

@@ -512,3 +512,3 @@ "summary": "Dispatch a custom event associated with the matching key binding for\nthe given `KeyboardEvent` if one can be found.",

"sectionName": "Managing Keyboard Events",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L625",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L618",
"visibility": "Public",

@@ -533,5 +533,53 @@ "summary": "Translate a keydown event to a keystroke string.",

{
"name": "addKeystrokeResolver",
"sectionName": "Managing Keyboard Events",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L639",
"visibility": "Public",
"summary": "Customize translation of raw keyboard events to keystroke strings.\nThis API is useful for working around Chrome bugs or changing how Atom\nresolves certain key combinations. If multiple resolvers are installed,\nthe most recently-added resolver returning a string for a given keystroke\ntakes precedence.",
"description": "Customize translation of raw keyboard events to keystroke strings.\nThis API is useful for working around Chrome bugs or changing how Atom\nresolves certain key combinations. If multiple resolvers are installed,\nthe most recently-added resolver returning a string for a given keystroke\ntakes precedence.",
"arguments": [
{
"children": [
{
"name": "keystroke",
"description": "The currently resolved keystroke string. If your function returns a falsy value, this is how Atom will resolve your keystroke.",
"type": null,
"isOptional": false
},
{
"name": "event",
"description": "The raw DOM 3 `KeyboardEvent` being resolved. See the DOM API documentation for more details.",
"type": null,
"isOptional": false
},
{
"name": "layoutName",
"description": "The OS-specific name of the current keyboard layout.",
"type": null,
"isOptional": false
},
{
"name": "keymap",
"description": "An object mapping DOM 3 `KeyboardEvent.code` values to objects with the typed character for that key in each modifier state, based on the current operating system layout.",
"type": null,
"isOptional": false
}
],
"name": "resolver",
"description": "A {Function} that returns a keystroke {String} and is called with an object containing the following keys:",
"type": "Function",
"isOptional": false
}
],
"returnValues": [
{
"type": "Disposable",
"description": "Returns a {Disposable} that removes the added resolver."
}
]
},
{
"name": "getPartialMatchTimeout",
"sectionName": "Managing Keyboard Events",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.0.8/src/keymap-manager.coffee#L632",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v7.1.0/src/keymap-manager.coffee#L649",
"visibility": "Public",

@@ -538,0 +586,0 @@ "summary": "Get the number of milliseconds allowed before pending states caused\nby partial matches of multi-keystroke bindings are terminated.",

@@ -156,4 +156,4 @@ (function() {

exports.keystrokeForKeyboardEvent = function(event) {
var altKey, characters, code, ctrlKey, isNonCharacterKey, key, keystroke, metaKey, nonAltModifiedKey, shiftKey, _ref, _ref1, _ref2;
exports.keystrokeForKeyboardEvent = function(event, customKeystrokeResolvers) {
var altKey, characters, code, ctrlKey, customKeystroke, isNonCharacterKey, key, keystroke, metaKey, nonAltModifiedKey, resolver, shiftKey, _i, _len, _ref, _ref1, _ref2;
key = event.key, code = event.code, ctrlKey = event.ctrlKey, altKey = event.altKey, shiftKey = event.shiftKey, metaKey = event.metaKey;

@@ -267,2 +267,16 @@ if (key === 'Dead') {

}
if (customKeystrokeResolvers != null) {
for (_i = 0, _len = customKeystrokeResolvers.length; _i < _len; _i++) {
resolver = customKeystrokeResolvers[_i];
customKeystroke = resolver({
keystroke: keystroke,
event: event,
layoutName: KeyboardLayout.getCurrentKeyboardLayout(),
keymap: KeyboardLayout.getCurrentKeymap()
});
if (customKeystroke) {
keystroke = normalizeKeystroke(customKeystroke);
}
}
}
return keystroke;

@@ -269,0 +283,0 @@ };

(function() {
var CSON, CommandEvent, CompositeDisposable, Disposable, Emitter, File, KeyBinding, KeymapManager, OtherPlatforms, Platforms, characterForKeyboardEvent, fs, isBareModifier, isSelectorValid, keydownEvent, keystrokeForKeyboardEvent, keystrokesMatch, keyupEvent, normalizeKeystrokes, observeCurrentKeyboardLayout, path, _ref, _ref1,
var CSON, CommandEvent, CompositeDisposable, Disposable, Emitter, File, KeyBinding, KeymapManager, OtherPlatforms, Platforms, characterForKeyboardEvent, fs, isBareModifier, isSelectorValid, keydownEvent, keystrokeForKeyboardEvent, keystrokesMatch, keyupEvent, normalizeKeystrokes, path, _ref, _ref1,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

@@ -11,4 +11,2 @@

observeCurrentKeyboardLayout = require('keyboard-layout').observeCurrentKeyboardLayout;
path = require('path');

@@ -58,5 +56,3 @@

KeymapManager.prototype.dvorakQwertyWorkaroundEnabled = false;
/*

@@ -76,4 +72,4 @@ Section: Construction and Destruction

this.watchSubscriptions = {};
this.customKeystrokeResolvers = [];
this.clear();
this.enableDvorakQwertyWorkaroundIfNeeded();
}

@@ -91,3 +87,2 @@

var filePath, subscription, _ref2;
this.keyboardLayoutSubscription.dispose();
_ref2 = this.watchSubscriptions;

@@ -100,11 +95,3 @@ for (filePath in _ref2) {

KeymapManager.prototype.enableDvorakQwertyWorkaroundIfNeeded = function() {
return this.keyboardLayoutSubscription = observeCurrentKeyboardLayout((function(_this) {
return function(layoutId) {
return _this.dvorakQwertyWorkaroundEnabled = (layoutId != null ? layoutId.indexOf('DVORAK-QWERTYCMD') : void 0) > -1;
};
})(this));
};
/*

@@ -448,5 +435,18 @@ Section: Event Subscription

KeymapManager.prototype.keystrokeForKeyboardEvent = function(event) {
return keystrokeForKeyboardEvent(event, this.dvorakQwertyWorkaroundEnabled);
return keystrokeForKeyboardEvent(event, this.customKeystrokeResolvers);
};
KeymapManager.prototype.addKeystrokeResolver = function(resolver) {
this.customKeystrokeResolvers.push(resolver);
return new Disposable((function(_this) {
return function() {
var index;
index = _this.customKeystrokeResolvers.indexOf(resolver);
if (index >= 0) {
return _this.customKeystrokeResolvers.splice(index, 1);
}
};
})(this));
};
KeymapManager.prototype.getPartialMatchTimeout = function() {

@@ -463,3 +463,3 @@ return this.partialMatchTimeout;

var character, textInputEvent;
if (character = characterForKeyboardEvent(keydownEvent, this.dvorakQwertyWorkaroundEnabled)) {
if (character = characterForKeyboardEvent(keydownEvent)) {
textInputEvent = document.createEvent("TextEvent");

@@ -466,0 +466,0 @@ textInputEvent.initTextEvent("textInput", true, true, window, character);

{
"name": "atom-keymap",
"version": "7.0.8",
"version": "7.1.0",
"description": "Atom's DOM-aware keymap module",

@@ -5,0 +5,0 @@ "main": "./lib/keymap-manager",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc