react-hotkeys-hook 5.0.1 → 5.1.0

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-hotkeys-hook",
3
3
  "description": "React hook for handling keyboard shortcuts",
4
- "version": "5.0.1",
4
+ "version": "5.1.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/JohannesKlauss/react-keymap-hook.git"
@@ -1,6 +1,6 @@
1
- import { createContext as I, useContext as q, useState as A, useCallback as w, useRef as S, useLayoutEffect as Q, useEffect as U } from "react";
2
- import { jsx as R } from "react/jsx-runtime";
3
- const F = ["shift", "alt", "meta", "mod", "ctrl", "control"], V = {
1
+ import { createContext as W, useContext as z, useState as A, useCallback as v, useRef as H, useLayoutEffect as _, useEffect as m } from "react";
2
+ import { jsx as q } from "react/jsx-runtime";
3
+ const G = ["shift", "alt", "meta", "mod", "ctrl", "control"], O = {
4
4
  esc: "escape",
5
5
  return: "enter",
6
6
  left: "arrowleft",
@@ -18,99 +18,106 @@ const F = ["shift", "alt", "meta", "mod", "ctrl", "control"], V = {
18
18
  ControlLeft: "ctrl",
19
19
  ControlRight: "ctrl"
20
20
  };
21
- function g(t) {
22
- return (V[t.trim()] || t.trim()).toLowerCase().replace(/key|digit|numpad/, "");
21
+ function S(t) {
22
+ return (O[t.trim()] || t.trim()).toLowerCase().replace(/key|digit|numpad/, "");
23
23
  }
24
- function X(t) {
25
- return F.includes(t);
24
+ function J(t) {
25
+ return G.includes(t);
26
26
  }
27
- function P(t, r = ",") {
27
+ function b(t, r = ",") {
28
28
  return t.toLowerCase().split(r);
29
29
  }
30
- function b(t, r = "+", n = !1, a) {
31
- const c = t.toLocaleLowerCase().split(r).map((i) => g(i)), l = {
32
- alt: c.includes("alt"),
33
- ctrl: c.includes("ctrl") || c.includes("control"),
34
- shift: c.includes("shift"),
35
- meta: c.includes("meta"),
36
- mod: c.includes("mod"),
37
- useKey: n
38
- }, o = c.filter((i) => !F.includes(i));
30
+ function R(t, r = "+", n = ">", f = !1, l) {
31
+ let u = [], c = !1;
32
+ t.includes(n) ? (c = !0, u = t.toLocaleLowerCase().split(n).map((i) => S(i))) : u = t.toLocaleLowerCase().split(r).map((i) => S(i));
33
+ const d = {
34
+ alt: u.includes("alt"),
35
+ ctrl: u.includes("ctrl") || u.includes("control"),
36
+ shift: u.includes("shift"),
37
+ meta: u.includes("meta"),
38
+ mod: u.includes("mod"),
39
+ useKey: f
40
+ }, a = u.filter((i) => !G.includes(i));
39
41
  return {
40
- ...l,
41
- keys: o,
42
- description: a
42
+ ...d,
43
+ keys: a,
44
+ description: l,
45
+ isSequence: c
43
46
  };
44
47
  }
45
48
  typeof document < "u" && (document.addEventListener("keydown", (t) => {
46
- t.code !== void 0 && T([g(t.code)]);
49
+ t.code !== void 0 && Q([S(t.code)]);
47
50
  }), document.addEventListener("keyup", (t) => {
48
- t.code !== void 0 && W([g(t.code)]);
49
- })), typeof window < "u" && window.addEventListener("blur", () => {
50
- v.clear();
51
- });
52
- const v = /* @__PURE__ */ new Set();
51
+ t.code !== void 0 && U([S(t.code)]);
52
+ })), typeof window < "u" && (window.addEventListener("blur", () => {
53
+ E.clear();
54
+ }), window.addEventListener("contextmenu", () => {
55
+ setTimeout(() => {
56
+ E.clear();
57
+ }, 0);
58
+ }));
59
+ const E = /* @__PURE__ */ new Set();
53
60
  function B(t) {
54
61
  return Array.isArray(t);
55
62
  }
56
- function Y(t, r = ",") {
57
- return (B(t) ? t : t.split(r)).every((a) => v.has(a.trim().toLowerCase()));
63
+ function ee(t, r = ",") {
64
+ return (B(t) ? t : t.split(r)).every((f) => E.has(f.trim().toLowerCase()));
58
65
  }
59
- function T(t) {
66
+ function Q(t) {
60
67
  const r = Array.isArray(t) ? t : [t];
61
- v.has("meta") && v.forEach((n) => !X(n) && v.delete(n.toLowerCase())), r.forEach((n) => v.add(n.toLowerCase()));
68
+ E.has("meta") && E.forEach((n) => !J(n) && E.delete(n.toLowerCase())), r.forEach((n) => E.add(n.toLowerCase()));
62
69
  }
63
- function W(t) {
70
+ function U(t) {
64
71
  const r = Array.isArray(t) ? t : [t];
65
- t === "meta" ? v.clear() : r.forEach((n) => v.delete(n.toLowerCase()));
72
+ t === "meta" ? E.clear() : r.forEach((n) => E.delete(n.toLowerCase()));
66
73
  }
67
- function Z(t, r, n) {
74
+ function te(t, r, n) {
68
75
  (typeof n == "function" && n(t, r) || n === !0) && t.preventDefault();
69
76
  }
70
- function $(t, r, n) {
77
+ function re(t, r, n) {
71
78
  return typeof n == "function" ? n(t, r) : n === !0 || n === void 0;
72
79
  }
73
- function _(t) {
74
- return z(t, ["input", "textarea", "select"]);
80
+ function ne(t) {
81
+ return V(t, ["input", "textarea", "select"]);
75
82
  }
76
- function z(t, r = !1) {
77
- const { target: n, composed: a } = t;
78
- let c;
79
- return m(n) && a ? c = t.composedPath()[0] && t.composedPath()[0].tagName : c = n && n.tagName, B(r) ? !!(c && r && r.some((l) => l.toLowerCase() === c.toLowerCase())) : !!(c && r && r);
83
+ function V(t, r = !1) {
84
+ const { target: n, composed: f } = t;
85
+ let l;
86
+ return ce(n) && f ? l = t.composedPath()[0] && t.composedPath()[0].tagName : l = n && n.tagName, B(r) ? !!(l && r && r.some((u) => u.toLowerCase() === l.toLowerCase())) : !!(l && r && r);
80
87
  }
81
- function m(t) {
88
+ function ce(t) {
82
89
  return !!t.tagName && !t.tagName.startsWith("-") && t.tagName.includes("-");
83
90
  }
84
- function O(t, r) {
91
+ function ue(t, r) {
85
92
  return t.length === 0 && r ? (console.warn(
86
93
  '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>'
87
94
  ), !0) : r ? t.some((n) => r.includes(n)) || t.includes("*") : !0;
88
95
  }
89
- const ee = (t, r, n = !1) => {
90
- const { alt: a, meta: c, mod: l, shift: o, ctrl: i, keys: f, useKey: y } = r, { code: k, key: e, ctrlKey: s, metaKey: d, shiftKey: C, altKey: H } = t, h = g(k);
91
- if (y && (f == null ? void 0 : f.length) === 1 && f.includes(e))
96
+ const oe = (t, r, n = !1) => {
97
+ const { alt: f, meta: l, mod: u, shift: c, ctrl: d, keys: a, useKey: i } = r, { code: w, key: e, ctrlKey: s, metaKey: y, shiftKey: k, altKey: K } = t, h = S(w);
98
+ if (i && (a == null ? void 0 : a.length) === 1 && a.includes(e))
92
99
  return !0;
93
- if (!(f != null && f.includes(h)) && !["ctrl", "control", "unknown", "meta", "alt", "shift", "os"].includes(h))
100
+ if (!(a != null && a.includes(h)) && !["ctrl", "control", "unknown", "meta", "alt", "shift", "os"].includes(h))
94
101
  return !1;
95
102
  if (!n) {
96
- if (a !== H && h !== "alt" || o !== C && h !== "shift")
103
+ if (f !== K && h !== "alt" || c !== k && h !== "shift")
97
104
  return !1;
98
- if (l) {
99
- if (!d && !s)
105
+ if (u) {
106
+ if (!y && !s)
100
107
  return !1;
101
- } else if (c !== d && h !== "meta" && h !== "os" || i !== s && h !== "ctrl" && h !== "control")
108
+ } else if (l !== y && h !== "meta" && h !== "os" || d !== s && h !== "ctrl" && h !== "control")
102
109
  return !1;
103
110
  }
104
- return f && f.length === 1 && f.includes(h) ? !0 : f ? Y(f) : !f;
105
- }, G = I(void 0), te = () => q(G);
106
- function re({ addHotkey: t, removeHotkey: r, children: n }) {
107
- return /* @__PURE__ */ R(G.Provider, { value: { addHotkey: t, removeHotkey: r }, children: n });
111
+ return a && a.length === 1 && a.includes(h) ? !0 : a ? ee(a) : !a;
112
+ }, X = W(void 0), ae = () => z(X);
113
+ function fe({ addHotkey: t, removeHotkey: r, children: n }) {
114
+ return /* @__PURE__ */ q(X.Provider, { value: { addHotkey: t, removeHotkey: r }, children: n });
108
115
  }
109
116
  function N(t, r) {
110
117
  return t && r && typeof t == "object" && typeof r == "object" ? Object.keys(t).length === Object.keys(r).length && // @ts-expect-error TS7053
111
- Object.keys(t).reduce((n, a) => n && N(t[a], r[a]), !0) : t === r;
118
+ Object.keys(t).reduce((n, f) => n && N(t[f], r[f]), !0) : t === r;
112
119
  }
113
- const J = I({
120
+ const Y = W({
114
121
  hotkeys: [],
115
122
  activeScopes: [],
116
123
  // This array has to be empty instead of containing '*' as default, to check if the provider is set or not
@@ -120,101 +127,120 @@ const J = I({
120
127
  },
121
128
  disableScope: () => {
122
129
  }
123
- }), ne = () => q(J), fe = ({ initiallyActiveScopes: t = ["*"], children: r }) => {
124
- const [n, a] = A(t), [c, l] = A([]), o = w((e) => {
125
- a((s) => s.includes("*") ? [e] : Array.from(/* @__PURE__ */ new Set([...s, e])));
126
- }, []), i = w((e) => {
127
- a((s) => s.filter((d) => d !== e));
128
- }, []), f = w((e) => {
129
- a((s) => s.includes(e) ? s.filter((d) => d !== e) : s.includes("*") ? [e] : Array.from(/* @__PURE__ */ new Set([...s, e])));
130
- }, []), y = w((e) => {
131
- l((s) => [...s, e]);
132
- }, []), k = w((e) => {
133
- l((s) => s.filter((d) => !N(d, e)));
130
+ }), le = () => z(Y), he = ({ initiallyActiveScopes: t = ["*"], children: r }) => {
131
+ const [n, f] = A(t), [l, u] = A([]), c = v((e) => {
132
+ f((s) => s.includes("*") ? [e] : Array.from(/* @__PURE__ */ new Set([...s, e])));
133
+ }, []), d = v((e) => {
134
+ f((s) => s.filter((y) => y !== e));
135
+ }, []), a = v((e) => {
136
+ f((s) => s.includes(e) ? s.filter((y) => y !== e) : s.includes("*") ? [e] : Array.from(/* @__PURE__ */ new Set([...s, e])));
137
+ }, []), i = v((e) => {
138
+ u((s) => [...s, e]);
139
+ }, []), w = v((e) => {
140
+ u((s) => s.filter((y) => !N(y, e)));
134
141
  }, []);
135
- return /* @__PURE__ */ R(
136
- J.Provider,
142
+ return /* @__PURE__ */ q(
143
+ Y.Provider,
137
144
  {
138
- value: { activeScopes: n, hotkeys: c, enableScope: o, disableScope: i, toggleScope: f },
139
- children: /* @__PURE__ */ R(re, { addHotkey: y, removeHotkey: k, children: r })
145
+ value: { activeScopes: n, hotkeys: l, enableScope: c, disableScope: d, toggleScope: a },
146
+ children: /* @__PURE__ */ q(fe, { addHotkey: i, removeHotkey: w, children: r })
140
147
  }
141
148
  );
142
149
  };
143
- function oe(t) {
144
- const r = S(void 0);
150
+ function se(t) {
151
+ const r = H(void 0);
145
152
  return N(r.current, t) || (r.current = t), r.current;
146
153
  }
147
- const D = (t) => {
154
+ const F = (t) => {
148
155
  t.stopPropagation(), t.preventDefault(), t.stopImmediatePropagation();
149
- }, ce = typeof window < "u" ? Q : U;
150
- function se(t, r, n, a) {
151
- const c = S(null), l = S(!1), o = n instanceof Array ? a instanceof Array ? void 0 : a : n, i = B(t) ? t.join(o == null ? void 0 : o.delimiter) : t, f = n instanceof Array ? n : a instanceof Array ? a : void 0, y = w(r, f ?? []), k = S(y);
152
- f ? k.current = y : k.current = r;
153
- const e = oe(o), { activeScopes: s } = ne(), d = te();
154
- return ce(() => {
155
- if ((e == null ? void 0 : e.enabled) === !1 || !O(s, e == null ? void 0 : e.scopes))
156
+ }, ie = typeof window < "u" ? _ : m;
157
+ function we(t, r, n, f) {
158
+ const l = H(null), u = H(!1), c = n instanceof Array ? f instanceof Array ? void 0 : f : n, d = B(t) ? t.join(c == null ? void 0 : c.delimiter) : t, a = n instanceof Array ? n : f instanceof Array ? f : void 0, i = v(r, a ?? []), w = H(i);
159
+ a ? w.current = i : w.current = r;
160
+ const e = se(c), { activeScopes: s } = le(), y = ae();
161
+ return ie(() => {
162
+ if ((e == null ? void 0 : e.enabled) === !1 || !ue(s, e == null ? void 0 : e.scopes))
156
163
  return;
157
- const C = (u, p = !1) => {
164
+ let k = [], K;
165
+ const h = (o, M = !1) => {
158
166
  var j;
159
- if (!(_(u) && !z(u, e == null ? void 0 : e.enableOnFormTags))) {
160
- if (c.current !== null) {
161
- const E = c.current.getRootNode();
162
- if ((E instanceof Document || E instanceof ShadowRoot) && E.activeElement !== c.current && !c.current.contains(E.activeElement)) {
163
- D(u);
167
+ if (!(ne(o) && !V(o, e == null ? void 0 : e.enableOnFormTags))) {
168
+ if (l.current !== null) {
169
+ const L = l.current.getRootNode();
170
+ if ((L instanceof Document || L instanceof ShadowRoot) && L.activeElement !== l.current && !l.current.contains(L.activeElement)) {
171
+ F(o);
164
172
  return;
165
173
  }
166
174
  }
167
- (j = u.target) != null && j.isContentEditable && !(e != null && e.enableOnContentEditable) || P(i, e == null ? void 0 : e.delimiter).forEach((E) => {
168
- var M, x;
169
- const L = b(E, e == null ? void 0 : e.splitKey, e == null ? void 0 : e.useKey, e == null ? void 0 : e.description);
170
- if (ee(u, L, e == null ? void 0 : e.ignoreModifiers) || (M = L.keys) != null && M.includes("*")) {
171
- if ((x = e == null ? void 0 : e.ignoreEventWhen) != null && x.call(e, u) || p && l.current)
175
+ (j = o.target) != null && j.isContentEditable && !(e != null && e.enableOnContentEditable) || b(d, e == null ? void 0 : e.delimiter).forEach((L) => {
176
+ var D, I, p, $;
177
+ if (L.includes((e == null ? void 0 : e.splitKey) ?? "+") && L.includes((e == null ? void 0 : e.sequenceSplitKey) ?? ">")) {
178
+ console.warn(`Hotkey ${L} contains both ${(e == null ? void 0 : e.splitKey) ?? "+"} and ${(e == null ? void 0 : e.sequenceSplitKey) ?? ">"} which is not supported.`);
179
+ return;
180
+ }
181
+ const g = R(L, e == null ? void 0 : e.splitKey, e == null ? void 0 : e.sequenceSplitKey, e == null ? void 0 : e.useKey, e == null ? void 0 : e.description);
182
+ if (g.isSequence) {
183
+ K = setTimeout(() => {
184
+ k = [];
185
+ }, (e == null ? void 0 : e.sequenceTimeoutMs) ?? 1e3);
186
+ const P = g.useKey ? o.key : S(o.code);
187
+ if (J(P.toLowerCase()))
188
+ return;
189
+ k.push(P);
190
+ const Z = (D = g.keys) == null ? void 0 : D[k.length - 1];
191
+ if (P !== Z) {
192
+ k = [], K && clearTimeout(K);
193
+ return;
194
+ }
195
+ k.length === ((I = g.keys) == null ? void 0 : I.length) && (w.current(o, g), K && clearTimeout(K), k = []);
196
+ } else if (oe(o, g, e == null ? void 0 : e.ignoreModifiers) || (p = g.keys) != null && p.includes("*")) {
197
+ if (($ = e == null ? void 0 : e.ignoreEventWhen) != null && $.call(e, o) || M && u.current)
172
198
  return;
173
- if (Z(u, L, e == null ? void 0 : e.preventDefault), !$(u, L, e == null ? void 0 : e.enabled)) {
174
- D(u);
199
+ if (te(o, g, e == null ? void 0 : e.preventDefault), !re(o, g, e == null ? void 0 : e.enabled)) {
200
+ F(o);
175
201
  return;
176
202
  }
177
- k.current(u, L), p || (l.current = !0);
203
+ w.current(o, g), M || (u.current = !0);
178
204
  }
179
205
  });
180
206
  }
181
- }, H = (u) => {
182
- u.code !== void 0 && (T(g(u.code)), ((e == null ? void 0 : e.keydown) === void 0 && (e == null ? void 0 : e.keyup) !== !0 || e != null && e.keydown) && C(u));
183
- }, h = (u) => {
184
- u.code !== void 0 && (W(g(u.code)), l.current = !1, e != null && e.keyup && C(u, !0));
185
- }, K = c.current || (o == null ? void 0 : o.document) || document;
186
- return K.addEventListener("keyup", h, o == null ? void 0 : o.eventListenerOptions), K.addEventListener("keydown", H, o == null ? void 0 : o.eventListenerOptions), d && P(i, e == null ? void 0 : e.delimiter).forEach(
187
- (u) => d.addHotkey(
188
- b(u, e == null ? void 0 : e.splitKey, e == null ? void 0 : e.useKey, e == null ? void 0 : e.description)
207
+ }, T = (o) => {
208
+ o.code !== void 0 && (Q(S(o.code)), ((e == null ? void 0 : e.keydown) === void 0 && (e == null ? void 0 : e.keyup) !== !0 || e != null && e.keydown) && h(o));
209
+ }, x = (o) => {
210
+ o.code !== void 0 && (U(S(o.code)), u.current = !1, e != null && e.keyup && h(o, !0));
211
+ }, C = l.current || (c == null ? void 0 : c.document) || document;
212
+ return C.addEventListener("keyup", x, c == null ? void 0 : c.eventListenerOptions), C.addEventListener("keydown", T, c == null ? void 0 : c.eventListenerOptions), y && b(d, e == null ? void 0 : e.delimiter).forEach(
213
+ (o) => y.addHotkey(
214
+ R(o, e == null ? void 0 : e.splitKey, e == null ? void 0 : e.sequenceSplitKey, e == null ? void 0 : e.useKey, e == null ? void 0 : e.description)
189
215
  )
190
216
  ), () => {
191
- K.removeEventListener("keyup", h, o == null ? void 0 : o.eventListenerOptions), K.removeEventListener("keydown", H, o == null ? void 0 : o.eventListenerOptions), d && P(i, e == null ? void 0 : e.delimiter).forEach(
192
- (u) => d.removeHotkey(
193
- b(u, e == null ? void 0 : e.splitKey, e == null ? void 0 : e.useKey, e == null ? void 0 : e.description)
217
+ C.removeEventListener("keyup", x, c == null ? void 0 : c.eventListenerOptions), C.removeEventListener("keydown", T, c == null ? void 0 : c.eventListenerOptions), y && b(d, e == null ? void 0 : e.delimiter).forEach(
218
+ (o) => y.removeHotkey(
219
+ R(o, e == null ? void 0 : e.splitKey, e == null ? void 0 : e.sequenceSplitKey, e == null ? void 0 : e.useKey, e == null ? void 0 : e.description)
194
220
  )
195
- );
221
+ ), k = [], K && clearTimeout(K);
196
222
  };
197
- }, [i, e, s]), c;
223
+ }, [d, e, s]), l;
198
224
  }
199
- function le(t = !1) {
200
- const [r, n] = A(/* @__PURE__ */ new Set()), [a, c] = A(!1), l = w((y) => {
201
- y.code !== void 0 && (y.preventDefault(), y.stopPropagation(), n((k) => {
202
- const e = new Set(k);
203
- return e.add(g(t ? y.key : y.code)), e;
225
+ function ge(t = !1) {
226
+ const [r, n] = A(/* @__PURE__ */ new Set()), [f, l] = A(!1), u = v((i) => {
227
+ i.code !== void 0 && (i.preventDefault(), i.stopPropagation(), n((w) => {
228
+ const e = new Set(w);
229
+ return e.add(S(t ? i.key : i.code)), e;
204
230
  }));
205
- }, [t]), o = w(() => {
206
- typeof document < "u" && (document.removeEventListener("keydown", l), c(!1));
207
- }, [l]), i = w(() => {
208
- n(/* @__PURE__ */ new Set()), typeof document < "u" && (o(), document.addEventListener("keydown", l), c(!0));
209
- }, [l, o]), f = w(() => {
231
+ }, [t]), c = v(() => {
232
+ typeof document < "u" && (document.removeEventListener("keydown", u), l(!1));
233
+ }, [u]), d = v(() => {
234
+ n(/* @__PURE__ */ new Set()), typeof document < "u" && (c(), document.addEventListener("keydown", u), l(!0));
235
+ }, [u, c]), a = v(() => {
210
236
  n(/* @__PURE__ */ new Set());
211
237
  }, []);
212
- return [r, { start: i, stop: o, resetKeys: f, isRecording: a }];
238
+ return [r, { start: d, stop: c, resetKeys: a, isRecording: f }];
213
239
  }
214
240
  export {
215
- fe as HotkeysProvider,
216
- Y as isHotkeyPressed,
217
- se as useHotkeys,
218
- ne as useHotkeysContext,
219
- le as useRecordHotkeys
241
+ he as HotkeysProvider,
242
+ ee as isHotkeyPressed,
243
+ we as useHotkeys,
244
+ le as useHotkeysContext,
245
+ ge as useRecordHotkeys
220
246
  };
@@ -2,4 +2,4 @@ import { Hotkey } from './types';
2
2
  export declare function mapCode(key: string): string;
3
3
  export declare function isHotkeyModifier(key: string): boolean;
4
4
  export declare function parseKeysHookInput(keys: string, delimiter?: string): string[];
5
- export declare function parseHotkey(hotkey: string, splitKey?: string, useKey?: boolean, description?: string): Hotkey;
5
+ export declare function parseHotkey(hotkey: string, splitKey?: string, sequenceSplitKey?: string, useKey?: boolean, description?: string): Hotkey;
@@ -2,7 +2,6 @@ import { DependencyList } from 'react';
2
2
  export type FormTags = 'input' | 'textarea' | 'select' | 'INPUT' | 'TEXTAREA' | 'SELECT';
3
3
  export type Keys = string | readonly string[];
4
4
  export type Scopes = string | readonly string[];
5
- export type RefType<T> = T | null;
6
5
  export type EventListenerOptions = {
7
6
  capture?: boolean;
8
7
  once?: boolean;
@@ -21,6 +20,7 @@ export type Hotkey = KeyboardModifiers & {
21
20
  keys?: readonly string[];
22
21
  scopes?: Scopes;
23
22
  description?: string;
23
+ isSequence?: boolean;
24
24
  };
25
25
  export type HotkeysEvent = Hotkey;
26
26
  export type HotkeyCallback = (keyboardEvent: KeyboardEvent, hotkeysEvent: HotkeysEvent) => void;
@@ -41,5 +41,7 @@ export type Options = {
41
41
  ignoreModifiers?: boolean;
42
42
  eventListenerOptions?: EventListenerOptions;
43
43
  useKey?: boolean;
44
+ sequenceTimeoutMs?: number;
45
+ sequenceSplitKey?: string;
44
46
  };
45
47
  export type OptionsOrDependencyArray = Options | DependencyList;
@@ -1,2 +1,2 @@
1
- import { HotkeyCallback, Keys, OptionsOrDependencyArray, RefType } from './types';
2
- export default function useHotkeys<T extends HTMLElement>(keys: Keys, callback: HotkeyCallback, options?: OptionsOrDependencyArray, dependencies?: OptionsOrDependencyArray): import('react').RefObject<RefType<T>>;
1
+ import { HotkeyCallback, Keys, OptionsOrDependencyArray } from './types';
2
+ export default function useHotkeys<T extends HTMLElement>(keys: Keys, callback: HotkeyCallback, options?: OptionsOrDependencyArray, dependencies?: OptionsOrDependencyArray): import('react').RefObject<T | null>;