Skip to main content

Keybindings

Index

Type Aliases

Category

Category: { id: chat | maproom | navigation | chatroom | unknown; name?: string | Partial<Record<ServerChatRoomLanguage | TW, string>> }

Groups related actions for easier navigation in a UI (e.g., "Editing", "Navigation").


Type declaration

  • readonlyid: chat | maproom | navigation | chatroom | unknown

    Unique identifier

  • optionalreadonlyname?: string | Partial<Record<ServerChatRoomLanguage | TW, string>>

    User-facing label

Context

Context: { id: chat | always | isInChatRoom | isOnChatRoomScreen | isChatRoomCharacterMode | isChatRoomMapMode | isChatRoomChatFocused | isChatRoomChatNOTFocused | noModifiers; name?: string | Partial<Record<ServerChatRoomLanguage | TW, string>>; prerequisite: (event: KeyboardEvent) => boolean; showInUI?: boolean }

Defines a context in which keybindings can be active.


Type declaration

  • readonlyid: chat | always | isInChatRoom | isOnChatRoomScreen | isChatRoomCharacterMode | isChatRoomMapMode | isChatRoomChatFocused | isChatRoomChatNOTFocused | noModifiers

    Unique identifier

  • optionalreadonlyname?: string | Partial<Record<ServerChatRoomLanguage | TW, string>>

    User-facing label

  • readonlyprerequisite: (event: KeyboardEvent) => boolean

    Function returning true if this context should be considered active

      • (event: KeyboardEvent): boolean
      • Parameters

        • event: KeyboardEvent

        Returns boolean

  • optionalreadonlyshowInUI?: boolean

    Optional flag whether to show this context in the UI

ContextId

ContextId: Context[id]

Unique identifier for a keybinding context. Contexts allow the same keybinding to behave differently depending on active UI states or modes.

KeyCode

KeyCode: keyof typeof KeybindingManager.ASCIIKeyboardMap

KeyCombo

KeyCombo: { key: KeyCode | null; modifiers?: Set<ModifierKey> } | { char: string | null; modifiers?: Set<ModifierKey> }

Represents a combination of a physical key and optional modifier keys.

Keybinding

Keybinding: { action: (event: KeyboardEvent) => boolean | void; categoryId: Category[id]; contextIds: ContextId[]; defaultKeyCombo?: KeyCombo; description?: string | Partial<Record<ServerChatRoomLanguage | TW, string>>; id: string; keyCombo?: KeyCombo; name?: string | Partial<Record<ServerChatRoomLanguage | TW, string>>; readonly: boolean }

Represents a specific keybinding configuration for an action.


Type declaration

  • readonlyaction: (event: KeyboardEvent) => boolean | void

    Function executed when triggered. Returns true if handled, false otherwise.

      • (event: KeyboardEvent): boolean | void
      • Parameters

        • event: KeyboardEvent

        Returns boolean | void

  • readonlycategoryId: Category[id]

    Category this action belongs to

  • readonlycontextIds: ContextId[]

    Contexts in which the action is valid

  • optionalreadonlydefaultKeyCombo?: KeyCombo

    System’s original mapping for reset purposes

  • optionalreadonlydescription?: string | Partial<Record<ServerChatRoomLanguage | TW, string>>

    Optional description

  • readonlyid: string

    Unique identifier

  • optionalkeyCombo?: KeyCombo

    Currently assigned key combo

  • optionalreadonlyname?: string | Partial<Record<ServerChatRoomLanguage | TW, string>>

    User-facing label

  • readonlyreadonly: boolean

    Flag whether the binding cannot be changed by the user

KeybindingSerialized

KeybindingSerialized: { actionId: string; keyCombo: string }

A lightweight, serialized form of a keybinding.


Type declaration

  • actionId: string

    Unique identifier

  • keyCombo: string

    String representation of the key combination. (e.g., "KeyK ⌃⇧")

ModifierKey

ModifierKey: Shift | Alt | Ctrl

Allowed modifier keys in this keybinding system. Uses human-readable names to match conceptual rather than platform-specific keys.

UninitializedKeybinding

UninitializedKeybinding: { id: Keybinding[id]; keyCombo: KeyCombo }

Type declaration