@searsuite/sear-render-scroll
Logical scrolling, axis locking, boundary feedback, and host scroller adapters.
Scroll state and control
- classHeadlessScroller
-
class HeadlessScroller extends ScrollerScroller adapter for hosts that have no native scroll surface.
constructor HeadlessScroller(): HeadlessScrollerConstructs a scroller adapter.
property readonly symbol: symbolstaticDI token for resolving HeadlessScroller.
method getPublisher(): ScrollPublisherReturns the publisher.
- classScrollAxisLock
-
Locks a continuous input gesture to its first dominant axis.
constructor ScrollAxisLock(): ScrollAxisLockmethod configure(config: Partial<ScrollAxisLockConfig>): voidApplies validated host overrides and resets an in-progress gesture.
method consume(x: number, y: number): { x: number; y: number }Filters one two-dimensional input sample through the active direction lock.
method getAxis(): ScrollAxis | nullReturns the currently selected axis, or null before activation.
method getWheelEndDelay(): numberReturns the configured wheel gesture-end delay.
method reset(): voidEnds the current gesture and clears uncommitted sub-threshold input.
- classScrollAxisLockConfigError
-
class ScrollAxisLockConfigError extends SearErrorStable public error raised for invalid scroll-axis lock configuration.
constructor ScrollAxisLockConfigError(message: string, details?: SearErrorDetails, options?: ErrorOptions): ScrollAxisLockConfigErrorproperty readonly code: "SEAR_SCROLL_INVALID_AXIS_LOCK_CONFIG"Stable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
- classScroller
-
Base class for host scroll adapters.
Concrete scrollers own platform scroll surfaces while ScrollManager owns the platform-neutral viewport state.
constructor Scroller(): ScrollerConstructs a scroller adapter.
property readonly configEngine: ConfigEngineConfiguration engine available to concrete scroller adapters.
property readonly ContainerSymbol: symbolstaticDI token used by hosts that provide a scroller container.
property readonly symbol: symbolstaticDI token for resolving the active scroller adapter.
- classScrollerFactory
-
Factory registry for host scroller adapters.
constructor ScrollerFactory(): ScrollerFactorymethod createScroller(type: string | symbol, args: unknown): ScrollerstaticCreates a scroller for a registered type.
ReturnsNew scroller adapter.
typeScroller type key.
argsAdapter-specific construction input.
method registerScroller(type: string | symbol, scrollerCreator: (args: unknown): Scroller): voidstaticRegisters a scroller creator.
typeScroller type key.
scrollerCreatorFactory invoked by createScroller().
- classScrollManager
-
Owns viewport scroll state and fans updates out to render subscribers.
constructor ScrollManager(width: number, height: number): ScrollManagerCreates a scroll manager for a viewport of the given dimensions.
property readonly symbol: symbolstaticDI token for resolving the scroll manager.
method addPublisher(publisher: ScrollPublisher): (): voidConnects a scroll-event source and returns an idempotent disposer.
method applyInputScroll(state: ScrollManagerState): voidApplies platform scroll data within the owning editor's command.
method destroy(ownerToken?: object): voidDisconnects publishers and subscribers owned by this manager.
method enforceCommandBoundary(isExecuting: (): boolean): voidCloses direct viewport writes after the owning editor finishes restoration.
method enforceTeardownBoundary(ownerToken: object): voidReserves publisher cleanup for the owning editor.
method getContentBoundary(): [number, number]Returns the maximum logical scroll positions for platform adapters.
method getPositionRect(): PositionRect<templateLiteral>Returns the viewport rectangle as (0, 0, width, height).
The scroll position is NOT included in the returned rect. Consumers that need the world-coordinate viewport should construct their own rect using scrollState.x/y (available via getState()).
Historically this method returned (state.x, state.y, width, height), but since ScrollManager.update() now clamps state.x/y in-place, including them caused double-offset bugs in render strategies that already add scrollState.x/y to compute world-coordinate query rects.
method getPreviousState(): ScrollManagerState | nullReturns the previous committed scroll state.
method getRenderScrollState(): ScrollManagerStateReturns the scroll state that render strategies should use for viewport copy planning.
deltaXanddeltaYare computed from the last position marked as rendered to the current committed position. This keeps wheel scrolling and programmaticscrollTo()jumps on the same delta convention expected byRasterCopyPlan: previous minus current.method getShape(): [number, number]Returns the viewport dimensions as
[width, height].method getState(): ScrollManagerStateReturns the current committed scroll state.
method hasUnrenderedScroll(): booleanReturns whether the current scroll position has not yet been rendered.
method markScrollStateRendered(): voidMarks the current committed scroll position as consumed by a render frame.
method requestScrollTo(x: number, y: number): voidRequests an absolute scroll position through the owning editor.
method resize(width: number, height: number): voidUpdates viewport dimensions and clamps the current position without emitting a scroll render.
method scrollTo(x: number, y: number): voidProgrammatically scroll to an absolute position, clamped to the content boundary, and notify all subscribers so the render pipeline re-draws.
method setContentBoundary(maxWidth: number, maxHeight: number): voidSet the content boundary for scroll clamping.
maxWidthMaximum scrollable x position (contentWidth - viewportWidth)
maxHeightMaximum scrollable y position (contentHeight - viewportHeight)
This should be called after initialization once the total sheet dimensions are known (e.g. by expandTreeBoundaryToSheetSize).
method setInputUpdateExecutor(executor: (state: ScrollManagerState): void): voidRoutes platform-originated viewport input through the host's action boundary.
method setPosition(x: number, y: number): voidDirectly set the scroll position (x, y) in the manager's state.
Useful for programmatic scroll jumps (e.g. "scroll to cell A1"). For normal scroll events, use addPublisher + update() instead, which clamps the position to the content boundary.
method setScrollToExecutor(executor: (x: number, y: number): void): voidBinds programmatic scroll requests to the owning editor's command bus.
method subscribeScroll(callback: ScrollSubscriber, prepend?: boolean): (): voidSubscribes to scroll-state changes and returns an idempotent disposer.
prependis reserved for updates that must run before render strategies. - classWebScroller
-
class WebScroller extends ScrollerAdapts a Web scroll surface to logical editor viewport coordinates.
constructor WebScroller(target: unknown, platform: Platform): WebScrollerproperty readonly symbol: symbolstaticDI token for resolving WebScroller.
memberroot root: unknownmethod configureAxisLock(config: Partial<ScrollAxisLockConfig>): voidEnables or tunes Safari-style dominant-axis locking for wheel and touch gestures.
method configureRubberBand(config: Partial<RubberBandConfig>): voidEnables or tunes the Safari-style overscroll effect. Logical editor coordinates remain clamped; only the visible surface moves.
method getPublisher(): (scrollStateInstance: ScrollManager, updateState: (newState: ScrollManagerState): void): (): voidReturns the publisher.
- interfaceScrollAxisLockConfig
-
Host-tunable direction-lock parameters for DOM scrolling gestures.
property activationThreshold: numberAccumulated pixels required before selecting the dominant axis.
property enabled: booleanproperty wheelEndDelay: numberWheel silence in milliseconds that separates two gestures.
- interfaceScrollManagerState
-
Scroll offset snapshot published to render and coordinate subscribers.
property deltaX: numberHorizontal input delta that produced the update.
property deltaY: numberVertical input delta that produced the update.
property x: numberCurrent horizontal scroll offset in world coordinates.
property y: numberCurrent vertical scroll offset in world coordinates.
- typeScrollAxis
-
type ScrollAxis = "x" | "y"Axis selected for one continuous wheel or touch gesture.
- typeScrollPublisher
-
type ScrollPublisher = (manager: ScrollManager, updateState: (newState: ScrollManagerState): void): (): voidPlatform adapter that connects a scroll event source to ScrollManager.
- functioncreateDefaultScrollManagerState
-
createDefaultScrollManagerState(): ScrollManagerStateCreates the default zero-offset scroll state.
Rubber band
- classRubberBandConfigError
-
class RubberBandConfigError extends SearErrorStable public error raised for invalid rubber-band physics configuration.
constructor RubberBandConfigError(message: string, details?: SearErrorDetails, options?: ErrorOptions): RubberBandConfigErrorproperty readonly code: "SEAR_SCROLL_INVALID_RUBBER_BAND_CONFIG"Stable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
- classRubberBandController
-
Platform-neutral Safari-style overscroll physics.
Logical positions never leave their boundaries. Raw excess input is mapped to a visual displacement with WebKit's viewport-relative resistance curve, then returned by a damped harmonic spring once boundary input settles.
constructor RubberBandController(platform: Platform, publishOffset: (offset: RubberBandOffset): void): RubberBandControllerCreates one controller and publishes every visual displacement change.
method configure(config: Partial<RubberBandConfig>): voidApplies validated host overrides and resets immediately when disabled.
method consume(input: RubberBandInput): RubberBandOffsetConsumes one wheel or touch sample and returns a clamped logical position. Reversing direction first consumes existing excess before logical scrolling resumes.
method getOffset(): RubberBandOffsetReturns a copy of the current transient visual displacement.
method release(delay?: number, preserveVelocity?: boolean): voidStarts the boundary return after the configured input-settle delay.
method reset(): voidCancels pending work and restores the exact zero-displacement state.
- interfaceRubberBandConfig
-
Host-tunable parameters for Safari-style boundary resistance and return motion.
property enabled: booleanproperty maxOffset: numberSmooth asymptotic maximum visual displacement in viewport pixels.
property resistance: numberInitial slope of the rubber-band curve. Lower values reduce sensitivity.
property returnDelay: numberDefault delay used when release is called without an explicit delay.
property springDamping: numberViscous damping used by the damped harmonic return motion.
property springMass: numberSpring mass used by the damped harmonic return motion.
property springStiffness: numberSpring stiffness used by the damped harmonic return motion.
- interfaceRubberBandInput
-
One logical input sample consumed by RubberBandController.
property readonly boundary: RubberBandOffsetproperty readonly continueReturnOnOutwardInput?: booleanKeeps an already scheduled return alive for same-direction wheel inertia.
property readonly displacement: RubberBandOffsetContent displacement: positive values move the visible surface right/down.
property readonly position: RubberBandOffsetproperty readonly viewport: RubberBandOffset - interfaceRubberBandOffset
-
Transient visual displacement in viewport pixels.
property readonly x: numberproperty readonly y: number - functionrubberBandDistance
-
rubberBandDistance(excess: number, viewport: number, resistance?: number, maxOffset?: number): numberSafari-like rubber-band mapping with a smooth maximum visual displacement.
No matching API entries.