import { ImportString, PageContext } from 'vike/types'; import { TagAttributes } from '../utils/getTagAttributesString'; import { Viewport } from '../integration/onRenderHtml'; import { ConfigsCumulative } from '../hooks/useConfig/configsCumulative'; import { Component } from './PageContext'; import { OnCreateAppSync, OnCreateAppAsync, OnBeforeRenderHtmlSync, OnBeforeRenderHtmlAsync, OnAfterRenderHtmlSync, OnAfterRenderHtmlAsync, OnBeforeRenderClientSync, OnBeforeRenderClientAsync } from './VikeHooks'; declare global { namespace Vike { interface Config { /** * Add arbitrary `` tags. * * https://vike.dev/Head */ Head?: Component; /** * A component that defines the visual layout common to several pages. * * Technically: the `` component wraps the root component ``. * * https://vike.dev/Layout */ Layout?: Component; /** * Set the page's tilte. * * Generates: * ```jsx * * {title} * * * ``` * * https://vike.dev/title */ title?: string | null | ((pageContext: PageContext_) => string | null | undefined); /** * Set the page's description. * * Generates: * ```jsx * * * * * ``` * * https://vike.dev/description */ description?: string | null | ((pageContext: PageContextServer) => string | null | undefined); /** * Set the page's preview image upon URL sharing. * * Generates: * ```jsx * * * * * ``` * * https://vike.dev/image */ image?: string | null | ((pageContext: PageContextServer) => string | null | undefined); /** * Set the page's width shown to the user on mobile/tablet devices. * * @default "responsive" * * https://vike.dev/viewport */ viewport?: Viewport | ((pageContext: PageContextServer) => Viewport | undefined); /** * Set the page's favicon. * * Generates: * ```jsx * * * * ``` * * https://vike.dev/favicon */ favicon?: string | null | ((pageContext: PageContextServer) => string | null | undefined); /** * Set the page's language (``). * * @default 'en' * * https://vike.dev/lang */ lang?: string | null | ((pageContext: PageContext_) => string | null | undefined); /** * Add tag attributes such as ``. * * https://vike.dev/htmlAttributes */ htmlAttributes?: TagAttributes | ((pageContext: PageContextServer) => TagAttributes | undefined); /** * Add tag attributes such as ``. * * https://vike.dev/bodyAttributes */ bodyAttributes?: TagAttributes | ((pageContext: PageContextServer) => TagAttributes | undefined); /** * If `true`, the page is rendered twice: on the server-side (to HTML) and on the client-side (hydration). * * If `false`, the page is rendered only once in the browser. * * @default true * * https://vike.dev/ssr */ ssr?: boolean; /** * Settings for HTML Streaming. * * https://vike.dev/stream */ stream?: boolean | 'node' | 'web' | { /** * Whether the HTML stream should be a Web Stream or a Node.js Stream. * * https://vike.dev/stream */ type?: 'node' | 'web'; /** * Setting +stream to `{ enable: null }` is the same as not setting +stream at all. * * Useful for changing stream settings without enabling streaming. For example, Vike extensions can set +stream to `{ enable: null, type: 'web' }` to change the default stream type without enabling streaming. * * https://vike.dev/stream */ enable?: boolean | null; }; /** * The page's root Vue component. * * https://vike.dev/Page */ Page?: Component; /** * Raw HTML injected at the start of ``. * * https://vike.dev/bodyHtmlBegin */ bodyHtmlBegin?: BodyHtmlBoundary; /** * Raw HTML injected at the end of ``. * * @default `
` * * https://vike.dev/bodyHtmlEnd */ bodyHtmlEnd?: BodyHtmlBoundary; /** * Hook called right after creating Vue's `app` instance. * * Typically used for registering Vue plugins. * * https://vike.dev/onCreateApp */ onCreateApp?: OnCreateAppSync | OnCreateAppAsync | ImportString; /** * Hook called right before rendering the page's root Vue component to HTML. * * https://vike.dev/onBeforeRenderHtml */ onBeforeRenderHtml?: OnBeforeRenderHtmlSync | OnBeforeRenderHtmlAsync | ImportString; /** * Hook called right after rendering the page's root Vue component to HTML. * * https://vike.dev/onAfterRenderHtml */ onAfterRenderHtml?: OnAfterRenderHtmlSync | OnAfterRenderHtmlAsync | ImportString; /** * Hook called right before mounting the page's root Vue component. * * Typically used for hydrating state management libraries. * * https://vike.dev/onBeforeRenderClient */ onBeforeRenderClient?: OnBeforeRenderClientSync | OnBeforeRenderClientAsync | ImportString; /** * Client-side hook called after the page is rendered. * * https://vike.dev/onAfterRenderClient */ onAfterRenderClient?: (pageContext: PageContextClient) => void; } interface ConfigResolved { onCreateApp?: Array; onBeforeRenderHtml?: Array; onAfterRenderHtml?: Array; onBeforeRenderClient?: Array; onAfterRenderClient?: Function[]; bodyHtmlBegin?: BodyHtmlBoundary[]; bodyHtmlEnd?: BodyHtmlBoundary[]; Layout?: Component[]; Head?: Component[]; bodyAttributes?: TagAttributes[]; htmlAttributes?: TagAttributes[]; stream?: Exclude[]; } } } export type __FakeExport_Config = never; type PageContext_ = PageContext; type BodyHtmlBoundary = string | ((pageContext: PageContext) => string); type PickWithoutGetter = { [P in K]: Exclude; }; export declare const configsFromHook: readonly ["Head", "title", "description", "image", "favicon", "lang", "viewport", "bodyAttributes", "htmlAttributes"]; type ConfigsFromHook = (typeof configsFromHook)[number]; export type ConfigFromHook = PickWithoutGetter; export type ConfigFromHookResolved = Omit & Pick; export {};