@docusaurus/theme-classic 2.0.0-beta.1ab8aa0af → 2.0.0-beta.2

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 (217) hide show
  1. package/codeTranslations/ar.json +2 -0
  2. package/codeTranslations/base.json +4 -0
  3. package/codeTranslations/bn.json +56 -0
  4. package/codeTranslations/da.json +2 -0
  5. package/codeTranslations/de.json +2 -0
  6. package/codeTranslations/es.json +2 -0
  7. package/codeTranslations/fa.json +2 -0
  8. package/codeTranslations/fil.json +2 -0
  9. package/codeTranslations/fr.json +2 -0
  10. package/codeTranslations/he.json +18 -16
  11. package/codeTranslations/hi.json +2 -0
  12. package/codeTranslations/ja.json +2 -0
  13. package/codeTranslations/ko.json +2 -0
  14. package/codeTranslations/pl.json +2 -0
  15. package/codeTranslations/pt-BR.json +2 -0
  16. package/codeTranslations/pt-PT.json +2 -0
  17. package/codeTranslations/ru.json +2 -0
  18. package/codeTranslations/tr.json +2 -0
  19. package/codeTranslations/vi.json +2 -0
  20. package/codeTranslations/zh-Hans.json +2 -0
  21. package/codeTranslations/zh-Hant.json +2 -0
  22. package/lib/index.js +28 -7
  23. package/lib/theme/AnnouncementBar/index.js +5 -7
  24. package/lib/theme/AnnouncementBar/styles.module.css +6 -6
  25. package/lib/theme/BlogListPage/index.js +2 -2
  26. package/lib/theme/BlogListPaginator/index.js +2 -2
  27. package/lib/theme/BlogPostItem/index.js +32 -23
  28. package/lib/theme/BlogPostItem/styles.module.css +5 -1
  29. package/lib/theme/BlogPostPage/index.js +4 -10
  30. package/lib/theme/BlogPostPaginator/index.js +3 -3
  31. package/lib/theme/BlogSidebar/index.js +11 -3
  32. package/lib/theme/BlogSidebar/styles.module.css +4 -6
  33. package/lib/theme/BlogTagsListPage/index.js +15 -20
  34. package/lib/theme/BlogTagsPostsPage/index.js +29 -33
  35. package/lib/theme/CodeBlock/index.js +11 -11
  36. package/lib/theme/CodeBlock/styles.module.css +4 -7
  37. package/lib/theme/DocItem/index.js +35 -26
  38. package/lib/theme/DocItem/styles.module.css +8 -10
  39. package/lib/theme/DocPage/index.js +43 -11
  40. package/lib/theme/DocPage/styles.module.css +7 -19
  41. package/lib/theme/DocPaginator/index.js +3 -3
  42. package/lib/theme/DocSidebar/index.js +23 -24
  43. package/lib/theme/DocSidebar/styles.module.css +0 -14
  44. package/lib/theme/DocVersionBanner/index.js +128 -0
  45. package/lib/theme/DocVersionSuggestions/index.js +4 -4
  46. package/lib/theme/Heading/index.js +18 -2
  47. package/lib/theme/Heading/styles.module.css +5 -0
  48. package/lib/theme/IconArrow/index.js +1 -1
  49. package/lib/theme/IconEdit/index.js +1 -1
  50. package/lib/theme/IconExternalLink/index.js +30 -0
  51. package/lib/theme/IconExternalLink/styles.module.css +12 -0
  52. package/lib/theme/IconLanguage/index.js +1 -1
  53. package/lib/theme/IconMenu/index.js +1 -2
  54. package/lib/theme/LastUpdated/index.js +17 -21
  55. package/lib/theme/Layout/styles.css +6 -0
  56. package/lib/theme/LayoutHead/index.js +3 -1
  57. package/lib/theme/LayoutProviders/index.js +7 -5
  58. package/lib/theme/Logo/index.js +13 -12
  59. package/lib/theme/MDXComponents/index.js +2 -2
  60. package/lib/theme/MDXPage/index.js +13 -15
  61. package/{src/theme/LastUpdated → lib/theme/MDXPage}/styles.module.css +2 -2
  62. package/lib/theme/Navbar/index.js +4 -4
  63. package/lib/theme/Navbar/styles.module.css +1 -1
  64. package/lib/theme/NavbarItem/DefaultNavbarItem.js +18 -4
  65. package/lib/theme/NavbarItem/DocNavbarItem.js +19 -11
  66. package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +5 -4
  67. package/lib/theme/NavbarItem/SearchNavbarItem.js +1 -5
  68. package/lib/theme/NavbarItem/index.js +1 -1
  69. package/lib/theme/NotFound.js +9 -2
  70. package/lib/theme/SearchMetadatas/index.js +1 -1
  71. package/lib/theme/Seo/index.js +0 -1
  72. package/lib/theme/SkipToContent/index.js +6 -4
  73. package/lib/theme/SkipToContent/styles.module.css +1 -3
  74. package/lib/theme/TOC/styles.module.css +1 -1
  75. package/lib/theme/Tabs/index.js +2 -2
  76. package/lib/theme/ThemedImage/index.js +2 -1
  77. package/lib/theme/ThemedImage/styles.module.css +7 -0
  78. package/lib/theme/Toggle/index.js +12 -24
  79. package/lib/theme/Toggle/styles.css +103 -0
  80. package/lib/theme/Toggle/styles.module.css +0 -97
  81. package/lib/theme/UserPreferencesProvider/index.js +1 -9
  82. package/lib/theme/hooks/useHideableNavbar.js +2 -2
  83. package/lib/theme/hooks/useTabGroupChoice.js +2 -4
  84. package/lib/theme/hooks/useThemeContext.js +1 -1
  85. package/lib/theme/hooks/useUserPreferencesContext.js +1 -1
  86. package/lib/types.d.ts +10 -12
  87. package/lib/validateThemeConfig.js +3 -3
  88. package/lib-next/index.js +31 -8
  89. package/lib-next/theme/AnnouncementBar/index.js +5 -9
  90. package/lib-next/theme/AnnouncementBar/styles.module.css +6 -6
  91. package/lib-next/theme/BlogListPage/index.js +2 -2
  92. package/lib-next/theme/BlogPostItem/index.js +41 -24
  93. package/lib-next/theme/BlogPostItem/styles.module.css +5 -1
  94. package/lib-next/theme/BlogPostPage/index.js +4 -8
  95. package/lib-next/theme/BlogPostPaginator/index.js +1 -1
  96. package/lib-next/theme/BlogSidebar/index.js +12 -3
  97. package/lib-next/theme/BlogSidebar/styles.module.css +4 -6
  98. package/lib-next/theme/BlogTagsListPage/index.js +17 -23
  99. package/lib-next/theme/BlogTagsPostsPage/index.js +36 -40
  100. package/lib-next/theme/CodeBlock/index.js +10 -9
  101. package/lib-next/theme/CodeBlock/styles.module.css +4 -7
  102. package/lib-next/theme/DocItem/index.js +41 -41
  103. package/lib-next/theme/DocItem/styles.module.css +8 -10
  104. package/lib-next/theme/DocPage/index.js +36 -9
  105. package/lib-next/theme/DocPage/styles.module.css +7 -19
  106. package/lib-next/theme/DocPaginator/index.js +1 -1
  107. package/lib-next/theme/DocSidebar/index.js +28 -21
  108. package/lib-next/theme/DocSidebar/styles.module.css +0 -14
  109. package/lib-next/theme/DocVersionBanner/index.js +127 -0
  110. package/lib-next/theme/DocVersionSuggestions/index.js +4 -4
  111. package/lib-next/theme/Heading/index.js +17 -1
  112. package/lib-next/theme/Heading/styles.module.css +5 -0
  113. package/lib-next/theme/IconArrow/index.js +1 -1
  114. package/lib-next/theme/IconEdit/index.js +3 -5
  115. package/lib-next/theme/IconExternalLink/index.js +26 -0
  116. package/{lib/theme/NavbarItem → lib-next/theme/IconExternalLink}/styles.module.css +4 -5
  117. package/lib-next/theme/IconLanguage/index.js +1 -1
  118. package/lib-next/theme/IconMenu/index.js +1 -4
  119. package/lib-next/theme/LastUpdated/index.js +34 -39
  120. package/lib-next/theme/Layout/styles.css +6 -0
  121. package/lib-next/theme/LayoutHead/index.js +5 -1
  122. package/lib-next/theme/LayoutProviders/index.js +11 -6
  123. package/lib-next/theme/Logo/index.js +12 -8
  124. package/lib-next/theme/MDXPage/index.js +13 -17
  125. package/lib-next/theme/{LastUpdated → MDXPage}/styles.module.css +2 -2
  126. package/lib-next/theme/Navbar/index.js +2 -2
  127. package/lib-next/theme/Navbar/styles.module.css +1 -1
  128. package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +19 -2
  129. package/lib-next/theme/NavbarItem/DocNavbarItem.js +23 -9
  130. package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +6 -6
  131. package/lib-next/theme/NavbarItem/SearchNavbarItem.js +1 -6
  132. package/lib-next/theme/NavbarItem/index.js +1 -1
  133. package/lib-next/theme/NotFound.js +6 -2
  134. package/lib-next/theme/SearchMetadatas/index.js +1 -1
  135. package/lib-next/theme/Seo/index.js +0 -1
  136. package/lib-next/theme/SkipToContent/index.js +3 -3
  137. package/lib-next/theme/SkipToContent/styles.module.css +1 -3
  138. package/lib-next/theme/TOC/styles.module.css +1 -1
  139. package/lib-next/theme/ThemedImage/index.js +2 -3
  140. package/lib-next/theme/ThemedImage/styles.module.css +7 -0
  141. package/lib-next/theme/Toggle/index.js +9 -24
  142. package/lib-next/theme/Toggle/styles.css +103 -0
  143. package/lib-next/theme/Toggle/styles.module.css +0 -97
  144. package/lib-next/theme/UserPreferencesProvider/index.js +0 -4
  145. package/lib-next/theme/hooks/useHideableNavbar.js +3 -3
  146. package/lib-next/theme/hooks/useTabGroupChoice.js +2 -4
  147. package/lib-next/theme/hooks/useThemeContext.js +1 -1
  148. package/lib-next/theme/hooks/useUserPreferencesContext.js +1 -1
  149. package/lib-next/types.d.ts +10 -12
  150. package/lib-next/validateThemeConfig.js +3 -3
  151. package/package.json +18 -17
  152. package/src/index.ts +32 -8
  153. package/src/theme/AnnouncementBar/index.tsx +6 -9
  154. package/src/theme/AnnouncementBar/styles.module.css +6 -6
  155. package/src/theme/BlogListPage/index.tsx +2 -2
  156. package/src/theme/BlogPostItem/index.tsx +40 -24
  157. package/src/theme/BlogPostItem/styles.module.css +5 -1
  158. package/src/theme/BlogPostPage/index.tsx +4 -8
  159. package/src/theme/BlogPostPaginator/index.tsx +1 -1
  160. package/src/theme/BlogSidebar/index.tsx +12 -3
  161. package/src/theme/BlogSidebar/styles.module.css +4 -6
  162. package/src/theme/BlogTagsListPage/index.tsx +17 -22
  163. package/src/theme/BlogTagsPostsPage/index.tsx +33 -43
  164. package/src/theme/CodeBlock/index.tsx +10 -9
  165. package/src/theme/CodeBlock/styles.module.css +4 -7
  166. package/src/theme/DocItem/index.tsx +40 -40
  167. package/src/theme/DocItem/styles.module.css +8 -10
  168. package/src/theme/DocPage/index.tsx +29 -9
  169. package/src/theme/DocPage/styles.module.css +7 -19
  170. package/src/theme/DocPaginator/index.tsx +1 -1
  171. package/src/theme/DocSidebar/index.tsx +28 -21
  172. package/src/theme/DocSidebar/styles.module.css +0 -14
  173. package/src/theme/{DocVersionSuggestions → DocVersionBanner}/index.tsx +46 -43
  174. package/src/theme/Heading/index.tsx +22 -1
  175. package/src/theme/Heading/styles.module.css +5 -0
  176. package/src/theme/IconArrow/index.tsx +1 -1
  177. package/src/theme/IconEdit/index.tsx +3 -5
  178. package/src/theme/IconExternalLink/index.tsx +32 -0
  179. package/src/theme/IconExternalLink/styles.module.css +12 -0
  180. package/src/theme/IconLanguage/index.tsx +1 -1
  181. package/src/theme/IconMenu/index.tsx +1 -4
  182. package/src/theme/LastUpdated/index.tsx +34 -39
  183. package/src/theme/Layout/styles.css +6 -0
  184. package/src/theme/LayoutHead/index.tsx +5 -1
  185. package/src/theme/LayoutProviders/index.tsx +11 -6
  186. package/src/theme/Logo/index.tsx +10 -6
  187. package/src/theme/MDXPage/index.tsx +14 -17
  188. package/{lib/theme/LastUpdated → src/theme/MDXPage}/styles.module.css +2 -2
  189. package/src/theme/Navbar/index.tsx +2 -2
  190. package/src/theme/Navbar/styles.module.css +1 -1
  191. package/src/theme/NavbarItem/DefaultNavbarItem.tsx +15 -2
  192. package/src/theme/NavbarItem/DocNavbarItem.tsx +29 -10
  193. package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +7 -6
  194. package/src/theme/NavbarItem/SearchNavbarItem.tsx +1 -6
  195. package/src/theme/NavbarItem/index.tsx +1 -1
  196. package/src/theme/NotFound.tsx +6 -2
  197. package/src/theme/SearchMetadatas/index.tsx +1 -1
  198. package/src/theme/Seo/index.tsx +0 -1
  199. package/src/theme/SkipToContent/index.tsx +3 -3
  200. package/src/theme/SkipToContent/styles.module.css +1 -3
  201. package/src/theme/TOC/styles.module.css +1 -1
  202. package/src/theme/ThemedImage/index.tsx +3 -3
  203. package/src/theme/ThemedImage/styles.module.css +7 -0
  204. package/src/theme/Toggle/index.tsx +9 -22
  205. package/src/theme/Toggle/styles.css +103 -0
  206. package/src/theme/Toggle/styles.module.css +0 -97
  207. package/src/theme/UserPreferencesProvider/index.tsx +0 -5
  208. package/src/theme/hooks/useHideableNavbar.ts +3 -3
  209. package/src/theme/hooks/useTabGroupChoice.ts +2 -2
  210. package/src/theme/hooks/useThemeContext.ts +1 -1
  211. package/src/theme/hooks/useUserPreferencesContext.ts +1 -1
  212. package/src/types.d.ts +10 -12
  213. package/src/validateThemeConfig.js +3 -3
  214. package/update-code-translations.js +1 -0
  215. package/lib-next/theme/NavbarItem/styles.module.css +0 -13
  216. package/src/theme/NavbarItem/styles.module.css +0 -13
  217. package/src/theme/hooks/useAnnouncementBar.ts +0 -58
@@ -5,7 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
- import styles from './styles.module.css';
9
8
  import Translate from '@docusaurus/Translate';
10
9
 
11
10
  function LastUpdatedAtDate({lastUpdatedAt, formattedLastUpdatedAt}) {
@@ -15,11 +14,11 @@ function LastUpdatedAtDate({lastUpdatedAt, formattedLastUpdatedAt}) {
15
14
  description="The words used to describe on which date a page has been last updated"
16
15
  values={{
17
16
  date: (
18
- <time
19
- dateTime={new Date(lastUpdatedAt * 1000).toISOString()}
20
- className={styles.lastUpdatedDate}>
21
- {formattedLastUpdatedAt}
22
- </time>
17
+ <b>
18
+ <time dateTime={new Date(lastUpdatedAt * 1000).toISOString()}>
19
+ {formattedLastUpdatedAt}
20
+ </time>
21
+ </b>
23
22
  ),
24
23
  }}>
25
24
  {' on {date}'}
@@ -33,7 +32,7 @@ function LastUpdatedByUser({lastUpdatedBy}) {
33
32
  id="theme.lastUpdated.byUser"
34
33
  description="The words used to describe by who the page has been last updated"
35
34
  values={{
36
- user: <strong>{lastUpdatedBy}</strong>,
35
+ user: <b>{lastUpdatedBy}</b>,
37
36
  }}>
38
37
  {' by {user}'}
39
38
  </Translate>
@@ -46,37 +45,33 @@ export default function LastUpdated({
46
45
  lastUpdatedBy,
47
46
  }) {
48
47
  return (
49
- <div className="col text--right">
50
- <em>
51
- <small>
52
- <Translate
53
- id="theme.lastUpdated.lastUpdatedAtBy"
54
- description="The sentence used to display when a page has been last updated, and by who"
55
- values={{
56
- atDate:
57
- lastUpdatedAt && formattedLastUpdatedAt ? (
58
- <LastUpdatedAtDate
59
- lastUpdatedAt={lastUpdatedAt}
60
- formattedLastUpdatedAt={formattedLastUpdatedAt}
61
- />
62
- ) : (
63
- ''
64
- ),
65
- byUser: lastUpdatedBy ? (
66
- <LastUpdatedByUser lastUpdatedBy={lastUpdatedBy} />
67
- ) : (
68
- ''
69
- ),
70
- }}>
71
- {'Last updated{atDate}{byUser}'}
72
- </Translate>
73
- {process.env.NODE_ENV === 'development' && (
74
- <div>
75
- <small> (Simulated during dev for better perf)</small>
76
- </div>
77
- )}
78
- </small>
79
- </em>
80
- </div>
48
+ <>
49
+ <Translate
50
+ id="theme.lastUpdated.lastUpdatedAtBy"
51
+ description="The sentence used to display when a page has been last updated, and by who"
52
+ values={{
53
+ atDate:
54
+ lastUpdatedAt && formattedLastUpdatedAt ? (
55
+ <LastUpdatedAtDate
56
+ lastUpdatedAt={lastUpdatedAt}
57
+ formattedLastUpdatedAt={formattedLastUpdatedAt}
58
+ />
59
+ ) : (
60
+ ''
61
+ ),
62
+ byUser: lastUpdatedBy ? (
63
+ <LastUpdatedByUser lastUpdatedBy={lastUpdatedBy} />
64
+ ) : (
65
+ ''
66
+ ),
67
+ }}>
68
+ {'Last updated{atDate}{byUser}'}
69
+ </Translate>
70
+ {process.env.NODE_ENV === 'development' && (
71
+ <div>
72
+ <small> (Simulated during dev for better perf)</small>
73
+ </div>
74
+ )}
75
+ </>
81
76
  );
82
77
  }
@@ -19,3 +19,9 @@ body {
19
19
  .main-wrapper {
20
20
  flex: 1 0 auto;
21
21
  }
22
+
23
+ /* Docusaurus-specific utility classes */
24
+
25
+ .docusaurus-mt-lg {
26
+ margin-top: 3rem;
27
+ }
@@ -79,7 +79,7 @@ export default function LayoutHead(props) {
79
79
  const {
80
80
  siteConfig: {
81
81
  favicon,
82
- themeConfig: {metadatas},
82
+ themeConfig: {metadatas, image: defaultImage},
83
83
  },
84
84
  i18n: {currentLocale, localeConfigs},
85
85
  } = useDocusaurusContext();
@@ -98,6 +98,10 @@ export default function LayoutHead(props) {
98
98
  {favicon && <link rel="shortcut icon" href={faviconUrl} />}
99
99
  <title>{pageTitle}</title>
100
100
  <meta property="og:title" content={pageTitle} />
101
+ {image ||
102
+ (defaultImage && (
103
+ <meta name="twitter:card" content="summary_large_image" />
104
+ ))}
101
105
  </Head>
102
106
 
103
107
  <Seo
@@ -7,15 +7,20 @@
7
7
  import React from 'react';
8
8
  import ThemeProvider from '@theme/ThemeProvider';
9
9
  import UserPreferencesProvider from '@theme/UserPreferencesProvider';
10
- import {DocsPreferredVersionContextProvider} from '@docusaurus/theme-common';
10
+ import {
11
+ AnnouncementBarProvider,
12
+ DocsPreferredVersionContextProvider,
13
+ } from '@docusaurus/theme-common';
11
14
  export default function LayoutProviders({children}) {
12
15
  return (
13
16
  <ThemeProvider>
14
- <UserPreferencesProvider>
15
- <DocsPreferredVersionContextProvider>
16
- {children}
17
- </DocsPreferredVersionContextProvider>
18
- </UserPreferencesProvider>
17
+ <AnnouncementBarProvider>
18
+ <UserPreferencesProvider>
19
+ <DocsPreferredVersionContextProvider>
20
+ {children}
21
+ </DocsPreferredVersionContextProvider>
22
+ </UserPreferencesProvider>
23
+ </AnnouncementBarProvider>
19
24
  </ThemeProvider>
20
25
  );
21
26
  }
@@ -9,18 +9,22 @@ import Link from '@docusaurus/Link';
9
9
  import ThemedImage from '@theme/ThemedImage';
10
10
  import useBaseUrl from '@docusaurus/useBaseUrl';
11
11
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
12
- import {useThemeConfig} from '@docusaurus/theme-common';
13
12
 
14
13
  const Logo = (props) => {
15
- const {isClient} = useDocusaurusContext();
16
14
  const {
17
- navbar: {
15
+ siteConfig: {
18
16
  title,
19
- logo = {
20
- src: '',
17
+ themeConfig: {
18
+ navbar: {
19
+ title: navbarTitle,
20
+ logo = {
21
+ src: '',
22
+ },
23
+ },
21
24
  },
22
25
  },
23
- } = useThemeConfig();
26
+ isClient,
27
+ } = useDocusaurusContext();
24
28
  const {imageClassName, titleClassName, ...propsRest} = props;
25
29
  const logoLink = useBaseUrl(logo.href || '/');
26
30
  const sources = {
@@ -39,10 +43,10 @@ const Logo = (props) => {
39
43
  key={isClient}
40
44
  className={imageClassName}
41
45
  sources={sources}
42
- alt={logo.alt || title || 'Logo'}
46
+ alt={logo.alt || navbarTitle || title}
43
47
  />
44
48
  )}
45
- {title != null && <strong className={titleClassName}>{title}</strong>}
49
+ {navbarTitle != null && <b className={titleClassName}>{navbarTitle}</b>}
46
50
  </Link>
47
51
  );
48
52
  };
@@ -5,11 +5,13 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
+ import clsx from 'clsx';
8
9
  import Layout from '@theme/Layout';
9
10
  import {MDXProvider} from '@mdx-js/react';
10
11
  import MDXComponents from '@theme/MDXComponents';
11
12
  import TOC from '@theme/TOC';
12
13
  import {ThemeClassNames} from '@docusaurus/theme-common';
14
+ import styles from './styles.module.css';
13
15
 
14
16
  function MDXPage(props) {
15
17
  const {content: MDXPageContent} = props;
@@ -28,24 +30,18 @@ function MDXPage(props) {
28
30
  permalink={permalink}
29
31
  wrapperClassName={wrapperClassName ?? ThemeClassNames.wrapper.mdxPages}
30
32
  pageClassName={ThemeClassNames.page.mdxPage}>
31
- <main>
32
- <div className="container container--fluid">
33
- <div className="margin-vert--lg padding-vert--lg">
34
- <div className="row">
35
- <div className="col col--8 col--offset-2">
36
- <div className="container">
37
- <MDXProvider components={MDXComponents}>
38
- <MDXPageContent />
39
- </MDXProvider>
40
- </div>
41
- </div>
42
- {!hideTableOfContents && MDXPageContent.toc && (
43
- <div className="col col--2">
44
- <TOC toc={MDXPageContent.toc} />
45
- </div>
46
- )}
47
- </div>
33
+ <main className="container container--fluid margin-vert--lg">
34
+ <div className={clsx('row', styles.mdxPageWrapper)}>
35
+ <div className={clsx('col', !hideTableOfContents && 'col--8')}>
36
+ <MDXProvider components={MDXComponents}>
37
+ <MDXPageContent />
38
+ </MDXProvider>
48
39
  </div>
40
+ {!hideTableOfContents && MDXPageContent.toc && (
41
+ <div className="col col--2">
42
+ <TOC toc={MDXPageContent.toc} />
43
+ </div>
44
+ )}
49
45
  </div>
50
46
  </main>
51
47
  </Layout>
@@ -5,6 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- .lastUpdatedDate {
9
- font-weight: bold;
8
+ .mdxPageWrapper {
9
+ justify-content: center;
10
10
  }
@@ -76,7 +76,7 @@ function Navbar() {
76
76
  {items != null && items.length !== 0 && (
77
77
  <button
78
78
  aria-label="Navigation bar toggle"
79
- className="navbar__toggle"
79
+ className="navbar__toggle clean-btn"
80
80
  type="button"
81
81
  tabIndex={0}
82
82
  onClick={showSidebar}
@@ -87,7 +87,7 @@ function Navbar() {
87
87
  <Logo
88
88
  className="navbar__brand"
89
89
  imageClassName="navbar__logo"
90
- titleClassName={clsx('navbar__title')}
90
+ titleClassName="navbar__title"
91
91
  />
92
92
  {leftItems.map((item, i) => (
93
93
  <NavbarItem {...item} key={i} />
@@ -16,5 +16,5 @@
16
16
  }
17
17
 
18
18
  .navbarHidden {
19
- transform: translate3d(0, calc(var(--ifm-navbar-height) * -1), 0);
19
+ transform: translate3d(0, calc(-100% - 2px), 0);
20
20
  }
@@ -10,6 +10,9 @@ import Link from '@docusaurus/Link';
10
10
  import useBaseUrl from '@docusaurus/useBaseUrl';
11
11
  import {useLocation} from '@docusaurus/router';
12
12
  import {isSamePath} from '@docusaurus/theme-common';
13
+ import IconExternalLink from '@theme/IconExternalLink';
14
+ import isInternalUrl from '@docusaurus/isInternalUrl';
15
+ const dropdownLinkActiveClass = 'dropdown__link--active';
13
16
 
14
17
  function NavLink({
15
18
  activeBasePath,
@@ -28,6 +31,8 @@ function NavLink({
28
31
  const normalizedHref = useBaseUrl(href, {
29
32
  forcePrependBaseUrl: true,
30
33
  });
34
+ const isExternalLink = label && href && !isInternalUrl(href);
35
+ const isDropdownLink = activeClassName === dropdownLinkActiveClass;
31
36
  return (
32
37
  <Link
33
38
  {...(href
@@ -48,7 +53,19 @@ function NavLink({
48
53
  : null),
49
54
  })}
50
55
  {...props}>
51
- {label}
56
+ {isExternalLink ? (
57
+ <span>
58
+ {label}
59
+ <IconExternalLink
60
+ {...(isDropdownLink && {
61
+ width: 12,
62
+ height: 12,
63
+ })}
64
+ />
65
+ </span>
66
+ ) : (
67
+ label
68
+ )}
52
69
  </Link>
53
70
  );
54
71
  }
@@ -122,7 +139,7 @@ function NavItemDesktop({items, position, className, ...props}) {
122
139
  }
123
140
  }
124
141
  }}
125
- activeClassName="dropdown__link--active"
142
+ activeClassName={dropdownLinkActiveClass}
126
143
  className={navLinkClassNames(childItemClassName, true)}
127
144
  {...childItemProps}
128
145
  />
@@ -9,6 +9,24 @@ import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
9
9
  import {useLatestVersion, useActiveDocContext} from '@theme/hooks/useDocs';
10
10
  import clsx from 'clsx';
11
11
  import {useDocsPreferredVersion} from '@docusaurus/theme-common';
12
+ import {uniq} from '@docusaurus/utils-common';
13
+
14
+ function getDocInVersions(versions, docId) {
15
+ // vanilla-js flatten, TODO replace soon by ES flat() / flatMap()
16
+ const allDocs = [].concat(...versions.map((version) => version.docs));
17
+ const doc = allDocs.find((versionDoc) => versionDoc.id === docId);
18
+
19
+ if (!doc) {
20
+ const docIds = allDocs.map((versionDoc) => versionDoc.id).join('\n- ');
21
+ throw new Error(`DocNavbarItem: couldn't find any doc with id "${docId}" in version${
22
+ versions.length ? 's' : ''
23
+ } ${versions.map((version) => version.name).join(', ')}".
24
+ Available doc ids are:\n- ${docIds}`);
25
+ }
26
+
27
+ return doc;
28
+ }
29
+
12
30
  export default function DocNavbarItem({
13
31
  docId,
14
32
  activeSidebarClassName,
@@ -18,16 +36,12 @@ export default function DocNavbarItem({
18
36
  }) {
19
37
  const {activeVersion, activeDoc} = useActiveDocContext(docsPluginId);
20
38
  const {preferredVersion} = useDocsPreferredVersion(docsPluginId);
21
- const latestVersion = useLatestVersion(docsPluginId);
22
- const version = activeVersion ?? preferredVersion ?? latestVersion;
23
- const doc = version.docs.find((versionDoc) => versionDoc.id === docId);
24
-
25
- if (!doc) {
26
- const docIds = version.docs.map((versionDoc) => versionDoc.id).join('\n- ');
27
- throw new Error(`DocNavbarItem: couldn't find any doc with id=${docId} in version ${version.name}.
28
- Available docIds=\n- ${docIds}`);
29
- }
39
+ const latestVersion = useLatestVersion(docsPluginId); // Versions used to look for the doc to link to, ordered + no duplicate
30
40
 
41
+ const versions = uniq(
42
+ [activeVersion, preferredVersion, latestVersion].filter(Boolean),
43
+ );
44
+ const doc = getDocInVersions(versions, docId);
31
45
  return (
32
46
  <DefaultNavbarItem
33
47
  exact
@@ -63,20 +63,20 @@ export default function DocsVersionDropdownNavbarItem({
63
63
  return items;
64
64
  }
65
65
 
66
+ const items = getItems();
66
67
  const dropdownVersion =
67
- activeDocContext.activeVersion ?? preferredVersion ?? latestVersion; // Mobile is handled a bit differently
68
+ activeDocContext.activeVersion ?? preferredVersion ?? latestVersion; // Mobile dropdown is handled a bit differently
68
69
 
69
- const dropdownLabel = mobile ? 'Versions' : dropdownVersion.label;
70
- const dropdownTo = mobile
71
- ? undefined
72
- : getVersionMainDoc(dropdownVersion).path;
70
+ const dropdownLabel = mobile && items ? 'Versions' : dropdownVersion.label;
71
+ const dropdownTo =
72
+ mobile && items ? undefined : getVersionMainDoc(dropdownVersion).path;
73
73
  return (
74
74
  <DefaultNavbarItem
75
75
  {...props}
76
76
  mobile={mobile}
77
77
  label={dropdownLabel}
78
78
  to={dropdownTo}
79
- items={getItems()}
79
+ items={items}
80
80
  isActive={dropdownActiveClassDisabled ? () => false : undefined}
81
81
  />
82
82
  );
@@ -6,15 +6,10 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import SearchBar from '@theme/SearchBar';
9
- import styles from './styles.module.css';
10
9
  export default function SearchNavbarItem({mobile}) {
11
10
  if (mobile) {
12
11
  return null;
13
12
  }
14
13
 
15
- return (
16
- <div className={styles.searchWrapper}>
17
- <SearchBar />
18
- </div>
19
- );
14
+ return <SearchBar />;
20
15
  }
@@ -29,7 +29,7 @@ const getNavbarItemComponent = (type = 'default') => {
29
29
  const navbarItemComponent = NavbarItemComponents[type];
30
30
 
31
31
  if (!navbarItemComponent) {
32
- throw new Error(`No NavbarItem component found for type=${type}.`);
32
+ throw new Error(`No NavbarItem component found for type "${type}".`);
33
33
  }
34
34
 
35
35
  return navbarItemComponent();
@@ -6,11 +6,15 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import Layout from '@theme/Layout';
9
- import Translate from '@docusaurus/Translate';
9
+ import Translate, {translate} from '@docusaurus/Translate';
10
10
 
11
11
  function NotFound() {
12
12
  return (
13
- <Layout title="Page Not Found">
13
+ <Layout
14
+ title={translate({
15
+ id: 'theme.NotFound.title',
16
+ message: 'Page Not Found',
17
+ })}>
14
18
  <main className="container margin-vert--xl">
15
19
  <div className="row">
16
20
  <div className="col col--6 col--offset-3">
@@ -12,7 +12,7 @@ import Head from '@docusaurus/Head';
12
12
  export default function SearchMetadatas({locale, version, tag}) {
13
13
  return (
14
14
  <Head>
15
- {locale && <meta name="docusaurus_locale" content={`${locale}`} />}
15
+ {locale && <meta name="docusaurus_locale" content={locale} />}
16
16
  {version && <meta name="docusaurus_version" content={version} />}
17
17
  {tag && <meta name="docusaurus_tag" content={tag} />}
18
18
  </Head>
@@ -31,7 +31,6 @@ export default function Seo({title, description, keywords, image}) {
31
31
 
32
32
  {pageImage && <meta property="og:image" content={pageImage} />}
33
33
  {pageImage && <meta name="twitter:image" content={pageImage} />}
34
- {pageImage && <meta name="twitter:card" content="summary_large_image" />}
35
34
  </Head>
36
35
  );
37
36
  }
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import React, {useRef} from 'react';
8
8
  import Translate from '@docusaurus/Translate';
9
- import {useChangeRoute} from '@docusaurus/theme-common';
9
+ import {useLocationChange} from '@docusaurus/theme-common';
10
10
  import styles from './styles.module.css';
11
11
 
12
12
  function programmaticFocus(el) {
@@ -29,8 +29,8 @@ function SkipToContent() {
29
29
  }
30
30
  };
31
31
 
32
- useChangeRoute(() => {
33
- if (containerRef.current) {
32
+ useLocationChange(({location}) => {
33
+ if (containerRef.current && !location.hash) {
34
34
  programmaticFocus(containerRef.current);
35
35
  }
36
36
  });
@@ -6,11 +6,9 @@
6
6
  padding: calc(var(--ifm-global-spacing) / 2) var(--ifm-global-spacing);
7
7
  color: var(--ifm-color-emphasis-900);
8
8
  background-color: var(--ifm-background-surface-color);
9
- border-radius: var(--ifm-global-radius);
10
- font: inherit;
11
- border: none;
12
9
  }
13
10
 
14
11
  .skipToContent:focus {
15
12
  left: 1rem;
13
+ box-shadow: var(--ifm-global-shadow-md);
16
14
  }
@@ -9,7 +9,7 @@
9
9
  max-height: calc(100vh - (var(--ifm-navbar-height) + 2rem));
10
10
  overflow-y: auto;
11
11
  position: sticky;
12
- top: calc(var(--ifm-navbar-height) + 2rem);
12
+ top: calc(var(--ifm-navbar-height) + 1rem);
13
13
  }
14
14
 
15
15
  @media only screen and (max-width: 996px) {
@@ -14,10 +14,9 @@ const ThemedImage = (props) => {
14
14
  const {isClient} = useDocusaurusContext();
15
15
  const {isDarkTheme} = useThemeContext();
16
16
  const {sources, className, alt = '', ...propsRest} = props;
17
+ const clientThemes = isDarkTheme ? ['dark'] : ['light'];
17
18
  const renderedSourceNames = isClient
18
- ? isDarkTheme
19
- ? ['dark']
20
- : ['light'] // We need to render both images on the server to avoid flash
19
+ ? clientThemes // We need to render both images on the server to avoid flash
21
20
  : // See https://github.com/facebook/docusaurus/pull/3730
22
21
  ['light', 'dark'];
23
22
  return (
@@ -1,3 +1,10 @@
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
+
1
8
  .themedImage {
2
9
  display: none;
3
10
  }
@@ -8,6 +8,7 @@ import React, {useState, useRef, memo} from 'react';
8
8
  import {useThemeConfig} from '@docusaurus/theme-common';
9
9
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
10
10
  import clsx from 'clsx';
11
+ import './styles.css';
11
12
  import styles from './styles.module.css';
12
13
 
13
14
  const Dark = ({icon, style}) => (
@@ -27,39 +28,22 @@ const Toggle = memo(
27
28
  const [checked, setChecked] = useState(defaultChecked);
28
29
  const [focused, setFocused] = useState(false);
29
30
  const inputRef = useRef(null);
30
-
31
- const handleToggle = (e) => {
32
- const checkbox = inputRef.current;
33
-
34
- if (!checkbox) {
35
- return;
36
- }
37
-
38
- if (e.target !== checkbox) {
39
- e.preventDefault();
40
- checkbox.focus();
41
- checkbox.click();
42
- return;
43
- }
44
-
45
- setChecked(checkbox?.checked);
46
- };
47
-
48
31
  return (
49
32
  <div
50
33
  className={clsx('react-toggle', className, {
51
34
  'react-toggle--checked': checked,
52
35
  'react-toggle--focus': focused,
53
36
  'react-toggle--disabled': disabled,
54
- })}
55
- role="button"
56
- tabIndex={-1}
57
- onClick={handleToggle}>
58
- <div className="react-toggle-track">
37
+ })}>
38
+ <div
39
+ className="react-toggle-track"
40
+ role="button"
41
+ tabIndex={-1}
42
+ onClick={() => inputRef.current?.click()}>
59
43
  <div className="react-toggle-track-check">{icons.checked}</div>
60
44
  <div className="react-toggle-track-x">{icons.unchecked}</div>
45
+ <div className="react-toggle-thumb" />
61
46
  </div>
62
- <div className="react-toggle-thumb" />
63
47
 
64
48
  <input
65
49
  ref={inputRef}
@@ -68,6 +52,7 @@ const Toggle = memo(
68
52
  className="react-toggle-screenreader-only"
69
53
  aria-label="Switch between dark and light mode"
70
54
  onChange={onChange}
55
+ onClick={() => setChecked(!checked)}
71
56
  onFocus={() => setFocused(true)}
72
57
  onBlur={() => setFocused(false)}
73
58
  />