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

react-hot-keys

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hot-keys - npm Package Compare versions

Comparing version 1.0.7 to 1.0.9

2

es/index.js

@@ -7,3 +7,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

import { Component } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

@@ -10,0 +10,0 @@ import Hotkeys from 'hotkeys-js';

@@ -8,2 +8,4 @@ 'use strict';

var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');

@@ -10,0 +12,0 @@

{
"name": "react-hot-keys",
"version": "1.0.7",
"version": "1.0.9",
"description": "React component to listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts.",

@@ -30,4 +30,4 @@ "author": "kenny wang <wowohoo@qq.com>",

"devDependencies": {
"nwb": "^0.18.10",
"prop-types": "^15.5.10",
"nwb": "^0.21.2",
"prop-types": "^15.6.0",
"react": "^16.2.0",

@@ -34,0 +34,0 @@ "react-dom": "^16.2.0"

/*!
* react-hot-keys v1.0.6 - https://jaywcjlove.github.io/react-hotkeys/
* react-hot-keys v1.0.7 - https://jaywcjlove.github.io/react-hotkeys/
* MIT Licensed

@@ -14,3 +14,3 @@ */

root["ReactHotkeys"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_6__) {
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_6__) {
return /******/ (function(modules) { // webpackBootstrap

@@ -90,7 +90,5 @@ /******/ // The module cache

* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*

@@ -133,7 +131,5 @@ *

* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*

@@ -194,8 +190,6 @@ */

/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*

@@ -265,8 +259,6 @@ */

/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

@@ -299,3 +291,3 @@

/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_prop_types__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_hotkeys_js__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_hotkeys_js__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_hotkeys_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_hotkeys_js__);

@@ -402,8 +394,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

@@ -440,8 +430,6 @@

/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

@@ -454,5 +442,6 @@

var warning = __webpack_require__(2);
var assign = __webpack_require__(9);
var ReactPropTypesSecret = __webpack_require__(3);
var checkPropTypes = __webpack_require__(9);
var checkPropTypes = __webpack_require__(10);

@@ -553,3 +542,4 @@ module.exports = function(isValidElement, throwOnDirectAccess) {

oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker
shape: createShapeTypeChecker,
exact: createStrictShapeTypeChecker,
};

@@ -769,3 +759,3 @@

false,
'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' +
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
'received %s at index %s.',

@@ -824,2 +814,32 @@ getPostfixForTypeWarning(checker),

function createStrictShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
// We need to check all keys in case some are required but missing from
// props.
var allKeys = assign({}, props[propName], shapeTypes);
for (var key in allKeys) {
var checker = shapeTypes[key];
if (!checker) {
return new PropTypeError(
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
);
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {

@@ -963,9 +983,104 @@ switch (typeof propValue) {

"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

@@ -1004,3 +1119,3 @@

// behavior as without this statement except with a better message.
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName);
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);

@@ -1029,7 +1144,7 @@ } catch (ex) {

/***/ }),
/* 10 */
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
/*! hotkeys-js v2.0.2 | MIT (c) 2017 kenny wang <wowohoo@qq.com> | https://github.com/jaywcjlove/hotkeys.git */
!function(e){if(true)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).hotkeys=e()}}(function(){function n(e){return h[e.toUpperCase()]||e.toUpperCase().charCodeAt(0)}function t(e){g=e||"all"}function o(){return g||"all"}function r(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent&&e.attachEvent("on"+n,function(){t(window.event)})}function i(e){var n,t=e.keyCode||e.which||e.charCode,r=x["*"];if(-1===y.indexOf(t)&&y.push(t),93!==t&&224!==t||(t=91),t in m){m[t]=!0;for(var i in v)v[i]===t&&(d[i]=!0);if(!r)return}for(var a in m)m[a]=e[w[a]];if(d.filter.call(this,e)){if(n=o(),r)for(l=0;l<r.length;l++)r[l].scope===n&&f(e,r[l],n);if(t in x)for(var l=0;l<x[t].length;l++)f(e,x[t][l],n)}}function f(e,n,t){var o;if(n.scope===t||"all"===n.scope){o=n.mods.length>0;for(var r in m)(!m[r]&&n.mods.indexOf(+r)>-1||m[r]&&-1===n.mods.indexOf(+r))&&(o=!1);(0!==n.mods.length||m[16]||m[18]||m[17]||m[91])&&!o&&"*"!==n.shortcut||!1===n.method(e,n)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function a(e,n){for(var t=e.length>=n.length?e:n,o=e.length>=n.length?n:e,r=0;r<t.length;r++)if(-1===o.indexOf(t[r]))return!1;return!0}function l(e){for(var n=e.slice(0,e.length-1),t=0;t<n.length;t++)n[t]=v[n[t].toLowerCase()];return n}function c(e){e||(e="");var n,t;for(t=(n=(e=e.replace(/\s/g,"")).split(",")).lastIndexOf("");t>=0;)n[t-1]+=",",n.splice(t,1),t=n.lastIndexOf("");return n}function s(n){var t=n.keyCode||e.which||e.charCode,o=y.indexOf(t);if(o>=0&&y.splice(o,1),93!==t&&224!==t||(t=91),t in m){m[t]=!1;for(var r in v)v[r]===t&&(d[r]=!1)}}function d(e,t,o){var r=c(e),i=[],f=0;for(void 0===o&&(o=t,t="all");f<r.length;f++)i=[],(e=r[f].split("+")).length>1&&(i=l(e)),(e="*"===(e=e[e.length-1])?"*":n(e))in x||(x[e]=[]),x[e].push({shortcut:r[f],scope:t,method:o,key:r[f],mods:i})}Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var n=0;n<this.length;n++)if(this[n]===e)return n;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(e){for(var n=this.length-1;n>=0;n--)if(this[n]===e)return n;return-1});for(var u,p=navigator.userAgent.toLowerCase().indexOf("firefox")>0,h={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,"⇪":20,capslock:20,",":188,".":190,"/":191,"`":192,"-":p?173:189,"=":p?61:187,";":p?59:186,"'":222,"[":219,"]":221,"\\":220},g="all",v={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":p?224:91,cmd:p?224:91,command:p?224:91},y=[],w={16:"shiftKey",18:"altKey",17:"ctrlKey"},m={16:!1,18:!1,17:!1},x={},O=1;O<20;O++)h["f"+O]=111+O;w[p?224:91]="metaKey",m[p?224:91]=!1,r(document,"keydown",function(e){i(e)}),r(document,"keyup",function(e){s(e)}),u={setScope:t,getScope:o,deleteScope:function(e,n){var r,i,f;e||(e=o());for(r in x)for(i=x[r],f=0;f<i.length;)i[f].scope===e?i.splice(f,1):f++;o()===e&&t(n||"all")},getPressedKeyCodes:function(){return y.slice(0)},isPressed:function(e){return"string"==typeof e&&(e=n(e)),-1!==y.indexOf(e)},filter:function(e){var n=(e.target||e.srcElement).tagName;return!("INPUT"===n||"SELECT"===n||"TEXTAREA"===n)},unbind:function(e,t){for(var r,i,f=c(e),s=[],d=0;d<f.length;d++){if((r=f[d].split("+")).length>1&&(s=l(r)),e=r[r.length-1],e="*"===e?"*":n(e),t||(t=o()),!x[e])return;for(var u=0;u<x[e].length;u++)(i=x[e][u]).scope===t&&a(i.mods,s)&&(x[e][u]={})}}};for(var k in u)d[k]=u[k];var C=window.hotkeys;return d.noConflict=function(e){return e&&window.hotkeys===d&&(window.hotkeys=C),d},window.hotkeys=d,d});
/*! hotkeys-js v2.0.8 | MIT (c) 2018 kenny wang <wowohoo@qq.com> | https://github.com/jaywcjlove/hotkeys.git */
!function(e){if(true)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).hotkeys=e()}}(function(){function e(e){return p[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)}function n(e){h=e||"all"}function t(){return h||"all"}function o(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent&&e.attachEvent("on"+n,function(){t(window.event)})}function r(e){var n,o=e.keyCode||e.which||e.charCode,r=m["*"];if(-1===y.indexOf(o)&&y.push(o),93!==o&&224!==o||(o=91),o in w){w[o]=!0;for(var f in g)g[f]===o&&(c[f]=!0);if(!r)return}for(var a in w)w[a]=e[v[a]];if(c.filter.call(this,e)){if(n=t(),r)for(l=0;l<r.length;l++)r[l].scope===n&&i(e,r[l],n);if(o in m)for(var l=0;l<m[o].length;l++)i(e,m[o][l],n)}}function i(e,n,t){var o;if(n.scope===t||"all"===n.scope){o=n.mods.length>0;for(var r in w)(!w[r]&&n.mods.indexOf(+r)>-1||w[r]&&-1===n.mods.indexOf(+r))&&(o=!1);(0!==n.mods.length||w[16]||w[18]||w[17]||w[91])&&!o&&"*"!==n.shortcut||!1===n.method(e,n)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function f(e,n){for(var t=e.length>=n.length?e:n,o=e.length>=n.length?n:e,r=0;r<t.length;r++)if(-1===o.indexOf(t[r]))return!1;return!0}function a(e){for(var n=e.slice(0,e.length-1),t=0;t<n.length;t++)n[t]=g[n[t].toLowerCase()];return n}function l(e){e||(e="");var n,t;for(t=(n=(e=e.replace(/\s/g,"")).split(",")).lastIndexOf("");t>=0;)n[t-1]+=",",n.splice(t,1),t=n.lastIndexOf("");return n}function d(e){var n=e.keyCode||e.which||e.charCode,t=y.indexOf(n);if(t>=0&&y.splice(t,1),93!==n&&224!==n||(n=91),n in w){w[n]=!1;for(var o in g)g[o]===n&&(c[o]=!1)}}function c(n,t,o){var r=l(n),i=[],f=0;for(void 0===o&&(o=t,t="all");f<r.length;f++)i=[],(n=r[f].split("+")).length>1&&(i=a(n)),(n="*"===(n=n[n.length-1])?"*":e(n))in m||(m[n]=[]),m[n].push({shortcut:r[f],scope:t,method:o,key:r[f],mods:i})}Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var n=0;n<this.length;n++)if(this[n]===e)return n;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(e){for(var n=this.length-1;n>=0;n--)if(this[n]===e)return n;return-1});for(var s,u="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0,p={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,"⇪":20,capslock:20,",":188,".":190,"/":191,"`":192,"-":u?173:189,"=":u?61:187,";":u?59:186,"'":222,"[":219,"]":221,"\\":220},h="all",g={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":u?224:91,cmd:u?224:91,command:u?224:91},y=[],v={16:"shiftKey",18:"altKey",17:"ctrlKey"},w={16:!1,18:!1,17:!1},m={},x=1;x<20;x++)p["f"+x]=111+x;v[u?224:91]="metaKey",w[u?224:91]=!1,"undefined"!=typeof document&&(o(document,"keydown",function(e){r(e)}),o(document,"keyup",function(e){d(e)})),s={setScope:n,getScope:t,deleteScope:function(e,o){var r,i,f;e||(e=t());for(r in m)for(i=m[r],f=0;f<i.length;)i[f].scope===e?i.splice(f,1):f++;t()===e&&n(o||"all")},getPressedKeyCodes:function(){return y.slice(0)},isPressed:function(n){return"string"==typeof n&&(n=e(n)),-1!==y.indexOf(n)},filter:function(e){var n=(e.target||e.srcElement).tagName;return!("INPUT"===n||"SELECT"===n||"TEXTAREA"===n)},unbind:function(n,o){for(var r,i,d=l(n),c=[],s=0;s<d.length;s++){if((r=d[s].split("+")).length>1&&(c=a(r)),n=r[r.length-1],n="*"===n?"*":e(n),o||(o=t()),!m[n])return;for(var u=0;u<m[n].length;u++)(i=m[n][u]).scope===o&&f(i.mods,c)&&(m[n][u]={})}}};for(var k in s)c[k]=s[k];if("undefined"!=typeof window){var O=window.hotkeys;c.noConflict=function(e){return e&&window.hotkeys===c&&(window.hotkeys=O),c},window.hotkeys=c}return window.hotkeys=c,c});

@@ -1039,3 +1154,3 @@

/***/ })
/******/ ]);
/******/ ])["default"];
});
/*!
* react-hot-keys v1.0.6 - https://jaywcjlove.github.io/react-hotkeys/
* react-hot-keys v1.0.7 - https://jaywcjlove.github.io/react-hotkeys/
* MIT Licensed
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactHotkeys=t(require("react")):e.ReactHotkeys=t(e.React)}(this,function(t){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"default",function(){return u});var s=n(2),c=(n.n(s),n(3)),a=n.n(c);a.a.filter=function(e){var t=(e.target||e.srcElement).tagName;return a.a.setScope(/^(INPUT|TEXTAREA|SELECT)$/.test(t)?"input":"other"),!0};var u=function(e){function t(n){o(this,t);var i=r(this,e.call(this,n));return i.onKeyDown=i.onKeyDown.bind(i),i.onKeyUp=i.onKeyUp.bind(i),i.handleKeyUpEvent=i.handleKeyUpEvent.bind(i),i.isKeyDown=!1,i.handle={},i}return i(t,e),t.prototype.componentDidMount=function(){a.a.unbind(this.props.keyName),a()(this.props.keyName,this.onKeyDown),document.addEventListener("keyup",this.handleKeyUpEvent)},t.prototype.componentWillUnmount=function(){a.a.unbind(this.props.keyName),this.isKeyDown=!1,this.handle={},document.removeEventListener("keyup",this.handleKeyUpEvent)},t.prototype.onKeyUp=function(e,t){(0,this.props.onKeyUp)(t.shortcut,e,t)},t.prototype.onKeyDown=function(e,t){var n=this.props.onKeyDown;this.isKeyDown||(this.isKeyDown=!0,this.handle=t,n(t.shortcut,e,t))},t.prototype.handleKeyUpEvent=function(e){this.isKeyDown&&(this.isKeyDown=!1,this.props.keyName.indexOf(this.handle.shortcut)<0||(this.onKeyUp(e,this.handle),this.handle={}))},t.prototype.render=function(){return this.props.children||null},t}(s.Component);u.defaultProps={onKeyUp:function(){},onKeyDown:function(){}}},function(e,n){e.exports=t},function(t,n,o){!function(e){t.exports=e()}(function(){function t(e){return d[e.toUpperCase()]||e.toUpperCase().charCodeAt(0)}function n(e){y=e||"all"}function o(){return y||"all"}function r(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,function(){n(window.event)})}function i(e){var t,n=e.keyCode||e.which||e.charCode,r=b["*"];if(-1===g.indexOf(n)&&g.push(n),93!==n&&224!==n||(n=91),n in w){w[n]=!0;for(var i in v)v[i]===n&&(p[i]=!0);if(!r)return}for(var c in w)w[c]=e[m[c]];if(p.filter.call(this,e)){if(t=o(),r)for(a=0;a<r.length;a++)r[a].scope===t&&s(e,r[a],t);if(n in b)for(var a=0;a<b[n].length;a++)s(e,b[n][a],t)}}function s(e,t,n){var o;if(t.scope===n||"all"===t.scope){o=t.mods.length>0;for(var r in w)(!w[r]&&t.mods.indexOf(+r)>-1||w[r]&&-1===t.mods.indexOf(+r))&&(o=!1);(0!==t.mods.length||w[16]||w[18]||w[17]||w[91])&&!o&&"*"!==t.shortcut||!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function c(e,t){for(var n=e.length>=t.length?e:t,o=e.length>=t.length?t:e,r=0;r<n.length;r++)if(-1===o.indexOf(n[r]))return!1;return!0}function a(e){for(var t=e.slice(0,e.length-1),n=0;n<t.length;n++)t[n]=v[t[n].toLowerCase()];return t}function u(e){e||(e="");var t,n;for(n=(t=(e=e.replace(/\s/g,"")).split(",")).lastIndexOf("");n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function f(t){var n=t.keyCode||e.which||e.charCode,o=g.indexOf(n);if(o>=0&&g.splice(o,1),93!==n&&224!==n||(n=91),n in w){w[n]=!1;for(var r in v)v[r]===n&&(p[r]=!1)}}function p(e,n,o){var r=u(e),i=[],s=0;for(void 0===o&&(o=n,n="all");s<r.length;s++)i=[],(e=r[s].split("+")).length>1&&(i=a(e)),(e="*"===(e=e[e.length-1])?"*":t(e))in b||(b[e]=[]),b[e].push({shortcut:r[s],scope:n,method:o,key:r[s],mods:i})}Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(e){for(var t=this.length-1;t>=0;t--)if(this[t]===e)return t;return-1});for(var l,h=navigator.userAgent.toLowerCase().indexOf("firefox")>0,d={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,"⇪":20,capslock:20,",":188,".":190,"/":191,"`":192,"-":h?173:189,"=":h?61:187,";":h?59:186,"'":222,"[":219,"]":221,"\\":220},y="all",v={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":h?224:91,cmd:h?224:91,command:h?224:91},g=[],m={16:"shiftKey",18:"altKey",17:"ctrlKey"},w={16:!1,18:!1,17:!1},b={},x=1;x<20;x++)d["f"+x]=111+x;m[h?224:91]="metaKey",w[h?224:91]=!1,r(document,"keydown",function(e){i(e)}),r(document,"keyup",function(e){f(e)}),l={setScope:n,getScope:o,deleteScope:function(e,t){var r,i,s;e||(e=o());for(r in b)for(i=b[r],s=0;s<i.length;)i[s].scope===e?i.splice(s,1):s++;o()===e&&n(t||"all")},getPressedKeyCodes:function(){return g.slice(0)},isPressed:function(e){return"string"==typeof e&&(e=t(e)),-1!==g.indexOf(e)},filter:function(e){var t=(e.target||e.srcElement).tagName;return!("INPUT"===t||"SELECT"===t||"TEXTAREA"===t)},unbind:function(e,n){for(var r,i,s=u(e),f=[],p=0;p<s.length;p++){if((r=s[p].split("+")).length>1&&(f=a(r)),e=r[r.length-1],e="*"===e?"*":t(e),n||(n=o()),!b[e])return;for(var l=0;l<b[e].length;l++)(i=b[e][l]).scope===n&&c(i.mods,f)&&(b[e][l]={})}}};for(var K in l)p[K]=l[K];var E=window.hotkeys;return p.noConflict=function(e){return e&&window.hotkeys===p&&(window.hotkeys=E),p},window.hotkeys=p,p})}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactHotkeys=t(require("react")):e.ReactHotkeys=t(e.React)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"default",function(){return f});var o=n(2),r=(n.n(o),n(3)),i=n.n(r);i.a.filter=function(e){var t=(e.target||e.srcElement).tagName;return i.a.setScope(/^(INPUT|TEXTAREA|SELECT)$/.test(t)?"input":"other"),!0};var f=function(e){function t(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.onKeyDown=o.onKeyDown.bind(o),o.onKeyUp=o.onKeyUp.bind(o),o.handleKeyUpEvent=o.handleKeyUpEvent.bind(o),o.isKeyDown=!1,o.handle={},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.componentDidMount=function(){i.a.unbind(this.props.keyName),i()(this.props.keyName,this.onKeyDown),document.addEventListener("keyup",this.handleKeyUpEvent)},t.prototype.componentWillUnmount=function(){i.a.unbind(this.props.keyName),this.isKeyDown=!1,this.handle={},document.removeEventListener("keyup",this.handleKeyUpEvent)},t.prototype.onKeyUp=function(e,t){var n=this.props.onKeyUp;n(t.shortcut,e,t)},t.prototype.onKeyDown=function(e,t){var n=this.props.onKeyDown;this.isKeyDown||(this.isKeyDown=!0,this.handle=t,n(t.shortcut,e,t))},t.prototype.handleKeyUpEvent=function(e){this.isKeyDown&&(this.isKeyDown=!1,this.props.keyName.indexOf(this.handle.shortcut)<0||(this.onKeyUp(e,this.handle),this.handle={}))},t.prototype.render=function(){return this.props.children||null},t}(o.Component);f.defaultProps={onKeyUp:function(){},onKeyDown:function(){}}},function(t,n){t.exports=e},function(e,t,n){var o;o=function(){function e(e){return p[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)}function t(e){l=e||"all"}function n(){return l||"all"}function o(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,function(){n(window.event)})}function r(e,t,n){var o;if(t.scope===n||"all"===t.scope){for(var r in o=t.mods.length>0,v)(!v[r]&&t.mods.indexOf(+r)>-1||v[r]&&-1===t.mods.indexOf(+r))&&(o=!1);(0!==t.mods.length||v[16]||v[18]||v[17]||v[91])&&!o&&"*"!==t.shortcut||!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function i(e,t){for(var n=e.length>=t.length?e:t,o=e.length>=t.length?t:e,r=0;r<n.length;r++)if(-1===o.indexOf(n[r]))return!1;return!0}function f(e){for(var t=e.slice(0,e.length-1),n=0;n<t.length;n++)t[n]=d[t[n].toLowerCase()];return t}function a(e){var t,n;for(e||(e=""),n=(t=(e=e.replace(/\s/g,"")).split(",")).lastIndexOf("");n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function s(t,n,o){var r=a(t),i=[],s=0;for(void 0===o&&(o=n,n="all");s<r.length;s++)i=[],(t=r[s].split("+")).length>1&&(i=f(t)),(t="*"===(t=t[t.length-1])?"*":e(t))in w||(w[t]=[]),w[t].push({shortcut:r[s],scope:n,method:o,key:r[s],mods:i})}Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(e){for(var t=this.length-1;t>=0;t--)if(this[t]===e)return t;return-1});for(var u,c="undefined"!=typeof navigator&&navigator.userAgent.toLowerCase().indexOf("firefox")>0,p={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,"⇪":20,capslock:20,",":188,".":190,"/":191,"`":192,"-":c?173:189,"=":c?61:187,";":c?59:186,"'":222,"[":219,"]":221,"\\":220},l="all",d={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":c?224:91,cmd:c?224:91,command:c?224:91},h=[],y={16:"shiftKey",18:"altKey",17:"ctrlKey"},v={16:!1,18:!1,17:!1},w={},g=1;g<20;g++)p["f"+g]=111+g;for(var m in y[c?224:91]="metaKey",v[c?224:91]=!1,"undefined"!=typeof document&&(o(document,"keydown",function(e){!function(e){var t,o=e.keyCode||e.which||e.charCode,i=w["*"];if(-1===h.indexOf(o)&&h.push(o),93!==o&&224!==o||(o=91),o in v){for(var f in v[o]=!0,d)d[f]===o&&(s[f]=!0);if(!i)return}for(var a in v)v[a]=e[y[a]];if(s.filter.call(this,e)){if(t=n(),i)for(u=0;u<i.length;u++)i[u].scope===t&&r(e,i[u],t);if(o in w)for(var u=0;u<w[o].length;u++)r(e,w[o][u],t)}}(e)}),o(document,"keyup",function(e){!function(e){var t=e.keyCode||e.which||e.charCode,n=h.indexOf(t);if(n>=0&&h.splice(n,1),93!==t&&224!==t||(t=91),t in v)for(var o in v[t]=!1,d)d[o]===t&&(s[o]=!1)}(e)})),u={setScope:t,getScope:n,deleteScope:function(e,o){var r,i,f;for(r in e||(e=n()),w)for(i=w[r],f=0;f<i.length;)i[f].scope===e?i.splice(f,1):f++;n()===e&&t(o||"all")},getPressedKeyCodes:function(){return h.slice(0)},isPressed:function(t){return"string"==typeof t&&(t=e(t)),-1!==h.indexOf(t)},filter:function(e){var t=(e.target||e.srcElement).tagName;return!("INPUT"===t||"SELECT"===t||"TEXTAREA"===t)},unbind:function(t,o){for(var r,s,u=a(t),c=[],p=0;p<u.length;p++){if((r=u[p].split("+")).length>1&&(c=f(r)),t="*"===(t=r[r.length-1])?"*":e(t),o||(o=n()),!w[t])return;for(var l=0;l<w[t].length;l++)(s=w[t][l]).scope===o&&i(s.mods,c)&&(w[t][l]={})}}})s[m]=u[m];if("undefined"!=typeof window){var b=window.hotkeys;s.noConflict=function(e){return e&&window.hotkeys===s&&(window.hotkeys=b),s},window.hotkeys=s}return window.hotkeys=s,s},e.exports=o()}]).default});
//# sourceMappingURL=react-hot-keys.min.js.map

Sorry, the diff of this file is not supported yet

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