Defined in: controllers/app-hotkeys.ts:48
A Lit ReactiveController for app hotkeys provided with provideAppHotkeys: the effective app hotkeys, a cheat sheet list with live status, and the user's custom hotkeys. Requests an update when any of them change.
class CheatSheet extends LitElement {
private app = new AppHotkeysController(this)
render() {
return html`<ul>
${this.app.list.map(
({ appHotkey, status }) => html`<li>${appHotkey.meta?.name}: ${status}</li>`,
)}
</ul>`
}
}new AppHotkeysController(_host): AppHotkeysController;Defined in: controllers/app-hotkeys.ts:53
ReactiveControllerHost
AppHotkeysController
get appHotkeys(): RegisteredAppHotkeys;Defined in: controllers/app-hotkeys.ts:58
Effective app hotkeys, typed by Register.
RegisteredAppHotkeys
get customHotkeys(): CustomHotkeys;Defined in: controllers/app-hotkeys.ts:68
The user's hotkeys that differ from the defaults.
CustomHotkeys
get list(): RegisteredAppHotkeyListItem[];Defined in: controllers/app-hotkeys.ts:63
Every app hotkey with its live status, in declaration order.
RegisteredAppHotkeyListItem[]
dispose(): void;Defined in: controllers/app-hotkeys.ts:130
Releases the controller now and removes it from its host. Use it to remove a controller early: Lit's removeController alone leaves it active.
void
findConflicts(
id,
hotkey,
recordedWith?
): AppHotkey<string, HotkeyChord | HotkeySequence | null>[];Defined in: controllers/app-hotkeys.ts:100
Other app hotkeys that would collide if id used hotkey. Pass the recorder's context for a recorded hotkey: it has the key press, which also finds a hotkey written differently that the same press fires.
string
Hotkey
RecordedKeyPresses
AppHotkey<string, HotkeyChord | HotkeySequence | null>[]
CustomHotkeyActions.findConflictshostConnected(): void;Defined in: controllers/app-hotkeys.ts:108
Called when the host is connected to the component tree. For custom element hosts, this corresponds to the connectedCallback() lifecycle, which is only called when the component is connected to the document.
void
ReactiveController.hostConnectedhostDisconnected(): void;Defined in: controllers/app-hotkeys.ts:121
Called when the host is disconnected from the component tree. For custom element hosts, this corresponds to the disconnectedCallback() lifecycle, which is called the host or an ancestor component is disconnected from the document.
void
ReactiveController.hostDisconnectedresetCustomHotkey(id): void;Defined in: controllers/app-hotkeys.ts:86
Restores the default hotkey for an app hotkey.
string
void
CustomHotkeyActions.resetCustomHotkeyresetCustomHotkeys(): void;Defined in: controllers/app-hotkeys.ts:91
Restores every default hotkey.
void
CustomHotkeyActions.resetCustomHotkeyssetCustomHotkey(
id,
hotkey,
recordedWith?
): AppHotkey<string, HotkeyChord | HotkeySequence | null>[];Defined in: controllers/app-hotkeys.ts:77
Sets the user's hotkey for an app hotkey. null unbinds it. Returns conflicting app hotkeys; when any exist, nothing changes. Pass the recorder's context for a recorded hotkey, as for findConflicts.
string
Hotkey | null
RecordedKeyPresses
AppHotkey<string, HotkeyChord | HotkeySequence | null>[]
CustomHotkeyActions.setCustomHotkey