@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,24 +5,22 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
.
|
|
9
|
-
|
|
10
|
-
margin-bottom: calc(var(--ifm-leading-desktop) * var(--ifm-leading));
|
|
8
|
+
.docItemContainer header + * {
|
|
9
|
+
margin-top: 0;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
.
|
|
14
|
-
margin: 0
|
|
15
|
-
|
|
12
|
+
.lastUpdated {
|
|
13
|
+
margin-top: 0.2rem;
|
|
14
|
+
font-style: italic;
|
|
15
|
+
font-size: smaller;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
@media only screen and (min-width: 997px) {
|
|
19
19
|
.docItemCol {
|
|
20
20
|
max-width: 75% !important;
|
|
21
21
|
}
|
|
22
|
-
}
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
padding: 0 0.3rem;
|
|
23
|
+
.lastUpdated {
|
|
24
|
+
text-align: right;
|
|
27
25
|
}
|
|
28
26
|
}
|
|
@@ -19,11 +19,37 @@ import clsx from 'clsx';
|
|
|
19
19
|
import styles from './styles.module.css';
|
|
20
20
|
import {ThemeClassNames, docVersionSearchTag} from '@docusaurus/theme-common';
|
|
21
21
|
|
|
22
|
+
function getSidebar({versionMetadata, currentDocRoute}) {
|
|
23
|
+
function addTrailingSlash(str) {
|
|
24
|
+
return str.endsWith('/') ? str : `${str}/`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function removeTrailingSlash(str) {
|
|
28
|
+
return str.endsWith('/') ? str.slice(0, -1) : str;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const {permalinkToSidebar, docsSidebars} = versionMetadata; // With/without trailingSlash, we should always be able to get the appropriate sidebar
|
|
32
|
+
// note: docs plugin permalinks currently never have trailing slashes
|
|
33
|
+
// trailingSlash is handled globally at the framework level, not plugin level
|
|
34
|
+
|
|
35
|
+
const sidebarName =
|
|
36
|
+
permalinkToSidebar[currentDocRoute.path] ||
|
|
37
|
+
permalinkToSidebar[addTrailingSlash(currentDocRoute.path)] ||
|
|
38
|
+
permalinkToSidebar[removeTrailingSlash(currentDocRoute.path)];
|
|
39
|
+
const sidebar = docsSidebars[sidebarName];
|
|
40
|
+
return {
|
|
41
|
+
sidebar,
|
|
42
|
+
sidebarName,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
22
46
|
function DocPageContent({currentDocRoute, versionMetadata, children}) {
|
|
23
47
|
const {siteConfig, isClient} = useDocusaurusContext();
|
|
24
|
-
const {pluginId,
|
|
25
|
-
const sidebarName =
|
|
26
|
-
|
|
48
|
+
const {pluginId, version} = versionMetadata;
|
|
49
|
+
const {sidebarName, sidebar} = getSidebar({
|
|
50
|
+
versionMetadata,
|
|
51
|
+
currentDocRoute,
|
|
52
|
+
});
|
|
27
53
|
const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false);
|
|
28
54
|
const [hiddenSidebar, setHiddenSidebar] = useState(false);
|
|
29
55
|
const toggleSidebar = useCallback(() => {
|
|
@@ -44,7 +70,7 @@ function DocPageContent({currentDocRoute, versionMetadata, children}) {
|
|
|
44
70
|
}}>
|
|
45
71
|
<div className={styles.docPage}>
|
|
46
72
|
{sidebar && (
|
|
47
|
-
<
|
|
73
|
+
<aside
|
|
48
74
|
className={clsx(styles.docSidebarContainer, {
|
|
49
75
|
[styles.docSidebarContainerHidden]: hiddenSidebarContainer,
|
|
50
76
|
})}
|
|
@@ -58,8 +84,7 @@ function DocPageContent({currentDocRoute, versionMetadata, children}) {
|
|
|
58
84
|
if (hiddenSidebarContainer) {
|
|
59
85
|
setHiddenSidebar(true);
|
|
60
86
|
}
|
|
61
|
-
}}
|
|
62
|
-
role="complementary">
|
|
87
|
+
}}>
|
|
63
88
|
<DocSidebar
|
|
64
89
|
key={
|
|
65
90
|
// Reset sidebar state on sidebar changes
|
|
@@ -97,7 +122,7 @@ function DocPageContent({currentDocRoute, versionMetadata, children}) {
|
|
|
97
122
|
<IconArrow className={styles.expandSidebarButtonIcon} />
|
|
98
123
|
</div>
|
|
99
124
|
)}
|
|
100
|
-
</
|
|
125
|
+
</aside>
|
|
101
126
|
)}
|
|
102
127
|
<main
|
|
103
128
|
className={clsx(styles.docMainContainer, {
|
|
@@ -106,7 +131,7 @@ function DocPageContent({currentDocRoute, versionMetadata, children}) {
|
|
|
106
131
|
})}>
|
|
107
132
|
<div
|
|
108
133
|
className={clsx(
|
|
109
|
-
'container padding-
|
|
134
|
+
'container padding-top--md padding-bottom--lg',
|
|
110
135
|
styles.docItemWrapper,
|
|
111
136
|
{
|
|
112
137
|
[styles.docItemWrapperEnhanced]: hiddenSidebarContainer,
|
|
@@ -138,7 +163,9 @@ function DocPage(props) {
|
|
|
138
163
|
<DocPageContent
|
|
139
164
|
currentDocRoute={currentDocRoute}
|
|
140
165
|
versionMetadata={versionMetadata}>
|
|
141
|
-
{renderRoutes(docRoutes
|
|
166
|
+
{renderRoutes(docRoutes, {
|
|
167
|
+
versionMetadata,
|
|
168
|
+
})}
|
|
142
169
|
</DocPageContent>
|
|
143
170
|
);
|
|
144
171
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
:root {
|
|
9
9
|
--doc-sidebar-width: 300px;
|
|
10
|
+
--doc-sidebar-hidden-width: 30px;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
:global(.docs-wrapper) {
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
.docMainContainerEnhanced {
|
|
29
|
-
max-width:
|
|
30
|
+
max-width: calc(100% - var(--doc-sidebar-hidden-width));
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
.docSidebarContainer {
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
.docSidebarContainerHidden {
|
|
42
|
-
width:
|
|
43
|
+
width: var(--doc-sidebar-hidden-width);
|
|
43
44
|
cursor: pointer;
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -72,27 +73,14 @@
|
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
.docItemWrapperEnhanced {
|
|
75
|
-
max-width: calc(
|
|
76
|
+
max-width: calc(
|
|
77
|
+
var(--ifm-container-width) + var(--doc-sidebar-width)
|
|
78
|
+
) !important;
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
@media (max-width: 996px) {
|
|
80
83
|
.docSidebarContainer {
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@media (min-width: 997px) and (max-width: 1320px) {
|
|
86
|
-
.docItemWrapper {
|
|
87
|
-
max-width: calc(
|
|
88
|
-
var(--ifm-container-width) - var(--doc-sidebar-width) -
|
|
89
|
-
var(--ifm-spacing-horizontal) * 2
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.docItemWrapperEnhanced {
|
|
94
|
-
max-width: calc(
|
|
95
|
-
var(--ifm-container-width) - var(--ifm-spacing-horizontal) * 2
|
|
96
|
-
);
|
|
84
|
+
display: none;
|
|
97
85
|
}
|
|
98
86
|
}
|
|
@@ -12,7 +12,7 @@ function DocPaginator(props) {
|
|
|
12
12
|
const {metadata} = props;
|
|
13
13
|
return (
|
|
14
14
|
<nav
|
|
15
|
-
className="pagination-nav"
|
|
15
|
+
className="pagination-nav docusaurus-mt-lg"
|
|
16
16
|
aria-label={translate({
|
|
17
17
|
id: 'theme.docs.paginator.navAriaLabel',
|
|
18
18
|
message: 'Docs pages navigation',
|
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, {useState, useCallback, useEffect, useRef, memo} from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import {
|
|
10
|
+
useThemeConfig,
|
|
11
|
+
isSamePath,
|
|
12
|
+
usePrevious,
|
|
13
|
+
useAnnouncementBar,
|
|
14
|
+
} from '@docusaurus/theme-common';
|
|
11
15
|
import useLockBodyScroll from '@theme/hooks/useLockBodyScroll';
|
|
12
16
|
import useWindowSize, {windowSizes} from '@theme/hooks/useWindowSize';
|
|
13
17
|
import useScrollPosition from '@theme/hooks/useScrollPosition';
|
|
@@ -16,18 +20,11 @@ import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
|
16
20
|
import Logo from '@theme/Logo';
|
|
17
21
|
import IconArrow from '@theme/IconArrow';
|
|
18
22
|
import IconMenu from '@theme/IconMenu';
|
|
23
|
+
import IconExternalLink from '@theme/IconExternalLink';
|
|
19
24
|
import {translate} from '@docusaurus/Translate';
|
|
20
25
|
import styles from './styles.module.css';
|
|
21
26
|
const MOBILE_TOGGLE_SIZE = 24;
|
|
22
27
|
|
|
23
|
-
function usePrevious(value) {
|
|
24
|
-
const ref = useRef(value);
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
ref.current = value;
|
|
27
|
-
}, [value]);
|
|
28
|
-
return ref.current;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
28
|
const isActiveSidebarItem = (item, activePath) => {
|
|
32
29
|
if (item.type === 'link') {
|
|
33
30
|
return isSamePath(item.href, activePath);
|
|
@@ -170,7 +167,6 @@ function DocSidebarItemLink({
|
|
|
170
167
|
<Link
|
|
171
168
|
className={clsx('menu__link', {
|
|
172
169
|
'menu__link--active': isActive,
|
|
173
|
-
[styles.menuLinkExternal]: !isInternalUrl(href),
|
|
174
170
|
})}
|
|
175
171
|
to={href}
|
|
176
172
|
{...(isInternalUrl(href) && {
|
|
@@ -179,19 +175,24 @@ function DocSidebarItemLink({
|
|
|
179
175
|
onClick: onItemClick,
|
|
180
176
|
})}
|
|
181
177
|
{...props}>
|
|
182
|
-
{
|
|
178
|
+
{isInternalUrl(href) ? (
|
|
179
|
+
label
|
|
180
|
+
) : (
|
|
181
|
+
<span>
|
|
182
|
+
{label}
|
|
183
|
+
<IconExternalLink />
|
|
184
|
+
</span>
|
|
185
|
+
)}
|
|
183
186
|
</Link>
|
|
184
187
|
</li>
|
|
185
188
|
);
|
|
186
189
|
}
|
|
187
190
|
|
|
188
191
|
function useShowAnnouncementBar() {
|
|
189
|
-
const {
|
|
190
|
-
const [showAnnouncementBar, setShowAnnouncementBar] = useState(
|
|
191
|
-
!isAnnouncementBarClosed,
|
|
192
|
-
);
|
|
192
|
+
const {isClosed} = useAnnouncementBar();
|
|
193
|
+
const [showAnnouncementBar, setShowAnnouncementBar] = useState(!isClosed);
|
|
193
194
|
useScrollPosition(({scrollY}) => {
|
|
194
|
-
if (!
|
|
195
|
+
if (!isClosed) {
|
|
195
196
|
setShowAnnouncementBar(scrollY === 0);
|
|
196
197
|
}
|
|
197
198
|
});
|
|
@@ -298,7 +299,7 @@ function DocSidebar({
|
|
|
298
299
|
navbar: {hideOnScroll},
|
|
299
300
|
hideableSidebar,
|
|
300
301
|
} = useThemeConfig();
|
|
301
|
-
const {isAnnouncementBarClosed} =
|
|
302
|
+
const {isClosed: isAnnouncementBarClosed} = useAnnouncementBar();
|
|
302
303
|
const {
|
|
303
304
|
showResponsiveSidebar,
|
|
304
305
|
closeResponsiveSidebar,
|
|
@@ -311,7 +312,7 @@ function DocSidebar({
|
|
|
311
312
|
[styles.sidebarHidden]: isHidden,
|
|
312
313
|
})}>
|
|
313
314
|
{hideOnScroll && <Logo tabIndex={-1} className={styles.sidebarLogo} />}
|
|
314
|
-
<
|
|
315
|
+
<nav
|
|
315
316
|
className={clsx(
|
|
316
317
|
'menu',
|
|
317
318
|
'menu--responsive',
|
|
@@ -322,11 +323,17 @@ function DocSidebar({
|
|
|
322
323
|
[styles.menuWithAnnouncementBar]:
|
|
323
324
|
!isAnnouncementBarClosed && showAnnouncementBar,
|
|
324
325
|
},
|
|
325
|
-
)}
|
|
326
|
+
)}
|
|
327
|
+
aria-label={translate({
|
|
328
|
+
id: 'theme.docs.sidebar.navAriaLabel',
|
|
329
|
+
message: 'Sidebar navigation',
|
|
330
|
+
description: 'The ARIA label for documentation menu',
|
|
331
|
+
})}>
|
|
326
332
|
<ResponsiveSidebarButton
|
|
327
333
|
responsiveSidebarOpened={showResponsiveSidebar}
|
|
328
334
|
onClick={toggleResponsiveSidebar}
|
|
329
335
|
/>
|
|
336
|
+
|
|
330
337
|
<ul className="menu__list">
|
|
331
338
|
<DocSidebarItems
|
|
332
339
|
items={sidebar}
|
|
@@ -335,7 +342,7 @@ function DocSidebar({
|
|
|
335
342
|
activePath={path}
|
|
336
343
|
/>
|
|
337
344
|
</ul>
|
|
338
|
-
</
|
|
345
|
+
</nav>
|
|
339
346
|
{hideableSidebar && <HideableSidebarButton onClick={onCollapse} />}
|
|
340
347
|
</div>
|
|
341
348
|
);
|
|
@@ -122,17 +122,3 @@
|
|
|
122
122
|
:global(.menu__list-item--collapsed) :global(.menu__list) {
|
|
123
123
|
height: 0 !important;
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
.menuLinkExternal {
|
|
127
|
-
align-items: center;
|
|
128
|
-
}
|
|
129
|
-
.menuLinkExternal:after {
|
|
130
|
-
content: '';
|
|
131
|
-
height: 1.15rem;
|
|
132
|
-
width: 1.15rem;
|
|
133
|
-
min-width: 1.15rem;
|
|
134
|
-
margin: 0 0 0 3%;
|
|
135
|
-
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(0,0,0,0.5)' d='M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z'/%3E%3C/svg%3E")
|
|
136
|
-
no-repeat;
|
|
137
|
-
filter: var(--ifm-menu-link-sublist-icon-filter);
|
|
138
|
-
}
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
import React from 'react';
|
|
8
|
+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
9
|
+
import Link from '@docusaurus/Link';
|
|
10
|
+
import Translate from '@docusaurus/Translate';
|
|
11
|
+
import {useActivePlugin, useDocVersionSuggestions} from '@theme/hooks/useDocs';
|
|
12
|
+
import {useDocsPreferredVersion} from '@docusaurus/theme-common';
|
|
13
|
+
|
|
14
|
+
function UnreleasedVersionLabel({siteTitle, versionMetadata}) {
|
|
15
|
+
return (
|
|
16
|
+
<Translate
|
|
17
|
+
id="theme.docs.versions.unreleasedVersionLabel"
|
|
18
|
+
description="The label used to tell the user that he's browsing an unreleased doc version"
|
|
19
|
+
values={{
|
|
20
|
+
siteTitle,
|
|
21
|
+
versionLabel: <b>{versionMetadata.label}</b>,
|
|
22
|
+
}}>
|
|
23
|
+
{
|
|
24
|
+
'This is unreleased documentation for {siteTitle} {versionLabel} version.'
|
|
25
|
+
}
|
|
26
|
+
</Translate>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function UnmaintainedVersionLabel({siteTitle, versionMetadata}) {
|
|
31
|
+
return (
|
|
32
|
+
<Translate
|
|
33
|
+
id="theme.docs.versions.unmaintainedVersionLabel"
|
|
34
|
+
description="The label used to tell the user that he's browsing an unmaintained doc version"
|
|
35
|
+
values={{
|
|
36
|
+
siteTitle,
|
|
37
|
+
versionLabel: <b>{versionMetadata.label}</b>,
|
|
38
|
+
}}>
|
|
39
|
+
{
|
|
40
|
+
'This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.'
|
|
41
|
+
}
|
|
42
|
+
</Translate>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const BannerLabelComponents = {
|
|
47
|
+
unreleased: UnreleasedVersionLabel,
|
|
48
|
+
unmaintained: UnmaintainedVersionLabel,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
function BannerLabel(props) {
|
|
52
|
+
const BannerLabelComponent =
|
|
53
|
+
BannerLabelComponents[props.versionMetadata.banner];
|
|
54
|
+
return <BannerLabelComponent {...props} />;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function LatestVersionSuggestionLabel({versionLabel, to, onClick}) {
|
|
58
|
+
return (
|
|
59
|
+
<Translate
|
|
60
|
+
id="theme.docs.versions.latestVersionSuggestionLabel"
|
|
61
|
+
description="The label used to tell the user to check the latest version"
|
|
62
|
+
values={{
|
|
63
|
+
versionLabel,
|
|
64
|
+
latestVersionLink: (
|
|
65
|
+
<b>
|
|
66
|
+
<Link to={to} onClick={onClick}>
|
|
67
|
+
<Translate
|
|
68
|
+
id="theme.docs.versions.latestVersionLinkLabel"
|
|
69
|
+
description="The label used for the latest version suggestion link label">
|
|
70
|
+
latest version
|
|
71
|
+
</Translate>
|
|
72
|
+
</Link>
|
|
73
|
+
</b>
|
|
74
|
+
),
|
|
75
|
+
}}>
|
|
76
|
+
{
|
|
77
|
+
'For up-to-date documentation, see the {latestVersionLink} ({versionLabel}).'
|
|
78
|
+
}
|
|
79
|
+
</Translate>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function DocVersionBannerEnabled({versionMetadata}) {
|
|
84
|
+
const {
|
|
85
|
+
siteConfig: {title: siteTitle},
|
|
86
|
+
} = useDocusaurusContext();
|
|
87
|
+
const {pluginId} = useActivePlugin({
|
|
88
|
+
failfast: true,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const getVersionMainDoc = (version) =>
|
|
92
|
+
version.docs.find((doc) => doc.id === version.mainDocId);
|
|
93
|
+
|
|
94
|
+
const {savePreferredVersionName} = useDocsPreferredVersion(pluginId);
|
|
95
|
+
const {
|
|
96
|
+
latestDocSuggestion,
|
|
97
|
+
latestVersionSuggestion,
|
|
98
|
+
} = useDocVersionSuggestions(pluginId); // try to link to same doc in latest version (not always possible)
|
|
99
|
+
// fallback to main doc of latest version
|
|
100
|
+
|
|
101
|
+
const latestVersionSuggestedDoc =
|
|
102
|
+
latestDocSuggestion ?? getVersionMainDoc(latestVersionSuggestion);
|
|
103
|
+
return (
|
|
104
|
+
<div className="alert alert--warning margin-bottom--md" role="alert">
|
|
105
|
+
<div>
|
|
106
|
+
<BannerLabel siteTitle={siteTitle} versionMetadata={versionMetadata} />
|
|
107
|
+
</div>
|
|
108
|
+
<div className="margin-top--md">
|
|
109
|
+
<LatestVersionSuggestionLabel
|
|
110
|
+
versionLabel={latestVersionSuggestion.label}
|
|
111
|
+
to={latestVersionSuggestedDoc.path}
|
|
112
|
+
onClick={() => savePreferredVersionName(latestVersionSuggestion.name)}
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function DocVersionBanner({versionMetadata}) {
|
|
120
|
+
if (versionMetadata.banner === 'none') {
|
|
121
|
+
return <></>;
|
|
122
|
+
} else {
|
|
123
|
+
return <DocVersionBannerEnabled versionMetadata={versionMetadata} />;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export default DocVersionBanner;
|
|
@@ -22,7 +22,7 @@ function UnreleasedVersionLabel({siteTitle, versionLabel}) {
|
|
|
22
22
|
description="The label used to tell the user that he's browsing an unreleased doc version"
|
|
23
23
|
values={{
|
|
24
24
|
siteTitle,
|
|
25
|
-
versionLabel: <
|
|
25
|
+
versionLabel: <b>{versionLabel}</b>,
|
|
26
26
|
}}>
|
|
27
27
|
{
|
|
28
28
|
'This is unreleased documentation for {siteTitle} {versionLabel} version.'
|
|
@@ -38,7 +38,7 @@ function UnmaintainedVersionLabel({siteTitle, versionLabel}) {
|
|
|
38
38
|
description="The label used to tell the user that he's browsing an unmaintained doc version"
|
|
39
39
|
values={{
|
|
40
40
|
siteTitle,
|
|
41
|
-
versionLabel: <
|
|
41
|
+
versionLabel: <b>{versionLabel}</b>,
|
|
42
42
|
}}>
|
|
43
43
|
{
|
|
44
44
|
'This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.'
|
|
@@ -55,7 +55,7 @@ function LatestVersionSuggestionLabel({versionLabel, to, onClick}) {
|
|
|
55
55
|
values={{
|
|
56
56
|
versionLabel,
|
|
57
57
|
latestVersionLink: (
|
|
58
|
-
<
|
|
58
|
+
<b>
|
|
59
59
|
<Link to={to} onClick={onClick}>
|
|
60
60
|
<Translate
|
|
61
61
|
id="theme.docs.versions.latestVersionLinkLabel"
|
|
@@ -63,7 +63,7 @@ function LatestVersionSuggestionLabel({versionLabel, to, onClick}) {
|
|
|
63
63
|
latest version
|
|
64
64
|
</Translate>
|
|
65
65
|
</Link>
|
|
66
|
-
</
|
|
66
|
+
</b>
|
|
67
67
|
),
|
|
68
68
|
}}>
|
|
69
69
|
{
|
|
@@ -12,8 +12,20 @@ import {translate} from '@docusaurus/Translate';
|
|
|
12
12
|
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
13
13
|
import './styles.css';
|
|
14
14
|
import styles from './styles.module.css';
|
|
15
|
+
export const MainHeading = function MainHeading({...props}) {
|
|
16
|
+
return (
|
|
17
|
+
<header>
|
|
18
|
+
<h1
|
|
19
|
+
{...props}
|
|
20
|
+
id={undefined} // h1 headings do not need an id because they don't appear in the TOC
|
|
21
|
+
className={styles.h1Heading}>
|
|
22
|
+
{props.children}
|
|
23
|
+
</h1>
|
|
24
|
+
</header>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
15
27
|
|
|
16
|
-
const
|
|
28
|
+
const createAnchorHeading = (Tag) =>
|
|
17
29
|
function TargetComponent({id, ...props}) {
|
|
18
30
|
const {
|
|
19
31
|
navbar: {hideOnScroll},
|
|
@@ -48,4 +60,8 @@ const Heading = (Tag) =>
|
|
|
48
60
|
);
|
|
49
61
|
};
|
|
50
62
|
|
|
63
|
+
const Heading = (headingType) => {
|
|
64
|
+
return headingType === 'h1' ? MainHeading : createAnchorHeading(headingType);
|
|
65
|
+
};
|
|
66
|
+
|
|
51
67
|
export default Heading;
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
|
|
9
9
|
const IconArrow = (props) => {
|
|
10
10
|
return (
|
|
11
|
-
<svg width="20" height="20"
|
|
11
|
+
<svg width="20" height="20" aria-hidden="true" {...props}>
|
|
12
12
|
<g fill="#7a7a7a">
|
|
13
13
|
<path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0" />
|
|
14
14
|
<path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0" />
|
|
@@ -12,13 +12,11 @@ const IconEdit = ({className, ...restProps}) => {
|
|
|
12
12
|
return (
|
|
13
13
|
<svg
|
|
14
14
|
fill="currentColor"
|
|
15
|
-
height="
|
|
16
|
-
width="
|
|
17
|
-
preserveAspectRatio="xMidYMid meet"
|
|
18
|
-
role="img"
|
|
15
|
+
height="20"
|
|
16
|
+
width="20"
|
|
19
17
|
viewBox="0 0 40 40"
|
|
20
18
|
className={clsx(styles.iconEdit, className)}
|
|
21
|
-
aria-
|
|
19
|
+
aria-hidden="true"
|
|
22
20
|
{...restProps}>
|
|
23
21
|
<g>
|
|
24
22
|
<path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z" />
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
import React from 'react';
|
|
8
|
+
import styles from './styles.module.css';
|
|
9
|
+
|
|
10
|
+
const IconExternalLink = ({width = 13.5, height = 13.5}) => {
|
|
11
|
+
return (
|
|
12
|
+
<svg
|
|
13
|
+
width={width}
|
|
14
|
+
height={height}
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
viewBox="0 0 24 24"
|
|
17
|
+
className={styles.iconExternalLink}>
|
|
18
|
+
<path
|
|
19
|
+
fill="currentColor"
|
|
20
|
+
d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default IconExternalLink;
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
8
|
+
.iconExternalLink {
|
|
9
|
+
margin-left: 0.3rem;
|
|
10
|
+
position: relative;
|
|
11
|
+
top: 1px;
|
|
13
12
|
}
|
|
@@ -9,10 +9,10 @@ import React from 'react';
|
|
|
9
9
|
const IconLanguage = ({width = 20, height = 20, ...props}) => {
|
|
10
10
|
return (
|
|
11
11
|
<svg
|
|
12
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
13
12
|
viewBox="0 0 20 20"
|
|
14
13
|
width={width}
|
|
15
14
|
height={height}
|
|
15
|
+
aria-hidden="true"
|
|
16
16
|
{...props}>
|
|
17
17
|
<path
|
|
18
18
|
fill="currentColor"
|
|
@@ -9,15 +9,12 @@ import React from 'react';
|
|
|
9
9
|
const IconMenu = ({width = 30, height = 30, className, ...restProps}) => {
|
|
10
10
|
return (
|
|
11
11
|
<svg
|
|
12
|
-
aria-label="Menu"
|
|
13
12
|
className={className}
|
|
14
13
|
width={width}
|
|
15
14
|
height={height}
|
|
16
15
|
viewBox="0 0 30 30"
|
|
17
|
-
|
|
18
|
-
focusable="false"
|
|
16
|
+
aria-hidden="true"
|
|
19
17
|
{...restProps}>
|
|
20
|
-
<title>Menu</title>
|
|
21
18
|
<path
|
|
22
19
|
stroke="currentColor"
|
|
23
20
|
strokeLinecap="round"
|