@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.
- package/codeTranslations/ar.json +2 -0
- package/codeTranslations/base.json +4 -0
- package/codeTranslations/bn.json +56 -0
- package/codeTranslations/da.json +2 -0
- package/codeTranslations/de.json +2 -0
- package/codeTranslations/es.json +2 -0
- package/codeTranslations/fa.json +2 -0
- package/codeTranslations/fil.json +2 -0
- package/codeTranslations/fr.json +2 -0
- package/codeTranslations/he.json +18 -16
- package/codeTranslations/hi.json +2 -0
- package/codeTranslations/ja.json +2 -0
- package/codeTranslations/ko.json +2 -0
- package/codeTranslations/pl.json +2 -0
- package/codeTranslations/pt-BR.json +2 -0
- package/codeTranslations/pt-PT.json +2 -0
- package/codeTranslations/ru.json +2 -0
- package/codeTranslations/tr.json +2 -0
- package/codeTranslations/vi.json +2 -0
- package/codeTranslations/zh-Hans.json +2 -0
- package/codeTranslations/zh-Hant.json +2 -0
- package/lib/index.js +28 -7
- package/lib/theme/AnnouncementBar/index.js +5 -7
- package/lib/theme/AnnouncementBar/styles.module.css +6 -6
- package/lib/theme/BlogListPage/index.js +2 -2
- package/lib/theme/BlogListPaginator/index.js +2 -2
- package/lib/theme/BlogPostItem/index.js +32 -23
- package/lib/theme/BlogPostItem/styles.module.css +5 -1
- package/lib/theme/BlogPostPage/index.js +4 -10
- package/lib/theme/BlogPostPaginator/index.js +3 -3
- package/lib/theme/BlogSidebar/index.js +11 -3
- package/lib/theme/BlogSidebar/styles.module.css +4 -6
- package/lib/theme/BlogTagsListPage/index.js +15 -20
- package/lib/theme/BlogTagsPostsPage/index.js +29 -33
- package/lib/theme/CodeBlock/index.js +11 -11
- package/lib/theme/CodeBlock/styles.module.css +4 -7
- package/lib/theme/DocItem/index.js +35 -26
- package/lib/theme/DocItem/styles.module.css +8 -10
- package/lib/theme/DocPage/index.js +43 -11
- package/lib/theme/DocPage/styles.module.css +7 -19
- package/lib/theme/DocPaginator/index.js +3 -3
- package/lib/theme/DocSidebar/index.js +23 -24
- package/lib/theme/DocSidebar/styles.module.css +0 -14
- package/lib/theme/DocVersionBanner/index.js +128 -0
- package/lib/theme/DocVersionSuggestions/index.js +4 -4
- package/lib/theme/Heading/index.js +18 -2
- package/lib/theme/Heading/styles.module.css +5 -0
- package/lib/theme/IconArrow/index.js +1 -1
- package/lib/theme/IconEdit/index.js +1 -1
- package/lib/theme/IconExternalLink/index.js +30 -0
- package/lib/theme/IconExternalLink/styles.module.css +12 -0
- package/lib/theme/IconLanguage/index.js +1 -1
- package/lib/theme/IconMenu/index.js +1 -2
- package/lib/theme/LastUpdated/index.js +17 -21
- package/lib/theme/Layout/styles.css +6 -0
- package/lib/theme/LayoutHead/index.js +3 -1
- package/lib/theme/LayoutProviders/index.js +7 -5
- package/lib/theme/Logo/index.js +13 -12
- package/lib/theme/MDXComponents/index.js +2 -2
- package/lib/theme/MDXPage/index.js +13 -15
- package/{src/theme/LastUpdated → lib/theme/MDXPage}/styles.module.css +2 -2
- package/lib/theme/Navbar/index.js +4 -4
- package/lib/theme/Navbar/styles.module.css +1 -1
- package/lib/theme/NavbarItem/DefaultNavbarItem.js +18 -4
- package/lib/theme/NavbarItem/DocNavbarItem.js +19 -11
- package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +5 -4
- package/lib/theme/NavbarItem/SearchNavbarItem.js +1 -5
- package/lib/theme/NavbarItem/index.js +1 -1
- package/lib/theme/NotFound.js +9 -2
- package/lib/theme/SearchMetadatas/index.js +1 -1
- package/lib/theme/Seo/index.js +0 -1
- package/lib/theme/SkipToContent/index.js +6 -4
- package/lib/theme/SkipToContent/styles.module.css +1 -3
- package/lib/theme/TOC/styles.module.css +1 -1
- package/lib/theme/Tabs/index.js +2 -2
- package/lib/theme/ThemedImage/index.js +2 -1
- package/lib/theme/ThemedImage/styles.module.css +7 -0
- package/lib/theme/Toggle/index.js +12 -24
- package/lib/theme/Toggle/styles.css +103 -0
- package/lib/theme/Toggle/styles.module.css +0 -97
- package/lib/theme/UserPreferencesProvider/index.js +1 -9
- package/lib/theme/hooks/useHideableNavbar.js +2 -2
- package/lib/theme/hooks/useTabGroupChoice.js +2 -4
- package/lib/theme/hooks/useThemeContext.js +1 -1
- package/lib/theme/hooks/useUserPreferencesContext.js +1 -1
- package/lib/types.d.ts +10 -12
- package/lib/validateThemeConfig.js +3 -3
- package/lib-next/index.js +31 -8
- package/lib-next/theme/AnnouncementBar/index.js +5 -9
- package/lib-next/theme/AnnouncementBar/styles.module.css +6 -6
- package/lib-next/theme/BlogListPage/index.js +2 -2
- package/lib-next/theme/BlogPostItem/index.js +41 -24
- package/lib-next/theme/BlogPostItem/styles.module.css +5 -1
- package/lib-next/theme/BlogPostPage/index.js +4 -8
- package/lib-next/theme/BlogPostPaginator/index.js +1 -1
- package/lib-next/theme/BlogSidebar/index.js +12 -3
- package/lib-next/theme/BlogSidebar/styles.module.css +4 -6
- package/lib-next/theme/BlogTagsListPage/index.js +17 -23
- package/lib-next/theme/BlogTagsPostsPage/index.js +36 -40
- package/lib-next/theme/CodeBlock/index.js +10 -9
- package/lib-next/theme/CodeBlock/styles.module.css +4 -7
- package/lib-next/theme/DocItem/index.js +41 -41
- package/lib-next/theme/DocItem/styles.module.css +8 -10
- package/lib-next/theme/DocPage/index.js +36 -9
- package/lib-next/theme/DocPage/styles.module.css +7 -19
- package/lib-next/theme/DocPaginator/index.js +1 -1
- package/lib-next/theme/DocSidebar/index.js +28 -21
- package/lib-next/theme/DocSidebar/styles.module.css +0 -14
- package/lib-next/theme/DocVersionBanner/index.js +127 -0
- package/lib-next/theme/DocVersionSuggestions/index.js +4 -4
- package/lib-next/theme/Heading/index.js +17 -1
- package/lib-next/theme/Heading/styles.module.css +5 -0
- package/lib-next/theme/IconArrow/index.js +1 -1
- package/lib-next/theme/IconEdit/index.js +3 -5
- package/lib-next/theme/IconExternalLink/index.js +26 -0
- package/{lib/theme/NavbarItem → lib-next/theme/IconExternalLink}/styles.module.css +4 -5
- package/lib-next/theme/IconLanguage/index.js +1 -1
- package/lib-next/theme/IconMenu/index.js +1 -4
- package/lib-next/theme/LastUpdated/index.js +34 -39
- package/lib-next/theme/Layout/styles.css +6 -0
- package/lib-next/theme/LayoutHead/index.js +5 -1
- package/lib-next/theme/LayoutProviders/index.js +11 -6
- package/lib-next/theme/Logo/index.js +12 -8
- package/lib-next/theme/MDXPage/index.js +13 -17
- package/lib-next/theme/{LastUpdated → MDXPage}/styles.module.css +2 -2
- package/lib-next/theme/Navbar/index.js +2 -2
- package/lib-next/theme/Navbar/styles.module.css +1 -1
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +19 -2
- package/lib-next/theme/NavbarItem/DocNavbarItem.js +23 -9
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +6 -6
- package/lib-next/theme/NavbarItem/SearchNavbarItem.js +1 -6
- package/lib-next/theme/NavbarItem/index.js +1 -1
- package/lib-next/theme/NotFound.js +6 -2
- package/lib-next/theme/SearchMetadatas/index.js +1 -1
- package/lib-next/theme/Seo/index.js +0 -1
- package/lib-next/theme/SkipToContent/index.js +3 -3
- package/lib-next/theme/SkipToContent/styles.module.css +1 -3
- package/lib-next/theme/TOC/styles.module.css +1 -1
- package/lib-next/theme/ThemedImage/index.js +2 -3
- package/lib-next/theme/ThemedImage/styles.module.css +7 -0
- package/lib-next/theme/Toggle/index.js +9 -24
- package/lib-next/theme/Toggle/styles.css +103 -0
- package/lib-next/theme/Toggle/styles.module.css +0 -97
- package/lib-next/theme/UserPreferencesProvider/index.js +0 -4
- package/lib-next/theme/hooks/useHideableNavbar.js +3 -3
- package/lib-next/theme/hooks/useTabGroupChoice.js +2 -4
- package/lib-next/theme/hooks/useThemeContext.js +1 -1
- package/lib-next/theme/hooks/useUserPreferencesContext.js +1 -1
- package/lib-next/types.d.ts +10 -12
- package/lib-next/validateThemeConfig.js +3 -3
- package/package.json +18 -17
- package/src/index.ts +32 -8
- package/src/theme/AnnouncementBar/index.tsx +6 -9
- package/src/theme/AnnouncementBar/styles.module.css +6 -6
- package/src/theme/BlogListPage/index.tsx +2 -2
- package/src/theme/BlogPostItem/index.tsx +40 -24
- package/src/theme/BlogPostItem/styles.module.css +5 -1
- package/src/theme/BlogPostPage/index.tsx +4 -8
- package/src/theme/BlogPostPaginator/index.tsx +1 -1
- package/src/theme/BlogSidebar/index.tsx +12 -3
- package/src/theme/BlogSidebar/styles.module.css +4 -6
- package/src/theme/BlogTagsListPage/index.tsx +17 -22
- package/src/theme/BlogTagsPostsPage/index.tsx +33 -43
- package/src/theme/CodeBlock/index.tsx +10 -9
- package/src/theme/CodeBlock/styles.module.css +4 -7
- package/src/theme/DocItem/index.tsx +40 -40
- package/src/theme/DocItem/styles.module.css +8 -10
- package/src/theme/DocPage/index.tsx +29 -9
- package/src/theme/DocPage/styles.module.css +7 -19
- package/src/theme/DocPaginator/index.tsx +1 -1
- package/src/theme/DocSidebar/index.tsx +28 -21
- package/src/theme/DocSidebar/styles.module.css +0 -14
- package/src/theme/{DocVersionSuggestions → DocVersionBanner}/index.tsx +46 -43
- package/src/theme/Heading/index.tsx +22 -1
- package/src/theme/Heading/styles.module.css +5 -0
- package/src/theme/IconArrow/index.tsx +1 -1
- package/src/theme/IconEdit/index.tsx +3 -5
- package/src/theme/IconExternalLink/index.tsx +32 -0
- package/src/theme/IconExternalLink/styles.module.css +12 -0
- package/src/theme/IconLanguage/index.tsx +1 -1
- package/src/theme/IconMenu/index.tsx +1 -4
- package/src/theme/LastUpdated/index.tsx +34 -39
- package/src/theme/Layout/styles.css +6 -0
- package/src/theme/LayoutHead/index.tsx +5 -1
- package/src/theme/LayoutProviders/index.tsx +11 -6
- package/src/theme/Logo/index.tsx +10 -6
- package/src/theme/MDXPage/index.tsx +14 -17
- package/{lib/theme/LastUpdated → src/theme/MDXPage}/styles.module.css +2 -2
- package/src/theme/Navbar/index.tsx +2 -2
- package/src/theme/Navbar/styles.module.css +1 -1
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +15 -2
- package/src/theme/NavbarItem/DocNavbarItem.tsx +29 -10
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +7 -6
- package/src/theme/NavbarItem/SearchNavbarItem.tsx +1 -6
- package/src/theme/NavbarItem/index.tsx +1 -1
- package/src/theme/NotFound.tsx +6 -2
- package/src/theme/SearchMetadatas/index.tsx +1 -1
- package/src/theme/Seo/index.tsx +0 -1
- package/src/theme/SkipToContent/index.tsx +3 -3
- package/src/theme/SkipToContent/styles.module.css +1 -3
- package/src/theme/TOC/styles.module.css +1 -1
- package/src/theme/ThemedImage/index.tsx +3 -3
- package/src/theme/ThemedImage/styles.module.css +7 -0
- package/src/theme/Toggle/index.tsx +9 -22
- package/src/theme/Toggle/styles.css +103 -0
- package/src/theme/Toggle/styles.module.css +0 -97
- package/src/theme/UserPreferencesProvider/index.tsx +0 -5
- package/src/theme/hooks/useHideableNavbar.ts +3 -3
- package/src/theme/hooks/useTabGroupChoice.ts +2 -2
- package/src/theme/hooks/useThemeContext.ts +1 -1
- package/src/theme/hooks/useUserPreferencesContext.ts +1 -1
- package/src/types.d.ts +10 -12
- package/src/validateThemeConfig.js +3 -3
- package/update-code-translations.js +1 -0
- package/lib-next/theme/NavbarItem/styles.module.css +0 -13
- package/src/theme/NavbarItem/styles.module.css +0 -13
- 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
|
-
<
|
|
19
|
-
dateTime={new Date(lastUpdatedAt * 1000).toISOString()}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
</
|
|
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: <
|
|
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
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
lastUpdatedAt
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
}
|
|
@@ -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 {
|
|
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
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
15
|
+
siteConfig: {
|
|
18
16
|
title,
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
themeConfig: {
|
|
18
|
+
navbar: {
|
|
19
|
+
title: navbarTitle,
|
|
20
|
+
logo = {
|
|
21
|
+
src: '',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
21
24
|
},
|
|
22
25
|
},
|
|
23
|
-
|
|
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 ||
|
|
46
|
+
alt={logo.alt || navbarTitle || title}
|
|
43
47
|
/>
|
|
44
48
|
)}
|
|
45
|
-
{
|
|
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=
|
|
33
|
-
<div className=
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
|
|
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>
|
|
@@ -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=
|
|
90
|
+
titleClassName="navbar__title"
|
|
91
91
|
/>
|
|
92
92
|
{leftItems.map((item, i) => (
|
|
93
93
|
<NavbarItem {...item} key={i} />
|
|
@@ -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
|
-
{
|
|
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=
|
|
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 =
|
|
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={
|
|
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
|
|
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
|
|
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={
|
|
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 {
|
|
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
|
-
|
|
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
|
}
|
|
@@ -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
|
-
?
|
|
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 (
|
|
@@ -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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
/>
|