hotkeys-js
Advanced tools
Comparing version 3.7.2 to 3.7.3
/*! | ||
* hotkeys-js v3.7.2 | ||
* hotkeys-js v3.7.3 | ||
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. | ||
@@ -189,3 +189,3 @@ * | ||
if (target.isContentEditable || tagName === 'TEXTAREA' || (tagName === 'INPUT' || tagName === 'TEXTAREA') && !target.readOnly) { | ||
if (target.isContentEditable || (tagName === 'INPUT' || tagName === 'TEXTAREA') && !target.readOnly) { | ||
flag = false; | ||
@@ -192,0 +192,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/*! hotkeys-js v3.7.2 | MIT (c) 2019 kenny wong <wowohoo@qq.com> | http://jaywcjlove.github.io/hotkeys */ | ||
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var isff="undefined"!=typeof navigator&&0<navigator.userAgent.toLowerCase().indexOf("firefox");function addEvent(e,o,t){e.addEventListener?e.addEventListener(o,t,!1):e.attachEvent&&e.attachEvent("on".concat(o),function(){t(window.event)})}function getMods(e,o){for(var t=o.slice(0,o.length-1),n=0;n<t.length;n++)t[n]=e[t[n].toLowerCase()];return t}function getKeys(e){"string"!=typeof e&&(e="");for(var o=(e=e.replace(/\s/g,"")).split(","),t=o.lastIndexOf("");0<=t;)o[t-1]+=",",o.splice(t,1),t=o.lastIndexOf("");return o}function compareArray(e,o){for(var t=e.length<o.length?o:e,n=e.length<o.length?e:o,r=!0,s=0;s<t.length;s++)~n.indexOf(t[s])||(r=!1);return r}for(var _keyMap={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,"-":isff?173:189,"=":isff?61:187,";":isff?59:186,"'":222,"[":219,"]":221,"\\":220},_modifier={"\u21e7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,command:91},modifierMap={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},_mods={16:!1,18:!1,17:!1,91:!1},_handlers={},k=1;k<20;k++)_keyMap["f".concat(k)]=111+k;var _downKeys=[],_scope="all",elementHasBindEvent=[],code=function(e){return _keyMap[e.toLowerCase()]||_modifier[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function setScope(e){_scope=e||"all"}function getScope(){return _scope||"all"}function getPressedKeyCodes(){return _downKeys.slice(0)}function filter(e){var o=e.target||e.srcElement,t=o.tagName,n=!0;return!o.isContentEditable&&"TEXTAREA"!==t&&("INPUT"!==t&&"TEXTAREA"!==t||o.readOnly)||(n=!1),n}function isPressed(e){return"string"==typeof e&&(e=code(e)),!!~_downKeys.indexOf(e)}function deleteScope(e,o){var t,n;for(var r in e||(e=getScope()),_handlers)if(Object.prototype.hasOwnProperty.call(_handlers,r))for(t=_handlers[r],n=0;n<t.length;)t[n].scope===e?t.splice(n,1):n++;getScope()===e&&setScope(o||"all")}function clearModifier(e){var o=e.keyCode||e.which||e.charCode,t=_downKeys.indexOf(o);if(t<0||_downKeys.splice(t,1),e.key&&"meta"==e.key.toLowerCase()&&_downKeys.splice(0,_downKeys.length),93!==o&&224!==o||(o=91),o in _mods)for(var n in _mods[o]=!1,_modifier)_modifier[n]===o&&(hotkeys[n]=!1)}function unbind(e){if(e){if(Array.isArray(e))e.forEach(function(e){e.key&&eachUnbind(e)});else if("object"===_typeof(e))e.key&&eachUnbind(e);else if("string"==typeof e){for(var o=arguments.length,t=Array(1<o?o-1:0),n=1;n<o;n++)t[n-1]=arguments[n];var r=t[0],s=t[1];"function"==typeof r&&(s=r,r=""),eachUnbind({key:e,scope:r,method:s,splitKey:"+"})}}else Object.keys(_handlers).forEach(function(e){return delete _handlers[e]})}var eachUnbind=function(e){var i=e.scope,d=e.method,o=e.splitKey,a=void 0===o?"+":o;getKeys(e.key).forEach(function(e){var o=e.split(a),t=o.length,n=o[t-1],r="*"===n?"*":code(n);if(_handlers[r]){i||(i=getScope());var s=1<t?getMods(_modifier,o):[];_handlers[r]=_handlers[r].map(function(e){return(!d||e.method===d)&&e.scope===i&&compareArray(e.mods,s)?{}:e})}})};function eventHandler(e,o,t){var n;if(o.scope===t||"all"===o.scope){for(var r in n=0<o.mods.length,_mods)Object.prototype.hasOwnProperty.call(_mods,r)&&(!_mods[r]&&-1<o.mods.indexOf(+r)||_mods[r]&&!~o.mods.indexOf(+r))&&(n=!1);(0!==o.mods.length||_mods[16]||_mods[18]||_mods[17]||_mods[91])&&!n&&"*"!==o.shortcut||!1===o.method(e,o)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function dispatch(t){var e=_handlers["*"],o=t.keyCode||t.which||t.charCode;if(hotkeys.filter.call(this,t)){if(93!==o&&224!==o||(o=91),~_downKeys.indexOf(o)||229===o||_downKeys.push(o),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(e){var o=modifierMap[e];t[e]&&!~_downKeys.indexOf(o)?_downKeys.push(o):!t[e]&&-1<_downKeys.indexOf(o)&&_downKeys.splice(_downKeys.indexOf(o),1)}),o in _mods){for(var n in _mods[o]=!0,_modifier)_modifier[n]===o&&(hotkeys[n]=!0);if(!e)return}for(var r in _mods)Object.prototype.hasOwnProperty.call(_mods,r)&&(_mods[r]=t[modifierMap[r]]);var s=getScope();if(e)for(var i=0;i<e.length;i++)e[i].scope===s&&("keydown"===t.type&&e[i].keydown||"keyup"===t.type&&e[i].keyup)&&eventHandler(t,e[i],s);if(o in _handlers)for(var d=0;d<_handlers[o].length;d++)if(("keydown"===t.type&&_handlers[o][d].keydown||"keyup"===t.type&&_handlers[o][d].keyup)&&_handlers[o][d].key){for(var a=_handlers[o][d],c=a.key.split(a.splitKey),f=[],l=0;l<c.length;l++)f.push(code(c[l]));f.sort().join("")===_downKeys.sort().join("")&&eventHandler(t,a,s)}}}function isElementBind(e){return-1<elementHasBindEvent.indexOf(e)}function hotkeys(e,o,t){_downKeys=[];var n=getKeys(e),r=[],s="all",i=document,d=0,a=!1,c=!0,f="+";for(void 0===t&&"function"==typeof o&&(t=o),"[object Object]"===Object.prototype.toString.call(o)&&(o.scope&&(s=o.scope),o.element&&(i=o.element),o.keyup&&(a=o.keyup),void 0!==o.keydown&&(c=o.keydown),"string"==typeof o.splitKey&&(f=o.splitKey)),"string"==typeof o&&(s=o);d<n.length;d++)r=[],1<(e=n[d].split(f)).length&&(r=getMods(_modifier,e)),(e="*"===(e=e[e.length-1])?"*":code(e))in _handlers||(_handlers[e]=[]),_handlers[e].push({keyup:a,keydown:c,scope:s,mods:r,shortcut:n[d],method:t,key:n[d],splitKey:f});void 0!==i&&!isElementBind(i)&&window&&(elementHasBindEvent.push(i),addEvent(i,"keydown",function(e){dispatch(e)}),addEvent(window,"focus",function(){_downKeys=[]}),addEvent(i,"keyup",function(e){dispatch(e),clearModifier(e)}))}var _api={setScope:setScope,getScope:getScope,deleteScope:deleteScope,getPressedKeyCodes:getPressedKeyCodes,isPressed:isPressed,filter:filter,unbind:unbind};for(var a in _api)Object.prototype.hasOwnProperty.call(_api,a)&&(hotkeys[a]=_api[a]);if("undefined"!=typeof window){var _hotkeys=window.hotkeys;hotkeys.noConflict=function(e){return e&&window.hotkeys===hotkeys&&(window.hotkeys=_hotkeys),hotkeys},window.hotkeys=hotkeys}module.exports=hotkeys; | ||
/*! hotkeys-js v3.7.3 | MIT (c) 2019 kenny wong <wowohoo@qq.com> | http://jaywcjlove.github.io/hotkeys */ | ||
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var isff="undefined"!=typeof navigator&&0<navigator.userAgent.toLowerCase().indexOf("firefox");function addEvent(e,o,t){e.addEventListener?e.addEventListener(o,t,!1):e.attachEvent&&e.attachEvent("on".concat(o),function(){t(window.event)})}function getMods(e,o){for(var t=o.slice(0,o.length-1),n=0;n<t.length;n++)t[n]=e[t[n].toLowerCase()];return t}function getKeys(e){"string"!=typeof e&&(e="");for(var o=(e=e.replace(/\s/g,"")).split(","),t=o.lastIndexOf("");0<=t;)o[t-1]+=",",o.splice(t,1),t=o.lastIndexOf("");return o}function compareArray(e,o){for(var t=e.length<o.length?o:e,n=e.length<o.length?e:o,r=!0,s=0;s<t.length;s++)~n.indexOf(t[s])||(r=!1);return r}for(var _keyMap={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,"-":isff?173:189,"=":isff?61:187,";":isff?59:186,"'":222,"[":219,"]":221,"\\":220},_modifier={"\u21e7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,command:91},modifierMap={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},_mods={16:!1,18:!1,17:!1,91:!1},_handlers={},k=1;k<20;k++)_keyMap["f".concat(k)]=111+k;var _downKeys=[],_scope="all",elementHasBindEvent=[],code=function(e){return _keyMap[e.toLowerCase()]||_modifier[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function setScope(e){_scope=e||"all"}function getScope(){return _scope||"all"}function getPressedKeyCodes(){return _downKeys.slice(0)}function filter(e){var o=e.target||e.srcElement,t=o.tagName,n=!0;return!o.isContentEditable&&("INPUT"!==t&&"TEXTAREA"!==t||o.readOnly)||(n=!1),n}function isPressed(e){return"string"==typeof e&&(e=code(e)),!!~_downKeys.indexOf(e)}function deleteScope(e,o){var t,n;for(var r in e=e||getScope(),_handlers)if(Object.prototype.hasOwnProperty.call(_handlers,r))for(t=_handlers[r],n=0;n<t.length;)t[n].scope===e?t.splice(n,1):n++;getScope()===e&&setScope(o||"all")}function clearModifier(e){var o=e.keyCode||e.which||e.charCode,t=_downKeys.indexOf(o);if(t<0||_downKeys.splice(t,1),e.key&&"meta"==e.key.toLowerCase()&&_downKeys.splice(0,_downKeys.length),93!==o&&224!==o||(o=91),o in _mods)for(var n in _mods[o]=!1,_modifier)_modifier[n]===o&&(hotkeys[n]=!1)}function unbind(e){if(e){if(Array.isArray(e))e.forEach(function(e){e.key&&eachUnbind(e)});else if("object"===_typeof(e))e.key&&eachUnbind(e);else if("string"==typeof e){for(var o=arguments.length,t=Array(1<o?o-1:0),n=1;n<o;n++)t[n-1]=arguments[n];var r=t[0],s=t[1];"function"==typeof r&&(s=r,r=""),eachUnbind({key:e,scope:r,method:s,splitKey:"+"})}}else Object.keys(_handlers).forEach(function(e){return delete _handlers[e]})}var eachUnbind=function(e){var i=e.scope,d=e.method,o=e.splitKey,a=void 0===o?"+":o;getKeys(e.key).forEach(function(e){var o=e.split(a),t=o.length,n=o[t-1],r="*"===n?"*":code(n);if(_handlers[r]){i=i||getScope();var s=1<t?getMods(_modifier,o):[];_handlers[r]=_handlers[r].map(function(e){return(!d||e.method===d)&&e.scope===i&&compareArray(e.mods,s)?{}:e})}})};function eventHandler(e,o,t){var n;if(o.scope===t||"all"===o.scope){for(var r in n=0<o.mods.length,_mods)Object.prototype.hasOwnProperty.call(_mods,r)&&(!_mods[r]&&~o.mods.indexOf(+r)||_mods[r]&&!~o.mods.indexOf(+r))&&(n=!1);(0!==o.mods.length||_mods[16]||_mods[18]||_mods[17]||_mods[91])&&!n&&"*"!==o.shortcut||!1===o.method(e,o)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function dispatch(t){var e=_handlers["*"],o=t.keyCode||t.which||t.charCode;if(hotkeys.filter.call(this,t)){if(93!==o&&224!==o||(o=91),~_downKeys.indexOf(o)||229===o||_downKeys.push(o),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(e){var o=modifierMap[e];t[e]&&!~_downKeys.indexOf(o)?_downKeys.push(o):!t[e]&&~_downKeys.indexOf(o)&&_downKeys.splice(_downKeys.indexOf(o),1)}),o in _mods){for(var n in _mods[o]=!0,_modifier)_modifier[n]===o&&(hotkeys[n]=!0);if(!e)return}for(var r in _mods)Object.prototype.hasOwnProperty.call(_mods,r)&&(_mods[r]=t[modifierMap[r]]);var s=getScope();if(e)for(var i=0;i<e.length;i++)e[i].scope===s&&("keydown"===t.type&&e[i].keydown||"keyup"===t.type&&e[i].keyup)&&eventHandler(t,e[i],s);if(o in _handlers)for(var d=0;d<_handlers[o].length;d++)if(("keydown"===t.type&&_handlers[o][d].keydown||"keyup"===t.type&&_handlers[o][d].keyup)&&_handlers[o][d].key){for(var a=_handlers[o][d],c=a.key.split(a.splitKey),f=[],l=0;l<c.length;l++)f.push(code(c[l]));f.sort().join("")===_downKeys.sort().join("")&&eventHandler(t,a,s)}}}function isElementBind(e){return!!~elementHasBindEvent.indexOf(e)}function hotkeys(e,o,t){_downKeys=[];var n=getKeys(e),r=[],s="all",i=document,d=0,a=!1,c=!0,f="+";for(void 0===t&&"function"==typeof o&&(t=o),"[object Object]"===Object.prototype.toString.call(o)&&(o.scope&&(s=o.scope),o.element&&(i=o.element),o.keyup&&(a=o.keyup),void 0!==o.keydown&&(c=o.keydown),"string"==typeof o.splitKey&&(f=o.splitKey)),"string"==typeof o&&(s=o);d<n.length;d++)r=[],1<(e=n[d].split(f)).length&&(r=getMods(_modifier,e)),(e="*"===(e=e[e.length-1])?"*":code(e))in _handlers||(_handlers[e]=[]),_handlers[e].push({keyup:a,keydown:c,scope:s,mods:r,shortcut:n[d],method:t,key:n[d],splitKey:f});void 0!==i&&!isElementBind(i)&&window&&(elementHasBindEvent.push(i),addEvent(i,"keydown",function(e){dispatch(e)}),addEvent(window,"focus",function(){_downKeys=[]}),addEvent(i,"keyup",function(e){dispatch(e),clearModifier(e)}))}var _api={setScope:setScope,getScope:getScope,deleteScope:deleteScope,getPressedKeyCodes:getPressedKeyCodes,isPressed:isPressed,filter:filter,unbind:unbind};for(var a in _api)Object.prototype.hasOwnProperty.call(_api,a)&&(hotkeys[a]=_api[a]);if("undefined"!=typeof window){var _hotkeys=window.hotkeys;hotkeys.noConflict=function(e){return e&&window.hotkeys===hotkeys&&(window.hotkeys=_hotkeys),hotkeys},window.hotkeys=hotkeys}module.exports=hotkeys; |
/*! | ||
* hotkeys-js v3.7.2 | ||
* hotkeys-js v3.7.3 | ||
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. | ||
@@ -187,3 +187,3 @@ * | ||
if (target.isContentEditable || tagName === 'TEXTAREA' || (tagName === 'INPUT' || tagName === 'TEXTAREA') && !target.readOnly) { | ||
if (target.isContentEditable || (tagName === 'INPUT' || tagName === 'TEXTAREA') && !target.readOnly) { | ||
flag = false; | ||
@@ -190,0 +190,0 @@ } |
/*! | ||
* hotkeys-js v3.7.2 | ||
* hotkeys-js v3.7.3 | ||
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. | ||
@@ -15,3 +15,3 @@ * | ||
(global = global || self, global.hotkeys = factory()); | ||
}(this, function () { 'use strict'; | ||
}(this, (function () { 'use strict'; | ||
@@ -194,3 +194,3 @@ function _typeof(obj) { | ||
if (target.isContentEditable || tagName === 'TEXTAREA' || (tagName === 'INPUT' || tagName === 'TEXTAREA') && !target.readOnly) { | ||
if (target.isContentEditable || (tagName === 'INPUT' || tagName === 'TEXTAREA') && !target.readOnly) { | ||
flag = false; | ||
@@ -552,2 +552,2 @@ } | ||
})); | ||
}))); |
@@ -1,2 +0,2 @@ | ||
/*! hotkeys-js v3.7.2 | MIT (c) 2019 kenny wong <wowohoo@qq.com> | http://jaywcjlove.github.io/hotkeys */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).hotkeys=t()}(this,function(){"use strict";function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var e="undefined"!=typeof navigator&&0<navigator.userAgent.toLowerCase().indexOf("firefox");function p(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on".concat(t),function(){n(window.event)})}function y(e,t){for(var n=t.slice(0,t.length-1),o=0;o<n.length;o++)n[o]=e[n[o].toLowerCase()];return n}function u(e){"string"!=typeof e&&(e="");for(var t=(e=e.replace(/\s/g,"")).split(","),n=t.lastIndexOf("");0<=n;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}for(var t={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,"-":e?173:189,"=":e?61:187,";":e?59:186,"'":222,"[":219,"]":221,"\\":220},d={"\u21e7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,command:91},h={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},v={16:!1,18:!1,17:!1,91:!1},g={},n=1;n<20;n++)t["f".concat(n)]=111+n;var w=[],o="all",k=[],m=function(e){return t[e.toLowerCase()]||d[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function i(e){o=e||"all"}function b(){return o||"all"}function c(e){var f=e.scope,c=e.method,t=e.splitKey,a=void 0===t?"+":t;u(e.key).forEach(function(e){var t=e.split(a),n=t.length,o=t[n-1],r="*"===o?"*":m(o);if(g[r]){f||(f=b());var i=1<n?y(d,t):[];g[r]=g[r].map(function(e){return(!c||e.method===c)&&e.scope===f&&function(e,t){for(var n=e.length<t.length?t:e,o=e.length<t.length?e:t,r=!0,i=0;i<n.length;i++)~o.indexOf(n[i])||(r=!1);return r}(e.mods,i)?{}:e})}})}function O(e,t,n){var o;if(t.scope===n||"all"===t.scope){for(var r in o=0<t.mods.length,v)Object.prototype.hasOwnProperty.call(v,r)&&(!v[r]&&-1<t.mods.indexOf(+r)||v[r]&&!~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 K(n){var e=g["*"],t=n.keyCode||n.which||n.charCode;if(x.filter.call(this,n)){if(93!==t&&224!==t||(t=91),~w.indexOf(t)||229===t||w.push(t),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(e){var t=h[e];n[e]&&!~w.indexOf(t)?w.push(t):!n[e]&&-1<w.indexOf(t)&&w.splice(w.indexOf(t),1)}),t in v){for(var o in v[t]=!0,d)d[o]===t&&(x[o]=!0);if(!e)return}for(var r in v)Object.prototype.hasOwnProperty.call(v,r)&&(v[r]=n[h[r]]);var i=b();if(e)for(var f=0;f<e.length;f++)e[f].scope===i&&("keydown"===n.type&&e[f].keydown||"keyup"===n.type&&e[f].keyup)&&O(n,e[f],i);if(t in g)for(var c=0;c<g[t].length;c++)if(("keydown"===n.type&&g[t][c].keydown||"keyup"===n.type&&g[t][c].keyup)&&g[t][c].key){for(var a=g[t][c],l=a.key.split(a.splitKey),s=[],p=0;p<l.length;p++)s.push(m(l[p]));s.sort().join("")===w.sort().join("")&&O(n,a,i)}}}function x(e,t,n){w=[];var o=u(e),r=[],i="all",f=document,c=0,a=!1,l=!0,s="+";for(void 0===n&&"function"==typeof t&&(n=t),"[object Object]"===Object.prototype.toString.call(t)&&(t.scope&&(i=t.scope),t.element&&(f=t.element),t.keyup&&(a=t.keyup),void 0!==t.keydown&&(l=t.keydown),"string"==typeof t.splitKey&&(s=t.splitKey)),"string"==typeof t&&(i=t);c<o.length;c++)r=[],1<(e=o[c].split(s)).length&&(r=y(d,e)),(e="*"===(e=e[e.length-1])?"*":m(e))in g||(g[e]=[]),g[e].push({keyup:a,keydown:l,scope:i,mods:r,shortcut:o[c],method:n,key:o[c],splitKey:s});void 0!==f&&!function(e){return-1<k.indexOf(e)}(f)&&window&&(k.push(f),p(f,"keydown",function(e){K(e)}),p(window,"focus",function(){w=[]}),p(f,"keyup",function(e){K(e),function(e){var t=e.keyCode||e.which||e.charCode,n=w.indexOf(t);if(n<0||w.splice(n,1),e.key&&"meta"==e.key.toLowerCase()&&w.splice(0,w.length),93!==t&&224!==t||(t=91),t in v)for(var o in v[t]=!1,d)d[o]===t&&(x[o]=!1)}(e)}))}var r={setScope:i,getScope:b,deleteScope:function(e,t){var n,o;for(var r in e||(e=b()),g)if(Object.prototype.hasOwnProperty.call(g,r))for(n=g[r],o=0;o<n.length;)n[o].scope===e?n.splice(o,1):o++;b()===e&&i(t||"all")},getPressedKeyCodes:function(){return w.slice(0)},isPressed:function(e){return"string"==typeof e&&(e=m(e)),!!~w.indexOf(e)},filter:function(e){var t=e.target||e.srcElement,n=t.tagName,o=!0;return!t.isContentEditable&&"TEXTAREA"!==n&&("INPUT"!==n&&"TEXTAREA"!==n||t.readOnly)||(o=!1),o},unbind:function(e){if(e){if(Array.isArray(e))e.forEach(function(e){e.key&&c(e)});else if("object"===f(e))e.key&&c(e);else if("string"==typeof e){for(var t=arguments.length,n=Array(1<t?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];var r=n[0],i=n[1];"function"==typeof r&&(i=r,r=""),c({key:e,scope:r,method:i,splitKey:"+"})}}else Object.keys(g).forEach(function(e){return delete g[e]})}};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(x[a]=r[a]);if("undefined"!=typeof window){var l=window.hotkeys;x.noConflict=function(e){return e&&window.hotkeys===x&&(window.hotkeys=l),x},window.hotkeys=x}return x}); | ||
/*! hotkeys-js v3.7.3 | MIT (c) 2019 kenny wong <wowohoo@qq.com> | http://jaywcjlove.github.io/hotkeys */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).hotkeys=t()}(this,function(){"use strict";function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var e="undefined"!=typeof navigator&&0<navigator.userAgent.toLowerCase().indexOf("firefox");function p(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on".concat(t),function(){n(window.event)})}function y(e,t){for(var n=t.slice(0,t.length-1),o=0;o<n.length;o++)n[o]=e[n[o].toLowerCase()];return n}function u(e){"string"!=typeof e&&(e="");for(var t=(e=e.replace(/\s/g,"")).split(","),n=t.lastIndexOf("");0<=n;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}for(var t={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,"-":e?173:189,"=":e?61:187,";":e?59:186,"'":222,"[":219,"]":221,"\\":220},d={"\u21e7":16,shift:16,"\u2325":18,alt:18,option:18,"\u2303":17,ctrl:17,control:17,"\u2318":91,cmd:91,command:91},h={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},v={16:!1,18:!1,17:!1,91:!1},g={},n=1;n<20;n++)t["f".concat(n)]=111+n;var w=[],o="all",k=[],m=function(e){return t[e.toLowerCase()]||d[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function i(e){o=e||"all"}function b(){return o||"all"}function c(e){var f=e.scope,c=e.method,t=e.splitKey,a=void 0===t?"+":t;u(e.key).forEach(function(e){var t=e.split(a),n=t.length,o=t[n-1],r="*"===o?"*":m(o);if(g[r]){f=f||b();var i=1<n?y(d,t):[];g[r]=g[r].map(function(e){return(!c||e.method===c)&&e.scope===f&&function(e,t){for(var n=e.length<t.length?t:e,o=e.length<t.length?e:t,r=!0,i=0;i<n.length;i++)~o.indexOf(n[i])||(r=!1);return r}(e.mods,i)?{}:e})}})}function O(e,t,n){var o;if(t.scope===n||"all"===t.scope){for(var r in o=0<t.mods.length,v)Object.prototype.hasOwnProperty.call(v,r)&&(!v[r]&&~t.mods.indexOf(+r)||v[r]&&!~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 K(n){var e=g["*"],t=n.keyCode||n.which||n.charCode;if(x.filter.call(this,n)){if(93!==t&&224!==t||(t=91),~w.indexOf(t)||229===t||w.push(t),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(e){var t=h[e];n[e]&&!~w.indexOf(t)?w.push(t):!n[e]&&~w.indexOf(t)&&w.splice(w.indexOf(t),1)}),t in v){for(var o in v[t]=!0,d)d[o]===t&&(x[o]=!0);if(!e)return}for(var r in v)Object.prototype.hasOwnProperty.call(v,r)&&(v[r]=n[h[r]]);var i=b();if(e)for(var f=0;f<e.length;f++)e[f].scope===i&&("keydown"===n.type&&e[f].keydown||"keyup"===n.type&&e[f].keyup)&&O(n,e[f],i);if(t in g)for(var c=0;c<g[t].length;c++)if(("keydown"===n.type&&g[t][c].keydown||"keyup"===n.type&&g[t][c].keyup)&&g[t][c].key){for(var a=g[t][c],l=a.key.split(a.splitKey),s=[],p=0;p<l.length;p++)s.push(m(l[p]));s.sort().join("")===w.sort().join("")&&O(n,a,i)}}}function x(e,t,n){w=[];var o=u(e),r=[],i="all",f=document,c=0,a=!1,l=!0,s="+";for(void 0===n&&"function"==typeof t&&(n=t),"[object Object]"===Object.prototype.toString.call(t)&&(t.scope&&(i=t.scope),t.element&&(f=t.element),t.keyup&&(a=t.keyup),void 0!==t.keydown&&(l=t.keydown),"string"==typeof t.splitKey&&(s=t.splitKey)),"string"==typeof t&&(i=t);c<o.length;c++)r=[],1<(e=o[c].split(s)).length&&(r=y(d,e)),(e="*"===(e=e[e.length-1])?"*":m(e))in g||(g[e]=[]),g[e].push({keyup:a,keydown:l,scope:i,mods:r,shortcut:o[c],method:n,key:o[c],splitKey:s});void 0!==f&&!function(e){return!!~k.indexOf(e)}(f)&&window&&(k.push(f),p(f,"keydown",function(e){K(e)}),p(window,"focus",function(){w=[]}),p(f,"keyup",function(e){K(e),function(e){var t=e.keyCode||e.which||e.charCode,n=w.indexOf(t);if(n<0||w.splice(n,1),e.key&&"meta"==e.key.toLowerCase()&&w.splice(0,w.length),93!==t&&224!==t||(t=91),t in v)for(var o in v[t]=!1,d)d[o]===t&&(x[o]=!1)}(e)}))}var r={setScope:i,getScope:b,deleteScope:function(e,t){var n,o;for(var r in e=e||b(),g)if(Object.prototype.hasOwnProperty.call(g,r))for(n=g[r],o=0;o<n.length;)n[o].scope===e?n.splice(o,1):o++;b()===e&&i(t||"all")},getPressedKeyCodes:function(){return w.slice(0)},isPressed:function(e){return"string"==typeof e&&(e=m(e)),!!~w.indexOf(e)},filter:function(e){var t=e.target||e.srcElement,n=t.tagName,o=!0;return!t.isContentEditable&&("INPUT"!==n&&"TEXTAREA"!==n||t.readOnly)||(o=!1),o},unbind:function(e){if(e){if(Array.isArray(e))e.forEach(function(e){e.key&&c(e)});else if("object"===f(e))e.key&&c(e);else if("string"==typeof e){for(var t=arguments.length,n=Array(1<t?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];var r=n[0],i=n[1];"function"==typeof r&&(i=r,r=""),c({key:e,scope:r,method:i,splitKey:"+"})}}else Object.keys(g).forEach(function(e){return delete g[e]})}};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(x[a]=r[a]);if("undefined"!=typeof window){var l=window.hotkeys;x.noConflict=function(e){return e&&window.hotkeys===x&&(window.hotkeys=l),x},window.hotkeys=x}return x}); |
@@ -13,11 +13,2 @@ export interface HotkeysEvent { | ||
export interface FilterEvent { | ||
target?: { | ||
tagName?: string | ||
} | ||
srcElement?: { | ||
tagName?: string | ||
} | ||
} | ||
type Options = { | ||
@@ -59,3 +50,3 @@ scope?: string, | ||
filter(event: FilterEvent): boolean | ||
filter(event: KeyboardEvent): boolean | ||
} | ||
@@ -62,0 +53,0 @@ // https://github.com/eiriklv/react-masonry-component/issues/57 |
{ | ||
"name": "hotkeys-js", | ||
"description": "A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.", | ||
"version": "3.7.2", | ||
"version": "3.7.3", | ||
"main": "index.js", | ||
@@ -53,7 +53,7 @@ "types": "index.d.ts", | ||
"devDependencies": { | ||
"@babel/core": "^7.4.4", | ||
"@babel/core": "^7.7.2", | ||
"@babel/plugin-external-helpers": "^7.2.0", | ||
"@babel/plugin-transform-runtime": "^7.4.4", | ||
"@babel/preset-env": "^7.4.4", | ||
"@babel/preset-react": "^7.0.0", | ||
"@babel/plugin-transform-runtime": "^7.6.2", | ||
"@babel/preset-env": "^7.7.1", | ||
"@babel/preset-react": "^7.7.0", | ||
"autoprefixer": "^8.6.1", | ||
@@ -63,28 +63,28 @@ "babel-eslint": "^8.2.3", | ||
"classnames": "^2.2.5", | ||
"colors-cli": "^1.0.13", | ||
"colors-cli": "^1.0.26", | ||
"eslint": "^4.19.1", | ||
"eslint-config-airbnb": "^16.1.0", | ||
"eslint-plugin-import": "^2.12.0", | ||
"eslint-plugin-jsx-a11y": "^6.0.3", | ||
"eslint-plugin-react": "^7.9.1", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-react": "^7.16.0", | ||
"gh-pages": "^1.2.0", | ||
"highlight.js": "^9.12.0", | ||
"husky": "^1.3.1", | ||
"jest": "^24.8.0", | ||
"less": "^3.0.4", | ||
"parcel-bundler": "^1.12.3", | ||
"parcel-plugin-markdown-string": "^1.3.5", | ||
"highlight.js": "^9.16.2", | ||
"husky": "^3.1.0", | ||
"jest": "^24.9.0", | ||
"less": "^3.10.3", | ||
"parcel-bundler": "^1.12.4", | ||
"parcel-plugin-markdown-string": "^1.4.2", | ||
"postcss-modules": "^1.1.0", | ||
"puppeteer": "^1.14.0", | ||
"react": "^16.7.0", | ||
"react-dom": "^16.7.0", | ||
"puppeteer": "^1.20.0", | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0", | ||
"react-markdown": "^3.3.2", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.11.0", | ||
"rollup-plugin-babel": "^4.3.2", | ||
"rimraf": "^2.7.1", | ||
"rollup": "^1.27.4", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
"rollup-plugin-node-resolve": "^4.2.3", | ||
"uglify-js": "^3.4.0", | ||
"rollup-plugin-node-resolve": "^4.2.4", | ||
"uglify-js": "^3.6.9", | ||
"zlib": "^1.0.5" | ||
} | ||
} |
@@ -114,3 +114,3 @@ # Hotkeys | ||
// SIngle key | ||
// Single key | ||
hotkeys('a', function(event,handler){ | ||
@@ -125,3 +125,3 @@ //event.srcElement: input | ||
// Key Combenation | ||
// Key Combination | ||
hotkeys('ctrl+a,ctrl+b,r,f', function (event, handler){ | ||
@@ -128,0 +128,0 @@ switch (handler.key) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1168581
5678
1
1