index.d.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import { AllowedComponentProps } from 'vue';
  2. import { App } from 'vue';
  3. import { Component } from 'vue';
  4. import { ComponentCustomProps } from 'vue';
  5. import { ComponentOptions } from 'vue';
  6. import { ComponentOptionsMixin } from 'vue';
  7. import { DefineComponent } from 'vue';
  8. import { EmitsOptions } from 'vue';
  9. import { ExtractPropTypes } from 'vue';
  10. import { Ref } from 'vue';
  11. import { RendererElement } from 'vue';
  12. import { RendererNode } from 'vue';
  13. import { VNode } from 'vue';
  14. import { VNodeProps } from 'vue';
  15. export declare const Content: DefineComponent< {}, () => VNode<RendererNode, RendererElement, {
  16. [key: string]: any;
  17. }>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, EmitsOptions, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes< {}>>, {}>;
  18. export declare const Debug: ComponentOptions<{}, any, any, any, any, any, any, any>;
  19. export declare interface EnhanceAppContext {
  20. app: App;
  21. router: Router;
  22. siteData: Ref<SiteData>;
  23. }
  24. export declare type HeadConfig =
  25. | [string, Record<string, string>]
  26. | [string, Record<string, string>, string]
  27. export declare interface Header {
  28. level: number
  29. title: string
  30. slug: string
  31. }
  32. export declare const inBrowser: boolean;
  33. export declare interface LocaleConfig {
  34. lang: string
  35. title?: string
  36. description?: string
  37. head?: HeadConfig[]
  38. label?: string
  39. selectText?: string
  40. }
  41. export declare interface PageData {
  42. relativePath: string
  43. title: string
  44. description: string
  45. headers: Header[]
  46. frontmatter: Record<string, any>
  47. lastUpdated?: number
  48. }
  49. export declare interface Route {
  50. path: string;
  51. data: PageData;
  52. component: Component | null;
  53. }
  54. export declare interface Router {
  55. route: Route;
  56. go: (href?: string) => Promise<void>;
  57. }
  58. export declare interface SiteData<ThemeConfig = any> {
  59. base: string
  60. /**
  61. * Language of the site as it should be set on the `html` element.
  62. * @example `en-US`, `zh-CN`
  63. */
  64. lang: string
  65. title: string
  66. description: string
  67. head: HeadConfig[]
  68. themeConfig: ThemeConfig
  69. scrollOffset: number | string
  70. locales: Record<string, LocaleConfig>
  71. /**
  72. * Available locales for the site when it has defined `locales` in its
  73. * `themeConfig`. This object is otherwise empty. Keys are paths like `/` or
  74. * `/zh/`.
  75. */
  76. langs: Record<
  77. string,
  78. {
  79. /**
  80. * Lang attribute as set on the `<html>` element.
  81. * @example `en-US`, `zh-CN`
  82. */
  83. lang: string
  84. /**
  85. * Label to display in the language menu.
  86. * @example `English`, `简体中文`
  87. */
  88. label: string
  89. }
  90. >
  91. }
  92. export declare interface Theme {
  93. Layout: Component;
  94. NotFound?: Component;
  95. enhanceApp?: (ctx: EnhanceAppContext) => void;
  96. }
  97. export declare function useData<T = any>(): VitePressData<T>;
  98. export declare function useRoute(): Route;
  99. export declare function useRouter(): Router;
  100. export declare interface VitePressData<T = any> {
  101. site: Ref<SiteData<T>>;
  102. page: Ref<PageData>;
  103. theme: Ref<T>;
  104. frontmatter: Ref<PageData['frontmatter']>;
  105. title: Ref<string>;
  106. description: Ref<string>;
  107. lang: Ref<string>;
  108. localePath: Ref<string>;
  109. }
  110. export declare function withBase(path: string): string;
  111. export { }