@docusaurus/theme-classic 2.4.0 → 2.4.3
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/theme/BlogPostItem/Container/index.js +11 -2
- package/lib/theme/BlogPostItem/Header/Author/index.js +6 -1
- package/lib/theme/CodeBlock/CopyButton/index.js +4 -6
- package/lib/theme/CodeBlock/WordWrapButton/index.js +2 -9
- package/lib/theme/DocPage/Layout/Sidebar/index.js +6 -1
- package/lib/theme/DocPage/Layout/styles.module.css +8 -0
- package/lib/theme/DocPaginator/index.js +1 -1
- package/lib/theme/Icon/Copy/index.d.ts +9 -0
- package/lib/theme/Icon/Copy/index.js +17 -0
- package/lib/theme/Icon/Success/index.d.ts +9 -0
- package/lib/theme/Icon/Success/index.js +17 -0
- package/lib/theme/Icon/WordWrap/index.d.ts +9 -0
- package/lib/theme/Icon/WordWrap/index.js +17 -0
- package/lib/theme/MDXComponents/Ul/index.js +4 -0
- package/lib/theme/SiteMetadata/index.js +9 -2
- package/package.json +14 -14
- package/src/theme/BlogPostItem/Container/index.tsx +11 -2
- package/src/theme/BlogPostItem/Header/Author/index.tsx +6 -1
- package/src/theme/CodeBlock/CopyButton/index.tsx +4 -6
- package/src/theme/CodeBlock/WordWrapButton/index.tsx +2 -9
- package/src/theme/DocPage/Layout/Sidebar/index.tsx +6 -1
- package/src/theme/DocPage/Layout/styles.module.css +8 -0
- package/src/theme/DocPaginator/index.tsx +1 -1
- package/src/theme/Icon/Copy/index.tsx +20 -0
- package/src/theme/Icon/Success/index.tsx +20 -0
- package/src/theme/Icon/WordWrap/index.tsx +20 -0
- package/src/theme/MDXComponents/Ul/index.tsx +5 -1
- package/src/theme/SiteMetadata/index.tsx +12 -2
- package/src/theme-classic.d.ts +24 -0
|
@@ -8,17 +8,26 @@ import React from 'react';
|
|
|
8
8
|
import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
|
|
9
9
|
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
10
10
|
export default function BlogPostItemContainer({children, className}) {
|
|
11
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
frontMatter,
|
|
13
|
+
assets,
|
|
14
|
+
metadata: {description},
|
|
15
|
+
} = useBlogPost();
|
|
12
16
|
const {withBaseUrl} = useBaseUrlUtils();
|
|
13
17
|
const image = assets.image ?? frontMatter.image;
|
|
18
|
+
const keywords = frontMatter.keywords ?? [];
|
|
14
19
|
return (
|
|
15
20
|
<article
|
|
16
21
|
className={className}
|
|
17
22
|
itemProp="blogPost"
|
|
18
23
|
itemScope
|
|
19
24
|
itemType="http://schema.org/BlogPosting">
|
|
25
|
+
{description && <meta itemProp="description" content={description} />}
|
|
20
26
|
{image && (
|
|
21
|
-
<
|
|
27
|
+
<link itemProp="image" href={withBaseUrl(image, {absolute: true})} />
|
|
28
|
+
)}
|
|
29
|
+
{keywords.length > 0 && (
|
|
30
|
+
<meta itemProp="keywords" content={keywords.join(',')} />
|
|
22
31
|
)}
|
|
23
32
|
{children}
|
|
24
33
|
</article>
|
|
@@ -20,7 +20,12 @@ export default function BlogPostItemHeaderAuthor({author, className}) {
|
|
|
20
20
|
<div className={clsx('avatar margin-bottom--sm', className)}>
|
|
21
21
|
{imageURL && (
|
|
22
22
|
<MaybeLink href={link} className="avatar__photo-link">
|
|
23
|
-
<img
|
|
23
|
+
<img
|
|
24
|
+
className="avatar__photo"
|
|
25
|
+
src={imageURL}
|
|
26
|
+
alt={name}
|
|
27
|
+
itemProp="image"
|
|
28
|
+
/>
|
|
24
29
|
</MaybeLink>
|
|
25
30
|
)}
|
|
26
31
|
|
|
@@ -9,6 +9,8 @@ import clsx from 'clsx';
|
|
|
9
9
|
// @ts-expect-error: TODO, we need to make theme-classic have type: module
|
|
10
10
|
import copy from 'copy-text-to-clipboard';
|
|
11
11
|
import {translate} from '@docusaurus/Translate';
|
|
12
|
+
import IconCopy from '@theme/Icon/Copy';
|
|
13
|
+
import IconSuccess from '@theme/Icon/Success';
|
|
12
14
|
import styles from './styles.module.css';
|
|
13
15
|
export default function CopyButton({code, className}) {
|
|
14
16
|
const [isCopied, setIsCopied] = useState(false);
|
|
@@ -50,12 +52,8 @@ export default function CopyButton({code, className}) {
|
|
|
50
52
|
)}
|
|
51
53
|
onClick={handleCopyCode}>
|
|
52
54
|
<span className={styles.copyButtonIcons} aria-hidden="true">
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
</svg>
|
|
56
|
-
<svg className={styles.copyButtonSuccessIcon} viewBox="0 0 24 24">
|
|
57
|
-
<path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" />
|
|
58
|
-
</svg>
|
|
55
|
+
<IconCopy className={styles.copyButtonIcon} />
|
|
56
|
+
<IconSuccess className={styles.copyButtonSuccessIcon} />
|
|
59
57
|
</span>
|
|
60
58
|
</button>
|
|
61
59
|
);
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import {translate} from '@docusaurus/Translate';
|
|
10
|
+
import IconWordWrap from '@theme/Icon/WordWrap';
|
|
10
11
|
import styles from './styles.module.css';
|
|
11
12
|
export default function WordWrapButton({className, onClick, isEnabled}) {
|
|
12
13
|
const title = translate({
|
|
@@ -26,15 +27,7 @@ export default function WordWrapButton({className, onClick, isEnabled}) {
|
|
|
26
27
|
)}
|
|
27
28
|
aria-label={title}
|
|
28
29
|
title={title}>
|
|
29
|
-
<
|
|
30
|
-
className={styles.wordWrapButtonIcon}
|
|
31
|
-
viewBox="0 0 24 24"
|
|
32
|
-
aria-hidden="true">
|
|
33
|
-
<path
|
|
34
|
-
fill="currentColor"
|
|
35
|
-
d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"
|
|
36
|
-
/>
|
|
37
|
-
</svg>
|
|
30
|
+
<IconWordWrap className={styles.wordWrapButtonIcon} aria-hidden="true" />
|
|
38
31
|
</button>
|
|
39
32
|
);
|
|
40
33
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, {useState, useCallback} from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
9
|
+
import {prefersReducedMotion, ThemeClassNames} from '@docusaurus/theme-common';
|
|
10
10
|
import {useDocsSidebar} from '@docusaurus/theme-common/internal';
|
|
11
11
|
import {useLocation} from '@docusaurus/router';
|
|
12
12
|
import DocSidebar from '@theme/DocSidebar';
|
|
@@ -34,6 +34,11 @@ export default function DocPageLayoutSidebar({
|
|
|
34
34
|
if (hiddenSidebar) {
|
|
35
35
|
setHiddenSidebar(false);
|
|
36
36
|
}
|
|
37
|
+
// onTransitionEnd won't fire when sidebar animation is disabled
|
|
38
|
+
// fixes https://github.com/facebook/docusaurus/issues/8918
|
|
39
|
+
if (!hiddenSidebar && prefersReducedMotion()) {
|
|
40
|
+
setHiddenSidebar(true);
|
|
41
|
+
}
|
|
37
42
|
setHiddenSidebarContainer((value) => !value);
|
|
38
43
|
}, [setHiddenSidebarContainer, hiddenSidebar]);
|
|
39
44
|
return (
|
|
@@ -15,3 +15,11 @@
|
|
|
15
15
|
display: flex;
|
|
16
16
|
flex: 1 0 auto;
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
JS disabled??? Show light version by default => better than showing nothing
|
|
21
|
+
TODO bad, but we currently always show light mode when there's no data-theme
|
|
22
|
+
*/
|
|
23
|
+
html:not([data-theme]) .themedComponent--light {
|
|
24
|
+
display: initial;
|
|
25
|
+
}
|
|
@@ -14,7 +14,7 @@ export default function DocPaginator(props) {
|
|
|
14
14
|
className="pagination-nav docusaurus-mt-lg"
|
|
15
15
|
aria-label={translate({
|
|
16
16
|
id: 'theme.docs.paginator.navAriaLabel',
|
|
17
|
-
message: 'Docs pages
|
|
17
|
+
message: 'Docs pages',
|
|
18
18
|
description: 'The ARIA label for the docs pagination',
|
|
19
19
|
})}>
|
|
20
20
|
{previous && (
|
|
@@ -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/Icon/Copy';
|
|
9
|
+
export default function IconCopy(props: Props): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
export default function IconCopy(props) {
|
|
9
|
+
return (
|
|
10
|
+
<svg viewBox="0 0 24 24" {...props}>
|
|
11
|
+
<path
|
|
12
|
+
fill="currentColor"
|
|
13
|
+
d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"
|
|
14
|
+
/>
|
|
15
|
+
</svg>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -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/Icon/Success';
|
|
9
|
+
export default function IconSuccess(props: Props): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
export default function IconSuccess(props) {
|
|
9
|
+
return (
|
|
10
|
+
<svg viewBox="0 0 24 24" {...props}>
|
|
11
|
+
<path
|
|
12
|
+
fill="currentColor"
|
|
13
|
+
d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"
|
|
14
|
+
/>
|
|
15
|
+
</svg>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -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/Icon/WordWrap';
|
|
9
|
+
export default function IconWordWrap(props: Props): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
export default function IconWordWrap(props) {
|
|
9
|
+
return (
|
|
10
|
+
<svg viewBox="0 0 24 24" {...props}>
|
|
11
|
+
<path
|
|
12
|
+
fill="currentColor"
|
|
13
|
+
d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"
|
|
14
|
+
/>
|
|
15
|
+
</svg>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -8,6 +8,10 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import styles from './styles.module.css';
|
|
10
10
|
function transformUlClassName(className) {
|
|
11
|
+
// Fix https://github.com/facebook/docusaurus/issues/9098
|
|
12
|
+
if (typeof className === 'undefined') {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
11
15
|
return clsx(
|
|
12
16
|
className,
|
|
13
17
|
// This class is set globally by GitHub/MDX. We keep the global class, and
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
keyboardFocusedClassName,
|
|
16
16
|
} from '@docusaurus/theme-common/internal';
|
|
17
17
|
import {useLocation} from '@docusaurus/router';
|
|
18
|
+
import {applyTrailingSlash} from '@docusaurus/utils-common';
|
|
18
19
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
19
20
|
// TODO move to SiteMetadataDefaults or theme-common ?
|
|
20
21
|
// Useful for i18n/SEO
|
|
@@ -54,10 +55,16 @@ function AlternateLangHeaders() {
|
|
|
54
55
|
// Default canonical url inferred from current page location pathname
|
|
55
56
|
function useDefaultCanonicalUrl() {
|
|
56
57
|
const {
|
|
57
|
-
siteConfig: {url: siteUrl},
|
|
58
|
+
siteConfig: {url: siteUrl, baseUrl, trailingSlash},
|
|
58
59
|
} = useDocusaurusContext();
|
|
60
|
+
// TODO using useLocation().pathname is not a super idea
|
|
61
|
+
// See https://github.com/facebook/docusaurus/issues/9170
|
|
59
62
|
const {pathname} = useLocation();
|
|
60
|
-
|
|
63
|
+
const canonicalPathname = applyTrailingSlash(useBaseUrl(pathname), {
|
|
64
|
+
trailingSlash,
|
|
65
|
+
baseUrl,
|
|
66
|
+
});
|
|
67
|
+
return siteUrl + canonicalPathname;
|
|
61
68
|
}
|
|
62
69
|
// TODO move to SiteMetadataDefaults or theme-common ?
|
|
63
70
|
function CanonicalUrlHeaders({permalink}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "2.4.
|
|
24
|
-
"@docusaurus/mdx-loader": "2.4.
|
|
25
|
-
"@docusaurus/module-type-aliases": "2.4.
|
|
26
|
-
"@docusaurus/plugin-content-blog": "2.4.
|
|
27
|
-
"@docusaurus/plugin-content-docs": "2.4.
|
|
28
|
-
"@docusaurus/plugin-content-pages": "2.4.
|
|
29
|
-
"@docusaurus/theme-common": "2.4.
|
|
30
|
-
"@docusaurus/theme-translations": "2.4.
|
|
31
|
-
"@docusaurus/types": "2.4.
|
|
32
|
-
"@docusaurus/utils": "2.4.
|
|
33
|
-
"@docusaurus/utils-common": "2.4.
|
|
34
|
-
"@docusaurus/utils-validation": "2.4.
|
|
23
|
+
"@docusaurus/core": "2.4.3",
|
|
24
|
+
"@docusaurus/mdx-loader": "2.4.3",
|
|
25
|
+
"@docusaurus/module-type-aliases": "2.4.3",
|
|
26
|
+
"@docusaurus/plugin-content-blog": "2.4.3",
|
|
27
|
+
"@docusaurus/plugin-content-docs": "2.4.3",
|
|
28
|
+
"@docusaurus/plugin-content-pages": "2.4.3",
|
|
29
|
+
"@docusaurus/theme-common": "2.4.3",
|
|
30
|
+
"@docusaurus/theme-translations": "2.4.3",
|
|
31
|
+
"@docusaurus/types": "2.4.3",
|
|
32
|
+
"@docusaurus/utils": "2.4.3",
|
|
33
|
+
"@docusaurus/utils-common": "2.4.3",
|
|
34
|
+
"@docusaurus/utils-validation": "2.4.3",
|
|
35
35
|
"@mdx-js/react": "^1.6.22",
|
|
36
36
|
"clsx": "^1.2.1",
|
|
37
37
|
"copy-text-to-clipboard": "^3.0.1",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=16.14"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "56410aa94665699f75cb889f477ccdffb98f2b21"
|
|
66
66
|
}
|
|
@@ -14,17 +14,26 @@ export default function BlogPostItemContainer({
|
|
|
14
14
|
children,
|
|
15
15
|
className,
|
|
16
16
|
}: Props): JSX.Element {
|
|
17
|
-
const {
|
|
17
|
+
const {
|
|
18
|
+
frontMatter,
|
|
19
|
+
assets,
|
|
20
|
+
metadata: {description},
|
|
21
|
+
} = useBlogPost();
|
|
18
22
|
const {withBaseUrl} = useBaseUrlUtils();
|
|
19
23
|
const image = assets.image ?? frontMatter.image;
|
|
24
|
+
const keywords = frontMatter.keywords ?? [];
|
|
20
25
|
return (
|
|
21
26
|
<article
|
|
22
27
|
className={className}
|
|
23
28
|
itemProp="blogPost"
|
|
24
29
|
itemScope
|
|
25
30
|
itemType="http://schema.org/BlogPosting">
|
|
31
|
+
{description && <meta itemProp="description" content={description} />}
|
|
26
32
|
{image && (
|
|
27
|
-
<
|
|
33
|
+
<link itemProp="image" href={withBaseUrl(image, {absolute: true})} />
|
|
34
|
+
)}
|
|
35
|
+
{keywords.length > 0 && (
|
|
36
|
+
<meta itemProp="keywords" content={keywords.join(',')} />
|
|
28
37
|
)}
|
|
29
38
|
{children}
|
|
30
39
|
</article>
|
|
@@ -28,7 +28,12 @@ export default function BlogPostItemHeaderAuthor({
|
|
|
28
28
|
<div className={clsx('avatar margin-bottom--sm', className)}>
|
|
29
29
|
{imageURL && (
|
|
30
30
|
<MaybeLink href={link} className="avatar__photo-link">
|
|
31
|
-
<img
|
|
31
|
+
<img
|
|
32
|
+
className="avatar__photo"
|
|
33
|
+
src={imageURL}
|
|
34
|
+
alt={name}
|
|
35
|
+
itemProp="image"
|
|
36
|
+
/>
|
|
32
37
|
</MaybeLink>
|
|
33
38
|
)}
|
|
34
39
|
|
|
@@ -11,6 +11,8 @@ import clsx from 'clsx';
|
|
|
11
11
|
import copy from 'copy-text-to-clipboard';
|
|
12
12
|
import {translate} from '@docusaurus/Translate';
|
|
13
13
|
import type {Props} from '@theme/CodeBlock/CopyButton';
|
|
14
|
+
import IconCopy from '@theme/Icon/Copy';
|
|
15
|
+
import IconSuccess from '@theme/Icon/Success';
|
|
14
16
|
|
|
15
17
|
import styles from './styles.module.css';
|
|
16
18
|
|
|
@@ -56,12 +58,8 @@ export default function CopyButton({code, className}: Props): JSX.Element {
|
|
|
56
58
|
)}
|
|
57
59
|
onClick={handleCopyCode}>
|
|
58
60
|
<span className={styles.copyButtonIcons} aria-hidden="true">
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
</svg>
|
|
62
|
-
<svg className={styles.copyButtonSuccessIcon} viewBox="0 0 24 24">
|
|
63
|
-
<path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" />
|
|
64
|
-
</svg>
|
|
61
|
+
<IconCopy className={styles.copyButtonIcon} />
|
|
62
|
+
<IconSuccess className={styles.copyButtonSuccessIcon} />
|
|
65
63
|
</span>
|
|
66
64
|
</button>
|
|
67
65
|
);
|
|
@@ -9,6 +9,7 @@ import React from 'react';
|
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import {translate} from '@docusaurus/Translate';
|
|
11
11
|
import type {Props} from '@theme/CodeBlock/WordWrapButton';
|
|
12
|
+
import IconWordWrap from '@theme/Icon/WordWrap';
|
|
12
13
|
|
|
13
14
|
import styles from './styles.module.css';
|
|
14
15
|
|
|
@@ -35,15 +36,7 @@ export default function WordWrapButton({
|
|
|
35
36
|
)}
|
|
36
37
|
aria-label={title}
|
|
37
38
|
title={title}>
|
|
38
|
-
<
|
|
39
|
-
className={styles.wordWrapButtonIcon}
|
|
40
|
-
viewBox="0 0 24 24"
|
|
41
|
-
aria-hidden="true">
|
|
42
|
-
<path
|
|
43
|
-
fill="currentColor"
|
|
44
|
-
d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"
|
|
45
|
-
/>
|
|
46
|
-
</svg>
|
|
39
|
+
<IconWordWrap className={styles.wordWrapButtonIcon} aria-hidden="true" />
|
|
47
40
|
</button>
|
|
48
41
|
);
|
|
49
42
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import React, {type ReactNode, useState, useCallback} from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
|
-
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
10
|
+
import {prefersReducedMotion, ThemeClassNames} from '@docusaurus/theme-common';
|
|
11
11
|
import {useDocsSidebar} from '@docusaurus/theme-common/internal';
|
|
12
12
|
import {useLocation} from '@docusaurus/router';
|
|
13
13
|
import DocSidebar from '@theme/DocSidebar';
|
|
@@ -40,6 +40,11 @@ export default function DocPageLayoutSidebar({
|
|
|
40
40
|
if (hiddenSidebar) {
|
|
41
41
|
setHiddenSidebar(false);
|
|
42
42
|
}
|
|
43
|
+
// onTransitionEnd won't fire when sidebar animation is disabled
|
|
44
|
+
// fixes https://github.com/facebook/docusaurus/issues/8918
|
|
45
|
+
if (!hiddenSidebar && prefersReducedMotion()) {
|
|
46
|
+
setHiddenSidebar(true);
|
|
47
|
+
}
|
|
43
48
|
setHiddenSidebarContainer((value) => !value);
|
|
44
49
|
}, [setHiddenSidebarContainer, hiddenSidebar]);
|
|
45
50
|
|
|
@@ -15,3 +15,11 @@
|
|
|
15
15
|
display: flex;
|
|
16
16
|
flex: 1 0 auto;
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
JS disabled??? Show light version by default => better than showing nothing
|
|
21
|
+
TODO bad, but we currently always show light mode when there's no data-theme
|
|
22
|
+
*/
|
|
23
|
+
html:not([data-theme]) .themedComponent--light {
|
|
24
|
+
display: initial;
|
|
25
|
+
}
|
|
@@ -17,7 +17,7 @@ export default function DocPaginator(props: Props): JSX.Element {
|
|
|
17
17
|
className="pagination-nav docusaurus-mt-lg"
|
|
18
18
|
aria-label={translate({
|
|
19
19
|
id: 'theme.docs.paginator.navAriaLabel',
|
|
20
|
-
message: 'Docs pages
|
|
20
|
+
message: 'Docs pages',
|
|
21
21
|
description: 'The ARIA label for the docs pagination',
|
|
22
22
|
})}>
|
|
23
23
|
{previous && (
|
|
@@ -0,0 +1,20 @@
|
|
|
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 type {Props} from '@theme/Icon/Copy';
|
|
10
|
+
|
|
11
|
+
export default function IconCopy(props: Props): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<svg viewBox="0 0 24 24" {...props}>
|
|
14
|
+
<path
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 type {Props} from '@theme/Icon/Success';
|
|
10
|
+
|
|
11
|
+
export default function IconSuccess(props: Props): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<svg viewBox="0 0 24 24" {...props}>
|
|
14
|
+
<path
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 type {Props} from '@theme/Icon/WordWrap';
|
|
10
|
+
|
|
11
|
+
export default function IconWordWrap(props: Props): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<svg viewBox="0 0 24 24" {...props}>
|
|
14
|
+
<path
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -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
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
keyboardFocusedClassName,
|
|
17
17
|
} from '@docusaurus/theme-common/internal';
|
|
18
18
|
import {useLocation} from '@docusaurus/router';
|
|
19
|
+
import {applyTrailingSlash} from '@docusaurus/utils-common';
|
|
19
20
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
20
21
|
|
|
21
22
|
// TODO move to SiteMetadataDefaults or theme-common ?
|
|
@@ -58,10 +59,19 @@ function AlternateLangHeaders(): JSX.Element {
|
|
|
58
59
|
// Default canonical url inferred from current page location pathname
|
|
59
60
|
function useDefaultCanonicalUrl() {
|
|
60
61
|
const {
|
|
61
|
-
siteConfig: {url: siteUrl},
|
|
62
|
+
siteConfig: {url: siteUrl, baseUrl, trailingSlash},
|
|
62
63
|
} = useDocusaurusContext();
|
|
64
|
+
|
|
65
|
+
// TODO using useLocation().pathname is not a super idea
|
|
66
|
+
// See https://github.com/facebook/docusaurus/issues/9170
|
|
63
67
|
const {pathname} = useLocation();
|
|
64
|
-
|
|
68
|
+
|
|
69
|
+
const canonicalPathname = applyTrailingSlash(useBaseUrl(pathname), {
|
|
70
|
+
trailingSlash,
|
|
71
|
+
baseUrl,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return siteUrl + canonicalPathname;
|
|
65
75
|
}
|
|
66
76
|
|
|
67
77
|
// TODO move to SiteMetadataDefaults or theme-common ?
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -1322,6 +1322,14 @@ declare module '@theme/Icon/Close' {
|
|
|
1322
1322
|
export default function IconClose(props: Props): JSX.Element;
|
|
1323
1323
|
}
|
|
1324
1324
|
|
|
1325
|
+
declare module '@theme/Icon/Copy' {
|
|
1326
|
+
import type {ComponentProps} from 'react';
|
|
1327
|
+
|
|
1328
|
+
export interface Props extends ComponentProps<'svg'> {}
|
|
1329
|
+
|
|
1330
|
+
export default function IconCopy(props: Props): JSX.Element;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1325
1333
|
declare module '@theme/Icon/Language' {
|
|
1326
1334
|
import type {ComponentProps} from 'react';
|
|
1327
1335
|
|
|
@@ -1330,6 +1338,14 @@ declare module '@theme/Icon/Language' {
|
|
|
1330
1338
|
export default function IconLanguage(props: Props): JSX.Element;
|
|
1331
1339
|
}
|
|
1332
1340
|
|
|
1341
|
+
declare module '@theme/Icon/Success' {
|
|
1342
|
+
import type {ComponentProps} from 'react';
|
|
1343
|
+
|
|
1344
|
+
export interface Props extends ComponentProps<'svg'> {}
|
|
1345
|
+
|
|
1346
|
+
export default function IconSuccess(props: Props): JSX.Element;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1333
1349
|
declare module '@theme/Icon/ExternalLink' {
|
|
1334
1350
|
import type {ComponentProps} from 'react';
|
|
1335
1351
|
|
|
@@ -1338,6 +1354,14 @@ declare module '@theme/Icon/ExternalLink' {
|
|
|
1338
1354
|
export default function IconExternalLink(props: Props): JSX.Element;
|
|
1339
1355
|
}
|
|
1340
1356
|
|
|
1357
|
+
declare module '@theme/Icon/WordWrap' {
|
|
1358
|
+
import type {ComponentProps} from 'react';
|
|
1359
|
+
|
|
1360
|
+
export interface Props extends ComponentProps<'svg'> {}
|
|
1361
|
+
|
|
1362
|
+
export default function IconWordWrap(props: Props): JSX.Element;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1341
1365
|
declare module '@theme/TagsListByLetter' {
|
|
1342
1366
|
import type {TagsListItem} from '@docusaurus/utils';
|
|
1343
1367
|
|