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

atom-keymap

Package Overview
Dependencies
Maintainers
6
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 4.0.0 to 5.0.0

32

api.json

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

"filename": "src/keymap-manager.coffee",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v4.0.0/src/keymap-manager.coffee#L68",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L68",
"sections": [

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

"sectionName": "Class Methods",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v4.0.0/src/keymap-manager.coffee#L87",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L87",
"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/v4.0.0/src/keymap-manager.coffee#L115",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L115",
"visibility": "Public",

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

"sectionName": "Construction and Destruction",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v4.0.0/src/keymap-manager.coffee#L125",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L128",
"visibility": "Public",

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

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v4.0.0/src/keymap-manager.coffee#L150",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L157",
"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/v4.0.0/src/keymap-manager.coffee#L166",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L173",
"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/v4.0.0/src/keymap-manager.coffee#L180",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L187",
"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/v4.0.0/src/keymap-manager.coffee#L211",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L218",
"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/v4.0.0/src/keymap-manager.coffee#L241",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L248",
"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/v4.0.0/src/keymap-manager.coffee#L279",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L285",
"visibility": "Public",

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

"sectionName": "Accessing Bindings",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v4.0.0/src/keymap-manager.coffee#L294",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L300",
"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/v4.0.0/src/keymap-manager.coffee#L329",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L335",
"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/v4.0.0/src/keymap-manager.coffee#L349",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L355",
"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/v4.0.0/src/keymap-manager.coffee#L421",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L427",
"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/v4.0.0/src/keymap-manager.coffee#L499",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L505",
"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/v4.0.0/src/keymap-manager.coffee#L506",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v5.0.0/src/keymap-manager.coffee#L512",
"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, NumPadToASCII, SpecificityCache, WindowsAndLinuxCharCodeTranslations, WindowsAndLinuxKeyIdentifierTranslations, charCodeFromKeyIdentifier, fs, isASCII, keyFromCharCode, loophole, modifier, normalizeKeystroke, numpadToASCII, parseKeystroke, parser, pegjs, specificity, translateCharCodeForWindowsAndLinuxChromiumBug, translateKeyIdentifierForWindowsAndLinuxChromiumBug, _i, _j, _len, _len1, _ref, _ref1, _ref2;
var AtomModifierRegex, AtomModifiers, KeyboardEventModifiers, LowerCaseLetterRegex, NumPadToASCII, SpecificityCache, UpperCaseLetterRegex, WhitespaceRegex, WindowsAndLinuxCharCodeTranslations, WindowsAndLinuxKeyIdentifierTranslations, charCodeFromKeyIdentifier, isASCII, keyFromCharCode, modifier, normalizeKeystroke, numpadToASCII, parseKeystroke, specificity, translateCharCodeForWindowsAndLinuxChromiumBug, translateKeyIdentifierForWindowsAndLinuxChromiumBug, _i, _j, _len, _len1, _ref, _ref1;
specificity = require('clear-cut').specificity;
_ref = [], parser = _ref[0], fs = _ref[1], loophole = _ref[2], pegjs = _ref[3];
AtomModifiers = new Set;
_ref1 = ['ctrl', 'alt', 'shift', 'cmd'];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
modifier = _ref1[_i];
_ref = ['ctrl', 'alt', 'shift', 'cmd'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
modifier = _ref[_i];
AtomModifiers.add(modifier);

@@ -18,7 +16,13 @@ }

WhitespaceRegex = /\s+/;
LowerCaseLetterRegex = /^[a-z]$/;
UpperCaseLetterRegex = /^[A-Z]$/;
KeyboardEventModifiers = new Set;
_ref2 = ['Control', 'Alt', 'Shift', 'Meta'];
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
modifier = _ref2[_j];
_ref1 = ['Control', 'Alt', 'Shift', 'Meta'];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
modifier = _ref1[_j];
KeyboardEventModifiers.add(modifier);

@@ -145,7 +149,7 @@ }

exports.normalizeKeystrokes = function(keystrokes) {
var keystroke, normalizedKeystroke, normalizedKeystrokes, _k, _len2, _ref3;
var keystroke, normalizedKeystroke, normalizedKeystrokes, _k, _len2, _ref2;
normalizedKeystrokes = [];
_ref3 = keystrokes.split(/\s+/);
for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) {
keystroke = _ref3[_k];
_ref2 = keystrokes.split(WhitespaceRegex);
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
keystroke = _ref2[_k];
if (normalizedKeystroke = normalizeKeystroke(keystroke)) {

@@ -161,5 +165,5 @@ normalizedKeystrokes.push(normalizedKeystroke);

exports.keystrokeForKeyboardEvent = function(event, dvorakQwertyWorkaroundEnabled) {
var charCode, key, keyIdentifier, keystroke;
var charCode, key, keyIdentifier, keystroke, _ref2, _ref3;
keyIdentifier = event.keyIdentifier;
if (process.platform === 'linux' || process.platform === 'win32') {
if ((_ref2 = process.platform) === 'linux' || _ref2 === 'win32') {
keyIdentifier = translateKeyIdentifierForWindowsAndLinuxChromiumBug(keyIdentifier);

@@ -177,3 +181,3 @@ }

if (charCode != null) {
if (process.platform === 'linux' || process.platform === 'win32') {
if ((_ref3 = process.platform) === 'linux' || _ref3 === 'win32') {
charCode = translateCharCodeForWindowsAndLinuxChromiumBug(charCode, event.shiftKey);

@@ -209,7 +213,7 @@ }

}
if (/^[a-z]$/.test(key)) {
if (LowerCaseLetterRegex.test(key)) {
key = key.toUpperCase();
}
} else {
if (/^[A-Z]$/.test(key)) {
if (UpperCaseLetterRegex.test(key)) {
key = key.toLowerCase();

@@ -242,4 +246,4 @@ }

exports.keydownEvent = function(key, _arg) {
var alt, bubbles, cancelable, cmd, ctrl, event, keyCode, keyIdentifier, location, shift, target, view, _ref3;
_ref3 = _arg != null ? _arg : {}, ctrl = _ref3.ctrl, shift = _ref3.shift, alt = _ref3.alt, cmd = _ref3.cmd, keyCode = _ref3.keyCode, target = _ref3.target, location = _ref3.location;
var alt, bubbles, cancelable, cmd, ctrl, event, keyCode, keyIdentifier, location, shift, target, view, _ref2;
_ref2 = _arg != null ? _arg : {}, ctrl = _ref2.ctrl, shift = _ref2.shift, alt = _ref2.alt, cmd = _ref2.cmd, keyCode = _ref2.keyCode, target = _ref2.target, location = _ref2.location;
event = document.createEvent('KeyboardEvent');

@@ -249,3 +253,3 @@ bubbles = true;

view = null;
if (/^[a-z]$/.test(key)) {
if (LowerCaseLetterRegex.test(key)) {
key = key.toUpperCase();

@@ -304,2 +308,5 @@ }

keys = parseKeystroke(keystroke);
if (!keys) {
return false;
}
primaryKey = null;

@@ -319,6 +326,6 @@ modifiers = new Set;

}
if (/^[A-Z]$/.test(primaryKey)) {
if (UpperCaseLetterRegex.test(primaryKey)) {
modifiers.add('shift');
}
if (modifiers.has('shift') && /^[a-z]$/.test(primaryKey)) {
if (modifiers.has('shift') && LowerCaseLetterRegex.test(primaryKey)) {
primaryKey = primaryKey.toUpperCase();

@@ -346,26 +353,21 @@ }

parseKeystroke = function(keystroke) {
var e, keystrokeGrammar;
if (parser == null) {
try {
parser = require('./keystroke');
} catch (_error) {
e = _error;
if (fs == null) {
fs = require('fs');
var character, index, keyStart, keys, _k, _len2;
keys = [];
keyStart = 0;
for (index = _k = 0, _len2 = keystroke.length; _k < _len2; index = ++_k) {
character = keystroke[index];
if (character === '-') {
if (index > keyStart) {
keys.push(keystroke.substring(keyStart, index));
keyStart = index + 1;
if (keyStart === keystroke.length) {
return false;
}
}
if (loophole == null) {
loophole = require('loophole');
}
if (pegjs == null) {
pegjs = require('pegjs');
}
keystrokeGrammar = fs.readFileSync(require.resolve('./keystroke.pegjs'), 'utf8');
loophole.allowUnsafeEval((function(_this) {
return function() {
return parser = pegjs.buildParser(keystrokeGrammar);
};
})(this));
}
}
return parser.parse(keystroke);
if (keyStart < keystroke.length) {
keys.push(keystroke.substring(keyStart));
}
return keys;
};

@@ -380,4 +382,4 @@

translateKeyIdentifierForWindowsAndLinuxChromiumBug = function(keyIdentifier) {
var _ref3;
return (_ref3 = WindowsAndLinuxKeyIdentifierTranslations[keyIdentifier]) != null ? _ref3 : keyIdentifier;
var _ref2;
return (_ref2 = WindowsAndLinuxKeyIdentifierTranslations[keyIdentifier]) != null ? _ref2 : keyIdentifier;
};

@@ -422,6 +424,6 @@

numpadToASCII = function(charCode) {
var _ref3;
return (_ref3 = NumPadToASCII[charCode]) != null ? _ref3 : charCode;
var _ref2;
return (_ref2 = NumPadToASCII[charCode]) != null ? _ref2 : charCode;
};
}).call(this);

@@ -87,2 +87,4 @@ (function() {

this.enableDvorakQwertyWorkaroundIfNeeded();
this.testSelectorElement = document.createElement('div');
this.selectorCache = {};
}

@@ -98,3 +100,4 @@

}
return void 0;
this.testSelectorElement = null;
this.selectorCache = null;
};

@@ -168,10 +171,7 @@

KeymapManager.prototype.add = function(source, keyBindingsBySelector) {
var addedKeyBindings, command, e, keyBinding, keyBindings, keystrokes, normalizedKeystrokes, selector;
var addedKeyBindings, command, keyBinding, keyBindings, keystrokes, normalizedKeystrokes, selector;
addedKeyBindings = [];
for (selector in keyBindingsBySelector) {
keyBindings = keyBindingsBySelector[selector];
try {
document.body.webkitMatchesSelector(selector.replace(/!important/g, ''));
} catch (_error) {
e = _error;
if (!this.isValidSelector(selector.replace(/!important/g, ''))) {
console.warn("Encountered an invalid selector adding key bindings from '" + source + "': '" + selector + "'");

@@ -193,4 +193,3 @@ return;

return function() {
var index, _i, _len, _results;
_results = [];
var index, _i, _len;
for (_i = 0, _len = addedKeyBindings.length; _i < _len; _i++) {

@@ -200,8 +199,5 @@ keyBinding = addedKeyBindings[_i];

if (index !== -1) {
_results.push(_this.keyBindings.splice(index, 1));
} else {
_results.push(void 0);
_this.keyBindings.splice(index, 1);
}
}
return _results;
};

@@ -529,3 +525,3 @@ })(this));

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

@@ -547,8 +543,6 @@ this.clearQueuedKeystrokes();

}
_results = [];
for (_k = 0, _len2 = bindingsToDisable.length; _k < _len2; _k++) {
binding = bindingsToDisable[_k];
_results.push(binding.enabled = true);
binding.enabled = true;
}
return _results;
};

@@ -576,4 +570,21 @@

KeymapManager.prototype.isValidSelector = function(selector) {
var cachedValue, error;
cachedValue = this.selectorCache[selector];
if (cachedValue != null) {
return cachedValue;
}
try {
this.testSelectorElement.querySelector(selector);
this.selectorCache[selector] = true;
return true;
} catch (_error) {
error = _error;
this.selectorCache[selector] = false;
return false;
}
};
KeymapManager.prototype.simulateBubblingOnDetachedTarget = function(target, commandEvent) {
var currentTarget, _ref2, _results;
var currentTarget, _ref2;
Object.defineProperty(commandEvent, 'target', {

@@ -590,3 +601,2 @@ get: function() {

currentTarget = target;
_results = [];
while (currentTarget != null) {

@@ -600,5 +610,4 @@ currentTarget.dispatchEvent(commandEvent);

}
_results.push(currentTarget = (_ref2 = currentTarget.parentNode) != null ? _ref2 : window);
currentTarget = (_ref2 = currentTarget.parentNode) != null ? _ref2 : window;
}
return _results;
};

@@ -605,0 +614,0 @@

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

@@ -8,3 +8,4 @@ "main": "./lib/keymap-manager",

"prepublish": "grunt prepublish",
"test": "grunt test"
"test": "grunt test",
"benchmark": "coffee --nodejs --harmony_collections benchmark/benchmark.coffee"
},

@@ -31,5 +32,3 @@ "repository": {

"keyboard-layout": "^0.10.0",
"loophole": "^1.0.0",
"pathwatcher": "^4.2",
"pegjs": "^0.8.0",
"property-accessors": "^1",

@@ -51,5 +50,4 @@ "season": "^5.0.2",

"space-pencil": "^0.3.0",
"grunt-peg": "^1.2.0",
"grunt-atomdoc": "^1.0.0"
}
}
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