@docusaurus/theme-classic 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/getSwizzleConfig.js +42 -1
- package/lib/theme/AnnouncementBar/styles.module.css +9 -1
- package/lib/theme/CodeBlock/Line/index.js +2 -4
- package/lib/theme/ColorModeToggle/index.js +2 -1
- package/lib/theme/DocBreadcrumbs/Items/Home/index.d.ts +8 -0
- package/lib/theme/DocBreadcrumbs/Items/Home/index.js +29 -0
- package/lib/theme/DocBreadcrumbs/Items/Home/styles.module.css +14 -0
- package/lib/theme/DocBreadcrumbs/index.js +1 -19
- package/lib/theme/DocBreadcrumbs/styles.module.css +0 -8
- package/lib/theme/DocPage/Layout/Sidebar/ExpandButton/styles.module.css +3 -2
- package/lib/theme/DocPage/Layout/Sidebar/index.js +13 -8
- package/lib/theme/DocPage/Layout/Sidebar/styles.module.css +7 -0
- package/lib/theme/DocPage/Layout/styles.module.css +1 -0
- package/lib/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +1 -0
- package/lib/theme/DocSidebar/Desktop/Content/index.js +6 -0
- package/lib/theme/DocSidebar/Desktop/styles.module.css +0 -6
- package/lib/theme/Heading/index.js +17 -8
- package/lib/theme/Layout/Provider/index.js +0 -2
- package/lib/theme/Layout/index.js +6 -1
- package/lib/theme/Layout/styles.module.css +2 -0
- package/lib/theme/MDXComponents/Code.js +24 -4
- package/lib/theme/MDXComponents/index.js +2 -0
- package/lib/theme/Mermaid.d.ts +7 -0
- package/lib/theme/Mermaid.js +13 -0
- package/lib/theme/Navbar/Layout/index.js +6 -0
- package/lib/theme/Navbar/MobileSidebar/Header/index.js +6 -0
- package/lib/theme/Navbar/MobileSidebar/Toggle/index.js +11 -6
- package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +4 -1
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +5 -1
- package/lib/theme/SkipToContent/index.js +2 -18
- package/lib/theme/Tabs/index.js +67 -131
- package/lib/theme/Tag/styles.module.css +1 -1
- package/package.json +14 -14
- package/src/getSwizzleConfig.ts +47 -1
- package/src/theme/AnnouncementBar/styles.module.css +9 -1
- package/src/theme/CodeBlock/Line/index.tsx +2 -4
- package/src/theme/ColorModeToggle/index.tsx +2 -1
- package/src/theme/DocBreadcrumbs/Items/Home/index.tsx +33 -0
- package/src/theme/DocBreadcrumbs/Items/Home/styles.module.css +14 -0
- package/src/theme/DocBreadcrumbs/index.tsx +1 -20
- package/src/theme/DocBreadcrumbs/styles.module.css +0 -8
- package/src/theme/DocPage/Layout/Sidebar/ExpandButton/styles.module.css +3 -2
- package/src/theme/DocPage/Layout/Sidebar/index.tsx +13 -8
- package/src/theme/DocPage/Layout/Sidebar/styles.module.css +7 -0
- package/src/theme/DocPage/Layout/styles.module.css +1 -0
- package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +1 -0
- package/src/theme/DocSidebar/Desktop/Content/index.tsx +6 -0
- package/src/theme/DocSidebar/Desktop/styles.module.css +0 -6
- package/src/theme/Heading/index.tsx +18 -8
- package/src/theme/Layout/Provider/index.tsx +0 -2
- package/src/theme/Layout/index.tsx +6 -1
- package/src/theme/Layout/styles.module.css +2 -0
- package/src/theme/MDXComponents/Code.tsx +24 -4
- package/src/theme/MDXComponents/index.tsx +2 -0
- package/src/theme/Mermaid.tsx +16 -0
- package/src/theme/Navbar/Layout/index.tsx +6 -0
- package/src/theme/Navbar/MobileSidebar/Header/index.tsx +6 -0
- package/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +11 -6
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +4 -1
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +5 -1
- package/src/theme/SkipToContent/index.tsx +2 -18
- package/src/theme/Tabs/index.tsx +87 -144
- package/src/theme/Tag/styles.module.css +1 -1
- package/src/theme-classic.d.ts +18 -25
|
@@ -5,24 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import
|
|
9
|
-
import {useSkipToContent} from '@docusaurus/theme-common/internal';
|
|
8
|
+
import {SkipToContentLink} from '@docusaurus/theme-common';
|
|
10
9
|
import styles from './styles.module.css';
|
|
11
10
|
export default function SkipToContent() {
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
ref={containerRef}
|
|
16
|
-
role="region"
|
|
17
|
-
aria-label={translate({id: 'theme.common.skipToMainContent'})}>
|
|
18
|
-
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
19
|
-
<a href="#" className={styles.skipToContent} onClick={handleSkip}>
|
|
20
|
-
<Translate
|
|
21
|
-
id="theme.common.skipToMainContent"
|
|
22
|
-
description="The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation">
|
|
23
|
-
Skip to main content
|
|
24
|
-
</Translate>
|
|
25
|
-
</a>
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
11
|
+
return <SkipToContentLink className={styles.skipToContent} />;
|
|
28
12
|
}
|
package/lib/theme/Tabs/index.js
CHANGED
|
@@ -4,104 +4,34 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, {
|
|
7
|
+
import React, {cloneElement} from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
10
|
-
import {duplicates} from '@docusaurus/theme-common';
|
|
11
9
|
import {
|
|
12
10
|
useScrollPositionBlocker,
|
|
13
|
-
|
|
11
|
+
useTabs,
|
|
14
12
|
} from '@docusaurus/theme-common/internal';
|
|
13
|
+
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
15
14
|
import styles from './styles.module.css';
|
|
16
|
-
|
|
17
|
-
// allowing customization
|
|
18
|
-
function isTabItem(comp) {
|
|
19
|
-
return 'value' in comp.props;
|
|
20
|
-
}
|
|
21
|
-
function TabsComponent(props) {
|
|
22
|
-
const {
|
|
23
|
-
lazy,
|
|
24
|
-
block,
|
|
25
|
-
defaultValue: defaultValueProp,
|
|
26
|
-
values: valuesProp,
|
|
27
|
-
groupId,
|
|
28
|
-
className,
|
|
29
|
-
} = props;
|
|
30
|
-
const children = React.Children.map(props.children, (child) => {
|
|
31
|
-
if (isValidElement(child) && isTabItem(child)) {
|
|
32
|
-
return child;
|
|
33
|
-
}
|
|
34
|
-
// child.type.name will give non-sensical values in prod because of
|
|
35
|
-
// minification, but we assume it won't throw in prod.
|
|
36
|
-
throw new Error(
|
|
37
|
-
`Docusaurus error: Bad <Tabs> child <${
|
|
38
|
-
// @ts-expect-error: guarding against unexpected cases
|
|
39
|
-
typeof child.type === 'string' ? child.type : child.type.name
|
|
40
|
-
}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`,
|
|
41
|
-
);
|
|
42
|
-
});
|
|
43
|
-
const values =
|
|
44
|
-
valuesProp ??
|
|
45
|
-
// Only pick keys that we recognize. MDX would inject some keys by default
|
|
46
|
-
children.map(({props: {value, label, attributes}}) => ({
|
|
47
|
-
value,
|
|
48
|
-
label,
|
|
49
|
-
attributes,
|
|
50
|
-
}));
|
|
51
|
-
const dup = duplicates(values, (a, b) => a.value === b.value);
|
|
52
|
-
if (dup.length > 0) {
|
|
53
|
-
throw new Error(
|
|
54
|
-
`Docusaurus error: Duplicate values "${dup
|
|
55
|
-
.map((a) => a.value)
|
|
56
|
-
.join(', ')}" found in <Tabs>. Every value needs to be unique.`,
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
// When defaultValueProp is null, don't show a default tab
|
|
60
|
-
const defaultValue =
|
|
61
|
-
defaultValueProp === null
|
|
62
|
-
? defaultValueProp
|
|
63
|
-
: defaultValueProp ??
|
|
64
|
-
children.find((child) => child.props.default)?.props.value ??
|
|
65
|
-
children[0].props.value;
|
|
66
|
-
if (defaultValue !== null && !values.some((a) => a.value === defaultValue)) {
|
|
67
|
-
throw new Error(
|
|
68
|
-
`Docusaurus error: The <Tabs> has a defaultValue "${defaultValue}" but none of its children has the corresponding value. Available values are: ${values
|
|
69
|
-
.map((a) => a.value)
|
|
70
|
-
.join(
|
|
71
|
-
', ',
|
|
72
|
-
)}. If you intend to show no default tab, use defaultValue={null} instead.`,
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
const {tabGroupChoices, setTabGroupChoices} = useTabGroupChoice();
|
|
76
|
-
const [selectedValue, setSelectedValue] = useState(defaultValue);
|
|
15
|
+
function TabList({className, block, selectedValue, selectValue, tabValues}) {
|
|
77
16
|
const tabRefs = [];
|
|
78
17
|
const {blockElementScrollPositionUntilNextRender} =
|
|
79
18
|
useScrollPositionBlocker();
|
|
80
|
-
if (groupId != null) {
|
|
81
|
-
const relevantTabGroupChoice = tabGroupChoices[groupId];
|
|
82
|
-
if (
|
|
83
|
-
relevantTabGroupChoice != null &&
|
|
84
|
-
relevantTabGroupChoice !== selectedValue &&
|
|
85
|
-
values.some((value) => value.value === relevantTabGroupChoice)
|
|
86
|
-
) {
|
|
87
|
-
setSelectedValue(relevantTabGroupChoice);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
19
|
const handleTabChange = (event) => {
|
|
91
20
|
const newTab = event.currentTarget;
|
|
92
21
|
const newTabIndex = tabRefs.indexOf(newTab);
|
|
93
|
-
const newTabValue =
|
|
22
|
+
const newTabValue = tabValues[newTabIndex].value;
|
|
94
23
|
if (newTabValue !== selectedValue) {
|
|
95
24
|
blockElementScrollPositionUntilNextRender(newTab);
|
|
96
|
-
|
|
97
|
-
if (groupId != null) {
|
|
98
|
-
setTabGroupChoices(groupId, String(newTabValue));
|
|
99
|
-
}
|
|
25
|
+
selectValue(newTabValue);
|
|
100
26
|
}
|
|
101
27
|
};
|
|
102
28
|
const handleKeydown = (event) => {
|
|
103
29
|
let focusElement = null;
|
|
104
30
|
switch (event.key) {
|
|
31
|
+
case 'Enter': {
|
|
32
|
+
handleTabChange(event);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
105
35
|
case 'ArrowRight': {
|
|
106
36
|
const nextTab = tabRefs.indexOf(event.currentTarget) + 1;
|
|
107
37
|
focusElement = tabRefs[nextTab] ?? tabRefs[0];
|
|
@@ -118,61 +48,67 @@ function TabsComponent(props) {
|
|
|
118
48
|
focusElement?.focus();
|
|
119
49
|
};
|
|
120
50
|
return (
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}),
|
|
170
|
-
)}
|
|
171
|
-
</div>
|
|
51
|
+
<ul
|
|
52
|
+
role="tablist"
|
|
53
|
+
aria-orientation="horizontal"
|
|
54
|
+
className={clsx(
|
|
55
|
+
'tabs',
|
|
56
|
+
{
|
|
57
|
+
'tabs--block': block,
|
|
58
|
+
},
|
|
59
|
+
className,
|
|
60
|
+
)}>
|
|
61
|
+
{tabValues.map(({value, label, attributes}) => (
|
|
62
|
+
<li
|
|
63
|
+
// TODO extract TabListItem
|
|
64
|
+
role="tab"
|
|
65
|
+
tabIndex={selectedValue === value ? 0 : -1}
|
|
66
|
+
aria-selected={selectedValue === value}
|
|
67
|
+
key={value}
|
|
68
|
+
ref={(tabControl) => tabRefs.push(tabControl)}
|
|
69
|
+
onKeyDown={handleKeydown}
|
|
70
|
+
onClick={handleTabChange}
|
|
71
|
+
{...attributes}
|
|
72
|
+
className={clsx('tabs__item', styles.tabItem, attributes?.className, {
|
|
73
|
+
'tabs__item--active': selectedValue === value,
|
|
74
|
+
})}>
|
|
75
|
+
{label ?? value}
|
|
76
|
+
</li>
|
|
77
|
+
))}
|
|
78
|
+
</ul>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
function TabContent({lazy, children, selectedValue}) {
|
|
82
|
+
if (lazy) {
|
|
83
|
+
const selectedTabItem = children.find(
|
|
84
|
+
(tabItem) => tabItem.props.value === selectedValue,
|
|
85
|
+
);
|
|
86
|
+
if (!selectedTabItem) {
|
|
87
|
+
// fail-safe or fail-fast? not sure what's best here
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
return cloneElement(selectedTabItem, {className: 'margin-top--md'});
|
|
91
|
+
}
|
|
92
|
+
return (
|
|
93
|
+
<div className="margin-top--md">
|
|
94
|
+
{children.map((tabItem, i) =>
|
|
95
|
+
cloneElement(tabItem, {
|
|
96
|
+
key: i,
|
|
97
|
+
hidden: tabItem.props.value !== selectedValue,
|
|
98
|
+
}),
|
|
172
99
|
)}
|
|
173
100
|
</div>
|
|
174
101
|
);
|
|
175
102
|
}
|
|
103
|
+
function TabsComponent(props) {
|
|
104
|
+
const tabs = useTabs(props);
|
|
105
|
+
return (
|
|
106
|
+
<div className={clsx('tabs-container', styles.tabList)}>
|
|
107
|
+
<TabList {...props} {...tabs} />
|
|
108
|
+
<TabContent {...props} {...tabs} />
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
176
112
|
export default function Tabs(props) {
|
|
177
113
|
const isBrowser = useIsBrowser();
|
|
178
114
|
return (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
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.
|
|
24
|
-
"@docusaurus/mdx-loader": "2.
|
|
25
|
-
"@docusaurus/module-type-aliases": "2.
|
|
26
|
-
"@docusaurus/plugin-content-blog": "2.
|
|
27
|
-
"@docusaurus/plugin-content-docs": "2.
|
|
28
|
-
"@docusaurus/plugin-content-pages": "2.
|
|
29
|
-
"@docusaurus/theme-common": "2.
|
|
30
|
-
"@docusaurus/theme-translations": "2.
|
|
31
|
-
"@docusaurus/types": "2.
|
|
32
|
-
"@docusaurus/utils": "2.
|
|
33
|
-
"@docusaurus/utils-common": "2.
|
|
34
|
-
"@docusaurus/utils-validation": "2.
|
|
23
|
+
"@docusaurus/core": "2.3.0",
|
|
24
|
+
"@docusaurus/mdx-loader": "2.3.0",
|
|
25
|
+
"@docusaurus/module-type-aliases": "2.3.0",
|
|
26
|
+
"@docusaurus/plugin-content-blog": "2.3.0",
|
|
27
|
+
"@docusaurus/plugin-content-docs": "2.3.0",
|
|
28
|
+
"@docusaurus/plugin-content-pages": "2.3.0",
|
|
29
|
+
"@docusaurus/theme-common": "2.3.0",
|
|
30
|
+
"@docusaurus/theme-translations": "2.3.0",
|
|
31
|
+
"@docusaurus/types": "2.3.0",
|
|
32
|
+
"@docusaurus/utils": "2.3.0",
|
|
33
|
+
"@docusaurus/utils-common": "2.3.0",
|
|
34
|
+
"@docusaurus/utils-validation": "2.3.0",
|
|
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": "ad477781bdca6a11fa9c6daef5048bdcec0ee37e"
|
|
66
66
|
}
|
package/src/getSwizzleConfig.ts
CHANGED
|
@@ -20,6 +20,14 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
20
20
|
description:
|
|
21
21
|
'The component used to render multi-line code blocks, generally used in Markdown files.',
|
|
22
22
|
},
|
|
23
|
+
'CodeBlock/Content': {
|
|
24
|
+
actions: {
|
|
25
|
+
eject: 'unsafe',
|
|
26
|
+
wrap: 'forbidden',
|
|
27
|
+
},
|
|
28
|
+
description:
|
|
29
|
+
'The folder containing components responsible for rendering different types of CodeBlock content.',
|
|
30
|
+
},
|
|
23
31
|
ColorModeToggle: {
|
|
24
32
|
actions: {
|
|
25
33
|
eject: 'safe',
|
|
@@ -28,6 +36,14 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
28
36
|
description:
|
|
29
37
|
'The color mode toggle to switch between light and dark mode.',
|
|
30
38
|
},
|
|
39
|
+
'DocBreadcrumbs/Items': {
|
|
40
|
+
actions: {
|
|
41
|
+
eject: 'unsafe',
|
|
42
|
+
wrap: 'forbidden', // Can't wrap a folder
|
|
43
|
+
},
|
|
44
|
+
description:
|
|
45
|
+
'The components responsible for rendering the breadcrumb items',
|
|
46
|
+
},
|
|
31
47
|
DocCardList: {
|
|
32
48
|
actions: {
|
|
33
49
|
eject: 'safe',
|
|
@@ -36,6 +52,17 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
36
52
|
description:
|
|
37
53
|
'The component responsible for rendering a list of sidebar items cards.\nNotable used on the category generated-index pages.',
|
|
38
54
|
},
|
|
55
|
+
'DocItem/TOC': {
|
|
56
|
+
actions: {
|
|
57
|
+
// Forbidden because it's a parent folder, makes the CLI crash atm
|
|
58
|
+
// TODO the CLI should rather support --eject
|
|
59
|
+
// Subfolders can be swizzled
|
|
60
|
+
eject: 'forbidden',
|
|
61
|
+
wrap: 'forbidden',
|
|
62
|
+
},
|
|
63
|
+
description:
|
|
64
|
+
'The DocItem TOC is not directly swizzle-able, but you can swizzle its sub-components.',
|
|
65
|
+
},
|
|
39
66
|
DocSidebar: {
|
|
40
67
|
actions: {
|
|
41
68
|
eject: 'unsafe', // Too much technical code in sidebar, not very safe atm
|
|
@@ -101,6 +128,17 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
101
128
|
},
|
|
102
129
|
description: 'The footer logo',
|
|
103
130
|
},
|
|
131
|
+
Icon: {
|
|
132
|
+
actions: {
|
|
133
|
+
// Forbidden because it's a parent folder, makes the CLI crash atm
|
|
134
|
+
// TODO the CLI should rather support --eject
|
|
135
|
+
// Subfolders can be swizzled
|
|
136
|
+
eject: 'forbidden',
|
|
137
|
+
wrap: 'forbidden',
|
|
138
|
+
},
|
|
139
|
+
description:
|
|
140
|
+
'The Icon folder is not directly swizzle-able, but you can swizzle its sub-components.',
|
|
141
|
+
},
|
|
104
142
|
'Icon/Arrow': {
|
|
105
143
|
actions: {
|
|
106
144
|
eject: 'safe',
|
|
@@ -220,7 +258,7 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
220
258
|
wrap: 'forbidden',
|
|
221
259
|
},
|
|
222
260
|
description:
|
|
223
|
-
'The Navbar item components mapping. Can be ejected to add custom navbar item types
|
|
261
|
+
'The Navbar item components mapping. Can be ejected to add custom navbar item types.\nSee https://github.com/facebook/docusaurus/issues/7227.',
|
|
224
262
|
},
|
|
225
263
|
NotFound: {
|
|
226
264
|
actions: {
|
|
@@ -240,6 +278,14 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
240
278
|
description:
|
|
241
279
|
'The search bar component of your site, appearing in the navbar.',
|
|
242
280
|
},
|
|
281
|
+
SkipToContent: {
|
|
282
|
+
actions: {
|
|
283
|
+
eject: 'safe',
|
|
284
|
+
wrap: 'safe',
|
|
285
|
+
},
|
|
286
|
+
description:
|
|
287
|
+
'The component responsible for implementing the accessibility "skip to content" link (https://www.w3.org/TR/WCAG20-TECHS/G1.html)',
|
|
288
|
+
},
|
|
243
289
|
'prism-include-languages': {
|
|
244
290
|
actions: {
|
|
245
291
|
eject: 'safe',
|
|
@@ -15,8 +15,16 @@
|
|
|
15
15
|
height: var(--docusaurus-announcement-bar-height);
|
|
16
16
|
background-color: var(--ifm-color-white);
|
|
17
17
|
color: var(--ifm-color-black);
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
Unfortunately we can't make announcement bar render above the navbar
|
|
21
|
+
IE need to use border-bottom instead of shadow
|
|
22
|
+
See https://github.com/facebookincubator/infima/issues/275
|
|
23
|
+
|
|
18
24
|
box-shadow: var(--ifm-global-shadow-lw);
|
|
19
|
-
z-index: calc(var(--ifm-z-index-fixed) + 1);
|
|
25
|
+
z-index: calc(var(--ifm-z-index-fixed) + 1);
|
|
26
|
+
*/
|
|
27
|
+
border-bottom: 1px solid var(--ifm-color-emphasis-100);
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
html[data-announcement-bar-initially-dismissed='true'] .announcementBar {
|
|
@@ -52,7 +52,8 @@ function ColorModeToggle({className, value, onChange}: Props): JSX.Element {
|
|
|
52
52
|
onClick={() => onChange(value === 'dark' ? 'light' : 'dark')}
|
|
53
53
|
disabled={!isBrowser}
|
|
54
54
|
title={title}
|
|
55
|
-
aria-label={title}
|
|
55
|
+
aria-label={title}
|
|
56
|
+
aria-live="polite">
|
|
56
57
|
<IconLightMode
|
|
57
58
|
className={clsx(styles.toggleIcon, styles.lightToggleIcon)}
|
|
58
59
|
/>
|
|
@@ -0,0 +1,33 @@
|
|
|
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 Link from '@docusaurus/Link';
|
|
10
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
11
|
+
import {translate} from '@docusaurus/Translate';
|
|
12
|
+
import IconHome from '@theme/Icon/Home';
|
|
13
|
+
|
|
14
|
+
import styles from './styles.module.css';
|
|
15
|
+
|
|
16
|
+
export default function HomeBreadcrumbItem(): JSX.Element {
|
|
17
|
+
const homeHref = useBaseUrl('/');
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<li className="breadcrumbs__item">
|
|
21
|
+
<Link
|
|
22
|
+
aria-label={translate({
|
|
23
|
+
id: 'theme.docs.breadcrumbs.home',
|
|
24
|
+
message: 'Home page',
|
|
25
|
+
description: 'The ARIA label for the home page in the breadcrumbs',
|
|
26
|
+
})}
|
|
27
|
+
className="breadcrumbs__link"
|
|
28
|
+
href={homeHref}>
|
|
29
|
+
<IconHome className={styles.breadcrumbHomeIcon} />
|
|
30
|
+
</Link>
|
|
31
|
+
</li>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
.breadcrumbHomeIcon {
|
|
9
|
+
position: relative;
|
|
10
|
+
top: 1px;
|
|
11
|
+
vertical-align: top;
|
|
12
|
+
height: 1.1rem;
|
|
13
|
+
width: 1.1rem;
|
|
14
|
+
}
|
|
@@ -13,9 +13,8 @@ import {
|
|
|
13
13
|
useHomePageRoute,
|
|
14
14
|
} from '@docusaurus/theme-common/internal';
|
|
15
15
|
import Link from '@docusaurus/Link';
|
|
16
|
-
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
17
16
|
import {translate} from '@docusaurus/Translate';
|
|
18
|
-
import
|
|
17
|
+
import HomeBreadcrumbItem from '@theme/DocBreadcrumbs/Items/Home';
|
|
19
18
|
|
|
20
19
|
import styles from './styles.module.css';
|
|
21
20
|
|
|
@@ -79,24 +78,6 @@ function BreadcrumbsItem({
|
|
|
79
78
|
);
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
function HomeBreadcrumbItem() {
|
|
83
|
-
const homeHref = useBaseUrl('/');
|
|
84
|
-
return (
|
|
85
|
-
<li className="breadcrumbs__item">
|
|
86
|
-
<Link
|
|
87
|
-
aria-label={translate({
|
|
88
|
-
id: 'theme.docs.breadcrumbs.home',
|
|
89
|
-
message: 'Home page',
|
|
90
|
-
description: 'The ARIA label for the home page in the breadcrumbs',
|
|
91
|
-
})}
|
|
92
|
-
className={clsx('breadcrumbs__link', styles.breadcrumbsItemLink)}
|
|
93
|
-
href={homeHref}>
|
|
94
|
-
<IconHome className={styles.breadcrumbHomeIcon} />
|
|
95
|
-
</Link>
|
|
96
|
-
</li>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
81
|
export default function DocBreadcrumbs(): JSX.Element | null {
|
|
101
82
|
const breadcrumbs = useSidebarBreadcrumbs();
|
|
102
83
|
const homePageRoute = useHomePageRoute();
|
|
@@ -60,15 +60,20 @@ export default function DocPageLayoutSidebar({
|
|
|
60
60
|
}
|
|
61
61
|
}}>
|
|
62
62
|
<ResetOnSidebarChange>
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
<div
|
|
64
|
+
className={clsx(
|
|
65
|
+
styles.sidebarViewport,
|
|
66
|
+
hiddenSidebar && styles.sidebarViewportHidden,
|
|
67
|
+
)}>
|
|
68
|
+
<DocSidebar
|
|
69
|
+
sidebar={sidebar}
|
|
70
|
+
path={pathname}
|
|
71
|
+
onCollapse={toggleSidebar}
|
|
72
|
+
isHidden={hiddenSidebar}
|
|
73
|
+
/>
|
|
74
|
+
{hiddenSidebar && <ExpandButton toggleSidebar={toggleSidebar} />}
|
|
75
|
+
</div>
|
|
69
76
|
</ResetOnSidebarChange>
|
|
70
|
-
|
|
71
|
-
{hiddenSidebar && <ExpandButton toggleSidebar={toggleSidebar} />}
|
|
72
77
|
</aside>
|
|
73
78
|
);
|
|
74
79
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
useAnnouncementBar,
|
|
13
13
|
useScrollPosition,
|
|
14
14
|
} from '@docusaurus/theme-common/internal';
|
|
15
|
+
import {translate} from '@docusaurus/Translate';
|
|
15
16
|
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
16
17
|
import type {Props} from '@theme/DocSidebar/Desktop/Content';
|
|
17
18
|
|
|
@@ -41,6 +42,11 @@ export default function DocSidebarDesktopContent({
|
|
|
41
42
|
|
|
42
43
|
return (
|
|
43
44
|
<nav
|
|
45
|
+
aria-label={translate({
|
|
46
|
+
id: 'theme.docs.sidebar.navAriaLabel',
|
|
47
|
+
message: 'Docs sidebar',
|
|
48
|
+
description: 'The ARIA label for the sidebar navigation',
|
|
49
|
+
})}
|
|
44
50
|
className={clsx(
|
|
45
51
|
'menu thin-scrollbar',
|
|
46
52
|
styles.menu,
|
|
@@ -9,13 +9,9 @@
|
|
|
9
9
|
.sidebar {
|
|
10
10
|
display: flex;
|
|
11
11
|
flex-direction: column;
|
|
12
|
-
max-height: 100vh;
|
|
13
12
|
height: 100%;
|
|
14
|
-
position: sticky;
|
|
15
|
-
top: 0;
|
|
16
13
|
padding-top: var(--ifm-navbar-height);
|
|
17
14
|
width: var(--doc-sidebar-width);
|
|
18
|
-
transition: opacity 50ms ease;
|
|
19
15
|
}
|
|
20
16
|
|
|
21
17
|
.sidebarWithHideableNavbar {
|
|
@@ -24,8 +20,6 @@
|
|
|
24
20
|
|
|
25
21
|
.sidebarHidden {
|
|
26
22
|
opacity: 0;
|
|
27
|
-
height: 0;
|
|
28
|
-
overflow: hidden;
|
|
29
23
|
visibility: hidden;
|
|
30
24
|
}
|
|
31
25
|
|