@tanstack/react-hotkeys 0.10.0 → 0.12.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 +15 -1
- package/dist/HotkeysProvider.d.ts +6 -12
- package/dist/HotkeysProvider.js +1 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/useHeldKeyCodes.d.ts +2 -4
- package/dist/useHeldKeyCodes.js +3 -3
- package/dist/useHeldKeys.d.ts +2 -4
- package/dist/useHeldKeys.js +3 -3
- package/dist/useHotkey.d.ts +3 -6
- package/dist/useHotkey.js +12 -8
- package/dist/useHotkeyHint.d.ts +11 -0
- package/dist/useHotkeyHint.js +17 -0
- package/dist/useHotkeyRecorder.d.ts +3 -6
- package/dist/useHotkeyRecorder.js +1 -2
- package/dist/useHotkeyRegistrations.d.ts +3 -6
- package/dist/useHotkeyRegistrations.js +1 -2
- package/dist/useHotkeySequence.d.ts +3 -6
- package/dist/useHotkeySequence.js +10 -7
- package/dist/useHotkeySequenceRecorder.d.ts +3 -6
- package/dist/useHotkeySequenceRecorder.js +1 -2
- package/dist/useHotkeySequences.d.ts +3 -6
- package/dist/useHotkeySequences.js +4 -17
- package/dist/useHotkeys.d.ts +3 -6
- package/dist/useHotkeys.js +4 -17
- package/dist/useKeyHold.d.ts +2 -5
- package/dist/useKeyHold.js +1 -2
- package/dist/utils.js +1 -2
- package/package.json +14 -19
- package/dist/HotkeysProvider.cjs +0 -23
- package/dist/HotkeysProvider.cjs.map +0 -1
- package/dist/HotkeysProvider.d.cts +0 -28
- package/dist/HotkeysProvider.js.map +0 -1
- package/dist/_virtual/_rolldown/runtime.cjs +0 -29
- package/dist/index.cjs +0 -33
- package/dist/index.d.cts +0 -13
- package/dist/useHeldKeyCodes.cjs +0 -38
- package/dist/useHeldKeyCodes.cjs.map +0 -1
- package/dist/useHeldKeyCodes.d.cts +0 -31
- package/dist/useHeldKeyCodes.js.map +0 -1
- package/dist/useHeldKeys.cjs +0 -34
- package/dist/useHeldKeys.cjs.map +0 -1
- package/dist/useHeldKeys.d.cts +0 -27
- package/dist/useHeldKeys.js.map +0 -1
- package/dist/useHotkey.cjs +0 -122
- package/dist/useHotkey.cjs.map +0 -1
- package/dist/useHotkey.d.cts +0 -74
- package/dist/useHotkey.js.map +0 -1
- package/dist/useHotkeyRecorder.cjs +0 -72
- package/dist/useHotkeyRecorder.cjs.map +0 -1
- package/dist/useHotkeyRecorder.d.cts +0 -57
- package/dist/useHotkeyRecorder.js.map +0 -1
- package/dist/useHotkeyRegistrations.cjs +0 -49
- package/dist/useHotkeyRegistrations.cjs.map +0 -1
- package/dist/useHotkeyRegistrations.d.cts +0 -48
- package/dist/useHotkeyRegistrations.js.map +0 -1
- package/dist/useHotkeySequence.cjs +0 -117
- package/dist/useHotkeySequence.cjs.map +0 -1
- package/dist/useHotkeySequence.d.cts +0 -58
- package/dist/useHotkeySequence.js.map +0 -1
- package/dist/useHotkeySequenceRecorder.cjs +0 -42
- package/dist/useHotkeySequenceRecorder.cjs.map +0 -1
- package/dist/useHotkeySequenceRecorder.d.cts +0 -25
- package/dist/useHotkeySequenceRecorder.js.map +0 -1
- package/dist/useHotkeySequences.cjs +0 -139
- package/dist/useHotkeySequences.cjs.map +0 -1
- package/dist/useHotkeySequences.d.cts +0 -63
- package/dist/useHotkeySequences.js.map +0 -1
- package/dist/useHotkeys.cjs +0 -137
- package/dist/useHotkeys.cjs.map +0 -1
- package/dist/useHotkeys.d.cts +0 -63
- package/dist/useHotkeys.js.map +0 -1
- package/dist/useKeyHold.cjs +0 -54
- package/dist/useKeyHold.cjs.map +0 -1
- package/dist/useKeyHold.d.cts +0 -47
- package/dist/useKeyHold.js.map +0 -1
- package/dist/utils.cjs +0 -12
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.js.map +0 -1
- package/src/HotkeysProvider.tsx +0 -58
- package/src/index.ts +0 -17
- package/src/useHeldKeyCodes.ts +0 -33
- package/src/useHeldKeys.ts +0 -29
- package/src/useHotkey.ts +0 -187
- package/src/useHotkeyRecorder.ts +0 -101
- package/src/useHotkeyRegistrations.ts +0 -67
- package/src/useHotkeySequence.ts +0 -187
- package/src/useHotkeySequenceRecorder.ts +0 -70
- package/src/useHotkeySequences.ts +0 -206
- package/src/useHotkeys.ts +0 -208
- package/src/useKeyHold.ts +0 -52
- package/src/utils.ts +0 -10
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HotkeysProvider.js","names":[],"sources":["../src/HotkeysProvider.tsx"],"sourcesContent":["import React, { createContext, useContext, useMemo } from 'react'\nimport type { ReactNode } from 'react'\nimport type {\n HotkeyRecorderOptions,\n HotkeySequenceRecorderOptions,\n} 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 hotkeySequenceRecorder?: Partial<HotkeySequenceRecorderOptions>\n}\n\ninterface HotkeysContextValue {\n defaultOptions: HotkeysProviderOptions\n}\n\nconst HotkeysContext = createContext<HotkeysContextValue | null>(null)\n\nexport interface HotkeysProviderProps {\n children: ReactNode\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 // eslint-disable-next-line @eslint-react/no-context-provider -- React 19+ only; we support React >=16.8\n <HotkeysContext.Provider value={contextValue}>\n {children}\n </HotkeysContext.Provider>\n )\n}\n\nexport function useHotkeysContext() {\n // eslint-disable-next-line @eslint-react/no-use-context -- React 19+ only; we support React >=16.8\n return useContext(HotkeysContext)\n}\n\nexport function useDefaultHotkeysOptions() {\n // eslint-disable-next-line @eslint-react/no-use-context -- React 19+ only; we support React >=16.8\n const context = useContext(HotkeysContext)\n return context?.defaultOptions ?? {}\n}\n"],"mappings":";;;AAoBA,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,QAEE,oCAAC,eAAe,UAAhB,EAAyB,OAAO,cAEN,EADvB,SACuB;;AAI9B,SAAgB,oBAAoB;AAElC,QAAO,WAAW,eAAe;;AAGnC,SAAgB,2BAA2B;AAGzC,QADgB,WAAW,eAAe,EAC1B,kBAAkB,EAAE"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
|
|
29
|
-
exports.__toESM = __toESM;
|
package/dist/index.cjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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_useHotkeys = require('./useHotkeys.cjs');
|
|
5
|
-
const require_useHeldKeys = require('./useHeldKeys.cjs');
|
|
6
|
-
const require_useHeldKeyCodes = require('./useHeldKeyCodes.cjs');
|
|
7
|
-
const require_useKeyHold = require('./useKeyHold.cjs');
|
|
8
|
-
const require_useHotkeySequence = require('./useHotkeySequence.cjs');
|
|
9
|
-
const require_useHotkeySequences = require('./useHotkeySequences.cjs');
|
|
10
|
-
const require_useHotkeyRecorder = require('./useHotkeyRecorder.cjs');
|
|
11
|
-
const require_useHotkeyRegistrations = require('./useHotkeyRegistrations.cjs');
|
|
12
|
-
const require_useHotkeySequenceRecorder = require('./useHotkeySequenceRecorder.cjs');
|
|
13
|
-
|
|
14
|
-
exports.HotkeysProvider = require_HotkeysProvider.HotkeysProvider;
|
|
15
|
-
exports.useDefaultHotkeysOptions = require_HotkeysProvider.useDefaultHotkeysOptions;
|
|
16
|
-
exports.useHeldKeyCodes = require_useHeldKeyCodes.useHeldKeyCodes;
|
|
17
|
-
exports.useHeldKeys = require_useHeldKeys.useHeldKeys;
|
|
18
|
-
exports.useHotkey = require_useHotkey.useHotkey;
|
|
19
|
-
exports.useHotkeyRecorder = require_useHotkeyRecorder.useHotkeyRecorder;
|
|
20
|
-
exports.useHotkeyRegistrations = require_useHotkeyRegistrations.useHotkeyRegistrations;
|
|
21
|
-
exports.useHotkeySequence = require_useHotkeySequence.useHotkeySequence;
|
|
22
|
-
exports.useHotkeySequenceRecorder = require_useHotkeySequenceRecorder.useHotkeySequenceRecorder;
|
|
23
|
-
exports.useHotkeySequences = require_useHotkeySequences.useHotkeySequences;
|
|
24
|
-
exports.useHotkeys = require_useHotkeys.useHotkeys;
|
|
25
|
-
exports.useHotkeysContext = require_HotkeysProvider.useHotkeysContext;
|
|
26
|
-
exports.useKeyHold = require_useKeyHold.useKeyHold;
|
|
27
|
-
var _tanstack_hotkeys = require("@tanstack/hotkeys");
|
|
28
|
-
Object.keys(_tanstack_hotkeys).forEach(function (k) {
|
|
29
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () { return _tanstack_hotkeys[k]; }
|
|
32
|
-
});
|
|
33
|
-
});
|
package/dist/index.d.cts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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 { UseHotkeyDefinition, useHotkeys } from "./useHotkeys.cjs";
|
|
5
|
-
import { useHeldKeys } from "./useHeldKeys.cjs";
|
|
6
|
-
import { useHeldKeyCodes } from "./useHeldKeyCodes.cjs";
|
|
7
|
-
import { useKeyHold } from "./useKeyHold.cjs";
|
|
8
|
-
import { UseHotkeySequenceDefinition, useHotkeySequences } from "./useHotkeySequences.cjs";
|
|
9
|
-
import { ReactHotkeyRecorder, useHotkeyRecorder } from "./useHotkeyRecorder.cjs";
|
|
10
|
-
import { HotkeyRegistrationsResult, useHotkeyRegistrations } from "./useHotkeyRegistrations.cjs";
|
|
11
|
-
import { ReactHotkeySequenceRecorder, useHotkeySequenceRecorder } from "./useHotkeySequenceRecorder.cjs";
|
|
12
|
-
export * from "@tanstack/hotkeys";
|
|
13
|
-
export { HotkeyRegistrationsResult, HotkeysProvider, HotkeysProviderOptions, HotkeysProviderProps, ReactHotkeyRecorder, ReactHotkeySequenceRecorder, UseHotkeyDefinition, UseHotkeyOptions, UseHotkeySequenceDefinition, UseHotkeySequenceOptions, useDefaultHotkeysOptions, useHeldKeyCodes, useHeldKeys, useHotkey, useHotkeyRecorder, useHotkeyRegistrations, useHotkeySequence, useHotkeySequenceRecorder, useHotkeySequences, useHotkeys, useHotkeysContext, useKeyHold };
|
package/dist/useHeldKeyCodes.cjs
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
let _tanstack_hotkeys = require("@tanstack/hotkeys");
|
|
3
|
-
let _tanstack_react_store = require("@tanstack/react-store");
|
|
4
|
-
|
|
5
|
-
//#region src/useHeldKeyCodes.ts
|
|
6
|
-
/**
|
|
7
|
-
* React hook that returns a map of currently held key names to their physical `event.code` values.
|
|
8
|
-
*
|
|
9
|
-
* This is useful for debugging which physical key was pressed (e.g. distinguishing
|
|
10
|
-
* left vs right Shift via "ShiftLeft" / "ShiftRight").
|
|
11
|
-
*
|
|
12
|
-
* @returns Record mapping normalized key names to their `event.code` values
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* function KeyDebugDisplay() {
|
|
17
|
-
* const heldKeys = useHeldKeys()
|
|
18
|
-
* const heldCodes = useHeldKeyCodes()
|
|
19
|
-
*
|
|
20
|
-
* return (
|
|
21
|
-
* <div>
|
|
22
|
-
* {heldKeys.map((key) => (
|
|
23
|
-
* <kbd key={key}>
|
|
24
|
-
* {key} <small>{heldCodes[key]}</small>
|
|
25
|
-
* </kbd>
|
|
26
|
-
* ))}
|
|
27
|
-
* </div>
|
|
28
|
-
* )
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
function useHeldKeyCodes() {
|
|
33
|
-
return (0, _tanstack_react_store.useSelector)((0, _tanstack_hotkeys.getKeyStateTracker)().store, (state) => state.heldCodes);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
//#endregion
|
|
37
|
-
exports.useHeldKeyCodes = useHeldKeyCodes;
|
|
38
|
-
//# sourceMappingURL=useHeldKeyCodes.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHeldKeyCodes.cjs","names":[],"sources":["../src/useHeldKeyCodes.ts"],"sourcesContent":["import { useSelector } from '@tanstack/react-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * React 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 useSelector(tracker.store, (state) => state.heldCodes)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,kBAA0C;AAExD,0FADoC,CACT,QAAQ,UAAU,MAAM,UAAU"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
//#region src/useHeldKeyCodes.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* React 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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHeldKeyCodes.js","names":[],"sources":["../src/useHeldKeyCodes.ts"],"sourcesContent":["import { useSelector } from '@tanstack/react-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * React 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 useSelector(tracker.store, (state) => state.heldCodes)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,kBAA0C;AAExD,QAAO,YADS,oBAAoB,CACT,QAAQ,UAAU,MAAM,UAAU"}
|
package/dist/useHeldKeys.cjs
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
let _tanstack_hotkeys = require("@tanstack/hotkeys");
|
|
3
|
-
let _tanstack_react_store = require("@tanstack/react-store");
|
|
4
|
-
|
|
5
|
-
//#region src/useHeldKeys.ts
|
|
6
|
-
/**
|
|
7
|
-
* React hook that returns an array of currently held keyboard keys.
|
|
8
|
-
*
|
|
9
|
-
* This hook uses `useSelector` from `@tanstack/react-store` to subscribe
|
|
10
|
-
* to the global KeyStateTracker and updates whenever keys are pressed
|
|
11
|
-
* or released.
|
|
12
|
-
*
|
|
13
|
-
* @returns Array of currently held key names
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* function KeyDisplay() {
|
|
18
|
-
* const heldKeys = useHeldKeys()
|
|
19
|
-
*
|
|
20
|
-
* return (
|
|
21
|
-
* <div>
|
|
22
|
-
* Currently pressed: {heldKeys.join(' + ') || 'None'}
|
|
23
|
-
* </div>
|
|
24
|
-
* )
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
function useHeldKeys() {
|
|
29
|
-
return (0, _tanstack_react_store.useSelector)((0, _tanstack_hotkeys.getKeyStateTracker)().store, (state) => state.heldKeys);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
exports.useHeldKeys = useHeldKeys;
|
|
34
|
-
//# sourceMappingURL=useHeldKeys.cjs.map
|
package/dist/useHeldKeys.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHeldKeys.cjs","names":[],"sources":["../src/useHeldKeys.ts"],"sourcesContent":["import { useSelector } from '@tanstack/react-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * React hook that returns an array of currently held keyboard keys.\n *\n * This hook uses `useSelector` from `@tanstack/react-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 useSelector(tracker.store, (state) => state.heldKeys)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,cAA6B;AAE3C,0FADoC,CACT,QAAQ,UAAU,MAAM,SAAS"}
|
package/dist/useHeldKeys.d.cts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//#region src/useHeldKeys.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* React hook that returns an array of currently held keyboard keys.
|
|
4
|
-
*
|
|
5
|
-
* This hook uses `useSelector` from `@tanstack/react-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
|
package/dist/useHeldKeys.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHeldKeys.js","names":[],"sources":["../src/useHeldKeys.ts"],"sourcesContent":["import { useSelector } from '@tanstack/react-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * React hook that returns an array of currently held keyboard keys.\n *\n * This hook uses `useSelector` from `@tanstack/react-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 useSelector(tracker.store, (state) => state.heldKeys)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,cAA6B;AAE3C,QAAO,YADS,oBAAoB,CACT,QAAQ,UAAU,MAAM,SAAS"}
|
package/dist/useHotkey.cjs
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_HotkeysProvider = require('./HotkeysProvider.cjs');
|
|
3
|
-
const require_utils = require('./utils.cjs');
|
|
4
|
-
let _tanstack_hotkeys = require("@tanstack/hotkeys");
|
|
5
|
-
let react = require("react");
|
|
6
|
-
|
|
7
|
-
//#region src/useHotkey.ts
|
|
8
|
-
/**
|
|
9
|
-
* React hook for registering a keyboard hotkey.
|
|
10
|
-
*
|
|
11
|
-
* Uses the singleton HotkeyManager for efficient event handling.
|
|
12
|
-
* The callback receives both the keyboard event and a context object
|
|
13
|
-
* containing the hotkey string and parsed hotkey.
|
|
14
|
-
*
|
|
15
|
-
* This hook syncs the callback and options on every render to avoid
|
|
16
|
-
* stale closures. This means
|
|
17
|
-
* callbacks that reference React state will always have access to
|
|
18
|
-
* the latest values.
|
|
19
|
-
*
|
|
20
|
-
* @param hotkey - The hotkey string (e.g., 'Mod+S', 'Escape') or RawHotkey object (supports `mod` for cross-platform)
|
|
21
|
-
* @param callback - The function to call when the hotkey is pressed
|
|
22
|
-
* @param options - Options for the hotkey behavior. `enabled: false` keeps the registration (visible in devtools)
|
|
23
|
-
* and only suppresses firing; the hook updates the existing handle instead of unregistering.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```tsx
|
|
27
|
-
* function SaveButton() {
|
|
28
|
-
* const [count, setCount] = useState(0)
|
|
29
|
-
*
|
|
30
|
-
* // Callback always has access to latest count value
|
|
31
|
-
* useHotkey('Mod+S', (event, { hotkey }) => {
|
|
32
|
-
* console.log(`Save triggered, count is ${count}`)
|
|
33
|
-
* handleSave()
|
|
34
|
-
* })
|
|
35
|
-
*
|
|
36
|
-
* return <button onClick={() => setCount(c => c + 1)}>Count: {count}</button>
|
|
37
|
-
* }
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```tsx
|
|
42
|
-
* function Modal({ isOpen, onClose }) {
|
|
43
|
-
* // enabled option is synced on every render
|
|
44
|
-
* useHotkey('Escape', () => {
|
|
45
|
-
* onClose()
|
|
46
|
-
* }, { enabled: isOpen })
|
|
47
|
-
*
|
|
48
|
-
* if (!isOpen) return null
|
|
49
|
-
* return <div className="modal">...</div>
|
|
50
|
-
* }
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```tsx
|
|
55
|
-
* function Editor() {
|
|
56
|
-
* const editorRef = useRef<HTMLDivElement>(null)
|
|
57
|
-
*
|
|
58
|
-
* // Scoped to a specific element
|
|
59
|
-
* useHotkey('Mod+S', () => {
|
|
60
|
-
* save()
|
|
61
|
-
* }, { target: editorRef })
|
|
62
|
-
*
|
|
63
|
-
* return <div ref={editorRef}>...</div>
|
|
64
|
-
* }
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
function useHotkey(hotkey, callback, options = {}) {
|
|
68
|
-
const mergedOptions = {
|
|
69
|
-
...require_HotkeysProvider.useDefaultHotkeysOptions().hotkey,
|
|
70
|
-
...options
|
|
71
|
-
};
|
|
72
|
-
const manager = (0, _tanstack_hotkeys.getHotkeyManager)();
|
|
73
|
-
const registrationRef = (0, react.useRef)(null);
|
|
74
|
-
const callbackRef = (0, react.useRef)(callback);
|
|
75
|
-
const optionsRef = (0, react.useRef)(mergedOptions);
|
|
76
|
-
const managerRef = (0, react.useRef)(manager);
|
|
77
|
-
callbackRef.current = callback;
|
|
78
|
-
optionsRef.current = mergedOptions;
|
|
79
|
-
managerRef.current = manager;
|
|
80
|
-
const prevTargetRef = (0, react.useRef)(null);
|
|
81
|
-
const prevHotkeyRef = (0, react.useRef)(null);
|
|
82
|
-
const hotkeyString = (0, _tanstack_hotkeys.normalizeRegisterableHotkey)(hotkey, mergedOptions.platform ?? (0, _tanstack_hotkeys.detectPlatform)());
|
|
83
|
-
const { target: _target, ...optionsWithoutTarget } = mergedOptions;
|
|
84
|
-
(0, react.useEffect)(() => {
|
|
85
|
-
const resolvedTarget = require_utils.isRef(optionsRef.current.target) ? optionsRef.current.target.current : optionsRef.current.target ?? (typeof document !== "undefined" ? document : null);
|
|
86
|
-
if (!resolvedTarget) {
|
|
87
|
-
if (registrationRef.current?.isActive) {
|
|
88
|
-
registrationRef.current.unregister();
|
|
89
|
-
registrationRef.current = null;
|
|
90
|
-
}
|
|
91
|
-
prevTargetRef.current = null;
|
|
92
|
-
prevHotkeyRef.current = null;
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const targetChanged = prevTargetRef.current !== null && prevTargetRef.current !== resolvedTarget;
|
|
96
|
-
const hotkeyChanged = prevHotkeyRef.current !== null && prevHotkeyRef.current !== hotkeyString;
|
|
97
|
-
if (registrationRef.current?.isActive && (targetChanged || hotkeyChanged)) {
|
|
98
|
-
registrationRef.current.unregister();
|
|
99
|
-
registrationRef.current = null;
|
|
100
|
-
}
|
|
101
|
-
if (!registrationRef.current || !registrationRef.current.isActive) registrationRef.current = managerRef.current.register(hotkeyString, callbackRef.current, {
|
|
102
|
-
...optionsRef.current,
|
|
103
|
-
target: resolvedTarget
|
|
104
|
-
});
|
|
105
|
-
prevTargetRef.current = resolvedTarget;
|
|
106
|
-
prevHotkeyRef.current = hotkeyString;
|
|
107
|
-
return () => {
|
|
108
|
-
if (registrationRef.current?.isActive) {
|
|
109
|
-
registrationRef.current.unregister();
|
|
110
|
-
registrationRef.current = null;
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}, [hotkeyString]);
|
|
114
|
-
if (registrationRef.current?.isActive) {
|
|
115
|
-
registrationRef.current.callback = callback;
|
|
116
|
-
registrationRef.current.setOptions(optionsWithoutTarget);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
//#endregion
|
|
121
|
-
exports.useHotkey = useHotkey;
|
|
122
|
-
//# sourceMappingURL=useHotkey.cjs.map
|
package/dist/useHotkey.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHotkey.cjs","names":["useDefaultHotkeysOptions","isRef"],"sources":["../src/useHotkey.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\nimport {\n detectPlatform,\n getHotkeyManager,\n normalizeRegisterableHotkey,\n} from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport { isRef } from './utils'\nimport type {\n HotkeyCallback,\n HotkeyOptions,\n HotkeyRegistrationHandle,\n RegisterableHotkey,\n} from '@tanstack/hotkeys'\n\nexport interface UseHotkeyOptions extends Omit<HotkeyOptions, 'target'> {\n /**\n * The DOM element to attach the event listener to.\n * Can be a React ref, direct DOM element, or null.\n * Defaults to document.\n */\n target?:\n | React.RefObject<HTMLElement | null>\n | HTMLElement\n | Document\n | Window\n | null\n}\n\n/**\n * React hook for registering a keyboard hotkey.\n *\n * Uses the singleton HotkeyManager for efficient event handling.\n * The callback receives both the keyboard event and a context object\n * containing the hotkey string and parsed hotkey.\n *\n * This hook syncs the callback and options on every render to avoid\n * stale closures. This means\n * callbacks that reference React state will always have access to\n * the latest values.\n *\n * @param hotkey - The hotkey string (e.g., 'Mod+S', 'Escape') or RawHotkey object (supports `mod` for cross-platform)\n * @param callback - The function to call when the hotkey is pressed\n * @param options - Options for the hotkey behavior. `enabled: false` keeps the registration (visible in devtools)\n * and only suppresses firing; the hook updates the existing handle instead of unregistering.\n *\n * @example\n * ```tsx\n * function SaveButton() {\n * const [count, setCount] = useState(0)\n *\n * // Callback always has access to latest count value\n * useHotkey('Mod+S', (event, { hotkey }) => {\n * console.log(`Save triggered, count is ${count}`)\n * handleSave()\n * })\n *\n * return <button onClick={() => setCount(c => c + 1)}>Count: {count}</button>\n * }\n * ```\n *\n * @example\n * ```tsx\n * function Modal({ isOpen, onClose }) {\n * // enabled option is synced on every render\n * useHotkey('Escape', () => {\n * onClose()\n * }, { enabled: isOpen })\n *\n * if (!isOpen) return null\n * return <div className=\"modal\">...</div>\n * }\n * ```\n *\n * @example\n * ```tsx\n * function Editor() {\n * const editorRef = useRef<HTMLDivElement>(null)\n *\n * // Scoped to a specific element\n * useHotkey('Mod+S', () => {\n * save()\n * }, { target: editorRef })\n *\n * return <div ref={editorRef}>...</div>\n * }\n * ```\n */\nexport function useHotkey(\n hotkey: RegisterableHotkey,\n callback: HotkeyCallback,\n options: UseHotkeyOptions = {},\n): void {\n const mergedOptions = {\n ...useDefaultHotkeysOptions().hotkey,\n ...options,\n } as UseHotkeyOptions\n\n const manager = getHotkeyManager()\n\n // Stable ref for registration handle\n const registrationRef = useRef<HotkeyRegistrationHandle | null>(null)\n\n // Refs to capture current values for use in effect without adding dependencies\n const callbackRef = useRef(callback)\n const optionsRef = useRef(mergedOptions)\n const managerRef = useRef(manager)\n\n // Update refs on every render\n callbackRef.current = callback\n optionsRef.current = mergedOptions\n managerRef.current = manager\n\n // Track previous target and hotkey to detect changes requiring re-registration\n const prevTargetRef = useRef<HTMLElement | Document | Window | null>(null)\n const prevHotkeyRef = useRef<string | null>(null)\n\n // Normalize to hotkey string\n const platform = mergedOptions.platform ?? detectPlatform()\n const hotkeyString = normalizeRegisterableHotkey(hotkey, platform)\n\n // Extract options without target (target is handled separately)\n const { target: _target, ...optionsWithoutTarget } = mergedOptions\n\n useEffect(() => {\n // Resolve target inside the effect so refs are already attached after mount\n const resolvedTarget = isRef(optionsRef.current.target)\n ? optionsRef.current.target.current\n : (optionsRef.current.target ??\n (typeof document !== 'undefined' ? document : null))\n\n // Skip if no valid target (SSR or ref still null)\n if (!resolvedTarget) {\n if (registrationRef.current?.isActive) {\n registrationRef.current.unregister()\n registrationRef.current = null\n }\n prevTargetRef.current = null\n prevHotkeyRef.current = null\n return\n }\n\n // Check if we need to re-register (target or hotkey changed)\n const targetChanged =\n prevTargetRef.current !== null && prevTargetRef.current !== resolvedTarget\n const hotkeyChanged =\n prevHotkeyRef.current !== null && prevHotkeyRef.current !== hotkeyString\n\n // If we have an active registration and target/hotkey changed, unregister first\n if (registrationRef.current?.isActive && (targetChanged || hotkeyChanged)) {\n registrationRef.current.unregister()\n registrationRef.current = null\n }\n\n // Register if needed (no active registration)\n // Use refs to access current values without adding them to dependencies\n if (!registrationRef.current || !registrationRef.current.isActive) {\n registrationRef.current = managerRef.current.register(\n hotkeyString,\n callbackRef.current,\n {\n ...optionsRef.current,\n target: resolvedTarget,\n },\n )\n }\n\n // Update tracking refs\n prevTargetRef.current = resolvedTarget\n prevHotkeyRef.current = hotkeyString\n\n // Cleanup on unmount\n return () => {\n if (registrationRef.current?.isActive) {\n registrationRef.current.unregister()\n registrationRef.current = null\n }\n }\n }, [hotkeyString])\n\n // Sync callback and options on EVERY render (outside useEffect)\n // This avoids stale closures - the callback always has access to latest state\n if (registrationRef.current?.isActive) {\n registrationRef.current.callback = callback\n registrationRef.current.setOptions(optionsWithoutTarget)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,SAAgB,UACd,QACA,UACA,UAA4B,EAAE,EACxB;CACN,MAAM,gBAAgB;EACpB,GAAGA,kDAA0B,CAAC;EAC9B,GAAG;EACJ;CAED,MAAM,mDAA4B;CAGlC,MAAM,oCAA0D,KAAK;CAGrE,MAAM,gCAAqB,SAAS;CACpC,MAAM,+BAAoB,cAAc;CACxC,MAAM,+BAAoB,QAAQ;AAGlC,aAAY,UAAU;AACtB,YAAW,UAAU;AACrB,YAAW,UAAU;CAGrB,MAAM,kCAA+D,KAAK;CAC1E,MAAM,kCAAsC,KAAK;CAIjD,MAAM,kEAA2C,QADhC,cAAc,mDAA4B,CACO;CAGlE,MAAM,EAAE,QAAQ,SAAS,GAAG,yBAAyB;AAErD,4BAAgB;EAEd,MAAM,iBAAiBC,oBAAM,WAAW,QAAQ,OAAO,GACnD,WAAW,QAAQ,OAAO,UACzB,WAAW,QAAQ,WACnB,OAAO,aAAa,cAAc,WAAW;AAGlD,MAAI,CAAC,gBAAgB;AACnB,OAAI,gBAAgB,SAAS,UAAU;AACrC,oBAAgB,QAAQ,YAAY;AACpC,oBAAgB,UAAU;;AAE5B,iBAAc,UAAU;AACxB,iBAAc,UAAU;AACxB;;EAIF,MAAM,gBACJ,cAAc,YAAY,QAAQ,cAAc,YAAY;EAC9D,MAAM,gBACJ,cAAc,YAAY,QAAQ,cAAc,YAAY;AAG9D,MAAI,gBAAgB,SAAS,aAAa,iBAAiB,gBAAgB;AACzE,mBAAgB,QAAQ,YAAY;AACpC,mBAAgB,UAAU;;AAK5B,MAAI,CAAC,gBAAgB,WAAW,CAAC,gBAAgB,QAAQ,SACvD,iBAAgB,UAAU,WAAW,QAAQ,SAC3C,cACA,YAAY,SACZ;GACE,GAAG,WAAW;GACd,QAAQ;GACT,CACF;AAIH,gBAAc,UAAU;AACxB,gBAAc,UAAU;AAGxB,eAAa;AACX,OAAI,gBAAgB,SAAS,UAAU;AACrC,oBAAgB,QAAQ,YAAY;AACpC,oBAAgB,UAAU;;;IAG7B,CAAC,aAAa,CAAC;AAIlB,KAAI,gBAAgB,SAAS,UAAU;AACrC,kBAAgB,QAAQ,WAAW;AACnC,kBAAgB,QAAQ,WAAW,qBAAqB"}
|
package/dist/useHotkey.d.cts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { HotkeyCallback, HotkeyOptions, RegisterableHotkey } from "@tanstack/hotkeys";
|
|
2
|
-
|
|
3
|
-
//#region src/useHotkey.d.ts
|
|
4
|
-
interface UseHotkeyOptions extends Omit<HotkeyOptions, 'target'> {
|
|
5
|
-
/**
|
|
6
|
-
* The DOM element to attach the event listener to.
|
|
7
|
-
* Can be a React ref, direct DOM element, or null.
|
|
8
|
-
* Defaults to document.
|
|
9
|
-
*/
|
|
10
|
-
target?: React.RefObject<HTMLElement | null> | HTMLElement | Document | Window | null;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* React hook for registering a keyboard hotkey.
|
|
14
|
-
*
|
|
15
|
-
* Uses the singleton HotkeyManager for efficient event handling.
|
|
16
|
-
* The callback receives both the keyboard event and a context object
|
|
17
|
-
* containing the hotkey string and parsed hotkey.
|
|
18
|
-
*
|
|
19
|
-
* This hook syncs the callback and options on every render to avoid
|
|
20
|
-
* stale closures. This means
|
|
21
|
-
* callbacks that reference React state will always have access to
|
|
22
|
-
* the latest values.
|
|
23
|
-
*
|
|
24
|
-
* @param hotkey - The hotkey string (e.g., 'Mod+S', 'Escape') or RawHotkey object (supports `mod` for cross-platform)
|
|
25
|
-
* @param callback - The function to call when the hotkey is pressed
|
|
26
|
-
* @param options - Options for the hotkey behavior. `enabled: false` keeps the registration (visible in devtools)
|
|
27
|
-
* and only suppresses firing; the hook updates the existing handle instead of unregistering.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```tsx
|
|
31
|
-
* function SaveButton() {
|
|
32
|
-
* const [count, setCount] = useState(0)
|
|
33
|
-
*
|
|
34
|
-
* // Callback always has access to latest count value
|
|
35
|
-
* useHotkey('Mod+S', (event, { hotkey }) => {
|
|
36
|
-
* console.log(`Save triggered, count is ${count}`)
|
|
37
|
-
* handleSave()
|
|
38
|
-
* })
|
|
39
|
-
*
|
|
40
|
-
* return <button onClick={() => setCount(c => c + 1)}>Count: {count}</button>
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```tsx
|
|
46
|
-
* function Modal({ isOpen, onClose }) {
|
|
47
|
-
* // enabled option is synced on every render
|
|
48
|
-
* useHotkey('Escape', () => {
|
|
49
|
-
* onClose()
|
|
50
|
-
* }, { enabled: isOpen })
|
|
51
|
-
*
|
|
52
|
-
* if (!isOpen) return null
|
|
53
|
-
* return <div className="modal">...</div>
|
|
54
|
-
* }
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```tsx
|
|
59
|
-
* function Editor() {
|
|
60
|
-
* const editorRef = useRef<HTMLDivElement>(null)
|
|
61
|
-
*
|
|
62
|
-
* // Scoped to a specific element
|
|
63
|
-
* useHotkey('Mod+S', () => {
|
|
64
|
-
* save()
|
|
65
|
-
* }, { target: editorRef })
|
|
66
|
-
*
|
|
67
|
-
* return <div ref={editorRef}>...</div>
|
|
68
|
-
* }
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
declare function useHotkey(hotkey: RegisterableHotkey, callback: HotkeyCallback, options?: UseHotkeyOptions): void;
|
|
72
|
-
//#endregion
|
|
73
|
-
export { UseHotkeyOptions, useHotkey };
|
|
74
|
-
//# sourceMappingURL=useHotkey.d.cts.map
|
package/dist/useHotkey.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHotkey.js","names":[],"sources":["../src/useHotkey.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\nimport {\n detectPlatform,\n getHotkeyManager,\n normalizeRegisterableHotkey,\n} from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport { isRef } from './utils'\nimport type {\n HotkeyCallback,\n HotkeyOptions,\n HotkeyRegistrationHandle,\n RegisterableHotkey,\n} from '@tanstack/hotkeys'\n\nexport interface UseHotkeyOptions extends Omit<HotkeyOptions, 'target'> {\n /**\n * The DOM element to attach the event listener to.\n * Can be a React ref, direct DOM element, or null.\n * Defaults to document.\n */\n target?:\n | React.RefObject<HTMLElement | null>\n | HTMLElement\n | Document\n | Window\n | null\n}\n\n/**\n * React hook for registering a keyboard hotkey.\n *\n * Uses the singleton HotkeyManager for efficient event handling.\n * The callback receives both the keyboard event and a context object\n * containing the hotkey string and parsed hotkey.\n *\n * This hook syncs the callback and options on every render to avoid\n * stale closures. This means\n * callbacks that reference React state will always have access to\n * the latest values.\n *\n * @param hotkey - The hotkey string (e.g., 'Mod+S', 'Escape') or RawHotkey object (supports `mod` for cross-platform)\n * @param callback - The function to call when the hotkey is pressed\n * @param options - Options for the hotkey behavior. `enabled: false` keeps the registration (visible in devtools)\n * and only suppresses firing; the hook updates the existing handle instead of unregistering.\n *\n * @example\n * ```tsx\n * function SaveButton() {\n * const [count, setCount] = useState(0)\n *\n * // Callback always has access to latest count value\n * useHotkey('Mod+S', (event, { hotkey }) => {\n * console.log(`Save triggered, count is ${count}`)\n * handleSave()\n * })\n *\n * return <button onClick={() => setCount(c => c + 1)}>Count: {count}</button>\n * }\n * ```\n *\n * @example\n * ```tsx\n * function Modal({ isOpen, onClose }) {\n * // enabled option is synced on every render\n * useHotkey('Escape', () => {\n * onClose()\n * }, { enabled: isOpen })\n *\n * if (!isOpen) return null\n * return <div className=\"modal\">...</div>\n * }\n * ```\n *\n * @example\n * ```tsx\n * function Editor() {\n * const editorRef = useRef<HTMLDivElement>(null)\n *\n * // Scoped to a specific element\n * useHotkey('Mod+S', () => {\n * save()\n * }, { target: editorRef })\n *\n * return <div ref={editorRef}>...</div>\n * }\n * ```\n */\nexport function useHotkey(\n hotkey: RegisterableHotkey,\n callback: HotkeyCallback,\n options: UseHotkeyOptions = {},\n): void {\n const mergedOptions = {\n ...useDefaultHotkeysOptions().hotkey,\n ...options,\n } as UseHotkeyOptions\n\n const manager = getHotkeyManager()\n\n // Stable ref for registration handle\n const registrationRef = useRef<HotkeyRegistrationHandle | null>(null)\n\n // Refs to capture current values for use in effect without adding dependencies\n const callbackRef = useRef(callback)\n const optionsRef = useRef(mergedOptions)\n const managerRef = useRef(manager)\n\n // Update refs on every render\n callbackRef.current = callback\n optionsRef.current = mergedOptions\n managerRef.current = manager\n\n // Track previous target and hotkey to detect changes requiring re-registration\n const prevTargetRef = useRef<HTMLElement | Document | Window | null>(null)\n const prevHotkeyRef = useRef<string | null>(null)\n\n // Normalize to hotkey string\n const platform = mergedOptions.platform ?? detectPlatform()\n const hotkeyString = normalizeRegisterableHotkey(hotkey, platform)\n\n // Extract options without target (target is handled separately)\n const { target: _target, ...optionsWithoutTarget } = mergedOptions\n\n useEffect(() => {\n // Resolve target inside the effect so refs are already attached after mount\n const resolvedTarget = isRef(optionsRef.current.target)\n ? optionsRef.current.target.current\n : (optionsRef.current.target ??\n (typeof document !== 'undefined' ? document : null))\n\n // Skip if no valid target (SSR or ref still null)\n if (!resolvedTarget) {\n if (registrationRef.current?.isActive) {\n registrationRef.current.unregister()\n registrationRef.current = null\n }\n prevTargetRef.current = null\n prevHotkeyRef.current = null\n return\n }\n\n // Check if we need to re-register (target or hotkey changed)\n const targetChanged =\n prevTargetRef.current !== null && prevTargetRef.current !== resolvedTarget\n const hotkeyChanged =\n prevHotkeyRef.current !== null && prevHotkeyRef.current !== hotkeyString\n\n // If we have an active registration and target/hotkey changed, unregister first\n if (registrationRef.current?.isActive && (targetChanged || hotkeyChanged)) {\n registrationRef.current.unregister()\n registrationRef.current = null\n }\n\n // Register if needed (no active registration)\n // Use refs to access current values without adding them to dependencies\n if (!registrationRef.current || !registrationRef.current.isActive) {\n registrationRef.current = managerRef.current.register(\n hotkeyString,\n callbackRef.current,\n {\n ...optionsRef.current,\n target: resolvedTarget,\n },\n )\n }\n\n // Update tracking refs\n prevTargetRef.current = resolvedTarget\n prevHotkeyRef.current = hotkeyString\n\n // Cleanup on unmount\n return () => {\n if (registrationRef.current?.isActive) {\n registrationRef.current.unregister()\n registrationRef.current = null\n }\n }\n }, [hotkeyString])\n\n // Sync callback and options on EVERY render (outside useEffect)\n // This avoids stale closures - the callback always has access to latest state\n if (registrationRef.current?.isActive) {\n registrationRef.current.callback = callback\n registrationRef.current.setOptions(optionsWithoutTarget)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,SAAgB,UACd,QACA,UACA,UAA4B,EAAE,EACxB;CACN,MAAM,gBAAgB;EACpB,GAAG,0BAA0B,CAAC;EAC9B,GAAG;EACJ;CAED,MAAM,UAAU,kBAAkB;CAGlC,MAAM,kBAAkB,OAAwC,KAAK;CAGrE,MAAM,cAAc,OAAO,SAAS;CACpC,MAAM,aAAa,OAAO,cAAc;CACxC,MAAM,aAAa,OAAO,QAAQ;AAGlC,aAAY,UAAU;AACtB,YAAW,UAAU;AACrB,YAAW,UAAU;CAGrB,MAAM,gBAAgB,OAA+C,KAAK;CAC1E,MAAM,gBAAgB,OAAsB,KAAK;CAIjD,MAAM,eAAe,4BAA4B,QADhC,cAAc,YAAY,gBAAgB,CACO;CAGlE,MAAM,EAAE,QAAQ,SAAS,GAAG,yBAAyB;AAErD,iBAAgB;EAEd,MAAM,iBAAiB,MAAM,WAAW,QAAQ,OAAO,GACnD,WAAW,QAAQ,OAAO,UACzB,WAAW,QAAQ,WACnB,OAAO,aAAa,cAAc,WAAW;AAGlD,MAAI,CAAC,gBAAgB;AACnB,OAAI,gBAAgB,SAAS,UAAU;AACrC,oBAAgB,QAAQ,YAAY;AACpC,oBAAgB,UAAU;;AAE5B,iBAAc,UAAU;AACxB,iBAAc,UAAU;AACxB;;EAIF,MAAM,gBACJ,cAAc,YAAY,QAAQ,cAAc,YAAY;EAC9D,MAAM,gBACJ,cAAc,YAAY,QAAQ,cAAc,YAAY;AAG9D,MAAI,gBAAgB,SAAS,aAAa,iBAAiB,gBAAgB;AACzE,mBAAgB,QAAQ,YAAY;AACpC,mBAAgB,UAAU;;AAK5B,MAAI,CAAC,gBAAgB,WAAW,CAAC,gBAAgB,QAAQ,SACvD,iBAAgB,UAAU,WAAW,QAAQ,SAC3C,cACA,YAAY,SACZ;GACE,GAAG,WAAW;GACd,QAAQ;GACT,CACF;AAIH,gBAAc,UAAU;AACxB,gBAAc,UAAU;AAGxB,eAAa;AACX,OAAI,gBAAgB,SAAS,UAAU;AACrC,oBAAgB,QAAQ,YAAY;AACpC,oBAAgB,UAAU;;;IAG7B,CAAC,aAAa,CAAC;AAIlB,KAAI,gBAAgB,SAAS,UAAU;AACrC,kBAAgB,QAAQ,WAAW;AACnC,kBAAgB,QAAQ,WAAW,qBAAqB"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_HotkeysProvider = require('./HotkeysProvider.cjs');
|
|
3
|
-
let _tanstack_hotkeys = require("@tanstack/hotkeys");
|
|
4
|
-
let react = require("react");
|
|
5
|
-
let _tanstack_react_store = require("@tanstack/react-store");
|
|
6
|
-
|
|
7
|
-
//#region src/useHotkeyRecorder.ts
|
|
8
|
-
/**
|
|
9
|
-
* React hook for recording keyboard shortcuts.
|
|
10
|
-
*
|
|
11
|
-
* This hook provides a thin wrapper around the framework-agnostic `HotkeyRecorder`
|
|
12
|
-
* class, managing all the complexity of capturing keyboard events, converting them
|
|
13
|
-
* to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete
|
|
14
|
-
* to clear.
|
|
15
|
-
*
|
|
16
|
-
* @param options - Configuration options for the recorder
|
|
17
|
-
* @returns An object with recording state and control functions
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```tsx
|
|
21
|
-
* function ShortcutSettings() {
|
|
22
|
-
* const [shortcut, setShortcut] = useState<Hotkey>('Mod+S')
|
|
23
|
-
*
|
|
24
|
-
* const recorder = useHotkeyRecorder({
|
|
25
|
-
* onRecord: (hotkey) => {
|
|
26
|
-
* setShortcut(hotkey)
|
|
27
|
-
* },
|
|
28
|
-
* onCancel: () => {
|
|
29
|
-
* console.log('Recording cancelled')
|
|
30
|
-
* },
|
|
31
|
-
* })
|
|
32
|
-
*
|
|
33
|
-
* return (
|
|
34
|
-
* <div>
|
|
35
|
-
* <button onClick={recorder.startRecording}>
|
|
36
|
-
* {recorder.isRecording ? 'Recording...' : 'Edit Shortcut'}
|
|
37
|
-
* </button>
|
|
38
|
-
* {recorder.recordedHotkey && (
|
|
39
|
-
* <div>Recording: {recorder.recordedHotkey}</div>
|
|
40
|
-
* )}
|
|
41
|
-
* </div>
|
|
42
|
-
* )
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
function useHotkeyRecorder(options) {
|
|
47
|
-
const mergedOptions = {
|
|
48
|
-
...require_HotkeysProvider.useDefaultHotkeysOptions().hotkeyRecorder,
|
|
49
|
-
...options
|
|
50
|
-
};
|
|
51
|
-
const recorderRef = (0, react.useRef)(null);
|
|
52
|
-
if (!recorderRef.current) recorderRef.current = new _tanstack_hotkeys.HotkeyRecorder(mergedOptions);
|
|
53
|
-
recorderRef.current.setOptions(mergedOptions);
|
|
54
|
-
const isRecording = (0, _tanstack_react_store.useSelector)(recorderRef.current.store, (state) => state.isRecording);
|
|
55
|
-
const recordedHotkey = (0, _tanstack_react_store.useSelector)(recorderRef.current.store, (state) => state.recordedHotkey);
|
|
56
|
-
(0, react.useEffect)(() => {
|
|
57
|
-
return () => {
|
|
58
|
-
recorderRef.current?.destroy();
|
|
59
|
-
};
|
|
60
|
-
}, []);
|
|
61
|
-
return {
|
|
62
|
-
isRecording,
|
|
63
|
-
recordedHotkey,
|
|
64
|
-
startRecording: () => recorderRef.current?.start(),
|
|
65
|
-
stopRecording: () => recorderRef.current?.stop(),
|
|
66
|
-
cancelRecording: () => recorderRef.current?.cancel()
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
exports.useHotkeyRecorder = useHotkeyRecorder;
|
|
72
|
-
//# sourceMappingURL=useHotkeyRecorder.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHotkeyRecorder.cjs","names":["useDefaultHotkeysOptions","HotkeyRecorder"],"sources":["../src/useHotkeyRecorder.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\nimport { useSelector } from '@tanstack/react-store'\nimport { HotkeyRecorder } from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport type { Hotkey, HotkeyRecorderOptions } from '@tanstack/hotkeys'\n\nexport interface ReactHotkeyRecorder {\n /** Whether recording is currently active */\n isRecording: boolean\n /** The currently recorded hotkey (for live preview) */\n recordedHotkey: Hotkey | null\n /** Start recording a new hotkey */\n startRecording: () => void\n /** Stop recording (same as cancel) */\n stopRecording: () => void\n /** Cancel recording without saving */\n cancelRecording: () => void\n}\n\n/**\n * React hook for recording keyboard shortcuts.\n *\n * This hook provides a thin wrapper around the framework-agnostic `HotkeyRecorder`\n * class, managing all the complexity of capturing keyboard events, converting them\n * to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete\n * to clear.\n *\n * @param options - Configuration options for the recorder\n * @returns An object with recording state and control functions\n *\n * @example\n * ```tsx\n * function ShortcutSettings() {\n * const [shortcut, setShortcut] = useState<Hotkey>('Mod+S')\n *\n * const recorder = useHotkeyRecorder({\n * onRecord: (hotkey) => {\n * setShortcut(hotkey)\n * },\n * onCancel: () => {\n * console.log('Recording cancelled')\n * },\n * })\n *\n * return (\n * <div>\n * <button onClick={recorder.startRecording}>\n * {recorder.isRecording ? 'Recording...' : 'Edit Shortcut'}\n * </button>\n * {recorder.recordedHotkey && (\n * <div>Recording: {recorder.recordedHotkey}</div>\n * )}\n * </div>\n * )\n * }\n * ```\n */\nexport function useHotkeyRecorder(\n options: HotkeyRecorderOptions,\n): ReactHotkeyRecorder {\n const mergedOptions = {\n ...useDefaultHotkeysOptions().hotkeyRecorder,\n ...options,\n } as HotkeyRecorderOptions\n\n const recorderRef = useRef<HotkeyRecorder | null>(null)\n\n // Create recorder instance once\n if (!recorderRef.current) {\n recorderRef.current = new HotkeyRecorder(mergedOptions)\n }\n\n // Sync options on every render (same pattern as useHotkey)\n // This ensures callbacks always have access to latest values\n recorderRef.current.setOptions(mergedOptions)\n\n // Subscribe to recorder state using useSelector (same pattern as useHeldKeys)\n const isRecording = useSelector(\n recorderRef.current.store,\n (state) => state.isRecording,\n )\n const recordedHotkey = useSelector(\n recorderRef.current.store,\n (state) => state.recordedHotkey,\n )\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n recorderRef.current?.destroy()\n }\n }, [])\n\n return {\n isRecording,\n recordedHotkey,\n startRecording: () => recorderRef.current?.start(),\n stopRecording: () => recorderRef.current?.stop(),\n cancelRecording: () => recorderRef.current?.cancel(),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,SAAgB,kBACd,SACqB;CACrB,MAAM,gBAAgB;EACpB,GAAGA,kDAA0B,CAAC;EAC9B,GAAG;EACJ;CAED,MAAM,gCAA4C,KAAK;AAGvD,KAAI,CAAC,YAAY,QACf,aAAY,UAAU,IAAIC,iCAAe,cAAc;AAKzD,aAAY,QAAQ,WAAW,cAAc;CAG7C,MAAM,qDACJ,YAAY,QAAQ,QACnB,UAAU,MAAM,YAClB;CACD,MAAM,wDACJ,YAAY,QAAQ,QACnB,UAAU,MAAM,eAClB;AAGD,4BAAgB;AACd,eAAa;AACX,eAAY,SAAS,SAAS;;IAE/B,EAAE,CAAC;AAEN,QAAO;EACL;EACA;EACA,sBAAsB,YAAY,SAAS,OAAO;EAClD,qBAAqB,YAAY,SAAS,MAAM;EAChD,uBAAuB,YAAY,SAAS,QAAQ;EACrD"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Hotkey, HotkeyRecorderOptions } from "@tanstack/hotkeys";
|
|
2
|
-
|
|
3
|
-
//#region src/useHotkeyRecorder.d.ts
|
|
4
|
-
interface ReactHotkeyRecorder {
|
|
5
|
-
/** Whether recording is currently active */
|
|
6
|
-
isRecording: boolean;
|
|
7
|
-
/** The currently recorded hotkey (for live preview) */
|
|
8
|
-
recordedHotkey: Hotkey | null;
|
|
9
|
-
/** Start recording a new hotkey */
|
|
10
|
-
startRecording: () => void;
|
|
11
|
-
/** Stop recording (same as cancel) */
|
|
12
|
-
stopRecording: () => void;
|
|
13
|
-
/** Cancel recording without saving */
|
|
14
|
-
cancelRecording: () => void;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* React hook for recording keyboard shortcuts.
|
|
18
|
-
*
|
|
19
|
-
* This hook provides a thin wrapper around the framework-agnostic `HotkeyRecorder`
|
|
20
|
-
* class, managing all the complexity of capturing keyboard events, converting them
|
|
21
|
-
* to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete
|
|
22
|
-
* to clear.
|
|
23
|
-
*
|
|
24
|
-
* @param options - Configuration options for the recorder
|
|
25
|
-
* @returns An object with recording state and control functions
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```tsx
|
|
29
|
-
* function ShortcutSettings() {
|
|
30
|
-
* const [shortcut, setShortcut] = useState<Hotkey>('Mod+S')
|
|
31
|
-
*
|
|
32
|
-
* const recorder = useHotkeyRecorder({
|
|
33
|
-
* onRecord: (hotkey) => {
|
|
34
|
-
* setShortcut(hotkey)
|
|
35
|
-
* },
|
|
36
|
-
* onCancel: () => {
|
|
37
|
-
* console.log('Recording cancelled')
|
|
38
|
-
* },
|
|
39
|
-
* })
|
|
40
|
-
*
|
|
41
|
-
* return (
|
|
42
|
-
* <div>
|
|
43
|
-
* <button onClick={recorder.startRecording}>
|
|
44
|
-
* {recorder.isRecording ? 'Recording...' : 'Edit Shortcut'}
|
|
45
|
-
* </button>
|
|
46
|
-
* {recorder.recordedHotkey && (
|
|
47
|
-
* <div>Recording: {recorder.recordedHotkey}</div>
|
|
48
|
-
* )}
|
|
49
|
-
* </div>
|
|
50
|
-
* )
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
declare function useHotkeyRecorder(options: HotkeyRecorderOptions): ReactHotkeyRecorder;
|
|
55
|
-
//#endregion
|
|
56
|
-
export { ReactHotkeyRecorder, useHotkeyRecorder };
|
|
57
|
-
//# sourceMappingURL=useHotkeyRecorder.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHotkeyRecorder.js","names":[],"sources":["../src/useHotkeyRecorder.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\nimport { useSelector } from '@tanstack/react-store'\nimport { HotkeyRecorder } from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport type { Hotkey, HotkeyRecorderOptions } from '@tanstack/hotkeys'\n\nexport interface ReactHotkeyRecorder {\n /** Whether recording is currently active */\n isRecording: boolean\n /** The currently recorded hotkey (for live preview) */\n recordedHotkey: Hotkey | null\n /** Start recording a new hotkey */\n startRecording: () => void\n /** Stop recording (same as cancel) */\n stopRecording: () => void\n /** Cancel recording without saving */\n cancelRecording: () => void\n}\n\n/**\n * React hook for recording keyboard shortcuts.\n *\n * This hook provides a thin wrapper around the framework-agnostic `HotkeyRecorder`\n * class, managing all the complexity of capturing keyboard events, converting them\n * to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete\n * to clear.\n *\n * @param options - Configuration options for the recorder\n * @returns An object with recording state and control functions\n *\n * @example\n * ```tsx\n * function ShortcutSettings() {\n * const [shortcut, setShortcut] = useState<Hotkey>('Mod+S')\n *\n * const recorder = useHotkeyRecorder({\n * onRecord: (hotkey) => {\n * setShortcut(hotkey)\n * },\n * onCancel: () => {\n * console.log('Recording cancelled')\n * },\n * })\n *\n * return (\n * <div>\n * <button onClick={recorder.startRecording}>\n * {recorder.isRecording ? 'Recording...' : 'Edit Shortcut'}\n * </button>\n * {recorder.recordedHotkey && (\n * <div>Recording: {recorder.recordedHotkey}</div>\n * )}\n * </div>\n * )\n * }\n * ```\n */\nexport function useHotkeyRecorder(\n options: HotkeyRecorderOptions,\n): ReactHotkeyRecorder {\n const mergedOptions = {\n ...useDefaultHotkeysOptions().hotkeyRecorder,\n ...options,\n } as HotkeyRecorderOptions\n\n const recorderRef = useRef<HotkeyRecorder | null>(null)\n\n // Create recorder instance once\n if (!recorderRef.current) {\n recorderRef.current = new HotkeyRecorder(mergedOptions)\n }\n\n // Sync options on every render (same pattern as useHotkey)\n // This ensures callbacks always have access to latest values\n recorderRef.current.setOptions(mergedOptions)\n\n // Subscribe to recorder state using useSelector (same pattern as useHeldKeys)\n const isRecording = useSelector(\n recorderRef.current.store,\n (state) => state.isRecording,\n )\n const recordedHotkey = useSelector(\n recorderRef.current.store,\n (state) => state.recordedHotkey,\n )\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n recorderRef.current?.destroy()\n }\n }, [])\n\n return {\n isRecording,\n recordedHotkey,\n startRecording: () => recorderRef.current?.start(),\n stopRecording: () => recorderRef.current?.stop(),\n cancelRecording: () => recorderRef.current?.cancel(),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,SAAgB,kBACd,SACqB;CACrB,MAAM,gBAAgB;EACpB,GAAG,0BAA0B,CAAC;EAC9B,GAAG;EACJ;CAED,MAAM,cAAc,OAA8B,KAAK;AAGvD,KAAI,CAAC,YAAY,QACf,aAAY,UAAU,IAAI,eAAe,cAAc;AAKzD,aAAY,QAAQ,WAAW,cAAc;CAG7C,MAAM,cAAc,YAClB,YAAY,QAAQ,QACnB,UAAU,MAAM,YAClB;CACD,MAAM,iBAAiB,YACrB,YAAY,QAAQ,QACnB,UAAU,MAAM,eAClB;AAGD,iBAAgB;AACd,eAAa;AACX,eAAY,SAAS,SAAS;;IAE/B,EAAE,CAAC;AAEN,QAAO;EACL;EACA;EACA,sBAAsB,YAAY,SAAS,OAAO;EAClD,qBAAqB,YAAY,SAAS,MAAM;EAChD,uBAAuB,YAAY,SAAS,QAAQ;EACrD"}
|