import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Specify when the content mounts. * `"visible"` mounts it once the wrapper comes within `rootMargin` of the viewport. * `"idle"` mounts it once the browser is idle, or sooner if it comes that close. * Idle mounts take turns, one an idle period, top to bottom, and skip * content above the viewport, which mounts as the reader scrolls near it. * @default "visible" */ when?: "visible" | "idle"; /** * Specify how far outside the viewport counts as near, as a CSS margin. * Content mounts before it scrolls into view, so it is ready when it does. * @default "600px" */ rootMargin?: string; /** * Specify the height to reserve until the content mounts, so the page * doesn't shift when it does. A number is in pixels. */ estimatedHeight?: number | string | undefined; /** * Set to `true` to render the content right away, for example in tests or * before printing. Content also mounts on `beforeprint`. * @default false */ eager?: boolean; /** * `true` once the content has mounted. Mounted content stays mounted. * @default false */ mounted?: boolean; placeholder?: (this: void) => void; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type LazyMountProps = Omit<$RestProps, keyof $Props> & $Props; export default class LazyMount extends SvelteComponentTyped< LazyMountProps, { /** Dispatched once, after the content first renders. */ mount: CustomEvent; }, { default: Record; placeholder: Record; } > {}