@docusaurus/theme-classic 2.0.0-beta.17 → 2.0.0-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/lib/getSwizzleConfig.js +113 -2
  2. package/lib/index.js +7 -12
  3. package/lib/theme-classic.d.ts +286 -60
  4. package/lib/translations.js +12 -2
  5. package/lib/validateThemeConfig.js +1 -1
  6. package/lib-next/theme/BackToTopButton/index.js +1 -3
  7. package/lib-next/theme/BlogArchivePage/index.js +14 -10
  8. package/lib-next/theme/BlogListPage/index.js +34 -13
  9. package/lib-next/theme/BlogPostItem/index.js +6 -6
  10. package/lib-next/theme/BlogPostPage/index.js +56 -45
  11. package/lib-next/theme/BlogTagsListPage/index.js +16 -12
  12. package/lib-next/theme/BlogTagsPostsPage/index.js +40 -33
  13. package/lib-next/theme/CodeBlock/CopyButton/index.js +60 -0
  14. package/lib-next/theme/CodeBlock/CopyButton/styles.module.css +66 -0
  15. package/lib-next/theme/CodeBlock/index.js +4 -36
  16. package/lib-next/theme/CodeBlock/styles.module.css +2 -22
  17. package/lib-next/theme/ColorModeToggle/index.js +36 -57
  18. package/lib-next/theme/ColorModeToggle/styles.module.css +8 -24
  19. package/lib-next/theme/DocBreadcrumbs/index.js +28 -11
  20. package/lib-next/theme/DocBreadcrumbs/styles.module.css +2 -17
  21. package/lib-next/theme/DocCard/index.js +17 -15
  22. package/lib-next/theme/DocCard/styles.module.css +8 -17
  23. package/lib-next/theme/DocCardList/index.js +15 -3
  24. package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +27 -6
  25. package/lib-next/theme/DocItem/index.js +84 -66
  26. package/lib-next/theme/DocPage/index.js +88 -89
  27. package/lib-next/theme/DocPage/styles.module.css +0 -4
  28. package/lib-next/theme/DocSidebar/Desktop/CollapseButton/index.js +34 -0
  29. package/lib-next/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
  30. package/lib-next/theme/DocSidebar/Desktop/Content/index.js +46 -0
  31. package/lib-next/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
  32. package/lib-next/theme/DocSidebar/Desktop/index.js +34 -0
  33. package/lib-next/theme/DocSidebar/Desktop/styles.module.css +50 -0
  34. package/lib-next/theme/DocSidebar/Mobile/index.js +49 -0
  35. package/lib-next/theme/DocSidebar/index.js +6 -113
  36. package/lib-next/theme/DocSidebarItem/index.js +14 -13
  37. package/lib-next/theme/DocSidebarItem/styles.module.css +4 -0
  38. package/lib-next/theme/DocTagDocListPage/index.js +38 -31
  39. package/lib-next/theme/DocTagsListPage/index.js +21 -16
  40. package/lib-next/theme/Footer/Copyright/index.js +18 -0
  41. package/lib-next/theme/Footer/Layout/index.js +26 -0
  42. package/lib-next/theme/Footer/LinkItem/index.js +33 -0
  43. package/lib-next/theme/Footer/Links/MultiColumn/index.js +47 -0
  44. package/lib-next/theme/Footer/Links/Simple/index.js +41 -0
  45. package/lib-next/theme/Footer/Links/index.js +17 -0
  46. package/lib-next/theme/Footer/Logo/index.js +38 -0
  47. package/lib-next/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
  48. package/lib-next/theme/Footer/index.js +11 -163
  49. package/lib-next/theme/Heading/index.js +6 -4
  50. package/lib-next/theme/IconExternalLink/styles.module.css +0 -2
  51. package/lib-next/theme/Layout/index.js +15 -10
  52. package/lib-next/theme/LayoutProviders/index.js +5 -4
  53. package/lib-next/theme/MDXComponents/A.js +11 -0
  54. package/lib-next/theme/MDXComponents/Code.js +28 -0
  55. package/lib-next/theme/MDXComponents/Details.js +20 -0
  56. package/lib-next/theme/MDXComponents/Head.js +26 -0
  57. package/lib-next/theme/MDXComponents/Heading.js +11 -0
  58. package/lib-next/theme/MDXComponents/Img.js +24 -0
  59. package/lib-next/theme/MDXComponents/Img.module.css +10 -0
  60. package/lib-next/theme/MDXComponents/Pre.js +18 -0
  61. package/lib-next/theme/MDXComponents/Ul.js +23 -0
  62. package/{src/theme/MDXComponents/styles.css → lib-next/theme/MDXComponents/Ul.module.css} +1 -5
  63. package/lib-next/theme/MDXComponents/index.js +22 -71
  64. package/lib-next/theme/MDXContent/index.js +12 -0
  65. package/lib-next/theme/MDXPage/index.js +33 -28
  66. package/lib-next/theme/Navbar/ColorModeToggle/index.js +25 -0
  67. package/lib-next/theme/Navbar/Content/index.js +70 -0
  68. package/lib-next/theme/Navbar/Content/styles.module.css +15 -0
  69. package/lib-next/theme/Navbar/Layout/index.js +54 -0
  70. package/{src/theme/Navbar → lib-next/theme/Navbar/Layout}/styles.module.css +0 -13
  71. package/lib-next/theme/Navbar/Logo/index.js +17 -0
  72. package/lib-next/theme/Navbar/MobileSidebar/Header/index.js +33 -0
  73. package/lib-next/theme/Navbar/MobileSidebar/Layout/index.js +28 -0
  74. package/lib-next/theme/Navbar/MobileSidebar/PrimaryMenu/index.js +33 -0
  75. package/lib-next/theme/Navbar/MobileSidebar/SecondaryMenu/index.js +36 -0
  76. package/lib-next/theme/Navbar/MobileSidebar/Toggle/index.js +23 -0
  77. package/lib-next/theme/Navbar/MobileSidebar/index.js +31 -0
  78. package/lib-next/theme/Navbar/index.js +6 -271
  79. package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +2 -6
  80. package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +10 -2
  81. package/lib-next/theme/NavbarItem/NavbarNavLink.js +8 -12
  82. package/lib-next/theme/NotFound.js +38 -33
  83. package/lib-next/theme/{LayoutHead → SiteMetadata}/index.js +11 -26
  84. package/lib-next/theme/TOCCollapsible/index.js +1 -3
  85. package/lib-next/theme/Tabs/__tests__/index.test.js +5 -5
  86. package/lib-next/theme/Tabs/index.js +2 -2
  87. package/lib-next/theme/Tag/index.js +4 -4
  88. package/lib-next/theme/ThemedImage/index.js +3 -3
  89. package/package.json +17 -17
  90. package/src/getSwizzleConfig.ts +122 -1
  91. package/src/index.ts +10 -12
  92. package/src/theme/BackToTopButton/index.tsx +1 -3
  93. package/src/theme/BlogArchivePage/index.tsx +18 -17
  94. package/src/theme/BlogLayout/index.tsx +1 -1
  95. package/src/theme/BlogListPage/index.tsx +32 -13
  96. package/src/theme/BlogPostItem/index.tsx +6 -6
  97. package/src/theme/BlogPostPage/index.tsx +55 -48
  98. package/src/theme/BlogTagsListPage/index.tsx +16 -12
  99. package/src/theme/BlogTagsPostsPage/index.tsx +39 -32
  100. package/src/theme/CodeBlock/CopyButton/index.tsx +66 -0
  101. package/src/theme/CodeBlock/CopyButton/styles.module.css +66 -0
  102. package/src/theme/CodeBlock/index.tsx +6 -38
  103. package/src/theme/CodeBlock/styles.module.css +2 -22
  104. package/src/theme/ColorModeToggle/index.tsx +36 -61
  105. package/src/theme/ColorModeToggle/styles.module.css +8 -24
  106. package/src/theme/DocBreadcrumbs/index.tsx +29 -10
  107. package/src/theme/DocBreadcrumbs/styles.module.css +2 -17
  108. package/src/theme/DocCard/index.tsx +24 -17
  109. package/src/theme/DocCard/styles.module.css +8 -17
  110. package/src/theme/DocCardList/index.tsx +14 -3
  111. package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +31 -4
  112. package/src/theme/DocItem/index.tsx +71 -55
  113. package/src/theme/DocPage/index.tsx +89 -90
  114. package/src/theme/DocPage/styles.module.css +0 -4
  115. package/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +38 -0
  116. package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
  117. package/src/theme/DocSidebar/Desktop/Content/index.tsx +55 -0
  118. package/src/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
  119. package/src/theme/DocSidebar/Desktop/index.tsx +38 -0
  120. package/src/theme/DocSidebar/Desktop/styles.module.css +50 -0
  121. package/src/theme/DocSidebar/Mobile/index.tsx +54 -0
  122. package/src/theme/DocSidebar/index.tsx +6 -121
  123. package/src/theme/DocSidebarItem/index.tsx +15 -16
  124. package/src/theme/DocSidebarItem/styles.module.css +4 -0
  125. package/src/theme/DocTagDocListPage/index.tsx +38 -30
  126. package/src/theme/DocTagsListPage/index.tsx +21 -16
  127. package/src/theme/DocVersionBanner/index.tsx +3 -4
  128. package/src/theme/Footer/Copyright/index.tsx +20 -0
  129. package/src/theme/Footer/Layout/index.tsx +34 -0
  130. package/src/theme/Footer/LinkItem/index.tsx +36 -0
  131. package/src/theme/Footer/Links/MultiColumn/index.tsx +51 -0
  132. package/src/theme/Footer/Links/Simple/index.tsx +42 -0
  133. package/src/theme/Footer/Links/index.tsx +21 -0
  134. package/src/theme/Footer/Logo/index.tsx +41 -0
  135. package/src/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
  136. package/src/theme/Footer/index.tsx +12 -186
  137. package/src/theme/Heading/index.tsx +6 -4
  138. package/src/theme/IconExternalLink/styles.module.css +0 -2
  139. package/src/theme/Layout/index.tsx +15 -10
  140. package/src/theme/LayoutProviders/index.tsx +5 -4
  141. package/src/theme/MDXComponents/A.tsx +14 -0
  142. package/src/theme/MDXComponents/Code.tsx +37 -0
  143. package/src/theme/MDXComponents/Details.tsx +26 -0
  144. package/src/theme/MDXComponents/Head.tsx +29 -0
  145. package/src/theme/MDXComponents/Heading.tsx +14 -0
  146. package/src/theme/MDXComponents/Img.module.css +10 -0
  147. package/src/theme/MDXComponents/Img.tsx +26 -0
  148. package/src/theme/MDXComponents/Pre.tsx +22 -0
  149. package/{lib-next/theme/MDXComponents/styles.css → src/theme/MDXComponents/Ul.module.css} +1 -5
  150. package/src/theme/MDXComponents/Ul.tsx +28 -0
  151. package/src/theme/MDXComponents/index.tsx +23 -80
  152. package/src/theme/MDXContent/index.tsx +15 -0
  153. package/src/theme/MDXPage/index.tsx +33 -28
  154. package/src/theme/Navbar/ColorModeToggle/index.tsx +30 -0
  155. package/src/theme/Navbar/Content/index.tsx +81 -0
  156. package/src/theme/Navbar/Content/styles.module.css +15 -0
  157. package/src/theme/Navbar/Layout/index.tsx +57 -0
  158. package/{lib-next/theme/Navbar → src/theme/Navbar/Layout}/styles.module.css +0 -13
  159. package/src/theme/Navbar/Logo/index.tsx +19 -0
  160. package/src/theme/Navbar/MobileSidebar/Header/index.tsx +34 -0
  161. package/src/theme/Navbar/MobileSidebar/Layout/index.tsx +31 -0
  162. package/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx +38 -0
  163. package/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx +38 -0
  164. package/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +25 -0
  165. package/src/theme/Navbar/MobileSidebar/index.tsx +33 -0
  166. package/src/theme/Navbar/index.tsx +6 -286
  167. package/src/theme/NavbarItem/DefaultNavbarItem.tsx +2 -2
  168. package/src/theme/NavbarItem/DropdownNavbarItem.tsx +11 -2
  169. package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +1 -1
  170. package/src/theme/NavbarItem/NavbarNavLink.tsx +3 -7
  171. package/src/theme/NavbarItem/index.tsx +3 -4
  172. package/src/theme/NotFound.tsx +38 -33
  173. package/src/theme/{LayoutHead → SiteMetadata}/index.tsx +11 -25
  174. package/src/theme/TOCCollapsible/index.tsx +1 -3
  175. package/src/theme/Tabs/index.tsx +5 -6
  176. package/src/theme/Tag/index.tsx +4 -4
  177. package/src/theme/ThemedImage/index.tsx +4 -3
  178. package/src/theme-classic.d.ts +286 -60
  179. package/src/translations.ts +12 -6
  180. package/src/validateThemeConfig.ts +6 -6
  181. package/lib-next/theme/DocSidebar/styles.module.css +0 -107
  182. package/lib-next/theme/Seo/index.js +0 -40
  183. package/src/theme/DocSidebar/styles.module.css +0 -107
  184. package/src/theme/Seo/index.tsx +0 -49
@@ -41,11 +41,7 @@ declare module '@theme/BlogListPaginator' {
41
41
  }
42
42
 
43
43
  declare module '@theme/BlogSidebar' {
44
- export type BlogSidebarItem = {title: string; permalink: string};
45
- export type BlogSidebar = {
46
- title: string;
47
- items: BlogSidebarItem[];
48
- };
44
+ import type {BlogSidebar} from '@docusaurus/plugin-content-blog';
49
45
 
50
46
  export interface Props {
51
47
  readonly sidebar: BlogSidebar;
@@ -106,7 +102,7 @@ declare module '@theme/BlogPostPaginator' {
106
102
  declare module '@theme/BlogLayout' {
107
103
  import type {ReactNode} from 'react';
108
104
  import type {Props as LayoutProps} from '@theme/Layout';
109
- import type {BlogSidebar} from '@theme/BlogSidebar';
105
+ import type {BlogSidebar} from '@docusaurus/plugin-content-blog';
110
106
 
111
107
  export interface Props extends LayoutProps {
112
108
  readonly sidebar?: BlogSidebar;
@@ -130,6 +126,14 @@ declare module '@theme/CodeBlock' {
130
126
  export default function CodeBlock(props: Props): JSX.Element;
131
127
  }
132
128
 
129
+ declare module '@theme/CodeBlock/CopyButton' {
130
+ export interface Props {
131
+ readonly code: string;
132
+ }
133
+
134
+ export default function CopyButton(props: Props): JSX.Element;
135
+ }
136
+
133
137
  declare module '@theme/DocCard' {
134
138
  import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
135
139
 
@@ -180,6 +184,42 @@ declare module '@theme/DocSidebar' {
180
184
  export default function DocSidebar(props: Props): JSX.Element;
181
185
  }
182
186
 
187
+ declare module '@theme/DocSidebar/Mobile' {
188
+ import type {Props as DocSidebarProps} from '@theme/DocSidebar';
189
+
190
+ export interface Props extends DocSidebarProps {}
191
+
192
+ export default function DocSidebarMobile(props: Props): JSX.Element;
193
+ }
194
+
195
+ declare module '@theme/DocSidebar/Desktop' {
196
+ import type {Props as DocSidebarProps} from '@theme/DocSidebar';
197
+
198
+ export interface Props extends DocSidebarProps {}
199
+
200
+ export default function DocSidebarDesktop(props: Props): JSX.Element;
201
+ }
202
+
203
+ declare module '@theme/DocSidebar/Desktop/Content' {
204
+ import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
205
+
206
+ export interface Props {
207
+ readonly className?: string;
208
+ readonly path: string;
209
+ readonly sidebar: readonly PropSidebarItem[];
210
+ }
211
+
212
+ export default function Content(props: Props): JSX.Element;
213
+ }
214
+
215
+ declare module '@theme/DocSidebar/Desktop/CollapseButton' {
216
+ export interface Props {
217
+ onClick: React.MouseEventHandler;
218
+ }
219
+
220
+ export default function CollapseButton(props: Props): JSX.Element;
221
+ }
222
+
183
223
  declare module '@theme/DocSidebarItem' {
184
224
  import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
185
225
 
@@ -244,6 +284,77 @@ declare module '@theme/Footer' {
244
284
  export default function Footer(): JSX.Element | null;
245
285
  }
246
286
 
287
+ declare module '@theme/Footer/Logo' {
288
+ import type {FooterLogo} from '@docusaurus/theme-common';
289
+
290
+ export interface Props {
291
+ logo: FooterLogo;
292
+ }
293
+
294
+ export default function FooterLogo(props: Props): JSX.Element;
295
+ }
296
+
297
+ declare module '@theme/Footer/Copyright' {
298
+ export interface Props {
299
+ copyright: string;
300
+ }
301
+
302
+ export default function FooterCopyright(props: Props): JSX.Element;
303
+ }
304
+
305
+ declare module '@theme/Footer/LinkItem' {
306
+ import type {FooterLinkItem} from '@docusaurus/theme-common';
307
+
308
+ export interface Props {
309
+ item: FooterLinkItem;
310
+ }
311
+
312
+ export default function FooterLinkItem(props: Props): JSX.Element;
313
+ }
314
+
315
+ declare module '@theme/Footer/Layout' {
316
+ import type {ReactNode} from 'react';
317
+
318
+ export interface Props {
319
+ style: 'light' | 'dark';
320
+ links: ReactNode;
321
+ logo: ReactNode;
322
+ copyright: ReactNode;
323
+ }
324
+
325
+ export default function FooterLayout(props: Props): JSX.Element;
326
+ }
327
+
328
+ declare module '@theme/Footer/Links' {
329
+ import type {Footer} from '@docusaurus/theme-common';
330
+
331
+ export interface Props {
332
+ links: Footer['links'];
333
+ }
334
+
335
+ export default function FooterLinks(props: Props): JSX.Element;
336
+ }
337
+
338
+ declare module '@theme/Footer/Links/MultiColumn' {
339
+ import type {MultiColumnFooter} from '@docusaurus/theme-common';
340
+
341
+ export interface Props {
342
+ columns: MultiColumnFooter['links'];
343
+ }
344
+
345
+ export default function FooterLinksMultiColumn(props: Props): JSX.Element;
346
+ }
347
+
348
+ declare module '@theme/Footer/Links/Simple' {
349
+ import type {SimpleFooter} from '@docusaurus/theme-common';
350
+
351
+ export interface Props {
352
+ links: SimpleFooter['links'];
353
+ }
354
+
355
+ export default function FooterLinksSimple(props: Props): JSX.Element;
356
+ }
357
+
247
358
  declare module '@theme/Heading' {
248
359
  import type {ComponentProps} from 'react';
249
360
 
@@ -261,31 +372,17 @@ declare module '@theme/Layout' {
261
372
 
262
373
  export interface Props {
263
374
  readonly children?: ReactNode;
264
- readonly title?: string;
265
375
  readonly noFooter?: boolean;
266
- readonly description?: string;
267
- readonly image?: string;
268
- readonly keywords?: string | string[];
269
- readonly permalink?: string;
270
376
  readonly wrapperClassName?: string;
271
- readonly pageClassName?: string;
272
- readonly searchMetadata?: {
273
- readonly version?: string;
274
- readonly tag?: string;
275
- };
377
+
378
+ // Not really layout-related, but kept for convenience/retro-compatibility
379
+ readonly title?: string;
380
+ readonly description?: string;
276
381
  }
277
382
 
278
383
  export default function Layout(props: Props): JSX.Element;
279
384
  }
280
385
 
281
- declare module '@theme/LayoutHead' {
282
- import type {Props as LayoutProps} from '@theme/Layout';
283
-
284
- export interface Props extends Omit<LayoutProps, 'children'> {}
285
-
286
- export default function LayoutHead(props: Props): JSX.Element;
287
- }
288
-
289
386
  declare module '@theme/LayoutProviders' {
290
387
  import type {ReactNode} from 'react';
291
388
 
@@ -320,33 +417,174 @@ declare module '@theme/SkipToContent' {
320
417
  export default function SkipToContent(): JSX.Element;
321
418
  }
322
419
 
323
- declare module '@theme/MDXComponents' {
420
+ declare module '@theme/MDXComponents/A' {
324
421
  import type {ComponentProps} from 'react';
325
- import type CodeBlock from '@theme/CodeBlock';
326
- import type Head from '@docusaurus/Head';
422
+
423
+ export interface Props extends ComponentProps<'a'> {}
424
+
425
+ export default function MDXA(props: Props): JSX.Element;
426
+ }
427
+
428
+ declare module '@theme/MDXComponents/Code' {
429
+ import type {ComponentProps} from 'react';
430
+
431
+ export interface Props extends ComponentProps<'code'> {}
432
+
433
+ export default function MDXCode(props: Props): JSX.Element;
434
+ }
435
+
436
+ declare module '@theme/MDXComponents/Details' {
437
+ import type {ComponentProps} from 'react';
438
+
439
+ export interface Props extends ComponentProps<'details'> {}
440
+
441
+ export default function MDXDetails(props: Props): JSX.Element;
442
+ }
443
+
444
+ declare module '@theme/MDXComponents/Ul' {
445
+ import type {ComponentProps} from 'react';
446
+
447
+ export interface Props extends ComponentProps<'ul'> {}
448
+
449
+ export default function MDXUl(props: Props): JSX.Element;
450
+ }
451
+
452
+ declare module '@theme/MDXComponents/Img' {
453
+ import type {ComponentProps} from 'react';
454
+
455
+ export interface Props extends ComponentProps<'img'> {}
456
+
457
+ export default function MDXImg(props: Props): JSX.Element;
458
+ }
459
+
460
+ declare module '@theme/MDXComponents/Head' {
461
+ import type {ComponentProps} from 'react';
462
+
463
+ export interface Props extends ComponentProps<'head'> {}
464
+
465
+ export default function MDXHead(props: Props): JSX.Element;
466
+ }
467
+
468
+ declare module '@theme/MDXComponents/Heading' {
469
+ import type {ComponentProps} from 'react';
470
+ import type Heading from '@theme/Heading';
471
+
472
+ export interface Props extends ComponentProps<typeof Heading> {}
473
+
474
+ export default function MDXHeading(props: Props): JSX.Element;
475
+ }
476
+
477
+ declare module '@theme/MDXComponents/Pre' {
478
+ import type {ComponentProps} from 'react';
479
+
480
+ export interface Props extends ComponentProps<'pre'> {}
481
+
482
+ export default function MDXPre(props: Props): JSX.Element;
483
+ }
484
+
485
+ declare module '@theme/MDXComponents' {
486
+ import type {ComponentType, ComponentProps} from 'react';
487
+
488
+ import type MDXHead from '@theme/MDXComponents/Head';
489
+ import type MDXCode from '@theme/MDXComponents/Code';
490
+ import type MDXA from '@theme/MDXComponents/A';
491
+ import type MDXPre from '@theme/MDXComponents/Pre';
492
+ import type MDXDetails from '@theme/MDXComponents/Details';
493
+ import type MDXUl from '@theme/MDXComponents/Ul';
494
+ import type MDXImg from '@theme/MDXComponents/Img';
327
495
 
328
496
  export type MDXComponentsObject = {
329
- readonly head: typeof Head;
330
- readonly code: typeof CodeBlock;
331
- readonly a: (props: ComponentProps<'a'>) => JSX.Element;
332
- readonly pre: typeof CodeBlock;
333
- readonly details: (props: ComponentProps<'details'>) => JSX.Element;
497
+ readonly head: typeof MDXHead;
498
+ readonly code: typeof MDXCode;
499
+ readonly a: typeof MDXA;
500
+ readonly pre: typeof MDXPre;
501
+ readonly details: typeof MDXDetails;
502
+ readonly ul: typeof MDXUl;
503
+ readonly img: typeof MDXImg;
334
504
  readonly h1: (props: ComponentProps<'h1'>) => JSX.Element;
335
505
  readonly h2: (props: ComponentProps<'h2'>) => JSX.Element;
336
506
  readonly h3: (props: ComponentProps<'h3'>) => JSX.Element;
337
507
  readonly h4: (props: ComponentProps<'h4'>) => JSX.Element;
338
508
  readonly h5: (props: ComponentProps<'h5'>) => JSX.Element;
339
509
  readonly h6: (props: ComponentProps<'h6'>) => JSX.Element;
340
- };
510
+ } & {[tagName: string]: ComponentType<unknown>};
341
511
 
342
512
  const MDXComponents: MDXComponentsObject;
343
513
  export default MDXComponents;
344
514
  }
345
515
 
516
+ declare module '@theme/MDXContent' {
517
+ import type {ReactNode} from 'react';
518
+
519
+ export interface Props {
520
+ readonly children: ReactNode;
521
+ }
522
+
523
+ export default function MDXContent(props: Props): JSX.Element;
524
+ }
525
+
346
526
  declare module '@theme/Navbar' {
347
527
  export default function Navbar(): JSX.Element;
348
528
  }
349
529
 
530
+ declare module '@theme/Navbar/ColorModeToggle' {
531
+ export interface Props {
532
+ readonly className?: string;
533
+ }
534
+
535
+ export default function NavbarColorModeToggle(
536
+ props: Props,
537
+ ): JSX.Element | null;
538
+ }
539
+
540
+ declare module '@theme/Navbar/Logo' {
541
+ export default function NavbarLogo(): JSX.Element;
542
+ }
543
+
544
+ declare module '@theme/Navbar/Content' {
545
+ export default function NavbarContent(): JSX.Element;
546
+ }
547
+
548
+ declare module '@theme/Navbar/Layout' {
549
+ export interface Props {
550
+ readonly children: React.ReactNode;
551
+ }
552
+
553
+ export default function NavbarLayout(props: Props): JSX.Element;
554
+ }
555
+
556
+ declare module '@theme/Navbar/MobileSidebar' {
557
+ export default function NavbarMobileSidebar(): JSX.Element;
558
+ }
559
+
560
+ declare module '@theme/Navbar/MobileSidebar/Layout' {
561
+ import type {ReactNode} from 'react';
562
+
563
+ interface Props {
564
+ header: ReactNode;
565
+ primaryMenu: ReactNode;
566
+ secondaryMenu: ReactNode;
567
+ }
568
+
569
+ export default function NavbarMobileSidebarLayout(props: Props): JSX.Element;
570
+ }
571
+
572
+ declare module '@theme/Navbar/MobileSidebar/Toggle' {
573
+ export default function NavbarMobileSidebarToggle(): JSX.Element;
574
+ }
575
+
576
+ declare module '@theme/Navbar/MobileSidebar/PrimaryMenu' {
577
+ export default function NavbarMobileSidebarPrimaryMenu(): JSX.Element;
578
+ }
579
+
580
+ declare module '@theme/Navbar/MobileSidebar/SecondaryMenu' {
581
+ export default function NavbarMobileSidebarSecondaryMenu(): JSX.Element;
582
+ }
583
+
584
+ declare module '@theme/Navbar/MobileSidebar/Header' {
585
+ export default function NavbarMobileSidebarHeader(): JSX.Element;
586
+ }
587
+
350
588
  declare module '@theme/NavbarItem/DefaultNavbarItem' {
351
589
  import type {Props as NavbarNavLinkProps} from '@theme/NavbarItem/NavbarNavLink';
352
590
 
@@ -530,7 +768,7 @@ declare module '@theme/TabItem' {
530
768
  readonly label?: string;
531
769
  readonly hidden?: boolean;
532
770
  readonly className?: string;
533
- readonly attributes?: Record<string, unknown>;
771
+ readonly attributes?: {[key: string]: unknown};
534
772
  }
535
773
 
536
774
  export default function TabItem(props: Props): JSX.Element;
@@ -548,7 +786,7 @@ declare module '@theme/Tabs' {
548
786
  readonly values?: readonly {
549
787
  value: string;
550
788
  label?: string;
551
- attributes?: Record<string, unknown>;
789
+ attributes?: {[key: string]: unknown};
552
790
  }[];
553
791
  readonly groupId?: string;
554
792
  readonly className?: string;
@@ -633,15 +871,19 @@ declare module '@theme/TOCCollapsible' {
633
871
  }
634
872
 
635
873
  declare module '@theme/ColorModeToggle' {
636
- import type {SyntheticEvent} from 'react';
874
+ import type {ColorMode} from '@docusaurus/theme-common';
637
875
 
638
876
  export interface Props {
639
877
  readonly className?: string;
640
- readonly checked: boolean;
641
- readonly onChange: (e: SyntheticEvent) => void;
878
+ readonly value: ColorMode;
879
+ /**
880
+ * The parameter represents the "to-be" value. For example, if currently in
881
+ * dark mode, clicking the button should call `onChange("light")`
882
+ */
883
+ readonly onChange: (colorMode: ColorMode) => void;
642
884
  }
643
885
 
644
- export default function Toggle(props: Props): JSX.Element;
886
+ export default function ColorModeToggle(props: Props): JSX.Element;
645
887
  }
646
888
 
647
889
  declare module '@theme/Logo' {
@@ -720,11 +962,8 @@ declare module '@theme/IconExternalLink' {
720
962
  }
721
963
 
722
964
  declare module '@theme/TagsListByLetter' {
723
- export type TagsListItem = Readonly<{
724
- name: string;
725
- permalink: string;
726
- count: number;
727
- }>;
965
+ import type {TagsListItem} from '@docusaurus/theme-common';
966
+
728
967
  export interface Props {
729
968
  readonly tags: readonly TagsListItem[];
730
969
  }
@@ -732,7 +971,8 @@ declare module '@theme/TagsListByLetter' {
732
971
  }
733
972
 
734
973
  declare module '@theme/TagsListInline' {
735
- export type Tag = Readonly<{label: string; permalink: string}>;
974
+ import type {Tag} from '@docusaurus/utils';
975
+
736
976
  export interface Props {
737
977
  readonly tags: readonly Tag[];
738
978
  }
@@ -740,7 +980,7 @@ declare module '@theme/TagsListInline' {
740
980
  }
741
981
 
742
982
  declare module '@theme/Tag' {
743
- import type {TagsListItem} from '@theme/TagsListByLetter';
983
+ import type {TagsListItem} from '@docusaurus/theme-common';
744
984
  import type {Optional} from 'utility-types';
745
985
 
746
986
  export interface Props extends Optional<TagsListItem, 'count'> {}
@@ -755,17 +995,3 @@ declare module '@theme/prism-include-languages' {
755
995
  PrismObject: typeof PrismNamespace,
756
996
  ): void;
757
997
  }
758
-
759
- declare module '@theme/Seo' {
760
- import type {ReactNode} from 'react';
761
-
762
- export interface Props {
763
- readonly title?: string;
764
- readonly description?: string;
765
- readonly keywords?: readonly string[] | string;
766
- readonly image?: string;
767
- readonly children?: ReactNode;
768
- }
769
-
770
- export default function Seo(props: Props): JSX.Element;
771
- }
@@ -50,8 +50,11 @@ function getNavbarTranslationFile(navbar: Navbar): TranslationFileContent {
50
50
  }
51
51
  function translateNavbar(
52
52
  navbar: Navbar,
53
- navbarTranslations: TranslationFileContent,
53
+ navbarTranslations: TranslationFileContent | undefined,
54
54
  ): Navbar {
55
+ if (!navbarTranslations) {
56
+ return navbar;
57
+ }
55
58
  return {
56
59
  ...navbar,
57
60
  title: navbarTranslations.title?.message ?? navbar.title,
@@ -76,7 +79,7 @@ function translateNavbar(
76
79
  function isMultiColumnFooterLinks(
77
80
  links: MultiColumnFooter['links'] | SimpleFooter['links'],
78
81
  ): links is MultiColumnFooter['links'] {
79
- return links.length > 0 && 'title' in links[0];
82
+ return links.length > 0 && 'title' in links[0]!;
80
83
  }
81
84
 
82
85
  function getFooterTranslationFile(footer: Footer): TranslationFileContent {
@@ -121,8 +124,11 @@ function getFooterTranslationFile(footer: Footer): TranslationFileContent {
121
124
  }
122
125
  function translateFooter(
123
126
  footer: Footer,
124
- footerTranslations: TranslationFileContent,
127
+ footerTranslations: TranslationFileContent | undefined,
125
128
  ): Footer {
129
+ if (!footerTranslations) {
130
+ return footer;
131
+ }
126
132
  const links = isMultiColumnFooterLinks(footer.links)
127
133
  ? footer.links.map((link) => ({
128
134
  ...link,
@@ -178,7 +184,7 @@ export function translateThemeConfig({
178
184
  themeConfig: ThemeConfig;
179
185
  translationFiles: TranslationFile[];
180
186
  }): ThemeConfig {
181
- const translationFilesMap: Record<string, TranslationFile> = _.keyBy(
187
+ const translationFilesMap: {[fileName: string]: TranslationFile} = _.keyBy(
182
188
  translationFiles,
183
189
  (f) => f.path,
184
190
  );
@@ -187,10 +193,10 @@ export function translateThemeConfig({
187
193
  ...themeConfig,
188
194
  navbar: translateNavbar(
189
195
  themeConfig.navbar,
190
- translationFilesMap.navbar.content,
196
+ translationFilesMap.navbar?.content,
191
197
  ),
192
198
  footer: themeConfig.footer
193
- ? translateFooter(themeConfig.footer, translationFilesMap.footer.content)
199
+ ? translateFooter(themeConfig.footer, translationFilesMap.footer?.content)
194
200
  : undefined,
195
201
  };
196
202
  }
@@ -6,7 +6,10 @@
6
6
  */
7
7
 
8
8
  import {Joi, URISchema} from '@docusaurus/utils-validation';
9
- import type {ThemeConfig, Validate, ValidationResult} from '@docusaurus/types';
9
+ import type {
10
+ ThemeConfig,
11
+ ThemeConfigValidationContext,
12
+ } from '@docusaurus/types';
10
13
 
11
14
  const DEFAULT_DOCS_CONFIG = {
12
15
  versionPersistence: 'localStorage',
@@ -304,7 +307,7 @@ export const ThemeConfigSchema = Joi.object({
304
307
  style: Joi.string().equal('dark', 'light').default('light'),
305
308
  logo: Joi.object({
306
309
  alt: Joi.string().allow(''),
307
- src: Joi.string(),
310
+ src: Joi.string().required(),
308
311
  srcDark: Joi.string(),
309
312
  // TODO infer this from reading the image
310
313
  width: Joi.alternatives().try(Joi.string(), Joi.number()),
@@ -373,9 +376,6 @@ export const ThemeConfigSchema = Joi.object({
373
376
  export function validateThemeConfig({
374
377
  validate,
375
378
  themeConfig,
376
- }: {
377
- validate: Validate<ThemeConfig>;
378
- themeConfig: ThemeConfig;
379
- }): ValidationResult<ThemeConfig> {
379
+ }: ThemeConfigValidationContext<ThemeConfig>): ThemeConfig {
380
380
  return validate(ThemeConfigSchema, themeConfig);
381
381
  }
@@ -1,107 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- :root {
9
- --collapse-button-bg-color-dark: #2e333a;
10
- }
11
-
12
- @media (min-width: 997px) {
13
- .sidebar {
14
- display: flex;
15
- flex-direction: column;
16
- max-height: 100vh;
17
- height: 100%;
18
- position: sticky;
19
- top: 0;
20
- padding-top: var(--ifm-navbar-height);
21
- width: var(--doc-sidebar-width);
22
- transition: opacity 50ms ease;
23
- }
24
-
25
- .sidebarWithHideableNavbar {
26
- padding-top: 0;
27
- }
28
-
29
- .sidebarHidden {
30
- opacity: 0;
31
- height: 0;
32
- overflow: hidden;
33
- visibility: hidden;
34
- }
35
-
36
- .sidebarLogo {
37
- display: flex !important;
38
- align-items: center;
39
- margin: 0 var(--ifm-navbar-padding-horizontal);
40
- min-height: var(--ifm-navbar-height);
41
- max-height: var(--ifm-navbar-height);
42
- color: inherit !important;
43
- text-decoration: none !important;
44
- }
45
-
46
- .sidebarLogo img {
47
- margin-right: 0.5rem;
48
- height: 2rem;
49
- }
50
-
51
- .menu {
52
- flex-grow: 1;
53
- padding: 0.5rem;
54
- }
55
-
56
- .menuWithAnnouncementBar {
57
- margin-bottom: var(--docusaurus-announcement-bar-height);
58
- }
59
-
60
- .collapseSidebarButton {
61
- display: block !important;
62
- background-color: var(--ifm-button-background-color);
63
- height: 40px;
64
- position: sticky;
65
- bottom: 0;
66
- border-radius: 0;
67
- border: 1px solid var(--ifm-toc-border-color);
68
- }
69
-
70
- .collapseSidebarButtonIcon {
71
- transform: rotate(180deg);
72
- margin-top: 4px;
73
- }
74
-
75
- [dir='rtl'] .collapseSidebarButtonIcon {
76
- transform: rotate(0);
77
- }
78
-
79
- [data-theme='dark'] .collapseSidebarButton {
80
- background-color: var(--collapse-button-bg-color-dark);
81
- }
82
-
83
- [data-theme='dark'] .collapseSidebarButton:hover,
84
- [data-theme='dark'] .collapseSidebarButton:focus {
85
- background-color: var(--ifm-color-emphasis-200);
86
- }
87
- }
88
-
89
- .sidebarLogo,
90
- .collapseSidebarButton {
91
- display: none;
92
- }
93
-
94
- .sidebarMenuIcon {
95
- vertical-align: middle;
96
- }
97
-
98
- .sidebarMenuCloseIcon {
99
- display: inline-flex;
100
- justify-content: center;
101
- align-items: center;
102
- height: 24px;
103
- font-size: 1.5rem;
104
- font-weight: var(--ifm-font-weight-bold);
105
- line-height: 0.9;
106
- width: 24px;
107
- }
@@ -1,40 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import React from 'react';
8
- import Head from '@docusaurus/Head';
9
- import {useTitleFormatter} from '@docusaurus/theme-common';
10
- import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
11
- export default function Seo({title, description, keywords, image, children}) {
12
- const pageTitle = useTitleFormatter(title);
13
- const {withBaseUrl} = useBaseUrlUtils();
14
- const pageImage = image
15
- ? withBaseUrl(image, {
16
- absolute: true,
17
- })
18
- : undefined;
19
- return (
20
- <Head>
21
- {title && <title>{pageTitle}</title>}
22
- {title && <meta property="og:title" content={pageTitle} />}
23
-
24
- {description && <meta name="description" content={description} />}
25
- {description && <meta property="og:description" content={description} />}
26
-
27
- {keywords && (
28
- <meta
29
- name="keywords"
30
- content={Array.isArray(keywords) ? keywords.join(',') : keywords}
31
- />
32
- )}
33
-
34
- {pageImage && <meta property="og:image" content={pageImage} />}
35
- {pageImage && <meta name="twitter:image" content={pageImage} />}
36
-
37
- {children}
38
- </Head>
39
- );
40
- }