authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-15 11:21:38-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-02-15 15:51:05-08:00
log53c367420cac82f7c5baba55bad29432f77a9633
tree2008b9618045d69aa092e91df80b4ba4edd855ee
parentace58035818652ebf400fe71e102de050950e3af

Align web keybinding types with shared contract aliases

- Reuse `KeybindingRule` and `KeybindingsConfig` directly for resolved keybinding types - Update normalization helper to accept `KeybindingRule` for consistent typing

1 files changed, 4 insertions(+), 9 deletions(-)

apps/web/src/keybindings.ts+4-9
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1import type { KeybindingCommand, KeybindingsConfig } from "@t3tools/contracts";1import type { KeybindingCommand, KeybindingRule, KeybindingsConfig } from "@t3tools/contracts";
22
3export interface ShortcutEventLike {3export interface ShortcutEventLike {
4 key: string;4 key: string;
...@@ -14,13 +14,8 @@ export interface ShortcutMatchContext {...@@ -14,13 +14,8 @@ export interface ShortcutMatchContext {
14 [key: string]: boolean;14 [key: string]: boolean;
15}15}
1616
17export interface ResolvedTerminalKeybinding {17export type ResolvedTerminalKeybinding = KeybindingRule;
18 key: string;18export type ResolvedTerminalKeybindings = KeybindingsConfig;
19 command: KeybindingCommand;
20 when?: string | undefined;
21}
22
23export type ResolvedTerminalKeybindings = ResolvedTerminalKeybinding[];
2419
25export const DEFAULT_TERMINAL_KEYBINDINGS: ResolvedTerminalKeybindings = [20export const DEFAULT_TERMINAL_KEYBINDINGS: ResolvedTerminalKeybindings = [
26 { key: "mod+j", command: "terminal.toggle" },21 { key: "mod+j", command: "terminal.toggle" },
...@@ -312,7 +307,7 @@ function resolveContext(options: ShortcutMatchOptions | undefined): ShortcutMatc...@@ -312,7 +307,7 @@ function resolveContext(options: ShortcutMatchOptions | undefined): ShortcutMatc
312}307}
313308
314function normalizeConfiguredKeybinding(309function normalizeConfiguredKeybinding(
315 keybinding: KeybindingsConfig[number],310 keybinding: KeybindingRule,
316): ResolvedTerminalKeybinding | null {311): ResolvedTerminalKeybinding | null {
317 const key = keybinding.key.trim();312 const key = keybinding.key.trim();
318 if (key.length === 0) return null;313 if (key.length === 0) return null;