react-hotkeys-hook
Advanced tools
Comparing version 4.3.7 to 4.3.8
@@ -1,5 +0,5 @@ | ||
import { Hotkey, Keys } from './types'; | ||
import { Hotkey } from './types'; | ||
export declare function mapKey(key: string): string; | ||
export declare function isHotkeyModifier(key: string): boolean; | ||
export declare function parseKeysHookInput(keys: Keys, splitKey?: string): string[]; | ||
export declare function parseKeysHookInput(keys: string, splitKey?: string): string[]; | ||
export declare function parseHotkey(hotkey: string, combinationKey?: string): Hotkey; |
@@ -53,6 +53,3 @@ 'use strict'; | ||
} | ||
if (typeof keys === 'string') { | ||
return keys.split(splitKey); | ||
} | ||
return keys; | ||
return keys.split(splitKey); | ||
} | ||
@@ -373,2 +370,3 @@ function parseHotkey(hotkey, combinationKey) { | ||
var _options = !(options instanceof Array) ? options : !(dependencies instanceof Array) ? dependencies : undefined; | ||
var _keys = keys instanceof Array ? keys.join(_options == null ? void 0 : _options.splitKey) : keys; | ||
var _deps = options instanceof Array ? options : dependencies instanceof Array ? dependencies : undefined; | ||
@@ -407,3 +405,3 @@ var memoisedCB = react.useCallback(callback, _deps != null ? _deps : []); | ||
} | ||
parseKeysHookInput(keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
var _hotkey$keys; | ||
@@ -455,3 +453,3 @@ var hotkey = parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey); | ||
if (proxy) { | ||
parseKeysHookInput(keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
return proxy.addHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey)); | ||
@@ -466,3 +464,3 @@ }); | ||
if (proxy) { | ||
parseKeysHookInput(keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
return proxy.removeHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey)); | ||
@@ -472,3 +470,3 @@ }); | ||
}; | ||
}, [keys, memoisedOptions, enabledScopes]); | ||
}, [_keys, memoisedOptions, enabledScopes]); | ||
return ref; | ||
@@ -475,0 +473,0 @@ } |
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("react"),t=require("react/jsx-runtime");function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}var o=["shift","alt","meta","mod","ctrl"],r={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function i(e){return(r[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function u(e,t){return void 0===t&&(t=","),"string"==typeof e?e.split(t):e}function c(e,t){void 0===t&&(t="+");var r=e.toLocaleLowerCase().split(t).map((function(e){return i(e)}));return n({},{alt:r.includes("alt"),ctrl:r.includes("ctrl")||r.includes("control"),shift:r.includes("shift"),meta:r.includes("meta"),mod:r.includes("mod")},{keys:r.filter((function(e){return!o.includes(e)}))})}"undefined"!=typeof document&&(document.addEventListener("keydown",(function(e){void 0!==e.key&&s([i(e.key),i(e.code)])})),document.addEventListener("keyup",(function(e){void 0!==e.key&&d([i(e.key),i(e.code)])}))),"undefined"!=typeof window&&window.addEventListener("blur",(function(){a.clear()}));var a=new Set;function l(e,t){return void 0===t&&(t=","),(Array.isArray(e)?e:e.split(t)).every((function(e){return a.has(e.trim().toLowerCase())}))}function s(e){var t=Array.isArray(e)?e:[e];a.has("meta")&&a.forEach((function(e){return!function(e){return o.includes(e)}(e)&&a.delete(e.toLowerCase())})),t.forEach((function(e){return a.add(e.toLowerCase())}))}function d(e){var t=Array.isArray(e)?e:[e];"meta"===e?a.clear():t.forEach((function(e){return a.delete(e.toLowerCase())}))}function f(e,t){var n=e.target;void 0===t&&(t=!1);var o=n&&n.tagName;return t instanceof Array?Boolean(o&&t&&t.some((function(e){return e.toLowerCase()===o.toLowerCase()}))):Boolean(o&&t&&!0===t)}var v=e.createContext(void 0);function y(e){return t.jsx(v.Provider,{value:{addHotkey:e.addHotkey,removeHotkey:e.removeHotkey},children:e.children})}function p(e,t){return e&&t&&"object"==typeof e&&"object"==typeof t?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((function(n,o){return n&&p(e[o],t[o])}),!0):e===t}var k=e.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),m=function(){return e.useContext(k)},h=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},b="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;exports.HotkeysProvider=function(n){var o=n.initiallyActiveScopes,r=void 0===o?["*"]:o,i=n.children,u=e.useState((null==r?void 0:r.length)>0?r:["*"]),c=u[0],a=u[1],l=e.useState([]),s=l[0],d=l[1],f=e.useCallback((function(e){a((function(t){return t.includes("*")?[e]:Array.from(new Set([].concat(t,[e])))}))}),[]),v=e.useCallback((function(e){a((function(t){return 0===t.filter((function(t){return t!==e})).length?["*"]:t.filter((function(t){return t!==e}))}))}),[]),m=e.useCallback((function(e){a((function(t){return t.includes(e)?0===t.filter((function(t){return t!==e})).length?["*"]:t.filter((function(t){return t!==e})):t.includes("*")?[e]:Array.from(new Set([].concat(t,[e])))}))}),[]),h=e.useCallback((function(e){d((function(t){return[].concat(t,[e])}))}),[]),b=e.useCallback((function(e){d((function(t){return t.filter((function(t){return!p(t,e)}))}))}),[]);return t.jsx(k.Provider,{value:{enabledScopes:c,hotkeys:s,enableScope:f,disableScope:v,toggleScope:m},children:t.jsx(y,{addHotkey:h,removeHotkey:b,children:i})})},exports.isHotkeyPressed=l,exports.useHotkeys=function(t,n,o,r){var a=e.useRef(null),y=e.useRef(!1),k=o instanceof Array?r instanceof Array?void 0:r:o,w=o instanceof Array?o:r instanceof Array?r:void 0,g=e.useCallback(n,null!=w?w:[]),C=e.useRef(g);C.current=w?g:n;var L=function(t){var n=e.useRef(void 0);return p(n.current,t)||(n.current=t),n.current}(k),S=m().enabledScopes,E=e.useContext(v);return b((function(){if(!1!==(null==L?void 0:L.enabled)&&(n=null==L?void 0:L.scopes,0===(e=S).length&&n?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),1):!n||e.some((function(e){return n.includes(e)}))||e.includes("*"))){var e,n,o=function(e,n){var o;void 0===n&&(n=!1),(!f(e,["input","textarea","select"])||f(e,null==L?void 0:L.enableOnFormTags))&&(null===a.current||document.activeElement===a.current||a.current.contains(document.activeElement)?(null==(o=e.target)||!o.isContentEditable||null!=L&&L.enableOnContentEditable)&&u(t,null==L?void 0:L.splitKey).forEach((function(t){var o,r=c(t,null==L?void 0:L.combinationKey);if(function(e,t,n){void 0===n&&(n=!1);var o=t.alt,r=t.meta,u=t.mod,c=t.shift,a=t.ctrl,s=t.keys,d=e.key,f=e.ctrlKey,v=e.metaKey,y=e.shiftKey,p=e.altKey,k=i(e.code),m=d.toLowerCase();if(!n){if(o===!p&&"alt"!==m)return!1;if(c===!y&&"shift"!==m)return!1;if(u){if(!v&&!f)return!1}else{if(r===!v&&"meta"!==m&&"os"!==m)return!1;if(a===!f&&"ctrl"!==m&&"control"!==m)return!1}}return!(!s||1!==s.length||!s.includes(m)&&!s.includes(k))||(s?l(s):!s)}(e,r,null==L?void 0:L.ignoreModifiers)||null!=(o=r.keys)&&o.includes("*")){if(n&&y.current)return;if(function(e,t,n){("function"==typeof n&&n(e,t)||!0===n)&&e.preventDefault()}(e,r,null==L?void 0:L.preventDefault),!function(e,t,n){return"function"==typeof n?n(e,t):!0===n||void 0===n}(e,r,null==L?void 0:L.enabled))return void h(e);C.current(e,r),n||(y.current=!0)}})):h(e))},r=function(e){void 0!==e.key&&(s(i(e.code)),(void 0===(null==L?void 0:L.keydown)&&!0!==(null==L?void 0:L.keyup)||null!=L&&L.keydown)&&o(e))},v=function(e){void 0!==e.key&&(d(i(e.code)),y.current=!1,null!=L&&L.keyup&&o(e,!0))},p=a.current||(null==k?void 0:k.document)||document;return p.addEventListener("keyup",v),p.addEventListener("keydown",r),E&&u(t,null==L?void 0:L.splitKey).forEach((function(e){return E.addHotkey(c(e,null==L?void 0:L.combinationKey))})),function(){p.removeEventListener("keyup",v),p.removeEventListener("keydown",r),E&&u(t,null==L?void 0:L.splitKey).forEach((function(e){return E.removeHotkey(c(e,null==L?void 0:L.combinationKey))}))}}}),[t,L,S]),a},exports.useHotkeysContext=m,exports.useRecordHotkeys=function(){var t=e.useState(new Set),n=t[0],o=t[1],r=e.useState(!1),u=r[0],c=r[1],a=e.useCallback((function(e){void 0!==e.key&&(e.preventDefault(),e.stopPropagation(),o((function(t){var n=new Set(t);return n.add(i(e.code)),n})))}),[]),l=e.useCallback((function(){"undefined"!=typeof document&&(document.removeEventListener("keydown",a),c(!1))}),[a]);return[n,{start:e.useCallback((function(){o(new Set),"undefined"!=typeof document&&(l(),document.addEventListener("keydown",a),c(!0))}),[a,l]),stop:l,isRecording:u}]}; | ||
"use strict";var e=require("react"),t=require("react/jsx-runtime");function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}var o=["shift","alt","meta","mod","ctrl"],r={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function i(e){return(r[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function u(e,t){return void 0===t&&(t=","),e.split(t)}function c(e,t){void 0===t&&(t="+");var r=e.toLocaleLowerCase().split(t).map((function(e){return i(e)}));return n({},{alt:r.includes("alt"),ctrl:r.includes("ctrl")||r.includes("control"),shift:r.includes("shift"),meta:r.includes("meta"),mod:r.includes("mod")},{keys:r.filter((function(e){return!o.includes(e)}))})}"undefined"!=typeof document&&(document.addEventListener("keydown",(function(e){void 0!==e.key&&s([i(e.key),i(e.code)])})),document.addEventListener("keyup",(function(e){void 0!==e.key&&d([i(e.key),i(e.code)])}))),"undefined"!=typeof window&&window.addEventListener("blur",(function(){a.clear()}));var a=new Set;function l(e,t){return void 0===t&&(t=","),(Array.isArray(e)?e:e.split(t)).every((function(e){return a.has(e.trim().toLowerCase())}))}function s(e){var t=Array.isArray(e)?e:[e];a.has("meta")&&a.forEach((function(e){return!function(e){return o.includes(e)}(e)&&a.delete(e.toLowerCase())})),t.forEach((function(e){return a.add(e.toLowerCase())}))}function d(e){var t=Array.isArray(e)?e:[e];"meta"===e?a.clear():t.forEach((function(e){return a.delete(e.toLowerCase())}))}function f(e,t){var n=e.target;void 0===t&&(t=!1);var o=n&&n.tagName;return t instanceof Array?Boolean(o&&t&&t.some((function(e){return e.toLowerCase()===o.toLowerCase()}))):Boolean(o&&t&&!0===t)}var v=e.createContext(void 0);function y(e){return t.jsx(v.Provider,{value:{addHotkey:e.addHotkey,removeHotkey:e.removeHotkey},children:e.children})}function p(e,t){return e&&t&&"object"==typeof e&&"object"==typeof t?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce((function(n,o){return n&&p(e[o],t[o])}),!0):e===t}var k=e.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),m=function(){return e.useContext(k)},h=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},b="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;exports.HotkeysProvider=function(n){var o=n.initiallyActiveScopes,r=void 0===o?["*"]:o,i=n.children,u=e.useState((null==r?void 0:r.length)>0?r:["*"]),c=u[0],a=u[1],l=e.useState([]),s=l[0],d=l[1],f=e.useCallback((function(e){a((function(t){return t.includes("*")?[e]:Array.from(new Set([].concat(t,[e])))}))}),[]),v=e.useCallback((function(e){a((function(t){return 0===t.filter((function(t){return t!==e})).length?["*"]:t.filter((function(t){return t!==e}))}))}),[]),m=e.useCallback((function(e){a((function(t){return t.includes(e)?0===t.filter((function(t){return t!==e})).length?["*"]:t.filter((function(t){return t!==e})):t.includes("*")?[e]:Array.from(new Set([].concat(t,[e])))}))}),[]),h=e.useCallback((function(e){d((function(t){return[].concat(t,[e])}))}),[]),b=e.useCallback((function(e){d((function(t){return t.filter((function(t){return!p(t,e)}))}))}),[]);return t.jsx(k.Provider,{value:{enabledScopes:c,hotkeys:s,enableScope:f,disableScope:v,toggleScope:m},children:t.jsx(y,{addHotkey:h,removeHotkey:b,children:i})})},exports.isHotkeyPressed=l,exports.useHotkeys=function(t,n,o,r){var a=e.useRef(null),y=e.useRef(!1),k=o instanceof Array?r instanceof Array?void 0:r:o,w=t instanceof Array?t.join(null==k?void 0:k.splitKey):t,g=o instanceof Array?o:r instanceof Array?r:void 0,C=e.useCallback(n,null!=g?g:[]),L=e.useRef(C);L.current=g?C:n;var S=function(t){var n=e.useRef(void 0);return p(n.current,t)||(n.current=t),n.current}(k),E=m().enabledScopes,A=e.useContext(v);return b((function(){if(!1!==(null==S?void 0:S.enabled)&&(t=null==S?void 0:S.scopes,0===(e=E).length&&t?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),1):!t||e.some((function(e){return t.includes(e)}))||e.includes("*"))){var e,t,n=function(e,t){var n;void 0===t&&(t=!1),(!f(e,["input","textarea","select"])||f(e,null==S?void 0:S.enableOnFormTags))&&(null===a.current||document.activeElement===a.current||a.current.contains(document.activeElement)?(null==(n=e.target)||!n.isContentEditable||null!=S&&S.enableOnContentEditable)&&u(w,null==S?void 0:S.splitKey).forEach((function(n){var o,r=c(n,null==S?void 0:S.combinationKey);if(function(e,t,n){void 0===n&&(n=!1);var o=t.alt,r=t.meta,u=t.mod,c=t.shift,a=t.ctrl,s=t.keys,d=e.key,f=e.ctrlKey,v=e.metaKey,y=e.shiftKey,p=e.altKey,k=i(e.code),m=d.toLowerCase();if(!n){if(o===!p&&"alt"!==m)return!1;if(c===!y&&"shift"!==m)return!1;if(u){if(!v&&!f)return!1}else{if(r===!v&&"meta"!==m&&"os"!==m)return!1;if(a===!f&&"ctrl"!==m&&"control"!==m)return!1}}return!(!s||1!==s.length||!s.includes(m)&&!s.includes(k))||(s?l(s):!s)}(e,r,null==S?void 0:S.ignoreModifiers)||null!=(o=r.keys)&&o.includes("*")){if(t&&y.current)return;if(function(e,t,n){("function"==typeof n&&n(e,t)||!0===n)&&e.preventDefault()}(e,r,null==S?void 0:S.preventDefault),!function(e,t,n){return"function"==typeof n?n(e,t):!0===n||void 0===n}(e,r,null==S?void 0:S.enabled))return void h(e);L.current(e,r),t||(y.current=!0)}})):h(e))},o=function(e){void 0!==e.key&&(s(i(e.code)),(void 0===(null==S?void 0:S.keydown)&&!0!==(null==S?void 0:S.keyup)||null!=S&&S.keydown)&&n(e))},r=function(e){void 0!==e.key&&(d(i(e.code)),y.current=!1,null!=S&&S.keyup&&n(e,!0))},v=a.current||(null==k?void 0:k.document)||document;return v.addEventListener("keyup",r),v.addEventListener("keydown",o),A&&u(w,null==S?void 0:S.splitKey).forEach((function(e){return A.addHotkey(c(e,null==S?void 0:S.combinationKey))})),function(){v.removeEventListener("keyup",r),v.removeEventListener("keydown",o),A&&u(w,null==S?void 0:S.splitKey).forEach((function(e){return A.removeHotkey(c(e,null==S?void 0:S.combinationKey))}))}}}),[w,S,E]),a},exports.useHotkeysContext=m,exports.useRecordHotkeys=function(){var t=e.useState(new Set),n=t[0],o=t[1],r=e.useState(!1),u=r[0],c=r[1],a=e.useCallback((function(e){void 0!==e.key&&(e.preventDefault(),e.stopPropagation(),o((function(t){var n=new Set(t);return n.add(i(e.code)),n})))}),[]),l=e.useCallback((function(){"undefined"!=typeof document&&(document.removeEventListener("keydown",a),c(!1))}),[a]);return[n,{start:e.useCallback((function(){o(new Set),"undefined"!=typeof document&&(l(),document.addEventListener("keydown",a),c(!0))}),[a,l]),stop:l,isRecording:u}]}; | ||
//# sourceMappingURL=react-hotkeys-hook.cjs.production.min.js.map |
@@ -51,6 +51,3 @@ import { useContext, createContext, useState, useCallback, useRef, useLayoutEffect, useEffect } from 'react'; | ||
} | ||
if (typeof keys === 'string') { | ||
return keys.split(splitKey); | ||
} | ||
return keys; | ||
return keys.split(splitKey); | ||
} | ||
@@ -371,2 +368,3 @@ function parseHotkey(hotkey, combinationKey) { | ||
var _options = !(options instanceof Array) ? options : !(dependencies instanceof Array) ? dependencies : undefined; | ||
var _keys = keys instanceof Array ? keys.join(_options == null ? void 0 : _options.splitKey) : keys; | ||
var _deps = options instanceof Array ? options : dependencies instanceof Array ? dependencies : undefined; | ||
@@ -405,3 +403,3 @@ var memoisedCB = useCallback(callback, _deps != null ? _deps : []); | ||
} | ||
parseKeysHookInput(keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
var _hotkey$keys; | ||
@@ -453,3 +451,3 @@ var hotkey = parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey); | ||
if (proxy) { | ||
parseKeysHookInput(keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
return proxy.addHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey)); | ||
@@ -464,3 +462,3 @@ }); | ||
if (proxy) { | ||
parseKeysHookInput(keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
parseKeysHookInput(_keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) { | ||
return proxy.removeHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey)); | ||
@@ -470,3 +468,3 @@ }); | ||
}; | ||
}, [keys, memoisedOptions, enabledScopes]); | ||
}, [_keys, memoisedOptions, enabledScopes]); | ||
return ref; | ||
@@ -473,0 +471,0 @@ } |
{ | ||
"name": "react-hotkeys-hook", | ||
"description": "React hook for handling keyboard shortcuts", | ||
"version": "4.3.7", | ||
"version": "4.3.8", | ||
"repository": "https://JohannesKlauss@github.com/JohannesKlauss/react-keymap-hook.git", | ||
@@ -91,9 +91,9 @@ "homepage": "https://johannesklauss.github.io/react-hotkeys-hook/", | ||
"@types/react-dom": "18.0.11", | ||
"@typescript-eslint/eslint-plugin": "5.53.0", | ||
"@typescript-eslint/parser": "5.53.0", | ||
"@typescript-eslint/eslint-plugin": "5.54.1", | ||
"@typescript-eslint/parser": "5.54.1", | ||
"eslint": "^8.34.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"eslint-plugin-react": "^7.32.2", | ||
"jest": "29.4.3", | ||
"jest-environment-jsdom": "29.4.3", | ||
"jest": "29.5.0", | ||
"jest-environment-jsdom": "29.5.0", | ||
"prettier": "2.8.4", | ||
@@ -100,0 +100,0 @@ "react": "18.2.0", |
@@ -38,8 +38,4 @@ import { Hotkey, KeyboardModifiers, Keys } from './types' | ||
export function parseKeysHookInput(keys: Keys, splitKey = ','): string[] { | ||
if (typeof keys === 'string') { | ||
return keys.split(splitKey) | ||
} | ||
return keys | ||
export function parseKeysHookInput(keys: string, splitKey: string = ','): string[] { | ||
return keys.split(splitKey) | ||
} | ||
@@ -46,0 +42,0 @@ |
@@ -39,2 +39,3 @@ import { HotkeyCallback, Keys, Options, OptionsOrDependencyArray, RefType } from './types' | ||
: undefined | ||
const _keys: string = keys instanceof Array ? keys.join(_options?.splitKey) : keys | ||
const _deps: DependencyList | undefined = | ||
@@ -83,3 +84,3 @@ options instanceof Array ? options : dependencies instanceof Array ? dependencies : undefined | ||
parseKeysHookInput(keys, memoisedOptions?.splitKey).forEach((key) => { | ||
parseKeysHookInput(_keys, memoisedOptions?.splitKey).forEach((key) => { | ||
const hotkey = parseHotkey(key, memoisedOptions?.combinationKey) | ||
@@ -146,3 +147,3 @@ | ||
if (proxy) { | ||
parseKeysHookInput(keys, memoisedOptions?.splitKey).forEach((key) => | ||
parseKeysHookInput(_keys, memoisedOptions?.splitKey).forEach((key) => | ||
proxy.addHotkey(parseHotkey(key, memoisedOptions?.combinationKey)) | ||
@@ -159,3 +160,3 @@ ) | ||
if (proxy) { | ||
parseKeysHookInput(keys, memoisedOptions?.splitKey).forEach((key) => | ||
parseKeysHookInput(_keys, memoisedOptions?.splitKey).forEach((key) => | ||
proxy.removeHotkey(parseHotkey(key, memoisedOptions?.combinationKey)) | ||
@@ -165,5 +166,5 @@ ) | ||
} | ||
}, [keys, memoisedOptions, enabledScopes]) | ||
}, [_keys, memoisedOptions, enabledScopes]) | ||
return ref | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
188830
1642