/** * Custom Keybinding Types * * Type definitions for customizable keybindings. * * @since v1.58.3 */ import type { Tier } from '../../core/types/auth.js'; /** * Context in which a keybinding is active */ export type KeybindingContext = 'global' | 'idle' | 'list' | 'input' | 'command' | 'dialog' | 'vim-normal' | 'vim-insert' | 'vim-visual' | 'vim-command'; /** * A single keybinding */ export interface Keybinding { /** Action identifier (e.g., 'navigate.up', 'action.sync') */ action: string; /** Key or key sequence (e.g., 'j', 'Ctrl+s', ['g', 'g']) */ keys: string | string[]; /** Context where this binding is active */ context: KeybindingContext; /** User-friendly description */ description?: string; /** Minimum tier required */ tier?: Tier; /** Whether this binding is enabled */ enabled?: boolean; } /** * Keybinding preset name */ export type PresetName = 'default' | 'vim' | 'emacs' | 'minimal' | 'custom'; /** * Keybinding configuration */ export interface KeybindingConfig { /** Active preset */ preset: PresetName; /** Leader key (for chord sequences) */ leader: string; /** Chord timeout in milliseconds */ timeout: number; /** Custom bindings that override preset */ bindings: KeybindingMap; /** Disabled actions (even if in preset) */ disabled: string[]; /** User's tier for feature gating */ userTier: Tier; } /** * Map of context -> action -> keys */ export type KeybindingMap = Partial<{ [K in KeybindingContext]: Record; }>; /** * Resolved keybinding after merging preset with custom */ export interface ResolvedKeybinding { action: string; keys: string[]; context: KeybindingContext; description: string; tier: Tier; isCustom: boolean; isDefault: boolean; } /** * Keybinding conflict */ export interface KeybindingConflict { /** The key sequence that conflicts */ keys: string[]; /** Actions that share this key */ actions: string[]; /** Context where conflict occurs */ context: KeybindingContext; /** Severity of conflict */ severity: 'warning' | 'error'; /** Suggestion to resolve */ suggestion?: string; } /** * Keybinding preset definition */ export interface KeybindingPreset { name: PresetName; displayName: string; description: string; bindings: KeybindingMap; /** Parent preset to inherit from */ inherits?: PresetName; } /** * Export format for keybindings */ export interface KeybindingExportFormat { version: 1; exportedAt: number; preset: PresetName; leader: string; timeout: number; bindings: KeybindingMap; disabled: string[]; } /** * Action definition for documentation */ export interface ActionDefinition { id: string; name: string; description: string; category: ActionCategory; defaultKeys: string | string[]; contexts: KeybindingContext[]; tier: Tier; } /** * Action category */ export type ActionCategory = 'navigation' | 'selection' | 'action' | 'view' | 'workflow' | 'macro' | 'search' | 'system'; /** * Default keybinding configuration */ export declare const DEFAULT_KEYBINDING_CONFIG: KeybindingConfig; /** * Normalize key representation */ export declare function normalizeKey(key: string): string; /** * Parse key sequence string into array */ export declare function parseKeySequence(keys: string | string[]): string[]; /** * Serialize key sequence to string */ export declare function serializeKeySequence(keys: string[]): string; /** * Check if a key matches a pattern (with modifiers) */ export declare function keysMatch(pattern: string[], actual: string[]): boolean; /** * Get display string for a key */ export declare function getKeyDisplay(key: string): string; /** * Get display string for key sequence */ export declare function getSequenceDisplay(keys: string[]): string; //# sourceMappingURL=keybinding-types.d.ts.map