import { r as DisplayListBuilder } from "./displayList.js"; import { U as NodeProps, V as Node, W as PropInit, h as Text, z as EvalContext } from "./nodes.js"; import { BindableSignal, Track } from "@glissade/core"; //#region src/textCursor.d.ts interface TextCursorProps extends NodeProps { /** The Text whose reveal head the caret follows. Place as a sibling. */ text: Text; /** Blink period in seconds (full on+off cycle); default 1.06 (~0.53s each). */ blinkPeriod?: number; /** Blink phase offset in seconds; default 0. */ blinkPhase?: number; /** Stay solid (no blink) while the reveal is still advancing; default true. */ solidWhileTyping?: boolean; /** Caret width in px; default 2. */ width?: number; /** Caret color; default '' = follow the Text's fill. Track '/fill'. */ fill?: PropInit; } declare class TextCursor extends Node { readonly target: Text; readonly blinkPeriod: number; readonly blinkPhase: number; readonly solidWhileTyping: boolean; readonly caretWidth: number; readonly fill: BindableSignal; constructor(props: TextCursorProps); protected draw(out: DisplayListBuilder, ctx: EvalContext): void; } /** `children: [title, textCursor(title)]` — a caret riding the reveal head. */ declare function textCursor(text: Text, props?: Omit): TextCursor; //#endregion //#region src/typewriter.d.ts /** One step of a typewriter performance. */ interface TypeEdit { /** graphemes to type in, one keystroke at a time */ type?: string; /** graphemes to backspace, one keystroke at a time */ delete?: number; /** seconds to hold the current text before the next step (a pause beat) */ hold?: number; /** seconds per keystroke for THIS step; overrides the global perChar */ perChar?: number; } /** One keystroke in the compiled schedule — the keystroke-SFX contract, * extended with `kind` so a backspace can take a different sample. */ interface EditMark { /** keystroke time, absolute timeline seconds */ time: number; /** a character appeared (insert) or was removed (delete/backspace) */ kind: 'insert' | 'delete'; /** the grapheme inserted, or the one removed */ grapheme: string; /** the full visible string AFTER this keystroke */ value: string; } /** One edit step's phrase boundary — for driving sibling UI (a counter chip, a * progress dot) off the same source instead of recomputing wall-clock spans. */ interface StepMark { /** index of the step in the edit script */ index: number; /** time this step began (before its first keystroke) */ start: number; /** time this step completed (after its last keystroke and its hold) */ end: number; /** the full visible string after this step */ value: string; } interface TypewriterResult { /** hold-key string track for the Text node's `/text` target */ track: Track; /** every keystroke (insert + delete), for keystroke SFX */ marks: EditMark[]; /** one entry per edit step, with its start/end times — phrase boundaries */ steps: StepMark[]; /** time of the last keystroke or hold — the performance's end */ duration: number; } /** * Compile an edit script into a string track + keystroke schedule. * * const tw = typewriter('prompt/text', [ * { type: 'make it pop' }, * { hold: 0.4 }, * { delete: 3 }, // backspace 'pop' * { type: 'sing' }, * ]); * // tracks: [tw.track, ...]; keystroke SFX: keystrokeClips(tw.marks, ...) */ declare function typewriter(target: string, edits: readonly TypeEdit[], opts?: { start?: number; perChar?: number; gap?: number; }): TypewriterResult; //#endregion export { typewriter as a, textCursor as c, TypewriterResult as i, StepMark as n, TextCursor as o, TypeEdit as r, TextCursorProps as s, EditMark as t };