SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

collapseStream

Folds every [data-stream-collapse] disclosure in root that comes before block.

tsx
import { collapseStream } from "@sdxc/ui/chat";

Usage

Folds every [data-stream-collapse] disclosure in root that comes before block, or all of them without one, marking each data-stream-collapsed. A reply shown without a replay calls it with no block, so it reads the same as one that streamed.

Signature

typescript
collapseStream(root: HTMLElement, block?: Element): void

Parameters

ParameterTypeRequiredDescription
rootHTMLElementYesThe reply.
blockElementNoThe block the replay is about to show.

Examples

tsx
collapseStream(document.getElementById("reply-7")!)

The events, constants and types its module publishes, each imported from @sdxc/ui/chat too.

Interface

StreamRevealOptions

Options for revealStream.

MemberTypeRequiredDescription
intervalnumberNoMilliseconds between ticks. @default 32
onEnd(end: StreamRevealEnd) => voidNoCalled once, when the whole reply has shown or StreamReveal.stop ran.
signalAbortSignalNoStops the reveal where it is when aborted, as StreamReveal.stop does.
Interface

StreamReveal

A running reveal.

MemberTypeRequiredDescription
stopvoidYesFreezes the reply at what has shown; the rest of it stays out of the page.
Type

StreamRevealEnd

How a reveal finished.

typescript
type StreamRevealEnd = "done" | "stopped"
@sdxc/ui

Can’t find it? Contact us