@docusaurus/theme-classic 0.0.0-5005 → 0.0.0-5010
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-next/theme/DocPage/Layout/Sidebar/index.js +1 -1
- package/lib-next/theme/DocPage/Layout/Sidebar/{index.module.css → styles.module.css} +0 -0
- package/lib-next/theme/DocPage/Layout/index.js +1 -1
- package/lib-next/theme/DocPage/Layout/{index.module.css → styles.module.css} +0 -0
- package/lib-next/theme/DocSidebarItem/{Category.js → Category/index.js} +16 -16
- package/lib-next/theme/DocSidebarItem/{Html.js → Html/index.js} +1 -1
- package/lib-next/theme/DocSidebarItem/{Html.module.css → Html/styles.module.css} +0 -0
- package/lib-next/theme/DocSidebarItem/{Link.js → Link/index.js} +1 -1
- package/lib-next/theme/DocSidebarItem/{Link.module.css → Link/styles.module.css} +0 -0
- package/lib-next/theme/MDXComponents/{Img.js → Img/index.js} +1 -1
- package/lib-next/theme/MDXComponents/{Img.module.css → Img/styles.module.css} +0 -0
- package/lib-next/theme/TOCCollapsible/{CollapseButton.js → CollapseButton/index.js} +1 -1
- package/lib-next/theme/TOCCollapsible/{CollapseButton.module.css → CollapseButton/styles.module.css} +0 -0
- package/lib-next/theme/TOCCollapsible/index.js +1 -1
- package/lib-next/theme/TOCCollapsible/{index.module.css → styles.module.css} +0 -0
- package/package.json +13 -13
- package/src/theme/DocPage/Layout/Sidebar/index.tsx +1 -1
- package/src/theme/DocPage/Layout/Sidebar/{index.module.css → styles.module.css} +0 -0
- package/src/theme/DocPage/Layout/index.tsx +2 -3
- package/src/theme/DocPage/Layout/{index.module.css → styles.module.css} +0 -0
- package/src/theme/DocSidebarItem/{Category.tsx → Category/index.tsx} +13 -12
- package/src/theme/DocSidebarItem/{Html.tsx → Html/index.tsx} +1 -1
- package/src/theme/DocSidebarItem/{Html.module.css → Html/styles.module.css} +0 -0
- package/src/theme/DocSidebarItem/{Link.tsx → Link/index.tsx} +1 -1
- package/src/theme/DocSidebarItem/{Link.module.css → Link/styles.module.css} +0 -0
- package/src/theme/MDXComponents/{Img.tsx → Img/index.tsx} +2 -1
- package/src/theme/MDXComponents/{Img.module.css → Img/styles.module.css} +0 -0
- package/src/theme/TOCCollapsible/{CollapseButton.tsx → CollapseButton/index.tsx} +2 -1
- package/src/theme/TOCCollapsible/{CollapseButton.module.css → CollapseButton/styles.module.css} +0 -0
- package/src/theme/TOCCollapsible/index.tsx +2 -1
- /package/src/theme/TOCCollapsible/{index.module.css → styles.module.css} +0 -0
|
@@ -9,7 +9,7 @@ import DocSidebar from '@theme/DocSidebar';
|
|
|
9
9
|
import {useLocation} from '@docusaurus/router';
|
|
10
10
|
import ExpandButton from '@theme/DocPage/Layout/Sidebar/ExpandButton';
|
|
11
11
|
import clsx from 'clsx';
|
|
12
|
-
import styles from './
|
|
12
|
+
import styles from './styles.module.css';
|
|
13
13
|
import {ThemeClassNames, useDocsSidebar} from '@docusaurus/theme-common'; // Reset sidebar state when sidebar changes
|
|
14
14
|
// Use React key to unmount/remount the children
|
|
15
15
|
// See https://github.com/facebook/docusaurus/issues/3414
|
|
File without changes
|
|
@@ -9,8 +9,8 @@ import Layout from '@theme/Layout';
|
|
|
9
9
|
import BackToTopButton from '@theme/BackToTopButton';
|
|
10
10
|
import DocPageLayoutSidebar from '@theme/DocPage/Layout/Sidebar';
|
|
11
11
|
import DocPageLayoutMain from '@theme/DocPage/Layout/Main';
|
|
12
|
-
import styles from './index.module.css';
|
|
13
12
|
import {useDocsSidebar} from '@docusaurus/theme-common';
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
14
|
export default function DocPageLayout({children}) {
|
|
15
15
|
const sidebar = useDocsSidebar();
|
|
16
16
|
const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false);
|
|
File without changes
|
|
@@ -23,15 +23,15 @@ import DocSidebarItems from '@theme/DocSidebarItems';
|
|
|
23
23
|
import useIsBrowser from '@docusaurus/useIsBrowser'; // If we navigate to a category and it becomes active, it should automatically
|
|
24
24
|
// expand itself
|
|
25
25
|
|
|
26
|
-
function useAutoExpandActiveCategory({isActive, collapsed,
|
|
26
|
+
function useAutoExpandActiveCategory({isActive, collapsed, updateCollapsed}) {
|
|
27
27
|
const wasActive = usePrevious(isActive);
|
|
28
28
|
useEffect(() => {
|
|
29
29
|
const justBecameActive = isActive && !wasActive;
|
|
30
30
|
|
|
31
31
|
if (justBecameActive && collapsed) {
|
|
32
|
-
|
|
32
|
+
updateCollapsed(false);
|
|
33
33
|
}
|
|
34
|
-
}, [isActive, wasActive, collapsed,
|
|
34
|
+
}, [isActive, wasActive, collapsed, updateCollapsed]);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* When a collapsible category has no link, we still link it to its first child
|
|
@@ -88,6 +88,11 @@ export default function DocSidebarItemCategory({
|
|
|
88
88
|
...props
|
|
89
89
|
}) {
|
|
90
90
|
const {items, label, collapsible, className, href} = item;
|
|
91
|
+
const {
|
|
92
|
+
docs: {
|
|
93
|
+
sidebar: {autoCollapseCategories},
|
|
94
|
+
},
|
|
95
|
+
} = useThemeConfig();
|
|
91
96
|
const hrefWithSSRFallback = useCategoryHrefWithSSRFallback(item);
|
|
92
97
|
const isActive = isActiveSidebarItem(item, activePath);
|
|
93
98
|
const isCurrentPage = isSamePath(href, activePath);
|
|
@@ -102,23 +107,18 @@ export default function DocSidebarItemCategory({
|
|
|
102
107
|
return isActive ? false : item.collapsed;
|
|
103
108
|
},
|
|
104
109
|
});
|
|
105
|
-
|
|
106
|
-
isActive,
|
|
107
|
-
collapsed,
|
|
108
|
-
setCollapsed,
|
|
109
|
-
});
|
|
110
|
-
const {expandedItem, setExpandedItem} = useDocSidebarItemsExpandedState();
|
|
110
|
+
const {expandedItem, setExpandedItem} = useDocSidebarItemsExpandedState(); // Use this instead of `setCollapsed`, because it is also reactive
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
const updateCollapsed = (toCollapsed = !collapsed) => {
|
|
113
113
|
setExpandedItem(toCollapsed ? null : index);
|
|
114
114
|
setCollapsed(toCollapsed);
|
|
115
|
-
}
|
|
115
|
+
};
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
117
|
+
useAutoExpandActiveCategory({
|
|
118
|
+
isActive,
|
|
119
|
+
collapsed,
|
|
120
|
+
updateCollapsed,
|
|
121
|
+
});
|
|
122
122
|
useEffect(() => {
|
|
123
123
|
if (
|
|
124
124
|
collapsible &&
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
10
|
-
import styles from './
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
11
|
export default function DocSidebarItemHtml({item, level, index}) {
|
|
12
12
|
const {value, defaultStyle, className} = item;
|
|
13
13
|
return (
|
|
File without changes
|
|
@@ -10,7 +10,7 @@ import {isActiveSidebarItem, ThemeClassNames} from '@docusaurus/theme-common';
|
|
|
10
10
|
import Link from '@docusaurus/Link';
|
|
11
11
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
12
12
|
import IconExternalLink from '@theme/IconExternalLink';
|
|
13
|
-
import styles from './
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
14
|
export default function DocSidebarItemLink({
|
|
15
15
|
item,
|
|
16
16
|
onItemClick,
|
|
File without changes
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import styles from './Img.module.css';
|
|
9
8
|
import clsx from 'clsx';
|
|
9
|
+
import styles from './styles.module.css';
|
|
10
10
|
|
|
11
11
|
function transformImgClassName(className) {
|
|
12
12
|
return clsx(className, styles.img);
|
|
File without changes
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import Translate from '@docusaurus/Translate';
|
|
10
|
-
import styles from './
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
11
|
export default function TOCCollapsibleCollapseButton({collapsed, ...props}) {
|
|
12
12
|
return (
|
|
13
13
|
<button
|
package/lib-next/theme/TOCCollapsible/{CollapseButton.module.css → CollapseButton/styles.module.css}
RENAMED
|
File without changes
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import {useCollapsible, Collapsible} from '@docusaurus/theme-common';
|
|
10
|
-
import styles from './index.module.css';
|
|
11
10
|
import TOCItems from '@theme/TOCItems';
|
|
12
11
|
import CollapseButton from '@theme/TOCCollapsible/CollapseButton';
|
|
12
|
+
import styles from './styles.module.css';
|
|
13
13
|
export default function TOCCollapsible({
|
|
14
14
|
toc,
|
|
15
15
|
className,
|
|
File without changes
|
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-5010",
|
|
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-5010",
|
|
25
|
+
"@docusaurus/plugin-content-blog": "0.0.0-5010",
|
|
26
|
+
"@docusaurus/plugin-content-docs": "0.0.0-5010",
|
|
27
|
+
"@docusaurus/plugin-content-pages": "0.0.0-5010",
|
|
28
|
+
"@docusaurus/theme-common": "0.0.0-5010",
|
|
29
|
+
"@docusaurus/theme-translations": "0.0.0-5010",
|
|
30
|
+
"@docusaurus/utils": "0.0.0-5010",
|
|
31
|
+
"@docusaurus/utils-common": "0.0.0-5010",
|
|
32
|
+
"@docusaurus/utils-validation": "0.0.0-5010",
|
|
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.10",
|
|
47
47
|
"@babel/core": "^7.17.10",
|
|
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-5010",
|
|
50
|
+
"@docusaurus/types": "0.0.0-5010",
|
|
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": "d4c0feac2c3c1cd9853af197a8a539832700e541"
|
|
68
68
|
}
|
|
@@ -12,7 +12,7 @@ import type {Props} from '@theme/DocPage/Layout/Sidebar';
|
|
|
12
12
|
import ExpandButton from '@theme/DocPage/Layout/Sidebar/ExpandButton';
|
|
13
13
|
|
|
14
14
|
import clsx from 'clsx';
|
|
15
|
-
import styles from './
|
|
15
|
+
import styles from './styles.module.css';
|
|
16
16
|
|
|
17
17
|
import {ThemeClassNames, useDocsSidebar} from '@docusaurus/theme-common';
|
|
18
18
|
|
|
File without changes
|
|
@@ -11,11 +11,10 @@ import BackToTopButton from '@theme/BackToTopButton';
|
|
|
11
11
|
import type {Props} from '@theme/DocPage/Layout';
|
|
12
12
|
import DocPageLayoutSidebar from '@theme/DocPage/Layout/Sidebar';
|
|
13
13
|
import DocPageLayoutMain from '@theme/DocPage/Layout/Main';
|
|
14
|
-
|
|
15
|
-
import styles from './index.module.css';
|
|
16
|
-
|
|
17
14
|
import {useDocsSidebar} from '@docusaurus/theme-common';
|
|
18
15
|
|
|
16
|
+
import styles from './styles.module.css';
|
|
17
|
+
|
|
19
18
|
export default function DocPageLayout({children}: Props): JSX.Element {
|
|
20
19
|
const sidebar = useDocsSidebar();
|
|
21
20
|
const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false);
|
|
File without changes
|
|
@@ -31,19 +31,19 @@ import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
|
31
31
|
function useAutoExpandActiveCategory({
|
|
32
32
|
isActive,
|
|
33
33
|
collapsed,
|
|
34
|
-
|
|
34
|
+
updateCollapsed,
|
|
35
35
|
}: {
|
|
36
36
|
isActive: boolean;
|
|
37
37
|
collapsed: boolean;
|
|
38
|
-
|
|
38
|
+
updateCollapsed: (b: boolean) => void;
|
|
39
39
|
}) {
|
|
40
40
|
const wasActive = usePrevious(isActive);
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
const justBecameActive = isActive && !wasActive;
|
|
43
43
|
if (justBecameActive && collapsed) {
|
|
44
|
-
|
|
44
|
+
updateCollapsed(false);
|
|
45
45
|
}
|
|
46
|
-
}, [isActive, wasActive, collapsed,
|
|
46
|
+
}, [isActive, wasActive, collapsed, updateCollapsed]);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
@@ -105,6 +105,11 @@ export default function DocSidebarItemCategory({
|
|
|
105
105
|
...props
|
|
106
106
|
}: Props): JSX.Element {
|
|
107
107
|
const {items, label, collapsible, className, href} = item;
|
|
108
|
+
const {
|
|
109
|
+
docs: {
|
|
110
|
+
sidebar: {autoCollapseCategories},
|
|
111
|
+
},
|
|
112
|
+
} = useThemeConfig();
|
|
108
113
|
const hrefWithSSRFallback = useCategoryHrefWithSSRFallback(item);
|
|
109
114
|
|
|
110
115
|
const isActive = isActiveSidebarItem(item, activePath);
|
|
@@ -121,17 +126,13 @@ export default function DocSidebarItemCategory({
|
|
|
121
126
|
},
|
|
122
127
|
});
|
|
123
128
|
|
|
124
|
-
useAutoExpandActiveCategory({isActive, collapsed, setCollapsed});
|
|
125
129
|
const {expandedItem, setExpandedItem} = useDocSidebarItemsExpandedState();
|
|
126
|
-
|
|
130
|
+
// Use this instead of `setCollapsed`, because it is also reactive
|
|
131
|
+
const updateCollapsed = (toCollapsed: boolean = !collapsed) => {
|
|
127
132
|
setExpandedItem(toCollapsed ? null : index);
|
|
128
133
|
setCollapsed(toCollapsed);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
docs: {
|
|
132
|
-
sidebar: {autoCollapseCategories},
|
|
133
|
-
},
|
|
134
|
-
} = useThemeConfig();
|
|
134
|
+
};
|
|
135
|
+
useAutoExpandActiveCategory({isActive, collapsed, updateCollapsed});
|
|
135
136
|
useEffect(() => {
|
|
136
137
|
if (
|
|
137
138
|
collapsible &&
|
|
@@ -10,7 +10,7 @@ import clsx from 'clsx';
|
|
|
10
10
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
11
11
|
import type {Props} from '@theme/DocSidebarItem/Html';
|
|
12
12
|
|
|
13
|
-
import styles from './
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
14
|
|
|
15
15
|
export default function DocSidebarItemHtml({
|
|
16
16
|
item,
|
|
File without changes
|
|
@@ -14,7 +14,7 @@ import IconExternalLink from '@theme/IconExternalLink';
|
|
|
14
14
|
|
|
15
15
|
import type {Props} from '@theme/DocSidebarItem/Link';
|
|
16
16
|
|
|
17
|
-
import styles from './
|
|
17
|
+
import styles from './styles.module.css';
|
|
18
18
|
|
|
19
19
|
export default function DocSidebarItemLink({
|
|
20
20
|
item,
|
|
File without changes
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import type {Props} from '@theme/MDXComponents/Img';
|
|
10
|
-
import styles from './Img.module.css';
|
|
11
10
|
import clsx from 'clsx';
|
|
12
11
|
|
|
12
|
+
import styles from './styles.module.css';
|
|
13
|
+
|
|
13
14
|
function transformImgClassName(className?: string): string {
|
|
14
15
|
return clsx(className, styles.img);
|
|
15
16
|
}
|
|
File without changes
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import Translate from '@docusaurus/Translate';
|
|
11
|
-
import styles from './CollapseButton.module.css';
|
|
12
11
|
import type {Props} from '@theme/TOCCollapsible/CollapseButton';
|
|
13
12
|
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
|
+
|
|
14
15
|
export default function TOCCollapsibleCollapseButton({
|
|
15
16
|
collapsed,
|
|
16
17
|
...props
|
package/src/theme/TOCCollapsible/{CollapseButton.module.css → CollapseButton/styles.module.css}
RENAMED
|
File without changes
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import {useCollapsible, Collapsible} from '@docusaurus/theme-common';
|
|
11
|
-
import styles from './index.module.css';
|
|
12
11
|
import TOCItems from '@theme/TOCItems';
|
|
13
12
|
import type {Props} from '@theme/TOCCollapsible';
|
|
14
13
|
import CollapseButton from '@theme/TOCCollapsible/CollapseButton';
|
|
15
14
|
|
|
15
|
+
import styles from './styles.module.css';
|
|
16
|
+
|
|
16
17
|
export default function TOCCollapsible({
|
|
17
18
|
toc,
|
|
18
19
|
className,
|
|
File without changes
|