Optionaloptions: CommandResolverOptionsRegister 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.
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.
(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.
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.
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.
Resolve + dispatch by key (the imperative / keystroke entry point).
Optionalargs: ARGSThe tracker's current anchor (or the registry root if none) — used by the dispatcher.
Monotonic version; bumps on each (debounced) re-emit — a stable useSyncExternalStore snapshot.
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.
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.
Optionalorigin: Node | nullSubscribe to re-resolution (anchor OR contribution changed), at the debounce cadence.
The per-container resolution authority — the second non-React core, paired with CommandScope. It binds a registry
scopeto an ActivationTracker (its anchor source) and answersresolve(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.scopeis fixed for the resolver's life; a React provider recreates + disposes the resolver when the scope changes (see design/COMMAND-DESIGN.md).