vite-plugin-shopify-theme-islands
Version:
Vite plugin for island architecture in Shopify themes
24 lines (23 loc) • 1.16 kB
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, type IslandLoader, type ReviveOptions, type RevivePayload } from "./contract.js";
export declare function revive(payload: RevivePayload): {
disconnect: () => void;
};
/** @deprecated Pass a RevivePayload object instead. Will be removed in v2.0. */
export declare function revive(islands: Record<string, IslandLoader>, options?: ReviveOptions, customDirectives?: Map<string, ClientDirective>): {
disconnect: () => void;
};