API reference
@searsuite/sear-render-input
Keyboard, pointer, text-input, and composition routing contracts.
17 exportsderived from source
- classHeadlessKeyboardRoutersource ↗
-
class HeadlessKeyboardRouter extends KeyboardRouterKeyboard router for hosts that do not expose a keyboard event source.
constructorconstructor HeadlessKeyboardRouter(): HeadlessKeyboardRouterpropertysymbolstatic readonly symbol: symbolDI token for resolving HeadlessKeyboardRouter.
methodstartListener startListener(): voidStarts listening to the host input source.
methodstopListener stopListener(): voidStops listening to the host input source.
methodsubscribe subscribe(_handlers: KeyboardRouterHandlers): voidSubscribes to state changes and returns an idempotent disposer.
_handlers: KeyboardRouterHandlers
- classHeadlessPointerCapturesource ↗
-
class HeadlessPointerCapture extends PointerCaptureNo-op pointer capture adapter for hosts without a pointer event source.
constructorconstructor HeadlessPointerCapture(): HeadlessPointerCapturemethodstart start(_handlers: PointerCaptureHandlers): (): voidStarts one capture session and returns a disposer for that session.
_handlers: PointerCaptureHandlers
methodstop stop(): voidStops the active session without invoking its release callback.
- classHeadlessTextInputsource ↗
-
class HeadlessTextInput extends TextInputText-input adapter that intentionally owns no platform input element.
constructorconstructor HeadlessTextInput(): HeadlessTextInputCreates a TextInput instance.
propertysymbolstatic readonly symbol: symbolDI token for resolving HeadlessTextInput.
methodstartListener startListener(): voidStarts forwarding host text and composition events.
methodstopListener stopListener(): voidStops forwarding host text and composition events.
methodsubscribe subscribe(_handlers: TextInputHandlers): voidSubscribes to state changes and returns an idempotent disposer.
_handlers: TextInputHandlers
Inherited members 7
Inherited from TextInput.
- classInputsource ↗
-
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.
constructorconstructor Input(): InputmethodstartListener startListener(): voidStarts listening to the host input source.
methodstopListener stopListener(): voidStops listening to the host input source.
- classInputManagersource ↗
-
class InputManagerRegistry for input adapters owned by one editor instance.
constructorconstructor InputManager(textInput: Input): InputManagerConstructs the manager with the configured text input adapter.
textInput: InputText input adapter resolved from the host.
propertytextInput readonly textInput: InputText input adapter resolved from the host.
propertysymbolstatic readonly symbol: symbolDI token for resolving the input manager.
methodget get<T>(symbol: symbol): T | undefinedRetrieves an input adapter by symbol.
ReturnsRegistered adapter, or void 0 when absent.
symbol: symbolAdapter symbol.
methodgetTextInput getTextInput(): TextInput | undefinedReturns the text-input adapter when it has been registered.
methodregister register(symbol: symbol, input: Input): voidRegisters an input adapter.
symbol: symbolAdapter symbol.
input: InputAdapter instance.
- classKeyboardRoutersource ↗
-
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.constructorconstructor KeyboardRouter(): KeyboardRouterpropertysymbolstatic readonly symbol: symbolDI token for resolving KeyboardRouter.
methodsubscribe subscribe(handlers: KeyboardRouterHandlers): void | (): voidInstalls handlers; implementations may return a disposer that restores the previous handlers.
handlers: KeyboardRouterHandlers
Inherited members 6
Inherited from Input.
- classPointerCapturesource ↗
-
class PointerCapturePlatform-neutral, editor-local host-wide pointer capture contract.
constructorconstructor PointerCapture(): PointerCapturepropertysymbolstatic readonly symbol: symbolDI token for resolving the pointer capture adapter.
methodstart start(handlers: PointerCaptureHandlers): (): voidStarts one capture session and returns a disposer for that session.
handlers: PointerCaptureHandlers
methodstop stop(): voidStops the active session without invoking its release callback.
- classTextInputsource ↗
-
class TextInput extends InputRoutes host text and composition input through portable subscriptions.
constructorconstructor TextInput(): TextInputCreates a TextInput instance.
propertysymbolstatic readonly symbol: symbolDI token for resolving TextInput.
methodrefocus refocus(): voidRestores focus to the hidden host text-input surface.
methodsetPosition setPosition(_x: number, _y: number): voidUpdates the position.
_x: number_y: number
methodstartListener startListener(): voidStarts forwarding host text and composition events.
methodstopListener stopListener(): voidStops forwarding host text and composition events.
methodsubscribe subscribe(_handlers: TextInputHandlers): voidSubscribes to state changes and returns an idempotent disposer.
_handlers: TextInputHandlers
methodisTextInputstatic isTextInput<T>(event: T): eventClassifies text events within a typed input-action union.
event: T
- classWebKeyboardRoutersource ↗
-
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().constructorconstructor WebKeyboardRouter(eventTarget: EventTarget): WebKeyboardRouterCreates a WebKeyboardRouter instance.
eventTarget: EventTarget
propertyeventTargetSymbolstatic readonly eventTargetSymbol: symbolDI token for the keyboard event source, normally
document.methodstartListener startListener(): voidStarts listening to the host input source.
methodstopListener stopListener(): voidStops listening to the host input source.
methodsubscribe subscribe(handlers: KeyboardRouterHandlers): (): voidInstalls handlers; implementations may return a disposer that restores the previous handlers.
handlers: KeyboardRouterHandlers
- classWebPointerCapturesource ↗
-
class WebPointerCapture extends PointerCaptureBrowser pointer capture adapter that emits render-root view coordinates.
constructorconstructor WebPointerCapture(renderContext: RenderContext, platform: Platform, eventTarget: unknown): WebPointerCaptureCreates one editor-local browser pointer capture adapter.
renderContext: RenderContextplatform: PlatformeventTarget: unknown
propertyeventTargetSymbolstatic readonly eventTargetSymbol: symbolDI token for the host-wide event source, normally
document.methodstart start(handlers: PointerCaptureHandlers): (): voidStarts one capture session and returns a disposer for that session.
handlers: PointerCaptureHandlers
methodstop stop(): voidStops the active session without invoking its release callback.
- classWebTextInputsource ↗
-
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.constructorconstructor WebTextInput(): WebTextInputCreates a WebTextInput instance.
propertyonDelete onDelete?: (): voidHandles the delete lifecycle event.
propertyonTextInput onTextInput?: (event: TextInputEvent): voidHandles the input lifecycle event.
methodrefocus refocus(): voidRestore focus to the hidden input (e.g. after a canvas click moves focus away).
methodsetPosition 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.
x: numbery: number
methodstartListener startListener(): voidStarts forwarding host text and composition events.
methodstopListener stopListener(): voidStops forwarding host text and composition events.
methodsubscribe subscribe(handlers: TextInputHandlers): voidSubscribes to state changes and returns an idempotent disposer.
handlers: TextInputHandlers
- interfaceKeyboardRouterHandlerssource ↗
-
interface KeyboardRouterHandlersCallbacks 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).propertyonArrowDown onArrowDown?: (shiftKey: boolean, metaKey: boolean): voidpropertyonArrowLeft onArrowLeft?: (shiftKey: boolean, metaKey: boolean): voidpropertyonArrowRight onArrowRight?: (shiftKey: boolean, metaKey: boolean): voidpropertyonArrowUp onArrowUp?: (shiftKey: boolean, metaKey: boolean): voidpropertyonCopy onCopy?: (): voidCtrl/Cmd + C - copy the active sheet selection.
propertyonCut onCut?: (): voidCtrl/Cmd + X - cut the active sheet selection.
propertyonDelete onDelete?: (): voidBackspace / Delete key.
propertyonEdit onEdit?: (): voidEnters editing while retaining the selected cell's content.
propertyonEnd onEnd?: (): voidMoves to the last occupied cell of the sheet.
propertyonEnter onEnter?: (shiftKey: boolean, primaryModifier?: boolean): voidEnter key – commit the current edit.
propertyonEscape onEscape?: (): voidEscape key – cancel the current edit.
propertyonHome onHome?: (primaryModifier: boolean): voidMoves to the start of the active row, or sheet with a primary modifier.
propertyonPage onPage?: (direction: -1 | 1): voidMoves the active selection by roughly one viewport.
propertyonPaste onPaste?: (): voidCtrl/Cmd + V - paste from the host clipboard.
propertyonRedo onRedo?: (): voidCtrl/Cmd + Shift + Z or Ctrl/Cmd + Y - redo the latest undone mutation.
propertyonSelectAll onSelectAll?: (): voidCtrl/Cmd + A – select all content in the editor.
propertyonSelectColumn onSelectColumn?: (): voidSelects the entire active column.
propertyonSelectRow onSelectRow?: (): voidSelects the entire active row.
propertyonSoftEnter onSoftEnter?: (): voidAlt/Option + Enter – insert a line break (soft enter) inside the cell.
propertyonTab onTab?: (shiftKey: boolean): voidTab / Shift+Tab - move the active sheet selection horizontally.
propertyonToggleBold onToggleBold?: (): voidCtrl/Cmd + B - toggle bold text in the active rich-text editor.
propertyonToggleItalic onToggleItalic?: (): voidCtrl/Cmd + I - toggle italic text in the active rich-text editor.
propertyonToggleReference onToggleReference?: (): voidCycles the reference at the formula caret through relative and absolute modes.
propertyonToggleStrikethrough onToggleStrikethrough?: (): voidCtrl/Cmd + Shift + X - toggle strikethrough text in the active rich-text editor.
propertyonToggleUnderline onToggleUnderline?: (): voidCtrl/Cmd + U - toggle underlined text in the active rich-text editor.
propertyonUndo onUndo?: (): voidCtrl/Cmd + Z - undo the latest sheet mutation.
propertyonUnhandledEscape onUnhandledEscape?: (): voidEscape not handled by a focused host control.
propertyonZoomIn onZoomIn?: (): voidpropertyonZoomOut onZoomOut?: (): voidpropertyonZoomReset onZoomReset?: (): void - interfacePointerCaptureHandlerssource ↗
-
interface PointerCaptureHandlersCallbacks active for one host-wide pointer capture session.
- interfacePointerCapturePointsource ↗
-
interface PointerCapturePointPointer position normalized to the editor render root's view coordinates.
propertyview readonly view: { x: number; y: number } - interfaceTextInputHandlerssource ↗
-
interface TextInputHandlersPortable text and selection-deletion subscriptions.
propertyonDelete onDelete?: (): voidReceives a clipboard cut as deletion of the current selection.
propertyonTextInput onTextInput?: (event: TextInputEvent): voidReceives committed text and composition updates through one ordered stream.
- typeTextInputEventsource ↗
-
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.
- variableTextInputKindsource ↗
-
TextInputKind: { CompositionUpdate: "compositionUpdate"; Text: "text" }Canonical kinds of portable text-input events.
No public exports match that search.