API reference
@searsuite/sear-render-scroll
Logical scrolling, axis locking, boundary feedback, and host scroller adapters.
18 exportsderived from source
- classHeadlessScrollersource ↗
-
class HeadlessScroller extends ScrollerScroller adapter for hosts that have no native scroll surface.
constructorconstructor HeadlessScroller(): HeadlessScrollerConstructs a scroller adapter.
propertysymbolstatic readonly symbol: symbolDI token for resolving HeadlessScroller.
methodgetPublisher getPublisher(): ScrollPublisherReturns the publisher.
- classRubberBandConfigErrorsource ↗
-
class RubberBandConfigError extends SearErrorStable public error raised for invalid rubber-band physics configuration.
constructorconstructor RubberBandConfigError(message: string, details?: SearErrorDetails, options?: ErrorOptions): RubberBandConfigErrorCreates a SearError instance.
message: stringdetails: SearErrorDetailsoptions: ErrorOptions
propertycode readonly code: "SEAR_SCROLL_INVALID_RUBBER_BAND_CONFIG"Stable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
- classRubberBandControllersource ↗
-
class RubberBandControllerPlatform-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.
constructorconstructor RubberBandController(platform: Platform, publishOffset: (offset: RubberBandOffset): void): RubberBandControllerCreates one controller and publishes every visual displacement change.
platform: PlatformpublishOffset: (offset: RubberBandOffset): void
methodconfigure configure(config: Partial<RubberBandConfig>): voidApplies validated host overrides and resets immediately when disabled.
config: Partial<RubberBandConfig>
methodconsume 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.
input: RubberBandInput
methodgetOffset getOffset(): RubberBandOffsetReturns a copy of the current transient visual displacement.
methodrelease release(delay?: number, preserveVelocity?: boolean): voidStarts the boundary return after the configured input-settle delay.
delay: numberpreserveVelocity: boolean
methodreset reset(): voidCancels pending work and restores the exact zero-displacement state.
- classScrollAxisLocksource ↗
-
class ScrollAxisLockLocks a continuous input gesture to its first dominant axis.
constructorconstructor ScrollAxisLock(): ScrollAxisLockmethodconfigure configure(config: Partial<ScrollAxisLockConfig>): voidApplies validated host overrides and resets an in-progress gesture.
config: Partial<ScrollAxisLockConfig>
methodconsume consume(x: number, y: number): { x: number; y: number }Filters one two-dimensional input sample through the active direction lock.
x: numbery: number
methodgetAxis getAxis(): ScrollAxis | nullReturns the currently selected axis, or null before activation.
methodgetWheelEndDelay getWheelEndDelay(): numberReturns the configured wheel gesture-end delay.
methodreset reset(): voidEnds the current gesture and clears uncommitted sub-threshold input.
- classScrollAxisLockConfigErrorsource ↗
-
class ScrollAxisLockConfigError extends SearErrorStable public error raised for invalid scroll-axis lock configuration.
constructorconstructor ScrollAxisLockConfigError(message: string, details?: SearErrorDetails, options?: ErrorOptions): ScrollAxisLockConfigErrorCreates a SearError instance.
message: stringdetails: SearErrorDetailsoptions: ErrorOptions
propertycode readonly code: "SEAR_SCROLL_INVALID_AXIS_LOCK_CONFIG"Stable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
- classScrollersource ↗
-
class ScrollerBase class for host scroll adapters.
Concrete scrollers own platform scroll surfaces while ScrollManager owns the platform-neutral viewport state.
constructorconstructor Scroller(): ScrollerConstructs a scroller adapter.
propertyconfigEngine readonly configEngine: ConfigEngineConfiguration engine available to concrete scroller adapters.
propertyContainerSymbolstatic readonly ContainerSymbol: symbolDI token used by hosts that provide a scroller container.
propertysymbolstatic readonly symbol: symbolDI token for resolving the active scroller adapter.
- classScrollerFactorysource ↗
-
class ScrollerFactoryFactory registry for host scroller adapters.
constructorconstructor ScrollerFactory(): ScrollerFactorymethodcreateScrollerstatic createScroller(type: string | symbol, args: unknown): ScrollerCreates a scroller for a registered type.
ReturnsNew scroller adapter.
type: string | symbolScroller type key.
args: unknownAdapter-specific construction input.
methodregisterScrollerstatic registerScroller(type: string | symbol, scrollerCreator: (args: unknown): Scroller): voidRegisters a scroller creator.
type: string | symbolScroller type key.
scrollerCreator: (args: unknown): ScrollerFactory invoked by createScroller().
- classScrollManagersource ↗
-
class ScrollManagerOwns viewport scroll state and fans updates out to render subscribers.
constructorconstructor ScrollManager(width: number, height: number): ScrollManagerCreates a scroll manager for a viewport of the given dimensions.
width: numberheight: number
propertysymbolstatic readonly symbol: symbolDI token for resolving the scroll manager.
methodaddPublisher addPublisher(publisher: ScrollPublisher): (): voidConnects a scroll-event source and returns an idempotent disposer.
publisher: ScrollPublisher
methodapplyInputScroll applyInputScroll(state: ScrollManagerState): voidApplies platform scroll data within the owning editor's command.
state: ScrollManagerState
methoddestroy destroy(ownerToken?: object): voidDisconnects publishers and subscribers owned by this manager.
ownerToken: object
methodenforceCommandBoundary enforceCommandBoundary(isExecuting: (): boolean): voidCloses direct viewport writes after the owning editor finishes restoration.
isExecuting: (): boolean
methodenforceTeardownBoundary enforceTeardownBoundary(ownerToken: object): voidReserves publisher cleanup for the owning editor.
ownerToken: object
methodgetContentBoundary getContentBoundary(): [number, number]Returns the maximum logical scroll positions for platform adapters.
methodgetPositionRect 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.
methodgetPreviousState getPreviousState(): ScrollManagerState | nullReturns the previous committed scroll state.
methodgetRenderScrollState 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.methodgetShape getShape(): [number, number]Returns the viewport dimensions as
[width, height].methodgetState getState(): ScrollManagerStateReturns the current committed scroll state.
methodhasUnrenderedScroll hasUnrenderedScroll(): booleanReturns whether the current scroll position has not yet been rendered.
methodmarkScrollStateRendered markScrollStateRendered(): voidMarks the current committed scroll position as consumed by a render frame.
methodrequestScrollTo requestScrollTo(x: number, y: number): voidRequests an absolute scroll position through the owning editor.
x: numbery: number
methodresize resize(width: number, height: number): voidUpdates viewport dimensions and clamps the current position without emitting a scroll render.
width: numberheight: number
methodscrollTo 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.
x: numbery: number
methodsetContentBoundary setContentBoundary(maxWidth: number, maxHeight: number): voidSet the content boundary for scroll clamping.
maxWidth: numberMaximum scrollable x position (contentWidth - viewportWidth)
maxHeight: numberMaximum scrollable y position (contentHeight - viewportHeight)
This should be called after initialization once the total sheet dimensions are known (e.g. by expandTreeBoundaryToSheetSize).
methodsetInputUpdateExecutor setInputUpdateExecutor(executor: (state: ScrollManagerState): void): voidRoutes platform-originated viewport input through the host's action boundary.
executor: (state: ScrollManagerState): void
methodsetPosition 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.
x: numbery: number
methodsetScrollToExecutor setScrollToExecutor(executor: (x: number, y: number): void): voidBinds programmatic scroll requests to the owning editor's command bus.
executor: (x: number, y: number): void
methodsubscribeScroll 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.callback: ScrollSubscriberprepend: boolean
- classWebScrollersource ↗
-
class WebScroller extends ScrollerAdapts a Web scroll surface to logical editor viewport coordinates.
constructorconstructor WebScroller(target: unknown, platform: Platform): WebScrollerCreates a WebScroller instance.
target: unknownplatform: Platform
propertysymbolstatic readonly symbol: symbolDI token for resolving WebScroller.
memberroot root: unknownmethodconfigureAxisLock configureAxisLock(config: Partial<ScrollAxisLockConfig>): voidEnables or tunes Safari-style dominant-axis locking for wheel and touch gestures.
config: Partial<ScrollAxisLockConfig>
methodconfigureRubberBand configureRubberBand(config: Partial<RubberBandConfig>): voidEnables or tunes the Safari-style overscroll effect. Logical editor coordinates remain clamped; only the visible surface moves.
config: Partial<RubberBandConfig>
methodgetPublisher getPublisher(): (scrollStateInstance: ScrollManager, updateState: (newState: ScrollManagerState): void): (): voidReturns the publisher.
- interfaceRubberBandConfigsource ↗
-
interface RubberBandConfigHost-tunable parameters for Safari-style boundary resistance and return motion.
propertyenabled enabled: booleanpropertymaxOffset maxOffset: numberSmooth asymptotic maximum visual displacement in viewport pixels.
propertyresistance resistance: numberInitial slope of the rubber-band curve. Lower values reduce sensitivity.
propertyreturnDelay returnDelay: numberDefault delay used when release is called without an explicit delay.
propertyspringDamping springDamping: numberViscous damping used by the damped harmonic return motion.
propertyspringMass springMass: numberSpring mass used by the damped harmonic return motion.
propertyspringStiffness springStiffness: numberSpring stiffness used by the damped harmonic return motion.
- interfaceRubberBandInputsource ↗
-
interface RubberBandInputOne logical input sample consumed by RubberBandController.
propertyboundary readonly boundary: RubberBandOffsetpropertycontinueReturnOnOutwardInput readonly continueReturnOnOutwardInput?: booleanKeeps an already scheduled return alive for same-direction wheel inertia.
propertydisplacement readonly displacement: RubberBandOffsetContent displacement: positive values move the visible surface right/down.
propertyposition readonly position: RubberBandOffsetpropertyviewport readonly viewport: RubberBandOffset - interfaceRubberBandOffsetsource ↗
-
interface RubberBandOffsetTransient visual displacement in viewport pixels.
- interfaceScrollAxisLockConfigsource ↗
-
interface ScrollAxisLockConfigHost-tunable direction-lock parameters for DOM scrolling gestures.
propertyactivationThreshold activationThreshold: numberAccumulated pixels required before selecting the dominant axis.
propertyenabled enabled: booleanpropertywheelEndDelay wheelEndDelay: numberWheel silence in milliseconds that separates two gestures.
- interfaceScrollManagerStatesource ↗
-
interface ScrollManagerStateScroll offset snapshot published to render and coordinate subscribers.
propertydeltaX deltaX: numberHorizontal input delta that produced the update.
propertydeltaY deltaY: numberVertical input delta that produced the update.
propertyx x: numberCurrent horizontal scroll offset in world coordinates.
propertyy y: numberCurrent vertical scroll offset in world coordinates.
- typeScrollAxissource ↗
-
type ScrollAxis = "x" | "y"Axis selected for one continuous wheel or touch gesture.
- typeScrollPublishersource ↗
-
type ScrollPublisher = (manager: ScrollManager, updateState: (newState: ScrollManagerState): void): (): voidPlatform adapter that connects a scroll event source to ScrollManager.
- functioncreateDefaultScrollManagerStatesource ↗
-
createDefaultScrollManagerState(): ScrollManagerStateCreates the default zero-offset scroll state.
- functionrubberBandDistancesource ↗
-
rubberBandDistance(excess: number, viewport: number, resistance?: number, maxOffset?: number): numberSafari-like rubber-band mapping with a smooth maximum visual displacement.
excess: numberviewport: numberresistance: numbermaxOffset: number
No public exports match that search.