@docusaurus/theme-classic 2.4.1 → 3.0.0-beta.0
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/lib/getSwizzleConfig.js +107 -8
- package/lib/index.js +20 -6
- package/lib/nprogress.d.ts +1 -1
- package/lib/options.js +6 -2
- package/lib/theme/Admonition/Icon/Danger.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Danger.js +17 -0
- package/lib/theme/Admonition/Icon/Info.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Info.js +17 -0
- package/lib/theme/Admonition/Icon/Note.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Note.js +17 -0
- package/lib/theme/Admonition/Icon/Tip.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Tip.js +17 -0
- package/lib/theme/Admonition/Icon/Warning.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Warning.js +17 -0
- package/lib/theme/Admonition/Layout/index.d.ts +9 -0
- package/lib/theme/Admonition/Layout/index.js +45 -0
- package/lib/theme/Admonition/{styles.module.css → Layout/styles.module.css} +4 -0
- package/lib/theme/Admonition/Type/Caution.d.ts +9 -0
- package/lib/theme/Admonition/Type/Caution.js +34 -0
- package/lib/theme/Admonition/Type/Danger.d.ts +9 -0
- package/lib/theme/Admonition/Type/Danger.js +32 -0
- package/lib/theme/Admonition/Type/Info.d.ts +9 -0
- package/lib/theme/Admonition/Type/Info.js +32 -0
- package/lib/theme/Admonition/Type/Note.d.ts +9 -0
- package/lib/theme/Admonition/Type/Note.js +32 -0
- package/lib/theme/Admonition/Type/Tip.d.ts +9 -0
- package/lib/theme/Admonition/Type/Tip.js +32 -0
- package/lib/theme/Admonition/Type/Warning.d.ts +9 -0
- package/lib/theme/Admonition/Type/Warning.js +32 -0
- package/lib/theme/Admonition/Types.d.ts +12 -0
- package/lib/theme/Admonition/Types.js +33 -0
- package/lib/theme/Admonition/index.d.ts +1 -1
- package/lib/theme/Admonition/index.js +12 -171
- package/lib/theme/BlogArchivePage/index.js +7 -2
- package/lib/theme/BlogLayout/index.js +1 -1
- package/lib/theme/BlogPostItem/Container/index.js +12 -3
- package/lib/theme/BlogPostItem/Header/Author/index.js +6 -1
- package/lib/theme/BlogPostPage/index.js +3 -1
- package/lib/theme/BlogSidebar/Desktop/index.js +3 -1
- package/lib/theme/BlogSidebar/Mobile/index.js +3 -1
- package/lib/theme/BlogTagsListPage/index.js +2 -1
- package/lib/theme/BlogTagsPostsPage/index.js +4 -2
- package/lib/theme/CodeBlock/Content/String.js +9 -2
- package/lib/theme/CodeBlock/CopyButton/index.js +0 -1
- package/lib/theme/DocBreadcrumbs/index.js +6 -2
- package/lib/theme/DocCard/index.js +8 -4
- package/lib/theme/DocItem/Layout/index.js +5 -0
- package/lib/theme/DocItem/index.js +1 -1
- package/lib/theme/{DocPage → DocRoot}/Layout/Main/index.d.ts +2 -2
- package/lib/theme/{DocPage → DocRoot}/Layout/Main/index.js +1 -1
- package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.d.ts +2 -2
- package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.js +1 -1
- package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/index.d.ts +2 -2
- package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/index.js +2 -2
- package/lib/theme/{DocPage → DocRoot}/Layout/index.d.ts +2 -2
- package/lib/theme/{DocPage → DocRoot}/Layout/index.js +9 -10
- package/lib/theme/{DocPage → DocRoot}/Layout/styles.module.css +1 -2
- package/lib/theme/{DocPage → DocRoot}/index.d.ts +2 -2
- package/lib/theme/DocRoot/index.js +31 -0
- package/lib/theme/DocSidebar/Desktop/index.d.ts +1 -1
- package/lib/theme/DocSidebar/Mobile/index.d.ts +1 -1
- package/lib/theme/DocSidebarItem/Category/index.js +24 -13
- package/lib/theme/DocSidebarItems/index.js +6 -4
- package/lib/theme/DocTagDocListPage/index.d.ts +1 -1
- package/lib/theme/DocTagDocListPage/index.js +53 -39
- package/lib/theme/DocTagsListPage/index.d.ts +1 -1
- package/lib/theme/DocTagsListPage/index.js +26 -17
- package/lib/theme/DocVersionRoot/index.d.ts +10 -0
- package/lib/theme/DocVersionRoot/index.js +46 -0
- package/lib/theme/DocsRoot/index.d.ts +10 -0
- package/lib/theme/DocsRoot/index.js +18 -0
- package/lib/theme/EditThisPage/index.js +3 -6
- package/lib/theme/ErrorPageContent.js +3 -2
- package/lib/theme/MDXComponents/Code.js +2 -36
- package/lib/theme/MDXComponents/Details.js +1 -1
- package/lib/theme/MDXComponents/Pre.d.ts +2 -2
- package/lib/theme/MDXComponents/Pre.js +4 -11
- package/lib/theme/MDXComponents/Ul/index.js +4 -0
- package/lib/theme/MDXComponents/index.js +4 -3
- package/lib/theme/MDXPage/index.js +16 -4
- package/lib/theme/NavbarItem/DocNavbarItem.js +4 -3
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.d.ts +1 -1
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +2 -1
- package/lib/theme/NotFound/Content/index.d.ts +9 -0
- package/lib/theme/NotFound/Content/index.js +42 -0
- package/lib/theme/{NotFound.d.ts → NotFound/index.d.ts} +1 -1
- package/lib/theme/NotFound/index.js +25 -0
- package/lib/theme/SiteMetadata/index.js +30 -3
- package/lib/theme/TOCItems/Tree.js +3 -4
- package/lib/theme/Tabs/index.js +4 -2
- package/lib/theme/TagsListByLetter/index.js +4 -1
- package/lib/theme/ThemedImage/index.js +8 -24
- package/lib/theme/{MDXComponents/Head.d.ts → Unlisted/index.d.ts} +2 -2
- package/lib/theme/Unlisted/index.js +38 -0
- package/package.json +26 -26
- package/src/getSwizzleConfig.ts +116 -9
- package/src/index.ts +21 -6
- package/src/nprogress.ts +2 -1
- package/src/options.ts +7 -2
- package/src/theme/Admonition/Icon/Danger.tsx +20 -0
- package/src/theme/Admonition/Icon/Info.tsx +20 -0
- package/src/theme/Admonition/Icon/Note.tsx +20 -0
- package/src/theme/Admonition/Icon/Tip.tsx +20 -0
- package/src/theme/Admonition/Icon/Warning.tsx +20 -0
- package/src/theme/Admonition/Layout/index.tsx +57 -0
- package/src/theme/Admonition/{styles.module.css → Layout/styles.module.css} +4 -0
- package/src/theme/Admonition/Type/Caution.tsx +39 -0
- package/src/theme/Admonition/Type/Danger.tsx +37 -0
- package/src/theme/Admonition/Type/Info.tsx +37 -0
- package/src/theme/Admonition/Type/Note.tsx +37 -0
- package/src/theme/Admonition/Type/Tip.tsx +37 -0
- package/src/theme/Admonition/Type/Warning.tsx +37 -0
- package/src/theme/Admonition/Types.tsx +38 -0
- package/src/theme/Admonition/index.tsx +13 -194
- package/src/theme/BlogArchivePage/index.tsx +7 -2
- package/src/theme/BlogLayout/index.tsx +1 -1
- package/src/theme/BlogPostItem/Container/index.tsx +12 -3
- package/src/theme/BlogPostItem/Header/Author/index.tsx +6 -1
- package/src/theme/BlogPostPage/index.tsx +3 -1
- package/src/theme/BlogSidebar/Desktop/index.tsx +3 -1
- package/src/theme/BlogSidebar/Mobile/index.tsx +3 -1
- package/src/theme/BlogTagsListPage/index.tsx +2 -1
- package/src/theme/BlogTagsPostsPage/index.tsx +4 -2
- package/src/theme/CodeBlock/Content/String.tsx +11 -2
- package/src/theme/CodeBlock/CopyButton/index.tsx +0 -1
- package/src/theme/DocBreadcrumbs/index.tsx +6 -2
- package/src/theme/DocCard/index.tsx +11 -6
- package/src/theme/DocItem/Layout/index.tsx +5 -0
- package/src/theme/DocItem/index.tsx +1 -1
- package/src/theme/{DocPage → DocRoot}/Layout/Main/index.tsx +2 -2
- package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.tsx +2 -2
- package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/index.tsx +3 -3
- package/src/theme/{DocPage → DocRoot}/Layout/index.tsx +10 -11
- package/src/theme/{DocPage → DocRoot}/Layout/styles.module.css +1 -2
- package/src/theme/DocRoot/index.tsx +34 -0
- package/src/theme/DocSidebarItem/Category/index.tsx +25 -12
- package/src/theme/DocSidebarItems/index.tsx +6 -4
- package/src/theme/DocTagDocListPage/index.tsx +60 -39
- package/src/theme/DocTagsListPage/index.tsx +33 -17
- package/src/theme/DocVersionRoot/index.tsx +51 -0
- package/src/theme/DocsRoot/index.tsx +22 -0
- package/src/theme/EditThisPage/index.tsx +3 -6
- package/src/theme/ErrorPageContent.tsx +3 -2
- package/src/theme/MDXComponents/Code.tsx +2 -39
- package/src/theme/MDXComponents/Details.tsx +1 -2
- package/src/theme/MDXComponents/Pre.tsx +5 -13
- package/src/theme/MDXComponents/Ul/index.tsx +5 -1
- package/src/theme/MDXComponents/index.tsx +11 -10
- package/src/theme/MDXPage/index.tsx +16 -4
- package/src/theme/NavbarItem/DocNavbarItem.tsx +4 -3
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +2 -1
- package/src/theme/NotFound/Content/index.tsx +45 -0
- package/src/theme/NotFound/index.tsx +27 -0
- package/src/theme/SiteMetadata/index.tsx +36 -3
- package/src/theme/SkipToContent/index.tsx +0 -1
- package/src/theme/TOCItems/Tree.tsx +3 -4
- package/src/theme/Tabs/index.tsx +4 -2
- package/src/theme/TagsListByLetter/index.tsx +4 -2
- package/src/theme/ThemedImage/index.tsx +8 -31
- package/src/theme/Unlisted/index.tsx +42 -0
- package/src/theme/prism-include-languages.ts +2 -1
- package/src/theme-classic.d.ts +146 -21
- package/lib/theme/DocPage/index.js +0 -67
- package/lib/theme/MDXComponents/Head.js +0 -23
- package/lib/theme/NotFound.js +0 -52
- package/src/theme/DocPage/index.tsx +0 -71
- package/src/theme/MDXComponents/Head.tsx +0 -29
- package/src/theme/NotFound.tsx +0 -54
- /package/lib/theme/{DocPage → DocRoot}/Layout/Main/styles.module.css +0 -0
- /package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/styles.module.css +0 -0
- /package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/styles.module.css +0 -0
- /package/src/theme/{DocPage → DocRoot}/Layout/Main/styles.module.css +0 -0
- /package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/styles.module.css +0 -0
- /package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/styles.module.css +0 -0
|
@@ -7,32 +7,31 @@
|
|
|
7
7
|
|
|
8
8
|
import React, {useState} from 'react';
|
|
9
9
|
import {useDocsSidebar} from '@docusaurus/theme-common/internal';
|
|
10
|
-
import Layout from '@theme/Layout';
|
|
11
10
|
import BackToTopButton from '@theme/BackToTopButton';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import type {Props} from '@theme/
|
|
11
|
+
import DocRootLayoutSidebar from '@theme/DocRoot/Layout/Sidebar';
|
|
12
|
+
import DocRootLayoutMain from '@theme/DocRoot/Layout/Main';
|
|
13
|
+
import type {Props} from '@theme/DocRoot/Layout';
|
|
15
14
|
|
|
16
15
|
import styles from './styles.module.css';
|
|
17
16
|
|
|
18
|
-
export default function
|
|
17
|
+
export default function DocRootLayout({children}: Props): JSX.Element {
|
|
19
18
|
const sidebar = useDocsSidebar();
|
|
20
19
|
const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false);
|
|
21
20
|
return (
|
|
22
|
-
<
|
|
21
|
+
<div className={styles.docsWrapper}>
|
|
23
22
|
<BackToTopButton />
|
|
24
|
-
<div className={styles.
|
|
23
|
+
<div className={styles.docRoot}>
|
|
25
24
|
{sidebar && (
|
|
26
|
-
<
|
|
25
|
+
<DocRootLayoutSidebar
|
|
27
26
|
sidebar={sidebar.items}
|
|
28
27
|
hiddenSidebarContainer={hiddenSidebarContainer}
|
|
29
28
|
setHiddenSidebarContainer={setHiddenSidebarContainer}
|
|
30
29
|
/>
|
|
31
30
|
)}
|
|
32
|
-
<
|
|
31
|
+
<DocRootLayoutMain hiddenSidebarContainer={hiddenSidebarContainer}>
|
|
33
32
|
{children}
|
|
34
|
-
</
|
|
33
|
+
</DocRootLayoutMain>
|
|
35
34
|
</div>
|
|
36
|
-
</
|
|
35
|
+
</div>
|
|
37
36
|
);
|
|
38
37
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {HtmlClassNameProvider, ThemeClassNames} from '@docusaurus/theme-common';
|
|
11
|
+
import {
|
|
12
|
+
DocsSidebarProvider,
|
|
13
|
+
useDocRootMetadata,
|
|
14
|
+
} from '@docusaurus/theme-common/internal';
|
|
15
|
+
import DocRootLayout from '@theme/DocRoot/Layout';
|
|
16
|
+
import NotFoundContent from '@theme/NotFound/Content';
|
|
17
|
+
import type {Props} from '@theme/DocRoot';
|
|
18
|
+
|
|
19
|
+
export default function DocRoot(props: Props): JSX.Element {
|
|
20
|
+
const currentDocRouteMetadata = useDocRootMetadata(props);
|
|
21
|
+
if (!currentDocRouteMetadata) {
|
|
22
|
+
// We only render the not found content to avoid a double layout
|
|
23
|
+
// see https://github.com/facebook/docusaurus/pull/7966#pullrequestreview-1077276692
|
|
24
|
+
return <NotFoundContent />;
|
|
25
|
+
}
|
|
26
|
+
const {docElement, sidebarName, sidebarItems} = currentDocRouteMetadata;
|
|
27
|
+
return (
|
|
28
|
+
<HtmlClassNameProvider className={clsx(ThemeClassNames.page.docsDocPage)}>
|
|
29
|
+
<DocsSidebarProvider name={sidebarName} items={sidebarItems}>
|
|
30
|
+
<DocRootLayout>{docElement}</DocRootLayout>
|
|
31
|
+
</DocsSidebarProvider>
|
|
32
|
+
</HtmlClassNameProvider>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from '@docusaurus/theme-common';
|
|
17
17
|
import {
|
|
18
18
|
isActiveSidebarItem,
|
|
19
|
-
|
|
19
|
+
findFirstSidebarItemLink,
|
|
20
20
|
useDocSidebarItemsExpandedState,
|
|
21
21
|
isSamePath,
|
|
22
22
|
} from '@docusaurus/theme-common/internal';
|
|
@@ -59,7 +59,7 @@ function useCategoryHrefWithSSRFallback(
|
|
|
59
59
|
): string | undefined {
|
|
60
60
|
const isBrowser = useIsBrowser();
|
|
61
61
|
return useMemo(() => {
|
|
62
|
-
if (item.href) {
|
|
62
|
+
if (item.href && !item.linkUnlisted) {
|
|
63
63
|
return item.href;
|
|
64
64
|
}
|
|
65
65
|
// In these cases, it's not necessary to render a fallback
|
|
@@ -67,28 +67,40 @@ function useCategoryHrefWithSSRFallback(
|
|
|
67
67
|
if (isBrowser || !item.collapsible) {
|
|
68
68
|
return undefined;
|
|
69
69
|
}
|
|
70
|
-
return
|
|
70
|
+
return findFirstSidebarItemLink(item);
|
|
71
71
|
}, [item, isBrowser]);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
function CollapseButton({
|
|
75
|
+
collapsed,
|
|
75
76
|
categoryLabel,
|
|
76
77
|
onClick,
|
|
77
78
|
}: {
|
|
79
|
+
collapsed: boolean;
|
|
78
80
|
categoryLabel: string;
|
|
79
81
|
onClick: ComponentProps<'button'>['onClick'];
|
|
80
82
|
}) {
|
|
81
83
|
return (
|
|
82
84
|
<button
|
|
83
|
-
aria-label={
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
aria-label={
|
|
86
|
+
collapsed
|
|
87
|
+
? translate(
|
|
88
|
+
{
|
|
89
|
+
id: 'theme.DocSidebarItem.expandCategoryAriaLabel',
|
|
90
|
+
message: "Expand sidebar category '{label}'",
|
|
91
|
+
description: 'The ARIA label to expand the sidebar category',
|
|
92
|
+
},
|
|
93
|
+
{label: categoryLabel},
|
|
94
|
+
)
|
|
95
|
+
: translate(
|
|
96
|
+
{
|
|
97
|
+
id: 'theme.DocSidebarItem.collapseCategoryAriaLabel',
|
|
98
|
+
message: "Collapse sidebar category '{label}'",
|
|
99
|
+
description: 'The ARIA label to collapse the sidebar category',
|
|
100
|
+
},
|
|
101
|
+
{label: categoryLabel},
|
|
102
|
+
)
|
|
103
|
+
}
|
|
92
104
|
type="button"
|
|
93
105
|
className="clean-btn menu__caret"
|
|
94
106
|
onClick={onClick}
|
|
@@ -188,6 +200,7 @@ export default function DocSidebarItemCategory({
|
|
|
188
200
|
</Link>
|
|
189
201
|
{href && collapsible && (
|
|
190
202
|
<CollapseButton
|
|
203
|
+
collapsed={collapsed}
|
|
191
204
|
categoryLabel={label}
|
|
192
205
|
onClick={(e) => {
|
|
193
206
|
e.preventDefault();
|
|
@@ -6,17 +6,19 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React, {memo} from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
DocSidebarItemsExpandedStateProvider,
|
|
11
|
+
useVisibleSidebarItems,
|
|
12
|
+
} from '@docusaurus/theme-common/internal';
|
|
10
13
|
import DocSidebarItem from '@theme/DocSidebarItem';
|
|
11
14
|
|
|
12
15
|
import type {Props} from '@theme/DocSidebarItems';
|
|
13
16
|
|
|
14
|
-
// TODO this item should probably not receive the "activePath" props
|
|
15
|
-
// TODO this triggers whole sidebar re-renders on navigation
|
|
16
17
|
function DocSidebarItems({items, ...props}: Props): JSX.Element {
|
|
18
|
+
const visibleItems = useVisibleSidebarItems(items, props.activePath);
|
|
17
19
|
return (
|
|
18
20
|
<DocSidebarItemsExpandedStateProvider>
|
|
19
|
-
{
|
|
21
|
+
{visibleItems.map((item, index) => (
|
|
20
22
|
<DocSidebarItem key={index} item={item} index={index} {...props} />
|
|
21
23
|
))}
|
|
22
24
|
</DocSidebarItemsExpandedStateProvider>
|
|
@@ -15,9 +15,10 @@ import {
|
|
|
15
15
|
usePluralForm,
|
|
16
16
|
} from '@docusaurus/theme-common';
|
|
17
17
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
18
|
-
import Layout from '@theme/Layout';
|
|
19
18
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
20
19
|
import type {Props} from '@theme/DocTagDocListPage';
|
|
20
|
+
import Unlisted from '@theme/Unlisted';
|
|
21
|
+
import Heading from '@theme/Heading';
|
|
21
22
|
|
|
22
23
|
// Very simple pluralization: probably good enough for now
|
|
23
24
|
function useNDocsTaggedPlural() {
|
|
@@ -37,59 +38,79 @@ function useNDocsTaggedPlural() {
|
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
function usePageTitle(props: Props): string {
|
|
42
|
+
const nDocsTaggedPlural = useNDocsTaggedPlural();
|
|
43
|
+
return translate(
|
|
44
|
+
{
|
|
45
|
+
id: 'theme.docs.tagDocListPageTitle',
|
|
46
|
+
description: 'The title of the page for a docs tag',
|
|
47
|
+
message: '{nDocsTagged} with "{tagName}"',
|
|
48
|
+
},
|
|
49
|
+
{nDocsTagged: nDocsTaggedPlural(props.tag.count), tagName: props.tag.label},
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
40
53
|
function DocItem({doc}: {doc: Props['tag']['items'][number]}): JSX.Element {
|
|
41
54
|
return (
|
|
42
55
|
<article className="margin-vert--lg">
|
|
43
56
|
<Link to={doc.permalink}>
|
|
44
|
-
<h2>{doc.title}</
|
|
57
|
+
<Heading as="h2">{doc.title}</Heading>
|
|
45
58
|
</Link>
|
|
46
59
|
{doc.description && <p>{doc.description}</p>}
|
|
47
60
|
</article>
|
|
48
61
|
);
|
|
49
62
|
}
|
|
50
63
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
{nDocsTagged: nDocsTaggedPlural(tag.count), tagName: tag.label},
|
|
64
|
+
function DocTagDocListPageMetadata({
|
|
65
|
+
title,
|
|
66
|
+
}: Props & {title: string}): JSX.Element {
|
|
67
|
+
return (
|
|
68
|
+
<>
|
|
69
|
+
<PageMetadata title={title} />
|
|
70
|
+
<SearchMetadata tag="doc_tag_doc_list" />
|
|
71
|
+
</>
|
|
60
72
|
);
|
|
73
|
+
}
|
|
61
74
|
|
|
75
|
+
function DocTagDocListPageContent({
|
|
76
|
+
tag,
|
|
77
|
+
title,
|
|
78
|
+
}: Props & {title: string}): JSX.Element {
|
|
62
79
|
return (
|
|
63
80
|
<HtmlClassNameProvider
|
|
64
|
-
className={clsx(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
{tag.items.map((doc) => (
|
|
86
|
-
<DocItem key={doc.id} doc={doc} />
|
|
87
|
-
))}
|
|
88
|
-
</section>
|
|
89
|
-
</main>
|
|
90
|
-
</div>
|
|
81
|
+
className={clsx(ThemeClassNames.page.docsTagDocListPage)}>
|
|
82
|
+
<div className="container margin-vert--lg">
|
|
83
|
+
<div className="row">
|
|
84
|
+
<main className="col col--8 col--offset-2">
|
|
85
|
+
{tag.unlisted && <Unlisted />}
|
|
86
|
+
<header className="margin-bottom--xl">
|
|
87
|
+
<Heading as="h1">{title}</Heading>
|
|
88
|
+
<Link href={tag.allTagsPath}>
|
|
89
|
+
<Translate
|
|
90
|
+
id="theme.tags.tagsPageLink"
|
|
91
|
+
description="The label of the link targeting the tag list page">
|
|
92
|
+
View All Tags
|
|
93
|
+
</Translate>
|
|
94
|
+
</Link>
|
|
95
|
+
</header>
|
|
96
|
+
<section className="margin-vert--lg">
|
|
97
|
+
{tag.items.map((doc) => (
|
|
98
|
+
<DocItem key={doc.id} doc={doc} />
|
|
99
|
+
))}
|
|
100
|
+
</section>
|
|
101
|
+
</main>
|
|
91
102
|
</div>
|
|
92
|
-
</
|
|
103
|
+
</div>
|
|
93
104
|
</HtmlClassNameProvider>
|
|
94
105
|
);
|
|
95
106
|
}
|
|
107
|
+
|
|
108
|
+
export default function DocTagDocListPage(props: Props): JSX.Element {
|
|
109
|
+
const title = usePageTitle(props);
|
|
110
|
+
return (
|
|
111
|
+
<>
|
|
112
|
+
<DocTagDocListPageMetadata {...props} title={title} />
|
|
113
|
+
<DocTagDocListPageContent {...props} title={title} />
|
|
114
|
+
</>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
@@ -13,31 +13,47 @@ import {
|
|
|
13
13
|
ThemeClassNames,
|
|
14
14
|
translateTagsPageTitle,
|
|
15
15
|
} from '@docusaurus/theme-common';
|
|
16
|
-
import Layout from '@theme/Layout';
|
|
17
16
|
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
18
17
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
19
18
|
import type {Props} from '@theme/DocTagsListPage';
|
|
19
|
+
import Heading from '@theme/Heading';
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
function DocTagsListPageMetadata({
|
|
22
|
+
title,
|
|
23
|
+
}: Props & {title: string}): JSX.Element {
|
|
23
24
|
return (
|
|
24
|
-
|
|
25
|
-
className={clsx(
|
|
26
|
-
ThemeClassNames.wrapper.docsPages,
|
|
27
|
-
ThemeClassNames.page.docsTagsListPage,
|
|
28
|
-
)}>
|
|
25
|
+
<>
|
|
29
26
|
<PageMetadata title={title} />
|
|
30
27
|
<SearchMetadata tag="doc_tags_list" />
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
</>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function DocTagsListPageContent({
|
|
33
|
+
tags,
|
|
34
|
+
title,
|
|
35
|
+
}: Props & {title: string}): JSX.Element {
|
|
36
|
+
return (
|
|
37
|
+
<HtmlClassNameProvider
|
|
38
|
+
className={clsx(ThemeClassNames.page.docsTagsListPage)}>
|
|
39
|
+
<div className="container margin-vert--lg">
|
|
40
|
+
<div className="row">
|
|
41
|
+
<main className="col col--8 col--offset-2">
|
|
42
|
+
<Heading as="h1">{title}</Heading>
|
|
43
|
+
<TagsListByLetter tags={tags} />
|
|
44
|
+
</main>
|
|
39
45
|
</div>
|
|
40
|
-
</
|
|
46
|
+
</div>
|
|
41
47
|
</HtmlClassNameProvider>
|
|
42
48
|
);
|
|
43
49
|
}
|
|
50
|
+
|
|
51
|
+
export default function DocTagsListPage(props: Props): JSX.Element {
|
|
52
|
+
const title = translateTagsPageTitle();
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<DocTagsListPageMetadata {...props} title={title} />
|
|
56
|
+
<DocTagsListPageContent {...props} title={title} />
|
|
57
|
+
</>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import {HtmlClassNameProvider, PageMetadata} from '@docusaurus/theme-common';
|
|
10
|
+
import {
|
|
11
|
+
docVersionSearchTag,
|
|
12
|
+
DocsVersionProvider,
|
|
13
|
+
} from '@docusaurus/theme-common/internal';
|
|
14
|
+
import renderRoutes from '@docusaurus/renderRoutes';
|
|
15
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
16
|
+
|
|
17
|
+
import type {Props} from '@theme/DocVersionRoot';
|
|
18
|
+
|
|
19
|
+
function DocVersionRootMetadata(props: Props): JSX.Element {
|
|
20
|
+
const {version} = props;
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<SearchMetadata
|
|
24
|
+
version={version.version}
|
|
25
|
+
tag={docVersionSearchTag(version.pluginId, version.version)}
|
|
26
|
+
/>
|
|
27
|
+
<PageMetadata>
|
|
28
|
+
{version.noIndex && <meta name="robots" content="noindex, nofollow" />}
|
|
29
|
+
</PageMetadata>
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function DocVersionRootContent(props: Props): JSX.Element {
|
|
35
|
+
const {version, route} = props;
|
|
36
|
+
return (
|
|
37
|
+
<HtmlClassNameProvider className={version.className}>
|
|
38
|
+
<DocsVersionProvider version={version}>
|
|
39
|
+
{renderRoutes(route.routes!)}
|
|
40
|
+
</DocsVersionProvider>
|
|
41
|
+
</HtmlClassNameProvider>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
export default function DocVersionRoot(props: Props): JSX.Element {
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<DocVersionRootMetadata {...props} />
|
|
48
|
+
<DocVersionRootContent {...props} />
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {ThemeClassNames, HtmlClassNameProvider} from '@docusaurus/theme-common';
|
|
11
|
+
import renderRoutes from '@docusaurus/renderRoutes';
|
|
12
|
+
import Layout from '@theme/Layout';
|
|
13
|
+
|
|
14
|
+
import type {Props} from '@theme/DocVersionRoot';
|
|
15
|
+
|
|
16
|
+
export default function DocsRoot(props: Props): JSX.Element {
|
|
17
|
+
return (
|
|
18
|
+
<HtmlClassNameProvider className={clsx(ThemeClassNames.wrapper.docsPages)}>
|
|
19
|
+
<Layout>{renderRoutes(props.route.routes!)}</Layout>
|
|
20
|
+
</HtmlClassNameProvider>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -8,22 +8,19 @@
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import Translate from '@docusaurus/Translate';
|
|
10
10
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
11
|
+
import Link from '@docusaurus/Link';
|
|
11
12
|
import IconEdit from '@theme/Icon/Edit';
|
|
12
13
|
import type {Props} from '@theme/EditThisPage';
|
|
13
14
|
|
|
14
15
|
export default function EditThisPage({editUrl}: Props): JSX.Element {
|
|
15
16
|
return (
|
|
16
|
-
<
|
|
17
|
-
href={editUrl}
|
|
18
|
-
target="_blank"
|
|
19
|
-
rel="noreferrer noopener"
|
|
20
|
-
className={ThemeClassNames.common.editThisPage}>
|
|
17
|
+
<Link to={editUrl} className={ThemeClassNames.common.editThisPage}>
|
|
21
18
|
<IconEdit />
|
|
22
19
|
<Translate
|
|
23
20
|
id="theme.common.editThisPage"
|
|
24
21
|
description="The link label to edit the current page">
|
|
25
22
|
Edit this page
|
|
26
23
|
</Translate>
|
|
27
|
-
</
|
|
24
|
+
</Link>
|
|
28
25
|
);
|
|
29
26
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
ErrorBoundaryTryAgainButton,
|
|
13
13
|
} from '@docusaurus/theme-common';
|
|
14
14
|
import type {Props} from '@theme/Error';
|
|
15
|
+
import Heading from '@theme/Heading';
|
|
15
16
|
|
|
16
17
|
export default function ErrorPageContent({
|
|
17
18
|
error,
|
|
@@ -21,13 +22,13 @@ export default function ErrorPageContent({
|
|
|
21
22
|
<main className="container margin-vert--xl">
|
|
22
23
|
<div className="row">
|
|
23
24
|
<div className="col col--6 col--offset-3">
|
|
24
|
-
<h1 className="hero__title">
|
|
25
|
+
<Heading as="h1" className="hero__title">
|
|
25
26
|
<Translate
|
|
26
27
|
id="theme.ErrorPageContent.title"
|
|
27
28
|
description="The title of the fallback page when the page crashed">
|
|
28
29
|
This page crashed.
|
|
29
30
|
</Translate>
|
|
30
|
-
</
|
|
31
|
+
</Heading>
|
|
31
32
|
<div className="margin-vert--lg">
|
|
32
33
|
<ErrorBoundaryTryAgainButton
|
|
33
34
|
onClick={tryAgain}
|
|
@@ -6,50 +6,13 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type {ComponentProps} from 'react';
|
|
9
|
-
import React
|
|
9
|
+
import React from 'react';
|
|
10
10
|
import CodeBlock from '@theme/CodeBlock';
|
|
11
11
|
import type {Props} from '@theme/MDXComponents/Code';
|
|
12
12
|
|
|
13
13
|
export default function MDXCode(props: Props): JSX.Element {
|
|
14
|
-
const inlineElements: (string | undefined)[] = [
|
|
15
|
-
'a',
|
|
16
|
-
'abbr',
|
|
17
|
-
'b',
|
|
18
|
-
'br',
|
|
19
|
-
'button',
|
|
20
|
-
'cite',
|
|
21
|
-
'code',
|
|
22
|
-
'del',
|
|
23
|
-
'dfn',
|
|
24
|
-
'em',
|
|
25
|
-
'i',
|
|
26
|
-
'img',
|
|
27
|
-
'input',
|
|
28
|
-
'ins',
|
|
29
|
-
'kbd',
|
|
30
|
-
'label',
|
|
31
|
-
'object',
|
|
32
|
-
'output',
|
|
33
|
-
'q',
|
|
34
|
-
'ruby',
|
|
35
|
-
's',
|
|
36
|
-
'small',
|
|
37
|
-
'span',
|
|
38
|
-
'strong',
|
|
39
|
-
'sub',
|
|
40
|
-
'sup',
|
|
41
|
-
'time',
|
|
42
|
-
'u',
|
|
43
|
-
'var',
|
|
44
|
-
'wbr',
|
|
45
|
-
];
|
|
46
14
|
const shouldBeInline = React.Children.toArray(props.children).every(
|
|
47
|
-
(el) =>
|
|
48
|
-
(typeof el === 'string' && !el.includes('\n')) ||
|
|
49
|
-
(isValidElement(el) &&
|
|
50
|
-
inlineElements.includes(
|
|
51
|
-
(el.props as {mdxType: string} | null)?.mdxType,
|
|
52
|
-
)),
|
|
15
|
+
(el) => typeof el === 'string' && !el.includes('\n'),
|
|
53
16
|
);
|
|
54
17
|
|
|
55
18
|
return shouldBeInline ? (
|
|
@@ -15,8 +15,7 @@ export default function MDXDetails(props: Props): JSX.Element {
|
|
|
15
15
|
// Details theme component
|
|
16
16
|
const summary = items.find(
|
|
17
17
|
(item): item is ReactElement<ComponentProps<'summary'>> =>
|
|
18
|
-
React.isValidElement(item) &&
|
|
19
|
-
(item.props as {mdxType: string} | null)?.mdxType === 'summary',
|
|
18
|
+
React.isValidElement(item) && item.type === 'summary',
|
|
20
19
|
);
|
|
21
20
|
const children = <>{items.filter((item) => item !== summary)}</>;
|
|
22
21
|
|
|
@@ -5,19 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React, {
|
|
9
|
-
import CodeBlock from '@theme/CodeBlock';
|
|
8
|
+
import React, {type ReactNode} from 'react';
|
|
10
9
|
import type {Props} from '@theme/MDXComponents/Pre';
|
|
11
10
|
|
|
12
|
-
export default function MDXPre(props: Props):
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{...(isValidElement(props.children) &&
|
|
17
|
-
(props.children.props as {originalType: string} | null)?.originalType ===
|
|
18
|
-
'code'
|
|
19
|
-
? props.children.props
|
|
20
|
-
: {...props})}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
11
|
+
export default function MDXPre(props: Props): ReactNode | undefined {
|
|
12
|
+
// With MDX 2, this element is only used for fenced code blocks
|
|
13
|
+
// It always receives a MDXComponents/Code as children
|
|
14
|
+
return <>{props.children}</>;
|
|
23
15
|
}
|
|
@@ -11,7 +11,11 @@ import type {Props} from '@theme/MDXComponents/Ul';
|
|
|
11
11
|
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
13
|
|
|
14
|
-
function transformUlClassName(className?: string): string {
|
|
14
|
+
function transformUlClassName(className?: string): string | undefined {
|
|
15
|
+
// Fix https://github.com/facebook/docusaurus/issues/9098
|
|
16
|
+
if (typeof className === 'undefined') {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
15
19
|
return clsx(
|
|
16
20
|
className,
|
|
17
21
|
// This class is set globally by GitHub/MDX. We keep the global class, and
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import
|
|
8
|
+
import React, {type ComponentProps} from 'react';
|
|
9
|
+
import Head from '@docusaurus/Head';
|
|
10
10
|
import MDXCode from '@theme/MDXComponents/Code';
|
|
11
11
|
import MDXA from '@theme/MDXComponents/A';
|
|
12
12
|
import MDXPre from '@theme/MDXComponents/Pre';
|
|
@@ -20,19 +20,20 @@ import Mermaid from '@theme/Mermaid';
|
|
|
20
20
|
import type {MDXComponentsObject} from '@theme/MDXComponents';
|
|
21
21
|
|
|
22
22
|
const MDXComponents: MDXComponentsObject = {
|
|
23
|
-
|
|
23
|
+
Head,
|
|
24
|
+
details: MDXDetails, // For MD mode support, see https://github.com/facebook/docusaurus/issues/9092#issuecomment-1602902274
|
|
25
|
+
Details: MDXDetails,
|
|
24
26
|
code: MDXCode,
|
|
25
27
|
a: MDXA,
|
|
26
28
|
pre: MDXPre,
|
|
27
|
-
details: MDXDetails,
|
|
28
29
|
ul: MDXUl,
|
|
29
30
|
img: MDXImg,
|
|
30
|
-
h1: (props) => <MDXHeading as="h1" {...props} />,
|
|
31
|
-
h2: (props) => <MDXHeading as="h2" {...props} />,
|
|
32
|
-
h3: (props) => <MDXHeading as="h3" {...props} />,
|
|
33
|
-
h4: (props) => <MDXHeading as="h4" {...props} />,
|
|
34
|
-
h5: (props) => <MDXHeading as="h5" {...props} />,
|
|
35
|
-
h6: (props) => <MDXHeading as="h6" {...props} />,
|
|
31
|
+
h1: (props: ComponentProps<'h1'>) => <MDXHeading as="h1" {...props} />,
|
|
32
|
+
h2: (props: ComponentProps<'h2'>) => <MDXHeading as="h2" {...props} />,
|
|
33
|
+
h3: (props: ComponentProps<'h3'>) => <MDXHeading as="h3" {...props} />,
|
|
34
|
+
h4: (props: ComponentProps<'h4'>) => <MDXHeading as="h4" {...props} />,
|
|
35
|
+
h5: (props: ComponentProps<'h5'>) => <MDXHeading as="h5" {...props} />,
|
|
36
|
+
h6: (props: ComponentProps<'h6'>) => <MDXHeading as="h6" {...props} />,
|
|
36
37
|
admonition: Admonition,
|
|
37
38
|
mermaid: Mermaid,
|
|
38
39
|
};
|