SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Class CommandResolver

    The per-container resolution authority — the second non-React core, paired with CommandScope. It binds a registry scope to an ActivationTracker (its anchor source) and answers resolve(key) / execute(key) from the tracker's current anchor. A single subscribe coalesces both anchor changes and scope contribution changes at the CommandResolverOptions.debounce cadence, so a consumer subscribes to one thing.

    scope is fixed for the resolver's life; a React provider recreates + disposes the resolver when the scope changes (see design/COMMAND-DESIGN.md).

    Index
    • Register a ResolveInjector — a hook that may contribute a leaf (most-specific) definition for a key, given the active DOM element, on every resolve. Returns a remover. Re-emits so consumers re-resolve immediately (and again on removal). Both buttons and keystrokes funnel through resolve, so one registration covers both paths. See design/COMMAND-INPUT-CLIPBOARD-PLAN.md.

      Parameters

      Returns RemoveListener

    • The command keys reachable from the current anchor, bounded by this resolver's root — the enumeration the KeyBindingDispatcher matches an event against. Bounding it here (not at scope.collectKeys) keeps a container from binding shortcuts for commands above its terminal.

      Returns string[]

    • (Re)establish this resolver's subscriptions to its scope + tracker. Idempotent. Called by the owning provider's mount effect — so a resolver that was disposed on an effect cleanup (e.g. React StrictMode's mount→unmount→remount, or a transient parent unmount) comes back to life on remount instead of staying permanently deaf. Without this, the useMemo'd instance survives the cleanup but its scope subscription doesn't, so contributions stop reaching _emit and consumers freeze.

      Returns void

    • Dispatch a keyboard event through this resolver's bindings (event → command at the current anchor). The host's keystroke entry when it delivers keys itself (keyBindings: false) — e.g. a grid terminal Layer tap calls this with the (synthetic) event, keeping the grid on one event system. Accepts a native or React keyboard event. Returns whether it was consumed.

      Parameters

      Returns boolean

    • Detach from scope + tracker + keybinds. Called on the provider effect's cleanup (unmount / scope change). Leaves the instance reusable: a following connect re-establishes everything (the StrictMode remount path). _listeners is cleared here, but consumers re-subscribe via their own useSyncExternalStore on remount, so no listener is lost.

      Returns void

    • Resolve + dispatch by key (the imperative / keystroke entry point).

      Type Parameters

      • ARGS = void

      Parameters

      • commandKey: string
      • Optionalargs: ARGS

      Returns Promise<boolean>

    • The tracker's current anchor (or the registry root if none) — used by the dispatcher.

      Returns CommandScope

    • Monotonic version; bumps on each (debounced) re-emit — a stable useSyncExternalStore snapshot.

      Returns number

    • Force a re-resolution emit. For an injector whose result depends on live DOM state that changed without a scope/anchor change — e.g. the caret selection in a focused input (a selectionchange doesn't touch the scope tree, yet a selection-gated copy enablement must re-evaluate). Coalesced by the resolver's debounce like any other emit.

      Returns void

    • Resolve a command from the tracker's current anchor, bounded by this resolver's root terminal. origin (keystroke dispatch only) applies per-contribution origin containment — see CommandScope.resolve; buttons/display omit it.

      Type Parameters

      • STATE = any
      • CONTEXT = any
      • ARGS = void

      Parameters

      • commandKey: string
      • Optionalorigin: Node | null

      Returns ResolvedCommand<STATE, CONTEXT, ARGS> | undefined

    • Subscribe to re-resolution (anchor OR contribution changed), at the debounce cadence.

      Parameters

      • listener: () => void

      Returns RemoveListener