import { RouteMap, RouteLocationNormalizedLoaded, LocationQuery } from 'vue-router'; import { DefineDataLoaderOptionsBase, DefineLoaderFn, DataLoaderContextBase, UseDataLoaderResult, UseDataLoader, _PromiseMerged, NavigationResult, DataLoaderEntryBase } from 'unplugin-vue-router/runtime'; import { ShallowRef } from 'vue'; import { UseQueryOptions, EntryKey, UseQueryReturn } from '@pinia/colada'; /** * Creates a data loader composable that can be exported by pages to attach the data loading to a route. This returns a * composable that can be used in any component. * * The returned composable exposes a mix of Data Loaders state and Pinia * Colada state. * - `data`, `isLoading`, `error` are navigation dependent and follow data loaders behavior. * - `status`, `asyncStatus`, `state` are Pinia Colada state and will immediately change and reflect the state of the * query. * * @experimental * Still under development and subject to change. See https://github.com/vuejs/rfcs/discussions/460 * * @param name - name of the route to have typed routes * @param loader - function that returns a promise with the data * @param options - options to configure the data loader */ declare function defineColadaLoader(name: Name, options: DefineDataColadaLoaderOptions): UseDataLoaderColada; declare function defineColadaLoader(options: DefineDataColadaLoaderOptions): UseDataLoaderColada; interface DefineDataColadaLoaderOptions extends DefineDataLoaderOptionsBase, Omit, 'query' | 'key'> { /** * Key associated with the data and passed to pinia colada * @param to - Route to load the data */ key: EntryKey | ((to: RouteLocationNormalizedLoaded) => EntryKey); /** * Function that returns a promise with the data. */ query: DefineLoaderFn>; } /** * @internal */ interface DataColadaLoaderContext extends DataLoaderContextBase { } interface UseDataLoaderColadaResult extends UseDataLoaderResult, Pick, 'isPending' | 'refetch' | 'refresh' | 'status' | 'asyncStatus' | 'state'> { } /** * Data Loader composable returned by `defineColadaLoader()`. */ interface UseDataLoaderColada extends UseDataLoader { /** * Data Loader composable returned by `defineColadaLoader()`. * * @example * Returns the Data loader data, isLoading, error etc. Meant to be used in `setup()` or ` * ``` * * @example * It also returns a promise of the data when used in nested loaders. Note this `data` is **not a ref**. This is not meant to be used in `setup()` or `