config.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. export namespace DefaultTheme {
  2. export interface Config {
  3. logo?: string
  4. nav?: NavItem[] | false
  5. sidebar?: SideBarConfig | MultiSideBarConfig
  6. /**
  7. * GitHub repository following the format <user>/<project>.
  8. *
  9. * @example `"vuejs/vue-next"`
  10. */
  11. repo?: string
  12. /**
  13. * Customize the header label. Defaults to GitHub/Gitlab/Bitbucket
  14. * depending on the provided repo.
  15. *
  16. * @example `"Contribute!"`
  17. */
  18. repoLabel?: string
  19. /**
  20. * If your docs are in a different repository from your main project.
  21. *
  22. * @example `"vuejs/docs-next"`
  23. */
  24. docsRepo?: string
  25. /**
  26. * If your docs are not at the root of the repo.
  27. *
  28. * @example `"docs"`
  29. */
  30. docsDir?: string
  31. /**
  32. * If your docs are in a different branch. Defaults to `master`.
  33. *
  34. * @example `"next"`
  35. */
  36. docsBranch?: string
  37. /**
  38. * Enable links to edit pages at the bottom of the page.
  39. */
  40. editLinks?: boolean
  41. /**
  42. * Custom text for edit link. Defaults to "Edit this page".
  43. */
  44. editLinkText?: string
  45. /**
  46. * Show last updated time at the bottom of the page. Defaults to `false`.
  47. * If given a string, it will be displayed as a prefix (default value:
  48. * "Last Updated").
  49. */
  50. lastUpdated?: string | boolean
  51. prevLinks?: boolean
  52. nextLinks?: boolean
  53. locales?: Record<string, LocaleConfig & Omit<Config, 'locales'>>
  54. algolia?: AlgoliaSearchOptions
  55. carbonAds?: {
  56. carbon: string
  57. custom?: string
  58. placement: string
  59. }
  60. }
  61. // navbar --------------------------------------------------------------------
  62. export type NavItem = NavItemWithLink | NavItemWithChildren
  63. export interface NavItemBase {
  64. text: string
  65. target?: string
  66. rel?: string
  67. ariaLabel?: string
  68. activeMatch?: string
  69. }
  70. export interface NavItemWithLink extends NavItemBase {
  71. link: string
  72. }
  73. export interface NavItemWithChildren extends NavItemBase {
  74. items: NavItemWithLink[]
  75. }
  76. // sidebar -------------------------------------------------------------------
  77. export type SideBarConfig = SideBarItem[] | 'auto' | false
  78. export interface MultiSideBarConfig {
  79. [path: string]: SideBarConfig
  80. }
  81. export type SideBarItem = SideBarLink | SideBarGroup
  82. export interface SideBarLink {
  83. text: string
  84. link: string
  85. }
  86. export interface SideBarGroup {
  87. text: string
  88. link?: string
  89. /**
  90. * @default false
  91. */
  92. collapsable?: boolean
  93. children: SideBarItem[]
  94. }
  95. // algolia ------------------------------------------------------------------
  96. // partially copied from @docsearch/react/dist/esm/DocSearch.d.ts
  97. export interface AlgoliaSearchOptions {
  98. appId?: string
  99. apiKey: string
  100. indexName: string
  101. placeholder?: string
  102. searchParameters?: any
  103. disableUserPersonalization?: boolean
  104. initialQuery?: string
  105. }
  106. // locales -------------------------------------------------------------------
  107. export interface LocaleConfig {
  108. /**
  109. * Text for the language dropdown.
  110. */
  111. selectText?: string
  112. /**
  113. * Label for this locale in the language dropdown.
  114. */
  115. label?: string
  116. }
  117. }