import { MakeSerializableObject } from "../../pages/runtime/utils.js"; import { NuxtLayouts } from "../../pages/runtime/composables.js"; import { NuxtError } from "../error.js"; import "./error.js"; import { NavigationFailure, NavigationGuard, RouteLocationNormalized, RouteLocationRaw, Router, useRoute as useRoute$1, useRouter as useRouter$1 } from "vue-router"; //#region src/app/composables/router.d.ts /** * Augmented by Nuxt when `experimental.early404` is enabled, to remove router methods * that are incompatible with it from the router returned by `useRouter`. Dynamically * added routes cannot be known at build time, so requests to them would incorrectly * receive an early 404 response. */ export interface Early404IncompatibleRouterMethods {} type NuxtUseRouter = keyof Early404IncompatibleRouterMethods extends never ? typeof useRouter$1 : () => Router & { [K in keyof Early404IncompatibleRouterMethods & keyof Router]: never; }; /** @since 3.0.0 */ export declare const useRouter: NuxtUseRouter; /** @since 3.0.0 */ export declare const useRoute: typeof useRoute$1; /** @since 3.0.0 */ export declare const onBeforeRouteLeave: (guard: NavigationGuard) => void; /** @since 3.0.0 */ export declare const onBeforeRouteUpdate: (guard: NavigationGuard) => void; export interface RouteMiddleware { (to: RouteLocationNormalized, from: RouteLocationNormalized): ReturnType; } /** @since 3.0.0 */ export declare function defineNuxtRouteMiddleware(middleware: RouteMiddleware): RouteMiddleware; export interface AddRouteMiddlewareOptions { global?: boolean; } interface AddRouteMiddleware { (name: string, middleware: RouteMiddleware, options?: AddRouteMiddlewareOptions): void; (middleware: RouteMiddleware): void; } /** @since 3.0.0 */ export declare const addRouteMiddleware: AddRouteMiddleware; type Without = { [P in Exclude]?: never; }; type XOR = (T | U) extends object ? (Without & U) | (Without & T) : T | U; export type OpenWindowFeatures = { popup?: boolean; noopener?: boolean; noreferrer?: boolean; } & XOR<{ width?: number; }, { innerWidth?: number; }> & XOR<{ height?: number; }, { innerHeight?: number; }> & XOR<{ left?: number; }, { screenX?: number; }> & XOR<{ top?: number; }, { screenY?: number; }>; export type OpenOptions = { target?: '_blank' | '_parent' | '_self' | '_top' | (string & {}); windowFeatures?: OpenWindowFeatures; }; export interface NavigateToOptions { /** * Whether or not the given route should replace the current route in the navigation history, rather than push it. */ replace?: boolean; /** * The status code to emit with the navigation. Defaults to `302 Found` when used on server side redirects. */ redirectCode?: number; /** * Whether or not the given route is a website/resource from a different origin. By default, navigating to external resources without setting `external: true` would result in an error. */ external?: boolean; open?: OpenOptions; } /** * A helper that aids in programmatic navigation within your Nuxt application. * * Can be called on the server and on the client, within pages, route middleware, plugins, and more. * @param {RouteLocationRaw | undefined | null} [to] - The route to navigate to. Accepts a route object, string path, `undefined`, or `null`. Defaults to '/'. * @param {NavigateToOptions} [options] - Optional customization for controlling the behavior of the navigation. * @returns {Promise | false | void | RouteLocationRaw} The navigation result, which varies depending on context and options. * @see https://nuxt.com/docs/4.x/api/utils/navigate-to * @since 3.0.0 */ export declare const navigateTo: (to: RouteLocationRaw | undefined | null, options?: NavigateToOptions) => Promise | false | void | RouteLocationRaw; /** * Produces the render function returned from `setup()` when * `experimental.navigateToEarlyReturn` short-circuits after a successful navigation. * * The returned function renders a placeholder comment both as a client render function * and as an inline `ssrRender` (where it is called with a `push` function). On the server * it is also assigned to `instance.ssrRender`, because the server renderer prefers the * component's compiled `ssrRender` over a render function returned from `setup()`, and the * compiled template must not run against the empty setup state left by the early return. * @internal */ export declare function _navigateToEarlyReturn(): (_ctx?: unknown, push?: unknown) => null | undefined; /** * This will abort navigation within a Nuxt route middleware handler. * @since 3.0.0 */ export declare const abortNavigation: (err?: string | Partial) => boolean; /** * Sets the layout for the current page. * @since 3.0.0 */ export declare const setPageLayout: (layout: unknown extends Layout ? string | false : Layout, props?: Layout extends keyof NuxtLayouts ? MakeSerializableObject : never) => void; /** * @internal */ export declare function resolveRouteObject(to: Exclude): string; /** * @internal */ export declare function encodeURL(location: string, isExternalHost?: boolean): string; /** * Encode the pathname of a route location string. Ensures decoded paths like * `/café` are percent-encoded to match vue-router's encoded route records. * Already-encoded paths are not double-encoded. * @internal */ export declare function encodeRoutePath(url: string): string; //#endregion export {};