/** * Owns the composer: what has been typed, whether an IME is mid-composition, * and when a keystroke counts as "send". * * The typed text is deliberately not a reactive property. A keystroke would * otherwise re-render the whole shadow tree, `repeat` over every message * included; instead the two things that depend on it — the send button's * enabled state and the character counter — are updated in place. * * @implements {ReactiveController} */ export class ComposerController implements ReactiveController { /** @param {LitElement & ComposerHost} host */ constructor(host: LitElement & ComposerHost); set value(next: string); /** @returns {string} */ get value(): string; /** @returns {boolean} True while an IME candidate window is open. */ get composing(): boolean; /** @returns {number} Characters typed, counted by code point. */ get length(): number; /** @returns {boolean} Whether the current text could be sent right now. */ get canSend(): boolean; hostDisconnected(): void; hostUpdated(): void; /** @param {Event} event */ onInput(event: Event): void; onCompositionStart(): void; onCompositionEnd(): void; /** @param {KeyboardEvent} event */ onKeydown(event: KeyboardEvent): void; /** * Hand the text to the consumer and clear the box. * * The text is passed as typed: leading and trailing newlines are theirs to * keep or strip, since only they know whether the message is prose or code. * * @param {string} [text] Defaults to what is in the box. * @returns {boolean} False when there was nothing to send. */ submit(text?: string): boolean; clear(): void; focus(): void; #private; } export type ComposerHost = { busy: boolean; inputDisabled: boolean; sendOnEnter: boolean; maxLength: number | undefined; currentLabels: import("../i18n/labels.js").Labels; /** * Called after a submit that no listener cancelled. */ handleSubmitted: () => void; }; import type { ReactiveController } from 'lit'; import type { LitElement } from 'lit';