import type { Component } from 'svelte'; import type { AsyncSvelteComponent, RoutePrecondition, WrappedComponent } from './types.js'; export type { AsyncSvelteComponent, RoutePrecondition, WrappedComponent } from './types.js'; /** Options object for the call to `wrap` */ export interface WrapOptions { /** Svelte component to load (this is incompatible with `asyncComponent`) */ component?: Component; /** Function that returns a Promise that fulfills with a Svelte component (e.g. `{asyncComponent: () => import('Foo.svelte')}`) */ asyncComponent?: AsyncSvelteComponent; /** Svelte component to be displayed while the async route is loading (as a placeholder); when unset or false-y, no component is shown */ loadingComponent?: Component; /** Optional dictionary passed to the `loadingComponent` component as params (for an exported prop called `params`) */ loadingParams?: Record; /** Optional object that will be passed to callback props such as `onRouteLoading`, `onRouteLoaded`, `onConditionsFailed` */ userData?: object; /** Optional key-value dictionary of static props that will be passed to the component */ props?: Record; /** Route pre-conditions to add, which will be executed in order */ conditions?: RoutePrecondition[] | RoutePrecondition; } /** * Wraps a component to enable multiple capabilities: * * 1. Using dynamically-imported components (e.g. `{asyncComponent: () => import('Foo.svelte')}`), which also allows bundlers to do code-splitting. * 2. Adding route pre-conditions (e.g. `{conditions: [...]}`). * 3. Adding static props that are passed to the component. * 4. Adding custom userData, which is passed to callback props (e.g. `onRouteLoaded`) or to route pre-conditions. */ export declare function wrap(args: WrapOptions): WrappedComponent; export default wrap;