跳到主要内容

ui/build/ai-elements/conversation/stick-to-bottom-context.svelte

ui/build/ai-elements/conversation/stick-to-bottom-context.svelte

Classes

StickToBottomContext

Defined in: apps/website/.api-docs-entry/ui/build/ai-elements/conversation/stick-to-bottom-context.svelte.d.ts:24

Stick-to-bottom for streaming chat.

User latch:

  • Any upward scroll / wheel-up → unlock (cancel pending pins)
  • Reach the bottom again (or scrollToBottom) → latch

While latched: content ResizeObserver pins scrollTop at most once per frame. Pins use a synchronous flag (not a time window) so user scroll-up is never swallowed.

Constructors

Constructor
new StickToBottomContext(): StickToBottomContext;

Defined in: apps/website/.api-docs-entry/ui/build/ai-elements/conversation/stick-to-bottom-context.svelte.d.ts:27

Returns

StickToBottomContext

Properties

isAtBottom
isAtBottom: boolean;

Defined in: apps/website/.api-docs-entry/ui/build/ai-elements/conversation/stick-to-bottom-context.svelte.d.ts:26

scrollToBottom
scrollToBottom: (behavior?) => void;

Defined in: apps/website/.api-docs-entry/ui/build/ai-elements/conversation/stick-to-bottom-context.svelte.d.ts:30

Explicit latch + jump (scroll button / initial mount).

Parameters
Parameter Type
behavior? ScrollBehavior
Returns

void

Methods

setElement()
setElement(element): void;

Defined in: apps/website/.api-docs-entry/ui/build/ai-elements/conversation/stick-to-bottom-context.svelte.d.ts:28

Parameters
Parameter Type
element HTMLElement
Returns

void

Functions

getStickToBottomContext()

function getStickToBottomContext(): StickToBottomContext;

Defined in: apps/website/.api-docs-entry/ui/build/ai-elements/conversation/stick-to-bottom-context.svelte.d.ts:33

Returns

StickToBottomContext


setStickToBottomContext()

function setStickToBottomContext(): StickToBottomContext;

Defined in: apps/website/.api-docs-entry/ui/build/ai-elements/conversation/stick-to-bottom-context.svelte.d.ts:32

Returns

StickToBottomContext


shouldPreserveBottomLatchAfterUpwardScroll()

function shouldPreserveBottomLatchAfterUpwardScroll(
   previous,
   current,
   options): boolean;

Defined in: apps/website/.api-docs-entry/ui/build/ai-elements/conversation/stick-to-bottom-context.svelte.d.ts:10

A shrinking transcript or a growing viewport can clamp scrollTop upward without user intent. Preserve the bottom latch for that layout movement; wheel, key, touch, and pointer input still win through directManipulation.

Parameters

Parameter Type
previous ScrollMetrics
current ScrollMetrics
options Readonly<{ directManipulation: boolean; stuck: boolean; }>

Returns

boolean