UNPKG

vite-plugin-shopify-theme-islands

Version:
32 lines (31 loc) 1.23 kB
import type { IslandLoader } from "./contract.js"; import type { IslandLifecycle } from "./lifecycle.js"; import { type ShopifyLifecycleRuntime } from "./shopify-lifecycle.js"; /** Runtime control verb semantics for Observed roots. */ export interface ObservedRootSession { disconnect(): void; scan(root?: HTMLElement | null): void; observe(root?: HTMLElement | null): void; unobserve(root?: HTMLElement | null): void; } interface OwnershipActivationCandidate { tagName: string; element: HTMLElement; loader: IslandLoader; } interface OwnershipSession { discover(tagName: string, element: HTMLElement): void; activate(candidate: OwnershipActivationCandidate): Promise<void>; clear(tagNames?: Iterable<string>): void; } export interface ObservedRootSessionDeps { islandMap: Map<string, IslandLoader>; lifecycle: Pick<IslandLifecycle, "start" | "includeRoot" | "excludeRoot" | "walk">; session: OwnershipSession; surface: { beginReadyLog(islandCount: number): () => void; }; connectShopify?: (runtime: ShopifyLifecycleRuntime) => () => void; } export declare function createObservedRootSession(deps: ObservedRootSessionDeps): ObservedRootSession; export {};