@tanstack/solid-hotkeys 0.21.0 → 0.21.1
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/dist/HotkeysProvider.d.ts +4 -5
- package/dist/HotkeysProvider.js +2 -3
- package/dist/_useSelector.js +1 -2
- package/dist/appHotkeys.d.ts +1 -3
- package/dist/appHotkeys.js +3 -4
- package/dist/createFormatForDisplay.d.ts +1 -3
- package/dist/createFormatForDisplay.js +1 -2
- package/dist/createHeldKeyCodes.d.ts +1 -3
- package/dist/createHeldKeyCodes.js +1 -2
- package/dist/createHeldKeys.d.ts +1 -3
- package/dist/createHeldKeys.js +1 -2
- package/dist/createHotkey.d.ts +1 -2
- package/dist/createHotkey.js +1 -2
- package/dist/createHotkeyHint.d.ts +1 -3
- package/dist/createHotkeyHint.js +1 -2
- package/dist/createHotkeyRecorder.d.ts +1 -3
- package/dist/createHotkeyRecorder.js +2 -3
- package/dist/createHotkeyRegistrations.d.ts +1 -3
- package/dist/createHotkeyRegistrations.js +1 -2
- package/dist/createHotkeyScopesState.d.ts +1 -3
- package/dist/createHotkeyScopesState.js +1 -2
- package/dist/createHotkeys.d.ts +1 -3
- package/dist/createHotkeys.js +2 -3
- package/dist/createKeyHold.d.ts +1 -3
- package/dist/createKeyHold.js +1 -2
- package/dist/defaultOptions.js +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +7 -7
- package/skills/solid-hotkeys/SKILL.md +1 -1
- package/skills/solid-hotkeys/references/app-hotkeys.md +2 -2
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CreateHotkeyCommonOptions } from "./createHotkey.js";
|
|
2
2
|
import { AppHotkeys, AppHotkeysStore, CustomHotkeys, HotkeyChordRecorderOptions, HotkeyPlatform, HotkeySequenceRecorderOptions } from "@tanstack/hotkeys";
|
|
3
|
-
import { JSX, ParentComponent } from "solid-js";
|
|
4
3
|
import { HotkeysProviderScopeProps } from "@tanstack/hotkeys/adapter";
|
|
5
|
-
|
|
4
|
+
import { JSX, ParentComponent } from "solid-js";
|
|
6
5
|
export interface HotkeysProviderOptions {
|
|
7
6
|
/**
|
|
8
7
|
* The user's platform, for labels from `createFormatForDisplay`, hotkeys,
|
|
@@ -35,8 +34,8 @@ export interface HotkeysProviderProps extends HotkeysProviderScopeProps {
|
|
|
35
34
|
/**
|
|
36
35
|
* The user's saved custom hotkeys. When the value changes, such as after
|
|
37
36
|
* saved data loads or the user signs in, it replaces the current custom
|
|
38
|
-
* hotkeys. `undefined` leaves them unchanged; `null` clears them.
|
|
39
|
-
* entries are ignored
|
|
37
|
+
* hotkeys. `undefined` leaves them unchanged; `null` clears them. Unknown
|
|
38
|
+
* ids and invalid entries are ignored.
|
|
40
39
|
*/
|
|
41
40
|
customHotkeys?: CustomHotkeys | null;
|
|
42
41
|
/** Called with the custom hotkeys after every change, ready to save. */
|
|
@@ -74,4 +73,4 @@ export interface HotkeysProviderProps extends HotkeysProviderScopeProps {
|
|
|
74
73
|
export declare const HotkeysProvider: ParentComponent<HotkeysProviderProps>;
|
|
75
74
|
export declare function useHotkeysContext(): HotkeysContextValue | null;
|
|
76
75
|
export declare function useDefaultHotkeysOptions(): HotkeysProviderOptions;
|
|
77
|
-
|
|
76
|
+
export {};
|
package/dist/HotkeysProvider.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { publishAppHotkeysStore } from "@tanstack/hotkeys";
|
|
2
2
|
import { createComponent } from "solid-js/web";
|
|
3
|
-
import { createContext, createEffect, createMemo, onCleanup, onMount, useContext } from "solid-js";
|
|
4
3
|
import { activateHotkeysProviderScope, createAppHotkeysStore, getHotkeysProviderScopeKey, mergeHotkeysProviderDefaults } from "@tanstack/hotkeys/adapter";
|
|
4
|
+
import { createContext, createEffect, createMemo, onCleanup, onMount, useContext } from "solid-js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/HotkeysProvider.tsx
|
|
7
7
|
const HotkeysContext = createContext(null);
|
|
8
8
|
const DEFAULT_OPTIONS = {};
|
|
9
9
|
/**
|
|
@@ -84,5 +84,4 @@ function useDefaultHotkeysOptions() {
|
|
|
84
84
|
return useContext(HotkeysContext)?.defaultOptions ?? DEFAULT_OPTIONS;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
//#endregion
|
|
88
87
|
export { HotkeysProvider, useDefaultHotkeysOptions, useHotkeysContext };
|
package/dist/_useSelector.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSignal, onCleanup } from "solid-js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/_useSelector.ts
|
|
4
4
|
/**
|
|
5
5
|
* Subscribes to a store until the owner is cleaned up and returns an accessor
|
|
6
6
|
* for the selected value, which updates when it changes (by `===`).
|
|
@@ -14,5 +14,4 @@ function useSelector(store, selector) {
|
|
|
14
14
|
return selected;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
//#endregion
|
|
18
17
|
export { useSelector };
|
package/dist/appHotkeys.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AppHotkey, AppHotkeyListItem, CustomHotkeys, Hotkey, RegisteredAppHotkeys } from "@tanstack/hotkeys";
|
|
2
|
-
//#region src/appHotkeys.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Returns an accessor for the effective app hotkeys from `HotkeysProvider`,
|
|
5
4
|
* typed by `Register`: each declaration with the user's custom hotkey applied.
|
|
@@ -38,5 +37,4 @@ export interface UseCustomHotkeysResult {
|
|
|
38
37
|
* registered app hotkey immediately and are passed to the provider's
|
|
39
38
|
* `onCustomHotkeysChange`, ready to save.
|
|
40
39
|
*/
|
|
41
|
-
export declare function useCustomHotkeys(): UseCustomHotkeysResult;
|
|
42
|
-
//#endregion
|
|
40
|
+
export declare function useCustomHotkeys(): UseCustomHotkeysResult;
|
package/dist/appHotkeys.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useAppHotkeysStoreSource } from "./defaultOptions.js";
|
|
2
1
|
import { createHotkeyRegistrations } from "./createHotkeyRegistrations.js";
|
|
2
|
+
import { useAppHotkeysStoreSource } from "./defaultOptions.js";
|
|
3
3
|
import { createMemo } from "solid-js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/appHotkeys.ts
|
|
6
6
|
function useRequiredStore(name) {
|
|
7
7
|
const source = useAppHotkeysStoreSource();
|
|
8
|
-
if (!source.store) throw new Error(
|
|
8
|
+
if (!source.store) throw new Error(`[hotkeys] ${name} requires a HotkeysProvider with an appHotkeys prop`);
|
|
9
9
|
return {
|
|
10
10
|
store: source.store,
|
|
11
11
|
state: source.state
|
|
@@ -60,5 +60,4 @@ function useCustomHotkeys() {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
//#endregion
|
|
64
63
|
export { createAppHotkeyList, useAppHotkeys, useCustomHotkeys };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { formatForDisplay } from "@tanstack/hotkeys";
|
|
2
|
-
//#region src/createFormatForDisplay.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Returns `formatForDisplay` with the provider's `platform` as the default,
|
|
5
4
|
* so labels match the user's platform. Call in a component; the returned
|
|
@@ -17,5 +16,4 @@ import { formatForDisplay } from "@tanstack/hotkeys";
|
|
|
17
16
|
* }
|
|
18
17
|
* ```
|
|
19
18
|
*/
|
|
20
|
-
export declare function createFormatForDisplay(): typeof formatForDisplay;
|
|
21
|
-
//#endregion
|
|
19
|
+
export declare function createFormatForDisplay(): typeof formatForDisplay;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useDefaultHotkeysOptionsSource } from "./defaultOptions.js";
|
|
2
2
|
import { formatForDisplay } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/createFormatForDisplay.ts
|
|
5
5
|
/**
|
|
6
6
|
* Returns `formatForDisplay` with the provider's `platform` as the default,
|
|
7
7
|
* so labels match the user's platform. Call in a component; the returned
|
|
@@ -27,5 +27,4 @@ function createFormatForDisplay() {
|
|
|
27
27
|
}));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
//#endregion
|
|
31
30
|
export { createFormatForDisplay };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/createHeldKeyCodes.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* SolidJS primitive that returns a signal of a map from currently held key names to their physical `event.code` values.
|
|
4
3
|
*
|
|
@@ -29,5 +28,4 @@
|
|
|
29
28
|
* }
|
|
30
29
|
* ```
|
|
31
30
|
*/
|
|
32
|
-
export declare function createHeldKeyCodes(): () => Record<string, string>;
|
|
33
|
-
//#endregion
|
|
31
|
+
export declare function createHeldKeyCodes(): () => Record<string, string>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useSelector } from "./_useSelector.js";
|
|
2
2
|
import { getKeyStateTracker } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/createHeldKeyCodes.ts
|
|
5
5
|
/**
|
|
6
6
|
* SolidJS primitive that returns a signal of a map from currently held key names to their physical `event.code` values.
|
|
7
7
|
*
|
|
@@ -37,5 +37,4 @@ function createHeldKeyCodes() {
|
|
|
37
37
|
return useSelector(tracker.store, (state) => state.heldCodes);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
//#endregion
|
|
41
40
|
export { createHeldKeyCodes };
|
package/dist/createHeldKeys.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/createHeldKeys.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* SolidJS primitive that returns a signal of currently held keyboard keys.
|
|
4
3
|
*
|
|
@@ -20,5 +19,4 @@
|
|
|
20
19
|
* }
|
|
21
20
|
* ```
|
|
22
21
|
*/
|
|
23
|
-
export declare function createHeldKeys(): () => Array<string>;
|
|
24
|
-
//#endregion
|
|
22
|
+
export declare function createHeldKeys(): () => Array<string>;
|
package/dist/createHeldKeys.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useSelector } from "./_useSelector.js";
|
|
2
2
|
import { getKeyStateTracker } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/createHeldKeys.ts
|
|
5
5
|
/**
|
|
6
6
|
* SolidJS primitive that returns a signal of currently held keyboard keys.
|
|
7
7
|
*
|
|
@@ -28,5 +28,4 @@ function createHeldKeys() {
|
|
|
28
28
|
return useSelector(tracker.store, (state) => state.heldKeys);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
//#endregion
|
|
32
31
|
export { createHeldKeys };
|
package/dist/createHotkey.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AppHotkey, HotkeyCallback, HotkeyCallbackContextFor, RegisterableHotkey, Target } from "@tanstack/hotkeys";
|
|
2
2
|
import { AdapterAppHotkeyOptions, AdapterChordOptions, AdapterCommonOptions, AdapterHotkeyOptions, AdapterOptionsFor, AdapterSequenceOptions } from "@tanstack/hotkeys/adapter";
|
|
3
|
-
//#region src/createHotkey.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The element to listen on. A `null` target skips registration, so pass an
|
|
6
5
|
* accessor such as `() => ({ target: element() })` for elements that attach
|
|
@@ -40,4 +39,4 @@ type MaybeAccessor<T> = T | (() => T);
|
|
|
40
39
|
*/
|
|
41
40
|
export declare function createHotkey<T extends AppHotkey>(hotkey: MaybeAccessor<T | null | undefined>, callback: HotkeyCallback, options?: MaybeAccessor<CreateAppHotkeyOptions<T>>): void;
|
|
42
41
|
export declare function createHotkey<const T extends RegisterableHotkey>(hotkey: MaybeAccessor<T | null | undefined>, callback: HotkeyCallback<HotkeyCallbackContextFor<T>>, options?: MaybeAccessor<CreateHotkeyOptionsFor<T>>): void;
|
|
43
|
-
|
|
42
|
+
export {};
|
package/dist/createHotkey.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHotkeys } from "./createHotkeys.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/createHotkey.ts
|
|
4
4
|
function createHotkey(hotkey, callback, options = {}) {
|
|
5
5
|
createHotkeys(() => [{
|
|
6
6
|
hotkey: typeof hotkey === "function" ? hotkey() : hotkey,
|
|
@@ -9,5 +9,4 @@ function createHotkey(hotkey, callback, options = {}) {
|
|
|
9
9
|
}]);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
//#endregion
|
|
13
12
|
export { createHotkey };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AppHotkey, HeldModifierOptions, RegisterableHotkey } from "@tanstack/hotkeys";
|
|
2
|
-
//#region src/createHotkeyHint.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Returns an accessor indicating whether held modifiers reveal this shortcut.
|
|
5
4
|
* The hint shows only while the hotkey can fire: some registration of it is
|
|
@@ -8,5 +7,4 @@ import { AppHotkey, HeldModifierOptions, RegisterableHotkey } from "@tanstack/ho
|
|
|
8
7
|
* effective hotkey (false while unbound). No hotkey (`undefined`, `null`, or
|
|
9
8
|
* `''`) returns false. This helper does not register a shortcut. A hotkey on an element counts only while focus is inside it.
|
|
10
9
|
*/
|
|
11
|
-
export declare function createHotkeyHint(hotkey: RegisterableHotkey | AppHotkey | null | undefined | (() => RegisterableHotkey | AppHotkey | null | undefined), options?: HeldModifierOptions | (() => HeldModifierOptions)): () => boolean;
|
|
12
|
-
//#endregion
|
|
10
|
+
export declare function createHotkeyHint(hotkey: RegisterableHotkey | AppHotkey | null | undefined | (() => RegisterableHotkey | AppHotkey | null | undefined), options?: HeldModifierOptions | (() => HeldModifierOptions)): () => boolean;
|
package/dist/createHotkeyHint.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useAppHotkeysStoreSource } from "./defaultOptions.js";
|
|
|
3
3
|
import { getHotkeyManager, getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey } from "@tanstack/hotkeys";
|
|
4
4
|
import { createMemo } from "solid-js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/createHotkeyHint.ts
|
|
7
7
|
/**
|
|
8
8
|
* Returns an accessor indicating whether held modifiers reveal this shortcut.
|
|
9
9
|
* The hint shows only while the hotkey can fire: some registration of it is
|
|
@@ -25,5 +25,4 @@ function createHotkeyHint(hotkey, options = {}) {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
//#endregion
|
|
29
28
|
export { createHotkeyHint };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Hotkey, HotkeyChord, HotkeyChordRecorderOptions, HotkeyRecorderOptions, HotkeySequence, HotkeySequenceRecorderOptions } from "@tanstack/hotkeys";
|
|
2
|
-
//#region src/createHotkeyRecorder.d.ts
|
|
3
2
|
export interface SolidHotkeyRecorder<THotkey extends Hotkey = Hotkey> {
|
|
4
3
|
/** Whether recording is currently active */
|
|
5
4
|
isRecording: () => boolean;
|
|
@@ -34,5 +33,4 @@ export declare function createHotkeyRecorder(options: HotkeyChordRecorderOptions
|
|
|
34
33
|
export declare function createHotkeyRecorder(options: HotkeySequenceRecorderOptions): SolidHotkeyRecorder;
|
|
35
34
|
export declare function createHotkeyRecorder(options: () => HotkeySequenceRecorderOptions): SolidHotkeyRecorder;
|
|
36
35
|
export declare function createHotkeyRecorder(options: () => HotkeyChordRecorderOptions): SolidHotkeyRecorder<HotkeyChord>;
|
|
37
|
-
export declare function createHotkeyRecorder(options: () => HotkeyRecorderOptions): SolidHotkeyRecorder;
|
|
38
|
-
//#endregion
|
|
36
|
+
export declare function createHotkeyRecorder(options: () => HotkeyRecorderOptions): SolidHotkeyRecorder;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useSelector } from "./_useSelector.js";
|
|
2
2
|
import { useDefaultHotkeysOptionsSource } from "./defaultOptions.js";
|
|
3
3
|
import { HotkeyRecorder } from "@tanstack/hotkeys";
|
|
4
|
-
import { createEffect, onCleanup } from "solid-js";
|
|
5
4
|
import { withDefaults } from "@tanstack/hotkeys/adapter";
|
|
5
|
+
import { createEffect, onCleanup } from "solid-js";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/createHotkeyRecorder.ts
|
|
8
8
|
function createHotkeyRecorder(options) {
|
|
9
9
|
const defaultOptions = useDefaultHotkeysOptionsSource();
|
|
10
10
|
const resolve = () => withDefaults(defaultOptions().hotkeyRecorder, typeof options === "function" ? options() : options);
|
|
@@ -29,5 +29,4 @@ function createHotkeyRecorder(options) {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
//#endregion
|
|
33
32
|
export { createHotkeyRecorder };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HotkeyRegistrationView } from "@tanstack/hotkeys";
|
|
2
|
-
//#region src/createHotkeyRegistrations.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Solid primitive that reactively reads every hotkey registration, chords and
|
|
5
4
|
* sequences, from the singleton HotkeyManager. Narrow each view with `kind`.
|
|
@@ -16,5 +15,4 @@ import { HotkeyRegistrationView } from "@tanstack/hotkeys";
|
|
|
16
15
|
* </For>
|
|
17
16
|
* ```
|
|
18
17
|
*/
|
|
19
|
-
export declare function createHotkeyRegistrations(): () => Array<HotkeyRegistrationView>;
|
|
20
|
-
//#endregion
|
|
18
|
+
export declare function createHotkeyRegistrations(): () => Array<HotkeyRegistrationView>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useSelector } from "./_useSelector.js";
|
|
2
2
|
import { getHotkeyManager, toHotkeyRegistrationView } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/createHotkeyRegistrations.ts
|
|
5
5
|
/**
|
|
6
6
|
* Solid primitive that reactively reads every hotkey registration, chords and
|
|
7
7
|
* sequences, from the singleton HotkeyManager. Narrow each view with `kind`.
|
|
@@ -22,5 +22,4 @@ function createHotkeyRegistrations() {
|
|
|
22
22
|
return useSelector(getHotkeyManager().registrations, (state) => Array.from(state.values()).map(toHotkeyRegistrationView));
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
//#endregion
|
|
26
25
|
export { createHotkeyRegistrations };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HotkeyScopesState } from "@tanstack/hotkeys";
|
|
2
|
-
//#region src/createHotkeyScopesState.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* SolidJS primitive that returns a signal of the hotkey manager's scope state:
|
|
5
4
|
* the active scopes, the exclusive scope that owns the keyboard, and the
|
|
@@ -20,5 +19,4 @@ import { HotkeyScopesState } from "@tanstack/hotkeys";
|
|
|
20
19
|
* }
|
|
21
20
|
* ```
|
|
22
21
|
*/
|
|
23
|
-
export declare function createHotkeyScopesState(): () => HotkeyScopesState;
|
|
24
|
-
//#endregion
|
|
22
|
+
export declare function createHotkeyScopesState(): () => HotkeyScopesState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useSelector } from "./_useSelector.js";
|
|
2
2
|
import { getHotkeyManager } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/createHotkeyScopesState.ts
|
|
5
5
|
/**
|
|
6
6
|
* SolidJS primitive that returns a signal of the hotkey manager's scope state:
|
|
7
7
|
* the active scopes, the exclusive scope that owns the keyboard, and the
|
|
@@ -26,5 +26,4 @@ function createHotkeyScopesState() {
|
|
|
26
26
|
return useSelector(getHotkeyManager().scopes, (state) => state);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
//#endregion
|
|
30
29
|
export { createHotkeyScopesState };
|
package/dist/createHotkeys.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CreateHotkeyCommonOptions, CreateHotkeyTarget } from "./createHotkey.js";
|
|
2
2
|
import { AdapterHotkeyDefinition } from "@tanstack/hotkeys/adapter";
|
|
3
|
-
//#region src/createHotkeys.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* One hotkey for `createHotkeys`. Chords accept `requireReset`; sequences
|
|
6
5
|
* accept `timeout`; hotkeys of unknown kind accept only shared options.
|
|
@@ -24,5 +23,4 @@ export type CreateHotkeyDefinition = AdapterHotkeyDefinition<CreateHotkeyTarget>
|
|
|
24
23
|
* ])
|
|
25
24
|
* ```
|
|
26
25
|
*/
|
|
27
|
-
export declare function createHotkeys(hotkeys: ReadonlyArray<CreateHotkeyDefinition> | (() => ReadonlyArray<CreateHotkeyDefinition>), commonOptions?: CreateHotkeyCommonOptions | (() => CreateHotkeyCommonOptions)): void;
|
|
28
|
-
//#endregion
|
|
26
|
+
export declare function createHotkeys(hotkeys: ReadonlyArray<CreateHotkeyDefinition> | (() => ReadonlyArray<CreateHotkeyDefinition>), commonOptions?: CreateHotkeyCommonOptions | (() => CreateHotkeyCommonOptions)): void;
|
package/dist/createHotkeys.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useAppHotkeysStoreSource, useDefaultHotkeysOptionsSource } from "./defaultOptions.js";
|
|
2
2
|
import { delegateEvents } from "solid-js/web";
|
|
3
|
-
import { createEffect, onCleanup, untrack } from "solid-js";
|
|
4
3
|
import { createHotkeyBindings, prepareHotkeyDefinitions } from "@tanstack/hotkeys/adapter";
|
|
4
|
+
import { createEffect, onCleanup, untrack } from "solid-js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/createHotkeys.ts
|
|
7
7
|
/**
|
|
8
8
|
* Solid primitive for registering several hotkeys at once: chords, sequences,
|
|
9
9
|
* and app hotkeys. Pass an accessor for a reactive list.
|
|
@@ -40,5 +40,4 @@ function createHotkeys(hotkeys, commonOptions = {}) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
//#endregion
|
|
44
43
|
export { createHotkeys };
|
package/dist/createKeyHold.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IndividualKey } from "@tanstack/hotkeys";
|
|
2
|
-
//#region src/createKeyHold.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* SolidJS primitive that returns whether a specific key is currently being held.
|
|
5
4
|
*
|
|
@@ -39,5 +38,4 @@ import { IndividualKey } from "@tanstack/hotkeys";
|
|
|
39
38
|
* }
|
|
40
39
|
* ```
|
|
41
40
|
*/
|
|
42
|
-
export declare function createKeyHold(key: IndividualKey | (() => IndividualKey)): () => boolean;
|
|
43
|
-
//#endregion
|
|
41
|
+
export declare function createKeyHold(key: IndividualKey | (() => IndividualKey)): () => boolean;
|
package/dist/createKeyHold.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useSelector } from "./_useSelector.js";
|
|
|
2
2
|
import { getKeyStateTracker } from "@tanstack/hotkeys";
|
|
3
3
|
import { createMemo } from "solid-js";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/createKeyHold.ts
|
|
6
6
|
/**
|
|
7
7
|
* SolidJS primitive that returns whether a specific key is currently being held.
|
|
8
8
|
*
|
|
@@ -51,5 +51,4 @@ function createKeyHold(key) {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
//#endregion
|
|
55
54
|
export { createKeyHold };
|
package/dist/defaultOptions.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useHotkeysContext } from "./HotkeysProvider.js";
|
|
|
2
2
|
import { useSelector } from "./_useSelector.js";
|
|
3
3
|
import { createStore } from "@tanstack/hotkeys/adapter";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/defaultOptions.ts
|
|
6
6
|
/** Captures the context once and reads current defaults inside reactive computations. */
|
|
7
7
|
function useDefaultHotkeysOptionsSource() {
|
|
8
8
|
const context = useHotkeysContext();
|
|
@@ -21,5 +21,4 @@ function useAppHotkeysStoreSource() {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
//#endregion
|
|
25
24
|
export { useAppHotkeysStoreSource, useDefaultHotkeysOptionsSource };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CreateAppHotkeyOptions, CreateHotkeyChordOptions, CreateHotkeyCommonOptions, CreateHotkeyOptions, CreateHotkeyOptionsFor, CreateHotkeySequenceOptions, CreateHotkeyTarget, createHotkey } from "./createHotkey.js";
|
|
2
1
|
import { HotkeysProvider, HotkeysProviderOptions, HotkeysProviderProps, useDefaultHotkeysOptions, useHotkeysContext } from "./HotkeysProvider.js";
|
|
2
|
+
import { CreateAppHotkeyOptions, CreateHotkeyChordOptions, CreateHotkeyCommonOptions, CreateHotkeyOptions, CreateHotkeyOptionsFor, CreateHotkeySequenceOptions, CreateHotkeyTarget, createHotkey } from "./createHotkey.js";
|
|
3
3
|
import { CreateHotkeyDefinition, createHotkeys } from "./createHotkeys.js";
|
|
4
4
|
import { SolidHotkeyRecorder, createHotkeyRecorder } from "./createHotkeyRecorder.js";
|
|
5
5
|
import { createHotkeyRegistrations } from "./createHotkeyRegistrations.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HotkeysProvider, useDefaultHotkeysOptions, useHotkeysContext } from "./HotkeysProvider.js";
|
|
2
|
-
import { createHotkeys } from "./createHotkeys.js";
|
|
3
2
|
import { createHotkey } from "./createHotkey.js";
|
|
3
|
+
import { createHotkeys } from "./createHotkeys.js";
|
|
4
4
|
import { createHotkeyRecorder } from "./createHotkeyRecorder.js";
|
|
5
5
|
import { createHotkeyRegistrations } from "./createHotkeyRegistrations.js";
|
|
6
6
|
import { createHotkeyScopesState } from "./createHotkeyScopesState.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-hotkeys",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "SolidJS adapter for TanStack Hotkeys",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,22 +38,22 @@
|
|
|
38
38
|
"skills"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@tanstack/hotkeys": "0.
|
|
41
|
+
"@tanstack/hotkeys": "0.25.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@solidjs/testing-library": "^0.8.10",
|
|
45
45
|
"@testing-library/jest-dom": "^7.0.1",
|
|
46
|
-
"solid-js": "^1.9.
|
|
47
|
-
"vite-plugin-solid": "^2.11.
|
|
46
|
+
"solid-js": "^1.9.18",
|
|
47
|
+
"vite-plugin-solid": "^2.11.15"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"solid-js": "^1.7.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"clean": "premove ./build ./dist",
|
|
54
|
-
"lint": "
|
|
55
|
-
"lint:fix": "
|
|
56
|
-
"test:
|
|
54
|
+
"lint": "oxlint ./src",
|
|
55
|
+
"lint:fix": "oxlint ./src --fix",
|
|
56
|
+
"test:oxlint": "oxlint ./src",
|
|
57
57
|
"test:lib": "vitest --passWithNoTests",
|
|
58
58
|
"test:lib:dev": "pnpm test:lib --watch",
|
|
59
59
|
"test:types": "tsc",
|
|
@@ -30,8 +30,8 @@ requires:
|
|
|
30
30
|
Before starting, load the `@tanstack/hotkeys#hotkeys-core` skill (`npx @tanstack/intent@latest load @tanstack/hotkeys#hotkeys-core`).
|
|
31
31
|
|
|
32
32
|
```tsx
|
|
33
|
-
import { createSignal } from 'solid-js'
|
|
34
33
|
import { createHotkey } from '@tanstack/solid-hotkeys'
|
|
34
|
+
import { createSignal } from 'solid-js'
|
|
35
35
|
|
|
36
36
|
export function Editor() {
|
|
37
37
|
const [isDirty, setIsDirty] = createSignal(false)
|
|
@@ -19,10 +19,10 @@ declare module '@tanstack/solid-hotkeys' {
|
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
```tsx no-check
|
|
22
|
-
import type { JSX } from 'solid-js'
|
|
23
22
|
import { HotkeysProvider } from '@tanstack/solid-hotkeys'
|
|
24
|
-
import type { CustomHotkeys } from '@tanstack/solid-hotkeys'
|
|
25
23
|
import { appHotkeys } from './app-hotkeys'
|
|
24
|
+
import type { CustomHotkeys } from '@tanstack/solid-hotkeys'
|
|
25
|
+
import type { JSX } from 'solid-js'
|
|
26
26
|
|
|
27
27
|
const saved: CustomHotkeys = JSON.parse(localStorage.getItem('hotkeys') ?? '{}')
|
|
28
28
|
|