@tanstack/vue-hotkeys 0.21.0 → 0.21.2

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.
@@ -2,7 +2,6 @@ import { HotkeysProviderOptions } from "./HotkeysProviderContext.js";
2
2
  import { AppHotkeys, CustomHotkeys } from "@tanstack/hotkeys";
3
3
  import { PropType } from "vue";
4
4
  import { HotkeysProviderScopeProps } from "@tanstack/hotkeys/adapter";
5
- //#region src/HotkeysProvider.d.ts
6
5
  /**
7
6
  * Vue component that provides default options, app hotkeys, and the user's
8
7
  * custom hotkeys. A new `customHotkeys` value replaces the current custom
@@ -105,5 +104,4 @@ export declare const HotkeysProvider: import("vue").DefineComponent<import("vue"
105
104
  customHotkeys: CustomHotkeys<Readonly<Record<string, import("@tanstack/hotkeys").AppHotkey<string, import("@tanstack/hotkeys").HotkeyChord | import("@tanstack/hotkeys").HotkeySequence | null>>>> | null;
106
105
  scope: string;
107
106
  enabled: boolean;
108
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
109
- //#endregion
107
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1,7 +1,7 @@
1
1
  import { provideHotkeysContext } from "./HotkeysProviderContext.js";
2
2
  import { defineComponent } from "vue";
3
3
 
4
- //#region src/HotkeysProvider.tsx
4
+ // src/HotkeysProvider.tsx
5
5
  /**
6
6
  * Vue component that provides default options, app hotkeys, and the user's
7
7
  * custom hotkeys. A new `customHotkeys` value replaces the current custom
@@ -79,5 +79,4 @@ const HotkeysProvider = defineComponent({
79
79
  }
80
80
  });
81
81
 
82
- //#endregion
83
82
  export { HotkeysProvider };
@@ -2,7 +2,6 @@ import { UseHotkeyCommonOptions } from "./useHotkey.js";
2
2
  import { AppHotkeys, AppHotkeysStore, CustomHotkeys, HotkeyChordRecorderOptions, HotkeyPlatform, HotkeySequenceRecorderOptions } from "@tanstack/hotkeys";
3
3
  import { MaybeRefOrGetter } from "vue";
4
4
  import { HotkeysProviderScopeProps } from "@tanstack/hotkeys/adapter";
5
- //#region src/HotkeysProviderContext.d.ts
6
5
  export interface HotkeysProviderOptions {
7
6
  /**
8
7
  * The user's platform, for labels from `useFormatForDisplay`, hotkeys, and
@@ -43,8 +42,8 @@ export interface ProvideHotkeysContextOptions {
43
42
  /**
44
43
  * The user's saved custom hotkeys. When the value changes, such as after
45
44
  * saved data loads or the user signs in, it replaces the current custom
46
- * hotkeys. `undefined` leaves them unchanged; `null` clears them. Invalid
47
- * entries are ignored with a warning.
45
+ * hotkeys. `undefined` leaves them unchanged; `null` clears them. Unknown
46
+ * ids and invalid entries are ignored.
48
47
  */
49
48
  customHotkeys?: MaybeRefOrGetter<CustomHotkeys | null | undefined>;
50
49
  /** Called with the custom hotkeys after every change, ready to save. */
@@ -78,4 +77,4 @@ export declare function provideHotkeysContext(options?: ProvideHotkeysContextOpt
78
77
  */
79
78
  export declare function useHotkeysContext(): HotkeysContextValue | null;
80
79
  export declare function useDefaultHotkeysOptions(): HotkeysProviderOptions;
81
- //#endregion
80
+ export {};
@@ -3,7 +3,7 @@ import { publishAppHotkeysStore } from "@tanstack/hotkeys";
3
3
  import { computed, hasInjectionContext, inject, onMounted, onScopeDispose, provide, toValue, watch } from "vue";
4
4
  import { activateHotkeysProviderScope, createAppHotkeysStore, getHotkeysProviderScopeKey, mergeHotkeysProviderDefaults } from "@tanstack/hotkeys/adapter";
5
5
 
6
- //#region src/HotkeysProviderContext.ts
6
+ // src/HotkeysProviderContext.ts
7
7
  const HotkeysContext = Symbol("HotkeysContext");
8
8
  const DEFAULT_OPTIONS = {};
9
9
  /**
@@ -77,5 +77,4 @@ function useDefaultHotkeysOptions() {
77
77
  return useHotkeysContext()?.defaultOptions ?? DEFAULT_OPTIONS;
78
78
  }
79
79
 
80
- //#endregion
81
80
  export { provideHotkeysContext, useDefaultHotkeysOptions, useHotkeysContext };
package/dist/_useLive.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { getCurrentInstance, onActivated, onDeactivated, ref } from "vue";
2
2
 
3
- //#region src/_useLive.ts
3
+ // src/_useLive.ts
4
4
  /**
5
5
  * Whether the component is shown. A component in a page cached by
6
6
  * `<KeepAlive>` is not live while the page is hidden. Always true outside a
@@ -15,5 +15,4 @@ function useLive() {
15
15
  return live;
16
16
  }
17
17
 
18
- //#endregion
19
18
  export { useLive };
@@ -2,7 +2,7 @@ import { useHotkeysContext } from "./HotkeysProviderContext.js";
2
2
  import { useStoreSelector } from "./useStoreSelector.js";
3
3
  import { shallowRef } from "vue";
4
4
 
5
- //#region src/defaultOptions.ts
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();
@@ -20,5 +20,4 @@ function useAppHotkeysStoreSource() {
20
20
  };
21
21
  }
22
22
 
23
- //#endregion
24
23
  export { useAppHotkeysStoreSource, useDefaultHotkeysOptionsSource };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { UseAppHotkeyOptions, UseHotkeyChordOptions, UseHotkeyCommonOptions, UseHotkeyOptions, UseHotkeyOptionsFor, UseHotkeySequenceOptions, UseHotkeyTarget, useHotkey } from "./useHotkey.js";
2
- import { HotkeysProviderOptions, ProvideHotkeysContextOptions, provideHotkeysContext, useDefaultHotkeysOptions, useHotkeysContext } from "./HotkeysProviderContext.js";
3
1
  import { HotkeysProvider } from "./HotkeysProvider.js";
2
+ import { HotkeysProviderOptions, ProvideHotkeysContextOptions, provideHotkeysContext, useDefaultHotkeysOptions, useHotkeysContext } from "./HotkeysProviderContext.js";
3
+ import { UseAppHotkeyOptions, UseHotkeyChordOptions, UseHotkeyCommonOptions, UseHotkeyOptions, UseHotkeyOptionsFor, UseHotkeySequenceOptions, UseHotkeyTarget, useHotkey } from "./useHotkey.js";
4
4
  import { UseHotkeyDefinition, useHotkeys } from "./useHotkeys.js";
5
5
  import { useHeldKeys } from "./useHeldKeys.js";
6
6
  import { useHeldKeyCodes } from "./useHeldKeyCodes.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { provideHotkeysContext, useDefaultHotkeysOptions, useHotkeysContext } from "./HotkeysProviderContext.js";
2
1
  import { HotkeysProvider } from "./HotkeysProvider.js";
3
- import { useHotkeys } from "./useHotkeys.js";
2
+ import { provideHotkeysContext, useDefaultHotkeysOptions, useHotkeysContext } from "./HotkeysProviderContext.js";
4
3
  import { useHotkey } from "./useHotkey.js";
4
+ import { useHotkeys } from "./useHotkeys.js";
5
5
  import { useHeldKeys } from "./useHeldKeys.js";
6
6
  import { useHeldKeyCodes } from "./useHeldKeyCodes.js";
7
7
  import { useKeyHold } from "./useKeyHold.js";
@@ -1,6 +1,5 @@
1
1
  import { AppHotkey, AppHotkeyListItem, CustomHotkeys, Hotkey, RegisteredAppHotkeys } from "@tanstack/hotkeys";
2
2
  import { ComputedRef } from "vue";
3
- //#region src/useAppHotkeys.d.ts
4
3
  /**
5
4
  * Returns a computed ref of the effective app hotkeys from `HotkeysProvider`,
6
5
  * typed by `Register`: each declaration with the user's custom hotkey applied.
@@ -39,5 +38,4 @@ export interface UseCustomHotkeysResult {
39
38
  * registered app hotkey immediately and are emitted by the provider as
40
39
  * `custom-hotkeys-change`, ready to save.
41
40
  */
42
- export declare function useCustomHotkeys(): UseCustomHotkeysResult;
43
- //#endregion
41
+ export declare function useCustomHotkeys(): UseCustomHotkeysResult;
@@ -2,10 +2,10 @@ import { useAppHotkeysStoreSource } from "./defaultOptions.js";
2
2
  import { useHotkeyRegistrations } from "./useHotkeyRegistrations.js";
3
3
  import { computed } from "vue";
4
4
 
5
- //#region src/useAppHotkeys.ts
5
+ // src/useAppHotkeys.ts
6
6
  function useRequiredStore(name) {
7
7
  const source = useAppHotkeysStoreSource();
8
- if (!source.store) throw new Error(`${name} requires a HotkeysProvider with app hotkeys`);
8
+ if (!source.store) throw new Error(`[hotkeys] ${name} requires a HotkeysProvider with app hotkeys`);
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 { useAppHotkeyList, useAppHotkeys, useCustomHotkeys };
@@ -1,5 +1,4 @@
1
1
  import { formatForDisplay } from "@tanstack/hotkeys";
2
- //#region src/useFormatForDisplay.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 `setup`; the returned function
@@ -20,5 +19,4 @@ import { formatForDisplay } from "@tanstack/hotkeys";
20
19
  * </template>
21
20
  * ```
22
21
  */
23
- export declare function useFormatForDisplay(): typeof formatForDisplay;
24
- //#endregion
22
+ export declare function useFormatForDisplay(): typeof formatForDisplay;
@@ -1,7 +1,7 @@
1
1
  import { useDefaultHotkeysOptionsSource } from "./defaultOptions.js";
2
2
  import { formatForDisplay } from "@tanstack/hotkeys";
3
3
 
4
- //#region src/useFormatForDisplay.ts
4
+ // src/useFormatForDisplay.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 `setup`; the returned function
@@ -30,5 +30,4 @@ function useFormatForDisplay() {
30
30
  }));
31
31
  }
32
32
 
33
- //#endregion
34
33
  export { useFormatForDisplay };
@@ -1,5 +1,4 @@
1
1
  import { Ref } from "vue";
2
- //#region src/useHeldKeyCodes.d.ts
3
2
  /**
4
3
  * Vue composable that returns a reactive ref mapping currently held key names to their physical `event.code` values.
5
4
  *
@@ -26,5 +25,4 @@ import { Ref } from "vue";
26
25
  * </template>
27
26
  * ```
28
27
  */
29
- export declare function useHeldKeyCodes(): Ref<Record<string, string>>;
30
- //#endregion
28
+ export declare function useHeldKeyCodes(): Ref<Record<string, string>>;
@@ -1,7 +1,7 @@
1
1
  import { useStoreSelector } from "./useStoreSelector.js";
2
2
  import { getKeyStateTracker } from "@tanstack/hotkeys";
3
3
 
4
- //#region src/useHeldKeyCodes.ts
4
+ // src/useHeldKeyCodes.ts
5
5
  /**
6
6
  * Vue composable that returns a reactive ref mapping currently held key names to their physical `event.code` values.
7
7
  *
@@ -33,5 +33,4 @@ function useHeldKeyCodes() {
33
33
  return useStoreSelector(tracker.store, (state) => state.heldCodes);
34
34
  }
35
35
 
36
- //#endregion
37
36
  export { useHeldKeyCodes };
@@ -1,5 +1,4 @@
1
1
  import { Ref } from "vue";
2
- //#region src/useHeldKeys.d.ts
3
2
  /**
4
3
  * Vue composable that returns a reactive ref of currently held keyboard keys.
5
4
  *
@@ -23,5 +22,4 @@ import { Ref } from "vue";
23
22
  * </template>
24
23
  * ```
25
24
  */
26
- export declare function useHeldKeys(): Ref<Array<string>>;
27
- //#endregion
25
+ export declare function useHeldKeys(): Ref<Array<string>>;
@@ -1,7 +1,7 @@
1
1
  import { useStoreSelector } from "./useStoreSelector.js";
2
2
  import { getKeyStateTracker } from "@tanstack/hotkeys";
3
3
 
4
- //#region src/useHeldKeys.ts
4
+ // src/useHeldKeys.ts
5
5
  /**
6
6
  * Vue composable that returns a reactive ref of currently held keyboard keys.
7
7
  *
@@ -30,5 +30,4 @@ function useHeldKeys() {
30
30
  return useStoreSelector(tracker.store, (state) => state.heldKeys);
31
31
  }
32
32
 
33
- //#endregion
34
33
  export { useHeldKeys };
@@ -1,7 +1,6 @@
1
1
  import { AppHotkey, HotkeyCallback, HotkeyCallbackContextFor, RegisterableHotkey, Target } from "@tanstack/hotkeys";
2
2
  import { MaybeRefOrGetter } from "vue";
3
3
  import { AdapterAppHotkeyOptions, AdapterChordOptions, AdapterCommonOptions, AdapterHotkeyOptions, AdapterOptionsFor, AdapterSequenceOptions } from "@tanstack/hotkeys/adapter";
4
- //#region src/useHotkey.d.ts
5
4
  /**
6
5
  * The element to listen on: a ref, getter, element, or null. A target that
7
6
  * resolves to `null` skips registration until it is set. Defaults to document.
@@ -44,4 +43,4 @@ export type UseAppHotkeyOptions<T extends AppHotkey = AppHotkey> = WithReactiveE
44
43
  */
45
44
  export declare function useHotkey<T extends AppHotkey>(hotkey: MaybeRefOrGetter<T | null | undefined>, callback: HotkeyCallback, options?: MaybeRefOrGetter<UseAppHotkeyOptions<T>>): void;
46
45
  export declare function useHotkey<const T extends RegisterableHotkey>(hotkey: MaybeRefOrGetter<T | null | undefined>, callback: HotkeyCallback<HotkeyCallbackContextFor<T>>, options?: MaybeRefOrGetter<UseHotkeyOptionsFor<T>>): void;
47
- //#endregion
46
+ export {};
package/dist/useHotkey.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useHotkeys } from "./useHotkeys.js";
2
2
 
3
- //#region src/useHotkey.ts
3
+ // src/useHotkey.ts
4
4
  function useHotkey(hotkey, callback, options = {}) {
5
5
  useHotkeys([{
6
6
  hotkey,
@@ -9,5 +9,4 @@ function useHotkey(hotkey, callback, options = {}) {
9
9
  }]);
10
10
  }
11
11
 
12
- //#endregion
13
12
  export { useHotkey };
@@ -1,6 +1,5 @@
1
1
  import { AppHotkey, HeldModifierOptions, RegisterableHotkey } from "@tanstack/hotkeys";
2
2
  import { ComputedRef, MaybeRefOrGetter } from "vue";
3
- //#region src/useHotkeyHint.d.ts
4
3
  /**
5
4
  * Returns a computed ref indicating whether held modifiers reveal this shortcut.
6
5
  * The hint shows only while the hotkey can fire: some registration of it is
@@ -10,5 +9,4 @@ import { ComputedRef, MaybeRefOrGetter } from "vue";
10
9
  * (false while unbound). No hotkey (`undefined`, `null`, or `''`) returns
11
10
  * false. This helper does not register a shortcut. A hotkey on an element counts only while focus is inside it.
12
11
  */
13
- export declare function useHotkeyHint(hotkey: MaybeRefOrGetter<RegisterableHotkey | AppHotkey | null | undefined>, options?: MaybeRefOrGetter<HeldModifierOptions>): ComputedRef<boolean>;
14
- //#endregion
12
+ export declare function useHotkeyHint(hotkey: MaybeRefOrGetter<RegisterableHotkey | AppHotkey | null | undefined>, options?: MaybeRefOrGetter<HeldModifierOptions>): ComputedRef<boolean>;
@@ -1,9 +1,9 @@
1
- import { useStoreSelector } from "./useStoreSelector.js";
2
1
  import { useAppHotkeysStoreSource } from "./defaultOptions.js";
2
+ import { useStoreSelector } from "./useStoreSelector.js";
3
3
  import { getHotkeyManager, getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey } from "@tanstack/hotkeys";
4
4
  import { computed, toValue } from "vue";
5
5
 
6
- //#region src/useHotkeyHint.ts
6
+ // src/useHotkeyHint.ts
7
7
  /**
8
8
  * Returns a computed ref indicating whether held modifiers reveal this shortcut.
9
9
  * The hint shows only while the hotkey can fire: some registration of it is
@@ -26,5 +26,4 @@ function useHotkeyHint(hotkey, options = {}) {
26
26
  });
27
27
  }
28
28
 
29
- //#endregion
30
29
  export { useHotkeyHint };
@@ -1,6 +1,5 @@
1
1
  import { Hotkey, HotkeyChord, HotkeyChordRecorderOptions, HotkeyRecorderOptions, HotkeySequence, HotkeySequenceRecorderOptions } from "@tanstack/hotkeys";
2
2
  import { Ref } from "vue";
3
- //#region src/useHotkeyRecorder.d.ts
4
3
  export interface VueHotkeyRecorder<THotkey extends Hotkey = Hotkey> {
5
4
  /** Whether recording is currently active */
6
5
  isRecording: Readonly<Ref<boolean>>;
@@ -35,5 +34,4 @@ export declare function useHotkeyRecorder(options: HotkeyChordRecorderOptions):
35
34
  export declare function useHotkeyRecorder(options: HotkeySequenceRecorderOptions): VueHotkeyRecorder;
36
35
  export declare function useHotkeyRecorder(options: () => HotkeySequenceRecorderOptions): VueHotkeyRecorder;
37
36
  export declare function useHotkeyRecorder(options: () => HotkeyChordRecorderOptions): VueHotkeyRecorder<HotkeyChord>;
38
- export declare function useHotkeyRecorder(options: Ref<HotkeyRecorderOptions>): VueHotkeyRecorder;
39
- //#endregion
37
+ export declare function useHotkeyRecorder(options: Ref<HotkeyRecorderOptions>): VueHotkeyRecorder;
@@ -1,11 +1,11 @@
1
1
  import { useLive } from "./_useLive.js";
2
- import { useStoreSelector } from "./useStoreSelector.js";
3
2
  import { useDefaultHotkeysOptionsSource } from "./defaultOptions.js";
3
+ import { useStoreSelector } from "./useStoreSelector.js";
4
4
  import { HotkeyRecorder } from "@tanstack/hotkeys";
5
5
  import { getCurrentInstance, onScopeDispose, toValue, watch } from "vue";
6
6
  import { withDefaults } from "@tanstack/hotkeys/adapter";
7
7
 
8
- //#region src/useHotkeyRecorder.ts
8
+ // src/useHotkeyRecorder.ts
9
9
  function useHotkeyRecorder(options) {
10
10
  const defaultOptions = useDefaultHotkeysOptionsSource();
11
11
  const resolve = () => withDefaults(defaultOptions().hotkeyRecorder, toValue(options));
@@ -37,5 +37,4 @@ function useHotkeyRecorder(options) {
37
37
  };
38
38
  }
39
39
 
40
- //#endregion
41
40
  export { useHotkeyRecorder };
@@ -1,6 +1,5 @@
1
1
  import { HotkeyRegistrationView } from "@tanstack/hotkeys";
2
2
  import { Ref } from "vue";
3
- //#region src/useHotkeyRegistrations.d.ts
4
3
  /**
5
4
  * Vue composable that reactively reads every hotkey registration, chords and
6
5
  * sequences, from the singleton HotkeyManager. Narrow each view with `kind`.
@@ -21,5 +20,4 @@ import { Ref } from "vue";
21
20
  * </template>
22
21
  * ```
23
22
  */
24
- export declare function useHotkeyRegistrations(): Readonly<Ref<Array<HotkeyRegistrationView>>>;
25
- //#endregion
23
+ export declare function useHotkeyRegistrations(): Readonly<Ref<Array<HotkeyRegistrationView>>>;
@@ -1,7 +1,7 @@
1
1
  import { useStoreSelector } from "./useStoreSelector.js";
2
2
  import { getHotkeyManager, toHotkeyRegistrationView } from "@tanstack/hotkeys";
3
3
 
4
- //#region src/useHotkeyRegistrations.ts
4
+ // src/useHotkeyRegistrations.ts
5
5
  /**
6
6
  * Vue composable that reactively reads every hotkey registration, chords and
7
7
  * sequences, from the singleton HotkeyManager. Narrow each view with `kind`.
@@ -26,5 +26,4 @@ function useHotkeyRegistrations() {
26
26
  return useStoreSelector(getHotkeyManager().registrations, (state) => Array.from(state.values()).map(toHotkeyRegistrationView));
27
27
  }
28
28
 
29
- //#endregion
30
29
  export { useHotkeyRegistrations };
@@ -1,6 +1,5 @@
1
1
  import { HotkeyScopesState } from "@tanstack/hotkeys";
2
2
  import { Ref } from "vue";
3
- //#region src/useHotkeyScopesState.d.ts
4
3
  /**
5
4
  * Vue composable that returns a ref of the hotkey manager's scope state: the
6
5
  * active scopes, the exclusive scope that owns the keyboard, and the scopes
@@ -21,5 +20,4 @@ import { Ref } from "vue";
21
20
  * </template>
22
21
  * ```
23
22
  */
24
- export declare function useHotkeyScopesState(): Ref<HotkeyScopesState>;
25
- //#endregion
23
+ export declare function useHotkeyScopesState(): Ref<HotkeyScopesState>;
@@ -1,7 +1,7 @@
1
1
  import { useStoreSelector } from "./useStoreSelector.js";
2
2
  import { getHotkeyManager } from "@tanstack/hotkeys";
3
3
 
4
- //#region src/useHotkeyScopesState.ts
4
+ // src/useHotkeyScopesState.ts
5
5
  /**
6
6
  * Vue composable that returns a ref of the hotkey manager's scope state: the
7
7
  * active scopes, the exclusive scope that owns the keyboard, and the scopes
@@ -26,5 +26,4 @@ function useHotkeyScopesState() {
26
26
  return useStoreSelector(getHotkeyManager().scopes, (state) => state);
27
27
  }
28
28
 
29
- //#endregion
30
29
  export { useHotkeyScopesState };
@@ -1,7 +1,6 @@
1
1
  import { UseAppHotkeyOptions, UseHotkeyChordOptions, UseHotkeyCommonOptions, UseHotkeyOptions, UseHotkeySequenceOptions } from "./useHotkey.js";
2
2
  import { AppHotkey, HotkeyCallback, RegisterableHotkey, RegisterableHotkeyChord, RegisterableHotkeySequence } from "@tanstack/hotkeys";
3
3
  import { MaybeRefOrGetter } from "vue";
4
- //#region src/useHotkeys.d.ts
5
4
  /**
6
5
  * One hotkey for `useHotkeys`. The hotkey and options may be refs or getters.
7
6
  * Chords accept `requireReset`; sequences accept `timeout`; hotkeys of unknown
@@ -51,5 +50,4 @@ export type UseHotkeyDefinition = {
51
50
  * ])
52
51
  * ```
53
52
  */
54
- export declare function useHotkeys(hotkeys: MaybeRefOrGetter<ReadonlyArray<UseHotkeyDefinition>>, commonOptions?: MaybeRefOrGetter<UseHotkeyCommonOptions>): void;
55
- //#endregion
53
+ export declare function useHotkeys(hotkeys: MaybeRefOrGetter<ReadonlyArray<UseHotkeyDefinition>>, commonOptions?: MaybeRefOrGetter<UseHotkeyCommonOptions>): void;
@@ -3,7 +3,7 @@ import { useAppHotkeysStoreSource, useDefaultHotkeysOptionsSource } from "./defa
3
3
  import { onScopeDispose, toValue, watch } from "vue";
4
4
  import { createHotkeyBindings, prepareHotkeyDefinitions } from "@tanstack/hotkeys/adapter";
5
5
 
6
- //#region src/useHotkeys.ts
6
+ // src/useHotkeys.ts
7
7
  /** Resolves a ref or getter `enabled` so the core sees a boolean. */
8
8
  function resolveEnabled(options) {
9
9
  if (!options) return options;
@@ -57,5 +57,4 @@ function useHotkeys(hotkeys, commonOptions = {}) {
57
57
  });
58
58
  }
59
59
 
60
- //#endregion
61
60
  export { useHotkeys };
@@ -1,6 +1,5 @@
1
1
  import { IndividualKey } from "@tanstack/hotkeys";
2
2
  import { MaybeRefOrGetter, Ref } from "vue";
3
- //#region src/useKeyHold.d.ts
4
3
  /**
5
4
  * Vue composable that returns a reactive ref indicating whether a specific key is currently being held.
6
5
  *
@@ -44,5 +43,4 @@ import { MaybeRefOrGetter, Ref } from "vue";
44
43
  * </template>
45
44
  * ```
46
45
  */
47
- export declare function useKeyHold(key: MaybeRefOrGetter<IndividualKey>): Ref<boolean>;
48
- //#endregion
46
+ export declare function useKeyHold(key: MaybeRefOrGetter<IndividualKey>): Ref<boolean>;
@@ -1,7 +1,7 @@
1
1
  import { useHeldKeys } from "./useHeldKeys.js";
2
2
  import { computed, toValue } from "vue";
3
3
 
4
- //#region src/useKeyHold.ts
4
+ // src/useKeyHold.ts
5
5
  /**
6
6
  * Vue composable that returns a reactive ref indicating whether a specific key is currently being held.
7
7
  *
@@ -53,5 +53,4 @@ function useKeyHold(key) {
53
53
  });
54
54
  }
55
55
 
56
- //#endregion
57
56
  export { useKeyHold };
@@ -1,6 +1,6 @@
1
1
  import { onScopeDispose, shallowReadonly, shallowRef } from "vue";
2
2
 
3
- //#region src/useStoreSelector.ts
3
+ // src/useStoreSelector.ts
4
4
  /**
5
5
  * Subscribes to a store until the effect scope is disposed and returns a ref
6
6
  * to the selected value, which updates when it changes (by `===`).
@@ -19,5 +19,4 @@ function useStoreSelector(store, selector) {
19
19
  return shallowReadonly(selected);
20
20
  }
21
21
 
22
- //#endregion
23
22
  export { useStoreSelector };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/vue-hotkeys",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "description": "Vue adapter for TanStack Hotkeys",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -38,21 +38,21 @@
38
38
  "skills"
39
39
  ],
40
40
  "dependencies": {
41
- "@tanstack/hotkeys": "0.23.0"
41
+ "@tanstack/hotkeys": "0.25.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@vitejs/plugin-vue": "^6.0.9",
44
+ "@vitejs/plugin-vue": "^6.0.10",
45
45
  "@vue/test-utils": "^2.5.1",
46
- "vue": "^3.5.43"
46
+ "vue": "^3.5.45"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "vue": ">=3.3.0"
50
50
  },
51
51
  "scripts": {
52
52
  "clean": "premove ./build ./dist",
53
- "lint": "eslint ./src",
54
- "lint:fix": "eslint ./src --fix",
55
- "test:eslint": "eslint ./src",
53
+ "lint": "oxlint ./src",
54
+ "lint:fix": "oxlint ./src --fix",
55
+ "test:oxlint": "oxlint ./src",
56
56
  "test:lib": "vitest --passWithNoTests",
57
57
  "test:lib:dev": "pnpm test:lib --watch",
58
58
  "test:types": "tsc",
@@ -33,8 +33,8 @@ Before starting, load the `@tanstack/hotkeys#hotkeys-core` skill (`npx @tanstack
33
33
 
34
34
  ```vue
35
35
  <script setup lang="ts">
36
- import { ref } from 'vue'
37
36
  import { formatForDisplay, useHotkey } from '@tanstack/vue-hotkeys'
37
+ import { ref } from 'vue'
38
38
 
39
39
  const isDirty = ref(false)
40
40
  const panel = ref<HTMLDivElement | null>(null)
@@ -22,9 +22,9 @@ declare module '@tanstack/vue-hotkeys' {
22
22
  <!-- App.vue -->
23
23
  <script setup lang="ts">
24
24
  import { HotkeysProvider } from '@tanstack/vue-hotkeys'
25
- import type { CustomHotkeys } from '@tanstack/vue-hotkeys'
26
- import { appHotkeys } from './app-hotkeys'
27
25
  import AppContent from './AppContent.vue'
26
+ import { appHotkeys } from './app-hotkeys'
27
+ import type { CustomHotkeys } from '@tanstack/vue-hotkeys'
28
28
 
29
29
  const saved: CustomHotkeys = JSON.parse(localStorage.getItem('hotkeys') ?? '{}')
30
30
  const saveHotkeys = (custom: CustomHotkeys) =>
@@ -48,13 +48,13 @@ A settings row records with `useHotkeyRecorder` and saves through `useCustomHotk
48
48
 
49
49
  ```vue
50
50
  <script setup lang="ts">
51
- import { computed } from 'vue'
52
51
  import {
53
52
  formatForDisplay,
54
53
  useAppHotkeys,
55
54
  useCustomHotkeys,
56
55
  useHotkeyRecorder,
57
56
  } from '@tanstack/vue-hotkeys'
57
+ import { computed } from 'vue'
58
58
  import type { AppHotkeyId } from '@tanstack/vue-hotkeys'
59
59
 
60
60
  const props = defineProps<{ id: AppHotkeyId }>()