/** * Component runtime — implicit "current component" context plus every lifecycle * hook a `setup()` function can call. * * Design note: hooks are plain module-level functions (not a bag/context object * passed into `setup`). They resolve the active component through a single * module-level pointer (`currentContext`), set for the duration of `setup()` and * of each queued `onMounted` callback. This is the same mechanism React/Vue/Solid * use for their composable hooks — it lets any helper function (not just the * top-level `setup()` body) call `onMounted`/`onCleanup`/`bind`/... directly, * with no context object to thread through every layer of a composable. */ import { type Cleanup, type Readable } from '@vielzeug/ripple'; export type OnMountedCallback = () => Cleanup | undefined; export type OnFormResetCallback = () => void; export type RuntimeContext = { element: HTMLElement; formResetCallbacks: OnFormResetCallback[]; mountCallbacks: OnMountedCallback[]; }; /** * Returns the current component's host element. * Only valid synchronously during component `setup()` (or inside a composable * called from it) — throws otherwise. */ export declare const getHost: () => HTMLElement; export declare const tryRegisterCleanup: (fn: Cleanup) => boolean; /** Registers cleanup work for component disconnect. */ export declare const onCleanup: (fn: Cleanup) => void; /** * Register work to run after the component template mounts to the DOM. * Multiple callbacks run in registration order. */ export declare const onMounted: (fn: OnMountedCallback) => void; /** * Register work to run when the ancestor `