/**
* Client-side proxies for islands defined in server-only modules
* (`*.server.ts(x)`).
*
* The real island never ships to the browser — it closes over server code.
* The Vite plugin rewrites client-graph imports of island exports to this
* factory, wiring each stream/action key to the tacho stub of the exported
* function it calls. The proxy is a branded ilha island so composition
* (`` inside a parent render) works unchanged:
*
* - SSR (server graph): imports resolve to the REAL module — no proxies.
* - Hydration (client): `mount` seeds state from `data-ilha-state`, preserves
* the SSR DOM, resumes streams through the wired stubs, and reconnects
* `[data-ilha-on]` event sentinels to named actions using the
* `data-ilha-actions` manifest emitted by `hydratable()`.
*/
import type { SnapshotObject, SnapshotValue } from "./snapshot";
/** Symbol.for keeps brands stable across duplicate ilha copies in one realm. */
declare const ISLAND: unique symbol;
declare const ISLAND_SLOT_TAG: unique symbol;
export declare const ISLAND_MOUNT_INTERNAL: unique symbol;
declare const ISLAND_CALL: unique symbol;
/** @internal */
export declare const __ilhaRepaintServerModule: (moduleKey: string) => void;
export type ServerStreamFn = (signal: AbortSignal) => AsyncGenerator | Generator;
/** JSON-serializable value — the wire format for server-action payloads. */
export type ServerActionPayload = SnapshotValue;
export type ServerIslandProps = SnapshotObject;
export interface ServerIslandWiring {
/** Stream key → client transport. The plugin wires these to tacho stubs. */
streams?: Record;
/** Action key → client transport. Event payloads are not serializable;
* handlers receive `undefined` and should read island state instead. */
actions?: Record SnapshotValue | Promise>;
/** Frame transport: re-renders the island with the latest parent props. */
frame?: (props?: ServerIslandProps) => string | Promise | SnapshotValue;
/** Client-capable islands nested in the server render, keyed by opaque ref. */
children?: Record;
}
export interface ServerIslandHandle {
unmount: () => void;
updateProps: (props?: ServerIslandProps) => void;
}
/** @internal */
export declare const __ilhaApplyHead: (entries: T) => void;
/**
* Create a client proxy island for a server-defined island. Called by
* generated virtual modules — not by application code.
*
* @param id - Stable identity (`#`), for diagnostics.
* @param as - Slot tag declared by the server island's `{ as }` option (default div).
* @param wiring - Stream/action transports wired to tacho stubs by codegen.
*/
interface IslandCallPayload {
[ISLAND_CALL]: true;
island: ServerIslandCallable;
props?: ServerIslandProps;
key: string;
}
export type ServerIslandCallable = ((props?: ServerIslandProps) => string) & {
[ISLAND]: true;
[ISLAND_SLOT_TAG]: string;
mount: (host: Element, props?: ServerIslandProps) => () => void;
toString: () => string;
key: (slotKey: string) => (props?: ServerIslandProps) => IslandCallPayload;
[ISLAND_MOUNT_INTERNAL]: (host: Element, props?: ServerIslandProps) => ServerIslandHandle;
};
export declare const __ilhaServerIsland: (id: string, as: string, wiring?: ServerIslandWiring, moduleKey?: string) => ServerIslandCallable;
export {};