import { defineWebComponent } from './define'; import { ResponseStream, type Mode } from '../components/response-stream'; interface Props extends Record { /** Text to stream. A string, or an `AsyncIterable` (set as a JS * property — async iterables can't be HTML attributes). */ text?: string | AsyncIterable; /** Reveal animation. */ mode?: Mode; /** Characters/segments per tick. */ speed?: number; /** Element tag to render as. */ as?: string; } /** Events fired by ``. */ interface Events { /** Streaming finished. */ 'kc-complete': void; } /** * `` — reveals text with a typewriter or fade animation. * Text via the `text` property; `mode`/`speed` attributes; emits `kc-complete`. */ defineWebComponent('kc-response-stream', { text: '', mode: 'typewriter', speed: 20, as: undefined, }, (props, { dispatch }) => ( dispatch('kc-complete')} /> ));