vite-plugin-shopify-theme-islands
Version:
Vite plugin for island architecture in Shopify themes
20 lines (19 loc) • 955 B
TypeScript
/**
* Island architecture runtime for Shopify themes.
*
* Walks the DOM for custom elements that match island files, then loads them
* lazily based on client directives:
*
* client:visible — load when the element scrolls into view
* client:media — load when a CSS media query matches
* client:idle — load when the browser has idle time
* client:defer — load after a fixed delay (ms value on the attribute)
* client:interaction — load on mouseenter / touchstart / focusin (or custom events)
*
* Directives can be combined; all conditions must be met before loading.
* A MutationObserver re-runs the same logic for elements added dynamically.
*/
import type { ClientDirective, ReviveOptions } from "./index.js";
export declare function revive(islands: Record<string, () => Promise<unknown>>, options?: ReviveOptions, customDirectives?: Map<string, ClientDirective>): {
disconnect: () => void;
};