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

atom-keymap

Package Overview
Dependencies
Maintainers
7
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 5.1.6 to 5.1.7

32

api.json

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

"filename": "src/keymap-manager.coffee",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.6/src/keymap-manager.coffee#L67",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L66",
"sections": [

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

"sectionName": "Class Methods",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.6/src/keymap-manager.coffee#L84",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L83",
"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/v5.1.6/src/keymap-manager.coffee#L108",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/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/v5.1.6/src/keymap-manager.coffee#L118",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L117",
"visibility": "Public",

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

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.6/src/keymap-manager.coffee#L144",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L143",
"visibility": "Public",

@@ -190,3 +190,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/v5.1.6/src/keymap-manager.coffee#L160",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L159",
"visibility": "Public",

@@ -241,3 +241,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/v5.1.6/src/keymap-manager.coffee#L174",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L173",
"visibility": "Public",

@@ -286,3 +286,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/v5.1.6/src/keymap-manager.coffee#L205",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L204",
"visibility": "Public",

@@ -331,3 +331,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/v5.1.6/src/keymap-manager.coffee#L218",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L217",
"visibility": "Public",

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

"sectionName": "Accessing Bindings",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.6/src/keymap-manager.coffee#L251",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L250",
"visibility": "Public",

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

"sectionName": "Accessing Bindings",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.6/src/keymap-manager.coffee#L266",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L265",
"visibility": "Public",

@@ -412,3 +412,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/v5.1.6/src/keymap-manager.coffee#L301",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L300",
"visibility": "Public",

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

"sectionName": "Managing Keymap Files",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.6/src/keymap-manager.coffee#L321",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L320",
"visibility": "Public",

@@ -460,3 +460,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/v5.1.6/src/keymap-manager.coffee#L395",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L392",
"visibility": "Public",

@@ -477,3 +477,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/v5.1.6/src/keymap-manager.coffee#L473",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L490",
"visibility": "Public",

@@ -500,3 +500,3 @@ "summary": "Translate a keydown event to a keystroke string.",

"sectionName": "Managing Keyboard Events",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.6/src/keymap-manager.coffee#L480",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.1.7/src/keymap-manager.coffee#L497",
"visibility": "Public",

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

(function() {
var AtomModifierRegex, AtomModifiers, KeyboardEventModifiers, LowerCaseLetterRegex, NumPadToASCII, UpperCaseLetterRegex, WhitespaceRegex, WindowsAndLinuxCharCodeTranslations, WindowsAndLinuxKeyIdentifierTranslations, calculateSpecificity, charCodeFromKeyIdentifier, isASCII, keyFromCharCode, modifier, normalizeKeystroke, numpadToASCII, parseKeystroke, translateCharCodeForWindowsAndLinuxChromiumBug, translateKeyIdentifierForWindowsAndLinuxChromiumBug, _i, _j, _len, _len1, _ref, _ref1;
var AtomModifierRegex, AtomModifiers, KeyboardEventModifiers, LowerCaseLetterRegex, NumPadToASCII, UpperCaseLetterRegex, WhitespaceRegex, WindowsAndLinuxCharCodeTranslations, WindowsAndLinuxKeyIdentifierTranslations, calculateSpecificity, charCodeFromKeyIdentifier, isASCII, keyForKeyboardEvent, keyFromCharCode, modifier, normalizeKeystroke, numpadToASCII, parseKeystroke, translateCharCodeForWindowsAndLinuxChromiumBug, translateKeyIdentifierForWindowsAndLinuxChromiumBug, _i, _j, _len, _len1, _ref, _ref1;

@@ -161,31 +161,4 @@ calculateSpecificity = require('clear-cut').calculateSpecificity;

exports.keystrokeForKeyboardEvent = function(event, dvorakQwertyWorkaroundEnabled) {
var charCode, key, keyIdentifier, keystroke, _ref2, _ref3;
keyIdentifier = event.keyIdentifier;
if ((_ref2 = process.platform) === 'linux' || _ref2 === 'win32') {
keyIdentifier = translateKeyIdentifierForWindowsAndLinuxChromiumBug(keyIdentifier);
}
if (!KeyboardEventModifiers.has(keyIdentifier)) {
charCode = charCodeFromKeyIdentifier(keyIdentifier);
if (dvorakQwertyWorkaroundEnabled && typeof charCode === 'number') {
if (event.keyCode === 46) {
charCode = 127;
} else {
charCode = event.keyCode;
}
}
if (charCode != null) {
if ((_ref3 = process.platform) === 'linux' || _ref3 === 'win32') {
charCode = translateCharCodeForWindowsAndLinuxChromiumBug(charCode, event.shiftKey);
}
if (event.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) {
charCode = numpadToASCII(charCode);
}
if (!isASCII(charCode) && isASCII(event.keyCode)) {
charCode = event.which;
}
key = keyFromCharCode(charCode);
} else {
key = keyIdentifier.toLowerCase();
}
}
var key, keystroke;
key = keyForKeyboardEvent(event, dvorakQwertyWorkaroundEnabled);
keystroke = '';

@@ -208,9 +181,2 @@ if (event.ctrlKey) {

}
if (LowerCaseLetterRegex.test(key)) {
key = key.toUpperCase();
}
} else {
if (UpperCaseLetterRegex.test(key)) {
key = key.toLowerCase();
}
}

@@ -232,2 +198,13 @@ if (event.metaKey) {

exports.characterForKeyboardEvent = function(event, dvorakQwertyWorkaroundEnabled) {
var key;
if (!(event.ctrlKey || event.altKey || event.metaKey)) {
if (key = keyForKeyboardEvent(event, dvorakQwertyWorkaroundEnabled)) {
if (key.length === 1) {
return key;
}
}
}
};
exports.calculateSpecificity = calculateSpecificity;

@@ -283,2 +260,7 @@

});
Object.defineProperty(event, 'path', {
get: function() {
return [target];
}
});
}

@@ -365,2 +347,45 @@ Object.defineProperty(event, 'keyCode', {

keyForKeyboardEvent = function(event, dvorakQwertyWorkaroundEnabled) {
var charCode, key, keyIdentifier, _ref2, _ref3;
keyIdentifier = event.keyIdentifier;
if ((_ref2 = process.platform) === 'linux' || _ref2 === 'win32') {
keyIdentifier = translateKeyIdentifierForWindowsAndLinuxChromiumBug(keyIdentifier);
}
if (KeyboardEventModifiers.has(keyIdentifier)) {
return null;
}
charCode = charCodeFromKeyIdentifier(keyIdentifier);
if (dvorakQwertyWorkaroundEnabled && typeof charCode === 'number') {
if (event.keyCode === 46) {
charCode = 127;
} else {
charCode = event.keyCode;
}
}
if (charCode != null) {
if ((_ref3 = process.platform) === 'linux' || _ref3 === 'win32') {
charCode = translateCharCodeForWindowsAndLinuxChromiumBug(charCode, event.shiftKey);
}
if (event.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) {
charCode = numpadToASCII(charCode);
}
if (!isASCII(charCode) && isASCII(event.keyCode)) {
charCode = event.which;
}
key = keyFromCharCode(charCode);
} else {
key = keyIdentifier.toLowerCase();
}
if (event.shiftKey) {
if (LowerCaseLetterRegex.test(key)) {
key = key.toUpperCase();
}
} else {
if (UpperCaseLetterRegex.test(key)) {
key = key.toLowerCase();
}
}
return key;
};
charCodeFromKeyIdentifier = function(keyIdentifier) {

@@ -367,0 +392,0 @@ if (keyIdentifier.indexOf('U+') === 0) {

(function() {
var Grim, KeyBinding, PropertyAccessors, calculateSpecificity;
var KeyBinding, calculateSpecificity;
Grim = require('grim');
calculateSpecificity = require('./helpers').calculateSpecificity;

@@ -45,17 +43,2 @@

if (Grim.includeDeprecatedAPIs) {
PropertyAccessors = require('property-accessors');
PropertyAccessors.includeInto(KeyBinding);
KeyBinding.prototype.accessor('keystroke', {
get: function() {
Grim.deprecate('Use KeyBinding.keystrokes instead');
return this.keystrokes;
},
set: function(value) {
Grim.deprecate('Use KeyBinding.keystrokes instead');
return this.keystrokes = value;
}
});
}
}).call(this);
(function() {
var CSON, CommandEvent, CompositeDisposable, Disposable, Emitter, EmitterMixin, File, Grim, KeyBinding, KeymapManager, OtherPlatforms, Platforms, fs, isAtomModifier, isSelectorValid, keydownEvent, keystrokeForKeyboardEvent, normalizeKeystrokes, observeCurrentKeyboardLayout, path, _ref, _ref1,
var CSON, CommandEvent, CompositeDisposable, Disposable, Emitter, File, KeyBinding, KeymapManager, OtherPlatforms, Platforms, characterForKeyboardEvent, fs, isAtomModifier, isSelectorValid, keydownEvent, keystrokeForKeyboardEvent, normalizeKeystrokes, observeCurrentKeyboardLayout, 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; };

@@ -7,4 +7,2 @@

Grim = require('grim');
fs = require('fs-plus');

@@ -26,3 +24,3 @@

_ref1 = require('./helpers'), normalizeKeystrokes = _ref1.normalizeKeystrokes, keystrokeForKeyboardEvent = _ref1.keystrokeForKeyboardEvent, isAtomModifier = _ref1.isAtomModifier, keydownEvent = _ref1.keydownEvent;
_ref1 = require('./helpers'), normalizeKeystrokes = _ref1.normalizeKeystrokes, keystrokeForKeyboardEvent = _ref1.keystrokeForKeyboardEvent, isAtomModifier = _ref1.isAtomModifier, keydownEvent = _ref1.keydownEvent, characterForKeyboardEvent = _ref1.characterForKeyboardEvent;

@@ -265,5 +263,2 @@ Platforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32'];

this.add(filePath, bindings);
if (Grim.includeDeprecatedAPIs) {
this.emit('reloaded-key-bindings', filePath);
}
return this.emitter.emit('did-reload-keymap', {

@@ -275,5 +270,2 @@ path: filePath

this.removeBindingsFromSource(filePath);
if (Grim.includeDeprecatedAPIs) {
this.emit('unloaded-key-bindings', filePath);
}
return this.emitter.emit('did-unload-keymap', {

@@ -319,3 +311,3 @@ path: filePath

KeymapManager.prototype.handleKeyboardEvent = function(event, replaying) {
KeymapManager.prototype.handleKeyboardEvent = function(event) {
var currentTarget, enableTimeout, exactMatch, exactMatchCandidates, exactMatches, foundMatch, keystroke, keystrokes, partialMatchCandidates, partialMatches, target, _i, _len, _ref2;

@@ -361,11 +353,7 @@ keystroke = this.keystrokeForKeyboardEvent(event);

if (this.dispatchCommandEvent(exactMatch.command, target, event)) {
event = {
this.emitter.emit('did-match-binding', {
keystrokes: keystrokes,
binding: exactMatch,
keyboardEventTarget: target
};
if (Grim.includeDeprecatedAPIs) {
this.emit('matched', event);
}
this.emitter.emit('did-match-binding', event);
});
return;

@@ -379,23 +367,22 @@ }

event.preventDefault();
enableTimeout = foundMatch != null ? foundMatch : this.pendingStateTimeoutHandle != null;
enableTimeout = (this.pendingStateTimeoutHandle != null) || foundMatch || (characterForKeyboardEvent(this.queuedKeyboardEvents[0]) != null);
this.enterPendingState(partialMatches, enableTimeout);
event = {
return this.emitter.emit('did-partially-match-binding', {
keystrokes: keystrokes,
partiallyMatchedBindings: partialMatches,
keyboardEventTarget: target
};
if (Grim.includeDeprecatedAPIs) {
this.emit('matched-partially', event);
}
return this.emitter.emit('did-partially-match-binding', event);
});
} else {
event = {
this.emitter.emit('did-fail-to-match-binding', {
keystrokes: keystrokes,
keyboardEventTarget: target
};
if (Grim.includeDeprecatedAPIs) {
this.emit('match-failed', event);
});
if (this.pendingPartialMatches != null) {
return this.terminatePendingState();
} else {
if (event.defaultPrevented) {
this.simulateTextInput(event);
}
return this.clearQueuedKeystrokes();
}
this.emitter.emit('did-fail-to-match-binding', event);
return this.terminatePendingState();
}

@@ -417,2 +404,11 @@ };

KeymapManager.prototype.simulateTextInput = function(keydownEvent) {
var character, textInputEvent;
if (character = characterForKeyboardEvent(keydownEvent, this.dvorakQwertyWorkaroundEnabled)) {
textInputEvent = document.createEvent("TextEvent");
textInputEvent.initTextEvent("textInput", true, true, window, character);
return keydownEvent.path[0].dispatchEvent(textInputEvent);
}
};
KeymapManager.prototype.getOtherPlatforms = function() {

@@ -485,3 +481,3 @@ return OtherPlatforms;

if (enableTimeout) {
return this.pendingStateTimeoutHandle = setTimeout(this.terminatePendingState.bind(this), this.partialMatchTimeout);
return this.pendingStateTimeoutHandle = setTimeout(this.terminatePendingState.bind(this, true), this.partialMatchTimeout);
}

@@ -496,8 +492,4 @@ };

KeymapManager.prototype.terminatePendingState = function() {
KeymapManager.prototype.terminatePendingState = function(timeout) {
var binding, bindingsToDisable, event, eventsToReplay, _i, _j, _k, _len, _len1, _len2;
if (this.pendingPartialMatches == null) {
this.clearQueuedKeystrokes();
return;
}
bindingsToDisable = this.pendingPartialMatches;

@@ -513,8 +505,17 @@ eventsToReplay = this.queuedKeyboardEvents;

event = eventsToReplay[_j];
this.handleKeyboardEvent(event, true);
this.handleKeyboardEvent(event);
if ((bindingsToDisable != null) && (this.pendingPartialMatches == null)) {
for (_k = 0, _len2 = bindingsToDisable.length; _k < _len2; _k++) {
binding = bindingsToDisable[_k];
binding.enabled = true;
}
bindingsToDisable = null;
}
}
for (_k = 0, _len2 = bindingsToDisable.length; _k < _len2; _k++) {
binding = bindingsToDisable[_k];
binding.enabled = true;
if (typeof atom !== "undefined" && atom !== null) {
atom.assert(bindingsToDisable == null, "Invalid keymap state");
}
if (timeout && (this.pendingPartialMatches != null)) {
this.terminatePendingState(true);
}
};

@@ -571,107 +572,2 @@

if (Grim.includeDeprecatedAPIs) {
KeymapManager.keydownEvent = function(key, options) {
Grim.deprecate("Use .buildKeydownEvent instead.");
return keydownEvent(key, options);
};
KeymapManager.prototype.handleKeyEvent = function(event) {
var originalEvent, _ref2;
Grim.deprecate("Use KeymapManager::handleKeyboardEvent instead.");
originalEvent = (_ref2 = event.originalEvent) != null ? _ref2 : event;
if (originalEvent.target == null) {
Object.defineProperty(originalEvent, 'target', {
get: function() {
return event.target;
}
});
}
this.handleKeyboardEvent(originalEvent);
return !originalEvent.defaultPrevented;
};
KeymapManager.prototype.remove = function(source) {
Grim.deprecate("Call .dispose() on the Disposable returned from KeymapManager::add instead");
return this.removeBindingsFromSource(source);
};
KeymapManager.prototype.addKeymap = function(source, bindings) {
Grim.deprecate("Use KeymapManager::add instead.");
return this.add(source, bindings);
};
KeymapManager.prototype.removeKeymap = function(source) {
Grim.deprecate("Use KeymapManager::remove instead.");
return this.remove(source);
};
KeymapManager.prototype.keystrokeStringForEvent = function(event) {
var _ref2;
Grim.deprecate("Use KeymapManager::keystrokeForKeyboardEvent instead.");
return this.keystrokeForKeyboardEvent((_ref2 = event.originalEvent) != null ? _ref2 : event);
};
KeymapManager.prototype.bindKeys = function(source, selector, keyBindings) {
var keyBindingsBySelector;
Grim.deprecate("Use KeymapManager::addKeymap instead.");
keyBindingsBySelector = {};
keyBindingsBySelector[selector] = keyBindings;
return this.add(source, keyBindingsBySelector);
};
KeymapManager.prototype.keyBindingsForCommand = function(command) {
Grim.deprecate("Use KeymapManager::findKeyBindings instead.");
return this.findKeyBindings({
command: command
});
};
KeymapManager.prototype.keyBindingsForKeystroke = function(keystroke) {
Grim.deprecate("Use KeymapManager::findKeyBindings instead.");
return this.findKeyBindings({
keystrokes: keystroke
});
};
KeymapManager.prototype.keyBindingsMatchingElement = function(target, keyBindings) {
var _ref2;
Grim.deprecate("Use KeymapManager::findKeyBindings instead.");
return this.findKeyBindings({
target: (_ref2 = target[0]) != null ? _ref2 : target,
keyBindings: keyBindings
});
};
KeymapManager.prototype.keyBindingsForCommandMatchingElement = function(command, target) {
var _ref2;
Grim.deprecate("Use KeymapManager::findKeyBindings instead.");
return this.findKeyBindings({
command: command,
target: (_ref2 = target[0]) != null ? _ref2 : target
});
};
KeymapManager.prototype.keyBindingsForKeystrokeMatchingElement = function(keystrokes, target) {
var _ref2;
Grim.deprecate("Use KeymapManager::findKeyBindings instead.");
return this.findKeyBindings({
keystrokes: keystrokes,
target: (_ref2 = target[0]) != null ? _ref2 : target
});
};
EmitterMixin = require('emissary').Emitter;
EmitterMixin.includeInto(KeymapManager);
KeymapManager.prototype.on = function(eventName) {
switch (eventName) {
case 'matched':
Grim.deprecate("Call KeymapManager::onDidMatchBinding instead");
break;
case 'matched-partially':
Grim.deprecate("Call KeymapManager::onDidPartiallyMatchBinding instead");
break;
case 'match-failed':
Grim.deprecate("Call KeymapManager::onDidFailToMatchBinding instead");
break;
case 'reloaded-key-bindings':
Grim.deprecate("Call KeymapManager::onDidReloadKeymap instead");
break;
case 'unloaded-key-bindings':
Grim.deprecate("Call KeymapManager::onDidUnloadKeymap instead");
break;
default:
Grim.deprecate("Use explicit event subscription methods instead");
}
return EmitterMixin.prototype.on.apply(this, arguments);
};
}
}).call(this);
{
"name": "atom-keymap",
"version": "5.1.6",
"version": "5.1.7",
"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