tuil
ReferencePackages

@mwillbanks/tuil-scroll

Shared terminal scroll containers, viewports, anchoring, culling, and restoration for tuil.

View rawEdit

Overview

Shared terminal scroll containers, viewports, anchoring, culling, and restoration for tuil.

@mwillbanks/tuil-scroll is independently installable and also participates in the umbrella @mwillbanks/tuil runtime where applicable.

Installation

npm install @mwillbanks/tuil-scroll

How it operates

Shared scrolling manages bounded offsets, sticky edges, anchoring, nested wheel routing, variable measurements, culling, restoration, and scrollbar projection.

Documentation flow diagram. register area; measure; move/anchor; project; restore/dispose; S0 leads to S1; S1 leads to S2; S2 leads to S3
Documentation flow diagram. register area; measure; move/anchor; project; restore/dispose; S0 leads to S1; S1 leads to S2; S2 leads to S3

API

APISignatureDescription
ScrollAlignmenttype ScrollAlignmentPublic type ScrollAlignment.
ScrollAreaOptionsinterface ScrollAreaOptionsPublic interface ScrollAreaOptions.
ScrollAreaStateclass ScrollAreaStatePublic class ScrollAreaState.
ScrollAxistype ScrollAxisPublic type ScrollAxis.
scrollbarfunction scrollbarPublic function scrollbar.
ScrollExtentinterface ScrollExtentPublic interface ScrollExtent.
ScrollManagerclass ScrollManagerPublic class ScrollManager.
ScrollPositioninterface ScrollPositionPublic interface ScrollPosition.
ScrollSnapshotinterface ScrollSnapshotPublic interface ScrollSnapshot.
ScrollViewportinterface ScrollViewportPublic interface ScrollViewport.

Events and lifecycle

Each area exposes immutable snapshots through a subscription.

All subscriptions and registrations return a disposer or belong to an owning runtime that disposes them in reverse order.

Example

import { ScrollAreaState } from "@mwillbanks/tuil-scroll";

const area = new ScrollAreaState({ id: "logs", viewport, extent });

On this page