@docusaurus/theme-classic 2.0.0-beta.15 → 2.0.0-beta.16
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 +102 -0
- package/lib/index.js +14 -11
- package/lib/theme-classic.d.ts +123 -97
- package/lib/translations.js +29 -32
- package/lib/validateThemeConfig.js +7 -4
- package/lib-next/theme/AnnouncementBar/index.js +1 -4
- package/lib-next/theme/BackToTopButton/index.js +6 -6
- package/lib-next/theme/BackToTopButton/styles.module.css +3 -1
- package/lib-next/theme/BlogLayout/index.js +1 -4
- package/lib-next/theme/BlogListPage/index.js +1 -4
- package/lib-next/theme/BlogListPaginator/index.js +1 -4
- package/lib-next/theme/BlogPostAuthor/index.js +18 -24
- package/lib-next/theme/BlogPostItem/index.js +12 -4
- package/lib-next/theme/BlogPostPage/index.js +4 -6
- package/lib-next/theme/BlogPostPaginator/index.js +1 -4
- package/lib-next/theme/BlogTagsListPage/index.js +1 -4
- package/lib-next/theme/BlogTagsPostsPage/index.js +4 -2
- package/lib-next/theme/CodeBlock/index.js +2 -1
- package/lib-next/theme/Details/index.js +2 -1
- package/lib-next/theme/DocBreadcrumbs/index.js +76 -0
- package/lib-next/theme/DocBreadcrumbs/styles.module.css +26 -0
- package/lib-next/theme/DocCard/index.js +12 -1
- package/lib-next/theme/DocCard/styles.module.css +1 -1
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +2 -0
- package/lib-next/theme/DocItem/index.js +8 -5
- package/lib-next/theme/DocPage/index.js +2 -4
- package/lib-next/theme/DocPage/styles.module.css +3 -3
- package/lib-next/theme/DocPaginator/index.js +1 -4
- package/lib-next/theme/DocSidebar/styles.module.css +4 -4
- package/lib-next/theme/DocSidebarItem/index.js +39 -14
- package/lib-next/theme/DocSidebarItem/styles.module.css +3 -10
- package/lib-next/theme/DocTagsListPage/index.js +1 -4
- package/lib-next/theme/DocVersionBadge/index.js +8 -1
- package/lib-next/theme/Footer/index.js +8 -4
- package/lib-next/theme/Heading/index.js +0 -1
- package/lib-next/theme/Heading/styles.module.css +16 -0
- package/lib-next/theme/IconArrow/index.js +1 -4
- package/lib-next/theme/IconEdit/index.js +1 -4
- package/lib-next/theme/IconExternalLink/index.js +1 -4
- package/lib-next/theme/IconLanguage/index.js +1 -4
- package/lib-next/theme/IconMenu/index.js +6 -4
- package/lib-next/theme/Layout/index.js +1 -4
- package/lib-next/theme/LayoutHead/index.js +4 -0
- package/lib-next/theme/Logo/index.js +1 -4
- package/lib-next/theme/MDXComponents/index.js +4 -3
- package/lib-next/theme/MDXPage/index.js +1 -4
- package/lib-next/theme/Navbar/index.js +1 -3
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +1 -3
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +2 -2
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +1 -3
- package/lib-next/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +8 -1
- package/lib-next/theme/NavbarItem/index.js +2 -2
- package/lib-next/theme/NotFound.js +1 -4
- package/lib-next/theme/PaginatorNavLink/index.js +1 -4
- package/lib-next/theme/SearchBar.js +1 -1
- package/lib-next/theme/SearchMetadata/index.js +11 -6
- package/lib-next/theme/SkipToContent/index.js +1 -3
- package/lib-next/theme/TOC/index.js +2 -5
- package/lib-next/theme/TOCInline/index.js +1 -4
- package/lib-next/theme/TOCItems/index.js +3 -3
- package/lib-next/theme/TabItem/index.js +1 -4
- package/lib-next/theme/Tabs/__tests__/index.test.js +3 -1
- package/lib-next/theme/Tabs/index.js +1 -1
- package/lib-next/theme/Tag/index.js +1 -4
- package/lib-next/theme/TagsListByLetter/index.js +1 -3
- package/lib-next/theme/ThemedImage/index.js +1 -4
- package/lib-next/theme/ThemedImage/styles.module.css +2 -2
- package/lib-next/theme/Toggle/index.js +25 -2
- package/lib-next/theme/prism-include-languages.js +17 -23
- package/package.json +21 -22
- package/src/getSwizzleConfig.ts +101 -0
- package/src/index.ts +7 -21
- package/src/theme/AnnouncementBar/index.tsx +1 -3
- package/src/theme/BackToTopButton/index.tsx +8 -7
- package/src/theme/BackToTopButton/styles.module.css +3 -1
- package/src/theme/BlogLayout/index.tsx +1 -3
- package/src/theme/BlogListPage/index.tsx +1 -3
- package/src/theme/BlogListPaginator/index.tsx +1 -3
- package/src/theme/BlogPostAuthor/index.tsx +18 -23
- package/src/theme/BlogPostItem/index.tsx +10 -4
- package/src/theme/BlogPostPage/index.tsx +4 -5
- package/src/theme/BlogPostPaginator/index.tsx +1 -3
- package/src/theme/BlogTagsListPage/index.tsx +1 -3
- package/src/theme/BlogTagsPostsPage/index.tsx +3 -1
- package/src/theme/CodeBlock/index.tsx +2 -1
- package/src/theme/Details/index.tsx +2 -1
- package/src/theme/DocBreadcrumbs/index.tsx +91 -0
- package/src/theme/DocBreadcrumbs/styles.module.css +26 -0
- package/src/theme/DocCard/index.tsx +10 -1
- package/src/theme/DocCard/styles.module.css +1 -1
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +2 -0
- package/src/theme/DocItem/index.tsx +7 -4
- package/src/theme/DocPage/index.tsx +2 -4
- package/src/theme/DocPage/styles.module.css +3 -3
- package/src/theme/DocPaginator/index.tsx +1 -3
- package/src/theme/DocSidebar/styles.module.css +4 -4
- package/src/theme/DocSidebarItem/index.tsx +43 -13
- package/src/theme/DocSidebarItem/styles.module.css +3 -10
- package/src/theme/DocTagsListPage/index.tsx +1 -3
- package/src/theme/DocVersionBadge/index.tsx +6 -1
- package/src/theme/Footer/index.tsx +8 -4
- package/src/theme/Heading/index.tsx +0 -1
- package/src/theme/Heading/styles.module.css +16 -0
- package/src/theme/IconArrow/index.tsx +1 -3
- package/src/theme/IconEdit/index.tsx +4 -3
- package/src/theme/IconExternalLink/index.tsx +4 -3
- package/src/theme/IconLanguage/index.tsx +5 -3
- package/src/theme/IconMenu/index.tsx +1 -3
- package/src/theme/Layout/index.tsx +1 -3
- package/src/theme/LayoutHead/index.tsx +4 -0
- package/src/theme/Logo/index.tsx +1 -3
- package/src/theme/MDXComponents/index.tsx +4 -3
- package/src/theme/MDXPage/index.tsx +1 -3
- package/src/theme/Navbar/index.tsx +1 -3
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +1 -3
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +2 -2
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +4 -3
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +8 -1
- package/src/theme/NavbarItem/index.tsx +2 -2
- package/src/theme/NotFound.tsx +1 -3
- package/src/theme/PaginatorNavLink/index.tsx +1 -3
- package/src/theme/SearchBar.tsx +2 -1
- package/src/theme/SearchMetadata/index.tsx +12 -6
- package/src/theme/SkipToContent/index.tsx +1 -3
- package/src/theme/TOC/index.tsx +3 -5
- package/src/theme/TOCCollapsible/index.tsx +2 -2
- package/src/theme/TOCInline/index.tsx +3 -5
- package/src/theme/TOCItems/index.tsx +11 -7
- package/src/theme/TabItem/index.tsx +5 -3
- package/src/theme/Tabs/index.tsx +1 -1
- package/src/theme/Tag/index.tsx +1 -3
- package/src/theme/TagsListByLetter/index.tsx +1 -3
- package/src/theme/ThemedImage/index.tsx +1 -3
- package/src/theme/ThemedImage/styles.module.css +2 -2
- package/src/theme/Toggle/index.tsx +26 -2
- package/src/theme/prism-include-languages.ts +20 -23
- package/src/theme-classic.d.ts +123 -97
- package/src/translations.ts +41 -39
- package/src/validateThemeConfig.ts +10 -8
- package/lib-next/theme/DocSidebarItems/styles.module.css +0 -20
- package/lib-next/theme/Heading/styles.css +0 -22
- package/src/theme/DocSidebarItems/styles.module.css +0 -20
- package/src/theme/Heading/styles.css +0 -22
|
@@ -10,7 +10,7 @@ import Translate, {translate} from '@docusaurus/Translate';
|
|
|
10
10
|
import PaginatorNavLink from '@theme/PaginatorNavLink';
|
|
11
11
|
import type {Props} from '@theme/BlogListPaginator';
|
|
12
12
|
|
|
13
|
-
function BlogListPaginator(props: Props): JSX.Element {
|
|
13
|
+
export default function BlogListPaginator(props: Props): JSX.Element {
|
|
14
14
|
const {metadata} = props;
|
|
15
15
|
const {previousPage, nextPage} = metadata;
|
|
16
16
|
|
|
@@ -53,5 +53,3 @@ function BlogListPaginator(props: Props): JSX.Element {
|
|
|
53
53
|
</nav>
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
export default BlogListPaginator;
|
|
@@ -11,7 +11,7 @@ import type {Props} from '@theme/BlogPostAuthor';
|
|
|
11
11
|
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
13
|
|
|
14
|
-
function BlogPostAuthor({author}: Props): JSX.Element {
|
|
14
|
+
export default function BlogPostAuthor({author}: Props): JSX.Element {
|
|
15
15
|
const {name, title, url, imageURL} = author;
|
|
16
16
|
return (
|
|
17
17
|
<div className="avatar margin-bottom--sm">
|
|
@@ -21,29 +21,24 @@ function BlogPostAuthor({author}: Props): JSX.Element {
|
|
|
21
21
|
</Link>
|
|
22
22
|
)}
|
|
23
23
|
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<span itemProp="name">{name}</span>
|
|
35
|
-
</Link>
|
|
36
|
-
</div>
|
|
37
|
-
{title && (
|
|
38
|
-
<small className="avatar__subtitle" itemProp="description">
|
|
39
|
-
{title}
|
|
40
|
-
</small>
|
|
41
|
-
)}
|
|
24
|
+
{name && (
|
|
25
|
+
<div
|
|
26
|
+
className="avatar__intro"
|
|
27
|
+
itemProp="author"
|
|
28
|
+
itemScope
|
|
29
|
+
itemType="https://schema.org/Person">
|
|
30
|
+
<div className="avatar__name">
|
|
31
|
+
<Link href={url} itemProp="url">
|
|
32
|
+
<span itemProp="name">{name}</span>
|
|
33
|
+
</Link>
|
|
42
34
|
</div>
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
{title && (
|
|
36
|
+
<small className="avatar__subtitle" itemProp="description">
|
|
37
|
+
{title}
|
|
38
|
+
</small>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
45
42
|
</div>
|
|
46
43
|
);
|
|
47
44
|
}
|
|
48
|
-
|
|
49
|
-
export default BlogPostAuthor;
|
|
@@ -41,7 +41,7 @@ function useReadingTimePlural() {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function BlogPostItem(props: Props): JSX.Element {
|
|
44
|
+
export default function BlogPostItem(props: Props): JSX.Element {
|
|
45
45
|
const readingTimePlural = useReadingTimePlural();
|
|
46
46
|
const {withBaseUrl} = useBaseUrlUtils();
|
|
47
47
|
const {
|
|
@@ -135,7 +135,15 @@ function BlogPostItem(props: Props): JSX.Element {
|
|
|
135
135
|
})}>
|
|
136
136
|
<Link
|
|
137
137
|
to={metadata.permalink}
|
|
138
|
-
aria-label={
|
|
138
|
+
aria-label={translate(
|
|
139
|
+
{
|
|
140
|
+
message: 'Read more about {title}',
|
|
141
|
+
id: 'theme.blog.post.readMoreLabel',
|
|
142
|
+
description:
|
|
143
|
+
'The ARIA label for the link to full blog posts from excerpts',
|
|
144
|
+
},
|
|
145
|
+
{title},
|
|
146
|
+
)}>
|
|
139
147
|
<b>
|
|
140
148
|
<Translate
|
|
141
149
|
id="theme.blog.post.readMore"
|
|
@@ -151,5 +159,3 @@ function BlogPostItem(props: Props): JSX.Element {
|
|
|
151
159
|
</article>
|
|
152
160
|
);
|
|
153
161
|
}
|
|
154
|
-
|
|
155
|
-
export default BlogPostItem;
|
|
@@ -14,7 +14,7 @@ import type {Props} from '@theme/BlogPostPage';
|
|
|
14
14
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
15
15
|
import TOC from '@theme/TOC';
|
|
16
16
|
|
|
17
|
-
function BlogPostPage(props: Props): JSX.Element {
|
|
17
|
+
export default function BlogPostPage(props: Props): JSX.Element {
|
|
18
18
|
const {content: BlogPostContents, sidebar} = props;
|
|
19
19
|
const {assets, metadata} = BlogPostContents;
|
|
20
20
|
const {
|
|
@@ -53,8 +53,9 @@ function BlogPostPage(props: Props): JSX.Element {
|
|
|
53
53
|
) : undefined
|
|
54
54
|
}>
|
|
55
55
|
<Seo
|
|
56
|
-
// TODO refactor needed: it's a bit annoying but Seo MUST be inside
|
|
57
|
-
// otherwise
|
|
56
|
+
// TODO refactor needed: it's a bit annoying but Seo MUST be inside
|
|
57
|
+
// BlogLayout, otherwise default image (set by BlogLayout) would shadow
|
|
58
|
+
// the custom blog post image
|
|
58
59
|
title={title}
|
|
59
60
|
description={description}
|
|
60
61
|
keywords={keywords}
|
|
@@ -94,5 +95,3 @@ function BlogPostPage(props: Props): JSX.Element {
|
|
|
94
95
|
</BlogLayout>
|
|
95
96
|
);
|
|
96
97
|
}
|
|
97
|
-
|
|
98
|
-
export default BlogPostPage;
|
|
@@ -10,7 +10,7 @@ import Translate, {translate} from '@docusaurus/Translate';
|
|
|
10
10
|
import PaginatorNavLink from '@theme/PaginatorNavLink';
|
|
11
11
|
import type {Props} from '@theme/BlogPostPaginator';
|
|
12
12
|
|
|
13
|
-
function BlogPostPaginator(props: Props): JSX.Element {
|
|
13
|
+
export default function BlogPostPaginator(props: Props): JSX.Element {
|
|
14
14
|
const {nextItem, prevItem} = props;
|
|
15
15
|
|
|
16
16
|
return (
|
|
@@ -52,5 +52,3 @@ function BlogPostPaginator(props: Props): JSX.Element {
|
|
|
52
52
|
</nav>
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
export default BlogPostPaginator;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
translateTagsPageTitle,
|
|
16
16
|
} from '@docusaurus/theme-common';
|
|
17
17
|
|
|
18
|
-
function BlogTagsListPage(props: Props): JSX.Element {
|
|
18
|
+
export default function BlogTagsListPage(props: Props): JSX.Element {
|
|
19
19
|
const {tags, sidebar} = props;
|
|
20
20
|
const title = translateTagsPageTitle();
|
|
21
21
|
return (
|
|
@@ -33,5 +33,3 @@ function BlogTagsListPage(props: Props): JSX.Element {
|
|
|
33
33
|
</BlogLayout>
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
export default BlogTagsListPage;
|
|
@@ -13,6 +13,7 @@ import BlogPostItem from '@theme/BlogPostItem';
|
|
|
13
13
|
import type {Props} from '@theme/BlogTagsPostsPage';
|
|
14
14
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
15
15
|
import {ThemeClassNames, usePluralForm} from '@docusaurus/theme-common';
|
|
16
|
+
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
16
17
|
|
|
17
18
|
// Very simple pluralization: probably good enough for now
|
|
18
19
|
function useBlogPostsPlural() {
|
|
@@ -33,7 +34,7 @@ function useBlogPostsPlural() {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export default function BlogTagsPostsPage(props: Props): JSX.Element {
|
|
36
|
-
const {metadata, items, sidebar} = props;
|
|
37
|
+
const {metadata, items, sidebar, listMetadata} = props;
|
|
37
38
|
const {allTagsPath, name: tagName, count} = metadata;
|
|
38
39
|
const blogPostsPlural = useBlogPostsPlural();
|
|
39
40
|
const title = translate(
|
|
@@ -77,6 +78,7 @@ export default function BlogTagsPostsPage(props: Props): JSX.Element {
|
|
|
77
78
|
<BlogPostContent />
|
|
78
79
|
</BlogPostItem>
|
|
79
80
|
))}
|
|
81
|
+
<BlogListPaginator metadata={listMetadata} />
|
|
80
82
|
</BlogLayout>
|
|
81
83
|
);
|
|
82
84
|
}
|
|
@@ -51,7 +51,8 @@ export default function CodeBlock({
|
|
|
51
51
|
const prismTheme = usePrismTheme();
|
|
52
52
|
|
|
53
53
|
// <pre> tags in markdown map to CodeBlocks and they may contain JSX children.
|
|
54
|
-
// When the children is not a simple string, we just return a styled block
|
|
54
|
+
// When the children is not a simple string, we just return a styled block
|
|
55
|
+
// without actually highlighting.
|
|
55
56
|
if (React.Children.toArray(children).some((el) => isValidElement(el))) {
|
|
56
57
|
return (
|
|
57
58
|
<Highlight
|
|
@@ -11,7 +11,8 @@ import {Details as DetailsGeneric} from '@docusaurus/theme-common';
|
|
|
11
11
|
import type {Props} from '@theme/Details';
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
13
|
|
|
14
|
-
// Should we have a custom details/summary comp in Infima instead of reusing
|
|
14
|
+
// Should we have a custom details/summary comp in Infima instead of reusing
|
|
15
|
+
// alert classes?
|
|
15
16
|
const InfimaClasses = 'alert alert--info';
|
|
16
17
|
|
|
17
18
|
export default function Details({...props}: Props): JSX.Element {
|
|
@@ -0,0 +1,91 @@
|
|
|
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, {type ReactNode} from 'react';
|
|
9
|
+
import {
|
|
10
|
+
ThemeClassNames,
|
|
11
|
+
useSidebarBreadcrumbs,
|
|
12
|
+
useHomePageRoute,
|
|
13
|
+
} from '@docusaurus/theme-common';
|
|
14
|
+
import styles from './styles.module.css';
|
|
15
|
+
import clsx from 'clsx';
|
|
16
|
+
import Link from '@docusaurus/Link';
|
|
17
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
18
|
+
|
|
19
|
+
// TODO move to design system folder
|
|
20
|
+
function BreadcrumbsItemLink({
|
|
21
|
+
children,
|
|
22
|
+
href,
|
|
23
|
+
}: {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
href?: string;
|
|
26
|
+
}): JSX.Element {
|
|
27
|
+
const className = clsx('breadcrumbs__link', styles.breadcrumbsItemLink);
|
|
28
|
+
return href ? (
|
|
29
|
+
<Link className={className} href={href}>
|
|
30
|
+
{children}
|
|
31
|
+
</Link>
|
|
32
|
+
) : (
|
|
33
|
+
<span className={className}>{children}</span>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// TODO move to design system folder
|
|
38
|
+
function BreadcrumbsItem({
|
|
39
|
+
children,
|
|
40
|
+
active,
|
|
41
|
+
}: {
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
active?: boolean;
|
|
44
|
+
}): JSX.Element {
|
|
45
|
+
return (
|
|
46
|
+
<li
|
|
47
|
+
className={clsx('breadcrumbs__item', {
|
|
48
|
+
'breadcrumbs__item--active': active,
|
|
49
|
+
})}>
|
|
50
|
+
{children}
|
|
51
|
+
</li>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function HomeBreadcrumbItem() {
|
|
56
|
+
const homeHref = useBaseUrl('/');
|
|
57
|
+
return (
|
|
58
|
+
<BreadcrumbsItem>
|
|
59
|
+
<BreadcrumbsItemLink href={homeHref}>🏠</BreadcrumbsItemLink>
|
|
60
|
+
</BreadcrumbsItem>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default function DocBreadcrumbs(): JSX.Element | null {
|
|
65
|
+
const breadcrumbs = useSidebarBreadcrumbs();
|
|
66
|
+
const homePageRoute = useHomePageRoute();
|
|
67
|
+
|
|
68
|
+
if (!breadcrumbs) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<nav
|
|
74
|
+
className={clsx(
|
|
75
|
+
ThemeClassNames.docs.docBreadcrumbs,
|
|
76
|
+
styles.breadcrumbsContainer,
|
|
77
|
+
)}
|
|
78
|
+
aria-label="breadcrumbs">
|
|
79
|
+
<ul className="breadcrumbs">
|
|
80
|
+
{homePageRoute && <HomeBreadcrumbItem />}
|
|
81
|
+
{breadcrumbs.map((item, idx) => (
|
|
82
|
+
<BreadcrumbsItem key={idx} active={idx === breadcrumbs.length - 1}>
|
|
83
|
+
<BreadcrumbsItemLink href={item.href}>
|
|
84
|
+
{item.label}
|
|
85
|
+
</BreadcrumbsItemLink>
|
|
86
|
+
</BreadcrumbsItem>
|
|
87
|
+
))}
|
|
88
|
+
</ul>
|
|
89
|
+
</nav>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
@@ -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
|
+
|
|
8
|
+
.breadcrumbsContainer {
|
|
9
|
+
margin-bottom: 0.4rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.breadcrumbsItemLink {
|
|
13
|
+
--ifm-breadcrumb-size-multiplier: 0.7 !important;
|
|
14
|
+
margin-bottom: 0.4rem;
|
|
15
|
+
background: var(--ifm-color-gray-100);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
html[data-theme='dark'] .breadcrumbsItemLink {
|
|
19
|
+
background-color: var(--ifm-color-gray-900);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media (min-width: 997px) {
|
|
23
|
+
.breadcrumbsItemLink {
|
|
24
|
+
--ifm-breadcrumb-size-multiplier: 0.8;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -16,6 +16,7 @@ import {findFirstCategoryLink, useDocById} from '@docusaurus/theme-common';
|
|
|
16
16
|
import clsx from 'clsx';
|
|
17
17
|
import styles from './styles.module.css';
|
|
18
18
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
19
|
+
import {translate} from '@docusaurus/Translate';
|
|
19
20
|
|
|
20
21
|
function CardContainer({
|
|
21
22
|
href,
|
|
@@ -70,7 +71,15 @@ function CardCategory({item}: {item: PropSidebarItemCategory}): JSX.Element {
|
|
|
70
71
|
href={href}
|
|
71
72
|
icon="🗃️"
|
|
72
73
|
title={item.label}
|
|
73
|
-
description={
|
|
74
|
+
description={translate(
|
|
75
|
+
{
|
|
76
|
+
message: '{count} items',
|
|
77
|
+
id: 'theme.docs.DocCard.categoryDescription',
|
|
78
|
+
description:
|
|
79
|
+
'The default description for a category card in the generated index about how many items this category includes',
|
|
80
|
+
},
|
|
81
|
+
{count: item.items.length},
|
|
82
|
+
)}
|
|
74
83
|
/>
|
|
75
84
|
);
|
|
76
85
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
box-shadow: 0 4px 8px 0 rgb(0 0 0 / 20%);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
[data-theme='dark'] .cardContainer.cardContainerLink:hover {
|
|
28
28
|
--ifm-card-background-color: #2d2d2d; /* original, non-hovered color is #242526 */
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -13,6 +13,7 @@ import DocPaginator from '@theme/DocPaginator';
|
|
|
13
13
|
import Seo from '@theme/Seo';
|
|
14
14
|
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
15
15
|
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
16
|
+
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
16
17
|
import Heading from '@theme/Heading';
|
|
17
18
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
18
19
|
|
|
@@ -33,6 +34,7 @@ export default function DocCategoryGeneratedIndexPage({
|
|
|
33
34
|
/>
|
|
34
35
|
<div className={styles.generatedIndexPage}>
|
|
35
36
|
<DocVersionBanner />
|
|
37
|
+
<DocBreadcrumbs />
|
|
36
38
|
<DocVersionBadge />
|
|
37
39
|
<header>
|
|
38
40
|
<Heading as="h1" className={styles.title}>
|
|
@@ -18,12 +18,12 @@ import TOCCollapsible from '@theme/TOCCollapsible';
|
|
|
18
18
|
import Heading from '@theme/Heading';
|
|
19
19
|
import styles from './styles.module.css';
|
|
20
20
|
import {ThemeClassNames, useWindowSize} from '@docusaurus/theme-common';
|
|
21
|
+
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
21
22
|
|
|
22
23
|
export default function DocItem(props: Props): JSX.Element {
|
|
23
24
|
const {content: DocContent} = props;
|
|
24
|
-
const {metadata, frontMatter} = DocContent;
|
|
25
|
+
const {metadata, frontMatter, assets} = DocContent;
|
|
25
26
|
const {
|
|
26
|
-
image,
|
|
27
27
|
keywords,
|
|
28
28
|
hide_title: hideTitle,
|
|
29
29
|
hide_table_of_contents: hideTableOfContents,
|
|
@@ -31,6 +31,7 @@ export default function DocItem(props: Props): JSX.Element {
|
|
|
31
31
|
toc_max_heading_level: tocMaxHeadingLevel,
|
|
32
32
|
} = frontMatter;
|
|
33
33
|
const {description, title} = metadata;
|
|
34
|
+
const image = assets.image ?? frontMatter.image;
|
|
34
35
|
|
|
35
36
|
// We only add a title if:
|
|
36
37
|
// - user asks to hide it with front matter
|
|
@@ -58,6 +59,7 @@ export default function DocItem(props: Props): JSX.Element {
|
|
|
58
59
|
<DocVersionBanner />
|
|
59
60
|
<div className={styles.docItemContainer}>
|
|
60
61
|
<article>
|
|
62
|
+
<DocBreadcrumbs />
|
|
61
63
|
<DocVersionBadge />
|
|
62
64
|
|
|
63
65
|
{canRenderTOC && (
|
|
@@ -75,8 +77,9 @@ export default function DocItem(props: Props): JSX.Element {
|
|
|
75
77
|
<div
|
|
76
78
|
className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
|
|
77
79
|
{/*
|
|
78
|
-
Title can be declared inside md content or declared through
|
|
79
|
-
To make both cases consistent,
|
|
80
|
+
Title can be declared inside md content or declared through
|
|
81
|
+
front matter and added manually. To make both cases consistent,
|
|
82
|
+
the added title is added under the same div.markdown block
|
|
80
83
|
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
81
84
|
*/}
|
|
82
85
|
{shouldAddTitle && (
|
|
@@ -145,7 +145,7 @@ function DocPageContent({
|
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
function DocPage(props: Props): JSX.Element {
|
|
148
|
+
export default function DocPage(props: Props): JSX.Element {
|
|
149
149
|
const {
|
|
150
150
|
route: {routes: docRoutes},
|
|
151
151
|
versionMetadata,
|
|
@@ -168,7 +168,7 @@ function DocPage(props: Props): JSX.Element {
|
|
|
168
168
|
return (
|
|
169
169
|
<>
|
|
170
170
|
<Head>
|
|
171
|
-
{/* TODO we should add a core addRoute({htmlClassName})
|
|
171
|
+
{/* TODO we should add a core addRoute({htmlClassName}) action */}
|
|
172
172
|
<html className={versionMetadata.className} />
|
|
173
173
|
</Head>
|
|
174
174
|
<DocsVersionProvider version={versionMetadata}>
|
|
@@ -184,5 +184,3 @@ function DocPage(props: Props): JSX.Element {
|
|
|
184
184
|
</>
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
|
-
|
|
188
|
-
export default DocPage;
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
transform: rotate(0);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
[dir='rtl'] .expandSidebarButtonIcon {
|
|
73
73
|
transform: rotate(180deg);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
[data-theme='dark'] .collapsedDocSidebar:hover,
|
|
77
|
+
[data-theme='dark'] .collapsedDocSidebar:focus {
|
|
78
78
|
background-color: var(--collapse-button-bg-color-dark);
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -10,7 +10,7 @@ import Translate, {translate} from '@docusaurus/Translate';
|
|
|
10
10
|
import PaginatorNavLink from '@theme/PaginatorNavLink';
|
|
11
11
|
import type {Props} from '@theme/DocPaginator';
|
|
12
12
|
|
|
13
|
-
function DocPaginator(props: Props): JSX.Element {
|
|
13
|
+
export default function DocPaginator(props: Props): JSX.Element {
|
|
14
14
|
const {previous, next} = props;
|
|
15
15
|
|
|
16
16
|
return (
|
|
@@ -52,5 +52,3 @@ function DocPaginator(props: Props): JSX.Element {
|
|
|
52
52
|
</nav>
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
export default DocPaginator;
|
|
@@ -72,16 +72,16 @@
|
|
|
72
72
|
margin-top: 4px;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
[dir='rtl'] .collapseSidebarButtonIcon {
|
|
76
76
|
transform: rotate(0);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
[data-theme='dark'] .collapseSidebarButton {
|
|
80
80
|
background-color: var(--collapse-button-bg-color-dark);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
[data-theme='dark'] .collapseSidebarButton:hover,
|
|
84
|
+
[data-theme='dark'] .collapseSidebarButton:focus {
|
|
85
85
|
background-color: var(--ifm-color-emphasis-200);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
ThemeClassNames,
|
|
17
17
|
useThemeConfig,
|
|
18
18
|
useDocSidebarItemsExpandedState,
|
|
19
|
+
isSamePath,
|
|
19
20
|
} from '@docusaurus/theme-common';
|
|
20
21
|
import Link from '@docusaurus/Link';
|
|
21
22
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
@@ -31,6 +32,7 @@ import type {
|
|
|
31
32
|
|
|
32
33
|
import styles from './styles.module.css';
|
|
33
34
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
35
|
+
import type {SidebarItemHtml} from '@docusaurus/plugin-content-docs/src/sidebars/types';
|
|
34
36
|
|
|
35
37
|
export default function DocSidebarItem({
|
|
36
38
|
item,
|
|
@@ -38,17 +40,17 @@ export default function DocSidebarItem({
|
|
|
38
40
|
}: Props): JSX.Element | null {
|
|
39
41
|
switch (item.type) {
|
|
40
42
|
case 'category':
|
|
41
|
-
if (item.items.length === 0) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
43
|
return <DocSidebarItemCategory item={item} {...props} />;
|
|
44
|
+
case 'html':
|
|
45
|
+
return <DocSidebarItemHtml item={item} {...props} />;
|
|
45
46
|
case 'link':
|
|
46
47
|
default:
|
|
47
48
|
return <DocSidebarItemLink item={item} {...props} />;
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
// If we navigate to a category and it becomes active, it should automatically
|
|
52
|
+
// If we navigate to a category and it becomes active, it should automatically
|
|
53
|
+
// expand itself
|
|
52
54
|
function useAutoExpandActiveCategory({
|
|
53
55
|
isActive,
|
|
54
56
|
collapsed,
|
|
@@ -67,11 +69,14 @@ function useAutoExpandActiveCategory({
|
|
|
67
69
|
}, [isActive, wasActive, collapsed, setCollapsed]);
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
/**
|
|
73
|
+
* When a collapsible category has no link, we still link it to its first child
|
|
74
|
+
* during SSR as a temporary fallback. This allows to be able to navigate inside
|
|
75
|
+
* the category even when JS fails to load, is delayed or simply disabled
|
|
76
|
+
* React hydration becomes an optional progressive enhancement
|
|
77
|
+
* see https://github.com/facebookincubator/infima/issues/36#issuecomment-772543188
|
|
78
|
+
* see https://github.com/facebook/docusaurus/issues/3030
|
|
79
|
+
*/
|
|
75
80
|
function useCategoryHrefWithSSRFallback(
|
|
76
81
|
item: PropSidebarItemCategory,
|
|
77
82
|
): string | undefined {
|
|
@@ -101,6 +106,7 @@ function DocSidebarItemCategory({
|
|
|
101
106
|
const hrefWithSSRFallback = useCategoryHrefWithSSRFallback(item);
|
|
102
107
|
|
|
103
108
|
const isActive = isActiveSidebarItem(item, activePath);
|
|
109
|
+
const isCurrentPage = isSamePath(href, activePath);
|
|
104
110
|
|
|
105
111
|
const {collapsed, setCollapsed} = useCollapsible({
|
|
106
112
|
// active categories are always initialized as expanded
|
|
@@ -148,13 +154,14 @@ function DocSidebarItemCategory({
|
|
|
148
154
|
},
|
|
149
155
|
className,
|
|
150
156
|
)}>
|
|
151
|
-
<div
|
|
157
|
+
<div
|
|
158
|
+
className={clsx('menu__list-item-collapsible', {
|
|
159
|
+
'menu__list-item-collapsible--active': isCurrentPage,
|
|
160
|
+
})}>
|
|
152
161
|
<Link
|
|
153
162
|
className={clsx('menu__link', {
|
|
154
163
|
'menu__link--sublist': collapsible && !href,
|
|
155
164
|
'menu__link--active': isActive,
|
|
156
|
-
[styles.menuLinkText]: !collapsible,
|
|
157
|
-
[styles.hasHref]: !!hrefWithSSRFallback,
|
|
158
165
|
})}
|
|
159
166
|
onClick={
|
|
160
167
|
collapsible
|
|
@@ -171,7 +178,7 @@ function DocSidebarItemCategory({
|
|
|
171
178
|
onItemClick?.(item);
|
|
172
179
|
}
|
|
173
180
|
}
|
|
174
|
-
aria-current={
|
|
181
|
+
aria-current={isCurrentPage ? 'page' : undefined}
|
|
175
182
|
href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback}
|
|
176
183
|
{...props}>
|
|
177
184
|
{label}
|
|
@@ -210,6 +217,29 @@ function DocSidebarItemCategory({
|
|
|
210
217
|
);
|
|
211
218
|
}
|
|
212
219
|
|
|
220
|
+
function DocSidebarItemHtml({
|
|
221
|
+
item,
|
|
222
|
+
level,
|
|
223
|
+
index,
|
|
224
|
+
}: Props & {item: SidebarItemHtml}) {
|
|
225
|
+
const {value, defaultStyle, className} = item;
|
|
226
|
+
return (
|
|
227
|
+
<li
|
|
228
|
+
className={clsx(
|
|
229
|
+
ThemeClassNames.docs.docSidebarItemLink,
|
|
230
|
+
ThemeClassNames.docs.docSidebarItemLinkLevel(level),
|
|
231
|
+
defaultStyle && `${styles.menuHtmlItem} menu__list-item`,
|
|
232
|
+
className,
|
|
233
|
+
)}
|
|
234
|
+
key={index}
|
|
235
|
+
// eslint-disable-next-line react/no-danger
|
|
236
|
+
dangerouslySetInnerHTML={{
|
|
237
|
+
__html: value,
|
|
238
|
+
}}
|
|
239
|
+
/>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
213
243
|
function DocSidebarItemLink({
|
|
214
244
|
item,
|
|
215
245
|
onItemClick,
|
|
@@ -6,15 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
@media (min-width: 997px) {
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.menuLinkText:hover {
|
|
14
|
-
background: none;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.menuLinkText.hasHref {
|
|
18
|
-
cursor: pointer;
|
|
9
|
+
.menuHtmlItem {
|
|
10
|
+
padding: var(--ifm-menu-link-padding-vertical)
|
|
11
|
+
var(--ifm-menu-link-padding-horizontal);
|
|
19
12
|
}
|
|
20
13
|
}
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import TagsListByLetter from '@theme/TagsListByLetter';
|
|
16
16
|
import type {Props} from '@theme/DocTagsListPage';
|
|
17
17
|
|
|
18
|
-
function DocTagsListPage({tags}: Props): JSX.Element {
|
|
18
|
+
export default function DocTagsListPage({tags}: Props): JSX.Element {
|
|
19
19
|
const title = translateTagsPageTitle();
|
|
20
20
|
return (
|
|
21
21
|
<Layout
|
|
@@ -37,5 +37,3 @@ function DocTagsListPage({tags}: Props): JSX.Element {
|
|
|
37
37
|
</Layout>
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
export default DocTagsListPage;
|