@tanstack/ember-hotkeys 0.10.1 → 0.10.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.
- package/dist/bindings.js +1 -2
- package/dist/createHotkeysScope.d.ts +4 -6
- package/dist/createHotkeysScope.js +3 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/onHotkey.d.ts +1 -3
- package/dist/onHotkey.js +1 -2
- package/dist/onHotkeys.d.ts +1 -3
- package/dist/onHotkeys.js +1 -2
- package/dist/types.d.ts +1 -3
- package/dist/useAppHotkeys.d.ts +1 -3
- package/dist/useAppHotkeys.js +3 -4
- package/dist/useFormatForDisplay.d.ts +1 -3
- package/dist/useFormatForDisplay.js +1 -2
- package/dist/useHeldKeyCodes.d.ts +1 -3
- package/dist/useHeldKeyCodes.js +1 -2
- package/dist/useHeldKeys.d.ts +1 -3
- package/dist/useHeldKeys.js +1 -2
- package/dist/useHotkey.d.ts +1 -3
- package/dist/useHotkey.js +1 -2
- package/dist/useHotkeyHint.d.ts +1 -3
- package/dist/useHotkeyHint.js +1 -2
- package/dist/useHotkeyRecorder.d.ts +2 -4
- package/dist/useHotkeyRecorder.js +1 -2
- package/dist/useHotkeyRegistrations.d.ts +1 -3
- package/dist/useHotkeyRegistrations.js +1 -2
- package/dist/useHotkeyScopesState.d.ts +1 -3
- package/dist/useHotkeyScopesState.js +1 -2
- package/dist/useHotkeys.d.ts +1 -3
- package/dist/useHotkeys.js +1 -2
- package/dist/useKeyHold.d.ts +1 -3
- package/dist/useKeyHold.js +1 -2
- package/dist/utils.d.ts +1 -3
- package/dist/utils.js +1 -2
- package/package.json +18 -18
package/dist/bindings.js
CHANGED
|
@@ -3,7 +3,7 @@ import { isDestroyed, isDestroying, registerDestructor } from "@ember/destroyabl
|
|
|
3
3
|
import { scheduleOnce } from "@ember/runloop";
|
|
4
4
|
import { createHotkeyBindings, prepareHotkeyDefinitions, subscribePublishedAppHotkeys } from "@tanstack/hotkeys/adapter";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/bindings.ts
|
|
7
7
|
/** Copies a hotkey so tracked getters are read while Ember tracks the caller. */
|
|
8
8
|
function copyHotkey(hotkey) {
|
|
9
9
|
if (hotkey == null) return hotkey;
|
|
@@ -53,5 +53,4 @@ function createOwnedBindings(owner) {
|
|
|
53
53
|
} };
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
//#endregion
|
|
57
56
|
export { createOwnedBindings };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OnHotkey } from "./onHotkey.js";
|
|
2
|
+
import { OnHotkeys } from "./onHotkeys.js";
|
|
2
3
|
import { UseHotkey } from "./useHotkey.js";
|
|
3
4
|
import { UseHotkeys } from "./useHotkeys.js";
|
|
5
|
+
import { DefaultHotkeysOptions } from "./types.js";
|
|
4
6
|
import { MaybeGetter } from "./utils.js";
|
|
5
|
-
import { OnHotkeys } from "./onHotkeys.js";
|
|
6
|
-
import { OnHotkey } from "./onHotkey.js";
|
|
7
|
-
//#region src/createHotkeysScope.d.ts
|
|
8
7
|
/**
|
|
9
8
|
* Helpers and modifiers with shared defaults. Owners retain their own cleanup.
|
|
10
9
|
* Pass the scope to `useHotkeyRecorder` to apply its recorder defaults, and to
|
|
@@ -20,5 +19,4 @@ export interface EmberHotkeysScope {
|
|
|
20
19
|
* Creates contextual helpers and modifiers with shared, optionally reactive defaults.
|
|
21
20
|
* Pass the scope to child components through arguments to share configuration.
|
|
22
21
|
*/
|
|
23
|
-
export declare function createHotkeysScope(defaultOptions?: MaybeGetter<DefaultHotkeysOptions>): EmberHotkeysScope;
|
|
24
|
-
//#endregion
|
|
22
|
+
export declare function createHotkeysScope(defaultOptions?: MaybeGetter<DefaultHotkeysOptions>): EmberHotkeysScope;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { OnHotkey } from "./onHotkey.js";
|
|
2
|
+
import { OnHotkeys } from "./onHotkeys.js";
|
|
1
3
|
import { UseHotkey } from "./useHotkey.js";
|
|
2
4
|
import { UseHotkeys } from "./useHotkeys.js";
|
|
3
5
|
import { read, scopeDefaults } from "./utils.js";
|
|
4
|
-
import { OnHotkey } from "./onHotkey.js";
|
|
5
|
-
import { OnHotkeys } from "./onHotkeys.js";
|
|
6
6
|
import { definedOptions, mergeHotkeysProviderDefaults } from "@tanstack/hotkeys/adapter";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// src/createHotkeysScope.ts
|
|
9
9
|
/**
|
|
10
10
|
* Creates contextual helpers and modifiers with shared, optionally reactive defaults.
|
|
11
11
|
* Pass the scope to child components through arguments to share configuration.
|
|
@@ -38,5 +38,4 @@ function createHotkeysScope(defaultOptions = {}) {
|
|
|
38
38
|
return scope;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
//#endregion
|
|
42
41
|
export { createHotkeysScope };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DefaultHotkeysOptions, EmberAppHotkeyList, EmberCustomHotkeys, EmberHotkeyCommonOptions, EmberHotkeyDefinition, EmberHotkeyRecorder, EmberHotkeyState, EmberHotkeyTarget, HotkeyRegistrationsResult } from "./types.js";
|
|
2
1
|
import { UseHotkey } from "./useHotkey.js";
|
|
3
2
|
import { UseHotkeys } from "./useHotkeys.js";
|
|
4
3
|
import { MaybeGetter } from "./utils.js";
|
|
@@ -8,11 +7,12 @@ import { useKeyHold } from "./useKeyHold.js";
|
|
|
8
7
|
import { useHotkeyHint } from "./useHotkeyHint.js";
|
|
9
8
|
import { useHotkeyRegistrations } from "./useHotkeyRegistrations.js";
|
|
10
9
|
import { useHotkeyScopesState } from "./useHotkeyScopesState.js";
|
|
11
|
-
import { ElementHotkeyOptions, OnHotkeys } from "./onHotkeys.js";
|
|
12
|
-
import { OnHotkey } from "./onHotkey.js";
|
|
13
|
-
import { EmberHotkeysScope, createHotkeysScope } from "./createHotkeysScope.js";
|
|
14
10
|
import { useHotkeyRecorder } from "./useHotkeyRecorder.js";
|
|
15
11
|
import { useAppHotkeyList, useAppHotkeys, useCustomHotkeys } from "./useAppHotkeys.js";
|
|
16
12
|
import { useFormatForDisplay } from "./useFormatForDisplay.js";
|
|
13
|
+
import { DefaultHotkeysOptions, EmberAppHotkeyList, EmberCustomHotkeys, EmberHotkeyCommonOptions, EmberHotkeyDefinition, EmberHotkeyRecorder, EmberHotkeyState, EmberHotkeyTarget, HotkeyRegistrationsResult } from "./types.js";
|
|
14
|
+
import { EmberHotkeysScope, createHotkeysScope } from "./createHotkeysScope.js";
|
|
15
|
+
import { OnHotkey } from "./onHotkey.js";
|
|
16
|
+
import { ElementHotkeyOptions, OnHotkeys } from "./onHotkeys.js";
|
|
17
17
|
export * from "@tanstack/hotkeys";
|
|
18
18
|
export { DefaultHotkeysOptions, type ElementHotkeyOptions, EmberAppHotkeyList, EmberCustomHotkeys, EmberHotkeyCommonOptions, EmberHotkeyDefinition, EmberHotkeyRecorder, EmberHotkeyState, EmberHotkeyTarget, EmberHotkeysScope, HotkeyRegistrationsResult, type MaybeGetter, createHotkeysScope, OnHotkey as onHotkey, OnHotkeys as onHotkeys, useAppHotkeyList, useAppHotkeys, useCustomHotkeys, useFormatForDisplay, useHeldKeyCodes, useHeldKeys, UseHotkey as useHotkey, useHotkeyHint, useHotkeyRecorder, useHotkeyRegistrations, useHotkeyScopesState, UseHotkeys as useHotkeys, useKeyHold };
|
package/dist/index.js
CHANGED
|
@@ -9,9 +9,9 @@ import { useHotkeyScopesState } from "./useHotkeyScopesState.js";
|
|
|
9
9
|
import { useHotkeyRecorder } from "./useHotkeyRecorder.js";
|
|
10
10
|
import { useAppHotkeyList, useAppHotkeys, useCustomHotkeys } from "./useAppHotkeys.js";
|
|
11
11
|
import { useFormatForDisplay } from "./useFormatForDisplay.js";
|
|
12
|
+
import { createHotkeysScope } from "./createHotkeysScope.js";
|
|
12
13
|
import { OnHotkey } from "./onHotkey.js";
|
|
13
14
|
import { OnHotkeys } from "./onHotkeys.js";
|
|
14
|
-
import { createHotkeysScope } from "./createHotkeysScope.js";
|
|
15
15
|
|
|
16
16
|
export * from "@tanstack/hotkeys"
|
|
17
17
|
|
package/dist/onHotkey.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ElementHotkeyOptions } from "./onHotkeys.js";
|
|
2
2
|
import { AppHotkey, HotkeyCallback, RegisterableHotkey } from "@tanstack/hotkeys";
|
|
3
3
|
import Modifier from "ember-modifier";
|
|
4
|
-
//#region src/onHotkey.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Attaches a hotkey (chord, sequence, or app hotkey) to the element that owns
|
|
7
6
|
* the modifier. `undefined`, `null`, or `''` registers nothing, for an
|
|
@@ -16,5 +15,4 @@ export declare class OnHotkey extends Modifier<{
|
|
|
16
15
|
}> {
|
|
17
16
|
private bindings;
|
|
18
17
|
modify(element: HTMLElement, [hotkey, callback]: [RegisterableHotkey | AppHotkey | null | undefined, HotkeyCallback], options: ElementHotkeyOptions): void;
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
18
|
+
}
|
package/dist/onHotkey.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createOwnedBindings } from "./bindings.js";
|
|
2
2
|
import Modifier from "ember-modifier";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/onHotkey.ts
|
|
5
5
|
/**
|
|
6
6
|
* Attaches a hotkey (chord, sequence, or app hotkey) to the element that owns
|
|
7
7
|
* the modifier. `undefined`, `null`, or `''` registers nothing, for an
|
|
@@ -18,5 +18,4 @@ var OnHotkey = class extends Modifier {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
//#endregion
|
|
22
21
|
export { OnHotkey };
|
package/dist/onHotkeys.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EmberHotkeyCommonOptions, EmberHotkeyDefinition } from "./types.js";
|
|
2
2
|
import Modifier from "ember-modifier";
|
|
3
|
-
//#region src/onHotkeys.d.ts
|
|
4
3
|
/** Options for a modifier whose target is always its containing element. */
|
|
5
4
|
export type ElementHotkeyOptions = Omit<EmberHotkeyCommonOptions, 'target'>;
|
|
6
5
|
/** Attach a reactive list of hotkeys directly to an element. */
|
|
@@ -13,5 +12,4 @@ export declare class OnHotkeys extends Modifier<{
|
|
|
13
12
|
}> {
|
|
14
13
|
private bindings;
|
|
15
14
|
modify(element: HTMLElement, [definitions]: [ReadonlyArray<EmberHotkeyDefinition>], options: ElementHotkeyOptions): void;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
15
|
+
}
|
package/dist/onHotkeys.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createOwnedBindings } from "./bindings.js";
|
|
2
2
|
import Modifier from "ember-modifier";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/onHotkeys.ts
|
|
5
5
|
/** Attach a reactive list of hotkeys directly to an element. */
|
|
6
6
|
var OnHotkeys = class extends Modifier {
|
|
7
7
|
bindings = createOwnedBindings(this);
|
|
@@ -10,5 +10,4 @@ var OnHotkeys = class extends Modifier {
|
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
//#endregion
|
|
14
13
|
export { OnHotkeys };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AppHotkey, AppHotkeyListItem, CustomHotkeys, Hotkey, HotkeyChordRecorderOptions, HotkeyPlatform, HotkeyRegistrationView, HotkeySequence, HotkeySequenceRecorderOptions, RegisteredAppHotkeys, Target } from "@tanstack/hotkeys";
|
|
2
2
|
import { AdapterCommonOptions, AdapterHotkeyDefinition } from "@tanstack/hotkeys/adapter";
|
|
3
|
-
//#region src/types.d.ts
|
|
4
3
|
/** A reactive value. Read `.value` where the framework tracks dependencies. */
|
|
5
4
|
export interface EmberHotkeyState<T> {
|
|
6
5
|
readonly value: T;
|
|
@@ -64,5 +63,4 @@ export interface DefaultHotkeysOptions {
|
|
|
64
63
|
hotkey?: EmberHotkeyCommonOptions;
|
|
65
64
|
/** Defaults for every recorder. */
|
|
66
65
|
hotkeyRecorder?: Partial<Omit<HotkeyChordRecorderOptions & HotkeySequenceRecorderOptions, 'maxSteps' | 'onRecord' | 'validate'>>;
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
66
|
+
}
|
package/dist/useAppHotkeys.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EmberAppHotkeyList, EmberCustomHotkeys, EmberHotkeyState } from "./types.js";
|
|
2
2
|
import { RegisteredAppHotkeys } from "@tanstack/hotkeys";
|
|
3
|
-
//#region src/useAppHotkeys.d.ts
|
|
4
3
|
/** Reads the effective app hotkeys from `provideAppHotkeys`, typed by `Register`. */
|
|
5
4
|
export declare function useAppHotkeys(owner: object): EmberHotkeyState<RegisteredAppHotkeys>;
|
|
6
5
|
/**
|
|
@@ -14,5 +13,4 @@ export declare function useAppHotkeyList(owner: object): EmberAppHotkeyList;
|
|
|
14
13
|
* registered app hotkey immediately and are passed to
|
|
15
14
|
* `onCustomHotkeysChange`, ready to save.
|
|
16
15
|
*/
|
|
17
|
-
export declare function useCustomHotkeys(owner: object): EmberCustomHotkeys;
|
|
18
|
-
//#endregion
|
|
16
|
+
export declare function useCustomHotkeys(owner: object): EmberCustomHotkeys;
|
package/dist/useAppHotkeys.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { trackPublishedAppHotkeys } from "./utils.js";
|
|
2
1
|
import { useHotkeyRegistrations } from "./useHotkeyRegistrations.js";
|
|
2
|
+
import { trackPublishedAppHotkeys } from "./utils.js";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/useAppHotkeys.ts
|
|
5
5
|
function requireStore(store) {
|
|
6
6
|
const current = store();
|
|
7
|
-
if (!current) throw new Error("App hotkeys require provideAppHotkeys()");
|
|
7
|
+
if (!current) throw new Error("[hotkeys] App hotkeys require provideAppHotkeys()");
|
|
8
8
|
return current;
|
|
9
9
|
}
|
|
10
10
|
/** Reads the effective app hotkeys from `provideAppHotkeys`, typed by `Register`. */
|
|
@@ -44,5 +44,4 @@ function useCustomHotkeys(owner) {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
//#endregion
|
|
48
47
|
export { useAppHotkeyList, useAppHotkeys, useCustomHotkeys };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EmberHotkeysScope } from "./createHotkeysScope.js";
|
|
2
2
|
import { formatForDisplay } from "@tanstack/hotkeys";
|
|
3
|
-
//#region src/useFormatForDisplay.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Returns `formatForDisplay` with the scope's `platform` as the default, so
|
|
6
5
|
* labels match the user's platform. The returned function works anywhere,
|
|
@@ -21,5 +20,4 @@ import { formatForDisplay } from "@tanstack/hotkeys";
|
|
|
21
20
|
* }
|
|
22
21
|
* ```
|
|
23
22
|
*/
|
|
24
|
-
export declare function useFormatForDisplay(scope?: EmberHotkeysScope): typeof formatForDisplay;
|
|
25
|
-
//#endregion
|
|
23
|
+
export declare function useFormatForDisplay(scope?: EmberHotkeysScope): typeof formatForDisplay;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { scopeDefaults } from "./utils.js";
|
|
2
2
|
import { formatForDisplay } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/useFormatForDisplay.ts
|
|
5
5
|
/**
|
|
6
6
|
* Returns `formatForDisplay` with the scope's `platform` as the default, so
|
|
7
7
|
* labels match the user's platform. The returned function works anywhere,
|
|
@@ -29,5 +29,4 @@ function useFormatForDisplay(scope) {
|
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
//#endregion
|
|
33
32
|
export { useFormatForDisplay };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { EmberHotkeyState } from "./types.js";
|
|
2
|
-
//#region src/useHeldKeyCodes.d.ts
|
|
3
2
|
/** Reads physical key codes through Ember autotracking. */
|
|
4
|
-
export declare function useHeldKeyCodes(owner: object): EmberHotkeyState<Record<string, string>>;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare function useHeldKeyCodes(owner: object): EmberHotkeyState<Record<string, string>>;
|
package/dist/useHeldKeyCodes.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { select } from "./utils.js";
|
|
2
2
|
import { getKeyStateTracker } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/useHeldKeyCodes.ts
|
|
5
5
|
/** Reads physical key codes through Ember autotracking. */
|
|
6
6
|
function useHeldKeyCodes(owner) {
|
|
7
7
|
return select(owner, getKeyStateTracker().store, (state) => state.heldCodes);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
//#endregion
|
|
11
10
|
export { useHeldKeyCodes };
|
package/dist/useHeldKeys.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { EmberHotkeyState } from "./types.js";
|
|
2
|
-
//#region src/useHeldKeys.d.ts
|
|
3
2
|
/** Pass the containing component as owner to release the subscription on destruction. */
|
|
4
|
-
export declare function useHeldKeys(owner: object): EmberHotkeyState<Array<string>>;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare function useHeldKeys(owner: object): EmberHotkeyState<Array<string>>;
|
package/dist/useHeldKeys.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { select } from "./utils.js";
|
|
2
2
|
import { getKeyStateTracker } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/useHeldKeys.ts
|
|
5
5
|
/** Pass the containing component as owner to release the subscription on destruction. */
|
|
6
6
|
function useHeldKeys(owner) {
|
|
7
7
|
return select(owner, getKeyStateTracker().store, (state) => state.heldKeys);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
//#endregion
|
|
11
10
|
export { useHeldKeys };
|
package/dist/useHotkey.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EmberHotkeyCommonOptions } from "./types.js";
|
|
2
2
|
import { AppHotkey, HotkeyCallback, RegisterableHotkey } from "@tanstack/hotkeys";
|
|
3
3
|
import Helper from "@ember/component/helper";
|
|
4
|
-
//#region src/useHotkey.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Registers a hotkey for the helper's template lifecycle: a chord such as
|
|
7
6
|
* `"Mod+S"`, a sequence such as `(array "G" "G")`, or an app hotkey.
|
|
@@ -18,5 +17,4 @@ export declare class UseHotkey extends Helper<{
|
|
|
18
17
|
}> {
|
|
19
18
|
private bindings;
|
|
20
19
|
compute([hotkey, callback]: [RegisterableHotkey | AppHotkey | null | undefined, HotkeyCallback], options: EmberHotkeyCommonOptions): void;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
20
|
+
}
|
package/dist/useHotkey.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createOwnedBindings } from "./bindings.js";
|
|
2
2
|
import Helper from "@ember/component/helper";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/useHotkey.ts
|
|
5
5
|
/**
|
|
6
6
|
* Registers a hotkey for the helper's template lifecycle: a chord such as
|
|
7
7
|
* `"Mod+S"`, a sequence such as `(array "G" "G")`, or an app hotkey.
|
|
@@ -20,5 +20,4 @@ var UseHotkey = class extends Helper {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
//#endregion
|
|
24
23
|
export { UseHotkey };
|
package/dist/useHotkeyHint.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EmberHotkeyState } from "./types.js";
|
|
2
2
|
import { MaybeGetter } from "./utils.js";
|
|
3
3
|
import { AppHotkey, HeldModifierOptions, RegisterableHotkey } from "@tanstack/hotkeys";
|
|
4
|
-
//#region src/useHotkeyHint.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Recomputes for held modifiers and tracked changes to the hotkey or options.
|
|
7
6
|
* The hint shows only while the hotkey can fire: some registration of it is
|
|
@@ -10,5 +9,4 @@ import { AppHotkey, HeldModifierOptions, RegisterableHotkey } from "@tanstack/ho
|
|
|
10
9
|
* effective hotkey (false while unbound). No hotkey (`undefined`, `null`, or
|
|
11
10
|
* `''`) returns false. A hotkey on an element counts only while focus is inside it.
|
|
12
11
|
*/
|
|
13
|
-
export declare function useHotkeyHint(owner: object, hotkey: MaybeGetter<RegisterableHotkey | AppHotkey | null | undefined>, options?: MaybeGetter<HeldModifierOptions>): EmberHotkeyState<boolean>;
|
|
14
|
-
//#endregion
|
|
12
|
+
export declare function useHotkeyHint(owner: object, hotkey: MaybeGetter<RegisterableHotkey | AppHotkey | null | undefined>, options?: MaybeGetter<HeldModifierOptions>): EmberHotkeyState<boolean>;
|
package/dist/useHotkeyHint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { read, select, trackPublishedAppHotkeys } from "./utils.js";
|
|
2
2
|
import { getHotkeyManager, getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/useHotkeyHint.ts
|
|
5
5
|
/**
|
|
6
6
|
* Recomputes for held modifiers and tracked changes to the hotkey or options.
|
|
7
7
|
* The hint shows only while the hotkey can fire: some registration of it is
|
|
@@ -22,5 +22,4 @@ function useHotkeyHint(owner, hotkey, options = {}) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
//#endregion
|
|
26
25
|
export { useHotkeyHint };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { EmberHotkeyRecorder } from "./types.js";
|
|
2
1
|
import { EmberHotkeysScope } from "./createHotkeysScope.js";
|
|
2
|
+
import { EmberHotkeyRecorder } from "./types.js";
|
|
3
3
|
import { HotkeyChord, HotkeyChordRecorderOptions, HotkeyRecorderOptions, HotkeySequenceRecorderOptions } from "@tanstack/hotkeys";
|
|
4
|
-
//#region src/useHotkeyRecorder.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Creates an owned recorder with autotracked state and current callback
|
|
7
6
|
* options. With the default `maxSteps: 1`, the first valid chord is recorded.
|
|
@@ -15,5 +14,4 @@ export declare function useHotkeyRecorder(owner: object, options: HotkeyChordRec
|
|
|
15
14
|
export declare function useHotkeyRecorder(owner: object, options: HotkeySequenceRecorderOptions, scope?: EmberHotkeysScope): EmberHotkeyRecorder;
|
|
16
15
|
export declare function useHotkeyRecorder(owner: object, options: () => HotkeySequenceRecorderOptions, scope?: EmberHotkeysScope): EmberHotkeyRecorder;
|
|
17
16
|
export declare function useHotkeyRecorder(owner: object, options: () => HotkeyChordRecorderOptions, scope?: EmberHotkeysScope): EmberHotkeyRecorder<HotkeyChord>;
|
|
18
|
-
export declare function useHotkeyRecorder(owner: object, options: () => HotkeyRecorderOptions, scope?: EmberHotkeysScope): EmberHotkeyRecorder;
|
|
19
|
-
//#endregion
|
|
17
|
+
export declare function useHotkeyRecorder(owner: object, options: () => HotkeyRecorderOptions, scope?: EmberHotkeysScope): EmberHotkeyRecorder;
|
|
@@ -3,7 +3,7 @@ import { HotkeyRecorder } from "@tanstack/hotkeys";
|
|
|
3
3
|
import { isDestroyed, isDestroying, registerDestructor } from "@ember/destroyable";
|
|
4
4
|
import { withDefaults } from "@tanstack/hotkeys/adapter";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/useHotkeyRecorder.ts
|
|
7
7
|
function useHotkeyRecorder(owner, options, scope) {
|
|
8
8
|
const recorder = new HotkeyRecorder(() => withDefaults(scope && scopeDefaults.get(scope)().hotkeyRecorder, read(options)));
|
|
9
9
|
const state = select(owner, recorder.store, (value) => value);
|
|
@@ -28,5 +28,4 @@ function useHotkeyRecorder(owner, options, scope) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
//#endregion
|
|
32
31
|
export { useHotkeyRecorder };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { HotkeyRegistrationsResult } from "./types.js";
|
|
2
|
-
//#region src/useHotkeyRegistrations.d.ts
|
|
3
2
|
/** Reads public snapshots of every registration, chords and sequences. */
|
|
4
|
-
export declare function useHotkeyRegistrations(owner: object): HotkeyRegistrationsResult;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare function useHotkeyRegistrations(owner: object): HotkeyRegistrationsResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { select } from "./utils.js";
|
|
2
2
|
import { getHotkeyManager, toHotkeyRegistrationView } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/useHotkeyRegistrations.ts
|
|
5
5
|
/** Reads public snapshots of every registration, chords and sequences. */
|
|
6
6
|
function useHotkeyRegistrations(owner) {
|
|
7
7
|
const hotkeys = select(owner, getHotkeyManager().registrations, (state) => Array.from(state.values()).map(toHotkeyRegistrationView));
|
|
@@ -10,5 +10,4 @@ function useHotkeyRegistrations(owner) {
|
|
|
10
10
|
} };
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
//#endregion
|
|
14
13
|
export { useHotkeyRegistrations };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { EmberHotkeyState } from "./types.js";
|
|
2
2
|
import { HotkeyScopesState } from "@tanstack/hotkeys";
|
|
3
|
-
//#region src/useHotkeyScopesState.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Reads the hotkey manager's scope state: the active scopes, the exclusive
|
|
6
5
|
* scope that owns the keyboard, and the scopes it allows or suspends. Pass the
|
|
7
6
|
* containing component as owner to release the subscription on destruction.
|
|
8
7
|
*/
|
|
9
|
-
export declare function useHotkeyScopesState(owner: object): EmberHotkeyState<HotkeyScopesState>;
|
|
10
|
-
//#endregion
|
|
8
|
+
export declare function useHotkeyScopesState(owner: object): EmberHotkeyState<HotkeyScopesState>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { select } from "./utils.js";
|
|
2
2
|
import { getHotkeyManager } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/useHotkeyScopesState.ts
|
|
5
5
|
/**
|
|
6
6
|
* Reads the hotkey manager's scope state: the active scopes, the exclusive
|
|
7
7
|
* scope that owns the keyboard, and the scopes it allows or suspends. Pass the
|
|
@@ -11,5 +11,4 @@ function useHotkeyScopesState(owner) {
|
|
|
11
11
|
return select(owner, getHotkeyManager().scopes, (state) => state);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
//#endregion
|
|
15
14
|
export { useHotkeyScopesState };
|
package/dist/useHotkeys.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EmberHotkeyCommonOptions, EmberHotkeyDefinition } from "./types.js";
|
|
2
2
|
import Helper from "@ember/component/helper";
|
|
3
|
-
//#region src/useHotkeys.d.ts
|
|
4
3
|
/** Registers a reactive list of hotkeys with the helper's template lifecycle. */
|
|
5
4
|
export declare class UseHotkeys extends Helper<{
|
|
6
5
|
Args: {
|
|
@@ -11,5 +10,4 @@ export declare class UseHotkeys extends Helper<{
|
|
|
11
10
|
}> {
|
|
12
11
|
private bindings;
|
|
13
12
|
compute([definitions]: [ReadonlyArray<EmberHotkeyDefinition>], options: EmberHotkeyCommonOptions): void;
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
13
|
+
}
|
package/dist/useHotkeys.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createOwnedBindings } from "./bindings.js";
|
|
2
2
|
import Helper from "@ember/component/helper";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/useHotkeys.ts
|
|
5
5
|
/** Registers a reactive list of hotkeys with the helper's template lifecycle. */
|
|
6
6
|
var UseHotkeys = class extends Helper {
|
|
7
7
|
bindings = createOwnedBindings(this);
|
|
@@ -10,5 +10,4 @@ var UseHotkeys = class extends Helper {
|
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
//#endregion
|
|
14
13
|
export { UseHotkeys };
|
package/dist/useKeyHold.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { EmberHotkeyState } from "./types.js";
|
|
2
2
|
import { MaybeGetter } from "./utils.js";
|
|
3
3
|
import { IndividualKey } from "@tanstack/hotkeys";
|
|
4
|
-
//#region src/useKeyHold.d.ts
|
|
5
4
|
/** Getter arguments can read changing tracked component properties. */
|
|
6
|
-
export declare function useKeyHold(owner: object, key: MaybeGetter<IndividualKey>): EmberHotkeyState<boolean>;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare function useKeyHold(owner: object, key: MaybeGetter<IndividualKey>): EmberHotkeyState<boolean>;
|
package/dist/useKeyHold.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { read, select } from "./utils.js";
|
|
2
2
|
import { getKeyStateTracker } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/useKeyHold.ts
|
|
5
5
|
/** Getter arguments can read changing tracked component properties. */
|
|
6
6
|
function useKeyHold(owner, key) {
|
|
7
7
|
return select(owner, getKeyStateTracker().store, (state) => state.heldKeys.includes(read(key)));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
//#endregion
|
|
11
10
|
export { useKeyHold };
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ import { registerDestructor } from "@ember/destroyable";
|
|
|
3
3
|
import { subscribePublishedAppHotkeys } from "@tanstack/hotkeys/adapter";
|
|
4
4
|
import { trackedObject } from "@ember/reactive/collections";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/utils.ts
|
|
7
7
|
/** Reads the merged defaults behind each `createHotkeysScope` result. */
|
|
8
8
|
const scopeDefaults = /* @__PURE__ */ new WeakMap();
|
|
9
9
|
function read(value) {
|
|
@@ -40,5 +40,4 @@ function trackPublishedAppHotkeys(owner) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
//#endregion
|
|
44
43
|
export { read, scopeDefaults, select, trackPublishedAppHotkeys };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/ember-hotkeys",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Ember adapter for TanStack Hotkeys",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,33 +39,33 @@
|
|
|
39
39
|
"skills"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@embroider/addon-shim": "^1.
|
|
43
|
-
"@tanstack/hotkeys": "0.
|
|
42
|
+
"@embroider/addon-shim": "^1.11.0",
|
|
43
|
+
"@tanstack/hotkeys": "0.25.0",
|
|
44
44
|
"ember-modifier": "^4.2.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@babel/core": "7.29.7",
|
|
48
48
|
"@babel/plugin-transform-typescript": "7.29.9",
|
|
49
49
|
"@ember/app-tsconfig": "2.1.0",
|
|
50
|
-
"@ember/test-helpers": "^5.
|
|
51
|
-
"@embroider/core": "4.6.
|
|
52
|
-
"@embroider/macros": "1.21.
|
|
53
|
-
"@embroider/vite": "^1.
|
|
54
|
-
"@glimmer/component": "2.
|
|
55
|
-
"@glint/ember-tsc": "1.
|
|
56
|
-
"@glint/template": "1.
|
|
57
|
-
"@glint/tsserver-plugin": "2.7.
|
|
50
|
+
"@ember/test-helpers": "^5.8.0",
|
|
51
|
+
"@embroider/core": "4.6.10",
|
|
52
|
+
"@embroider/macros": "1.21.4",
|
|
53
|
+
"@embroider/vite": "^1.8.0",
|
|
54
|
+
"@glimmer/component": "2.2.1",
|
|
55
|
+
"@glint/ember-tsc": "1.14.3",
|
|
56
|
+
"@glint/template": "1.11.1",
|
|
57
|
+
"@glint/tsserver-plugin": "2.7.16",
|
|
58
58
|
"@rollup/plugin-babel": "7.1.0",
|
|
59
59
|
"@types/qunit": "^2.19.14",
|
|
60
|
-
"babel-plugin-ember-template-compilation": "4.0.
|
|
60
|
+
"babel-plugin-ember-template-compilation": "4.0.1",
|
|
61
61
|
"decorator-transforms": "2.4.0",
|
|
62
62
|
"ember-qunit": "^9.2.0",
|
|
63
|
-
"ember-source": "7.
|
|
63
|
+
"ember-source": "7.4.0",
|
|
64
64
|
"ember-strict-application-resolver": "0.1.1",
|
|
65
65
|
"qunit": "^3.0.0",
|
|
66
66
|
"qunit-dom": "^3.6.0",
|
|
67
|
-
"testem": "^3.21.
|
|
68
|
-
"vite": "^8.3.
|
|
67
|
+
"testem": "^3.21.5",
|
|
68
|
+
"vite": "^8.3.6"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"ember-source": ">=6.8.3 <6.9.0 || >=6.10.1"
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|
|
89
89
|
"clean": "premove ./build ./dist ./dist-tests",
|
|
90
|
-
"lint": "
|
|
91
|
-
"lint:fix": "
|
|
92
|
-
"test:
|
|
90
|
+
"lint": "oxlint ./src",
|
|
91
|
+
"lint:fix": "oxlint ./src --fix",
|
|
92
|
+
"test:oxlint": "oxlint ./src",
|
|
93
93
|
"test:lib": "vite build --mode=development --out-dir dist-tests && testem --file testem.cjs ci --port 0",
|
|
94
94
|
"test:lib:dev": "pnpm test:lib --watch",
|
|
95
95
|
"test:types": "ember-tsc --noEmit",
|