@docusaurus/theme-classic 2.0.0-beta.14 → 2.0.0-beta.15

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 (152) hide show
  1. package/README.md +1 -1
  2. package/lib/index.js +7 -16
  3. package/lib/theme-classic.d.ts +89 -182
  4. package/lib/validateThemeConfig.js +13 -1
  5. package/lib-next/theme/BackToTopButton/styles.module.css +1 -1
  6. package/lib-next/theme/BlogListPaginator/index.js +12 -12
  7. package/lib-next/theme/BlogPostAuthor/index.js +1 -1
  8. package/lib-next/theme/BlogPostAuthors/index.js +12 -2
  9. package/lib-next/theme/BlogPostAuthors/styles.module.css +10 -0
  10. package/lib-next/theme/BlogPostItem/index.js +12 -15
  11. package/lib-next/theme/BlogPostPage/index.js +10 -7
  12. package/lib-next/theme/BlogPostPaginator/index.js +11 -15
  13. package/lib-next/theme/BlogSidebar/styles.module.css +2 -0
  14. package/lib-next/theme/CodeBlock/index.js +44 -9
  15. package/lib-next/theme/CodeBlock/styles.module.css +12 -7
  16. package/lib-next/theme/DocCard/styles.module.css +3 -3
  17. package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +6 -3
  18. package/lib-next/theme/DocItem/index.js +9 -6
  19. package/lib-next/theme/DocItem/styles.module.css +2 -2
  20. package/lib-next/theme/DocPage/index.js +7 -3
  21. package/lib-next/theme/DocPage/styles.module.css +1 -0
  22. package/lib-next/theme/DocPaginator/index.js +26 -4
  23. package/lib-next/theme/DocSidebar/index.js +2 -2
  24. package/lib-next/theme/DocSidebar/styles.module.css +1 -0
  25. package/lib-next/theme/DocSidebarItem/index.js +43 -21
  26. package/lib-next/theme/DocSidebarItem/styles.module.css +1 -0
  27. package/lib-next/theme/DocSidebarItems/index.js +28 -0
  28. package/{src/theme/hooks/styles.css → lib-next/theme/DocSidebarItems/styles.module.css} +12 -2
  29. package/lib-next/theme/DocVersionBanner/index.js +4 -1
  30. package/lib-next/theme/Footer/styles.module.css +2 -1
  31. package/lib-next/theme/Heading/index.js +39 -42
  32. package/lib-next/theme/Heading/styles.css +1 -1
  33. package/lib-next/theme/Layout/index.js +1 -2
  34. package/lib-next/theme/LayoutHead/index.js +5 -9
  35. package/lib-next/theme/LayoutProviders/index.js +6 -6
  36. package/lib-next/theme/MDXComponents/index.js +18 -31
  37. package/lib-next/theme/MDXComponents/styles.css +4 -0
  38. package/lib-next/theme/MDXPage/index.js +3 -10
  39. package/lib-next/theme/Navbar/index.js +6 -6
  40. package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +4 -66
  41. package/lib-next/theme/NavbarItem/DocNavbarItem.js +5 -2
  42. package/lib-next/theme/NavbarItem/DocSidebarNavbarItem.js +73 -0
  43. package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +5 -3
  44. package/lib-next/theme/NavbarItem/DocsVersionNavbarItem.js +4 -1
  45. package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +5 -5
  46. package/lib-next/theme/NavbarItem/NavbarNavLink.js +70 -0
  47. package/lib-next/theme/NavbarItem/index.js +1 -2
  48. package/lib-next/theme/{hooks/styles.css → NavbarItem/utils.js} +3 -4
  49. package/lib-next/theme/PaginatorNavLink/index.js +20 -0
  50. package/lib-next/theme/SkipToContent/index.js +1 -1
  51. package/lib-next/theme/SkipToContent/styles.module.css +7 -0
  52. package/lib-next/theme/TOCCollapsible/styles.module.css +2 -2
  53. package/lib-next/theme/Tabs/__tests__/index.test.js +8 -6
  54. package/lib-next/theme/Tabs/index.js +6 -3
  55. package/lib-next/theme/Tag/styles.module.css +4 -4
  56. package/lib-next/theme/ThemedImage/index.js +2 -2
  57. package/lib-next/theme/Toggle/styles.module.css +16 -15
  58. package/lib-next/theme/prism-include-languages.js +10 -3
  59. package/package.json +16 -17
  60. package/src/index.ts +10 -21
  61. package/src/theme/Admonition/index.tsx +1 -1
  62. package/src/theme/BackToTopButton/styles.module.css +1 -1
  63. package/src/theme/BlogListPaginator/index.tsx +12 -12
  64. package/src/theme/BlogPostAuthor/index.tsx +1 -1
  65. package/src/theme/BlogPostAuthors/index.tsx +12 -2
  66. package/src/theme/BlogPostAuthors/styles.module.css +10 -0
  67. package/src/theme/BlogPostItem/index.tsx +13 -15
  68. package/src/theme/BlogPostPage/index.tsx +10 -7
  69. package/src/theme/BlogPostPaginator/index.tsx +11 -15
  70. package/src/theme/BlogSidebar/styles.module.css +2 -0
  71. package/src/theme/CodeBlock/index.tsx +45 -10
  72. package/src/theme/CodeBlock/styles.module.css +12 -7
  73. package/src/theme/DocCard/index.tsx +2 -2
  74. package/src/theme/DocCard/styles.module.css +3 -3
  75. package/src/theme/DocCardList/index.tsx +1 -1
  76. package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +7 -3
  77. package/src/theme/DocItem/index.tsx +9 -6
  78. package/src/theme/DocItem/styles.module.css +2 -2
  79. package/src/theme/DocItemFooter/index.tsx +1 -1
  80. package/src/theme/DocPage/index.tsx +8 -4
  81. package/src/theme/DocPage/styles.module.css +1 -0
  82. package/src/theme/DocPaginator/index.tsx +26 -4
  83. package/src/theme/DocSidebar/index.tsx +3 -3
  84. package/src/theme/DocSidebar/styles.module.css +1 -0
  85. package/src/theme/DocSidebarItem/index.tsx +34 -23
  86. package/src/theme/DocSidebarItem/styles.module.css +1 -0
  87. package/src/theme/DocSidebarItems/index.tsx +32 -0
  88. package/src/theme/{UserPreferencesContext.ts → DocSidebarItems/styles.module.css} +11 -3
  89. package/src/theme/DocVersionBanner/index.tsx +3 -3
  90. package/src/theme/Footer/index.tsx +4 -4
  91. package/src/theme/Footer/styles.module.css +2 -1
  92. package/src/theme/Heading/index.tsx +39 -46
  93. package/src/theme/Heading/styles.css +1 -1
  94. package/src/theme/Layout/index.tsx +1 -2
  95. package/src/theme/LayoutHead/index.tsx +4 -8
  96. package/src/theme/LayoutProviders/index.tsx +6 -6
  97. package/src/theme/MDXComponents/index.tsx +26 -37
  98. package/src/theme/MDXComponents/styles.css +4 -0
  99. package/src/theme/MDXPage/index.tsx +3 -11
  100. package/src/theme/Navbar/index.tsx +7 -7
  101. package/src/theme/NavbarItem/DefaultNavbarItem.tsx +6 -62
  102. package/src/theme/NavbarItem/DocNavbarItem.tsx +8 -5
  103. package/src/theme/NavbarItem/DocSidebarNavbarItem.tsx +84 -0
  104. package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +9 -6
  105. package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +2 -2
  106. package/src/theme/NavbarItem/DropdownNavbarItem.tsx +5 -5
  107. package/src/theme/NavbarItem/NavbarNavLink.tsx +68 -0
  108. package/src/theme/NavbarItem/index.tsx +3 -5
  109. package/{lib-next/theme/UserPreferencesContext.js → src/theme/NavbarItem/utils.ts} +4 -3
  110. package/src/theme/PaginatorNavLink/index.tsx +22 -0
  111. package/src/theme/SkipToContent/index.tsx +1 -1
  112. package/src/theme/SkipToContent/styles.module.css +7 -0
  113. package/src/theme/TOCCollapsible/styles.module.css +2 -2
  114. package/src/theme/TOCItems/index.tsx +2 -2
  115. package/src/theme/Tabs/index.tsx +7 -4
  116. package/src/theme/Tag/styles.module.css +4 -4
  117. package/src/theme/TagsListByLetter/index.tsx +1 -1
  118. package/src/theme/ThemedImage/index.tsx +2 -2
  119. package/src/theme/Toggle/index.tsx +1 -1
  120. package/src/theme/Toggle/styles.module.css +16 -15
  121. package/src/theme/prism-include-languages.ts +10 -3
  122. package/src/theme-classic.d.ts +89 -182
  123. package/src/translations.ts +2 -2
  124. package/src/validateThemeConfig.ts +16 -0
  125. package/lib-next/theme/DocPaginatorNavLink/index.js +0 -36
  126. package/lib-next/theme/ThemeContext.js +0 -9
  127. package/lib-next/theme/ThemeProvider/index.js +0 -28
  128. package/lib-next/theme/UserPreferencesProvider/index.js +0 -27
  129. package/lib-next/theme/hooks/useDocs.js +0 -10
  130. package/lib-next/theme/hooks/useHideableNavbar.js +0 -66
  131. package/lib-next/theme/hooks/useKeyboardNavigation.js +0 -35
  132. package/lib-next/theme/hooks/useLockBodyScroll.js +0 -18
  133. package/lib-next/theme/hooks/usePrismTheme.js +0 -20
  134. package/lib-next/theme/hooks/useTabGroupChoice.js +0 -39
  135. package/lib-next/theme/hooks/useTheme.js +0 -81
  136. package/lib-next/theme/hooks/useThemeContext.js +0 -22
  137. package/lib-next/theme/hooks/useUserPreferencesContext.js +0 -22
  138. package/lib-next/theme/hooks/useWindowSize.js +0 -59
  139. package/src/theme/DocPaginatorNavLink/index.tsx +0 -38
  140. package/src/theme/ThemeContext.ts +0 -15
  141. package/src/theme/ThemeProvider/index.tsx +0 -28
  142. package/src/theme/UserPreferencesProvider/index.tsx +0 -30
  143. package/src/theme/hooks/useDocs.ts +0 -11
  144. package/src/theme/hooks/useHideableNavbar.ts +0 -72
  145. package/src/theme/hooks/useKeyboardNavigation.ts +0 -39
  146. package/src/theme/hooks/useLockBodyScroll.ts +0 -20
  147. package/src/theme/hooks/usePrismTheme.ts +0 -22
  148. package/src/theme/hooks/useTabGroupChoice.ts +0 -46
  149. package/src/theme/hooks/useTheme.ts +0 -91
  150. package/src/theme/hooks/useThemeContext.ts +0 -23
  151. package/src/theme/hooks/useUserPreferencesContext.ts +0 -25
  152. package/src/theme/hooks/useWindowSize.ts +0 -69
package/README.md CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
 
25
25
  ## Swizzling components
26
26
 
27
- ```shell
27
+ ```bash
28
28
  $ npm swizzle @docusaurus/theme-classic [component name]
29
29
  ```
30
30
 
package/lib/index.js CHANGED
@@ -101,8 +101,7 @@ function getInfimaCSSFile(direction) {
101
101
  return `infima/dist/css/default/default${direction === 'rtl' ? '-rtl' : ''}.css`;
102
102
  }
103
103
 
104
- function docusaurusThemeClassic(context, // TODO: LoadContext is missing some of properties
105
- options) {
104
+ function docusaurusThemeClassic(context, options) {
106
105
  const {
107
106
  siteConfig: {
108
107
  themeConfig: roughlyTypedThemeConfig
@@ -129,21 +128,12 @@ options) {
129
128
  return {
130
129
  name: 'docusaurus-theme-classic',
131
130
 
132
- /*
133
- Does not seem needed: webpack can already hot reload theme files
134
- getPathsToWatch() {
135
- return [
136
- path.join(__dirname, '..', 'lib'),
137
- path.join(__dirname, '..', 'lib-next'),
138
- ];
139
- },
140
- */
141
131
  getThemePath() {
142
- return _path.default.join(__dirname, '..', 'lib-next', 'theme');
132
+ return _path.default.join(__dirname, '../lib-next/theme');
143
133
  },
144
134
 
145
135
  getTypeScriptThemePath() {
146
- return _path.default.resolve(__dirname, '..', 'src', 'theme');
136
+ return _path.default.resolve(__dirname, '../src/theme');
147
137
  },
148
138
 
149
139
  getTranslationFiles: async () => (0, _translations.getTranslationFiles)({
@@ -178,9 +168,10 @@ options) {
178
168
  configureWebpack() {
179
169
  const prismLanguages = additionalLanguages.map(lang => `prism-${lang}`).join('|');
180
170
  return {
181
- ignoreWarnings: [// See https://github.com/facebook/docusaurus/pull/3382
182
- e => e.message.includes("Can't resolve '@theme-init/hooks/useDocs")],
183
- plugins: [new ContextReplacementPlugin(/prismjs[\\/]components$/, new RegExp(`^./(${prismLanguages})$`))]
171
+ plugins: [// This allows better optimization by only bundling those components
172
+ // that the user actually needs, because the modules are dynamically
173
+ // required and can't be known during compile time.
174
+ new ContextReplacementPlugin(/prismjs[\\/]components$/, new RegExp(`^./(${prismLanguages})$`))]
184
175
  };
185
176
  },
186
177
 
@@ -44,7 +44,8 @@ declare module '@theme/BlogListPaginator' {
44
44
  }
45
45
 
46
46
  declare module '@theme/BlogPostItem' {
47
- import type {FrontMatter, Assets, Metadata} from '@theme/BlogPostPage';
47
+ import type {FrontMatter, Metadata} from '@theme/BlogPostPage';
48
+ import type {Assets} from '@docusaurus/plugin-content-blog';
48
49
 
49
50
  export interface Props {
50
51
  readonly frontMatter: FrontMatter;
@@ -70,7 +71,8 @@ declare module '@theme/BlogPostAuthor' {
70
71
  }
71
72
 
72
73
  declare module '@theme/BlogPostAuthors' {
73
- import type {Metadata, Assets} from '@theme/BlogPostPage';
74
+ import type {Metadata} from '@theme/BlogPostPage';
75
+ import type {Assets} from '@docusaurus/plugin-content-blog';
74
76
 
75
77
  export interface Props {
76
78
  readonly authors: Metadata['authors'];
@@ -107,13 +109,14 @@ declare module '@theme/BlogLayout' {
107
109
  }
108
110
 
109
111
  declare module '@theme/CodeBlock' {
110
- import {ReactElement} from 'react';
112
+ import type {ReactElement} from 'react';
111
113
 
112
114
  export interface Props {
113
115
  readonly children: string | ReactElement;
114
116
  readonly className?: string;
115
117
  readonly metastring?: string;
116
118
  readonly title?: string;
119
+ readonly language?: string;
117
120
  }
118
121
 
119
122
  const CodeBlock: (props: Props) => JSX.Element;
@@ -129,18 +132,6 @@ declare module '@theme/DocPaginator' {
129
132
  export default function DocPaginator(props: Props): JSX.Element;
130
133
  }
131
134
 
132
- declare module '@theme/DocPaginatorNavLink' {
133
- import type {PropNavigationLink} from '@docusaurus/plugin-content-docs';
134
-
135
- // May be simpler to provide a {navigation: PropNavigation} prop?
136
- export interface Props {
137
- navLink: PropNavigationLink;
138
- next?: boolean;
139
- }
140
-
141
- export default function DocPaginatorNavLink(props: Props): JSX.Element;
142
- }
143
-
144
135
  declare module '@theme/DocSidebar' {
145
136
  import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
146
137
 
@@ -160,23 +151,27 @@ declare module '@theme/DocSidebar' {
160
151
  declare module '@theme/DocSidebarItem' {
161
152
  import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
162
153
 
163
- type DocSidebarPropsBase = {
154
+ export interface Props {
164
155
  readonly activePath: string;
165
156
  readonly onItemClick?: (item: PropSidebarItem) => void;
166
157
  readonly level: number;
167
158
  readonly tabIndex?: number;
168
- };
169
-
170
- export interface Props extends DocSidebarPropsBase {
171
159
  readonly item: PropSidebarItem;
160
+ readonly index: number;
172
161
  }
173
- const DocSidebarItem: (props: Props) => JSX.Element;
174
- export default DocSidebarItem;
175
162
 
176
- export type DocSidebarItemsProps = DocSidebarPropsBase & {
163
+ export default function DocSidebarItem(props: Props): JSX.Element;
164
+ }
165
+
166
+ declare module '@theme/DocSidebarItems' {
167
+ import type {Props as DocSidebarItemProps} from '@theme/DocSidebarItem';
168
+ import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
169
+
170
+ export type Props = Omit<DocSidebarItemProps, 'item' | 'index'> & {
177
171
  readonly items: readonly PropSidebarItem[];
178
172
  };
179
- export const DocSidebarItems: (props: DocSidebarItemsProps) => JSX.Element;
173
+
174
+ export default function DocSidebarItems(props: Props): JSX.Element;
180
175
  }
181
176
 
182
177
  declare module '@theme/DocVersionSuggestions' {
@@ -193,7 +188,7 @@ declare module '@theme/EditThisPage' {
193
188
  }
194
189
 
195
190
  declare module '@theme/ErrorPageContent' {
196
- import ErrorComponent from '@theme/Error';
191
+ import type ErrorComponent from '@theme/Error';
197
192
 
198
193
  const ErrorPageContent: typeof ErrorComponent;
199
194
  export default ErrorPageContent;
@@ -207,99 +202,20 @@ declare module '@theme/Footer' {
207
202
  declare module '@theme/Heading' {
208
203
  import type {ComponentProps} from 'react';
209
204
 
210
- export type HeadingType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
211
- export interface Props extends ComponentProps<HeadingType> {}
212
-
213
- const Heading: (Tag: HeadingType) => (props: Props) => JSX.Element;
214
- export default Heading;
215
- export const MainHeading: (props: Props) => JSX.Element;
216
- }
217
-
218
- declare module '@theme/hooks/useHideableNavbar' {
219
- export type useHideableNavbarReturns = {
220
- readonly navbarRef: (node: HTMLElement | null) => void;
221
- readonly isNavbarVisible: boolean;
222
- };
223
-
224
- const useHideableNavbar: (hideOnScroll: boolean) => useHideableNavbarReturns;
225
- export default useHideableNavbar;
226
- }
227
-
228
- declare module '@theme/hooks/useLockBodyScroll' {
229
- const useLockBodyScroll: (lock?: boolean) => void;
230
- export default useLockBodyScroll;
231
- }
232
-
233
- declare module '@theme/hooks/usePrismTheme' {
234
- import defaultTheme from 'prism-react-renderer/themes/palenight';
235
-
236
- const usePrismTheme: () => typeof defaultTheme;
237
- export default usePrismTheme;
238
- }
239
-
240
- declare module '@theme/hooks/useTabGroupChoice' {
241
- export type useTabGroupChoiceReturns = {
242
- readonly tabGroupChoices: {readonly [groupId: string]: string};
243
- readonly setTabGroupChoices: (groupId: string, newChoice: string) => void;
244
- };
245
-
246
- const useTabGroupChoice: () => useTabGroupChoiceReturns;
247
- export default useTabGroupChoice;
248
- }
205
+ type HeadingType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
249
206
 
250
- declare module '@theme/hooks/useTheme' {
251
- export type useThemeReturns = {
252
- readonly isDarkTheme: boolean;
253
- readonly setLightTheme: () => void;
254
- readonly setDarkTheme: () => void;
255
- };
256
-
257
- const useTheme: () => useThemeReturns;
258
- export default useTheme;
259
- }
260
-
261
- declare module '@theme/hooks/useThemeContext' {
262
- export type ThemeContextProps = {
263
- isDarkTheme: boolean;
264
- setLightTheme: () => void;
265
- setDarkTheme: () => void;
266
- };
267
-
268
- export default function useThemeContext(): ThemeContextProps;
269
- }
270
-
271
- declare module '@theme/hooks/useUserPreferencesContext' {
272
- export type UserPreferencesContextProps = {
273
- tabGroupChoices: {readonly [groupId: string]: string};
274
- setTabGroupChoices: (groupId: string, newChoice: string) => void;
275
- };
276
-
277
- export default function useUserPreferencesContext(): UserPreferencesContextProps;
278
- }
279
-
280
- declare module '@theme/hooks/useWindowSize' {
281
- export const windowSizes: {
282
- desktop: 'desktop';
283
- mobile: 'mobile';
284
- ssr: 'ssr';
285
- };
286
-
287
- export type WindowSize = keyof typeof windowSizes;
288
-
289
- export default function useWindowSize(): WindowSize;
290
- }
291
-
292
- declare module '@theme/hooks/useKeyboardNavigation' {
293
- const useKeyboardNavigation: () => void;
207
+ export interface Props extends ComponentProps<HeadingType> {
208
+ as: HeadingType;
209
+ }
294
210
 
295
- export default useKeyboardNavigation;
211
+ export default function Heading(props: Props): JSX.Element;
296
212
  }
297
213
 
298
214
  declare module '@theme/Layout' {
299
215
  import type {ReactNode} from 'react';
300
216
 
301
217
  export interface Props {
302
- readonly children: ReactNode;
218
+ readonly children?: ReactNode;
303
219
  readonly title?: string;
304
220
  readonly noFooter?: boolean;
305
221
  readonly description?: string;
@@ -314,8 +230,7 @@ declare module '@theme/Layout' {
314
230
  };
315
231
  }
316
232
 
317
- const Layout: (props: Props) => JSX.Element;
318
- export default Layout;
233
+ export default function Layout(props: Props): JSX.Element;
319
234
  }
320
235
 
321
236
  declare module '@theme/LayoutHead' {
@@ -323,8 +238,17 @@ declare module '@theme/LayoutHead' {
323
238
 
324
239
  export interface Props extends Omit<LayoutProps, 'children'> {}
325
240
 
326
- const LayoutHead: (props: Props) => JSX.Element;
327
- export default LayoutHead;
241
+ export default function LayoutHead(props: Props): JSX.Element;
242
+ }
243
+
244
+ declare module '@theme/LayoutProviders' {
245
+ import type {ReactNode} from 'react';
246
+
247
+ export interface Props {
248
+ readonly children: ReactNode;
249
+ }
250
+
251
+ export default function LayoutProviders(props: Props): JSX.Element;
328
252
  }
329
253
 
330
254
  declare module '@theme/SearchMetadata' {
@@ -383,18 +307,9 @@ declare module '@theme/Navbar' {
383
307
  }
384
308
 
385
309
  declare module '@theme/NavbarItem/DefaultNavbarItem' {
386
- import type {ReactNode} from 'react';
387
- import type {LinkProps} from '@docusaurus/Link';
388
-
389
- export type NavLinkProps = LinkProps & {
390
- readonly activeBasePath?: string;
391
- readonly activeBaseRegex?: string;
392
- readonly exact?: boolean;
393
- readonly label?: ReactNode;
394
- readonly prependBaseUrlToHref?: string;
395
- };
310
+ import type {Props as NavbarNavLinkProps} from '@theme/NavbarItem/NavbarNavLink';
396
311
 
397
- export type DesktopOrMobileNavBarItemProps = NavLinkProps & {
312
+ export type DesktopOrMobileNavBarItemProps = NavbarNavLinkProps & {
398
313
  readonly isDropdownItem?: boolean;
399
314
  readonly className?: string;
400
315
  readonly position?: 'left' | 'right';
@@ -404,17 +319,30 @@ declare module '@theme/NavbarItem/DefaultNavbarItem' {
404
319
  readonly mobile?: boolean;
405
320
  }
406
321
 
407
- export const NavLink: (props: NavLinkProps) => JSX.Element;
322
+ export default function DefaultNavbarItem(props: Props): JSX.Element;
323
+ }
324
+
325
+ declare module '@theme/NavbarItem/NavbarNavLink' {
326
+ import type {ReactNode} from 'react';
327
+ import type {LinkProps} from '@docusaurus/Link';
408
328
 
409
- const DefaultNavbarItem: (props: Props) => JSX.Element;
410
- export default DefaultNavbarItem;
329
+ export type Props = LinkProps & {
330
+ readonly activeBasePath?: string;
331
+ readonly activeBaseRegex?: string;
332
+ readonly exact?: boolean;
333
+ readonly label?: ReactNode;
334
+ readonly prependBaseUrlToHref?: string;
335
+ };
336
+
337
+ export default function NavbarNavLink(props: Props): JSX.Element;
411
338
  }
412
339
 
413
340
  declare module '@theme/NavbarItem/DropdownNavbarItem' {
414
- import type {NavLinkProps} from '@theme/NavbarItem/DefaultNavbarItem';
341
+ import type {Props as NavbarNavLinkProps} from '@theme/NavbarItem/NavbarNavLink';
342
+
415
343
  import type {LinkLikeNavbarItemProps} from '@theme/NavbarItem';
416
344
 
417
- export type DesktopOrMobileNavBarItemProps = NavLinkProps & {
345
+ export type DesktopOrMobileNavBarItemProps = NavbarNavLinkProps & {
418
346
  readonly position?: 'left' | 'right';
419
347
  readonly items: readonly LinkLikeNavbarItemProps[];
420
348
  readonly className?: string;
@@ -488,10 +416,23 @@ declare module '@theme/NavbarItem/DocNavbarItem' {
488
416
  export default DocsSidebarNavbarItem;
489
417
  }
490
418
 
419
+ declare module '@theme/NavbarItem/DocSidebarNavbarItem' {
420
+ import type {Props as DefaultNavbarItemProps} from '@theme/NavbarItem/DefaultNavbarItem';
421
+
422
+ export interface Props extends DefaultNavbarItemProps {
423
+ readonly sidebarId: string;
424
+ readonly docsPluginId?: string;
425
+ }
426
+
427
+ const DocSidebarNavbarItem: (props: Props) => JSX.Element;
428
+ export default DocSidebarNavbarItem;
429
+ }
430
+
491
431
  declare module '@theme/NavbarItem' {
492
432
  import type {ComponentProps} from 'react';
493
433
  import type {Props as DefaultNavbarItemProps} from '@theme/NavbarItem/DefaultNavbarItem';
494
434
  import type {Props as DocNavbarItemProps} from '@theme/NavbarItem/DocNavbarItem';
435
+ import type {Props as DocSidebarNavbarItemProps} from '@theme/NavbarItem/DocSidebarNavbarItem';
495
436
  import type {Props as DocsVersionNavbarItemProps} from '@theme/NavbarItem/DocsVersionNavbarItem';
496
437
  import type {Props as DropdownNavbarItemProps} from '@theme/NavbarItem/DropdownNavbarItem';
497
438
  import type {Props as DocsVersionDropdownNavbarItemProps} from '@theme/NavbarItem/DocsVersionDropdownNavbarItem';
@@ -501,7 +442,8 @@ declare module '@theme/NavbarItem' {
501
442
  export type LinkLikeNavbarItemProps =
502
443
  | ({readonly type?: 'default'} & DefaultNavbarItemProps)
503
444
  | ({readonly type: 'doc'} & DocNavbarItemProps)
504
- | ({readonly type: 'docsVersion'} & DocsVersionNavbarItemProps);
445
+ | ({readonly type: 'docsVersion'} & DocsVersionNavbarItemProps)
446
+ | ({readonly type: 'docSidebar'} & DocSidebarNavbarItemProps);
505
447
 
506
448
  export type Props = ComponentProps<'a'> & {
507
449
  readonly position?: 'left' | 'right';
@@ -523,6 +465,22 @@ declare module '@theme/NavbarItem' {
523
465
  export default NavbarItem;
524
466
  }
525
467
 
468
+ declare module '@theme/NavbarItem/utils' {
469
+ export function getInfimaActiveClassName(mobile?: boolean): string;
470
+ }
471
+
472
+ declare module '@theme/PaginatorNavLink' {
473
+ import type {ReactNode} from 'react';
474
+ import type {PropNavigationLink} from '@docusaurus/plugin-content-docs';
475
+
476
+ export interface Props extends Omit<PropNavigationLink, 'title'> {
477
+ readonly title: ReactNode;
478
+ readonly subLabel?: JSX.Element;
479
+ }
480
+
481
+ export default function PaginatorNavLink(props: Props): JSX.Element;
482
+ }
483
+
526
484
  declare module '@theme/SearchBar' {
527
485
  export default function SearchBar(): JSX.Element;
528
486
  }
@@ -581,23 +539,12 @@ declare module '@theme/ThemedImage' {
581
539
  }
582
540
 
583
541
  declare module '@theme/Details' {
584
- import {Details, DetailsProps} from '@docusaurus/theme-common';
542
+ import {Details, type DetailsProps} from '@docusaurus/theme-common';
585
543
 
586
544
  export interface Props extends DetailsProps {}
587
545
  export default Details;
588
546
  }
589
547
 
590
- declare module '@theme/ThemeProvider' {
591
- import type {ReactNode} from 'react';
592
-
593
- export interface Props {
594
- readonly children: ReactNode;
595
- }
596
-
597
- const ThemeProvider: (props: Props) => JSX.Element;
598
- export default ThemeProvider;
599
- }
600
-
601
548
  declare module '@theme/TOCItems' {
602
549
  import type {TOCItem} from '@docusaurus/types';
603
550
 
@@ -678,46 +625,6 @@ declare module '@theme/Toggle' {
678
625
  export default Toggle;
679
626
  }
680
627
 
681
- declare module '@theme/UserPreferencesProvider' {
682
- import type {ReactNode} from 'react';
683
-
684
- export interface Props {
685
- readonly children: ReactNode;
686
- }
687
-
688
- const UserPreferencesProvider: (props: Props) => JSX.Element;
689
- export default UserPreferencesProvider;
690
- }
691
-
692
- declare module '@theme/LayoutProviders' {
693
- import type {ReactNode} from 'react';
694
-
695
- export interface Props {
696
- readonly children: ReactNode;
697
- }
698
-
699
- const LayoutProviders: (props: Props) => JSX.Element;
700
- export default LayoutProviders;
701
- }
702
-
703
- declare module '@theme/ThemeContext' {
704
- import type {Context} from 'react';
705
- import type {ThemeContextProps} from '@theme/hooks/useThemeContext';
706
-
707
- const ThemeContext: Context<ThemeContextProps | undefined>;
708
- export default ThemeContext;
709
- }
710
-
711
- declare module '@theme/UserPreferencesContext' {
712
- import type {Context} from 'react';
713
- import type {UserPreferencesContextProps} from '@theme/hooks/useUserPreferencesContext';
714
-
715
- const UserPreferencesContext: Context<
716
- UserPreferencesContextProps | undefined
717
- >;
718
- export default UserPreferencesContext;
719
- }
720
-
721
628
  declare module '@theme/Logo' {
722
629
  import type {ComponentProps} from 'react';
723
630
 
@@ -45,6 +45,7 @@ const DEFAULT_CONFIG = {
45
45
  items: []
46
46
  },
47
47
  hideableSidebar: false,
48
+ autoCollapseSidebarCategories: false,
48
49
  tableOfContents: {
49
50
  minHeadingLevel: 2,
50
51
  maxHeadingLevel: 3
@@ -84,6 +85,11 @@ const DocItemSchema = NavbarItemBaseSchema.append({
84
85
  docId: _utilsValidation.Joi.string().required(),
85
86
  docsPluginId: _utilsValidation.Joi.string()
86
87
  });
88
+ const DocSidebarItemSchema = NavbarItemBaseSchema.append({
89
+ type: _utilsValidation.Joi.string().equal('docSidebar').required(),
90
+ sidebarId: _utilsValidation.Joi.string().required(),
91
+ docsPluginId: _utilsValidation.Joi.string()
92
+ });
87
93
 
88
94
  const itemWithType = type => {
89
95
  // because equal(undefined) is not supported :/
@@ -151,6 +157,9 @@ const NavbarItemSchema = _utilsValidation.Joi.object({
151
157
  }, {
152
158
  is: itemWithType('doc'),
153
159
  then: DocItemSchema
160
+ }, {
161
+ is: itemWithType('docSidebar'),
162
+ then: DocSidebarItemSchema
154
163
  }, {
155
164
  is: itemWithType('localeDropdown'),
156
165
  then: LocaleDropdownNavbarItemSchema
@@ -219,8 +228,10 @@ const ThemeConfigSchema = _utilsValidation.Joi.object({
219
228
  image: _utilsValidation.Joi.string(),
220
229
  docs: DocsSchema,
221
230
  metadata: _utilsValidation.Joi.array().items(HtmlMetadataSchema).default(DEFAULT_CONFIG.metadata),
231
+ // cSpell:ignore metadatas
222
232
  metadatas: _utilsValidation.Joi.any().forbidden().messages({
223
- 'any.unknown': 'themeConfig.metadatas has been renamed as themeConfig.metadata. See https://github.com/facebook/docusaurus/pull/5871'
233
+ 'any.unknown': // cSpell:ignore metadatas
234
+ 'themeConfig.metadatas has been renamed as themeConfig.metadata. See https://github.com/facebook/docusaurus/pull/5871'
224
235
  }),
225
236
  announcementBar: _utilsValidation.Joi.object({
226
237
  id: _utilsValidation.Joi.string().default('announcement-bar'),
@@ -280,6 +291,7 @@ const ThemeConfigSchema = _utilsValidation.Joi.object({
280
291
  additionalLanguages: _utilsValidation.Joi.array().items(_utilsValidation.Joi.string()).default(DEFAULT_CONFIG.prism.additionalLanguages)
281
292
  }).default(DEFAULT_CONFIG.prism).unknown(),
282
293
  hideableSidebar: _utilsValidation.Joi.bool().default(DEFAULT_CONFIG.hideableSidebar),
294
+ autoCollapseSidebarCategories: _utilsValidation.Joi.bool().default(DEFAULT_CONFIG.autoCollapseSidebarCategories),
283
295
  sidebarCollapsible: _utilsValidation.Joi.forbidden().messages({
284
296
  'any.unknown': 'The themeConfig.sidebarCollapsible has been moved to docs plugin options. See: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs'
285
297
  }),
@@ -21,7 +21,7 @@
21
21
  transform: scale(0);
22
22
  }
23
23
 
24
- .backToTopButton:after {
24
+ .backToTopButton::after {
25
25
  content: ' ';
26
26
  display: inline-block;
27
27
  mask: var(--ifm-menu-link-sublist-icon) 50% / 2rem 2rem no-repeat;
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
- import Link from '@docusaurus/Link';
9
8
  import Translate, {translate} from '@docusaurus/Translate';
9
+ import PaginatorNavLink from '@theme/PaginatorNavLink';
10
10
 
11
11
  function BlogListPaginator(props) {
12
12
  const {metadata} = props;
@@ -21,30 +21,30 @@ function BlogListPaginator(props) {
21
21
  })}>
22
22
  <div className="pagination-nav__item">
23
23
  {previousPage && (
24
- <Link className="pagination-nav__link" to={previousPage}>
25
- <div className="pagination-nav__label">
26
- &laquo;{' '}
24
+ <PaginatorNavLink
25
+ permalink={previousPage}
26
+ title={
27
27
  <Translate
28
28
  id="theme.blog.paginator.newerEntries"
29
29
  description="The label used to navigate to the newer blog posts page (previous page)">
30
30
  Newer Entries
31
31
  </Translate>
32
- </div>
33
- </Link>
32
+ }
33
+ />
34
34
  )}
35
35
  </div>
36
36
  <div className="pagination-nav__item pagination-nav__item--next">
37
37
  {nextPage && (
38
- <Link className="pagination-nav__link" to={nextPage}>
39
- <div className="pagination-nav__label">
38
+ <PaginatorNavLink
39
+ permalink={nextPage}
40
+ title={
40
41
  <Translate
41
42
  id="theme.blog.paginator.olderEntries"
42
43
  description="The label used to navigate to the older blog posts page (next page)">
43
44
  Older Entries
44
- </Translate>{' '}
45
- &raquo;
46
- </div>
47
- </Link>
45
+ </Translate>
46
+ }
47
+ />
48
48
  )}
49
49
  </div>
50
50
  </nav>
@@ -19,7 +19,7 @@ function BlogPostAuthor({author}) {
19
19
  )}
20
20
 
21
21
  {
22
- // Note: only legacy author frontmatter allow empty name (not frontMatter.authors)
22
+ // Note: only legacy author front matter allow empty name (not frontMatter.authors)
23
23
  name && (
24
24
  <div
25
25
  className="avatar__intro"
@@ -16,10 +16,20 @@ export default function BlogPostAuthors({authors, assets}) {
16
16
  return null;
17
17
  }
18
18
 
19
+ const imageOnly = authors.every(({name}) => !name);
19
20
  return (
20
- <div className="row margin-top--md margin-bottom--sm">
21
+ <div
22
+ className={clsx(
23
+ 'margin-top--md margin-bottom--sm',
24
+ imageOnly ? styles.imageOnlyAuthorRow : 'row',
25
+ )}>
21
26
  {authors.map((author, idx) => (
22
- <div className={clsx('col col--6', styles.authorCol)} key={idx}>
27
+ <div
28
+ className={clsx(
29
+ !imageOnly && 'col col--6',
30
+ imageOnly ? styles.imageOnlyAuthorCol : styles.authorCol,
31
+ )}
32
+ key={idx}>
23
33
  <BlogPostAuthor
24
34
  author={{
25
35
  ...author,
@@ -9,3 +9,13 @@
9
9
  max-width: inherit !important;
10
10
  flex-grow: 1 !important;
11
11
  }
12
+
13
+ .imageOnlyAuthorRow {
14
+ display: flex;
15
+ flex-flow: row wrap;
16
+ }
17
+
18
+ .imageOnlyAuthorCol {
19
+ margin-left: 0.3rem;
20
+ margin-right: 0.3rem;
21
+ }