@opentui/keymap/extras
Every export of @opentui/keymap/extras in the 0.6.0 release, from its type declarations. A version names the release that added an export after the module's first release.
Functions#
function commandBindings<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent>(bindings: Readonly<CommandBindingMap>, options?: CommandBindingsOptions): Binding<TTarget, TEvent>[]function createBindingLookup<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent>(config: BindingConfig<TTarget, TEvent>, options?: CreateBindingLookupOptions<TTarget, TEvent>): BindingLookup<TTarget, TEvent>function formatCommandBindings(bindings: readonly SequenceBindingLike[] | undefined, options?: FormatCommandBindingsOptions): string | undefinedfunction formatKeySequence(parts: readonly KeySequenceFormatPart[] | undefined, options?: FormatKeySequenceOptions): string
Interfaces#
interface BindingDefaultsContext<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent>property BindingDefaultsContext.binding: Readonly<Binding<TTarget, TEvent>>property BindingDefaultsContext.command: string
interface BindingLookup<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent>method BindingLookup.gather(name: string, commands: readonly string[]): readonly Binding<TTarget, TEvent>[]method BindingLookup.get(command: string): readonly Binding<TTarget, TEvent>[]method BindingLookup.has(command: string): booleanmethod BindingLookup.invalidate(name?: string): voidmethod BindingLookup.omit(name: string, commands: readonly string[]): Binding<TTarget, TEvent>[]method BindingLookup.pick(name: string, commands: readonly string[]): Binding<TTarget, TEvent>[]method BindingLookup.update(config?: BindingConfig<TTarget, TEvent>): voidreadonly property BindingLookup.bindings: readonly Binding<TTarget, TEvent>[]
interface CommandBindingsErrorproperty CommandBindingsError.code: "invalid-command-binding"property CommandBindingsError.command: stringproperty CommandBindingsError.reason: Errorproperty CommandBindingsError.value: unknown
interface CommandBindingsOptionsproperty CommandBindingsOptions.onError?: (error: CommandBindingsError) => voidproperty CommandBindingsOptions.onWarning?: (warning: CommandBindingsOverrideWarning) => void
interface CommandBindingsOverrideWarningproperty CommandBindingsOverrideWarning.code: "command-binding-override"property CommandBindingsOverrideWarning.command: stringproperty CommandBindingsOverrideWarning.nextKey: KeyLikeproperty CommandBindingsOverrideWarning.previousKey: KeyLike
interface CreateBindingLookupOptions<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent>property CreateBindingLookupOptions.bindingDefaults?: BindingDefaults<TTarget, TEvent>property CreateBindingLookupOptions.commandMap?: BindingCommandMap
interface FormatCommandBindingsOptions extends FormatKeySequenceOptionsproperty FormatCommandBindingsOptions.bindingSeparator?: stringproperty FormatCommandBindingsOptions.dedupe?: boolean
interface FormatKeySequenceOptionsproperty FormatKeySequenceOptions.keyNameAliases?: Readonly<Record<string, string>>property FormatKeySequenceOptions.modifierAliases?: Partial<Record<KeyModifierName, string>>property FormatKeySequenceOptions.patternDisplay?: PatternDisplayResolverproperty FormatKeySequenceOptions.separator?: stringproperty FormatKeySequenceOptions.tokenDisplay?: TokenDisplayResolver
interface KeySequenceFormatPartproperty KeySequenceFormatPart.display: stringproperty KeySequenceFormatPart.match?: KeySequencePart["match"]property KeySequenceFormatPart.patternName?: stringproperty KeySequenceFormatPart.stroke: KeySequencePart["stroke"]property KeySequenceFormatPart.tokenName?: string
interface SequenceBindingLikeproperty SequenceBindingLike.sequence: readonly KeySequenceFormatPart[]
Types#
type BindingCommandMap = Readonly<Record<string, string>>type BindingConfig<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent> = Readonly<Record<string, BindingValue<TTarget, TEvent>>>type BindingConfigItem<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent> = KeyLike | Binding<TTarget, TEvent>type BindingDefaults<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent> = (ctx: BindingDefaultsContext<TTarget, TEvent>) => Readonly<Record<string, unknown>> | voidtype BindingValue<TTarget extends object = object, TEvent extends KeymapEvent = KeymapEvent> = false | "none" | BindingConfigItem<TTarget, TEvent> | readonly BindingConfigItem<TTarget, TEvent>[]type CommandBindingMap = Record<string, KeyLike>type KeyModifierName = "ctrl" | "shift" | "meta" | "super" | "hyper"type TokenDisplayResolver = Readonly<Record<string, string>> | ((tokenName: string, part: KeySequenceFormatPart) => string | undefined)