Constructors

Accessors

  • get capturing(): boolean
  • Whether a control is recording a chord right now.

    Returns boolean

Methods

  • Make overrides the user's chords: every command it leaves out goes back to its default, and each one it names moves (null unbinds). Written for a saved record, so it reads anything: an entry that does not parse, is reserved, or names a fixed binding is dropped, and one for a command nothing registered yet is kept for when it does. Collisions a saved chord makes are reported through onConflict, as a registration's are.

    Parameters

    • overrides: unknown

    Returns void

  • Listen on target in the capture phase, so a claimed chord never reaches the engine's own listener on the document. Returns the detacher; a second call replaces the first.

    Parameters

    • target: {
          addEventListener(t: string, fn: EventListener, opts?: boolean): void;
          removeEventListener(t: string, fn: EventListener, opts?: boolean): void;
      }

    Returns () => void

  • Hand the next key presses to fn ahead of every binding, for a control that records a chord. Each press is prevented and stopped outright, so no binding, no open dialog's Escape and no chart shortcut sees it, and another keymap attached to the same node claims nothing meanwhile; fn returns false to let one through (Tab moving the focus). Returns the release. A second capture replaces the first.

    Parameters

    Returns () => void

  • The chord a command answers to now, in key form: '' while it is unbound, null for a command nothing registered. An engine command (chart:<command>) reports its first chord.

    Parameters

    • command: string

    Returns null | string

  • The bindings that would compete with combo (key form) for a binding in scope: widget bindings on it in that scope or one live at the same time (global, widget and chart nest), and the engine's commands on it unless the scope is rail or overlay. An unreadable chord has none.

    Parameters

    Returns KeyChordUse[]

  • The bindings as the shortcuts panel shows them: the widget's own groups, then the engine's chart commands, with any chord the widget claims first marked as shadowed. An engine command the user unbound stays listed, so it can be reset.

    Returns KeymapGroup[]

  • The user's chords, JSON-safe: what a host saves and hands back to applyOverrides.

    Returns Record<string, null | string | string[]>

  • Move a command to another chord, or unbind it with null. A widget command takes one chord in the key grammar; an engine command (chart:<command>) one or several in the engine's code grammar, as eventToCombo gives them. A chord the browser keeps is refused, and so is one another binding holds, unless replace is set and every holder is rebindable: each then gives the chord up and is left without it.

    Parameters

    • command: string
    • combo: null | string | readonly string[]
    • opts: { replace?: boolean } = {}

    Returns KeyRebindResult

  • Bind a chord. Returns a disposer. Throws on a chord the grammar cannot read, or a command another live binding has, because a binding that can never fire or never be told apart is a defect at the call site, not at key time. A saved override for the command applies at once.

    Parameters

    Returns () => void

  • Put a command back on its default chord. The default may have been taken meanwhile by a binding of the same kind (widget or chart); that is refused as taken unless replace is set, as with rebind. A command nothing registered yet just forgets its saved chord.

    Parameters

    • command: string
    • opts: { replace?: boolean } = {}

    Returns KeyRebindResult

  • Every command back on its default chord, including those not registered yet.

    Returns void