@docusaurus/theme-classic 3.9.2 → 3.10.1
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/README.md +1 -1
- package/lib/getSwizzleConfig.js +7 -0
- package/lib/theme/Admonition/Layout/index.js +5 -4
- package/lib/theme/CodeBlock/Buttons/CopyButton/index.js +15 -1
- package/lib/theme/CodeBlock/Line/index.js +13 -5
- package/lib/theme/DocCard/Description/index.d.ts +9 -0
- package/lib/theme/DocCard/Description/index.js +23 -0
- package/lib/theme/DocCard/Description/styles.module.css +10 -0
- package/lib/theme/DocCard/Heading/Icon/index.d.ts +9 -0
- package/lib/theme/DocCard/Heading/Icon/index.js +18 -0
- package/lib/theme/DocCard/Heading/Icon/styles.module.css +11 -0
- package/lib/theme/DocCard/Heading/Text/index.d.ts +9 -0
- package/lib/theme/DocCard/Heading/Text/index.js +22 -0
- package/lib/theme/DocCard/Heading/Text/styles.module.css +10 -0
- package/lib/theme/DocCard/Heading/index.d.ts +9 -0
- package/lib/theme/DocCard/Heading/index.js +24 -0
- package/lib/theme/DocCard/Heading/styles.module.css +11 -0
- package/lib/theme/DocCard/Layout/index.d.ts +9 -0
- package/lib/theme/DocCard/Layout/index.js +42 -0
- package/lib/theme/DocCard/{styles.module.css → Layout/styles.module.css} +0 -8
- package/lib/theme/DocCard/index.js +24 -56
- package/lib/theme/Layout/index.js +0 -2
- package/lib/theme/Navbar/MobileSidebar/Layout/index.js +1 -0
- package/lib/theme/NavbarItem/DropdownNavbarItem/Desktop/index.js +1 -1
- package/lib/theme/SiteMetadata/index.js +1 -2
- package/lib/theme/TabItem/index.d.ts +1 -1
- package/lib/theme/TabItem/index.js +15 -1
- package/lib/theme/Tabs/index.js +24 -39
- package/package.json +16 -16
- package/src/getSwizzleConfig.ts +7 -0
- package/src/theme/Admonition/Layout/index.tsx +6 -4
- package/src/theme/CodeBlock/Buttons/CopyButton/index.tsx +16 -1
- package/src/theme/CodeBlock/Line/index.tsx +14 -8
- package/src/theme/DocCard/Description/index.tsx +27 -0
- package/src/theme/DocCard/Description/styles.module.css +10 -0
- package/src/theme/DocCard/Heading/Icon/index.tsx +22 -0
- package/src/theme/DocCard/Heading/Icon/styles.module.css +11 -0
- package/src/theme/DocCard/Heading/Text/index.tsx +27 -0
- package/src/theme/DocCard/Heading/Text/styles.module.css +10 -0
- package/src/theme/DocCard/Heading/index.tsx +28 -0
- package/src/theme/DocCard/Heading/styles.module.css +11 -0
- package/src/theme/DocCard/Layout/index.tsx +55 -0
- package/src/theme/DocCard/{styles.module.css → Layout/styles.module.css} +0 -8
- package/src/theme/DocCard/index.tsx +28 -79
- package/src/theme/Layout/index.tsx +0 -3
- package/src/theme/Navbar/MobileSidebar/Layout/index.tsx +2 -1
- package/src/theme/NavbarItem/DropdownNavbarItem/Desktop/index.tsx +1 -1
- package/src/theme/SiteMetadata/index.tsx +1 -2
- package/src/theme/TabItem/index.tsx +28 -3
- package/src/theme/Tabs/index.tsx +31 -50
- package/src/theme-classic.d.ts +69 -2
package/README.md
CHANGED
package/lib/getSwizzleConfig.js
CHANGED
|
@@ -343,6 +343,13 @@ function getSwizzleConfig() {
|
|
|
343
343
|
},
|
|
344
344
|
description: 'The component used to render <img> tags and Markdown images in MDX',
|
|
345
345
|
},
|
|
346
|
+
'MDXComponents/Li': {
|
|
347
|
+
actions: {
|
|
348
|
+
eject: 'safe',
|
|
349
|
+
wrap: 'safe',
|
|
350
|
+
},
|
|
351
|
+
description: 'The component used to render <li> tags in MDX',
|
|
352
|
+
},
|
|
346
353
|
'MDXComponents/Pre': {
|
|
347
354
|
actions: {
|
|
348
355
|
eject: 'safe',
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
10
10
|
import styles from './styles.module.css';
|
|
11
|
-
function AdmonitionContainer({type, className, children}) {
|
|
11
|
+
function AdmonitionContainer({type, className, children, id}) {
|
|
12
12
|
return (
|
|
13
13
|
<div
|
|
14
14
|
className={clsx(
|
|
@@ -16,7 +16,8 @@ function AdmonitionContainer({type, className, children}) {
|
|
|
16
16
|
ThemeClassNames.common.admonitionType(type),
|
|
17
17
|
styles.admonition,
|
|
18
18
|
className,
|
|
19
|
-
)}
|
|
19
|
+
)}
|
|
20
|
+
id={id}>
|
|
20
21
|
{children}
|
|
21
22
|
</div>
|
|
22
23
|
);
|
|
@@ -35,9 +36,9 @@ function AdmonitionContent({children}) {
|
|
|
35
36
|
) : null;
|
|
36
37
|
}
|
|
37
38
|
export default function AdmonitionLayout(props) {
|
|
38
|
-
const {type, icon, title, children, className} = props;
|
|
39
|
+
const {type, icon, title, children, className, id} = props;
|
|
39
40
|
return (
|
|
40
|
-
<AdmonitionContainer type={type} className={className}>
|
|
41
|
+
<AdmonitionContainer type={type} className={className} id={id}>
|
|
41
42
|
{title || icon ? <AdmonitionHeading title={title} icon={icon} /> : null}
|
|
42
43
|
<AdmonitionContent>{children}</AdmonitionContent>
|
|
43
44
|
</AdmonitionContainer>
|
|
@@ -32,6 +32,18 @@ function ariaLabel(isCopied) {
|
|
|
32
32
|
description: 'The ARIA label for copy code blocks button',
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
async function copyToClipboard(text) {
|
|
36
|
+
// The clipboard API is only defined in secure contexts (HTTPS / localhost).
|
|
37
|
+
// See https://developer.mozilla.org/en-US/docs/Web/API/Clipboard
|
|
38
|
+
if (navigator.clipboard) {
|
|
39
|
+
return navigator.clipboard.writeText(text);
|
|
40
|
+
}
|
|
41
|
+
// Fall back to copy-text-to-clipboard for non-secure contexts (e.g. HTTP
|
|
42
|
+
// on a local network). The fallback is lazily loaded to avoid bundle
|
|
43
|
+
// overhead for the common HTTPS case.
|
|
44
|
+
const {default: copy} = await import('copy-text-to-clipboard');
|
|
45
|
+
return copy(text);
|
|
46
|
+
}
|
|
35
47
|
function useCopyButton() {
|
|
36
48
|
const {
|
|
37
49
|
metadata: {code},
|
|
@@ -39,12 +51,14 @@ function useCopyButton() {
|
|
|
39
51
|
const [isCopied, setIsCopied] = useState(false);
|
|
40
52
|
const copyTimeout = useRef(undefined);
|
|
41
53
|
const copyCode = useCallback(() => {
|
|
42
|
-
|
|
54
|
+
copyToClipboard(code).then(() => {
|
|
43
55
|
setIsCopied(true);
|
|
44
56
|
copyTimeout.current = window.setTimeout(() => {
|
|
45
57
|
setIsCopied(false);
|
|
46
58
|
}, 1000);
|
|
47
59
|
});
|
|
60
|
+
// Errors are intentionally not caught so they remain unhandled and can
|
|
61
|
+
// be captured by observability tools (e.g. Sentry, PostHog).
|
|
48
62
|
}, [code]);
|
|
49
63
|
useEffect(() => () => window.clearTimeout(copyTimeout.current), []);
|
|
50
64
|
return {copyCode, isCopied};
|
|
@@ -8,8 +8,16 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import LineToken from '@theme/CodeBlock/Line/Token';
|
|
10
10
|
import styles from './styles.module.css';
|
|
11
|
-
//
|
|
12
|
-
//
|
|
11
|
+
// This <br/ seems useful when the line has no content to prevent collapsing.
|
|
12
|
+
// For code blocks with "diff" languages, this makes the empty lines collapse to
|
|
13
|
+
// zero height lines, which is undesirable.
|
|
14
|
+
// See also https://github.com/facebook/docusaurus/pull/11565
|
|
15
|
+
function LineBreak() {
|
|
16
|
+
return <br />;
|
|
17
|
+
}
|
|
18
|
+
// Replaces single lines with '\n' by '' so that we don't end up with
|
|
19
|
+
// duplicate line breaks (the '\n' + the artificial <br/> above)
|
|
20
|
+
// see also https://github.com/facebook/docusaurus/pull/11565
|
|
13
21
|
function fixLineBreak(line) {
|
|
14
22
|
const singleLineBreakToken =
|
|
15
23
|
line.length === 1 && line[0].content === '\n' ? line[0] : undefined;
|
|
@@ -39,7 +47,7 @@ export default function CodeBlockLine({
|
|
|
39
47
|
);
|
|
40
48
|
});
|
|
41
49
|
return (
|
|
42
|
-
<
|
|
50
|
+
<div {...lineProps}>
|
|
43
51
|
{showLineNumbers ? (
|
|
44
52
|
<>
|
|
45
53
|
<span className={styles.codeLineNumber} />
|
|
@@ -48,7 +56,7 @@ export default function CodeBlockLine({
|
|
|
48
56
|
) : (
|
|
49
57
|
lineTokens
|
|
50
58
|
)}
|
|
51
|
-
<
|
|
52
|
-
</
|
|
59
|
+
<LineBreak />
|
|
60
|
+
</div>
|
|
53
61
|
);
|
|
54
62
|
}
|
|
@@ -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
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
import type { Props } from '@theme/DocCard/Description';
|
|
9
|
+
export default function DocCardDescription({ description }: Props): ReactNode;
|
|
@@ -0,0 +1,23 @@
|
|
|
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} from '@docusaurus/theme-common';
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
|
+
export default function DocCardDescription({description}) {
|
|
12
|
+
return (
|
|
13
|
+
<p
|
|
14
|
+
className={clsx(
|
|
15
|
+
'text--truncate',
|
|
16
|
+
ThemeClassNames.docs.docCard.description,
|
|
17
|
+
styles.cardDescription,
|
|
18
|
+
)}
|
|
19
|
+
title={description}>
|
|
20
|
+
{description}
|
|
21
|
+
</p>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -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
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
import type { Props } from '@theme/DocCard/Heading/Icon';
|
|
9
|
+
export default function DocCardHeadingIcon({ icon }: Props): ReactNode;
|
|
@@ -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} from '@docusaurus/theme-common';
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
|
+
export default function DocCardHeadingIcon({icon}) {
|
|
12
|
+
return (
|
|
13
|
+
<span
|
|
14
|
+
className={clsx(ThemeClassNames.docs.docCard.icon, styles.cardTitleIcon)}>
|
|
15
|
+
{icon}
|
|
16
|
+
</span>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
.cardTitleIcon {
|
|
9
|
+
font-size: 1.6rem;
|
|
10
|
+
margin-right: 0.6rem;
|
|
11
|
+
}
|
|
@@ -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
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
import type { Props } from '@theme/DocCard/Heading/Text';
|
|
9
|
+
export default function DocCardHeadingText({ title }: Props): ReactNode;
|
|
@@ -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
|
+
import React from 'react';
|
|
8
|
+
import clsx from 'clsx';
|
|
9
|
+
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
|
+
export default function DocCardHeadingText({title}) {
|
|
12
|
+
return (
|
|
13
|
+
<span
|
|
14
|
+
className={clsx(
|
|
15
|
+
'text--truncate',
|
|
16
|
+
ThemeClassNames.docs.docCard.title,
|
|
17
|
+
styles.cardTitleText,
|
|
18
|
+
)}>
|
|
19
|
+
{title}
|
|
20
|
+
</span>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -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
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
import type { Props } from '@theme/DocCard/Heading';
|
|
9
|
+
export default function DocCardHeading({ item, title, icon }: Props): ReactNode;
|
|
@@ -0,0 +1,24 @@
|
|
|
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} from '@docusaurus/theme-common';
|
|
10
|
+
import Heading from '@theme/Heading';
|
|
11
|
+
import Icon from '@theme/DocCard/Heading/Icon';
|
|
12
|
+
import Text from '@theme/DocCard/Heading/Text';
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
|
+
export default function DocCardHeading({item, title, icon}) {
|
|
15
|
+
return (
|
|
16
|
+
<Heading
|
|
17
|
+
as="h2"
|
|
18
|
+
className={clsx(ThemeClassNames.docs.docCard.heading, styles.cardTitle)}
|
|
19
|
+
title={title}>
|
|
20
|
+
{icon && <Icon item={item} icon={icon} />}
|
|
21
|
+
<Text item={item} title={title} />
|
|
22
|
+
</Heading>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
.cardTitle {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
}
|
|
@@ -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
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
import type { Props } from '@theme/DocCard/Layout';
|
|
9
|
+
export default function DocCardLayout({ item, className, href, icon, title, description, }: Props): ReactNode;
|
|
@@ -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 Link from '@docusaurus/Link';
|
|
10
|
+
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
11
|
+
import Heading from '@theme/DocCard/Heading';
|
|
12
|
+
import Description from '@theme/DocCard/Description';
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
|
+
function Container({className, href, children}) {
|
|
15
|
+
return (
|
|
16
|
+
<Link
|
|
17
|
+
href={href}
|
|
18
|
+
className={clsx(
|
|
19
|
+
'card padding--lg',
|
|
20
|
+
ThemeClassNames.docs.docCard.container,
|
|
21
|
+
styles.cardContainer,
|
|
22
|
+
className,
|
|
23
|
+
)}>
|
|
24
|
+
{children}
|
|
25
|
+
</Link>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
export default function DocCardLayout({
|
|
29
|
+
item,
|
|
30
|
+
className,
|
|
31
|
+
href,
|
|
32
|
+
icon,
|
|
33
|
+
title,
|
|
34
|
+
description,
|
|
35
|
+
}) {
|
|
36
|
+
return (
|
|
37
|
+
<Container href={href} className={className}>
|
|
38
|
+
<Heading item={item} icon={icon} title={title} />
|
|
39
|
+
{description && <Description item={item} description={description} />}
|
|
40
|
+
</Container>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -5,88 +5,56 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import clsx from 'clsx';
|
|
9
|
-
import Link from '@docusaurus/Link';
|
|
10
8
|
import {
|
|
11
9
|
useDocById,
|
|
12
10
|
findFirstSidebarItemLink,
|
|
13
11
|
} from '@docusaurus/plugin-content-docs/client';
|
|
14
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
extractLeadingEmoji,
|
|
14
|
+
useDocCardDescriptionCategoryItemsPlural,
|
|
15
|
+
} from '@docusaurus/theme-common/internal';
|
|
15
16
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
selectMessage(
|
|
23
|
-
count,
|
|
24
|
-
translate(
|
|
25
|
-
{
|
|
26
|
-
message: '1 item|{count} items',
|
|
27
|
-
id: 'theme.docs.DocCard.categoryDescription.plurals',
|
|
28
|
-
description:
|
|
29
|
-
'The default description for a category card in the generated index about how many items this category includes',
|
|
30
|
-
},
|
|
31
|
-
{count},
|
|
32
|
-
),
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
function CardContainer({className, href, children}) {
|
|
36
|
-
return (
|
|
37
|
-
<Link
|
|
38
|
-
href={href}
|
|
39
|
-
className={clsx('card padding--lg', styles.cardContainer, className)}>
|
|
40
|
-
{children}
|
|
41
|
-
</Link>
|
|
42
|
-
);
|
|
17
|
+
import Layout from '@theme/DocCard/Layout';
|
|
18
|
+
function getFallbackEmojiIcon(item) {
|
|
19
|
+
if (item.type === 'category') {
|
|
20
|
+
return '🗃';
|
|
21
|
+
}
|
|
22
|
+
return isInternalUrl(item.href) ? '📄️' : '🔗';
|
|
43
23
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{icon} {title}
|
|
52
|
-
</Heading>
|
|
53
|
-
{description && (
|
|
54
|
-
<p
|
|
55
|
-
className={clsx('text--truncate', styles.cardDescription)}
|
|
56
|
-
title={description}>
|
|
57
|
-
{description}
|
|
58
|
-
</p>
|
|
59
|
-
)}
|
|
60
|
-
</CardContainer>
|
|
61
|
-
);
|
|
24
|
+
function getIconTitleProps(item) {
|
|
25
|
+
const extracted = extractLeadingEmoji(item.label);
|
|
26
|
+
const emoji = extracted.emoji ?? getFallbackEmojiIcon(item);
|
|
27
|
+
return {
|
|
28
|
+
icon: emoji,
|
|
29
|
+
title: extracted.rest.trim(),
|
|
30
|
+
};
|
|
62
31
|
}
|
|
63
32
|
function CardCategory({item}) {
|
|
64
33
|
const href = findFirstSidebarItemLink(item);
|
|
65
|
-
const categoryItemsPlural =
|
|
34
|
+
const categoryItemsPlural = useDocCardDescriptionCategoryItemsPlural();
|
|
66
35
|
// Unexpected: categories that don't have a link have been filtered upfront
|
|
67
36
|
if (!href) {
|
|
68
37
|
return null;
|
|
69
38
|
}
|
|
70
39
|
return (
|
|
71
|
-
<
|
|
40
|
+
<Layout
|
|
41
|
+
item={item}
|
|
72
42
|
className={item.className}
|
|
73
43
|
href={href}
|
|
74
|
-
icon="🗃️"
|
|
75
|
-
title={item.label}
|
|
76
44
|
description={item.description ?? categoryItemsPlural(item.items.length)}
|
|
45
|
+
{...getIconTitleProps(item)}
|
|
77
46
|
/>
|
|
78
47
|
);
|
|
79
48
|
}
|
|
80
49
|
function CardLink({item}) {
|
|
81
|
-
const icon = isInternalUrl(item.href) ? '📄️' : '🔗';
|
|
82
50
|
const doc = useDocById(item.docId ?? undefined);
|
|
83
51
|
return (
|
|
84
|
-
<
|
|
52
|
+
<Layout
|
|
53
|
+
item={item}
|
|
85
54
|
className={item.className}
|
|
86
55
|
href={item.href}
|
|
87
|
-
icon={icon}
|
|
88
|
-
title={item.label}
|
|
89
56
|
description={item.description ?? doc?.description}
|
|
57
|
+
{...getIconTitleProps(item)}
|
|
90
58
|
/>
|
|
91
59
|
);
|
|
92
60
|
}
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
SkipToContentFallbackId,
|
|
13
13
|
ThemeClassNames,
|
|
14
14
|
} from '@docusaurus/theme-common';
|
|
15
|
-
import {useKeyboardNavigation} from '@docusaurus/theme-common/internal';
|
|
16
15
|
import SkipToContent from '@theme/SkipToContent';
|
|
17
16
|
import AnnouncementBar from '@theme/AnnouncementBar';
|
|
18
17
|
import Navbar from '@theme/Navbar';
|
|
@@ -29,7 +28,6 @@ export default function Layout(props) {
|
|
|
29
28
|
title,
|
|
30
29
|
description,
|
|
31
30
|
} = props;
|
|
32
|
-
useKeyboardNavigation();
|
|
33
31
|
return (
|
|
34
32
|
<LayoutProvider>
|
|
35
33
|
<PageMetadata title={title} description={description} />
|
|
@@ -14,6 +14,7 @@ import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
|
14
14
|
function inertProps(inert) {
|
|
15
15
|
const isBeforeReact19 = parseInt(version.split('.')[0], 10) < 19;
|
|
16
16
|
if (isBeforeReact19) {
|
|
17
|
+
// TODO Docusaurus v4: remove temporary inert workaround
|
|
17
18
|
return {inert: inert ? '' : undefined};
|
|
18
19
|
}
|
|
19
20
|
return {inert};
|
|
@@ -52,7 +52,7 @@ export default function DropdownNavbarItemDesktop({
|
|
|
52
52
|
{...props}
|
|
53
53
|
onClick={props.to ? undefined : (e) => e.preventDefault()}
|
|
54
54
|
onKeyDown={(e) => {
|
|
55
|
-
if (e.key === 'Enter') {
|
|
55
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
56
56
|
e.preventDefault();
|
|
57
57
|
setShowDropdown(!showDropdown);
|
|
58
58
|
}
|
|
@@ -12,7 +12,6 @@ import {PageMetadata, useThemeConfig} from '@docusaurus/theme-common';
|
|
|
12
12
|
import {
|
|
13
13
|
DEFAULT_SEARCH_TAG,
|
|
14
14
|
useAlternatePageUtils,
|
|
15
|
-
keyboardFocusedClassName,
|
|
16
15
|
} from '@docusaurus/theme-common/internal';
|
|
17
16
|
import {useLocation} from '@docusaurus/router';
|
|
18
17
|
import {applyTrailingSlash} from '@docusaurus/utils-common';
|
|
@@ -115,7 +114,7 @@ export default function SiteMetadata() {
|
|
|
115
114
|
<meta name="twitter:card" content="summary_large_image" />
|
|
116
115
|
{/* The keyboard focus class name need to be applied when SSR so links
|
|
117
116
|
are outlined when JS is disabled */}
|
|
118
|
-
<body
|
|
117
|
+
<body />
|
|
119
118
|
</Head>
|
|
120
119
|
|
|
121
120
|
{defaultImage && <PageMetadata image={defaultImage} />}
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
+
import {useTabs} from '@docusaurus/theme-common/internal';
|
|
9
10
|
import styles from './styles.module.css';
|
|
10
|
-
|
|
11
|
+
function TabItemPanel({children, className, hidden}) {
|
|
11
12
|
return (
|
|
12
13
|
<div
|
|
13
14
|
role="tabpanel"
|
|
@@ -17,3 +18,16 @@ export default function TabItem({children, hidden, className}) {
|
|
|
17
18
|
</div>
|
|
18
19
|
);
|
|
19
20
|
}
|
|
21
|
+
export default function TabItem({children, className, value}) {
|
|
22
|
+
const {selectedValue, lazy} = useTabs();
|
|
23
|
+
const isSelected = value === selectedValue;
|
|
24
|
+
// TODO Docusaurus v4: use <Activity> ?
|
|
25
|
+
if (!isSelected && lazy) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return (
|
|
29
|
+
<TabItemPanel className={className} hidden={!isSelected}>
|
|
30
|
+
{children}
|
|
31
|
+
</TabItemPanel>
|
|
32
|
+
);
|
|
33
|
+
}
|