@docusaurus/theme-classic 2.4.1 → 3.0.0-alpha.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 +99 -7
- package/lib/index.js +20 -6
- package/lib/nprogress.d.ts +1 -1
- package/lib/options.js +1 -0
- package/lib/theme/Admonition/Icon/Caution.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Caution.js +17 -0
- 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/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 +32 -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/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/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/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/{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/DocSidebarItem/Category/index.js +3 -3
- 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/index.js +3 -3
- package/lib/theme/MDXContent/index.js +1 -0
- 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/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 +24 -24
- package/src/getSwizzleConfig.ts +107 -8
- package/src/index.ts +21 -6
- package/src/nprogress.ts +2 -1
- package/src/options.ts +1 -0
- package/src/theme/Admonition/Icon/Caution.tsx +20 -0
- 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/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 +37 -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/Types.tsx +38 -0
- package/src/theme/Admonition/index.tsx +13 -194
- package/src/theme/BlogArchivePage/index.tsx +7 -2
- 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/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/{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 +3 -3
- 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/index.tsx +3 -3
- package/src/theme/MDXContent/index.tsx +1 -0
- 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/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 +130 -20
- 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,4 +7,4 @@
|
|
|
7
7
|
/// <reference types="@docusaurus/plugin-content-docs" />
|
|
8
8
|
/// <reference types="react" />
|
|
9
9
|
import type { Props } from '@theme/DocTagDocListPage';
|
|
10
|
-
export default function DocTagDocListPage(
|
|
10
|
+
export default function DocTagDocListPage(props: Props): JSX.Element;
|
|
@@ -14,8 +14,9 @@ import {
|
|
|
14
14
|
usePluralForm,
|
|
15
15
|
} from '@docusaurus/theme-common';
|
|
16
16
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
17
|
-
import Layout from '@theme/Layout';
|
|
18
17
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
18
|
+
import Unlisted from '@theme/Unlisted';
|
|
19
|
+
import Heading from '@theme/Heading';
|
|
19
20
|
// Very simple pluralization: probably good enough for now
|
|
20
21
|
function useNDocsTaggedPlural() {
|
|
21
22
|
const {selectMessage} = usePluralForm();
|
|
@@ -33,57 +34,70 @@ function useNDocsTaggedPlural() {
|
|
|
33
34
|
),
|
|
34
35
|
);
|
|
35
36
|
}
|
|
37
|
+
function usePageTitle(props) {
|
|
38
|
+
const nDocsTaggedPlural = useNDocsTaggedPlural();
|
|
39
|
+
return translate(
|
|
40
|
+
{
|
|
41
|
+
id: 'theme.docs.tagDocListPageTitle',
|
|
42
|
+
description: 'The title of the page for a docs tag',
|
|
43
|
+
message: '{nDocsTagged} with "{tagName}"',
|
|
44
|
+
},
|
|
45
|
+
{nDocsTagged: nDocsTaggedPlural(props.tag.count), tagName: props.tag.label},
|
|
46
|
+
);
|
|
47
|
+
}
|
|
36
48
|
function DocItem({doc}) {
|
|
37
49
|
return (
|
|
38
50
|
<article className="margin-vert--lg">
|
|
39
51
|
<Link to={doc.permalink}>
|
|
40
|
-
<h2>{doc.title}</
|
|
52
|
+
<Heading as="h2">{doc.title}</Heading>
|
|
41
53
|
</Link>
|
|
42
54
|
{doc.description && <p>{doc.description}</p>}
|
|
43
55
|
</article>
|
|
44
56
|
);
|
|
45
57
|
}
|
|
46
|
-
|
|
47
|
-
const nDocsTaggedPlural = useNDocsTaggedPlural();
|
|
48
|
-
const title = translate(
|
|
49
|
-
{
|
|
50
|
-
id: 'theme.docs.tagDocListPageTitle',
|
|
51
|
-
description: 'The title of the page for a docs tag',
|
|
52
|
-
message: '{nDocsTagged} with "{tagName}"',
|
|
53
|
-
},
|
|
54
|
-
{nDocsTagged: nDocsTaggedPlural(tag.count), tagName: tag.label},
|
|
55
|
-
);
|
|
58
|
+
function DocTagDocListPageMetadata({title}) {
|
|
56
59
|
return (
|
|
57
|
-
|
|
58
|
-
className={clsx(
|
|
59
|
-
ThemeClassNames.wrapper.docsPages,
|
|
60
|
-
ThemeClassNames.page.docsTagDocListPage,
|
|
61
|
-
)}>
|
|
60
|
+
<>
|
|
62
61
|
<PageMetadata title={title} />
|
|
63
62
|
<SearchMetadata tag="doc_tag_doc_list" />
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function DocTagDocListPageContent({tag, title}) {
|
|
67
|
+
return (
|
|
68
|
+
<HtmlClassNameProvider
|
|
69
|
+
className={clsx(ThemeClassNames.page.docsTagDocListPage)}>
|
|
70
|
+
<div className="container margin-vert--lg">
|
|
71
|
+
<div className="row">
|
|
72
|
+
<main className="col col--8 col--offset-2">
|
|
73
|
+
{tag.unlisted && <Unlisted />}
|
|
74
|
+
<header className="margin-bottom--xl">
|
|
75
|
+
<Heading as="h1">{title}</Heading>
|
|
76
|
+
<Link href={tag.allTagsPath}>
|
|
77
|
+
<Translate
|
|
78
|
+
id="theme.tags.tagsPageLink"
|
|
79
|
+
description="The label of the link targeting the tag list page">
|
|
80
|
+
View All Tags
|
|
81
|
+
</Translate>
|
|
82
|
+
</Link>
|
|
83
|
+
</header>
|
|
84
|
+
<section className="margin-vert--lg">
|
|
85
|
+
{tag.items.map((doc) => (
|
|
86
|
+
<DocItem key={doc.id} doc={doc} />
|
|
87
|
+
))}
|
|
88
|
+
</section>
|
|
89
|
+
</main>
|
|
85
90
|
</div>
|
|
86
|
-
</
|
|
91
|
+
</div>
|
|
87
92
|
</HtmlClassNameProvider>
|
|
88
93
|
);
|
|
89
94
|
}
|
|
95
|
+
export default function DocTagDocListPage(props) {
|
|
96
|
+
const title = usePageTitle(props);
|
|
97
|
+
return (
|
|
98
|
+
<>
|
|
99
|
+
<DocTagDocListPageMetadata {...props} title={title} />
|
|
100
|
+
<DocTagDocListPageContent {...props} title={title} />
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
/// <reference types="@docusaurus/plugin-content-docs" />
|
|
8
8
|
/// <reference types="react" />
|
|
9
9
|
import type { Props } from '@theme/DocTagsListPage';
|
|
10
|
-
export default function DocTagsListPage(
|
|
10
|
+
export default function DocTagsListPage(props: Props): JSX.Element;
|
|
@@ -12,29 +12,38 @@ import {
|
|
|
12
12
|
ThemeClassNames,
|
|
13
13
|
translateTagsPageTitle,
|
|
14
14
|
} from '@docusaurus/theme-common';
|
|
15
|
-
import Layout from '@theme/Layout';
|
|
16
15
|
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
17
16
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
import Heading from '@theme/Heading';
|
|
18
|
+
function DocTagsListPageMetadata({title}) {
|
|
20
19
|
return (
|
|
21
|
-
|
|
22
|
-
className={clsx(
|
|
23
|
-
ThemeClassNames.wrapper.docsPages,
|
|
24
|
-
ThemeClassNames.page.docsTagsListPage,
|
|
25
|
-
)}>
|
|
20
|
+
<>
|
|
26
21
|
<PageMetadata title={title} />
|
|
27
22
|
<SearchMetadata tag="doc_tags_list" />
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function DocTagsListPageContent({tags, title}) {
|
|
27
|
+
return (
|
|
28
|
+
<HtmlClassNameProvider
|
|
29
|
+
className={clsx(ThemeClassNames.page.docsTagsListPage)}>
|
|
30
|
+
<div className="container margin-vert--lg">
|
|
31
|
+
<div className="row">
|
|
32
|
+
<main className="col col--8 col--offset-2">
|
|
33
|
+
<Heading as="h1">{title}</Heading>
|
|
34
|
+
<TagsListByLetter tags={tags} />
|
|
35
|
+
</main>
|
|
36
36
|
</div>
|
|
37
|
-
</
|
|
37
|
+
</div>
|
|
38
38
|
</HtmlClassNameProvider>
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
|
+
export default function DocTagsListPage(props) {
|
|
42
|
+
const title = translateTagsPageTitle();
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<DocTagsListPageMetadata {...props} title={title} />
|
|
46
|
+
<DocTagsListPageContent {...props} title={title} />
|
|
47
|
+
</>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="@docusaurus/plugin-content-docs" />
|
|
8
|
+
/// <reference types="react" />
|
|
9
|
+
import type { Props } from '@theme/DocVersionRoot';
|
|
10
|
+
export default function DocVersionRoot(props: Props): JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 {HtmlClassNameProvider, PageMetadata} from '@docusaurus/theme-common';
|
|
9
|
+
import {
|
|
10
|
+
docVersionSearchTag,
|
|
11
|
+
DocsVersionProvider,
|
|
12
|
+
} from '@docusaurus/theme-common/internal';
|
|
13
|
+
import renderRoutes from '@docusaurus/renderRoutes';
|
|
14
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
15
|
+
function DocVersionRootMetadata(props) {
|
|
16
|
+
const {version} = props;
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<SearchMetadata
|
|
20
|
+
version={version.version}
|
|
21
|
+
tag={docVersionSearchTag(version.pluginId, version.version)}
|
|
22
|
+
/>
|
|
23
|
+
<PageMetadata>
|
|
24
|
+
{version.noIndex && <meta name="robots" content="noindex, nofollow" />}
|
|
25
|
+
</PageMetadata>
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function DocVersionRootContent(props) {
|
|
30
|
+
const {version, route} = props;
|
|
31
|
+
return (
|
|
32
|
+
<HtmlClassNameProvider className={version.className}>
|
|
33
|
+
<DocsVersionProvider version={version}>
|
|
34
|
+
{renderRoutes(route.routes)}
|
|
35
|
+
</DocsVersionProvider>
|
|
36
|
+
</HtmlClassNameProvider>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
export default function DocVersionRoot(props) {
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
<DocVersionRootMetadata {...props} />
|
|
43
|
+
<DocVersionRootContent {...props} />
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="@docusaurus/plugin-content-docs" />
|
|
8
|
+
/// <reference types="react" />
|
|
9
|
+
import type { Props } from '@theme/DocVersionRoot';
|
|
10
|
+
export default function DocsRoot(props: Props): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 clsx from 'clsx';
|
|
9
|
+
import {ThemeClassNames, HtmlClassNameProvider} from '@docusaurus/theme-common';
|
|
10
|
+
import renderRoutes from '@docusaurus/renderRoutes';
|
|
11
|
+
import Layout from '@theme/Layout';
|
|
12
|
+
export default function DocsRoot(props) {
|
|
13
|
+
return (
|
|
14
|
+
<HtmlClassNameProvider className={clsx(ThemeClassNames.wrapper.docsPages)}>
|
|
15
|
+
<Layout>{renderRoutes(props.route.routes)}</Layout>
|
|
16
|
+
</HtmlClassNameProvider>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -7,20 +7,17 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import Translate from '@docusaurus/Translate';
|
|
9
9
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
10
|
+
import Link from '@docusaurus/Link';
|
|
10
11
|
import IconEdit from '@theme/Icon/Edit';
|
|
11
12
|
export default function EditThisPage({editUrl}) {
|
|
12
13
|
return (
|
|
13
|
-
<
|
|
14
|
-
href={editUrl}
|
|
15
|
-
target="_blank"
|
|
16
|
-
rel="noreferrer noopener"
|
|
17
|
-
className={ThemeClassNames.common.editThisPage}>
|
|
14
|
+
<Link to={editUrl} className={ThemeClassNames.common.editThisPage}>
|
|
18
15
|
<IconEdit />
|
|
19
16
|
<Translate
|
|
20
17
|
id="theme.common.editThisPage"
|
|
21
18
|
description="The link label to edit the current page">
|
|
22
19
|
Edit this page
|
|
23
20
|
</Translate>
|
|
24
|
-
</
|
|
21
|
+
</Link>
|
|
25
22
|
);
|
|
26
23
|
}
|
|
@@ -10,18 +10,19 @@ import {
|
|
|
10
10
|
ErrorBoundaryError,
|
|
11
11
|
ErrorBoundaryTryAgainButton,
|
|
12
12
|
} from '@docusaurus/theme-common';
|
|
13
|
+
import Heading from '@theme/Heading';
|
|
13
14
|
export default function ErrorPageContent({error, tryAgain}) {
|
|
14
15
|
return (
|
|
15
16
|
<main className="container margin-vert--xl">
|
|
16
17
|
<div className="row">
|
|
17
18
|
<div className="col col--6 col--offset-3">
|
|
18
|
-
<h1 className="hero__title">
|
|
19
|
+
<Heading as="h1" className="hero__title">
|
|
19
20
|
<Translate
|
|
20
21
|
id="theme.ErrorPageContent.title"
|
|
21
22
|
description="The title of the fallback page when the page crashed">
|
|
22
23
|
This page crashed.
|
|
23
24
|
</Translate>
|
|
24
|
-
</
|
|
25
|
+
</Heading>
|
|
25
26
|
<div className="margin-vert--lg">
|
|
26
27
|
<ErrorBoundaryTryAgainButton
|
|
27
28
|
onClick={tryAgain}
|
|
@@ -4,45 +4,11 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React
|
|
7
|
+
import React from 'react';
|
|
8
8
|
import CodeBlock from '@theme/CodeBlock';
|
|
9
9
|
export default function MDXCode(props) {
|
|
10
|
-
const inlineElements = [
|
|
11
|
-
'a',
|
|
12
|
-
'abbr',
|
|
13
|
-
'b',
|
|
14
|
-
'br',
|
|
15
|
-
'button',
|
|
16
|
-
'cite',
|
|
17
|
-
'code',
|
|
18
|
-
'del',
|
|
19
|
-
'dfn',
|
|
20
|
-
'em',
|
|
21
|
-
'i',
|
|
22
|
-
'img',
|
|
23
|
-
'input',
|
|
24
|
-
'ins',
|
|
25
|
-
'kbd',
|
|
26
|
-
'label',
|
|
27
|
-
'object',
|
|
28
|
-
'output',
|
|
29
|
-
'q',
|
|
30
|
-
'ruby',
|
|
31
|
-
's',
|
|
32
|
-
'small',
|
|
33
|
-
'span',
|
|
34
|
-
'strong',
|
|
35
|
-
'sub',
|
|
36
|
-
'sup',
|
|
37
|
-
'time',
|
|
38
|
-
'u',
|
|
39
|
-
'var',
|
|
40
|
-
'wbr',
|
|
41
|
-
];
|
|
42
10
|
const shouldBeInline = React.Children.toArray(props.children).every(
|
|
43
|
-
(el) =>
|
|
44
|
-
(typeof el === 'string' && !el.includes('\n')) ||
|
|
45
|
-
(isValidElement(el) && inlineElements.includes(el.props?.mdxType)),
|
|
11
|
+
(el) => typeof el === 'string' && !el.includes('\n'),
|
|
46
12
|
);
|
|
47
13
|
return shouldBeInline ? <code {...props} /> : <CodeBlock {...props} />;
|
|
48
14
|
}
|
|
@@ -11,7 +11,7 @@ export default function MDXDetails(props) {
|
|
|
11
11
|
// Split summary item from the rest to pass it as a separate prop to the
|
|
12
12
|
// Details theme component
|
|
13
13
|
const summary = items.find(
|
|
14
|
-
(item) => React.isValidElement(item) && item.
|
|
14
|
+
(item) => React.isValidElement(item) && item.type === 'summary',
|
|
15
15
|
);
|
|
16
16
|
const children = <>{items.filter((item) => item !== summary)}</>;
|
|
17
17
|
return (
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import { type ReactNode } from 'react';
|
|
8
8
|
import type { Props } from '@theme/MDXComponents/Pre';
|
|
9
|
-
export default function MDXPre(props: Props):
|
|
9
|
+
export default function MDXPre(props: Props): ReactNode | undefined;
|
|
@@ -4,16 +4,9 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React
|
|
8
|
-
import CodeBlock from '@theme/CodeBlock';
|
|
7
|
+
import React from 'react';
|
|
9
8
|
export default function MDXPre(props) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{...(isValidElement(props.children) &&
|
|
14
|
-
props.children.props?.originalType === 'code'
|
|
15
|
-
? props.children.props
|
|
16
|
-
: {...props})}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
9
|
+
// With MDX 2, this element is only used for fenced code blocks
|
|
10
|
+
// It always receives a MDXComponents/Code as children
|
|
11
|
+
return <>{props.children}</>;
|
|
19
12
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import
|
|
8
|
+
import Head from '@docusaurus/Head';
|
|
9
9
|
import MDXCode from '@theme/MDXComponents/Code';
|
|
10
10
|
import MDXA from '@theme/MDXComponents/A';
|
|
11
11
|
import MDXPre from '@theme/MDXComponents/Pre';
|
|
@@ -16,11 +16,11 @@ import MDXImg from '@theme/MDXComponents/Img';
|
|
|
16
16
|
import Admonition from '@theme/Admonition';
|
|
17
17
|
import Mermaid from '@theme/Mermaid';
|
|
18
18
|
const MDXComponents = {
|
|
19
|
-
|
|
19
|
+
Head,
|
|
20
|
+
Details: MDXDetails,
|
|
20
21
|
code: MDXCode,
|
|
21
22
|
a: MDXA,
|
|
22
23
|
pre: MDXPre,
|
|
23
|
-
details: MDXDetails,
|
|
24
24
|
ul: MDXUl,
|
|
25
25
|
img: MDXImg,
|
|
26
26
|
h1: (props) => <MDXHeading as="h1" {...props} />,
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
+
// @ts-expect-error: TODO see https://github.com/microsoft/TypeScript/issues/49721
|
|
8
9
|
import {MDXProvider} from '@mdx-js/react';
|
|
9
10
|
import MDXComponents from '@theme/MDXComponents';
|
|
10
11
|
export default function MDXContent({children}) {
|
|
@@ -14,25 +14,37 @@ import {
|
|
|
14
14
|
import Layout from '@theme/Layout';
|
|
15
15
|
import MDXContent from '@theme/MDXContent';
|
|
16
16
|
import TOC from '@theme/TOC';
|
|
17
|
+
import Unlisted from '@theme/Unlisted';
|
|
17
18
|
import styles from './styles.module.css';
|
|
18
19
|
export default function MDXPage(props) {
|
|
19
20
|
const {content: MDXPageContent} = props;
|
|
20
21
|
const {
|
|
21
|
-
metadata: {title, description, frontMatter},
|
|
22
|
+
metadata: {title, description, frontMatter, unlisted},
|
|
23
|
+
assets,
|
|
22
24
|
} = MDXPageContent;
|
|
23
|
-
const {
|
|
24
|
-
|
|
25
|
+
const {
|
|
26
|
+
keywords,
|
|
27
|
+
wrapperClassName,
|
|
28
|
+
hide_table_of_contents: hideTableOfContents,
|
|
29
|
+
} = frontMatter;
|
|
30
|
+
const image = assets.image ?? frontMatter.image;
|
|
25
31
|
return (
|
|
26
32
|
<HtmlClassNameProvider
|
|
27
33
|
className={clsx(
|
|
28
34
|
wrapperClassName ?? ThemeClassNames.wrapper.mdxPages,
|
|
29
35
|
ThemeClassNames.page.mdxPage,
|
|
30
36
|
)}>
|
|
31
|
-
<PageMetadata title={title} description={description} />
|
|
32
37
|
<Layout>
|
|
38
|
+
<PageMetadata
|
|
39
|
+
title={title}
|
|
40
|
+
description={description}
|
|
41
|
+
keywords={keywords}
|
|
42
|
+
image={image}
|
|
43
|
+
/>
|
|
33
44
|
<main className="container container--fluid margin-vert--lg">
|
|
34
45
|
<div className={clsx('row', styles.mdxPageWrapper)}>
|
|
35
46
|
<div className={clsx('col', !hideTableOfContents && 'col--8')}>
|
|
47
|
+
{unlisted && <Unlisted />}
|
|
36
48
|
<article>
|
|
37
49
|
<MDXContent>
|
|
38
50
|
<MDXPageContent />
|
|
@@ -16,8 +16,9 @@ export default function DocNavbarItem({
|
|
|
16
16
|
}) {
|
|
17
17
|
const {activeDoc} = useActiveDocContext(docsPluginId);
|
|
18
18
|
const doc = useLayoutDoc(docId, docsPluginId);
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const pageActive = activeDoc?.path === doc?.path;
|
|
20
|
+
// Draft and unlisted items are not displayed in the navbar.
|
|
21
|
+
if (doc === null || (doc.unlisted && !pageActive)) {
|
|
21
22
|
return null;
|
|
22
23
|
}
|
|
23
24
|
return (
|
|
@@ -25,7 +26,7 @@ export default function DocNavbarItem({
|
|
|
25
26
|
exact
|
|
26
27
|
{...props}
|
|
27
28
|
isActive={() =>
|
|
28
|
-
|
|
29
|
+
pageActive ||
|
|
29
30
|
(!!activeDoc?.sidebar && activeDoc.sidebar === doc.sidebar)
|
|
30
31
|
}
|
|
31
32
|
label={staticLabel ?? doc.id}
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
8
|
import type { Props } from '@theme/NavbarItem/LocaleDropdownNavbarItem';
|
|
9
|
-
export default function LocaleDropdownNavbarItem({ mobile, dropdownItemsBefore, dropdownItemsAfter, ...props }: Props): JSX.Element;
|
|
9
|
+
export default function LocaleDropdownNavbarItem({ mobile, dropdownItemsBefore, dropdownItemsAfter, queryString, ...props }: Props): JSX.Element;
|
|
@@ -16,6 +16,7 @@ export default function LocaleDropdownNavbarItem({
|
|
|
16
16
|
mobile,
|
|
17
17
|
dropdownItemsBefore,
|
|
18
18
|
dropdownItemsAfter,
|
|
19
|
+
queryString = '',
|
|
19
20
|
...props
|
|
20
21
|
}) {
|
|
21
22
|
const {
|
|
@@ -29,7 +30,7 @@ export default function LocaleDropdownNavbarItem({
|
|
|
29
30
|
fullyQualified: false,
|
|
30
31
|
})}`;
|
|
31
32
|
// preserve ?search#hash suffix on locale switches
|
|
32
|
-
const to = `${baseTo}${search}${hash}`;
|
|
33
|
+
const to = `${baseTo}${search}${hash}${queryString}`;
|
|
33
34
|
return {
|
|
34
35
|
label: localeConfigs[locale].label,
|
|
35
36
|
lang: localeConfigs[locale].htmlLang,
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
8
|
+
import type { Props } from '@theme/NotFound/Content';
|
|
9
|
+
export default function NotFoundContent({ className }: Props): JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
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 clsx from 'clsx';
|
|
9
|
+
import Translate from '@docusaurus/Translate';
|
|
10
|
+
import Heading from '@theme/Heading';
|
|
11
|
+
export default function NotFoundContent({className}) {
|
|
12
|
+
return (
|
|
13
|
+
<main className={clsx('container margin-vert--xl', className)}>
|
|
14
|
+
<div className="row">
|
|
15
|
+
<div className="col col--6 col--offset-3">
|
|
16
|
+
<Heading as="h1" className="hero__title">
|
|
17
|
+
<Translate
|
|
18
|
+
id="theme.NotFound.title"
|
|
19
|
+
description="The title of the 404 page">
|
|
20
|
+
Page Not Found
|
|
21
|
+
</Translate>
|
|
22
|
+
</Heading>
|
|
23
|
+
<p>
|
|
24
|
+
<Translate
|
|
25
|
+
id="theme.NotFound.p1"
|
|
26
|
+
description="The first paragraph of the 404 page">
|
|
27
|
+
We could not find what you were looking for.
|
|
28
|
+
</Translate>
|
|
29
|
+
</p>
|
|
30
|
+
<p>
|
|
31
|
+
<Translate
|
|
32
|
+
id="theme.NotFound.p2"
|
|
33
|
+
description="The 2nd paragraph of the 404 page">
|
|
34
|
+
Please contact the owner of the site that linked you to the
|
|
35
|
+
original URL and let them know their link is broken.
|
|
36
|
+
</Translate>
|
|
37
|
+
</p>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</main>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 {translate} from '@docusaurus/Translate';
|
|
9
|
+
import {PageMetadata} from '@docusaurus/theme-common';
|
|
10
|
+
import Layout from '@theme/Layout';
|
|
11
|
+
import NotFoundContent from '@theme/NotFound/Content';
|
|
12
|
+
export default function Index() {
|
|
13
|
+
const title = translate({
|
|
14
|
+
id: 'theme.NotFound.title',
|
|
15
|
+
message: 'Page Not Found',
|
|
16
|
+
});
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<PageMetadata title={title} />
|
|
20
|
+
<Layout>
|
|
21
|
+
<NotFoundContent />
|
|
22
|
+
</Layout>
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
+
import Link from '@docusaurus/Link';
|
|
8
9
|
// Recursive component rendering the toc tree
|
|
9
10
|
function TOCItemTree({toc, className, linkClassName, isChild}) {
|
|
10
11
|
if (!toc.length) {
|
|
@@ -14,12 +15,10 @@ function TOCItemTree({toc, className, linkClassName, isChild}) {
|
|
|
14
15
|
<ul className={isChild ? undefined : className}>
|
|
15
16
|
{toc.map((heading) => (
|
|
16
17
|
<li key={heading.id}>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
href={`#${heading.id}`}
|
|
18
|
+
<Link
|
|
19
|
+
to={`#${heading.id}`}
|
|
20
20
|
className={linkClassName ?? undefined}
|
|
21
21
|
// Developer provided the HTML, so assume it's safe.
|
|
22
|
-
// eslint-disable-next-line react/no-danger
|
|
23
22
|
dangerouslySetInnerHTML={{__html: heading.value}}
|
|
24
23
|
/>
|
|
25
24
|
<TOCItemTree
|