@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
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import styles from './styles.module.css';
|
|
10
9
|
import Translate from '@docusaurus/Translate';
|
|
11
10
|
import type {Props} from '@theme/LastUpdated';
|
|
12
11
|
|
|
@@ -23,11 +22,11 @@ function LastUpdatedAtDate({
|
|
|
23
22
|
description="The words used to describe on which date a page has been last updated"
|
|
24
23
|
values={{
|
|
25
24
|
date: (
|
|
26
|
-
<
|
|
27
|
-
dateTime={new Date(lastUpdatedAt * 1000).toISOString()}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</
|
|
25
|
+
<b>
|
|
26
|
+
<time dateTime={new Date(lastUpdatedAt * 1000).toISOString()}>
|
|
27
|
+
{formattedLastUpdatedAt}
|
|
28
|
+
</time>
|
|
29
|
+
</b>
|
|
31
30
|
),
|
|
32
31
|
}}>
|
|
33
32
|
{' on {date}'}
|
|
@@ -45,7 +44,7 @@ function LastUpdatedByUser({
|
|
|
45
44
|
id="theme.lastUpdated.byUser"
|
|
46
45
|
description="The words used to describe by who the page has been last updated"
|
|
47
46
|
values={{
|
|
48
|
-
user: <
|
|
47
|
+
user: <b>{lastUpdatedBy}</b>,
|
|
49
48
|
}}>
|
|
50
49
|
{' by {user}'}
|
|
51
50
|
</Translate>
|
|
@@ -58,37 +57,33 @@ export default function LastUpdated({
|
|
|
58
57
|
lastUpdatedBy,
|
|
59
58
|
}: Props): JSX.Element {
|
|
60
59
|
return (
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
lastUpdatedAt
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
)}
|
|
90
|
-
</small>
|
|
91
|
-
</em>
|
|
92
|
-
</div>
|
|
60
|
+
<>
|
|
61
|
+
<Translate
|
|
62
|
+
id="theme.lastUpdated.lastUpdatedAtBy"
|
|
63
|
+
description="The sentence used to display when a page has been last updated, and by who"
|
|
64
|
+
values={{
|
|
65
|
+
atDate:
|
|
66
|
+
lastUpdatedAt && formattedLastUpdatedAt ? (
|
|
67
|
+
<LastUpdatedAtDate
|
|
68
|
+
lastUpdatedAt={lastUpdatedAt}
|
|
69
|
+
formattedLastUpdatedAt={formattedLastUpdatedAt}
|
|
70
|
+
/>
|
|
71
|
+
) : (
|
|
72
|
+
''
|
|
73
|
+
),
|
|
74
|
+
byUser: lastUpdatedBy ? (
|
|
75
|
+
<LastUpdatedByUser lastUpdatedBy={lastUpdatedBy} />
|
|
76
|
+
) : (
|
|
77
|
+
''
|
|
78
|
+
),
|
|
79
|
+
}}>
|
|
80
|
+
{'Last updated{atDate}{byUser}'}
|
|
81
|
+
</Translate>
|
|
82
|
+
{process.env.NODE_ENV === 'development' && (
|
|
83
|
+
<div>
|
|
84
|
+
<small> (Simulated during dev for better perf)</small>
|
|
85
|
+
</div>
|
|
86
|
+
)}
|
|
87
|
+
</>
|
|
93
88
|
);
|
|
94
89
|
}
|
|
@@ -85,7 +85,7 @@ export default function LayoutHead(props: Props): JSX.Element {
|
|
|
85
85
|
const {
|
|
86
86
|
siteConfig: {
|
|
87
87
|
favicon,
|
|
88
|
-
themeConfig: {metadatas},
|
|
88
|
+
themeConfig: {metadatas, image: defaultImage},
|
|
89
89
|
},
|
|
90
90
|
i18n: {currentLocale, localeConfigs},
|
|
91
91
|
} = useDocusaurusContext();
|
|
@@ -105,6 +105,10 @@ export default function LayoutHead(props: Props): JSX.Element {
|
|
|
105
105
|
{favicon && <link rel="shortcut icon" href={faviconUrl} />}
|
|
106
106
|
<title>{pageTitle}</title>
|
|
107
107
|
<meta property="og:title" content={pageTitle} />
|
|
108
|
+
{image ||
|
|
109
|
+
(defaultImage && (
|
|
110
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
111
|
+
))}
|
|
108
112
|
</Head>
|
|
109
113
|
|
|
110
114
|
<Seo {...{description, keywords, image}} />
|
|
@@ -8,17 +8,22 @@
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import ThemeProvider from '@theme/ThemeProvider';
|
|
10
10
|
import UserPreferencesProvider from '@theme/UserPreferencesProvider';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
AnnouncementBarProvider,
|
|
13
|
+
DocsPreferredVersionContextProvider,
|
|
14
|
+
} from '@docusaurus/theme-common';
|
|
12
15
|
import type {Props} from '@theme/LayoutProviders';
|
|
13
16
|
|
|
14
17
|
export default function LayoutProviders({children}: Props): JSX.Element {
|
|
15
18
|
return (
|
|
16
19
|
<ThemeProvider>
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
<AnnouncementBarProvider>
|
|
21
|
+
<UserPreferencesProvider>
|
|
22
|
+
<DocsPreferredVersionContextProvider>
|
|
23
|
+
{children}
|
|
24
|
+
</DocsPreferredVersionContextProvider>
|
|
25
|
+
</UserPreferencesProvider>
|
|
26
|
+
</AnnouncementBarProvider>
|
|
22
27
|
</ThemeProvider>
|
|
23
28
|
);
|
|
24
29
|
}
|
package/src/theme/Logo/index.tsx
CHANGED
|
@@ -12,13 +12,17 @@ import Link from '@docusaurus/Link';
|
|
|
12
12
|
import ThemedImage from '@theme/ThemedImage';
|
|
13
13
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
14
14
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
15
|
-
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
16
15
|
|
|
17
16
|
const Logo = (props: Props): JSX.Element => {
|
|
18
|
-
const {isClient} = useDocusaurusContext();
|
|
19
17
|
const {
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
siteConfig: {
|
|
19
|
+
title,
|
|
20
|
+
themeConfig: {
|
|
21
|
+
navbar: {title: navbarTitle, logo = {src: ''}},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
isClient,
|
|
25
|
+
} = useDocusaurusContext();
|
|
22
26
|
|
|
23
27
|
const {imageClassName, titleClassName, ...propsRest} = props;
|
|
24
28
|
const logoLink = useBaseUrl(logo.href || '/');
|
|
@@ -37,10 +41,10 @@ const Logo = (props: Props): JSX.Element => {
|
|
|
37
41
|
key={isClient}
|
|
38
42
|
className={imageClassName}
|
|
39
43
|
sources={sources}
|
|
40
|
-
alt={logo.alt ||
|
|
44
|
+
alt={logo.alt || navbarTitle || title}
|
|
41
45
|
/>
|
|
42
46
|
)}
|
|
43
|
-
{
|
|
47
|
+
{navbarTitle != null && <b className={titleClassName}>{navbarTitle}</b>}
|
|
44
48
|
</Link>
|
|
45
49
|
);
|
|
46
50
|
};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
9
10
|
import Layout from '@theme/Layout';
|
|
10
11
|
import {MDXProvider} from '@mdx-js/react';
|
|
11
12
|
import MDXComponents from '@theme/MDXComponents';
|
|
@@ -13,6 +14,8 @@ import type {Props} from '@theme/MDXPage';
|
|
|
13
14
|
import TOC from '@theme/TOC';
|
|
14
15
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
15
16
|
|
|
17
|
+
import styles from './styles.module.css';
|
|
18
|
+
|
|
16
19
|
function MDXPage(props: Props): JSX.Element {
|
|
17
20
|
const {content: MDXPageContent} = props;
|
|
18
21
|
const {frontMatter, metadata} = MDXPageContent;
|
|
@@ -32,24 +35,18 @@ function MDXPage(props: Props): JSX.Element {
|
|
|
32
35
|
permalink={permalink}
|
|
33
36
|
wrapperClassName={wrapperClassName ?? ThemeClassNames.wrapper.mdxPages}
|
|
34
37
|
pageClassName={ThemeClassNames.page.mdxPage}>
|
|
35
|
-
<main>
|
|
36
|
-
<div className=
|
|
37
|
-
<div className=
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
<MDXProvider components={MDXComponents}>
|
|
42
|
-
<MDXPageContent />
|
|
43
|
-
</MDXProvider>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
{!hideTableOfContents && MDXPageContent.toc && (
|
|
47
|
-
<div className="col col--2">
|
|
48
|
-
<TOC toc={MDXPageContent.toc} />
|
|
49
|
-
</div>
|
|
50
|
-
)}
|
|
51
|
-
</div>
|
|
38
|
+
<main className="container container--fluid margin-vert--lg">
|
|
39
|
+
<div className={clsx('row', styles.mdxPageWrapper)}>
|
|
40
|
+
<div className={clsx('col', !hideTableOfContents && 'col--8')}>
|
|
41
|
+
<MDXProvider components={MDXComponents}>
|
|
42
|
+
<MDXPageContent />
|
|
43
|
+
</MDXProvider>
|
|
52
44
|
</div>
|
|
45
|
+
{!hideTableOfContents && MDXPageContent.toc && (
|
|
46
|
+
<div className="col col--2">
|
|
47
|
+
<TOC toc={MDXPageContent.toc} />
|
|
48
|
+
</div>
|
|
49
|
+
)}
|
|
53
50
|
</div>
|
|
54
51
|
</main>
|
|
55
52
|
</Layout>
|
|
@@ -88,7 +88,7 @@ function Navbar(): JSX.Element {
|
|
|
88
88
|
{items != null && items.length !== 0 && (
|
|
89
89
|
<button
|
|
90
90
|
aria-label="Navigation bar toggle"
|
|
91
|
-
className="navbar__toggle"
|
|
91
|
+
className="navbar__toggle clean-btn"
|
|
92
92
|
type="button"
|
|
93
93
|
tabIndex={0}
|
|
94
94
|
onClick={showSidebar}
|
|
@@ -99,7 +99,7 @@ function Navbar(): JSX.Element {
|
|
|
99
99
|
<Logo
|
|
100
100
|
className="navbar__brand"
|
|
101
101
|
imageClassName="navbar__logo"
|
|
102
|
-
titleClassName=
|
|
102
|
+
titleClassName="navbar__title"
|
|
103
103
|
/>
|
|
104
104
|
{leftItems.map((item, i) => (
|
|
105
105
|
<NavbarItem {...item} key={i} />
|
|
@@ -16,6 +16,10 @@ import type {
|
|
|
16
16
|
DesktopOrMobileNavBarItemProps,
|
|
17
17
|
Props,
|
|
18
18
|
} from '@theme/NavbarItem/DefaultNavbarItem';
|
|
19
|
+
import IconExternalLink from '@theme/IconExternalLink';
|
|
20
|
+
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
21
|
+
|
|
22
|
+
const dropdownLinkActiveClass = 'dropdown__link--active';
|
|
19
23
|
|
|
20
24
|
function NavLink({
|
|
21
25
|
activeBasePath,
|
|
@@ -32,6 +36,8 @@ function NavLink({
|
|
|
32
36
|
const toUrl = useBaseUrl(to);
|
|
33
37
|
const activeBaseUrl = useBaseUrl(activeBasePath);
|
|
34
38
|
const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});
|
|
39
|
+
const isExternalLink = label && href && !isInternalUrl(href);
|
|
40
|
+
const isDropdownLink = activeClassName === dropdownLinkActiveClass;
|
|
35
41
|
|
|
36
42
|
return (
|
|
37
43
|
<Link
|
|
@@ -53,7 +59,14 @@ function NavLink({
|
|
|
53
59
|
: null),
|
|
54
60
|
})}
|
|
55
61
|
{...props}>
|
|
56
|
-
{
|
|
62
|
+
{isExternalLink ? (
|
|
63
|
+
<span>
|
|
64
|
+
{label}
|
|
65
|
+
<IconExternalLink {...(isDropdownLink && {width: 12, height: 12})} />
|
|
66
|
+
</span>
|
|
67
|
+
) : (
|
|
68
|
+
label
|
|
69
|
+
)}
|
|
57
70
|
</Link>
|
|
58
71
|
);
|
|
59
72
|
}
|
|
@@ -137,7 +150,7 @@ function NavItemDesktop({
|
|
|
137
150
|
}
|
|
138
151
|
}
|
|
139
152
|
}}
|
|
140
|
-
activeClassName=
|
|
153
|
+
activeClassName={dropdownLinkActiveClass}
|
|
141
154
|
className={navLinkClassNames(childItemClassName, true)}
|
|
142
155
|
{...childItemProps}
|
|
143
156
|
/>
|
|
@@ -11,6 +11,30 @@ import {useLatestVersion, useActiveDocContext} from '@theme/hooks/useDocs';
|
|
|
11
11
|
import clsx from 'clsx';
|
|
12
12
|
import type {Props} from '@theme/NavbarItem/DocNavbarItem';
|
|
13
13
|
import {useDocsPreferredVersion} from '@docusaurus/theme-common';
|
|
14
|
+
import {uniq} from '@docusaurus/utils-common';
|
|
15
|
+
import type {
|
|
16
|
+
GlobalDataVersion,
|
|
17
|
+
GlobalDataDoc,
|
|
18
|
+
} from '@docusaurus/plugin-content-docs-types';
|
|
19
|
+
|
|
20
|
+
function getDocInVersions(versions: GlobalDataVersion[], docId: string) {
|
|
21
|
+
// vanilla-js flatten, TODO replace soon by ES flat() / flatMap()
|
|
22
|
+
const allDocs: GlobalDataDoc[] = [].concat(
|
|
23
|
+
...versions.map((version) => version.docs),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const doc = allDocs.find((versionDoc) => versionDoc.id === docId);
|
|
27
|
+
if (!doc) {
|
|
28
|
+
const docIds = allDocs.map((versionDoc) => versionDoc.id).join('\n- ');
|
|
29
|
+
throw new Error(
|
|
30
|
+
`DocNavbarItem: couldn't find any doc with id "${docId}" in version${
|
|
31
|
+
versions.length ? 's' : ''
|
|
32
|
+
} ${versions.map((version) => version.name).join(', ')}".
|
|
33
|
+
Available doc ids are:\n- ${docIds}`,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
return doc;
|
|
37
|
+
}
|
|
14
38
|
|
|
15
39
|
export default function DocNavbarItem({
|
|
16
40
|
docId,
|
|
@@ -23,16 +47,11 @@ export default function DocNavbarItem({
|
|
|
23
47
|
const {preferredVersion} = useDocsPreferredVersion(docsPluginId);
|
|
24
48
|
const latestVersion = useLatestVersion(docsPluginId);
|
|
25
49
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
throw new Error(
|
|
32
|
-
`DocNavbarItem: couldn't find any doc with id=${docId} in version ${version.name}.
|
|
33
|
-
Available docIds=\n- ${docIds}`,
|
|
34
|
-
);
|
|
35
|
-
}
|
|
50
|
+
// Versions used to look for the doc to link to, ordered + no duplicate
|
|
51
|
+
const versions: GlobalDataVersion[] = uniq(
|
|
52
|
+
[activeVersion, preferredVersion, latestVersion].filter(Boolean),
|
|
53
|
+
);
|
|
54
|
+
const doc = getDocInVersions(versions, docId);
|
|
36
55
|
|
|
37
56
|
return (
|
|
38
57
|
<DefaultNavbarItem
|
|
@@ -68,14 +68,15 @@ export default function DocsVersionDropdownNavbarItem({
|
|
|
68
68
|
return items;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
const items = getItems();
|
|
72
|
+
|
|
71
73
|
const dropdownVersion =
|
|
72
74
|
activeDocContext.activeVersion ?? preferredVersion ?? latestVersion;
|
|
73
75
|
|
|
74
|
-
// Mobile is handled a bit differently
|
|
75
|
-
const dropdownLabel = mobile ? 'Versions' : dropdownVersion.label;
|
|
76
|
-
const dropdownTo =
|
|
77
|
-
? undefined
|
|
78
|
-
: getVersionMainDoc(dropdownVersion).path;
|
|
76
|
+
// Mobile dropdown is handled a bit differently
|
|
77
|
+
const dropdownLabel = mobile && items ? 'Versions' : dropdownVersion.label;
|
|
78
|
+
const dropdownTo =
|
|
79
|
+
mobile && items ? undefined : getVersionMainDoc(dropdownVersion).path;
|
|
79
80
|
|
|
80
81
|
return (
|
|
81
82
|
<DefaultNavbarItem
|
|
@@ -83,7 +84,7 @@ export default function DocsVersionDropdownNavbarItem({
|
|
|
83
84
|
mobile={mobile}
|
|
84
85
|
label={dropdownLabel}
|
|
85
86
|
to={dropdownTo}
|
|
86
|
-
items={
|
|
87
|
+
items={items}
|
|
87
88
|
isActive={dropdownActiveClassDisabled ? () => false : undefined}
|
|
88
89
|
/>
|
|
89
90
|
);
|
|
@@ -8,16 +8,11 @@
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import type {Props} from '@theme/NavbarItem/SearchNavbarItem';
|
|
10
10
|
import SearchBar from '@theme/SearchBar';
|
|
11
|
-
import styles from './styles.module.css';
|
|
12
11
|
|
|
13
12
|
export default function SearchNavbarItem({mobile}: Props): JSX.Element | null {
|
|
14
13
|
if (mobile) {
|
|
15
14
|
return null;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
return
|
|
19
|
-
<div className={styles.searchWrapper}>
|
|
20
|
-
<SearchBar />
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
17
|
+
return <SearchBar />;
|
|
23
18
|
}
|
|
@@ -34,7 +34,7 @@ const getNavbarItemComponent = (
|
|
|
34
34
|
) => {
|
|
35
35
|
const navbarItemComponent = NavbarItemComponents[type];
|
|
36
36
|
if (!navbarItemComponent) {
|
|
37
|
-
throw new Error(`No NavbarItem component found for type
|
|
37
|
+
throw new Error(`No NavbarItem component found for type "${type}".`);
|
|
38
38
|
}
|
|
39
39
|
return navbarItemComponent();
|
|
40
40
|
};
|
package/src/theme/NotFound.tsx
CHANGED
|
@@ -7,11 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import Layout from '@theme/Layout';
|
|
10
|
-
import Translate from '@docusaurus/Translate';
|
|
10
|
+
import Translate, {translate} from '@docusaurus/Translate';
|
|
11
11
|
|
|
12
12
|
function NotFound(): JSX.Element {
|
|
13
13
|
return (
|
|
14
|
-
<Layout
|
|
14
|
+
<Layout
|
|
15
|
+
title={translate({
|
|
16
|
+
id: 'theme.NotFound.title',
|
|
17
|
+
message: 'Page Not Found',
|
|
18
|
+
})}>
|
|
15
19
|
<main className="container margin-vert--xl">
|
|
16
20
|
<div className="row">
|
|
17
21
|
<div className="col col--6 col--offset-3">
|
|
@@ -20,7 +20,7 @@ export default function SearchMetadatas({
|
|
|
20
20
|
}: Props): JSX.Element {
|
|
21
21
|
return (
|
|
22
22
|
<Head>
|
|
23
|
-
{locale && <meta name="docusaurus_locale" content={
|
|
23
|
+
{locale && <meta name="docusaurus_locale" content={locale} />}
|
|
24
24
|
{version && <meta name="docusaurus_version" content={version} />}
|
|
25
25
|
{tag && <meta name="docusaurus_tag" content={tag} />}
|
|
26
26
|
</Head>
|
package/src/theme/Seo/index.tsx
CHANGED
|
@@ -41,7 +41,6 @@ export default function Seo({
|
|
|
41
41
|
|
|
42
42
|
{pageImage && <meta property="og:image" content={pageImage} />}
|
|
43
43
|
{pageImage && <meta name="twitter:image" content={pageImage} />}
|
|
44
|
-
{pageImage && <meta name="twitter:card" content="summary_large_image" />}
|
|
45
44
|
</Head>
|
|
46
45
|
);
|
|
47
46
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import React, {useRef} from 'react';
|
|
9
9
|
import Translate from '@docusaurus/Translate';
|
|
10
|
-
import {
|
|
10
|
+
import {useLocationChange} from '@docusaurus/theme-common';
|
|
11
11
|
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
13
|
|
|
@@ -31,8 +31,8 @@ function SkipToContent(): JSX.Element {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
if (containerRef.current) {
|
|
34
|
+
useLocationChange(({location}) => {
|
|
35
|
+
if (containerRef.current && !location.hash) {
|
|
36
36
|
programmaticFocus(containerRef.current);
|
|
37
37
|
}
|
|
38
38
|
});
|
|
@@ -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
|
}
|
|
@@ -21,10 +21,10 @@ const ThemedImage = (props: Props): JSX.Element => {
|
|
|
21
21
|
|
|
22
22
|
type SourceName = keyof Props['sources'];
|
|
23
23
|
|
|
24
|
+
const clientThemes: SourceName[] = isDarkTheme ? ['dark'] : ['light'];
|
|
25
|
+
|
|
24
26
|
const renderedSourceNames: SourceName[] = isClient
|
|
25
|
-
?
|
|
26
|
-
? ['dark']
|
|
27
|
-
: ['light']
|
|
27
|
+
? clientThemes
|
|
28
28
|
: // We need to render both images on the server to avoid flash
|
|
29
29
|
// See https://github.com/facebook/docusaurus/pull/3730
|
|
30
30
|
['light', 'dark'];
|
|
@@ -11,6 +11,7 @@ import {useThemeConfig} from '@docusaurus/theme-common';
|
|
|
11
11
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
12
12
|
|
|
13
13
|
import clsx from 'clsx';
|
|
14
|
+
import './styles.css';
|
|
14
15
|
import styles from './styles.module.css';
|
|
15
16
|
|
|
16
17
|
interface IconProps {
|
|
@@ -44,22 +45,6 @@ const Toggle = memo(
|
|
|
44
45
|
const [checked, setChecked] = useState(defaultChecked);
|
|
45
46
|
const [focused, setFocused] = useState(false);
|
|
46
47
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
47
|
-
const handleToggle = (e) => {
|
|
48
|
-
const checkbox = inputRef.current;
|
|
49
|
-
|
|
50
|
-
if (!checkbox) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (e.target !== checkbox) {
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
checkbox.focus();
|
|
57
|
-
checkbox.click();
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
setChecked(checkbox?.checked);
|
|
62
|
-
};
|
|
63
48
|
|
|
64
49
|
return (
|
|
65
50
|
<div
|
|
@@ -67,15 +52,16 @@ const Toggle = memo(
|
|
|
67
52
|
'react-toggle--checked': checked,
|
|
68
53
|
'react-toggle--focus': focused,
|
|
69
54
|
'react-toggle--disabled': disabled,
|
|
70
|
-
})}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
55
|
+
})}>
|
|
56
|
+
<div
|
|
57
|
+
className="react-toggle-track"
|
|
58
|
+
role="button"
|
|
59
|
+
tabIndex={-1}
|
|
60
|
+
onClick={() => inputRef.current?.click()}>
|
|
75
61
|
<div className="react-toggle-track-check">{icons.checked}</div>
|
|
76
62
|
<div className="react-toggle-track-x">{icons.unchecked}</div>
|
|
63
|
+
<div className="react-toggle-thumb" />
|
|
77
64
|
</div>
|
|
78
|
-
<div className="react-toggle-thumb" />
|
|
79
65
|
|
|
80
66
|
<input
|
|
81
67
|
ref={inputRef}
|
|
@@ -84,6 +70,7 @@ const Toggle = memo(
|
|
|
84
70
|
className="react-toggle-screenreader-only"
|
|
85
71
|
aria-label="Switch between dark and light mode"
|
|
86
72
|
onChange={onChange}
|
|
73
|
+
onClick={() => setChecked(!checked)}
|
|
87
74
|
onFocus={() => setFocused(true)}
|
|
88
75
|
onBlur={() => setFocused(false)}
|
|
89
76
|
/>
|