import ComponentHook from '../../component_hook.js'; export interface IslandOptions { lazy?: boolean; defer?: boolean; always?: boolean; skip?: boolean; } /** * Shares the `island()` helper the `@island`/`@endisland` Edge tag calls * into the template, and records every island rendered during this pass * (regardless of whether *this* request is island-scoped) so * `RequestHandler` can pull out just the one(s) a `wire:island`-scoped * call actually asked for afterward. * * Also handles 4 option-driven variants — none of them need any client * changes, since an island lives inside the same component's DOM tree * rather than being a separate component with its own snapshot, and the * client's generic full-page morph + `$wire.$island()` action-scoping * already do everything these need: * * - `lazy`/`defer`: render a placeholder with * `x-intersect`/`x-init="$wire.$island(name)"` instead of the real * content, until a request comes in scoped to that island * (`RequestHandler` already returns just that island's fragment for * such a request). * - `skip`: same placeholder mechanism as `lazy`/`defer`, minus the * auto-trigger directive — whatever the placeholder puts inside the * island's own fragment markers (e.g. a button) is already scoped to * this island automatically by the client's `closestIsland()`, the * same mechanism that already scopes clicks inside *loaded* content. * - `always` (and its absence, which is the real default per the * official docs): an island that ISN'T `always` and isn't this * request's direct target gets tagged `mode: 'static'` in its *inline* * copy (embedded in the component's own full `html` effect) instead of * `'morph'` — the client's generic morph already skips any fragment * whose incoming mode isn't `'morph'` (built to protect append/prepend * regions), so this reuses that existing skip to freeze the island's * DOM on unrelated re-renders, matching official behavior, with zero * client changes. This is a real behavior change from this package's * original Islands MVP, which always morphed every island on every * render — see WIP.md. * * The "once loaded, stay loaded" half of lazy/defer/skip needs its own * persistence: a loaded island must keep rendering real content on every * later re-render of the component too (not just the one request that * loaded it), so the loaded set is round-tripped through the component's * own memo, the same way `SupportLazyLoading` persists `lazyLoaded`. */ export declare class SupportIslands extends ComponentHook { hydrate(memo: any): Promise; render(view: any): Promise; dehydrate(context: any): Promise; }