@docusaurus/theme-classic 2.0.0-beta.16 → 2.0.0-beta.17
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 +64 -41
- package/lib/theme-classic.d.ts +17 -1
- package/lib/validateThemeConfig.js +4 -13
- package/lib-next/theme/BlogPostAuthor/index.js +18 -6
- package/lib-next/theme/ColorModeToggle/index.js +83 -0
- package/lib-next/theme/ColorModeToggle/styles.module.css +51 -0
- package/lib-next/theme/IconDarkMode/index.js +17 -0
- package/lib-next/theme/IconLanguage/index.js +3 -3
- package/lib-next/theme/IconLightMode/index.js +17 -0
- package/lib-next/theme/MDXComponents/index.js +15 -1
- package/lib-next/theme/Navbar/index.js +3 -3
- package/lib-next/theme/SearchMetadata/index.js +9 -0
- package/package.json +14 -14
- package/src/getSwizzleConfig.ts +53 -31
- package/src/theme/BlogPostAuthor/index.tsx +17 -7
- package/src/theme/ColorModeToggle/index.tsx +92 -0
- package/src/theme/ColorModeToggle/styles.module.css +51 -0
- package/src/theme/IconDarkMode/index.tsx +20 -0
- package/src/theme/IconLanguage/index.tsx +3 -3
- package/src/theme/IconLightMode/index.tsx +20 -0
- package/src/theme/MDXComponents/index.tsx +15 -1
- package/src/theme/Navbar/index.tsx +3 -3
- package/src/theme/SearchMetadata/index.tsx +9 -0
- package/src/theme-classic.d.ts +17 -1
- package/src/validateThemeConfig.ts +4 -20
- package/lib-next/theme/Toggle/index.js +0 -100
- package/lib-next/theme/Toggle/styles.module.css +0 -106
- package/src/theme/Toggle/index.tsx +0 -117
- package/src/theme/Toggle/styles.module.css +0 -106
package/lib/getSwizzleConfig.js
CHANGED
|
@@ -11,91 +11,114 @@ exports.default = getSwizzleConfig;
|
|
|
11
11
|
* This source code is licensed under the MIT license found in the
|
|
12
12
|
* LICENSE file in the root directory of this source tree.
|
|
13
13
|
*/
|
|
14
|
+
|
|
15
|
+
/* eslint sort-keys: "error" */
|
|
14
16
|
function getSwizzleConfig() {
|
|
15
17
|
return {
|
|
16
18
|
components: {
|
|
17
19
|
CodeBlock: {
|
|
18
20
|
actions: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
eject: 'safe',
|
|
22
|
+
wrap: 'safe'
|
|
21
23
|
},
|
|
22
24
|
description: 'The component used to render multi-line code blocks, generally used in Markdown files.'
|
|
23
25
|
},
|
|
26
|
+
ColorModeToggle: {
|
|
27
|
+
actions: {
|
|
28
|
+
eject: 'safe',
|
|
29
|
+
wrap: 'safe'
|
|
30
|
+
},
|
|
31
|
+
description: 'The color mode toggle to switch between light and dark mode.'
|
|
32
|
+
},
|
|
24
33
|
DocSidebar: {
|
|
25
34
|
actions: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
eject: 'unsafe',
|
|
36
|
+
// too much technical code in sidebar, not very safe atm
|
|
37
|
+
wrap: 'safe'
|
|
29
38
|
},
|
|
30
39
|
description: 'The sidebar component on docs pages'
|
|
31
40
|
},
|
|
32
41
|
Footer: {
|
|
33
42
|
actions: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
eject: 'unsafe',
|
|
44
|
+
// TODO split footer into smaller parts
|
|
45
|
+
wrap: 'safe'
|
|
37
46
|
},
|
|
38
47
|
description: "The footer component of you site's layout"
|
|
39
48
|
},
|
|
40
|
-
|
|
41
|
-
actions: {
|
|
42
|
-
wrap: 'safe',
|
|
43
|
-
eject: 'safe'
|
|
44
|
-
},
|
|
45
|
-
description: 'The global 404 page of your site, meant to be ejected and customized'
|
|
46
|
-
},
|
|
47
|
-
SearchBar: {
|
|
49
|
+
IconArrow: {
|
|
48
50
|
actions: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
eject: 'safe',
|
|
52
|
+
wrap: 'safe'
|
|
51
53
|
},
|
|
52
|
-
|
|
53
|
-
// By default it's an empty placeholder for the user to fill
|
|
54
|
-
description: 'The search bar component of your site, appearing in the navbar.'
|
|
54
|
+
description: 'The arrow icon component'
|
|
55
55
|
},
|
|
56
|
-
|
|
56
|
+
IconDarkMode: {
|
|
57
57
|
actions: {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
eject: 'safe',
|
|
59
|
+
wrap: 'safe'
|
|
60
60
|
},
|
|
61
|
-
description: 'The
|
|
61
|
+
description: 'The dark mode icon component.'
|
|
62
62
|
},
|
|
63
63
|
IconEdit: {
|
|
64
64
|
actions: {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
eject: 'safe',
|
|
66
|
+
wrap: 'safe'
|
|
67
67
|
},
|
|
68
68
|
description: 'The edit icon component'
|
|
69
69
|
},
|
|
70
|
-
|
|
70
|
+
IconLightMode: {
|
|
71
71
|
actions: {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
eject: 'safe',
|
|
73
|
+
wrap: 'safe'
|
|
74
74
|
},
|
|
75
|
-
description: 'The
|
|
75
|
+
description: 'The light mode icon component.'
|
|
76
76
|
},
|
|
77
|
-
|
|
77
|
+
IconMenu: {
|
|
78
78
|
actions: {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
eject: 'safe'
|
|
79
|
+
eject: 'safe',
|
|
80
|
+
wrap: 'safe'
|
|
82
81
|
},
|
|
83
|
-
description: 'The
|
|
82
|
+
description: 'The menu icon component'
|
|
84
83
|
},
|
|
85
84
|
MDXComponents: {
|
|
86
85
|
actions: {
|
|
87
|
-
|
|
88
|
-
/// TODO allow wrapping objects???
|
|
89
|
-
|
|
86
|
+
eject: 'safe',
|
|
87
|
+
wrap: 'forbidden' /// TODO allow wrapping objects???
|
|
88
|
+
|
|
90
89
|
},
|
|
91
90
|
description: 'The MDX components to use for rendering MDX files. Meant to be ejected.'
|
|
92
91
|
},
|
|
93
92
|
// TODO should probably not even appear here
|
|
94
93
|
'NavbarItem/utils': {
|
|
95
94
|
actions: {
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
eject: 'forbidden',
|
|
96
|
+
wrap: 'forbidden'
|
|
98
97
|
}
|
|
98
|
+
},
|
|
99
|
+
NotFound: {
|
|
100
|
+
actions: {
|
|
101
|
+
eject: 'safe',
|
|
102
|
+
wrap: 'safe'
|
|
103
|
+
},
|
|
104
|
+
description: 'The global 404 page of your site, meant to be ejected and customized'
|
|
105
|
+
},
|
|
106
|
+
SearchBar: {
|
|
107
|
+
actions: {
|
|
108
|
+
eject: 'safe',
|
|
109
|
+
wrap: 'safe'
|
|
110
|
+
},
|
|
111
|
+
// TODO how to describe this one properly?
|
|
112
|
+
// By default it's an empty placeholder for the user to fill
|
|
113
|
+
description: 'The search bar component of your site, appearing in the navbar.'
|
|
114
|
+
},
|
|
115
|
+
'prism-include-languages': {
|
|
116
|
+
actions: {
|
|
117
|
+
eject: 'safe',
|
|
118
|
+
wrap: 'forbidden' // not a component!
|
|
119
|
+
|
|
120
|
+
},
|
|
121
|
+
description: 'The Prism languages to include for code block syntax highlighting. Meant to be ejected.'
|
|
99
122
|
}
|
|
100
123
|
}
|
|
101
124
|
};
|
package/lib/theme-classic.d.ts
CHANGED
|
@@ -632,7 +632,7 @@ declare module '@theme/TOCCollapsible' {
|
|
|
632
632
|
export default function TOCCollapsible(props: Props): JSX.Element;
|
|
633
633
|
}
|
|
634
634
|
|
|
635
|
-
declare module '@theme/
|
|
635
|
+
declare module '@theme/ColorModeToggle' {
|
|
636
636
|
import type {SyntheticEvent} from 'react';
|
|
637
637
|
|
|
638
638
|
export interface Props {
|
|
@@ -663,6 +663,14 @@ declare module '@theme/IconArrow' {
|
|
|
663
663
|
export default function IconArrow(props: Props): JSX.Element;
|
|
664
664
|
}
|
|
665
665
|
|
|
666
|
+
declare module '@theme/IconDarkMode' {
|
|
667
|
+
import type {ComponentProps} from 'react';
|
|
668
|
+
|
|
669
|
+
export interface Props extends ComponentProps<'svg'> {}
|
|
670
|
+
|
|
671
|
+
export default function IconDarkMode(props: Props): JSX.Element;
|
|
672
|
+
}
|
|
673
|
+
|
|
666
674
|
declare module '@theme/IconEdit' {
|
|
667
675
|
import type {ComponentProps} from 'react';
|
|
668
676
|
|
|
@@ -671,6 +679,14 @@ declare module '@theme/IconEdit' {
|
|
|
671
679
|
export default function IconEdit(props: Props): JSX.Element;
|
|
672
680
|
}
|
|
673
681
|
|
|
682
|
+
declare module '@theme/IconLightMode' {
|
|
683
|
+
import type {ComponentProps} from 'react';
|
|
684
|
+
|
|
685
|
+
export interface Props extends ComponentProps<'svg'> {}
|
|
686
|
+
|
|
687
|
+
export default function IconLightMode(props: Props): JSX.Element;
|
|
688
|
+
}
|
|
689
|
+
|
|
674
690
|
declare module '@theme/IconMenu' {
|
|
675
691
|
import type {ComponentProps} from 'react';
|
|
676
692
|
|
|
@@ -25,13 +25,7 @@ const DocsSchema = _utilsValidation.Joi.object({
|
|
|
25
25
|
const DEFAULT_COLOR_MODE_CONFIG = {
|
|
26
26
|
defaultMode: 'light',
|
|
27
27
|
disableSwitch: false,
|
|
28
|
-
respectPrefersColorScheme: false
|
|
29
|
-
switchConfig: {
|
|
30
|
-
darkIcon: '🌜',
|
|
31
|
-
darkIconStyle: {},
|
|
32
|
-
lightIcon: '🌞',
|
|
33
|
-
lightIconStyle: {}
|
|
34
|
-
}
|
|
28
|
+
respectPrefersColorScheme: false
|
|
35
29
|
};
|
|
36
30
|
const DEFAULT_CONFIG = {
|
|
37
31
|
colorMode: DEFAULT_COLOR_MODE_CONFIG,
|
|
@@ -189,12 +183,9 @@ const ColorModeSchema = _utilsValidation.Joi.object({
|
|
|
189
183
|
defaultMode: _utilsValidation.Joi.string().equal('dark', 'light').default(DEFAULT_COLOR_MODE_CONFIG.defaultMode),
|
|
190
184
|
disableSwitch: _utilsValidation.Joi.bool().default(DEFAULT_COLOR_MODE_CONFIG.disableSwitch),
|
|
191
185
|
respectPrefersColorScheme: _utilsValidation.Joi.bool().default(DEFAULT_COLOR_MODE_CONFIG.respectPrefersColorScheme),
|
|
192
|
-
switchConfig: _utilsValidation.Joi.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
lightIcon: _utilsValidation.Joi.string().default(DEFAULT_COLOR_MODE_CONFIG.switchConfig.lightIcon),
|
|
196
|
-
lightIconStyle: _utilsValidation.Joi.object().default(DEFAULT_COLOR_MODE_CONFIG.switchConfig.lightIconStyle)
|
|
197
|
-
}).default(DEFAULT_COLOR_MODE_CONFIG.switchConfig)
|
|
186
|
+
switchConfig: _utilsValidation.Joi.any().forbidden().messages({
|
|
187
|
+
'any.unknown': 'colorMode.switchConfig is deprecated. If you want to customize the icons for light and dark mode, swizzle IconLightMode, IconDarkMode, or ColorModeToggle instead.'
|
|
188
|
+
})
|
|
198
189
|
}).default(DEFAULT_COLOR_MODE_CONFIG); // schema can probably be improved
|
|
199
190
|
|
|
200
191
|
|
|
@@ -7,14 +7,26 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import Link from '@docusaurus/Link';
|
|
9
9
|
import styles from './styles.module.css';
|
|
10
|
+
|
|
11
|
+
function MaybeLink(props) {
|
|
12
|
+
if (props.href) {
|
|
13
|
+
return <Link {...props} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return <>{props.children}</>;
|
|
17
|
+
}
|
|
18
|
+
|
|
10
19
|
export default function BlogPostAuthor({author}) {
|
|
11
|
-
const {name, title, url, imageURL} = author;
|
|
20
|
+
const {name, title, url, imageURL, email} = author;
|
|
21
|
+
const link = url || (email && `mailto:${email}`) || undefined;
|
|
12
22
|
return (
|
|
13
23
|
<div className="avatar margin-bottom--sm">
|
|
14
24
|
{imageURL && (
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
25
|
+
<span className="avatar__photo-link avatar__photo">
|
|
26
|
+
<MaybeLink href={link}>
|
|
27
|
+
<img className={styles.image} src={imageURL} alt={name} />
|
|
28
|
+
</MaybeLink>
|
|
29
|
+
</span>
|
|
18
30
|
)}
|
|
19
31
|
|
|
20
32
|
{name && (
|
|
@@ -24,9 +36,9 @@ export default function BlogPostAuthor({author}) {
|
|
|
24
36
|
itemScope
|
|
25
37
|
itemType="https://schema.org/Person">
|
|
26
38
|
<div className="avatar__name">
|
|
27
|
-
<
|
|
39
|
+
<MaybeLink href={link} itemProp="url">
|
|
28
40
|
<span itemProp="name">{name}</span>
|
|
29
|
-
</
|
|
41
|
+
</MaybeLink>
|
|
30
42
|
</div>
|
|
31
43
|
{title && (
|
|
32
44
|
<small className="avatar__subtitle" itemProp="description">
|
|
@@ -0,0 +1,83 @@
|
|
|
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, {useState, useRef, useEffect} from 'react';
|
|
8
|
+
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
9
|
+
import {translate} from '@docusaurus/Translate';
|
|
10
|
+
import IconLightMode from '@theme/IconLightMode';
|
|
11
|
+
import IconDarkMode from '@theme/IconDarkMode';
|
|
12
|
+
import clsx from 'clsx';
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
|
+
|
|
15
|
+
function ColorModeToggle({className, checked: defaultChecked, onChange}) {
|
|
16
|
+
const isBrowser = useIsBrowser();
|
|
17
|
+
const [checked, setChecked] = useState(defaultChecked);
|
|
18
|
+
const [focused, setFocused] = useState(false);
|
|
19
|
+
const inputRef = useRef(null);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
setChecked(defaultChecked);
|
|
22
|
+
}, [defaultChecked]);
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
className={clsx(styles.toggle, className, {
|
|
26
|
+
[styles.toggleChecked]: checked,
|
|
27
|
+
[styles.toggleFocused]: focused,
|
|
28
|
+
[styles.toggleDisabled]: !isBrowser,
|
|
29
|
+
})}>
|
|
30
|
+
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
|
|
31
|
+
<div
|
|
32
|
+
className={styles.toggleButton}
|
|
33
|
+
role="button"
|
|
34
|
+
tabIndex={-1}
|
|
35
|
+
onClick={() => inputRef.current?.click()}>
|
|
36
|
+
<IconLightMode
|
|
37
|
+
className={clsx(styles.toggleIcon, styles.lightToggleIcon)}
|
|
38
|
+
/>
|
|
39
|
+
<IconDarkMode
|
|
40
|
+
className={clsx(styles.toggleIcon, styles.darkToggleIcon)}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<input
|
|
45
|
+
ref={inputRef}
|
|
46
|
+
checked={checked}
|
|
47
|
+
type="checkbox"
|
|
48
|
+
className={styles.toggleScreenReader}
|
|
49
|
+
aria-label={translate(
|
|
50
|
+
{
|
|
51
|
+
message: 'Switch between dark and light mode (currently {mode})',
|
|
52
|
+
id: 'theme.colorToggle.ariaLabel',
|
|
53
|
+
description: 'The ARIA label for the navbar color mode toggle',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
mode: checked
|
|
57
|
+
? translate({
|
|
58
|
+
message: 'dark mode',
|
|
59
|
+
id: 'theme.colorToggle.ariaLabel.mode.dark',
|
|
60
|
+
description: 'The name for the dark color mode',
|
|
61
|
+
})
|
|
62
|
+
: translate({
|
|
63
|
+
message: 'light mode',
|
|
64
|
+
id: 'theme.colorToggle.ariaLabel.mode.light',
|
|
65
|
+
description: 'The name for the light color mode',
|
|
66
|
+
}),
|
|
67
|
+
},
|
|
68
|
+
)}
|
|
69
|
+
onChange={onChange}
|
|
70
|
+
onClick={() => setChecked(!checked)}
|
|
71
|
+
onFocus={() => setFocused(true)}
|
|
72
|
+
onBlur={() => setFocused(false)}
|
|
73
|
+
onKeyDown={(e) => {
|
|
74
|
+
if (e.key === 'Enter') {
|
|
75
|
+
inputRef.current?.click();
|
|
76
|
+
}
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default React.memo(ColorModeToggle);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.toggle {
|
|
9
|
+
position: relative;
|
|
10
|
+
width: 32px;
|
|
11
|
+
height: 32px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.toggleScreenReader {
|
|
15
|
+
border: 0;
|
|
16
|
+
clip: rect(0 0 0 0);
|
|
17
|
+
height: 1px;
|
|
18
|
+
margin: -1px;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
position: absolute;
|
|
21
|
+
width: 1px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.toggleDisabled {
|
|
25
|
+
cursor: not-allowed;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.toggleButton {
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
user-select: none;
|
|
31
|
+
-webkit-tap-highlight-color: transparent;
|
|
32
|
+
align-items: center;
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
border-radius: 50%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.toggleButton:hover {
|
|
41
|
+
background-color: #00000010;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[data-theme='dark'] .toggleButton:hover {
|
|
45
|
+
background-color: #ffffff20;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[data-theme='light'] .darkToggleIcon,
|
|
49
|
+
[data-theme='dark'] .lightToggleIcon {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
@@ -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 IconDarkMode(props) {
|
|
9
|
+
return (
|
|
10
|
+
<svg viewBox="0 0 24 24" width={24} height={24} {...props}>
|
|
11
|
+
<path
|
|
12
|
+
fill="currentColor"
|
|
13
|
+
d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"
|
|
14
|
+
/>
|
|
15
|
+
</svg>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -8,14 +8,14 @@ import React from 'react';
|
|
|
8
8
|
export default function IconLanguage({width = 20, height = 20, ...props}) {
|
|
9
9
|
return (
|
|
10
10
|
<svg
|
|
11
|
-
viewBox="0 0
|
|
11
|
+
viewBox="0 0 24 24"
|
|
12
12
|
width={width}
|
|
13
13
|
height={height}
|
|
14
|
-
aria-hidden
|
|
14
|
+
aria-hidden
|
|
15
15
|
{...props}>
|
|
16
16
|
<path
|
|
17
17
|
fill="currentColor"
|
|
18
|
-
d="
|
|
18
|
+
d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"
|
|
19
19
|
/>
|
|
20
20
|
</svg>
|
|
21
21
|
);
|
|
@@ -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 IconLightMode(props) {
|
|
9
|
+
return (
|
|
10
|
+
<svg viewBox="0 0 24 24" width={24} height={24} {...props}>
|
|
11
|
+
<path
|
|
12
|
+
fill="currentColor"
|
|
13
|
+
d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"
|
|
14
|
+
/>
|
|
15
|
+
</svg>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -30,8 +30,22 @@ const MDXComponents = {
|
|
|
30
30
|
return <Head {...props}>{unwrappedChildren}</Head>;
|
|
31
31
|
},
|
|
32
32
|
code: (props) => {
|
|
33
|
+
const inlineElements = [
|
|
34
|
+
'a',
|
|
35
|
+
'b',
|
|
36
|
+
'big',
|
|
37
|
+
'i',
|
|
38
|
+
'span',
|
|
39
|
+
'em',
|
|
40
|
+
'strong',
|
|
41
|
+
'sup',
|
|
42
|
+
'sub',
|
|
43
|
+
'small',
|
|
44
|
+
];
|
|
33
45
|
const shouldBeInline = React.Children.toArray(props.children).every(
|
|
34
|
-
(el) =>
|
|
46
|
+
(el) =>
|
|
47
|
+
(typeof el === 'string' && !el.includes('\n')) ||
|
|
48
|
+
(React.isValidElement(el) && inlineElements.includes(el.props.mdxType)),
|
|
35
49
|
);
|
|
36
50
|
return shouldBeInline ? <code {...props} /> : <CodeBlock {...props} />;
|
|
37
51
|
},
|
|
@@ -8,7 +8,7 @@ import React, {useCallback, useState, useEffect} from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import Translate from '@docusaurus/Translate';
|
|
10
10
|
import SearchBar from '@theme/SearchBar';
|
|
11
|
-
import
|
|
11
|
+
import ColorModeToggle from '@theme/ColorModeToggle';
|
|
12
12
|
import {
|
|
13
13
|
useThemeConfig,
|
|
14
14
|
useMobileSecondaryMenuRenderer,
|
|
@@ -157,7 +157,7 @@ function NavbarMobileSidebar({sidebarShown, toggleSidebar}) {
|
|
|
157
157
|
titleClassName="navbar__title"
|
|
158
158
|
/>
|
|
159
159
|
{!colorModeToggle.disabled && (
|
|
160
|
-
<
|
|
160
|
+
<ColorModeToggle
|
|
161
161
|
className={styles.navbarSidebarToggle}
|
|
162
162
|
checked={colorModeToggle.isDarkTheme}
|
|
163
163
|
onChange={colorModeToggle.toggle}
|
|
@@ -254,7 +254,7 @@ export default function Navbar() {
|
|
|
254
254
|
<NavbarItem {...item} key={i} />
|
|
255
255
|
))}
|
|
256
256
|
{!colorModeToggle.disabled && (
|
|
257
|
-
<
|
|
257
|
+
<ColorModeToggle
|
|
258
258
|
className={styles.toggle}
|
|
259
259
|
checked={colorModeToggle.isDarkTheme}
|
|
260
260
|
onChange={colorModeToggle.toggle}
|
|
@@ -17,6 +17,15 @@ export default function SearchMetadata({locale, version, tag}) {
|
|
|
17
17
|
const language = locale;
|
|
18
18
|
return (
|
|
19
19
|
<Head>
|
|
20
|
+
{/*
|
|
21
|
+
Docusaurus metadata, used by third-party search plugin
|
|
22
|
+
See https://github.com/cmfcmf/docusaurus-search-local/issues/99
|
|
23
|
+
*/}
|
|
24
|
+
{locale && <meta name="docusaurus_locale" content={locale} />}
|
|
25
|
+
{version && <meta name="docusaurus_version" content={version} />}
|
|
26
|
+
{tag && <meta name="docusaurus_tag" content={tag} />}
|
|
27
|
+
|
|
28
|
+
{/* Algolia DocSearch metadata */}
|
|
20
29
|
{language && <meta name="docsearch:language" content={language} />}
|
|
21
30
|
{version && <meta name="docsearch:version" content={version} />}
|
|
22
31
|
{tag && <meta name="docsearch:docusaurus_tag" content={tag} />}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.17",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -21,29 +21,29 @@
|
|
|
21
21
|
"format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@docusaurus/core": "2.0.0-beta.
|
|
25
|
-
"@docusaurus/plugin-content-blog": "2.0.0-beta.
|
|
26
|
-
"@docusaurus/plugin-content-docs": "2.0.0-beta.
|
|
27
|
-
"@docusaurus/plugin-content-pages": "2.0.0-beta.
|
|
28
|
-
"@docusaurus/theme-common": "2.0.0-beta.
|
|
29
|
-
"@docusaurus/theme-translations": "2.0.0-beta.
|
|
30
|
-
"@docusaurus/utils": "2.0.0-beta.
|
|
31
|
-
"@docusaurus/utils-common": "2.0.0-beta.
|
|
32
|
-
"@docusaurus/utils-validation": "2.0.0-beta.
|
|
24
|
+
"@docusaurus/core": "2.0.0-beta.17",
|
|
25
|
+
"@docusaurus/plugin-content-blog": "2.0.0-beta.17",
|
|
26
|
+
"@docusaurus/plugin-content-docs": "2.0.0-beta.17",
|
|
27
|
+
"@docusaurus/plugin-content-pages": "2.0.0-beta.17",
|
|
28
|
+
"@docusaurus/theme-common": "2.0.0-beta.17",
|
|
29
|
+
"@docusaurus/theme-translations": "2.0.0-beta.17",
|
|
30
|
+
"@docusaurus/utils": "2.0.0-beta.17",
|
|
31
|
+
"@docusaurus/utils-common": "2.0.0-beta.17",
|
|
32
|
+
"@docusaurus/utils-validation": "2.0.0-beta.17",
|
|
33
33
|
"@mdx-js/react": "^1.6.22",
|
|
34
34
|
"clsx": "^1.1.1",
|
|
35
35
|
"copy-text-to-clipboard": "^3.0.1",
|
|
36
36
|
"infima": "0.2.0-alpha.37",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
38
|
-
"postcss": "^8.4.
|
|
38
|
+
"postcss": "^8.4.7",
|
|
39
39
|
"prism-react-renderer": "^1.2.1",
|
|
40
40
|
"prismjs": "^1.27.0",
|
|
41
41
|
"react-router-dom": "^5.2.0",
|
|
42
42
|
"rtlcss": "^3.3.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@docusaurus/module-type-aliases": "2.0.0-beta.
|
|
46
|
-
"@docusaurus/types": "2.0.0-beta.
|
|
45
|
+
"@docusaurus/module-type-aliases": "2.0.0-beta.17",
|
|
46
|
+
"@docusaurus/types": "2.0.0-beta.17",
|
|
47
47
|
"@types/mdx-js__react": "^1.5.5",
|
|
48
48
|
"@types/prismjs": "^1.26.0",
|
|
49
49
|
"@types/rtlcss": "^3.1.2",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=14"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "0032c0b0480083227af2e1b4da2d3ee6ce992403"
|
|
63
63
|
}
|