@searsuite/sear-render-input
Keyboard, pointer, text-input, and composition routing contracts.
Keyboard input
- classHeadlessKeyboardRouter
-
class HeadlessKeyboardRouter extends KeyboardRouterKeyboard router for hosts that do not expose a keyboard event source.
constructor HeadlessKeyboardRouter(): HeadlessKeyboardRouterproperty readonly symbol: symbolstaticDI token for resolving HeadlessKeyboardRouter.
method startListener(): voidStarts listening to the host input source.
method stopListener(): voidStops listening to the host input source.
method subscribe(_handlers: KeyboardRouterHandlers): voidSubscribes to state changes and returns an idempotent disposer.
- classInput
-
class Input extends EventListenerBase class for host input adapters.
Input adapters bridge platform events into the shared EventListener contract and expose explicit listener lifecycle methods for assembly teardown.
constructor Input(): Inputmethod startListener(): voidStarts listening to the host input source.
method stopListener(): voidStops listening to the host input source.
- classInputManager
-
Registry for input adapters owned by one editor instance.
constructor InputManager(textInput: Input): InputManagerConstructs the manager with the configured text input adapter.
textInputText input adapter resolved from the host.
property readonly textInput: InputText input adapter resolved from the host.
property readonly symbol: symbolstaticDI token for resolving the input manager.
method get<T>(symbol: symbol): T | undefinedRetrieves an input adapter by symbol.
ReturnsRegistered adapter, or void 0 when absent.
symbolAdapter symbol.
method getTextInput(): TextInput | undefinedReturns the text-input adapter when it has been registered.
method register(symbol: symbol, input: Input): voidRegisters an input adapter.
symbolAdapter symbol.
inputAdapter instance.
- classKeyboardRouter
-
class KeyboardRouter extends InputAbstract keyboard-shortcut router.
Implementations intercept action keys (arrows, Enter, Escape, Backspace, Ctrl+A/B/C/V/X and Tab) and dispatch them to the registered handlers. Unlike
TextInput, implementations MUST work regardless of which DOM element currently holds focus – this is the key contract that fixes the "Ctrl+A lost after clicking canvas" problem.Lifecycle:
startListener()– attach the listener for the editor instance.stopListener()– detach it when the editor is destroyed.constructor KeyboardRouter(): KeyboardRouterproperty readonly symbol: symbolstaticDI token for resolving KeyboardRouter.
method subscribe(handlers: KeyboardRouterHandlers): void | (): voidInstalls handlers; implementations may return a disposer that restores the previous handlers.
Inherited members 6
Inherited from Input.
- classWebKeyboardRouter
-
class WebKeyboardRouter extends KeyboardRouterBrowser implementation of
KeyboardRouter.Attaches a
keydownlistener to the injectedEventTargetin the capture phase so that keyboard shortcuts are intercepted before any bubbling-phase handler can act on them, and – critically – regardless of which DOM element holds editor focus at the time. Native host form controls retain their own keys. This means shortcuts like Ctrl+A remain functional even after a canvas click has shifted browser focus away from the hidden<input>used for IME composition.The
EventTarget(typicallydocument) is injected via DI usingWebKeyboardRouter.eventTargetSymbol, keeping this class free of hard-coded browser globals and making it straightforward to test with a stub.The listener is active only between
startListener()/stopListener().constructor WebKeyboardRouter(eventTarget: EventTarget): WebKeyboardRouterproperty readonly eventTargetSymbol: symbolstaticDI token for the keyboard event source, normally
document.method startListener(): voidStarts listening to the host input source.
method stopListener(): voidStops listening to the host input source.
method subscribe(handlers: KeyboardRouterHandlers): (): voidInstalls handlers; implementations may return a disposer that restores the previous handlers.
- interfaceKeyboardRouterHandlers
-
Callbacks for all keyboard-shortcut / action-key events that the editor needs to intercept. These are intentionally separate from text composition events (which remain the responsibility of
TextInput).property onArrowDown?: (shiftKey: boolean, metaKey: boolean): voidproperty onArrowLeft?: (shiftKey: boolean, metaKey: boolean): voidproperty onArrowRight?: (shiftKey: boolean, metaKey: boolean): voidproperty onArrowUp?: (shiftKey: boolean, metaKey: boolean): voidproperty onCopy?: (): voidCtrl/Cmd + C - copy the active sheet selection.
property onCut?: (): voidCtrl/Cmd + X - cut the active sheet selection.
property onDelete?: (): voidBackspace / Delete key.
property onEdit?: (): voidEnters editing while retaining the selected cell's content.
property onEnd?: (shiftKey: boolean): voidMoves to the last occupied cell of the sheet.
property onEnter?: (shiftKey: boolean, primaryModifier?: boolean): voidEnter key – commit the current edit.
property onEscape?: (): voidEscape key – cancel the current edit.
property onFillDown?: (): voidCtrl/Cmd + D/R - fill the selection from its top row/left column.
property onFillRight?: (): voidproperty onHome?: (primaryModifier: boolean, shiftKey: boolean): voidMoves to the start of the active row, or sheet with a primary modifier.
property onPage?: (direction: -1 | 1, shiftKey: boolean): voidMoves the active selection by roughly one viewport.
property onPaste?: (): voidCtrl/Cmd + V - paste from the host clipboard.
property onRedo?: (): voidCtrl/Cmd + Shift + Z or Ctrl/Cmd + Y - redo the latest undone mutation.
property onSelectAll?: (): voidCtrl/Cmd + A – select all content in the editor.
property onSelectColumn?: (): voidSelects the entire active column.
property onSelectRow?: (): voidSelects the entire active row.
property onSoftEnter?: (): voidAlt/Option + Enter – insert a line break (soft enter) inside the cell.
property onTab?: (shiftKey: boolean): voidTab / Shift+Tab - move the active sheet selection horizontally.
property onToggleBold?: (): voidCtrl/Cmd + B - toggle bold text in the active rich-text editor.
property onToggleItalic?: (): voidCtrl/Cmd + I - toggle italic text in the active rich-text editor.
property onToggleReference?: (): voidCycles the reference at the formula caret through relative and absolute modes.
property onToggleStrikethrough?: (): voidCtrl/Cmd + Shift + X - toggle strikethrough text in the active rich-text editor.
property onToggleUnderline?: (): voidCtrl/Cmd + U - toggle underlined text in the active rich-text editor.
property onUndo?: (): voidCtrl/Cmd + Z - undo the latest sheet mutation.
property onUnhandledEscape?: (): voidEscape not handled by a focused host control.
property onZoomIn?: (): voidproperty onZoomOut?: (): voidproperty onZoomReset?: (): void
Pointer capture
- classHeadlessPointerCapture
-
class HeadlessPointerCapture extends PointerCaptureNo-op pointer capture adapter for hosts without a pointer event source.
constructor HeadlessPointerCapture(): HeadlessPointerCapturemethod start(_handlers: PointerCaptureHandlers): (): voidStarts one capture session and returns a disposer for that session.
method stop(): voidStops the active session without invoking its release callback.
- classPointerCapture
-
Platform-neutral, editor-local host-wide pointer capture contract.
constructor PointerCapture(): PointerCaptureproperty readonly symbol: symbolstaticDI token for resolving the pointer capture adapter.
method start(handlers: PointerCaptureHandlers): (): voidStarts one capture session and returns a disposer for that session.
method stop(): voidStops the active session without invoking its release callback.
- classWebPointerCapture
-
class WebPointerCapture extends PointerCaptureBrowser pointer capture adapter that emits render-root view coordinates.
constructor WebPointerCapture(renderContext: RenderContext, platform: Platform, eventTarget: unknown): WebPointerCaptureCreates one editor-local browser pointer capture adapter.
property readonly eventTargetSymbol: symbolstaticDI token for the host-wide event source, normally
document.method start(handlers: PointerCaptureHandlers): (): voidStarts one capture session and returns a disposer for that session.
method stop(): voidStops the active session without invoking its release callback.
- interfacePointerCaptureHandlers
-
Callbacks active for one host-wide pointer capture session.
property readonly onMove?: (event: PointerCapturePoint): voidReceives pointer movement while capture is active.
property readonly onRelease: (event: PointerCapturePoint): voidReceives the release that ends the capture session.
- interfacePointerCapturePoint
-
Pointer position normalized to the editor render root's view coordinates.
Text input
- classHeadlessTextInput
-
class HeadlessTextInput extends TextInputText-input adapter that intentionally owns no platform input element.
constructor HeadlessTextInput(): HeadlessTextInputproperty readonly symbol: symbolstaticDI token for resolving HeadlessTextInput.
method startListener(): voidStarts forwarding host text and composition events.
method stopListener(): voidStops forwarding host text and composition events.
method subscribe(_handlers: TextInputHandlers): voidSubscribes to state changes and returns an idempotent disposer.
Inherited members 7
Inherited from TextInput.
- classTextInput
-
class TextInput extends InputRoutes host text and composition input through portable subscriptions.
constructor TextInput(): TextInputproperty readonly symbol: symbolstaticDI token for resolving TextInput.
method refocus(): voidRestores focus to the hidden host text-input surface.
method setPosition(_x: number, _y: number): voidUpdates the position.
method startListener(): voidStarts forwarding host text and composition events.
method stopListener(): voidStops forwarding host text and composition events.
method subscribe(_handlers: TextInputHandlers): voidSubscribes to state changes and returns an idempotent disposer.
method isTextInput<T>(event: T): eventstaticClassifies text events within a typed input-action union.
- classWebTextInput
-
class WebTextInput extends TextInputBrowser implementation of
TextInput.Manages a hidden
<input>element that receives IME composition events and regular printable-character input. All keyboard-shortcut / action-key handling (arrows, Enter, Escape, Backspace, Ctrl+A) has been moved toWebKeyboardRouterso that those shortcuts remain functional even when browser focus shifts away from this element (e.g. after a canvas click).The hidden input must still hold focus during active editing so that the OS IME candidate window is anchored to it. Call
refocus()whenever a pointer event inside the editor area moves focus elsewhere.constructor WebTextInput(): WebTextInputproperty onDelete?: (): voidHandles the delete lifecycle event.
property onPaste?: (text: string): booleanproperty onTextInput?: (event: TextInputEvent): voidHandles the input lifecycle event.
method refocus(): voidRestore focus to the hidden input (e.g. after a canvas click moves focus away).
method setPosition(x: number, y: number): voidMove the hidden input to the cursor's screen position so that the OS IME candidate window is anchored near the cell being edited.
method startListener(): voidStarts forwarding host text and composition events.
method stopListener(): voidStops forwarding host text and composition events.
method subscribe(handlers: TextInputHandlers): voidSubscribes to state changes and returns an idempotent disposer.
- interfaceTextInputHandlers
-
Portable text and selection-deletion subscriptions.
property onDelete?: (): voidReceives a clipboard cut as deletion of the current selection.
property onPaste?: (text: string): booleanReturns true when a host handles a native paste as a committed grid operation.
property onTextInput?: (event: TextInputEvent): voidReceives committed text and composition updates through one ordered stream.
- typeTextInputEvent
-
type TextInputEvent = { kind: typeof TextInputKind.Text; text: string } | { caretOffset: number; kind: typeof TextInputKind.CompositionUpdate; text: string }Committed text or an in-flight composition update, including composition clearing.
- variableTextInputKind
-
TextInputKind: { CompositionUpdate: "compositionUpdate"; Text: "text" }Canonical kinds of portable text-input events.
No matching API entries.