/** * Lazy loading for sigx components — runtime-only, no build dependencies; * works with any bundler that supports dynamic import(). * * A lazy wrapper reads its factory's load state REACTIVELY: while the chunk * loads it renders null (an enclosing shows the fallback — the * wrapper registered its promise with it at setup time), on resolution it * renders the real component in place, and on rejection it throws the load * error from render — routing through the standard error path (nearest * errorScope, then app onError). * * There is no thrown-promise protocol and no register-during-render * ordering — those were removed with (docs/rfc-async.md rev 8). */ import { type AnyComponentFactory } from './component.js'; /** * Module with default export */ type ModuleWithDefault = { default: T; }; /** * Loader function that returns a component or module with default export */ type ComponentLoader = () => Promise>; /** * Extended component factory with lazy loading methods */ export type LazyComponentFactory = T & { /** Preload the component without rendering */ preload: () => Promise; /** Check if the component is loaded */ isLoaded: () => boolean; /** @internal Marker for lazy components */ __lazy: true; }; /** * Create a lazy-loaded component wrapper. * * The component loads on first render (or `preload()`). Wrap it in * `` to show a fallback while the chunk loads. * * @param loader - Function that returns a Promise resolving to the component * @returns A component factory that loads the real component on demand * * @example * ```tsx * import { lazy, Defer } from 'sigx'; * * // Component will be in a separate chunk * const HeavyChart = lazy(() => import('./components/HeavyChart')); * * // Usage * }> * * * * // Preload on hover * * ``` */ export declare function lazy(loader: ComponentLoader): LazyComponentFactory; /** * Check if a component is a lazy-loaded component */ export declare function isLazyComponent(component: any): component is LazyComponentFactory; export {}; //# sourceMappingURL=lazy.d.ts.map