@docusaurus/theme-classic 0.0.0-4927 → 0.0.0-4930
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-classic.d.ts +37 -2
- package/lib-next/theme/DocPage/Layout/Main.js +1 -1
- package/lib-next/theme/DocPage/Layout/Main.module.css +28 -0
- package/lib-next/theme/DocPage/Layout/Sidebar/ExpandButton.js +34 -0
- package/lib-next/theme/DocPage/Layout/Sidebar/ExpandButton.module.css +37 -0
- package/lib-next/theme/DocPage/Layout/{Aside.js → Sidebar/index.js} +5 -31
- package/lib-next/theme/DocPage/Layout/Sidebar/index.module.css +32 -0
- package/lib-next/theme/DocPage/Layout/index.js +3 -3
- package/lib-next/theme/DocPage/Layout/index.module.css +15 -0
- package/lib-next/theme/DocPage/index.js +2 -32
- package/lib-next/theme/TOCCollapsible/CollapseButton.js +29 -0
- package/{src/theme/TOCCollapsible/styles.module.css → lib-next/theme/TOCCollapsible/CollapseButton.module.css} +1 -22
- package/lib-next/theme/TOCCollapsible/index.js +3 -13
- package/lib-next/theme/TOCCollapsible/index.module.css +31 -0
- package/lib-next/theme/TOCItems/Tree.js +41 -0
- package/lib-next/theme/TOCItems/index.js +3 -34
- package/package.json +13 -13
- package/src/theme/DocPage/Layout/Main.module.css +28 -0
- package/src/theme/DocPage/Layout/Main.tsx +1 -1
- package/src/theme/DocPage/Layout/Sidebar/ExpandButton.module.css +37 -0
- package/src/theme/DocPage/Layout/Sidebar/ExpandButton.tsx +40 -0
- package/src/theme/DocPage/Layout/Sidebar/index.module.css +32 -0
- package/src/theme/DocPage/Layout/{Aside.tsx → Sidebar/index.tsx} +5 -31
- package/src/theme/DocPage/Layout/index.module.css +15 -0
- package/src/theme/DocPage/Layout/index.tsx +3 -3
- package/src/theme/DocPage/index.tsx +2 -39
- package/src/theme/MDXComponents/Details.tsx +2 -3
- package/{lib-next/theme/TOCCollapsible/styles.module.css → src/theme/TOCCollapsible/CollapseButton.module.css} +1 -22
- package/src/theme/TOCCollapsible/CollapseButton.tsx +35 -0
- package/src/theme/TOCCollapsible/index.module.css +31 -0
- package/src/theme/TOCCollapsible/index.tsx +3 -14
- package/src/theme/TOCItems/Tree.tsx +46 -0
- package/src/theme/TOCItems/index.tsx +2 -41
- package/src/theme-classic.d.ts +37 -2
- package/lib-next/theme/DocPage/Layout/styles.module.css +0 -87
- package/src/theme/DocPage/Layout/styles.module.css +0 -87
package/lib/theme-classic.d.ts
CHANGED
|
@@ -268,7 +268,7 @@ declare module '@theme/DocPage/Layout' {
|
|
|
268
268
|
export default function DocPageLayout(props: Props): JSX.Element;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
declare module '@theme/DocPage/Layout/
|
|
271
|
+
declare module '@theme/DocPage/Layout/Sidebar' {
|
|
272
272
|
import type {Dispatch, SetStateAction} from 'react';
|
|
273
273
|
import type {PropSidebar} from '@docusaurus/plugin-content-docs';
|
|
274
274
|
|
|
@@ -278,7 +278,17 @@ declare module '@theme/DocPage/Layout/Aside' {
|
|
|
278
278
|
readonly setHiddenSidebarContainer: Dispatch<SetStateAction<boolean>>;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
export default function
|
|
281
|
+
export default function DocPageLayoutSidebar(props: Props): JSX.Element;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
declare module '@theme/DocPage/Layout/Sidebar/ExpandButton' {
|
|
285
|
+
export interface Props {
|
|
286
|
+
toggleSidebar: () => void;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export default function DocPageLayoutSidebarExpandButton(
|
|
290
|
+
props: Props,
|
|
291
|
+
): JSX.Element;
|
|
282
292
|
}
|
|
283
293
|
|
|
284
294
|
declare module '@theme/DocPage/Layout/Main' {
|
|
@@ -1061,6 +1071,19 @@ declare module '@theme/TOCItems' {
|
|
|
1061
1071
|
export default function TOCItems(props: Props): JSX.Element;
|
|
1062
1072
|
}
|
|
1063
1073
|
|
|
1074
|
+
declare module '@theme/TOCItems/Tree' {
|
|
1075
|
+
import type {TOCTreeNode} from '@docusaurus/theme-common';
|
|
1076
|
+
|
|
1077
|
+
export interface Props {
|
|
1078
|
+
readonly toc: readonly TOCTreeNode[];
|
|
1079
|
+
readonly className: string;
|
|
1080
|
+
readonly linkClassName: string | null;
|
|
1081
|
+
readonly isChild?: boolean;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
export default function TOCItems(props: Props): JSX.Element;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1064
1087
|
declare module '@theme/TOC' {
|
|
1065
1088
|
import type {TOCItem} from '@docusaurus/types';
|
|
1066
1089
|
|
|
@@ -1101,6 +1124,18 @@ declare module '@theme/TOCCollapsible' {
|
|
|
1101
1124
|
export default function TOCCollapsible(props: Props): JSX.Element;
|
|
1102
1125
|
}
|
|
1103
1126
|
|
|
1127
|
+
declare module '@theme/TOCCollapsible/CollapseButton' {
|
|
1128
|
+
import type {ComponentProps} from 'react';
|
|
1129
|
+
|
|
1130
|
+
export interface Props extends ComponentProps<'button'> {
|
|
1131
|
+
collapsed: boolean;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
export default function TOCCollapsibleCollapseButton(
|
|
1135
|
+
props: Props,
|
|
1136
|
+
): JSX.Element;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1104
1139
|
declare module '@theme/ColorModeToggle' {
|
|
1105
1140
|
import type {ColorMode} from '@docusaurus/theme-common';
|
|
1106
1141
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import {useDocsSidebar} from '@docusaurus/theme-common';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
|
-
import styles from './
|
|
10
|
+
import styles from './Main.module.css';
|
|
11
11
|
export default function DocPageLayoutMain({hiddenSidebarContainer, children}) {
|
|
12
12
|
const sidebar = useDocsSidebar();
|
|
13
13
|
return (
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
.docMainContainer {
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (min-width: 997px) {
|
|
14
|
+
.docMainContainer {
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
max-width: calc(100% - var(--doc-sidebar-width));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.docMainContainerEnhanced {
|
|
20
|
+
max-width: calc(100% - var(--doc-sidebar-hidden-width));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.docItemWrapperEnhanced {
|
|
24
|
+
max-width: calc(
|
|
25
|
+
var(--ifm-container-width) + var(--doc-sidebar-width)
|
|
26
|
+
) !important;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 IconArrow from '@theme/IconArrow';
|
|
9
|
+
import {translate} from '@docusaurus/Translate';
|
|
10
|
+
import styles from './ExpandButton.module.css';
|
|
11
|
+
export default function DocPageLayoutSidebarExpandButton({toggleSidebar}) {
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
className={styles.expandButton}
|
|
15
|
+
title={translate({
|
|
16
|
+
id: 'theme.docs.sidebar.expandButtonTitle',
|
|
17
|
+
message: 'Expand sidebar',
|
|
18
|
+
description:
|
|
19
|
+
'The ARIA label and title attribute for expand button of doc sidebar',
|
|
20
|
+
})}
|
|
21
|
+
aria-label={translate({
|
|
22
|
+
id: 'theme.docs.sidebar.expandButtonAriaLabel',
|
|
23
|
+
message: 'Expand sidebar',
|
|
24
|
+
description:
|
|
25
|
+
'The ARIA label and title attribute for expand button of doc sidebar',
|
|
26
|
+
})}
|
|
27
|
+
tabIndex={0}
|
|
28
|
+
role="button"
|
|
29
|
+
onKeyDown={toggleSidebar}
|
|
30
|
+
onClick={toggleSidebar}>
|
|
31
|
+
<IconArrow className={styles.expandButtonIcon} />
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
@media (min-width: 997px) {
|
|
9
|
+
.expandButton {
|
|
10
|
+
position: sticky;
|
|
11
|
+
top: 0;
|
|
12
|
+
height: 100%;
|
|
13
|
+
max-height: 100vh;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
transition: background-color var(--ifm-transition-fast) ease;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.expandButton:hover,
|
|
21
|
+
.expandButton:focus {
|
|
22
|
+
background-color: var(--ifm-color-emphasis-200);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.expandButtonIcon {
|
|
26
|
+
transform: rotate(0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[dir='rtl'] .expandButtonIcon {
|
|
30
|
+
transform: rotate(180deg);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[data-theme='dark'] .expandButton:hover,
|
|
34
|
+
[data-theme='dark'] .expandButton:focus {
|
|
35
|
+
background-color: var(--collapse-button-bg-color-dark);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -6,37 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, {useState, useCallback} from 'react';
|
|
8
8
|
import DocSidebar from '@theme/DocSidebar';
|
|
9
|
-
import IconArrow from '@theme/IconArrow';
|
|
10
|
-
import {translate} from '@docusaurus/Translate';
|
|
11
9
|
import {useLocation} from '@docusaurus/router';
|
|
10
|
+
import ExpandButton from '@theme/DocPage/Layout/Sidebar/ExpandButton';
|
|
12
11
|
import clsx from 'clsx';
|
|
13
|
-
import styles from './
|
|
14
|
-
import {ThemeClassNames, useDocsSidebar} from '@docusaurus/theme-common';
|
|
15
|
-
|
|
16
|
-
function SidebarExpandButton({toggleSidebar}) {
|
|
17
|
-
return (
|
|
18
|
-
<div
|
|
19
|
-
className={styles.collapsedDocSidebar}
|
|
20
|
-
title={translate({
|
|
21
|
-
id: 'theme.docs.sidebar.expandButtonTitle',
|
|
22
|
-
message: 'Expand sidebar',
|
|
23
|
-
description:
|
|
24
|
-
'The ARIA label and title attribute for expand button of doc sidebar',
|
|
25
|
-
})}
|
|
26
|
-
aria-label={translate({
|
|
27
|
-
id: 'theme.docs.sidebar.expandButtonAriaLabel',
|
|
28
|
-
message: 'Expand sidebar',
|
|
29
|
-
description:
|
|
30
|
-
'The ARIA label and title attribute for expand button of doc sidebar',
|
|
31
|
-
})}
|
|
32
|
-
tabIndex={0}
|
|
33
|
-
role="button"
|
|
34
|
-
onKeyDown={toggleSidebar}
|
|
35
|
-
onClick={toggleSidebar}>
|
|
36
|
-
<IconArrow className={styles.expandSidebarButtonIcon} />
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
} // Reset sidebar state when sidebar changes
|
|
12
|
+
import styles from './index.module.css';
|
|
13
|
+
import {ThemeClassNames, useDocsSidebar} from '@docusaurus/theme-common'; // Reset sidebar state when sidebar changes
|
|
40
14
|
// Use React key to unmount/remount the children
|
|
41
15
|
// See https://github.com/facebook/docusaurus/issues/3414
|
|
42
16
|
|
|
@@ -49,7 +23,7 @@ function ResetOnSidebarChange({children}) {
|
|
|
49
23
|
);
|
|
50
24
|
}
|
|
51
25
|
|
|
52
|
-
export default function
|
|
26
|
+
export default function DocPageLayoutSidebar({
|
|
53
27
|
sidebar,
|
|
54
28
|
hiddenSidebarContainer,
|
|
55
29
|
setHiddenSidebarContainer,
|
|
@@ -88,7 +62,7 @@ export default function DocPageLayoutAside({
|
|
|
88
62
|
/>
|
|
89
63
|
</ResetOnSidebarChange>
|
|
90
64
|
|
|
91
|
-
{hiddenSidebar && <
|
|
65
|
+
{hiddenSidebar && <ExpandButton toggleSidebar={toggleSidebar} />}
|
|
92
66
|
</aside>
|
|
93
67
|
);
|
|
94
68
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
:root {
|
|
9
|
+
--doc-sidebar-width: 300px;
|
|
10
|
+
--doc-sidebar-hidden-width: 30px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.docSidebarContainer {
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@media (min-width: 997px) {
|
|
18
|
+
.docSidebarContainer {
|
|
19
|
+
display: block;
|
|
20
|
+
width: var(--doc-sidebar-width);
|
|
21
|
+
margin-top: calc(-1 * var(--ifm-navbar-height));
|
|
22
|
+
border-right: 1px solid var(--ifm-toc-border-color);
|
|
23
|
+
will-change: width;
|
|
24
|
+
transition: width var(--ifm-transition-fast) ease;
|
|
25
|
+
clip-path: inset(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.docSidebarContainerHidden {
|
|
29
|
+
width: var(--doc-sidebar-hidden-width);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
import React, {useState} from 'react';
|
|
8
8
|
import Layout from '@theme/Layout';
|
|
9
9
|
import BackToTopButton from '@theme/BackToTopButton';
|
|
10
|
-
import
|
|
10
|
+
import DocPageLayoutSidebar from '@theme/DocPage/Layout/Sidebar';
|
|
11
11
|
import DocPageLayoutMain from '@theme/DocPage/Layout/Main';
|
|
12
|
-
import styles from './
|
|
12
|
+
import styles from './index.module.css';
|
|
13
13
|
import {useDocsSidebar} from '@docusaurus/theme-common';
|
|
14
14
|
export default function DocPageLayout({children}) {
|
|
15
15
|
const sidebar = useDocsSidebar();
|
|
@@ -19,7 +19,7 @@ export default function DocPageLayout({children}) {
|
|
|
19
19
|
<BackToTopButton />
|
|
20
20
|
<div className={styles.docPage}>
|
|
21
21
|
{sidebar && (
|
|
22
|
-
<
|
|
22
|
+
<DocPageLayoutSidebar
|
|
23
23
|
sidebar={sidebar.items}
|
|
24
24
|
hiddenSidebarContainer={hiddenSidebarContainer}
|
|
25
25
|
setHiddenSidebarContainer={setHiddenSidebarContainer}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
.docPage {
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.docsWrapper {
|
|
14
|
+
display: flex;
|
|
15
|
+
}
|
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import renderRoutes from '@docusaurus/renderRoutes';
|
|
9
8
|
import NotFound from '@theme/NotFound';
|
|
10
9
|
import DocPageLayout from '@theme/DocPage/Layout';
|
|
11
|
-
import {matchPath} from '@docusaurus/router';
|
|
12
10
|
import clsx from 'clsx';
|
|
13
11
|
import {
|
|
14
12
|
HtmlClassNameProvider,
|
|
@@ -16,40 +14,12 @@ import {
|
|
|
16
14
|
docVersionSearchTag,
|
|
17
15
|
DocsSidebarProvider,
|
|
18
16
|
DocsVersionProvider,
|
|
17
|
+
useDocRouteMetadata,
|
|
19
18
|
} from '@docusaurus/theme-common';
|
|
20
19
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
21
|
-
|
|
22
|
-
function extractDocRouteMetadata(props) {
|
|
23
|
-
const {
|
|
24
|
-
route: {routes: docRoutes},
|
|
25
|
-
versionMetadata,
|
|
26
|
-
location,
|
|
27
|
-
} = props;
|
|
28
|
-
const currentDocRoute = docRoutes.find((docRoute) =>
|
|
29
|
-
matchPath(location.pathname, docRoute),
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
if (!currentDocRoute) {
|
|
33
|
-
return null;
|
|
34
|
-
} // For now, the sidebarName is added as route config: not ideal!
|
|
35
|
-
|
|
36
|
-
const sidebarName = currentDocRoute.sidebar;
|
|
37
|
-
const sidebarItems = sidebarName
|
|
38
|
-
? versionMetadata.docsSidebars[sidebarName]
|
|
39
|
-
: undefined;
|
|
40
|
-
const docElement = renderRoutes(props.route.routes, {
|
|
41
|
-
versionMetadata,
|
|
42
|
-
});
|
|
43
|
-
return {
|
|
44
|
-
docElement,
|
|
45
|
-
sidebarName,
|
|
46
|
-
sidebarItems,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
20
|
export default function DocPage(props) {
|
|
51
21
|
const {versionMetadata} = props;
|
|
52
|
-
const currentDocRouteMetadata =
|
|
22
|
+
const currentDocRouteMetadata = useDocRouteMetadata(props);
|
|
53
23
|
|
|
54
24
|
if (!currentDocRouteMetadata) {
|
|
55
25
|
return <NotFound />;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 Translate from '@docusaurus/Translate';
|
|
10
|
+
import styles from './CollapseButton.module.css';
|
|
11
|
+
export default function TOCCollapsibleCollapseButton({collapsed, ...props}) {
|
|
12
|
+
return (
|
|
13
|
+
<button
|
|
14
|
+
type="button"
|
|
15
|
+
{...props}
|
|
16
|
+
className={clsx(
|
|
17
|
+
'clean-btn',
|
|
18
|
+
styles.tocCollapsibleButton,
|
|
19
|
+
!collapsed && styles.tocCollapsibleButtonExpanded,
|
|
20
|
+
props.className,
|
|
21
|
+
)}>
|
|
22
|
+
<Translate
|
|
23
|
+
id="theme.TOCCollapsible.toggleButtonLabel"
|
|
24
|
+
description="The label used by the button on the collapsible TOC component">
|
|
25
|
+
On this page
|
|
26
|
+
</Translate>
|
|
27
|
+
</button>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -5,12 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
.tocCollapsible {
|
|
9
|
-
background-color: var(--ifm-menu-color-background-active);
|
|
10
|
-
border-radius: var(--ifm-global-radius);
|
|
11
|
-
margin: 1rem 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
8
|
.tocCollapsibleButton {
|
|
15
9
|
font-size: inherit;
|
|
16
10
|
display: flex;
|
|
@@ -30,21 +24,6 @@
|
|
|
30
24
|
transition: transform var(--ifm-transition-fast);
|
|
31
25
|
}
|
|
32
26
|
|
|
33
|
-
.
|
|
34
|
-
border-left: none;
|
|
35
|
-
border-top: 1px solid var(--ifm-color-emphasis-300);
|
|
36
|
-
padding: 0.2rem 0;
|
|
37
|
-
font-size: 15px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.tocCollapsibleContent ul li {
|
|
41
|
-
margin: 0.4rem 0.8rem;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.tocCollapsibleContent a {
|
|
45
|
-
display: block;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.tocCollapsibleExpanded .tocCollapsibleButton::after {
|
|
27
|
+
.tocCollapsibleButtonExpanded::after {
|
|
49
28
|
transform: none;
|
|
50
29
|
}
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import Translate from '@docusaurus/Translate';
|
|
10
9
|
import {useCollapsible, Collapsible} from '@docusaurus/theme-common';
|
|
11
|
-
import styles from './
|
|
10
|
+
import styles from './index.module.css';
|
|
12
11
|
import TOCItems from '@theme/TOCItems';
|
|
12
|
+
import CollapseButton from '@theme/TOCCollapsible/CollapseButton';
|
|
13
13
|
export default function TOCCollapsible({
|
|
14
14
|
toc,
|
|
15
15
|
className,
|
|
@@ -26,17 +26,7 @@ export default function TOCCollapsible({
|
|
|
26
26
|
!collapsed && styles.tocCollapsibleExpanded,
|
|
27
27
|
className,
|
|
28
28
|
)}>
|
|
29
|
-
<
|
|
30
|
-
type="button"
|
|
31
|
-
className={clsx('clean-btn', styles.tocCollapsibleButton)}
|
|
32
|
-
onClick={toggleCollapsed}>
|
|
33
|
-
<Translate
|
|
34
|
-
id="theme.TOCCollapsible.toggleButtonLabel"
|
|
35
|
-
description="The label used by the button on the collapsible TOC component">
|
|
36
|
-
On this page
|
|
37
|
-
</Translate>
|
|
38
|
-
</button>
|
|
39
|
-
|
|
29
|
+
<CollapseButton collapsed={collapsed} onClick={toggleCollapsed} />
|
|
40
30
|
<Collapsible
|
|
41
31
|
lazy
|
|
42
32
|
className={styles.tocCollapsibleContent}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
.tocCollapsible {
|
|
9
|
+
background-color: var(--ifm-menu-color-background-active);
|
|
10
|
+
border-radius: var(--ifm-global-radius);
|
|
11
|
+
margin: 1rem 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tocCollapsibleContent > ul {
|
|
15
|
+
border-left: none;
|
|
16
|
+
border-top: 1px solid var(--ifm-color-emphasis-300);
|
|
17
|
+
padding: 0.2rem 0;
|
|
18
|
+
font-size: 15px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.tocCollapsibleContent ul li {
|
|
22
|
+
margin: 0.4rem 0.8rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tocCollapsibleContent a {
|
|
26
|
+
display: block;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.tocCollapsibleExpanded {
|
|
30
|
+
transform: none;
|
|
31
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
|
|
9
|
+
// Recursive component rendering the toc tree
|
|
10
|
+
|
|
11
|
+
/* eslint-disable jsx-a11y/control-has-associated-label */
|
|
12
|
+
function TOCItemTree({toc, className, linkClassName, isChild}) {
|
|
13
|
+
if (!toc.length) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<ul className={isChild ? undefined : className}>
|
|
19
|
+
{toc.map((heading) => (
|
|
20
|
+
<li key={heading.id}>
|
|
21
|
+
<a
|
|
22
|
+
href={`#${heading.id}`}
|
|
23
|
+
className={linkClassName ?? undefined} // Developer provided the HTML, so assume it's safe.
|
|
24
|
+
// eslint-disable-next-line react/no-danger
|
|
25
|
+
dangerouslySetInnerHTML={{
|
|
26
|
+
__html: heading.value,
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
<TOCItemTree
|
|
30
|
+
isChild
|
|
31
|
+
toc={heading.children}
|
|
32
|
+
className={className}
|
|
33
|
+
linkClassName={linkClassName}
|
|
34
|
+
/>
|
|
35
|
+
</li>
|
|
36
|
+
))}
|
|
37
|
+
</ul>
|
|
38
|
+
);
|
|
39
|
+
} // Memo only the tree root is enough
|
|
40
|
+
|
|
41
|
+
export default React.memo(TOCItemTree);
|
|
@@ -5,43 +5,12 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, {useMemo} from 'react';
|
|
8
|
+
import TOCItemTree from '@theme/TOCItems/Tree';
|
|
8
9
|
import {
|
|
9
10
|
useThemeConfig,
|
|
10
11
|
useTOCHighlight,
|
|
11
12
|
useFilteredAndTreeifiedTOC,
|
|
12
|
-
} from '@docusaurus/theme-common';
|
|
13
|
-
|
|
14
|
-
/* eslint-disable jsx-a11y/control-has-associated-label */
|
|
15
|
-
|
|
16
|
-
function TOCItemList({toc, className, linkClassName, isChild}) {
|
|
17
|
-
if (!toc.length) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<ul className={isChild ? undefined : className}>
|
|
23
|
-
{toc.map((heading) => (
|
|
24
|
-
<li key={heading.id}>
|
|
25
|
-
<a
|
|
26
|
-
href={`#${heading.id}`}
|
|
27
|
-
className={linkClassName ?? undefined} // Developer provided the HTML, so assume it's safe.
|
|
28
|
-
// eslint-disable-next-line react/no-danger
|
|
29
|
-
dangerouslySetInnerHTML={{
|
|
30
|
-
__html: heading.value,
|
|
31
|
-
}}
|
|
32
|
-
/>
|
|
33
|
-
<TOCItemList
|
|
34
|
-
isChild
|
|
35
|
-
toc={heading.children}
|
|
36
|
-
className={className}
|
|
37
|
-
linkClassName={linkClassName}
|
|
38
|
-
/>
|
|
39
|
-
</li>
|
|
40
|
-
))}
|
|
41
|
-
</ul>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
13
|
+
} from '@docusaurus/theme-common';
|
|
45
14
|
export default function TOCItems({
|
|
46
15
|
toc,
|
|
47
16
|
className = 'table-of-contents table-of-contents__left-border',
|
|
@@ -75,7 +44,7 @@ export default function TOCItems({
|
|
|
75
44
|
}, [linkClassName, linkActiveClassName, minHeadingLevel, maxHeadingLevel]);
|
|
76
45
|
useTOCHighlight(tocHighlightConfig);
|
|
77
46
|
return (
|
|
78
|
-
<
|
|
47
|
+
<TOCItemTree
|
|
79
48
|
toc={tocTree}
|
|
80
49
|
className={className}
|
|
81
50
|
linkClassName={linkClassName}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4930",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@docusaurus/core": "0.0.0-
|
|
25
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
28
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
29
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
30
|
-
"@docusaurus/utils": "0.0.0-
|
|
31
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
32
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
24
|
+
"@docusaurus/core": "0.0.0-4930",
|
|
25
|
+
"@docusaurus/plugin-content-blog": "0.0.0-4930",
|
|
26
|
+
"@docusaurus/plugin-content-docs": "0.0.0-4930",
|
|
27
|
+
"@docusaurus/plugin-content-pages": "0.0.0-4930",
|
|
28
|
+
"@docusaurus/theme-common": "0.0.0-4930",
|
|
29
|
+
"@docusaurus/theme-translations": "0.0.0-4930",
|
|
30
|
+
"@docusaurus/utils": "0.0.0-4930",
|
|
31
|
+
"@docusaurus/utils-common": "0.0.0-4930",
|
|
32
|
+
"@docusaurus/utils-validation": "0.0.0-4930",
|
|
33
33
|
"@mdx-js/react": "^1.6.22",
|
|
34
34
|
"clsx": "^1.1.1",
|
|
35
35
|
"copy-text-to-clipboard": "^3.0.1",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@babel/cli": "^7.17.6",
|
|
47
47
|
"@babel/core": "^7.17.9",
|
|
48
48
|
"@babel/preset-typescript": "^7.16.7",
|
|
49
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
50
|
-
"@docusaurus/types": "0.0.0-
|
|
49
|
+
"@docusaurus/module-type-aliases": "0.0.0-4930",
|
|
50
|
+
"@docusaurus/types": "0.0.0-4930",
|
|
51
51
|
"@types/mdx-js__react": "^1.5.5",
|
|
52
52
|
"@types/nprogress": "^0.2.0",
|
|
53
53
|
"@types/prismjs": "^1.26.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=14"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "947ca37c2d3c4dd3db699a91ec446c35795b1574"
|
|
68
68
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
.docMainContainer {
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (min-width: 997px) {
|
|
14
|
+
.docMainContainer {
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
max-width: calc(100% - var(--doc-sidebar-width));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.docMainContainerEnhanced {
|
|
20
|
+
max-width: calc(100% - var(--doc-sidebar-hidden-width));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.docItemWrapperEnhanced {
|
|
24
|
+
max-width: calc(
|
|
25
|
+
var(--ifm-container-width) + var(--doc-sidebar-width)
|
|
26
|
+
) !important;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -10,7 +10,7 @@ import React from 'react';
|
|
|
10
10
|
import {useDocsSidebar} from '@docusaurus/theme-common';
|
|
11
11
|
|
|
12
12
|
import clsx from 'clsx';
|
|
13
|
-
import styles from './
|
|
13
|
+
import styles from './Main.module.css';
|
|
14
14
|
import type {Props} from '@theme/DocPage/Layout/Main';
|
|
15
15
|
|
|
16
16
|
export default function DocPageLayoutMain({
|