react-hotkeys-hook 4.0.4-0 → 4.0.4-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
- import { ReactNode } from 'react';
2
- import { Hotkey } from './types';
3
- declare type BoundHotkeysProxyProviderType = {
4
- addHotkey: (hotkey: Hotkey) => void;
5
- removeHotkey: (hotkey: Hotkey) => void;
6
- };
7
- export declare const useBoundHotkeysProxy: () => BoundHotkeysProxyProviderType | undefined;
8
- interface Props {
9
- children: ReactNode;
10
- addHotkey: (hotkey: Hotkey) => void;
11
- removeHotkey: (hotkey: Hotkey) => void;
12
- }
13
- export default function BoundHotkeysProxyProviderProvider({ addHotkey, removeHotkey, children }: Props): JSX.Element;
14
- export {};
1
+ import { ReactNode } from 'react';
2
+ import { Hotkey } from './types';
3
+ declare type BoundHotkeysProxyProviderType = {
4
+ addHotkey: (hotkey: Hotkey) => void;
5
+ removeHotkey: (hotkey: Hotkey) => void;
6
+ };
7
+ export declare const useBoundHotkeysProxy: () => BoundHotkeysProxyProviderType | undefined;
8
+ interface Props {
9
+ children: ReactNode;
10
+ addHotkey: (hotkey: Hotkey) => void;
11
+ removeHotkey: (hotkey: Hotkey) => void;
12
+ }
13
+ export default function BoundHotkeysProxyProviderProvider({ addHotkey, removeHotkey, children }: Props): JSX.Element;
14
+ export {};
@@ -1,16 +1,16 @@
1
- import { Hotkey } from './types';
2
- import { ReactNode } from 'react';
3
- export declare type HotkeysContextType = {
4
- hotkeys: ReadonlyArray<Hotkey>;
5
- enabledScopes: string[];
6
- toggleScope: (scope: string) => void;
7
- enableScope: (scope: string) => void;
8
- disableScope: (scope: string) => void;
9
- };
10
- export declare const useHotkeysContext: () => HotkeysContextType;
11
- interface Props {
12
- initiallyActiveScopes?: string[];
13
- children: ReactNode;
14
- }
15
- export declare const HotkeysProvider: ({ initiallyActiveScopes, children }: Props) => JSX.Element;
16
- export {};
1
+ import { Hotkey } from './types';
2
+ import { ReactNode } from 'react';
3
+ export declare type HotkeysContextType = {
4
+ hotkeys: ReadonlyArray<Hotkey>;
5
+ enabledScopes: string[];
6
+ toggleScope: (scope: string) => void;
7
+ enableScope: (scope: string) => void;
8
+ disableScope: (scope: string) => void;
9
+ };
10
+ export declare const useHotkeysContext: () => HotkeysContextType;
11
+ interface Props {
12
+ initiallyActiveScopes?: string[];
13
+ children: ReactNode;
14
+ }
15
+ export declare const HotkeysProvider: ({ initiallyActiveScopes, children }: Props) => JSX.Element;
16
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import useHotkeys from './useHotkeys';
2
- import type { Options } from './types';
3
- import { HotkeysProvider, useHotkeysContext } from './HotkeysProvider';
4
- import { isHotkeyPressed } from './isHotkeyPressed';
5
- export { useHotkeys, useHotkeysContext, isHotkeyPressed, HotkeysProvider, Options, };
1
+ import useHotkeys from './useHotkeys';
2
+ import type { Options } from './types';
3
+ import { HotkeysProvider, useHotkeysContext } from './HotkeysProvider';
4
+ import { isHotkeyPressed } from './isHotkeyPressed';
5
+ export { useHotkeys, useHotkeysContext, isHotkeyPressed, HotkeysProvider, Options, };
package/dist/index.js CHANGED
@@ -1,2 +1,8 @@
1
- "use strict";var Kn=Object.create;var $=Object.defineProperty;var In=Object.getOwnPropertyDescriptor;var Mn=Object.getOwnPropertyNames;var Dn=Object.getPrototypeOf,Rn=Object.prototype.hasOwnProperty;var n=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Bn=(e,r)=>{for(var t in r)$(e,t,{get:r[t],enumerable:!0})},ze=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Mn(r))!Rn.call(e,i)&&i!==t&&$(e,i,{get:()=>r[i],enumerable:!(o=In(r,i))||o.enumerable});return e};var $e=(e,r,t)=>(t=e!=null?Kn(Dn(e)):{},ze(r||!e||!e.__esModule?$(t,"default",{value:e,enumerable:!0}):t,e)),Gn=e=>ze($({},"__esModule",{value:!0}),e);var or=n((qc,tr)=>{function Un(){this.__data__=[],this.size=0}tr.exports=Un});var qe=n((Ac,nr)=>{function zn(e,r){return e===r||e!==e&&r!==r}nr.exports=zn});var L=n((Tc,ar)=>{var $n=qe();function Wn(e,r){for(var t=e.length;t--;)if($n(e[t][0],r))return t;return-1}ar.exports=Wn});var sr=n((wc,ir)=>{var Jn=L(),Xn=Array.prototype,Yn=Xn.splice;function Zn(e){var r=this.__data__,t=Jn(r,e);if(t<0)return!1;var o=r.length-1;return t==o?r.pop():Yn.call(r,t,1),--this.size,!0}ir.exports=Zn});var pr=n((Pc,ur)=>{var Qn=L();function Vn(e){var r=this.__data__,t=Qn(r,e);return t<0?void 0:r[t][1]}ur.exports=Vn});var fr=n((Hc,cr)=>{var ea=L();function ra(e){return ea(this.__data__,e)>-1}cr.exports=ra});var lr=n((Sc,yr)=>{var ta=L();function oa(e,r){var t=this.__data__,o=ta(t,e);return o<0?(++this.size,t.push([e,r])):t[o][1]=r,this}yr.exports=oa});var K=n((Oc,dr)=>{var na=or(),aa=sr(),ia=pr(),sa=fr(),ua=lr();function H(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var o=e[r];this.set(o[0],o[1])}}H.prototype.clear=na;H.prototype.delete=aa;H.prototype.get=ia;H.prototype.has=sa;H.prototype.set=ua;dr.exports=H});var gr=n((Cc,vr)=>{var pa=K();function ca(){this.__data__=new pa,this.size=0}vr.exports=ca});var br=n((Ec,hr)=>{function fa(e){var r=this.__data__,t=r.delete(e);return this.size=r.size,t}hr.exports=fa});var mr=n((kc,xr)=>{function ya(e){return this.__data__.get(e)}xr.exports=ya});var qr=n((jc,_r)=>{function la(e){return this.__data__.has(e)}_r.exports=la});var Ae=n((Lc,Ar)=>{var da=typeof global=="object"&&global&&global.Object===Object&&global;Ar.exports=da});var m=n((Kc,Tr)=>{var va=Ae(),ga=typeof self=="object"&&self&&self.Object===Object&&self,ha=va||ga||Function("return this")();Tr.exports=ha});var Y=n((Ic,wr)=>{var ba=m(),xa=ba.Symbol;wr.exports=xa});var Or=n((Mc,Sr)=>{var Pr=Y(),Hr=Object.prototype,ma=Hr.hasOwnProperty,_a=Hr.toString,I=Pr?Pr.toStringTag:void 0;function qa(e){var r=ma.call(e,I),t=e[I];try{e[I]=void 0;var o=!0}catch{}var i=_a.call(e);return o&&(r?e[I]=t:delete e[I]),i}Sr.exports=qa});var Er=n((Dc,Cr)=>{var Aa=Object.prototype,Ta=Aa.toString;function wa(e){return Ta.call(e)}Cr.exports=wa});var M=n((Rc,Lr)=>{var kr=Y(),Pa=Or(),Ha=Er(),Sa="[object Null]",Oa="[object Undefined]",jr=kr?kr.toStringTag:void 0;function Ca(e){return e==null?e===void 0?Oa:Sa:jr&&jr in Object(e)?Pa(e):Ha(e)}Lr.exports=Ca});var Te=n((Bc,Kr)=>{function Ea(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}Kr.exports=Ea});var we=n((Gc,Ir)=>{var ka=M(),ja=Te(),La="[object AsyncFunction]",Ka="[object Function]",Ia="[object GeneratorFunction]",Ma="[object Proxy]";function Da(e){if(!ja(e))return!1;var r=ka(e);return r==Ka||r==Ia||r==La||r==Ma}Ir.exports=Da});var Dr=n((Nc,Mr)=>{var Ra=m(),Ba=Ra["__core-js_shared__"];Mr.exports=Ba});var Gr=n((Fc,Br)=>{var Pe=Dr(),Rr=function(){var e=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Ga(e){return!!Rr&&Rr in e}Br.exports=Ga});var He=n((Uc,Nr)=>{var Na=Function.prototype,Fa=Na.toString;function Ua(e){if(e!=null){try{return Fa.call(e)}catch{}try{return e+""}catch{}}return""}Nr.exports=Ua});var Ur=n((zc,Fr)=>{var za=we(),$a=Gr(),Wa=Te(),Ja=He(),Xa=/[\\^$.*+?()[\]{}|]/g,Ya=/^\[object .+?Constructor\]$/,Za=Function.prototype,Qa=Object.prototype,Va=Za.toString,ei=Qa.hasOwnProperty,ri=RegExp("^"+Va.call(ei).replace(Xa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ti(e){if(!Wa(e)||$a(e))return!1;var r=za(e)?ri:Ya;return r.test(Ja(e))}Fr.exports=ti});var $r=n(($c,zr)=>{function oi(e,r){return e?.[r]}zr.exports=oi});var T=n((Wc,Wr)=>{var ni=Ur(),ai=$r();function ii(e,r){var t=ai(e,r);return ni(t)?t:void 0}Wr.exports=ii});var Z=n((Jc,Jr)=>{var si=T(),ui=m(),pi=si(ui,"Map");Jr.exports=pi});var D=n((Xc,Xr)=>{var ci=T(),fi=ci(Object,"create");Xr.exports=fi});var Qr=n((Yc,Zr)=>{var Yr=D();function yi(){this.__data__=Yr?Yr(null):{},this.size=0}Zr.exports=yi});var et=n((Zc,Vr)=>{function li(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}Vr.exports=li});var tt=n((Qc,rt)=>{var di=D(),vi="__lodash_hash_undefined__",gi=Object.prototype,hi=gi.hasOwnProperty;function bi(e){var r=this.__data__;if(di){var t=r[e];return t===vi?void 0:t}return hi.call(r,e)?r[e]:void 0}rt.exports=bi});var nt=n((Vc,ot)=>{var xi=D(),mi=Object.prototype,_i=mi.hasOwnProperty;function qi(e){var r=this.__data__;return xi?r[e]!==void 0:_i.call(r,e)}ot.exports=qi});var it=n((ef,at)=>{var Ai=D(),Ti="__lodash_hash_undefined__";function wi(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=Ai&&r===void 0?Ti:r,this}at.exports=wi});var ut=n((rf,st)=>{var Pi=Qr(),Hi=et(),Si=tt(),Oi=nt(),Ci=it();function S(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var o=e[r];this.set(o[0],o[1])}}S.prototype.clear=Pi;S.prototype.delete=Hi;S.prototype.get=Si;S.prototype.has=Oi;S.prototype.set=Ci;st.exports=S});var ft=n((tf,ct)=>{var pt=ut(),Ei=K(),ki=Z();function ji(){this.size=0,this.__data__={hash:new pt,map:new(ki||Ei),string:new pt}}ct.exports=ji});var lt=n((of,yt)=>{function Li(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}yt.exports=Li});var R=n((nf,dt)=>{var Ki=lt();function Ii(e,r){var t=e.__data__;return Ki(r)?t[typeof r=="string"?"string":"hash"]:t.map}dt.exports=Ii});var gt=n((af,vt)=>{var Mi=R();function Di(e){var r=Mi(this,e).delete(e);return this.size-=r?1:0,r}vt.exports=Di});var bt=n((sf,ht)=>{var Ri=R();function Bi(e){return Ri(this,e).get(e)}ht.exports=Bi});var mt=n((uf,xt)=>{var Gi=R();function Ni(e){return Gi(this,e).has(e)}xt.exports=Ni});var qt=n((pf,_t)=>{var Fi=R();function Ui(e,r){var t=Fi(this,e),o=t.size;return t.set(e,r),this.size+=t.size==o?0:1,this}_t.exports=Ui});var Se=n((cf,At)=>{var zi=ft(),$i=gt(),Wi=bt(),Ji=mt(),Xi=qt();function O(e){var r=-1,t=e==null?0:e.length;for(this.clear();++r<t;){var o=e[r];this.set(o[0],o[1])}}O.prototype.clear=zi;O.prototype.delete=$i;O.prototype.get=Wi;O.prototype.has=Ji;O.prototype.set=Xi;At.exports=O});var wt=n((ff,Tt)=>{var Yi=K(),Zi=Z(),Qi=Se(),Vi=200;function es(e,r){var t=this.__data__;if(t instanceof Yi){var o=t.__data__;if(!Zi||o.length<Vi-1)return o.push([e,r]),this.size=++t.size,this;t=this.__data__=new Qi(o)}return t.set(e,r),this.size=t.size,this}Tt.exports=es});var Ht=n((yf,Pt)=>{var rs=K(),ts=gr(),os=br(),ns=mr(),as=qr(),is=wt();function C(e){var r=this.__data__=new rs(e);this.size=r.size}C.prototype.clear=ts;C.prototype.delete=os;C.prototype.get=ns;C.prototype.has=as;C.prototype.set=is;Pt.exports=C});var Ot=n((lf,St)=>{var ss="__lodash_hash_undefined__";function us(e){return this.__data__.set(e,ss),this}St.exports=us});var Et=n((df,Ct)=>{function ps(e){return this.__data__.has(e)}Ct.exports=ps});var jt=n((vf,kt)=>{var cs=Se(),fs=Ot(),ys=Et();function Q(e){var r=-1,t=e==null?0:e.length;for(this.__data__=new cs;++r<t;)this.add(e[r])}Q.prototype.add=Q.prototype.push=fs;Q.prototype.has=ys;kt.exports=Q});var Kt=n((gf,Lt)=>{function ls(e,r){for(var t=-1,o=e==null?0:e.length;++t<o;)if(r(e[t],t,e))return!0;return!1}Lt.exports=ls});var Mt=n((hf,It)=>{function ds(e,r){return e.has(r)}It.exports=ds});var Oe=n((bf,Dt)=>{var vs=jt(),gs=Kt(),hs=Mt(),bs=1,xs=2;function ms(e,r,t,o,i,a){var f=t&bs,y=e.length,c=r.length;if(y!=c&&!(f&&c>y))return!1;var s=a.get(e),h=a.get(r);if(s&&h)return s==r&&h==e;var d=-1,p=!0,v=t&xs?new vs:void 0;for(a.set(e,r),a.set(r,e);++d<y;){var g=e[d],u=r[d];if(o)var x=f?o(u,g,d,r,e,a):o(g,u,d,e,r,a);if(x!==void 0){if(x)continue;p=!1;break}if(v){if(!gs(r,function(b,A){if(!hs(v,A)&&(g===b||i(g,b,t,o,a)))return v.push(A)})){p=!1;break}}else if(!(g===u||i(g,u,t,o,a))){p=!1;break}}return a.delete(e),a.delete(r),p}Dt.exports=ms});var Bt=n((xf,Rt)=>{var _s=m(),qs=_s.Uint8Array;Rt.exports=qs});var Nt=n((mf,Gt)=>{function As(e){var r=-1,t=Array(e.size);return e.forEach(function(o,i){t[++r]=[i,o]}),t}Gt.exports=As});var Ut=n((_f,Ft)=>{function Ts(e){var r=-1,t=Array(e.size);return e.forEach(function(o){t[++r]=o}),t}Ft.exports=Ts});var Xt=n((qf,Jt)=>{var zt=Y(),$t=Bt(),ws=qe(),Ps=Oe(),Hs=Nt(),Ss=Ut(),Os=1,Cs=2,Es="[object Boolean]",ks="[object Date]",js="[object Error]",Ls="[object Map]",Ks="[object Number]",Is="[object RegExp]",Ms="[object Set]",Ds="[object String]",Rs="[object Symbol]",Bs="[object ArrayBuffer]",Gs="[object DataView]",Wt=zt?zt.prototype:void 0,Ce=Wt?Wt.valueOf:void 0;function Ns(e,r,t,o,i,a,f){switch(t){case Gs:if(e.byteLength!=r.byteLength||e.byteOffset!=r.byteOffset)return!1;e=e.buffer,r=r.buffer;case Bs:return!(e.byteLength!=r.byteLength||!a(new $t(e),new $t(r)));case Es:case ks:case Ks:return ws(+e,+r);case js:return e.name==r.name&&e.message==r.message;case Is:case Ds:return e==r+"";case Ls:var y=Hs;case Ms:var c=o&Os;if(y||(y=Ss),e.size!=r.size&&!c)return!1;var s=f.get(e);if(s)return s==r;o|=Cs,f.set(e,r);var h=Ps(y(e),y(r),o,i,a,f);return f.delete(e),h;case Rs:if(Ce)return Ce.call(e)==Ce.call(r)}return!1}Jt.exports=Ns});var Zt=n((Af,Yt)=>{function Fs(e,r){for(var t=-1,o=r.length,i=e.length;++t<o;)e[i+t]=r[t];return e}Yt.exports=Fs});var V=n((Tf,Qt)=>{var Us=Array.isArray;Qt.exports=Us});var eo=n((wf,Vt)=>{var zs=Zt(),$s=V();function Ws(e,r,t){var o=r(e);return $s(e)?o:zs(o,t(e))}Vt.exports=Ws});var to=n((Pf,ro)=>{function Js(e,r){for(var t=-1,o=e==null?0:e.length,i=0,a=[];++t<o;){var f=e[t];r(f,t,e)&&(a[i++]=f)}return a}ro.exports=Js});var no=n((Hf,oo)=>{function Xs(){return[]}oo.exports=Xs});var so=n((Sf,io)=>{var Ys=to(),Zs=no(),Qs=Object.prototype,Vs=Qs.propertyIsEnumerable,ao=Object.getOwnPropertySymbols,eu=ao?function(e){return e==null?[]:(e=Object(e),Ys(ao(e),function(r){return Vs.call(e,r)}))}:Zs;io.exports=eu});var po=n((Of,uo)=>{function ru(e,r){for(var t=-1,o=Array(e);++t<e;)o[t]=r(t);return o}uo.exports=ru});var B=n((Cf,co)=>{function tu(e){return e!=null&&typeof e=="object"}co.exports=tu});var yo=n((Ef,fo)=>{var ou=M(),nu=B(),au="[object Arguments]";function iu(e){return nu(e)&&ou(e)==au}fo.exports=iu});var ho=n((kf,go)=>{var lo=yo(),su=B(),vo=Object.prototype,uu=vo.hasOwnProperty,pu=vo.propertyIsEnumerable,cu=lo(function(){return arguments}())?lo:function(e){return su(e)&&uu.call(e,"callee")&&!pu.call(e,"callee")};go.exports=cu});var xo=n((jf,bo)=>{function fu(){return!1}bo.exports=fu});var Ee=n((G,E)=>{var yu=m(),lu=xo(),qo=typeof G=="object"&&G&&!G.nodeType&&G,mo=qo&&typeof E=="object"&&E&&!E.nodeType&&E,du=mo&&mo.exports===qo,_o=du?yu.Buffer:void 0,vu=_o?_o.isBuffer:void 0,gu=vu||lu;E.exports=gu});var To=n((Lf,Ao)=>{var hu=9007199254740991,bu=/^(?:0|[1-9]\d*)$/;function xu(e,r){var t=typeof e;return r=r??hu,!!r&&(t=="number"||t!="symbol"&&bu.test(e))&&e>-1&&e%1==0&&e<r}Ao.exports=xu});var ke=n((Kf,wo)=>{var mu=9007199254740991;function _u(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=mu}wo.exports=_u});var Ho=n((If,Po)=>{var qu=M(),Au=ke(),Tu=B(),wu="[object Arguments]",Pu="[object Array]",Hu="[object Boolean]",Su="[object Date]",Ou="[object Error]",Cu="[object Function]",Eu="[object Map]",ku="[object Number]",ju="[object Object]",Lu="[object RegExp]",Ku="[object Set]",Iu="[object String]",Mu="[object WeakMap]",Du="[object ArrayBuffer]",Ru="[object DataView]",Bu="[object Float32Array]",Gu="[object Float64Array]",Nu="[object Int8Array]",Fu="[object Int16Array]",Uu="[object Int32Array]",zu="[object Uint8Array]",$u="[object Uint8ClampedArray]",Wu="[object Uint16Array]",Ju="[object Uint32Array]",l={};l[Bu]=l[Gu]=l[Nu]=l[Fu]=l[Uu]=l[zu]=l[$u]=l[Wu]=l[Ju]=!0;l[wu]=l[Pu]=l[Du]=l[Hu]=l[Ru]=l[Su]=l[Ou]=l[Cu]=l[Eu]=l[ku]=l[ju]=l[Lu]=l[Ku]=l[Iu]=l[Mu]=!1;function Xu(e){return Tu(e)&&Au(e.length)&&!!l[qu(e)]}Po.exports=Xu});var Oo=n((Mf,So)=>{function Yu(e){return function(r){return e(r)}}So.exports=Yu});var Eo=n((N,k)=>{var Zu=Ae(),Co=typeof N=="object"&&N&&!N.nodeType&&N,F=Co&&typeof k=="object"&&k&&!k.nodeType&&k,Qu=F&&F.exports===Co,je=Qu&&Zu.process,Vu=function(){try{var e=F&&F.require&&F.require("util").types;return e||je&&je.binding&&je.binding("util")}catch{}}();k.exports=Vu});var Le=n((Df,Lo)=>{var ep=Ho(),rp=Oo(),ko=Eo(),jo=ko&&ko.isTypedArray,tp=jo?rp(jo):ep;Lo.exports=tp});var Io=n((Rf,Ko)=>{var op=po(),np=ho(),ap=V(),ip=Ee(),sp=To(),up=Le(),pp=Object.prototype,cp=pp.hasOwnProperty;function fp(e,r){var t=ap(e),o=!t&&np(e),i=!t&&!o&&ip(e),a=!t&&!o&&!i&&up(e),f=t||o||i||a,y=f?op(e.length,String):[],c=y.length;for(var s in e)(r||cp.call(e,s))&&!(f&&(s=="length"||i&&(s=="offset"||s=="parent")||a&&(s=="buffer"||s=="byteLength"||s=="byteOffset")||sp(s,c)))&&y.push(s);return y}Ko.exports=fp});var Do=n((Bf,Mo)=>{var yp=Object.prototype;function lp(e){var r=e&&e.constructor,t=typeof r=="function"&&r.prototype||yp;return e===t}Mo.exports=lp});var Bo=n((Gf,Ro)=>{function dp(e,r){return function(t){return e(r(t))}}Ro.exports=dp});var No=n((Nf,Go)=>{var vp=Bo(),gp=vp(Object.keys,Object);Go.exports=gp});var Uo=n((Ff,Fo)=>{var hp=Do(),bp=No(),xp=Object.prototype,mp=xp.hasOwnProperty;function _p(e){if(!hp(e))return bp(e);var r=[];for(var t in Object(e))mp.call(e,t)&&t!="constructor"&&r.push(t);return r}Fo.exports=_p});var $o=n((Uf,zo)=>{var qp=we(),Ap=ke();function Tp(e){return e!=null&&Ap(e.length)&&!qp(e)}zo.exports=Tp});var Jo=n((zf,Wo)=>{var wp=Io(),Pp=Uo(),Hp=$o();function Sp(e){return Hp(e)?wp(e):Pp(e)}Wo.exports=Sp});var Yo=n(($f,Xo)=>{var Op=eo(),Cp=so(),Ep=Jo();function kp(e){return Op(e,Ep,Cp)}Xo.exports=kp});var Vo=n((Wf,Qo)=>{var Zo=Yo(),jp=1,Lp=Object.prototype,Kp=Lp.hasOwnProperty;function Ip(e,r,t,o,i,a){var f=t&jp,y=Zo(e),c=y.length,s=Zo(r),h=s.length;if(c!=h&&!f)return!1;for(var d=c;d--;){var p=y[d];if(!(f?p in r:Kp.call(r,p)))return!1}var v=a.get(e),g=a.get(r);if(v&&g)return v==r&&g==e;var u=!0;a.set(e,r),a.set(r,e);for(var x=f;++d<c;){p=y[d];var b=e[p],A=r[p];if(o)var Ue=f?o(A,b,p,r,e,a):o(b,A,p,e,r,a);if(!(Ue===void 0?b===A||i(b,A,t,o,a):Ue)){u=!1;break}x||(x=p=="constructor")}if(u&&!x){var U=e.constructor,z=r.constructor;U!=z&&"constructor"in e&&"constructor"in r&&!(typeof U=="function"&&U instanceof U&&typeof z=="function"&&z instanceof z)&&(u=!1)}return a.delete(e),a.delete(r),u}Qo.exports=Ip});var rn=n((Jf,en)=>{var Mp=T(),Dp=m(),Rp=Mp(Dp,"DataView");en.exports=Rp});var on=n((Xf,tn)=>{var Bp=T(),Gp=m(),Np=Bp(Gp,"Promise");tn.exports=Np});var an=n((Yf,nn)=>{var Fp=T(),Up=m(),zp=Fp(Up,"Set");nn.exports=zp});var un=n((Zf,sn)=>{var $p=T(),Wp=m(),Jp=$p(Wp,"WeakMap");sn.exports=Jp});var gn=n((Qf,vn)=>{var Ke=rn(),Ie=Z(),Me=on(),De=an(),Re=un(),dn=M(),j=He(),pn="[object Map]",Xp="[object Object]",cn="[object Promise]",fn="[object Set]",yn="[object WeakMap]",ln="[object DataView]",Yp=j(Ke),Zp=j(Ie),Qp=j(Me),Vp=j(De),ec=j(Re),w=dn;(Ke&&w(new Ke(new ArrayBuffer(1)))!=ln||Ie&&w(new Ie)!=pn||Me&&w(Me.resolve())!=cn||De&&w(new De)!=fn||Re&&w(new Re)!=yn)&&(w=function(e){var r=dn(e),t=r==Xp?e.constructor:void 0,o=t?j(t):"";if(o)switch(o){case Yp:return ln;case Zp:return pn;case Qp:return cn;case Vp:return fn;case ec:return yn}return r});vn.exports=w});var Tn=n((Vf,An)=>{var Be=Ht(),rc=Oe(),tc=Xt(),oc=Vo(),hn=gn(),bn=V(),xn=Ee(),nc=Le(),ac=1,mn="[object Arguments]",_n="[object Array]",ee="[object Object]",ic=Object.prototype,qn=ic.hasOwnProperty;function sc(e,r,t,o,i,a){var f=bn(e),y=bn(r),c=f?_n:hn(e),s=y?_n:hn(r);c=c==mn?ee:c,s=s==mn?ee:s;var h=c==ee,d=s==ee,p=c==s;if(p&&xn(e)){if(!xn(r))return!1;f=!0,h=!1}if(p&&!h)return a||(a=new Be),f||nc(e)?rc(e,r,t,o,i,a):tc(e,r,c,t,o,i,a);if(!(t&ac)){var v=h&&qn.call(e,"__wrapped__"),g=d&&qn.call(r,"__wrapped__");if(v||g){var u=v?e.value():e,x=g?r.value():r;return a||(a=new Be),i(u,x,t,o,a)}}return p?(a||(a=new Be),oc(e,r,t,o,i,a)):!1}An.exports=sc});var Sn=n((ey,Hn)=>{var uc=Tn(),wn=B();function Pn(e,r,t,o,i){return e===r?!0:e==null||r==null||!wn(e)&&!wn(r)?e!==e&&r!==r:uc(e,r,t,o,Pn,i)}Hn.exports=Pn});var Ge=n((ry,On)=>{var pc=Sn();function cc(e,r){return pc(e,r)}On.exports=cc});var lc={};Bn(lc,{HotkeysProvider:()=>rr,isHotkeyPressed:()=>Ln,useHotkeys:()=>Fe,useHotkeysContext:()=>X});module.exports=Gn(lc);var P=require("react");var Nn=["ctrl","shift","alt","meta","mod"],Fn={esc:"escape",return:"enter",left:"arrowleft",up:"arrowup",right:"arrowright",down:"arrowdown"};function W(e,r=","){return typeof e=="string"?e.split(r):e}function q(e,r="+"){let t=e.toLocaleLowerCase().split(r).map(a=>a.trim()).map(a=>Fn[a]||a),o={alt:t.includes("alt"),ctrl:t.includes("ctrl"),shift:t.includes("shift"),meta:t.includes("meta"),mod:t.includes("mod")},i=t.filter(a=>!Nn.includes(a));return{...o,keys:i}}function We(e,r,t){(typeof t=="function"&&t(e,r)||t===!0)&&e.preventDefault()}function Je(e,r,t){return typeof t=="function"?t(e,r):t===!0||t===void 0}function Xe(e){return te(e,["input","textarea","select"])}function te({target:e},r=!1){let t=e&&e.tagName;return r instanceof Array?Boolean(t&&r&&r.some(o=>o.toLowerCase()===t.toLowerCase())):Boolean(t&&r&&r===!0)}function Ye(e,r){return e.length===0&&r?(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>'),!0):r?e.some(t=>r.includes(t))||e.includes("*"):!0}var Ze=(e,r,t)=>{let{alt:o,ctrl:i,meta:a,mod:f,shift:y,keys:c}=r,{altKey:s,ctrlKey:h,metaKey:d,shiftKey:p,key:v,code:g}=e,u=g.toLowerCase().replace("key",""),x=v.toLowerCase();if(s!==o&&x!=="alt"||p!==y&&x!=="shift")return!1;if(f){if(!d&&!h)return!1}else if(d!==a&&u!=="meta"||h!==i&&u!=="ctrl")return!1;return c&&c.length===1&&(c.includes(x)||c.includes(u))?!0:c?c.every(b=>t.has(b)):!c};var _=require("react");var J=require("react"),Qe=(0,J.createContext)(void 0),Ve=()=>(0,J.useContext)(Qe);function _e({addHotkey:e,removeHotkey:r,children:t}){return<Qe.Provider value={{addHotkey:e,removeHotkey:r}}>{t}</Qe.Provider>}var er=(0,_.createContext)({hotkeys:[],enabledScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),X=()=>(0,_.useContext)(er),rr=({initiallyActiveScopes:e=["*"],children:r})=>{let[t,o]=(0,_.useState)(e?.length>0?e:["*"]),[i,a]=(0,_.useState)([]),f=(0,_.useMemo)(()=>t.includes("*"),[t]),y=p=>{o(f?[p]:Array.from(new Set([...t,p])))},c=p=>{let v=t.filter(g=>g!==p);v.length===0?o(["*"]):o(v)},s=p=>{t.includes(p)?c(p):y(p)},h=p=>{a([...i,p])},d=p=>{a(i.filter(v=>v.keys!==p.keys))};return<er.Provider value={{enabledScopes:t,hotkeys:i,enableScope:y,disableScope:c,toggleScope:s}}><_e addHotkey={h}removeHotkey={d}>{r}</_e></er.Provider>};var Cn=require("react"),En=$e(Ge());function Ne(e){let r=(0,Cn.useRef)(void 0);return(0,En.default)(r.current,e)||(r.current=e),r.current}var kn=e=>{e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()};function Fe(e,r,t,o){let i=(0,P.useRef)(null),{current:a}=(0,P.useRef)(new Set),f=t instanceof Array?o instanceof Array?void 0:o:t,y=t instanceof Array?t:o instanceof Array?o:[],c=(0,P.useCallback)(r,[...y]),s=Ne(f),{enabledScopes:h}=X(),d=Ve();return(0,P.useLayoutEffect)(()=>{if(s?.enabled===!1||!Ye(h,s?.scopes))return;let p=u=>{if(!(Xe(u)&&!te(u,s?.enableOnFormTags))){if(i.current!==null&&document.activeElement!==i.current&&!i.current.contains(document.activeElement)){kn(u);return}u.target?.isContentEditable&&!s?.enableOnContentEditable||W(e,s?.splitKey).forEach(x=>{let b=q(x,s?.combinationKey);if(Ze(u,b,a)||b.keys?.includes("*")){if(We(u,b,s?.preventDefault),!Je(u,b,s?.enabled)){kn(u);return}c(u,b)}})}},v=u=>{a.add(u.key.toLowerCase()),(s?.keydown===void 0&&s?.keyup!==!0||s?.keydown)&&p(u)},g=u=>{u.key.toLowerCase()!=="meta"?a.delete(u.key.toLowerCase()):a.clear(),s?.keyup&&p(u)};return(i.current||document).addEventListener("keyup",g),(i.current||document).addEventListener("keydown",v),d&&W(e,s?.splitKey).forEach(u=>d.addHotkey(q(u,s?.combinationKey))),()=>{(i.current||document).removeEventListener("keyup",g),(i.current||document).removeEventListener("keydown",v),d&&W(e,s?.splitKey).forEach(u=>d.removeHotkey(q(u,s?.combinationKey)))}},[e,c,s,h]),i}var jn=$e(Ge()),re=new Set;function Ln(e,r=","){return(Array.isArray(e)?e:e.split(r)).every(o=>{let i=q(o);for(let a of re)if((0,jn.default)(i,a))return!0})}function fc(e){(Array.isArray(e)?e:[e]).forEach(t=>re.add(q(t)))}function yc(e){(Array.isArray(e)?e:[e]).forEach(t=>{let o=q(t);for(let i of re)i.keys?.every(a=>o.keys?.includes(a))&&re.delete(i)})}typeof window<"u"&&window.addEventListener("DOMContentLoaded",()=>{document.addEventListener("keydown",e=>{fc(e.key)}),document.addEventListener("keyup",e=>{yc(e.key)})});
2
- //# sourceMappingURL=index.js.map
1
+
2
+ 'use strict'
3
+
4
+ if (process.env.NODE_ENV === 'production') {
5
+ module.exports = require('./react-hotkeys-hook.cjs.production.min.js')
6
+ } else {
7
+ module.exports = require('./react-hotkeys-hook.cjs.development.js')
8
+ }
@@ -1,3 +1,3 @@
1
- export declare function isHotkeyPressed(key: string | string[], splitKey?: string): boolean;
2
- export declare function pushToCurrentlyPressedKeys(key: string | string[]): void;
3
- export declare function removeFromCurrentlyPressedKeys(key: string | string[]): void;
1
+ export declare function isHotkeyPressed(key: string | string[], splitKey?: string): boolean;
2
+ export declare function pushToCurrentlyPressedKeys(key: string | string[]): void;
3
+ export declare function removeFromCurrentlyPressedKeys(key: string | string[]): void;
@@ -1,3 +1,3 @@
1
- import { Hotkey, Keys } from './types';
2
- export declare function parseKeysHookInput(keys: Keys, splitKey?: string): string[];
3
- export declare function parseHotkey(hotkey: string, combinationKey?: string): Hotkey;
1
+ import { Hotkey, Keys } from './types';
2
+ export declare function parseKeysHookInput(keys: Keys, splitKey?: string): string[];
3
+ export declare function parseHotkey(hotkey: string, combinationKey?: string): Hotkey;
@@ -0,0 +1,427 @@
1
+ 'use strict';
2
+
3
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
+
5
+ var react = require('react');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var isEqual = _interopDefault(require('lodash/isEqual'));
8
+
9
+ function _extends() {
10
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
11
+ for (var i = 1; i < arguments.length; i++) {
12
+ var source = arguments[i];
13
+ for (var key in source) {
14
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
15
+ target[key] = source[key];
16
+ }
17
+ }
18
+ }
19
+ return target;
20
+ };
21
+ return _extends.apply(this, arguments);
22
+ }
23
+ function _unsupportedIterableToArray(o, minLen) {
24
+ if (!o) return;
25
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
26
+ var n = Object.prototype.toString.call(o).slice(8, -1);
27
+ if (n === "Object" && o.constructor) n = o.constructor.name;
28
+ if (n === "Map" || n === "Set") return Array.from(o);
29
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
30
+ }
31
+ function _arrayLikeToArray(arr, len) {
32
+ if (len == null || len > arr.length) len = arr.length;
33
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
34
+ return arr2;
35
+ }
36
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
37
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
38
+ if (it) return (it = it.call(o)).next.bind(it);
39
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
40
+ if (it) o = it;
41
+ var i = 0;
42
+ return function () {
43
+ if (i >= o.length) return {
44
+ done: true
45
+ };
46
+ return {
47
+ done: false,
48
+ value: o[i++]
49
+ };
50
+ };
51
+ }
52
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
53
+ }
54
+
55
+ var reservedModifierKeywords = ['ctrl', 'shift', 'alt', 'meta', 'mod'];
56
+ var mappedKeys = {
57
+ esc: 'escape',
58
+ "return": 'enter',
59
+ left: 'arrowleft',
60
+ up: 'arrowup',
61
+ right: 'arrowright',
62
+ down: 'arrowdown'
63
+ };
64
+ function parseKeysHookInput(keys, splitKey) {
65
+ if (splitKey === void 0) {
66
+ splitKey = ',';
67
+ }
68
+ if (typeof keys === 'string') {
69
+ return keys.split(splitKey);
70
+ }
71
+ return keys;
72
+ }
73
+ function parseHotkey(hotkey, combinationKey) {
74
+ if (combinationKey === void 0) {
75
+ combinationKey = '+';
76
+ }
77
+ var keys = hotkey.toLocaleLowerCase().split(combinationKey).map(function (k) {
78
+ return k.trim();
79
+ }).map(function (k) {
80
+ return mappedKeys[k] || k;
81
+ });
82
+ var modifiers = {
83
+ alt: keys.includes('alt'),
84
+ ctrl: keys.includes('ctrl'),
85
+ shift: keys.includes('shift'),
86
+ meta: keys.includes('meta'),
87
+ mod: keys.includes('mod')
88
+ };
89
+ var singleCharKeys = keys.filter(function (k) {
90
+ return !reservedModifierKeywords.includes(k);
91
+ });
92
+ return _extends({}, modifiers, {
93
+ keys: singleCharKeys
94
+ });
95
+ }
96
+
97
+ function maybePreventDefault(e, hotkey, preventDefault) {
98
+ if (typeof preventDefault === 'function' && preventDefault(e, hotkey) || preventDefault === true) {
99
+ e.preventDefault();
100
+ }
101
+ }
102
+ function isHotkeyEnabled(e, hotkey, enabled) {
103
+ if (typeof enabled === 'function') {
104
+ return enabled(e, hotkey);
105
+ }
106
+ return enabled === true || enabled === undefined;
107
+ }
108
+ function isKeyboardEventTriggeredByInput(ev) {
109
+ return isHotkeyEnabledOnTag(ev, ['input', 'textarea', 'select']);
110
+ }
111
+ function isHotkeyEnabledOnTag(_ref, enabledOnTags) {
112
+ var target = _ref.target;
113
+ if (enabledOnTags === void 0) {
114
+ enabledOnTags = false;
115
+ }
116
+ var targetTagName = target && target.tagName;
117
+ if (enabledOnTags instanceof Array) {
118
+ return Boolean(targetTagName && enabledOnTags && enabledOnTags.some(function (tag) {
119
+ return tag.toLowerCase() === targetTagName.toLowerCase();
120
+ }));
121
+ }
122
+ return Boolean(targetTagName && enabledOnTags && enabledOnTags === true);
123
+ }
124
+ function isScopeActive(activeScopes, scopes) {
125
+ if (activeScopes.length === 0 && scopes) {
126
+ 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>');
127
+ return true;
128
+ }
129
+ if (!scopes) {
130
+ return true;
131
+ }
132
+ return activeScopes.some(function (scope) {
133
+ return scopes.includes(scope);
134
+ }) || activeScopes.includes('*');
135
+ }
136
+ var isHotkeyMatchingKeyboardEvent = function isHotkeyMatchingKeyboardEvent(e, hotkey, pressedDownKeys) {
137
+ var alt = hotkey.alt,
138
+ ctrl = hotkey.ctrl,
139
+ meta = hotkey.meta,
140
+ mod = hotkey.mod,
141
+ shift = hotkey.shift,
142
+ keys = hotkey.keys;
143
+ var altKey = e.altKey,
144
+ ctrlKey = e.ctrlKey,
145
+ metaKey = e.metaKey,
146
+ shiftKey = e.shiftKey,
147
+ pressedKeyUppercase = e.key,
148
+ code = e.code;
149
+ var keyCode = code.toLowerCase().replace('key', '');
150
+ var pressedKey = pressedKeyUppercase.toLowerCase();
151
+ if (altKey !== alt && pressedKey !== 'alt') {
152
+ return false;
153
+ }
154
+ if (shiftKey !== shift && pressedKey !== 'shift') {
155
+ return false;
156
+ }
157
+ // Mod is a special key name that is checking for meta on macOS and ctrl on other platforms
158
+ if (mod) {
159
+ if (!metaKey && !ctrlKey) {
160
+ return false;
161
+ }
162
+ } else {
163
+ if (metaKey !== meta && keyCode !== 'meta') {
164
+ return false;
165
+ }
166
+ if (ctrlKey !== ctrl && keyCode !== 'ctrl') {
167
+ return false;
168
+ }
169
+ }
170
+ // All modifiers are correct, now check the key
171
+ // If the key is set we check for the key
172
+ if (keys && keys.length === 1 && (keys.includes(pressedKey) || keys.includes(keyCode))) {
173
+ return true;
174
+ } else if (keys) {
175
+ // Check if all keys are present in pressedDownKeys set
176
+ return keys.every(function (key) {
177
+ return pressedDownKeys.has(key);
178
+ });
179
+ } else if (!keys) {
180
+ // If the key is not set, we only listen for modifiers, that check went alright, so we return true
181
+ return true;
182
+ }
183
+ // There is nothing that matches.
184
+ return false;
185
+ };
186
+
187
+ var BoundHotkeysProxyProvider = /*#__PURE__*/react.createContext(undefined);
188
+ var useBoundHotkeysProxy = function useBoundHotkeysProxy() {
189
+ return react.useContext(BoundHotkeysProxyProvider);
190
+ };
191
+ function BoundHotkeysProxyProviderProvider(_ref) {
192
+ var addHotkey = _ref.addHotkey,
193
+ removeHotkey = _ref.removeHotkey,
194
+ children = _ref.children;
195
+ return /*#__PURE__*/jsxRuntime.jsx(BoundHotkeysProxyProvider.Provider, {
196
+ value: {
197
+ addHotkey: addHotkey,
198
+ removeHotkey: removeHotkey
199
+ },
200
+ children: children
201
+ });
202
+ }
203
+
204
+ var HotkeysContext = /*#__PURE__*/react.createContext({
205
+ hotkeys: [],
206
+ enabledScopes: [],
207
+ toggleScope: function toggleScope() {},
208
+ enableScope: function enableScope() {},
209
+ disableScope: function disableScope() {}
210
+ });
211
+ var useHotkeysContext = function useHotkeysContext() {
212
+ return react.useContext(HotkeysContext);
213
+ };
214
+ var HotkeysProvider = function HotkeysProvider(_ref) {
215
+ var _ref$initiallyActiveS = _ref.initiallyActiveScopes,
216
+ initiallyActiveScopes = _ref$initiallyActiveS === void 0 ? ['*'] : _ref$initiallyActiveS,
217
+ children = _ref.children;
218
+ var _useState = react.useState((initiallyActiveScopes == null ? void 0 : initiallyActiveScopes.length) > 0 ? initiallyActiveScopes : ['*']),
219
+ internalActiveScopes = _useState[0],
220
+ setInternalActiveScopes = _useState[1];
221
+ var _useState2 = react.useState([]),
222
+ boundHotkeys = _useState2[0],
223
+ setBoundHotkeys = _useState2[1];
224
+ var isAllActive = react.useMemo(function () {
225
+ return internalActiveScopes.includes('*');
226
+ }, [internalActiveScopes]);
227
+ var enableScope = function enableScope(scope) {
228
+ if (isAllActive) {
229
+ setInternalActiveScopes([scope]);
230
+ } else {
231
+ setInternalActiveScopes(Array.from(new Set([].concat(internalActiveScopes, [scope]))));
232
+ }
233
+ };
234
+ var disableScope = function disableScope(scope) {
235
+ var scopes = internalActiveScopes.filter(function (s) {
236
+ return s !== scope;
237
+ });
238
+ if (scopes.length === 0) {
239
+ setInternalActiveScopes(['*']);
240
+ } else {
241
+ setInternalActiveScopes(scopes);
242
+ }
243
+ };
244
+ var toggleScope = function toggleScope(scope) {
245
+ if (internalActiveScopes.includes(scope)) {
246
+ disableScope(scope);
247
+ } else {
248
+ enableScope(scope);
249
+ }
250
+ };
251
+ var addBoundHotkey = function addBoundHotkey(hotkey) {
252
+ setBoundHotkeys([].concat(boundHotkeys, [hotkey]));
253
+ };
254
+ var removeBoundHotkey = function removeBoundHotkey(hotkey) {
255
+ setBoundHotkeys(boundHotkeys.filter(function (h) {
256
+ return h.keys !== hotkey.keys;
257
+ }));
258
+ };
259
+ return /*#__PURE__*/jsxRuntime.jsx(HotkeysContext.Provider, {
260
+ value: {
261
+ enabledScopes: internalActiveScopes,
262
+ hotkeys: boundHotkeys,
263
+ enableScope: enableScope,
264
+ disableScope: disableScope,
265
+ toggleScope: toggleScope
266
+ },
267
+ children: /*#__PURE__*/jsxRuntime.jsx(BoundHotkeysProxyProviderProvider, {
268
+ addHotkey: addBoundHotkey,
269
+ removeHotkey: removeBoundHotkey,
270
+ children: children
271
+ })
272
+ });
273
+ };
274
+
275
+ function useDeepEqualMemo(value) {
276
+ var ref = react.useRef(undefined);
277
+ if (!isEqual(ref.current, value)) {
278
+ ref.current = value;
279
+ }
280
+ return ref.current;
281
+ }
282
+
283
+ var stopPropagation = function stopPropagation(e) {
284
+ e.stopPropagation();
285
+ e.preventDefault();
286
+ e.stopImmediatePropagation();
287
+ };
288
+ var useSafeLayoutEffect = typeof window !== 'undefined' ? react.useLayoutEffect : react.useEffect;
289
+ function useHotkeys(keys, callback, options, dependencies) {
290
+ var ref = react.useRef(null);
291
+ var _useRef = react.useRef(new Set()),
292
+ pressedDownKeys = _useRef.current;
293
+ var _options = !(options instanceof Array) ? options : !(dependencies instanceof Array) ? dependencies : undefined;
294
+ var _deps = options instanceof Array ? options : dependencies instanceof Array ? dependencies : [];
295
+ var cb = react.useCallback(callback, [].concat(_deps));
296
+ var memoisedOptions = useDeepEqualMemo(_options);
297
+ var _useHotkeysContext = useHotkeysContext(),
298
+ enabledScopes = _useHotkeysContext.enabledScopes;
299
+ var proxy = useBoundHotkeysProxy();
300
+ useSafeLayoutEffect(function () {
301
+ if ((memoisedOptions == null ? void 0 : memoisedOptions.enabled) === false || !isScopeActive(enabledScopes, memoisedOptions == null ? void 0 : memoisedOptions.scopes)) {
302
+ return;
303
+ }
304
+ var listener = function listener(e) {
305
+ var _e$target;
306
+ if (isKeyboardEventTriggeredByInput(e) && !isHotkeyEnabledOnTag(e, memoisedOptions == null ? void 0 : memoisedOptions.enableOnFormTags)) {
307
+ return;
308
+ }
309
+ // TODO: SINCE THE EVENT IS NOW ATTACHED TO THE REF, THE ACTIVE ELEMENT CAN NEVER BE INSIDE THE REF. THE HOTKEY ONLY TRIGGERS IF THE
310
+ // REF IS THE ACTIVE ELEMENT. THIS IS A PROBLEM SINCE FOCUSED SUB COMPONENTS WONT TRIGGER THE HOTKEY.
311
+ if (ref.current !== null && document.activeElement !== ref.current && !ref.current.contains(document.activeElement)) {
312
+ stopPropagation(e);
313
+ return;
314
+ }
315
+ if ((_e$target = e.target) != null && _e$target.isContentEditable && !(memoisedOptions != null && memoisedOptions.enableOnContentEditable)) {
316
+ return;
317
+ }
318
+ parseKeysHookInput(keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
319
+ var _hotkey$keys;
320
+ var hotkey = parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey);
321
+ if (isHotkeyMatchingKeyboardEvent(e, hotkey, pressedDownKeys) || (_hotkey$keys = hotkey.keys) != null && _hotkey$keys.includes('*')) {
322
+ maybePreventDefault(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.preventDefault);
323
+ if (!isHotkeyEnabled(e, hotkey, memoisedOptions == null ? void 0 : memoisedOptions.enabled)) {
324
+ stopPropagation(e);
325
+ return;
326
+ }
327
+ cb(e, hotkey);
328
+ }
329
+ });
330
+ };
331
+ var handleKeyDown = function handleKeyDown(event) {
332
+ pressedDownKeys.add(event.key.toLowerCase());
333
+ if ((memoisedOptions == null ? void 0 : memoisedOptions.keydown) === undefined && (memoisedOptions == null ? void 0 : memoisedOptions.keyup) !== true || memoisedOptions != null && memoisedOptions.keydown) {
334
+ listener(event);
335
+ }
336
+ };
337
+ var handleKeyUp = function handleKeyUp(event) {
338
+ if (event.key.toLowerCase() !== 'meta') {
339
+ pressedDownKeys["delete"](event.key.toLowerCase());
340
+ } else {
341
+ // On macOS pressing down the meta key prevents triggering the keyup event for any other key https://stackoverflow.com/a/57153300/735226.
342
+ pressedDownKeys.clear();
343
+ }
344
+ if (memoisedOptions != null && memoisedOptions.keyup) {
345
+ listener(event);
346
+ }
347
+ };
348
+ // @ts-ignore
349
+ (ref.current || document).addEventListener('keyup', handleKeyUp);
350
+ // @ts-ignore
351
+ (ref.current || document).addEventListener('keydown', handleKeyDown);
352
+ if (proxy) {
353
+ parseKeysHookInput(keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
354
+ return proxy.addHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey));
355
+ });
356
+ }
357
+ return function () {
358
+ // @ts-ignore
359
+ (ref.current || document).removeEventListener('keyup', handleKeyUp);
360
+ // @ts-ignore
361
+ (ref.current || document).removeEventListener('keydown', handleKeyDown);
362
+ if (proxy) {
363
+ parseKeysHookInput(keys, memoisedOptions == null ? void 0 : memoisedOptions.splitKey).forEach(function (key) {
364
+ return proxy.removeHotkey(parseHotkey(key, memoisedOptions == null ? void 0 : memoisedOptions.combinationKey));
365
+ });
366
+ }
367
+ };
368
+ }, [keys, cb, memoisedOptions, enabledScopes]);
369
+ return ref;
370
+ }
371
+
372
+ var currentlyPressedKeys = /*#__PURE__*/new Set();
373
+ function isHotkeyPressed(key, splitKey) {
374
+ if (splitKey === void 0) {
375
+ splitKey = ',';
376
+ }
377
+ var hotkeyArray = Array.isArray(key) ? key : key.split(splitKey);
378
+ return hotkeyArray.every(function (hotkey) {
379
+ var parsedHotkey = parseHotkey(hotkey);
380
+ for (var _iterator = _createForOfIteratorHelperLoose(currentlyPressedKeys), _step; !(_step = _iterator()).done;) {
381
+ var pressedHotkey = _step.value;
382
+ if (isEqual(parsedHotkey, pressedHotkey)) {
383
+ return true;
384
+ }
385
+ }
386
+ });
387
+ }
388
+ function pushToCurrentlyPressedKeys(key) {
389
+ var hotkeyArray = Array.isArray(key) ? key : [key];
390
+ hotkeyArray.forEach(function (hotkey) {
391
+ return currentlyPressedKeys.add(parseHotkey(hotkey));
392
+ });
393
+ }
394
+ function removeFromCurrentlyPressedKeys(key) {
395
+ var hotkeyArray = Array.isArray(key) ? key : [key];
396
+ hotkeyArray.forEach(function (hotkey) {
397
+ var parsedHotkey = parseHotkey(hotkey);
398
+ for (var _iterator2 = _createForOfIteratorHelperLoose(currentlyPressedKeys), _step2; !(_step2 = _iterator2()).done;) {
399
+ var _pressedHotkey$keys;
400
+ var pressedHotkey = _step2.value;
401
+ if ((_pressedHotkey$keys = pressedHotkey.keys) != null && _pressedHotkey$keys.every(function (key) {
402
+ var _parsedHotkey$keys;
403
+ return (_parsedHotkey$keys = parsedHotkey.keys) == null ? void 0 : _parsedHotkey$keys.includes(key);
404
+ })) {
405
+ currentlyPressedKeys["delete"](pressedHotkey);
406
+ }
407
+ }
408
+ });
409
+ }
410
+ (function () {
411
+ if (typeof window !== 'undefined') {
412
+ window.addEventListener('DOMContentLoaded', function () {
413
+ document.addEventListener('keydown', function (e) {
414
+ pushToCurrentlyPressedKeys(e.key);
415
+ });
416
+ document.addEventListener('keyup', function (e) {
417
+ removeFromCurrentlyPressedKeys(e.key);
418
+ });
419
+ });
420
+ }
421
+ })();
422
+
423
+ exports.HotkeysProvider = HotkeysProvider;
424
+ exports.isHotkeyPressed = isHotkeyPressed;
425
+ exports.useHotkeys = useHotkeys;
426
+ exports.useHotkeysContext = useHotkeysContext;
427
+ //# sourceMappingURL=react-hotkeys-hook.cjs.development.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-hotkeys-hook.cjs.development.js","sources":["../src/parseHotkeys.ts","../src/validators.ts","../src/BoundHotkeysProxyProvider.tsx","../src/HotkeysProvider.tsx","../src/useDeepEqualMemo.ts","../src/useHotkeys.ts","../src/isHotkeyPressed.ts"],"sourcesContent":["import { Hotkey, KeyboardModifiers, Keys } from './types'\n\nconst reservedModifierKeywords = ['ctrl', 'shift', 'alt', 'meta', 'mod']\n\nconst mappedKeys: Record<string, string> = {\n esc: 'escape',\n return: 'enter',\n left: 'arrowleft',\n up: 'arrowup',\n right: 'arrowright',\n down: 'arrowdown',\n}\n\nexport function parseKeysHookInput(keys: Keys, splitKey: string = ','): string[] {\n if (typeof keys === 'string') {\n return keys.split(splitKey)\n }\n\n return keys\n}\n\nexport function parseHotkey(hotkey: string, combinationKey: string = '+'): Hotkey {\n const keys = hotkey\n .toLocaleLowerCase()\n .split(combinationKey)\n .map(k => k.trim())\n .map(k => mappedKeys[k] || k)\n\n const modifiers: KeyboardModifiers = {\n alt: keys.includes('alt'),\n ctrl: keys.includes('ctrl'),\n shift: keys.includes('shift'),\n meta: keys.includes('meta'),\n mod: keys.includes('mod'),\n }\n\n const singleCharKeys = keys.filter((k) => !reservedModifierKeywords.includes(k))\n\n return {\n ...modifiers,\n keys: singleCharKeys,\n }\n}\n","import { FormTags, Hotkey, Scopes, Trigger } from './types'\n\nexport function maybePreventDefault(e: KeyboardEvent, hotkey: Hotkey, preventDefault?: Trigger): void {\n if ((typeof preventDefault === 'function' && preventDefault(e, hotkey)) || preventDefault === true) {\n e.preventDefault()\n }\n}\n\nexport function isHotkeyEnabled(e: KeyboardEvent, hotkey: Hotkey, enabled?: Trigger): boolean {\n if (typeof enabled === 'function') {\n return enabled(e, hotkey)\n }\n\n return enabled === true || enabled === undefined\n}\n\nexport function isKeyboardEventTriggeredByInput(ev: KeyboardEvent): boolean {\n return isHotkeyEnabledOnTag(ev, ['input', 'textarea', 'select'])\n}\n\nexport function isHotkeyEnabledOnTag({ target }: KeyboardEvent, enabledOnTags: FormTags[] | boolean = false): boolean {\n const targetTagName = target && (target as HTMLElement).tagName\n\n if (enabledOnTags instanceof Array) {\n return Boolean(targetTagName && enabledOnTags && enabledOnTags.some(tag => tag.toLowerCase() === targetTagName.toLowerCase()))\n }\n\n return Boolean(targetTagName && enabledOnTags && enabledOnTags === true)\n}\n\nexport function isScopeActive(activeScopes: string[], scopes?: Scopes): boolean {\n if (activeScopes.length === 0 && scopes) {\n console.warn(\n '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>'\n )\n\n return true\n }\n\n if (!scopes) {\n return true\n }\n\n return activeScopes.some(scope => scopes.includes(scope)) || activeScopes.includes('*')\n}\n\nexport const isHotkeyMatchingKeyboardEvent = (e: KeyboardEvent, hotkey: Hotkey, pressedDownKeys: Set<string>): boolean => {\n const { alt, ctrl, meta, mod, shift, keys } = hotkey\n const { altKey, ctrlKey, metaKey, shiftKey, key: pressedKeyUppercase, code } = e\n\n const keyCode = code.toLowerCase().replace('key', '')\n const pressedKey = pressedKeyUppercase.toLowerCase()\n\n if (altKey !== alt && pressedKey !== 'alt') {\n return false\n }\n\n if (shiftKey !== shift && pressedKey !== 'shift') {\n return false\n }\n\n // Mod is a special key name that is checking for meta on macOS and ctrl on other platforms\n if (mod) {\n if (!metaKey && !ctrlKey) {\n return false\n }\n } else {\n if (metaKey !== meta && keyCode !== 'meta') {\n return false\n }\n\n if (ctrlKey !== ctrl && keyCode !== 'ctrl') {\n return false\n }\n }\n\n // All modifiers are correct, now check the key\n // If the key is set we check for the key\n if (keys && keys.length === 1 && (keys.includes(pressedKey) || keys.includes(keyCode))) {\n return true\n } else if (keys) {\n // Check if all keys are present in pressedDownKeys set\n return keys.every(key => pressedDownKeys.has(key))\n }\n else if (!keys) {\n // If the key is not set, we only listen for modifiers, that check went alright, so we return true\n return true\n }\n\n // There is nothing that matches.\n return false\n}\n","import { createContext, ReactNode, useContext } from 'react'\nimport { Hotkey } from './types'\n\ntype BoundHotkeysProxyProviderType = {\n addHotkey: (hotkey: Hotkey) => void,\n removeHotkey: (hotkey: Hotkey) => void,\n}\n\nconst BoundHotkeysProxyProvider = createContext<BoundHotkeysProxyProviderType | undefined>(undefined)\n\nexport const useBoundHotkeysProxy = () => {\n return useContext(BoundHotkeysProxyProvider)\n}\n\ninterface Props {\n children: ReactNode\n addHotkey: (hotkey: Hotkey) => void\n removeHotkey: (hotkey: Hotkey) => void\n}\n\nexport default function BoundHotkeysProxyProviderProvider({ addHotkey, removeHotkey, children }: Props) {\n return <BoundHotkeysProxyProvider.Provider value={{addHotkey, removeHotkey}}>{children}</BoundHotkeysProxyProvider.Provider>\n}\n","import { Hotkey } from './types'\nimport { createContext, ReactNode, useMemo, useState, useContext } from 'react'\nimport BoundHotkeysProxyProviderProvider from './BoundHotkeysProxyProvider'\n\nexport type HotkeysContextType = {\n hotkeys: ReadonlyArray<Hotkey>\n enabledScopes: string[]\n toggleScope: (scope: string) => void\n enableScope: (scope: string) => void\n disableScope: (scope: string) => void\n}\n\n// The context is only needed for special features like global scoping, so we use a graceful default fallback\nconst HotkeysContext = createContext<HotkeysContextType>({\n hotkeys: [],\n enabledScopes: [], // This array has to be empty instead of containing '*' as default, to check if the provider is set or not\n toggleScope: () => {},\n enableScope: () => {},\n disableScope: () => {},\n})\n\nexport const useHotkeysContext = () => {\n return useContext(HotkeysContext)\n}\n\ninterface Props {\n initiallyActiveScopes?: string[]\n children: ReactNode\n}\n\nexport const HotkeysProvider = ({initiallyActiveScopes = ['*'], children}: Props) => {\n const [internalActiveScopes, setInternalActiveScopes] = useState(initiallyActiveScopes?.length > 0 ? initiallyActiveScopes : ['*'])\n const [boundHotkeys, setBoundHotkeys] = useState<Hotkey[]>([]);\n\n const isAllActive = useMemo(() => internalActiveScopes.includes('*'), [internalActiveScopes])\n\n const enableScope = (scope: string) => {\n if (isAllActive) {\n setInternalActiveScopes([scope])\n } else {\n setInternalActiveScopes(Array.from(new Set([...internalActiveScopes, scope])))\n }\n }\n\n const disableScope = (scope: string) => {\n const scopes = internalActiveScopes.filter(s => s !== scope)\n\n if (scopes.length === 0) {\n setInternalActiveScopes(['*'])\n } else {\n setInternalActiveScopes(scopes)\n }\n }\n\n const toggleScope = (scope: string) => {\n if (internalActiveScopes.includes(scope)) {\n disableScope(scope)\n } else {\n enableScope(scope)\n }\n }\n\n const addBoundHotkey = (hotkey: Hotkey) => {\n setBoundHotkeys([...boundHotkeys, hotkey])\n }\n\n const removeBoundHotkey = (hotkey: Hotkey) => {\n setBoundHotkeys(boundHotkeys.filter(h => h.keys !== hotkey.keys))\n }\n\n return (\n <HotkeysContext.Provider value={{enabledScopes: internalActiveScopes, hotkeys: boundHotkeys, enableScope, disableScope, toggleScope}}>\n <BoundHotkeysProxyProviderProvider addHotkey={addBoundHotkey} removeHotkey={removeBoundHotkey}>\n {children}\n </BoundHotkeysProxyProviderProvider>\n </HotkeysContext.Provider>\n )\n}\n","import { useRef } from 'react'\nimport isEqual from 'lodash/isEqual'\n\nexport default function useDeepEqualMemo<T>(value: T) {\n const ref = useRef<T | undefined>(undefined)\n\n if (!isEqual(ref.current, value)) {\n ref.current = value\n }\n\n return ref.current\n}\n","import { HotkeyCallback, Keys, Options, OptionsOrDependencyArray, RefType } from './types'\nimport { DependencyList, useCallback, useEffect, useLayoutEffect, useRef } from 'react'\nimport { parseHotkey, parseKeysHookInput } from './parseHotkeys'\nimport {\n isHotkeyEnabled,\n isHotkeyEnabledOnTag,\n isHotkeyMatchingKeyboardEvent,\n isKeyboardEventTriggeredByInput,\n isScopeActive,\n maybePreventDefault,\n} from './validators'\nimport { useHotkeysContext } from './HotkeysProvider'\nimport { useBoundHotkeysProxy } from './BoundHotkeysProxyProvider'\nimport useDeepEqualMemo from './useDeepEqualMemo'\n\nconst stopPropagation = (e: KeyboardEvent): void => {\n e.stopPropagation()\n e.preventDefault()\n e.stopImmediatePropagation()\n}\n\nconst useSafeLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\nexport default function useHotkeys<T extends HTMLElement>(\n keys: Keys,\n callback: HotkeyCallback,\n options?: OptionsOrDependencyArray,\n dependencies?: OptionsOrDependencyArray,\n) {\n const ref = useRef<RefType<T>>(null)\n const { current: pressedDownKeys } = useRef<Set<string>>(new Set())\n\n const _options: Options | undefined = !(options instanceof Array) ? (options as Options) : !(dependencies instanceof Array) ? (dependencies as Options) : undefined\n const _deps: DependencyList = options instanceof Array ? options : dependencies instanceof Array ? dependencies : []\n\n const cb = useCallback(callback, [..._deps])\n const memoisedOptions = useDeepEqualMemo(_options)\n\n const { enabledScopes } = useHotkeysContext()\n const proxy = useBoundHotkeysProxy()\n\n useSafeLayoutEffect(() => {\n if (memoisedOptions?.enabled === false || !isScopeActive(enabledScopes, memoisedOptions?.scopes)) {\n return\n }\n\n const listener = (e: KeyboardEvent) => {\n if (isKeyboardEventTriggeredByInput(e) && !isHotkeyEnabledOnTag(e, memoisedOptions?.enableOnFormTags)) {\n return\n }\n\n // TODO: SINCE THE EVENT IS NOW ATTACHED TO THE REF, THE ACTIVE ELEMENT CAN NEVER BE INSIDE THE REF. THE HOTKEY ONLY TRIGGERS IF THE\n // REF IS THE ACTIVE ELEMENT. THIS IS A PROBLEM SINCE FOCUSED SUB COMPONENTS WONT TRIGGER THE HOTKEY.\n\n if (ref.current !== null && document.activeElement !== ref.current && !ref.current.contains(document.activeElement)) {\n stopPropagation(e)\n\n return\n }\n\n if (((e.target as HTMLElement)?.isContentEditable && !memoisedOptions?.enableOnContentEditable)) {\n return\n }\n\n parseKeysHookInput(keys, memoisedOptions?.splitKey).forEach((key) => {\n const hotkey = parseHotkey(key, memoisedOptions?.combinationKey)\n\n if (isHotkeyMatchingKeyboardEvent(e, hotkey, pressedDownKeys) || hotkey.keys?.includes('*')) {\n maybePreventDefault(e, hotkey, memoisedOptions?.preventDefault)\n\n if (!isHotkeyEnabled(e, hotkey, memoisedOptions?.enabled)) {\n stopPropagation(e)\n\n return\n }\n\n cb(e, hotkey)\n }\n })\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n pressedDownKeys.add(event.key.toLowerCase())\n\n if ((memoisedOptions?.keydown === undefined && memoisedOptions?.keyup !== true) || memoisedOptions?.keydown) {\n listener(event)\n }\n }\n\n const handleKeyUp = (event: KeyboardEvent) => {\n if (event.key.toLowerCase() !== 'meta') {\n pressedDownKeys.delete(event.key.toLowerCase())\n } else {\n // On macOS pressing down the meta key prevents triggering the keyup event for any other key https://stackoverflow.com/a/57153300/735226.\n pressedDownKeys.clear()\n }\n\n if (memoisedOptions?.keyup) {\n listener(event)\n }\n }\n\n // @ts-ignore\n (ref.current || document).addEventListener('keyup', handleKeyUp);\n // @ts-ignore\n (ref.current || document).addEventListener('keydown', handleKeyDown)\n\n if (proxy) {\n parseKeysHookInput(keys, memoisedOptions?.splitKey).forEach((key) => proxy.addHotkey(parseHotkey(key, memoisedOptions?.combinationKey)))\n }\n\n return () => {\n // @ts-ignore\n (ref.current || document).removeEventListener('keyup', handleKeyUp);\n // @ts-ignore\n (ref.current || document).removeEventListener('keydown', handleKeyDown)\n\n if (proxy) {\n parseKeysHookInput(keys, memoisedOptions?.splitKey).forEach((key) => proxy.removeHotkey(parseHotkey(key, memoisedOptions?.combinationKey)))\n }\n }\n }, [keys, cb, memoisedOptions, enabledScopes])\n\n return ref\n}\n","import { Hotkey } from './types'\nimport { parseHotkey } from './parseHotkeys'\nimport isEqual from 'lodash/isEqual'\n\nconst currentlyPressedKeys: Set<Hotkey> = new Set<Hotkey>()\n\nexport function isHotkeyPressed(key: string | string[], splitKey: string = ','): boolean {\n const hotkeyArray = Array.isArray(key) ? key : key.split(splitKey)\n\n return hotkeyArray.every((hotkey) => {\n const parsedHotkey = parseHotkey(hotkey)\n\n for (const pressedHotkey of currentlyPressedKeys) {\n if (isEqual(parsedHotkey, pressedHotkey)) {\n return true\n }\n }\n })\n}\n\nexport function pushToCurrentlyPressedKeys(key: string | string[]): void {\n const hotkeyArray = Array.isArray(key) ? key : [key]\n\n hotkeyArray.forEach(hotkey => currentlyPressedKeys.add(parseHotkey(hotkey)))\n}\n\nexport function removeFromCurrentlyPressedKeys(key: string | string[]): void {\n const hotkeyArray = Array.isArray(key) ? key : [key]\n\n hotkeyArray.forEach((hotkey) => {\n const parsedHotkey = parseHotkey(hotkey)\n\n for (const pressedHotkey of currentlyPressedKeys) {\n if (pressedHotkey.keys?.every((key) => parsedHotkey.keys?.includes(key))) {\n currentlyPressedKeys.delete(pressedHotkey)\n }\n }\n })\n}\n\n(() => {\n if (typeof window !== 'undefined') {\n window.addEventListener('DOMContentLoaded', () => {\n document.addEventListener('keydown', e => {\n pushToCurrentlyPressedKeys(e.key)\n })\n\n document.addEventListener('keyup', e => {\n removeFromCurrentlyPressedKeys(e.key)\n })\n })\n }\n})()\n"],"names":["reservedModifierKeywords","mappedKeys","esc","left","up","right","down","parseKeysHookInput","keys","splitKey","split","parseHotkey","hotkey","combinationKey","toLocaleLowerCase","map","k","trim","modifiers","alt","includes","ctrl","shift","meta","mod","singleCharKeys","filter","maybePreventDefault","e","preventDefault","isHotkeyEnabled","enabled","undefined","isKeyboardEventTriggeredByInput","ev","isHotkeyEnabledOnTag","enabledOnTags","target","targetTagName","tagName","Array","Boolean","some","tag","toLowerCase","isScopeActive","activeScopes","scopes","length","console","warn","scope","isHotkeyMatchingKeyboardEvent","pressedDownKeys","altKey","ctrlKey","metaKey","shiftKey","pressedKeyUppercase","key","code","keyCode","replace","pressedKey","every","has","BoundHotkeysProxyProvider","createContext","useBoundHotkeysProxy","useContext","BoundHotkeysProxyProviderProvider","addHotkey","removeHotkey","children","_jsx","HotkeysContext","hotkeys","enabledScopes","toggleScope","enableScope","disableScope","useHotkeysContext","HotkeysProvider","initiallyActiveScopes","useState","internalActiveScopes","setInternalActiveScopes","boundHotkeys","setBoundHotkeys","isAllActive","useMemo","from","Set","s","addBoundHotkey","removeBoundHotkey","h","useDeepEqualMemo","value","ref","useRef","isEqual","current","stopPropagation","stopImmediatePropagation","useSafeLayoutEffect","window","useLayoutEffect","useEffect","useHotkeys","callback","options","dependencies","_options","_deps","cb","useCallback","memoisedOptions","proxy","listener","enableOnFormTags","document","activeElement","contains","isContentEditable","enableOnContentEditable","forEach","handleKeyDown","event","add","keydown","keyup","handleKeyUp","clear","addEventListener","removeEventListener","currentlyPressedKeys","isHotkeyPressed","hotkeyArray","isArray","parsedHotkey","pressedHotkey","pushToCurrentlyPressedKeys","removeFromCurrentlyPressedKeys"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,wBAAwB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC;AAExE,IAAMC,UAAU,GAA2B;EACzCC,GAAG,EAAE,QAAQ;EACb,UAAQ,OAAO;EACfC,IAAI,EAAE,WAAW;EACjBC,EAAE,EAAE,SAAS;EACbC,KAAK,EAAE,YAAY;EACnBC,IAAI,EAAE;CACP;SAEeC,kBAAkB,CAACC,IAAU,EAAEC;MAAAA;IAAAA,WAAmB,GAAG;;EACnE,IAAI,OAAOD,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI,CAACE,KAAK,CAACD,QAAQ,CAAC;;EAG7B,OAAOD,IAAI;AACb;SAEgBG,WAAW,CAACC,MAAc,EAAEC;MAAAA;IAAAA,iBAAyB,GAAG;;EACtE,IAAML,IAAI,GAAGI,MAAM,CAChBE,iBAAiB,EAAE,CACnBJ,KAAK,CAACG,cAAc,CAAC,CACrBE,GAAG,CAAC,UAAAC,CAAC;IAAA,OAAIA,CAAC,CAACC,IAAI,EAAE;IAAC,CAClBF,GAAG,CAAC,UAAAC,C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