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