import TypedEmitter from "typed-emitter"; /** * Copyright (c) 2026, Daily. * * SPDX-License-Identifier: BSD-2-Clause */ /** Payload for the built-in `toast` command. */ export interface ToastPayload { title: string; subtitle?: string | null; description?: string | null; image_url?: string | null; duration_ms?: number | null; } /** Payload for the built-in `navigate` command. */ export interface NavigatePayload { view: string; params?: Record | null; } /** Payload for the built-in `scroll_to` command. */ export interface ScrollToPayload { /** * Snapshot ref (e.g. `"e42"`) assigned by the a11y walker. When * set, the default handler resolves this first; use when the server * is referencing an element it saw in ``. */ ref?: string | null; /** * Element id (`document.getElementById`). Used as a fallback when * `ref` is not set or no longer resolves. */ target_id?: string | null; /** Typically `"smooth"` or `"instant"`. Clients may ignore. */ behavior?: string | null; } /** Payload for the built-in `highlight` command. */ export interface HighlightPayload { ref?: string | null; target_id?: string | null; duration_ms?: number | null; } /** Payload for the built-in `focus` command. */ export interface FocusPayload { ref?: string | null; target_id?: string | null; } /** * Payload for the built-in `click` command. * * Closes the form-fill loop for non-text inputs (checkboxes, * radios) and exposes the rest of the action vocabulary (submit * buttons, links, app-specific clickable nodes). The standard * handler refuses on `disabled` targets. * * For native ``. The default handler refuses to write into * `disabled`, `readonly`, or `` targets so the * worker can't bypass UI affordances the user is meant to control. * * For text inputs and textareas, `replace: false` appends the value * to whatever is already in the field; the default replaces. The * flag is ignored for native `` and `