- Name
anchorId- Kind
- property
- Type
string | null- Requirement
- required
DocsAPI referenceUI machinesmessage-scroller
message-scroller machine
The public state machine contract for @grassroot/ui-machines/message-scroller. The machine owns behaviour; the matching headless layer owns composition.
@grassroot/ui-machines/message-scroller
Package
Service example
message-scroller.tsts
import { createService } from "@grassroot/statechart";import { messageScrollerMachine } from "@grassroot/ui-machines/message-scroller"; const service = createService(messageScrollerMachine, { input: {} });service.start();service.send({ type: "…" });service.stop();17 of 17
Exports
MESSAGE_SCROLLER_JUMP_DELAY_MSts
export declare const MESSAGE_SCROLLER_JUMP_DELAY_MS: 260;MESSAGE_SCROLLER_JUMP_KEYts
export declare const MESSAGE_SCROLLER_JUMP_KEY: "message-scroller.jump";MessageScrollerCommandts
type MessageScrollerCommand = (CommandObject & { readonly type: "SCROLL_TO"; readonly target: MessageScrollerScrollTarget; readonly behavior: MessageScrollerScrollBehavior;}) | (CommandObject & { readonly type: "PRESERVE_PREPEND";}) | (CommandObject & { readonly type: "CLEAR_SPACER";}) | (CommandObject & { readonly type: "REANCHOR";}) | ScheduleCommand<MessageScrollerEvent> | CancelCommand;MessageScrollerContextts
type MessageScrollerContext = { readonly jumping: boolean; readonly anchorId: string | null; readonly defaultApplied: boolean; readonly pendingJumpId: string | null;};Name
Kind
Type
Requirement
anchorIdproperty
string | nullrequired
defaultAppliedproperty
booleanrequired
jumpingproperty
booleanrequired
pendingJumpIdproperty
string | nullrequired
- Name
defaultApplied- Kind
- property
- Type
boolean- Requirement
- required
- Name
jumping- Kind
- property
- Type
boolean- Requirement
- required
- Name
pendingJumpId- Kind
- property
- Type
string | null- Requirement
- required
MessageScrollerDefaultScrollPositionts
type MessageScrollerDefaultScrollPosition = "start" | "end" | "last-anchor";MessageScrollerDiagnosticCodests
export declare const MessageScrollerDiagnosticCodes: readonly DiagnosticCatalogueEntry[];MessageScrollerEvent
typeMessageScrollerEventts
type MessageScrollerEvent = { readonly type: "USER_RELEASE";} | { readonly type: "SCROLL_REPORT"; readonly atEnd: boolean;} | { readonly type: "PREPEND";} | { readonly type: "APPLY_DEFAULT"; readonly action: "start" | "end" | "anchor"; readonly anchorId?: string;} | { readonly type: "APPEND"; readonly newAnchorId: string | null; readonly newAnchorCount: number;} | { readonly type: "ANCHOR"; readonly id: string;} | { readonly type: "FOLLOW_END";} | { readonly type: "JUMP_START"; readonly behavior: MessageScrollerScrollBehavior;} | { readonly type: "JUMP_END"; readonly behavior: MessageScrollerScrollBehavior;} | { readonly type: "JUMP_MESSAGE"; readonly messageId: string; readonly found: boolean; readonly rowsMounted: boolean; readonly alreadyVisible: boolean; readonly behavior: MessageScrollerScrollBehavior; readonly align?: MessageScrollerScrollAlign; readonly scrollMargin?: number;} | { readonly type: "JUMP_COMPLETE";} | { readonly type: "REANCHOR_REQUEST";} | { readonly type: "ANCHOR_LOST";} | { readonly type: "REANCHOR_RELEASED";} | { readonly type: "RESIZE";} | { readonly type: "AUTO_SCROLL_EDGE"; readonly atEnd: boolean;} | { readonly type: "STOP";};MessageScrollerInput
typeMessageScrollerInputts
type MessageScrollerInput = { readonly autoScroll?: boolean; readonly defaultScrollPosition?: MessageScrollerDefaultScrollPosition; readonly preserveScrollOnPrepend?: boolean; /** Presentation-only. The machine ignores it. @default "Messages" */ readonly label?: string; /** Presentation-only. The machine ignores it. @default false */ readonly busy?: boolean; /** Presentation-only. The machine ignores it. @default "end" */ readonly buttonDirection?: "start" | "end";};Name
Kind
Type
Requirement
Description
autoScrollproperty
booleanoptional
—
busyproperty
booleanoptional
Presentation-only. The machine ignores it.
defaultScrollPositionproperty
MessageScrollerDefaultScrollPositionoptional
—
labelproperty
stringoptional
Presentation-only. The machine ignores it.
preserveScrollOnPrependproperty
booleanoptional
—
- Name
autoScroll- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- —
- Name
busy- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- Presentation-only. The machine ignores it.
- Name
buttonDirection- Kind
- property
- Type
"start" | "end"- Requirement
- optional
- Description
- Presentation-only. The machine ignores it.
- Name
defaultScrollPosition- Kind
- property
- Type
MessageScrollerDefaultScrollPosition- Requirement
- optional
- Description
- —
- Name
label- Kind
- property
- Type
string- Requirement
- optional
- Description
- Presentation-only. The machine ignores it.
- Name
preserveScrollOnPrepend- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- —
messageScrollerMachine
valuemessageScrollerMachinets
export declare const messageScrollerMachine: MessageScrollerMachine;MessageScrollerMachinets
type MessageScrollerMachine = Machine<MessageScrollerInput, MessageScrollerStateValue, MessageScrollerContext, MessageScrollerEvent, MessageScrollerCommand>;messageScrollerReplaySequencets
export declare const messageScrollerReplaySequence: readonly MessageScrollerEvent[];MessageScrollerScrollAlignts
type MessageScrollerScrollAlign = "start" | "center" | "end" | "nearest";MessageScrollerScrollBehaviorts
type MessageScrollerScrollBehavior = "smooth" | "auto";MessageScrollerScrollTargetts
type MessageScrollerScrollTarget = { readonly kind: "start";} | { readonly kind: "end";} | { readonly kind: "message"; readonly id: string; readonly align?: MessageScrollerScrollAlign; readonly scrollMargin?: number;} | { readonly kind: "anchor"; readonly id: string;};messageScrollerSelectors
valuemessageScrollerSelectorsts
export declare const messageScrollerSelectors: { following: (snapshot: MessageScrollerSnapshot) => boolean; anchored: (snapshot: MessageScrollerSnapshot) => boolean; idle: (snapshot: MessageScrollerSnapshot) => boolean; jumping: (snapshot: MessageScrollerSnapshot) => boolean; anchorId: (snapshot: MessageScrollerSnapshot) => string | null; pendingJumpId: (snapshot: MessageScrollerSnapshot) => string | null; defaultApplied: (snapshot: MessageScrollerSnapshot) => boolean;};Name
Kind
Type
Requirement
anchoredproperty
(snapshot: MessageScrollerSnapshot) => booleanrequired
anchorIdproperty
(snapshot: MessageScrollerSnapshot) => string | nullrequired
defaultAppliedproperty
(snapshot: MessageScrollerSnapshot) => booleanrequired
followingproperty
(snapshot: MessageScrollerSnapshot) => booleanrequired
idleproperty
(snapshot: MessageScrollerSnapshot) => booleanrequired
jumpingproperty
(snapshot: MessageScrollerSnapshot) => booleanrequired
pendingJumpIdproperty
(snapshot: MessageScrollerSnapshot) => string | nullrequired
- Name
anchored- Kind
- property
- Type
(snapshot: MessageScrollerSnapshot) => boolean- Requirement
- required
- Name
anchorId- Kind
- property
- Type
(snapshot: MessageScrollerSnapshot) => string | null- Requirement
- required
- Name
defaultApplied- Kind
- property
- Type
(snapshot: MessageScrollerSnapshot) => boolean- Requirement
- required
- Name
following- Kind
- property
- Type
(snapshot: MessageScrollerSnapshot) => boolean- Requirement
- required
- Name
idle- Kind
- property
- Type
(snapshot: MessageScrollerSnapshot) => boolean- Requirement
- required
- Name
jumping- Kind
- property
- Type
(snapshot: MessageScrollerSnapshot) => boolean- Requirement
- required
- Name
pendingJumpId- Kind
- property
- Type
(snapshot: MessageScrollerSnapshot) => string | null- Requirement
- required
MessageScrollerSnapshotts
type MessageScrollerSnapshot = Snapshot<MessageScrollerStateValue, MessageScrollerContext>;MessageScrollerStateValuets
type MessageScrollerStateValue = "idle" | "following" | "anchored";