OptionalhostOptional pluggable backend for chord subscription. When provided, the
service delegates keys.registerAction → bridge.subscribe(chord, cb)
and stores the returned unsubscribe handle keyed on actionId. The
default document-listener path is NOT attached when hostBridge is
provided — the bridge is authoritative. See HostKeysBridge.
OptionallistenerEventTarget to attach the default keydown listener to. Defaults to the
global document when running in a DOM environment, else an isolated
new EventTarget() (SSR / Node-test safe). Passing a fresh
new EventTarget() is useful for unit tests. Mirrors the pattern used
by @kehto/shell's createKeysForwarder.
Ignored when hostBridge is provided — the bridge owns subscription
lifecycle and no document listener is attached.
OptionalonCalled on keys.forward (napplet-forwarded chord) AND on document keydown
matching a registered action. Receives the DOM-style field names
(ctrlKey/altKey/shiftKey/metaKey) to match the shell's HotkeyHooks
contract. The service translates from the wire shape
({ ctrl, alt, shift, meta }) before invoking this callback.
OptionalreservedOptional set of shell-reserved chords. Strings in the @napplet/nap/keys
wire format (e.g. 'Ctrl+Shift+K', 'Cmd+P'). When a napplet sends
keys.forward with a chord matching this set — or when a document
keydown matches a reserved chord — the service invokes onForward
(or the hostBridge-registered handler) but suppresses the
keys.action push to any napplet that registered the same chord via
keys.registerAction. Precedence: reserved > registered. The shell
WANTS the forward — that is why it reserved the chord.
Normalized once at service construction via the same chord parser used
for action.defaultKey — 'Ctrl+K' / 'Control+k' / 'ctrl+K' all
match. Static; no runtime mutation. For dynamic reservation see the
deferred HostKeysBridge.reserveAbsolute(chords) extension.
Options for creating a keys service via createKeysService().
Example