diff --git a/dist/react-hotkeys.js b/dist/react-hotkeys.js index 0e4e31c0..ae216241 100644 --- a/dist/react-hotkeys.js +++ b/dist/react-hotkeys.js @@ -1,7 +1,7 @@ /*! - * react-hotkeys v2.6.2 + * react-hotkeys v2.7.0 * React component to listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts. - * Copyright (c) 2020 kenny wang + * Copyright (c) 2021 kenny wang * Licensed under the MIT license. */ (function webpackUniversalModuleDefinition(root, factory) { @@ -244,10 +244,10 @@ var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__ // CONCATENATED MODULE: ./node_modules/hotkeys-js/dist/hotkeys.esm.js /*! - * hotkeys-js v3.8.1 + * hotkeys-js v3.8.7 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * - * Copyright (c) 2020 kenny wong + * Copyright (c) 2021 kenny wong * http://jaywcjlove.github.io/hotkeys * * Licensed under the MIT license. @@ -328,6 +328,22 @@ var _keyMap = { pageup: 33, pagedown: 34, capslock: 20, + num_0: 96, + num_1: 97, + num_2: 98, + num_3: 99, + num_4: 100, + num_5: 101, + num_6: 102, + num_7: 103, + num_8: 104, + num_9: 105, + num_multiply: 106, + num_add: 107, + num_enter: 108, + num_subtract: 109, + num_decimal: 110, + num_divide: 111, '⇪': 20, ',': 188, '.': 190, diff --git a/dist/react-hotkeys.min.js b/dist/react-hotkeys.min.js index 0e8a57ac..e2c1715b 100644 --- a/dist/react-hotkeys.min.js +++ b/dist/react-hotkeys.min.js @@ -1,2 +1,2 @@ /*! For license information please see react-hotkeys.min.js.LICENSE.txt */ -!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)}(window,(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,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return 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=1)}([function(t,n){t.exports=e},function(e,t,n){"use strict";function o(e,t){for(var n=0;n0;function y(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on".concat(t),(function(){n(window.event)}))}function d(e,t){for(var n=t.slice(0,t.length-1),o=0;o=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}for(var v={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,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,"\u21ea":20,",":188,".":190,"/":191,"`":192,"-":p?173:189,"=":p?61:187,";":p?59:186,"'":222,"[":219,"]":221,"\\":220},b={"\u21e7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,command:91},m={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},w={16:!1,18:!1,17:!1,91:!1},g={},k=1;k<20;k++)v["f".concat(k)]=111+k;var K=[],O="all",x=[],E=function(e){return v[e.toLowerCase()]||b[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function j(e){O=e||"all"}function P(){return O||"all"}var S=function(e){var t=e.key,n=e.scope,o=e.method,r=e.splitKey,i=void 0===r?"+":r;h(t).forEach((function(e){var t=e.split(i),r=t.length,c=t[r-1],f="*"===c?"*":E(c);if(g[f]){n||(n=P());var a=r>1?d(b,t):[];g[f]=g[f].map((function(e){return(!o||e.method===o)&&e.scope===n&&function(e,t){for(var n=e.length>=t.length?e:t,o=e.length>=t.length?t:e,r=!0,i=0;i0,w)Object.prototype.hasOwnProperty.call(w,r)&&(!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 D(e){var t=g["*"],n=e.keyCode||e.which||e.charCode;if(U.filter.call(this,e)){if(93!==n&&224!==n||(n=91),-1===K.indexOf(n)&&229!==n&&K.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach((function(t){var n=m[t];e[t]&&-1===K.indexOf(n)?K.push(n):!e[t]&&K.indexOf(n)>-1?K.splice(K.indexOf(n),1):"metaKey"===t&&e[t]&&3===K.length&&(e.ctrlKey||e.shiftKey||e.altKey||(K=K.slice(K.indexOf(n))))})),n in w){for(var o in w[n]=!0,b)b[o]===n&&(U[o]=!0);if(!t)return}for(var r in w)Object.prototype.hasOwnProperty.call(w,r)&&(w[r]=e[m[r]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(-1===K.indexOf(17)&&K.push(17),-1===K.indexOf(18)&&K.push(18),w[17]=!0,w[18]=!0);var i=P();if(t)for(var c=0;c1&&(r=d(b,e)),(e="*"===(e=e[e.length-1])?"*":E(e))in g||(g[e]=[]),g[e].push({keyup:a,keydown:u,scope:i,mods:r,shortcut:o[f],method:n,key:o[f],splitKey:l});"undefined"!==typeof c&&!function(e){return x.indexOf(e)>-1}(c)&&window&&(x.push(c),y(c,"keydown",(function(e){D(e)})),y(window,"focus",(function(){K=[]})),y(c,"keyup",(function(e){D(e),function(e){var t=e.keyCode||e.which||e.charCode,n=K.indexOf(t);if(n>=0&&K.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&K.splice(0,K.length),93!==t&&224!==t||(t=91),t in w)for(var o in w[t]=!1,b)b[o]===t&&(U[o]=!1)}(e)})))}var _={setScope:j,getScope:P,deleteScope:function(e,t){var n,o;for(var r in e||(e=P()),g)if(Object.prototype.hasOwnProperty.call(g,r))for(n=g[r],o=0;o1?t-1:0),o=1;o0;function y(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on".concat(t),(function(){n(window.event)}))}function d(e,t){for(var n=t.slice(0,t.length-1),o=0;o=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}for(var v={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,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"\u21ea":20,",":188,".":190,"/":191,"`":192,"-":p?173:189,"=":p?61:187,";":p?59:186,"'":222,"[":219,"]":221,"\\":220},m={"\u21e7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,command:91},b={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},w={16:!1,18:!1,17:!1,91:!1},g={},k=1;k<20;k++)v["f".concat(k)]=111+k;var K=[],O="all",x=[],E=function(e){return v[e.toLowerCase()]||m[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function _(e){O=e||"all"}function j(){return O||"all"}var P=function(e){var t=e.key,n=e.scope,o=e.method,r=e.splitKey,i=void 0===r?"+":r;h(t).forEach((function(e){var t=e.split(i),r=t.length,u=t[r-1],c="*"===u?"*":E(u);if(g[c]){n||(n=j());var a=r>1?d(m,t):[];g[c]=g[c].map((function(e){return(!o||e.method===o)&&e.scope===n&&function(e,t){for(var n=e.length>=t.length?e:t,o=e.length>=t.length?t:e,r=!0,i=0;i0,w)Object.prototype.hasOwnProperty.call(w,r)&&(!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){var t=g["*"],n=e.keyCode||e.which||e.charCode;if(D.filter.call(this,e)){if(93!==n&&224!==n||(n=91),-1===K.indexOf(n)&&229!==n&&K.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach((function(t){var n=b[t];e[t]&&-1===K.indexOf(n)?K.push(n):!e[t]&&K.indexOf(n)>-1?K.splice(K.indexOf(n),1):"metaKey"===t&&e[t]&&3===K.length&&(e.ctrlKey||e.shiftKey||e.altKey||(K=K.slice(K.indexOf(n))))})),n in w){for(var o in w[n]=!0,m)m[o]===n&&(D[o]=!0);if(!t)return}for(var r in w)Object.prototype.hasOwnProperty.call(w,r)&&(w[r]=e[b[r]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(-1===K.indexOf(17)&&K.push(17),-1===K.indexOf(18)&&K.push(18),w[17]=!0,w[18]=!0);var i=j();if(t)for(var u=0;u1&&(r=d(m,e)),(e="*"===(e=e[e.length-1])?"*":E(e))in g||(g[e]=[]),g[e].push({keyup:a,keydown:f,scope:i,mods:r,shortcut:o[c],method:n,key:o[c],splitKey:l});"undefined"!==typeof u&&!function(e){return x.indexOf(e)>-1}(u)&&window&&(x.push(u),y(u,"keydown",(function(e){C(e)})),y(window,"focus",(function(){K=[]})),y(u,"keyup",(function(e){C(e),function(e){var t=e.keyCode||e.which||e.charCode,n=K.indexOf(t);if(n>=0&&K.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&K.splice(0,K.length),93!==t&&224!==t||(t=91),t in w)for(var o in w[t]=!1,m)m[o]===t&&(D[o]=!1)}(e)})))}var U={setScope:_,getScope:j,deleteScope:function(e,t){var n,o;for(var r in e||(e=j()),g)if(Object.prototype.hasOwnProperty.call(g,r))for(n=g[r],o=0;o1?t-1:0),o=1;o + * Copyright (c) 2021 kenny wang * Licensed under the MIT license. */ diff --git a/package.json b/package.json index 7e63107b..624e5c01 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-hot-keys", - "version": "2.6.2", + "version": "2.7.0", "description": "React component to listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts.", "author": "kenny wang ", "main": "cjs/index.js",