@tanstack/preact-hotkeys 0.3.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 +122 -0
- package/dist/HotkeysProvider.cjs +26 -0
- package/dist/HotkeysProvider.cjs.map +1 -0
- package/dist/HotkeysProvider.d.cts +28 -0
- package/dist/HotkeysProvider.d.ts +28 -0
- package/dist/HotkeysProvider.js +24 -0
- package/dist/HotkeysProvider.js.map +1 -0
- package/dist/index.cjs +25 -0
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +11 -0
- package/dist/useHeldKeyCodes.cjs +37 -0
- package/dist/useHeldKeyCodes.cjs.map +1 -0
- package/dist/useHeldKeyCodes.d.cts +31 -0
- package/dist/useHeldKeyCodes.d.ts +31 -0
- package/dist/useHeldKeyCodes.js +37 -0
- package/dist/useHeldKeyCodes.js.map +1 -0
- package/dist/useHeldKeys.cjs +33 -0
- package/dist/useHeldKeys.cjs.map +1 -0
- package/dist/useHeldKeys.d.cts +27 -0
- package/dist/useHeldKeys.d.ts +27 -0
- package/dist/useHeldKeys.js +33 -0
- package/dist/useHeldKeys.js.map +1 -0
- package/dist/useHotkey.cjs +118 -0
- package/dist/useHotkey.cjs.map +1 -0
- package/dist/useHotkey.d.cts +74 -0
- package/dist/useHotkey.d.ts +74 -0
- package/dist/useHotkey.js +118 -0
- package/dist/useHotkey.js.map +1 -0
- package/dist/useHotkeyRecorder.cjs +71 -0
- package/dist/useHotkeyRecorder.cjs.map +1 -0
- package/dist/useHotkeyRecorder.d.cts +57 -0
- package/dist/useHotkeyRecorder.d.ts +57 -0
- package/dist/useHotkeyRecorder.js +71 -0
- package/dist/useHotkeyRecorder.js.map +1 -0
- package/dist/useHotkeySequence.cjs +96 -0
- package/dist/useHotkeySequence.cjs.map +1 -0
- package/dist/useHotkeySequence.d.cts +48 -0
- package/dist/useHotkeySequence.d.ts +48 -0
- package/dist/useHotkeySequence.js +96 -0
- package/dist/useHotkeySequence.js.map +1 -0
- package/dist/useKeyHold.cjs +53 -0
- package/dist/useKeyHold.cjs.map +1 -0
- package/dist/useKeyHold.d.cts +47 -0
- package/dist/useKeyHold.d.ts +47 -0
- package/dist/useKeyHold.js +53 -0
- package/dist/useKeyHold.js.map +1 -0
- package/package.json +63 -0
- package/src/HotkeysProvider.tsx +52 -0
- package/src/index.ts +13 -0
- package/src/useHeldKeyCodes.ts +33 -0
- package/src/useHeldKeys.ts +29 -0
- package/src/useHotkey.ts +192 -0
- package/src/useHotkeyRecorder.ts +101 -0
- package/src/useHotkeySequence.ts +169 -0
- package/src/useKeyHold.ts +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="./media/header_hotkeys.png" alt="TanStack Hotkeys" />
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<br />
|
|
6
|
+
|
|
7
|
+
<div align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@tanstack/hotkeys" target="\_parent">
|
|
9
|
+
<img alt="" src="https://img.shields.io/npm/dm/@tanstack/hotkeys.svg" alt="npm downloads" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://github.com/TanStack/hotkeys" target="\_parent">
|
|
12
|
+
<img alt="" src="https://img.shields.io/github/stars/TanStack/hotkeys.svg?style=social&label=Star" alt="GitHub stars" />
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://bundlephobia.com/result?p=@tanstack/react-hotkeys@latest" target="\_parent">
|
|
15
|
+
<img alt="" src="https://badgen.net/bundlephobia/minzip/@tanstack/react-hotkeys@latest" alt="Bundle size" />
|
|
16
|
+
</a>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div align="center">
|
|
20
|
+
<a href="#badge">
|
|
21
|
+
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
|
|
22
|
+
</a>
|
|
23
|
+
<a href="#badge">
|
|
24
|
+
<img src="https://img.shields.io/github/v/release/tanstack/hotkeys" alt="Release"/>
|
|
25
|
+
</a>
|
|
26
|
+
<a href="https://twitter.com/tan_stack">
|
|
27
|
+
<img src="https://img.shields.io/twitter/follow/tan_stack.svg?style=social" alt="Follow @TanStack"/>
|
|
28
|
+
</a>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div align="center">
|
|
32
|
+
|
|
33
|
+
### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/)
|
|
34
|
+
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
# TanStack Hotkeys
|
|
38
|
+
|
|
39
|
+
> [!NOTE]
|
|
40
|
+
> TanStack Hotkeys is pre-alpha (prototyping phase). We are actively developing the library and are open to feedback and contributions.
|
|
41
|
+
|
|
42
|
+
Type-safe keyboard shortcuts for the web. Template-string bindings, parsed objects, a cross-platform `Mod` key, a singleton Hotkey Manager, and utilities for cheatsheet UIs—built to stay SSR-friendly.
|
|
43
|
+
|
|
44
|
+
- Type-safe bindings — template strings (`Mod+Shift+S`, `Escape`) or parsed objects for full control
|
|
45
|
+
- Flexible options — `keydown`/`keyup`, `preventDefault`, `stopPropagation`, conditional enabled, `requireReset`
|
|
46
|
+
- Cross-platform Mod — maps to Cmd on macOS and Ctrl on Windows/Linux
|
|
47
|
+
- Batteries included — validation + matching, sequences (Vim-style), key-state tracking, recorder UI helpers, React hooks, and devtools (in progress)
|
|
48
|
+
|
|
49
|
+
### <a href="https://tanstack.com/hotkeys">Read the docs →</a>
|
|
50
|
+
|
|
51
|
+
<br />
|
|
52
|
+
|
|
53
|
+
> [!NOTE]
|
|
54
|
+
> You may know **TanStack Hotkeys** by our adapter names, too!
|
|
55
|
+
>
|
|
56
|
+
> - [**React Hotkeys**](https://tanstack.com/hotkeys/latest/docs/framework/react/react-hotkeys)
|
|
57
|
+
> - [**Preact Hotkeys**](https://tanstack.com/hotkeys/latest/docs/framework/preact/preact-hotkeys)
|
|
58
|
+
> - [**Solid Hotkeys**](https://tanstack.com/hotkeys/latest/docs/framework/solid/solid-hotkeys)
|
|
59
|
+
> - Angular Hotkeys – needs a contributor!
|
|
60
|
+
> - Svelte Hotkeys – needs a contributor!
|
|
61
|
+
> - Vue Hotkeys – needs a contributor!
|
|
62
|
+
|
|
63
|
+
## Get Involved
|
|
64
|
+
|
|
65
|
+
- We welcome issues and pull requests!
|
|
66
|
+
- Participate in [GitHub discussions](https://github.com/TanStack/hotkeys/discussions)
|
|
67
|
+
- Chat with the community on [Discord](https://discord.com/invite/WrRKjPJ)
|
|
68
|
+
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup instructions
|
|
69
|
+
|
|
70
|
+
## Partners
|
|
71
|
+
|
|
72
|
+
<div align="center">
|
|
73
|
+
|
|
74
|
+
<table align="center">
|
|
75
|
+
<tr>
|
|
76
|
+
<td>
|
|
77
|
+
<a href="https://www.coderabbit.ai/?via=tanstack&dub_id=aCcEEdAOqqutX6OS" >
|
|
78
|
+
<picture>
|
|
79
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/coderabbit-dark-D643Zkrv.svg" height="40" />
|
|
80
|
+
<source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/coderabbit-light-CIzGLYU_.svg" height="40" />
|
|
81
|
+
<img src="https://tanstack.com/assets/coderabbit-light-DVMJ2jHi.svg" height="40" alt="CodeRabbit" />
|
|
82
|
+
</picture>
|
|
83
|
+
</a>
|
|
84
|
+
</td>
|
|
85
|
+
<td>
|
|
86
|
+
<a href="https://www.cloudflare.com?utm_source=tanstack">
|
|
87
|
+
<picture>
|
|
88
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/cloudflare-white-Co-Tyjbl.svg" height="60" />
|
|
89
|
+
<source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/cloudflare-black-6Ojsn8yh.svg" height="60" />
|
|
90
|
+
<img src="https://tanstack.com/assets/cloudflare-black-CPufaW0B.svg" height="60" alt="Cloudflare" />
|
|
91
|
+
</picture>
|
|
92
|
+
</a>
|
|
93
|
+
</td>
|
|
94
|
+
</tr>
|
|
95
|
+
</table>
|
|
96
|
+
|
|
97
|
+
<div align="center">
|
|
98
|
+
<img src="media/partner_logo.svg" alt="Keys & you?" height="65">
|
|
99
|
+
<p>
|
|
100
|
+
We're looking for TanStack Hotkeys Partners to join our mission! Partner with us to push the boundaries of TanStack Hotkeys and build amazing things together.
|
|
101
|
+
</p>
|
|
102
|
+
<a href="mailto:partners@tanstack.com?subject=TanStack Hotkeys Partnership"><b>LET'S CHAT</b></a>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
## Explore the TanStack Ecosystem
|
|
108
|
+
|
|
109
|
+
- <a href="https://github.com/tanstack/config"><b>TanStack Config</b></a> – Tooling for JS/TS packages
|
|
110
|
+
- <a href="https://github.com/tanstack/db"><b>TanStack DB</b></a> – Reactive sync client store
|
|
111
|
+
- <a href="https://github.com/tanstack/devtools"><b>TanStack DevTools</b></a> – Unified devtools panel
|
|
112
|
+
- <a href="https://github.com/tanstack/form"><b>TanStack Form</b></a> – Type‑safe form state
|
|
113
|
+
- <a href="https://github.com/tanstack/hotkeys"><b>TanStack Hotkeys</b></a> – Type‑safe keyboard shortcuts
|
|
114
|
+
- <a href="https://github.com/tanstack/query"><b>TanStack Query</b></a> – Async state & caching
|
|
115
|
+
- <a href="https://github.com/tanstack/ranger"><b>TanStack Ranger</b></a> – Range & slider primitives
|
|
116
|
+
- <a href="https://github.com/tanstack/router"><b>TanStack Router</b></a> – Type‑safe routing, caching & URL state
|
|
117
|
+
- <a href="https://github.com/tanstack/start"><b>TanStack Start</b></a> – Full‑stack SSR & streaming
|
|
118
|
+
- <a href="https://github.com/tanstack/store"><b>TanStack Store</b></a> – Reactive data store
|
|
119
|
+
- <a href="https://github.com/tanstack/table"><b>TanStack Table</b></a> – Headless datagrids
|
|
120
|
+
- <a href="https://github.com/tanstack/virtual"><b>TanStack Virtual</b></a> – Virtualized rendering
|
|
121
|
+
|
|
122
|
+
… and more at <a href="https://tanstack.com"><b>TanStack.com »</b></a>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
let preact = require("preact");
|
|
2
|
+
let preact_hooks = require("preact/hooks");
|
|
3
|
+
let preact_jsx_runtime = require("preact/jsx-runtime");
|
|
4
|
+
|
|
5
|
+
//#region src/HotkeysProvider.tsx
|
|
6
|
+
const HotkeysContext = (0, preact.createContext)(null);
|
|
7
|
+
const DEFAULT_OPTIONS = {};
|
|
8
|
+
function HotkeysProvider({ children, defaultOptions = DEFAULT_OPTIONS }) {
|
|
9
|
+
const contextValue = (0, preact_hooks.useMemo)(() => ({ defaultOptions }), [defaultOptions]);
|
|
10
|
+
return /* @__PURE__ */ (0, preact_jsx_runtime.jsx)(HotkeysContext.Provider, {
|
|
11
|
+
value: contextValue,
|
|
12
|
+
children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function useHotkeysContext() {
|
|
16
|
+
return (0, preact_hooks.useContext)(HotkeysContext);
|
|
17
|
+
}
|
|
18
|
+
function useDefaultHotkeysOptions() {
|
|
19
|
+
return (0, preact_hooks.useContext)(HotkeysContext)?.defaultOptions ?? {};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.HotkeysProvider = HotkeysProvider;
|
|
24
|
+
exports.useDefaultHotkeysOptions = useDefaultHotkeysOptions;
|
|
25
|
+
exports.useHotkeysContext = useHotkeysContext;
|
|
26
|
+
//# sourceMappingURL=HotkeysProvider.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HotkeysProvider.cjs","names":[],"sources":["../src/HotkeysProvider.tsx"],"sourcesContent":["import { createContext } from 'preact'\nimport { useContext, useMemo } from 'preact/hooks'\nimport type { ComponentChildren } from 'preact'\nimport type { HotkeyRecorderOptions } from '@tanstack/hotkeys'\nimport type { UseHotkeyOptions } from './useHotkey'\nimport type { UseHotkeySequenceOptions } from './useHotkeySequence'\n\nexport interface HotkeysProviderOptions {\n hotkey?: Partial<UseHotkeyOptions>\n hotkeyRecorder?: Partial<HotkeyRecorderOptions>\n hotkeySequence?: Partial<UseHotkeySequenceOptions>\n}\n\ninterface HotkeysContextValue {\n defaultOptions: HotkeysProviderOptions\n}\n\nconst HotkeysContext = createContext<HotkeysContextValue | null>(null)\n\nexport interface HotkeysProviderProps {\n children: ComponentChildren\n defaultOptions?: HotkeysProviderOptions\n}\n\nconst DEFAULT_OPTIONS: HotkeysProviderOptions = {}\n\nexport function HotkeysProvider({\n children,\n defaultOptions = DEFAULT_OPTIONS,\n}: HotkeysProviderProps) {\n const contextValue: HotkeysContextValue = useMemo(\n () => ({\n defaultOptions,\n }),\n [defaultOptions],\n )\n\n return (\n <HotkeysContext.Provider value={contextValue}>\n {children}\n </HotkeysContext.Provider>\n )\n}\n\nexport function useHotkeysContext() {\n return useContext(HotkeysContext)\n}\n\nexport function useDefaultHotkeysOptions() {\n const context = useContext(HotkeysContext)\n return context?.defaultOptions ?? {}\n}\n"],"mappings":";;;;;AAiBA,MAAM,2CAA2D,KAAK;AAOtE,MAAM,kBAA0C,EAAE;AAElD,SAAgB,gBAAgB,EAC9B,UACA,iBAAiB,mBACM;CACvB,MAAM,gDACG,EACL,gBACD,GACD,CAAC,eAAe,CACjB;AAED,QACE,4CAAC,eAAe;EAAS,OAAO;EAC7B;GACuB;;AAI9B,SAAgB,oBAAoB;AAClC,qCAAkB,eAAe;;AAGnC,SAAgB,2BAA2B;AAEzC,qCAD2B,eAAe,EAC1B,kBAAkB,EAAE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { UseHotkeyOptions } from "./useHotkey.cjs";
|
|
2
|
+
import { UseHotkeySequenceOptions } from "./useHotkeySequence.cjs";
|
|
3
|
+
import { HotkeyRecorderOptions } from "@tanstack/hotkeys";
|
|
4
|
+
import * as preact from "preact";
|
|
5
|
+
import { ComponentChildren } from "preact";
|
|
6
|
+
|
|
7
|
+
//#region src/HotkeysProvider.d.ts
|
|
8
|
+
interface HotkeysProviderOptions {
|
|
9
|
+
hotkey?: Partial<UseHotkeyOptions>;
|
|
10
|
+
hotkeyRecorder?: Partial<HotkeyRecorderOptions>;
|
|
11
|
+
hotkeySequence?: Partial<UseHotkeySequenceOptions>;
|
|
12
|
+
}
|
|
13
|
+
interface HotkeysContextValue {
|
|
14
|
+
defaultOptions: HotkeysProviderOptions;
|
|
15
|
+
}
|
|
16
|
+
interface HotkeysProviderProps {
|
|
17
|
+
children: ComponentChildren;
|
|
18
|
+
defaultOptions?: HotkeysProviderOptions;
|
|
19
|
+
}
|
|
20
|
+
declare function HotkeysProvider({
|
|
21
|
+
children,
|
|
22
|
+
defaultOptions
|
|
23
|
+
}: HotkeysProviderProps): preact.JSX.Element;
|
|
24
|
+
declare function useHotkeysContext(): HotkeysContextValue | null;
|
|
25
|
+
declare function useDefaultHotkeysOptions(): HotkeysProviderOptions;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { HotkeysProvider, HotkeysProviderOptions, HotkeysProviderProps, useDefaultHotkeysOptions, useHotkeysContext };
|
|
28
|
+
//# sourceMappingURL=HotkeysProvider.d.cts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { UseHotkeyOptions } from "./useHotkey.js";
|
|
2
|
+
import { UseHotkeySequenceOptions } from "./useHotkeySequence.js";
|
|
3
|
+
import { HotkeyRecorderOptions } from "@tanstack/hotkeys";
|
|
4
|
+
import * as preact from "preact";
|
|
5
|
+
import { ComponentChildren } from "preact";
|
|
6
|
+
|
|
7
|
+
//#region src/HotkeysProvider.d.ts
|
|
8
|
+
interface HotkeysProviderOptions {
|
|
9
|
+
hotkey?: Partial<UseHotkeyOptions>;
|
|
10
|
+
hotkeyRecorder?: Partial<HotkeyRecorderOptions>;
|
|
11
|
+
hotkeySequence?: Partial<UseHotkeySequenceOptions>;
|
|
12
|
+
}
|
|
13
|
+
interface HotkeysContextValue {
|
|
14
|
+
defaultOptions: HotkeysProviderOptions;
|
|
15
|
+
}
|
|
16
|
+
interface HotkeysProviderProps {
|
|
17
|
+
children: ComponentChildren;
|
|
18
|
+
defaultOptions?: HotkeysProviderOptions;
|
|
19
|
+
}
|
|
20
|
+
declare function HotkeysProvider({
|
|
21
|
+
children,
|
|
22
|
+
defaultOptions
|
|
23
|
+
}: HotkeysProviderProps): preact.JSX.Element;
|
|
24
|
+
declare function useHotkeysContext(): HotkeysContextValue | null;
|
|
25
|
+
declare function useDefaultHotkeysOptions(): HotkeysProviderOptions;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { HotkeysProvider, HotkeysProviderOptions, HotkeysProviderProps, useDefaultHotkeysOptions, useHotkeysContext };
|
|
28
|
+
//# sourceMappingURL=HotkeysProvider.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createContext } from "preact";
|
|
2
|
+
import { useContext, useMemo } from "preact/hooks";
|
|
3
|
+
import { jsx } from "preact/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/HotkeysProvider.tsx
|
|
6
|
+
const HotkeysContext = createContext(null);
|
|
7
|
+
const DEFAULT_OPTIONS = {};
|
|
8
|
+
function HotkeysProvider({ children, defaultOptions = DEFAULT_OPTIONS }) {
|
|
9
|
+
const contextValue = useMemo(() => ({ defaultOptions }), [defaultOptions]);
|
|
10
|
+
return /* @__PURE__ */ jsx(HotkeysContext.Provider, {
|
|
11
|
+
value: contextValue,
|
|
12
|
+
children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function useHotkeysContext() {
|
|
16
|
+
return useContext(HotkeysContext);
|
|
17
|
+
}
|
|
18
|
+
function useDefaultHotkeysOptions() {
|
|
19
|
+
return useContext(HotkeysContext)?.defaultOptions ?? {};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { HotkeysProvider, useDefaultHotkeysOptions, useHotkeysContext };
|
|
24
|
+
//# sourceMappingURL=HotkeysProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HotkeysProvider.js","names":[],"sources":["../src/HotkeysProvider.tsx"],"sourcesContent":["import { createContext } from 'preact'\nimport { useContext, useMemo } from 'preact/hooks'\nimport type { ComponentChildren } from 'preact'\nimport type { HotkeyRecorderOptions } from '@tanstack/hotkeys'\nimport type { UseHotkeyOptions } from './useHotkey'\nimport type { UseHotkeySequenceOptions } from './useHotkeySequence'\n\nexport interface HotkeysProviderOptions {\n hotkey?: Partial<UseHotkeyOptions>\n hotkeyRecorder?: Partial<HotkeyRecorderOptions>\n hotkeySequence?: Partial<UseHotkeySequenceOptions>\n}\n\ninterface HotkeysContextValue {\n defaultOptions: HotkeysProviderOptions\n}\n\nconst HotkeysContext = createContext<HotkeysContextValue | null>(null)\n\nexport interface HotkeysProviderProps {\n children: ComponentChildren\n defaultOptions?: HotkeysProviderOptions\n}\n\nconst DEFAULT_OPTIONS: HotkeysProviderOptions = {}\n\nexport function HotkeysProvider({\n children,\n defaultOptions = DEFAULT_OPTIONS,\n}: HotkeysProviderProps) {\n const contextValue: HotkeysContextValue = useMemo(\n () => ({\n defaultOptions,\n }),\n [defaultOptions],\n )\n\n return (\n <HotkeysContext.Provider value={contextValue}>\n {children}\n </HotkeysContext.Provider>\n )\n}\n\nexport function useHotkeysContext() {\n return useContext(HotkeysContext)\n}\n\nexport function useDefaultHotkeysOptions() {\n const context = useContext(HotkeysContext)\n return context?.defaultOptions ?? {}\n}\n"],"mappings":";;;;;AAiBA,MAAM,iBAAiB,cAA0C,KAAK;AAOtE,MAAM,kBAA0C,EAAE;AAElD,SAAgB,gBAAgB,EAC9B,UACA,iBAAiB,mBACM;CACvB,MAAM,eAAoC,eACjC,EACL,gBACD,GACD,CAAC,eAAe,CACjB;AAED,QACE,oBAAC,eAAe;EAAS,OAAO;EAC7B;GACuB;;AAI9B,SAAgB,oBAAoB;AAClC,QAAO,WAAW,eAAe;;AAGnC,SAAgB,2BAA2B;AAEzC,QADgB,WAAW,eAAe,EAC1B,kBAAkB,EAAE"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_HotkeysProvider = require('./HotkeysProvider.cjs');
|
|
3
|
+
const require_useHotkey = require('./useHotkey.cjs');
|
|
4
|
+
const require_useHeldKeys = require('./useHeldKeys.cjs');
|
|
5
|
+
const require_useHeldKeyCodes = require('./useHeldKeyCodes.cjs');
|
|
6
|
+
const require_useKeyHold = require('./useKeyHold.cjs');
|
|
7
|
+
const require_useHotkeySequence = require('./useHotkeySequence.cjs');
|
|
8
|
+
const require_useHotkeyRecorder = require('./useHotkeyRecorder.cjs');
|
|
9
|
+
|
|
10
|
+
exports.HotkeysProvider = require_HotkeysProvider.HotkeysProvider;
|
|
11
|
+
exports.useDefaultHotkeysOptions = require_HotkeysProvider.useDefaultHotkeysOptions;
|
|
12
|
+
exports.useHeldKeyCodes = require_useHeldKeyCodes.useHeldKeyCodes;
|
|
13
|
+
exports.useHeldKeys = require_useHeldKeys.useHeldKeys;
|
|
14
|
+
exports.useHotkey = require_useHotkey.useHotkey;
|
|
15
|
+
exports.useHotkeyRecorder = require_useHotkeyRecorder.useHotkeyRecorder;
|
|
16
|
+
exports.useHotkeySequence = require_useHotkeySequence.useHotkeySequence;
|
|
17
|
+
exports.useHotkeysContext = require_HotkeysProvider.useHotkeysContext;
|
|
18
|
+
exports.useKeyHold = require_useKeyHold.useKeyHold;
|
|
19
|
+
var _tanstack_hotkeys = require("@tanstack/hotkeys");
|
|
20
|
+
Object.keys(_tanstack_hotkeys).forEach(function (k) {
|
|
21
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return _tanstack_hotkeys[k]; }
|
|
24
|
+
});
|
|
25
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UseHotkeyOptions, useHotkey } from "./useHotkey.cjs";
|
|
2
|
+
import { UseHotkeySequenceOptions, useHotkeySequence } from "./useHotkeySequence.cjs";
|
|
3
|
+
import { HotkeysProvider, HotkeysProviderOptions, HotkeysProviderProps, useDefaultHotkeysOptions, useHotkeysContext } from "./HotkeysProvider.cjs";
|
|
4
|
+
import { useHeldKeys } from "./useHeldKeys.cjs";
|
|
5
|
+
import { useHeldKeyCodes } from "./useHeldKeyCodes.cjs";
|
|
6
|
+
import { useKeyHold } from "./useKeyHold.cjs";
|
|
7
|
+
import { PreactHotkeyRecorder, useHotkeyRecorder } from "./useHotkeyRecorder.cjs";
|
|
8
|
+
export * from "@tanstack/hotkeys";
|
|
9
|
+
export { HotkeysProvider, HotkeysProviderOptions, HotkeysProviderProps, PreactHotkeyRecorder, UseHotkeyOptions, UseHotkeySequenceOptions, useDefaultHotkeysOptions, useHeldKeyCodes, useHeldKeys, useHotkey, useHotkeyRecorder, useHotkeySequence, useHotkeysContext, useKeyHold };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UseHotkeyOptions, useHotkey } from "./useHotkey.js";
|
|
2
|
+
import { UseHotkeySequenceOptions, useHotkeySequence } from "./useHotkeySequence.js";
|
|
3
|
+
import { HotkeysProvider, HotkeysProviderOptions, HotkeysProviderProps, useDefaultHotkeysOptions, useHotkeysContext } from "./HotkeysProvider.js";
|
|
4
|
+
import { useHeldKeys } from "./useHeldKeys.js";
|
|
5
|
+
import { useHeldKeyCodes } from "./useHeldKeyCodes.js";
|
|
6
|
+
import { useKeyHold } from "./useKeyHold.js";
|
|
7
|
+
import { PreactHotkeyRecorder, useHotkeyRecorder } from "./useHotkeyRecorder.js";
|
|
8
|
+
export * from "@tanstack/hotkeys";
|
|
9
|
+
export { HotkeysProvider, HotkeysProviderOptions, HotkeysProviderProps, PreactHotkeyRecorder, UseHotkeyOptions, UseHotkeySequenceOptions, useDefaultHotkeysOptions, useHeldKeyCodes, useHeldKeys, useHotkey, useHotkeyRecorder, useHotkeySequence, useHotkeysContext, useKeyHold };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HotkeysProvider, useDefaultHotkeysOptions, useHotkeysContext } from "./HotkeysProvider.js";
|
|
2
|
+
import { useHotkey } from "./useHotkey.js";
|
|
3
|
+
import { useHeldKeys } from "./useHeldKeys.js";
|
|
4
|
+
import { useHeldKeyCodes } from "./useHeldKeyCodes.js";
|
|
5
|
+
import { useKeyHold } from "./useKeyHold.js";
|
|
6
|
+
import { useHotkeySequence } from "./useHotkeySequence.js";
|
|
7
|
+
import { useHotkeyRecorder } from "./useHotkeyRecorder.js";
|
|
8
|
+
|
|
9
|
+
export * from "@tanstack/hotkeys"
|
|
10
|
+
|
|
11
|
+
export { HotkeysProvider, useDefaultHotkeysOptions, useHeldKeyCodes, useHeldKeys, useHotkey, useHotkeyRecorder, useHotkeySequence, useHotkeysContext, useKeyHold };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
let _tanstack_hotkeys = require("@tanstack/hotkeys");
|
|
2
|
+
let _tanstack_preact_store = require("@tanstack/preact-store");
|
|
3
|
+
|
|
4
|
+
//#region src/useHeldKeyCodes.ts
|
|
5
|
+
/**
|
|
6
|
+
* Preact hook that returns a map of currently held key names to their physical `event.code` values.
|
|
7
|
+
*
|
|
8
|
+
* This is useful for debugging which physical key was pressed (e.g. distinguishing
|
|
9
|
+
* left vs right Shift via "ShiftLeft" / "ShiftRight").
|
|
10
|
+
*
|
|
11
|
+
* @returns Record mapping normalized key names to their `event.code` values
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* function KeyDebugDisplay() {
|
|
16
|
+
* const heldKeys = useHeldKeys()
|
|
17
|
+
* const heldCodes = useHeldKeyCodes()
|
|
18
|
+
*
|
|
19
|
+
* return (
|
|
20
|
+
* <div>
|
|
21
|
+
* {heldKeys.map((key) => (
|
|
22
|
+
* <kbd key={key}>
|
|
23
|
+
* {key} <small>{heldCodes[key]}</small>
|
|
24
|
+
* </kbd>
|
|
25
|
+
* ))}
|
|
26
|
+
* </div>
|
|
27
|
+
* )
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
function useHeldKeyCodes() {
|
|
32
|
+
return (0, _tanstack_preact_store.useStore)((0, _tanstack_hotkeys.getKeyStateTracker)().store, (state) => state.heldCodes);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.useHeldKeyCodes = useHeldKeyCodes;
|
|
37
|
+
//# sourceMappingURL=useHeldKeyCodes.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHeldKeyCodes.cjs","names":[],"sources":["../src/useHeldKeyCodes.ts"],"sourcesContent":["import { useStore } from '@tanstack/preact-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * Preact hook that returns a map of currently held key names to their physical `event.code` values.\n *\n * This is useful for debugging which physical key was pressed (e.g. distinguishing\n * left vs right Shift via \"ShiftLeft\" / \"ShiftRight\").\n *\n * @returns Record mapping normalized key names to their `event.code` values\n *\n * @example\n * ```tsx\n * function KeyDebugDisplay() {\n * const heldKeys = useHeldKeys()\n * const heldCodes = useHeldKeyCodes()\n *\n * return (\n * <div>\n * {heldKeys.map((key) => (\n * <kbd key={key}>\n * {key} <small>{heldCodes[key]}</small>\n * </kbd>\n * ))}\n * </div>\n * )\n * }\n * ```\n */\nexport function useHeldKeyCodes(): Record<string, string> {\n const tracker = getKeyStateTracker()\n return useStore(tracker.store, (state) => state.heldCodes)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,kBAA0C;AAExD,wFADoC,CACZ,QAAQ,UAAU,MAAM,UAAU"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/useHeldKeyCodes.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Preact hook that returns a map of currently held key names to their physical `event.code` values.
|
|
4
|
+
*
|
|
5
|
+
* This is useful for debugging which physical key was pressed (e.g. distinguishing
|
|
6
|
+
* left vs right Shift via "ShiftLeft" / "ShiftRight").
|
|
7
|
+
*
|
|
8
|
+
* @returns Record mapping normalized key names to their `event.code` values
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* function KeyDebugDisplay() {
|
|
13
|
+
* const heldKeys = useHeldKeys()
|
|
14
|
+
* const heldCodes = useHeldKeyCodes()
|
|
15
|
+
*
|
|
16
|
+
* return (
|
|
17
|
+
* <div>
|
|
18
|
+
* {heldKeys.map((key) => (
|
|
19
|
+
* <kbd key={key}>
|
|
20
|
+
* {key} <small>{heldCodes[key]}</small>
|
|
21
|
+
* </kbd>
|
|
22
|
+
* ))}
|
|
23
|
+
* </div>
|
|
24
|
+
* )
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare function useHeldKeyCodes(): Record<string, string>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { useHeldKeyCodes };
|
|
31
|
+
//# sourceMappingURL=useHeldKeyCodes.d.cts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/useHeldKeyCodes.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Preact hook that returns a map of currently held key names to their physical `event.code` values.
|
|
4
|
+
*
|
|
5
|
+
* This is useful for debugging which physical key was pressed (e.g. distinguishing
|
|
6
|
+
* left vs right Shift via "ShiftLeft" / "ShiftRight").
|
|
7
|
+
*
|
|
8
|
+
* @returns Record mapping normalized key names to their `event.code` values
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* function KeyDebugDisplay() {
|
|
13
|
+
* const heldKeys = useHeldKeys()
|
|
14
|
+
* const heldCodes = useHeldKeyCodes()
|
|
15
|
+
*
|
|
16
|
+
* return (
|
|
17
|
+
* <div>
|
|
18
|
+
* {heldKeys.map((key) => (
|
|
19
|
+
* <kbd key={key}>
|
|
20
|
+
* {key} <small>{heldCodes[key]}</small>
|
|
21
|
+
* </kbd>
|
|
22
|
+
* ))}
|
|
23
|
+
* </div>
|
|
24
|
+
* )
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare function useHeldKeyCodes(): Record<string, string>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { useHeldKeyCodes };
|
|
31
|
+
//# sourceMappingURL=useHeldKeyCodes.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getKeyStateTracker } from "@tanstack/hotkeys";
|
|
2
|
+
import { useStore } from "@tanstack/preact-store";
|
|
3
|
+
|
|
4
|
+
//#region src/useHeldKeyCodes.ts
|
|
5
|
+
/**
|
|
6
|
+
* Preact hook that returns a map of currently held key names to their physical `event.code` values.
|
|
7
|
+
*
|
|
8
|
+
* This is useful for debugging which physical key was pressed (e.g. distinguishing
|
|
9
|
+
* left vs right Shift via "ShiftLeft" / "ShiftRight").
|
|
10
|
+
*
|
|
11
|
+
* @returns Record mapping normalized key names to their `event.code` values
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* function KeyDebugDisplay() {
|
|
16
|
+
* const heldKeys = useHeldKeys()
|
|
17
|
+
* const heldCodes = useHeldKeyCodes()
|
|
18
|
+
*
|
|
19
|
+
* return (
|
|
20
|
+
* <div>
|
|
21
|
+
* {heldKeys.map((key) => (
|
|
22
|
+
* <kbd key={key}>
|
|
23
|
+
* {key} <small>{heldCodes[key]}</small>
|
|
24
|
+
* </kbd>
|
|
25
|
+
* ))}
|
|
26
|
+
* </div>
|
|
27
|
+
* )
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
function useHeldKeyCodes() {
|
|
32
|
+
return useStore(getKeyStateTracker().store, (state) => state.heldCodes);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { useHeldKeyCodes };
|
|
37
|
+
//# sourceMappingURL=useHeldKeyCodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHeldKeyCodes.js","names":[],"sources":["../src/useHeldKeyCodes.ts"],"sourcesContent":["import { useStore } from '@tanstack/preact-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * Preact hook that returns a map of currently held key names to their physical `event.code` values.\n *\n * This is useful for debugging which physical key was pressed (e.g. distinguishing\n * left vs right Shift via \"ShiftLeft\" / \"ShiftRight\").\n *\n * @returns Record mapping normalized key names to their `event.code` values\n *\n * @example\n * ```tsx\n * function KeyDebugDisplay() {\n * const heldKeys = useHeldKeys()\n * const heldCodes = useHeldKeyCodes()\n *\n * return (\n * <div>\n * {heldKeys.map((key) => (\n * <kbd key={key}>\n * {key} <small>{heldCodes[key]}</small>\n * </kbd>\n * ))}\n * </div>\n * )\n * }\n * ```\n */\nexport function useHeldKeyCodes(): Record<string, string> {\n const tracker = getKeyStateTracker()\n return useStore(tracker.store, (state) => state.heldCodes)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,kBAA0C;AAExD,QAAO,SADS,oBAAoB,CACZ,QAAQ,UAAU,MAAM,UAAU"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
let _tanstack_hotkeys = require("@tanstack/hotkeys");
|
|
2
|
+
let _tanstack_preact_store = require("@tanstack/preact-store");
|
|
3
|
+
|
|
4
|
+
//#region src/useHeldKeys.ts
|
|
5
|
+
/**
|
|
6
|
+
* Preact hook that returns an array of currently held keyboard keys.
|
|
7
|
+
*
|
|
8
|
+
* This hook uses `useStore` from `@tanstack/preact-store` to subscribe
|
|
9
|
+
* to the global KeyStateTracker and updates whenever keys are pressed
|
|
10
|
+
* or released.
|
|
11
|
+
*
|
|
12
|
+
* @returns Array of currently held key names
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* function KeyDisplay() {
|
|
17
|
+
* const heldKeys = useHeldKeys()
|
|
18
|
+
*
|
|
19
|
+
* return (
|
|
20
|
+
* <div>
|
|
21
|
+
* Currently pressed: {heldKeys.join(' + ') || 'None'}
|
|
22
|
+
* </div>
|
|
23
|
+
* )
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
function useHeldKeys() {
|
|
28
|
+
return (0, _tanstack_preact_store.useStore)((0, _tanstack_hotkeys.getKeyStateTracker)().store, (state) => state.heldKeys);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.useHeldKeys = useHeldKeys;
|
|
33
|
+
//# sourceMappingURL=useHeldKeys.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHeldKeys.cjs","names":[],"sources":["../src/useHeldKeys.ts"],"sourcesContent":["import { useStore } from '@tanstack/preact-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * Preact hook that returns an array of currently held keyboard keys.\n *\n * This hook uses `useStore` from `@tanstack/preact-store` to subscribe\n * to the global KeyStateTracker and updates whenever keys are pressed\n * or released.\n *\n * @returns Array of currently held key names\n *\n * @example\n * ```tsx\n * function KeyDisplay() {\n * const heldKeys = useHeldKeys()\n *\n * return (\n * <div>\n * Currently pressed: {heldKeys.join(' + ') || 'None'}\n * </div>\n * )\n * }\n * ```\n */\nexport function useHeldKeys(): Array<string> {\n const tracker = getKeyStateTracker()\n return useStore(tracker.store, (state) => state.heldKeys)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,cAA6B;AAE3C,wFADoC,CACZ,QAAQ,UAAU,MAAM,SAAS"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/useHeldKeys.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Preact hook that returns an array of currently held keyboard keys.
|
|
4
|
+
*
|
|
5
|
+
* This hook uses `useStore` from `@tanstack/preact-store` to subscribe
|
|
6
|
+
* to the global KeyStateTracker and updates whenever keys are pressed
|
|
7
|
+
* or released.
|
|
8
|
+
*
|
|
9
|
+
* @returns Array of currently held key names
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* function KeyDisplay() {
|
|
14
|
+
* const heldKeys = useHeldKeys()
|
|
15
|
+
*
|
|
16
|
+
* return (
|
|
17
|
+
* <div>
|
|
18
|
+
* Currently pressed: {heldKeys.join(' + ') || 'None'}
|
|
19
|
+
* </div>
|
|
20
|
+
* )
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function useHeldKeys(): Array<string>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { useHeldKeys };
|
|
27
|
+
//# sourceMappingURL=useHeldKeys.d.cts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/useHeldKeys.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Preact hook that returns an array of currently held keyboard keys.
|
|
4
|
+
*
|
|
5
|
+
* This hook uses `useStore` from `@tanstack/preact-store` to subscribe
|
|
6
|
+
* to the global KeyStateTracker and updates whenever keys are pressed
|
|
7
|
+
* or released.
|
|
8
|
+
*
|
|
9
|
+
* @returns Array of currently held key names
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* function KeyDisplay() {
|
|
14
|
+
* const heldKeys = useHeldKeys()
|
|
15
|
+
*
|
|
16
|
+
* return (
|
|
17
|
+
* <div>
|
|
18
|
+
* Currently pressed: {heldKeys.join(' + ') || 'None'}
|
|
19
|
+
* </div>
|
|
20
|
+
* )
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare function useHeldKeys(): Array<string>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { useHeldKeys };
|
|
27
|
+
//# sourceMappingURL=useHeldKeys.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getKeyStateTracker } from "@tanstack/hotkeys";
|
|
2
|
+
import { useStore } from "@tanstack/preact-store";
|
|
3
|
+
|
|
4
|
+
//#region src/useHeldKeys.ts
|
|
5
|
+
/**
|
|
6
|
+
* Preact hook that returns an array of currently held keyboard keys.
|
|
7
|
+
*
|
|
8
|
+
* This hook uses `useStore` from `@tanstack/preact-store` to subscribe
|
|
9
|
+
* to the global KeyStateTracker and updates whenever keys are pressed
|
|
10
|
+
* or released.
|
|
11
|
+
*
|
|
12
|
+
* @returns Array of currently held key names
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* function KeyDisplay() {
|
|
17
|
+
* const heldKeys = useHeldKeys()
|
|
18
|
+
*
|
|
19
|
+
* return (
|
|
20
|
+
* <div>
|
|
21
|
+
* Currently pressed: {heldKeys.join(' + ') || 'None'}
|
|
22
|
+
* </div>
|
|
23
|
+
* )
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
function useHeldKeys() {
|
|
28
|
+
return useStore(getKeyStateTracker().store, (state) => state.heldKeys);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { useHeldKeys };
|
|
33
|
+
//# sourceMappingURL=useHeldKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHeldKeys.js","names":[],"sources":["../src/useHeldKeys.ts"],"sourcesContent":["import { useStore } from '@tanstack/preact-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * Preact hook that returns an array of currently held keyboard keys.\n *\n * This hook uses `useStore` from `@tanstack/preact-store` to subscribe\n * to the global KeyStateTracker and updates whenever keys are pressed\n * or released.\n *\n * @returns Array of currently held key names\n *\n * @example\n * ```tsx\n * function KeyDisplay() {\n * const heldKeys = useHeldKeys()\n *\n * return (\n * <div>\n * Currently pressed: {heldKeys.join(' + ') || 'None'}\n * </div>\n * )\n * }\n * ```\n */\nexport function useHeldKeys(): Array<string> {\n const tracker = getKeyStateTracker()\n return useStore(tracker.store, (state) => state.heldKeys)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,cAA6B;AAE3C,QAAO,SADS,oBAAoB,CACZ,QAAQ,UAAU,MAAM,SAAS"}
|