UNPKG

vite-plugin-shopify-theme-islands

Version:
28 lines (27 loc) 1.27 kB
import type { ClientDirective, NormalizedReviveOptions } from "./contract.js"; import type { RuntimeLogger } from "./runtime-surface.js"; export interface DirectiveWaiters { waitVisible(element: Element, rootMargin: string, threshold: number, watch: (el: Element, cancel: () => void) => () => void): Promise<void>; waitMedia(query: string): Promise<void>; waitIdle(timeout: number): Promise<void>; waitDelay(ms: number): Promise<void>; waitInteraction(element: Element, events: string[], watch: (el: Element, cancel: () => void) => () => void): Promise<void>; } export interface DirectiveRunContext { tagName: string; element: HTMLElement; directives: NormalizedReviveOptions["directives"]; customDirectives?: Map<string, ClientDirective>; directiveTimeout: number; watchCancellable: (el: Element, cancel: () => void) => () => void; log: RuntimeLogger; run: () => Promise<void>; onError(attrName: string, err: unknown): void; } export interface DirectiveOrchestrator { run(ctx: DirectiveRunContext): Promise<boolean>; } export declare class DirectiveCancelledError extends Error { constructor(); } export declare function createDirectiveOrchestrator(waiters?: DirectiveWaiters): DirectiveOrchestrator;