From cfd47cab748ab25487d7a742701a1dabc16cf0de Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Sat, 9 Dec 2023 19:48:44 +0800 Subject: [PATCH] released v3.13.1 #441 #464 --- dist/hotkeys.common.js | 2 +- dist/hotkeys.common.min.js | 2 +- dist/hotkeys.esm.js | 2 +- dist/hotkeys.js | 2 +- dist/hotkeys.min.js | 2 +- package.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/hotkeys.common.js b/dist/hotkeys.common.js index 36a85267..f8b2ece1 100644 --- a/dist/hotkeys.common.js +++ b/dist/hotkeys.common.js @@ -1,5 +1,5 @@ /**! - * hotkeys-js v3.13.0 + * hotkeys-js v3.13.1 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * * Copyright (c) 2023 kenny wong diff --git a/dist/hotkeys.common.min.js b/dist/hotkeys.common.min.js index 0092dd27..ee240286 100644 --- a/dist/hotkeys.common.min.js +++ b/dist/hotkeys.common.min.js @@ -1,2 +1,2 @@ -/*! hotkeys-js v3.13.0 | MIT © 2023 kenny wong https://jaywcjlove.github.io/hotkeys-js */ +/*! hotkeys-js v3.13.1 | MIT © 2023 kenny wong https://jaywcjlove.github.io/hotkeys-js */ "use strict";const isff="undefined"!=typeof navigator&&0{o(window.event)})}function getMods(t,e){var o=e.slice(0,e.length-1);for(let e=0;e_keyMap[e.toLowerCase()]||_modifier[e.toLowerCase()]||e.toUpperCase().charCodeAt(0),getKey=t=>Object.keys(_keyMap).find(e=>_keyMap[e]===t),getModifier=t=>Object.keys(_modifier).find(e=>_modifier[e]===t);function setScope(e){_scope=e||"all"}function getScope(){return _scope||"all"}function getPressedKeyCodes(){return _downKeys.slice(0)}function getPressedKeyString(){return _downKeys.map(e=>getKey(e)||getModifier(e)||String.fromCharCode(e))}function getAllKeyCodes(){const s=[];return Object.keys(_handlers).forEach(e=>{_handlers[e].forEach(e=>{var{key:e,scope:t,mods:o,shortcut:n}=e;s.push({scope:t,shortcut:n,mods:o,keys:e.split("+").map(e=>code(e))})})}),s}function filter(e){var e=e.target||e.srcElement,t=e["tagName"];let o=!e.isContentEditable&&("INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t||e.readOnly)?!0:!1;return o}function isPressed(e){return"string"==typeof e&&(e=code(e)),!!~_downKeys.indexOf(e)}function deleteScope(e,t){var o;let n;e=e||getScope();for(const s in _handlers)if(Object.prototype.hasOwnProperty.call(_handlers,s))for(o=_handlers[s],n=0;ndelete _handlers[e]);else if(Array.isArray(o))o.forEach(e=>{e.key&&eachUnbind(e)});else if("object"==typeof o)o.key&&eachUnbind(o);else if("string"==typeof o){for(var n=arguments.length,s=Array(1{let{key:t,scope:s,method:d,splitKey:i="+"}=e;getKeys(t).forEach(e=>{var e=e.split(i),t=e.length,o=e[t-1],o="*"===o?"*":code(o);if(_handlers[o]){s=s||getScope();const n=1{return!((!d||e.method===d)&&e.scope===s&&compareArray(e.mods,n))})}})};function eventHandler(t,o,n,e){if(o.element===e){let e;if(o.scope===n||"all"===o.scope){e=0{var t=modifierMap[e];o[e]&&!~_downKeys.indexOf(t)?_downKeys.push(t):!o[e]&&~_downKeys.indexOf(t)?_downKeys.splice(_downKeys.indexOf(t),1):"metaKey"!==e||!o[e]||3!==_downKeys.length||o.ctrlKey||o.shiftKey||o.altKey||(_downKeys=_downKeys.slice(_downKeys.indexOf(t)))}),s in _mods){_mods[s]=!0;for(const e in _modifier)_modifier[e]===s&&(hotkeys[e]=!0);if(!n)return}for(const c in _mods)Object.prototype.hasOwnProperty.call(_mods,c)&&(_mods[c]=o[modifierMap[c]]);o.getModifierState&&(!o.altKey||o.ctrlKey)&&o.getModifierState("AltGraph")&&(~_downKeys.indexOf(17)||_downKeys.push(17),~_downKeys.indexOf(18)||_downKeys.push(18),_mods[17]=!0,_mods[18]=!0);var d=getScope();if(n)for(let e=0;e{dispatch(e,i)},y),winListendFocus||(winListendFocus=!0,addEvent(window,"focus",()=>{_downKeys=[]},y)),addEvent(i,"keyup",e=>{dispatch(e,i),clearModifier(e)},y))}function trigger(t){let o=1{_handlers[e].filter(e=>e.scope===o&&e.shortcut===t).forEach(e=>{e&&e.method&&e.method()})})}const _api={getPressedKeyString:getPressedKeyString,setScope:setScope,getScope:getScope,deleteScope:deleteScope,getPressedKeyCodes:getPressedKeyCodes,getAllKeyCodes:getAllKeyCodes,isPressed:isPressed,filter:filter,trigger:trigger,unbind:unbind,keyMap:_keyMap,modifier:_modifier,modifierMap:modifierMap};for(const f0 in _api)Object.prototype.hasOwnProperty.call(_api,f0)&&(hotkeys[f0]=_api[f0]);if("undefined"!=typeof window){const g0=window.hotkeys;hotkeys.noConflict=e=>(e&&window.hotkeys===hotkeys&&(window.hotkeys=g0),hotkeys),window.hotkeys=hotkeys}module.exports=hotkeys; \ No newline at end of file diff --git a/dist/hotkeys.esm.js b/dist/hotkeys.esm.js index f9aec667..762c50f8 100644 --- a/dist/hotkeys.esm.js +++ b/dist/hotkeys.esm.js @@ -1,5 +1,5 @@ /**! - * hotkeys-js v3.13.0 + * hotkeys-js v3.13.1 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * * Copyright (c) 2023 kenny wong diff --git a/dist/hotkeys.js b/dist/hotkeys.js index da52f0ba..fbc67b5c 100644 --- a/dist/hotkeys.js +++ b/dist/hotkeys.js @@ -1,5 +1,5 @@ /**! - * hotkeys-js v3.13.0 + * hotkeys-js v3.13.1 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * * Copyright (c) 2023 kenny wong diff --git a/dist/hotkeys.min.js b/dist/hotkeys.min.js index 2cfd2e65..123df802 100644 --- a/dist/hotkeys.min.js +++ b/dist/hotkeys.min.js @@ -1,2 +1,2 @@ -/*! hotkeys-js v3.13.0 | MIT © 2023 kenny wong https://jaywcjlove.github.io/hotkeys-js */ +/*! hotkeys-js v3.13.1 | MIT © 2023 kenny wong https://jaywcjlove.github.io/hotkeys-js */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).hotkeys=t()}(this,function(){"use strict";var e="undefined"!=typeof navigator&&0{n(window.event)})}function u(t,e){var n=e.slice(0,e.length-1);for(let e=0;eo[e.toLowerCase()]||m[e.toLowerCase()]||e.toUpperCase().charCodeAt(0);function i(e){t=e||"all"}function d(){return t||"all"}const s=e=>{let{key:t,scope:r,method:i,splitKey:s="+"}=e;h(t).forEach(e=>{var e=e.split(s),t=e.length,n=e[t-1],n="*"===n?"*":K(n);if(k[n]){r=r||d();const o=1{return!((!i||e.method===i)&&e.scope===r&&function(e,t){var n=e.length{var t=p[e];n[e]&&!~w.indexOf(t)?w.push(t):!n[e]&&~w.indexOf(t)?w.splice(w.indexOf(t),1):"metaKey"!==e||!n[e]||3!==w.length||n.ctrlKey||n.shiftKey||n.altKey||(w=w.slice(w.indexOf(t)))}),r in g){g[r]=!0;for(const e in m)m[e]===r&&(C[e]=!0);if(!o)return}for(const a in g)Object.prototype.hasOwnProperty.call(g,a)&&(g[a]=n[p[a]]);n.getModifierState&&(!n.altKey||n.ctrlKey)&&n.getModifierState("AltGraph")&&(~w.indexOf(17)||w.push(17),~w.indexOf(18)||w.push(18),g[17]=!0,g[18]=!0);var i=d();if(o)for(let e=0;e{x(e,s)},p),v||(v=!0,y(window,"focus",()=>{w=[]},p)),y(s,"keyup",t=>{x(t,s);{let e=t.keyCode||t.which||t.charCode;var n=w.indexOf(e);if(n<0||w.splice(n,1),t.key&&"meta"==t.key.toLowerCase()&&w.splice(0,w.length),(e=93!==e&&224!==e?e:91)in g){g[e]=!1;for(const o in m)m[o]===e&&(C[o]=!1)}}},p))}var n={getPressedKeyString:function(){return w.map(e=>{return n=e,Object.keys(o).find(e=>o[e]===n)||(t=e,Object.keys(m).find(e=>m[e]===t))||String.fromCharCode(e);var t,n})},setScope:i,getScope:d,deleteScope:function(e,t){var n;let o;e=e||d();for(const r in k)if(Object.prototype.hasOwnProperty.call(k,r))for(n=k[r],o=0;o{k[e].forEach(e=>{var{key:e,scope:t,mods:n,shortcut:o}=e;r.push({scope:t,shortcut:o,mods:n,keys:e.split("+").map(e=>K(e))})})}),r},isPressed:function(e){return"string"==typeof e&&(e=K(e)),!!~w.indexOf(e)},filter:function(e){var t=(e=e.target||e.srcElement)["tagName"];let n=!e.isContentEditable&&("INPUT"!==t&&"TEXTAREA"!==t&&"SELECT"!==t||e.readOnly)?!0:!1;return n},trigger:function(t){let n=1{k[e].filter(e=>e.scope===n&&e.shortcut===t).forEach(e=>{e&&e.method&&e.method()})})},unbind:function(n){if(void 0===n)Object.keys(k).forEach(e=>delete k[e]);else if(Array.isArray(n))n.forEach(e=>{e.key&&s(e)});else if("object"==typeof n)n.key&&s(n);else if("string"==typeof n){for(var o=arguments.length,r=Array(1(e&&window.hotkeys===C&&(window.hotkeys=l),C),window.hotkeys=C}return C}); \ No newline at end of file diff --git a/package.json b/package.json index 739d0f9e..a5ab28e7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "hotkeys-js", "description": "A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.", - "version": "3.13.0", + "version": "3.13.1", "main": "index.js", "types": "index.d.ts", "module": "dist/hotkeys.esm.js",