pota/use/keyboardpota/use/keyboard exports ref factories for keyboard chords:
shortcut scopes to the element,
globalShortcut listens on the
document, and submitOnCtrlEnter
is a convenience for textareas — plus
useKeyHeld /
keysHeld for tracking held keys.
Chords are a +-separated list of modifiers — ctrl, meta, alt,
shift, plus the alias mod (ctrl on non-Mac, meta on Mac) —
followed by a single key. Matching is strict: ctrl+s does not fire
on ctrl+shift+s. The handler is called with the KeyboardEvent;
preventDefault is applied automatically when the chord matches.
shortcut(combo, fn) — element-scoped
use:ref chordglobalShortcut(combo, fn) —
document-scoped chordsubmitOnCtrlEnter(fn) —
Ctrl/Cmd+Enter convenience for textareasuseKeyHeld(key) — reactive boolean: is
a key held?keysHeld() — live, non-reactive
Set<string> of held keys