@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
@@ -40,12 +40,60 @@ function getSwizzleConfig() {
40
40
  },
41
41
  Footer: {
42
42
  actions: {
43
- eject: 'unsafe',
44
- // TODO split footer into smaller parts
43
+ eject: 'safe',
45
44
  wrap: 'safe'
46
45
  },
47
46
  description: "The footer component of you site's layout"
48
47
  },
48
+ 'Footer/Copyright': {
49
+ actions: {
50
+ eject: 'safe',
51
+ wrap: 'safe'
52
+ },
53
+ description: 'The footer copyright'
54
+ },
55
+ 'Footer/Layout': {
56
+ actions: {
57
+ eject: 'safe',
58
+ wrap: 'safe'
59
+ },
60
+ description: 'The footer main layout component'
61
+ },
62
+ 'Footer/LinkItem': {
63
+ actions: {
64
+ eject: 'safe',
65
+ wrap: 'safe'
66
+ },
67
+ description: 'The footer link item component'
68
+ },
69
+ 'Footer/Links': {
70
+ actions: {
71
+ eject: 'safe',
72
+ wrap: 'safe'
73
+ },
74
+ description: 'The footer component rendering the footer links'
75
+ },
76
+ 'Footer/Links/MultiColumn': {
77
+ actions: {
78
+ eject: 'safe',
79
+ wrap: 'safe'
80
+ },
81
+ description: 'The footer component rendering the footer links with a multi-column layout'
82
+ },
83
+ 'Footer/Links/Simple': {
84
+ actions: {
85
+ eject: 'safe',
86
+ wrap: 'safe'
87
+ },
88
+ description: 'The footer component rendering the footer links with a simple layout (single row)'
89
+ },
90
+ 'Footer/Logo': {
91
+ actions: {
92
+ eject: 'safe',
93
+ wrap: 'safe'
94
+ },
95
+ description: 'The footer logo'
96
+ },
49
97
  IconArrow: {
50
98
  actions: {
51
99
  eject: 'safe',
@@ -89,6 +137,69 @@ function getSwizzleConfig() {
89
137
  },
90
138
  description: 'The MDX components to use for rendering MDX files. Meant to be ejected.'
91
139
  },
140
+ 'MDXComponents/A': {
141
+ actions: {
142
+ eject: 'safe',
143
+ wrap: 'safe'
144
+ },
145
+ description: 'The component used to render <a> tags and Markdown links in MDX'
146
+ },
147
+ 'MDXComponents/Code': {
148
+ actions: {
149
+ eject: 'safe',
150
+ wrap: 'safe'
151
+ },
152
+ description: 'The component used to render <code> tags and Markdown code blocks in MDX'
153
+ },
154
+ 'MDXComponents/Details': {
155
+ actions: {
156
+ eject: 'safe',
157
+ wrap: 'safe'
158
+ },
159
+ description: 'The component used to render <details> tags in MDX'
160
+ },
161
+ 'MDXComponents/Head': {
162
+ actions: {
163
+ eject: 'forbidden',
164
+ wrap: 'forbidden'
165
+ },
166
+ description: 'Technical component used to assign metadata (generally for SEO purpose) to the current MDX document'
167
+ },
168
+ 'MDXComponents/Heading': {
169
+ actions: {
170
+ eject: 'safe',
171
+ wrap: 'safe'
172
+ },
173
+ description: 'The component used to render heading tags (<h1>, <h2>...) and Markdown headings in MDX'
174
+ },
175
+ 'MDXComponents/Img': {
176
+ actions: {
177
+ eject: 'safe',
178
+ wrap: 'safe'
179
+ },
180
+ description: 'The component used to render <img> tags and Markdown images in MDX'
181
+ },
182
+ 'MDXComponents/Pre': {
183
+ actions: {
184
+ eject: 'safe',
185
+ wrap: 'safe'
186
+ },
187
+ description: 'The component used to render <pre> tags in MDX'
188
+ },
189
+ 'MDXComponents/Ul': {
190
+ actions: {
191
+ eject: 'safe',
192
+ wrap: 'safe'
193
+ },
194
+ description: 'The component used to render <ul> tags and Markdown unordered lists in MDX'
195
+ },
196
+ MDXContent: {
197
+ actions: {
198
+ eject: 'safe',
199
+ wrap: 'safe'
200
+ },
201
+ description: 'A component wrapping all MDX content and providing the MDXComponents to the MDX context'
202
+ },
92
203
  // TODO should probably not even appear here
93
204
  'NavbarItem/utils': {
94
205
  actions: {
package/lib/index.js CHANGED
@@ -20,8 +20,6 @@ Object.defineProperty(exports, "validateThemeConfig", {
20
20
 
21
21
  var _translations = require("./translations");
22
22
 
23
- var _path = _interopRequireDefault(require("path"));
24
-
25
23
  var _module = require("module");
26
24
 
27
25
  var _rtlcss = _interopRequireDefault(require("rtlcss"));
@@ -112,25 +110,22 @@ function getInfimaCSSFile(direction) {
112
110
 
113
111
  function docusaurusThemeClassic(context, options) {
114
112
  const {
115
- siteConfig: {
116
- themeConfig: roughlyTypedThemeConfig
117
- },
118
113
  i18n: {
119
114
  currentLocale,
120
115
  localeConfigs
121
116
  }
122
117
  } = context;
123
- const themeConfig = roughlyTypedThemeConfig || {};
118
+ const themeConfig = context.siteConfig.themeConfig;
124
119
  const {
125
120
  announcementBar,
126
121
  colorMode,
127
122
  prism: {
128
- additionalLanguages = []
129
- } = {}
123
+ additionalLanguages
124
+ }
130
125
  } = themeConfig;
131
126
  const {
132
127
  customCss
133
- } = options || {};
128
+ } = options ?? {};
134
129
  const {
135
130
  direction
136
131
  } = localeConfigs[currentLocale];
@@ -138,11 +133,11 @@ function docusaurusThemeClassic(context, options) {
138
133
  name: 'docusaurus-theme-classic',
139
134
 
140
135
  getThemePath() {
141
- return _path.default.join(__dirname, '../lib-next/theme');
136
+ return '../lib-next/theme';
142
137
  },
143
138
 
144
139
  getTypeScriptThemePath() {
145
- return _path.default.resolve(__dirname, '../src/theme');
140
+ return '../src/theme';
146
141
  },
147
142
 
148
143
  getTranslationFiles: async () => (0, _translations.getTranslationFiles)({
@@ -161,7 +156,7 @@ function docusaurusThemeClassic(context, options) {
161
156
  },
162
157
 
163
158
  getClientModules() {
164
- const modules = [require.resolve(getInfimaCSSFile(direction)), _path.default.resolve(__dirname, './prism-include-languages'), _path.default.resolve(__dirname, './admonitions.css')];
159
+ const modules = [require.resolve(getInfimaCSSFile(direction)), './prism-include-languages', './admonitions.css'];
165
160
 
166
161
  if (customCss) {
167
162
  if (Array.isArray(customCss)) {
@@ -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
- }
@@ -45,6 +45,10 @@ function getNavbarTranslationFile(navbar) {
45
45
  function translateNavbar(navbar, navbarTranslations) {
46
46
  var _navbarTranslations$t;
47
47
 
48
+ if (!navbarTranslations) {
49
+ return navbar;
50
+ }
51
+
48
52
  return { ...navbar,
49
53
  title: ((_navbarTranslations$t = navbarTranslations.title) === null || _navbarTranslations$t === void 0 ? void 0 : _navbarTranslations$t.message) ?? navbar.title,
50
54
  // TODO handle properly all the navbar item types here!
@@ -93,6 +97,10 @@ function getFooterTranslationFile(footer) {
93
97
  function translateFooter(footer, footerTranslations) {
94
98
  var _footerTranslations$c;
95
99
 
100
+ if (!footerTranslations) {
101
+ return footer;
102
+ }
103
+
96
104
  const links = isMultiColumnFooterLinks(footer.links) ? footer.links.map(link => {
97
105
  var _footerTranslations$;
98
106
 
@@ -137,10 +145,12 @@ function translateThemeConfig({
137
145
  themeConfig,
138
146
  translationFiles
139
147
  }) {
148
+ var _translationFilesMap$, _translationFilesMap$2;
149
+
140
150
  const translationFilesMap = _lodash.default.keyBy(translationFiles, f => f.path);
141
151
 
142
152
  return { ...themeConfig,
143
- navbar: translateNavbar(themeConfig.navbar, translationFilesMap.navbar.content),
144
- footer: themeConfig.footer ? translateFooter(themeConfig.footer, translationFilesMap.footer.content) : undefined
153
+ navbar: translateNavbar(themeConfig.navbar, (_translationFilesMap$ = translationFilesMap.navbar) === null || _translationFilesMap$ === void 0 ? void 0 : _translationFilesMap$.content),
154
+ footer: themeConfig.footer ? translateFooter(themeConfig.footer, (_translationFilesMap$2 = translationFilesMap.footer) === null || _translationFilesMap$2 === void 0 ? void 0 : _translationFilesMap$2.content) : undefined
145
155
  };
146
156
  }